-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(#706): apply inhibitor medication change behavoir to current med…
…ications list * Uses switch tiles for current medications * Refactors drug list
- Loading branch information
Showing
13 changed files
with
103 additions
and
109 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
import '../module.dart'; | ||
|
||
typedef SetDrugActivityFunction = void Function({ | ||
required Drug drug, | ||
required bool? value, | ||
}); | ||
|
||
SwitchListTile buildDrugActivitySelection({ | ||
Key? key, | ||
required BuildContext context, | ||
required Drug drug, | ||
required String title, | ||
String? subtitle, | ||
required SetDrugActivityFunction setActivity, | ||
required bool isActive, | ||
required bool disabled, | ||
EdgeInsetsGeometry? contentPadding, | ||
}) => SwitchListTile.adaptive( | ||
key: key, | ||
value: isActive, | ||
activeColor: PharMeTheme.primaryColor, | ||
title: Text(title), | ||
subtitle: subtitle.isNotNullOrBlank ? Text(subtitle!, style: PharMeTheme.textTheme.bodyMedium): null, | ||
contentPadding: contentPadding, | ||
onChanged: disabled ? null : (newValue) { | ||
if (isInhibitor(drug.name)) { | ||
showAdaptiveDialog( | ||
context: context, | ||
builder: (context) => DialogWrapper( | ||
title: context.l10n.drugs_page_active_warn_header, | ||
content: DialogContentText( | ||
context.l10n.drugs_page_active_warn, | ||
), | ||
actions: [ | ||
DialogAction( | ||
onPressed: () => Navigator.pop( | ||
context, | ||
'Cancel', | ||
), | ||
text: context.l10n.action_cancel, | ||
), | ||
DialogAction( | ||
onPressed: () { | ||
Navigator.pop(context, 'OK'); | ||
setActivity(drug: drug, value: newValue); | ||
}, | ||
text: context.l10n.action_continue, | ||
isDestructive: true, | ||
), | ||
], | ||
), | ||
); | ||
} else { | ||
setActivity(drug: drug, value: newValue); | ||
} | ||
}, | ||
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters