Skip to content

Commit

Permalink
feat(app): add "back to app" button to edit medications
Browse files Browse the repository at this point in the history
  • Loading branch information
tamara-slosarek authored and tamslo committed Jan 13, 2025
1 parent 4b8db38 commit 356380c
Showing 1 changed file with 15 additions and 7 deletions.
22 changes: 15 additions & 7 deletions app/lib/drug_selection/pages/drug_selection.dart
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ class DrugSelectionPage extends HookWidget {
),
),
Expanded(child: _buildDrugList(context, state)),
if (concludesOnboarding) _buildButton(context, state),
_buildButton(context, state),
],
),
);
Expand All @@ -61,18 +61,26 @@ class DrugSelectionPage extends HookWidget {
}

Widget _buildButton(BuildContext context, DrugSelectionState state) {
return Padding(
padding: EdgeInsets.all(PharMeTheme.mediumSpace),
child: FullWidthButton(
context.l10n.action_proceed_to_app,
() async {
final buttonText = concludesOnboarding
? context.l10n.action_proceed_to_app
: context.l10n.action_back_to_app;
final onButtonPressed = concludesOnboarding
? () async {
MetaData.instance.initialDrugSelectionDone = true;
await MetaData.save();
// ignore: use_build_context_synchronously
await context.router.push(
MainRoute(),
);
},
}
: () {
context.router.maybePop();
};
return Padding(
padding: EdgeInsets.all(PharMeTheme.mediumSpace),
child: FullWidthButton(
buttonText,
onButtonPressed,
enabled: _isEditable(state),
)
);
Expand Down

0 comments on commit 356380c

Please sign in to comment.