diff --git a/lib/core/viewModel/PatientRegistrationViewModel.dart b/lib/core/viewModel/PatientRegistrationViewModel.dart index 692313eb..a60d1ed2 100644 --- a/lib/core/viewModel/PatientRegistrationViewModel.dart +++ b/lib/core/viewModel/PatientRegistrationViewModel.dart @@ -142,10 +142,8 @@ class PatientRegistrationViewModel extends BaseViewModel { } Future sendActivationCodeByOTPNotificationType( - {SendActivationCodeByOTPNotificationTypeForRegistrationModel? - registrationModel, - required int otpType, - PatientRegistrationViewModel? user}) async { + { + required int otpType}) async { setState(ViewState.BusyLocal); print(checkPatientForRegistrationModel); print(checkPatientForRegistrationModel); @@ -183,7 +181,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/models/SOAP/selected_items/my_selected_examination.dart b/lib/models/SOAP/selected_items/my_selected_examination.dart index 75f67ae2..8c2f375b 100644 --- a/lib/models/SOAP/selected_items/my_selected_examination.dart +++ b/lib/models/SOAP/selected_items/my_selected_examination.dart @@ -1,16 +1,16 @@ import 'package:doctor_app_flutter/models/SOAP/master_key_model.dart'; class MySelectedExamination { - MasterKeyModel selectedExamination; - String remark; + MasterKeyModel? selectedExamination; + String? remark; bool isNormal; bool isAbnormal; bool notExamined; bool isNew; bool isLocal; - int createdBy; - String createdOn; - String editedOn; + int? createdBy; + String? createdOn; + String? editedOn; MySelectedExamination({ this.selectedExamination, diff --git a/lib/models/SOAP/selected_items/my_selected_history.dart b/lib/models/SOAP/selected_items/my_selected_history.dart index 177fb46e..814027c9 100644 --- a/lib/models/SOAP/selected_items/my_selected_history.dart +++ b/lib/models/SOAP/selected_items/my_selected_history.dart @@ -1,8 +1,8 @@ import 'package:doctor_app_flutter/models/SOAP/master_key_model.dart'; class MySelectedHistory { - MasterKeyModel selectedHistory; - String remark; + MasterKeyModel? selectedHistory; + String? remark; bool? isChecked; bool? isLocal; diff --git a/lib/screens/patients/DischargedPatientPage.dart b/lib/screens/patients/DischargedPatientPage.dart index 56e0d9b0..a8df56a3 100644 --- a/lib/screens/patients/DischargedPatientPage.dart +++ b/lib/screens/patients/DischargedPatientPage.dart @@ -74,7 +74,7 @@ class _DischargedPatientState extends State { DoctorApp.filter_1, color: Colors.black, ), - iconSize: 20, + iconSize: 20, onPressed: () { }, ), ), SizedBox( @@ -209,8 +209,8 @@ class _DischargedPatientState extends State { 25, width: 30, - errorBuilder: (BuildContext context, - Object + errorBuilder: (BuildContext? context, + Object? exception, StackTrace? stackTrace) { diff --git a/lib/screens/patients/profile/pending_orders/pending_orders_screen.dart b/lib/screens/patients/profile/pending_orders/pending_orders_screen.dart index c69f3868..6fc9fb4f 100644 --- a/lib/screens/patients/profile/pending_orders/pending_orders_screen.dart +++ b/lib/screens/patients/profile/pending_orders/pending_orders_screen.dart @@ -9,88 +9,85 @@ import 'package:doctor_app_flutter/widgets/shared/errors/dr_app_embedded_error.d import 'package:flutter/material.dart'; class PendingOrdersScreen extends StatelessWidget { - const PendingOrdersScreen({Key key}) : super(key: key); + const PendingOrdersScreen({Key? key}) : super(key: key); @override Widget build(BuildContext context) { - final routeArgs = ModalRoute.of(context).settings.arguments as Map; + final routeArgs = ModalRoute.of(context)!.settings.arguments as Map; PatiantInformtion patient = routeArgs['patient']; patient = routeArgs['patient']; String patientType = routeArgs['patientType']; bool isInpatient = routeArgs['isInpatient']; + return BaseView( - onModelReady: (model) => model.getPendingOrders( - patientId: patient.patientMRN, - admissionNo: int.parse(patient.admissionNo)), - builder: - (BuildContext context, PendingOrdersViewModel model, Widget child) => - AppScaffold( - appBar: PatientProfileAppBar( - patient, - isInpatient: isInpatient, - ), - isShowAppBar: true, - baseViewModel: model, - appBarTitle: "Pending Orders", - body: model.pendingOrdersList == null || + onModelReady: (model) async {}, + builder: (_, model, w) => AppScaffold( + appBar: PatientProfileAppBar( + patient, + isInpatient: isInpatient, + ), + isShowAppBar: true, + baseViewModel: model, + appBarTitle: "Pending Orders", + body: model.pendingOrdersList == null || model.pendingOrdersList.length == 0 - ? DrAppEmbeddedError( - error: TranslationBase.of(context).noDataAvailable) - : Column( - children: [ - Padding( - padding: const EdgeInsets.all(8.0), - child: Column( - children: [ - Row( - children: [ - AppText( - TranslationBase.of(context).pending, - fontSize: 15.0, - fontWeight: FontWeight.w600, - fontFamily: 'Poppins', - ), - ], - ), - Row( - children: [ - AppText( - TranslationBase.of(context).orders, - fontSize: 25.0, - fontWeight: FontWeight.w700, - ), - ], - ), - ], + ? DrAppEmbeddedError( + error: TranslationBase.of(context).noDataAvailable!) + : Column( + children: [ + Padding( + padding: const EdgeInsets.all(8.0), + child: Column( + children: [ + Row( + children: [ + AppText( + TranslationBase.of(context).pending, + fontSize: 15.0, + fontWeight: FontWeight.w600, + fontFamily: 'Poppins', + ), + ], + ), + Row( + children: [ + AppText( + TranslationBase.of(context).orders, + fontSize: 25.0, + fontWeight: FontWeight.w700, + ), + ], + ), + ], + ), ), - ), - Container( - child: ListView.builder( - scrollDirection: Axis.vertical, - shrinkWrap: true, - itemCount: model.pendingOrdersList.length, - itemBuilder: (BuildContext ctxt, int index) { - return Padding( - padding: EdgeInsets.all(8.0), - child: Container( - decoration: BoxDecoration( - borderRadius: BorderRadius.all( - Radius.circular(10.0), + Container( + child: ListView.builder( + scrollDirection: Axis.vertical, + shrinkWrap: true, + itemCount: model.pendingOrdersList.length, + itemBuilder: (BuildContext ctxt, int index) { + return Padding( + padding: EdgeInsets.all(8.0), + child: Container( + decoration: BoxDecoration( + borderRadius: BorderRadius.all( + Radius.circular(10.0), + ), + border: Border.all( + color: Color(0xFF707070), width: 0.30), + ), + child: Padding( + padding: EdgeInsets.all(8.0), + child: AppText( + model.pendingOrdersList[index].notes), ), - border: Border.all( - color: Color(0xFF707070), width: 0.30), - ), - child: Padding( - padding: EdgeInsets.all(8.0), - child: AppText( - model.pendingOrdersList[index].notes), ), - ), - ); - })), - ], - ), - ), + ); + })), + ], + ), + ), ); } } diff --git a/lib/screens/patients/profile/profile_screen/patient_profile_screen.dart b/lib/screens/patients/profile/profile_screen/patient_profile_screen.dart index 2aa9e669..ffea7c78 100644 --- a/lib/screens/patients/profile/profile_screen/patient_profile_screen.dart +++ b/lib/screens/patients/profile/profile_screen/patient_profile_screen.dart @@ -70,7 +70,7 @@ class _PatientProfileScreenState extends State with Single _tabController.dispose(); super.dispose(); if (isFromLiveCare) { - _liveCareViewModel.removePatientFromDoctorList(patient.vcId); + _liveCareViewModel.removePatientFromDoctorList(patient.vcId!); } } @@ -139,7 +139,7 @@ class _PatientProfileScreenState extends State with Single return BaseView( onModelReady: (model) async { if (isFromLiveCare && patient.patientStatus == 1) - await model.addPatientToDoctorList(patient.vcId); + await model.addPatientToDoctorList(patient!.vcId!); },builder: (_, model, w) => AppScaffold( baseViewModel: model,isLoading: true, appBarTitle: TranslationBase.of(context).patientProfile ?? "", @@ -151,6 +151,7 @@ class _PatientProfileScreenState extends State with Single Column( children: [ PatientProfileAppBar( + patient, patientProfileAppBarModel: PatientProfileAppBarModel( patient: patient, videoCallDurationStream: videoCallDurationStream, @@ -364,7 +365,7 @@ class _PatientProfileScreenState extends State with Single } else { GifLoaderDialogUtils.showMyDialog(context); await model.startCall( - isReCall: false, vCID: patient.vcId); + isReCall: false, vCID: patient.vcId!); if (model.state == ViewState.ErrorLocal) { GifLoaderDialogUtils.hideDialog(context); @@ -398,7 +399,7 @@ class _PatientProfileScreenState extends State with Single : true, callConnected, callDisconnected); - }); + }, type: ''); } } }, @@ -417,16 +418,16 @@ class _PatientProfileScreenState extends State with Single ); } - createEpisode({PatiantInformtion patient, SOAPViewModel model}) async { + createEpisode({required PatiantInformtion patient, required SOAPViewModel model}) async { await locator().logEvent( eventCategory: "Patient Profile", eventAction: "Create Episode", ); GifLoaderDialogUtils.showMyDialog(context); - if (patient.admissionNo != null && patient.admissionNo.isNotEmpty) { + if (patient.admissionNo != null && patient.admissionNo!.isNotEmpty) { PostEpisodeForInpatientRequestModel postEpisodeReqModel = PostEpisodeForInpatientRequestModel( - admissionNo: int.parse(patient.admissionNo), + admissionNo: int.parse(patient!.admissionNo!), patientID: patient.patientId); await model.postEpisodeForInPatient(postEpisodeReqModel); } else { 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 22a5f23b..6f1b57d8 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,77 +33,41 @@ 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!, @@ -112,21 +76,15 @@ 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( @@ -141,23 +99,22 @@ 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 209062eb..3dc919d1 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,87 +30,45 @@ 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( @@ -125,8 +83,7 @@ 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 268e0379..dab0002a 100644 --- a/lib/screens/patients/profile/referral/my-referral-detail-screen.dart +++ b/lib/screens/patients/profile/referral/my-referral-detail-screen.dart @@ -16,10 +16,9 @@ import 'package:flutter/material.dart'; // ignore: must_be_immutable class MyReferralDetailScreen extends StatelessWidget { - final MyReferralPatientModel referralPatient; + final MyReferralPatientModel? referralPatient; - const MyReferralDetailScreen({Key? key, required this.referralPatient}) - : super(key: key); + const MyReferralDetailScreen({Key? key, this.referralPatient}) : super(key: key); @override Widget build(BuildContext context) { @@ -54,15 +53,13 @@ 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', ), ), - referralPatient.gender == 1 + referralPatient!.gender! == 1 ? Icon( DoctorApp.male_2, color: Colors.blue, @@ -82,7 +79,7 @@ class MyReferralDetailScreen extends StatelessWidget { width: 60, height: 60, child: Image.asset( - referralPatient.gender == 1 + referralPatient!.gender == 1 ? 'assets/images/male_avatar.png' : 'assets/images/female_avatar.png', fit: BoxFit.cover, @@ -96,31 +93,23 @@ class MyReferralDetailScreen extends StatelessWidget { child: Column( children: [ Row( - mainAxisAlignment: - MainAxisAlignment.spaceBetween, + mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ AppText( - referralPatient.referralStatus != null - ? model.getReferralStatusNameByCode( - referralPatient.referralStatus!, - context) + referralPatient!.referralStatus != null + ? 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, @@ -129,35 +118,29 @@ 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}", + "${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, @@ -166,70 +149,50 @@ 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), ), ), @@ -241,29 +204,22 @@ class MyReferralDetailScreen extends StatelessWidget { Row( children: [ AppText( - referralPatient.nationalityName != - null - ? referralPatient.nationalityName + 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'); }, )) @@ -276,8 +232,7 @@ 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, @@ -285,20 +240,14 @@ 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, ), ), @@ -306,19 +255,14 @@ 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, + referralPatient!.doctorName, fontFamily: 'Poppins', fontWeight: FontWeight.w700, - fontSize: 1.7 * - SizeConfig.textMultiplier, + fontSize: 1.7 * SizeConfig.textMultiplier, color: Color(0XFF2E303A), ), ], @@ -349,12 +293,11 @@ 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: "", - to: "", + from: null, + to: null, ), ), ), @@ -363,7 +306,7 @@ class MyReferralDetailScreen extends StatelessWidget { ), ), ), - if (referralPatient.referralStatus == 1) + if (referralPatient!.referralStatus == 1) Container( margin: EdgeInsets.symmetric(horizontal: 16, vertical: 16), child: Row( @@ -378,13 +321,11 @@ 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); @@ -405,14 +346,11 @@ 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/soap_update/assessment/add_assessment_details.dart b/lib/screens/patients/profile/soap_update/assessment/add_assessment_details.dart index 17b8740c..afe7cb62 100644 --- a/lib/screens/patients/profile/soap_update/assessment/add_assessment_details.dart +++ b/lib/screens/patients/profile/soap_update/assessment/add_assessment_details.dart @@ -115,7 +115,7 @@ class _AddAssessmentDetailsState extends State { baseViewModel: model, isShowAppBar: true, appBar: BottomSheetTitle( - title: TranslationBase.of(context).addAssessmentDetails), + title: TranslationBase.of(context).addAssessmentDetails!), backgroundColor: Theme.of(context).scaffoldBackgroundColor, body: SingleChildScrollView( child: Center( @@ -210,9 +210,9 @@ class _AddAssessmentDetailsState extends State { .width * 0.7, child: AppText( widget.mySelectedAssessment - .selectedICD.description + + .selectedICD!.description! + (' (${widget.mySelectedAssessment - .selectedICD.code} )'), + .selectedICD!.code!} )'), color: Color(0xFF575757), fontSize: 10, fontWeight: FontWeight.w700, diff --git a/lib/screens/patients/profile/soap_update/assessment/update_assessment_page.dart b/lib/screens/patients/profile/soap_update/assessment/update_assessment_page.dart index f42289f9..e2cf91cf 100644 --- a/lib/screens/patients/profile/soap_update/assessment/update_assessment_page.dart +++ b/lib/screens/patients/profile/soap_update/assessment/update_assessment_page.dart @@ -165,7 +165,7 @@ class _UpdateAssessmentPageState extends State ), new TextSpan( text: assessment - .selectedICD.code + .selectedICD!.code .trim() .toUpperCase() ?? ""), @@ -191,7 +191,7 @@ class _UpdateAssessmentPageState extends State children: [ new TextSpan( text: assessment - .selectedICD.description + .selectedICD!.description .toString(), ), ], @@ -249,7 +249,7 @@ class _UpdateAssessmentPageState extends State new TextSpan( text: TranslationBase.of( context) - .condition + + .condition! + " : ", style: new TextStyle( letterSpacing: -0.4, @@ -260,11 +260,11 @@ class _UpdateAssessmentPageState extends State text: projectViewModel .isArabic ? assessment - .selectedDiagnosisCondition - .nameAr + .selectedDiagnosisCondition! + .nameAr! : assessment - .selectedDiagnosisCondition - .nameEn, + .selectedDiagnosisCondition! + .nameEn!, style: new TextStyle( fontSize: SizeConfig .getTextMultiplierBasedOnWidth() * @@ -289,7 +289,7 @@ class _UpdateAssessmentPageState extends State new TextSpan( text: TranslationBase.of( context) - .dType + + .dType! + ' : ', style: new TextStyle( letterSpacing: -0.4, @@ -300,10 +300,10 @@ class _UpdateAssessmentPageState extends State text: projectViewModel .isArabic ? assessment - .selectedDiagnosisType + .selectedDiagnosisType! .nameAr : assessment - .selectedDiagnosisType + .selectedDiagnosisType! .nameEn, style: new TextStyle( fontSize: SizeConfig @@ -331,7 +331,7 @@ class _UpdateAssessmentPageState extends State new TextSpan( text: TranslationBase.of( context) - .doctor + + .doctor! + ' : ', style: new TextStyle( fontSize: SizeConfig @@ -374,7 +374,7 @@ class _UpdateAssessmentPageState extends State '') ? TranslationBase.of( context) - .remarks + + .remarks! + " : " : '', fontSize: SizeConfig @@ -405,8 +405,8 @@ class _UpdateAssessmentPageState extends State ? AppDateUtils .getDayMonthYearDateFormatted( DateTime.parse( - assessment - .createdOn)) + assessment! + .createdOn!)) : AppDateUtils .getDayMonthYearDateFormatted( DateTime.now()), @@ -419,8 +419,8 @@ class _UpdateAssessmentPageState extends State assessment.createdOn != null ? AppDateUtils.getHour( DateTime.parse( - assessment - .createdOn)) + assessment! + .createdOn!)) : AppDateUtils.getHour( DateTime.now()), fontWeight: FontWeight.w600, diff --git a/lib/screens/patients/profile/soap_update/objective/add_examination_page.dart b/lib/screens/patients/profile/soap_update/objective/add_examination_page.dart index 3f55b8f4..8593dbb9 100644 --- a/lib/screens/patients/profile/soap_update/objective/add_examination_page.dart +++ b/lib/screens/patients/profile/soap_update/objective/add_examination_page.dart @@ -25,7 +25,7 @@ class AddExaminationPage extends StatefulWidget { } class _AddExaminationPageState extends State { - List mySelectedExaminationLocal; + late List mySelectedExaminationLocal; @override initState() { diff --git a/lib/screens/patients/profile/soap_update/objective/add_examination_widget.dart b/lib/screens/patients/profile/soap_update/objective/add_examination_widget.dart index e6df38e7..1f5232f7 100644 --- a/lib/screens/patients/profile/soap_update/objective/add_examination_widget.dart +++ b/lib/screens/patients/profile/soap_update/objective/add_examination_widget.dart @@ -20,7 +20,7 @@ class AddExaminationWidget extends StatefulWidget { final bool Function(MasterKeyModel) isServiceSelected; bool isExpand; final VoidCallback expandClick; - final List mySelectedExamination; + final List? mySelectedExamination; AddExaminationWidget({ required this.item, @@ -44,13 +44,13 @@ class _AddExaminationWidgetState extends State { @override void initState() { if (getSelectedExam(widget.item) != null) { - examination = getSelectedExam(widget.item); + examination = getSelectedExam(widget.item)!; status = examination.isNormal ? 1 : examination.isAbnormal ? 2 : 3; - remarksController.text = examination.remark; + remarksController.text = examination!.remark!; } else { examination.selectedExamination = widget.item; } @@ -75,7 +75,7 @@ class _AddExaminationWidgetState extends State { Checkbox( value:widget.isServiceSelected(widget.item), activeColor: Colors.red[800], - onChanged: (bool newValue) { + onChanged: (bool ?newValue) { onExamTap(); }), Container( @@ -274,11 +274,11 @@ class _AddExaminationWidgetState extends State { }); } - MySelectedExamination getSelectedExam(MasterKeyModel masterKey) { - Iterable exam = widget.mySelectedExamination.where( + MySelectedExamination? getSelectedExam(MasterKeyModel masterKey) { + Iterable exam = widget.mySelectedExamination!.where( (element) => - masterKey.id == element.selectedExamination.id && - masterKey.typeId == element.selectedExamination.typeId); + masterKey.id == element.selectedExamination!.id && + masterKey.typeId == element.selectedExamination!.typeId); if (exam.length > 0) { return exam.first; } diff --git a/lib/screens/patients/profile/soap_update/objective/examination_item_card.dart b/lib/screens/patients/profile/soap_update/objective/examination_item_card.dart index 7ad9dedd..592478f7 100644 --- a/lib/screens/patients/profile/soap_update/objective/examination_item_card.dart +++ b/lib/screens/patients/profile/soap_update/objective/examination_item_card.dart @@ -73,7 +73,7 @@ class ExaminationItemCard extends StatelessWidget { SizedBox( height: 4, ), - if (examination.remark.isNotEmpty) + if (examination.remark!.isNotEmpty) RemarkText(remark: examination.remark), ], ), diff --git a/lib/screens/patients/profile/soap_update/objective/examinations_list_search_widget.dart b/lib/screens/patients/profile/soap_update/objective/examinations_list_search_widget.dart index c89b30d3..480826ce 100644 --- a/lib/screens/patients/profile/soap_update/objective/examinations_list_search_widget.dart +++ b/lib/screens/patients/profile/soap_update/objective/examinations_list_search_widget.dart @@ -19,7 +19,7 @@ class ExaminationsListSearchWidget extends StatefulWidget { {required this.removeExamination, required this.addExamination, required this.isServiceSelected, - required this.masterList, this.mySelectedExamination}); + required this.masterList, required this.mySelectedExamination}); @override _ExaminationsListSearchWidgetState createState() => _ExaminationsListSearchWidgetState(); diff --git a/lib/screens/patients/profile/soap_update/objective/update_objective_page.dart b/lib/screens/patients/profile/soap_update/objective/update_objective_page.dart index 99891220..7ece1622 100644 --- a/lib/screens/patients/profile/soap_update/objective/update_objective_page.dart +++ b/lib/screens/patients/profile/soap_update/objective/update_objective_page.dart @@ -71,7 +71,7 @@ class _UpdateObjectivePageState extends State await model.getMasterLookup(MasterKeysService.PhysicalExamination); } model.patientPhysicalExamList.forEach((element) { - MasterKeyModel examMaster = model.getOneMasterKey( + MasterKeyModel? examMaster = model.getOneMasterKey( masterKeys: MasterKeysService.PhysicalExamination, id: element.examId, ); @@ -152,7 +152,7 @@ class _UpdateObjectivePageState extends State .map((examination) { return ExaminationItemCard(examination, () { removeExamination( - examination.selectedExamination); + examination!.selectedExamination!); }); }).toList(), ), @@ -181,7 +181,7 @@ class _UpdateObjectivePageState extends State .map((examination) { return ExaminationItemCard(examination, () { removeExamination( - examination.selectedExamination); + examination.selectedExamination!); }); }).toList(), ) @@ -205,7 +205,7 @@ class _UpdateObjectivePageState extends State submitUpdateObjectivePage(SOAPViewModel model) async { if (mySelectedExamination.isNotEmpty) { if(!model.isAddExamInProgress && widget.patientInfo.admissionNo != null && - widget.patientInfo.admissionNo.isNotEmpty) { + widget.patientInfo.admissionNo!.isNotEmpty) { Navigator.of(context).pop(); }else{ widget.changeLoadingState(true); @@ -230,8 +230,8 @@ class _UpdateObjectivePageState extends State createdOn: exam.createdOn ?? DateTime.now().toIso8601String(), editedBy: doctorProfile.doctorID, editedOn: DateTime.now().toIso8601String(), - examId: exam.selectedExamination.id, - examType: exam.selectedExamination.typeId, + examId: exam.selectedExamination!.id, + examType: exam.selectedExamination!.typeId, isAbnormal: exam.isAbnormal, isNormal: exam.isNormal, notExamined: exam.notExamined, @@ -248,13 +248,13 @@ class _UpdateObjectivePageState extends State isNew: exam.isNew, ); if (widget.patientInfo.admissionNo != null && - widget.patientInfo.admissionNo.isNotEmpty) { + widget.patientInfo.admissionNo!.isNotEmpty) { listHisProgNotePhysicalExaminationVM.admissionNo = - int.parse(widget.patientInfo.admissionNo); + int.parse(widget.patientInfo.admissionNo!); } else { listHisProgNotePhysicalExaminationVM.admissionNo = 0; } - postPhysicalExamRequestModel.listHisProgNotePhysicalExaminationVM + postPhysicalExamRequestModel.listHisProgNotePhysicalExaminationVM! .add(listHisProgNotePhysicalExaminationVM); }); @@ -268,13 +268,13 @@ class _UpdateObjectivePageState extends State widget.changeLoadingState(false); Helpers.showErrorToast(model.error); if(widget.patientInfo.admissionNo != null && - widget.patientInfo.admissionNo.isNotEmpty) { + widget.patientInfo.admissionNo!.isNotEmpty) { // Navigator.of(context).pop(); model.isAddExamInProgress = false; } } else { if(widget.patientInfo.admissionNo != null && - widget.patientInfo.admissionNo.isNotEmpty) { + widget.patientInfo.admissionNo!.isNotEmpty) { // Navigator.of(context).pop(); widget.changeLoadingState(false); model.isAddExamInProgress = false; @@ -322,9 +322,8 @@ class _UpdateObjectivePageState extends State mySelectedExaminationLocal.forEach((element) { if ((mySelectedExamination.singleWhere( (it) => - it.selectedExamination.id == - element.selectedExamination.id, - orElse: () => null)) == + it.selectedExamination!.id == + element.selectedExamination!.id)) == null) { mySelectedExamination.insert(0,element); } @@ -335,16 +334,16 @@ class _UpdateObjectivePageState extends State mySelectedExamination.forEach((element) { if ((mySelectedExaminationLocal.singleWhere( (it) => - it.selectedExamination.id == - element.selectedExamination.id, - orElse: () => null)) == + it.selectedExamination!.id == + element.selectedExamination!.id, + )) == null) { removedList.add(element); } }); removedList.forEach((element) { - removeExamination(element.selectedExamination); + removeExamination(element.selectedExamination!); }); Navigator.of(context).pop(); } diff --git a/lib/screens/patients/profile/soap_update/plan/update_plan_page.dart b/lib/screens/patients/profile/soap_update/plan/update_plan_page.dart index f2f67f8c..cac5deeb 100644 --- a/lib/screens/patients/profile/soap_update/plan/update_plan_page.dart +++ b/lib/screens/patients/profile/soap_update/plan/update_plan_page.dart @@ -37,7 +37,8 @@ class UpdatePlanPage extends StatefulWidget { required this.changeLoadingState, required this.currentIndex, required this.sOAPViewModel, - this.changeStateFun}); + required this.changeStateFun}); + @override _UpdatePlanPageState createState() => _UpdatePlanPageState(); @@ -90,7 +91,7 @@ class _UpdatePlanPageState extends State ///TODO set progressNote in model; if (widget.sOAPViewModel.patientProgressNoteList.isNotEmpty) { progressNoteController.text = Helpers.parseHtmlString( - widget.sOAPViewModel.patientProgressNoteList[0].planNote); + widget.sOAPViewModel!.patientProgressNoteList[0]!.planNote!); patientProgressNote.planNote = progressNoteController.text; patientProgressNote.createdByName = @@ -126,7 +127,7 @@ class _UpdatePlanPageState extends State if (widget.sOAPViewModel.patientProgressNoteList.isNotEmpty) { progressNoteController.text = Helpers.parseHtmlString( - widget.sOAPViewModel.patientProgressNoteList[0].planNote); + widget.sOAPViewModel.patientProgressNoteList[0].planNote!); patientProgressNote.planNote = progressNoteController.text; patientProgressNote.createdByName = widget.sOAPViewModel.patientProgressNoteList[0].createdByName; @@ -253,7 +254,7 @@ class _UpdatePlanPageState extends State .getDayMonthYearDateFormatted( DateTime.parse( patientProgressNote - .createdOn)) + .createdOn!)) : AppDateUtils .getDayMonthYearDateFormatted( DateTime.now()), @@ -288,7 +289,7 @@ class _UpdatePlanPageState extends State ? AppDateUtils.getHour( DateTime.parse( patientProgressNote - .createdOn)) + .createdOn!)) : AppDateUtils.getHour( DateTime.now()), fontWeight: FontWeight.w600, @@ -385,7 +386,7 @@ class _UpdatePlanPageState extends State .getPatientProgressNote(getGetProgressNoteReqModel); if (widget.sOAPViewModel.patientProgressNoteList.isNotEmpty) { progressNoteController.text = Helpers.parseHtmlString( - widget.sOAPViewModel.patientProgressNoteList[0].planNote); + widget.sOAPViewModel.patientProgressNoteList[0].planNote!); patientProgressNote.planNote = progressNoteController.text; patientProgressNote.createdByName = widget.sOAPViewModel.patientProgressNoteList[0].createdByName; diff --git a/lib/screens/patients/profile/soap_update/shared_soap_widgets/SOAP_step_header.dart b/lib/screens/patients/profile/soap_update/shared_soap_widgets/SOAP_step_header.dart index ef92e0db..92d049c2 100644 --- a/lib/screens/patients/profile/soap_update/shared_soap_widgets/SOAP_step_header.dart +++ b/lib/screens/patients/profile/soap_update/shared_soap_widgets/SOAP_step_header.dart @@ -9,7 +9,7 @@ class SOAPStepHeader extends StatelessWidget { const SOAPStepHeader({ Key? key, required this.currentIndex, - required this.changePageViewIndex, this.patientInfo, + required this.changePageViewIndex, required this.patientInfo, }) : super(key: key); final int currentIndex; diff --git a/lib/screens/patients/profile/soap_update/shared_soap_widgets/bottom_sheet_dialog_button.dart b/lib/screens/patients/profile/soap_update/shared_soap_widgets/bottom_sheet_dialog_button.dart index c7d48e1c..b9e6ba14 100644 --- a/lib/screens/patients/profile/soap_update/shared_soap_widgets/bottom_sheet_dialog_button.dart +++ b/lib/screens/patients/profile/soap_update/shared_soap_widgets/bottom_sheet_dialog_button.dart @@ -4,8 +4,8 @@ import 'package:flutter/material.dart'; import 'package:hexcolor/hexcolor.dart'; class BottomSheetDialogButton extends StatelessWidget { - final Function onTap; - final String label; + final VoidCallback? onTap; + final String? label; double headerHeight = SizeConfig.heightMultiplier * 12; diff --git a/lib/screens/patients/profile/soap_update/shared_soap_widgets/remark_text.dart b/lib/screens/patients/profile/soap_update/shared_soap_widgets/remark_text.dart index 91ef6954..eb9023f9 100644 --- a/lib/screens/patients/profile/soap_update/shared_soap_widgets/remark_text.dart +++ b/lib/screens/patients/profile/soap_update/shared_soap_widgets/remark_text.dart @@ -3,9 +3,9 @@ import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart'; import 'package:flutter/material.dart'; class RemarkText extends StatelessWidget { - final String remark; + final String? remark; const RemarkText({ - Key key, this.remark, + Key? key, this.remark, }) : super(key: key); @override diff --git a/lib/screens/patients/profile/soap_update/shared_soap_widgets/remove_button.dart b/lib/screens/patients/profile/soap_update/shared_soap_widgets/remove_button.dart index c64fe86a..e989852d 100644 --- a/lib/screens/patients/profile/soap_update/shared_soap_widgets/remove_button.dart +++ b/lib/screens/patients/profile/soap_update/shared_soap_widgets/remove_button.dart @@ -7,8 +7,8 @@ import 'package:font_awesome_flutter/font_awesome_flutter.dart'; import 'package:hexcolor/hexcolor.dart'; class RemoveButton extends StatelessWidget { - final Function onTap; - final String label; + final VoidCallback? onTap; + final String? label; const RemoveButton({Key? key, this.onTap, this.label}) : super(key: key); diff --git a/lib/screens/patients/profile/soap_update/shared_soap_widgets/steper/Step_details_widget.dart b/lib/screens/patients/profile/soap_update/shared_soap_widgets/steper/Step_details_widget.dart index fb1bdcc9..72abc567 100644 --- a/lib/screens/patients/profile/soap_update/shared_soap_widgets/steper/Step_details_widget.dart +++ b/lib/screens/patients/profile/soap_update/shared_soap_widgets/steper/Step_details_widget.dart @@ -4,10 +4,10 @@ import 'package:flutter/material.dart'; class StepDetailsWidget extends StatelessWidget { final String stepLabel; - final double marginLeft; + final double? marginLeft; const StepDetailsWidget({ - Key key, this.stepLabel, this.marginLeft = 0, + Key? key, required this.stepLabel, this.marginLeft = 0, }) : super(key: key); @override diff --git a/lib/screens/patients/profile/soap_update/shared_soap_widgets/steper/status_Label.dart b/lib/screens/patients/profile/soap_update/shared_soap_widgets/steper/status_Label.dart index 10562d53..53f04994 100644 --- a/lib/screens/patients/profile/soap_update/shared_soap_widgets/steper/status_Label.dart +++ b/lib/screens/patients/profile/soap_update/shared_soap_widgets/steper/status_Label.dart @@ -6,9 +6,9 @@ import 'package:hexcolor/hexcolor.dart'; class StatusLabel extends StatelessWidget { const StatusLabel({ - Key key, - this.stepId, - this.selectedStepId, + Key? key, + required this.stepId, + required this.selectedStepId, }) : super(key: key); final int stepId; diff --git a/lib/screens/patients/profile/soap_update/shared_soap_widgets/steper/steps_widget.dart b/lib/screens/patients/profile/soap_update/shared_soap_widgets/steper/steps_widget.dart index 22f92f00..12d9f8fe 100644 --- a/lib/screens/patients/profile/soap_update/shared_soap_widgets/steper/steps_widget.dart +++ b/lib/screens/patients/profile/soap_update/shared_soap_widgets/steper/steps_widget.dart @@ -17,10 +17,10 @@ class StepsWidget extends StatelessWidget { StepsWidget( {Key? key, - this.index, - this.changeCurrentTab, + required this.index, + required this.changeCurrentTab, this.height = 0.0, - this.patientInfo}); + required this.patientInfo}); @override Widget build(BuildContext context) { @@ -52,7 +52,7 @@ class StepsWidget extends StatelessWidget { child: Container( width: MediaQuery.of(context).size.width * (patientInfo.admissionNo == null || - patientInfo.admissionNo.isEmpty + patientInfo.admissionNo!.isEmpty ? 0.9 : 0.85), child: Divider( @@ -115,7 +115,7 @@ class StepsWidget extends StatelessWidget { Positioned( top: circleTop, left: patientInfo.admissionNo == null || - patientInfo.admissionNo.isEmpty + patientInfo.admissionNo!.isEmpty ? MediaQuery.of(context).size.width * 0.25 : MediaQuery.of(context).size.width * 0.71, child: InkWell( @@ -167,7 +167,7 @@ class StepsWidget extends StatelessWidget { ), ), if (patientInfo.admissionNo == null || - patientInfo.admissionNo.isEmpty) + patientInfo.admissionNo!.isEmpty) Positioned( top: circleTop, left: MediaQuery.of(context).size.width * 0.47, @@ -222,7 +222,7 @@ class StepsWidget extends StatelessWidget { ), ), if (patientInfo.admissionNo == null || - patientInfo.admissionNo.isEmpty) + patientInfo.admissionNo!.isEmpty) Positioned( top: circleTop, right: 0, @@ -289,7 +289,7 @@ class StepsWidget extends StatelessWidget { child: Center( child: Container( width: MediaQuery.of(context).size.width * (patientInfo.admissionNo == null || - patientInfo.admissionNo.isEmpty?0.9:0.85), + patientInfo.admissionNo!.isEmpty?0.9:0.85), child: Divider( color: Colors.grey, height: 0.75, @@ -349,7 +349,7 @@ class StepsWidget extends StatelessWidget { Positioned( top: circleTop, right: MediaQuery.of(context).size.width * (patientInfo.admissionNo == null || - patientInfo.admissionNo.isEmpty?0.25:0.71), + patientInfo.admissionNo!.isEmpty?0.25:0.71), child: InkWell( onTap: () => index >= 2 ? changeCurrentTab(1) : null, child: Column( @@ -396,7 +396,7 @@ class StepsWidget extends StatelessWidget { ), ), if (patientInfo.admissionNo == null || - patientInfo.admissionNo.isEmpty) + patientInfo.admissionNo!.isEmpty) Positioned( top: circleTop, right: MediaQuery.of(context).size.width * 0.50, @@ -451,7 +451,7 @@ class StepsWidget extends StatelessWidget { ), ), if (patientInfo.admissionNo == null || - patientInfo.admissionNo.isEmpty) + patientInfo.admissionNo!.isEmpty) Positioned( top: circleTop, left: 0, diff --git a/lib/screens/patients/profile/soap_update/subjective/allergies/add_allergies.dart b/lib/screens/patients/profile/soap_update/subjective/allergies/add_allergies.dart index ff5c6e6f..621e6736 100644 --- a/lib/screens/patients/profile/soap_update/subjective/allergies/add_allergies.dart +++ b/lib/screens/patients/profile/soap_update/subjective/allergies/add_allergies.dart @@ -100,7 +100,7 @@ class _AddAllergiesState extends State { isServiceSelected: (master) => isServiceSelected(master), getServiceSelectedAllergy: (master) => - getSelectedAllergy(master), + getSelectedAllergy(master)!, hintSearchText: '', buttonName: '', ), ), ), @@ -145,7 +145,7 @@ class _AddAllergiesState extends State { myAllergiesListLocal.removeWhere((element) => element.selectedAllergy!.id == masterKey.id); } - MySelectedAllergy? getSelectedAllergy(MasterKeyModel masterKey) { + MySelectedAllergy ? getSelectedAllergy(MasterKeyModel masterKey) { Iterable allergy = myAllergiesListLocal.where((element) => masterKey.id == element.selectedAllergy!.id && masterKey.typeId == element.selectedAllergy!.typeId && diff --git a/lib/screens/patients/profile/soap_update/subjective/allergies/allergies_item.dart b/lib/screens/patients/profile/soap_update/subjective/allergies/allergies_item.dart index cceab871..fe4ee498 100644 --- a/lib/screens/patients/profile/soap_update/subjective/allergies/allergies_item.dart +++ b/lib/screens/patients/profile/soap_update/subjective/allergies/allergies_item.dart @@ -27,12 +27,12 @@ class AddAllergiesItem extends StatefulWidget { const AddAllergiesItem( {Key? key, - this.model, - this.removeAllergy, - this.addAllergy, - this.isServiceSelected, - this.getServiceSelectedAllergy, - this.item}) + required this.model, + required this.removeAllergy, + required this.addAllergy, + required this.isServiceSelected, + required this.getServiceSelectedAllergy, + required this.item}) : super(key: key); @override @@ -40,7 +40,7 @@ class AddAllergiesItem extends StatefulWidget { } class _AddAllergiesItemState extends State { - MasterKeyModel _selectedAllergySeverity; + late MasterKeyModel _selectedAllergySeverity; bool isSubmitted = false; @override @@ -48,7 +48,7 @@ class _AddAllergiesItemState extends State { ProjectViewModel projectViewModel = Provider.of(context); bool isSelected = widget.isServiceSelected(widget.item); - MySelectedAllergy mySelectedAllergy; + MySelectedAllergy mySelectedAllergy =MySelectedAllergy() ; if (isSelected) { mySelectedAllergy = widget.getServiceSelectedAllergy(widget.item); } @@ -58,8 +58,8 @@ class _AddAllergiesItemState extends State { text: isSelected ? mySelectedAllergy.selectedAllergySeverity != null ? projectViewModel.isArabic - ? mySelectedAllergy.selectedAllergySeverity.nameAr - : mySelectedAllergy.selectedAllergySeverity.nameEn + ? mySelectedAllergy.selectedAllergySeverity!.nameAr + : mySelectedAllergy.selectedAllergySeverity!.nameEn : null : null); return HeaderBodyExpandableNotifier( @@ -71,7 +71,7 @@ class _AddAllergiesItemState extends State { Checkbox( value: widget.isServiceSelected(widget.item), activeColor: Colors.red[800], - onChanged: (bool newValue) { + onChanged: (bool ?newValue) { onTapItem(); }), InkWell( @@ -97,12 +97,12 @@ class _AddAllergiesItemState extends State { if (mySelectedAllergy != null) { setState(() { mySelectedAllergy.isExpanded = - mySelectedAllergy.isExpanded ? false : true; + mySelectedAllergy.isExpanded! ? false : true; }); } }, child: Icon( - (mySelectedAllergy != null ? mySelectedAllergy.isExpanded : false) + (mySelectedAllergy!.isExpanded!) ? EvaIcons.arrowIosUpwardOutline : EvaIcons.arrowIosDownwardOutline, color: Color(0xFF575757), @@ -142,14 +142,14 @@ class _AddAllergiesItemState extends State { } : null, isTextFieldHasSuffix: true, - hintText: TranslationBase.of(context).selectSeverity + "*", + hintText: TranslationBase.of(context).selectSeverity! + "*", enabled: false, maxLines: 1, minLines: 1, height: Helpers.getTextFieldHeight(), validationError: mySelectedAllergy != null && mySelectedAllergy.selectedAllergySeverity == null && - mySelectedAllergy.hasValidationError + mySelectedAllergy!.hasValidationError! ? TranslationBase.of(context).severityValidationError : null, controller: severityController, diff --git a/lib/screens/patients/profile/soap_update/subjective/allergies/master_key_checkbox_search_allergies_widget.dart b/lib/screens/patients/profile/soap_update/subjective/allergies/master_key_checkbox_search_allergies_widget.dart index 2c13c5b2..36cdad17 100644 --- a/lib/screens/patients/profile/soap_update/subjective/allergies/master_key_checkbox_search_allergies_widget.dart +++ b/lib/screens/patients/profile/soap_update/subjective/allergies/master_key_checkbox_search_allergies_widget.dart @@ -25,15 +25,15 @@ class MasterKeyCheckboxSearchAllergiesWidget extends StatefulWidget { MasterKeyCheckboxSearchAllergiesWidget( {Key? key, - this.model, - this.addSelectedAllergy, - this.removeAllergy, - this.masterList, - this.addAllergy, - this.isServiceSelected, - this.buttonName, - this.hintSearchText, - this.getServiceSelectedAllergy}) + required this.model, + required this.addSelectedAllergy, + required this.removeAllergy, + required this.masterList, + required this.addAllergy, + required this.isServiceSelected, + required this.buttonName, + required this.hintSearchText, + required this.getServiceSelectedAllergy}) : super(key: key); @override @@ -80,7 +80,7 @@ class _MasterKeyCheckboxSearchAllergiesWidgetState icon: Icon( Icons.search, color: Colors.black, - )), + ), onPressed: () { },), ), DividerWithSpacesAround(), SizedBox( @@ -127,8 +127,8 @@ class _MasterKeyCheckboxSearchAllergiesWidgetState if (query.isNotEmpty) { List dummyListData = []; dummySearchList.forEach((items) { - if (items.nameAr.toLowerCase().contains(query.toLowerCase()) || - items.nameEn.toLowerCase().contains(query.toLowerCase())) { + if (items.nameAr!.toLowerCase().contains(query.toLowerCase()) || + items.nameEn!.toLowerCase().contains(query.toLowerCase())) { dummyListData.add(items); } }); diff --git a/lib/screens/patients/profile/soap_update/subjective/allergies/update_allergies_widget.dart b/lib/screens/patients/profile/soap_update/subjective/allergies/update_allergies_widget.dart index b0902519..e84754eb 100644 --- a/lib/screens/patients/profile/soap_update/subjective/allergies/update_allergies_widget.dart +++ b/lib/screens/patients/profile/soap_update/subjective/allergies/update_allergies_widget.dart @@ -77,11 +77,11 @@ class _UpdateAllergiesWidgetState extends State { AppText( projectViewModel.isArabic ? selectedAllergy - .selectedAllergySeverity.nameAr + .selectedAllergySeverity!.nameAr : selectedAllergy - .selectedAllergySeverity.nameEn + .selectedAllergySeverity!.nameEn! .toUpperCase(), - textDecoration: selectedAllergy.isChecked + textDecoration: selectedAllergy!.isChecked! ? null : TextDecoration.lineThrough, color: Color(0xFFCC9B14), @@ -132,7 +132,7 @@ class _UpdateAllergiesWidgetState extends State { .toList(); if (allergy.length > 0) { - if (allergy.first.isLocal) { + if (allergy!.first!.isLocal!) { setState(() { widget.myAllergiesList.remove(allergy.first); }); @@ -165,9 +165,8 @@ class _UpdateAllergiesWidgetState extends State { mySelectedAllergy.forEach((element) { if ((widget.myAllergiesList.singleWhere( (it) => - it.selectedAllergy.id == - element.selectedAllergy.id, - orElse: () => null)) == + it.selectedAllergy!.id == + element.selectedAllergy!.id,)) == null) { widget.myAllergiesList.add(element); } @@ -178,9 +177,8 @@ class _UpdateAllergiesWidgetState extends State { widget.myAllergiesList.forEach((element) { if ((mySelectedAllergy.singleWhere( (it) => - it.selectedAllergy.id == - element.selectedAllergy.id, - orElse: () => null)) == + it.selectedAllergy!.id == + element.selectedAllergy!.id)) == null) { removedList.add(element); } diff --git a/lib/screens/patients/profile/soap_update/subjective/history/add_history_dialog.dart b/lib/screens/patients/profile/soap_update/subjective/history/add_history_dialog.dart index cb0598cd..bf294b07 100644 --- a/lib/screens/patients/profile/soap_update/subjective/history/add_history_dialog.dart +++ b/lib/screens/patients/profile/soap_update/subjective/history/add_history_dialog.dart @@ -59,7 +59,7 @@ class _AddHistoryDialogState extends State { baseViewModel: model, isShowAppBar: true, appBar: - BottomSheetTitle(title: TranslationBase.of(context).addHistory), + BottomSheetTitle(title: TranslationBase.of(context).addHistory!), body: Center( child: Container( child: Column( diff --git a/lib/screens/patients/profile/soap_update/subjective/history/update_history_widget.dart b/lib/screens/patients/profile/soap_update/subjective/history/update_history_widget.dart index f0512273..06898bdc 100644 --- a/lib/screens/patients/profile/soap_update/subjective/history/update_history_widget.dart +++ b/lib/screens/patients/profile/soap_update/subjective/history/update_history_widget.dart @@ -70,9 +70,9 @@ class _UpdateHistoryWidgetState extends State with TickerPr letterSpacing: -0.48,), width: MediaQuery.of(context).size.width * 0.5, ), - if (myHistory.isChecked) + if (myHistory!.isChecked!) RemoveButton( - onTap: () => removeHistory(myHistory.selectedHistory), + onTap: () => removeHistory(myHistory!.selectedHistory!), ) ], ), @@ -97,7 +97,7 @@ class _UpdateHistoryWidgetState extends State with TickerPr .toList(); if (history.length > 0){ - if (history.first.isLocal) { + if (history!.first!.isLocal!) { setState(() { widget.myHistoryList.remove(history.first); }); diff --git a/lib/screens/patients/register_patient/VerifyMethodPage.dart b/lib/screens/patients/register_patient/VerifyMethodPage.dart index e273e096..61b70110 100644 --- a/lib/screens/patients/register_patient/VerifyMethodPage.dart +++ b/lib/screens/patients/register_patient/VerifyMethodPage.dart @@ -481,7 +481,6 @@ class _ActivationPageState extends State { sendActivationCode(type) async { GifLoaderDialogUtils.showMyDialog(context); await widget.model.sendActivationCodeByOTPNotificationType(otpType: type); - if (widget.model.state == ViewState.ErrorLocal) { Helpers.showErrorToast(widget.model.error); GifLoaderDialogUtils.hideDialog(context); diff --git a/lib/screens/reschedule-leaves/reschedule_leave.dart b/lib/screens/reschedule-leaves/reschedule_leave.dart index 673e260a..c554e563 100644 --- a/lib/screens/reschedule-leaves/reschedule_leave.dart +++ b/lib/screens/reschedule-leaves/reschedule_leave.dart @@ -99,796 +99,442 @@ 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(), - // ))), - // ), - // ], - // ) - // ], - // ), - // )), + 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: [ - // new IgnorePointer( - // ignoring: true, - // child: AppTextFormField( - // readOnly: true, - // hintText: profile != null - // ? profile['DoctorName'] - // : "", - // borderColor: Colors.white, - // onSaved: (value) {}, - // inputFormatter: ONLY_NUMBERS)) - // ], - // ), - // ), + 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( + 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< - String>( - value: item['code'] - .toString(), - child: Text( - item['description'], - textAlign: - TextAlign.end, - ), - ); - }).toList(), - )), - ) - : SizedBox(), - ], - ) - ], - ), + 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, + ) + ], )), - 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; - }); - }), - ], - )) - ], + 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"))), - 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(), - ], - ) - ], - ), + 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"))), - 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), + 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, ), - ), + ], + ); + }).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, ), - // 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(), - ], + ); + }).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); - } - }, - ), + ) ], ), - ), - // Column( - // children: [ - // AppText(TranslationBase.of(context) - // .previousSickLeaveIssue + - // ' ') - // ], - // ) - ], + )), + + 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(), + ], + ) + ], + ), + )), + 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 + + // ' ') + // ], + // ) + ], ), ), ), - ))); + ), + ), + ))); } getProfile() async { @@ -901,16 +547,13 @@ 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; @@ -923,8 +566,7 @@ 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'] : ""; } @@ -934,16 +576,10 @@ 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); @@ -958,8 +594,7 @@ 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": [ { @@ -982,10 +617,9 @@ class _RescheduleLeaveScreen extends State { Navigator.push( context, MaterialPageRoute( - builder: (context) => AddRescheduleLeavScreen(), - settings: RouteSettings(name: 'AddRescheduleLeaveScreen') - // MyReferredPatient(), - ), + builder: (context) => AddRescheduleLeavScreen(), settings: RouteSettings(name: 'AddRescheduleLeaveScreen') + // MyReferredPatient(), + ), ); } }); @@ -998,21 +632,13 @@ 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(); - } else { - fromDate = df.format( - fromDates is DateTime ? fromDates : DateTime.parse(fromDates)); + fromDate = + df.format(DateTime.parse(_toDateController.text)) + 'T' + fromTime + ':' + DateTime.now().second.toString(); toDate = - df.format(toDates is DateTime ? toDates : DateTime.parse(toDates)); + 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)); } Map request = { @@ -1025,8 +651,7 @@ 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": [ { @@ -1064,9 +689,8 @@ 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/lib/widgets/patients/profile/profile_medical_info_widget_search.dart b/lib/widgets/patients/profile/profile_medical_info_widget_search.dart index e457b6dd..b5be57ec 100644 --- a/lib/widgets/patients/profile/profile_medical_info_widget_search.dart +++ b/lib/widgets/patients/profile/profile_medical_info_widget_search.dart @@ -8,8 +8,8 @@ import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; class ProfileMedicalInfoWidgetSearch extends StatefulWidget { - final String from; - final String to; + final String? from; + final String? to; final PatiantInformtion patient; final String patientType; final String? arrivalType; @@ -21,8 +21,8 @@ class ProfileMedicalInfoWidgetSearch extends StatefulWidget { required this.patient, required this.patientType, this.arrivalType, - required this.from, - required this.to, + this.from, + this.to, this.isInpatient = false, this.isDischargedPatient}); diff --git a/pubspec.lock b/pubspec.lock index 957312ba..972d2116 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -35,7 +35,7 @@ packages: name: async url: "https://pub.dartlang.org" source: hosted - version: "2.8.2" + version: "2.8.1" autocomplete_textfield: dependency: "direct main" description: @@ -154,7 +154,7 @@ packages: name: characters url: "https://pub.dartlang.org" source: hosted - version: "1.2.0" + version: "1.1.0" charcode: dependency: transitive description: @@ -315,7 +315,7 @@ packages: name: dropdown_search url: "https://pub.dartlang.org" source: hosted - version: "0.6.3" + version: "2.0.1" equatable: dependency: transitive description: @@ -769,7 +769,7 @@ packages: name: matcher url: "https://pub.dartlang.org" source: hosted - version: "0.12.11" + version: "0.12.10" meta: dependency: transitive description: @@ -1173,7 +1173,7 @@ packages: name: test_api url: "https://pub.dartlang.org" source: hosted - version: "0.4.3" + version: "0.4.2" timing: dependency: transitive description: @@ -1257,7 +1257,7 @@ packages: name: vector_math url: "https://pub.dartlang.org" source: hosted - version: "2.1.1" + version: "2.1.0" video_player: dependency: transitive description: diff --git a/pubspec.yaml b/pubspec.yaml index 323cb1b0..b67d4eb5 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -45,7 +45,7 @@ dependencies: #Icons eva_icons_flutter: ^3.0.0 font_awesome_flutter: ^9.0.0 - dropdown_search: ^0.6.1 + dropdown_search: ^2.0.1 flutter_staggered_grid_view: ^0.4.0 expandable: ^5.0.1