Skip to content

Commit

Permalink
fix(app): adapt app bar title size dependent on content
Browse files Browse the repository at this point in the history
  • Loading branch information
tamslo committed Dec 29, 2023
1 parent 27fcf87 commit dead5b5
Showing 1 changed file with 15 additions and 12 deletions.
27 changes: 15 additions & 12 deletions app/lib/common/widgets/page_scaffold.dart
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
import '../module.dart';

Text buildTitle(String text) {
return Text(text, style: PharMeTheme.textTheme.headlineLarge);
Widget buildTitle(String text) {
return FittedBox(
fit: BoxFit.fitWidth,
child: Text(text, style: PharMeTheme.textTheme.headlineLarge),
);
}

AppBar? buildBarBottom(String? barBottom) {
Expand Down Expand Up @@ -65,16 +68,16 @@ Scaffold unscrollablePageScaffold({
final appBar = title == null
? null
: AppBar(
backgroundColor: PharMeTheme.appBarTheme.backgroundColor,
foregroundColor: PharMeTheme.appBarTheme.foregroundColor,
elevation: PharMeTheme.appBarTheme.elevation,
leadingWidth: PharMeTheme.appBarTheme.leadingWidth,
centerTitle: PharMeTheme.appBarTheme.centerTitle,
title: buildTitle(title),
actions: actions,
bottom: buildBarBottom(barBottom),
scrolledUnderElevation: 0,
);
backgroundColor: PharMeTheme.appBarTheme.backgroundColor,
foregroundColor: PharMeTheme.appBarTheme.foregroundColor,
elevation: PharMeTheme.appBarTheme.elevation,
leadingWidth: PharMeTheme.appBarTheme.leadingWidth,
centerTitle: PharMeTheme.appBarTheme.centerTitle,
title: buildTitle(title),
actions: actions,
bottom: buildBarBottom(barBottom),
scrolledUnderElevation: 0,
);
return Scaffold(
key: key,
appBar: appBar,
Expand Down

0 comments on commit dead5b5

Please sign in to comment.