diff --git a/app/lib/common/widgets/page_scaffold.dart b/app/lib/common/widgets/page_scaffold.dart index 38c34947..f2428513 100644 --- a/app/lib/common/widgets/page_scaffold.dart +++ b/app/lib/common/widgets/page_scaffold.dart @@ -1,6 +1,10 @@ import '../../drug/widgets/tooltip_icon.dart'; import '../module.dart'; +double? _getTitleSpacing({required bool backButtonPresent}) { + return backButtonPresent ? 0 : null; +} + EdgeInsets pagePadding() => EdgeInsets.only( left: PharMeTheme.defaultPagePadding, right: PharMeTheme.defaultPagePadding, @@ -12,7 +16,7 @@ Widget buildTitle(String text, { String? tooltipText }) { child: Row( crossAxisAlignment: CrossAxisAlignment.center, children: [ - Text(text, style: PharMeTheme.textTheme.headlineLarge), + Text(text, style: PharMeTheme.textTheme.headlineMedium), if (tooltipText.isNotNullOrBlank) Padding( padding: EdgeInsets.only(left: PharMeTheme.smallSpace), child: TooltipIcon( @@ -30,6 +34,7 @@ Scaffold pageScaffold({ required List body, List? actions, Key? key, + bool canNavigateBack = true, }) { return Scaffold( key: key, @@ -40,12 +45,14 @@ Scaffold pageScaffold({ foregroundColor: PharMeTheme.appBarTheme.foregroundColor, elevation: PharMeTheme.appBarTheme.elevation, leadingWidth: PharMeTheme.appBarTheme.leadingWidth, + automaticallyImplyLeading: canNavigateBack, floating: true, pinned: true, snap: false, centerTitle: PharMeTheme.appBarTheme.centerTitle, title: buildTitle(title), actions: actions, + titleSpacing: _getTitleSpacing(backButtonPresent: canNavigateBack), ), SliverPadding( padding: pagePadding(), @@ -61,7 +68,7 @@ Scaffold unscrollablePageScaffold({ String? titleTooltip, List? actions, Widget? drawer, - bool automaticallyImplyLeading = true, + bool canNavigateBack = true, Key? key, }) { final appBar = title == null @@ -71,11 +78,12 @@ Scaffold unscrollablePageScaffold({ foregroundColor: PharMeTheme.appBarTheme.foregroundColor, elevation: PharMeTheme.appBarTheme.elevation, leadingWidth: PharMeTheme.appBarTheme.leadingWidth, - automaticallyImplyLeading: automaticallyImplyLeading, + automaticallyImplyLeading: canNavigateBack, centerTitle: PharMeTheme.appBarTheme.centerTitle, title: buildTitle(title, tooltipText: titleTooltip), actions: actions, scrolledUnderElevation: 0, + titleSpacing: _getTitleSpacing(backButtonPresent: canNavigateBack), ); return Scaffold( key: key, diff --git a/app/lib/drug_selection/pages/drug_selection.dart b/app/lib/drug_selection/pages/drug_selection.dart index 92411130..cbe93c94 100644 --- a/app/lib/drug_selection/pages/drug_selection.dart +++ b/app/lib/drug_selection/pages/drug_selection.dart @@ -31,6 +31,7 @@ class DrugSelectionPage extends HookWidget { } return unscrollablePageScaffold( title: context.l10n.drug_selection_header, + canNavigateBack: !concludesOnboarding, body: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ diff --git a/app/lib/faq/pages/faq.dart b/app/lib/faq/pages/faq.dart index b9fad095..9c577399 100644 --- a/app/lib/faq/pages/faq.dart +++ b/app/lib/faq/pages/faq.dart @@ -9,28 +9,31 @@ class FaqPage extends StatelessWidget { Widget build(BuildContext context) { return PopScope( canPop: false, - child: pageScaffold(title: context.l10n.tab_faq, body: [ - Padding( - padding: const EdgeInsets.all(PharMeTheme.smallSpace), - child: Column( - key: Key('questionsColumn'), - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - SizedBox(height: 8), - ...faqContent.flatMap((faqSection) => - _buildTopic(context, faqSection)), - ..._buildTopicHeader( - context.l10n.more_page_contact_us, - addSpace: true, - ), - _buildQuestionCard( - child: ListTile( - title: Text(context.l10n.faq_contact_us), - trailing: Icon(Icons.chevron_right_rounded), - iconColor: PharMeTheme.iconColor, - onTap: () => sendEmail(context), - ) - ), + child: pageScaffold( + title: context.l10n.tab_faq, + canNavigateBack: false, + body: [ + Padding( + padding: const EdgeInsets.all(PharMeTheme.smallSpace), + child: Column( + key: Key('questionsColumn'), + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + SizedBox(height: 8), + ...faqContent.flatMap((faqSection) => + _buildTopic(context, faqSection)), + ..._buildTopicHeader( + context.l10n.more_page_contact_us, + addSpace: true, + ), + _buildQuestionCard( + child: ListTile( + title: Text(context.l10n.faq_contact_us), + trailing: Icon(Icons.chevron_right_rounded), + iconColor: PharMeTheme.iconColor, + onTap: () => sendEmail(context), + ) + ), ], ), ), diff --git a/app/lib/more/pages/more.dart b/app/lib/more/pages/more.dart index 75698019..ca4e9a6d 100644 --- a/app/lib/more/pages/more.dart +++ b/app/lib/more/pages/more.dart @@ -11,6 +11,7 @@ class MorePage extends StatelessWidget { canPop: false, child: pageScaffold( title: context.l10n.tab_more, + canNavigateBack: false, body: [ SubheaderDivider( text: context.l10n.more_page_account_settings, diff --git a/app/lib/report/pages/report.dart b/app/lib/report/pages/report.dart index b90385cd..057e5fd7 100644 --- a/app/lib/report/pages/report.dart +++ b/app/lib/report/pages/report.dart @@ -67,6 +67,7 @@ class ReportPage extends StatelessWidget { canPop: false, child: unscrollablePageScaffold( title: context.l10n.tab_report, + canNavigateBack: false, titleTooltip: context.l10n.report_page_faq_tooltip, body: Column( crossAxisAlignment: CrossAxisAlignment.start, diff --git a/app/lib/search/pages/search.dart b/app/lib/search/pages/search.dart index 0423c30d..eb8e9028 100644 --- a/app/lib/search/pages/search.dart +++ b/app/lib/search/pages/search.dart @@ -23,6 +23,7 @@ class SearchPage extends HookWidget { canPop: false, child: unscrollablePageScaffold( title: context.l10n.tab_drugs, + canNavigateBack: false, body: DrugSearch( key: Key('drug-search'), showFilter: true, @@ -39,7 +40,6 @@ class SearchPage extends HookWidget { activeDrugs, useDrugClass: useDrugClass, ), - automaticallyImplyLeading: false, // do not show leading "menu" icon ), ), );