From 8720e281ff6b897947f9563521b30e789bea707c Mon Sep 17 00:00:00 2001 From: hussam al-habibeh Date: Mon, 22 Nov 2021 16:19:18 +0200 Subject: [PATCH 1/2] flutter version 2 --- .../PatientRegistrationViewModel.dart | 6 +- lib/screens/live_care/end_call_screen.dart | 145 +- .../patients/DischargedPatientPage.dart | 2 +- .../profile/UCAF/UCAF-detail-screen.dart | 68 +- .../profile/UCAF/UCAF-input-screen.dart | 88 +- .../profile/UCAF/page-stepper-widget.dart | 42 +- .../profile/UCAF/ucaf_pager_screen.dart | 10 +- .../admission_orders_screen.dart | 4 +- .../line_chart_for_diabetic.dart | 20 +- .../discharge_Summary_widget.dart | 15 +- .../profile/lab_result/LineChartCurved.dart | 16 +- .../lab_result/LineChartCurvedLabHistory.dart | 17 +- .../operation_report/operation_report.dart | 23 +- .../update_operation_report.dart | 212 +-- .../profile_gird_for_InPatient.dart | 88 +- .../profile_gird_for_other.dart | 125 +- .../profile_gird_for_search.dart | 93 +- .../referral/my-referral-detail-screen.dart | 154 +- .../profile/vital_sign/LineChartCurved.dart | 18 +- .../LineChartCurvedBloodPressure.dart | 20 +- .../vital_sign/vital_sign_details_screen.dart | 319 ++-- .../register_patient/CustomEditableText.dart | 8 +- .../RegisterConfirmationPatientPage.dart | 31 +- .../register_patient/RegisterPatientPage.dart | 4 +- .../RegisterSearchPatientPage.dart | 56 +- .../register_patient/VerifyMethodPage.dart | 4 +- .../prescription/add_prescription_form.dart | 473 ++++-- .../reschedule-leaves/reschedule_leave.dart | 1420 ++++++++++------- 28 files changed, 2152 insertions(+), 1329 deletions(-) diff --git a/lib/core/viewModel/PatientRegistrationViewModel.dart b/lib/core/viewModel/PatientRegistrationViewModel.dart index 31d84608..692313eb 100644 --- a/lib/core/viewModel/PatientRegistrationViewModel.dart +++ b/lib/core/viewModel/PatientRegistrationViewModel.dart @@ -142,10 +142,10 @@ class PatientRegistrationViewModel extends BaseViewModel { } Future sendActivationCodeByOTPNotificationType( - {required SendActivationCodeByOTPNotificationTypeForRegistrationModel + {SendActivationCodeByOTPNotificationTypeForRegistrationModel? registrationModel, required int otpType, - required PatientRegistrationViewModel user}) async { + PatientRegistrationViewModel? user}) async { setState(ViewState.BusyLocal); print(checkPatientForRegistrationModel); print(checkPatientForRegistrationModel); @@ -183,7 +183,7 @@ class PatientRegistrationViewModel extends BaseViewModel { channel: 3, // TODO Elham* loginType loginType: 4, - logInTokenID:_patientRegistrationService.logInTokenID , + logInTokenID: _patientRegistrationService.logInTokenID, nationalID: checkPatientForRegistrationModel.patientIdentificationID, patientID: 0, mobileNo: checkPatientForRegistrationModel.patientMobileNumber.toString(), diff --git a/lib/screens/live_care/end_call_screen.dart b/lib/screens/live_care/end_call_screen.dart index a9ab2d9f..b7e64233 100644 --- a/lib/screens/live_care/end_call_screen.dart +++ b/lib/screens/live_care/end_call_screen.dart @@ -26,7 +26,10 @@ import 'package:hexcolor/hexcolor.dart'; class EndCallScreen extends StatefulWidget { final PatiantInformtion? patient; - const EndCallScreen({Key? key, this.patient,}) : super(key: key); + const EndCallScreen({ + Key? key, + this.patient, + }) : super(key: key); @override _EndCallScreenState createState() => _EndCallScreenState(); @@ -34,7 +37,7 @@ class EndCallScreen extends StatefulWidget { class _EndCallScreenState extends State { bool isInpatient = false; - PatiantInformtion ?patient; + PatiantInformtion? patient; bool isDischargedPatient = false; bool isSearchAndOut = false; late String patientType; @@ -46,28 +49,26 @@ class _EndCallScreenState extends State { @override void initState() { super.initState(); - if(widget.patient!=null) - patient = widget.patient; + if (widget.patient != null) patient = widget.patient; } @override void didChangeDependencies() { super.didChangeDependencies(); final routeArgs = ModalRoute.of(context)!.settings.arguments as Map; - if(routeArgs.containsKey('patient')) - patient = routeArgs['patient']; + if (routeArgs.containsKey('patient')) patient = routeArgs['patient']; } @override Widget build(BuildContext context) { final List cardsList = [ - PatientProfileCardModel( - TranslationBase.of(context).resume!, TranslationBase.of(context).theCall!, '', 'patient/vital_signs.png', - isInPatient: isInpatient, - color: Colors.green[800]!, - onTap: () async { + PatientProfileCardModel(TranslationBase.of(context).resume!, + TranslationBase.of(context).theCall!, '', 'patient/vital_signs.png', + isInPatient: isInpatient, color: Colors.green[800]!, onTap: () async { GifLoaderDialogUtils.showMyDialog(context); - await liveCareModel.startCall(isReCall: false, vCID: patient!.vcId!).then((value) async { + await liveCareModel + .startCall(isReCall: false, vCID: patient!.vcId!) + .then((value) async { await liveCareModel.getDoctorProfile(); GifLoaderDialogUtils.hideDialog(context); if (liveCareModel.state == ViewState.ErrorLocal) { @@ -78,8 +79,13 @@ class _EndCallScreenState extends State { kSessionId: liveCareModel.startCallRes.openSessionID, kApiKey: '46209962', vcId: patient!.vcId, - isRecording: liveCareModel.startCallRes != null ? liveCareModel.startCallRes.isRecording: false, - patientName: patient!.fullName ?? (patient!.firstName != null ? "${patient!.firstName} ${patient!.lastName}" : "-"), + isRecording: liveCareModel.startCallRes != null + ? liveCareModel.startCallRes.isRecording! + : false, + patientName: patient!.fullName ?? + (patient!.firstName != null + ? "${patient!.firstName} ${patient!.lastName}" + : "-"), tokenID: await liveCareModel.getToken(), generalId: GENERAL_ID, doctorId: liveCareModel.doctorProfile!.doctorID, @@ -92,13 +98,14 @@ class _EndCallScreenState extends State { await liveCareModel.endCall( patient!.vcId!, false, - - );GifLoaderDialogUtils.hideDialog(context); + ); + GifLoaderDialogUtils.hideDialog(context); if (liveCareModel.state == ViewState.ErrorLocal) { DrAppToastMsg.showErrorToast(liveCareModel.error); } }, - onCallNotRespond: (SessionStatusModel sessionStatusModel) async { + onCallNotRespond: + (SessionStatusModel sessionStatusModel) async { GifLoaderDialogUtils.showMyDialog(context); GifLoaderDialogUtils.showMyDialog(context); await liveCareModel.endCall( @@ -117,10 +124,12 @@ class _EndCallScreenState extends State { } }, isDartIcon: true, dartIcon: DoctorApp.call), PatientProfileCardModel( - TranslationBase.of(context).endLC!, TranslationBase.of(context).consultation!, '', 'patient/vital_signs.png', + TranslationBase.of(context).endLC!, + TranslationBase.of(context).consultation!, + '', + 'patient/vital_signs.png', isInPatient: isInpatient, - color: Colors.red[800]!, - onTap: () { + color: Colors.red[800]!, onTap: () { Helpers.showConfirmationDialog(context, "${TranslationBase.of(context).areYouSureYouWantTo} ${TranslationBase.of(context).endLC} ${TranslationBase.of(context).consultation} ?", () async { @@ -131,14 +140,17 @@ class _EndCallScreenState extends State { if (liveCareModel.state == ViewState.ErrorLocal) { DrAppToastMsg.showErrorToast(liveCareModel.error); } else { - showAlternativesDialog(context, liveCareModel, (bool isConfirmed) async { + showAlternativesDialog(context, liveCareModel, + (bool isConfirmed) async { GifLoaderDialogUtils.showMyDialog(context); - await liveCareModel.endCallWithCharge(patient!.vcId!, isConfirmed); + await liveCareModel.endCallWithCharge( + patient!.vcId!, isConfirmed); GifLoaderDialogUtils.hideDialog(context); if (liveCareModel.state == ViewState.ErrorLocal) { DrAppToastMsg.showErrorToast(liveCareModel.error); } else { - DrAppToastMsg.showSuccesToast("You successfully completed call with charge"); + DrAppToastMsg.showSuccesToast( + "You successfully completed call with charge"); Navigator.of(context).pop(); Navigator.of(context).pop(); } @@ -146,34 +158,47 @@ class _EndCallScreenState extends State { } }); }, isDartIcon: true, dartIcon: DoctorApp.end_consultaion), - PatientProfileCardModel(TranslationBase.of(context).sendLC!, TranslationBase.of(context).instruction!, "", - 'patient/health_summary.png', - onTap: () { - Helpers.showConfirmationDialog(context, - "${TranslationBase.of(context).areYouSureYouWantTo} ${TranslationBase.of(context).sendLC} ${TranslationBase.of(context).instruction} ?", - () async { - Navigator.of(context).pop(); - GifLoaderDialogUtils.showMyDialog(context); - await liveCareModel.sendSMSInstruction(patient!.vcId!); - GifLoaderDialogUtils.hideDialog(context); - if (liveCareModel.state == ViewState.ErrorLocal) { - DrAppToastMsg.showErrorToast(liveCareModel.error); - } else { - DrAppToastMsg.showSuccesToast("You successfully sent SMS instructions"); - } - }); - }, + PatientProfileCardModel( + TranslationBase.of(context).sendLC!, + TranslationBase.of(context).instruction!, + "", + 'patient/health_summary.png', onTap: () { + Helpers.showConfirmationDialog(context, + "${TranslationBase.of(context).areYouSureYouWantTo} ${TranslationBase.of(context).sendLC} ${TranslationBase.of(context).instruction} ?", + () async { + Navigator.of(context).pop(); + GifLoaderDialogUtils.showMyDialog(context); + await liveCareModel.sendSMSInstruction(patient!.vcId!); + GifLoaderDialogUtils.hideDialog(context); + if (liveCareModel.state == ViewState.ErrorLocal) { + DrAppToastMsg.showErrorToast(liveCareModel.error); + } else { + DrAppToastMsg.showSuccesToast( + "You successfully sent SMS instructions"); + } + }); + }, isInPatient: isInpatient, isDartIcon: true, // isDisable: true, dartIcon: DoctorApp.send_instruction), PatientProfileCardModel( - TranslationBase.of(context).transferTo!, TranslationBase.of(context).admin!, '', 'patient/health_summary.png', - onTap: () { - Navigator.push(context, - MaterialPageRoute(builder: (BuildContext context) => LivaCareTransferToAdmin(patient: patient!), - settings: RouteSettings(name: 'LivaCareTransferToAdmin'),),); - }, isInPatient: isInpatient, isDartIcon: true, dartIcon: DoctorApp.transfer_to_admin), + TranslationBase.of(context).transferTo!, + TranslationBase.of(context).admin!, + '', + 'patient/health_summary.png', onTap: () { + Navigator.push( + context, + MaterialPageRoute( + builder: (BuildContext context) => + LivaCareTransferToAdmin(patient: patient!), + settings: RouteSettings(name: 'LivaCareTransferToAdmin'), + ), + ); + }, + isInPatient: isInpatient, + isDartIcon: true, + dartIcon: DoctorApp.transfer_to_admin), ]; return BaseView( @@ -182,19 +207,12 @@ class _EndCallScreenState extends State { }, builder: (_, model, w) => AppScaffold( baseViewModel: model, - appBarTitle: TranslationBase - .of(context) - .patientProfile!, - backgroundColor: Theme - .of(context) - .scaffoldBackgroundColor, + appBarTitle: TranslationBase.of(context).patientProfile!, + backgroundColor: Theme.of(context).scaffoldBackgroundColor, isShowAppBar: true, - appBar: PatientProfileAppBar( - patient, - onPressed: (){ - Navigator.pop(context); - - }, + appBar: PatientProfileAppBar(patient, onPressed: () { + Navigator.pop(context); + }, isInpatient: isInpatient, height: (patient!.patientStatusType != null && patient!.patientStatusType == 43) @@ -212,7 +230,8 @@ class _EndCallScreenState extends State { child: ListView( children: [ Padding( - padding: const EdgeInsets.symmetric(vertical: 15.0, horizontal: 15), + padding: + const EdgeInsets.symmetric(vertical: 15.0, horizontal: 15), child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ @@ -237,7 +256,8 @@ class _EndCallScreenState extends State { crossAxisCount: 3, itemCount: cardsList.length, staggeredTileBuilder: (int index) => StaggeredTile.fit(1), - itemBuilder: (BuildContext context, int index) => PatientProfileButton( + itemBuilder: (BuildContext context, int index) => + PatientProfileButton( patient: patient!, patientType: patientType, arrivalType: arrivalType, @@ -248,7 +268,8 @@ class _EndCallScreenState extends State { route: cardsList[index].route, icon: cardsList[index].icon, isInPatient: cardsList[index].isInPatient, - isDischargedPatient: cardsList[index].isDischargedPatient, + isDischargedPatient: + cardsList[index].isDischargedPatient, isDisable: cardsList[index].isDisable, onTap: cardsList[index].onTap, isLoading: cardsList[index].isLoading, @@ -326,7 +347,7 @@ class _EndCallScreenState extends State { ), actions: [ AppButton( - onPressed: (){ + onPressed: () { Navigator.of(context).pop(); okFunction(true); }, diff --git a/lib/screens/patients/DischargedPatientPage.dart b/lib/screens/patients/DischargedPatientPage.dart index 83e8376a..56e0d9b0 100644 --- a/lib/screens/patients/DischargedPatientPage.dart +++ b/lib/screens/patients/DischargedPatientPage.dart @@ -212,7 +212,7 @@ class _DischargedPatientState extends State { errorBuilder: (BuildContext context, Object exception, - StackTrace + StackTrace? stackTrace) { return AppText( '', diff --git a/lib/screens/patients/profile/UCAF/UCAF-detail-screen.dart b/lib/screens/patients/profile/UCAF/UCAF-detail-screen.dart index e50c6ae1..d44a2e7e 100644 --- a/lib/screens/patients/profile/UCAF/UCAF-detail-screen.dart +++ b/lib/screens/patients/profile/UCAF/UCAF-detail-screen.dart @@ -24,14 +24,15 @@ class UcafDetailScreen extends StatefulWidget { final UcafViewModel model; final Function changeLoadingState; - UcafDetailScreen(this.patient, this.model, {this.changeLoadingState}); + UcafDetailScreen(this.patient, this.model, + {required this.changeLoadingState}); @override - _UcafDetailScreenState createState() => _UcafDetailScreenState(this.patient, this.model); + _UcafDetailScreenState createState() => + _UcafDetailScreenState(this.patient, this.model); } class _UcafDetailScreenState extends State { - final PatiantInformtion patient; final UcafViewModel model; @@ -43,17 +44,15 @@ class _UcafDetailScreenState extends State { @override void initState() { - model.saveUCAFOnTap = () async{ + model.saveUCAFOnTap = () async { widget.changeLoadingState(true); await ucafModel.postUCAF(patient); widget.changeLoadingState(false); if (ucafModel.state == ViewState.Idle) { DrAppToastMsg.showSuccesToast( - TranslationBase.of(context) - .postUcafSuccessMsg); + TranslationBase.of(context).postUcafSuccessMsg); Navigator.of(context).popUntil((route) { - return route.settings.name == - PATIENTS_PROFILE; + return route.settings.name == PATIENTS_PROFILE; }); } else { DrAppToastMsg.showErrorToast(ucafModel.error); @@ -86,14 +85,17 @@ class _UcafDetailScreenState extends State { crossAxisAlignment: CrossAxisAlignment.start, children: [ Container( - margin: EdgeInsets.symmetric(vertical: 16, horizontal: 16), + margin: EdgeInsets.symmetric( + vertical: 16, horizontal: 16), child: Column( children: [ - treatmentStepsBar(context, model, screenSize, patient), + treatmentStepsBar( + context, model, screenSize, patient), SizedBox( height: 16, ), - ...getSelectedTreatmentStepItem(context, model), + ...getSelectedTreatmentStepItem( + context, model), ], ), ), @@ -107,7 +109,8 @@ class _UcafDetailScreenState extends State { )); } - Widget treatmentStepsBar(BuildContext _context, UcafViewModel model, Size screenSize, PatiantInformtion patient) { + Widget treatmentStepsBar(BuildContext _context, UcafViewModel model, + Size screenSize, PatiantInformtion patient) { List __treatmentSteps = [ TranslationBase.of(context).diagnosis ?? "".toUpperCase(), TranslationBase.of(context).medications ?? "".toUpperCase(), @@ -115,7 +118,8 @@ class _UcafDetailScreenState extends State { ]; return Container( height: screenSize.height * 0.070, - decoration: Helpers.containerBorderDecoration(Color(0Xffffffff), Color(0xFFCCCCCC)), + decoration: Helpers.containerBorderDecoration( + Color(0Xffffffff), Color(0xFFCCCCCC)), child: Row( mainAxisSize: MainAxisSize.max, crossAxisAlignment: CrossAxisAlignment.center, @@ -127,13 +131,16 @@ class _UcafDetailScreenState extends State { child: Container( height: screenSize.height * 0.070, decoration: Helpers.containerBorderDecoration( - _isActive ? HexColor("#B8382B") : Colors.white, _isActive ? HexColor("#B8382B") : Colors.white), + _isActive ? HexColor("#B8382B") : Colors.white, + _isActive ? HexColor("#B8382B") : 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, ), ), @@ -166,17 +173,20 @@ class _UcafDetailScreenState extends State { ); } - List getSelectedTreatmentStepItem(BuildContext _context, UcafViewModel model) { + List getSelectedTreatmentStepItem( + BuildContext _context, UcafViewModel model) { switch (_activeTap) { case 0: if (model.patientAssessmentList != null) { return [ - ListView.builder(itemCount: model.patientAssessmentList.length, + ListView.builder( + itemCount: model.patientAssessmentList.length, scrollDirection: Axis.vertical, physics: ScrollPhysics(), shrinkWrap: true, itemBuilder: (context, index) { - return DiagnosisWidget(model, model.patientAssessmentList[index]); + return DiagnosisWidget( + model, model.patientAssessmentList[index]); }) ]; } else { @@ -187,12 +197,16 @@ class _UcafDetailScreenState extends State { break; case 1: return [ - ListView.builder(itemCount:model.prescriptionList != null ? model.prescriptionList!.entityList!.length : 0, + ListView.builder( + itemCount: model.prescriptionList != null + ? model.prescriptionList!.entityList!.length + : 0, scrollDirection: Axis.vertical, physics: ScrollPhysics(), shrinkWrap: true, itemBuilder: (context, index) { - return MedicationWidget(model, model.prescriptionList!.entityList![index]); + return MedicationWidget( + model, model.prescriptionList!.entityList![index]); }) ]; break; @@ -200,7 +214,8 @@ class _UcafDetailScreenState extends State { if (model.orderProcedures != null) { return [ ListView.builder( - itemCount:model.orderProcedures.length, scrollDirection: Axis.vertical, + itemCount: model.orderProcedures.length, + scrollDirection: Axis.vertical, physics: ScrollPhysics(), shrinkWrap: true, itemBuilder: (context, index) { @@ -219,7 +234,6 @@ class _UcafDetailScreenState extends State { ]; } } - } class DiagnosisWidget extends StatelessWidget { @@ -230,10 +244,12 @@ class DiagnosisWidget extends StatelessWidget { @override Widget build(BuildContext context) { - MasterKeyModel? diagnosisType = - model.findMasterDataById(masterKeys: MasterKeysService.DiagnosisType, id: diagnosis.diagnosisTypeID); - MasterKeyModel? diagnosisCondition = - model.findMasterDataById(masterKeys: MasterKeysService.DiagnosisCondition, id: diagnosis.conditionID); + MasterKeyModel? diagnosisType = model.findMasterDataById( + masterKeys: MasterKeysService.DiagnosisType, + id: diagnosis.diagnosisTypeID); + MasterKeyModel? diagnosisCondition = model.findMasterDataById( + masterKeys: MasterKeysService.DiagnosisCondition, + id: diagnosis.conditionID); return Column( crossAxisAlignment: CrossAxisAlignment.start, diff --git a/lib/screens/patients/profile/UCAF/UCAF-input-screen.dart b/lib/screens/patients/profile/UCAF/UCAF-input-screen.dart index 1d1d549b..f81bfe0c 100644 --- a/lib/screens/patients/profile/UCAF/UCAF-input-screen.dart +++ b/lib/screens/patients/profile/UCAF/UCAF-input-screen.dart @@ -21,7 +21,7 @@ class UCAFInputScreen extends StatefulWidget { final PatiantInformtion patient; final Function changeLoadingState; - UCAFInputScreen(this.patient, {this.changeLoadingState}); + UCAFInputScreen(this.patient, {required this.changeLoadingState}); @override _UCAFInputScreenState createState() => _UCAFInputScreenState(this.patient); @@ -83,7 +83,8 @@ class _UCAFInputScreenState extends State { children: [ // PatientHeaderWidgetNoAvatar(patient), Container( - margin: EdgeInsets.symmetric(vertical: 0, horizontal: 16), + margin: EdgeInsets.symmetric( + vertical: 0, horizontal: 16), child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ @@ -137,7 +138,8 @@ class _UCAFInputScreenState extends State { height: 16, ),*/ Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, + mainAxisAlignment: + MainAxisAlignment.spaceBetween, children: [ Row( children: [ @@ -151,7 +153,8 @@ class _UCAFInputScreenState extends State { ), AppText( "BP (H/L)", - fontSize: SizeConfig.textMultiplier * 1.8, + fontSize: + SizeConfig.textMultiplier * 1.8, color: Colors.black, fontWeight: FontWeight.normal, ), @@ -160,7 +163,8 @@ class _UCAFInputScreenState extends State { ), AppText( "${model.bloodPressure}", - fontSize: SizeConfig.textMultiplier * 2, + fontSize: + SizeConfig.textMultiplier * 2, color: Colors.grey.shade800, fontWeight: FontWeight.w700, ), @@ -174,7 +178,8 @@ class _UCAFInputScreenState extends State { children: [ AppText( "${TranslationBase.of(context).temperature}", - fontSize: SizeConfig.textMultiplier * 1.8, + fontSize: + SizeConfig.textMultiplier * 1.8, color: Colors.black, fontWeight: FontWeight.normal, ), @@ -184,7 +189,8 @@ class _UCAFInputScreenState extends State { Expanded( child: AppText( "${model.temperatureCelcius}(C), ${(double.parse(model.temperatureCelcius) * (9 / 5) + 32).toStringAsFixed(2)}(F)", - fontSize: SizeConfig.textMultiplier * 2, + fontSize: + SizeConfig.textMultiplier * 2, color: Colors.grey.shade800, fontWeight: FontWeight.w700, ), @@ -198,13 +204,15 @@ class _UCAFInputScreenState extends State { height: 2, ), Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, + mainAxisAlignment: + MainAxisAlignment.spaceBetween, children: [ Row( children: [ AppText( "${TranslationBase.of(context).pulseBeats}:", - fontSize: SizeConfig.textMultiplier * 1.8, + fontSize: + SizeConfig.textMultiplier * 1.8, color: Colors.black, fontWeight: FontWeight.normal, ), @@ -213,7 +221,8 @@ class _UCAFInputScreenState extends State { ), AppText( "${model.hartRat}", - fontSize: SizeConfig.textMultiplier * 2, + fontSize: + SizeConfig.textMultiplier * 2, color: Colors.grey.shade800, fontWeight: FontWeight.w700, ), @@ -225,7 +234,8 @@ class _UCAFInputScreenState extends State { height: 16, ), AppText( - TranslationBase.of(context).chiefComplaintsAndSymptoms, + TranslationBase.of(context) + .chiefComplaintsAndSymptoms, fontFamily: 'Poppins', fontSize: SizeConfig.textMultiplier * 2.2, fontWeight: FontWeight.w700, @@ -246,9 +256,12 @@ class _UCAFInputScreenState extends State { height: 8, ), AppTextFieldCustom( - hintText: TranslationBase.of(context).instruction, - dropDownText: - Helpers.parseHtmlString(model.patientChiefComplaintList[0].chiefComplaint ?? ""), + hintText: + TranslationBase.of(context).instruction, + dropDownText: Helpers.parseHtmlString(model + .patientChiefComplaintList[0] + .chiefComplaint ?? + ""), controller: _additionalComplaintsController, inputType: TextInputType.multiline, enabled: false, @@ -370,29 +383,32 @@ class _UCAFInputScreenState extends State { ) : model.patientChiefComplaintList != null || model.patientVitalSignsHistory != null - ?Center( - child: Column( - crossAxisAlignment: CrossAxisAlignment.center, - children: [ - SizedBox( - height: 100, + ? Center( + child: Column( + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + SizedBox( + height: 100, + ), + Image.asset('assets/images/no-data.png'), + Padding( + padding: const EdgeInsets.all(8.0), + child: AppText( + model.patientVitalSignsHistory == null || + model.patientVitalSignsHistory.length == 0 + ? TranslationBase.of(context).vitalSignEmptyMsg + : TranslationBase.of(context) + .chiefComplaintEmptyMsg, + fontWeight: FontWeight.normal, + textAlign: TextAlign.center, + color: HexColor("#B8382B"), + fontSize: SizeConfig.textMultiplier * 2.5, + ), + ) + ], ), - Image.asset('assets/images/no-data.png'), - Padding( - padding: const EdgeInsets.all(8.0), - child: AppText( - model.patientVitalSignsHistory == null ||model.patientVitalSignsHistory.length == 0 - ? TranslationBase.of(context).vitalSignEmptyMsg - : TranslationBase.of(context).chiefComplaintEmptyMsg, - fontWeight: FontWeight.normal, - textAlign: TextAlign.center, - color: HexColor("#B8382B"), - fontSize: SizeConfig.textMultiplier * 2.5, - ), - ) - ], - ), - ): Container(), + ) + : Container(), ), ); } diff --git a/lib/screens/patients/profile/UCAF/page-stepper-widget.dart b/lib/screens/patients/profile/UCAF/page-stepper-widget.dart index 78f7f6db..fe8ff250 100644 --- a/lib/screens/patients/profile/UCAF/page-stepper-widget.dart +++ b/lib/screens/patients/profile/UCAF/page-stepper-widget.dart @@ -16,9 +16,13 @@ class PageStepperWidget extends StatelessWidget { final int stepsCount; final int currentStepIndex; final Size screenSize; - final List stepsTitles; + final List? stepsTitles; - PageStepperWidget({required this.stepsCount, required this.currentStepIndex, required this.screenSize, this.stepsTitles}); + PageStepperWidget( + {required this.stepsCount, + required this.currentStepIndex, + required this.screenSize, + this.stepsTitles}); @override Widget build(BuildContext context) { @@ -33,9 +37,23 @@ class PageStepperWidget extends StatelessWidget { children: [ for (int i = 1; i <= stepsCount; i++) if (i == currentStepIndex) - StepWidget(i, true, i == stepsCount, i < currentStepIndex, dividerWidth, stepsTitles: stepsTitles,) + StepWidget( + i, + true, + i == stepsCount, + i < currentStepIndex, + dividerWidth, + stepsTitles: stepsTitles!, + ) else - StepWidget(i, false, i == stepsCount, i < currentStepIndex, dividerWidth, stepsTitles: stepsTitles,) + StepWidget( + i, + false, + i == stepsCount, + i < currentStepIndex, + dividerWidth, + stepsTitles: stepsTitles!, + ) ], ) ], @@ -52,7 +70,9 @@ class StepWidget extends StatelessWidget { final double dividerWidth; final List stepsTitles; - StepWidget(this.index, this.isInProgress, this.isFinalStep, this.isStepFinish, this.dividerWidth, {this.stepsTitles}); + StepWidget(this.index, this.isInProgress, this.isFinalStep, this.isStepFinish, + this.dividerWidth, + {required this.stepsTitles}); @override Widget build(BuildContext context) { @@ -96,7 +116,9 @@ class StepWidget extends StatelessWidget { child: Icon( Icons.check, size: 20, - color: status == StepStatus.Locked ? Color(0xFF969696) : Colors.white, + color: status == StepStatus.Locked + ? Color(0xFF969696) + : Colors.white, )), ), if (!isFinalStep) @@ -104,7 +126,9 @@ class StepWidget extends StatelessWidget { margin: EdgeInsets.symmetric(horizontal: 4), width: dividerWidth, height: 2, - color: status == StepStatus.Completed ? Color(0xFF359846) : Color(0xFFCCCCCC), + color: status == StepStatus.Completed + ? Color(0xFF359846) + : Color(0xFFCCCCCC), ), ], ), @@ -112,7 +136,9 @@ class StepWidget extends StatelessWidget { height: 8, ), AppText( - stepsTitles == null ? "${TranslationBase.of(context).step} $index" : "${stepsTitles[index - 1]}", + stepsTitles == null + ? "${TranslationBase.of(context).step} $index" + : "${stepsTitles[index - 1]}", fontWeight: FontWeight.bold, color: status == StepStatus.Locked ? Color(0xFF969696) : Colors.black, fontFamily: 'Poppins', diff --git a/lib/screens/patients/profile/UCAF/ucaf_pager_screen.dart b/lib/screens/patients/profile/UCAF/ucaf_pager_screen.dart index 2be71d19..f95fea71 100644 --- a/lib/screens/patients/profile/UCAF/ucaf_pager_screen.dart +++ b/lib/screens/patients/profile/UCAF/ucaf_pager_screen.dart @@ -23,13 +23,13 @@ class UCAFPagerScreen extends StatefulWidget { class _UCAFPagerScreenState extends State with TickerProviderStateMixin { - PageController _controller; + late PageController _controller; int _currentIndex = 0; bool _isLoading = true; - PatiantInformtion patient; - String patientType; - String arrivalType; + late PatiantInformtion patient; + late String patientType; + late String arrivalType; changePageViewIndex(pageIndex, {isChangeState = true}) { if (pageIndex != _currentIndex && isChangeState) changeLoadingState(true); @@ -65,7 +65,7 @@ class _UCAFPagerScreenState extends State isShowAppBar: true, isLoading: _isLoading, appBar: PatientProfileAppBar(patient), - appBarTitle: TranslationBase.of(context).ucaf, + appBarTitle: TranslationBase.of(context).ucaf!, body: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ diff --git a/lib/screens/patients/profile/admission-orders/admission_orders_screen.dart b/lib/screens/patients/profile/admission-orders/admission_orders_screen.dart index 0ec237da..98936870 100644 --- a/lib/screens/patients/profile/admission-orders/admission_orders_screen.dart +++ b/lib/screens/patients/profile/admission-orders/admission_orders_screen.dart @@ -215,7 +215,7 @@ class _AdmissionOrdersScreenState extends State { .getDateTimeFromServerFormat(model .admissionOrderList[ index] - .createdOn), + .createdOn!), isArabic: projectViewModel .isArabic, @@ -241,7 +241,7 @@ class _AdmissionOrdersScreenState extends State { .getDateTimeFromServerFormat(model .admissionOrderList[ index] - .createdOn)) + .createdOn!)) : AppDateUtils.getHour( DateTime.now()), fontWeight: FontWeight.w600, diff --git a/lib/screens/patients/profile/diabetic_chart/line_chart_for_diabetic.dart b/lib/screens/patients/profile/diabetic_chart/line_chart_for_diabetic.dart index 6f4005f1..914226fe 100644 --- a/lib/screens/patients/profile/diabetic_chart/line_chart_for_diabetic.dart +++ b/lib/screens/patients/profile/diabetic_chart/line_chart_for_diabetic.dart @@ -12,7 +12,10 @@ class LineChartForDiabetic extends StatelessWidget { final bool isOX; LineChartForDiabetic( - {required this.title, required this.timeSeries1, required this.indexes, this.isOX= false}); + {required this.title, + required this.timeSeries1, + required this.indexes, + this.isOX = false}); List xAxixs = []; List yAxixs = []; @@ -93,7 +96,7 @@ class LineChartForDiabetic extends StatelessWidget { titlesData: FlTitlesData( bottomTitles: SideTitles( showTitles: true, - getTextStyles: (value) => TextStyle( + getTextStyles: (value) => TextStyle( color: Colors.black, fontSize: 10, ), @@ -121,13 +124,16 @@ class LineChartForDiabetic extends StatelessWidget { ), leftTitles: SideTitles( showTitles: true, - getTextStyles: (value) => const TextStyle( + getTextStyles: (value) => TextStyle( color: Colors.black, fontWeight: FontWeight.bold, fontSize: 10, ), - interval:getMaxY() - getMinY() <=500?50:getMaxY() - getMinY() <=1000?100:200, - + interval: getMaxY() - getMinY() <= 500 + ? 50 + : getMaxY() - getMinY() <= 1000 + ? 100 + : 200, margin: 12, ), ), @@ -226,10 +232,10 @@ class LineChartForDiabetic extends StatelessWidget { ); List lineChartData = []; - if(spots.isNotEmpty){ + if (spots.isNotEmpty) { lineChartData.add(lineChartBarData1); } - if(spots2.isNotEmpty){ + if (spots2.isNotEmpty) { lineChartData.add(lineChartBarData2); } return lineChartData; diff --git a/lib/screens/patients/profile/discharge_summary/discharge_Summary_widget.dart b/lib/screens/patients/profile/discharge_summary/discharge_Summary_widget.dart index 33572f93..e60ad382 100644 --- a/lib/screens/patients/profile/discharge_summary/discharge_Summary_widget.dart +++ b/lib/screens/patients/profile/discharge_summary/discharge_Summary_widget.dart @@ -71,21 +71,22 @@ class _DischargeSummaryWidgetState extends State { isCopyable: false, ), CustomRow( - label: TranslationBase.of(context).dischargeDate! + ": ", + label: + TranslationBase.of(context).dischargeDate! + ": ", value: AppDateUtils.getDateTimeFromServerFormat( - widget.dischargeSummary.createdOn) + widget.dischargeSummary.createdOn!) .day .toString() + " " + AppDateUtils.getMonth( AppDateUtils.getDateTimeFromServerFormat( - widget.dischargeSummary.createdOn) + widget.dischargeSummary.createdOn!) .month) .toString() .substring(0, 3) + ' ' + AppDateUtils.getDateTimeFromServerFormat( - widget.dischargeSummary.createdOn) + widget.dischargeSummary.createdOn!) .year .toString(), isCopyable: false, @@ -140,7 +141,7 @@ class _DischargeSummaryWidgetState extends State { )), new TextSpan( text: Helpers.parseHtmlString( - widget.dischargeSummary.pastHistory), + widget.dischargeSummary.pastHistory!), style: TextStyle( fontFamily: 'Poppins', fontSize: SizeConfig @@ -215,7 +216,7 @@ class _DischargeSummaryWidgetState extends State { )), new TextSpan( text: Helpers.parseHtmlString(widget - .dischargeSummary.conditionOnDischarge), + .dischargeSummary.conditionOnDischarge!), style: TextStyle( fontFamily: 'Poppins', fontSize: SizeConfig @@ -252,7 +253,7 @@ class _DischargeSummaryWidgetState extends State { )), new TextSpan( text: Helpers.parseHtmlString( - widget.dischargeSummary.planedProcedure), + widget.dischargeSummary.planedProcedure!), style: TextStyle( fontFamily: 'Poppins', fontSize: SizeConfig diff --git a/lib/screens/patients/profile/lab_result/LineChartCurved.dart b/lib/screens/patients/profile/lab_result/LineChartCurved.dart index 4c27861e..05e26cfe 100644 --- a/lib/screens/patients/profile/lab_result/LineChartCurved.dart +++ b/lib/screens/patients/profile/lab_result/LineChartCurved.dart @@ -91,11 +91,12 @@ class LineChartCurvedState extends State { touchCallback: (LineTouchResponse touchResponse) {}, handleBuiltInTouches: true, ), - gridData: FlGridData(show: true, drawVerticalLine: true, drawHorizontalLine: true), + gridData: FlGridData( + show: true, drawVerticalLine: true, drawHorizontalLine: true), titlesData: FlTitlesData( bottomTitles: SideTitles( showTitles: true, - getTextStyles: (value) => const TextStyle( + getTextStyles: (context, value) => const TextStyle( color: Colors.black, fontSize: 11, ), @@ -103,7 +104,8 @@ class LineChartCurvedState extends State { rotateAngle: -65, getTitles: (value) { print(value); - DateTime date = AppDateUtils.convertStringToDate(widget.labResult[value.toInt()].verifiedOnDateTime!); + DateTime date = AppDateUtils.convertStringToDate( + widget.labResult[value.toInt()].verifiedOnDateTime!); if (widget.labResult.length < 8) { if (widget.labResult.length > value.toInt()) { return '${date.day}/ ${date.year}'; @@ -111,7 +113,8 @@ class LineChartCurvedState extends State { return ''; } else { if (value.toInt() == 0) return '${date.day}/ ${date.year}'; - if (value.toInt() == widget.labResult.length - 1) return '${date.day}/ ${date.year}'; + if (value.toInt() == widget.labResult.length - 1) + return '${date.day}/ ${date.year}'; if (xAxixs.contains(value.toInt())) { return '${date.day}/ ${date.year}'; } @@ -122,7 +125,7 @@ class LineChartCurvedState extends State { ), leftTitles: SideTitles( showTitles: true, - getTextStyles: (value) => const TextStyle( + getTextStyles: (context, value) => const TextStyle( color: Colors.black, fontWeight: FontWeight.bold, fontSize: 10, @@ -195,7 +198,8 @@ class LineChartCurvedState extends State { List spots = []; for (int index = 0; index < widget.labResult.length; index++) { try { - var resultValueDouble = double.parse(widget.labResult[index].resultValue ?? ""); + var resultValueDouble = + double.parse(widget.labResult[index].resultValue ?? ""); spots.add(FlSpot(index.toDouble(), resultValueDouble)); } catch (e) { print(e); diff --git a/lib/screens/patients/profile/lab_result/LineChartCurvedLabHistory.dart b/lib/screens/patients/profile/lab_result/LineChartCurvedLabHistory.dart index 606c75a2..d1711c37 100644 --- a/lib/screens/patients/profile/lab_result/LineChartCurvedLabHistory.dart +++ b/lib/screens/patients/profile/lab_result/LineChartCurvedLabHistory.dart @@ -9,7 +9,8 @@ class LineChartCurvedLabHistory extends StatefulWidget { final String title; final List labResultHistory; - LineChartCurvedLabHistory({required this.title, required this.labResultHistory}); + LineChartCurvedLabHistory( + {required this.title, required this.labResultHistory}); @override State createState() => LineChartCurvedLabHistoryState(); @@ -98,7 +99,7 @@ class LineChartCurvedLabHistoryState extends State { titlesData: FlTitlesData( bottomTitles: SideTitles( showTitles: true, - getTextStyles: (value) => const TextStyle( + getTextStyles: (context, value) => TextStyle( color: Colors.black, fontSize: 11, ), @@ -107,7 +108,7 @@ class LineChartCurvedLabHistoryState extends State { getTitles: (value) { print(value); DateTime date = AppDateUtils.convertStringToDate( - widget.labResultHistory[value.toInt()].verifiedOnDateTime); + widget.labResultHistory[value.toInt()].verifiedOnDateTime!); if (widget.labResultHistory.length < 8) { if (widget.labResultHistory.length > value.toInt()) { return '${date.day}/ ${date.year}'; @@ -127,7 +128,7 @@ class LineChartCurvedLabHistoryState extends State { ), leftTitles: SideTitles( showTitles: true, - getTextStyles: (value) => const TextStyle( + getTextStyles: (context, value) => const TextStyle( color: Colors.black, fontWeight: FontWeight.bold, fontSize: 10, @@ -169,7 +170,7 @@ class LineChartCurvedLabHistoryState extends State { double max = 0; widget.labResultHistory.forEach((element) { try { - double resultValueDouble = double.parse(element.resultValue); + double resultValueDouble = double.parse(element.resultValue!); if (resultValueDouble > max) max = resultValueDouble; } catch (e) { print(e); @@ -182,10 +183,10 @@ class LineChartCurvedLabHistoryState extends State { double getMinY() { double min = 0; try { - min = double.parse(widget.labResultHistory[0].resultValue); + min = double.parse(widget.labResultHistory[0].resultValue!); widget.labResultHistory.forEach((element) { - double resultValueDouble = double.parse(element.resultValue); + double resultValueDouble = double.parse(element.resultValue!); if (resultValueDouble < min) min = resultValueDouble; }); } catch (e) { @@ -201,7 +202,7 @@ class LineChartCurvedLabHistoryState extends State { for (int index = 0; index < widget.labResultHistory.length; index++) { try { var resultValueDouble = - double.parse(widget.labResultHistory[index].resultValue); + double.parse(widget.labResultHistory[index].resultValue!); spots.add(FlSpot(index.toDouble(), resultValueDouble)); } catch (e) { print(e); diff --git a/lib/screens/patients/profile/operation_report/operation_report.dart b/lib/screens/patients/profile/operation_report/operation_report.dart index 376f8dbb..961641e6 100644 --- a/lib/screens/patients/profile/operation_report/operation_report.dart +++ b/lib/screens/patients/profile/operation_report/operation_report.dart @@ -68,8 +68,7 @@ class _ProgressNoteState extends State { color: Colors.grey[200], child: Column( children: [ - model.reservationList == null || - model.reservationList.length == 0 + model.reservationList == null || model.reservationList.length == 0 ? DrAppEmbeddedError( error: TranslationBase.of(context).errorNoProgressNote!) : Expanded( @@ -136,9 +135,7 @@ class _ProgressNoteState extends State { Column( children: [ AppText( - model - .reservationList[ - index] + model.reservationList[index] .createdOn != null ? AppDateUtils.getDayMonthYearDateFormatted( @@ -146,7 +143,7 @@ class _ProgressNoteState extends State { .getDateTimeFromServerFormat(model .reservationList[ index] - .createdOn), + .createdOn!), isArabic: projectViewModel .isArabic, @@ -161,9 +158,7 @@ class _ProgressNoteState extends State { fontSize: 14, ), AppText( - model - .reservationList[ - index] + model.reservationList[index] .createdOn != null ? AppDateUtils.getHour( @@ -171,7 +166,7 @@ class _ProgressNoteState extends State { .getDateTimeFromServerFormat(model .reservationList[ index] - .createdOn)) + .createdOn!)) : AppDateUtils.getHour( DateTime.now()), fontWeight: FontWeight.w600, @@ -188,7 +183,7 @@ class _ProgressNoteState extends State { ), Row( mainAxisAlignment: - MainAxisAlignment.start, + MainAxisAlignment.start, children: [ AppText( "Reservation: ", @@ -196,7 +191,9 @@ class _ProgressNoteState extends State { ), Expanded( child: AppText( - model.reservationList[index].oTReservationID.toString(), + model.reservationList[index] + .oTReservationID + .toString(), fontSize: 10, ), ) @@ -222,7 +219,7 @@ class _ProgressNoteState extends State { .getDateTimeFromServerFormat(model .reservationList[ index] - .operationDate), + .operationDate!), isArabic: projectViewModel .isArabic, diff --git a/lib/screens/patients/profile/operation_report/update_operation_report.dart b/lib/screens/patients/profile/operation_report/update_operation_report.dart index 6ff2b7de..105937c5 100644 --- a/lib/screens/patients/profile/operation_report/update_operation_report.dart +++ b/lib/screens/patients/profile/operation_report/update_operation_report.dart @@ -100,34 +100,33 @@ class _UpdateOperationReportState extends State { return BaseView( onModelReady: (model) async { - await model - .getOperationReportDetails(widget.reservation); + await model.getOperationReportDetails(widget.reservation); OTReservationID.text = widget.reservation.oTReservationID.toString(); if (model.operationDetailsList.isNotEmpty) { GetOperationDetailsResponseModel oldDetails = model.operationDetailsList[0]; - postOpDiagmosisNoteController.text = oldDetails.postOpInstruction; - preOpDiagmosisController.text = oldDetails.preOpDiagnosis; - surgeonController.text = oldDetails.surgeon; - assistantNoteController.text = oldDetails.assistant; - operationController.text = oldDetails.operation; - inasionController.text = oldDetails.inasion; - findingController.text = oldDetails.finding; - surgeryProcedureController.text = oldDetails.surgeryProcedure; - postOpInstructionController.text = oldDetails.postOpInstruction; - complicationDetailsController.text = oldDetails.complicationDetail; - bloodLossDetailController.text = oldDetails.bloodLossDetail; - histopathSpecimenController.text = oldDetails.histopathSpecimen; + postOpDiagmosisNoteController.text = oldDetails.postOpInstruction!; + preOpDiagmosisController.text = oldDetails.preOpDiagnosis!; + surgeonController.text = oldDetails.surgeon!; + assistantNoteController.text = oldDetails.assistant!; + operationController.text = oldDetails.operation!; + inasionController.text = oldDetails.inasion!; + findingController.text = oldDetails.finding!; + surgeryProcedureController.text = oldDetails.surgeryProcedure!; + postOpInstructionController.text = oldDetails.postOpInstruction!; + complicationDetailsController.text = oldDetails.complicationDetail!; + bloodLossDetailController.text = oldDetails.bloodLossDetail!; + histopathSpecimenController.text = oldDetails.histopathSpecimen!; microbiologySpecimenController.text = - oldDetails.microbiologySpecimen; - otherSpecimenController.text = oldDetails.otherSpecimen; + oldDetails.microbiologySpecimen!; + otherSpecimenController.text = oldDetails.otherSpecimen!; scrubNurseController.text = oldDetails.scrubNurse; circulatingNurseController.text = oldDetails.circulatingNurse; BloodTransfusedDetailController.text = oldDetails.bloodTransfusedDetail; - anasthetistController.text = oldDetails.anasthetist; + anasthetistController.text = oldDetails.anasthetist!; } }, builder: (_, model, w) => AppScaffold( @@ -530,94 +529,101 @@ class _UpdateOperationReportState extends State { ), ), ), - bottomSheet: model.state != ViewState.Idle?Container(height: 0,): Container( - height: 70, - margin: EdgeInsets.all(SizeConfig.widthMultiplier * 5), - child: Column( - children: [ - Container( - margin: EdgeInsets.all(5), - child: AppButton( - title: (widget.isUpdate - ? TranslationBase.of(context).noteUpdate - : TranslationBase.of(context).noteAdd)! + - TranslationBase.of(context).operationReports!, - color: Color(0xff359846), - // disabled: operationReportsController.text.isEmpty, - fontWeight: FontWeight.w700, - onPressed: () async { - setState(() { - isSubmitted = true; - }); - if (isFormValid()) { - GifLoaderDialogUtils.showMyDialog(context); - await model - .getDoctorProfile(); - - CreateUpdateOperationReportRequestModel - createUpdateOperationReportRequestModel = - CreateUpdateOperationReportRequestModel( - inasion: inasionController.text, - - /// TODO Elham* Add dynamic reservation - reservationNo: - widget.reservation.oTReservationID, - preOpDiagmosis: - preOpDiagmosisController.text, - postOpDiagmosis: - postOpDiagmosisNoteController.text, - surgeon: surgeonController.text, - assistant: assistantNoteController.text, - anasthetist: assistantNoteController.text, - operation: operationController.text, - finding: findingController.text, - surgeryProcedure: surgeonController.text, - postOpInstruction: - postOpInstructionController.text, - complicationDetails: - complicationDetailsController.text, - bloodLossDetail: - bloodLossDetailController.text, - histopathSpecimen: - histopathSpecimenController.text, - microbiologySpecimen: - microbiologySpecimenController.text, - otherSpecimen: otherSpecimenController.text, - scrubNurse: surgeonController.text, - circulatingNurse: - circulatingNurseController.text, - bloodTransfusedDetail: - bloodLossDetailController.text, - patientID: widget.patient.patientId, - admissionNo: - int.parse(widget.patient.admissionNo!), - createdBy: model - .doctorProfile!.doctorID!, - setupID: "010266"); - await model - .updateOperationReport( - createUpdateOperationReportRequestModel); - - if (model.state == - ViewState.ErrorLocal) { - Helpers.showErrorToast( - model.error); - } else { - // await model.( - // operationReportsRequest.toJson()); - - DrAppToastMsg.showSuccesToast( - "Your Order added Successfully"); - Navigator.of(context).pop(); - } - GifLoaderDialogUtils.hideDialog(context); - } - }, + bottomSheet: model.state != ViewState.Idle + ? Container( + height: 0, + ) + : Container( + height: 70, + margin: EdgeInsets.all(SizeConfig.widthMultiplier * 5), + child: Column( + children: [ + Container( + margin: EdgeInsets.all(5), + child: AppButton( + title: (widget.isUpdate + ? TranslationBase.of(context).noteUpdate + : TranslationBase.of(context).noteAdd)! + + TranslationBase.of(context).operationReports!, + color: Color(0xff359846), + // disabled: operationReportsController.text.isEmpty, + fontWeight: FontWeight.w700, + onPressed: () async { + setState(() { + isSubmitted = true; + }); + if (isFormValid()) { + GifLoaderDialogUtils.showMyDialog(context); + await model.getDoctorProfile(); + + CreateUpdateOperationReportRequestModel + createUpdateOperationReportRequestModel = + CreateUpdateOperationReportRequestModel( + inasion: inasionController.text, + + /// TODO Elham* Add dynamic reservation + reservationNo: widget + .reservation.oTReservationID, + preOpDiagmosis: + preOpDiagmosisController.text, + postOpDiagmosis: + postOpDiagmosisNoteController + .text, + surgeon: surgeonController.text, + assistant: + assistantNoteController.text, + anasthetist: + assistantNoteController.text, + operation: operationController.text, + finding: findingController.text, + surgeryProcedure: + surgeonController.text, + postOpInstruction: + postOpInstructionController.text, + complicationDetails: + complicationDetailsController + .text, + bloodLossDetail: + bloodLossDetailController.text, + histopathSpecimen: + histopathSpecimenController.text, + microbiologySpecimen: + microbiologySpecimenController + .text, + otherSpecimen: + otherSpecimenController.text, + scrubNurse: surgeonController.text, + circulatingNurse: + circulatingNurseController.text, + bloodTransfusedDetail: + bloodLossDetailController.text, + patientID: widget.patient.patientId, + admissionNo: int.parse( + widget.patient.admissionNo!), + createdBy: + model.doctorProfile!.doctorID!, + setupID: "010266"); + await model.updateOperationReport( + createUpdateOperationReportRequestModel); + + if (model.state == ViewState.ErrorLocal) { + Helpers.showErrorToast(model.error); + } else { + // await model.( + // operationReportsRequest.toJson()); + + DrAppToastMsg.showSuccesToast( + "Your Order added Successfully"); + Navigator.of(context).pop(); + } + GifLoaderDialogUtils.hideDialog(context); + } + }, + ), + ), + ], ), ), - ], - ), - ), )); } diff --git a/lib/screens/patients/profile/profile_screen/profile_gird_for_InPatient.dart b/lib/screens/patients/profile/profile_screen/profile_gird_for_InPatient.dart index e9451e54..0f2d708b 100644 --- a/lib/screens/patients/profile/profile_screen/profile_gird_for_InPatient.dart +++ b/lib/screens/patients/profile/profile_screen/profile_gird_for_InPatient.dart @@ -35,39 +35,69 @@ class ProfileGridForInPatient extends StatelessWidget { @override Widget build(BuildContext context) { final List cardsList = [ - PatientProfileCardModel(TranslationBase.of(context).vital ?? "", TranslationBase.of(context).signs ?? "", - VITAL_SIGN_DETAILS, 'patient/vital_signs.png', + PatientProfileCardModel( + TranslationBase.of(context).vital ?? "", + TranslationBase.of(context).signs ?? "", + VITAL_SIGN_DETAILS, + 'patient/vital_signs.png', isInPatient: isInpatient), - PatientProfileCardModel(TranslationBase.of(context).lab ?? "", TranslationBase.of(context).result ?? "", - LAB_RESULT, 'patient/lab_results.png', + PatientProfileCardModel( + TranslationBase.of(context).lab ?? "", + TranslationBase.of(context).result ?? "", + LAB_RESULT, + 'patient/lab_results.png', isInPatient: isInpatient), PatientProfileCardModel( - TranslationBase.of(context).lab, - TranslationBase.of(context).special, + TranslationBase.of(context).lab!, + TranslationBase.of(context).special!, ALL_SPECIAL_LAB_RESULT, 'patient/lab_results.png', isInPatient: isInpatient), - PatientProfileCardModel(TranslationBase.of(context).radiology!, TranslationBase.of(context).result!, - RADIOLOGY_PATIENT, 'patient/health_summary.png', + PatientProfileCardModel( + TranslationBase.of(context).radiology!, + TranslationBase.of(context).result!, + RADIOLOGY_PATIENT, + 'patient/health_summary.png', isInPatient: isInpatient), - PatientProfileCardModel(TranslationBase.of(context).patient!, TranslationBase.of(context).prescription!, - ORDER_PRESCRIPTION_NEW, 'patient/order_prescription.png', + PatientProfileCardModel( + TranslationBase.of(context).patient!, + TranslationBase.of(context).prescription!, + ORDER_PRESCRIPTION_NEW, + 'patient/order_prescription.png', isInPatient: isInpatient), - PatientProfileCardModel(TranslationBase.of(context).progress!, TranslationBase.of(context).note!, PROGRESS_NOTE, + PatientProfileCardModel( + TranslationBase.of(context).progress!, + TranslationBase.of(context).note!, + PROGRESS_NOTE, 'patient/Progress_notes.png', - isInPatient: isInpatient, isDischargedPatient: isDischargedPatient), - PatientProfileCardModel(TranslationBase.of(context).order!, TranslationBase.of(context).sheet!, ORDER_NOTE, + isInPatient: isInpatient, + isDischargedPatient: isDischargedPatient), + PatientProfileCardModel( + TranslationBase.of(context).order!, + TranslationBase.of(context).sheet!, + ORDER_NOTE, 'patient/Progress_notes.png', - isInPatient: isInpatient, isDischargedPatient: isDischargedPatient), - PatientProfileCardModel(TranslationBase.of(context).orders!, TranslationBase.of(context).procedures!, - ORDER_PROCEDURE, 'patient/Order_Procedures.png', + isInPatient: isInpatient, + isDischargedPatient: isDischargedPatient), + PatientProfileCardModel( + TranslationBase.of(context).orders!, + TranslationBase.of(context).procedures!, + ORDER_PROCEDURE, + 'patient/Order_Procedures.png', isInPatient: isInpatient), - PatientProfileCardModel(TranslationBase.of(context).health!, TranslationBase.of(context).summary!, HEALTH_SUMMARY, + PatientProfileCardModel( + TranslationBase.of(context).health!, + TranslationBase.of(context).summary!, + HEALTH_SUMMARY, 'patient/health_summary.png', isInPatient: isInpatient), - PatientProfileCardModel(TranslationBase.of(context).medical!, TranslationBase.of(context).report!, - PATIENT_MEDICAL_REPORT, 'patient/health_summary.png', - isInPatient: isInpatient, isDisable: false), + PatientProfileCardModel( + TranslationBase.of(context).medical!, + TranslationBase.of(context).report!, + PATIENT_MEDICAL_REPORT, + 'patient/health_summary.png', + isInPatient: isInpatient, + isDisable: false), PatientProfileCardModel( TranslationBase.of(context).referral!, TranslationBase.of(context).patient!, @@ -76,13 +106,19 @@ class ProfileGridForInPatient extends StatelessWidget { isInPatient: isInpatient, isDisable: isDischargedPatient || isFromSearch, ), - PatientProfileCardModel(TranslationBase.of(context).insurance!, TranslationBase.of(context).approvals!, - PATIENT_INSURANCE_APPROVALS_NEW, 'patient/vital_signs.png', + PatientProfileCardModel( + TranslationBase.of(context).insurance!, + TranslationBase.of(context).approvals!, + PATIENT_INSURANCE_APPROVALS_NEW, + 'patient/vital_signs.png', isInPatient: isInpatient), - PatientProfileCardModel(TranslationBase.of(context).discharge!, TranslationBase.of(context).report!, DISCHARGE_SUMMARY, - 'patient/patient_sick_leave.png', - isInPatient: isInpatient, ) - , + PatientProfileCardModel( + TranslationBase.of(context).discharge!, + TranslationBase.of(context).report!, + DISCHARGE_SUMMARY, + 'patient/patient_sick_leave.png', + isInPatient: isInpatient, + ), PatientProfileCardModel( TranslationBase.of(context).patientSick!, TranslationBase.of(context).leave!, diff --git a/lib/screens/patients/profile/profile_screen/profile_gird_for_other.dart b/lib/screens/patients/profile/profile_screen/profile_gird_for_other.dart index 7045f6c7..22a5f23b 100644 --- a/lib/screens/patients/profile/profile_screen/profile_gird_for_other.dart +++ b/lib/screens/patients/profile/profile_screen/profile_gird_for_other.dart @@ -33,41 +33,77 @@ class ProfileGridForOther extends StatelessWidget { @override Widget build(BuildContext context) { final List cardsList = [ - PatientProfileCardModel(TranslationBase.of(context).vital!, TranslationBase.of(context).signs!, VITAL_SIGN_DETAILS, 'patient/vital_signs.png', + PatientProfileCardModel( + TranslationBase.of(context).vital!, + TranslationBase.of(context).signs!, + VITAL_SIGN_DETAILS, + 'patient/vital_signs.png', isInPatient: isInpatient), PatientProfileCardModel( - TranslationBase.of(context).lab!, TranslationBase.of(context).result!, LAB_RESULT, 'patient/lab_results.png', + TranslationBase.of(context).lab!, + TranslationBase.of(context).result!, + LAB_RESULT, + 'patient/lab_results.png', isInPatient: isInpatient), - PatientProfileCardModel(TranslationBase.of(context).lab, TranslationBase.of(context).special, - ALL_SPECIAL_LAB_RESULT, 'patient/lab_results.png', + PatientProfileCardModel( + TranslationBase.of(context).lab!, + TranslationBase.of(context).special!, + ALL_SPECIAL_LAB_RESULT, + 'patient/lab_results.png', isInPatient: isInpatient), - PatientProfileCardModel(TranslationBase.of(context).radiology, TranslationBase.of(context).service, - RADIOLOGY_PATIENT, 'patient/health_summary.png', + PatientProfileCardModel( + TranslationBase.of(context).radiology!, + TranslationBase.of(context).service!, + RADIOLOGY_PATIENT, + 'patient/health_summary.png', isInPatient: isInpatient), - PatientProfileCardModel(TranslationBase.of(context).orders, TranslationBase.of(context).prescription, - ORDER_PRESCRIPTION_NEW, 'patient/order_prescription.png', + PatientProfileCardModel( + TranslationBase.of(context).orders!, + TranslationBase.of(context).prescription!, + ORDER_PRESCRIPTION_NEW, + 'patient/order_prescription.png', isInPatient: isInpatient), - PatientProfileCardModel(TranslationBase.of(context).health!, TranslationBase.of(context).summary!, HEALTH_SUMMARY, + PatientProfileCardModel( + TranslationBase.of(context).health!, + TranslationBase.of(context).summary!, + HEALTH_SUMMARY, 'patient/health_summary.png', isInPatient: isInpatient), - PatientProfileCardModel(TranslationBase.of(context).patient!, "ECG", PATIENT_ECG, 'patient/patient_sick_leave.png', + PatientProfileCardModel(TranslationBase.of(context).patient!, "ECG", + PATIENT_ECG, 'patient/patient_sick_leave.png', isInPatient: isInpatient), - PatientProfileCardModel(TranslationBase.of(context).orders!, TranslationBase.of(context).procedures!, - ORDER_PROCEDURE, 'patient/Order_Procedures.png', + PatientProfileCardModel( + TranslationBase.of(context).orders!, + TranslationBase.of(context).procedures!, + ORDER_PROCEDURE, + 'patient/Order_Procedures.png', isInPatient: isInpatient), - PatientProfileCardModel(TranslationBase.of(context).insurance!, TranslationBase.of(context).service!, - PATIENT_INSURANCE_APPROVALS_NEW, 'patient/vital_signs.png', + PatientProfileCardModel( + TranslationBase.of(context).insurance!, + TranslationBase.of(context).service!, + PATIENT_INSURANCE_APPROVALS_NEW, + 'patient/vital_signs.png', isInPatient: isInpatient), - PatientProfileCardModel(TranslationBase.of(context).patientSick!, TranslationBase.of(context).leave!, ADD_SICKLEAVE, 'patient/patient_sick_leave.png', + PatientProfileCardModel( + TranslationBase.of(context).patientSick!, + TranslationBase.of(context).leave!, + ADD_SICKLEAVE, + 'patient/patient_sick_leave.png', isInPatient: isInpatient), - if (isFromLiveCare || (patient.appointmentNo != null && patient.appointmentNo != 0)) - PatientProfileCardModel(TranslationBase.of(context).patient!, TranslationBase.of(context).ucaf!, - PATIENT_UCAF_REQUEST, 'patient/ucaf.png', + if (isFromLiveCare || + (patient.appointmentNo != null && patient.appointmentNo != 0)) + PatientProfileCardModel( + TranslationBase.of(context).patient!, + TranslationBase.of(context).ucaf!, + PATIENT_UCAF_REQUEST, + 'patient/ucaf.png', isInPatient: isInpatient, isDisable: isFromLiveCare ? patient.appointmentNo == null - : patient.patientStatusType != 43 || patient.appointmentNo == null), - if (isFromLiveCare || (patient.appointmentNo != null && patient.appointmentNo != 0)) + : patient.patientStatusType != 43 || + patient.appointmentNo == null), + if (isFromLiveCare || + (patient.appointmentNo != null && patient.appointmentNo != 0)) PatientProfileCardModel( TranslationBase.of(context).referral!, TranslationBase.of(context).patient!, @@ -76,15 +112,21 @@ class ProfileGridForOther extends StatelessWidget { isInPatient: isInpatient, isDisable: isFromLiveCare ? patient.appointmentNo == null - : patient.patientStatusType != 43 || patient.appointmentNo == null, + : patient.patientStatusType != 43 || + patient.appointmentNo == null, ), - if (isFromLiveCare || (patient.appointmentNo != null && patient.appointmentNo != 0)) - PatientProfileCardModel(TranslationBase.of(context).admission!, TranslationBase.of(context).request!, - PATIENT_ADMISSION_REQUEST, 'patient/admission_req.png', + if (isFromLiveCare || + (patient.appointmentNo != null && patient.appointmentNo != 0)) + PatientProfileCardModel( + TranslationBase.of(context).admission!, + TranslationBase.of(context).request!, + PATIENT_ADMISSION_REQUEST, + 'patient/admission_req.png', isInPatient: isInpatient, isDisable: isFromLiveCare ? patient.appointmentNo == null - : patient.patientStatusType != 43 || patient.appointmentNo == null), + : patient.patientStatusType != 43 || + patient.appointmentNo == null), ]; return Column( @@ -99,22 +141,23 @@ class ProfileGridForOther extends StatelessWidget { crossAxisCount: 3, itemCount: cardsList.length, staggeredTileBuilder: (int index) => StaggeredTile.fit(1), - itemBuilder: (BuildContext context, int index) => PatientProfileButton( - patient: patient, - patientType: patientType, - arrivalType: arrivalType, - from: from, - to: to, - nameLine1: cardsList[index].nameLine1, - nameLine2: cardsList[index].nameLine2, - route: cardsList[index].route, - icon: cardsList[index].icon, - isInPatient: cardsList[index].isInPatient, - isDischargedPatient: cardsList[index].isDischargedPatient, - isDisable: cardsList[index].isDisable, - onTap: cardsList[index].onTap, - isLoading: cardsList[index].isLoading, - isFromLiveCare: isFromLiveCare), + itemBuilder: (BuildContext context, int index) => + PatientProfileButton( + patient: patient, + patientType: patientType, + arrivalType: arrivalType, + from: from, + to: to, + nameLine1: cardsList[index].nameLine1, + nameLine2: cardsList[index].nameLine2, + route: cardsList[index].route, + icon: cardsList[index].icon, + isInPatient: cardsList[index].isInPatient, + isDischargedPatient: cardsList[index].isDischargedPatient, + isDisable: cardsList[index].isDisable, + onTap: cardsList[index].onTap, + isLoading: cardsList[index].isLoading, + isFromLiveCare: isFromLiveCare), ), ), ], diff --git a/lib/screens/patients/profile/profile_screen/profile_gird_for_search.dart b/lib/screens/patients/profile/profile_screen/profile_gird_for_search.dart index 47097c43..209062eb 100644 --- a/lib/screens/patients/profile/profile_screen/profile_gird_for_search.dart +++ b/lib/screens/patients/profile/profile_screen/profile_gird_for_search.dart @@ -30,45 +30,87 @@ class ProfileGridForSearch extends StatelessWidget { @override Widget build(BuildContext context) { final List cardsList = [ - PatientProfileCardModel(TranslationBase.of(context).vital!, TranslationBase.of(context).signs!, VITAL_SIGN_DETAILS, 'patient/vital_signs.png', + PatientProfileCardModel( + TranslationBase.of(context).vital!, + TranslationBase.of(context).signs!, + VITAL_SIGN_DETAILS, + 'patient/vital_signs.png', isInPatient: isInpatient), PatientProfileCardModel( - TranslationBase.of(context).lab!, TranslationBase.of(context).result!, LAB_RESULT, 'patient/lab_results.png', + TranslationBase.of(context).lab!, + TranslationBase.of(context).result!, + LAB_RESULT, + 'patient/lab_results.png', isInPatient: isInpatient), - PatientProfileCardModel(TranslationBase.of(context).lab, TranslationBase.of(context).special, - ALL_SPECIAL_LAB_RESULT, 'patient/lab_results.png', + PatientProfileCardModel( + TranslationBase.of(context).lab!, + TranslationBase.of(context).special!, + ALL_SPECIAL_LAB_RESULT, + 'patient/lab_results.png', isInPatient: isInpatient), - PatientProfileCardModel(TranslationBase.of(context).radiology, TranslationBase.of(context).service, - RADIOLOGY_PATIENT, 'patient/health_summary.png', + PatientProfileCardModel( + TranslationBase.of(context).radiology!, + TranslationBase.of(context).service!, + RADIOLOGY_PATIENT, + 'patient/health_summary.png', isInPatient: isInpatient), - PatientProfileCardModel(TranslationBase.of(context).orders, TranslationBase.of(context).prescription, - ORDER_PRESCRIPTION_NEW, 'patient/order_prescription.png', + PatientProfileCardModel( + TranslationBase.of(context).orders!, + TranslationBase.of(context).prescription!, + ORDER_PRESCRIPTION_NEW, + 'patient/order_prescription.png', isInPatient: isInpatient), - PatientProfileCardModel(TranslationBase.of(context).health!, TranslationBase.of(context).summary!, HEALTH_SUMMARY, + PatientProfileCardModel( + TranslationBase.of(context).health!, + TranslationBase.of(context).summary!, + HEALTH_SUMMARY, 'patient/health_summary.png', isInPatient: isInpatient), - PatientProfileCardModel(TranslationBase.of(context).patient!, "ECG", PATIENT_ECG, 'patient/patient_sick_leave.png', + PatientProfileCardModel(TranslationBase.of(context).patient!, "ECG", + PATIENT_ECG, 'patient/patient_sick_leave.png', isInPatient: isInpatient), - PatientProfileCardModel(TranslationBase.of(context).orders!, TranslationBase.of(context).procedures!, - ORDER_PROCEDURE, 'patient/Order_Procedures.png', + PatientProfileCardModel( + TranslationBase.of(context).orders!, + TranslationBase.of(context).procedures!, + ORDER_PROCEDURE, + 'patient/Order_Procedures.png', isInPatient: isInpatient), - PatientProfileCardModel(TranslationBase.of(context).insurance!, TranslationBase.of(context).service!, - PATIENT_INSURANCE_APPROVALS_NEW, 'patient/vital_signs.png', + PatientProfileCardModel( + TranslationBase.of(context).insurance!, + TranslationBase.of(context).service!, + PATIENT_INSURANCE_APPROVALS_NEW, + 'patient/vital_signs.png', isInPatient: isInpatient), - PatientProfileCardModel(TranslationBase.of(context).patientSick!, TranslationBase.of(context).leave!, ADD_SICKLEAVE, 'patient/patient_sick_leave.png', + PatientProfileCardModel( + TranslationBase.of(context).patientSick!, + TranslationBase.of(context).leave!, + ADD_SICKLEAVE, + 'patient/patient_sick_leave.png', isInPatient: isInpatient), if (patient.appointmentNo != null && patient.appointmentNo != 0) - PatientProfileCardModel(TranslationBase.of(context).patient!, TranslationBase.of(context).ucaf!, - PATIENT_UCAF_REQUEST, 'patient/ucaf.png', - isInPatient: isInpatient, isDisable: patient.patientStatusType != 43 ? true : false), + PatientProfileCardModel( + TranslationBase.of(context).patient!, + TranslationBase.of(context).ucaf!, + PATIENT_UCAF_REQUEST, + 'patient/ucaf.png', + isInPatient: isInpatient, + isDisable: patient.patientStatusType != 43 ? true : false), if (patient.appointmentNo != null && patient.appointmentNo != 0) - PatientProfileCardModel(TranslationBase.of(context).referral!, TranslationBase.of(context).patient!, - REFER_PATIENT_TO_DOCTOR, 'patient/refer_patient.png', - isInPatient: isInpatient, isDisable: patient.patientStatusType != 43 ? true : false), + PatientProfileCardModel( + TranslationBase.of(context).referral!, + TranslationBase.of(context).patient!, + REFER_PATIENT_TO_DOCTOR, + 'patient/refer_patient.png', + isInPatient: isInpatient, + isDisable: patient.patientStatusType != 43 ? true : false), if (patient.appointmentNo != null && patient.appointmentNo != 0) - PatientProfileCardModel(TranslationBase.of(context).admission!, TranslationBase.of(context).request!, - PATIENT_ADMISSION_REQUEST, 'patient/admission_req.png', - isInPatient: isInpatient, isDisable: patient.patientStatusType != 43 ? true : false), + PatientProfileCardModel( + TranslationBase.of(context).admission!, + TranslationBase.of(context).request!, + PATIENT_ADMISSION_REQUEST, + 'patient/admission_req.png', + isInPatient: isInpatient, + isDisable: patient.patientStatusType != 43 ? true : false), ]; return Column( @@ -83,7 +125,8 @@ class ProfileGridForSearch extends StatelessWidget { crossAxisCount: 3, itemCount: cardsList.length, staggeredTileBuilder: (int index) => StaggeredTile.fit(1), - itemBuilder: (BuildContext context, int index) => PatientProfileButton( + itemBuilder: (BuildContext context, int index) => + PatientProfileButton( patient: patient, patientType: patientType, arrivalType: arrivalType, 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 ac8ddd16..268e0379 100644 --- a/lib/screens/patients/profile/referral/my-referral-detail-screen.dart +++ b/lib/screens/patients/profile/referral/my-referral-detail-screen.dart @@ -18,7 +18,8 @@ import 'package:flutter/material.dart'; class MyReferralDetailScreen extends StatelessWidget { final MyReferralPatientModel referralPatient; - const MyReferralDetailScreen({Key? key, this.referralPatient}) : super(key: key); + const MyReferralDetailScreen({Key? key, required this.referralPatient}) + : super(key: key); @override Widget build(BuildContext context) { @@ -29,7 +30,7 @@ class MyReferralDetailScreen extends StatelessWidget { onModelReady: (model) => model.getDoctorProfile(), builder: (_, model, w) => AppScaffold( baseViewModel: model, - appBarTitle: TranslationBase.of(context).referPatient, + appBarTitle: TranslationBase.of(context).referPatient!, isShowAppBar: false, body: Column( children: [ @@ -53,7 +54,9 @@ class MyReferralDetailScreen extends StatelessWidget { ), Expanded( child: AppText( - (Helpers.capitalize(referralPatient.firstName + " " + referralPatient.lastName)), + (Helpers.capitalize(referralPatient.firstName! + + " " + + referralPatient.lastName!)), fontSize: SizeConfig.textMultiplier * 2.5, fontWeight: FontWeight.bold, fontFamily: 'Poppins', @@ -93,23 +96,31 @@ class MyReferralDetailScreen extends StatelessWidget { child: Column( children: [ Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, + mainAxisAlignment: + MainAxisAlignment.spaceBetween, children: [ AppText( referralPatient.referralStatus != null - ? model.getReferralStatusNameByCode(referralPatient.referralStatus, context) + ? model.getReferralStatusNameByCode( + referralPatient.referralStatus!, + context) : "", fontFamily: 'Poppins', fontSize: 1.9 * SizeConfig.textMultiplier, fontWeight: FontWeight.w700, color: referralPatient.referralStatus == 1 ? Color(0xffc4aa54) - : referralPatient.referralStatus == 46 || referralPatient.referralStatus == 2 + : referralPatient.referralStatus == + 46 || + referralPatient + .referralStatus == + 2 ? Colors.green[700] : Colors.red[700], ), AppText( - AppDateUtils.getDayMonthYearDateFormatted(referralPatient.referralDate), + AppDateUtils.getDayMonthYearDateFormatted( + referralPatient.referralDate!), fontFamily: 'Poppins', fontWeight: FontWeight.w600, fontSize: 2.0 * SizeConfig.textMultiplier, @@ -118,29 +129,35 @@ class MyReferralDetailScreen extends StatelessWidget { ], ), Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, + mainAxisAlignment: + MainAxisAlignment.spaceBetween, children: [ Row( - mainAxisAlignment: MainAxisAlignment.start, + mainAxisAlignment: + MainAxisAlignment.start, children: [ AppText( - TranslationBase.of(context).fileNumber, + TranslationBase.of(context) + .fileNumber, fontFamily: 'Poppins', fontWeight: FontWeight.w600, - fontSize: 1.7 * SizeConfig.textMultiplier, + fontSize: + 1.7 * SizeConfig.textMultiplier, color: Color(0XFF575757), ), AppText( "${referralPatient.patientID}", fontFamily: 'Poppins', fontWeight: FontWeight.w700, - fontSize: 1.8 * SizeConfig.textMultiplier, + fontSize: + 1.8 * SizeConfig.textMultiplier, color: Color(0XFF2E303A), ), ], ), AppText( - AppDateUtils.getTimeHHMMA(referralPatient.referralDate), + AppDateUtils.getTimeHHMMA( + referralPatient.referralDate!), fontFamily: 'Poppins', fontWeight: FontWeight.w600, fontSize: 1.8 * SizeConfig.textMultiplier, @@ -149,50 +166,70 @@ class MyReferralDetailScreen extends StatelessWidget { ], ), Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, + mainAxisAlignment: + MainAxisAlignment.spaceBetween, crossAxisAlignment: CrossAxisAlignment.center, children: [ Expanded( child: Column( children: [ Row( - mainAxisAlignment: MainAxisAlignment.start, + mainAxisAlignment: + MainAxisAlignment.start, children: [ AppText( - TranslationBase.of(context).referredFrom, + TranslationBase.of(context) + .referredFrom, fontFamily: 'Poppins', fontWeight: FontWeight.w600, - fontSize: 1.7 * SizeConfig.textMultiplier, + fontSize: 1.7 * + SizeConfig.textMultiplier, color: Color(0XFF575757), ), AppText( - referralPatient.targetProjectId == referralPatient.sourceProjectId - ? TranslationBase.of(context).sameBranch - : TranslationBase.of(context).otherBranch, + referralPatient + .targetProjectId == + referralPatient + .sourceProjectId + ? TranslationBase.of( + context) + .sameBranch + : TranslationBase.of( + context) + .otherBranch, fontFamily: 'Poppins', fontWeight: FontWeight.w700, - fontSize: 1.8 * SizeConfig.textMultiplier, + fontSize: 1.8 * + SizeConfig.textMultiplier, color: Color(0XFF2E303A), ), ], ), Row( - mainAxisAlignment: MainAxisAlignment.start, - crossAxisAlignment: CrossAxisAlignment.start, + mainAxisAlignment: + MainAxisAlignment.start, + crossAxisAlignment: + CrossAxisAlignment.start, children: [ AppText( - TranslationBase.of(context).remarks + " : ", + TranslationBase.of(context) + .remarks! + + " : ", fontFamily: 'Poppins', fontWeight: FontWeight.w600, - fontSize: 1.7 * SizeConfig.textMultiplier, + fontSize: 1.7 * + SizeConfig.textMultiplier, color: Color(0XFF575757), ), Expanded( child: AppText( - referralPatient.referringDoctorRemarks ?? '', + referralPatient + .referringDoctorRemarks ?? + '', fontFamily: 'Poppins', fontWeight: FontWeight.w700, - fontSize: 1.8 * SizeConfig.textMultiplier, + fontSize: 1.8 * + SizeConfig.textMultiplier, color: Color(0XFF2E303A), ), ), @@ -204,22 +241,29 @@ class MyReferralDetailScreen extends StatelessWidget { Row( children: [ AppText( - referralPatient.nationalityName != null + referralPatient.nationalityName != + null ? referralPatient.nationalityName : "", fontWeight: FontWeight.bold, color: Color(0xFF2E303A), - fontSize: 1.4 * SizeConfig.textMultiplier, + fontSize: + 1.4 * SizeConfig.textMultiplier, ), - referralPatient.nationalityFlagURL != null + referralPatient.nationalityFlagURL != + null ? ClipRRect( - borderRadius: BorderRadius.circular(20.0), + borderRadius: + BorderRadius.circular(20.0), child: Image.network( - referralPatient.nationalityFlagURL, + referralPatient + .nationalityFlagURL!, height: 25, width: 30, - errorBuilder: - (BuildContext context, Object exception, StackTrace stackTrace) { + errorBuilder: (BuildContext + context, + Object exception, + StackTrace? stackTrace) { return Text('No Image'); }, )) @@ -232,7 +276,8 @@ class MyReferralDetailScreen extends StatelessWidget { crossAxisAlignment: CrossAxisAlignment.start, children: [ Container( - margin: EdgeInsets.only(left: 10, right: 0), + margin: + EdgeInsets.only(left: 10, right: 0), child: Image.asset( 'assets/images/patient/ic_ref_arrow_up.png', height: 50, @@ -240,14 +285,20 @@ class MyReferralDetailScreen extends StatelessWidget { ), ), Container( - margin: EdgeInsets.only(left: 0, top: 25, right: 0, bottom: 0), - padding: EdgeInsets.only(left: 4.0, right: 4.0), + margin: EdgeInsets.only( + left: 0, + top: 25, + right: 0, + bottom: 0), + padding: EdgeInsets.only( + left: 4.0, right: 4.0), child: Container( width: 40, height: 40, child: CircleAvatar( radius: 25.0, - backgroundImage: NetworkImage(referralPatient.doctorImageURL), + backgroundImage: NetworkImage( + referralPatient.doctorImageURL!), backgroundColor: Colors.transparent, ), ), @@ -255,14 +306,19 @@ class MyReferralDetailScreen extends StatelessWidget { Expanded( flex: 4, child: Container( - margin: EdgeInsets.only(left: 10, top: 25, right: 10, bottom: 0), + margin: EdgeInsets.only( + left: 10, + top: 25, + right: 10, + bottom: 0), child: Column( children: [ AppText( referralPatient.doctorName, fontFamily: 'Poppins', fontWeight: FontWeight.w700, - fontSize: 1.7 * SizeConfig.textMultiplier, + fontSize: 1.7 * + SizeConfig.textMultiplier, color: Color(0XFF2E303A), ), ], @@ -293,11 +349,12 @@ class MyReferralDetailScreen extends StatelessWidget { padding: const EdgeInsets.symmetric(horizontal: 16), child: SizedBox( child: ProfileMedicalInfoWidgetSearch( - patient: model.getPatientFromReferralO(referralPatient), + patient: model + .getPatientFromReferralO(referralPatient), patientType: "7", isInpatient: false, - from: null, - to: null, + from: "", + to: "", ), ), ), @@ -325,7 +382,9 @@ class MyReferralDetailScreen extends StatelessWidget { if (model.state == ViewState.ErrorLocal) { DrAppToastMsg.showErrorToast(model.error); } else { - DrAppToastMsg.showSuccesToast(TranslationBase.of(context).referralSuccessMsgAccept); + DrAppToastMsg.showSuccesToast( + TranslationBase.of(context) + .referralSuccessMsgAccept); model.getMyReferralOutPatientService(); Navigator.pop(context); Navigator.pop(context); @@ -346,11 +405,14 @@ class MyReferralDetailScreen extends StatelessWidget { vPadding: 12, disabled: model.state == ViewState.Busy, onPressed: () async { - await model.responseReferral(referralPatient, false); + await model.responseReferral( + referralPatient, false); if (model.state == ViewState.ErrorLocal) { DrAppToastMsg.showErrorToast(model.error); } else { - DrAppToastMsg.showSuccesToast(TranslationBase.of(context).referralSuccessMsgReject); + DrAppToastMsg.showSuccesToast( + TranslationBase.of(context) + .referralSuccessMsgReject); model.getMyReferralOutPatientService(); Navigator.pop(context); Navigator.pop(context); diff --git a/lib/screens/patients/profile/vital_sign/LineChartCurved.dart b/lib/screens/patients/profile/vital_sign/LineChartCurved.dart index ec33ccf0..d926549e 100644 --- a/lib/screens/patients/profile/vital_sign/LineChartCurved.dart +++ b/lib/screens/patients/profile/vital_sign/LineChartCurved.dart @@ -10,7 +10,8 @@ class LineChartCurved extends StatelessWidget { final List timeSeries; final int indexes; - LineChartCurved({required this.title, required this.timeSeries, required this.indexes}); + LineChartCurved( + {required this.title, required this.timeSeries, required this.indexes}); List xAxixs = []; List yAxixs = []; @@ -105,11 +106,12 @@ class LineChartCurved extends StatelessWidget { touchCallback: (LineTouchResponse touchResponse) {}, handleBuiltInTouches: true, ), - gridData: FlGridData(show: true, drawVerticalLine: true, drawHorizontalLine: true), + gridData: FlGridData( + show: true, drawVerticalLine: true, drawHorizontalLine: true), titlesData: FlTitlesData( bottomTitles: SideTitles( showTitles: true, - getTextStyles: (value) => const TextStyle( + getTextStyles: (context, value) => TextStyle( color: Colors.black, fontSize: 10, ), @@ -129,7 +131,9 @@ class LineChartCurved extends StatelessWidget { return ''; } } else { - if (value.toInt() == 0 || value.toInt() == timeSeries.length - 1 || xAxixs.contains(value.toInt())) { + if (value.toInt() == 0 || + value.toInt() == timeSeries.length - 1 || + xAxixs.contains(value.toInt())) { DateTime dateTime = timeSeries[value.toInt()].time; if (isDatesSameYear) { return monthFormat.format(dateTime); @@ -159,7 +163,7 @@ class LineChartCurved extends StatelessWidget { ), leftTitles: SideTitles( showTitles: true, - getTextStyles: (value) => const TextStyle( + getTextStyles: (context, value) => const TextStyle( color: Colors.black, fontWeight: FontWeight.bold, fontSize: 10, @@ -235,7 +239,9 @@ class LineChartCurved extends StatelessWidget { int previousDateYear = 0; for (int index = 0; index < timeSeries.length; index++) { spots.add(FlSpot(index.toDouble(), timeSeries[index].sales)); - if (isDatesSameYear == false || (previousDateYear != 0 && previousDateYear != timeSeries[index].time.year)) { + if (isDatesSameYear == false || + (previousDateYear != 0 && + previousDateYear != timeSeries[index].time.year)) { isDatesSameYear = false; } previousDateYear = timeSeries[index].time.year; diff --git a/lib/screens/patients/profile/vital_sign/LineChartCurvedBloodPressure.dart b/lib/screens/patients/profile/vital_sign/LineChartCurvedBloodPressure.dart index 197e517f..772823d9 100644 --- a/lib/screens/patients/profile/vital_sign/LineChartCurvedBloodPressure.dart +++ b/lib/screens/patients/profile/vital_sign/LineChartCurvedBloodPressure.dart @@ -58,7 +58,8 @@ class LineChartCurvedBloodPressure extends StatelessWidget { ), Expanded( child: Padding( - padding: const EdgeInsets.only(right: 18.0, left: 16.0, top: 15), + padding: + const EdgeInsets.only(right: 18.0, left: 16.0, top: 15), child: LineChart( sampleData1(context), swapAnimationDuration: const Duration(milliseconds: 250), @@ -77,12 +78,15 @@ class LineChartCurvedBloodPressure extends StatelessWidget { Container( width: 20, height: 20, - decoration: BoxDecoration(shape: BoxShape.rectangle, color: Theme.of(context).primaryColor), + decoration: BoxDecoration( + shape: BoxShape.rectangle, + color: Theme.of(context).primaryColor), ), SizedBox( width: 5, ), - AppText(isOX ? "SAO2" : TranslationBase.of(context).systolicLng) + AppText( + isOX ? "SAO2" : TranslationBase.of(context).systolicLng) ], ), SizedBox( @@ -93,7 +97,8 @@ class LineChartCurvedBloodPressure extends StatelessWidget { Container( width: 20, height: 20, - decoration: BoxDecoration(shape: BoxShape.rectangle, color: Colors.red), + decoration: BoxDecoration( + shape: BoxShape.rectangle, color: Colors.red), ), SizedBox( width: 5, @@ -129,11 +134,12 @@ class LineChartCurvedBloodPressure extends StatelessWidget { touchCallback: (LineTouchResponse touchResponse) {}, handleBuiltInTouches: true, ), - gridData: FlGridData(show: true, drawVerticalLine: true, drawHorizontalLine: true), + gridData: FlGridData( + show: true, drawVerticalLine: true, drawHorizontalLine: true), titlesData: FlTitlesData( bottomTitles: SideTitles( showTitles: true, - getTextStyles: (value) => const TextStyle( + getTextStyles: (context, value) => TextStyle( color: Colors.black, fontSize: 10, ), @@ -160,7 +166,7 @@ class LineChartCurvedBloodPressure extends StatelessWidget { ), leftTitles: SideTitles( showTitles: true, - getTextStyles: (value) => const TextStyle( + getTextStyles: (context, value) => TextStyle( color: Colors.black, fontWeight: FontWeight.bold, fontSize: 10, diff --git a/lib/screens/patients/profile/vital_sign/vital_sign_details_screen.dart b/lib/screens/patients/profile/vital_sign/vital_sign_details_screen.dart index fc3c6096..3412f2e0 100644 --- a/lib/screens/patients/profile/vital_sign/vital_sign_details_screen.dart +++ b/lib/screens/patients/profile/vital_sign/vital_sign_details_screen.dart @@ -20,7 +20,8 @@ class VitalSignDetailsScreen extends StatelessWidget { int? projectID; bool isNotOneAppointment; - VitalSignDetailsScreen({this.appointmentNo, this.projectID, this.isNotOneAppointment = true}); + VitalSignDetailsScreen( + {this.appointmentNo, this.projectID, this.isNotOneAppointment = true}); @override Widget build(BuildContext context) { @@ -35,7 +36,8 @@ class VitalSignDetailsScreen extends StatelessWidget { String assetBasePath = "${imageBasePath}patient/vital_signs/"; return BaseView( - onModelReady: (model) => model.getPatientVitalSignHistory(patient, from, to, isInpatient), + onModelReady: (model) => + model.getPatientVitalSignHistory(patient, from, to, isInpatient), builder: (_, mode, widget) => AppScaffold( baseViewModel: mode, isShowAppBar: true, @@ -74,7 +76,8 @@ class VitalSignDetailsScreen extends StatelessWidget { height: MediaQuery.of(context).size.height * 0.23, width: double.infinity, padding: EdgeInsets.all(12.0), - margin: EdgeInsets.symmetric(horizontal: 16.0, vertical: 8.0), + margin: EdgeInsets.symmetric( + horizontal: 16.0, vertical: 8.0), decoration: BoxDecoration( shape: BoxShape.rectangle, color: Colors.white, @@ -98,13 +101,17 @@ class VitalSignDetailsScreen extends StatelessWidget { children: [ Expanded( child: Column( - crossAxisAlignment: CrossAxisAlignment.center, + crossAxisAlignment: + CrossAxisAlignment.center, children: [ Image.asset( mode.getBMIStatus() != 1 ? '${assetBasePath}underweight_BMI.png' : '${assetBasePath}underweight_BMI-r.png', - height: MediaQuery.of(context).size.height * 0.10, + height: MediaQuery.of(context) + .size + .height * + 0.10, ), const SizedBox( height: 4, @@ -112,28 +119,38 @@ class VitalSignDetailsScreen extends StatelessWidget { AppText( "${TranslationBase.of(context).bmiUnderWeight}", fontFamily: 'Poppins', - fontSize: SizeConfig.textMultiplier * 1.15, - color: mode.getBMIStatus() == 1 ? Color(0XFFD02127) : null, + fontSize: + SizeConfig.textMultiplier * 1.15, + color: mode.getBMIStatus() == 1 + ? Color(0XFFD02127) + : null, fontWeight: FontWeight.w700, ), AppText( "(<18.5)", fontFamily: 'Poppins', - fontSize: SizeConfig.textMultiplier * 1.15, - color: mode.getBMIStatus() == 1 ? Color(0XFFD02127) : null, + fontSize: + SizeConfig.textMultiplier * 1.15, + color: mode.getBMIStatus() == 1 + ? Color(0XFFD02127) + : null, fontWeight: FontWeight.w700, ), ], )), Expanded( child: Column( - crossAxisAlignment: CrossAxisAlignment.center, + crossAxisAlignment: + CrossAxisAlignment.center, children: [ Image.asset( mode.getBMIStatus() != 2 ? '${assetBasePath}health_BMI.png' : '${assetBasePath}health_BMI-r.png', - height: MediaQuery.of(context).size.height * 0.10, + height: MediaQuery.of(context) + .size + .height * + 0.10, ), const SizedBox( height: 4, @@ -142,29 +159,40 @@ class VitalSignDetailsScreen extends StatelessWidget { child: AppText( "${TranslationBase.of(context).normal}", fontFamily: 'Poppins', - fontSize: SizeConfig.textMultiplier * 1.15, + fontSize: + SizeConfig.textMultiplier * + 1.15, fontWeight: FontWeight.w700, - color: mode.getBMIStatus() == 2 ? Color(0XFFD02127) : null, + color: mode.getBMIStatus() == 2 + ? Color(0XFFD02127) + : null, ), ), AppText( "(18.5-24.9)", fontFamily: 'Poppins', - fontSize: SizeConfig.textMultiplier * 1.15, + fontSize: + SizeConfig.textMultiplier * 1.15, fontWeight: FontWeight.w700, - color: mode.getBMIStatus() == 2 ? Color(0XFFD02127) : null, + color: mode.getBMIStatus() == 2 + ? Color(0XFFD02127) + : null, ), ], )), Expanded( child: Column( - crossAxisAlignment: CrossAxisAlignment.center, + crossAxisAlignment: + CrossAxisAlignment.center, children: [ Image.asset( mode.getBMIStatus() != 3 ? '${assetBasePath}ovrweight_BMI.png' : '${assetBasePath}ovrweight_BMI-r.png', - height: MediaQuery.of(context).size.height * 0.10, + height: MediaQuery.of(context) + .size + .height * + 0.10, ), const SizedBox( height: 4, @@ -172,28 +200,38 @@ class VitalSignDetailsScreen extends StatelessWidget { AppText( "${TranslationBase.of(context).bmiOverWeight}", fontFamily: 'Poppins', - fontSize: SizeConfig.textMultiplier * 1.155, + fontSize: + SizeConfig.textMultiplier * 1.155, fontWeight: FontWeight.w700, - color: mode.getBMIStatus() == 3 ? Color(0XFFD02127) : null, + color: mode.getBMIStatus() == 3 + ? Color(0XFFD02127) + : null, ), AppText( "(25-29.9)", fontFamily: 'Poppins', - fontSize: SizeConfig.textMultiplier * 1.155, + fontSize: + SizeConfig.textMultiplier * 1.155, fontWeight: FontWeight.w700, - color: mode.getBMIStatus() == 3 ? Color(0XFFD02127) : null, + color: mode.getBMIStatus() == 3 + ? Color(0XFFD02127) + : null, ), ], )), Expanded( child: Column( - crossAxisAlignment: CrossAxisAlignment.center, + crossAxisAlignment: + CrossAxisAlignment.center, children: [ Image.asset( mode.getBMIStatus() != 4 ? '${assetBasePath}Obese_BMI.png' : '${assetBasePath}Obese_BMI-r.png', - height: MediaQuery.of(context).size.height * 0.10, + height: MediaQuery.of(context) + .size + .height * + 0.10, ), const SizedBox( height: 4, @@ -201,28 +239,38 @@ class VitalSignDetailsScreen extends StatelessWidget { AppText( "${TranslationBase.of(context).bmiObese}", fontFamily: 'Poppins', - fontSize: SizeConfig.textMultiplier * 1.15, + fontSize: + SizeConfig.textMultiplier * 1.15, fontWeight: FontWeight.w700, - color: mode.getBMIStatus() == 4 ? Color(0XFFD02127) : null, + color: mode.getBMIStatus() == 4 + ? Color(0XFFD02127) + : null, ), AppText( "(30-34.9)", fontFamily: 'Poppins', - fontSize: SizeConfig.textMultiplier * 1.15, + fontSize: + SizeConfig.textMultiplier * 1.15, fontWeight: FontWeight.w700, - color: mode.getBMIStatus() == 4 ? Color(0XFFD02127) : null, + color: mode.getBMIStatus() == 4 + ? Color(0XFFD02127) + : null, ), ], )), Expanded( child: Column( - crossAxisAlignment: CrossAxisAlignment.center, + crossAxisAlignment: + CrossAxisAlignment.center, children: [ Image.asset( mode.getBMIStatus() != 5 ? '${assetBasePath}Obese_BMI.png' : '${assetBasePath}Obese_BMI-r.png', - height: MediaQuery.of(context).size.height * 0.10, + height: MediaQuery.of(context) + .size + .height * + 0.10, ), const SizedBox( height: 4, @@ -232,17 +280,24 @@ class VitalSignDetailsScreen extends StatelessWidget { child: AppText( "${TranslationBase.of(context).bmiObeseExtreme}", fontFamily: 'Poppins', - fontSize: SizeConfig.textMultiplier * 1.15, + fontSize: + SizeConfig.textMultiplier * + 1.15, fontWeight: FontWeight.w700, - color: mode.getBMIStatus() == 5 ? Color(0XFFD02127) : null, + color: mode.getBMIStatus() == 5 + ? Color(0XFFD02127) + : null, ), ), AppText( "(35<)", fontFamily: 'Poppins', - fontSize: SizeConfig.textMultiplier * 1.15, + fontSize: + SizeConfig.textMultiplier * 1.15, fontWeight: FontWeight.w700, - color: mode.getBMIStatus() == 5 ? Color(0XFFD02127) : null, + color: mode.getBMIStatus() == 5 + ? Color(0XFFD02127) + : null, ), ], )), @@ -254,7 +309,8 @@ class VitalSignDetailsScreen extends StatelessWidget { Expanded( child: SingleChildScrollView( child: Container( - margin: EdgeInsets.symmetric(horizontal: 16.0, vertical: 16), + margin: EdgeInsets.symmetric( + horizontal: 16.0, vertical: 16), child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ @@ -270,10 +326,16 @@ class VitalSignDetailsScreen extends StatelessWidget { ? Navigator.push( context, FadePage( - page: VitalSignItemDetailsScreen( - pageKey: vitalSignDetails.Height, - pageTitle: TranslationBase.of(context).height, - vitalList: mode.patientVitalSignsHistory, + page: + VitalSignItemDetailsScreen( + pageKey: vitalSignDetails + .Height, + pageTitle: + TranslationBase.of( + context) + .height, + vitalList: mode + .patientVitalSignsHistory, patient: patient, patientType: patientType, arrivalType: arrivalType, @@ -283,28 +345,40 @@ class VitalSignDetailsScreen extends StatelessWidget { : null, child: Container( child: VitalSignItem( - des: TranslationBase.of(context).height!, - imagePath: "${assetBasePath}height.png", + des: TranslationBase.of(context) + .height!, + imagePath: + "${assetBasePath}height.png", lastVal: mode.heightCm, - unit: TranslationBase.of(context).cm!, + unit: TranslationBase.of(context) + .cm!, ), ), ), if (isNotOneAppointment) InkWell( onTap: () async { - await locator().logEvent( - eventCategory: "Vital Sign Details Screen", - eventAction: "Vital Sign Details", + await locator() + .logEvent( + eventCategory: + "Vital Sign Details Screen", + eventAction: + "Vital Sign Details", ); Navigator.push( context, FadePage( - page: VitalSignItemDetailsScreen( - pageKey: vitalSignDetails.Weight, - pageTitle: TranslationBase.of(context).weight, - vitalList: mode.patientVitalSignsHistory, + page: + VitalSignItemDetailsScreen( + pageKey: + vitalSignDetails.Weight, + pageTitle: + TranslationBase.of( + context) + .weight, + vitalList: mode + .patientVitalSignsHistory, patient: patient, patientType: patientType, arrivalType: arrivalType, @@ -313,9 +387,12 @@ class VitalSignDetailsScreen extends StatelessWidget { ); }, child: VitalSignItem( - des: TranslationBase.of(context).weight!, - imagePath: "${assetBasePath}weight.png", - unit: TranslationBase.of(context).kg!, + des: TranslationBase.of(context) + .weight!, + imagePath: + "${assetBasePath}weight.png", + unit: TranslationBase.of(context) + .kg!, lastVal: mode.weightKg, ), ), @@ -324,10 +401,16 @@ class VitalSignDetailsScreen extends StatelessWidget { ? Navigator.push( context, FadePage( - page: VitalSignItemDetailsScreen( - pageKey: vitalSignDetails.Temperature, - pageTitle: TranslationBase.of(context).temperature, - vitalList: mode.patientVitalSignsHistory, + page: + VitalSignItemDetailsScreen( + pageKey: vitalSignDetails + .Temperature, + pageTitle: + TranslationBase.of( + context) + .temperature, + vitalList: mode + .patientVitalSignsHistory, patient: patient, patientType: patientType, arrivalType: arrivalType, @@ -337,10 +420,13 @@ class VitalSignDetailsScreen extends StatelessWidget { : null, child: Container( child: VitalSignItem( - des: TranslationBase.of(context).temperature!, - imagePath: "${assetBasePath}temperature.png", + des: TranslationBase.of(context) + .temperature!, + imagePath: + "${assetBasePath}temperature.png", lastVal: mode.temperatureCelcius, - unit: TranslationBase.of(context).tempC!, + unit: TranslationBase.of(context) + .tempC!, ), ), ), @@ -349,10 +435,16 @@ class VitalSignDetailsScreen extends StatelessWidget { ? Navigator.push( context, FadePage( - page: VitalSignItemDetailsScreen( - pageKey: vitalSignDetails.heart, - pageTitle: TranslationBase.of(context).heart, - vitalList: mode.patientVitalSignsHistory, + page: + VitalSignItemDetailsScreen( + pageKey: vitalSignDetails + .heart, + pageTitle: + TranslationBase.of( + context) + .heart, + vitalList: mode + .patientVitalSignsHistory, patient: patient, patientType: patientType, arrivalType: arrivalType, @@ -361,10 +453,13 @@ class VitalSignDetailsScreen extends StatelessWidget { ) : null, child: VitalSignItem( - des: TranslationBase.of(context).heart!, - imagePath: "${assetBasePath}heart_rate.png", + des: TranslationBase.of(context) + .heart!, + imagePath: + "${assetBasePath}heart_rate.png", lastVal: mode.hartRat, - unit: TranslationBase.of(context).bpm!, + unit: TranslationBase.of(context) + .bpm!, ), ), InkWell( @@ -372,10 +467,16 @@ class VitalSignDetailsScreen extends StatelessWidget { ? Navigator.push( context, FadePage( - page: VitalSignItemDetailsScreen( - pageKey: vitalSignDetails.Respiration, - pageTitle: TranslationBase.of(context).respirationRate, - vitalList: mode.patientVitalSignsHistory, + page: + VitalSignItemDetailsScreen( + pageKey: vitalSignDetails + .Respiration, + pageTitle: + TranslationBase.of( + context) + .respirationRate, + vitalList: mode + .patientVitalSignsHistory, patient: patient, patientType: patientType, arrivalType: arrivalType, @@ -384,10 +485,14 @@ class VitalSignDetailsScreen extends StatelessWidget { ) : null, child: VitalSignItem( - des: TranslationBase.of(context).respirationRate!, - imagePath: "${assetBasePath}respiration_rate.png", - lastVal: mode.respirationBeatPerMinute, - unit: TranslationBase.of(context).respirationSigns!, + des: TranslationBase.of(context) + .respirationRate!, + imagePath: + "${assetBasePath}respiration_rate.png", + lastVal: + mode.respirationBeatPerMinute, + unit: TranslationBase.of(context) + .respirationSigns!, ), ), InkWell( @@ -395,10 +500,16 @@ class VitalSignDetailsScreen extends StatelessWidget { ? Navigator.push( context, FadePage( - page: VitalSignItemDetailsScreen( - pageKey: vitalSignDetails.BloodPressure, - pageTitle: TranslationBase.of(context).bloodPressure, - vitalList: mode.patientVitalSignsHistory, + page: + VitalSignItemDetailsScreen( + pageKey: vitalSignDetails + .BloodPressure, + pageTitle: + TranslationBase.of( + context) + .bloodPressure, + vitalList: mode + .patientVitalSignsHistory, patient: patient, patientType: patientType, arrivalType: arrivalType, @@ -407,10 +518,13 @@ class VitalSignDetailsScreen extends StatelessWidget { ) : null, child: VitalSignItem( - des: TranslationBase.of(context).bloodPressure!, - imagePath: "${assetBasePath}blood_pressure.png", + des: TranslationBase.of(context) + .bloodPressure!, + imagePath: + "${assetBasePath}blood_pressure.png", lastVal: mode.bloodPressure, - unit: TranslationBase.of(context).sysDias!, + unit: TranslationBase.of(context) + .sysDias!, ), ), InkWell( @@ -418,10 +532,16 @@ class VitalSignDetailsScreen extends StatelessWidget { ? Navigator.push( context, FadePage( - page: VitalSignItemDetailsScreen( - pageKey: vitalSignDetails.Oxygenation, - pageTitle: TranslationBase.of(context).oxygenation, - vitalList: mode.patientVitalSignsHistory, + page: + VitalSignItemDetailsScreen( + pageKey: vitalSignDetails + .Oxygenation, + pageTitle: + TranslationBase.of( + context) + .oxygenation, + vitalList: mode + .patientVitalSignsHistory, patient: patient, patientType: patientType, arrivalType: arrivalType, @@ -430,8 +550,10 @@ class VitalSignDetailsScreen extends StatelessWidget { ) : null, child: VitalSignItem( - des: TranslationBase.of(context).oxygenation!, - imagePath: "${assetBasePath}oxg.png", + des: TranslationBase.of(context) + .oxygenation!, + imagePath: + "${assetBasePath}oxg.png", lastVal: "${mode.oxygenation}%", unit: "", ), @@ -441,10 +563,16 @@ class VitalSignDetailsScreen extends StatelessWidget { ? Navigator.push( context, FadePage( - page: VitalSignItemDetailsScreen( - pageKey: vitalSignDetails.PainScale, - pageTitle: TranslationBase.of(context).painScale, - vitalList: mode.patientVitalSignsHistory, + page: + VitalSignItemDetailsScreen( + pageKey: vitalSignDetails + .PainScale, + pageTitle: + TranslationBase.of( + context) + .painScale, + vitalList: mode + .patientVitalSignsHistory, patient: patient, patientType: patientType, arrivalType: arrivalType, @@ -453,10 +581,13 @@ class VitalSignDetailsScreen extends StatelessWidget { ) : null, child: VitalSignItem( - des: TranslationBase.of(context).painScale!, - imagePath: "${assetBasePath}painScale.png", + des: TranslationBase.of(context) + .painScale!, + imagePath: + "${assetBasePath}painScale.png", lastVal: mode.painScore, - unit: TranslationBase.of(context).severe!, + unit: TranslationBase.of(context) + .severe!, ), ), ], @@ -475,7 +606,7 @@ class VitalSignDetailsScreen extends StatelessWidget { : Container( color: Theme.of(context).scaffoldBackgroundColor, child: ErrorMessage( - error: TranslationBase.of(context).vitalSignEmptyMsg, + error: TranslationBase.of(context).vitalSignEmptyMsg!, )), ), ); diff --git a/lib/screens/patients/register_patient/CustomEditableText.dart b/lib/screens/patients/register_patient/CustomEditableText.dart index ac20d1e1..225d6141 100644 --- a/lib/screens/patients/register_patient/CustomEditableText.dart +++ b/lib/screens/patients/register_patient/CustomEditableText.dart @@ -6,7 +6,7 @@ import 'package:flutter/material.dart'; class CustomEditableText extends StatefulWidget { CustomEditableText({ - Key key, + Key? key, required this.controller, this.hint, this.isEditable = false, @@ -15,9 +15,9 @@ class CustomEditableText extends StatefulWidget { final TextEditingController controller; - final String hint; + final String? hint; bool isEditable; - final bool isSubmitted; + final bool? isSubmitted; @override _CustomEditableTextState createState() => _CustomEditableTextState(); @@ -80,7 +80,7 @@ class _CustomEditableTextState extends State { //TranslationBase.of(context).addoperationReports, controller: widget.controller, validationError: - widget.controller.text.isEmpty && widget.isSubmitted + widget.controller.text.isEmpty && widget.isSubmitted! ? TranslationBase.of(context).emptyMessage : null, maxLines: 1, diff --git a/lib/screens/patients/register_patient/RegisterConfirmationPatientPage.dart b/lib/screens/patients/register_patient/RegisterConfirmationPatientPage.dart index 6aaacb26..8e8bde13 100644 --- a/lib/screens/patients/register_patient/RegisterConfirmationPatientPage.dart +++ b/lib/screens/patients/register_patient/RegisterConfirmationPatientPage.dart @@ -39,12 +39,15 @@ import 'package:speech_to_text/speech_to_text.dart' as stt; import 'CustomEditableText.dart'; class RegisterConfirmationPatientPage extends StatefulWidget { - final OperationReportViewModel operationReportViewModel; - final PatiantInformtion patient; + final OperationReportViewModel? operationReportViewModel; + final PatiantInformtion? patient; final PatientRegistrationViewModel model; const RegisterConfirmationPatientPage( - {Key? key, this.operationReportViewModel, this.patient, this.model}) + {Key? key, + this.operationReportViewModel, + this.patient, + required this.model}) : super(key: key); @override @@ -55,14 +58,14 @@ class RegisterConfirmationPatientPage extends StatefulWidget { class _RegisterConfirmationPatientPageState extends State { bool isSubmitted = false; - ProjectViewModel projectViewModel; - TextEditingController firstNameN; - TextEditingController middleNameN; - TextEditingController lastNameN; - TextEditingController firstNameAr; - TextEditingController middleNameAr; - TextEditingController lastNameAr; - TextEditingController emailAddressController; + ProjectViewModel? projectViewModel; + late TextEditingController firstNameN; + late TextEditingController middleNameN; + late TextEditingController lastNameN; + late TextEditingController firstNameAr; + late TextEditingController middleNameAr; + late TextEditingController lastNameAr; + late TextEditingController emailAddressController; TextEditingController langController = TextEditingController(text: "English"); int selectedLang = 1; @@ -392,8 +395,8 @@ class _RegisterConfirmationPatientPageState print( widget.model.getPatientInfoResponseModel.dateOfBirth); - var dateFormat = DateFormat('MM/dd/yyyy').parse( - widget.model.getPatientInfoResponseModel.dateOfBirth); + var dateFormat = DateFormat('MM/dd/yyyy').parse(widget + .model.getPatientInfoResponseModel.dateOfBirth!); String wellFormat = "${dateFormat.day}\/${dateFormat.month}\/${dateFormat.year}"; print( @@ -425,7 +428,7 @@ class _RegisterConfirmationPatientPageState strDateofBirth: dateFormat.toUtc().toString(), dateofBirth: AppDateUtils.convertToServerFormat( widget.model.getPatientInfoResponseModel - .dateOfBirth, + .dateOfBirth!, 'MM/dd/yyyy'), dateofBirthN: '$hijriDate', gender: (widget.model.getPatientInfoResponseModel.gender == "M") diff --git a/lib/screens/patients/register_patient/RegisterPatientPage.dart b/lib/screens/patients/register_patient/RegisterPatientPage.dart index 9bc2d6fe..5ec38223 100644 --- a/lib/screens/patients/register_patient/RegisterPatientPage.dart +++ b/lib/screens/patients/register_patient/RegisterPatientPage.dart @@ -20,7 +20,7 @@ class RegisterPatientPage extends StatefulWidget { class _RegisterPatientPageState extends State with TickerProviderStateMixin { - PageController _controller; + late PageController _controller; int _currentIndex = 0; bool _isLoading = false; @@ -61,7 +61,7 @@ class _RegisterPatientPageState extends State isShowAppBar: true, isLoading: _isLoading, appBar: PatientSearchHeader( - title: TranslationBase.of(context).registeraPatient, + title: TranslationBase.of(context).registeraPatient!, ), body: Column( crossAxisAlignment: CrossAxisAlignment.start, diff --git a/lib/screens/patients/register_patient/RegisterSearchPatientPage.dart b/lib/screens/patients/register_patient/RegisterSearchPatientPage.dart index fd425c01..861e9295 100644 --- a/lib/screens/patients/register_patient/RegisterSearchPatientPage.dart +++ b/lib/screens/patients/register_patient/RegisterSearchPatientPage.dart @@ -30,7 +30,7 @@ class RegisterSearchPatientPage extends StatefulWidget { final PatientRegistrationViewModel model; const RegisterSearchPatientPage( - {Key? key, this.changePageViewIndex, this.model}) + {Key? key, required this.changePageViewIndex, required this.model}) : super(key: key); @override @@ -39,10 +39,10 @@ class RegisterSearchPatientPage extends StatefulWidget { } class _RegisterSearchPatientPageState extends State { - String countryError; + late String countryError; dynamic _selectedCountry; - List countryList; + late List countryList; dynamic country; @@ -52,14 +52,14 @@ class _RegisterSearchPatientPageState extends State { TextEditingController(text: "508079569"); TextEditingController _phoneCode = TextEditingController(text: "966"); - String phoneError; + late String phoneError; TextEditingController _idController = TextEditingController(text: "1062938285"); - String idError; + late String idError; - DateTime _birthDateInGregorian; - String birthdateError; + late DateTime _birthDateInGregorian; + late String birthdateError; var birthDateInHijri = new HijriCalendar.now(); CalenderType calenderType = CalenderType.Gregorian; @@ -191,9 +191,9 @@ class _RegisterSearchPatientPageState extends State { title: AppText("Gregorian"), value: CalenderType.Gregorian, groupValue: calenderType, - onChanged: (CalenderType value) { + onChanged: (CalenderType? value) { setState(() { - calenderType = value; + calenderType = value!; }); }, ), @@ -203,9 +203,9 @@ class _RegisterSearchPatientPageState extends State { title: AppText("Hijri"), value: CalenderType.Hijri, groupValue: calenderType, - onChanged: (CalenderType value) { + onChanged: (CalenderType? value) { setState(() { - calenderType = value; + calenderType = value!; }); }, ), @@ -221,9 +221,10 @@ class _RegisterSearchPatientPageState extends State { dropDownText: getBirthdate(), enabled: false, isTextFieldHasSuffix: true, - validationError: _birthDateInGregorian == null && isSubmitted - ? TranslationBase.of(context).emptyMessage - : null, + validationError: + _birthDateInGregorian == null && isSubmitted + ? TranslationBase.of(context).emptyMessage + : null, suffixIcon: IconButton( icon: Icon( Icons.calendar_today, @@ -240,17 +241,18 @@ class _RegisterSearchPatientPageState extends State { setState(() { if (calenderType == CalenderType.Hijri) { birthDateInHijri = selectedDate; - _birthDateInGregorian = HijriCalendar().hijriToGregorian( - birthDateInHijri.hYear, - birthDateInHijri.hMonth, - birthDateInHijri.hDay); + _birthDateInGregorian = HijriCalendar() + .hijriToGregorian( + birthDateInHijri.hYear, + birthDateInHijri.hMonth, + birthDateInHijri.hDay); print(_birthDateInGregorian); print(birthDateInHijri); } else { _birthDateInGregorian = selectedDate; birthDateInHijri = HijriCalendar() - .gregorianToHijri( - selectedDate.year, selectedDate.month, selectedDate.day); + .gregorianToHijri(selectedDate.year, + selectedDate.month, selectedDate.day); print(_birthDateInGregorian); print(birthDateInHijri); @@ -307,9 +309,9 @@ class _RegisterSearchPatientPageState extends State { isSubmitted = true; }); if (country == null) { - countryError = TranslationBase.of(context).fieldRequired; + countryError = TranslationBase.of(context).fieldRequired!; } else { - countryError = null; + countryError = ""; } if (isFormValid()) { GifLoaderDialogUtils.showMyDialog(context); @@ -397,7 +399,7 @@ class _RegisterSearchPatientPageState extends State { ); if (pickedH != null && birthDateInHijri != pickedH) updateDate(pickedH); } else { - final DateTime picked = await showDatePicker( + final DateTime? picked = await showDatePicker( context: context, initialDate: dateTime ?? DateTime.now(), firstDate: DateTime(DateTime.now().year - 150), @@ -432,16 +434,12 @@ class _RegisterSearchPatientPageState extends State { } getBirthdate() { - if (calenderType == CalenderType.Hijri) { - return birthDateInHijri != null - ? "$birthDateInHijri" - : null; - }else{ + return birthDateInHijri != null ? "$birthDateInHijri" : null; + } else { return _birthDateInGregorian != null ? "${AppDateUtils.convertStringToDateFormat(_birthDateInGregorian.toString(), "yyyy/MM/dd")}" : null; } - } } diff --git a/lib/screens/patients/register_patient/VerifyMethodPage.dart b/lib/screens/patients/register_patient/VerifyMethodPage.dart index f2d0646f..e273e096 100644 --- a/lib/screens/patients/register_patient/VerifyMethodPage.dart +++ b/lib/screens/patients/register_patient/VerifyMethodPage.dart @@ -16,7 +16,7 @@ class ActivationPage extends StatefulWidget { final PatientRegistrationViewModel model; final Function changePageViewIndex; - ActivationPage({this.model, this.changePageViewIndex}); + ActivationPage({required this.model, required this.changePageViewIndex}); @override _ActivationPageState createState() => _ActivationPageState(); @@ -393,7 +393,7 @@ class _ActivationPageState extends State { children: [ AppText( TranslationBase.of(context) - .validationMessage + + .validationMessage! + ' ', fontWeight: FontWeight.w600, fontSize: 14, diff --git a/lib/screens/prescription/add_prescription_form.dart b/lib/screens/prescription/add_prescription_form.dart index 128acac6..2d284853 100644 --- a/lib/screens/prescription/add_prescription_form.dart +++ b/lib/screens/prescription/add_prescription_form.dart @@ -35,7 +35,8 @@ import 'package:permission_handler/permission_handler.dart'; import 'package:speech_to_text/speech_recognition_error.dart'; import 'package:speech_to_text/speech_to_text.dart' as stt; -addPrescriptionForm(context, PrescriptionViewModel model, PatiantInformtion patient, prescription) { +addPrescriptionForm(context, PrescriptionViewModel model, + PatiantInformtion patient, prescription) { showModalBottomSheet( isScrollControlled: true, context: context, @@ -60,7 +61,8 @@ postPrescription( String? icdCode, PatiantInformtion? patient, String? patientType}) async { - PostPrescriptionReqModel postProcedureReqModel = new PostPrescriptionReqModel(); + PostPrescriptionReqModel postProcedureReqModel = + new PostPrescriptionReqModel(); List prescriptionList = []; postProcedureReqModel.appointmentNo = patient!.appointmentNo; @@ -125,7 +127,8 @@ class _PrescriptionFormWidgetState extends State { DateTime? selectedDate; int? strengthChar; GetMedicationResponseModel? _selectedMedication; - GlobalKey key = new GlobalKey>(); + GlobalKey key = + new GlobalKey>(); TextEditingController drugIdController = TextEditingController(); TextEditingController doseController = TextEditingController(); @@ -169,7 +172,8 @@ class _PrescriptionFormWidgetState extends State { 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, @@ -212,7 +216,8 @@ class _PrescriptionFormWidgetState extends State { } 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; } @@ -257,13 +262,15 @@ class _PrescriptionFormWidgetState extends State { initialChildSize: 0.98, maxChildSize: 0.98, minChildSize: 0.9, - builder: (BuildContext context, ScrollController scrollController) { + builder: + (BuildContext context, ScrollController scrollController) { return SingleChildScrollView( child: Container( height: MediaQuery.of(context).size.height * 1.65, color: Color(0xffF8F8F8), child: Padding( - padding: EdgeInsets.symmetric(horizontal: 12.0, vertical: 10.0), + padding: EdgeInsets.symmetric( + horizontal: 12.0, vertical: 10.0), child: Column( children: [ Column( @@ -285,8 +292,11 @@ class _PrescriptionFormWidgetState extends State { widthFactor: 0.9, child: 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"))), padding: EdgeInsets.all(10), child: AppTextFormField( onTap: () { @@ -294,7 +304,8 @@ class _PrescriptionFormWidgetState extends State { visbiltySearch = true; }, borderColor: Colors.white, - hintText: TranslationBase.of(context).searchMedicineNameHere, + hintText: TranslationBase.of(context) + .searchMedicineNameHere, controller: myController, onSaved: (value) {}, onFieldSubmitted: (value) { @@ -320,9 +331,12 @@ class _PrescriptionFormWidgetState extends State { children: [ // TODO change it secondary button and add loading AppButton( - title: TranslationBase.of(context).search, + title: TranslationBase.of( + context) + .search, onPressed: () async { - await searchMedicine(context, model); + await searchMedicine( + context, model); }, ), ], @@ -331,23 +345,44 @@ class _PrescriptionFormWidgetState extends State { ), if (myController.text != '') Container( - height: MediaQuery.of(context).size.height * 0.5, + height: MediaQuery.of(context) + .size + .height * + 0.5, child: ListView.builder( - padding: const EdgeInsets.only(top: 20), + padding: const EdgeInsets.only( + top: 20), scrollDirection: Axis.vertical, - itemCount: model.allMedicationList == null - ? 0 - : model.allMedicationList.length, - itemBuilder: (BuildContext context, int index) { + itemCount: + model.allMedicationList == + null + ? 0 + : model + .allMedicationList + .length, + itemBuilder: + (BuildContext context, + int index) { return InkWell( child: MedicineItemWidget( - label: model.allMedicationList[index].description), + label: model + .allMedicationList[ + index] + .description), onTap: () { - model.getItem(itemID: model.allMedicationList[index].itemId!); - visbiltyPrescriptionForm = true; + model.getItem( + itemID: model + .allMedicationList[ + index] + .itemId!); + visbiltyPrescriptionForm = + true; visbiltySearch = false; - _selectedMedication = model.allMedicationList[index]; - uom = _selectedMedication!.uom; + _selectedMedication = + model.allMedicationList[ + index]; + uom = _selectedMedication! + .uom; }, ); }, @@ -366,53 +401,69 @@ class _PrescriptionFormWidgetState extends State { child: Column( children: [ AppText( - _selectedMedication?.description ?? "", + _selectedMedication?.description ?? + "", bold: true, ), Container( child: Row( children: [ AppText( - TranslationBase.of(context).orderType, + TranslationBase.of(context) + .orderType, fontWeight: FontWeight.w600, ), Radio( - activeColor: Color(0xFFB9382C), + activeColor: + Color(0xFFB9382C), value: 1, groupValue: selectedType, onChanged: (int? value) { setSelectedType(value!); }, ), - Text(TranslationBase.of(context).regular ?? ""), + Text(TranslationBase.of(context) + .regular ?? + ""), ], ), ), - SizedBox(height: spaceBetweenTextFileds), + SizedBox( + height: spaceBetweenTextFileds), Container( width: double.infinity, child: Row( children: [ Container( - width: MediaQuery.of(context).size.width * 0.35, + width: MediaQuery.of(context) + .size + .width * + 0.35, child: AppTextFieldCustom( height: 40, - validationError: strengthError, + validationError: + strengthError, hintText: 'Strength', isTextFieldHasSuffix: false, enabled: true, - controller: strengthController, + controller: + strengthController, onChanged: (String value) { setState(() { - strengthChar = value.length; + strengthChar = + value.length; }); if (strengthChar! >= 5) { - DrAppToastMsg.showErrorToast( - TranslationBase.of(context).only5DigitsAllowedForStrength, + DrAppToastMsg + .showErrorToast( + TranslationBase.of( + context) + .only5DigitsAllowedForStrength, ); } }, - inputType: TextInputType.numberWithOptions( + inputType: TextInputType + .numberWithOptions( decimal: true, ), ), @@ -422,15 +473,23 @@ class _PrescriptionFormWidgetState extends State { ), PrescriptionTextFiled( isSubmitted: isSubmitted, - width: MediaQuery.of(context).size.width * 0.517, - element: model.itemMedicineListUnit.length == 1 - ? model.itemMedicineListUnit[0] + width: MediaQuery.of(context) + .size + .width * + 0.517, + element: model + .itemMedicineListUnit + .length == + 1 + ? model + .itemMedicineListUnit[0] : units, - elementError: unitError, + elementError: unitError!, keyName: 'description', keyId: 'parameterCode', hintText: 'Select', - elementList: model.itemMedicineListUnit, + elementList: model + .itemMedicineListUnit, okFunction: (selectedValue) { setState(() { units = selectedValue; @@ -441,14 +500,18 @@ class _PrescriptionFormWidgetState extends State { ], ), ), - SizedBox(height: spaceBetweenTextFileds), + SizedBox( + height: spaceBetweenTextFileds), PrescriptionTextFiled( isSubmitted: isSubmitted, - elementList: model.itemMedicineListRoute, - element: model.itemMedicineListRoute.length == 1 + elementList: + model.itemMedicineListRoute, + element: model.itemMedicineListRoute + .length == + 1 ? model.itemMedicineListRoute[0] : route, - elementError: routeError, + elementError: routeError!, keyId: 'parameterCode', keyName: 'description', okFunction: (selectedValue) { @@ -457,44 +520,69 @@ class _PrescriptionFormWidgetState extends State { route['isDefault'] = true; }); }, - hintText: TranslationBase.of(context).route ?? "", + hintText: + TranslationBase.of(context) + .route ?? + "", ), - SizedBox(height: spaceBetweenTextFileds), + SizedBox( + height: spaceBetweenTextFileds), PrescriptionTextFiled( isSubmitted: isSubmitted, - hintText: TranslationBase.of(context).frequency ?? "", - elementError: frequencyError ?? "", - element: model.itemMedicineList.length == 1 - ? frequency = model.itemMedicineList[0] + hintText: + TranslationBase.of(context) + .frequency ?? + "", + elementError: + frequencyError ?? "", + element: model.itemMedicineList + .length == + 1 + ? frequency = + model.itemMedicineList[0] : frequency, - elementList: model.itemMedicineList, + elementList: + model.itemMedicineList, keyId: 'parameterCode', keyName: 'description', okFunction: (selectedValue) { setState(() { frequency = selectedValue; frequency['isDefault'] = true; - if (_selectedMedication != null && + if (_selectedMedication != + null && duration != null && frequency != null && - strengthController.text != null) { + strengthController.text != + null) { model.getBoxQuantity( - freq: frequency['parameterCode'], - duration: duration['id'], - itemCode: _selectedMedication!.itemId!, - strength: double.parse(strengthController.text)); + freq: frequency[ + 'parameterCode'], + duration: + duration['id'], + itemCode: + _selectedMedication! + .itemId!, + strength: double.parse( + strengthController + .text)); return; } }); }), - SizedBox(height: spaceBetweenTextFileds), + SizedBox( + height: spaceBetweenTextFileds), PrescriptionTextFiled( isSubmitted: isSubmitted, - hintText: TranslationBase.of(context).doseTime ?? "", + hintText: + TranslationBase.of(context) + .doseTime ?? + "", elementError: doseTimeError ?? "", element: doseTime, - elementList: model.medicationDoseTimeList, + elementList: + model.medicationDoseTimeList, keyId: 'id', keyName: 'nameEn', okFunction: (selectedValue) { @@ -502,8 +590,10 @@ class _PrescriptionFormWidgetState extends State { doseTime = selectedValue; }); }), - SizedBox(height: spaceBetweenTextFileds), - if (model.patientAssessmentList.isNotEmpty) + SizedBox( + height: spaceBetweenTextFileds), + if (model + .patientAssessmentList.isNotEmpty) Container( height: screenSize.height * 0.070, width: double.infinity, @@ -511,25 +601,49 @@ class _PrescriptionFormWidgetState extends State { child: Row( children: [ Container( - width: MediaQuery.of(context).size.width * 0.29, + width: + MediaQuery.of(context) + .size + .width * + 0.29, child: TextField( - decoration: textFieldSelectorDecoration( - model.patientAssessmentList[0].icdCode10ID.toString(), - indication != null ? indication['name'] : null, - false), + decoration: + textFieldSelectorDecoration( + model + .patientAssessmentList[ + 0] + .icdCode10ID + .toString(), + indication != null + ? indication[ + 'name'] + : null, + false), enabled: true, readOnly: true, ), ), Container( - width: MediaQuery.of(context).size.width * 0.59, + width: + MediaQuery.of(context) + .size + .width * + 0.59, color: Colors.white, child: TextField( maxLines: 5, - decoration: textFieldSelectorDecoration( - model.patientAssessmentList[0].asciiDesc.toString(), - indication != null ? indication['name'] : null, - false), + decoration: + textFieldSelectorDecoration( + model + .patientAssessmentList[ + 0] + .asciiDesc + .toString(), + indication != null + ? indication[ + 'name'] + : null, + false), enabled: true, readOnly: true, ), @@ -537,48 +651,66 @@ class _PrescriptionFormWidgetState extends State { ], ), ), - SizedBox(height: spaceBetweenTextFileds), + SizedBox( + height: spaceBetweenTextFileds), Container( height: screenSize.height * 0.070, color: Colors.white, child: InkWell( - onTap: () => selectDate(context, widget.model), + onTap: () => selectDate( + context, widget.model), child: 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, - )), + 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: spaceBetweenTextFileds), + SizedBox( + height: spaceBetweenTextFileds), PrescriptionTextFiled( isSubmitted: isSubmitted, element: duration, elementError: durationError ?? "", - hintText: TranslationBase.of(context).duration ?? "", - elementList: model.medicationDurationList, + hintText: + TranslationBase.of(context) + .duration ?? + "", + elementList: + model.medicationDurationList, keyName: 'nameEn', keyId: 'id', okFunction: (selectedValue) { setState(() { duration = selectedValue; - if (_selectedMedication != null && + if (_selectedMedication != + null && duration != null && frequency != null && - strengthController.text != null) { + strengthController.text != + null) { model.getBoxQuantity( - freq: frequency['parameterCode'], + freq: frequency[ + 'parameterCode'], duration: duration['id'], - itemCode: _selectedMedication!.itemId!, - strength: double.parse(strengthController.text), + itemCode: + _selectedMedication! + .itemId!, + strength: double.parse( + strengthController + .text), ); box = model.boxQuintity; @@ -587,38 +719,53 @@ class _PrescriptionFormWidgetState extends State { }); }, ), - SizedBox(height: spaceBetweenTextFileds), + SizedBox( + height: spaceBetweenTextFileds), Container( color: Colors.white, child: AppTextFieldCustom( hintText: "UOM", isTextFieldHasSuffix: false, - dropDownText: uom != null ? uom : null, + dropDownText: + uom != null ? uom : null, enabled: false, ), ), - SizedBox(height: spaceBetweenTextFileds), + SizedBox( + height: spaceBetweenTextFileds), Container( color: Colors.white, child: AppTextFieldCustom( - hintText: TranslationBase.of(context).boxQuantity, + hintText: + TranslationBase.of(context) + .boxQuantity, isTextFieldHasSuffix: false, - dropDownText: box != null ? model.boxQuintity.toString() : null, + dropDownText: box != null + ? model.boxQuintity.toString() + : null, enabled: false, ), ), - SizedBox(height: spaceBetweenTextFileds), + SizedBox( + height: spaceBetweenTextFileds), 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: Stack( children: [ TextFields( maxLines: 6, minLines: 4, - hintText: TranslationBase.of(context).instruction, - controller: instructionController, + hintText: TranslationBase.of( + context) + .instruction, + controller: + instructionController, //keyboardType: TextInputType.number, ), Positioned( @@ -631,51 +778,77 @@ class _PrescriptionFormWidgetState extends State { size: 35, ), onPressed: () { - initSpeechState().then((value) => {onVoiceText()}); + initSpeechState().then( + (value) => + {onVoiceText()}); }, ), ), ], ), ), - SizedBox(height: spaceBetweenTextFileds), + SizedBox( + height: spaceBetweenTextFileds), Container( - margin: EdgeInsets.all(SizeConfig.widthMultiplier * 5), + margin: EdgeInsets.all( + SizeConfig.widthMultiplier * 5), child: Wrap( alignment: WrapAlignment.center, children: [ AppButton( color: Color(0xff359846), - title: TranslationBase.of(context).addMedication, + title: TranslationBase.of( + context) + .addMedication, fontWeight: FontWeight.w600, onPressed: () async { - await locator().logEvent( - eventCategory: "Add Prescription Form", - eventAction: "Add Prescription", + await locator< + AnalyticsService>() + .logEvent( + eventCategory: + "Add Prescription Form", + eventAction: + "Add Prescription", ); if (duration != null && doseTime != null && frequency != null && selectedDate != null && - strengthController.text != "") { - if (_selectedMedication!.isNarcotic == true) { - DrAppToastMsg.showErrorToast(TranslationBase.of(context) - .narcoticMedicineCanOnlyBePrescribedFromVida); + strengthController + .text != + "") { + if (_selectedMedication! + .isNarcotic == + true) { + DrAppToastMsg.showErrorToast( + TranslationBase.of( + context) + .narcoticMedicineCanOnlyBePrescribedFromVida); // Navigator.pop(context); return; } - 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 (formKey.currentState!.validate()) { + if (formKey.currentState! + .validate()) { Navigator.pop(context); openDrugToDrug(model); { @@ -765,39 +938,60 @@ class _PrescriptionFormWidgetState extends State { setState(() { isSubmitted = true; if (duration == null) { - durationError = TranslationBase.of(context).fieldRequired; + durationError = + TranslationBase.of( + context) + .fieldRequired; } else { durationError = ""; } if (doseTime == null) { - doseTimeError = TranslationBase.of(context).fieldRequired; + doseTimeError = + TranslationBase.of( + context) + .fieldRequired; } else { doseTimeError = ""; } if (route == null) { - routeError = TranslationBase.of(context).fieldRequired; + routeError = + TranslationBase.of( + context) + .fieldRequired; } else { routeError = ""; } if (frequency == null) { - frequencyError = TranslationBase.of(context).fieldRequired; + frequencyError = + TranslationBase.of( + context) + .fieldRequired; } else { frequencyError = ""; } if (units == null) { - unitError = TranslationBase.of(context).fieldRequired; + unitError = + TranslationBase.of( + context) + .fieldRequired; } else { unitError = ""; } - if (strengthController.text == "") { - strengthError = TranslationBase.of(context).fieldRequired; + if (strengthController + .text == + "") { + strengthError = + TranslationBase.of( + context) + .fieldRequired; } else { strengthError = ""; } }); } - formKey.currentState!.save(); + formKey.currentState! + .save(); }, ), ], @@ -840,7 +1034,8 @@ class _PrescriptionFormWidgetState extends State { } } - InputDecoration textFieldSelectorDecoration(String? hintText, String? selectedText, bool isDropDown, + InputDecoration textFieldSelectorDecoration( + String? hintText, String? selectedText, bool isDropDown, {Icon? suffixIcon}) { return InputDecoration( focusedBorder: OutlineInputBorder( @@ -891,7 +1086,9 @@ class _PrescriptionFormWidgetState extends State { child: Column( // mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ - DrugToDrug(widget.patient, getPriscriptionforDrug(widget.prescriptionList, model), + DrugToDrug( + widget.patient, + getPriscriptionforDrug(widget.prescriptionList, model), model.patientAssessmentList), Container( margin: EdgeInsets.all(SizeConfig.widthMultiplier * 3), @@ -902,23 +1099,28 @@ class _PrescriptionFormWidgetState extends State { postPrescription( icdCode: model.patientAssessmentList.isNotEmpty - ? model.patientAssessmentList[0].icdCode10ID.isEmpty + ? model.patientAssessmentList[0].icdCode10ID + .isEmpty ? "test" - : model.patientAssessmentList[0].icdCode10ID.toString() + : model.patientAssessmentList[0].icdCode10ID + .toString() : "test", dose: strengthController.text, doseUnit: model.itemMedicineListUnit.length == 1 - ? model.itemMedicineListUnit[0]['parameterCode'].toString() + ? model.itemMedicineListUnit[0]['parameterCode'] + .toString() : units['parameterCode'].toString(), patient: widget.patient, doseTimeIn: doseTime['id'].toString(), model: widget.model, duration: duration['id'].toString(), frequency: model.itemMedicineList.length == 1 - ? model.itemMedicineList[0]['parameterCode'].toString() + ? model.itemMedicineList[0]['parameterCode'] + .toString() : frequency['parameterCode'].toString(), route: model.itemMedicineListRoute.length == 1 - ? model.itemMedicineListRoute[0]['parameterCode'].toString() + ? model.itemMedicineListRoute[0]['parameterCode'] + .toString() : route['parameterCode'].toString(), drugId: _selectedMedication!.itemId.toString(), strength: strengthController.text, @@ -937,7 +1139,8 @@ class _PrescriptionFormWidgetState extends State { }); } - getPriscriptionforDrug(List prescriptionList, MedicineViewModel model) { + getPriscriptionforDrug( + List prescriptionList, MedicineViewModel model) { var prescriptionDetails = []; if (prescriptionList.length > 0) { prescriptionList[0].entityList!.forEach((element) { diff --git a/lib/screens/reschedule-leaves/reschedule_leave.dart b/lib/screens/reschedule-leaves/reschedule_leave.dart index 7d90c9a8..673e260a 100644 --- a/lib/screens/reschedule-leaves/reschedule_leave.dart +++ b/lib/screens/reschedule-leaves/reschedule_leave.dart @@ -37,9 +37,9 @@ class _RescheduleLeaveScreen extends State { DrAppSharedPreferances sharedPref = new DrAppSharedPreferances(); TextEditingController _toDateController = new TextEditingController(); TextEditingController _toDateController2 = new TextEditingController(); - ProjectViewModel projectsProvider; - SickLeaveViewModel sickLeaveViewModel; - String _selectedClinic; + late ProjectViewModel projectsProvider; + late SickLeaveViewModel sickLeaveViewModel; + late String _selectedClinic; Map profile = {}; var offTime = '1'; var date; @@ -48,8 +48,8 @@ class _RescheduleLeaveScreen extends State { dynamic fromDate; dynamic toDate; var clinicID; - String fromTime; - String toTime; + late String fromTime; + late String toTime; TextEditingController _controller4 = new TextEditingController(); TextEditingController _controller5 = new TextEditingController(); void _presentDatePicker(id) { @@ -99,620 +99,796 @@ class _RescheduleLeaveScreen extends State { @override Widget build(BuildContext context) { projectsProvider = Provider.of(context); - offTime = widget.updateData != null ? widget.updateData.requisitionType.toString() : offTime; + offTime = widget.updateData != null + ? widget.updateData.requisitionType.toString() + : offTime; return BaseView( onModelReady: (model) => model.getClinicsList(), builder: (_, model, w) => BaseView( onModelReady: (model2) => { - model2.getOffTime(), - model2.getReasons(offTime == '1' - ? 18 - : offTime == '2' - ? 19 - : 102), - model2.getCoveringDoctors() - }, + model2.getOffTime(), + model2.getReasons(offTime == '1' + ? 18 + : offTime == '2' + ? 19 + : 102), + model2.getCoveringDoctors() + }, builder: (_, model2, w) => GestureDetector( - onTap: () { - FocusScope.of(context).requestFocus(new FocusNode()); - }, - child: AppScaffold( - baseViewModel: model2, - isShowAppBar: true, - appBarTitle: TranslationBase.of(context).rescheduleLeaves, - body: Center( - child: Container( - margin: EdgeInsets.only(top: 10), - child: FractionallySizedBox( - widthFactor: 0.9, - child: ListView( - children: [ - // Container( - // margin: EdgeInsets.all(8), - // decoration: BoxDecoration( - // borderRadius: BorderRadius.all( - // Radius.circular(6.0)), - // border: Border.all( - // width: 1.0, - // color: HexColor("#CCCCCC"))), - // width: double.infinity, - // child: Padding( - // padding: EdgeInsets.only( - // top: SizeConfig.widthMultiplier * 0.9, - // bottom: - // SizeConfig.widthMultiplier * 0.9, - // right: SizeConfig.widthMultiplier * 3, - // left: SizeConfig.widthMultiplier * 3), - // child: Column( - // crossAxisAlignment: - // CrossAxisAlignment.start, - // children: [ - // Row( - // mainAxisSize: MainAxisSize.max, - // children: [ - // Expanded( - // // add Expanded to have your dropdown button fill remaining space - // child: - // DropdownButtonHideUnderline( - // child: new IgnorePointer( - // ignoring: true, - // child: DropdownButton( - // focusColor: - // Colors.grey, - // isExpanded: true, - // dropdownColor: - // Colors.grey, - // value: getClinicName( - // model) ?? - // "", - // iconSize: 0, - // elevation: 16, - // selectedItemBuilder: - // (BuildContext - // context) { - // return model - // .getClinicNameList() - // .map((item) { - // return Row( - // mainAxisSize: - // MainAxisSize - // .max, - // children: < - // Widget>[ - // AppText( - // item, - // fontSize: - // SizeConfig.textMultiplier * - // 2.1, - // color: Colors - // .grey[ - // 500], - // ), - // ], - // ); - // }).toList(); - // }, - // onChanged: - // (newValue) => - // {}, - // items: model - // .getClinicNameList() - // .map((item) { - // return DropdownMenuItem( - // value: item - // .toString(), - // child: Text( - // item, - // textAlign: - // TextAlign - // .end, - // ), - // ); - // }).toList(), - // ))), - // ), - // ], - // ) - // ], - // ), - // )), - - // Container( - // margin: EdgeInsets.all(8), - // decoration: BoxDecoration( - // borderRadius: - // BorderRadius.all(Radius.circular(6.0)), - // border: Border.all( - // width: 1.0, - // color: HexColor("#CCCCCC"))), - // padding: EdgeInsets.all(5), - // child: Column( - // crossAxisAlignment: CrossAxisAlignment.start, - // children: [ - // new IgnorePointer( - // ignoring: true, - // child: AppTextFormField( - // readOnly: true, - // hintText: profile != null - // ? profile['DoctorName'] - // : "", - // borderColor: Colors.white, - // onSaved: (value) {}, - // inputFormatter: ONLY_NUMBERS)) - // ], - // ), - // ), + onTap: () { + FocusScope.of(context).requestFocus(new FocusNode()); + }, + child: AppScaffold( + baseViewModel: model2, + isShowAppBar: true, + appBarTitle: TranslationBase.of(context).rescheduleLeaves!, + body: Center( + child: Container( + margin: EdgeInsets.only(top: 10), + child: FractionallySizedBox( + widthFactor: 0.9, + child: ListView( + children: [ + // Container( + // margin: EdgeInsets.all(8), + // decoration: BoxDecoration( + // borderRadius: BorderRadius.all( + // Radius.circular(6.0)), + // border: Border.all( + // width: 1.0, + // color: HexColor("#CCCCCC"))), + // width: double.infinity, + // child: Padding( + // padding: EdgeInsets.only( + // top: SizeConfig.widthMultiplier * 0.9, + // bottom: + // SizeConfig.widthMultiplier * 0.9, + // right: SizeConfig.widthMultiplier * 3, + // left: SizeConfig.widthMultiplier * 3), + // child: Column( + // crossAxisAlignment: + // CrossAxisAlignment.start, + // children: [ + // Row( + // mainAxisSize: MainAxisSize.max, + // children: [ + // Expanded( + // // add Expanded to have your dropdown button fill remaining space + // child: + // DropdownButtonHideUnderline( + // child: new IgnorePointer( + // ignoring: true, + // child: DropdownButton( + // focusColor: + // Colors.grey, + // isExpanded: true, + // dropdownColor: + // Colors.grey, + // value: getClinicName( + // model) ?? + // "", + // iconSize: 0, + // elevation: 16, + // selectedItemBuilder: + // (BuildContext + // context) { + // return model + // .getClinicNameList() + // .map((item) { + // return Row( + // mainAxisSize: + // MainAxisSize + // .max, + // children: < + // Widget>[ + // AppText( + // item, + // fontSize: + // SizeConfig.textMultiplier * + // 2.1, + // color: Colors + // .grey[ + // 500], + // ), + // ], + // ); + // }).toList(); + // }, + // onChanged: + // (newValue) => + // {}, + // items: model + // .getClinicNameList() + // .map((item) { + // return DropdownMenuItem( + // value: item + // .toString(), + // child: Text( + // item, + // textAlign: + // TextAlign + // .end, + // ), + // ); + // }).toList(), + // ))), + // ), + // ], + // ) + // ], + // ), + // )), - Container( - margin: EdgeInsets.all(8), - decoration: BoxDecoration( - borderRadius: BorderRadius.all(Radius.circular(6.0)), - border: Border.all(width: 1.0, color: HexColor("#CCCCCC"))), - width: double.infinity, - child: Padding( - padding: EdgeInsets.only( - top: SizeConfig.widthMultiplier * 0.9, - bottom: SizeConfig.widthMultiplier * 0.9, - right: SizeConfig.widthMultiplier * 3, - left: SizeConfig.widthMultiplier * 3), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Row( - mainAxisSize: MainAxisSize.max, - children: [ - model2.allOffTime.length > 0 - ? Expanded( - // add Expanded to have your dropdown button fill remaining space - child: DropdownButtonHideUnderline( - child: DropdownButton( - // focusColor: Colors.grey, - isExpanded: true, - value: offTime == null ? model2.allOffTime[0]['code'] : offTime, - iconSize: 40, - elevation: 16, - selectedItemBuilder: (BuildContext context) { - return model2.allOffTime.map((item) { - return Row( - mainAxisSize: MainAxisSize.max, - children: [ - AppText( - item['description'], + // Container( + // margin: EdgeInsets.all(8), + // decoration: BoxDecoration( + // borderRadius: + // BorderRadius.all(Radius.circular(6.0)), + // border: Border.all( + // width: 1.0, + // color: HexColor("#CCCCCC"))), + // padding: EdgeInsets.all(5), + // child: Column( + // crossAxisAlignment: CrossAxisAlignment.start, + // children: [ + // new IgnorePointer( + // ignoring: true, + // child: AppTextFormField( + // readOnly: true, + // hintText: profile != null + // ? profile['DoctorName'] + // : "", + // borderColor: Colors.white, + // onSaved: (value) {}, + // inputFormatter: ONLY_NUMBERS)) + // ], + // ), + // ), - fontSize: SizeConfig.textMultiplier * 2.1, - // color: - // Colors.grey, - ), - ], - ); - }).toList(); - }, - onChanged: (newValue) { - setState(() { - offTime = newValue; - }); - if (offTime == '1') { - model2.getReasons(18); - } else if (offTime == '2') { - model2.getReasons(19); - } else if (offTime == '3' || offTime == '5') { - model2.getReasons(102); - setState(() { - offTime = newValue; - }); - } - }, - items: model2.allOffTime.map((item) { - return DropdownMenuItem( - value: item['code'].toString(), - child: Text( - item['description'], - textAlign: TextAlign.end, - ), - ); - }).toList(), - )), - ) - : SizedBox(), - ], - ) - ], - ), - )), - offTime == '1' - ? Column( - children: [ Container( margin: EdgeInsets.all(8), decoration: BoxDecoration( - borderRadius: BorderRadius.all(Radius.circular(6.0)), - border: Border.all(width: 1.0, color: HexColor("#CCCCCC"))), - padding: EdgeInsets.all(5), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - AppTextFormField( - hintText: TranslationBase.of(context).fromDate, - borderColor: Colors.white, - prefix: IconButton(icon: Icon(Icons.calendar_today)), - textInputType: TextInputType.number, - controller: _toDateController, - onTap: () { - _presentDatePicker('fromDate'); - }, - inputFormatter: ONLY_DATE, - onChanged: (val) => fromDate = val, - onSaved: (val) => fromDate = val, - ) - ], - )), - Row( - children: [ - Expanded( - child: Container( - margin: EdgeInsets.all(8), - decoration: BoxDecoration( - borderRadius: BorderRadius.all(Radius.circular(6.0)), - border: Border.all(width: 1.0, color: HexColor("#CCCCCC"))), - padding: EdgeInsets.all(5), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - DateTimePicker( - timeHintText: TranslationBase.of(context).fromTime, - type: DateTimePickerType.time, - controller: _controller4, - onChanged: (val) => fromTime = val, - validator: (val) { - print(val); - // setState( - // () => _valueToValidate4 = val); - return null; - }, - onSaved: (val) => fromTime = val, - ) - ], - ), + borderRadius: BorderRadius.all( + Radius.circular(6.0)), + border: Border.all( + width: 1.0, + color: HexColor("#CCCCCC"))), + width: double.infinity, + child: Padding( + padding: EdgeInsets.only( + top: SizeConfig.widthMultiplier * 0.9, + bottom: + SizeConfig.widthMultiplier * 0.9, + right: SizeConfig.widthMultiplier * 3, + left: SizeConfig.widthMultiplier * 3), + child: Column( + crossAxisAlignment: + CrossAxisAlignment.start, + children: [ + Row( + mainAxisSize: MainAxisSize.max, + children: [ + model2.allOffTime.length > 0 + ? Expanded( + // add Expanded to have your dropdown button fill remaining space + child: + DropdownButtonHideUnderline( + child: + DropdownButton( + // focusColor: Colors.grey, + isExpanded: true, + value: offTime == null + ? model2.allOffTime[0] + ['code'] + : offTime, + iconSize: 40, + elevation: 16, + selectedItemBuilder: + (BuildContext + context) { + return model2.allOffTime + .map((item) { + return Row( + mainAxisSize: + MainAxisSize + .max, + children: [ + AppText( + item[ + 'description'], + + fontSize: SizeConfig + .textMultiplier * + 2.1, + // color: + // Colors.grey, + ), + ], + ); + }).toList(); + }, + onChanged: (newValue) { + setState(() { + offTime = newValue; + }); + if (offTime == '1') { + model2.getReasons(18); + } else if (offTime == + '2') { + model2.getReasons(19); + } else if (offTime == + '3' || + offTime == '5') { + model2 + .getReasons(102); + setState(() { + offTime = newValue; + }); + } + }, + items: model2.allOffTime + .map((item) { + return DropdownMenuItem< + String>( + value: item['code'] + .toString(), + child: Text( + item['description'], + textAlign: + TextAlign.end, + ), + ); + }).toList(), + )), + ) + : SizedBox(), + ], + ) + ], ), - ), - Expanded( - child: Container( - margin: EdgeInsets.all(8), - decoration: BoxDecoration( - borderRadius: BorderRadius.all(Radius.circular(6.0)), - border: Border.all(width: 1.0, color: HexColor("#CCCCCC"))), - padding: EdgeInsets.all(5), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - DateTimePicker( - timeHintText: TranslationBase.of(context).toTime, - type: DateTimePickerType.time, - controller: _controller5, - onChanged: (val) => toTime = val, - validator: (val) { - print(val); - // setState( - // () => _valueToValidate4 = val); - return null; - }, - onSaved: (val) => toTime = val, - ) - ], - ), + )), + offTime == '1' + ? Column( + children: [ + Container( + margin: EdgeInsets.all(8), + decoration: BoxDecoration( + borderRadius: BorderRadius.all( + Radius.circular(6.0)), + border: Border.all( + width: 1.0, + color: + HexColor("#CCCCCC"))), + padding: EdgeInsets.all(5), + child: Column( + crossAxisAlignment: + CrossAxisAlignment.start, + children: [ + AppTextFormField( + hintText: TranslationBase.of( + context) + .fromDate, + borderColor: Colors.white, + prefix: IconButton( + icon: Icon( + Icons.calendar_today), + onPressed: () {}), + textInputType: + TextInputType.number, + controller: _toDateController, + onTap: () { + _presentDatePicker( + 'fromDate'); + }, + inputFormatter: ONLY_DATE, + onChanged: (val) => + fromDate = val, + onSaved: (val) => + fromDate = val, + ) + ], + )), + Row( + children: [ + Expanded( + child: Container( + margin: EdgeInsets.all(8), + decoration: BoxDecoration( + borderRadius: + BorderRadius.all( + Radius.circular( + 6.0)), + border: Border.all( + width: 1.0, + color: HexColor( + "#CCCCCC"))), + padding: EdgeInsets.all(5), + child: Column( + crossAxisAlignment: + CrossAxisAlignment.start, + children: [ + DateTimePicker( + timeHintText: + TranslationBase.of( + context) + .fromTime, + type: DateTimePickerType + .time, + controller: _controller4, + onChanged: (val) => + fromTime = val, + validator: (val) { + print(val); + // setState( + // () => _valueToValidate4 = val); + return null; + }, + onSaved: (val) => + fromTime = val!, + ) + ], + ), + ), + ), + Expanded( + child: Container( + margin: EdgeInsets.all(8), + decoration: BoxDecoration( + borderRadius: + BorderRadius.all( + Radius.circular( + 6.0)), + border: Border.all( + width: 1.0, + color: HexColor( + "#CCCCCC"))), + padding: EdgeInsets.all(5), + child: Column( + crossAxisAlignment: + CrossAxisAlignment.start, + children: [ + DateTimePicker( + timeHintText: + TranslationBase.of( + context) + .toTime, + type: DateTimePickerType + .time, + controller: _controller5, + onChanged: (val) => + toTime = val, + validator: (val) { + print(val); + // setState( + // () => _valueToValidate4 = val); + return null; + }, + onSaved: (val) => + toTime = val!, + ) + ], + ), + ), + ) + ], + ) + ], + ) + : Column( + children: [ + Container( + margin: EdgeInsets.all(8), + decoration: BoxDecoration( + borderRadius: BorderRadius.all( + Radius.circular(6.0)), + border: Border.all( + width: 1.0, + color: + HexColor("#CCCCCC"))), + padding: EdgeInsets.all(5), + child: Column( + crossAxisAlignment: + CrossAxisAlignment.start, + children: [ + AppTextFormField( + hintText: + TranslationBase.of( + context) + .fromDate, + borderColor: Colors.white, + prefix: IconButton( + icon: Icon(Icons + .calendar_today), + onPressed: () {}), + textInputType: + TextInputType.number, + readOnly: true, + controller: + _toDateController, + onTap: () { + _presentDatePicker( + 'fromDate'); + }, + inputFormatter: ONLY_DATE, + onChanged: (value) { + setState(() { + fromDate = value; + }); + }), + ], + )), + Container( + margin: EdgeInsets.all(8), + decoration: BoxDecoration( + borderRadius: BorderRadius.all( + Radius.circular(6.0)), + border: Border.all( + width: 1.0, + color: + HexColor("#CCCCCC"))), + padding: EdgeInsets.all(5), + child: Column( + crossAxisAlignment: + CrossAxisAlignment.start, + children: [ + AppTextFormField( + hintText: + TranslationBase.of( + context) + .toDate, + readOnly: true, + borderColor: Colors.white, + prefix: IconButton( + icon: Icon( + Icons.calendar_today), + onPressed: () {}, + ), + textInputType: + TextInputType.number, + controller: + _toDateController2, + onTap: () { + _presentDatePicker( + 'toDate'); + }, + inputFormatter: ONLY_DATE, + onChanged: (value) { + setState(() { + toDate = value; + }); + }), + ], + )) + ], ), - ) - ], - ) - ], - ) - : Column( - children: [ Container( margin: EdgeInsets.all(8), decoration: BoxDecoration( - borderRadius: BorderRadius.all(Radius.circular(6.0)), - border: Border.all(width: 1.0, color: HexColor("#CCCCCC"))), - padding: EdgeInsets.all(5), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - AppTextFormField( - hintText: TranslationBase.of(context).fromDate, - borderColor: Colors.white, - prefix: IconButton(icon: Icon(Icons.calendar_today)), - textInputType: TextInputType.number, - readOnly: true, - controller: _toDateController, - onTap: () { - _presentDatePicker('fromDate'); - }, - inputFormatter: ONLY_DATE, - onChanged: (value) { - setState(() { - fromDate = value; - }); - }), - ], + borderRadius: BorderRadius.all( + Radius.circular(6.0)), + border: Border.all( + width: 1.0, + color: HexColor("#CCCCCC"))), + width: double.infinity, + child: Padding( + padding: EdgeInsets.only( + top: SizeConfig.widthMultiplier * 0.9, + bottom: + SizeConfig.widthMultiplier * 0.9, + right: SizeConfig.widthMultiplier * 3, + left: SizeConfig.widthMultiplier * 3), + child: Column( + crossAxisAlignment: + CrossAxisAlignment.start, + children: [ + Row( + mainAxisSize: MainAxisSize.max, + children: [ + model2.allReasons.length > 0 + ? Expanded( + // add Expanded to have your dropdown button fill remaining space + child: + DropdownButtonHideUnderline( + child: + DropdownButton( + focusColor: Colors.grey, + isExpanded: true, + value: model2 + .allReasons[0] + ['id'] + .toString() ?? + "", + iconSize: 40, + elevation: 16, + selectedItemBuilder: + (BuildContext + context) { + return model2.allReasons + .map((item) { + return Row( + mainAxisSize: + MainAxisSize + .max, + children: [ + AppText( + projectsProvider + .isArabic + ? item[ + 'nameAr'] + : item[ + 'nameEn'], + fontSize: SizeConfig + .textMultiplier * + 2.1, + // color: + // Colors.grey, + ), + ], + ); + }).toList(); + }, + onChanged: (newValue) => { + setState(() { + reason = newValue; + }) + }, + items: model2.allReasons + .map((item) { + return DropdownMenuItem< + String>( + value: item['id'] + .toString(), + child: Text( + projectsProvider + .isArabic + ? item['nameAr'] + : item[ + 'nameEn'], + textAlign: + TextAlign.end, + ), + ); + }).toList(), + )), + ) + : SizedBox(), + ], + ) + ], + ), )), + Container( margin: EdgeInsets.all(8), decoration: BoxDecoration( - borderRadius: BorderRadius.all(Radius.circular(6.0)), - border: Border.all(width: 1.0, color: HexColor("#CCCCCC"))), - padding: EdgeInsets.all(5), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - AppTextFormField( - hintText: TranslationBase.of(context).toDate, - readOnly: true, - borderColor: Colors.white, - prefix: IconButton(icon: Icon(Icons.calendar_today)), - textInputType: TextInputType.number, - controller: _toDateController2, - onTap: () { - _presentDatePicker('toDate'); - }, - inputFormatter: ONLY_DATE, - onChanged: (value) { - setState(() { - toDate = value; - }); - }), - ], - )) - ], - ), - Container( - margin: EdgeInsets.all(8), - decoration: BoxDecoration( - borderRadius: BorderRadius.all(Radius.circular(6.0)), - border: Border.all(width: 1.0, color: HexColor("#CCCCCC"))), - width: double.infinity, - child: Padding( - padding: EdgeInsets.only( - top: SizeConfig.widthMultiplier * 0.9, - bottom: SizeConfig.widthMultiplier * 0.9, - right: SizeConfig.widthMultiplier * 3, - left: SizeConfig.widthMultiplier * 3), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Row( - mainAxisSize: MainAxisSize.max, - children: [ - model2.allReasons.length > 0 - ? Expanded( - // add Expanded to have your dropdown button fill remaining space - child: DropdownButtonHideUnderline( - child: DropdownButton( - focusColor: Colors.grey, - isExpanded: true, - value: model2.allReasons[0]['id'].toString() ?? "", - iconSize: 40, - elevation: 16, - selectedItemBuilder: (BuildContext context) { - return model2.allReasons.map((item) { - return Row( - mainAxisSize: MainAxisSize.max, - children: [ - AppText( - projectsProvider.isArabic - ? item['nameAr'] - : item['nameEn'], - fontSize: SizeConfig.textMultiplier * 2.1, - // color: - // Colors.grey, + borderRadius: BorderRadius.all( + Radius.circular(6.0)), + border: Border.all( + width: 1.0, + color: HexColor("#CCCCCC"))), + width: double.infinity, + child: Padding( + padding: EdgeInsets.only( + top: SizeConfig.widthMultiplier * 0.9, + bottom: + SizeConfig.widthMultiplier * 0.9, + right: SizeConfig.widthMultiplier * 3, + left: SizeConfig.widthMultiplier * 3), + child: Column( + crossAxisAlignment: + CrossAxisAlignment.start, + children: [ + Row( + mainAxisSize: MainAxisSize.max, + children: [ + model2.coveringDoctors.length > 0 + ? Expanded( + // add Expanded to have your dropdown button fill remaining space + child: DropdownSearch( + mode: Mode.BOTTOM_SHEET, + + dropdownSearchDecoration: + InputDecoration( + contentPadding: + EdgeInsets + .all(0), + border: + InputBorder + .none), + //maxHeight: 300, + items: model2 + .coveringDoctors + .map((item) { + return projectsProvider + .isArabic + ? item[ + 'doctorNameN'] + : item[ + 'doctorName']; + }).toList(), + // label: "Doctor List", + onChanged: (item) { + model2.coveringDoctors + .forEach( + (newVal) => { + if (newVal[ + 'doctorName'] == + item) + doctorID = + newVal['DoctorID'] + }); + }, + selectedItem: + getSelectedDoctor( + model2), + showSearchBox: true, + searchBoxDecoration: + InputDecoration( + border: + OutlineInputBorder(), + contentPadding: + EdgeInsets.fromLTRB( + 12, 12, 8, 0), + labelText: + "Search Doctor", + ), + popupTitle: Container( + height: 50, + decoration: + BoxDecoration( + color: Theme.of( + context) + .primaryColorDark, + borderRadius: + BorderRadius.only( + topLeft: + Radius.circular( + 20), + topRight: + Radius.circular( + 20), + ), + ), + child: Center( + child: Text( + '', + style: TextStyle( + fontSize: 24, + fontWeight: + FontWeight + .bold, + color: + Colors.white, + ), + ), + ), + ), + popupShape: + RoundedRectangleBorder( + borderRadius: + BorderRadius.only( + topLeft: + Radius.circular( + 24), + topRight: + Radius.circular( + 24), ), - ], - ); - }).toList(); - }, - onChanged: (newValue) => { - setState(() { - reason = newValue; - }) - }, - items: model2.allReasons.map((item) { - return DropdownMenuItem( - value: item['id'].toString(), - child: Text( - projectsProvider.isArabic ? item['nameAr'] : item['nameEn'], - textAlign: TextAlign.end, + ), ), - ); - }).toList(), - )), + // DropdownButtonHideUnderline( + // child: DropdownButton( + // focusColor: Colors.grey, + // isExpanded: true, + // value: doctorID == null + // ? model2 + // .coveringDoctors[0] + // ['doctorID'] + // .toString() + // : doctorID, + // iconSize: 40, + // elevation: 16, + // selectedItemBuilder: + // (BuildContext context) { + // return model2 + // .coveringDoctors + // .map((item) { + // return Row( + // mainAxisSize: + // MainAxisSize.max, + // children: [ + // AppText( + // projectsProvider + // .isArabic + // ? item[ + // 'doctorNameN'] + // : item[ + // 'doctorName'], + // fontSize: SizeConfig + // .textMultiplier * + // 2.1, + // ), + // ], + // ); + // }).toList(); + // }, + // onChanged: (newValue) => { + // setState(() { + // doctorID = newValue; + // }) + // }, + // items: model2 + // .coveringDoctors + // .map((item) { + // return DropdownMenuItem< + // String>( + // value: item['doctorID'] + // .toString(), + // child: Text( + // projectsProvider + // .isArabic + // ? item[ + // 'doctorNameN'] + // : item[ + // 'doctorName'], + // textAlign: + // TextAlign.start, + // ), + // ); + // }).toList(), + // )), + ) + : SizedBox(), + ], ) - : SizedBox(), ], - ) - ], - ), - )), - - Container( - margin: EdgeInsets.all(8), - decoration: BoxDecoration( - borderRadius: BorderRadius.all(Radius.circular(6.0)), - border: Border.all(width: 1.0, color: HexColor("#CCCCCC"))), - width: double.infinity, - child: Padding( - padding: EdgeInsets.only( - top: SizeConfig.widthMultiplier * 0.9, - bottom: SizeConfig.widthMultiplier * 0.9, - right: SizeConfig.widthMultiplier * 3, - left: SizeConfig.widthMultiplier * 3), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Row( - mainAxisSize: MainAxisSize.max, - children: [ - model2.coveringDoctors.length > 0 - ? Expanded( - // add Expanded to have your dropdown button fill remaining space - child: DropdownSearch( - mode: Mode.BOTTOM_SHEET, - - dropdownSearchDecoration: InputDecoration( - contentPadding: EdgeInsets.all(0), border: InputBorder.none), - //maxHeight: 300, - items: model2.coveringDoctors.map((item) { - return projectsProvider.isArabic - ? item['doctorNameN'] - : item['doctorName']; - }).toList(), - // label: "Doctor List", - onChanged: (item) { - model2.coveringDoctors.forEach((newVal) => { - if (newVal['doctorName'] == item) - doctorID = newVal['DoctorID'] - }); - }, - selectedItem: getSelectedDoctor(model2), - showSearchBox: true, - searchBoxDecoration: InputDecoration( - border: OutlineInputBorder(), - contentPadding: EdgeInsets.fromLTRB(12, 12, 8, 0), - labelText: "Search Doctor", - ), - popupTitle: Container( - height: 50, - decoration: BoxDecoration( - color: Theme.of(context).primaryColorDark, - borderRadius: BorderRadius.only( - topLeft: Radius.circular(20), - topRight: Radius.circular(20), - ), - ), - child: Center( - child: Text( - '', - style: TextStyle( - fontSize: 24, - fontWeight: FontWeight.bold, - color: Colors.white, - ), - ), - ), - ), - popupShape: RoundedRectangleBorder( - borderRadius: BorderRadius.only( - topLeft: Radius.circular(24), - topRight: Radius.circular(24), - ), - ), - ), - // DropdownButtonHideUnderline( - // child: DropdownButton( - // focusColor: Colors.grey, - // isExpanded: true, - // value: doctorID == null - // ? model2 - // .coveringDoctors[0] - // ['doctorID'] - // .toString() - // : doctorID, - // iconSize: 40, - // elevation: 16, - // selectedItemBuilder: - // (BuildContext context) { - // return model2 - // .coveringDoctors - // .map((item) { - // return Row( - // mainAxisSize: - // MainAxisSize.max, - // children: [ - // AppText( - // projectsProvider - // .isArabic - // ? item[ - // 'doctorNameN'] - // : item[ - // 'doctorName'], - // fontSize: SizeConfig - // .textMultiplier * - // 2.1, - // ), - // ], - // ); - // }).toList(); - // }, - // onChanged: (newValue) => { - // setState(() { - // doctorID = newValue; - // }) - // }, - // items: model2 - // .coveringDoctors - // .map((item) { - // return DropdownMenuItem< - // String>( - // value: item['doctorID'] - // .toString(), - // child: Text( - // projectsProvider - // .isArabic - // ? item[ - // 'doctorNameN'] - // : item[ - // 'doctorName'], - // textAlign: - // TextAlign.start, - // ), - // ); - // }).toList(), - // )), - ) - : SizedBox(), - ], - ) + ), + )), + SizedBox(height: SizeConfig.screenHeight * .3), + Container( + margin: EdgeInsets.all( + SizeConfig.widthMultiplier * 5), + child: Wrap( + alignment: WrapAlignment.center, + children: [ + AppButton( + title: widget.isUpdate == true + ? TranslationBase.of(context) + .updateReschedule + : TranslationBase.of(context) + .addReschedule, + color: HexColor('#359846'), + onPressed: () { + if (offTime == '1' || offTime == '2') { + if (widget.isUpdate == true) { + updateRecheduleLeave(model2); + } else { + addRecheduleLeave(model2); + } + } else { + DrAppToastMsg.showErrorToast( + TranslationBase.of(context) + .onlyOfftimeHoliday); + } + }, + ), ], ), - )), - SizedBox(height: SizeConfig.screenHeight * .3), - Container( - margin: EdgeInsets.all(SizeConfig.widthMultiplier * 5), - child: Wrap( - alignment: WrapAlignment.center, - children: [ - AppButton( - title: widget.isUpdate == true - ? TranslationBase.of(context).updateReschedule - : TranslationBase.of(context).addReschedule, - color: HexColor('#359846'), - onPressed: () { - if (offTime == '1' || offTime == '2') { - if (widget.isUpdate == true) { - updateRecheduleLeave(model2); - } else { - addRecheduleLeave(model2); - } - } else { - DrAppToastMsg.showErrorToast(TranslationBase.of(context).onlyOfftimeHoliday); - } - }, - ), - ], - ), + ), + // Column( + // children: [ + // AppText(TranslationBase.of(context) + // .previousSickLeaveIssue + + // ' ') + // ], + // ) + ], ), - // Column( - // children: [ - // AppText(TranslationBase.of(context) - // .previousSickLeaveIssue + - // ' ') - // ], - // ) - ], + ), ), ), ), - ), - ), - ))); + ))); } getProfile() async { @@ -725,13 +901,16 @@ class _RescheduleLeaveScreen extends State { final df = new DateFormat('HH:mm:ss'); final dateFormat = new DateFormat('yyyy-MM-dd'); this.offTime = widget.updateData.requisitionType.toString(); - _toDateController.text = dateFormat.format(DateTime.parse(widget.updateData.dateTimeFrom)); + _toDateController.text = + dateFormat.format(DateTime.parse(widget.updateData.dateTimeFrom)); //df.format(DateTime.parse(widget.updateData.dateTimeFrom)); - this.fromTime = df.format(DateTime.parse(widget.updateData.dateTimeFrom)); + this.fromTime = + df.format(DateTime.parse(widget.updateData.dateTimeFrom)); this.fromTime = this.fromTime.substring(0, this.fromTime.length - 3); this.toTime = df.format(DateTime.parse(widget.updateData.dateTimeTo)); this.toTime = this.toTime.substring(0, this.toTime.length - 3); - _toDateController2.text = dateFormat.format(DateTime.parse(widget.updateData.dateTimeTo)); + _toDateController2.text = + dateFormat.format(DateTime.parse(widget.updateData.dateTimeTo)); _controller5.text = toTime; _controller4.text = fromTime; toDate = _toDateController2.text; @@ -744,7 +923,8 @@ class _RescheduleLeaveScreen extends State { getClinicName(model) { var clinicID = this.profile['ClinicID'] ?? 1; - var clinicInfo = model.clinicsList.where((i) => i['ClinicID'] == clinicID).toList(); + var clinicInfo = + model.clinicsList.where((i) => i['ClinicID'] == clinicID).toList(); return clinicInfo.length > 0 ? clinicInfo[0]['ClinicDescription'] : ""; } @@ -754,10 +934,16 @@ class _RescheduleLeaveScreen extends State { var fromDates = fromDate; var toDates = toDate; if (offTime == '1') { - fromDate = df.format( - DateTime.parse(dateFormat.format(fromDates) + 'T' + fromTime + ':' + DateTime.now().second.toString())); - toDate = df - .format(DateTime.parse(dateFormat.format(fromDates) + 'T' + toTime + ':' + DateTime.now().second.toString())); + fromDate = df.format(DateTime.parse(dateFormat.format(fromDates) + + 'T' + + fromTime + + ':' + + DateTime.now().second.toString())); + toDate = df.format(DateTime.parse(dateFormat.format(fromDates) + + 'T' + + toTime + + ':' + + DateTime.now().second.toString())); } else { fromDate = df.format(fromDates); toDate = df.format(toDates); @@ -772,7 +958,8 @@ class _RescheduleLeaveScreen extends State { "dateTimeTo": toDate, "date": offTime == '1' ? fromDate : df.format(DateTime.now()), "reasonId": reason == null ? model.allOffTime[0]['code'] : reason, - "coveringDoctorId": doctorID == null ? model.coveringDoctors[0]['doctorID'] : doctorID, + "coveringDoctorId": + doctorID == null ? model.coveringDoctors[0]['doctorID'] : doctorID, "status": 2, "schedule": [ { @@ -795,9 +982,10 @@ class _RescheduleLeaveScreen extends State { Navigator.push( context, MaterialPageRoute( - builder: (context) => AddRescheduleLeavScreen(), settings: RouteSettings(name: 'AddRescheduleLeaveScreen') - // MyReferredPatient(), - ), + builder: (context) => AddRescheduleLeavScreen(), + settings: RouteSettings(name: 'AddRescheduleLeaveScreen') + // MyReferredPatient(), + ), ); } }); @@ -810,13 +998,21 @@ class _RescheduleLeaveScreen extends State { dynamic fromDates = fromDate; dynamic toDates = toDate; if (offTime == '1') { - fromDate = - df.format(DateTime.parse(_toDateController.text)) + 'T' + fromTime + ':' + DateTime.now().second.toString(); - toDate = - df.format(DateTime.parse(_toDateController2.text)) + 'T' + toTime + ':' + DateTime.now().second.toString(); + fromDate = df.format(DateTime.parse(_toDateController.text)) + + 'T' + + fromTime + + ':' + + DateTime.now().second.toString(); + toDate = df.format(DateTime.parse(_toDateController2.text)) + + 'T' + + toTime + + ':' + + DateTime.now().second.toString(); } else { - fromDate = df.format(fromDates is DateTime ? fromDates : DateTime.parse(fromDates)); - toDate = df.format(toDates is DateTime ? toDates : DateTime.parse(toDates)); + fromDate = df.format( + fromDates is DateTime ? fromDates : DateTime.parse(fromDates)); + toDate = + df.format(toDates is DateTime ? toDates : DateTime.parse(toDates)); } Map request = { @@ -829,7 +1025,8 @@ class _RescheduleLeaveScreen extends State { "dateTimeTo": toDate, "date": offTime == '1' ? fromDate : df.format(DateTime.now()), "reasonId": reason == null ? model.allOffTime[0]['code'] : reason, - "coveringDoctorId": doctorID == null ? model.coveringDoctors[0]['doctorID'] : doctorID, + "coveringDoctorId": + doctorID == null ? model.coveringDoctors[0]['doctorID'] : doctorID, "status": 2, "schedule": [ { @@ -867,8 +1064,9 @@ class _RescheduleLeaveScreen extends State { : model2.coveringDoctors[0]['doctorName']; else { model2.coveringDoctors.forEach((newVal) => { - if (newVal['doctorID'].toString() == doctorID) {doctorName = newVal['doctorName']} - }); + if (newVal['doctorID'].toString() == doctorID) + {doctorName = newVal['doctorName']} + }); return doctorName; } } From 7d3e59e0604b8831c64a653b18fdf451de69a10b Mon Sep 17 00:00:00 2001 From: hussam al-habibeh Date: Mon, 22 Nov 2021 16:28:25 +0200 Subject: [PATCH 2/2] flutter version 2 --- .../PatientRegistrationViewModel.dart | 6 +- .../profile_gird_for_other.dart | 125 +- .../profile_gird_for_search.dart | 93 +- .../referral/my-referral-detail-screen.dart | 154 ++- .../reschedule-leaves/reschedule_leave.dart | 1043 ++++++++++------- pubspec.lock | 10 +- 6 files changed, 883 insertions(+), 548 deletions(-) diff --git a/lib/core/viewModel/PatientRegistrationViewModel.dart b/lib/core/viewModel/PatientRegistrationViewModel.dart index a60d1ed2..fe32bfcb 100644 --- a/lib/core/viewModel/PatientRegistrationViewModel.dart +++ b/lib/core/viewModel/PatientRegistrationViewModel.dart @@ -141,9 +141,7 @@ class PatientRegistrationViewModel extends BaseViewModel { setState(ViewState.Idle); } - Future sendActivationCodeByOTPNotificationType( - { - required int otpType}) async { + Future sendActivationCodeByOTPNotificationType({required int otpType}) async { setState(ViewState.BusyLocal); print(checkPatientForRegistrationModel); print(checkPatientForRegistrationModel); @@ -181,7 +179,7 @@ class PatientRegistrationViewModel extends BaseViewModel { channel: 3, // TODO Elham* loginType loginType: 4, - logInTokenID:_patientRegistrationService.logInTokenID , + logInTokenID: _patientRegistrationService.logInTokenID, nationalID: checkPatientForRegistrationModel.patientIdentificationID, patientID: 0, mobileNo: checkPatientForRegistrationModel.patientMobileNumber.toString(), diff --git a/lib/screens/patients/profile/profile_screen/profile_gird_for_other.dart b/lib/screens/patients/profile/profile_screen/profile_gird_for_other.dart index 6f1b57d8..22a5f23b 100644 --- a/lib/screens/patients/profile/profile_screen/profile_gird_for_other.dart +++ b/lib/screens/patients/profile/profile_screen/profile_gird_for_other.dart @@ -33,41 +33,77 @@ class ProfileGridForOther extends StatelessWidget { @override Widget build(BuildContext context) { final List cardsList = [ - PatientProfileCardModel(TranslationBase.of(context).vital!, TranslationBase.of(context).signs!, VITAL_SIGN_DETAILS, 'patient/vital_signs.png', + PatientProfileCardModel( + TranslationBase.of(context).vital!, + TranslationBase.of(context).signs!, + VITAL_SIGN_DETAILS, + 'patient/vital_signs.png', isInPatient: isInpatient), PatientProfileCardModel( - TranslationBase.of(context).lab!, TranslationBase.of(context).result!, LAB_RESULT, 'patient/lab_results.png', + TranslationBase.of(context).lab!, + TranslationBase.of(context).result!, + LAB_RESULT, + 'patient/lab_results.png', isInPatient: isInpatient), - PatientProfileCardModel(TranslationBase.of(context).lab!, TranslationBase.of(context).special!, - ALL_SPECIAL_LAB_RESULT, 'patient/lab_results.png', + PatientProfileCardModel( + TranslationBase.of(context).lab!, + TranslationBase.of(context).special!, + ALL_SPECIAL_LAB_RESULT, + 'patient/lab_results.png', isInPatient: isInpatient), - PatientProfileCardModel(TranslationBase.of(context).radiology!, TranslationBase.of(context).service!, - RADIOLOGY_PATIENT, 'patient/health_summary.png', + PatientProfileCardModel( + TranslationBase.of(context).radiology!, + TranslationBase.of(context).service!, + RADIOLOGY_PATIENT, + 'patient/health_summary.png', isInPatient: isInpatient), - PatientProfileCardModel(TranslationBase.of(context).orders!, TranslationBase.of(context).prescription!, - ORDER_PRESCRIPTION_NEW, 'patient/order_prescription.png', + PatientProfileCardModel( + TranslationBase.of(context).orders!, + TranslationBase.of(context).prescription!, + ORDER_PRESCRIPTION_NEW, + 'patient/order_prescription.png', isInPatient: isInpatient), - PatientProfileCardModel(TranslationBase.of(context).health!, TranslationBase.of(context).summary!, HEALTH_SUMMARY, + PatientProfileCardModel( + TranslationBase.of(context).health!, + TranslationBase.of(context).summary!, + HEALTH_SUMMARY, 'patient/health_summary.png', isInPatient: isInpatient), - PatientProfileCardModel(TranslationBase.of(context).patient!, "ECG", PATIENT_ECG, 'patient/patient_sick_leave.png', + PatientProfileCardModel(TranslationBase.of(context).patient!, "ECG", + PATIENT_ECG, 'patient/patient_sick_leave.png', isInPatient: isInpatient), - PatientProfileCardModel(TranslationBase.of(context).orders!, TranslationBase.of(context).procedures!, - ORDER_PROCEDURE, 'patient/Order_Procedures.png', + PatientProfileCardModel( + TranslationBase.of(context).orders!, + TranslationBase.of(context).procedures!, + ORDER_PROCEDURE, + 'patient/Order_Procedures.png', isInPatient: isInpatient), - PatientProfileCardModel(TranslationBase.of(context).insurance!, TranslationBase.of(context).service!, - PATIENT_INSURANCE_APPROVALS_NEW, 'patient/vital_signs.png', + PatientProfileCardModel( + TranslationBase.of(context).insurance!, + TranslationBase.of(context).service!, + PATIENT_INSURANCE_APPROVALS_NEW, + 'patient/vital_signs.png', isInPatient: isInpatient), - PatientProfileCardModel(TranslationBase.of(context).patientSick!, TranslationBase.of(context).leave!, ADD_SICKLEAVE, 'patient/patient_sick_leave.png', + PatientProfileCardModel( + TranslationBase.of(context).patientSick!, + TranslationBase.of(context).leave!, + ADD_SICKLEAVE, + 'patient/patient_sick_leave.png', isInPatient: isInpatient), - if (isFromLiveCare || (patient.appointmentNo != null && patient.appointmentNo != 0)) - PatientProfileCardModel(TranslationBase.of(context).patient!, TranslationBase.of(context).ucaf!, - PATIENT_UCAF_REQUEST, 'patient/ucaf.png', + if (isFromLiveCare || + (patient.appointmentNo != null && patient.appointmentNo != 0)) + PatientProfileCardModel( + TranslationBase.of(context).patient!, + TranslationBase.of(context).ucaf!, + PATIENT_UCAF_REQUEST, + 'patient/ucaf.png', isInPatient: isInpatient, isDisable: isFromLiveCare ? patient.appointmentNo == null - : patient.patientStatusType != 43 || patient.appointmentNo == null), - if (isFromLiveCare || (patient.appointmentNo != null && patient.appointmentNo != 0)) + : patient.patientStatusType != 43 || + patient.appointmentNo == null), + if (isFromLiveCare || + (patient.appointmentNo != null && patient.appointmentNo != 0)) PatientProfileCardModel( TranslationBase.of(context).referral!, TranslationBase.of(context).patient!, @@ -76,15 +112,21 @@ class ProfileGridForOther extends StatelessWidget { isInPatient: isInpatient, isDisable: isFromLiveCare ? patient.appointmentNo == null - : patient.patientStatusType != 43 || patient.appointmentNo == null, + : patient.patientStatusType != 43 || + patient.appointmentNo == null, ), - if (isFromLiveCare || (patient.appointmentNo != null && patient.appointmentNo != 0)) - PatientProfileCardModel(TranslationBase.of(context).admission!, TranslationBase.of(context).request!, - PATIENT_ADMISSION_REQUEST, 'patient/admission_req.png', + if (isFromLiveCare || + (patient.appointmentNo != null && patient.appointmentNo != 0)) + PatientProfileCardModel( + TranslationBase.of(context).admission!, + TranslationBase.of(context).request!, + PATIENT_ADMISSION_REQUEST, + 'patient/admission_req.png', isInPatient: isInpatient, isDisable: isFromLiveCare ? patient.appointmentNo == null - : patient.patientStatusType != 43 || patient.appointmentNo == null), + : patient.patientStatusType != 43 || + patient.appointmentNo == null), ]; return Column( @@ -99,22 +141,23 @@ class ProfileGridForOther extends StatelessWidget { crossAxisCount: 3, itemCount: cardsList.length, staggeredTileBuilder: (int index) => StaggeredTile.fit(1), - itemBuilder: (BuildContext context, int index) => PatientProfileButton( - patient: patient, - patientType: patientType, - arrivalType: arrivalType, - from: from, - to: to, - nameLine1: cardsList[index].nameLine1, - nameLine2: cardsList[index].nameLine2, - route: cardsList[index].route, - icon: cardsList[index].icon, - isInPatient: cardsList[index].isInPatient, - isDischargedPatient: cardsList[index].isDischargedPatient, - isDisable: cardsList[index].isDisable, - onTap: cardsList[index].onTap, - isLoading: cardsList[index].isLoading, - isFromLiveCare: isFromLiveCare), + itemBuilder: (BuildContext context, int index) => + PatientProfileButton( + patient: patient, + patientType: patientType, + arrivalType: arrivalType, + from: from, + to: to, + nameLine1: cardsList[index].nameLine1, + nameLine2: cardsList[index].nameLine2, + route: cardsList[index].route, + icon: cardsList[index].icon, + isInPatient: cardsList[index].isInPatient, + isDischargedPatient: cardsList[index].isDischargedPatient, + isDisable: cardsList[index].isDisable, + onTap: cardsList[index].onTap, + isLoading: cardsList[index].isLoading, + isFromLiveCare: isFromLiveCare), ), ), ], diff --git a/lib/screens/patients/profile/profile_screen/profile_gird_for_search.dart b/lib/screens/patients/profile/profile_screen/profile_gird_for_search.dart index 3dc919d1..209062eb 100644 --- a/lib/screens/patients/profile/profile_screen/profile_gird_for_search.dart +++ b/lib/screens/patients/profile/profile_screen/profile_gird_for_search.dart @@ -30,45 +30,87 @@ class ProfileGridForSearch extends StatelessWidget { @override Widget build(BuildContext context) { final List cardsList = [ - PatientProfileCardModel(TranslationBase.of(context).vital!, TranslationBase.of(context).signs!, VITAL_SIGN_DETAILS, 'patient/vital_signs.png', + PatientProfileCardModel( + TranslationBase.of(context).vital!, + TranslationBase.of(context).signs!, + VITAL_SIGN_DETAILS, + 'patient/vital_signs.png', isInPatient: isInpatient), PatientProfileCardModel( - TranslationBase.of(context).lab!, TranslationBase.of(context).result!, LAB_RESULT, 'patient/lab_results.png', + TranslationBase.of(context).lab!, + TranslationBase.of(context).result!, + LAB_RESULT, + 'patient/lab_results.png', isInPatient: isInpatient), - PatientProfileCardModel(TranslationBase.of(context).lab!, TranslationBase.of(context).special!, - ALL_SPECIAL_LAB_RESULT, 'patient/lab_results.png', + PatientProfileCardModel( + TranslationBase.of(context).lab!, + TranslationBase.of(context).special!, + ALL_SPECIAL_LAB_RESULT, + 'patient/lab_results.png', isInPatient: isInpatient), - PatientProfileCardModel(TranslationBase.of(context).radiology!, TranslationBase.of(context).service!, - RADIOLOGY_PATIENT, 'patient/health_summary.png', + PatientProfileCardModel( + TranslationBase.of(context).radiology!, + TranslationBase.of(context).service!, + RADIOLOGY_PATIENT, + 'patient/health_summary.png', isInPatient: isInpatient), - PatientProfileCardModel(TranslationBase.of(context).orders!, TranslationBase.of(context).prescription!, - ORDER_PRESCRIPTION_NEW, 'patient/order_prescription.png', + PatientProfileCardModel( + TranslationBase.of(context).orders!, + TranslationBase.of(context).prescription!, + ORDER_PRESCRIPTION_NEW, + 'patient/order_prescription.png', isInPatient: isInpatient), - PatientProfileCardModel(TranslationBase.of(context).health!, TranslationBase.of(context).summary!, HEALTH_SUMMARY, + PatientProfileCardModel( + TranslationBase.of(context).health!, + TranslationBase.of(context).summary!, + HEALTH_SUMMARY, 'patient/health_summary.png', isInPatient: isInpatient), - PatientProfileCardModel(TranslationBase.of(context).patient!, "ECG", PATIENT_ECG, 'patient/patient_sick_leave.png', + PatientProfileCardModel(TranslationBase.of(context).patient!, "ECG", + PATIENT_ECG, 'patient/patient_sick_leave.png', isInPatient: isInpatient), - PatientProfileCardModel(TranslationBase.of(context).orders!, TranslationBase.of(context).procedures!, - ORDER_PROCEDURE, 'patient/Order_Procedures.png', + PatientProfileCardModel( + TranslationBase.of(context).orders!, + TranslationBase.of(context).procedures!, + ORDER_PROCEDURE, + 'patient/Order_Procedures.png', isInPatient: isInpatient), - PatientProfileCardModel(TranslationBase.of(context).insurance!, TranslationBase.of(context).service!, - PATIENT_INSURANCE_APPROVALS_NEW, 'patient/vital_signs.png', + PatientProfileCardModel( + TranslationBase.of(context).insurance!, + TranslationBase.of(context).service!, + PATIENT_INSURANCE_APPROVALS_NEW, + 'patient/vital_signs.png', isInPatient: isInpatient), - PatientProfileCardModel(TranslationBase.of(context).patientSick!, TranslationBase.of(context).leave!, ADD_SICKLEAVE, 'patient/patient_sick_leave.png', + PatientProfileCardModel( + TranslationBase.of(context).patientSick!, + TranslationBase.of(context).leave!, + ADD_SICKLEAVE, + 'patient/patient_sick_leave.png', isInPatient: isInpatient), if (patient.appointmentNo != null && patient.appointmentNo != 0) - PatientProfileCardModel(TranslationBase.of(context).patient!, TranslationBase.of(context).ucaf!, - PATIENT_UCAF_REQUEST, 'patient/ucaf.png', - isInPatient: isInpatient, isDisable: patient.patientStatusType != 43 ? true : false), + PatientProfileCardModel( + TranslationBase.of(context).patient!, + TranslationBase.of(context).ucaf!, + PATIENT_UCAF_REQUEST, + 'patient/ucaf.png', + isInPatient: isInpatient, + isDisable: patient.patientStatusType != 43 ? true : false), if (patient.appointmentNo != null && patient.appointmentNo != 0) - PatientProfileCardModel(TranslationBase.of(context).referral!, TranslationBase.of(context).patient!, - REFER_PATIENT_TO_DOCTOR, 'patient/refer_patient.png', - isInPatient: isInpatient, isDisable: patient.patientStatusType != 43 ? true : false), + PatientProfileCardModel( + TranslationBase.of(context).referral!, + TranslationBase.of(context).patient!, + REFER_PATIENT_TO_DOCTOR, + 'patient/refer_patient.png', + isInPatient: isInpatient, + isDisable: patient.patientStatusType != 43 ? true : false), if (patient.appointmentNo != null && patient.appointmentNo != 0) - PatientProfileCardModel(TranslationBase.of(context).admission!, TranslationBase.of(context).request!, - PATIENT_ADMISSION_REQUEST, 'patient/admission_req.png', - isInPatient: isInpatient, isDisable: patient.patientStatusType != 43 ? true : false), + PatientProfileCardModel( + TranslationBase.of(context).admission!, + TranslationBase.of(context).request!, + PATIENT_ADMISSION_REQUEST, + 'patient/admission_req.png', + isInPatient: isInpatient, + isDisable: patient.patientStatusType != 43 ? true : false), ]; return Column( @@ -83,7 +125,8 @@ class ProfileGridForSearch extends StatelessWidget { crossAxisCount: 3, itemCount: cardsList.length, staggeredTileBuilder: (int index) => StaggeredTile.fit(1), - itemBuilder: (BuildContext context, int index) => PatientProfileButton( + itemBuilder: (BuildContext context, int index) => + PatientProfileButton( patient: patient, patientType: patientType, arrivalType: arrivalType, 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 dab0002a..4edb8675 100644 --- a/lib/screens/patients/profile/referral/my-referral-detail-screen.dart +++ b/lib/screens/patients/profile/referral/my-referral-detail-screen.dart @@ -18,7 +18,8 @@ import 'package:flutter/material.dart'; class MyReferralDetailScreen extends StatelessWidget { final MyReferralPatientModel? referralPatient; - const MyReferralDetailScreen({Key? key, this.referralPatient}) : super(key: key); + const MyReferralDetailScreen({Key? key, this.referralPatient}) + : super(key: key); @override Widget build(BuildContext context) { @@ -53,7 +54,9 @@ class MyReferralDetailScreen extends StatelessWidget { ), Expanded( child: AppText( - (Helpers.capitalize(referralPatient!.firstName! + " " + referralPatient!.lastName!)), + (Helpers.capitalize(referralPatient!.firstName! + + " " + + referralPatient!.lastName!)), fontSize: SizeConfig.textMultiplier * 2.5, fontWeight: FontWeight.bold, fontFamily: 'Poppins', @@ -93,23 +96,32 @@ class MyReferralDetailScreen extends StatelessWidget { child: Column( children: [ Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, + mainAxisAlignment: + MainAxisAlignment.spaceBetween, children: [ AppText( referralPatient!.referralStatus != null - ? model.getReferralStatusNameByCode(referralPatient!.referralStatus!, context) + ? model.getReferralStatusNameByCode( + referralPatient!.referralStatus!, + context) : "", fontFamily: 'Poppins', fontSize: 1.9 * SizeConfig.textMultiplier, fontWeight: FontWeight.w700, - color: referralPatient!.referralStatus == 1 + color: referralPatient!.referralStatus == + 1 ? Color(0xffc4aa54) - : referralPatient!.referralStatus == 46 || referralPatient!.referralStatus! == 2 + : referralPatient!.referralStatus == + 46 || + referralPatient! + .referralStatus! == + 2 ? Colors.green[700] : Colors.red[700], ), AppText( - AppDateUtils.getDayMonthYearDateFormatted(referralPatient!.referralDate!), + AppDateUtils.getDayMonthYearDateFormatted( + referralPatient!.referralDate!), fontFamily: 'Poppins', fontWeight: FontWeight.w600, fontSize: 2.0 * SizeConfig.textMultiplier, @@ -118,29 +130,35 @@ class MyReferralDetailScreen extends StatelessWidget { ], ), Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, + mainAxisAlignment: + MainAxisAlignment.spaceBetween, children: [ Row( - mainAxisAlignment: MainAxisAlignment.start, + mainAxisAlignment: + MainAxisAlignment.start, children: [ AppText( - TranslationBase.of(context).fileNumber, + TranslationBase.of(context) + .fileNumber, fontFamily: 'Poppins', fontWeight: FontWeight.w600, - fontSize: 1.7 * SizeConfig.textMultiplier, + fontSize: + 1.7 * SizeConfig.textMultiplier, color: Color(0XFF575757), ), AppText( "${referralPatient!.patientID}", fontFamily: 'Poppins', fontWeight: FontWeight.w700, - fontSize: 1.8 * SizeConfig.textMultiplier, + fontSize: + 1.8 * SizeConfig.textMultiplier, color: Color(0XFF2E303A), ), ], ), AppText( - AppDateUtils.getTimeHHMMA(referralPatient!.referralDate!), + AppDateUtils.getTimeHHMMA( + referralPatient!.referralDate!), fontFamily: 'Poppins', fontWeight: FontWeight.w600, fontSize: 1.8 * SizeConfig.textMultiplier, @@ -149,50 +167,70 @@ class MyReferralDetailScreen extends StatelessWidget { ], ), Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, + mainAxisAlignment: + MainAxisAlignment.spaceBetween, crossAxisAlignment: CrossAxisAlignment.center, children: [ Expanded( child: Column( children: [ Row( - mainAxisAlignment: MainAxisAlignment.start, + mainAxisAlignment: + MainAxisAlignment.start, children: [ AppText( - TranslationBase.of(context).referredFrom, + TranslationBase.of(context) + .referredFrom, fontFamily: 'Poppins', fontWeight: FontWeight.w600, - fontSize: 1.7 * SizeConfig.textMultiplier, + fontSize: 1.7 * + SizeConfig.textMultiplier, color: Color(0XFF575757), ), AppText( - referralPatient!.targetProjectId! == referralPatient!.sourceProjectId! - ? TranslationBase.of(context).sameBranch - : TranslationBase.of(context).otherBranch, + referralPatient! + .targetProjectId! == + referralPatient! + .sourceProjectId! + ? TranslationBase.of( + context) + .sameBranch + : TranslationBase.of( + context) + .otherBranch, fontFamily: 'Poppins', fontWeight: FontWeight.w700, - fontSize: 1.8 * SizeConfig.textMultiplier, + fontSize: 1.8 * + SizeConfig.textMultiplier, color: Color(0XFF2E303A), ), ], ), Row( - mainAxisAlignment: MainAxisAlignment.start, - crossAxisAlignment: CrossAxisAlignment.start, + mainAxisAlignment: + MainAxisAlignment.start, + crossAxisAlignment: + CrossAxisAlignment.start, children: [ AppText( - TranslationBase.of(context).remarks! + " : ", + TranslationBase.of(context) + .remarks! + + " : ", fontFamily: 'Poppins', fontWeight: FontWeight.w600, - fontSize: 1.7 * SizeConfig.textMultiplier, + fontSize: 1.7 * + SizeConfig.textMultiplier, color: Color(0XFF575757), ), Expanded( child: AppText( - referralPatient!.referringDoctorRemarks ?? '', + referralPatient! + .referringDoctorRemarks ?? + '', fontFamily: 'Poppins', fontWeight: FontWeight.w700, - fontSize: 1.8 * SizeConfig.textMultiplier, + fontSize: 1.8 * + SizeConfig.textMultiplier, color: Color(0XFF2E303A), ), ), @@ -204,22 +242,29 @@ class MyReferralDetailScreen extends StatelessWidget { Row( children: [ AppText( - referralPatient!.nationalityName != null + referralPatient!.nationalityName != + null ? referralPatient!.nationalityName : "", fontWeight: FontWeight.bold, color: Color(0xFF2E303A), - fontSize: 1.4 * SizeConfig.textMultiplier, + fontSize: + 1.4 * SizeConfig.textMultiplier, ), - referralPatient!.nationalityFlagURL != null + referralPatient!.nationalityFlagURL != + null ? ClipRRect( - borderRadius: BorderRadius.circular(20.0), + borderRadius: + BorderRadius.circular(20.0), child: Image.network( - referralPatient!.nationalityFlagURL!, + referralPatient! + .nationalityFlagURL!, height: 25, width: 30, - errorBuilder: - (BuildContext ?context, Object ?exception, StackTrace? stackTrace) { + errorBuilder: (BuildContext? + context, + Object? exception, + StackTrace? stackTrace) { return Text('No Image'); }, )) @@ -232,7 +277,8 @@ class MyReferralDetailScreen extends StatelessWidget { crossAxisAlignment: CrossAxisAlignment.start, children: [ Container( - margin: EdgeInsets.only(left: 10, right: 0), + margin: + EdgeInsets.only(left: 10, right: 0), child: Image.asset( 'assets/images/patient/ic_ref_arrow_up.png', height: 50, @@ -240,14 +286,20 @@ class MyReferralDetailScreen extends StatelessWidget { ), ), Container( - margin: EdgeInsets.only(left: 0, top: 25, right: 0, bottom: 0), - padding: EdgeInsets.only(left: 4.0, right: 4.0), + margin: EdgeInsets.only( + left: 0, + top: 25, + right: 0, + bottom: 0), + padding: EdgeInsets.only( + left: 4.0, right: 4.0), child: Container( width: 40, height: 40, child: CircleAvatar( radius: 25.0, - backgroundImage: NetworkImage(referralPatient!.doctorImageURL!), + backgroundImage: NetworkImage( + referralPatient!.doctorImageURL!), backgroundColor: Colors.transparent, ), ), @@ -255,14 +307,19 @@ class MyReferralDetailScreen extends StatelessWidget { Expanded( flex: 4, child: Container( - margin: EdgeInsets.only(left: 10, top: 25, right: 10, bottom: 0), + margin: EdgeInsets.only( + left: 10, + top: 25, + right: 10, + bottom: 0), child: Column( children: [ AppText( referralPatient!.doctorName, fontFamily: 'Poppins', fontWeight: FontWeight.w700, - fontSize: 1.7 * SizeConfig.textMultiplier, + fontSize: 1.7 * + SizeConfig.textMultiplier, color: Color(0XFF2E303A), ), ], @@ -293,7 +350,8 @@ class MyReferralDetailScreen extends StatelessWidget { padding: const EdgeInsets.symmetric(horizontal: 16), child: SizedBox( child: ProfileMedicalInfoWidgetSearch( - patient: model.getPatientFromReferralO(referralPatient!), + patient: model + .getPatientFromReferralO(referralPatient!), patientType: "7", isInpatient: false, from: null, @@ -321,11 +379,14 @@ class MyReferralDetailScreen extends StatelessWidget { vPadding: 12, disabled: model.state == ViewState.Busy, onPressed: () async { - await model.responseReferral(referralPatient!, true); + await model.responseReferral( + referralPatient!, true); if (model.state == ViewState.ErrorLocal) { DrAppToastMsg.showErrorToast(model.error); } else { - DrAppToastMsg.showSuccesToast(TranslationBase.of(context).referralSuccessMsgAccept); + DrAppToastMsg.showSuccesToast( + TranslationBase.of(context) + .referralSuccessMsgAccept); model.getMyReferralOutPatientService(); Navigator.pop(context); Navigator.pop(context); @@ -346,11 +407,14 @@ class MyReferralDetailScreen extends StatelessWidget { vPadding: 12, disabled: model.state == ViewState.Busy, onPressed: () async { - await model.responseReferral(referralPatient!, false); + await model.responseReferral( + referralPatient!, false); if (model.state == ViewState.ErrorLocal) { DrAppToastMsg.showErrorToast(model.error); } else { - DrAppToastMsg.showSuccesToast(TranslationBase.of(context).referralSuccessMsgReject); + DrAppToastMsg.showSuccesToast( + TranslationBase.of(context) + .referralSuccessMsgReject); model.getMyReferralOutPatientService(); Navigator.pop(context); Navigator.pop(context); diff --git a/lib/screens/reschedule-leaves/reschedule_leave.dart b/lib/screens/reschedule-leaves/reschedule_leave.dart index c554e563..f7f2ee31 100644 --- a/lib/screens/reschedule-leaves/reschedule_leave.dart +++ b/lib/screens/reschedule-leaves/reschedule_leave.dart @@ -99,442 +99,607 @@ class _RescheduleLeaveScreen extends State { @override Widget build(BuildContext context) { projectsProvider = Provider.of(context); - offTime = widget.updateData != null ? widget.updateData.requisitionType.toString() : offTime; + offTime = widget.updateData != null + ? widget.updateData.requisitionType.toString() + : offTime; return BaseView( onModelReady: (model) => model.getClinicsList(), builder: (_, model, w) => BaseView( onModelReady: (model2) => { - model2.getOffTime(), - model2.getReasons(offTime == '1' - ? 18 - : offTime == '2' - ? 19 - : 102), - model2.getCoveringDoctors() - }, + model2.getOffTime(), + model2.getReasons(offTime == '1' + ? 18 + : offTime == '2' + ? 19 + : 102), + model2.getCoveringDoctors() + }, builder: (_, model2, w) => GestureDetector( - onTap: () { - FocusScope.of(context).requestFocus(new FocusNode()); - }, - child: AppScaffold( - baseViewModel: model2, - isShowAppBar: true, - appBarTitle: TranslationBase.of(context).rescheduleLeaves!, - body: Center( - child: Container( - margin: EdgeInsets.only(top: 10), - child: FractionallySizedBox( - widthFactor: 0.9, - child: ListView( - children: [ - - Container( - margin: EdgeInsets.all(8), - decoration: BoxDecoration( - borderRadius: BorderRadius.all(Radius.circular(6.0)), - border: Border.all(width: 1.0, color: HexColor("#CCCCCC"))), - width: double.infinity, - child: Padding( - padding: EdgeInsets.only( - top: SizeConfig.widthMultiplier * 0.9, - bottom: SizeConfig.widthMultiplier * 0.9, - right: SizeConfig.widthMultiplier * 3, - left: SizeConfig.widthMultiplier * 3), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Row( - mainAxisSize: MainAxisSize.max, - children: [ - model2.allOffTime.length > 0 - ? Expanded( - // add Expanded to have your dropdown button fill remaining space - child: DropdownButtonHideUnderline( - child: DropdownButton( - // focusColor: Colors.grey, - isExpanded: true, - value: offTime == null ? model2.allOffTime[0]['code'] : offTime, - iconSize: 40, - elevation: 16, - selectedItemBuilder: (BuildContext context) { - return model2.allOffTime.map((item) { - return Row( - mainAxisSize: MainAxisSize.max, - children: [ - AppText( - item['description'], - - fontSize: SizeConfig.textMultiplier * 2.1, - // color: - // Colors.grey, - ), - ], - ); - }).toList(); - }, - onChanged: (newValue) { - setState(() { - offTime = newValue; - }); - if (offTime == '1') { - model2.getReasons(18); - } else if (offTime == '2') { - model2.getReasons(19); - } else if (offTime == '3' || offTime == '5') { - model2.getReasons(102); - setState(() { - offTime = newValue; - }); - } - }, - items: model2.allOffTime.map((item) { - return DropdownMenuItem( - value: item['code'].toString(), - child: Text( - item['description'], - textAlign: TextAlign.end, - ), - ); - }).toList(), - )), - ) - : SizedBox(), - ], - ) - ], - ), - )), - offTime == '1' - ? Column( + onTap: () { + FocusScope.of(context).requestFocus(new FocusNode()); + }, + child: AppScaffold( + baseViewModel: model2, + isShowAppBar: true, + appBarTitle: TranslationBase.of(context).rescheduleLeaves!, + body: Center( + child: Container( + margin: EdgeInsets.only(top: 10), + child: FractionallySizedBox( + widthFactor: 0.9, + child: ListView( children: [ Container( margin: EdgeInsets.all(8), decoration: BoxDecoration( - borderRadius: BorderRadius.all(Radius.circular(6.0)), - border: Border.all(width: 1.0, color: HexColor("#CCCCCC"))), - padding: EdgeInsets.all(5), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - AppTextFormField( - hintText: TranslationBase.of(context).fromDate, - borderColor: Colors.white, - prefix: IconButton(icon: Icon(Icons.calendar_today), onPressed: () { },), - textInputType: TextInputType.number, - controller: _toDateController, - onTap: () { - _presentDatePicker('fromDate'); - }, - inputFormatter: ONLY_DATE, - onChanged: (val) => fromDate = val, - onSaved: (val) => fromDate = val, - ) - ], - )), - Row( - children: [ - Expanded( - child: Container( - margin: EdgeInsets.all(8), - decoration: BoxDecoration( - borderRadius: BorderRadius.all(Radius.circular(6.0)), - border: Border.all(width: 1.0, color: HexColor("#CCCCCC"))), - padding: EdgeInsets.all(5), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - DateTimePicker( - timeHintText: TranslationBase.of(context).fromTime, - type: DateTimePickerType.time, - controller: _controller4, - onChanged: (val) => fromTime = val, - validator: (val) { - print(val); - // setState( - // () => _valueToValidate4 = val); - return null; - }, - onSaved: (val) => fromTime = val!, - ) - ], - ), + borderRadius: BorderRadius.all( + Radius.circular(6.0)), + border: Border.all( + width: 1.0, + color: HexColor("#CCCCCC"))), + width: double.infinity, + child: Padding( + padding: EdgeInsets.only( + top: SizeConfig.widthMultiplier * 0.9, + bottom: + SizeConfig.widthMultiplier * 0.9, + right: SizeConfig.widthMultiplier * 3, + left: SizeConfig.widthMultiplier * 3), + child: Column( + crossAxisAlignment: + CrossAxisAlignment.start, + children: [ + Row( + mainAxisSize: MainAxisSize.max, + children: [ + model2.allOffTime.length > 0 + ? Expanded( + // add Expanded to have your dropdown button fill remaining space + child: + DropdownButtonHideUnderline( + child: + DropdownButton( + // focusColor: Colors.grey, + isExpanded: true, + value: offTime == null + ? model2.allOffTime[0] + ['code'] + : offTime, + iconSize: 40, + elevation: 16, + selectedItemBuilder: + (BuildContext + context) { + return model2.allOffTime + .map((item) { + return Row( + mainAxisSize: + MainAxisSize + .max, + children: [ + AppText( + item[ + 'description'], + + fontSize: SizeConfig + .textMultiplier * + 2.1, + // color: + // Colors.grey, + ), + ], + ); + }).toList(); + }, + onChanged: (newValue) { + setState(() { + offTime = newValue; + }); + if (offTime == '1') { + model2.getReasons(18); + } else if (offTime == + '2') { + model2.getReasons(19); + } else if (offTime == + '3' || + offTime == '5') { + model2 + .getReasons(102); + setState(() { + offTime = newValue; + }); + } + }, + items: model2.allOffTime + .map((item) { + return DropdownMenuItem< + String>( + value: item['code'] + .toString(), + child: Text( + item['description'], + textAlign: + TextAlign.end, + ), + ); + }).toList(), + )), + ) + : SizedBox(), + ], + ) + ], ), - ), - Expanded( - child: Container( - margin: EdgeInsets.all(8), - decoration: BoxDecoration( - borderRadius: BorderRadius.all(Radius.circular(6.0)), - border: Border.all(width: 1.0, color: HexColor("#CCCCCC"))), - padding: EdgeInsets.all(5), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - DateTimePicker( - timeHintText: TranslationBase.of(context).toTime, - type: DateTimePickerType.time, - controller: _controller5, - onChanged: (val) => toTime = val, - validator: (val) { - print(val); - // setState( - // () => _valueToValidate4 = val); - return null; - }, - onSaved: (val) => toTime = val!, - ) - ], - ), + )), + offTime == '1' + ? Column( + children: [ + Container( + margin: EdgeInsets.all(8), + decoration: BoxDecoration( + borderRadius: BorderRadius.all( + Radius.circular(6.0)), + border: Border.all( + width: 1.0, + color: + HexColor("#CCCCCC"))), + padding: EdgeInsets.all(5), + child: Column( + crossAxisAlignment: + CrossAxisAlignment.start, + children: [ + AppTextFormField( + hintText: TranslationBase.of( + context) + .fromDate, + borderColor: Colors.white, + prefix: IconButton( + icon: Icon( + Icons.calendar_today), + onPressed: () {}, + ), + textInputType: + TextInputType.number, + controller: _toDateController, + onTap: () { + _presentDatePicker( + 'fromDate'); + }, + inputFormatter: ONLY_DATE, + onChanged: (val) => + fromDate = val, + onSaved: (val) => + fromDate = val, + ) + ], + )), + Row( + children: [ + Expanded( + child: Container( + margin: EdgeInsets.all(8), + decoration: BoxDecoration( + borderRadius: + BorderRadius.all( + Radius.circular( + 6.0)), + border: Border.all( + width: 1.0, + color: HexColor( + "#CCCCCC"))), + padding: EdgeInsets.all(5), + child: Column( + crossAxisAlignment: + CrossAxisAlignment.start, + children: [ + DateTimePicker( + timeHintText: + TranslationBase.of( + context) + .fromTime, + type: DateTimePickerType + .time, + controller: _controller4, + onChanged: (val) => + fromTime = val, + validator: (val) { + print(val); + // setState( + // () => _valueToValidate4 = val); + return null; + }, + onSaved: (val) => + fromTime = val!, + ) + ], + ), + ), + ), + Expanded( + child: Container( + margin: EdgeInsets.all(8), + decoration: BoxDecoration( + borderRadius: + BorderRadius.all( + Radius.circular( + 6.0)), + border: Border.all( + width: 1.0, + color: HexColor( + "#CCCCCC"))), + padding: EdgeInsets.all(5), + child: Column( + crossAxisAlignment: + CrossAxisAlignment.start, + children: [ + DateTimePicker( + timeHintText: + TranslationBase.of( + context) + .toTime, + type: DateTimePickerType + .time, + controller: _controller5, + onChanged: (val) => + toTime = val, + validator: (val) { + print(val); + // setState( + // () => _valueToValidate4 = val); + return null; + }, + onSaved: (val) => + toTime = val!, + ) + ], + ), + ), + ) + ], + ) + ], + ) + : Column( + children: [ + Container( + margin: EdgeInsets.all(8), + decoration: BoxDecoration( + borderRadius: BorderRadius.all( + Radius.circular(6.0)), + border: Border.all( + width: 1.0, + color: + HexColor("#CCCCCC"))), + padding: EdgeInsets.all(5), + child: Column( + crossAxisAlignment: + CrossAxisAlignment.start, + children: [ + AppTextFormField( + hintText: + TranslationBase.of( + context) + .fromDate, + borderColor: Colors.white, + prefix: IconButton( + icon: Icon( + Icons.calendar_today), + onPressed: () {}, + ), + textInputType: + TextInputType.number, + readOnly: true, + controller: + _toDateController, + onTap: () { + _presentDatePicker( + 'fromDate'); + }, + inputFormatter: ONLY_DATE, + onChanged: (value) { + setState(() { + fromDate = value; + }); + }), + ], + )), + Container( + margin: EdgeInsets.all(8), + decoration: BoxDecoration( + borderRadius: BorderRadius.all( + Radius.circular(6.0)), + border: Border.all( + width: 1.0, + color: + HexColor("#CCCCCC"))), + padding: EdgeInsets.all(5), + child: Column( + crossAxisAlignment: + CrossAxisAlignment.start, + children: [ + AppTextFormField( + hintText: + TranslationBase.of( + context) + .toDate, + readOnly: true, + borderColor: Colors.white, + prefix: IconButton( + icon: Icon( + Icons.calendar_today), + onPressed: () {}, + ), + textInputType: + TextInputType.number, + controller: + _toDateController2, + onTap: () { + _presentDatePicker( + 'toDate'); + }, + inputFormatter: ONLY_DATE, + onChanged: (value) { + setState(() { + toDate = value; + }); + }), + ], + )) + ], ), - ) - ], - ) - ], - ) - : Column( - children: [ Container( margin: EdgeInsets.all(8), decoration: BoxDecoration( - borderRadius: BorderRadius.all(Radius.circular(6.0)), - border: Border.all(width: 1.0, color: HexColor("#CCCCCC"))), - padding: EdgeInsets.all(5), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - AppTextFormField( - hintText: TranslationBase.of(context).fromDate, - borderColor: Colors.white, - prefix: IconButton(icon: Icon(Icons.calendar_today), onPressed: () { },), - textInputType: TextInputType.number, - readOnly: true, - controller: _toDateController, - onTap: () { - _presentDatePicker('fromDate'); - }, - inputFormatter: ONLY_DATE, - onChanged: (value) { - setState(() { - fromDate = value; - }); - }), - ], + borderRadius: BorderRadius.all( + Radius.circular(6.0)), + border: Border.all( + width: 1.0, + color: HexColor("#CCCCCC"))), + width: double.infinity, + child: Padding( + padding: EdgeInsets.only( + top: SizeConfig.widthMultiplier * 0.9, + bottom: + SizeConfig.widthMultiplier * 0.9, + right: SizeConfig.widthMultiplier * 3, + left: SizeConfig.widthMultiplier * 3), + child: Column( + crossAxisAlignment: + CrossAxisAlignment.start, + children: [ + Row( + mainAxisSize: MainAxisSize.max, + children: [ + model2.allReasons.length > 0 + ? Expanded( + // add Expanded to have your dropdown button fill remaining space + child: + DropdownButtonHideUnderline( + child: + DropdownButton( + focusColor: Colors.grey, + isExpanded: true, + value: model2 + .allReasons[0] + ['id'] + .toString() ?? + "", + iconSize: 40, + elevation: 16, + selectedItemBuilder: + (BuildContext + context) { + return model2.allReasons + .map((item) { + return Row( + mainAxisSize: + MainAxisSize + .max, + children: [ + AppText( + projectsProvider + .isArabic + ? item[ + 'nameAr'] + : item[ + 'nameEn'], + fontSize: SizeConfig + .textMultiplier * + 2.1, + // color: + // Colors.grey, + ), + ], + ); + }).toList(); + }, + onChanged: (newValue) => { + setState(() { + reason = newValue; + }) + }, + items: model2.allReasons + .map((item) { + return DropdownMenuItem< + String>( + value: item['id'] + .toString(), + child: Text( + projectsProvider + .isArabic + ? item['nameAr'] + : item[ + 'nameEn'], + textAlign: + TextAlign.end, + ), + ); + }).toList(), + )), + ) + : SizedBox(), + ], + ) + ], + ), )), + Container( margin: EdgeInsets.all(8), decoration: BoxDecoration( - borderRadius: BorderRadius.all(Radius.circular(6.0)), - border: Border.all(width: 1.0, color: HexColor("#CCCCCC"))), - padding: EdgeInsets.all(5), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - AppTextFormField( - hintText: TranslationBase.of(context).toDate, - readOnly: true, - borderColor: Colors.white, - prefix: IconButton(icon: Icon(Icons.calendar_today), onPressed: () { },), - textInputType: TextInputType.number, - controller: _toDateController2, - onTap: () { - _presentDatePicker('toDate'); - }, - inputFormatter: ONLY_DATE, - onChanged: (value) { - setState(() { - toDate = value; - }); - }), - ], - )) - ], - ), - Container( - margin: EdgeInsets.all(8), - decoration: BoxDecoration( - borderRadius: BorderRadius.all(Radius.circular(6.0)), - border: Border.all(width: 1.0, color: HexColor("#CCCCCC"))), - width: double.infinity, - child: Padding( - padding: EdgeInsets.only( - top: SizeConfig.widthMultiplier * 0.9, - bottom: SizeConfig.widthMultiplier * 0.9, - right: SizeConfig.widthMultiplier * 3, - left: SizeConfig.widthMultiplier * 3), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Row( - mainAxisSize: MainAxisSize.max, - children: [ - model2.allReasons.length > 0 - ? Expanded( - // add Expanded to have your dropdown button fill remaining space - child: DropdownButtonHideUnderline( - child: DropdownButton( - focusColor: Colors.grey, - isExpanded: true, - value: model2.allReasons[0]['id'].toString() ?? "", - iconSize: 40, - elevation: 16, - selectedItemBuilder: (BuildContext context) { - return model2.allReasons.map((item) { - return Row( - mainAxisSize: MainAxisSize.max, - children: [ - AppText( - projectsProvider.isArabic - ? item['nameAr'] - : item['nameEn'], - fontSize: SizeConfig.textMultiplier * 2.1, - // color: - // Colors.grey, + borderRadius: BorderRadius.all( + Radius.circular(6.0)), + border: Border.all( + width: 1.0, + color: HexColor("#CCCCCC"))), + width: double.infinity, + child: Padding( + padding: EdgeInsets.only( + top: SizeConfig.widthMultiplier * 0.9, + bottom: + SizeConfig.widthMultiplier * 0.9, + right: SizeConfig.widthMultiplier * 3, + left: SizeConfig.widthMultiplier * 3), + child: Column( + crossAxisAlignment: + CrossAxisAlignment.start, + children: [ + Row( + mainAxisSize: MainAxisSize.max, + children: [ + if (model2.coveringDoctors.length > + 0) + Expanded( + // add Expanded to have your dropdown button fill remaining space + child: DropdownSearch( + mode: Mode.BOTTOM_SHEET, + + dropdownSearchDecoration: + InputDecoration( + contentPadding: + EdgeInsets.all(0), + border: + InputBorder.none), + //maxHeight: 300, + items: model2.coveringDoctors + .map((item) { + return projectsProvider + .isArabic + ? item['doctorNameN'] + : item['doctorName']; + }).toList(), + // label: "Doctor List", + onChanged: (item) { + model2.coveringDoctors + .forEach((newVal) => { + if (newVal[ + 'doctorName'] == + item) + doctorID = newVal[ + 'DoctorID'] + }); + }, + selectedItem: + getSelectedDoctor(model2), + showSearchBox: true, + searchBoxDecoration: + InputDecoration( + border: + OutlineInputBorder(), + contentPadding: + EdgeInsets.fromLTRB( + 12, 12, 8, 0), + labelText: "Search Doctor", + ), + popupTitle: Container( + height: 50, + decoration: BoxDecoration( + color: Theme.of(context) + .primaryColorDark, + borderRadius: + BorderRadius.only( + topLeft: + Radius.circular(20), + topRight: + Radius.circular(20), + ), + ), + child: Center( + child: Text( + '', + style: TextStyle( + fontSize: 24, + fontWeight: + FontWeight.bold, + color: Colors.white, ), - ], - ); - }).toList(); - }, - onChanged: (newValue) => { - setState(() { - reason = newValue; - }) - }, - items: model2.allReasons.map((item) { - return DropdownMenuItem( - value: item['id'].toString(), - child: Text( - projectsProvider.isArabic ? item['nameAr'] : item['nameEn'], - textAlign: TextAlign.end, + ), + ), + ), + popupShape: + RoundedRectangleBorder( + borderRadius: + BorderRadius.only( + topLeft: + Radius.circular(24), + topRight: + Radius.circular(24), ), - ); - }).toList(), - )), - ) - : SizedBox(), - ], - ) - ], - ), - )), - - Container( - margin: EdgeInsets.all(8), - decoration: BoxDecoration( - borderRadius: BorderRadius.all(Radius.circular(6.0)), - border: Border.all(width: 1.0, color: HexColor("#CCCCCC"))), - width: double.infinity, - child: Padding( - padding: EdgeInsets.only( - top: SizeConfig.widthMultiplier * 0.9, - bottom: SizeConfig.widthMultiplier * 0.9, - right: SizeConfig.widthMultiplier * 3, - left: SizeConfig.widthMultiplier * 3), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Row( - mainAxisSize: MainAxisSize.max, - children: [ - if (model2.coveringDoctors.length > 0) Expanded( - // add Expanded to have your dropdown button fill remaining space - child: DropdownSearch( - mode: Mode.BOTTOM_SHEET, - - dropdownSearchDecoration: InputDecoration( - contentPadding: EdgeInsets.all(0), border: InputBorder.none), - //maxHeight: 300, - items: model2.coveringDoctors.map((item) { - return projectsProvider.isArabic - ? item['doctorNameN'] - : item['doctorName']; - }).toList(), - // label: "Doctor List", - onChanged: (item) { - model2.coveringDoctors.forEach((newVal) => { - if (newVal['doctorName'] == item) - doctorID = newVal['DoctorID'] - }); - }, - selectedItem: getSelectedDoctor(model2), - showSearchBox: true, - searchBoxDecoration: InputDecoration( - border: OutlineInputBorder(), - contentPadding: EdgeInsets.fromLTRB(12, 12, 8, 0), - labelText: "Search Doctor", - ), - popupTitle: Container( - height: 50, - decoration: BoxDecoration( - color: Theme.of(context).primaryColorDark, - borderRadius: BorderRadius.only( - topLeft: Radius.circular(20), - topRight: Radius.circular(20), - ), - ), - child: Center( - child: Text( - '', - style: TextStyle( - fontSize: 24, - fontWeight: FontWeight.bold, - color: Colors.white, ), ), - ), - ), - popupShape: RoundedRectangleBorder( - borderRadius: BorderRadius.only( - topLeft: Radius.circular(24), - topRight: Radius.circular(24), - ), - ), - ), - ) else SizedBox(), + ) + else + SizedBox(), + ], + ) ], - ) + ), + )), + SizedBox(height: SizeConfig.screenHeight * .3), + Container( + margin: EdgeInsets.all( + SizeConfig.widthMultiplier * 5), + child: Wrap( + alignment: WrapAlignment.center, + children: [ + AppButton( + title: widget.isUpdate == true + ? TranslationBase.of(context) + .updateReschedule + : TranslationBase.of(context) + .addReschedule, + color: HexColor('#359846'), + onPressed: () { + if (offTime == '1' || offTime == '2') { + if (widget.isUpdate == true) { + updateRecheduleLeave(model2); + } else { + addRecheduleLeave(model2); + } + } else { + DrAppToastMsg.showErrorToast( + TranslationBase.of(context) + .onlyOfftimeHoliday); + } + }, + ), ], ), - )), - SizedBox(height: SizeConfig.screenHeight * .3), - Container( - margin: EdgeInsets.all(SizeConfig.widthMultiplier * 5), - child: Wrap( - alignment: WrapAlignment.center, - children: [ - AppButton( - title: widget.isUpdate == true - ? TranslationBase.of(context).updateReschedule - : TranslationBase.of(context).addReschedule, - color: HexColor('#359846'), - onPressed: () { - if (offTime == '1' || offTime == '2') { - if (widget.isUpdate == true) { - updateRecheduleLeave(model2); - } else { - addRecheduleLeave(model2); - } - } else { - DrAppToastMsg.showErrorToast(TranslationBase.of(context).onlyOfftimeHoliday); - } - }, - ), - ], - ), + ), + // Column( + // children: [ + // AppText(TranslationBase.of(context) + // .previousSickLeaveIssue + + // ' ') + // ], + // ) + ], ), - // Column( - // children: [ - // AppText(TranslationBase.of(context) - // .previousSickLeaveIssue + - // ' ') - // ], - // ) - ], + ), ), ), ), - ), - ), - ))); + ))); } getProfile() async { @@ -547,13 +712,16 @@ class _RescheduleLeaveScreen extends State { final df = new DateFormat('HH:mm:ss'); final dateFormat = new DateFormat('yyyy-MM-dd'); this.offTime = widget.updateData.requisitionType.toString(); - _toDateController.text = dateFormat.format(DateTime.parse(widget.updateData.dateTimeFrom)); + _toDateController.text = + dateFormat.format(DateTime.parse(widget.updateData.dateTimeFrom)); //df.format(DateTime.parse(widget.updateData.dateTimeFrom)); - this.fromTime = df.format(DateTime.parse(widget.updateData.dateTimeFrom)); + this.fromTime = + df.format(DateTime.parse(widget.updateData.dateTimeFrom)); this.fromTime = this.fromTime.substring(0, this.fromTime.length - 3); this.toTime = df.format(DateTime.parse(widget.updateData.dateTimeTo)); this.toTime = this.toTime.substring(0, this.toTime.length - 3); - _toDateController2.text = dateFormat.format(DateTime.parse(widget.updateData.dateTimeTo)); + _toDateController2.text = + dateFormat.format(DateTime.parse(widget.updateData.dateTimeTo)); _controller5.text = toTime; _controller4.text = fromTime; toDate = _toDateController2.text; @@ -566,7 +734,8 @@ class _RescheduleLeaveScreen extends State { getClinicName(model) { var clinicID = this.profile['ClinicID'] ?? 1; - var clinicInfo = model.clinicsList.where((i) => i['ClinicID'] == clinicID).toList(); + var clinicInfo = + model.clinicsList.where((i) => i['ClinicID'] == clinicID).toList(); return clinicInfo.length > 0 ? clinicInfo[0]['ClinicDescription'] : ""; } @@ -576,10 +745,16 @@ class _RescheduleLeaveScreen extends State { var fromDates = fromDate; var toDates = toDate; if (offTime == '1') { - fromDate = df.format( - DateTime.parse(dateFormat.format(fromDates) + 'T' + fromTime + ':' + DateTime.now().second.toString())); - toDate = df - .format(DateTime.parse(dateFormat.format(fromDates) + 'T' + toTime + ':' + DateTime.now().second.toString())); + fromDate = df.format(DateTime.parse(dateFormat.format(fromDates) + + 'T' + + fromTime + + ':' + + DateTime.now().second.toString())); + toDate = df.format(DateTime.parse(dateFormat.format(fromDates) + + 'T' + + toTime + + ':' + + DateTime.now().second.toString())); } else { fromDate = df.format(fromDates); toDate = df.format(toDates); @@ -594,7 +769,8 @@ class _RescheduleLeaveScreen extends State { "dateTimeTo": toDate, "date": offTime == '1' ? fromDate : df.format(DateTime.now()), "reasonId": reason == null ? model.allOffTime[0]['code'] : reason, - "coveringDoctorId": doctorID == null ? model.coveringDoctors[0]['doctorID'] : doctorID, + "coveringDoctorId": + doctorID == null ? model.coveringDoctors[0]['doctorID'] : doctorID, "status": 2, "schedule": [ { @@ -617,9 +793,10 @@ class _RescheduleLeaveScreen extends State { Navigator.push( context, MaterialPageRoute( - builder: (context) => AddRescheduleLeavScreen(), settings: RouteSettings(name: 'AddRescheduleLeaveScreen') - // MyReferredPatient(), - ), + builder: (context) => AddRescheduleLeavScreen(), + settings: RouteSettings(name: 'AddRescheduleLeaveScreen') + // MyReferredPatient(), + ), ); } }); @@ -632,13 +809,21 @@ class _RescheduleLeaveScreen extends State { dynamic fromDates = fromDate; dynamic toDates = toDate; if (offTime == '1') { - fromDate = - df.format(DateTime.parse(_toDateController.text)) + 'T' + fromTime + ':' + DateTime.now().second.toString(); - toDate = - df.format(DateTime.parse(_toDateController2.text)) + 'T' + toTime + ':' + DateTime.now().second.toString(); + fromDate = df.format(DateTime.parse(_toDateController.text)) + + 'T' + + fromTime + + ':' + + DateTime.now().second.toString(); + toDate = df.format(DateTime.parse(_toDateController2.text)) + + 'T' + + toTime + + ':' + + DateTime.now().second.toString(); } else { - fromDate = df.format(fromDates is DateTime ? fromDates : DateTime.parse(fromDates)); - toDate = df.format(toDates is DateTime ? toDates : DateTime.parse(toDates)); + fromDate = df.format( + fromDates is DateTime ? fromDates : DateTime.parse(fromDates)); + toDate = + df.format(toDates is DateTime ? toDates : DateTime.parse(toDates)); } Map request = { @@ -651,7 +836,8 @@ class _RescheduleLeaveScreen extends State { "dateTimeTo": toDate, "date": offTime == '1' ? fromDate : df.format(DateTime.now()), "reasonId": reason == null ? model.allOffTime[0]['code'] : reason, - "coveringDoctorId": doctorID == null ? model.coveringDoctors[0]['doctorID'] : doctorID, + "coveringDoctorId": + doctorID == null ? model.coveringDoctors[0]['doctorID'] : doctorID, "status": 2, "schedule": [ { @@ -689,8 +875,9 @@ class _RescheduleLeaveScreen extends State { : model2.coveringDoctors[0]['doctorName']; else { model2.coveringDoctors.forEach((newVal) => { - if (newVal['doctorID'].toString() == doctorID) {doctorName = newVal['doctorName']} - }); + if (newVal['doctorID'].toString() == doctorID) + {doctorName = newVal['doctorName']} + }); return doctorName; } } diff --git a/pubspec.lock b/pubspec.lock index 972d2116..764ad2dd 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -35,7 +35,7 @@ packages: name: async url: "https://pub.dartlang.org" source: hosted - version: "2.8.1" + version: "2.8.2" autocomplete_textfield: dependency: "direct main" description: @@ -154,7 +154,7 @@ packages: name: characters url: "https://pub.dartlang.org" source: hosted - version: "1.1.0" + version: "1.2.0" charcode: dependency: transitive description: @@ -769,7 +769,7 @@ packages: name: matcher url: "https://pub.dartlang.org" source: hosted - version: "0.12.10" + version: "0.12.11" meta: dependency: transitive description: @@ -1173,7 +1173,7 @@ packages: name: test_api url: "https://pub.dartlang.org" source: hosted - version: "0.4.2" + version: "0.4.3" timing: dependency: transitive description: @@ -1257,7 +1257,7 @@ packages: name: vector_math url: "https://pub.dartlang.org" source: hosted - version: "2.1.0" + version: "2.1.1" video_player: dependency: transitive description: