From 80cfdceffd53839ae78ea0a931bd6a880e6f2603 Mon Sep 17 00:00:00 2001 From: Tamara Slosarek Date: Wed, 25 Sep 2024 10:36:39 +0200 Subject: [PATCH] feat(app): improve report sorting --- app/lib/l10n/app_en.arb | 1 + app/lib/report/pages/report.dart | 25 +++++++++++++++++++++++-- 2 files changed, 24 insertions(+), 2 deletions(-) diff --git a/app/lib/l10n/app_en.arb b/app/lib/l10n/app_en.arb index 083ab061..8bd0ab90 100644 --- a/app/lib/l10n/app_en.arb +++ b/app/lib/l10n/app_en.arb @@ -164,6 +164,7 @@ } } }, + "report_no_result_genes": "Genes with no result", "gene_page_headline": "{gene} report", "@gene_page_headline": { diff --git a/app/lib/report/pages/report.dart b/app/lib/report/pages/report.dart index 06664159..94ae3be4 100644 --- a/app/lib/report/pages/report.dart +++ b/app/lib/report/pages/report.dart @@ -51,6 +51,10 @@ class ReportPage extends StatelessWidget { ), ); } + final sortedGenotypesWithResults = sortedGenotypes.filter( + (genotypeResult) => !_hasNoResult(genotypeResult) + ); + final sortedGenotypesWithoutResults = sortedGenotypes.filter(_hasNoResult); final hasActiveInhibitors = activeDrugs.names.any(isInhibitor); return PopScope( canPop: false, @@ -74,11 +78,25 @@ class ReportPage extends StatelessWidget { ] ), ), - ...sortedGenotypes.map((genotypeResult) => GeneCard( + ...sortedGenotypesWithResults.map((genotypeResult) => GeneCard( genotypeResult, warningLevelCounts[genotypeResult.key.value]!, key: Key('gene-card-${genotypeResult.key.value}') )), + if (sortedGenotypesWithoutResults.isNotEmpty) ...[ + SubheaderDivider( + text: context.l10n.report_no_result_genes, + key: Key('header-no-result'), + useLine: false, + ), + ...sortedGenotypesWithoutResults.map((genotypeResult) => + GeneCard( + genotypeResult, + warningLevelCounts[genotypeResult.key.value]!, + key: Key('gene-card-${genotypeResult.key.value}') + ) + ), + ], ], ), if (hasActiveInhibitors) PageIndicatorExplanation( @@ -94,6 +112,9 @@ class ReportPage extends StatelessWidget { } } +bool _hasNoResult(GenotypeResult genotypeResult) => + UserData.lookupFor(genotypeResult.key.value) == SpecialLookup.noResult.value; + class GeneCard extends StatelessWidget { const GeneCard(this.genotypeResult, this.warningLevelCounts, { super.key }); @@ -117,7 +138,7 @@ class GeneCard extends StatelessWidget { GeneRoute(genotypeResult: genotypeResult) ), radius: 16, - color: _getHighestSeverityColor(warningLevelCounts), + color: _hasNoResult(genotypeResult) ? PharMeTheme.onSurfaceColor : _getHighestSeverityColor(warningLevelCounts), child: IntrinsicHeight(child: Row( crossAxisAlignment: CrossAxisAlignment.stretch, children: [