From dead5b5c30dc721c81296570547bf648764da45e Mon Sep 17 00:00:00 2001 From: Tamara Slosarek Date: Fri, 29 Dec 2023 17:48:11 +0100 Subject: [PATCH] fix(app): adapt app bar title size dependent on content --- app/lib/common/widgets/page_scaffold.dart | 27 +++++++++++++---------- 1 file changed, 15 insertions(+), 12 deletions(-) diff --git a/app/lib/common/widgets/page_scaffold.dart b/app/lib/common/widgets/page_scaffold.dart index 3c358a36..2bc3d41b 100644 --- a/app/lib/common/widgets/page_scaffold.dart +++ b/app/lib/common/widgets/page_scaffold.dart @@ -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) { @@ -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,