diff --git a/app/lib/common/widgets/dialog_wrapper.dart b/app/lib/common/widgets/dialog_wrapper.dart index b710f4d6..d1eeef02 100644 --- a/app/lib/common/widgets/dialog_wrapper.dart +++ b/app/lib/common/widgets/dialog_wrapper.dart @@ -3,12 +3,12 @@ import '../module.dart'; class DialogWrapper extends StatelessWidget { const DialogWrapper({ super.key, - required this.title, - required this.content, required this.actions, + this.title, + this.content, }); - final String title; + final String? title; final Widget? content; final List actions; @@ -22,7 +22,7 @@ class DialogWrapper extends StatelessWidget { ) : content; return AlertDialog.adaptive( - title: Text(title), + title: title != null ? Text(title!) : null, content: materialContent, actions: actions, elevation: 0, diff --git a/app/lib/drug_selection/pages/drug_selection.dart b/app/lib/drug_selection/pages/drug_selection.dart index 1e38b865..ac0a997e 100644 --- a/app/lib/drug_selection/pages/drug_selection.dart +++ b/app/lib/drug_selection/pages/drug_selection.dart @@ -38,9 +38,7 @@ class DrugSelectionPage extends HookWidget { Padding( padding: EdgeInsets.symmetric(vertical: PharMeTheme.smallSpace), child: PageDescription.fromText( - concludesOnboarding - ? context.l10n.drug_selection_onboarding_description - : context.l10n.drug_selection_settings_description, + context.l10n.drug_selection_settings_description, ), ), Expanded(child: _buildDrugList(context, state)), @@ -67,10 +65,28 @@ class DrugSelectionPage extends HookWidget { child: FullWidthButton( context.l10n.action_continue, () async { - MetaData.instance.initialDrugSelectionDone = true; - await MetaData.save(); - // ignore: use_build_context_synchronously - await overwriteRoutes(context, nextPage: MainRoute()); + await showAdaptiveDialog( + context: context, + builder: (context) => DialogWrapper( + content: Text(context.l10n.drug_selection_continue_warning), + actions: [ + DialogAction( + onPressed: context.router.root.maybePop, + text: context.l10n.action_cancel, + ), + DialogAction( + onPressed: () async { + MetaData.instance.initialDrugSelectionDone = true; + await MetaData.save(); + // ignore: use_build_context_synchronously + await overwriteRoutes(context, nextPage: MainRoute()); + }, + text: context.l10n.action_understood, + isDefault: true, + ), + ], + ), + ); }, enabled: _isEditable(state), ) diff --git a/app/lib/l10n/app_en.arb b/app/lib/l10n/app_en.arb index 302a5b3f..c03d069f 100644 --- a/app/lib/l10n/app_en.arb +++ b/app/lib/l10n/app_en.arb @@ -32,7 +32,7 @@ "drug_item_brand_names": "Brand names", "drug_selection_header": "Current medications", - "drug_selection_onboarding_description": "Please review the medications you are currently taking below and update them if needed. You can always change the status for a medication later on a medication page or in the settings.", + "drug_selection_continue_warning": "If you continue, you will complete the initial setup and will not be able to come back to this page. You can always change the status for a medication later in the app.", "drug_selection_settings_description": "Review the medications you are currently taking below.", "drug_selection_no_drugs_loaded": "No medications loaded",