Skip to content

Commit

Permalink
feat(#683): tab root pages will not pop scope
Browse files Browse the repository at this point in the history
  • Loading branch information
tamslo committed Dec 8, 2023
1 parent 4b1d155 commit 50f7649
Show file tree
Hide file tree
Showing 4 changed files with 108 additions and 96 deletions.
41 changes: 22 additions & 19 deletions app/lib/faq/pages/faq.dart
Original file line number Diff line number Diff line change
Expand Up @@ -6,26 +6,29 @@ class FaqPage extends StatelessWidget {

@override
Widget build(BuildContext context) {
return pageScaffold(title: context.l10n.tab_faq, body: [
Padding(
padding: const EdgeInsets.all(8),
child: Column(
key: Key('questionsColumn'),
children: [
SizedBox(height: 8),
...faqList.keys.fold<List<Widget>>(
[], (widgets, topic) =>
[...widgets, ..._buildTopic(context, topic, faqList[topic]!)]
),
Divider(),
ListTile(
title: Text(context.l10n.faq_contact_us),
trailing: Icon(Icons.chevron_right_rounded),
onTap: sendEmail)
],
return WillPopScope(
child: pageScaffold(title: context.l10n.tab_faq, body: [
Padding(
padding: const EdgeInsets.all(8),
child: Column(
key: Key('questionsColumn'),
children: [
SizedBox(height: 8),
...faqList.keys.fold<List<Widget>>(
[], (widgets, topic) =>
[...widgets, ..._buildTopic(context, topic, faqList[topic]!)]
),
Divider(),
ListTile(
title: Text(context.l10n.faq_contact_us),
trailing: Icon(Icons.chevron_right_rounded),
onTap: sendEmail)
],
),
),
),
]);
]),
onWillPop: () async => false,
);
}

List<Widget> _buildTopic(
Expand Down
39 changes: 21 additions & 18 deletions app/lib/report/pages/report.dart
Original file line number Diff line number Diff line change
Expand Up @@ -25,24 +25,27 @@ class ReportPage extends StatelessWidget {
lookupkey: notTestedString
)
);
return unscrollablePageScaffold(
title: context.l10n.tab_report,
barBottom: context.l10n.report_content_explanation,
body: Column(
children: [
scrollList(
userPhenotypes.map((phenotype) =>
Column(
key: Key('gene-card-${phenotype.geneSymbol}'),
children: [
GeneCard(phenotype),
SizedBox(height: 8)
]
)
).toList()),
if (hasActiveInhibitors) drugInteractionExplanation(context),
]
)
return WillPopScope(
child: unscrollablePageScaffold(
title: context.l10n.tab_report,
barBottom: context.l10n.report_content_explanation,
body: Column(
children: [
scrollList(
userPhenotypes.map((phenotype) =>
Column(
key: Key('gene-card-${phenotype.geneSymbol}'),
children: [
GeneCard(phenotype),
SizedBox(height: 8)
]
)
).toList()),
if (hasActiveInhibitors) drugInteractionExplanation(context),
]
)
),
onWillPop: () async => false,
);
}

Expand Down
17 changes: 10 additions & 7 deletions app/lib/search/pages/search.dart
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,17 @@ class SearchPage extends HookWidget {
await cubit.loadDrugs(useCache: false);
}
});
return unscrollablePageScaffold(
title: context.l10n.tab_drugs,
body: DrugSearch(
showFilter: true,
buildDrugItems: buildDrugCards,
cubit: cubit,
showDrugInteractionIndicator: true,
return WillPopScope(
child: unscrollablePageScaffold(
title: context.l10n.tab_drugs,
body: DrugSearch(
showFilter: true,
buildDrugItems: buildDrugCards,
cubit: cubit,
showDrugInteractionIndicator: true,
),
),
onWillPop: () async => false,
);
}
}
107 changes: 55 additions & 52 deletions app/lib/settings/pages/settings.dart
Original file line number Diff line number Diff line change
Expand Up @@ -7,63 +7,66 @@ class SettingsPage extends StatelessWidget {

@override
Widget build(BuildContext context) {
return pageScaffold(title: context.l10n.tab_more, body: [
ListTile(
title: Text(
context.l10n.settings_page_account_settings,
style: PharMeTheme.textTheme.bodyMedium,
return WillPopScope(
child: pageScaffold(title: context.l10n.tab_more, body: [
ListTile(
title: Text(
context.l10n.settings_page_account_settings,
style: PharMeTheme.textTheme.bodyMedium,
),
dense: true,
),
ListTile(
title: Text(context.l10n.drug_selection_header),
trailing: Icon(Icons.chevron_right_rounded),
onTap: () => context.router.push(
DrugSelectionRouter(concludesOnboarding: false)
),
),
ListTile(
title: Text(context.l10n.settings_page_delete_data),
trailing: Icon(Icons.chevron_right_rounded),
onTap: () => showDialog(
context: context,
builder: (_) => DeleteDataDialog(),
),
),
dense: true,
),
ListTile(
title: Text(context.l10n.drug_selection_header),
trailing: Icon(Icons.chevron_right_rounded),
onTap: () => context.router.push(
DrugSelectionRouter(concludesOnboarding: false)
Divider(),
ListTile(
title: Text(
context.l10n.settings_page_more,
style: PharMeTheme.textTheme.bodyMedium,
),
dense: true,
),
),
ListTile(
title: Text(context.l10n.settings_page_delete_data),
trailing: Icon(Icons.chevron_right_rounded),
onTap: () => showDialog(
context: context,
builder: (_) => DeleteDataDialog(),
ListTile(
title: Text(context.l10n.settings_page_onboarding),
trailing: Icon(Icons.chevron_right_rounded),
onTap: () => context.router.push(OnboardingRouter(isRevisiting: true)),
),
),
Divider(),
ListTile(
title: Text(
context.l10n.settings_page_more,
style: PharMeTheme.textTheme.bodyMedium,
ListTile(
title: Text(context.l10n.settings_page_about_us),
trailing: Icon(Icons.chevron_right_rounded),
onTap: () => context.router.push(AboutUsRoute()),
),
dense: true,
),
ListTile(
title: Text(context.l10n.settings_page_onboarding),
trailing: Icon(Icons.chevron_right_rounded),
onTap: () => context.router.push(OnboardingRouter(isRevisiting: true)),
),
ListTile(
title: Text(context.l10n.settings_page_about_us),
trailing: Icon(Icons.chevron_right_rounded),
onTap: () => context.router.push(AboutUsRoute()),
),
ListTile(
title: Text(context.l10n.settings_page_privacy_policy),
trailing: Icon(Icons.chevron_right_rounded),
onTap: () => context.router.push(PrivacyPolicyRoute()),
),
ListTile(
title: Text(context.l10n.settings_page_terms_and_conditions),
trailing: Icon(Icons.chevron_right_rounded),
onTap: () => context.router.push(TermsAndConditionsRoute()),
),
Divider(),
ListTile(
title: Text(context.l10n.settings_page_contact_us),
ListTile(
title: Text(context.l10n.settings_page_privacy_policy),
trailing: Icon(Icons.chevron_right_rounded),
onTap: sendEmail)
]);
onTap: () => context.router.push(PrivacyPolicyRoute()),
),
ListTile(
title: Text(context.l10n.settings_page_terms_and_conditions),
trailing: Icon(Icons.chevron_right_rounded),
onTap: () => context.router.push(TermsAndConditionsRoute()),
),
Divider(),
ListTile(
title: Text(context.l10n.settings_page_contact_us),
trailing: Icon(Icons.chevron_right_rounded),
onTap: sendEmail)
]),
onWillPop: () async => false,
);
}
}

Expand Down

0 comments on commit 50f7649

Please sign in to comment.