Fix add medication button

merge-requests/967/head
RoaaGhali98 4 years ago
parent 5b8211eec4
commit d5e3a79f85

@ -8,7 +8,6 @@ import '../../../core/model/patient/patiant_info_model.dart';
import '../../../core/model/search_drug/get_medication_response_model.dart'; import '../../../core/model/search_drug/get_medication_response_model.dart';
import '../../../core/viewModel/prescription_view_model.dart'; import '../../../core/viewModel/prescription_view_model.dart';
import '../../../widgets/shared/buttons/app_buttons_widget.dart'; import '../../../widgets/shared/buttons/app_buttons_widget.dart';
import 'add_prescription_form.dart';
import 'drugtodrug.dart'; import 'drugtodrug.dart';
class AddDrugWidget extends StatefulWidget { class AddDrugWidget extends StatefulWidget {
@ -16,37 +15,30 @@ class AddDrugWidget extends StatefulWidget {
final List<PrescriptionModel> prescriptionList; final List<PrescriptionModel> prescriptionList;
final MedicineViewModel medicineModel; final MedicineViewModel medicineModel;
final PrescriptionViewModel modelPrescription; final PrescriptionViewModel modelPrescription;
final dynamic units;
final dynamic route;
final dynamic frequency;
final dynamic duration;
final dynamic doseTime;
final dynamic uom;
final dynamic x;
final GetMedicationResponseModel selectedMedication;
final String strength;
final String indication;
final String instruction;
final DateTime selectedDate;
const AddDrugWidget({Key key, this.patient, this.prescriptionList, this.medicineModel,
this.modelPrescription, this.units, this.route, this.frequency, this.duration, this.doseTime,
this.uom, this.x, this.selectedMedication, this.strength, this.indication, this.instruction, this.selectedDate}) : super(key: key);
const AddDrugWidget({Key key, this.patient, this.prescriptionList, this.medicineModel, this.modelPrescription}) : super(key: key);
@override @override
_AddDrugWidgetState createState() => _AddDrugWidgetState(); _AddDrugWidgetState createState() => _AddDrugWidgetState();
} }
class _AddDrugWidgetState extends State<AddDrugWidget> { class _AddDrugWidgetState extends State<AddDrugWidget> {
TextEditingController strengthController = TextEditingController();
dynamic route;
dynamic frequency;
dynamic duration;
dynamic doseTime;
dynamic indication;
dynamic units;
dynamic uom;
dynamic box;
dynamic x;
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
GetMedicationResponseModel _selectedMedication;
TextEditingController indicationController = TextEditingController();
TextEditingController instructionController = TextEditingController();
DateTime selectedDate;
return Container( return Container(
height: SizeConfig.realScreenHeight * .8, height: SizeConfig.realScreenHeight * .8,
width: SizeConfig.realScreenWidth, width: SizeConfig.realScreenWidth,
@ -66,7 +58,6 @@ class _AddDrugWidgetState extends State<AddDrugWidget> {
title: TranslationBase.of(context).addMedication, title: TranslationBase.of(context).addMedication,
onPressed: () { onPressed: () {
Navigator.pop(context); Navigator.pop(context);
widget.medicineModel.postPrescription( widget.medicineModel.postPrescription(
icdCode: widget.medicineModel.patientAssessmentList.isNotEmpty icdCode: widget.medicineModel.patientAssessmentList.isNotEmpty
? widget.medicineModel.patientAssessmentList[0].icdCode10ID ? widget.medicineModel.patientAssessmentList[0].icdCode10ID
@ -75,28 +66,28 @@ class _AddDrugWidgetState extends State<AddDrugWidget> {
: widget.medicineModel.patientAssessmentList[0].icdCode10ID : widget.medicineModel.patientAssessmentList[0].icdCode10ID
.toString() .toString()
: "test", : "test",
dose: strengthController.text, dose: widget.strength,
doseUnit: widget.medicineModel.itemMedicineListUnit.length == 1 doseUnit: widget.medicineModel.itemMedicineListUnit.length == 1
? widget.medicineModel.itemMedicineListUnit[0]['parameterCode'] ? widget.medicineModel.itemMedicineListUnit[0]['parameterCode']
.toString() .toString()
: units['parameterCode'].toString(), : widget.units['parameterCode'].toString(),
patient: widget.patient, patient: widget.patient,
doseTimeIn: doseTime['id'].toString(), doseTimeIn: widget.doseTime['id'].toString(),
model: widget.modelPrescription, model: widget.modelPrescription,
duration: duration['id'].toString(), duration: widget.duration['id'].toString(),
frequency: widget.medicineModel.itemMedicineList.length == 1 frequency: widget.medicineModel.itemMedicineList.length == 1
? widget.medicineModel.itemMedicineList[0]['parameterCode'] ? widget.medicineModel.itemMedicineList[0]['parameterCode']
.toString() .toString()
: frequency['parameterCode'].toString(), : widget.frequency['parameterCode'].toString(),
route: widget.medicineModel.itemMedicineListRoute.length == 1 route: widget.medicineModel.itemMedicineListRoute.length == 1
? widget.medicineModel.itemMedicineListRoute[0]['parameterCode'] ? widget.medicineModel.itemMedicineListRoute[0]['parameterCode']
.toString() .toString()
: route['parameterCode'].toString(), : widget.route['parameterCode'].toString(),
drugId: _selectedMedication.itemId.toString(), drugId: widget.selectedMedication.itemId.toString(),
strength: strengthController.text, strength: widget.strength,
indication: indicationController.text, indication: widget.indication,
instruction: instructionController.text, instruction: widget.instruction,
doseTime: selectedDate, doseTime: widget.selectedDate,
); );
}, },
)) ))

@ -113,52 +113,49 @@ class _AddPrescriptionFormState extends State<AddPrescriptionForm> {
height: spaceBetweenTextFields, height: spaceBetweenTextFields,
), ),
Container( Container(
child: Form( child: Column(
key: formKey, children: [
child: Column( Visibility(
children: [ visible: visibilitySearch,
Visibility( child: SearchPrescriptionWidget(
visible: visibilitySearch, spaceBetweenTextFields:
child: SearchPrescriptionWidget( spaceBetweenTextFields,
spaceBetweenTextFields: medicineViewModel: model,
spaceBetweenTextFields, prescriptionViewModel:
medicineViewModel: model, widget.prescriptionViewModel,
prescriptionViewModel: onItemSelected:
widget.prescriptionViewModel, (GetMedicationResponseModel
onItemSelected: medication) async {
(GetMedicationResponseModel setState(() {
medication) async { visibilitySearch = !visibilitySearch;
setState(() { _selectedMedication = medication;
visibilitySearch = !visibilitySearch; });
_selectedMedication = medication; GifLoaderDialogUtils.showMyDialog(context);
}); await model.getAssessmentList(patientInfo: widget.patient, isLocalBusy: true);
GifLoaderDialogUtils.showMyDialog(context); GifLoaderDialogUtils.hideDialog(context);
await model.getAssessmentList(patientInfo: widget.patient, isLocalBusy: true); },
GifLoaderDialogUtils.hideDialog(context);
},
),
), ),
Visibility( ),
visible: !visibilitySearch, Visibility(
child: Container( visible: !visibilitySearch,
child: Column( child: Container(
children: [ child: Column(
PrescriptionFormWidget( children: [
patient: widget.patient, PrescriptionFormWidget(
prescriptionViewModel: patient: widget.patient,
widget.prescriptionViewModel, prescriptionViewModel:
medicineViewModel: model, widget.prescriptionViewModel,
prescriptionList: medicineViewModel: model,
widget.prescriptionList, prescriptionList:
selectedMedication: _selectedMedication, widget.prescriptionList,
), selectedMedication: _selectedMedication,
], ),
), ],
), ),
), ),
], ),
), ],
), ),
), ),
], ],

