From 943f2d0c56702789375d9165ddfd7bb127d82f82 Mon Sep 17 00:00:00 2001 From: tamslo Date: Fri, 29 Nov 2024 00:51:09 +0100 Subject: [PATCH] feat(app): put more focus on guideline --- .../drug/widgets/annotation_cards/drug.dart | 53 +++++++++++-------- .../widgets/annotation_cards/guideline.dart | 22 ++++++-- app/lib/l10n/app_en.arb | 2 + 3 files changed, 51 insertions(+), 26 deletions(-) diff --git a/app/lib/drug/widgets/annotation_cards/drug.dart b/app/lib/drug/widgets/annotation_cards/drug.dart index 66208002..4332a75f 100644 --- a/app/lib/drug/widgets/annotation_cards/drug.dart +++ b/app/lib/drug/widgets/annotation_cards/drug.dart @@ -49,30 +49,37 @@ class DrugAnnotationCards extends StatelessWidget { ) ), SizedBox(height: PharMeTheme.smallSpace), - SubHeader(context.l10n.drugs_page_header_drug), - SizedBox(height: PharMeTheme.smallSpace), - RoundedCard( - innerPadding: EdgeInsets.all(PharMeTheme.mediumSpace), - child: SingleChildScrollView( - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Text(drug.annotations.indication), - SizedBox(height: PharMeTheme.smallSpace), - buildTable([ - TableRowDefinition( - context.l10n.drugs_page_header_drugclass, - drug.annotations.drugclass, - ), - if (drug.annotations.brandNames.isNotEmpty) - TableRowDefinition( - context.l10n.drug_item_brand_names, - drug.annotations.brandNames.join(', '), - ), - ]), - ], + PrettyExpansionTile( + title: SubHeader(context.l10n.drugs_page_header_drug), + visualDensity: VisualDensity.compact, + titlePadding: EdgeInsets.zero, + childrenPadding: EdgeInsets.zero, + children: [ + SizedBox(height: PharMeTheme.smallSpace), + RoundedCard( + innerPadding: EdgeInsets.all(PharMeTheme.mediumSpace), + child: SingleChildScrollView( + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text(drug.annotations.indication), + SizedBox(height: PharMeTheme.smallSpace), + buildTable([ + TableRowDefinition( + context.l10n.drugs_page_header_drugclass, + drug.annotations.drugclass, + ), + if (drug.annotations.brandNames.isNotEmpty) + TableRowDefinition( + context.l10n.drug_item_brand_names, + drug.annotations.brandNames.join(', '), + ), + ]), + ], + ), + ), ), - ), + ], ), ], ); diff --git a/app/lib/drug/widgets/annotation_cards/guideline.dart b/app/lib/drug/widgets/annotation_cards/guideline.dart index 293f1432..a2d4c5e4 100644 --- a/app/lib/drug/widgets/annotation_cards/guideline.dart +++ b/app/lib/drug/widgets/annotation_cards/guideline.dart @@ -76,8 +76,20 @@ class GuidelineAnnotationCard extends StatelessWidget { SizedBox(height: PharMeTheme.smallToMediumSpace), Text.rich( TextSpan( - text: - implicationText ?? context.l10n.drugs_page_no_guidelines_text, + children: [ + TextSpan( + text: context.l10n.drugs_page_implication_description, + ), + TextSpan(text: '\n'), + WidgetSpan(child: SizedBox(height: PharMeTheme.mediumSpace * 1.2)), + TextSpan( + text: + implicationText ?? context.l10n.drugs_page_no_guidelines_text, + style: implicationText != null + ? TextStyle(fontWeight: FontWeight.bold) + : TextStyle(fontStyle: FontStyle.italic) + ), + ], ), ), if (recommendationText != null) ...[ @@ -86,9 +98,13 @@ class GuidelineAnnotationCard extends StatelessWidget { TextSpan(children: [ TextSpan( text: context.l10n.drugs_page_recommendation_description, + ), + TextSpan(text: '\n'), + WidgetSpan(child: SizedBox(height: PharMeTheme.mediumSpace * 1.2)), + TextSpan( + text: recommendationText, style: TextStyle(fontWeight: FontWeight.bold), ), - TextSpan(text: recommendationText), ]), ), ], diff --git a/app/lib/l10n/app_en.arb b/app/lib/l10n/app_en.arb index b95c0fbf..61733194 100644 --- a/app/lib/l10n/app_en.arb +++ b/app/lib/l10n/app_en.arb @@ -257,6 +257,8 @@ }, "drugs_page_tooltip_guideline_missing": "Guidelines provide recommendations on which medications to use based on your DNA. However, no guideline is present in this case (yet).", "@drugs_page_tooltip_guideline_missing": {}, + "drugs_page_implication_description": "What your result means: ", + "@drugs_page_implication_description": {}, "drugs_page_recommendation_description": "What to do: ", "@drugs_page_recommendation_description": {},