From 04150f6a78443c40b7fea36a91f640771b38b714 Mon Sep 17 00:00:00 2001 From: tamslo Date: Mon, 24 Feb 2025 19:27:26 +0100 Subject: [PATCH] feat(app): add information about genetics resources --- app/lib/common/constants.dart | 9 ------ app/lib/common/routing/router.dart | 8 +++++- .../common/widgets/large_markdown_body.dart | 8 +++++- app/lib/genetic_information/module.dart | 9 ++++++ .../pages/genetic_information.dart | 28 +++++++++++++++++++ app/lib/l10n/app_en.arb | 4 ++- app/lib/more/pages/more.dart | 5 +++- docs/User-instructions.html | 11 ++++---- 8 files changed, 64 insertions(+), 18 deletions(-) create mode 100644 app/lib/genetic_information/module.dart create mode 100644 app/lib/genetic_information/pages/genetic_information.dart diff --git a/app/lib/common/constants.dart b/app/lib/common/constants.dart index 93aa165f..c955db29 100644 --- a/app/lib/common/constants.dart +++ b/app/lib/common/constants.dart @@ -1,5 +1,4 @@ import 'package:font_awesome_flutter/font_awesome_flutter.dart'; -import 'package:url_launcher/url_launcher.dart'; import 'module.dart'; @@ -9,14 +8,6 @@ const genesIcon = FontAwesomeIcons.dna; Uri anniUrl([String slug = '']) => Uri.http('hpi-annotation-service.duckdns.org', 'api/v1/$slug'); -final geneticInformationUrl = Uri.https( - 'medlineplus.gov', - '/genetics/understanding/', -); - -Future openFurtherGeneticInformation() async => - launchUrl(geneticInformationUrl); - final cpicMaxCacheTime = Duration(days: 90); const cpicLookupUrl = 'https://api.cpicpgx.org/v1/diplotype?select=genesymbol,diplotype,generesult,lookupkey'; diff --git a/app/lib/common/routing/router.dart b/app/lib/common/routing/router.dart index 2b5fbfb0..c6e176da 100644 --- a/app/lib/common/routing/router.dart +++ b/app/lib/common/routing/router.dart @@ -2,6 +2,7 @@ import '../../drug/module.dart'; import '../../drug_selection/module.dart'; import '../../error/module.dart'; import '../../faq/module.dart'; +import '../../genetic_information/module.dart'; import '../../login/module.dart'; import '../../main/module.dart'; import '../../more/module.dart'; @@ -28,7 +29,12 @@ class AppRouter extends _$AppRouter { searchRoute(children: [ drugRoute() ]), faqRoute(), moreRoute( - children: [ aboutRoute(), termsRoute(), privacyRoute() ], + children: [ + geneticInformationRoute(), + aboutRoute(), + termsRoute(), + privacyRoute(), + ], ), ], ), diff --git a/app/lib/common/widgets/large_markdown_body.dart b/app/lib/common/widgets/large_markdown_body.dart index 65a072ee..83924997 100644 --- a/app/lib/common/widgets/large_markdown_body.dart +++ b/app/lib/common/widgets/large_markdown_body.dart @@ -3,9 +3,14 @@ import 'package:flutter_markdown/flutter_markdown.dart'; import '../module.dart'; class LargeMarkdownBody extends StatelessWidget { - const LargeMarkdownBody({super.key, required this.data}); + const LargeMarkdownBody({ + super.key, + required this.data, + this.onTapLink, + }); final String data; + final void Function(String text, String? href, String title)? onTapLink; @override Widget build(BuildContext context) => MarkdownBody( @@ -17,5 +22,6 @@ class LargeMarkdownBody extends StatelessWidget { ) ) ), + onTapLink: onTapLink, ); } \ No newline at end of file diff --git a/app/lib/genetic_information/module.dart b/app/lib/genetic_information/module.dart new file mode 100644 index 00000000..229adeed --- /dev/null +++ b/app/lib/genetic_information/module.dart @@ -0,0 +1,9 @@ +import '../common/module.dart'; + +// For generated routes +export 'pages/genetic_information.dart'; + +AutoRoute geneticInformationRoute() => AutoRoute( + path: 'genetic-information', + page: GeneticInformationRoute.page, +); \ No newline at end of file diff --git a/app/lib/genetic_information/pages/genetic_information.dart b/app/lib/genetic_information/pages/genetic_information.dart new file mode 100644 index 00000000..aa225faa --- /dev/null +++ b/app/lib/genetic_information/pages/genetic_information.dart @@ -0,0 +1,28 @@ +import 'package:url_launcher/url_launcher.dart'; + +import '../../common/module.dart'; + +@RoutePage() +class GeneticInformationPage extends HookWidget { + const GeneticInformationPage({super.key}); + + @override + Widget build(BuildContext context) { + return pageScaffold( + title: context.l10n.more_page_genetic_information, + body: [ + Padding( + padding: const EdgeInsets.only( + left: PharMeTheme.smallSpace, + right: PharMeTheme.smallSpace, + bottom: PharMeTheme.smallSpace, + ), + child: LargeMarkdownBody( + data: context.l10n.more_page_genetic_information_markdown, + onTapLink: (text, href, title) => launchUrl(Uri.parse(href!)), + ), + ), + ] + ); + } +} \ No newline at end of file diff --git a/app/lib/l10n/app_en.arb b/app/lib/l10n/app_en.arb index c2419610..cf1e3c76 100644 --- a/app/lib/l10n/app_en.arb +++ b/app/lib/l10n/app_en.arb @@ -648,8 +648,10 @@ "@more_page_terms_and_conditions_text": {}, "more_page_help_and_feedback": "Help & feedback", "@more_page_help_and_feedback": {}, - "more_page_genetic_information": "Learn about genetics (MedlinePlus)", + "more_page_genetic_information": "Learn about genetics", "@more_page_genetic_information": {}, + "more_page_genetic_information_markdown": "Please refer to the links below to learn more about PGx (pharmacogenomics) and genetics in general.\n\n_For more information on PGx:_\n\n- **Mount Sinai Introduction Video**: \n- **Information on MedlinePlus** (an online health information resource for patients and their families and friends of the National Library of Medicine): \n- **Information on KidsHealth** (educational resources by Nemours®): \n\n_For more information on Genetics_:\n- **Genetics on OLogy** (a science website in easy language from the American Museum of Natural History): \n- **Information from Genes and Health** (resources by the study team of one of the world’s largest community-based genetics studies): ", + "@more_page_genetic_information_markdown": {}, "more_page_contact_us": "Contact us", "@more_page_contact_us": {}, diff --git a/app/lib/more/pages/more.dart b/app/lib/more/pages/more.dart index de6f55b1..0396d0e4 100644 --- a/app/lib/more/pages/more.dart +++ b/app/lib/more/pages/more.dart @@ -56,7 +56,10 @@ class MorePage extends StatelessWidget { ), _buildSettingsItem( title: context.l10n.more_page_genetic_information, - onTap: openFurtherGeneticInformation), + onTap: () => context.router.push( + GeneticInformationRoute(), + ), + ), SubheaderDivider( text: context.l10n.more_page_app_information, useLine: false, diff --git a/docs/User-instructions.html b/docs/User-instructions.html index a3ab49c3..8e65f15c 100644 --- a/docs/User-instructions.html +++ b/docs/User-instructions.html @@ -596,18 +596,18 @@

III. Learn About Genetics

You can also open the links from the App, under "More" > "Learn about genetics".

-

For more information on PGx:

+

For more information on PGx:

-

For more information on Genetics:

+

For more information on Genetics:

IV. Frequently Asked Questions (FAQ)

@@ -823,8 +823,9 @@

2.7 Can other medications affect how my body processes medications?

of other medications. Consult your pharmacist or doctor for more information in such cases.

-

PharMe currently only includes strong and moderate inhibitors for the gene - CYP2D6: +

+ PharMe currently only includes strong and moderate inhibitors for the gene + CYP2D6:

Strong inhibitors: