Skip to content

Commit

Permalink
feat(app): move brandnames below title on drug page
Browse files Browse the repository at this point in the history
  • Loading branch information
tamslo committed Dec 10, 2024
1 parent e7b8ba8 commit 615d442
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 15 deletions.
3 changes: 2 additions & 1 deletion app/lib/common/widgets/drug_activity_selection.dart
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ SwitchListTile buildDrugActivitySelection({
required BuildContext context,
required Drug drug,
required String title,
TextStyle? titleStyle,
String? subtitle,
required SetDrugActivityFunction setActivity,
required bool isActive,
Expand All @@ -23,7 +24,7 @@ SwitchListTile buildDrugActivitySelection({
inactiveThumbColor: PharMeTheme.surfaceColor,
inactiveTrackColor: PharMeTheme.borderColor,
trackOutlineColor: WidgetStatePropertyAll(Colors.transparent),
title: Text(title),
title: Text(title, style: titleStyle),
subtitle: subtitle.isNotNullOrBlank ? Text(subtitle!, style: PharMeTheme.textTheme.bodyMedium): null,
contentPadding: contentPadding,
onChanged: disabled ? null : (newValue) {
Expand Down
42 changes: 28 additions & 14 deletions app/lib/drug/widgets/annotation_cards/drug.dart
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,34 @@ class DrugAnnotationCards extends StatelessWidget {
return Column(
children: [
RoundedCard(
innerPadding: EdgeInsets.symmetric(horizontal: PharMeTheme.mediumSpace),
child: buildDrugActivitySelection(
context: context,
drug: drug,
setActivity: setActivity,
title: context.l10n.drugs_page_text_active,
isActive: isActive,
disabled: disabled,
contentPadding: EdgeInsets.zero,
innerPadding: EdgeInsets.symmetric(
horizontal: PharMeTheme.mediumSpace,
),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
if (drug.annotations.brandNames.isNotEmpty) ...[
SizedBox(height: PharMeTheme.mediumSpace),
buildTable([
TableRowDefinition(
context.l10n.drug_item_brand_names,
drug.annotations.brandNames.join(', '),
),
]),
],
buildDrugActivitySelection(
context: context,
drug: drug,
setActivity: setActivity,
title: context.l10n.drugs_page_text_active,
titleStyle: PharMeTheme.textTheme.bodyMedium!.copyWith(
fontWeight: FontWeight.bold,
),
isActive: isActive,
disabled: disabled,
contentPadding: EdgeInsets.zero,
),
],
),
),
SizedBox(height: PharMeTheme.smallSpace),
Expand All @@ -52,11 +71,6 @@ class DrugAnnotationCards extends StatelessWidget {
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(', '),
),
]),
],
),
Expand Down

0 comments on commit 615d442

Please sign in to comment.