Skip to content

Commit

Permalink
feat(#683): only continue from drug selection if onboarding
Browse files Browse the repository at this point in the history
  • Loading branch information
tamslo committed Dec 8, 2023
1 parent 236c1f1 commit ddaf2c8
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 9 deletions.
20 changes: 13 additions & 7 deletions app/lib/drug_selection/pages/drug_selection.dart
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,12 @@ import 'cubit.dart';
class DrugSelectionPage extends HookWidget {
const DrugSelectionPage({
Key? key,
this.concludesOnboarding = false,
@visibleForTesting this.cubit,
}) : super(key: key);

final DrugSelectionPageCubit? cubit;
final bool concludesOnboarding;

@override
Widget build(BuildContext context) {
Expand All @@ -24,13 +26,14 @@ class DrugSelectionPage extends HookWidget {
builder: (context, state) {
return unscrollablePageScaffold(
title: context.l10n.drug_selection_header,
barBottom: context.l10n.drug_selection_description,
barBottom: concludesOnboarding
? context.l10n.drug_selection_onboarding_description
: null,
padding: PharMeTheme.largeSpace,
body: Column(
children: [
Expanded(child: _buildDrugList(context, state)),
SizedBox(height: PharMeTheme.mediumSpace),
_buildButton(context, state),
if (concludesOnboarding) _buildButton(context, state),
],
),
);
Expand All @@ -48,10 +51,13 @@ class DrugSelectionPage extends HookWidget {
}

Widget _buildButton(BuildContext context, DrugSelectionPageState state) {
return FullWidthButton(
context.l10n.action_continue,
() => overwriteRoutes(context, nextPage: MainRoute()),
enabled: _isEditable(state),
return Padding(
padding: EdgeInsets.only(top: PharMeTheme.mediumSpace),
child: FullWidthButton(
context.l10n.action_continue,
() => overwriteRoutes(context, nextPage: MainRoute()),
enabled: _isEditable(state),
)
);
}

Expand Down
2 changes: 1 addition & 1 deletion app/lib/l10n/app_en.arb
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"auth_success": "Successfully imported data",

"drug_selection_header": "Select active drugs",
"drug_selection_description": "Please update the drugs you are currently taking below. You can always change the status for a drug later on a drug page or in the settings.",
"drug_selection_onboarding_description": "Please update which drugs you are currently taking below. You can always change the status for a drug later on a drug page or in the settings.",
"drug_selection_no_drugs_loaded": "No drugs loaded",
"drug_selection_subheader_active_drugs": "Active drugs",
"drug_selection_subheader_all_drugs": "All drugs",
Expand Down
4 changes: 3 additions & 1 deletion app/lib/login/pages/login.dart
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,9 @@ class LoginPage extends HookWidget {
return _buildColumnWrapper(
action: () => overwriteRoutes(
context,
nextPage: OnboardingRouter(nextPage: DrugSelectionRouter()),
nextPage: OnboardingRouter(
nextPage: DrugSelectionRouter(concludesOnboarding: true)
),
),
actionText: context.l10n.general_continue,
children: [
Expand Down

0 comments on commit ddaf2c8

Please sign in to comment.