Skip to content

Commit

Permalink
feat(#713): use 'brand names' on drug items and in drug details
Browse files Browse the repository at this point in the history
  • Loading branch information
tamslo committed Apr 9, 2024
1 parent 39aaeb4 commit 920d3ed
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 5 deletions.
4 changes: 2 additions & 2 deletions app/lib/common/widgets/drug_list/drug_items/drug_cards.dart
Original file line number Diff line number Diff line change
Expand Up @@ -73,8 +73,8 @@ class DrugCard extends StatelessWidget {
if (drug.annotations.brandNames.isNotEmpty) ...[
SizedBox(width: PharMeTheme.smallSpace / 2),
Text(
'(${drug.annotations.brandNames.join(', ')})',
style: PharMeTheme.textTheme.titleMedium,
formatBrandNames(context, drug),
style: PharMeTheme.textTheme.titleSmall,
),
],
SizedBox(height: PharMeTheme.smallSpace * 0.75),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,14 @@ List<Widget> buildDrugCheckboxList(
),
)]
: _buildCheckboxList(
context,
activeDrugs,
buildParams,
showDrugInteractionIndicator,
keyPrefix: 'active',
);
final allDrugsList = _buildCheckboxList(
context,
drugs,
buildParams,
showDrugInteractionIndicator,
Expand All @@ -48,6 +50,7 @@ List<Widget> buildDrugCheckboxList(
}

List<CheckboxListTileWrapper> _buildCheckboxList(
BuildContext context,
List<Drug> drugs,
Map buildParams,
bool showDrugInteractionIndicator,
Expand All @@ -63,7 +66,7 @@ List<CheckboxListTileWrapper> _buildCheckboxList(
onChanged: (value) => onCheckboxChange(drug, value),
title: formatDrugName(drug, showDrugInteractionIndicator),
subtitle: (drug.annotations.brandNames.isNotEmpty) ?
'(${drug.annotations.brandNames.join(", ")})' :
formatBrandNames(context, drug) :
null,
)
).toList();
Expand Down
4 changes: 4 additions & 0 deletions app/lib/common/widgets/drug_list/drug_items/utils.dart
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
import '../../../module.dart';

String formatBrandNames(BuildContext context, Drug drug) =>
'${context.l10n.drug_item_brand_names}: '
'${drug.annotations.brandNames.join(", ")}';

String formatDrugName(
Drug drug,
// ignore: avoid_positional_boolean_parameters
Expand Down
2 changes: 1 addition & 1 deletion app/lib/drug/widgets/annotation_cards/drug.dart
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ class DrugAnnotationCards extends StatelessWidget {
),
if (drug.annotations.brandNames.isNotEmpty)
TableRowDefinition(
context.l10n.drugs_page_header_synonyms,
context.l10n.drug_item_brand_names,
drug.annotations.brandNames.join(', '),
),
]),
Expand Down
3 changes: 2 additions & 1 deletion app/lib/l10n/app_en.arb
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@
"auth_sign_in": "Get data",
"auth_success": "Successfully imported data",

"drug_item_brand_names": "Brand names",

"drug_selection_header": "Current medications",
"drug_selection_onboarding_description": "Please review the medications you are currently taking below and update them if needed. You can always change the status for a medication later on a medication page or in the settings.",
"drug_selection_settings_description": "Review the medications you are currently taking below.",
Expand Down Expand Up @@ -156,7 +158,6 @@
}
}
},
"drugs_page_header_synonyms": "Other names",
"drugs_page_header_drugclass": "Medication class",
"drugs_page_header_drug": "Medication information",
"drugs_page_header_active": "Usage status",
Expand Down

0 comments on commit 920d3ed

Please sign in to comment.