Skip to content

Commit

Permalink
feat(#722): add further disclaimer
Browse files Browse the repository at this point in the history
  • Loading branch information
tamslo committed Jul 20, 2024
1 parent 0f6d2f1 commit 867defa
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 17 deletions.
1 change: 0 additions & 1 deletion app/integration_test/drugs_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,6 @@ void main() {
);

expect(find.text(testDrugWithoutGuidelines.name), findsOneWidget);
expect(find.byType(Disclaimer), findsNothing);
});

testWidgets('test loading', (tester) async {
Expand Down
31 changes: 18 additions & 13 deletions app/lib/drug/widgets/annotation_cards/disclaimer.dart
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
import '../../../common/module.dart';

class Disclaimer extends StatelessWidget {
const Disclaimer({ this.description, this.text });
const Disclaimer({ this.userGuideline });

final String? description;
final String? text;
final Guideline? userGuideline;

@override
Widget build(BuildContext context) {
Expand All @@ -28,19 +27,25 @@ class Disclaimer extends StatelessWidget {
),
TextSpan(text: ' '),
TextSpan(
text: description ?? context.l10n.drugs_page_disclaimer_description,
text: context.l10n.drugs_page_disclaimer_description,
style: TextStyle(fontWeight: FontWeight.bold),
),
if (text != null) TextSpan(text: text),
if (text == null) TextSpan(children: [
TextSpan(text: context.l10n.drugs_page_disclaimer_text_part_1),
TextSpan(text: ' '),
TextSpan(text: context.l10n.drugs_page_disclaimer_text_part_2),
])
TextSpan(
text: context.l10n.drugs_page_disclaimer_text_part_0,
style: TextStyle(fontWeight: FontWeight.w500),
),
if (userGuideline != null) TextSpan(
children: [
TextSpan(text: '\n\n'),
TextSpan(text: context.l10n.drugs_page_disclaimer_text_part_1),
TextSpan(text: ' '),
TextSpan(text: context.l10n.drugs_page_disclaimer_text_part_2),
],
style: PharMeTheme.textTheme.labelMedium!.copyWith(
fontWeight: FontWeight.w300,
),
)
]),
style: PharMeTheme.textTheme.labelMedium!.copyWith(
fontWeight: FontWeight.w300,
),
),
);
}
Expand Down
4 changes: 2 additions & 2 deletions app/lib/drug/widgets/annotation_cards/guideline.dart
Original file line number Diff line number Diff line change
Expand Up @@ -151,9 +151,9 @@ class GuidelineAnnotationCard extends StatelessWidget {
TextSpan(text: recommendationText),
]),
),
if (drug.userGuideline != null) ...[
...[
SizedBox(height: PharMeTheme.smallToMediumSpace),
Disclaimer(),
Disclaimer(userGuideline: drug.userGuideline),
],
]
)
Expand Down
3 changes: 2 additions & 1 deletion app/lib/l10n/app_en.arb
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,8 @@
}
},
"drugs_page_disclaimer_description": "Please note: ",
"drugs_page_disclaimer_text_part_1": "The information shown on this page is ONLY based on your DNA and certain medications you are currently taking.",
"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_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_2": "Other important factors like weight, age, pre-existing conditions, and further medication interactions are not considered.",
"drugs_page_is_inhibitor": "Taking {drugName} can interact with your results for the following gene(s): {genes}",
"@drugs_page_is_inhibitor": {
Expand Down

0 comments on commit 867defa

Please sign in to comment.