Skip to content

Commit

Permalink
feat(app): add puzzle piece analogy
Browse files Browse the repository at this point in the history
  • Loading branch information
tamslo committed Nov 29, 2024
1 parent 828ab91 commit e2aae73
Show file tree
Hide file tree
Showing 4 changed files with 35 additions and 26 deletions.
17 changes: 11 additions & 6 deletions app/lib/drug/widgets/annotation_cards/disclaimer.dart
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import 'package:font_awesome_flutter/font_awesome_flutter.dart';

import '../../../common/module.dart';

class Disclaimer extends StatelessWidget {
Expand Down Expand Up @@ -34,16 +36,19 @@ class Disclaimer extends StatelessWidget {
text: context.l10n.drugs_page_disclaimer_text_part_0,
style: TextStyle(fontWeight: FontWeight.w500),
),
if (userGuideline != null) TextSpan(
TextSpan(
children: [
TextSpan(text: '\n\n'),
TextSpan(text: context.l10n.drugs_page_disclaimer_text_part_1),
WidgetSpan(
child: Icon(
FontAwesomeIcons.puzzlePiece,
size: PharMeTheme.mediumSpace,
color: PharMeTheme.onSurfaceText,
),
),
TextSpan(text: ' '),
TextSpan(text: context.l10n.drugs_page_disclaimer_text_part_2),
TextSpan(text: context.l10n.onboarding_1_disclaimer),
],
style: PharMeTheme.textTheme.labelMedium!.copyWith(
fontWeight: FontWeight.w300,
),
)
]),
),
Expand Down
6 changes: 3 additions & 3 deletions app/lib/drug/widgets/annotation_cards/guideline.dart
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,10 @@ class GuidelineAnnotationCard extends StatelessWidget {
..._buildHeader(context),
SizedBox(height: PharMeTheme.mediumSpace),
_buildCard(context),
SizedBox(height: PharMeTheme.mediumSpace),
SizedBox(height: PharMeTheme.smallSpace),
_buildSourcesSection(context),
SizedBox(height: PharMeTheme.smallSpace),
Disclaimer(userGuideline: drug.userGuideline),
]
else ...[
..._buildHeader(context),
Expand Down Expand Up @@ -108,8 +110,6 @@ class GuidelineAnnotationCard extends StatelessWidget {
]),
),
],
SizedBox(height: PharMeTheme.smallToMediumSpace),
Disclaimer(userGuideline: drug.userGuideline),
]
)
);
Expand Down
8 changes: 2 additions & 6 deletions app/lib/l10n/app_en.arb
Original file line number Diff line number Diff line change
Expand Up @@ -133,10 +133,6 @@
"@drugs_page_disclaimer_description": {},
"drugs_page_disclaimer_text_part_0": "Never stop taking or change the dose of your medications without consulting your pharmacist or doctor.",
"@drugs_page_disclaimer_text_part_0": {},
"drugs_page_disclaimer_text_part_1": "Also, the information shown on this page is ONLY based on your DNA and certain medications you are currently taking.",
"@drugs_page_disclaimer_text_part_1": {},
"drugs_page_disclaimer_text_part_2": "Other important factors like weight, age, pre-existing conditions, and further medication interactions are not considered.",
"@drugs_page_disclaimer_text_part_2": {},
"drugs_page_is_inhibitor": "Taking {drugName} can interact with your results for the following gene(s): {genes}",
"@drugs_page_is_inhibitor": {
"placeholders": {
Expand Down Expand Up @@ -473,8 +469,8 @@
"@onboarding_1_text": {},
"onboarding_2_header": "One size does not fit all",
"@onboarding_2_header": {},
"onboarding_1_disclaimer_part_1": "The information provided in PharMe is ONLY based on your DNA and certain medications that may interact with your genetic result.",
"@onboarding_1_disclaimer_part_1": {},
"onboarding_1_disclaimer": "The information from PharMe is like one puzzle piece in the big picture of how well a medicine works for you.\n\nThe information provided here is based ONLY on your DNA and certain medications that may interact with your genetic result. Other important factors like weight, age, pre-existing conditions, and further medication interactions are not considered.",
"@onboarding_1_disclaimer": {},
"onboarding_2_text": "Each person’s body reacts to medications differently.\n\nMedications that are effective for a majority of people can have adverse side effects for you.",
"@onboarding_2_text": {},
"onboarding_3_header": "Genome power unlocked to improve human health",
Expand Down
30 changes: 19 additions & 11 deletions app/lib/onboarding/pages/onboarding.dart
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import 'package:font_awesome_flutter/font_awesome_flutter.dart';

import '../../../common/module.dart' hide MetaData;
import '../../common/models/metadata.dart';

Expand All @@ -17,9 +19,8 @@ class OnboardingPage extends HookWidget {
header: context.l10n.onboarding_1_header,
text: context.l10n.onboarding_1_text,
color: PharMeTheme.sinaiCyan,
child: DisclaimerCard(
text: context.l10n.onboarding_1_disclaimer_part_1,
secondLineText: context.l10n.drugs_page_disclaimer_text_part_2,
bottom: DisclaimerCard(
text: context.l10n.onboarding_3_disclaimer,
),
),
OnboardingSubPage(
Expand All @@ -37,8 +38,9 @@ class OnboardingPage extends HookWidget {
header: context.l10n.onboarding_3_header,
text: context.l10n.onboarding_3_text,
color: PharMeTheme.sinaiPurple,
child: DisclaimerCard(
text: context.l10n.onboarding_3_disclaimer,
bottom: DisclaimerCard(
icon: FontAwesomeIcons.puzzlePiece,
text: context.l10n.onboarding_1_disclaimer,
),
),
OnboardingSubPage(
Expand Down Expand Up @@ -295,7 +297,8 @@ class OnboardingSubPage extends HookWidget {
required this.text,
required this.color,
required this.availableHeight,
this.child,
this.top,
this.bottom,
});

final String illustrationPath;
Expand All @@ -304,7 +307,8 @@ class OnboardingSubPage extends HookWidget {
final String text;
final double availableHeight;
final Color color;
final Widget? child;
final Widget? top;
final Widget? bottom;

double? _getContentHeight(GlobalKey contentKey) {
return contentKey.currentContext?.size?.height;
Expand Down Expand Up @@ -418,15 +422,19 @@ class OnboardingSubPage extends HookWidget {
maxLines: 2,
),
SizedBox(height: PharMeTheme.mediumToLargeSpace),
if (top != null) ...[
top!,
SizedBox(height: PharMeTheme.mediumSpace),
],
Text(
text,
style: PharMeTheme.textTheme.bodyLarge!.copyWith(
color: Colors.white,
),
),
if (child != null) ...[
if (bottom != null) ...[
SizedBox(height: PharMeTheme.mediumSpace),
child!,
bottom!,
],
]),
// Empty widget for spaceBetween in this column to work properly
Expand Down Expand Up @@ -474,7 +482,7 @@ class DisclaimerCard extends StatelessWidget {
this.onClick,
});

final Icon? icon;
final IconData? icon;
final String text;
final String? secondLineText;
final GestureTapCallback? onClick;
Expand All @@ -491,7 +499,7 @@ class DisclaimerCard extends StatelessWidget {
child: Row(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
icon ?? Icon(Icons.warning_rounded, size: 32),
Icon(icon ?? Icons.warning_rounded, size: 32),
SizedBox(width: PharMeTheme.smallSpace),
Expanded(
child: Column(
Expand Down

0 comments on commit e2aae73

Please sign in to comment.