diff --git a/lib/screens/prescription/add_prescription/prescription_form_widget.dart b/lib/screens/prescription/add_prescription/prescription_form_widget.dart index 7aefa133..7af4b67b 100644 --- a/lib/screens/prescription/add_prescription/prescription_form_widget.dart +++ b/lib/screens/prescription/add_prescription/prescription_form_widget.dart @@ -61,7 +61,7 @@ class _PrescriptionFormWidgetState extends State { bool visibilityPrescriptionForm = false; bool visibilitySearch = true; - DateTime selectedDate = DateTime.now(); + DateTime? selectedDate; int? strengthChar; GlobalKey key = new GlobalKey>(); @@ -217,7 +217,7 @@ getIcdCodeData() async{ ), PrescriptionTextFiled( width: MediaQuery.of(context).size.width * 0.510, - element: widget.medicineViewModel.itemMedicineListUnit.length == 1 ? widget.medicineViewModel.itemMedicineListUnit[0] : units, + element: widget.medicineViewModel.itemMedicineListUnit.length == 1 ? units= widget.medicineViewModel.itemMedicineListUnit[0] : units, elementError: unitError, keyName: 'description', keyId: 'parameterCode', @@ -252,7 +252,7 @@ getIcdCodeData() async{ hintText: TranslationBase.of(context).frequency, elementError: frequencyError, // element: frequency, - element: widget.medicineViewModel.medicationFrequencyList.length == 1 ? frequency = widget.medicineViewModel.medicationFrequencyList[0] : frequency, + element: widget.medicineViewModel.itemMedicineList.length == 1 ? frequency = widget.medicineViewModel.itemMedicineList[0] : frequency, elementList: widget.medicineViewModel.itemMedicineList, keyId: 'parameterCode', keyName: 'description', @@ -314,6 +314,7 @@ getIcdCodeData() async{ setState(() { icdNameController.text; }); + }, height: Utils.getTextFieldHeight(), onClick: widget.prescriptionViewModel.icd10DeseaseItems != null @@ -345,8 +346,10 @@ getIcdCodeData() async{ onTap: (){ icdCode = widget.prescriptionViewModel.icd10DeseaseItems[index]; icdNameController.text = widget.prescriptionViewModel.icd10DeseaseItems[index].asciiDesc; - widget.medicineViewModel.patientAssessmentList[0].icdCode10ID = widget.prescriptionViewModel.icd10DeseaseItems[index].codeId; - widget.medicineViewModel.patientAssessmentList[0].asciiDesc = widget.prescriptionViewModel.icd10DeseaseItems[index].asciiDesc; + if(widget.medicineViewModel.patientAssessmentList.isNotEmpty) { + widget.medicineViewModel.patientAssessmentList[0].icdCode10ID = widget.prescriptionViewModel.icd10DeseaseItems[index].codeId; + widget.medicineViewModel.patientAssessmentList[0].asciiDesc = widget.prescriptionViewModel.icd10DeseaseItems[index].asciiDesc; + } icdCodeList.clear(); setState(() { @@ -407,7 +410,9 @@ getIcdCodeData() async{ ), dropDownText: selectedDate != null ? "${AppDateUtils.convertStringToDateFormat(selectedDate.toString(), "yyyy-MM-dd")}" : null, enabled: false, - onChanged: (value) {}, + onChanged: (value) { + + }, onFieldSubmitted: () {}, ), ), @@ -523,6 +528,7 @@ getIcdCodeData() async{ } addMedicationButton(MedicineViewModel model) async { + print("Add"); await locator().logEvent( eventCategory: "Add Prescription Form", eventAction: "Add Prescription",