From 4af94e6b715022e77aa7312a975bb3ae8d593851 Mon Sep 17 00:00:00 2001 From: hussam al-habibeh Date: Wed, 2 Jun 2021 13:04:38 +0300 Subject: [PATCH] hot fix --- .../refer-patient-screen-in-patient.dart | 209 +-- .../prescription/add_prescription_form.dart | 35 +- .../prescription_checkout_screen.dart | 36 +- .../prescription/prescription_screen.dart | 1176 +++++++---------- 4 files changed, 605 insertions(+), 851 deletions(-) diff --git a/lib/screens/patients/profile/referral/refer-patient-screen-in-patient.dart b/lib/screens/patients/profile/referral/refer-patient-screen-in-patient.dart index cc491cf2..658ad895 100644 --- a/lib/screens/patients/profile/referral/refer-patient-screen-in-patient.dart +++ b/lib/screens/patients/profile/referral/refer-patient-screen-in-patient.dart @@ -25,12 +25,10 @@ import 'package:speech_to_text/speech_to_text.dart' as stt; class PatientMakeInPatientReferralScreen extends StatefulWidget { @override - _PatientMakeInPatientReferralScreenState createState() => - _PatientMakeInPatientReferralScreenState(); + _PatientMakeInPatientReferralScreenState createState() => _PatientMakeInPatientReferralScreenState(); } -class _PatientMakeInPatientReferralScreenState - extends State { +class _PatientMakeInPatientReferralScreenState extends State { PatiantInformtion patient; List referToList; dynamic _referTo; @@ -68,8 +66,7 @@ class _PatientMakeInPatientReferralScreenState onVoiceText() async { new SpeechToText(context: context).showAlertDialog(context); var lang = TranslationBase.of(AppGlobal.CONTEX).locale.languageCode; - bool available = await speech.initialize( - onStatus: statusListener, onError: errorListener); + bool available = await speech.initialize(onStatus: statusListener, onError: errorListener); if (available) { speech.listen( onResult: resultListener, @@ -113,8 +110,7 @@ class _PatientMakeInPatientReferralScreenState } Future initSpeechState() async { - bool hasSpeech = await speech.initialize( - onError: errorListener, onStatus: statusListener); + bool hasSpeech = await speech.initialize(onError: errorListener, onStatus: statusListener); print(hasSpeech); if (!mounted) return; } @@ -127,14 +123,8 @@ class _PatientMakeInPatientReferralScreenState String arrivalType = routeArgs['arrivalType']; bool isInpatient = routeArgs['isInpatient']; referToList = List(); - dynamic sameBranch = { - "id": 1, - "name": TranslationBase.of(context).sameBranch - }; - dynamic otherBranch = { - "id": 2, - "name": TranslationBase.of(context).otherBranch - }; + dynamic sameBranch = {"id": 1, "name": TranslationBase.of(context).sameBranch}; + dynamic otherBranch = {"id": 2, "name": TranslationBase.of(context).otherBranch}; referToList.add(sameBranch); referToList.add(otherBranch); @@ -188,8 +178,7 @@ class _PatientMakeInPatientReferralScreenState AppTextFieldCustom( height: screenSize.height * 0.075, hintText: TranslationBase.of(context).branch, - dropDownText: - _referTo != null ? _referTo['name'] : null, + dropDownText: _referTo != null ? _referTo['name'] : null, enabled: false, isTextFieldHasSuffix: true, validationError: branchError, @@ -206,23 +195,15 @@ class _PatientMakeInPatientReferralScreenState _selectedBranch = null; _selectedClinic = null; _selectedDoctor = null; - model - .getDoctorBranch() - .then((value) async { + model.getDoctorBranch().then((value) async { _selectedBranch = value; if (_referTo['id'] == 1) { - GifLoaderDialogUtils.showMyDialog( - context); + GifLoaderDialogUtils.showMyDialog(context); await model - .getClinics(_selectedBranch[ - 'facilityId']) - .then((_) => - GifLoaderDialogUtils - .hideDialog(context)); - if (model.state == - ViewState.ErrorLocal) { - DrAppToastMsg.showErrorToast( - model.error); + .getClinics(_selectedBranch['facilityId']) + .then((_) => GifLoaderDialogUtils.hideDialog(context)); + if (model.state == ViewState.ErrorLocal) { + DrAppToastMsg.showErrorToast(model.error); } } else { _selectedBranch = null; @@ -247,9 +228,7 @@ class _PatientMakeInPatientReferralScreenState AppTextFieldCustom( height: screenSize.height * 0.075, hintText: TranslationBase.of(context).hospital, - dropDownText: _selectedBranch != null - ? _selectedBranch['facilityName'] - : null, + dropDownText: _selectedBranch != null ? _selectedBranch['facilityName'] : null, enabled: false, isTextFieldHasSuffix: true, validationError: hospitalError, @@ -268,17 +247,12 @@ class _PatientMakeInPatientReferralScreenState _selectedBranch = selectedValue; _selectedClinic = null; _selectedDoctor = null; - GifLoaderDialogUtils.showMyDialog( - context); + GifLoaderDialogUtils.showMyDialog(context); await model - .getClinics( - _selectedBranch['facilityId']) - .then((_) => GifLoaderDialogUtils - .hideDialog(context)); - if (model.state == - ViewState.ErrorLocal) { - DrAppToastMsg.showErrorToast( - model.error); + .getClinics(_selectedBranch['facilityId']) + .then((_) => GifLoaderDialogUtils.hideDialog(context)); + if (model.state == ViewState.ErrorLocal) { + DrAppToastMsg.showErrorToast(model.error); } }); }, @@ -299,9 +273,7 @@ class _PatientMakeInPatientReferralScreenState AppTextFieldCustom( height: screenSize.height * 0.075, hintText: TranslationBase.of(context).clinic, - dropDownText: _selectedClinic != null - ? _selectedClinic['ClinicDescription'] - : null, + dropDownText: _selectedClinic != null ? _selectedClinic['ClinicDescription'] : null, enabled: false, isTextFieldHasSuffix: true, validationError: clinicError, @@ -314,27 +286,19 @@ class _PatientMakeInPatientReferralScreenState attributeName: 'ClinicDescription', attributeValueId: 'ClinicID', usingSearch: true, - hintSearchText: - TranslationBase.of(context) - .clinicSearch, + hintSearchText: TranslationBase.of(context).clinicSearch, okText: TranslationBase.of(context).ok, okFunction: (selectedValue) { setState(() async { _selectedDoctor = null; _selectedClinic = selectedValue; - GifLoaderDialogUtils.showMyDialog( - context); + GifLoaderDialogUtils.showMyDialog(context); await model .getClinicDoctors( - patient, - _selectedClinic['ClinicID'], - _selectedBranch['facilityId']) - .then((_) => GifLoaderDialogUtils - .hideDialog(context)); - if (model.state == - ViewState.ErrorLocal) { - DrAppToastMsg.showErrorToast( - model.error); + patient, _selectedClinic['ClinicID'], _selectedBranch['facilityId']) + .then((_) => GifLoaderDialogUtils.hideDialog(context)); + if (model.state == ViewState.ErrorLocal) { + DrAppToastMsg.showErrorToast(model.error); } }); }, @@ -355,49 +319,41 @@ class _PatientMakeInPatientReferralScreenState AppTextFieldCustom( height: screenSize.height * 0.075, hintText: TranslationBase.of(context).doctor, - dropDownText: _selectedDoctor != null - ? _selectedDoctor['Name'] - : null, + dropDownText: _selectedDoctor != null ? _selectedDoctor['Name'] : null, enabled: false, isTextFieldHasSuffix: true, validationError: doctorError, - onClick: _selectedClinic != null && - model.doctorsList != null && - model.doctorsList.length > 0 - ? () { - ListSelectDialog dialog = ListSelectDialog( - list: model.doctorsList, - attributeName: 'Name', - attributeValueId: 'DoctorID', - usingSearch: true, - hintSearchText: - TranslationBase.of(context) - .doctorSearch, - okText: TranslationBase.of(context).ok, - okFunction: (selectedValue) { - setState(() { - _selectedDoctor = selectedValue; - }); + onClick: + _selectedClinic != null && model.doctorsList != null && model.doctorsList.length > 0 + ? () { + ListSelectDialog dialog = ListSelectDialog( + list: model.doctorsList, + attributeName: 'Name', + attributeValueId: 'DoctorID', + usingSearch: true, + hintSearchText: TranslationBase.of(context).doctorSearch, + okText: TranslationBase.of(context).ok, + okFunction: (selectedValue) { + setState(() { + _selectedDoctor = selectedValue; + }); + }, + ); + showDialog( + barrierDismissible: false, + context: context, + builder: (BuildContext context) { + return dialog; + }, + ); + } + : () { + if (_selectedClinic == null) { + DrAppToastMsg.showErrorToast("You need to select a clinic first"); + } else if (model.doctorsList == null || model.doctorsList.length == 0) { + DrAppToastMsg.showErrorToast("There is no doctors for this clinic"); + } }, - ); - showDialog( - barrierDismissible: false, - context: context, - builder: (BuildContext context) { - return dialog; - }, - ); - } - : () { - if (_selectedClinic == null) { - DrAppToastMsg.showErrorToast( - "You need to select a clinic first"); - } else if (model.doctorsList == null || - model.doctorsList.length == 0) { - DrAppToastMsg.showErrorToast( - "There is no doctors for this clinic"); - } - }, ), SizedBox( height: 10, @@ -425,11 +381,8 @@ class _PatientMakeInPatientReferralScreenState ), AppTextFieldCustom( height: screenSize.height * 0.075, - hintText: - TranslationBase.of(context).referralFrequency, - dropDownText: _selectedFrequency != null - ? _selectedFrequency['Description'] - : null, + hintText: TranslationBase.of(context).referralFrequency, + dropDownText: _selectedFrequency != null ? _selectedFrequency['Description'] : null, enabled: false, isTextFieldHasSuffix: true, validationError: frequencyError, @@ -439,8 +392,7 @@ class _PatientMakeInPatientReferralScreenState attributeName: 'Description', attributeValueId: 'ParameterCode', usingSearch: true, - hintSearchText: TranslationBase.of(context) - .selectReferralFrequency, + hintSearchText: TranslationBase.of(context).selectReferralFrequency, okText: TranslationBase.of(context).ok, okFunction: (selectedValue) { setState(() { @@ -478,8 +430,7 @@ class _PatientMakeInPatientReferralScreenState maxLines: 6, ), Positioned( - top: - 0, //MediaQuery.of(context).size.height * 0, + top: 0, //MediaQuery.of(context).size.height * 0, right: 15, child: IconButton( icon: Icon( @@ -488,8 +439,7 @@ class _PatientMakeInPatientReferralScreenState size: 35, ), onPressed: () { - initSpeechState() - .then((value) => {onVoiceText()}); + initSpeechState().then((value) => {onVoiceText()}); }, ), ), @@ -524,32 +474,27 @@ class _PatientMakeInPatientReferralScreenState onPressed: () async { setState(() { if (_referTo == null) { - branchError = - TranslationBase.of(context).fieldRequired; + branchError = TranslationBase.of(context).fieldRequired; } else { branchError = null; } if (_selectedBranch == null) { - hospitalError = - TranslationBase.of(context).fieldRequired; + hospitalError = TranslationBase.of(context).fieldRequired; } else { hospitalError = null; } if (_selectedClinic == null) { - clinicError = - TranslationBase.of(context).fieldRequired; + clinicError = TranslationBase.of(context).fieldRequired; } else { clinicError = null; } if (_selectedDoctor == null) { - doctorError = - TranslationBase.of(context).fieldRequired; + doctorError = TranslationBase.of(context).fieldRequired; } else { doctorError = null; } if (_selectedFrequency == null) { - frequencyError = - TranslationBase.of(context).fieldRequired; + frequencyError = TranslationBase.of(context).fieldRequired; } else { frequencyError = null; } @@ -566,8 +511,7 @@ class _PatientMakeInPatientReferralScreenState projectID: _selectedBranch['facilityId'], clinicID: _selectedClinic['ClinicID'], doctorID: _selectedDoctor['DoctorID'], - frequencyCode: - _selectedFrequency['ParameterCode'], + frequencyCode: _selectedFrequency['ParameterCode'], ext: _extController.text, remarks: _remarksController.text, priority: _activePriority, @@ -575,9 +519,7 @@ class _PatientMakeInPatientReferralScreenState if (model.state == ViewState.ErrorLocal) DrAppToastMsg.showErrorToast(model.error); else { - DrAppToastMsg.showSuccesToast( - TranslationBase.of(context) - .referralSuccessMsg); + DrAppToastMsg.showSuccesToast(TranslationBase.of(context).referralSuccessMsg); Navigator.pop(context); } } @@ -602,8 +544,7 @@ class _PatientMakeInPatientReferralScreenState ]; return Container( height: screenSize.height * 0.070, - decoration: - containerBorderDecoration(Color(0Xffffffff), Color(0xFFCCCCCC)), + decoration: containerBorderDecoration(Color(0Xffffffff), Color(0xFFCCCCCC)), child: Row( mainAxisSize: MainAxisSize.max, crossAxisAlignment: CrossAxisAlignment.center, @@ -615,16 +556,13 @@ class _PatientMakeInPatientReferralScreenState child: Container( height: screenSize.height * 0.070, decoration: containerBorderDecoration( - _isActive ? Color(0XFFB8382B) : Colors.white, - _isActive ? Color(0XFFB8382B) : Colors.white), + _isActive ? Color(0XFFB8382B) : Colors.white, _isActive ? Color(0XFFB8382B) : Colors.white), child: Center( child: Text( item, style: TextStyle( fontSize: 12, - color: _isActive - ? Colors.white - : Colors.black, //Colors.black, + color: _isActive ? Colors.white : Colors.black, //Colors.black, fontWeight: FontWeight.bold, ), ), @@ -664,8 +602,7 @@ class _PatientMakeInPatientReferralScreenState return time; } - BoxDecoration containerBorderDecoration( - Color containerColor, Color borderColor) { + BoxDecoration containerBorderDecoration(Color containerColor, Color borderColor) { return BoxDecoration( color: containerColor, shape: BoxShape.rectangle, diff --git a/lib/screens/prescription/add_prescription_form.dart b/lib/screens/prescription/add_prescription_form.dart index f4761897..a6e4ac10 100644 --- a/lib/screens/prescription/add_prescription_form.dart +++ b/lib/screens/prescription/add_prescription_form.dart @@ -147,8 +147,16 @@ class _PrescriptionFormWidgetState extends State { @override void initState() { - super.initState(); + requestPermissions(); + event.controller.stream.listen((p) { + if (p['startPopUp'] == 'true') { + if (this.mounted) { + initSpeechState().then((value) => {onVoiceText()}); + } + } + }); selectedType = 1; + super.initState(); } setSelectedType(int val) { @@ -195,7 +203,7 @@ class _PrescriptionFormWidgetState extends State { setState(() { SpeechToText.closeAlertDialog(context); speech.stop(); - indicationController.text += reconizedWord + '\n'; + instructionController.text += reconizedWord + '\n'; }); } else { print(result.finalResult); @@ -263,25 +271,6 @@ class _PrescriptionFormWidgetState extends State { SizedBox( height: 60, ), - Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - AppText( - TranslationBase.of(context).newPrescriptionOrder, - fontWeight: FontWeight.w700, - fontSize: 20, - ), - InkWell( - child: Icon( - Icons.close, - size: 24.0, - ), - onTap: () { - Navigator.pop(context); - }, - ) - ], - ), ], ), SizedBox( @@ -635,9 +624,7 @@ class _PrescriptionFormWidgetState extends State { size: 35, ), onPressed: () { - setState(() { - initSpeechState().then((value) => {onVoiceText()}); - }); + initSpeechState().then((value) => {onVoiceText()}); }, ), ), diff --git a/lib/screens/prescription/prescription_checkout_screen.dart b/lib/screens/prescription/prescription_checkout_screen.dart index 27905b2d..5ebc84aa 100644 --- a/lib/screens/prescription/prescription_checkout_screen.dart +++ b/lib/screens/prescription/prescription_checkout_screen.dart @@ -136,8 +136,16 @@ class _PrescriptionCheckOutScreenState extends State @override void initState() { - super.initState(); + requestPermissions(); + event.controller.stream.listen((p) { + if (p['startPopUp'] == 'true') { + if (this.mounted) { + initSpeechState().then((value) => {onVoiceText()}); + } + } + }); selectedType = 1; + super.initState(); } onVoiceText() async { @@ -512,29 +520,7 @@ class _PrescriptionCheckOutScreenState extends State }, ), SizedBox(height: spaceBetweenTextFileds), - // Container( - // color: Colors.white, - // child: AppTextFieldCustom( - // hintText: "UOM", - // isTextFieldHasSuffix: false, - // dropDownText: uom != null ? uom : null, - // enabled: false, - // ), - // ), SizedBox(height: spaceBetweenTextFileds), - // Container( - // color: Colors.white, - // child: AppTextFieldCustom( - // hintText: TranslationBase.of(context).boxQuantity, - // isTextFieldHasSuffix: false, - // dropDownText: box != null - // ? TranslationBase.of(context).boxQuantity + - // ": " + - // model.boxQuintity.toString() - // : null, - // enabled: false, - // ), - // ), SizedBox(height: spaceBetweenTextFileds), Container( decoration: BoxDecoration( @@ -559,9 +545,7 @@ class _PrescriptionCheckOutScreenState extends State size: 35, ), onPressed: () { - setState(() { - initSpeechState().then((value) => {onVoiceText()}); - }); + initSpeechState().then((value) => {onVoiceText()}); }, ), ), diff --git a/lib/screens/prescription/prescription_screen.dart b/lib/screens/prescription/prescription_screen.dart index 6608f108..d5a94c61 100644 --- a/lib/screens/prescription/prescription_screen.dart +++ b/lib/screens/prescription/prescription_screen.dart @@ -18,7 +18,6 @@ class NewPrescriptionScreen extends StatefulWidget { class _NewPrescriptionScreenState extends State { PersistentBottomSheetController _controller; - final _scaffoldKey = GlobalKey(); TextEditingController strengthController = TextEditingController(); int testNum = 0; int strengthChar; @@ -35,694 +34,541 @@ class _NewPrescriptionScreenState extends State { patient = routeArgs['patient']; return BaseView( onModelReady: (model) => model.getPrescription(mrn: patient.patientId), - builder: - (BuildContext context, PrescriptionViewModel model, Widget child) => - AppScaffold( - isShowAppBar: true, - appBarTitle: TranslationBase.of(context).prescription, - body: NetworkBaseView( - baseViewModel: model, - child: SingleChildScrollView( - child: Container( - color: Colors.white, - child: Column( - children: [ - PatientPageHeaderWidget(patient), - Divider( - height: 1.0, - thickness: 1.0, - color: Colors.grey, - ), - (model.prescriptionList.length != 0) - ? SizedBox( - height: - model.prescriptionList[0].rowcount == 0 - ? 200.0 - : 10.0) - : SizedBox(height: 200.0), - //model.prescriptionList == null - (model.prescriptionList.length != 0) - ? model.prescriptionList[0].rowcount == 0 - ? Column( - mainAxisAlignment: - MainAxisAlignment.center, - crossAxisAlignment: - CrossAxisAlignment.stretch, - children: [ - InkWell( - onTap: () { - addPrescriptionForm( - context, - model, - patient, - model.prescriptionList); - //model.postPrescription(); - }, - child: CircleAvatar( - radius: 65, - backgroundColor: - Color(0XFFB8382C), - child: CircleAvatar( - radius: 60, - backgroundColor: Colors.white, - child: Icon( - Icons.add, - color: Colors.black, - size: 45.0, + builder: (BuildContext context, PrescriptionViewModel model, Widget child) => AppScaffold( + isShowAppBar: true, + appBarTitle: TranslationBase.of(context).prescription, + body: NetworkBaseView( + baseViewModel: model, + child: SingleChildScrollView( + child: Container( + color: Colors.white, + child: Column( + children: [ + PatientPageHeaderWidget(patient), + Divider( + height: 1.0, + thickness: 1.0, + color: Colors.grey, + ), + (model.prescriptionList.length != 0) + ? SizedBox(height: model.prescriptionList[0].rowcount == 0 ? 200.0 : 10.0) + : SizedBox(height: 200.0), + //model.prescriptionList == null + (model.prescriptionList.length != 0) + ? model.prescriptionList[0].rowcount == 0 + ? Column( + mainAxisAlignment: MainAxisAlignment.center, + crossAxisAlignment: CrossAxisAlignment.stretch, + children: [ + InkWell( + onTap: () { + addPrescriptionForm(context, model, patient, model.prescriptionList); + //model.postPrescription(); + }, + child: CircleAvatar( + radius: 65, + backgroundColor: Color(0XFFB8382C), + child: CircleAvatar( + radius: 60, + backgroundColor: Colors.white, + child: Icon( + Icons.add, + color: Colors.black, + size: 45.0, + ), + ), + ), + ), + SizedBox( + height: 15.0, + ), + Row( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + AppText( + TranslationBase.of(context).noPrescriptionListed, + color: Colors.black, + fontWeight: FontWeight.w900, + ), + ], + ), + Row( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + AppText( + TranslationBase.of(context).addNow, + color: Color(0XFFB8382C), + fontWeight: FontWeight.w900, + ), + ], + ), + ], + ) + : Padding( + padding: EdgeInsets.all(14.0), + child: NetworkBaseView( + baseViewModel: model, + child: Column( + mainAxisAlignment: MainAxisAlignment.start, + children: [ + InkWell( + child: Container( + height: 50.0, + width: 450.0, + decoration: BoxDecoration( + color: Colors.white, + border: Border.all(color: Colors.grey), + borderRadius: BorderRadius.circular(10.0), + ), + child: Padding( + padding: EdgeInsets.all(8.0), + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + AppText( + ' Add more medication', + fontWeight: FontWeight.w100, + fontSize: 12.5, ), - ), + Icon( + Icons.add, + color: Color(0XFFB8382C), + ) + ], ), ), - SizedBox( - height: 15.0, - ), - Row( - mainAxisAlignment: - MainAxisAlignment.center, - children: [ - AppText( - TranslationBase.of(context) - .noPrescriptionListed, - color: Colors.black, - fontWeight: FontWeight.w900, - ), - ], - ), - Row( - mainAxisAlignment: - MainAxisAlignment.center, - children: [ - AppText( - TranslationBase.of(context) - .addNow, - color: Color(0XFFB8382C), - fontWeight: FontWeight.w900, - ), - ], - ), - ], - ) - : Padding( - padding: EdgeInsets.all(14.0), - child: NetworkBaseView( - baseViewModel: model, + ), + onTap: () { + addPrescriptionForm(context, model, patient, model.prescriptionList); + //model.postPrescription(); + }, + ), + SizedBox( + height: 10.0, + ), + ...List.generate( + model.prescriptionList[0].rowcount, + (index) => Container( + color: Colors.white, child: Column( - mainAxisAlignment: - MainAxisAlignment.start, children: [ - InkWell( - child: Container( - height: 50.0, - width: 450.0, - decoration: BoxDecoration( + SizedBox( + height: MediaQuery.of(context).size.height * 0.022, + ), + Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + // crossAxisAlignment: + // CrossAxisAlignment.start, + children: [ + Container( color: Colors.white, - border: Border.all( - color: Colors.grey), - borderRadius: - BorderRadius.circular( - 10.0), - ), - child: Padding( - padding: - EdgeInsets.all(8.0), - child: Row( - mainAxisAlignment: - MainAxisAlignment - .spaceBetween, + height: MediaQuery.of(context).size.height * 0.21, + width: MediaQuery.of(context).size.width * 0.1, + child: Column( children: [ AppText( - ' Add more medication', - fontWeight: - FontWeight.w100, - fontSize: 12.5, + (DateTime.parse(model.prescriptionList[0].entityList[index] + .createdOn) != + null + ? (DateTime.parse(model.prescriptionList[0] + .entityList[index].createdOn) + .year) + .toString() + : DateTime.now().year) + .toString(), + color: Colors.green, + fontSize: 13.5, + ), + AppText( + AppDateUtils.getMonth(model.prescriptionList[0] + .entityList[index].createdOn != + null + ? (DateTime.parse(model.prescriptionList[0] + .entityList[index].createdOn) + .month) + : DateTime.now().month) + .toUpperCase(), + color: Colors.green, + ), + AppText( + DateTime.parse( + model.prescriptionList[0].entityList[index].createdOn) + .day + .toString(), + color: Colors.green, + ), + AppText( + AppDateUtils.getTimeFormated(DateTime.parse(model + .prescriptionList[0].entityList[index].createdOn)) + .toString(), + color: Colors.green, ), - Icon( - Icons.add, - color: - Color(0XFFB8382C), - ) ], ), ), - ), - onTap: () { - addPrescriptionForm( - context, - model, - patient, - model.prescriptionList); - //model.postPrescription(); - }, - ), - SizedBox( - height: 10.0, - ), - ...List.generate( - model.prescriptionList[0] - .rowcount, - (index) => Container( - color: Colors.white, - child: Column( - children: [ - SizedBox( - height: MediaQuery.of( - context) - .size - .height * - 0.022, - ), - Row( - mainAxisAlignment: - MainAxisAlignment - .spaceBetween, - // crossAxisAlignment: - // CrossAxisAlignment.start, - children: [ - Container( - color: Colors.white, - height: MediaQuery.of( - context) - .size - .height * - 0.21, - width: MediaQuery.of( - context) - .size - .width * - 0.1, - child: Column( - children: [ - AppText( - (DateTime.parse(model.prescriptionList[0].entityList[index].createdOn) != - null - ? (DateTime.parse(model.prescriptionList[0].entityList[index].createdOn).year) - .toString() - : DateTime.now() - .year) - .toString(), - color: Colors - .green, - fontSize: - 13.5, - ), - AppText( - AppDateUtils.getMonth(model.prescriptionList[0].entityList[index].createdOn != - null - ? (DateTime.parse(model.prescriptionList[0].entityList[index].createdOn) - .month) - : DateTime.now() - .month) - .toUpperCase(), - color: Colors - .green, - ), - AppText( - DateTime.parse(model - .prescriptionList[ - 0] - .entityList[ - index] - .createdOn) - .day - .toString(), - color: Colors - .green, - ), - AppText( - AppDateUtils.getTimeFormated(DateTime.parse(model - .prescriptionList[ - 0] - .entityList[ - index] - .createdOn)) - .toString(), - color: Colors - .green, - ), - ], + Container( + color: Colors.white, + // height: MediaQuery.of( + // context) + // .size + // .height * + // 0.3499, + width: MediaQuery.of(context).size.width * 0.77, + child: Column( + children: [ + Row( + children: [ + AppText( + 'Start Date:', + fontWeight: FontWeight.w700, + fontSize: 14.0, ), - ), - Container( - color: Colors.white, - // height: MediaQuery.of( - // context) - // .size - // .height * - // 0.3499, - width: MediaQuery.of( - context) - .size - .width * - 0.77, - child: Column( - children: [ - Row( - children: [ - AppText( - 'Start Date:', - fontWeight: - FontWeight - .w700, - fontSize: - 14.0, - ), - Expanded( - child: - AppText( - AppDateUtils.getDateFormatted(DateTime.parse(model - .prescriptionList[0] - .entityList[index] - .startDate)), - fontSize: - 13.5, - ), - ), - SizedBox( - width: - 6.0, - ), - AppText( - 'Order Type:', - fontWeight: - FontWeight - .w700, - fontSize: - 14.0, - ), - Expanded( - child: - AppText( - model - .prescriptionList[0] - .entityList[index] - .orderTypeDescription, - fontSize: - 13.0, - ), - ), - ], - ), - SizedBox( - height: 5.5, - ), - Row( - children: [ - Container( - color: Colors - .white, - child: - Expanded( - child: - AppText( - model - .prescriptionList[0] - .entityList[index] - .medicationName, - fontWeight: - FontWeight.w700, - fontSize: - 15.0, - ), - ), - ) - ], - ), - SizedBox( - height: 5.5, - ), - Row( - children: [ - Expanded( - child: - AppText( - model - .prescriptionList[0] - .entityList[index] - .doseDetail, - fontSize: - 15.0, - ), - ) - ], - ), - SizedBox( - height: 10.0, - ), - Row( - children: [ - AppText( - 'Indication: ', - fontWeight: - FontWeight - .w700, - fontSize: - 17.0, - ), - Expanded( - child: - RichText( - maxLines: - 3, - overflow: - TextOverflow.ellipsis, - strutStyle: - StrutStyle(fontSize: 12.0), - text: TextSpan( - style: - TextStyle(color: Colors.black), - text: model.prescriptionList[0].entityList[index].indication), - ), - ), - ], - ), - Row( - children: [ - AppText( - 'UOM: ', - fontWeight: - FontWeight - .w700, - fontSize: - 17.0, - ), - Expanded( - child: - RichText( - maxLines: - 3, - overflow: - TextOverflow.ellipsis, - strutStyle: - StrutStyle(fontSize: 12.0), - text: TextSpan( - style: - TextStyle(color: Colors.black), - text: model.prescriptionList[0].entityList[index].uom), - ), - ), - ], - ), - Row( - children: [ - AppText( - 'BOX Quantity: ', - fontWeight: - FontWeight - .w700, - fontSize: - 17.0, - ), - Expanded( - child: - RichText( - maxLines: - 3, - overflow: - TextOverflow.ellipsis, - strutStyle: - StrutStyle(fontSize: 12.0), - text: TextSpan( - style: - TextStyle(color: Colors.black), - text: model.prescriptionList[0].entityList[index].quantity.toString() == null ? "" : model.prescriptionList[0].entityList[index].quantity.toString()), - ), - ), - ], - ), - Row( - children: [ - AppText( - 'pharmacy Intervention ', - fontWeight: - FontWeight - .w700, - fontSize: - 17.0, - ), - Expanded( - child: - RichText( - maxLines: - 3, - overflow: - TextOverflow.ellipsis, - strutStyle: - StrutStyle(fontSize: 12.0), - text: TextSpan( - style: - TextStyle(color: Colors.black), - text: model.prescriptionList[0].entityList[index].pharmacyInervention == null ? "" : model.prescriptionList[0].entityList[index].pharmacyInervention.toString()), - ), - ), - ], - ), - SizedBox( - height: - 5.0), - Row( - children: [ - AppText( - 'pharmacist Remarks : ', - fontWeight: - FontWeight - .w700, - fontSize: - 15.0, - ), - Expanded( - child: AppText( - // commening below code because there is an error coming in the model please fix it before pushing it - model.prescriptionList[0].entityList[index].pharmacistRemarks == null ? "" : model.prescriptionList[0].entityList[index].pharmacistRemarks, - fontSize: 15.0), - ) - ], - ), - SizedBox( - height: 20.0, - ), - Row( - children: [ - AppText( - TranslationBase.of(context) - .doctorName + - ": ", - fontWeight: - FontWeight - .w600, - ), - Expanded( - child: - AppText( - model - .prescriptionList[0] - .entityList[index] - .doctorName, - fontWeight: - FontWeight.w700, - ), - ) - ], - ), - SizedBox( - height: 8.0, - ), - Row( - children: [ - AppText( - 'Doctor Remarks : ', - fontWeight: - FontWeight - .w700, - fontSize: - 13.0, - ), - Expanded( - child: - Container( - color: Colors - .white, - // height: MediaQuery.of(context).size.height * - // 0.038, - child: - RichText( - // maxLines: - // 2, - // overflow: - // TextOverflow.ellipsis, - strutStyle: - StrutStyle(fontSize: 10.0), - text: - TextSpan( - style: - TextStyle(color: Colors.black), - text: model.prescriptionList[0].entityList[index].remarks != null - ? model.prescriptionList[0].entityList[index].remarks - : "", - ), - ), - ), - ), - ], - ), - SizedBox( - height: 10.0, + Expanded( + child: AppText( + AppDateUtils.getDateFormatted(DateTime.parse(model + .prescriptionList[0].entityList[index].startDate)), + fontSize: 13.5, + ), + ), + SizedBox( + width: 6.0, + ), + AppText( + 'Order Type:', + fontWeight: FontWeight.w700, + fontSize: 14.0, + ), + Expanded( + child: AppText( + model.prescriptionList[0].entityList[index] + .orderTypeDescription, + fontSize: 13.0, + ), + ), + ], + ), + SizedBox( + height: 5.5, + ), + Row( + children: [ + Container( + color: Colors.white, + child: Expanded( + child: AppText( + model.prescriptionList[0].entityList[index] + .medicationName, + fontWeight: FontWeight.w700, + fontSize: 15.0, ), - - // SizedBox( - // height: 40, - // ), - ], + ), + ) + ], + ), + SizedBox( + height: 5.5, + ), + Row( + children: [ + Expanded( + child: AppText( + model.prescriptionList[0].entityList[index].doseDetail, + fontSize: 15.0, + ), + ) + ], + ), + SizedBox( + height: 10.0, + ), + Row( + children: [ + AppText( + 'Indication: ', + fontWeight: FontWeight.w700, + fontSize: 17.0, + ), + Expanded( + child: RichText( + maxLines: 3, + overflow: TextOverflow.ellipsis, + strutStyle: StrutStyle(fontSize: 12.0), + text: TextSpan( + style: TextStyle(color: Colors.black), + text: model.prescriptionList[0].entityList[index] + .indication), + ), + ), + ], + ), + Row( + children: [ + AppText( + 'UOM: ', + fontWeight: FontWeight.w700, + fontSize: 17.0, + ), + Expanded( + child: RichText( + maxLines: 3, + overflow: TextOverflow.ellipsis, + strutStyle: StrutStyle(fontSize: 12.0), + text: TextSpan( + style: TextStyle(color: Colors.black), + text: model + .prescriptionList[0].entityList[index].uom), + ), + ), + ], + ), + Row( + children: [ + AppText( + 'BOX Quantity: ', + fontWeight: FontWeight.w700, + fontSize: 17.0, + ), + Expanded( + child: RichText( + maxLines: 3, + overflow: TextOverflow.ellipsis, + strutStyle: StrutStyle(fontSize: 12.0), + text: TextSpan( + style: TextStyle(color: Colors.black), + text: model.prescriptionList[0].entityList[index] + .quantity + .toString() == + null + ? "" + : model.prescriptionList[0].entityList[index] + .quantity + .toString()), + ), + ), + ], + ), + Row( + children: [ + AppText( + 'pharmacy Intervention ', + fontWeight: FontWeight.w700, + fontSize: 17.0, + ), + Expanded( + child: RichText( + maxLines: 3, + overflow: TextOverflow.ellipsis, + strutStyle: StrutStyle(fontSize: 12.0), + text: TextSpan( + style: TextStyle(color: Colors.black), + text: model.prescriptionList[0].entityList[index] + .pharmacyInervention == + null + ? "" + : model.prescriptionList[0].entityList[index] + .pharmacyInervention + .toString()), + ), + ), + ], + ), + SizedBox(height: 5.0), + Row( + children: [ + AppText( + 'pharmacist Remarks : ', + fontWeight: FontWeight.w700, + fontSize: 15.0, + ), + Expanded( + child: AppText( + model.prescriptionList[0].entityList[index] + .pharmacistRemarks == + null + ? "" + : model.prescriptionList[0].entityList[index] + .pharmacistRemarks, + fontSize: 15.0), + ) + ], + ), + SizedBox( + height: 20.0, + ), + Row( + children: [ + AppText( + TranslationBase.of(context).doctorName + ": ", + fontWeight: FontWeight.w600, + ), + Expanded( + child: AppText( + model.prescriptionList[0].entityList[index].doctorName, + fontWeight: FontWeight.w700, + ), + ) + ], + ), + SizedBox( + height: 8.0, + ), + Row( + children: [ + AppText( + 'Doctor Remarks : ', + fontWeight: FontWeight.w700, + fontSize: 13.0, ), - ), - Container( - color: Colors.white, - height: MediaQuery.of( - context) - .size - .height * - 0.16, - width: MediaQuery.of( - context) - .size - .width * - 0.06, - child: Column( - children: [ - InkWell( - child: Icon( - Icons - .edit), - onTap: () { - updatePrescriptionForm( - box: model - .prescriptionList[ - 0] - .entityList[ - index] - .quantity, - uom: model - .prescriptionList[ - 0] - .entityList[ - index] - .uom, - drugNameGeneric: model - .prescriptionList[ - 0] - .entityList[ - index] - .medicationName, - doseUnit: model.prescriptionList[0].entityList[index].doseDailyUnitID - .toString(), - doseStreangth: model.prescriptionList[0].entityList[index].doseDailyQuantity - .toString(), - duration: - model.prescriptionList[0].entityList[index].doseDurationDays - .toString(), - startDate: - model.prescriptionList[0].entityList[index].startDate - .toString(), - dose: model - .prescriptionList[ - 0] - .entityList[ - index] - .doseTimingID - .toString(), - frequency: - model.prescriptionList[0].entityList[index].frequencyID - .toString(), - rouat: model - .prescriptionList[0] - .entityList[index] - .routeID - .toString(), - patient: patient, - drugId: model.prescriptionList[0].entityList[index].medicineCode, - drugName: model.prescriptionList[0].entityList[index].medicationName, - remarks: model.prescriptionList[0].entityList[index].remarks, - model: model, - enteredRemarks: model.prescriptionList[0].entityList[index].remarks, - context: context); - //model.postPrescription(); - }, + Expanded( + child: Container( + color: Colors.white, + // height: MediaQuery.of(context).size.height * + // 0.038, + child: RichText( + // maxLines: + // 2, + // overflow: + // TextOverflow.ellipsis, + strutStyle: StrutStyle(fontSize: 10.0), + text: TextSpan( + style: TextStyle(color: Colors.black), + text: model.prescriptionList[0].entityList[index] + .remarks != + null + ? model.prescriptionList[0].entityList[index] + .remarks + : "", + ), ), - ], + ), ), - ), - ], - ), - Divider( - height: 0, - thickness: 1.0, - color: Colors.grey, - ), - ], + ], + ), + SizedBox( + height: 10.0, + ), + + // SizedBox( + // height: 40, + // ), + ], + ), ), - ), + Container( + color: Colors.white, + height: MediaQuery.of(context).size.height * 0.16, + width: MediaQuery.of(context).size.width * 0.06, + child: Column( + children: [ + InkWell( + child: Icon(Icons.edit), + onTap: () { + updatePrescriptionForm( + box: model + .prescriptionList[0].entityList[index].quantity, + uom: model.prescriptionList[0].entityList[index].uom, + drugNameGeneric: model.prescriptionList[0] + .entityList[index].medicationName, + doseUnit: model.prescriptionList[0].entityList[index] + .doseDailyUnitID + .toString(), + doseStreangth: model.prescriptionList[0] + .entityList[index].doseDailyQuantity + .toString(), + duration: model.prescriptionList[0].entityList[index] + .doseDurationDays + .toString(), + startDate: model + .prescriptionList[0].entityList[index].startDate + .toString(), + dose: model.prescriptionList[0].entityList[index].doseTimingID + .toString(), + frequency: model + .prescriptionList[0].entityList[index].frequencyID + .toString(), + rouat: model.prescriptionList[0].entityList[index].routeID + .toString(), + patient: patient, + drugId: model.prescriptionList[0].entityList[index].medicineCode, + drugName: model.prescriptionList[0].entityList[index].medicationName, + remarks: model.prescriptionList[0].entityList[index].remarks, + model: model, + enteredRemarks: model.prescriptionList[0].entityList[index].remarks, + context: context); + //model.postPrescription(); + }, + ), + ], + ), + ), + ], + ), + Divider( + height: 0, + thickness: 1.0, + color: Colors.grey, ), ], ), ), - ) - : Column( - mainAxisAlignment: MainAxisAlignment.center, - crossAxisAlignment: - CrossAxisAlignment.stretch, - children: [ - InkWell( - onTap: () { - addPrescriptionForm(context, model, - patient, model.prescriptionList); - //model.postPrescription(); - }, - child: CircleAvatar( - radius: 65, - backgroundColor: Color(0XFFB8382C), - child: CircleAvatar( - radius: 60, - backgroundColor: Colors.white, - child: Icon( - Icons.add, - color: Colors.black, - size: 45.0, - ), - ), - ), - ), - SizedBox( - height: 15.0, - ), - Row( - mainAxisAlignment: - MainAxisAlignment.center, - children: [ - AppText( - TranslationBase.of(context) - .noPrescriptionListed, - color: Colors.black, - fontWeight: FontWeight.w900, - ), - ], - ), - Row( - mainAxisAlignment: - MainAxisAlignment.center, - children: [ - AppText( - TranslationBase.of(context).addNow, - color: Color(0XFFB8382C), - fontWeight: FontWeight.w900, - ), - ], ), ], - ) - ], - ), - ), - ), - )), + ), + ), + ) + : Column( + mainAxisAlignment: MainAxisAlignment.center, + crossAxisAlignment: CrossAxisAlignment.stretch, + children: [ + InkWell( + onTap: () { + addPrescriptionForm(context, model, patient, model.prescriptionList); + //model.postPrescription(); + }, + child: CircleAvatar( + radius: 65, + backgroundColor: Color(0XFFB8382C), + child: CircleAvatar( + radius: 60, + backgroundColor: Colors.white, + child: Icon( + Icons.add, + color: Colors.black, + size: 45.0, + ), + ), + ), + ), + SizedBox( + height: 15.0, + ), + Row( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + AppText( + TranslationBase.of(context).noPrescriptionListed, + color: Colors.black, + fontWeight: FontWeight.w900, + ), + ], + ), + Row( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + AppText( + TranslationBase.of(context).addNow, + color: Color(0XFFB8382C), + fontWeight: FontWeight.w900, + ), + ], + ), + ], + ) + ], + ), + ), + ), + )), ); }