diff --git a/lib/screens/patients/profile/medical_report/AddVerifyMedicalReport.dart b/lib/screens/patients/profile/medical_report/AddVerifyMedicalReport.dart index 72ee1311..b9a3f09f 100644 --- a/lib/screens/patients/profile/medical_report/AddVerifyMedicalReport.dart +++ b/lib/screens/patients/profile/medical_report/AddVerifyMedicalReport.dart @@ -23,7 +23,7 @@ class AddVerifyMedicalReport extends StatefulWidget { final String medicalNote; const AddVerifyMedicalReport( - {Key key, + {Key? key, this.patient, this.patientType, this.arrivalType, diff --git a/lib/screens/patients/profile/operation_report/operation_report.dart b/lib/screens/patients/profile/operation_report/operation_report.dart index f0e611a6..d93117c8 100644 --- a/lib/screens/patients/profile/operation_report/operation_report.dart +++ b/lib/screens/patients/profile/operation_report/operation_report.dart @@ -36,7 +36,7 @@ DrAppSharedPreferances sharedPref = new DrAppSharedPreferances(); class OperationReportScreen extends StatefulWidget { final int visitType; - const OperationReportScreen({Key key, this.visitType}) : super(key: key); + const OperationReportScreen({Key? key, this.visitType}) : super(key: key); @override _ProgressNoteState createState() => _ProgressNoteState(); diff --git a/lib/screens/patients/profile/prescriptions/out_patient_prescription_details_item.dart b/lib/screens/patients/profile/prescriptions/out_patient_prescription_details_item.dart index 50585143..ebc6ac0a 100644 --- a/lib/screens/patients/profile/prescriptions/out_patient_prescription_details_item.dart +++ b/lib/screens/patients/profile/prescriptions/out_patient_prescription_details_item.dart @@ -7,7 +7,7 @@ import 'package:flutter/material.dart'; class OutPatientPrescriptionDetailsItem extends StatefulWidget { final PrescriptionReport prescriptionReport; - OutPatientPrescriptionDetailsItem({Key key, this.prescriptionReport}); + OutPatientPrescriptionDetailsItem({Key? key, this.prescriptionReport}); @override _OutPatientPrescriptionDetailsItemState createState() => diff --git a/lib/screens/patients/profile/radiology/radiology_details_page.dart b/lib/screens/patients/profile/radiology/radiology_details_page.dart index 1e742de9..0cc89795 100644 --- a/lib/screens/patients/profile/radiology/radiology_details_page.dart +++ b/lib/screens/patients/profile/radiology/radiology_details_page.dart @@ -22,7 +22,7 @@ class RadiologyDetailsPage extends StatelessWidget { final bool isInpatient; RadiologyDetailsPage( - {Key key, this.finalRadiology, this.patient, this.patientType, this.arrivalType, this.isInpatient = false}); + {Key? key, this.finalRadiology, this.patient, this.patientType, this.arrivalType, this.isInpatient = false}); @override Widget build(BuildContext context) { diff --git a/lib/screens/patients/profile/referral/AddReplayOnReferralPatient.dart b/lib/screens/patients/profile/referral/AddReplayOnReferralPatient.dart index 15d176d0..9d37a61f 100644 --- a/lib/screens/patients/profile/referral/AddReplayOnReferralPatient.dart +++ b/lib/screens/patients/profile/referral/AddReplayOnReferralPatient.dart @@ -30,7 +30,7 @@ class AddReplayOnReferralPatient extends StatefulWidget { final bool isEdited; const AddReplayOnReferralPatient( - {Key key, + {Key? key, this.patientReferralViewModel, this.myReferralInPatientModel, this.isEdited, diff --git a/lib/screens/patients/profile/referral/my-referral-detail-screen.dart b/lib/screens/patients/profile/referral/my-referral-detail-screen.dart index 58569dc1..be7cbd91 100644 --- a/lib/screens/patients/profile/referral/my-referral-detail-screen.dart +++ b/lib/screens/patients/profile/referral/my-referral-detail-screen.dart @@ -19,7 +19,7 @@ import 'package:flutter/material.dart'; class MyReferralDetailScreen extends StatelessWidget { final MyReferralPatientModel? referralPatient; - const MyReferralDetailScreen({Key key, this.referralPatient}) + const MyReferralDetailScreen({Key? key, this.referralPatient}) : super(key: key); @override diff --git a/lib/screens/patients/profile/soap_update/shared_soap_widgets/SOAP_open_items.dart b/lib/screens/patients/profile/soap_update/shared_soap_widgets/SOAP_open_items.dart index 6449913c..217daf7b 100644 --- a/lib/screens/patients/profile/soap_update/shared_soap_widgets/SOAP_open_items.dart +++ b/lib/screens/patients/profile/soap_update/shared_soap_widgets/SOAP_open_items.dart @@ -7,7 +7,7 @@ class SOAPOpenItems extends StatelessWidget { final Function onTap; final String label; - const SOAPOpenItems({Key key, this.onTap, this.label}) : super(key: key); + const SOAPOpenItems({Key? key, this.onTap, this.label}) : super(key: key); @override Widget build(BuildContext context) { return InkWell( diff --git a/lib/screens/patients/profile/soap_update/shared_soap_widgets/bottom_sheet_dialog_button.dart b/lib/screens/patients/profile/soap_update/shared_soap_widgets/bottom_sheet_dialog_button.dart index 4bb9b6a6..b9e6ba14 100644 --- a/lib/screens/patients/profile/soap_update/shared_soap_widgets/bottom_sheet_dialog_button.dart +++ b/lib/screens/patients/profile/soap_update/shared_soap_widgets/bottom_sheet_dialog_button.dart @@ -9,7 +9,7 @@ class BottomSheetDialogButton extends StatelessWidget { double headerHeight = SizeConfig.heightMultiplier * 12; - BottomSheetDialogButton({Key key, this.onTap, this.label}) : super(key: key); + BottomSheetDialogButton({Key? key, this.onTap, this.label}) : super(key: key); @override Widget build(BuildContext context) { diff --git a/lib/screens/patients/profile/soap_update/shared_soap_widgets/bottom_sheet_title.dart b/lib/screens/patients/profile/soap_update/shared_soap_widgets/bottom_sheet_title.dart index f5134c1c..dd111610 100644 --- a/lib/screens/patients/profile/soap_update/shared_soap_widgets/bottom_sheet_title.dart +++ b/lib/screens/patients/profile/soap_update/shared_soap_widgets/bottom_sheet_title.dart @@ -4,7 +4,7 @@ import 'package:flutter/material.dart'; class BottomSheetTitle extends StatelessWidget with PreferredSizeWidget { BottomSheetTitle({ - Key key, + Key? key, this.title, }) : super(key: key); diff --git a/lib/screens/patients/profile/soap_update/shared_soap_widgets/expandable_SOAP_widget.dart b/lib/screens/patients/profile/soap_update/shared_soap_widgets/expandable_SOAP_widget.dart index c1b2d443..114eaab4 100644 --- a/lib/screens/patients/profile/soap_update/shared_soap_widgets/expandable_SOAP_widget.dart +++ b/lib/screens/patients/profile/soap_update/shared_soap_widgets/expandable_SOAP_widget.dart @@ -14,7 +14,7 @@ class ExpandableSOAPWidget extends StatelessWidget { final bool isRequired; const ExpandableSOAPWidget( - {Key key, this.isExpanded, this.child, this.onTap, this.headerTitle, this.isRequired= true}) + {Key? key, this.isExpanded, this.child, this.onTap, this.headerTitle, this.isRequired= true}) : super(key: key); @override diff --git a/lib/screens/patients/profile/soap_update/shared_soap_widgets/remove_button.dart b/lib/screens/patients/profile/soap_update/shared_soap_widgets/remove_button.dart index 568cfe30..e989852d 100644 --- a/lib/screens/patients/profile/soap_update/shared_soap_widgets/remove_button.dart +++ b/lib/screens/patients/profile/soap_update/shared_soap_widgets/remove_button.dart @@ -10,7 +10,7 @@ class RemoveButton extends StatelessWidget { final VoidCallback? onTap; final String? label; - const RemoveButton({Key key, this.onTap, this.label}) : super(key: key); + const RemoveButton({Key? key, this.onTap, this.label}) : super(key: key); @override Widget build(BuildContext context) { diff --git a/lib/screens/patients/profile/soap_update/subjective/allergies/update_allergies_widget.dart b/lib/screens/patients/profile/soap_update/subjective/allergies/update_allergies_widget.dart index f3748df3..74ad8881 100644 --- a/lib/screens/patients/profile/soap_update/subjective/allergies/update_allergies_widget.dart +++ b/lib/screens/patients/profile/soap_update/subjective/allergies/update_allergies_widget.dart @@ -17,7 +17,7 @@ import 'add_allergies.dart'; class UpdateAllergiesWidget extends StatefulWidget { List myAllergiesList; - UpdateAllergiesWidget({Key key, this.myAllergiesList}); + UpdateAllergiesWidget({Key? key, this.myAllergiesList}); @override _UpdateAllergiesWidgetState createState() => _UpdateAllergiesWidgetState(); diff --git a/lib/screens/patients/profile/soap_update/subjective/cheif_complaints/update_Chief_complaints.dart b/lib/screens/patients/profile/soap_update/subjective/cheif_complaints/update_Chief_complaints.dart index 0e5e6ec1..9602e4b1 100644 --- a/lib/screens/patients/profile/soap_update/subjective/cheif_complaints/update_Chief_complaints.dart +++ b/lib/screens/patients/profile/soap_update/subjective/cheif_complaints/update_Chief_complaints.dart @@ -7,7 +7,7 @@ import '../medication/update_medication_widget.dart'; class UpdateChiefComplaints extends StatelessWidget { const UpdateChiefComplaints({ - Key key, + Key? key, @required this.formKey, @required this.complaintsController, @required this.illnessController, diff --git a/lib/screens/patients/profile/soap_update/subjective/medication/update_medication_widget.dart b/lib/screens/patients/profile/soap_update/subjective/medication/update_medication_widget.dart index c6427511..66415288 100644 --- a/lib/screens/patients/profile/soap_update/subjective/medication/update_medication_widget.dart +++ b/lib/screens/patients/profile/soap_update/subjective/medication/update_medication_widget.dart @@ -9,7 +9,7 @@ class UpdateMedicationWidget extends StatefulWidget { final TextEditingController medicationController; UpdateMedicationWidget({ - Key key, + Key? key, this.medicationController, }); diff --git a/lib/screens/prescription/update_prescription_form.dart b/lib/screens/prescription/update_prescription_form.dart index edd90190..a553d13a 100644 --- a/lib/screens/prescription/update_prescription_form.dart +++ b/lib/screens/prescription/update_prescription_form.dart @@ -42,22 +42,22 @@ class UpdatePrescriptionForm extends StatefulWidget { final PrescriptionViewModel model; UpdatePrescriptionForm( - {this.drugName, - this.doseStreangth, - this.drugId, - this.remarks, - this.patient, - this.duration, - this.route, - this.dose, - this.startDate, - this.doseUnit, - this.enteredRemarks, - this.frequency, - this.model, - this.drugNameGeneric, - this.uom, - this.box}); + {required this.drugName, + required this.doseStreangth, + required this.drugId, + required this.remarks, + required this.patient, + required this.duration, + required this.route, + required this.dose, + required this.startDate, + required this.doseUnit, + required this.enteredRemarks, + required this.frequency, + required this.model, + required this.drugNameGeneric, + required this.uom, + required this.box}); @override _UpdatePrescriptionFormState createState() => _UpdatePrescriptionFormState(); } @@ -66,19 +66,18 @@ class _UpdatePrescriptionFormState extends State { TextEditingController strengthController = TextEditingController(); TextEditingController remarksController = TextEditingController(); int testNum = 0; - int strengthChar; - PatiantInformtion patient; + late int strengthChar; + late PatiantInformtion patient; dynamic route; dynamic doseTime; dynamic frequencyUpdate; dynamic updatedDuration; dynamic units; - GetMedicationResponseModel newSelectedMedication; - GlobalKey key = - new GlobalKey>(); - List indicationList; + late GetMedicationResponseModel newSelectedMedication; + GlobalKey key = new GlobalKey>(); + late List indicationList; dynamic indication; - DateTime selectedDate; + late DateTime selectedDate; @override void initState() { super.initState(); @@ -91,10 +90,7 @@ class _UpdatePrescriptionFormState extends State { dynamic indication3 = {"id": 547, "name": "Hypertrichosis"}; dynamic indication4 = {"id": 548, "name": "Mild Dizziness"}; dynamic indication5 = {"id": 549, "name": "Enlargement of Facial Features"}; - dynamic indication6 = { - "id": 550, - "name": "Phenytoin Hypersensitivity Syndrome" - }; + dynamic indication6 = {"id": 550, "name": "Phenytoin Hypersensitivity Syndrome"}; dynamic indication7 = {"id": 551, "name": "Asterixis"}; dynamic indication8 = {"id": 552, "name": "Bullous Dermatitis"}; dynamic indication9 = {"id": 554, "name": "Purpuric Dermatitis"}; @@ -115,8 +111,7 @@ class _UpdatePrescriptionFormState extends State { @override Widget build(BuildContext context) { final screenSize = MediaQuery.of(context).size; - return StatefulBuilder(builder: - (BuildContext context, StateSetter setState /*You can rename this!*/) { + return StatefulBuilder(builder: (BuildContext context, StateSetter setState /*You can rename this!*/) { return BaseView( onModelReady: (model) async { await model.getMedicationList(); @@ -127,20 +122,13 @@ class _UpdatePrescriptionFormState extends State { await model.getMedicationDoseTime(); await model.getItem(itemID: widget.drugId); //await model.getMedicationIndications(); - route = model.getLookupByIdFilter( - model.itemMedicineListRoute, widget.route); - doseTime = - model.getLookupById(model.medicationDoseTimeList, widget.dose); - updatedDuration = model.getLookupById( - model.medicationDurationList, widget.duration); - units = model.getLookupByIdFilter( - model.itemMedicineListUnit, widget.doseUnit); - frequencyUpdate = model.getLookupById( - model.medicationFrequencyList, widget.frequency); + route = model.getLookupByIdFilter(model.itemMedicineListRoute, widget.route); + doseTime = model.getLookupById(model.medicationDoseTimeList, widget.dose); + updatedDuration = model.getLookupById(model.medicationDurationList, widget.duration); + units = model.getLookupByIdFilter(model.itemMedicineListUnit, widget.doseUnit); + frequencyUpdate = model.getLookupById(model.medicationFrequencyList, widget.frequency); }, - builder: - (BuildContext context, MedicineViewModel model, Widget child) => - NetworkBaseView( + builder: (BuildContext context, MedicineViewModel model, Widget? child) => NetworkBaseView( baseViewModel: model, child: GestureDetector( onTap: () { @@ -150,15 +138,13 @@ class _UpdatePrescriptionFormState extends State { initialChildSize: 0.98, maxChildSize: 0.99, minChildSize: 0.6, - builder: - (BuildContext context, ScrollController scrollController) { + builder: (BuildContext context, ScrollController scrollController) { return SingleChildScrollView( child: Container( height: MediaQuery.of(context).size.height * 1.5, child: Form( child: Padding( - padding: EdgeInsets.symmetric( - horizontal: 20.0, vertical: 12.0), + padding: EdgeInsets.symmetric(horizontal: 20.0, vertical: 12.0), child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ @@ -244,25 +230,16 @@ class _UpdatePrescriptionFormState extends State { // height: 12, // ), Container( - height: - MediaQuery.of(context).size.height * - 0.060, + height: MediaQuery.of(context).size.height * 0.060, width: double.infinity, child: Row( children: [ Container( - width: MediaQuery.of(context) - .size - .width * - 0.4900, - height: MediaQuery.of(context) - .size - .height * - 0.55, + width: MediaQuery.of(context).size.width * 0.4900, + height: MediaQuery.of(context).size.height * 0.55, child: TextFields( inputFormatters: [ - LengthLimitingTextInputFormatter( - 5), + LengthLimitingTextInputFormatter(5), // WhitelistingTextInputFormatter // .digitsOnly ], @@ -270,8 +247,7 @@ class _UpdatePrescriptionFormState extends State { hintText: widget.doseStreangth, fontSize: 15.0, controller: strengthController, - keyboardType: TextInputType - .numberWithOptions( + keyboardType: TextInputType.numberWithOptions( decimal: true, ), onChanged: (String value) { @@ -279,8 +255,7 @@ class _UpdatePrescriptionFormState extends State { strengthChar = value.length; }); if (strengthChar >= 5) { - DrAppToastMsg.showErrorToast( - "Only 5 Digits allowed for strength"); + DrAppToastMsg.showErrorToast("Only 5 Digits allowed for strength"); } }, // validator: (value) { @@ -298,59 +273,34 @@ class _UpdatePrescriptionFormState extends State { width: 10.0, ), Container( - width: MediaQuery.of(context) - .size - .width * - 0.3700, + width: MediaQuery.of(context).size.width * 0.3700, child: InkWell( - onTap: - model.itemMedicineListUnit != - null - ? () { - Helpers.hideKeyboard( - context); - ListSelectDialog - dialog = - ListSelectDialog( - list: model - .itemMedicineListUnit, - attributeName: - 'description', - attributeValueId: - 'parameterCode', - okText: - TranslationBase.of( - context) - .ok, - okFunction: - (selectedValue) { - setState(() { - units = - selectedValue; - }); - }, - ); - showDialog( - barrierDismissible: - false, - context: context, - builder: - (BuildContext - context) { - return dialog; - }, - ); - } - : null, + onTap: model.itemMedicineListUnit != null + ? () { + Helpers.hideKeyboard(context); + ListSelectDialog dialog = ListSelectDialog( + list: model.itemMedicineListUnit, + attributeName: 'description', + attributeValueId: 'parameterCode', + okText: TranslationBase.of(context).ok, + okFunction: (selectedValue) { + setState(() { + units = selectedValue; + }); + }, + ); + showDialog( + barrierDismissible: false, + context: context, + builder: (BuildContext context) { + return dialog; + }, + ); + } + : null, child: TextField( - decoration: - textFieldSelectorDecoration( - 'UNIT Type', - units != null - ? units[ - 'description'] - : null, - true), + decoration: textFieldSelectorDecoration( + 'UNIT Type', units != null ? units['description'] : null, true), enabled: false, ), ), @@ -362,51 +312,37 @@ class _UpdatePrescriptionFormState extends State { height: 12, ), Container( - height: - MediaQuery.of(context).size.height * - 0.070, + height: MediaQuery.of(context).size.height * 0.070, child: InkWell( - onTap: model.itemMedicineListRoute != - null + onTap: model.itemMedicineListRoute != null ? () { - Helpers.hideKeyboard(context); - ListSelectDialog dialog = - ListSelectDialog( - list: model - .itemMedicineListRoute, - attributeName: 'description', - attributeValueId: - 'parameterCode', - okText: TranslationBase.of( - context) - .ok, - okFunction: (selectedValue) { - setState(() { - route = selectedValue; - }); - if (route == null) { - route = route['id']; - } - }, - ); - showDialog( - barrierDismissible: false, - context: context, - builder: - (BuildContext context) { - return dialog; - }, - ); + Helpers.hideKeyboard(context); + ListSelectDialog dialog = ListSelectDialog( + list: model.itemMedicineListRoute, + attributeName: 'description', + attributeValueId: 'parameterCode', + okText: TranslationBase.of(context).ok, + okFunction: (selectedValue) { + setState(() { + route = selectedValue; + }); + if (route == null) { + route = route['id']; } + }, + ); + showDialog( + barrierDismissible: false, + context: context, + builder: (BuildContext context) { + return dialog; + }, + ); + } : null, child: TextField( - decoration: - textFieldSelectorDecoration( - 'Route', - route != null - ? route['description'] - : null, - true), + decoration: textFieldSelectorDecoration( + 'Route', route != null ? route['description'] : null, true), enabled: false, ), ), @@ -415,48 +351,34 @@ class _UpdatePrescriptionFormState extends State { height: 12.0, ), Container( - height: - MediaQuery.of(context).size.height * - 0.070, + height: MediaQuery.of(context).size.height * 0.070, child: InkWell( - onTap: model.medicationDoseTimeList != - null + onTap: model.medicationDoseTimeList != null ? () { - Helpers.hideKeyboard(context); - ListSelectDialog dialog = - ListSelectDialog( - list: model - .medicationDoseTimeList, - attributeName: 'nameEn', - attributeValueId: 'id', - okText: TranslationBase.of( - context) - .ok, - okFunction: (selectedValue) { - setState(() { - doseTime = selectedValue; - }); - }, - ); - showDialog( - barrierDismissible: false, - context: context, - builder: - (BuildContext context) { - return dialog; - }, - ); - } + Helpers.hideKeyboard(context); + ListSelectDialog dialog = ListSelectDialog( + list: model.medicationDoseTimeList, + attributeName: 'nameEn', + attributeValueId: 'id', + okText: TranslationBase.of(context).ok, + okFunction: (selectedValue) { + setState(() { + doseTime = selectedValue; + }); + }, + ); + showDialog( + barrierDismissible: false, + context: context, + builder: (BuildContext context) { + return dialog; + }, + ); + } : null, child: TextField( - decoration: - textFieldSelectorDecoration( - TranslationBase.of(context) - .doseTime, - doseTime != null - ? doseTime['nameEn'] - : null, - true), + decoration: textFieldSelectorDecoration(TranslationBase.of(context).doseTime!, + doseTime != null ? doseTime['nameEn'] : null, true), enabled: false, ), ), @@ -465,50 +387,36 @@ class _UpdatePrescriptionFormState extends State { height: 12.0, ), Container( - height: - MediaQuery.of(context).size.height * - 0.070, + height: MediaQuery.of(context).size.height * 0.070, child: InkWell( - onTap: model.medicationFrequencyList != - null + onTap: model.medicationFrequencyList != null ? () { - Helpers.hideKeyboard(context); - ListSelectDialog dialog = - ListSelectDialog( - list: model - .medicationFrequencyList, - attributeName: 'nameEn', - attributeValueId: 'id', - okText: TranslationBase.of( - context) - .ok, - okFunction: (selectedValue) { - setState(() { - frequencyUpdate = - selectedValue; - }); - }, - ); - showDialog( - barrierDismissible: false, - context: context, - builder: - (BuildContext context) { - return dialog; - }, - ); - } + Helpers.hideKeyboard(context); + ListSelectDialog dialog = ListSelectDialog( + list: model.medicationFrequencyList, + attributeName: 'nameEn', + attributeValueId: 'id', + okText: TranslationBase.of(context).ok, + okFunction: (selectedValue) { + setState(() { + frequencyUpdate = selectedValue; + }); + }, + ); + showDialog( + barrierDismissible: false, + context: context, + builder: (BuildContext context) { + return dialog; + }, + ); + } : null, child: TextField( - decoration: - textFieldSelectorDecoration( - TranslationBase.of(context) - .frequency, - frequencyUpdate != null - ? frequencyUpdate[ - 'nameEn'] - : null, - true), + decoration: textFieldSelectorDecoration( + TranslationBase.of(context).frequency!, + frequencyUpdate != null ? frequencyUpdate['nameEn'] : null, + true), enabled: false, ), ), @@ -517,51 +425,36 @@ class _UpdatePrescriptionFormState extends State { height: 12.0, ), Container( - height: - MediaQuery.of(context).size.height * - 0.070, + height: MediaQuery.of(context).size.height * 0.070, child: InkWell( - onTap: model.medicationDurationList != - null + onTap: model.medicationDurationList != null ? () { - Helpers.hideKeyboard(context); - ListSelectDialog dialog = - ListSelectDialog( - list: model - .medicationDurationList, - attributeName: 'nameEn', - attributeValueId: 'id', - okText: TranslationBase.of( - context) - .ok, - okFunction: (selectedValue) { - setState(() { - updatedDuration = - selectedValue; - }); - }, - ); - showDialog( - barrierDismissible: false, - context: context, - builder: - (BuildContext context) { - return dialog; - }, - ); - } + Helpers.hideKeyboard(context); + ListSelectDialog dialog = ListSelectDialog( + list: model.medicationDurationList, + attributeName: 'nameEn', + attributeValueId: 'id', + okText: TranslationBase.of(context).ok, + okFunction: (selectedValue) { + setState(() { + updatedDuration = selectedValue; + }); + }, + ); + showDialog( + barrierDismissible: false, + context: context, + builder: (BuildContext context) { + return dialog; + }, + ); + } : null, child: TextField( - decoration: - textFieldSelectorDecoration( - TranslationBase.of(context) - .duration, - updatedDuration != null - ? updatedDuration[ - 'nameEn'] - .toString() - : null, - true), + decoration: textFieldSelectorDecoration( + TranslationBase.of(context).duration!, + updatedDuration != null ? updatedDuration['nameEn'].toString() : null, + true), enabled: false, ), ), @@ -570,89 +463,55 @@ class _UpdatePrescriptionFormState extends State { height: 12.0, ), Container( - height: model.patientAssessmentList - .isNotEmpty - ? screenSize.height * 0.070 - : 0.0, - width: model.patientAssessmentList - .isNotEmpty - ? double.infinity - : 0.0, - child: model.patientAssessmentList - .isNotEmpty + height: + model.patientAssessmentList.isNotEmpty ? screenSize.height * 0.070 : 0.0, + width: model.patientAssessmentList.isNotEmpty ? double.infinity : 0.0, + child: model.patientAssessmentList.isNotEmpty ? Row( - children: [ - Container( - width: - MediaQuery.of(context) - .size - .width * - 0.29, - child: InkWell( - onTap: - indicationList != null - ? () { - Helpers.hideKeyboard( - context); - } - : null, - child: TextField( - decoration: textFieldSelectorDecoration( - model.patientAssessmentList - .isNotEmpty - ? model - .patientAssessmentList[ - 0] - .icdCode10ID - .toString() - : '', - indication != null - ? indication[ - 'name'] - : null, - true), - enabled: true, - readOnly: true, - ), - ), - ), - Container( - width: - MediaQuery.of(context) - .size - .width * - 0.61, - child: InkWell( - onTap: - indicationList != null - ? () { - Helpers.hideKeyboard( - context); - } - : null, - child: TextField( - maxLines: 3, - decoration: textFieldSelectorDecoration( - model.patientAssessmentList - .isNotEmpty - ? model - .patientAssessmentList[ - 0] - .asciiDesc - .toString() - : '', - indication != null - ? indication[ - 'name'] - : null, - true), - enabled: true, - readOnly: true, - ), - ), - ), - ], - ) + children: [ + Container( + width: MediaQuery.of(context).size.width * 0.29, + child: InkWell( + onTap: indicationList != null + ? () { + Helpers.hideKeyboard(context); + } + : null, + child: TextField( + decoration: textFieldSelectorDecoration( + model.patientAssessmentList.isNotEmpty + ? model.patientAssessmentList[0].icdCode10ID.toString() + : '', + indication != null ? indication['name'] : null, + true), + enabled: true, + readOnly: true, + ), + ), + ), + Container( + width: MediaQuery.of(context).size.width * 0.61, + child: InkWell( + onTap: indicationList != null + ? () { + Helpers.hideKeyboard(context); + } + : null, + child: TextField( + maxLines: 3, + decoration: textFieldSelectorDecoration( + model.patientAssessmentList.isNotEmpty + ? model.patientAssessmentList[0].asciiDesc.toString() + : '', + indication != null ? indication['name'] : null, + true), + enabled: true, + readOnly: true, + ), + ), + ), + ], + ) : null), SizedBox( height: 12.0, @@ -660,22 +519,18 @@ class _UpdatePrescriptionFormState extends State { Container( height: screenSize.height * 0.070, child: InkWell( - onTap: () => - selectDate(context, widget.model), + onTap: () => selectDate(context, widget.model), child: TextField( - decoration: Helpers - .textFieldSelectorDecoration( - AppDateUtils.getDateFormatted( - DateTime.parse( - widget.startDate)), - selectedDate != null - ? "${AppDateUtils.convertStringToDateFormat(selectedDate.toString(), "yyyy-MM-dd")}" - : null, - true, - suffixIcon: Icon( - Icons.calendar_today, - color: Colors.black, - )), + decoration: Helpers.textFieldSelectorDecoration( + AppDateUtils.getDateFormatted(DateTime.parse(widget.startDate)), + selectedDate != null + ? "${AppDateUtils.convertStringToDateFormat(selectedDate.toString(), "yyyy-MM-dd")}" + : null, + true, + suffixIcon: Icon( + Icons.calendar_today, + color: Colors.black, + )), enabled: false, ), ), @@ -688,39 +543,30 @@ class _UpdatePrescriptionFormState extends State { child: InkWell( onTap: model.allMedicationList != null ? () { - Helpers.hideKeyboard(context); - ListSelectDialog dialog = - ListSelectDialog( - list: model.allMedicationList, - attributeName: 'nameEn', - attributeValueId: 'id', - okText: TranslationBase.of( - context) - .ok, - okFunction: (selectedValue) { - setState(() { - // duration = selectedValue; - }); - }, - ); - showDialog( - barrierDismissible: false, - context: context, - builder: - (BuildContext context) { - return dialog; - }, - ); - } + Helpers.hideKeyboard(context); + ListSelectDialog dialog = ListSelectDialog( + list: model.allMedicationList, + attributeName: 'nameEn', + attributeValueId: 'id', + okText: TranslationBase.of(context).ok, + okFunction: (selectedValue) { + setState(() { + // duration = selectedValue; + }); + }, + ); + showDialog( + barrierDismissible: false, + context: context, + builder: (BuildContext context) { + return dialog; + }, + ); + } : null, child: TextField( - decoration: - textFieldSelectorDecoration( - "UOM", - widget.uom != null - ? widget.uom - : null, - true), + decoration: textFieldSelectorDecoration( + "UOM", widget.uom != null ? widget.uom : null, true), // enabled: false, readOnly: true, ), @@ -731,40 +577,32 @@ class _UpdatePrescriptionFormState extends State { child: InkWell( onTap: model.allMedicationList != null ? () { - Helpers.hideKeyboard(context); - ListSelectDialog dialog = - ListSelectDialog( - list: model.allMedicationList, - attributeName: 'nameEn', - attributeValueId: 'id', - okText: TranslationBase.of( - context) - .ok, - okFunction: (selectedValue) { - setState(() { - // duration = selectedValue; - }); - }, - ); - showDialog( - barrierDismissible: false, - context: context, - builder: - (BuildContext context) { - return dialog; - }, - ); - } + Helpers.hideKeyboard(context); + ListSelectDialog dialog = ListSelectDialog( + list: model.allMedicationList, + attributeName: 'nameEn', + attributeValueId: 'id', + okText: TranslationBase.of(context).ok, + okFunction: (selectedValue) { + setState(() { + // duration = selectedValue; + }); + }, + ); + showDialog( + barrierDismissible: false, + context: context, + builder: (BuildContext context) { + return dialog; + }, + ); + } : null, child: TextField( - decoration: - textFieldSelectorDecoration( - 'Box Quantity', - widget.box != null - ? "Box Quantity: " + - widget.box.toString() - : null, - true), + decoration: textFieldSelectorDecoration( + 'Box Quantity', + widget.box != null ? "Box Quantity: " + widget.box.toString() : null, + true), // enabled: false, readOnly: true, ), @@ -775,11 +613,8 @@ class _UpdatePrescriptionFormState extends State { ), Container( decoration: BoxDecoration( - borderRadius: BorderRadius.all( - Radius.circular(6.0)), - border: Border.all( - width: 1.0, - color: HexColor("#CCCCCC"))), + borderRadius: BorderRadius.all(Radius.circular(6.0)), + border: Border.all(width: 1.0, color: HexColor("#CCCCCC"))), child: TextFields( controller: remarksController, maxLines: 7, @@ -790,59 +625,39 @@ class _UpdatePrescriptionFormState extends State { height: 10.0, ), SizedBox( - height: - MediaQuery.of(context).size.height * - 0.08, + height: MediaQuery.of(context).size.height * 0.08, ), Container( - margin: EdgeInsets.all( - SizeConfig.widthMultiplier * 2), + margin: EdgeInsets.all(SizeConfig.widthMultiplier * 2), child: Wrap( alignment: WrapAlignment.center, children: [ AppButton( - title: 'update prescription' - .toUpperCase(), + title: 'update prescription'.toUpperCase(), onPressed: () { - if (double.parse( - strengthController.text) > - 1000.0) { - DrAppToastMsg.showErrorToast( - "1000 is the MAX for the strength"); + if (double.parse(strengthController.text) > 1000.0) { + DrAppToastMsg.showErrorToast("1000 is the MAX for the strength"); return; } - if (double.parse( - strengthController - .text) == - 0.0) { - DrAppToastMsg.showErrorToast( - "strength can't be zero"); + if (double.parse(strengthController.text) == 0.0) { + DrAppToastMsg.showErrorToast("strength can't be zero"); return; } - if (strengthController - .text.length > - 4) { - DrAppToastMsg.showErrorToast( - "strength can't be more then 4 digits "); + if (strengthController.text.length > 4) { + DrAppToastMsg.showErrorToast("strength can't be more then 4 digits "); return; } // if(units==null&& updatedDuration==null&&frequencyUpdate==null&&) updatePrescription( newStartDate: selectedDate, - newDoseStreangth: - strengthController - .text.isNotEmpty - ? strengthController - .text - : widget - .doseStreangth, + newDoseStreangth: strengthController.text.isNotEmpty + ? strengthController.text + : widget.doseStreangth, newUnit: units != null - ? units['parameterCode'] - .toString() + ? units['parameterCode'].toString() : widget.doseUnit, doseUnit: widget.doseUnit, - doseStreangth: - widget.doseStreangth, + doseStreangth: widget.doseStreangth, duration: widget.duration, startDate: widget.startDate, doseId: widget.dose, @@ -850,30 +665,18 @@ class _UpdatePrescriptionFormState extends State { routeId: widget.route, patient: widget.patient, model: widget.model, - newDuration: - updatedDuration != null - ? updatedDuration['id'] - .toString() - : widget.duration, + newDuration: updatedDuration != null + ? updatedDuration['id'].toString() + : widget.duration, drugId: widget.drugId, - remarks: remarksController - .text, - route: route != null - ? route['parameterCode'] - .toString() - : widget.route, - frequency: - frequencyUpdate != null - ? frequencyUpdate[ - 'id'] - .toString() - : widget.frequency, - dose: doseTime != null - ? doseTime['id'] - .toString() - : widget.dose, - enteredRemarks: - widget.enteredRemarks); + remarks: remarksController.text, + route: + route != null ? route['parameterCode'].toString() : widget.route, + frequency: frequencyUpdate != null + ? frequencyUpdate['id'].toString() + : widget.frequency, + dose: doseTime != null ? doseTime['id'].toString() : widget.dose, + enteredRemarks: widget.enteredRemarks); Navigator.pop(context); }, ), @@ -898,7 +701,7 @@ class _UpdatePrescriptionFormState extends State { Helpers.hideKeyboard(context); DateTime selectedDate; selectedDate = DateTime.now(); - final DateTime picked = await showDatePicker( + final DateTime? picked = await showDatePicker( context: context, initialDate: selectedDate, firstDate: DateTime.now(), @@ -912,9 +715,8 @@ class _UpdatePrescriptionFormState extends State { } } - InputDecoration textFieldSelectorDecoration( - String hintText, String selectedText, bool isDropDown, - {Icon suffixIcon}) { + InputDecoration textFieldSelectorDecoration(String hintText, String? selectedText, bool isDropDown, + {Icon? suffixIcon}) { return InputDecoration( focusedBorder: OutlineInputBorder( borderSide: BorderSide(color: Color(0xFFCCCCCC), width: 2.0), @@ -931,11 +733,11 @@ class _UpdatePrescriptionFormState extends State { hintText: selectedText != null ? selectedText : hintText, suffixIcon: isDropDown ? suffixIcon != null - ? suffixIcon - : Icon( - Icons.arrow_drop_down, - color: Colors.black, - ) + ? suffixIcon + : Icon( + Icons.arrow_drop_down, + color: Colors.black, + ) : null, hintStyle: TextStyle( fontSize: 14, @@ -945,29 +747,28 @@ class _UpdatePrescriptionFormState extends State { } updatePrescription( - {PrescriptionViewModel model, - int drugId, - String newDrugId, - String frequencyId, - String remarks, - String dose, - String doseId, - String frequency, - String route, - String routeId, - String startDate, - DateTime newStartDate, - String doseUnit, - String doseStreangth, - String newDoseStreangth, - String duration, - String newDuration, - String newUnit, - String enteredRemarks, - PatiantInformtion patient}) async { + {required PrescriptionViewModel model, + required int drugId, + String? newDrugId, + required String frequencyId, + required String remarks, + required String dose, + required String doseId, + required String frequency, + required String route, + required String routeId, + required String startDate, + required DateTime newStartDate, + required String doseUnit, + required String doseStreangth, + required String newDoseStreangth, + required String duration, + required String newDuration, + required String newUnit, + required String enteredRemarks, + required PatiantInformtion patient}) async { //PrescriptionViewModel model = PrescriptionViewModel(); - PostPrescriptionReqModel updatePrescriptionReqModel = - new PostPrescriptionReqModel(); + PostPrescriptionReqModel updatePrescriptionReqModel = new PostPrescriptionReqModel(); List sss = []; updatePrescriptionReqModel.appointmentNo = patient.appointmentNo; @@ -977,31 +778,22 @@ class _UpdatePrescriptionFormState extends State { sss.add(PrescriptionRequestModel( covered: true, - dose: newDoseStreangth.isNotEmpty - ? double.parse(newDoseStreangth) - : double.parse(doseStreangth), + dose: newDoseStreangth.isNotEmpty ? double.parse(newDoseStreangth) : double.parse(doseStreangth), //frequency.isNotEmpty ? int.parse(dose) : 1, itemId: drugId, - doseUnitId: - newUnit.isNotEmpty ? int.parse(newUnit) : int.parse(doseUnit), + doseUnitId: newUnit.isNotEmpty ? int.parse(newUnit) : int.parse(doseUnit), route: route.isNotEmpty ? int.parse(route) : int.parse(routeId), - frequency: frequency.isNotEmpty - ? int.parse(frequency) - : int.parse(frequencyId), + frequency: frequency.isNotEmpty ? int.parse(frequency) : int.parse(frequencyId), remarks: remarks.isEmpty ? enteredRemarks : remarks, approvalRequired: true, icdcode10Id: "test2", doseTime: dose.isNotEmpty ? int.parse(dose) : int.parse(doseId), - duration: newDuration.isNotEmpty - ? int.parse(newDuration) - : int.parse(duration), - doseStartDate: - newStartDate != null ? newStartDate.toIso8601String() : startDate)); + duration: newDuration.isNotEmpty ? int.parse(newDuration) : int.parse(duration), + doseStartDate: newStartDate != null ? newStartDate.toIso8601String() : startDate)); updatePrescriptionReqModel.prescriptionRequestModel = sss; //postProcedureReqModel.procedures = controlsProcedure; - await model.updatePrescription( - updatePrescriptionReqModel, patient.patientMRN); + await model.updatePrescription(updatePrescriptionReqModel, patient.patientMRN!); if (model.state == ViewState.ErrorLocal) { Helpers.showErrorToast(model.error); @@ -1013,22 +805,22 @@ class _UpdatePrescriptionFormState extends State { void updatePrescriptionForm( {context, - String drugName, - String drugNameGeneric, - int drugId, - String remarks, - PrescriptionViewModel model, - PatiantInformtion patient, - String rouat, - String frequency, - String dose, - String duration, - String doseStreangth, - String doseUnit, - String enteredRemarks, - String uom, - int box, - String startDate}) { + required String drugName, + required String drugNameGeneric, + required int drugId, + required String remarks, + required PrescriptionViewModel model, + required PatiantInformtion patient, + required String rouat, + required String frequency, + required String dose, + required String duration, + required String doseStreangth, + required String doseUnit, + required String enteredRemarks, + required String uom, + required int box, + required String startDate}) { TextEditingController remarksController = TextEditingController(); TextEditingController doseController = TextEditingController(); TextEditingController frequencyController = TextEditingController();