@ -86,7 +86,6 @@ class _PrescriptionFormWidgetState extends State<PrescriptionFormWidget> {
dynamic frequency; dynamic frequency;
dynamic duration; dynamic duration;
dynamic doseTime; dynamic doseTime;
dynamic indication;
dynamic units; dynamic units;
dynamic uom; dynamic uom;
dynamic box; dynamic box;
@ -155,366 +154,368 @@ class _PrescriptionFormWidgetState extends State<PrescriptionFormWidget> {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
final screenSize = MediaQuery.of(context).size; final screenSize = MediaQuery.of(context).size;
return Column( return Form(
children: [ key: formKey,
AppText( child: Column(
widget.selectedMedication?.description ?? "", children: [
fontWeight: FontWeight.w600, AppText(
), widget.selectedMedication?.description ?? "",
SizedBox( fontWeight: FontWeight.w600,
height: 15.0, ),
), SizedBox(
Container( height: 15.0,
child: Row( ),
mainAxisAlignment: MainAxisAlignment.start, Container(
children: [ child: Row(
SizedBox( mainAxisAlignment: MainAxisAlignment.start,
width: 6, children: [
), SizedBox(
AppText( width: 6,
TranslationBase.of(context).orderType, ),
fontWeight: FontWeight.w500, AppText(
), TranslationBase.of(context).orderType,
SizedBox( fontWeight: FontWeight.w500,
width: 18, ),
), SizedBox(
Radio( width: 18,
activeColor: AppGlobal.appRedColor, ),
value: 1, Radio(
groupValue: selectedType, activeColor: AppGlobal.appRedColor,
onChanged: (value) { value: 1,
setSelectedType(value); groupValue: selectedType,
}, onChanged: (value) {
), setSelectedType(value);
Text(TranslationBase.of(context).regular), },
], ),
Text(TranslationBase.of(context).regular),
],
),
), ),
), Container(
Container( width: double.infinity,
width: double.infinity, child: Row(
child: Row( children: [
children: [ Container(
Container( width: MediaQuery.of(context).size.width * 0.35,
width: MediaQuery.of(context).size.width * 0.35, child: AppTextFieldCustom(
child: AppTextFieldCustom( height: 38,
height: 38, validationError: strengthError,
validationError: strengthError, hintText: 'Strength',
hintText: 'Strength', isTextFieldHasSuffix: false,
isTextFieldHasSuffix: false, enabled: true,
enabled: true, controller: strengthController,
controller: strengthController, onChanged: (String value) {
onChanged: (String value) { setState(() {
strengthChar = value.length;
});
if (strengthChar >= 5) {
DrAppToastMsg.showErrorToast(
TranslationBase.of(context)
.only5DigitsAllowedForStrength,
);
}
},
inputType: TextInputType.numberWithOptions(
decimal: true,
),
),
),
SizedBox(
width: 5.0,
),
// Container(
// width: MediaQuery.of(context)
// .size
// .width *
// 0.35,
// child: AppTextFieldCustom(
// height: 38,
// validationError:
// unitError,
// hintText: 'Unit',
// isTextFieldHasSuffix: false,
// enabled: true,
// controller:
// unitController,
// onChanged: (selectedValue) {
// setState(() {
// units = selectedValue;
// units['isDefault'] = true;
// });
// if (strengthChar >= 5) {
// DrAppToastMsg
// .showErrorToast(
// TranslationBase.of(
// context)
// .only5DigitsAllowedForStrength,
// );
// }
// },
// inputType: TextInputType
// .numberWithOptions(
// decimal: true,
// ),
// ),
// ),
PrescriptionTextFiled(
width: MediaQuery.of(context).size.width * 0.510,
element:
widget.medicineViewModel.itemMedicineListUnit.length == 1
? widget.medicineViewModel.itemMedicineListUnit[0]
: units,
elementError: unitError,
keyName: 'description',
keyId: 'parameterCode',
hintText: 'Unit',
elementList: widget.medicineViewModel.itemMedicineListUnit,
okFunction: (selectedValue) {
setState(() { setState(() {
strengthChar = value.length; units = selectedValue;
units['isDefault'] = true;
}); });
if (strengthChar >= 5) {
DrAppToastMsg.showErrorToast(
TranslationBase.of(context)
.only5DigitsAllowedForStrength,
);
}
}, },
inputType: TextInputType.numberWithOptions(
decimal: true,
),
), ),
],
),
),
SizedBox(height: spaceBetweenTextFields),
PrescriptionTextFiled(
elementList: widget.medicineViewModel.itemMedicineListRoute,
element: widget.medicineViewModel.itemMedicineListRoute.length == 1
? route = widget.medicineViewModel.itemMedicineListRoute[0]
: route,
elementError: routeError,
keyId: 'parameterCode',
keyName: 'description',
okFunction: (selectedValue) {
setState(() {
route = selectedValue;
route['isDefault'] = true;
});
},
hintText: TranslationBase.of(context).route,
),
SizedBox(height: spaceBetweenTextFields),
PrescriptionTextFiled(
hintText: TranslationBase.of(context).frequency,
elementError: frequencyError,
// element: frequency,
element: widget.medicineViewModel.itemMedicineListRoute.length == 1
? frequency = widget.medicineViewModel.itemMedicineListRoute[0]
: frequency,
elementList: widget.medicineViewModel.itemMedicineList,
keyId: 'parameterCode',
keyName: 'description',
okFunction: (selectedValue) {
setState(() {
frequency = selectedValue;
frequency['isDefault'] = true;
if (widget.selectedMedication != null &&
duration != null &&
frequency != null &&
strengthController.text != null) {
widget.medicineViewModel.getBoxQuantity(
freq: frequency['parameterCode'],
duration: duration['id'],
itemCode: widget.selectedMedication.itemId,
strength: double.parse(strengthController.text));
return;
}
});
}),
SizedBox(height: spaceBetweenTextFields),
PrescriptionTextFiled(
hintText: TranslationBase.of(context).doseTime,
elementError: doseTimeError,
element: doseTime,
elementList: widget.medicineViewModel.medicationDoseTimeList,
keyId: 'id',
keyName: 'nameEn',
okFunction: (selectedValue) {
setState(() {
doseTime = selectedValue;
});
}),
SizedBox(height: spaceBetweenTextFields),
if (widget.medicineViewModel.patientAssessmentList.isNotEmpty)
Container(
height: screenSize.height * 0.070,
width: double.infinity,
color: Colors.white,
child: Row(
children: [
Container(
width: MediaQuery.of(context).size.width * 0.29,
child: AppTextFieldCustom(
hintText: widget
.medicineViewModel.patientAssessmentList[0].icdCode10ID
.toString(),
// indication != null
// ? indication[
// 'name']
// : null,
enabled: true,
),
),
Container(
width: MediaQuery.of(context).size.width * 0.57,
color: Colors.white,
child: AppTextFieldCustom(
maxLines: 5,
hintText: widget
.medicineViewModel.patientAssessmentList[0].asciiDesc
.toString(),
// indication != null
// ? indication[
// 'name']
// : null,
enabled: true,
),
),
],
), ),
SizedBox( ),
width: 5.0, SizedBox(height: spaceBetweenTextFields),
Container(
color: Colors.transparent,
child: InkWell(
onTap: () => selectDate(context, widget.prescriptionViewModel),
child: AppTextFieldCustom(
validationError: strengthError,
hintText: 'Date',
isTextFieldHasSuffix: true,
suffixIcon: IconButton(
icon: Icon(
Icons.calendar_today,
color: Colors.black,
),
),
dropDownText: selectedDate != null
? "${AppDateUtils.convertStringToDateFormat(selectedDate.toString(), "yyyy-MM-dd")}"
: null,
enabled: false,
controller: strengthController,
), ),
// Container(
// width: MediaQuery.of(context) // TextField(
// .size // decoration:
// .width * // textFieldSelectorDecoration(
// 0.35,
// child: AppTextFieldCustom(
// height: 38,
// validationError:
// unitError,
// hintText: 'Unit',
// isTextFieldHasSuffix: false,
// enabled: true,
// controller:
// unitController,
// onChanged: (selectedValue) {
// setState(() {
// units = selectedValue;
// units['isDefault'] = true;
// });
// if (strengthChar >= 5) {
// DrAppToastMsg
// .showErrorToast(
// TranslationBase.of( // TranslationBase.of(
// context) // context)
// .only5DigitsAllowedForStrength, // .date,
// ); // selectedDate != null
// } // ? "${AppDateUtils.convertStringToDateFormat(selectedDate.toString(), "yyyy-MM-dd")}"
// }, // : null,
// inputType: TextInputType // true,
// .numberWithOptions( // suffixIcon: Icon(
// decimal: true, // Icons.calendar_today,
// ), // color: Colors.black,
// ), // )),
// enabled: false,
// ), // ),
PrescriptionTextFiled( ),
width: MediaQuery.of(context).size.width * 0.510,
element:
widget.medicineViewModel.itemMedicineListUnit.length == 1
? widget.medicineViewModel.itemMedicineListUnit[0]
: units,
elementError: unitError,
keyName: 'description',
keyId: 'parameterCode',
hintText: 'Unit',
elementList: widget.medicineViewModel.itemMedicineListUnit,
okFunction: (selectedValue) {
setState(() {
units = selectedValue;
units['isDefault'] = true;
});
},
),
],
), ),
), SizedBox(height: spaceBetweenTextFields),
SizedBox(height: spaceBetweenTextFields), PrescriptionTextFiled(
PrescriptionTextFiled( element: duration,
elementList: widget.medicineViewModel.itemMedicineListRoute, elementError: durationError,
element: widget.medicineViewModel.itemMedicineListRoute.length == 1 hintText: TranslationBase.of(context).duration,
? route = widget.medicineViewModel.itemMedicineListRoute[0] elementList: widget.medicineViewModel.medicationDurationList,
: route, keyName: 'nameEn',
elementError: routeError, keyId: 'id',
keyId: 'parameterCode',
keyName: 'description',
okFunction: (selectedValue) {
setState(() {
route = selectedValue;
route['isDefault'] = true;
});
},
hintText: TranslationBase.of(context).route,
),
SizedBox(height: spaceBetweenTextFields),
PrescriptionTextFiled(
hintText: TranslationBase.of(context).frequency,
elementError: frequencyError,
// element: frequency,
element: widget.medicineViewModel.itemMedicineListRoute.length == 1
? frequency = widget.medicineViewModel.itemMedicineListRoute[0]
: frequency,
elementList: widget.medicineViewModel.itemMedicineList,
keyId: 'parameterCode',
keyName: 'description',
okFunction: (selectedValue) { okFunction: (selectedValue) {
setState(() { setState(() {
frequency = selectedValue; duration = selectedValue;
frequency['isDefault'] = true;
if (widget.selectedMedication != null && if (widget.selectedMedication != null &&
duration != null && duration != null &&
frequency != null && frequency != null &&
strengthController.text != null) { strengthController.text != null) {
widget.medicineViewModel.getBoxQuantity( // widget.medicineViewModel.getBoxQuantity(
freq: frequency['parameterCode'], // freq: frequency['parameterCode'],
duration: duration['id'], // duration: duration['id'],
itemCode: widget.selectedMedication.itemId, // itemCode: widget.selectedMedication.itemId,
strength: double.parse(strengthController.text)); // strength: double.parse(strengthController.text),
// );
box = widget.medicineViewModel.boxQuintity;
return; return;
} }
}); });
}), },
SizedBox(height: spaceBetweenTextFields), ),
PrescriptionTextFiled( SizedBox(height: spaceBetweenTextFields),
hintText: TranslationBase.of(context).doseTime,
elementError: doseTimeError,
element: doseTime,
elementList: widget.medicineViewModel.medicationDoseTimeList,
keyId: 'id',
keyName: 'nameEn',
okFunction: (selectedValue) {
setState(() {
doseTime = selectedValue;
});
}),
SizedBox(height: spaceBetweenTextFields),
if (widget.medicineViewModel.patientAssessmentList.isNotEmpty)
Container( Container(
height: screenSize.height * 0.070,
width: double.infinity,
color: Colors.white, color: Colors.white,
child: Row( child: AppTextFieldCustom(
children: [ hintText: "UOM",
Container( isTextFieldHasSuffix: false,
width: MediaQuery.of(context).size.width * 0.29, dropDownText: uom != null ? uom : null,
child: AppTextFieldCustom( enabled: false,
hintText: widget
.medicineViewModel.patientAssessmentList[0].icdCode10ID
.toString(),
// indication != null
// ? indication[
// 'name']
// : null,
enabled: true,
),
),
Container(
width: MediaQuery.of(context).size.width * 0.57,
color: Colors.white,
child: AppTextFieldCustom(
maxLines: 5,
hintText: widget
.medicineViewModel.patientAssessmentList[0].asciiDesc
.toString(),
// indication != null
// ? indication[
// 'name']
// : null,
enabled: true,
),
),
],
), ),
), ),
SizedBox(height: spaceBetweenTextFields), SizedBox(height: spaceBetweenTextFields),
Container( Container(
color: Colors.transparent, color: Colors.white,
child: InkWell(
onTap: () => selectDate(context, widget.prescriptionViewModel),
child: AppTextFieldCustom( child: AppTextFieldCustom(
validationError: strengthError, hintText: TranslationBase.of(context).boxQuantity,
hintText: 'Date', isTextFieldHasSuffix: false,
isTextFieldHasSuffix: true, dropDownText: box != null
suffixIcon: IconButton( ? widget.medicineViewModel.boxQuintity.toString()
icon: Icon(
Icons.calendar_today,
color: Colors.black,
),
),
dropDownText: selectedDate != null
? "${AppDateUtils.convertStringToDateFormat(selectedDate.toString(), "yyyy-MM-dd")}"
: null, : null,
enabled: false, enabled: false,
controller: strengthController,
), ),
// TextField(
// decoration:
// textFieldSelectorDecoration(
// TranslationBase.of(
// context)
// .date,
// selectedDate != null
// ? "${AppDateUtils.convertStringToDateFormat(selectedDate.toString(), "yyyy-MM-dd")}"
// : null,
// true,
// suffixIcon: Icon(
// Icons.calendar_today,
// color: Colors.black,
// )),
// enabled: false,
// ),
), ),
), SizedBox(height: spaceBetweenTextFields),
SizedBox(height: spaceBetweenTextFields), Container(
PrescriptionTextFiled( decoration: BoxDecoration(
element: duration, borderRadius: BorderRadius.all(Radius.circular(6.0)),
elementError: durationError, border: Border.all(width: 1.0, color: HexColor("#CCCCCC"))),
hintText: TranslationBase.of(context).duration, child: Stack(
elementList: widget.medicineViewModel.medicationDurationList, children: [
keyName: 'nameEn', TextFields(
keyId: 'id', maxLines: 6,
okFunction: (selectedValue) { minLines: 4,
setState(() { hintText: TranslationBase.of(context).instruction,
duration = selectedValue; controller: instructionController,
if (widget.selectedMedication != null && //keyboardType: TextInputType.number,
duration != null && ),
frequency != null && Positioned(
strengthController.text != null) { top: 0,
widget.medicineViewModel.getBoxQuantity( right: 15,
freq: frequency['parameterCode'], child: IconButton(
duration: duration['id'], icon: Icon(
itemCode: widget.selectedMedication.itemId, DoctorApp.speechtotext,
strength: double.parse(strengthController.text), color: Colors.black,
); size: 35,
box = widget.medicineViewModel.boxQuintity; ),
onPressed: () {
return; initSpeechState().then((value) => {onVoiceText()});
} },
});
},
),
SizedBox(height: spaceBetweenTextFields),
Container(
color: Colors.white,
child: AppTextFieldCustom(
hintText: "UOM",
isTextFieldHasSuffix: false,
dropDownText: uom != null ? uom : null,
enabled: false,
),
),
SizedBox(height: spaceBetweenTextFields),
Container(
color: Colors.white,
child: AppTextFieldCustom(
hintText: TranslationBase.of(context).boxQuantity,
isTextFieldHasSuffix: false,
dropDownText: box != null
? widget.medicineViewModel.boxQuintity.toString()
: null,
enabled: false,
),
),
SizedBox(height: spaceBetweenTextFields),
Container(
decoration: BoxDecoration(
borderRadius: BorderRadius.all(Radius.circular(6.0)),
border: Border.all(width: 1.0, color: HexColor("#CCCCCC"))),
child: Stack(
children: [
TextFields(
maxLines: 6,
minLines: 4,
hintText: TranslationBase.of(context).instruction,
controller: instructionController,
//keyboardType: TextInputType.number,
),
Positioned(
top: 0,
right: 15,
child: IconButton(
icon: Icon(
DoctorApp.speechtotext,
color: Colors.black,
size: 35,
), ),
onPressed: () {
initSpeechState().then((value) => {onVoiceText()});
},
), ),
), ],
], ),
), ),
), SizedBox(height: spaceBetweenTextFields),
SizedBox(height: spaceBetweenTextFields), Container(
Container( margin: EdgeInsets.all(SizeConfig.widthMultiplier * 5),
margin: EdgeInsets.all(SizeConfig.widthMultiplier * 5), child: Wrap(
child: Wrap( alignment: WrapAlignment.center,
alignment: WrapAlignment.center, children: <Widget>[
children: <Widget>[ AppButton(
AppButton( color: Color(0xff359846),
color: Color(0xff359846), title: TranslationBase.of(context).addMedication,
title: TranslationBase.of(context).addMedication, fontWeight: FontWeight.w600,
fontWeight: FontWeight.w600, onPressed: () async {
onPressed: () async { addMedicationButton(widget.medicineViewModel);
addMedicationButton(widget.medicineViewModel); },
}, ),
), ],
], ),
), ),
), ],
], ),
); );
} }
@ -537,15 +538,27 @@ class _PrescriptionFormWidgetState extends State<PrescriptionFormWidget> {
} }
openDrugToDrug( openDrugToDrug(
MedicineViewModel model, PrescriptionViewModel modelPrescription) { MedicineViewModel medicineViewModel, PrescriptionViewModel modelPrescription) {
showModalBottomSheet( showModalBottomSheet(
context: context, context: context,
builder: (context) { builder: (context) {
return AddDrugWidget( return AddDrugWidget(
patient: widget.patient, patient: widget.patient,
medicineModel: model, medicineModel: widget.medicineViewModel,
modelPrescription: modelPrescription, modelPrescription: widget.prescriptionViewModel,
prescriptionList: widget.prescriptionList, prescriptionList: widget.prescriptionList,
route: route,
doseTime: doseTime,
duration: duration,
frequency: frequency,
units: units,
uom: uom,
x: x,
selectedMedication: widget.selectedMedication,
strength: strengthController.text,
indication: indicationController.text,
instruction: instructionController.text,
selectedDate: selectedDate,
); );
}); });
} }
@ -578,7 +591,7 @@ class _PrescriptionFormWidgetState extends State<PrescriptionFormWidget> {
if (formKey.currentState.validate()) { if (formKey.currentState.validate()) {
Navigator.pop(context); Navigator.pop(context);
openDrugToDrug(model, widget.prescriptionViewModel); openDrugToDrug(model, prescriptionViewModel);
} }
} else { } else {
setState(() { setState(() {

Loading…
Cancel
Save