Skip to content

Commit

Permalink
feat(#685): add link to MedlinePlus to report
Browse files Browse the repository at this point in the history
  • Loading branch information
tamslo committed Feb 14, 2024
1 parent f40c77c commit eff061b
Show file tree
Hide file tree
Showing 5 changed files with 45 additions and 5 deletions.
3 changes: 3 additions & 0 deletions app/lib/common/constants.dart
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,9 @@ Future<void> sendEmail({
);
}

Future<void> openFurtherGeneticInformation() async =>
launchUrl(Uri.https('medlineplus.gov', '/genetics/understanding/'));

final cpicMaxCacheTime = Duration(days: 90);
const maxCachedDrugs = 10;
const cpicLookupUrl =
Expand Down
22 changes: 19 additions & 3 deletions app/lib/common/widgets/page_description.dart
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
import '../module.dart';

class PageDescription extends StatelessWidget {
const PageDescription(this.text);
const PageDescription(this.widget);

final String text;
factory PageDescription.fromText(String text) =>
PageDescription(PageDescriptionText(text));

final Widget widget;

@override
Widget build(BuildContext context) {
Expand All @@ -12,7 +15,20 @@ class PageDescription extends StatelessWidget {
left: PharMeTheme.smallSpace,
right: PharMeTheme.smallSpace,
bottom: PharMeTheme.smallSpace),
child: Text(text, style: PharMeTheme.textTheme.bodyMedium),
child: widget,
);
}
}

final pageDescriptionTextStyle = PharMeTheme.textTheme.bodyMedium;

class PageDescriptionText extends StatelessWidget {
const PageDescriptionText(this.text);

final String text;

@override
Widget build(BuildContext context) {
return Text(text, style: pageDescriptionTextStyle);
}
}
2 changes: 1 addition & 1 deletion app/lib/drug_selection/pages/drug_selection.dart
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ class DrugSelectionPage extends HookWidget {
title: context.l10n.drug_selection_header,
body: Column(
children: [
if (concludesOnboarding) PageDescription(
if (concludesOnboarding) PageDescription.fromText(
context.l10n.drug_selection_onboarding_description,
),
Expanded(child: _buildDrugList(context, state)),
Expand Down
3 changes: 3 additions & 0 deletions app/lib/l10n/app_en.arb
Original file line number Diff line number Diff line change
Expand Up @@ -206,6 +206,9 @@
"drugs_page_recommendation_warfarin": "Consult your pharmacist or doctor for more information.",

"report_content_explanation": "Here is your PGx report. Tap on a gene name for more details on your results and a list of implicated drugs.",
"report_genetic_information_part_1": "If you would like to learn more about genetics, please visit ",
"report_genetic_information_part_2": ", a service of the National Library of Medicine.",
"genetic_information_source": "MedlinePlus",
"report_page_indicator_explanation": "Phenotypes followed by an {indicatorName} ({indicator}) might be influenced by drugs you are currently taking",
"@report_page_indicator_explanation": {
"placeholders": {
Expand Down
20 changes: 19 additions & 1 deletion app/lib/report/pages/report.dart
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,24 @@ class ReportPage extends StatelessWidget {
title: context.l10n.tab_report,
body: Column(
children: [
PageDescription(context.l10n.report_content_explanation),
PageDescription(Column(children: [
PageDescriptionText(context.l10n.report_content_explanation),
SizedBox(height: PharMeTheme.smallSpace),
RichText(text: TextSpan(
text: context.l10n.report_genetic_information_part_1,
style: pageDescriptionTextStyle,
children: [
linkTextSpan(
text: context.l10n.genetic_information_source,
onTap: openFurtherGeneticInformation,
),
TextSpan(
text: context.l10n.report_genetic_information_part_2,
style: pageDescriptionTextStyle,
),
],
))
])),
scrollList(
userGenotypes.map((genotypeResult) => GeneCard(
genotypeResult,
Expand All @@ -50,6 +67,7 @@ class ReportPage extends StatelessWidget {
),
);
}

}

class GeneCard extends StatelessWidget {
Expand Down

0 comments on commit eff061b

Please sign in to comment.