|
|
|
|
@ -17,6 +17,7 @@ import 'add_medication.dart';
|
|
|
|
|
|
|
|
|
|
class UpdateMedicationWidget extends StatefulWidget {
|
|
|
|
|
final PatiantInformtion patientInfo;
|
|
|
|
|
|
|
|
|
|
UpdateMedicationWidget({
|
|
|
|
|
Key? key,
|
|
|
|
|
required this.patientInfo,
|
|
|
|
|
@ -33,77 +34,63 @@ class _UpdateMedicationWidgetState extends State<UpdateMedicationWidget> {
|
|
|
|
|
Widget build(BuildContext context) {
|
|
|
|
|
return BaseView<SOAPViewModel>(
|
|
|
|
|
onModelReady: (model) async {
|
|
|
|
|
model.getHomeMedication(widget.patientInfo);
|
|
|
|
|
WidgetsBinding.instance.addPostFrameCallback((_) {
|
|
|
|
|
model.getHomeMedication(widget.patientInfo);
|
|
|
|
|
});
|
|
|
|
|
},
|
|
|
|
|
builder: (_, model, w) =>
|
|
|
|
|
Column(
|
|
|
|
|
children: [
|
|
|
|
|
AddSoapItem(
|
|
|
|
|
title: "${TranslationBase
|
|
|
|
|
.of(context)
|
|
|
|
|
.addMedication}",
|
|
|
|
|
onAddSoapItemClicked: () {
|
|
|
|
|
Navigator.push(
|
|
|
|
|
context,
|
|
|
|
|
FadePage(
|
|
|
|
|
page: AddMedication(
|
|
|
|
|
patientInfo: widget.patientInfo,
|
|
|
|
|
addMedicationFun:(){
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
));
|
|
|
|
|
// openMedicationList(context);
|
|
|
|
|
},
|
|
|
|
|
),
|
|
|
|
|
SizedBox(
|
|
|
|
|
height: 20,
|
|
|
|
|
),
|
|
|
|
|
ListView(
|
|
|
|
|
padding: EdgeInsets.all(10),
|
|
|
|
|
shrinkWrap: true,
|
|
|
|
|
physics: NeverScrollableScrollPhysics(),
|
|
|
|
|
children: model.getHomeMedicationList!.map((medication) {
|
|
|
|
|
return ListTile(
|
|
|
|
|
trailing: TextButton.icon(
|
|
|
|
|
onPressed: () {
|
|
|
|
|
removeMedication(medication, model);
|
|
|
|
|
},
|
|
|
|
|
icon: SvgPicture.asset(
|
|
|
|
|
"assets/images/svgs/delete.svg",
|
|
|
|
|
height: 18,
|
|
|
|
|
color: Color(0xffD02127),
|
|
|
|
|
),
|
|
|
|
|
label: AppText(
|
|
|
|
|
TranslationBase.of(context)
|
|
|
|
|
.remove,
|
|
|
|
|
fontSize: 12,
|
|
|
|
|
color: Color(0xffD02127))),
|
|
|
|
|
title:
|
|
|
|
|
|
|
|
|
|
AppText(
|
|
|
|
|
medication.prescribedItemName!,
|
|
|
|
|
fontSize: 12,
|
|
|
|
|
fontWeight: FontWeight.w800,
|
|
|
|
|
letterSpacing: -0.48,
|
|
|
|
|
),
|
|
|
|
|
subtitle: AppText(
|
|
|
|
|
'${medication.doseQuantity!} - ${ medication.frequencyString!}',
|
|
|
|
|
fontSize: 10,
|
|
|
|
|
|
|
|
|
|
builder: (_, model, w) => Column(children: [
|
|
|
|
|
AddSoapItem(
|
|
|
|
|
title: "${TranslationBase.of(context).addMedication}",
|
|
|
|
|
onAddSoapItemClicked: () {
|
|
|
|
|
Navigator.push(
|
|
|
|
|
context,
|
|
|
|
|
FadePage(
|
|
|
|
|
page: AddMedication(
|
|
|
|
|
patientInfo: widget.patientInfo,
|
|
|
|
|
addMedicationFun: () {})));
|
|
|
|
|
// openMedicationList(context);
|
|
|
|
|
},
|
|
|
|
|
),
|
|
|
|
|
SizedBox(
|
|
|
|
|
height: 20,
|
|
|
|
|
),
|
|
|
|
|
ListView(
|
|
|
|
|
padding: EdgeInsets.all(10),
|
|
|
|
|
shrinkWrap: true,
|
|
|
|
|
physics: NeverScrollableScrollPhysics(),
|
|
|
|
|
children: model.getHomeMedicationList!.map((medication) {
|
|
|
|
|
return ListTile(
|
|
|
|
|
trailing: TextButton.icon(
|
|
|
|
|
onPressed: () {
|
|
|
|
|
removeMedication(medication, model);
|
|
|
|
|
},
|
|
|
|
|
icon: SvgPicture.asset(
|
|
|
|
|
"assets/images/svgs/delete.svg",
|
|
|
|
|
height: 18,
|
|
|
|
|
color: Color(0xffD02127),
|
|
|
|
|
),
|
|
|
|
|
);
|
|
|
|
|
}).toList()),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
]
|
|
|
|
|
));
|
|
|
|
|
label: AppText(TranslationBase.of(context).remove,
|
|
|
|
|
fontSize: 12, color: Color(0xffD02127))),
|
|
|
|
|
title: AppText(
|
|
|
|
|
medication.prescribedItemName!,
|
|
|
|
|
fontSize: 12,
|
|
|
|
|
fontWeight: FontWeight.w800,
|
|
|
|
|
letterSpacing: -0.48,
|
|
|
|
|
),
|
|
|
|
|
subtitle: AppText(
|
|
|
|
|
'${medication.doseQuantity!} - ${medication.frequencyString!}',
|
|
|
|
|
fontSize: 10,
|
|
|
|
|
),
|
|
|
|
|
);
|
|
|
|
|
}).toList()),
|
|
|
|
|
]));
|
|
|
|
|
}
|
|
|
|
|
removeMedication(GetHomeMedicationList medication, SOAPViewModel model) async{
|
|
|
|
|
|
|
|
|
|
removeMedication(
|
|
|
|
|
GetHomeMedicationList medication, SOAPViewModel model) async {
|
|
|
|
|
GifLoaderDialogUtils.showMyDialog(context);
|
|
|
|
|
await model.removeCurrentMedication(medication.id!);
|
|
|
|
|
await model.getHomeMedication(widget.patientInfo);
|
|
|
|
|
GifLoaderDialogUtils.hideDialog(context);
|
|
|
|
|
await model.removeCurrentMedication(medication.id!);
|
|
|
|
|
await model.getHomeMedication(widget.patientInfo);
|
|
|
|
|
GifLoaderDialogUtils.hideDialog(context);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|