Skip to content

Commit

Permalink
feat(app): add gene inclusion disclaimer
Browse files Browse the repository at this point in the history
  • Loading branch information
tamslo committed Jan 23, 2025
1 parent d5899e7 commit 3fd7058
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 14 deletions.
36 changes: 22 additions & 14 deletions app/lib/common/widgets/list_inclusion_description.dart
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,19 @@ enum ListInclusionDescriptionType {
genes,
}

extension ListInclusionDescriptionContent on ListInclusionDescriptionType {
String getText(BuildContext context) =>
context.l10n.included_content_disclaimer_text(
this == ListInclusionDescriptionType.medications
? context.l10n.included_content_medications
: context.l10n.included_content_genes
);

IconData get icon => this == ListInclusionDescriptionType.medications
? medicationsIcon
: genesIcon;
}

class ListInclusionDescription extends StatelessWidget {
const ListInclusionDescription({
super.key,
Expand All @@ -22,11 +35,6 @@ class ListInclusionDescription extends StatelessWidget {

@override
Widget build(BuildContext context) {
final inclusionText = context.l10n.included_content_disclaimer_text(
type == ListInclusionDescriptionType.medications
? context.l10n.included_content_medications
: context.l10n.included_content_genes
);
return DisclaimerRow(
icon: Padding(
padding: EdgeInsets.only(
Expand All @@ -36,7 +44,7 @@ class ListInclusionDescription extends StatelessWidget {
child: IncludedContentIcon(type: type),
),
text: Text(
inclusionText,
type.getText(context),
style: TextStyle(color: PharMeTheme.iconColor),
),
);
Expand All @@ -58,30 +66,30 @@ class IncludedContentIcon extends StatelessWidget {

@override
Widget build(BuildContext context) {
final icon = type == ListInclusionDescriptionType.medications
? medicationsIcon
: genesIcon;
final totalSize = size ?? PharMeTheme.mediumToLargeSpace * 1.5;
final iconSize = totalSize * 0.9;
final checkIconBackgroundSize = totalSize * 0.5;
final checkIconSize = checkIconBackgroundSize * 0.8;
final rightShift = type == ListInclusionDescriptionType.medications
? checkIconBackgroundSize / 2
: checkIconBackgroundSize / 4;
final bottomShift = type == ListInclusionDescriptionType.medications
? totalSize * 0.1
: 0.0;
final iconSize = totalSize * 0.9 - rightShift;
final checkIconSize = checkIconBackgroundSize * 0.8;
return Stack(
children: [
SizedBox(
height: totalSize,
width: totalSize + rightShift,
width: totalSize,
),
Icon(
icon,
type.icon,
size: iconSize,
color: color ?? PharMeTheme.buttonColor,
),
Positioned(
right: 0,
bottom: 0,
bottom: bottomShift,
child: Stack(
children: [
Icon(
Expand Down
9 changes: 9 additions & 0 deletions app/lib/drug/widgets/annotation_cards/disclaimer.dart
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,15 @@ class GuidelineDisclaimer extends StatelessWidget {
),
),
SizedBox(height: PharMeTheme.smallSpace),
DisclaimerRow(
icon: IncludedContentIcon(
type: ListInclusionDescriptionType.genes,
size: PharMeTheme.mediumSpace,
color: PharMeTheme.onSurfaceText,
),
text: Text(ListInclusionDescriptionType.genes.getText(context)),
),
SizedBox(height: PharMeTheme.smallSpace),
DisclaimerRow(
icon: Icon(
FontAwesomeIcons.puzzlePiece,
Expand Down

0 comments on commit 3fd7058

Please sign in to comment.