From 597d5a3498be95d3bf55a08c635f597258f131bf Mon Sep 17 00:00:00 2001 From: "Aamir.Muhammad" Date: Wed, 29 Nov 2023 15:26:26 +0300 Subject: [PATCH] Null Safety Update --- lib/client/base_app_client.dart | 8 +- .../CheckActivationCodeModel.dart | 50 +- .../CheckPatientForRegistrationModel.dart | 34 +- .../GetPatientInfoRequestModel.dart | 24 +- .../GetPatientInfoResponseModel.dart | 88 +- .../PatientRegistrationModel.dart | 78 +- ...PNotificationTypeForRegistrationModel.dart | 48 +- .../model/Prescriptions/Prescriptions.dart | 76 +- .../get_medication_for_inpatient_model.dart | 60 +- ...edication_for_inpatient_request_model.dart | 24 +- .../in_patient_prescription_model.dart | 2 +- .../Prescriptions/perscription_pharmacy.dart | 46 +- .../post_prescrition_req_model.dart | 42 +- .../prescription_in_patient.dart | 68 +- .../Prescriptions/prescription_model.dart | 8 +- .../Prescriptions/prescription_report.dart | 62 +- .../prescription_report_enh.dart | 34 +- .../Prescriptions/prescriptions_order.dart | 34 +- ...t_get_list_pharmacy_for_prescriptions.dart | 24 +- .../request_prescription_report.dart | 38 +- .../request_prescription_report_enh.dart | 38 +- .../allergy/get_allergies_request_model.dart | 10 +- .../SOAP/allergy/get_allergies_res_model.dart | 26 +- .../allergy/post_allergy_request_model.dart | 40 +- .../assessment/get_assessment_req_model.dart | 12 +- .../assessment/get_assessment_res_model.dart | 30 +- .../patch_assessment_req_model.dart | 18 +- .../post_assessment_request_model.dart | 24 +- .../get_chief_complaint_req_model.dart | 10 +- .../get_chief_complaint_res_model.dart | 24 +- .../post_chief_complaint_request_model.dart | 20 +- .../model/SOAP/general_get_req_for_SOAP.dart | 6 +- .../SOAP/history/get_history_req_model.dart | 14 +- .../SOAP/history/get_history_res_model.dart | 14 +- .../history/post_histories_request_model.dart | 22 +- .../get_episode_for_inpatient_req_model.dart | 6 +- ...t_episode_for_Inpatient_request_model.dart | 6 +- lib/core/model/SOAP/master_key_model.dart | 16 +- .../get_physical_exam_list_res_model.dart | 38 +- .../get_physical_exam_req_model.dart | 12 +- .../post_physical_exam_request_model.dart | 54 +- .../model/SOAP/post_episode_req_model.dart | 8 +- .../GetGetProgressNoteResModel.dart | 22 +- .../get_progress_note_req_model.dart | 12 +- .../post_progress_note_request_model.dart | 8 +- .../selected_items/my_selected_allergy.dart | 16 +- .../selected_items/my_selected_assement.dart | 20 +- .../my_selected_examination.dart | 20 +- .../selected_items/my_selected_history.dart | 8 +- lib/core/model/auth/insert_imei_model.dart | 12 +- .../model/calculate_box_request_model.dart | 10 +- lib/core/model/chart_axis_model.dart | 4 +- .../model/charts/app_time_series_chart.dart | 4 +- lib/core/model/countries_model.dart | 8 +- lib/core/model/hospitals_model.dart | 26 +- .../model/insurance/insurance_approval.dart | 60 +- .../insurance_approval_request_model.dart | 26 +- lib/core/model/labs/lab_result.dart | 8 +- .../live_care/AlternativeServicesList.dart | 2 +- .../model/patient/PatientArrivalEntity.dart | 36 +- .../get_clinic_by_project_id_request.dart | 48 +- .../get_doctor_by_clinic_id_request.dart | 24 +- ...t_list_stp_referral_frequency_request.dart | 41 +- .../patient/get_pending_patient_er_model.dart | 66 +- .../patient/insurance_aprovals_request.dart | 47 +- lib/core/model/patient/orders_request.dart | 47 +- .../model/patient/patiant_info_model.dart | 142 +-- lib/core/model/patient/patient_model.dart | 111 +- .../model/patient/progress_note_request.dart | 46 +- ...st_prescription_report_for_in_patient.dart | 26 +- .../patient/refer_to_doctor_request.dart | 55 +- .../request_my_referral_patient_model.dart | 40 +- .../model/patient/topten_users_res_model.dart | 13 +- .../vital_sign/vital_sign_res_model.dart | 13 +- .../patient_muse/PatientMuseResultsModel.dart | 24 +- .../PatientSearchRequestModel.dart | 32 +- .../pending_order_request_model.dart | 32 +- .../pending_orders/pending_orders_model.dart | 2 +- .../pharmacies_List_request_model.dart | 29 +- .../pharmacies_items_request_model.dart | 29 +- .../accept_or_reject_req_model.dart | 26 +- ...rvention_medication_history_req_model.dart | 10 +- ...rvention_medication_history_res_model.dart | 42 +- .../new_medication_req_model.dart | 8 +- .../new_medication_res_model.dart | 44 +- lib/core/model/procedure/ControlsModel.dart | 4 +- .../Procedure_template_request_model.dart | 54 +- .../model/procedure/categories_procedure.dart | 36 +- .../get_ordered_procedure_model.dart | 60 +- .../get_ordered_procedure_request_model.dart | 6 +- .../model/procedure/get_procedure_model.dart | 32 +- .../procedure/get_procedure_req_model.dart | 12 +- lib/core/model/procedure/order-procedure.dart | 48 +- .../procedure/post_procedure_req_model.dart | 28 +- .../procedure_category_list_model.dart | 14 +- .../procedure/procedure_templateModel.dart | 18 +- .../procedure_template_details_model.dart | 54 +- ...cedure_template_details_request_model.dart | 56 +- .../procedure/procedure_valadate_model.dart | 14 +- .../procedure_valadate_request_model.dart | 10 +- .../update_procedure_request_model.dart | 28 +- lib/core/model/radiology/final_radiology.dart | 26 +- .../request_patient_rad_orders_details.dart | 40 +- .../request_send_rad_report_email.dart | 52 +- .../referral/DischargeReferralPatient.dart | 84 +- .../referral/MyReferralPatientModel.dart | 126 +-- .../MyReferralPatientRequestModel.dart | 46 +- lib/core/model/referral/ReferralRequest.dart | 48 +- .../add_referred_remarks_request.dart | 30 +- .../get_medication_response_model.dart | 12 +- .../search_drug/item_by_medicine_model.dart | 42 +- .../item_by_medicine_request_model.dart | 4 +- .../model/search_drug/search_drug_model.dart | 10 +- .../search_drug_request_model.dart | 2 +- .../sick_leave_doctor_request_model.dart | 10 +- .../sick_leave/sick_leave_patient_model.dart | 10 +- .../sick_leave_patient_request_model.dart | 26 +- .../sickleave/add_sickleave_request.dart | 10 +- .../sickleave/extend_sick_leave_request.dart | 8 +- .../sickleave/get_all_sickleave_response.dart | 18 +- .../sick_leave_statisitics_model.dart | 6 +- .../vte_assessment_req_model.dart | 6 +- .../vte_assessment_res_model.dart | 18 +- lib/core/service/AnalyticsService.dart | 4 +- lib/core/service/NavigationService.dart | 14 +- .../service/PatientRegistrationService.dart | 90 +- lib/core/service/VideoCallService.dart | 32 +- lib/core/service/authentication_service.dart | 16 +- lib/core/service/base/base_service.dart | 23 +- lib/core/service/home/dasboard_service.dart | 2 +- lib/core/service/home/scan_qr_service.dart | 8 +- .../service/hospitals/hospitals_service.dart | 2 +- .../patient/DischargedPatientService.dart | 8 +- .../patient/LiveCarePatientServices.dart | 20 +- .../patient/MyReferralPatientService.dart | 87 +- .../service/patient/PatientMuseService.dart | 7 +- lib/core/service/patient/ReferralService.dart | 28 +- .../patient-doctor-referral-service.dart | 2 +- .../patient/patientInPatientService.dart | 10 +- lib/core/service/patient/patient_service.dart | 44 +- .../profile/discharge_summary_servive.dart | 25 +- .../intervention_medication_service.dart | 12 +- .../profile/operation_report_servive.dart | 8 +- .../profile/vte_assessment_service.dart | 4 +- .../ER_signin/ER_signin_service.dart | 32 +- .../insurance/InsuranceCardService.dart | 8 +- .../lab_order/labs_service.dart | 58 +- .../PatientMedicalReportService.dart | 34 +- .../medical_report/medical_file_service.dart | 4 +- .../prescription/prescription_service.dart | 240 ++--- .../procedure/procedure_service.dart | 22 +- .../radiology/radiology_service.dart | 10 +- .../sick_leave/sickleave_service.dart | 8 +- .../soap/SOAP_service.dart | 8 +- .../ucaf/patient-ucaf-service.dart | 60 +- .../patient-vital-signs-service.dart | 2 +- lib/core/service/pending_order_service.dart | 34 +- .../viewModel/DischargedPatientViewModel.dart | 6 +- .../ER_sign_in/ER_sign_in_view_model.dart | 28 +- lib/core/viewModel/InsuranceViewModel.dart | 4 +- .../viewModel/LiveCarePatientViewModel.dart | 32 +- lib/core/viewModel/PatientMuseViewModel.dart | 2 +- .../PatientRegistrationViewModel.dart | 51 +- .../viewModel/PatientSearchViewModel.dart | 206 ++-- lib/core/viewModel/SOAP_view_model.dart | 436 ++++---- .../viewModel/authentication_view_model.dart | 225 ++-- lib/core/viewModel/base_view_model.dart | 23 +- lib/core/viewModel/dashboard_view_model.dart | 36 +- .../viewModel/doctor_replay_view_model.dart | 4 +- lib/core/viewModel/labs_view_model.dart | 54 +- .../viewModel/leave_rechdule_response.dart | 22 +- lib/core/viewModel/livecare_view_model.dart | 2 +- .../viewModel/medical_file_view_model.dart | 2 +- lib/core/viewModel/medicine_view_model.dart | 187 ++-- .../patient-admission-request-viewmodel.dart | 4 +- .../viewModel/patient-referral-viewmodel.dart | 22 +- .../viewModel/patient-ucaf-viewmodel.dart | 57 +- .../patient-vital-sign-viewmodel.dart | 56 +- lib/core/viewModel/patient_view_model.dart | 24 +- .../viewModel/pednding_orders_view_model.dart | 4 +- .../prescription/prescription_view_model.dart | 123 +-- lib/core/viewModel/procedure_View_model.dart | 299 ++---- .../profile/discharge_summary_view_model.dart | 10 +- .../intervention_medication_view_model.dart | 102 +- .../pharmacy_intervention_view_model.dart | 8 +- .../profile/vte_assessment_view_model.dart | 4 +- lib/core/viewModel/project_view_model.dart | 17 +- lib/core/viewModel/radiology_view_model.dart | 18 +- lib/icons_app/doctor_app_icons.dart | 2 +- lib/screens/ER_singin/ER_singin_screen.dart | 27 +- lib/screens/auth/login_screen.dart | 22 +- .../auth/verification_methods_screen.dart | 456 +++------ lib/screens/base/base_view.dart | 12 +- .../doctor_replay/all_doctor_questions.dart | 6 +- .../doctor_replay/doctor_repaly_chat.dart | 31 +- .../doctor_replay/doctor_reply_screen.dart | 17 +- .../doctor_replay/doctor_reply_widget.dart | 25 +- .../not_replaied_doctor_questions.dart | 6 +- .../doctor/patient_arrival_screen.dart | 26 +- .../home/dashboard_referral_patient.dart | 42 +- .../home/dashboard_slider-item-widget.dart | 12 +- lib/screens/home/dashboard_swipe_widget.dart | 23 +- lib/screens/home/home_page_card.dart | 18 +- lib/screens/home/home_patient_card.dart | 36 +- lib/screens/home/home_screen.dart | 225 ++-- lib/screens/home/label.dart | 14 +- lib/screens/live_care/end_call_screen.dart | 147 +-- .../live-care_transfer_to_admin.dart | 12 +- .../live_care/live_care_patient_screen.dart | 38 +- lib/screens/live_care/panding_list.dart | 113 +- lib/screens/live_care/video_call.dart | 135 ++- .../medical-file/health_summary_page.dart | 131 +-- .../medical-file/medical_file_details.dart | 660 +++--------- .../medicine/medicine_search_screen.dart | 10 +- .../medicine/pharmacies_list_screen.dart | 385 ++++--- .../add_patient_sick_leave_screen.dart | 103 +- .../patient_sick_leave_screen.dart | 6 +- .../patients/In_patient/InPatientHeader.dart | 10 +- lib/screens/patients/In_patient/NoData.dart | 2 +- .../In_patient/in_patient_list_page.dart | 139 +-- .../In_patient/in_patient_screen.dart | 14 +- .../In_patient/list_of_all_in_patient.dart | 14 +- .../In_patient/list_of_my_inpatient.dart | 10 +- .../out_patient/filter_date_page.dart | 97 +- .../out_patient/out_patient_screen.dart | 103 +- .../patient_search/patient_search_header.dart | 8 +- .../patient_search_result_screen.dart | 34 +- .../patient_search/patient_search_screen.dart | 6 +- .../patients/patient_search/time_bar.dart | 18 +- .../admission_orders_screen.dart | 16 +- .../admission_request_first_screen.dart | 239 ++--- .../admission_request_second_screen.dart | 963 ++++++++---------- .../admission_request_third_screen.dart | 304 +++--- .../diabetic_chart/diabetic_chart.dart | 70 +- ...iabetic_details_blood_pressurewideget.dart | 18 +- .../line_chart_for_diabetic.dart | 150 +-- .../profile/diagnosis/diagnosis_screen.dart | 20 +- .../all_discharge_summary.dart | 8 +- .../discharge_Summary_widget.dart | 112 +- .../discharge_summary/discharge_summary.dart | 14 +- .../pending_discharge_summary.dart | 10 +- .../line_chart_curved_lab_history.dart | 4 +- .../profile/notes/note/update_note.dart | 2 +- .../update_operation_report.dart | 2 +- .../patient_profile_screen.dart | 4 +- .../refer-patient-screen-in-patient.dart | 4 +- .../refer_details/refer-patient-screen.dart | 2 +- .../add_replay_on_referral_patient.dart | 2 +- .../assessment/add_assessment_details.dart | 2 +- .../assessment/update_assessment_page.dart | 2 +- .../examinations_list_search_widget.dart | 6 +- .../objective/update_objective_page.dart | 4 +- .../soap_update/plan/update_plan_page.dart | 2 +- .../shared_soap_widgets/SOAP_step_header.dart | 2 +- .../bottom_sheet_title.dart | 2 +- .../steper/steps_widget.dart | 2 +- ..._key_checkbox_search_allergies_widget.dart | 6 +- .../subjective/medication/add_medication.dart | 4 +- .../subjective/update_subjective_page.dart | 10 +- .../soap_update/update_soap_index.dart | 10 +- .../profile/vital_sign/line_chart_curved.dart | 6 +- .../line_chart_curved_blood_pressure.dart | 10 +- .../profile/vital_sign/vital_sign_item.dart | 6 +- .../RegisterSearchPatientPage.dart | 2 +- .../add_drug/add_drug_widget.dart | 4 +- .../add_drug/drug_to_drug.dart | 4 +- .../prescription_form_widget.dart | 2 +- .../prescription_checkout_screen.dart | 4 +- .../procedures/add_procedure_page.dart | 4 +- .../entity_list_checkbox_search_widget.dart | 6 +- .../add_favourite_procedure.dart | 2 +- .../entity_list_fav_procedure.dart | 8 +- .../procedure_checkout_screen.dart | 6 +- lib/screens/procedures/update_procedure.dart | 4 +- lib/screens/qr_reader/QR_reader_screen.dart | 2 +- .../reschedule_leaves/reschedule_leave.dart | 26 +- lib/utils/utils.dart | 6 +- lib/widgets/auth/method_type_card.dart | 6 +- .../bottom_sheet/bottom_sheet_container.dart | 4 +- .../custom_bottom_sheet_container.dart | 2 +- lib/widgets/dashboard/activity_button.dart | 8 +- lib/widgets/dashboard/guage_chart.dart | 8 +- lib/widgets/dashboard/out_patient_stack.dart | 2 +- .../medicine/medicine_item_widget.dart | 2 +- .../app_bar/patient-profile-app-bar.dart | 2 +- .../prescription_in_patinets_widget.dart | 4 +- .../prescription_out_patinets_widget.dart | 4 +- lib/widgets/shared/app_drawer_widget.dart | 4 +- .../shared/bottom_navigation_item.dart | 4 +- .../shared/buttons/app_buttons_widget.dart | 6 +- .../shared/dialogs/dailog-list-select.dart | 6 +- .../master_key_checkbox_search_widget.dart | 6 +- lib/widgets/shared/speech-text-popup.dart | 4 +- pubspec.yaml | 11 +- 294 files changed, 4941 insertions(+), 7172 deletions(-) diff --git a/lib/client/base_app_client.dart b/lib/client/base_app_client.dart index f06c3930..6d08a7c2 100644 --- a/lib/client/base_app_client.dart +++ b/lib/client/base_app_client.dart @@ -148,7 +148,7 @@ class BaseAppClient { {required Map body, required Function(dynamic response, int statusCode) onSuccess, required Function(String error, int statusCode) onFailure, - required PatiantInformtion patient, + PatiantInformtion? patient, bool isExternal = false}) async { String url = BASE_URL + endPoint; @@ -196,7 +196,7 @@ class BaseAppClient { body['PatientType'] = body.containsKey('PatientType') ? body['PatientType'] != null ? body['PatientType'] - : patient.patientType != null + : patient!.patientType != null ? patient.patientType : PATIENT_TYPE : PATIENT_TYPE; @@ -204,13 +204,13 @@ class BaseAppClient { body['PatientTypeID'] = body.containsKey('PatientTypeID') ? body['PatientTypeID'] != null ? body['PatientTypeID'] - : patient.patientType != null + : patient!.patientType != null ? patient.patientType : PATIENT_TYPE_ID : PATIENT_TYPE_ID; body['TokenID'] = body.containsKey('TokenID') ? body['TokenID'] ?? token : token; - body['PatientID'] = body['PatientID'] != null ? body['PatientID'] : patient.patientId ?? patient.patientMRN; + body['PatientID'] = body['PatientID'] != null ? body['PatientID'] : patient!.patientId ?? patient.patientMRN; body['PatientOutSA'] = 0; //user['OutSA']; //TODO change it body['SessionID'] = SESSION_ID; //getSe diff --git a/lib/core/model/PatientRegistration/CheckActivationCodeModel.dart b/lib/core/model/PatientRegistration/CheckActivationCodeModel.dart index ce65a600..06ad84c5 100644 --- a/lib/core/model/PatientRegistration/CheckActivationCodeModel.dart +++ b/lib/core/model/PatientRegistration/CheckActivationCodeModel.dart @@ -1,29 +1,29 @@ class CheckActivationCodeModel { - int patientMobileNumber; - String mobileNo; - int projectOutSA; - int loginType; - String zipCode; - bool isRegister; - String logInTokenID; - int searchType; - int patientID; - int nationalID; - int patientIdentificationID; - bool forRegisteration; - String activationCode; - double versionID; - int channel; - int languageID; - String iPAdress; - String generalid; - int patientOutSA; - Null sessionID; - bool isDentalAllowedBackend; - int deviceTypeID; - String dOB; - int isHijri; - String healthId; + int? patientMobileNumber; + String? mobileNo; + int? projectOutSA; + int? loginType; + String? zipCode; + bool? isRegister; + String? logInTokenID; + int? searchType; + int? patientID; + int? nationalID; + int? patientIdentificationID; + bool? forRegisteration; + String? activationCode; + double? versionID; + int? channel; + int? languageID; + String? iPAdress; + String? generalid; + int? patientOutSA; + dynamic sessionID; + bool? isDentalAllowedBackend; + int? deviceTypeID; + String? dOB; + int? isHijri; + String? healthId; CheckActivationCodeModel( {this.patientMobileNumber, diff --git a/lib/core/model/PatientRegistration/CheckPatientForRegistrationModel.dart b/lib/core/model/PatientRegistration/CheckPatientForRegistrationModel.dart index cba0e11d..8d8bc3d4 100644 --- a/lib/core/model/PatientRegistration/CheckPatientForRegistrationModel.dart +++ b/lib/core/model/PatientRegistration/CheckPatientForRegistrationModel.dart @@ -1,21 +1,21 @@ class CheckPatientForRegistrationModel { - int patientIdentificationID; - int patientMobileNumber; - String zipCode; - double versionID; - int channel; - int languageID; - String iPAdress; - String generalid; - int patientOutSA; - Null sessionID; - bool isDentalAllowedBackend; - int deviceTypeID; - String tokenID; - int patientID; - bool isRegister; - String dOB; - int isHijri; + int? patientIdentificationID; + int? patientMobileNumber; + String? zipCode; + double? versionID; + int? channel; + int? languageID; + String? iPAdress; + String? generalid; + int? patientOutSA; + dynamic sessionID; + bool? isDentalAllowedBackend; + int? deviceTypeID; + String? tokenID; + int? patientID; + bool? isRegister; + String? dOB; + int? isHijri; CheckPatientForRegistrationModel( {this.patientIdentificationID, diff --git a/lib/core/model/PatientRegistration/GetPatientInfoRequestModel.dart b/lib/core/model/PatientRegistration/GetPatientInfoRequestModel.dart index 254ddab5..b9d5f9ea 100644 --- a/lib/core/model/PatientRegistration/GetPatientInfoRequestModel.dart +++ b/lib/core/model/PatientRegistration/GetPatientInfoRequestModel.dart @@ -1,16 +1,16 @@ class GetPatientInfoRequestModel { - String patientIdentificationID; - String dOB; - int isHijri; - double versionID; - int channel; - int languageID; - String iPAdress; - String generalid; - int patientOutSA; - Null sessionID; - bool isDentalAllowedBackend; - int deviceTypeID; + String? patientIdentificationID; + String? dOB; + int? isHijri; + double? versionID; + int? channel; + int? languageID; + String? iPAdress; + String? generalid; + int? patientOutSA; + dynamic sessionID; + bool? isDentalAllowedBackend; + int? deviceTypeID; GetPatientInfoRequestModel( {this.patientIdentificationID, diff --git a/lib/core/model/PatientRegistration/GetPatientInfoResponseModel.dart b/lib/core/model/PatientRegistration/GetPatientInfoResponseModel.dart index 1de1ded4..a1a25e17 100644 --- a/lib/core/model/PatientRegistration/GetPatientInfoResponseModel.dart +++ b/lib/core/model/PatientRegistration/GetPatientInfoResponseModel.dart @@ -1,78 +1,78 @@ class GetPatientInfoResponseModel { dynamic date; - int languageID; - int serviceName; + int? languageID; + int? serviceName; dynamic time; dynamic androidLink; dynamic authenticationTokenID; dynamic data; - bool dataw; - int dietType; + bool? dataw; + int? dietType; dynamic errorCode; dynamic errorEndUserMessage; dynamic errorEndUserMessageN; dynamic errorMessage; - int errorType; - int foodCategory; + int? errorType; + int? foodCategory; dynamic iOSLink; - bool isAuthenticated; - int mealOrderStatus; - int mealType; - int messageStatus; - int numberOfResultRecords; + bool? isAuthenticated; + int? mealOrderStatus; + int? mealType; + int? messageStatus; + int? numberOfResultRecords; dynamic patientBlodType; dynamic successMsg; dynamic successMsgN; dynamic vidaUpdatedResponse; dynamic accessTokenObject; - int age; + int? age; dynamic clientIdentifierId; - int createdBy; - String dateOfBirth; - String firstNameAr; - String firstNameEn; - String gender; + int? createdBy; + String? dateOfBirth; + String? firstNameAr; + String? firstNameEn; + String? gender; dynamic genderAr; dynamic genderEn; - String healthId; - String idNumber; - String idType; - bool isHijri; - int isInstertedOrUpdated; - int isNull; - int isPatientExistNHIC; - bool isRecordLockedByCurrentUser; - String lastNameAr; - String lastNameEn; + String? healthId; + String? idNumber; + String? idType; + bool? isHijri; + int? isInstertedOrUpdated; + int? isNull; + int? isPatientExistNHIC; + bool? isRecordLockedByCurrentUser; + String? lastNameAr; + String? lastNameEn; dynamic listActiveAccessToken; - String maritalStatus; - String maritalStatusCode; - String nationalDateOfBirth; - String nationality; - String nationalityCode; - String occupation; + String? maritalStatus; + String? maritalStatusCode; + String? nationalDateOfBirth; + String? nationality; + String? nationalityCode; + String? occupation; dynamic pCDTransactionDataResultList; dynamic pCDGetVidaPatientForManualVerificationList; dynamic pCDNHICHMGPatientDetailsMatchCalulationList; - int pCDReturnValue; - String patientStatus; - String placeofBirth; + int? pCDReturnValue; + String? patientStatus; + String? placeofBirth; dynamic practitionerStatusCode; dynamic practitionerStatusDescAr; dynamic practitionerStatusDescEn; - int rowCount; - String secondNameAr; - String secondNameEn; - String thirdNameAr; - String thirdNameEn; + int? rowCount; + String? secondNameAr; + String? secondNameEn; + String? thirdNameAr; + String? thirdNameEn; dynamic yakeenVidaPatientDataStatisticsByPatientIdList; dynamic yakeenVidaPatientDataStatisticsList; dynamic yakeenVidaPatientDataStatisticsPrefferedList; dynamic accessToken; - int categoryCode; + int? categoryCode; dynamic categoryNameAr; dynamic categoryNameEn; - int constraintCode; + int? constraintCode; dynamic constraintNameAr; dynamic constraintNameEn; dynamic content; @@ -84,7 +84,7 @@ class GetPatientInfoResponseModel { dynamic licenseStatusDescEn; dynamic organizations; dynamic registrationNumber; - int specialtyCode; + int? specialtyCode; dynamic specialtyNameAr; dynamic specialtyNameEn; diff --git a/lib/core/model/PatientRegistration/PatientRegistrationModel.dart b/lib/core/model/PatientRegistration/PatientRegistrationModel.dart index f7139725..a73ecb0b 100644 --- a/lib/core/model/PatientRegistration/PatientRegistrationModel.dart +++ b/lib/core/model/PatientRegistration/PatientRegistrationModel.dart @@ -1,22 +1,22 @@ class PatientRegistrationModel { - Patientobject patientobject; - String patientIdentificationID; - String patientMobileNumber; - String logInTokenID; - double versionID; - int channel; - int languageID; - String iPAdress; - String generalid; - int patientOutSA; + Patientobject? patientobject; + String? patientIdentificationID; + String? patientMobileNumber; + String? logInTokenID; + double? versionID; + int? channel; + int? languageID; + String? iPAdress; + String? generalid; + int? patientOutSA; Null sessionID; - bool isDentalAllowedBackend; - int deviceTypeID; - String tokenID; - String dOB; - int isHijri; - String healthId; - String zipCode; + bool? isDentalAllowedBackend; + int? deviceTypeID; + String? tokenID; + String? dOB; + int? isHijri; + String? healthId; + String? zipCode; PatientRegistrationModel( {this.patientobject, @@ -64,7 +64,7 @@ class PatientRegistrationModel { Map toJson() { final Map data = new Map(); if (this.patientobject != null) { - data['Patientobject'] = this.patientobject.toJson(); + data['Patientobject'] = this.patientobject!.toJson(); } data['PatientIdentificationID'] = this.patientIdentificationID; data['PatientMobileNumber'] = this.patientMobileNumber; @@ -88,27 +88,27 @@ class PatientRegistrationModel { } class Patientobject { - bool tempValue; - int patientIdentificationType; - String patientIdentificationNo; - int mobileNumber; - int patientOutSA; - String firstNameN; - String middleNameN; - String lastNameN; - String firstName; - String middleName; - String lastName; - String strDateofBirth; - String dateofBirth; - int gender; - String nationalityID; - String dateofBirthN; - String emailAddress; - String sourceType; - String preferredLanguage; - String marital; - String eHealthIDField; + bool? tempValue; + int? patientIdentificationType; + String? patientIdentificationNo; + int? mobileNumber; + int? patientOutSA; + String? firstNameN; + String? middleNameN; + String? lastNameN; + String? firstName; + String? middleName; + String? lastName; + String? strDateofBirth; + String? dateofBirth; + int? gender; + String? nationalityID; + String? dateofBirthN; + String? emailAddress; + String? sourceType; + String? preferredLanguage; + String? marital; + String? eHealthIDField; Patientobject( {this.tempValue, diff --git a/lib/core/model/PatientRegistration/SendActivationCodebyOTPNotificationTypeForRegistrationModel.dart b/lib/core/model/PatientRegistration/SendActivationCodebyOTPNotificationTypeForRegistrationModel.dart index 5709e137..2af7743b 100644 --- a/lib/core/model/PatientRegistration/SendActivationCodebyOTPNotificationTypeForRegistrationModel.dart +++ b/lib/core/model/PatientRegistration/SendActivationCodebyOTPNotificationTypeForRegistrationModel.dart @@ -1,28 +1,28 @@ class SendActivationCodeByOTPNotificationTypeForRegistrationModel { - int patientMobileNumber; - String mobileNo; - int projectOutSA; - int loginType; - String zipCode; - bool isRegister; - String logInTokenID; - int searchType; - int patientID; - int nationalID; - int patientIdentificationID; - int oTPSendType; - int languageID; - double versionID; - int channel; - String iPAdress; - String generalid; - int patientOutSA; - Null sessionID; - bool isDentalAllowedBackend; - int deviceTypeID; - String dOB; - int isHijri; - String healthId; + int? patientMobileNumber; + String? mobileNo; + int? projectOutSA; + int? loginType; + String? zipCode; + bool? isRegister; + String? logInTokenID; + int? searchType; + int? patientID; + int? nationalID; + int? patientIdentificationID; + int? oTPSendType; + int? languageID; + double? versionID; + int? channel; + String? iPAdress; + String? generalid; + int? patientOutSA; + dynamic sessionID; + bool? isDentalAllowedBackend; + int? deviceTypeID; + String? dOB; + int? isHijri; + String? healthId; SendActivationCodeByOTPNotificationTypeForRegistrationModel( {this.patientMobileNumber, diff --git a/lib/core/model/Prescriptions/Prescriptions.dart b/lib/core/model/Prescriptions/Prescriptions.dart index d27d85d7..31900dfc 100644 --- a/lib/core/model/Prescriptions/Prescriptions.dart +++ b/lib/core/model/Prescriptions/Prescriptions.dart @@ -1,40 +1,40 @@ import 'package:doctor_app_flutter/utils/date-utils.dart'; class Prescriptions { - String setupID; - int projectID; - int patientID; - int appointmentNo; - String appointmentDate; - String doctorName; - String clinicDescription; - String name; - int episodeID; - int actualDoctorRate; - int admission; - int clinicID; - String companyName; - String despensedStatus; - DateTime dischargeDate; - int dischargeNo; - int doctorID; - String doctorImageURL; - int doctorRate; - String doctorTitle; - int gender; - String genderDescription; - bool isActiveDoctorProfile; - bool isDoctorAllowVedioCall; - bool isExecludeDoctor; - bool isInOutPatient; - bool isLiveCareAppointment; - String isInOutPatientDescription; - String isInOutPatientDescriptionN; - bool isInsurancePatient; - String nationalityFlagURL; - int noOfPatientsRate; - String qR; - List speciality; + String? setupID; + int? projectID; + int? patientID; + int? appointmentNo; + String? appointmentDate; + String? doctorName; + String? clinicDescription; + String? name; + int? episodeID; + int? actualDoctorRate; + int? admission; + int? clinicID; + String? companyName; + String? despensedStatus; + DateTime? dischargeDate; + int? dischargeNo; + int? doctorID; + String? doctorImageURL; + int? doctorRate; + String? doctorTitle; + int? gender; + String? genderDescription; + bool? isActiveDoctorProfile; + bool? isDoctorAllowVedioCall; + bool? isExecludeDoctor; + bool? isInOutPatient; + bool? isLiveCareAppointment; + String? isInOutPatientDescription; + String? isInOutPatientDescriptionN; + bool? isInsurancePatient; + String? nationalityFlagURL; + int? noOfPatientsRate; + String? qR; + List? speciality; Prescriptions( {this.setupID, @@ -150,10 +150,10 @@ class Prescriptions { } class PrescriptionsList { - String filterName = ""; - List prescriptionsList = List(); + String? filterName = ""; + List? prescriptionsList = []; - PrescriptionsList({this.filterName, Prescriptions prescriptions}) { - prescriptionsList.add(prescriptions); + PrescriptionsList({this.filterName, Prescriptions? prescriptions}) { + prescriptionsList!.add(prescriptions!); } } diff --git a/lib/core/model/Prescriptions/get_medication_for_inpatient_model.dart b/lib/core/model/Prescriptions/get_medication_for_inpatient_model.dart index 8ba07f2a..4644131e 100644 --- a/lib/core/model/Prescriptions/get_medication_for_inpatient_model.dart +++ b/lib/core/model/Prescriptions/get_medication_for_inpatient_model.dart @@ -1,40 +1,40 @@ class GetMedicationForInPatientModel { - String setupID; - int projectID; - int admissionNo; - int patientID; - int orderNo; - int prescriptionNo; - int lineItemNo; - String prescriptionDatetime; - int itemID; - int directionID; - int refillID; - String dose; - int unitofMeasurement; - String startDatetime; - String stopDatetime; - int noOfDoses; - int routeId; - String comments; - int reviewedPharmacist; + String? setupID; + int? projectID; + int? admissionNo; + int? patientID; + int? orderNo; + int? prescriptionNo; + int? lineItemNo; + String? prescriptionDatetime; + int? itemID; + int? directionID; + int? refillID; + String? dose; + int? unitofMeasurement; + String? startDatetime; + String? stopDatetime; + int? noOfDoses; + int? routeId; + String? comments; + int? reviewedPharmacist; dynamic reviewedPharmacistDatetime; dynamic discountinueDatetime; dynamic rescheduleDatetime; - int status; - String statusDescription; - int createdBy; - String createdOn; + int? status; + String? statusDescription; + int? createdBy; + String? createdOn; dynamic editedBy; dynamic editedOn; dynamic strength; - String pHRItemDescription; - String pHRItemDescriptionN; - String doctorName; - String uomDescription; - String routeDescription; - String directionDescription; - String refillDescription; + String? pHRItemDescription; + String? pHRItemDescriptionN; + String? doctorName; + String? uomDescription; + String? routeDescription; + String? directionDescription; + String? refillDescription; GetMedicationForInPatientModel( {this.setupID, diff --git a/lib/core/model/Prescriptions/get_medication_for_inpatient_request_model.dart b/lib/core/model/Prescriptions/get_medication_for_inpatient_request_model.dart index 7c906643..71c1305a 100644 --- a/lib/core/model/Prescriptions/get_medication_for_inpatient_request_model.dart +++ b/lib/core/model/Prescriptions/get_medication_for_inpatient_request_model.dart @@ -1,16 +1,16 @@ class GetMedicationForInPatientRequestModel { - bool isDentalAllowedBackend; - double versionID; - int channel; - int languageID; - String iPAdress; - String generalid; - int deviceTypeID; - String tokenID; - int patientID; - int admissionNo; - String sessionID; - int projectID; + bool? isDentalAllowedBackend; + double? versionID; + int? channel; + int? languageID; + String? iPAdress; + String? generalid; + int? deviceTypeID; + String? tokenID; + int? patientID; + int? admissionNo; + String? sessionID; + int? projectID; GetMedicationForInPatientRequestModel( {this.isDentalAllowedBackend, diff --git a/lib/core/model/Prescriptions/in_patient_prescription_model.dart b/lib/core/model/Prescriptions/in_patient_prescription_model.dart index f6e88bf7..3f67e659 100644 --- a/lib/core/model/Prescriptions/in_patient_prescription_model.dart +++ b/lib/core/model/Prescriptions/in_patient_prescription_model.dart @@ -1,5 +1,5 @@ class InPatientPrescriptionRequestModel { - String vidaAuthTokenID; + String? vidaAuthTokenID; dynamic patientMRN; dynamic appNo; dynamic admissionNo; diff --git a/lib/core/model/Prescriptions/perscription_pharmacy.dart b/lib/core/model/Prescriptions/perscription_pharmacy.dart index 4634d30e..e443a67c 100644 --- a/lib/core/model/Prescriptions/perscription_pharmacy.dart +++ b/lib/core/model/Prescriptions/perscription_pharmacy.dart @@ -1,28 +1,28 @@ class PharmacyPrescriptions { - String expiryDate; + String? expiryDate; dynamic sellingPrice; - int quantity; - int itemID; - int locationID; - int projectID; - String setupID; - String locationDescription; - Null locationDescriptionN; - String itemDescription; - Null itemDescriptionN; - String alias; - int locationTypeID; - int barcode; - Null companybarcode; - int cityID; - String cityName; - int distanceInKilometers; - String latitude; - int locationType; - String longitude; - String phoneNumber; - String projectImageURL; - Null sortOrder; + int? quantity; + int? itemID; + int? locationID; + int? projectID; + String? setupID; + String? locationDescription; + dynamic locationDescriptionN; + String? itemDescription; + dynamic itemDescriptionN; + String? alias; + int? locationTypeID; + int? barcode; + dynamic companybarcode; + int? cityID; + String? cityName; + int? distanceInKilometers; + String? latitude; + int? locationType; + String? longitude; + String? phoneNumber; + String? projectImageURL; + dynamic sortOrder; PharmacyPrescriptions( {this.expiryDate, diff --git a/lib/core/model/Prescriptions/post_prescrition_req_model.dart b/lib/core/model/Prescriptions/post_prescrition_req_model.dart index 06a524ed..d7c484d7 100644 --- a/lib/core/model/Prescriptions/post_prescrition_req_model.dart +++ b/lib/core/model/Prescriptions/post_prescrition_req_model.dart @@ -1,10 +1,10 @@ class PostPrescriptionReqModel { - String vidaAuthTokenID; - int clinicID; - int episodeID; - int appointmentNo; - int patientMRN; - List prescriptionRequestModel; + String? vidaAuthTokenID; + int? clinicID; + int? episodeID; + int? appointmentNo; + int? patientMRN; + List? prescriptionRequestModel; PostPrescriptionReqModel( {this.vidaAuthTokenID, @@ -21,9 +21,9 @@ class PostPrescriptionReqModel { appointmentNo = json['AppointmentNo']; patientMRN = json['PatientMRN']; if (json['prescriptionRequestModel'] != null) { - prescriptionRequestModel = new List(); + prescriptionRequestModel = []; json['prescriptionRequestModel'].forEach((v) { - prescriptionRequestModel.add(new PrescriptionRequestModel.fromJson(v)); + prescriptionRequestModel!.add(new PrescriptionRequestModel.fromJson(v)); }); } } @@ -37,25 +37,25 @@ class PostPrescriptionReqModel { data['PatientMRN'] = this.patientMRN; if (this.prescriptionRequestModel != null) { data['prescriptionRequestModel'] = - this.prescriptionRequestModel.map((v) => v.toJson()).toList(); + this.prescriptionRequestModel!.map((v) => v.toJson()).toList(); } return data; } } class PrescriptionRequestModel { - int itemId; - String doseStartDate; - int duration; - double dose; - int doseUnitId; - int route; - int frequency; - int doseTime; - bool covered; - bool approvalRequired; - String remarks; - String icdcode10Id; + int? itemId; + String? doseStartDate; + int? duration; + double? dose; + int? doseUnitId; + int? route; + int? frequency; + int? doseTime; + bool? covered; + bool? approvalRequired; + String? remarks; + String? icdcode10Id; PrescriptionRequestModel({ this.itemId, diff --git a/lib/core/model/Prescriptions/prescription_in_patient.dart b/lib/core/model/Prescriptions/prescription_in_patient.dart index c66bc8a4..bbb2b756 100644 --- a/lib/core/model/Prescriptions/prescription_in_patient.dart +++ b/lib/core/model/Prescriptions/prescription_in_patient.dart @@ -1,50 +1,50 @@ class PrescriotionInPatient { - int admissionNo; - int authorizedBy; + int? admissionNo; + int? authorizedBy; dynamic bedNo; - String comments; - int createdBy; - String createdByName; + String? comments; + int? createdBy; + String? createdByName; dynamic createdByNameN; - String createdOn; - String direction; - int directionID; + String? createdOn; + String? direction; + int? directionID; dynamic directionN; - String dose; - int editedBy; + String? dose; + int? editedBy; dynamic iVDiluentLine; - int iVDiluentType; + int? iVDiluentType; dynamic iVDiluentVolume; dynamic iVRate; dynamic iVStability; - String itemDescription; - int itemID; - int lineItemNo; - int locationId; - int noOfDoses; - int orderNo; - int patientID; - String pharmacyRemarks; - String prescriptionDatetime; - int prescriptionNo; - String processedBy; - int projectID; - int refillID; - String refillType; + String? itemDescription; + int? itemID; + int? lineItemNo; + int? locationId; + int? noOfDoses; + int? orderNo; + int? patientID; + String? pharmacyRemarks; + String? prescriptionDatetime; + int? prescriptionNo; + String? processedBy; + int? projectID; + int? refillID; + String? refillType; dynamic refillTypeN; - int reviewedPharmacist; + int? reviewedPharmacist; dynamic roomId; - String route; - int routeId; + String? route; + int? routeId; dynamic routeN; dynamic setupID; - String startDatetime; - int status; - String statusDescription; + String? startDatetime; + int? status; + String? statusDescription; dynamic statusDescriptionN; - String stopDatetime; - int unitofMeasurement; - String unitofMeasurementDescription; + String? stopDatetime; + int? unitofMeasurement; + String? unitofMeasurementDescription; dynamic unitofMeasurementDescriptionN; PrescriotionInPatient( diff --git a/lib/core/model/Prescriptions/prescription_model.dart b/lib/core/model/Prescriptions/prescription_model.dart index a286908f..1029829f 100644 --- a/lib/core/model/Prescriptions/prescription_model.dart +++ b/lib/core/model/Prescriptions/prescription_model.dart @@ -1,7 +1,7 @@ import 'package:doctor_app_flutter/core/model/Prescriptions/prescription_entity_model.dart'; class PrescriptionModel { - List entityList; + List? entityList; dynamic rowcount; dynamic statusMessage; @@ -9,9 +9,9 @@ class PrescriptionModel { PrescriptionModel.fromJson(Map json) { if (json['entityList'] != null) { - entityList = new List(); + entityList = []; json['entityList'].forEach((v) { - entityList.add(new PrescriptionEntityModel.fromJson(v)); + entityList!.add(new PrescriptionEntityModel.fromJson(v)); }); } rowcount = json['rowcount']; @@ -21,7 +21,7 @@ class PrescriptionModel { Map toJson() { final Map data = new Map(); if (this.entityList != null) { - data['entityList'] = this.entityList.map((v) => v.toJson()).toList(); + data['entityList'] = this.entityList!.map((v) => v.toJson()).toList(); } data['rowcount'] = this.rowcount; data['statusMessage'] = this.statusMessage; diff --git a/lib/core/model/Prescriptions/prescription_report.dart b/lib/core/model/Prescriptions/prescription_report.dart index 006a6fad..ded50def 100644 --- a/lib/core/model/Prescriptions/prescription_report.dart +++ b/lib/core/model/Prescriptions/prescription_report.dart @@ -1,48 +1,48 @@ class PrescriptionReport { - String address; + String? address; dynamic appodynamicmentNo; - String clinic; - String companyName; + String? clinic; + String? companyName; dynamic days; - String doctorName; + String? doctorName; var doseDailyQuantity; - String frequency; + String? frequency; dynamic frequencyNumber; - String image; - String imageExtension; - String imageSRCUrl; - String imageString; - String imageThumbUrl; - String isCovered; - String itemDescription; + String? image; + String? imageExtension; + String? imageSRCUrl; + String? imageString; + String? imageThumbUrl; + String? isCovered; + String? itemDescription; dynamic itemID; - String orderDate; + String? orderDate; dynamic patientID; - String patientName; - String phoneOffice1; - String prescriptionQR; + String? patientName; + String? phoneOffice1; + String? prescriptionQR; dynamic prescriptionTimes; - String productImage; - String productImageBase64; - String productImageString; + String? productImage; + String? productImageBase64; + String? productImageString; dynamic projectID; - String projectName; - String remarks; - String route; - String sKU; + String? projectName; + String? remarks; + String? route; + String? sKU; dynamic scaleOffset; - String startDate; + String? startDate; - String patientAge; - String patientGender; - String phoneOffice; + String? patientAge; + String? patientGender; + String? phoneOffice; dynamic doseTimingID; dynamic frequencyID; dynamic routeID; - String name; - String itemDescriptionN; - String routeN; - String frequencyN; + String? name; + String? itemDescriptionN; + String? routeN; + String? frequencyN; PrescriptionReport({ this.address, diff --git a/lib/core/model/Prescriptions/prescription_report_enh.dart b/lib/core/model/Prescriptions/prescription_report_enh.dart index e73034bd..52044ffe 100644 --- a/lib/core/model/Prescriptions/prescription_report_enh.dart +++ b/lib/core/model/Prescriptions/prescription_report_enh.dart @@ -1,37 +1,37 @@ class PrescriptionReportEnh { - String address; + String? address; dynamic appodynamicmentNo; - String clinic; + String? clinic; dynamic companyName; dynamic days; - String doctorName; + String? doctorName; dynamic doseDailyQuantity; - String frequency; + String? frequency; dynamic frequencyNumber; dynamic image; dynamic imageExtension; - String imageSRCUrl; + String? imageSRCUrl; dynamic imageString; - String imageThumbUrl; - String isCovered; - String itemDescription; + String? imageThumbUrl; + String? isCovered; + String? itemDescription; dynamic itemID; - String orderDate; + String? orderDate; dynamic patientID; - String patientName; - String phoneOffice1; + String? patientName; + String? phoneOffice1; dynamic prescriptionQR; dynamic prescriptionTimes; dynamic productImage; dynamic productImageBase64; - String productImageString; + String? productImageString; dynamic projectID; - String projectName; - String remarks; - String route; - String sKU; + String? projectName; + String? remarks; + String? route; + String? sKU; dynamic scaleOffset; - String startDate; + String? startDate; PrescriptionReportEnh( {this.address, diff --git a/lib/core/model/Prescriptions/prescriptions_order.dart b/lib/core/model/Prescriptions/prescriptions_order.dart index 24015eaa..dee3c6ef 100644 --- a/lib/core/model/Prescriptions/prescriptions_order.dart +++ b/lib/core/model/Prescriptions/prescriptions_order.dart @@ -1,32 +1,32 @@ import 'package:doctor_app_flutter/utils/date-utils.dart'; class PrescriptionsOrder { - int iD; + int? iD; dynamic patientID; - bool patientOutSA; - bool isOutPatient; - int projectID; - int nearestProjectID; - double longitude; - double latitude; + bool? patientOutSA; + bool? isOutPatient; + int? projectID; + int? nearestProjectID; + double? longitude; + double? latitude; dynamic appointmentNo; dynamic dischargeID; - int lineItemNo; - int status; + int? lineItemNo; + int? status; dynamic description; dynamic descriptionN; - DateTime createdOn; - int serviceID; - int createdBy; - DateTime editedOn; - int editedBy; - int channel; + DateTime? createdOn; + int? serviceID; + int? createdBy; + DateTime? editedOn; + int? editedBy; + int? channel; dynamic clientRequestID; - bool returnedToQueue; + bool? returnedToQueue; dynamic pickupDateTime; dynamic pickupLocationName; dynamic dropoffLocationName; - int realRRTHaveTransactions; + int? realRRTHaveTransactions; dynamic nearestProjectDescription; dynamic nearestProjectDescriptionN; dynamic projectDescription; diff --git a/lib/core/model/Prescriptions/request_get_list_pharmacy_for_prescriptions.dart b/lib/core/model/Prescriptions/request_get_list_pharmacy_for_prescriptions.dart index e7d968c5..21772d3b 100644 --- a/lib/core/model/Prescriptions/request_get_list_pharmacy_for_prescriptions.dart +++ b/lib/core/model/Prescriptions/request_get_list_pharmacy_for_prescriptions.dart @@ -1,16 +1,16 @@ class RequestGetListPharmacyForPrescriptions { - int latitude; - int longitude; - double versionID; - int channel; - int languageID; - String iPAdress; - String generalid; - int patientOutSA; - String sessionID; - bool isDentalAllowedBackend; - int deviceTypeID; - int itemID; + int? latitude; + int? longitude; + double? versionID; + int? channel; + int? languageID; + String? iPAdress; + String? generalid; + int? patientOutSA; + String? sessionID; + bool? isDentalAllowedBackend; + int? deviceTypeID; + int? itemID; RequestGetListPharmacyForPrescriptions( {this.latitude, diff --git a/lib/core/model/Prescriptions/request_prescription_report.dart b/lib/core/model/Prescriptions/request_prescription_report.dart index edd249ee..73b6655c 100644 --- a/lib/core/model/Prescriptions/request_prescription_report.dart +++ b/lib/core/model/Prescriptions/request_prescription_report.dart @@ -1,23 +1,23 @@ class RequestPrescriptionReport { - double versionID; - int channel; - int languageID; - String iPAdress; - String generalid; - int patientOutSA; - String sessionID; - bool isDentalAllowedBackend; - int deviceTypeID; - int patientID; - String tokenID; - int patientTypeID; - int patientType; - int appointmentNo; - String setupID; - int episodeID; - int clinicID; - int projectID; - int dischargeNo; + double? versionID; + int? channel; + int? languageID; + String? iPAdress; + String? generalid; + int? patientOutSA; + String? sessionID; + bool? isDentalAllowedBackend; + int? deviceTypeID; + int? patientID; + String? tokenID; + int? patientTypeID; + int? patientType; + int? appointmentNo; + String? setupID; + int? episodeID; + int? clinicID; + int? projectID; + int? dischargeNo; RequestPrescriptionReport( {this.versionID, diff --git a/lib/core/model/Prescriptions/request_prescription_report_enh.dart b/lib/core/model/Prescriptions/request_prescription_report_enh.dart index 48b4f435..f7d45133 100644 --- a/lib/core/model/Prescriptions/request_prescription_report_enh.dart +++ b/lib/core/model/Prescriptions/request_prescription_report_enh.dart @@ -1,23 +1,23 @@ class RequestPrescriptionReportEnh { - double versionID; - int channel; - int languageID; - String iPAdress; - String generalid; - int patientOutSA; - String sessionID; - bool isDentalAllowedBackend; - int deviceTypeID; - int patientID; - String tokenID; - int patientTypeID; - int patientType; - int appointmentNo; - String setupID; - int dischargeNo; - int episodeID; - int clinicID; - int projectID; + double? versionID; + int? channel; + int? languageID; + String? iPAdress; + String? generalid; + int? patientOutSA; + String? sessionID; + bool? isDentalAllowedBackend; + int? deviceTypeID; + int? patientID; + String? tokenID; + int? patientTypeID; + int? patientType; + int? appointmentNo; + String? setupID; + int? dischargeNo; + int? episodeID; + int? clinicID; + int? projectID; RequestPrescriptionReportEnh( {this.versionID, diff --git a/lib/core/model/SOAP/allergy/get_allergies_request_model.dart b/lib/core/model/SOAP/allergy/get_allergies_request_model.dart index 2220f243..e8581d1a 100644 --- a/lib/core/model/SOAP/allergy/get_allergies_request_model.dart +++ b/lib/core/model/SOAP/allergy/get_allergies_request_model.dart @@ -1,9 +1,9 @@ class GetAllergiesRequestModel { - String vidaAuthTokenID; - int patientMRN; - int appointmentNo; - int episodeId; - String doctorID; + String? vidaAuthTokenID; + int? patientMRN; + int? appointmentNo; + int? episodeId; + String? doctorID; GetAllergiesRequestModel( {this.vidaAuthTokenID, diff --git a/lib/core/model/SOAP/allergy/get_allergies_res_model.dart b/lib/core/model/SOAP/allergy/get_allergies_res_model.dart index d3eac57d..745b169a 100644 --- a/lib/core/model/SOAP/allergy/get_allergies_res_model.dart +++ b/lib/core/model/SOAP/allergy/get_allergies_res_model.dart @@ -1,17 +1,17 @@ class GetAllergiesResModel { - int allergyDiseaseId; - String allergyDiseaseName; - int allergyDiseaseType; - int appointmentNo; - int createdBy; - String createdByName; - String createdOn; - int episodeID; - bool isChecked; - bool isUpdatedByNurse; - int severity; - String severityName; - String remarks; + int? allergyDiseaseId; + String? allergyDiseaseName; + int? allergyDiseaseType; + int? appointmentNo; + int? createdBy; + String? createdByName; + String? createdOn; + int? episodeID; + bool? isChecked; + bool? isUpdatedByNurse; + int? severity; + String? severityName; + String? remarks; GetAllergiesResModel( {this.allergyDiseaseId, diff --git a/lib/core/model/SOAP/allergy/post_allergy_request_model.dart b/lib/core/model/SOAP/allergy/post_allergy_request_model.dart index a179da06..6be4ffe2 100644 --- a/lib/core/model/SOAP/allergy/post_allergy_request_model.dart +++ b/lib/core/model/SOAP/allergy/post_allergy_request_model.dart @@ -1,16 +1,13 @@ class PostAllergyRequestModel { - List - listHisProgNotePatientAllergyDiseaseVM; + List? listHisProgNotePatientAllergyDiseaseVM; PostAllergyRequestModel({this.listHisProgNotePatientAllergyDiseaseVM}); PostAllergyRequestModel.fromJson(Map json) { if (json['listHisProgNotePatientAllergyDiseaseVM'] != null) { - listHisProgNotePatientAllergyDiseaseVM = - new List(); + listHisProgNotePatientAllergyDiseaseVM = []; json['listHisProgNotePatientAllergyDiseaseVM'].forEach((v) { - listHisProgNotePatientAllergyDiseaseVM - .add(new ListHisProgNotePatientAllergyDiseaseVM.fromJson(v)); + listHisProgNotePatientAllergyDiseaseVM!.add(new ListHisProgNotePatientAllergyDiseaseVM.fromJson(v)); }); } } @@ -18,29 +15,26 @@ class PostAllergyRequestModel { Map toJson() { final Map data = new Map(); if (this.listHisProgNotePatientAllergyDiseaseVM != null) { - data['listHisProgNotePatientAllergyDiseaseVM'] = this - .listHisProgNotePatientAllergyDiseaseVM - .map((v) => v.toJson()) - .toList(); + data['listHisProgNotePatientAllergyDiseaseVM'] = this.listHisProgNotePatientAllergyDiseaseVM!.map((v) => v.toJson()).toList(); } return data; } } class ListHisProgNotePatientAllergyDiseaseVM { - int patientMRN; - int allergyDiseaseType; - int allergyDiseaseId; - int episodeId; - int appointmentNo; - int severity; - bool isChecked; - bool isUpdatedByNurse; - String remarks; - int createdBy; - String createdOn; - int editedBy; - String editedOn; + int? patientMRN; + int? allergyDiseaseType; + int? allergyDiseaseId; + int? episodeId; + int? appointmentNo; + int? severity; + bool? isChecked; + bool? isUpdatedByNurse; + String? remarks; + int? createdBy; + String? createdOn; + int? editedBy; + String? editedOn; ListHisProgNotePatientAllergyDiseaseVM( {this.patientMRN, diff --git a/lib/core/model/SOAP/assessment/get_assessment_req_model.dart b/lib/core/model/SOAP/assessment/get_assessment_req_model.dart index 0c71982e..fffe4f92 100644 --- a/lib/core/model/SOAP/assessment/get_assessment_req_model.dart +++ b/lib/core/model/SOAP/assessment/get_assessment_req_model.dart @@ -1,10 +1,10 @@ class GetAssessmentReqModel { - int patientMRN; - int appointmentNo; - String episodeID; - String from; - String to; - int clinicID; + int? patientMRN; + int? appointmentNo; + String? episodeID; + String? from; + String? to; + int? clinicID; dynamic doctorID; dynamic editedBy; diff --git a/lib/core/model/SOAP/assessment/get_assessment_res_model.dart b/lib/core/model/SOAP/assessment/get_assessment_res_model.dart index ca460c81..fb92f994 100644 --- a/lib/core/model/SOAP/assessment/get_assessment_res_model.dart +++ b/lib/core/model/SOAP/assessment/get_assessment_res_model.dart @@ -1,19 +1,19 @@ class GetAssessmentResModel { - int appointmentNo; - String asciiDesc; - String clinicDescription; - int clinicID; - bool complexDiagnosis; - int conditionID; - int createdBy; - String createdOn; - int diagnosisTypeID; - int doctorID; - String doctorName; - int episodeId; - String icdCode10ID; - int patientMRN; - String remarks; + int? appointmentNo; + String? asciiDesc; + String? clinicDescription; + int? clinicID; + bool? complexDiagnosis; + int? conditionID; + int? createdBy; + String? createdOn; + int? diagnosisTypeID; + int? doctorID; + String? doctorName; + int? episodeId; + String? icdCode10ID; + int? patientMRN; + String? remarks; GetAssessmentResModel( {this.appointmentNo, diff --git a/lib/core/model/SOAP/assessment/patch_assessment_req_model.dart b/lib/core/model/SOAP/assessment/patch_assessment_req_model.dart index fb229127..c52a6a51 100644 --- a/lib/core/model/SOAP/assessment/patch_assessment_req_model.dart +++ b/lib/core/model/SOAP/assessment/patch_assessment_req_model.dart @@ -1,13 +1,13 @@ class PatchAssessmentReqModel { - int patientMRN; - int appointmentNo; - int episodeID; - String icdcode10Id; - String prevIcdCode10ID; - int conditionId; - int diagnosisTypeId; - bool complexDiagnosis; - String remarks; + int? patientMRN; + int? appointmentNo; + int? episodeID; + String? icdcode10Id; + String? prevIcdCode10ID; + int? conditionId; + int? diagnosisTypeId; + bool? complexDiagnosis; + String? remarks; PatchAssessmentReqModel( {this.patientMRN, diff --git a/lib/core/model/SOAP/assessment/post_assessment_request_model.dart b/lib/core/model/SOAP/assessment/post_assessment_request_model.dart index 5cda0524..0c6bd784 100644 --- a/lib/core/model/SOAP/assessment/post_assessment_request_model.dart +++ b/lib/core/model/SOAP/assessment/post_assessment_request_model.dart @@ -1,8 +1,8 @@ class PostAssessmentRequestModel { - int patientMRN; - int appointmentNo; - int episodeId; - List icdCodeDetails; + int? patientMRN; + int? appointmentNo; + int? episodeId; + List? icdCodeDetails; PostAssessmentRequestModel( {this.patientMRN, @@ -15,9 +15,9 @@ class PostAssessmentRequestModel { appointmentNo = json['AppointmentNo']; episodeId = json['EpisodeID']; if (json['icdCodeDetails'] != null) { - icdCodeDetails = new List(); + icdCodeDetails = []; json['icdCodeDetails'].forEach((v) { - icdCodeDetails.add(new IcdCodeDetails.fromJson(v)); + icdCodeDetails!.add(new IcdCodeDetails.fromJson(v)); }); } } @@ -29,18 +29,18 @@ class PostAssessmentRequestModel { data['EpisodeID'] = this.episodeId; if (this.icdCodeDetails != null) { data['icdCodeDetails'] = - this.icdCodeDetails.map((v) => v.toJson()).toList(); + this.icdCodeDetails!.map((v) => v.toJson()).toList(); } return data; } } class IcdCodeDetails { - String icdcode10Id; - int conditionId; - int diagnosisTypeId; - bool complexDiagnosis; - String remarks; + String? icdcode10Id; + int? conditionId; + int? diagnosisTypeId; + bool? complexDiagnosis; + String? remarks; IcdCodeDetails( {this.icdcode10Id, diff --git a/lib/core/model/SOAP/chief_complaint/get_chief_complaint_req_model.dart b/lib/core/model/SOAP/chief_complaint/get_chief_complaint_req_model.dart index b8b7f38c..9f7f0fa7 100644 --- a/lib/core/model/SOAP/chief_complaint/get_chief_complaint_req_model.dart +++ b/lib/core/model/SOAP/chief_complaint/get_chief_complaint_req_model.dart @@ -1,10 +1,10 @@ class GetChiefComplaintReqModel { - int patientMRN; - int appointmentNo; - int episodeId; - int episodeID; + int? patientMRN; + int? appointmentNo; + int? episodeId; + int? episodeID; dynamic doctorID; - int admissionNo; + int? admissionNo; GetChiefComplaintReqModel( {this.patientMRN, diff --git a/lib/core/model/SOAP/chief_complaint/get_chief_complaint_res_model.dart b/lib/core/model/SOAP/chief_complaint/get_chief_complaint_res_model.dart index 16a524ef..12fc142c 100644 --- a/lib/core/model/SOAP/chief_complaint/get_chief_complaint_res_model.dart +++ b/lib/core/model/SOAP/chief_complaint/get_chief_complaint_res_model.dart @@ -1,16 +1,16 @@ class GetChiefComplaintResModel { - int appointmentNo; - String ccdate; - String chiefComplaint; - String clinicDescription; - int clinicID; - String currentMedication; - int doctorID; - String doctorName; - int episodeId; - String hopi; - int patientMRN; - int status; + int? appointmentNo; + String? ccdate; + String? chiefComplaint; + String? clinicDescription; + int? clinicID; + String? currentMedication; + int? doctorID; + String? doctorName; + int? episodeId; + String? hopi; + int? patientMRN; + int? status; GetChiefComplaintResModel( {this.appointmentNo, diff --git a/lib/core/model/SOAP/chief_complaint/post_chief_complaint_request_model.dart b/lib/core/model/SOAP/chief_complaint/post_chief_complaint_request_model.dart index 682342df..56b97a92 100644 --- a/lib/core/model/SOAP/chief_complaint/post_chief_complaint_request_model.dart +++ b/lib/core/model/SOAP/chief_complaint/post_chief_complaint_request_model.dart @@ -1,14 +1,14 @@ class PostChiefComplaintRequestModel { - int appointmentNo; - int episodeID; - int patientMRN; - int admissionNo; - String chiefComplaint; - String hopi; - String currentMedication; - bool ispregnant; - bool isLactation; - int numberOfWeeks; + int? appointmentNo; + int? episodeID; + int? patientMRN; + int? admissionNo; + String? chiefComplaint; + String? hopi; + String? currentMedication; + bool? ispregnant; + bool? isLactation; + int? numberOfWeeks; dynamic doctorID; dynamic editedBy; diff --git a/lib/core/model/SOAP/general_get_req_for_SOAP.dart b/lib/core/model/SOAP/general_get_req_for_SOAP.dart index 70e76313..65ba7d6b 100644 --- a/lib/core/model/SOAP/general_get_req_for_SOAP.dart +++ b/lib/core/model/SOAP/general_get_req_for_SOAP.dart @@ -1,7 +1,7 @@ class GeneralGetReqForSOAP { - int patientMRN; - int appointmentNo; - int episodeId; + int? patientMRN; + int? appointmentNo; + int? episodeId; dynamic editedBy; dynamic doctorID; diff --git a/lib/core/model/SOAP/history/get_history_req_model.dart b/lib/core/model/SOAP/history/get_history_req_model.dart index 2211c4f4..b4a5f404 100644 --- a/lib/core/model/SOAP/history/get_history_req_model.dart +++ b/lib/core/model/SOAP/history/get_history_req_model.dart @@ -1,11 +1,11 @@ class GetHistoryReqModel { - int patientMRN; - int historyType; - String episodeID; - String from; - String to; - int clinicID; - int appointmentNo; + int? patientMRN; + int? historyType; + String? episodeID; + String? from; + String? to; + int? clinicID; + int? appointmentNo; dynamic editedBy; dynamic doctorID; diff --git a/lib/core/model/SOAP/history/get_history_res_model.dart b/lib/core/model/SOAP/history/get_history_res_model.dart index 078a2caa..9773aea8 100644 --- a/lib/core/model/SOAP/history/get_history_res_model.dart +++ b/lib/core/model/SOAP/history/get_history_res_model.dart @@ -1,11 +1,11 @@ class GetHistoryResModel { - int appointmentNo; - int episodeId; - int historyId; - int historyType; - bool isChecked; - int patientMRN; - String remarks; + int? appointmentNo; + int? episodeId; + int? historyId; + int? historyType; + bool? isChecked; + int? patientMRN; + String? remarks; GetHistoryResModel( {this.appointmentNo, diff --git a/lib/core/model/SOAP/history/post_histories_request_model.dart b/lib/core/model/SOAP/history/post_histories_request_model.dart index 7d15974c..a2516fe9 100644 --- a/lib/core/model/SOAP/history/post_histories_request_model.dart +++ b/lib/core/model/SOAP/history/post_histories_request_model.dart @@ -1,14 +1,14 @@ class PostHistoriesRequestModel { - List listMedicalHistoryVM; + List? listMedicalHistoryVM; dynamic doctorID; PostHistoriesRequestModel({this.listMedicalHistoryVM, this.doctorID}); PostHistoriesRequestModel.fromJson(Map json) { if (json['listMedicalHistoryVM'] != null) { - listMedicalHistoryVM = new List(); + listMedicalHistoryVM = []; json['listMedicalHistoryVM'].forEach((v) { - listMedicalHistoryVM.add(new ListMedicalHistoryVM.fromJson(v)); + listMedicalHistoryVM!.add(new ListMedicalHistoryVM.fromJson(v)); }); } doctorID = json['DoctorID']; @@ -18,7 +18,7 @@ class PostHistoriesRequestModel { final Map data = new Map(); if (this.listMedicalHistoryVM != null) { data['listMedicalHistoryVM'] = - this.listMedicalHistoryVM.map((v) => v.toJson()).toList(); + this.listMedicalHistoryVM!.map((v) => v.toJson()).toList(); } data['DoctorID'] = this.doctorID; return data; @@ -26,13 +26,13 @@ class PostHistoriesRequestModel { } class ListMedicalHistoryVM { - int patientMRN; - int historyType; - int historyId; - int episodeId; - int appointmentNo; - bool isChecked; - String remarks; + int? patientMRN; + int? historyType; + int? historyId; + int? episodeId; + int? appointmentNo; + bool? isChecked; + String? remarks; ListMedicalHistoryVM( {this.patientMRN, diff --git a/lib/core/model/SOAP/in_patient/get_episode_for_inpatient_req_model.dart b/lib/core/model/SOAP/in_patient/get_episode_for_inpatient_req_model.dart index 2b49066e..4d5efc98 100644 --- a/lib/core/model/SOAP/in_patient/get_episode_for_inpatient_req_model.dart +++ b/lib/core/model/SOAP/in_patient/get_episode_for_inpatient_req_model.dart @@ -1,7 +1,7 @@ class GetEpisodeForInpatientReqModel { - int patientID; - int patientTypeID; - int admissionNo; + int? patientID; + int? patientTypeID; + int? admissionNo; GetEpisodeForInpatientReqModel( {this.patientID, this.patientTypeID, this.admissionNo}); diff --git a/lib/core/model/SOAP/in_patient/post_episode_for_Inpatient_request_model.dart b/lib/core/model/SOAP/in_patient/post_episode_for_Inpatient_request_model.dart index 2dff7a60..b9ea104e 100644 --- a/lib/core/model/SOAP/in_patient/post_episode_for_Inpatient_request_model.dart +++ b/lib/core/model/SOAP/in_patient/post_episode_for_Inpatient_request_model.dart @@ -1,7 +1,7 @@ class PostEpisodeForInpatientRequestModel { - int admissionNo; - int patientID; - int patientTypeID; + int? admissionNo; + int? patientID; + int? patientTypeID; PostEpisodeForInpatientRequestModel( {this.admissionNo, this.patientID, this.patientTypeID = 1}); diff --git a/lib/core/model/SOAP/master_key_model.dart b/lib/core/model/SOAP/master_key_model.dart index 070eab08..0f1a4c5a 100644 --- a/lib/core/model/SOAP/master_key_model.dart +++ b/lib/core/model/SOAP/master_key_model.dart @@ -1,6 +1,6 @@ class MasterKeyModel { - String alias; - String aliasN; + String? alias; + String? aliasN; dynamic code; dynamic description; dynamic detail1; @@ -8,13 +8,13 @@ class MasterKeyModel { dynamic detail3; dynamic detail4; dynamic detail5; - int groupID; - int id; - String nameAr; - String nameEn; + int? groupID; + int? id; + String? nameAr; + String? nameEn; dynamic remarks; - int typeId; - String valueList; + int? typeId; + String? valueList; MasterKeyModel( {this.alias, diff --git a/lib/core/model/SOAP/physical_exam/get_physical_exam_list_res_model.dart b/lib/core/model/SOAP/physical_exam/get_physical_exam_list_res_model.dart index c8f825ad..952e3a5c 100644 --- a/lib/core/model/SOAP/physical_exam/get_physical_exam_list_res_model.dart +++ b/lib/core/model/SOAP/physical_exam/get_physical_exam_list_res_model.dart @@ -1,23 +1,23 @@ class GetPhysicalExamResModel { - int appointmentNo; - int createdBy; - String createdByName; - String createdOn; - Null editedBy; - String editedByName; - String editedOn; - int episodeId; - int examId; - String examName; - int examType; - int examinationType; - String examinationTypeName; - bool isAbnormal; - bool isNew; - bool isNormal; - bool notExamined; - int patientMRN; - String remarks; + int? appointmentNo; + int? createdBy; + String? createdByName; + String? createdOn; + dynamic editedBy; + String? editedByName; + String? editedOn; + int? episodeId; + int? examId; + String? examName; + int? examType; + int? examinationType; + String? examinationTypeName; + bool? isAbnormal; + bool? isNew; + bool? isNormal; + bool? notExamined; + int? patientMRN; + String? remarks; GetPhysicalExamResModel( {this.appointmentNo, diff --git a/lib/core/model/SOAP/physical_exam/get_physical_exam_req_model.dart b/lib/core/model/SOAP/physical_exam/get_physical_exam_req_model.dart index 710dafd1..ea2d8f97 100644 --- a/lib/core/model/SOAP/physical_exam/get_physical_exam_req_model.dart +++ b/lib/core/model/SOAP/physical_exam/get_physical_exam_req_model.dart @@ -1,10 +1,10 @@ class GetPhysicalExamReqModel { - int patientMRN; - int appointmentNo; - int admissionNo; - String episodeID; - String from; - String to; + int? patientMRN; + int? appointmentNo; + int? admissionNo; + String? episodeID; + String? from; + String? to; dynamic editedBy; dynamic doctorID; diff --git a/lib/core/model/SOAP/physical_exam/post_physical_exam_request_model.dart b/lib/core/model/SOAP/physical_exam/post_physical_exam_request_model.dart index f056f168..94099748 100644 --- a/lib/core/model/SOAP/physical_exam/post_physical_exam_request_model.dart +++ b/lib/core/model/SOAP/physical_exam/post_physical_exam_request_model.dart @@ -1,16 +1,13 @@ class PostPhysicalExamRequestModel { - List - listHisProgNotePhysicalExaminationVM; + List? listHisProgNotePhysicalExaminationVM; PostPhysicalExamRequestModel({this.listHisProgNotePhysicalExaminationVM}); PostPhysicalExamRequestModel.fromJson(Map json) { if (json['listHisProgNotePhysicalExaminationVM'] != null) { - listHisProgNotePhysicalExaminationVM = - new List(); + listHisProgNotePhysicalExaminationVM = []; json['listHisProgNotePhysicalExaminationVM'].forEach((v) { - listHisProgNotePhysicalExaminationVM - .add(new ListHisProgNotePhysicalExaminationVM.fromJson(v)); + listHisProgNotePhysicalExaminationVM!.add(new ListHisProgNotePhysicalExaminationVM.fromJson(v)); }); } } @@ -18,36 +15,33 @@ class PostPhysicalExamRequestModel { Map toJson() { final Map data = new Map(); if (this.listHisProgNotePhysicalExaminationVM != null) { - data['listHisProgNotePhysicalExaminationVM'] = this - .listHisProgNotePhysicalExaminationVM - .map((v) => v.toJson()) - .toList(); + data['listHisProgNotePhysicalExaminationVM'] = this.listHisProgNotePhysicalExaminationVM!.map((v) => v.toJson()).toList(); } return data; } } class ListHisProgNotePhysicalExaminationVM { - int episodeId; - int appointmentNo; - int admissionNo; - int examType; - int examId; - int patientMRN; - bool isNormal; - bool isAbnormal; - bool notExamined; - String examName; - String examinationTypeName; - int examinationType; - String remarks; - bool isNew; - int createdBy; - String createdOn; - String createdByName; - int editedBy; - String editedOn; - String editedByName; + int? episodeId; + int? appointmentNo; + int? admissionNo; + int? examType; + int? examId; + int? patientMRN; + bool? isNormal; + bool? isAbnormal; + bool? notExamined; + String? examName; + String? examinationTypeName; + int? examinationType; + String? remarks; + bool? isNew; + int? createdBy; + String? createdOn; + String? createdByName; + int? editedBy; + String? editedOn; + String? editedByName; ListHisProgNotePhysicalExaminationVM( {this.episodeId, diff --git a/lib/core/model/SOAP/post_episode_req_model.dart b/lib/core/model/SOAP/post_episode_req_model.dart index bfc4e4bc..90fbd5f3 100644 --- a/lib/core/model/SOAP/post_episode_req_model.dart +++ b/lib/core/model/SOAP/post_episode_req_model.dart @@ -1,8 +1,8 @@ class PostEpisodeReqModel { - int appointmentNo; - int patientMRN; - int doctorID; - String vidaAuthTokenID; + int? appointmentNo; + int? patientMRN; + int? doctorID; + String? vidaAuthTokenID; PostEpisodeReqModel( {this.appointmentNo, diff --git a/lib/core/model/SOAP/progress_note/GetGetProgressNoteResModel.dart b/lib/core/model/SOAP/progress_note/GetGetProgressNoteResModel.dart index 1e5cae66..e5923ac8 100644 --- a/lib/core/model/SOAP/progress_note/GetGetProgressNoteResModel.dart +++ b/lib/core/model/SOAP/progress_note/GetGetProgressNoteResModel.dart @@ -1,15 +1,15 @@ class GetPatientProgressNoteResModel { - int appointmentNo; - int createdBy; - String createdByName; - String createdOn; - String dName; - String editedByName; - String editedOn; - int episodeId; - String mName; - int patientMRN; - String planNote; + int? appointmentNo; + int? createdBy; + String? createdByName; + String? createdOn; + String? dName; + String? editedByName; + String? editedOn; + int? episodeId; + String? mName; + int? patientMRN; + String? planNote; GetPatientProgressNoteResModel( {this.appointmentNo, diff --git a/lib/core/model/SOAP/progress_note/get_progress_note_req_model.dart b/lib/core/model/SOAP/progress_note/get_progress_note_req_model.dart index b5370c65..9a4eaad5 100644 --- a/lib/core/model/SOAP/progress_note/get_progress_note_req_model.dart +++ b/lib/core/model/SOAP/progress_note/get_progress_note_req_model.dart @@ -1,10 +1,10 @@ class GetProgressNoteReqModel { - int patientMRN; - int appointmentNo; - String episodeID; - String from; - String to; - int clinicID; + int? patientMRN; + int? appointmentNo; + String? episodeID; + String? from; + String? to; + int? clinicID; dynamic doctorID; dynamic editedBy; diff --git a/lib/core/model/SOAP/progress_note/post_progress_note_request_model.dart b/lib/core/model/SOAP/progress_note/post_progress_note_request_model.dart index 2925819d..a96a9fcb 100644 --- a/lib/core/model/SOAP/progress_note/post_progress_note_request_model.dart +++ b/lib/core/model/SOAP/progress_note/post_progress_note_request_model.dart @@ -1,8 +1,8 @@ class PostProgressNoteRequestModel { - int appointmentNo; - int episodeId; - int patientMRN; - String planNote; + int? appointmentNo; + int? episodeId; + int? patientMRN; + String? planNote; dynamic doctorID; dynamic editedBy; diff --git a/lib/core/model/SOAP/selected_items/my_selected_allergy.dart b/lib/core/model/SOAP/selected_items/my_selected_allergy.dart index 86fad1ec..c3e17a8c 100644 --- a/lib/core/model/SOAP/selected_items/my_selected_allergy.dart +++ b/lib/core/model/SOAP/selected_items/my_selected_allergy.dart @@ -1,14 +1,14 @@ import 'package:doctor_app_flutter/core/model/SOAP/master_key_model.dart'; class MySelectedAllergy { - MasterKeyModel selectedAllergySeverity; - MasterKeyModel selectedAllergy; - String remark; - bool isChecked; - bool isExpanded; - bool isLocal; - int createdBy; - bool hasValidationError; + MasterKeyModel? selectedAllergySeverity; + MasterKeyModel? selectedAllergy; + String? remark; + bool? isChecked; + bool? isExpanded; + bool? isLocal; + int? createdBy; + bool? hasValidationError; MySelectedAllergy( {this.selectedAllergySeverity, diff --git a/lib/core/model/SOAP/selected_items/my_selected_assement.dart b/lib/core/model/SOAP/selected_items/my_selected_assement.dart index ab4c9965..f6be0059 100644 --- a/lib/core/model/SOAP/selected_items/my_selected_assement.dart +++ b/lib/core/model/SOAP/selected_items/my_selected_assement.dart @@ -1,16 +1,16 @@ import 'package:doctor_app_flutter/core/model/SOAP/master_key_model.dart'; class MySelectedAssessment { - MasterKeyModel selectedICD; - MasterKeyModel selectedDiagnosisCondition; - MasterKeyModel selectedDiagnosisType; - String remark; - int appointmentId; - int createdBy; - String createdOn; - int doctorID; - String doctorName; - String icdCode10ID; + MasterKeyModel? selectedICD; + MasterKeyModel? selectedDiagnosisCondition; + MasterKeyModel? selectedDiagnosisType; + String? remark; + int? appointmentId; + int? createdBy; + String? createdOn; + int? doctorID; + String? doctorName; + String? icdCode10ID; MySelectedAssessment( {this.selectedICD, diff --git a/lib/core/model/SOAP/selected_items/my_selected_examination.dart b/lib/core/model/SOAP/selected_items/my_selected_examination.dart index 1e8a128f..29092efb 100644 --- a/lib/core/model/SOAP/selected_items/my_selected_examination.dart +++ b/lib/core/model/SOAP/selected_items/my_selected_examination.dart @@ -1,16 +1,16 @@ import 'package:doctor_app_flutter/core/model/SOAP/master_key_model.dart'; class MySelectedExamination { - MasterKeyModel selectedExamination; - String remark; - bool isNormal; - bool isAbnormal; - bool notExamined; - bool isNew; - bool isLocal; - int createdBy; - String createdOn; - String editedOn; + MasterKeyModel? selectedExamination; + String? remark; + bool? isNormal; + bool? isAbnormal; + bool? notExamined; + bool? isNew; + bool? isLocal; + int? createdBy; + String? createdOn; + String? editedOn; MySelectedExamination({ this.selectedExamination, diff --git a/lib/core/model/SOAP/selected_items/my_selected_history.dart b/lib/core/model/SOAP/selected_items/my_selected_history.dart index 2aa0b3e3..5f6a9f14 100644 --- a/lib/core/model/SOAP/selected_items/my_selected_history.dart +++ b/lib/core/model/SOAP/selected_items/my_selected_history.dart @@ -1,10 +1,10 @@ import 'package:doctor_app_flutter/core/model/SOAP/master_key_model.dart'; class MySelectedHistory { - MasterKeyModel selectedHistory; - String remark; - bool isChecked; - bool isLocal; + MasterKeyModel? selectedHistory; + String? remark; + bool? isChecked; + bool? isLocal; MySelectedHistory( {this.selectedHistory, this.remark, this.isChecked, this.isLocal = true}); diff --git a/lib/core/model/auth/insert_imei_model.dart b/lib/core/model/auth/insert_imei_model.dart index af8967fc..61128c8d 100644 --- a/lib/core/model/auth/insert_imei_model.dart +++ b/lib/core/model/auth/insert_imei_model.dart @@ -1,22 +1,22 @@ class InsertIMEIDetailsModel { String? iMEI; int? logInTypeID; - dynamic? outSA; + dynamic outSA; String? mobile; - dynamic? identificationNo; + dynamic identificationNo; int? doctorID; String? doctorName; String? doctorNameN; int? clinicID; String? clinicDescription; - Null? clinicDescriptionN; + dynamic clinicDescriptionN; String? projectName; String? genderDescription; - Null? genderDescriptionN; + dynamic genderDescriptionN; String? titleDescription; - Null? titleDescriptionN; + dynamic titleDescriptionN; bool? bioMetricEnabled; - Null? preferredLanguage; + dynamic preferredLanguage; bool? isActive; int? editedBy; int? projectID; diff --git a/lib/core/model/calculate_box_request_model.dart b/lib/core/model/calculate_box_request_model.dart index 80281854..24e75bb7 100644 --- a/lib/core/model/calculate_box_request_model.dart +++ b/lib/core/model/calculate_box_request_model.dart @@ -1,9 +1,9 @@ class CalculateBoxQuantityRequestModel { - int itemCode; - double strength; - int frequency; - int duration; - String vidaAuthTokenID; + int? itemCode; + double? strength; + int? frequency; + int? duration; + String? vidaAuthTokenID; CalculateBoxQuantityRequestModel( {this.itemCode, diff --git a/lib/core/model/chart_axis_model.dart b/lib/core/model/chart_axis_model.dart index 781d0e71..76dac586 100644 --- a/lib/core/model/chart_axis_model.dart +++ b/lib/core/model/chart_axis_model.dart @@ -1,7 +1,7 @@ /// Sample linear data type. class ChartAxis { - final int xAxis; - final int yAxis; + final int? xAxis; + final int? yAxis; ChartAxis(this.xAxis, this.yAxis); } diff --git a/lib/core/model/charts/app_time_series_chart.dart b/lib/core/model/charts/app_time_series_chart.dart index 8db6d611..578b5c7a 100644 --- a/lib/core/model/charts/app_time_series_chart.dart +++ b/lib/core/model/charts/app_time_series_chart.dart @@ -1,13 +1,13 @@ class TimeSeriesSales { final DateTime time; - final int sales; + final int? sales; TimeSeriesSales(this.time, this.sales); } class TimeSeriesSales2 { final DateTime time; - final double sales; + final double? sales; TimeSeriesSales2(this.time, this.sales); } diff --git a/lib/core/model/countries_model.dart b/lib/core/model/countries_model.dart index 8628ff6b..c9eda669 100644 --- a/lib/core/model/countries_model.dart +++ b/lib/core/model/countries_model.dart @@ -1,8 +1,8 @@ class Countries { - String name; - String nameAr; - String code; - String countryCode; + String? name; + String? nameAr; + String? code; + String? countryCode; Countries({this.name, this.nameAr, this.code, this.countryCode}); diff --git a/lib/core/model/hospitals_model.dart b/lib/core/model/hospitals_model.dart index 3e9690ba..b34ecf17 100644 --- a/lib/core/model/hospitals_model.dart +++ b/lib/core/model/hospitals_model.dart @@ -1,20 +1,20 @@ class HospitalsModel { - String desciption; + String? desciption; dynamic desciptionN; - int iD; - String legalName; - String legalNameN; - String name; + int? iD; + String? legalName; + String? legalNameN; + String? name; dynamic nameN; - String phoneNumber; - String setupID; - int distanceInKilometers; - bool isActive; - String latitude; - String longitude; - int mainProjectID; + String? phoneNumber; + String? setupID; + int? distanceInKilometers; + bool? isActive; + String? latitude; + String? longitude; + int? mainProjectID; dynamic projectOutSA; - bool usingInDoctorApp; + bool? usingInDoctorApp; HospitalsModel( {this.desciption, diff --git a/lib/core/model/insurance/insurance_approval.dart b/lib/core/model/insurance/insurance_approval.dart index 5f60f4c8..ef33c6a9 100644 --- a/lib/core/model/insurance/insurance_approval.dart +++ b/lib/core/model/insurance/insurance_approval.dart @@ -155,48 +155,48 @@ class InsuranceApprovalModel { // class InsuranceApprovalModel { // String setupID; -// int projectID; -// int approvalNo; +// int? projectID; +// int? approvalNo; // String approvalDate; -// int patientType; -// int patientID; -// int companyID; -// int subCategoryID; -// int doctorID; -// int clinicID; -// int approvalType; +// int? patientType; +// int? patientID; +// int? companyID; +// int? subCategoryID; +// int? doctorID; +// int? clinicID; +// int? approvalType; // Null inpatientApprovalSubType; // String validFrom; // Null vaildDays; // String validTo; // Null isApprovalOnGross; // Null isPackage; -// int requestedAmount; -// bool isDentalAllowedBackend; -// int patientTypeID; +// int? requestedAmount; +// bool? isDentalAllowedBackend; +// int? patientTypeID; // // String companyApprovalNo; // // String submitOn; // String receiptOn; // -// int status; -// int eXuldAPPNO; +// int? status; +// int? eXuldAPPNO; // String feedbackStatusOn; -// int authorizerID; +// int? authorizerID; // String expiryDate; -// int appointmentNo; -// int admissionNo; +// int? appointmentNo; +// int? admissionNo; // -// int createdBy; +// int? createdBy; // String createdOn; -// int editedBy; +// int? editedBy; // String editedOn; // // String extendedOn; // -// int noOrderAuthorizerID; -// bool isVerbalApproval; +// int? noOrderAuthorizerID; +// bool? isVerbalApproval; // // List apporvalDetails; // String approvalStatusDescption; @@ -206,23 +206,23 @@ class InsuranceApprovalModel { // String doctorImageURL; // String doctorName; // -// int doctorRate; +// int? doctorRate; // String doctorTitle; -// int gender; +// int? gender; // String genderDescription; -// bool isActiveDoctorProfile; -// bool isExecludeDoctor; -// bool isInOutPatient; +// bool? isActiveDoctorProfile; +// bool? isExecludeDoctor; +// bool? isInOutPatient; // String isInOutPatientDescription; // String isInOutPatientDescriptionN; -// bool isLiveCareAppointment; +// bool? isLiveCareAppointment; // String projectName; // // String qR; // List speciality; // -// int totaUnUsedCount; -// int unUsedCount; +// int? totaUnUsedCount; +// int? unUsedCount; // // InsuranceApprovalModel( // {this.setupID, @@ -435,7 +435,7 @@ class InsuranceApprovalModel { // } // // class ApporvalDetails { -// int approvalNo; +// int? approvalNo; // // String procedureName; // //String procedureNameN; diff --git a/lib/core/model/insurance_approval_request_model.dart b/lib/core/model/insurance_approval_request_model.dart index 02f71ecb..11f7804e 100644 --- a/lib/core/model/insurance_approval_request_model.dart +++ b/lib/core/model/insurance_approval_request_model.dart @@ -1,17 +1,17 @@ class InsuranceApprovalInPatientRequestModel { - int patientID; - int patientTypeID; - int eXuldAPPNO; - int projectID; - int languageID; - String stamp; - String iPAdress; - double versionID; - int channel; - String tokenID; - String sessionID; - bool isLoginForDoctorApp; - bool patientOutSA; + int? patientID; + int? patientTypeID; + int? eXuldAPPNO; + int? projectID; + int? languageID; + String? stamp; + String? iPAdress; + double? versionID; + int? channel; + String? tokenID; + String? sessionID; + bool? isLoginForDoctorApp; + bool? patientOutSA; InsuranceApprovalInPatientRequestModel( {this.patientID, diff --git a/lib/core/model/labs/lab_result.dart b/lib/core/model/labs/lab_result.dart index 586f3079..4e5df0fc 100644 --- a/lib/core/model/labs/lab_result.dart +++ b/lib/core/model/labs/lab_result.dart @@ -94,11 +94,11 @@ class LabResult { return data; } - int checkResultStatus() { + int? checkResultStatus() { try { - var max = double.tryParse(maxValue!) ?? null; - var min = double.tryParse(minValue!) ?? null; - var result = double.tryParse(resultValue!) ?? null; + var max = double?.tryParse(maxValue!) ?? null; + var min = double?.tryParse(minValue!) ?? null; + var result = double?.tryParse(resultValue!) ?? null; if (max != null && min != null && result != null) { if (result > max) { return 1; diff --git a/lib/core/model/live_care/AlternativeServicesList.dart b/lib/core/model/live_care/AlternativeServicesList.dart index eb5c69a8..adf88e91 100644 --- a/lib/core/model/live_care/AlternativeServicesList.dart +++ b/lib/core/model/live_care/AlternativeServicesList.dart @@ -34,7 +34,7 @@ class AlternativeServicesList with ChangeNotifier { notifyListeners(); } - setSelected(AlternativeService service, bool isSelected) { + setSelected(AlternativeService service, bool? isSelected) { List alternativeService = _alternativeServicesList .where((element) => service.serviceID == element.serviceID) .toList(); diff --git a/lib/core/model/patient/PatientArrivalEntity.dart b/lib/core/model/patient/PatientArrivalEntity.dart index 347cc60f..96da3bce 100644 --- a/lib/core/model/patient/PatientArrivalEntity.dart +++ b/lib/core/model/patient/PatientArrivalEntity.dart @@ -1,22 +1,22 @@ class PatientArrivalEntity { - String age; - String appointmentDate; - int appointmentNo; - String appointmentType; - String arrivedOn; - String companyName; - String endTime; - int episodeNo; - int fallRiskScore; - String gender; - int medicationOrders; - String mobileNumber; - String nationality; - int patientMRN; - String patientName; - int rowCount; - String startTime; - String visitType; + String? age; + String? appointmentDate; + int? appointmentNo; + String? appointmentType; + String? arrivedOn; + String? companyName; + String? endTime; + int? episodeNo; + int? fallRiskScore; + String? gender; + int? medicationOrders; + String? mobileNumber; + String? nationality; + int? patientMRN; + String? patientName; + int? rowCount; + String? startTime; + String? visitType; PatientArrivalEntity( {this.age, diff --git a/lib/core/model/patient/get_clinic_by_project_id_request.dart b/lib/core/model/patient/get_clinic_by_project_id_request.dart index 5dc820be..55599cb2 100644 --- a/lib/core/model/patient/get_clinic_by_project_id_request.dart +++ b/lib/core/model/patient/get_clinic_by_project_id_request.dart @@ -1,40 +1,16 @@ class ClinicByProjectIdRequest { - /* - *@author: Ibrahim Albitar - *@Date:03/06/2020 - *@param: - *@return: - *@desc: ClinicByProjectIdRequest - */ - - int projectID; - int languageID; - String stamp; - String iPAdress; - double versionID; - int channel; - String tokenID; - String sessionID; - bool isLoginForDoctorApp; - bool patientOutSA; - int patientTypeID; - - /* - { - "ProjectID": 21, - "LanguageID": 2, - "stamp": "2020-06-03T11:18:19.979Z", - "IPAdress": "11.11.11.11", - "VersionID": 1.2, - "Channel": 9, - "TokenID": "gyIQFH4WWEm2Tq7xjYMjsg==", - "SessionID": "JBXRsDl37L", - "IsLoginForDoctorApp": true, - "PatientOutSA": false, - "PatientTypeID": 1 -} - */ - + int? projectID; + int? languageID; + String? stamp; + String? iPAdress; + double? versionID; + int? channel; + String? tokenID; + String? sessionID; + bool? isLoginForDoctorApp; + bool? patientOutSA; + int? patientTypeID; + ClinicByProjectIdRequest( {this.projectID, this.languageID = 2, diff --git a/lib/core/model/patient/get_doctor_by_clinic_id_request.dart b/lib/core/model/patient/get_doctor_by_clinic_id_request.dart index 0ac6ee62..351f19f7 100644 --- a/lib/core/model/patient/get_doctor_by_clinic_id_request.dart +++ b/lib/core/model/patient/get_doctor_by_clinic_id_request.dart @@ -1,16 +1,16 @@ class DoctorsByClinicIdRequest { - int clinicID; - int projectID; - bool continueDentalPlan; - bool isSearchAppointmnetByClinicID; - int patientID; - int gender; - bool isGetNearAppointment; - bool isVoiceCommand; - int latitude; - int longitude; - bool license; - bool isDentalAllowedBackend; + int? clinicID; + int? projectID; + bool? continueDentalPlan; + bool? isSearchAppointmnetByClinicID; + int? patientID; + int? gender; + bool? isGetNearAppointment; + bool? isVoiceCommand; + int? latitude; + int? longitude; + bool? license; + bool? isDentalAllowedBackend; DoctorsByClinicIdRequest({ this.clinicID, diff --git a/lib/core/model/patient/get_list_stp_referral_frequency_request.dart b/lib/core/model/patient/get_list_stp_referral_frequency_request.dart index 597ed6de..401260f7 100644 --- a/lib/core/model/patient/get_list_stp_referral_frequency_request.dart +++ b/lib/core/model/patient/get_list_stp_referral_frequency_request.dart @@ -1,37 +1,16 @@ class STPReferralFrequencyRequest { -/* - *@author: Ibrahim Albitar - *@Date:03/06/2020 - *@param: - *@return: - *@desc: - */ - int languageID; - String stamp; - String iPAdress; - double versionID; - int channel; - String tokenID; - String sessionID; - bool isLoginForDoctorApp; - bool patientOutSA; - int patientTypeID; + int? languageID; + String? stamp; + String? iPAdress; + double? versionID; + int? channel; + String? tokenID; + String? sessionID; + bool? isLoginForDoctorApp; + bool? patientOutSA; + int? patientTypeID; - /* -{ - "LanguageID": 2, - "stamp": "2020-06-03T11:18:19.986Z", - "IPAdress": "11.11.11.11", - "VersionID": 1.2, - "Channel": 9, - "TokenID": "gyIQFH4WWEm2Tq7xjYMjsg==", - "SessionID": "JBXRsDl37L", - "IsLoginForDoctorApp": true, - "PatientOutSA": false, - "PatientTypeID": 1 -} - */ STPReferralFrequencyRequest( {this.languageID = 2, diff --git a/lib/core/model/patient/get_pending_patient_er_model.dart b/lib/core/model/patient/get_pending_patient_er_model.dart index 7791926a..2bd85b9d 100644 --- a/lib/core/model/patient/get_pending_patient_er_model.dart +++ b/lib/core/model/patient/get_pending_patient_er_model.dart @@ -1,10 +1,4 @@ -/* - *@author: Amjad Amireh - *@Date:15/6/2020 - *@param: - *@return: - *@desc: Find list of pending patients Model - */ + import 'dart:convert'; ListPendingPatientListModel listPendingPatientListModelFromJson(String str) => @@ -58,43 +52,43 @@ class ListPendingPatientListModel { dynamic acceptedBy; dynamic acceptedOn; - int age; + int? age; dynamic appointmentNo; - String arrivalTime; - String arrivalTimeD; - int callStatus; - String clientRequestId; - String clinicName; + String? arrivalTime; + String? arrivalTimeD; + int? callStatus; + String? clientRequestId; + String? clinicName; dynamic consoltationEnd; dynamic consultationNotes; dynamic createdOn; - DateTime dateOfBirth; - String deviceToken; - String deviceType; + DateTime? dateOfBirth; + String? deviceToken; + String? deviceType; dynamic doctorName; - String editOn; - String gender; - bool isFollowUp; + String? editOn; + String? gender; + bool? isFollowUp; dynamic isFromVida; - int isLoginB; - bool isOutKsa; - int isRejected; - String language; - double latitude; - double longitude; - String mobileNumber; + int? isLoginB; + bool? isOutKsa; + int? isRejected; + String? language; + double? latitude; + double? longitude; + String? mobileNumber; dynamic openSession; dynamic openTokenId; - String patientId; - String patientName; - int patientStatus; - String preferredLanguage; - int projectId; - int scoring; - int serviceId; + String? patientId; + String? patientName; + int? patientStatus; + String? preferredLanguage; + int? projectId; + int? scoring; + int? serviceId; dynamic tokenId; - int vcId; - String voipToken; + int? vcId; + String? voipToken; factory ListPendingPatientListModel.fromJson(Map json) => ListPendingPatientListModel( @@ -153,7 +147,7 @@ class ListPendingPatientListModel { "ConsultationNotes": consultationNotes, "CreatedOn": createdOn, "DateOfBirth": - "${dateOfBirth.year.toString().padLeft(4, '0')}-${dateOfBirth.month.toString().padLeft(2, '0')}-${dateOfBirth.day.toString().padLeft(2, '0')}", + "${dateOfBirth!.year.toString().padLeft(4, '0')}-${dateOfBirth!.month.toString().padLeft(2, '0')}-${dateOfBirth!.day.toString().padLeft(2, '0')}", "DeviceToken": deviceToken, "DeviceType": deviceType, "DoctorName": doctorName, diff --git a/lib/core/model/patient/insurance_aprovals_request.dart b/lib/core/model/patient/insurance_aprovals_request.dart index f1e4e7bd..df2a3dcf 100644 --- a/lib/core/model/patient/insurance_aprovals_request.dart +++ b/lib/core/model/patient/insurance_aprovals_request.dart @@ -1,39 +1,18 @@ -/* - *@author: Ibrahim Albitar - *@Date:15/5/2020 - - *@param: - {"PatientID":1089227, - "PatientTypeID":1, - "EXuldAPPNO":0, - "ProjectID":12, - "LanguageID":2, - "stamp":"2020-04-01T09:47:19.643Z", - "IPAdress":"11.11.11.11", - "VersionID":1.2, - "Channel":9, - "TokenID":"yIwh6wNyUkOeQlJRohWjyw==", - "SessionID":"LlBk8lUEJY", - "IsLoginForDoctorApp":true, - "PatientOutSA":false} - *@return: - *@desc: - */ class InsuranceAprovalsRequest { - int exuldAppNO; - int patientID; - int channel; - int projectID; - int languageID; - String stamp; - String ipAdress; - double versionID; - String tokenID; - String sessionID; - bool isLoginForDoctorApp; - bool patientOutSA; - int patientTypeID; + int? exuldAppNO; + int? patientID; + int? channel; + int? projectID; + int? languageID; + String? stamp; + String? ipAdress; + double? versionID; + String? tokenID; + String? sessionID; + bool? isLoginForDoctorApp; + bool? patientOutSA; + int? patientTypeID; InsuranceAprovalsRequest( {this.exuldAppNO, diff --git a/lib/core/model/patient/orders_request.dart b/lib/core/model/patient/orders_request.dart index 4adab686..dd2e2acd 100644 --- a/lib/core/model/patient/orders_request.dart +++ b/lib/core/model/patient/orders_request.dart @@ -1,40 +1,19 @@ -/* - *@author: Ibrahim Albitar - *@Date:15/5/2020 - - *@param: -{"VisitType":3, -"AdmissionNo":2020004683, -"ProjectID":12, -"LanguageID":2, -"stamp":"2020-04-01T09:53:50.410Z", -"IPAdress":"11.11.11.11", -"VersionID":1.2, -"Channel":9, -"TokenID":"yIwh6wNyUkOeQlJRohWjyw==", -"SessionID":"LlBk8lUEJY", -"IsLoginForDoctorApp":true, -"PatientOutSA":false, -"PatientTypeID":1} -*@return: - *@desc: - */ class OrdersRequest { - int visitType; - int admissionNo; - int projectID; - int languageID; - String stamp; - String iPAdress; - int channel; - String tokenID; - String sessionID; - bool isLoginForDoctorApp; - bool patientOutSA; - int patientTypeID; - double versionID; + int? visitType; + int? admissionNo; + int? projectID; + int? languageID; + String? stamp; + String? iPAdress; + int? channel; + String? tokenID; + String? sessionID; + bool? isLoginForDoctorApp; + bool? patientOutSA; + int? patientTypeID; + double? versionID; OrdersRequest( {this.visitType, diff --git a/lib/core/model/patient/patiant_info_model.dart b/lib/core/model/patient/patiant_info_model.dart index bc8e3a07..b1002e6c 100644 --- a/lib/core/model/patient/patiant_info_model.dart +++ b/lib/core/model/patient/patiant_info_model.dart @@ -4,81 +4,81 @@ import 'package:doctor_app_flutter/utils/date-utils.dart'; import 'package:doctor_app_flutter/utils/utils.dart'; class PatiantInformtion { - PatiantInformtion patientDetails; - int genderInt; + PatiantInformtion? patientDetails; + int? genderInt; dynamic age; - String appointmentDate; - DateTime appointmentDateWithDateTimeForm; + String? appointmentDate; + DateTime? appointmentDateWithDateTimeForm; dynamic appointmentNo; dynamic appointmentType; - String arrivalTime; - String arrivalTimeD; - int callStatus; + String? arrivalTime; + String? arrivalTimeD; + int? callStatus; dynamic callStatusDisc; - int callTypeID; - String clientRequestID; - String clinicName; - String consoltationEnd; - String consultationNotes; - int appointmentTypeId; - String arrivedOn; - int clinicGroupId; - String companyName; + int? callTypeID; + String? clientRequestID; + String? clinicName; + String? consoltationEnd; + String? consultationNotes; + int? appointmentTypeId; + String? arrivedOn; + int? clinicGroupId; + String? companyName; dynamic dischargeStatus; dynamic doctorDetails; - int doctorId; - String endTime; - int episodeNo; - int fallRiskScore; - bool isSigned; - int medicationOrders; - String mobileNumber; - String nationality; - int projectId; - int clinicId; + int? doctorId; + String? endTime; + int? episodeNo; + int? fallRiskScore; + bool? isSigned; + int? medicationOrders; + String? mobileNumber; + String? nationality; + int? projectId; + int? clinicId; dynamic patientId; - String doctorName; - String doctorNameN; - String firstName; - String middleName; - String lastName; - String firstNameN; - String middleNameN; - String lastNameN; - String fullName; - String fullNameN; - int gender; - String dateofBirth; - String nationalityId; - String emailAddress; - String patientIdentificationNo; - int patientType; - int patientMRN; - String admissionNo; - String admissionDate; - DateTime admissionDateWithDateTimeForm; - String createdOn; - String roomId; - String bedId; - String nursingStationId; - String description; - String clinicDescription; - String clinicDescriptionN; - String nationalityName; - String nationalityNameN; - String genderDescription; - String nursingStationName; - String startTime; - String visitType; - String nationalityFlagURL; - int patientStatus; - int patientStatusType; - int visitTypeId; - String startTimes; - String dischargeDate; - int status; - int vcId; - String voipToken; + String? doctorName; + String? doctorNameN; + String? firstName; + String? middleName; + String? lastName; + String? firstNameN; + String? middleNameN; + String? lastNameN; + String? fullName; + String? fullNameN; + int? gender; + String? dateofBirth; + String? nationalityId; + String? emailAddress; + String? patientIdentificationNo; + int? patientType; + int? patientMRN; + String? admissionNo; + String? admissionDate; + DateTime? admissionDateWithDateTimeForm; + String? createdOn; + String? roomId; + String? bedId; + String? nursingStationId; + String? description; + String? clinicDescription; + String? clinicDescriptionN; + String? nationalityName; + String? nationalityNameN; + String? genderDescription; + String? nursingStationName; + String? startTime; + String? visitType; + String? nationalityFlagURL; + int? patientStatus; + int? patientStatusType; + int? visitTypeId; + String? startTimes; + String? dischargeDate; + int? status; + int? vcId; + String? voipToken; PatiantInformtion( {this.patientDetails, @@ -167,7 +167,7 @@ class PatiantInformtion { doctorId = json["DoctorID"] ?? json["doctorID"]; patientId = json["PatientID"] != null ? json["PatientID"] is String - ? int.parse(json["PatientID"]) + ? int?.parse(json["PatientID"]) : json["PatientID"] : json["patientID"] ?? json['patientMRN'] ?? json['PatientMRN']; doctorName = json["DoctorName"] ?? json["doctorName"]; @@ -180,7 +180,7 @@ class PatiantInformtion { lastNameN = json["LastNameN"] ?? json["lastNameN"]; gender = json["Gender"] != null ? json["Gender"] is String - ? int.parse(json["Gender"]) + ? int?.parse(json["Gender"]) : json["Gender"] : json["gender"]; fullName = json["fullName"] ?? json["fullName"] ?? json["PatientName"]; @@ -319,7 +319,7 @@ class PatiantInformtion { data['Age'] = this.age; data['AppointmentDate'] = - this.appointmentDate.isNotEmpty ? this.appointmentDate : null; + this.appointmentDate!.isNotEmpty ? this.appointmentDate : null; data['AppointmentNo'] = this.appointmentNo; data['ArrivalTime'] = this.arrivalTime; diff --git a/lib/core/model/patient/patient_model.dart b/lib/core/model/patient/patient_model.dart index 3a8eb9ae..c456ab3e 100644 --- a/lib/core/model/patient/patient_model.dart +++ b/lib/core/model/patient/patient_model.dart @@ -1,62 +1,55 @@ -/* - *@author:Modified by amjad add getter and setter Amjad Amireh - *@Date:11/5/2020 - *@param: - *@return:PatientsScreen Search textbox filter - - *@desc: - */ + class PatientModel { - int ProjectID; - int ClinicID; - int DoctorID; - String FirstName; + int? ProjectID; + int? ClinicID; + int? DoctorID; + String? FirstName; - String MiddleName; - String LastName; - String PatientMobileNumber; - String PatientIdentificationID; - int PatientID; - String From; - String To; - int LanguageID; - String stamp; - String IPAdress; - double VersionID; - int Channel; - String TokenID; - String SessionID; - bool IsLoginForDoctorApp; - bool PatientOutSA; - int Searchtype; - String IdentificationNo; - String MobileNo; + String? MiddleName; + String? LastName; + String? PatientMobileNumber; + String? PatientIdentificationID; + int? PatientID; + String? From; + String? To; + int? LanguageID; + String? stamp; + String? IPAdress; + double? VersionID; + int? Channel; + String? TokenID; + String? SessionID; + bool? IsLoginForDoctorApp; + bool? PatientOutSA; + int? Searchtype; + String? IdentificationNo; + String? MobileNo; - int get getProjectID => ProjectID; + int? get getProjectID => ProjectID; - set setProjectID(int ProjectID) => this.ProjectID = ProjectID; + set setProjectID(int? ProjectID) => this.ProjectID = ProjectID; - int get getClinicID => ClinicID; + int? get getClinicID => ClinicID; - set setClinicID(int ClinicID) => this.ClinicID = ClinicID; + set setClinicID(int? ClinicID) => this.ClinicID = ClinicID; - int get getDoctorID => DoctorID; + int? get getDoctorID => DoctorID; - set setDoctorID(int DoctorID) => this.DoctorID = DoctorID; + set setDoctorID(int? DoctorID) => this.DoctorID = DoctorID; - String get getFirstName => FirstName; + String? get getFirstName => FirstName; set setFirstName(String FirstName) => this.FirstName = FirstName; - String get getMiddleName => MiddleName; + String? get getMiddleName => MiddleName; set setMiddleName(String MiddleName) => this.MiddleName = MiddleName; - String get getLastName => LastName; + String? get getLastName => LastName; set setLastName(String LastName) => this.LastName = LastName; - String get getPatientMobileNumber => PatientMobileNumber; + String? get getPatientMobileNumber => PatientMobileNumber; set setPatientMobileNumber(String PatientMobileNumber) => this.PatientMobileNumber = PatientMobileNumber; @@ -65,54 +58,54 @@ class PatientModel { // set setPatientIdentificationID(String PatientIdentificationID) => this.PatientIdentificationID = PatientIdentificationID; - int get getPatientID => PatientID; + int? get getPatientID => PatientID; - set setPatientID(int PatientID) => this.PatientID = PatientID; + set setPatientID(int? PatientID) => this.PatientID = PatientID; - String get getFrom => From; + String? get getFrom => From; set setFrom(String From) => this.From = From; - String get getTo => To; + String? get getTo => To; set setTo(String To) => this.To = To; - int get getLanguageID => LanguageID; + int? get getLanguageID => LanguageID; - set setLanguageID(int LanguageID) => this.LanguageID = LanguageID; + set setLanguageID(int? LanguageID) => this.LanguageID = LanguageID; - String get getStamp => stamp; + String? get getStamp => stamp; set setStamp(String stamp) => this.stamp = stamp; - String get getIPAdress => IPAdress; + String? get getIPAdress => IPAdress; set setIPAdress(String IPAdress) => this.IPAdress = IPAdress; - double get getVersionID => VersionID; + double? get getVersionID => VersionID; - set setVersionID(double VersionID) => this.VersionID = VersionID; + set setVersionID(double? VersionID) => this.VersionID = VersionID; - int get getChannel => Channel; + int? get getChannel => Channel; - set setChannel(int Channel) => this.Channel = Channel; + set setChannel(int? Channel) => this.Channel = Channel; - String get getTokenID => TokenID; + String? get getTokenID => TokenID; set setTokenID(String TokenID) => this.TokenID = TokenID; - String get getSessionID => SessionID; + String? get getSessionID => SessionID; set setSessionID(String SessionID) => this.SessionID = SessionID; - bool get getIsLoginForDoctorApp => IsLoginForDoctorApp; + bool? get getIsLoginForDoctorApp => IsLoginForDoctorApp; - set setIsLoginForDoctorApp(bool IsLoginForDoctorApp) => + set setIsLoginForDoctorApp(bool? IsLoginForDoctorApp) => this.IsLoginForDoctorApp = IsLoginForDoctorApp; - bool get getPatientOutSA => PatientOutSA; + bool? get getPatientOutSA => PatientOutSA; - set setPatientOutSA(bool PatientOutSA) => this.PatientOutSA = PatientOutSA; + set setPatientOutSA(bool? PatientOutSA) => this.PatientOutSA = PatientOutSA; PatientModel( {this.ProjectID, diff --git a/lib/core/model/patient/progress_note_request.dart b/lib/core/model/patient/progress_note_request.dart index 77920b25..2d25a061 100644 --- a/lib/core/model/patient/progress_note_request.dart +++ b/lib/core/model/patient/progress_note_request.dart @@ -1,39 +1,17 @@ -/* - *@author: Ibrahim Albitar - *@Date:15/5/2020 - - *@param: -{"VisitType":5, -"AdmissionNo":2020004683, -"ProjectID":12, -"LanguageID":2, -"stamp":"2020-04-01T09:41:59.089Z", -"IPAdress":"11.11.11.11", -"VersionID":1.2, -"Channel":9, -"TokenID":"yIwh6wNyUkOeQlJRohWjyw==", -"SessionID":"LlBk8lUEJY", -"IsLoginForDoctorApp":true, -"PatientOutSA":false, -"PatientTypeID":1} - -*@return: - *@desc: - */ class ProgressNoteRequest { - int visitType; - int admissionNo; - int projectID; - int languageID; - String stamp; - String iPAdress; - int channel; - String tokenID; - String sessionID; - bool isLoginForDoctorApp; - bool patientOutSA; - int patientTypeID; + int? visitType; + int? admissionNo; + int? projectID; + int? languageID; + String? stamp; + String? iPAdress; + int? channel; + String? tokenID; + String? sessionID; + bool? isLoginForDoctorApp; + bool? patientOutSA; + int? patientTypeID; ProgressNoteRequest( {this.visitType, diff --git a/lib/core/model/patient/reauest_prescription_report_for_in_patient.dart b/lib/core/model/patient/reauest_prescription_report_for_in_patient.dart index 6299908d..292af0a3 100644 --- a/lib/core/model/patient/reauest_prescription_report_for_in_patient.dart +++ b/lib/core/model/patient/reauest_prescription_report_for_in_patient.dart @@ -1,17 +1,17 @@ class RequestPrescriptionReportForInPatient { - int patientID; - int projectID; - int admissionNo; - int languageID; - String stamp; - String iPAdress; - double versionID; - int channel; - String tokenID; - String sessionID; - bool isLoginForDoctorApp; - bool patientOutSA; - int patientTypeID; + int? patientID; + int? projectID; + int? admissionNo; + int? languageID; + String? stamp; + String? iPAdress; + double? versionID; + int? channel; + String? tokenID; + String? sessionID; + bool? isLoginForDoctorApp; + bool? patientOutSA; + int? patientTypeID; RequestPrescriptionReportForInPatient( {this.patientID, diff --git a/lib/core/model/patient/refer_to_doctor_request.dart b/lib/core/model/patient/refer_to_doctor_request.dart index 11e1ca01..3ce0fdc2 100644 --- a/lib/core/model/patient/refer_to_doctor_request.dart +++ b/lib/core/model/patient/refer_to_doctor_request.dart @@ -1,38 +1,31 @@ import 'package:flutter/cupertino.dart'; class ReferToDoctorRequest { -/* - *@author: Ibrahim Albitar - *@Date:03/06/2020 - *@param: - *@return: - *@desc: ReferToDoctor - */ - int projectID; - int admissionNo; - String roomID; - String referralClinic; - String referralDoctor; - int createdBy; - int editedBy; - int patientID; - int patientTypeID; - int referringClinic; - int referringDoctor; - String referringDoctorRemarks; - String priority; - String frequency; - String extension; - int languageID; - String stamp; - String iPAdress; - double versionID; - int channel; - String tokenID; - String sessionID; - bool isLoginForDoctorApp; - bool patientOutSA; + int? projectID; + int? admissionNo; + String? roomID; + String? referralClinic; + String? referralDoctor; + int? createdBy; + int? editedBy; + int? patientID; + int? patientTypeID; + int? referringClinic; + int? referringDoctor; + String? referringDoctorRemarks; + String? priority; + String? frequency; + String? extension; + int? languageID; + String? stamp; + String? iPAdress; + double? versionID; + int? channel; + String? tokenID; + String? sessionID; + bool? isLoginForDoctorApp; + bool? patientOutSA; /* { diff --git a/lib/core/model/patient/request_my_referral_patient_model.dart b/lib/core/model/patient/request_my_referral_patient_model.dart index 382f6309..dd6c6143 100644 --- a/lib/core/model/patient/request_my_referral_patient_model.dart +++ b/lib/core/model/patient/request_my_referral_patient_model.dart @@ -1,24 +1,24 @@ class RequestMyReferralPatientModel { - int projectID; - int clinicID; - int doctorID; - String firstName; - String middleName; - String lastName; - String patientMobileNumber; - String patientIdentificationID; - int patientID; - String from; - String to; - int languageID; - String stamp; - String iPAdress; - double versionID; - int channel; - String tokenID; - String sessionID; - bool isLoginForDoctorApp; - bool patientOutSA; + int? projectID; + int? clinicID; + int? doctorID; + String? firstName; + String? middleName; + String? lastName; + String? patientMobileNumber; + String? patientIdentificationID; + int? patientID; + String? from; + String? to; + int? languageID; + String? stamp; + String? iPAdress; + double? versionID; + int? channel; + String? tokenID; + String? sessionID; + bool? isLoginForDoctorApp; + bool? patientOutSA; RequestMyReferralPatientModel( {this.projectID, diff --git a/lib/core/model/patient/topten_users_res_model.dart b/lib/core/model/patient/topten_users_res_model.dart index cc47a2f8..352c40e0 100644 --- a/lib/core/model/patient/topten_users_res_model.dart +++ b/lib/core/model/patient/topten_users_res_model.dart @@ -1,17 +1,10 @@ -/* - *@author: Amjad Amireh - *@Date:27/4/2020 - *@param: - *@return:pass a List to a List from a JSON - *@desc: - */ import 'package:doctor_app_flutter/core/model/patient/patiant_info_model.dart'; //ModelResponse class ModelResponse { - final List list; - String firstName; + final List? list; + String? firstName; ModelResponse({ this.list, @@ -19,7 +12,7 @@ class ModelResponse { }); factory ModelResponse.fromJson(List parsedJson) { - List list = new List(); + List list = []; list = parsedJson.map((i) => PatiantInformtion.fromJson(i)).toList(); diff --git a/lib/core/model/patient/vital_sign/vital_sign_res_model.dart b/lib/core/model/patient/vital_sign/vital_sign_res_model.dart index 681e5399..c9b48f6f 100644 --- a/lib/core/model/patient/vital_sign/vital_sign_res_model.dart +++ b/lib/core/model/patient/vital_sign/vital_sign_res_model.dart @@ -1,10 +1,3 @@ -/* - *@author: Elham Rababah - *@Date:6/5/2020 - *@param: - *@return:VitalSignResModel - *@desc: VitalSignResModel class - */ import 'package:doctor_app_flutter/utils/date-utils.dart'; class VitalSignResModel { @@ -34,9 +27,9 @@ class VitalSignResModel { var painDuration; var painCharacter; var painFrequency; - bool isPainManagementDone; + bool? isPainManagementDone; var status; - bool isVitalsRequired; + bool? isVitalsRequired; var patientID; var createdOn; var doctorID; @@ -44,7 +37,7 @@ class VitalSignResModel { var triageCategory; var gCScore; var lineItemNo; - DateTime vitalSignDate; + DateTime? vitalSignDate; var actualTimeTaken; var sugarLevel; var fBS; diff --git a/lib/core/model/patient_muse/PatientMuseResultsModel.dart b/lib/core/model/patient_muse/PatientMuseResultsModel.dart index adee3ec0..d8e2248c 100644 --- a/lib/core/model/patient_muse/PatientMuseResultsModel.dart +++ b/lib/core/model/patient_muse/PatientMuseResultsModel.dart @@ -1,19 +1,19 @@ import 'package:doctor_app_flutter/utils/date-utils.dart'; class PatientMuseResultsModel { - int rowID; - String setupID; - int projectID; - String orderNo; - int lineItemNo; - int patientType; - int patientID; - String procedureID; + int? rowID; + String? setupID; + int? projectID; + String? orderNo; + int? lineItemNo; + int? patientType; + int? patientID; + String? procedureID; dynamic reportData; - String imageURL; - String createdBy; - String createdOn; - DateTime createdOnDateTime; + String? imageURL; + String? createdBy; + String? createdOn; + DateTime? createdOnDateTime; PatientMuseResultsModel( {this.rowID, diff --git a/lib/core/model/patient_muse/PatientSearchRequestModel.dart b/lib/core/model/patient_muse/PatientSearchRequestModel.dart index 8241f00d..afa0cda4 100644 --- a/lib/core/model/patient_muse/PatientSearchRequestModel.dart +++ b/lib/core/model/patient_muse/PatientSearchRequestModel.dart @@ -1,20 +1,20 @@ class PatientSearchRequestModel { - int doctorID; - String firstName; - String middleName; - String lastName; - String patientMobileNumber; - String patientIdentificationID; - int patientID; - String from; - String to; - int searchType; - int projectID; - String mobileNo; - String identificationNo; - int nursingStationID; - int clinicID = 0; - int loginDoctorID; + int? doctorID; + String? firstName; + String? middleName; + String? lastName; + String? patientMobileNumber; + String? patientIdentificationID; + int? patientID; + String? from; + String? to; + int? searchType; + int? projectID; + String? mobileNo; + String? identificationNo; + int? nursingStationID; + int? clinicID = 0; + int? loginDoctorID; PatientSearchRequestModel( diff --git a/lib/core/model/pending_orders/pending_order_request_model.dart b/lib/core/model/pending_orders/pending_order_request_model.dart index c69cf780..47577b16 100644 --- a/lib/core/model/pending_orders/pending_order_request_model.dart +++ b/lib/core/model/pending_orders/pending_order_request_model.dart @@ -1,20 +1,20 @@ class PendingOrderRequestModel { - bool isDentalAllowedBackend; - double versionID; - int channel; - int languageID; - String iPAdress; - String generalid; - int deviceTypeID; - String tokenID; - int patientID; - int admissionNo; - String sessionID; - int projectID; - String setupID; - bool patientOutSA; - int patientType; - int patientTypeID; + bool? isDentalAllowedBackend; + double? versionID; + int? channel; + int? languageID; + String? iPAdress; + String? generalid; + int? deviceTypeID; + String? tokenID; + int? patientID; + int? admissionNo; + String? sessionID; + int? projectID; + String? setupID; + bool? patientOutSA; + int? patientType; + int? patientTypeID; PendingOrderRequestModel( {this.isDentalAllowedBackend, diff --git a/lib/core/model/pending_orders/pending_orders_model.dart b/lib/core/model/pending_orders/pending_orders_model.dart index 89525369..65f93f89 100644 --- a/lib/core/model/pending_orders/pending_orders_model.dart +++ b/lib/core/model/pending_orders/pending_orders_model.dart @@ -1,5 +1,5 @@ class PendingOrderModel { - String notes; + String? notes; PendingOrderModel({this.notes}); diff --git a/lib/core/model/pharmacies/pharmacies_List_request_model.dart b/lib/core/model/pharmacies/pharmacies_List_request_model.dart index 69341f09..b57c71f7 100644 --- a/lib/core/model/pharmacies/pharmacies_List_request_model.dart +++ b/lib/core/model/pharmacies/pharmacies_List_request_model.dart @@ -1,23 +1,16 @@ -/* - *@author: Ibrahim Albitar - *@Date:27/4/2020 - *@param: - *@return: - *@desc: - */ class PharmaciesListRequestModel { - int itemID; - int languageID; - String stamp; - String ipAdress; - double versionID; - String tokenID; - String sessionID; - bool isLoginForDoctorApp; - bool patientOutSA; - int patientTypeID; - int channel; + int? itemID; + int? languageID; + String? stamp; + String? ipAdress; + double? versionID; + String? tokenID; + String? sessionID; + bool? isLoginForDoctorApp; + bool? patientOutSA; + int? patientTypeID; + int? channel; PharmaciesListRequestModel( {this.itemID, diff --git a/lib/core/model/pharmacies/pharmacies_items_request_model.dart b/lib/core/model/pharmacies/pharmacies_items_request_model.dart index a09736e2..ed593322 100644 --- a/lib/core/model/pharmacies/pharmacies_items_request_model.dart +++ b/lib/core/model/pharmacies/pharmacies_items_request_model.dart @@ -1,23 +1,16 @@ -/* - *@author: Ibrahim Albitar - *@Date:27/4/2020 - *@param: - *@return: - *@desc: - */ class PharmaciesItemsRequestModel { - String pHRItemName; - int pageIndex = 0; - int pageSize = 20; - int channel = 3; - int languageID = 2; - String iPAdress = "10.20.10.20"; - String generalid = "Cs2020@2016\$2958"; - int patientOutSA = 0; - String sessionID = "KvFJENeAUCxyVdIfEkHw"; - bool isDentalAllowedBackend = false; - int deviceTypeID = 2; + String? pHRItemName; + int? pageIndex = 0; + int? pageSize = 20; + int? channel = 3; + int? languageID = 2; + String? iPAdress = "10.20.10.20"; + String? generalid = "Cs2020@2016\$2958"; + int? patientOutSA = 0; + String? sessionID = "KvFJENeAUCxyVdIfEkHw"; + bool? isDentalAllowedBackend = false; + int? deviceTypeID = 2; PharmaciesItemsRequestModel( {this.pHRItemName, diff --git a/lib/core/model/pharmacy-intervention-model/accept_or_reject_req_model.dart b/lib/core/model/pharmacy-intervention-model/accept_or_reject_req_model.dart index 67b234de..6c082f6e 100644 --- a/lib/core/model/pharmacy-intervention-model/accept_or_reject_req_model.dart +++ b/lib/core/model/pharmacy-intervention-model/accept_or_reject_req_model.dart @@ -1,17 +1,17 @@ class AcceptOrRejectReqModel { - int patientID; - int projectID; - int admissionNo; - int prescriptionNo; - int orderNo; - String remarks; - int memberID; - int accessLevel; - int languageID; - int lineItemNo; - bool patientOutSA; - int interventionStatus; - int status; + int? patientID; + int? projectID; + int? admissionNo; + int? prescriptionNo; + int? orderNo; + String? remarks; + int? memberID; + int? accessLevel; + int? languageID; + int? lineItemNo; + bool? patientOutSA; + int? interventionStatus; + int? status; AcceptOrRejectReqModel( {this.patientID, diff --git a/lib/core/model/pharmacy-intervention-model/intervention_medication_history_req_model.dart b/lib/core/model/pharmacy-intervention-model/intervention_medication_history_req_model.dart index 122212b7..9588a488 100644 --- a/lib/core/model/pharmacy-intervention-model/intervention_medication_history_req_model.dart +++ b/lib/core/model/pharmacy-intervention-model/intervention_medication_history_req_model.dart @@ -1,9 +1,9 @@ class InterventionMedicationHistoryReqModel { - int projectID; - int patientID; - int admissionNo; - int orderNo; - int prescriptionNo; + int? projectID; + int? patientID; + int? admissionNo; + int? orderNo; + int? prescriptionNo; InterventionMedicationHistoryReqModel( {this.projectID, diff --git a/lib/core/model/pharmacy-intervention-model/intervention_medication_history_res_model.dart b/lib/core/model/pharmacy-intervention-model/intervention_medication_history_res_model.dart index 451cccb8..88eeb952 100644 --- a/lib/core/model/pharmacy-intervention-model/intervention_medication_history_res_model.dart +++ b/lib/core/model/pharmacy-intervention-model/intervention_medication_history_res_model.dart @@ -1,25 +1,25 @@ class InterventionMedicationHistoryResModel { - String setupId; - String projectId; - int patientId; - int admissionNo; - int prescriptionId; - int orderNo; - int id; - int interventionId; - Null intervention; - String remark; - int commentedBy; - bool isDoctor; - bool isActive; - int createdBy; - String createdByName; - String createdByNameN; - String createdOn; - Null editedBy; - Null editedByName; - Null editedByNameN; - Null editedOn; + String? setupId; + String? projectId; + int? patientId; + int? admissionNo; + int? prescriptionId; + int? orderNo; + int? id; + int? interventionId; + dynamic intervention; + String? remark; + int? commentedBy; + bool? isDoctor; + bool? isActive; + int? createdBy; + String? createdByName; + String? createdByNameN; + String? createdOn; + dynamic editedBy; + dynamic editedByName; + dynamic editedByNameN; + dynamic editedOn; InterventionMedicationHistoryResModel( {this.setupId, diff --git a/lib/core/model/pharmacy-intervention-model/new_medication_req_model.dart b/lib/core/model/pharmacy-intervention-model/new_medication_req_model.dart index 92cde706..79b2431c 100644 --- a/lib/core/model/pharmacy-intervention-model/new_medication_req_model.dart +++ b/lib/core/model/pharmacy-intervention-model/new_medication_req_model.dart @@ -1,8 +1,8 @@ class InterventionMedicationReqModel { - int projectID; - int patientID; - String fromDate; - String toDate; + int? projectID; + int? patientID; + String? fromDate; + String? toDate; InterventionMedicationReqModel( {this.projectID, this.patientID, this.fromDate, this.toDate}); diff --git a/lib/core/model/pharmacy-intervention-model/new_medication_res_model.dart b/lib/core/model/pharmacy-intervention-model/new_medication_res_model.dart index 5d3dca39..81a017d5 100644 --- a/lib/core/model/pharmacy-intervention-model/new_medication_res_model.dart +++ b/lib/core/model/pharmacy-intervention-model/new_medication_res_model.dart @@ -1,26 +1,26 @@ class InterventionMedicationResModel { - String cS; - String iHR; - String setupID; - int projectID; - int accessLevel; - int patientID; - String patientName; - String description; - int admissionNo; - int orderNo; - int prescriptionNo; - int lineItemNo; - int itemID; - String medication; - String doctorComments; - String startDatetime; - String stopDatetime; - int status; - int createdBy; - int authorizedby; - Null pharmacyRemarks; - String statusDescription; + String? cS; + String? iHR; + String? setupID; + int? projectID; + int? accessLevel; + int? patientID; + String? patientName; + String? description; + int? admissionNo; + int? orderNo; + int? prescriptionNo; + int? lineItemNo; + int? itemID; + String? medication; + String? doctorComments; + String? startDatetime; + String? stopDatetime; + int? status; + int? createdBy; + int? authorizedby; + dynamic pharmacyRemarks; + String? statusDescription; InterventionMedicationResModel( {this.cS, diff --git a/lib/core/model/procedure/ControlsModel.dart b/lib/core/model/procedure/ControlsModel.dart index b3e8ae9c..c4dbcfd5 100644 --- a/lib/core/model/procedure/ControlsModel.dart +++ b/lib/core/model/procedure/ControlsModel.dart @@ -1,6 +1,6 @@ class Controls { - String code; - String controlValue; + String? code; + String? controlValue; Controls({this.code, this.controlValue}); diff --git a/lib/core/model/procedure/Procedure_template_request_model.dart b/lib/core/model/procedure/Procedure_template_request_model.dart index 698178e3..26e3a271 100644 --- a/lib/core/model/procedure/Procedure_template_request_model.dart +++ b/lib/core/model/procedure/Procedure_template_request_model.dart @@ -1,31 +1,31 @@ class ProcedureTempleteRequestModel { - int doctorID; - String firstName; - String middleName; - String lastName; - String patientMobileNumber; - String patientIdentificationID; - int patientID; - String from; - String to; - int searchType; - String mobileNo; - String identificationNo; - int editedBy; - int projectID; - int clinicID; - String tokenID; - int languageID; - String stamp; - String iPAdress; - double versionID; - int channel; - String sessionID; - bool isLoginForDoctorApp; - bool patientOutSA; - String vidaAuthTokenID; - String vidaRefreshTokenID; - int deviceTypeID; + int? doctorID; + String? firstName; + String? middleName; + String? lastName; + String? patientMobileNumber; + String? patientIdentificationID; + int? patientID; + String? from; + String? to; + int? searchType; + String? mobileNo; + String? identificationNo; + int? editedBy; + int? projectID; + int? clinicID; + String? tokenID; + int? languageID; + String? stamp; + String? iPAdress; + double? versionID; + int? channel; + String? sessionID; + bool? isLoginForDoctorApp; + bool? patientOutSA; + String? vidaAuthTokenID; + String? vidaRefreshTokenID; + int? deviceTypeID; ProcedureTempleteRequestModel( {this.doctorID, diff --git a/lib/core/model/procedure/categories_procedure.dart b/lib/core/model/procedure/categories_procedure.dart index 9e6f847f..8fb38586 100644 --- a/lib/core/model/procedure/categories_procedure.dart +++ b/lib/core/model/procedure/categories_procedure.dart @@ -1,6 +1,6 @@ class CategoriseProcedureModel { - List entityList; - int rowcount; + List? entityList; + int? rowcount; dynamic statusMessage; CategoriseProcedureModel( @@ -8,9 +8,9 @@ class CategoriseProcedureModel { CategoriseProcedureModel.fromJson(Map json) { if (json['entityList'] != null) { - entityList = new List(); + entityList = []; json['entityList'].forEach((v) { - entityList.add(new EntityList.fromJson(v)); + entityList!.add(new EntityList.fromJson(v)); }); } rowcount = json['rowcount']; @@ -20,7 +20,7 @@ class CategoriseProcedureModel { Map toJson() { final Map data = new Map(); if (this.entityList != null) { - data['entityList'] = this.entityList.map((v) => v.toJson()).toList(); + data['entityList'] = this.entityList!.map((v) => v.toJson()).toList(); } data['rowcount'] = this.rowcount; data['statusMessage'] = this.statusMessage; @@ -29,20 +29,20 @@ class CategoriseProcedureModel { } class EntityList { - bool allowedClinic; - String category; - String categoryID; - String genderValidation; - String group; - String orderedValidation; + bool? allowedClinic; + String? category; + String? categoryID; + String? genderValidation; + String? group; + String? orderedValidation; dynamic price; - String procedureId; - String procedureName; - String specialPermission; - String subGroup; - String template; - String remarks; - String type; + String? procedureId; + String? procedureName; + String? specialPermission; + String? subGroup; + String? template; + String? remarks; + String? type; EntityList( {this.allowedClinic, diff --git a/lib/core/model/procedure/get_ordered_procedure_model.dart b/lib/core/model/procedure/get_ordered_procedure_model.dart index c3c7718f..7ddf6471 100644 --- a/lib/core/model/procedure/get_ordered_procedure_model.dart +++ b/lib/core/model/procedure/get_ordered_procedure_model.dart @@ -1,6 +1,6 @@ class GetOrderedProcedureModel { - List entityList; - int rowcount; + List? entityList; + int? rowcount; dynamic statusMessage; GetOrderedProcedureModel( @@ -8,9 +8,9 @@ class GetOrderedProcedureModel { GetOrderedProcedureModel.fromJson(Map json) { if (json['entityList'] != null) { - entityList = new List(); + entityList = []; json['entityList'].forEach((v) { - entityList.add(new EntityList.fromJson(v)); + entityList!.add(new EntityList.fromJson(v)); }); } rowcount = json['rowcount']; @@ -20,7 +20,7 @@ class GetOrderedProcedureModel { Map toJson() { final Map data = new Map(); if (this.entityList != null) { - data['entityList'] = this.entityList.map((v) => v.toJson()).toList(); + data['entityList'] = this.entityList!.map((v) => v.toJson()).toList(); } data['rowcount'] = this.rowcount; data['statusMessage'] = this.statusMessage; @@ -29,31 +29,31 @@ class GetOrderedProcedureModel { } class EntityList { - String achiCode; - String appointmentDate; - int appointmentNo; - int categoryID; - String clinicDescription; - String cptCode; - int createdBy; - String createdOn; - String doctorName; - bool isApprovalCreated; - bool isApprovalRequired; - bool isCovered; - bool isInvoiced; - bool isReferralInvoiced; - bool isUncoveredByDoctor; - int lineItemNo; - String orderDate; - int orderNo; - int orderType; - String procedureId; - String procedureName; - String remarks; - String status; - String template; - int doctorID; + String? achiCode; + String? appointmentDate; + int? appointmentNo; + int? categoryID; + String? clinicDescription; + String? cptCode; + int? createdBy; + String? createdOn; + String? doctorName; + bool? isApprovalCreated; + bool? isApprovalRequired; + bool? isCovered; + bool? isInvoiced; + bool? isReferralInvoiced; + bool? isUncoveredByDoctor; + int? lineItemNo; + String? orderDate; + int? orderNo; + int? orderType; + String? procedureId; + String? procedureName; + String? remarks; + String? status; + String? template; + int? doctorID; EntityList( {this.achiCode, diff --git a/lib/core/model/procedure/get_ordered_procedure_request_model.dart b/lib/core/model/procedure/get_ordered_procedure_request_model.dart index 454559f9..dbfb75cd 100644 --- a/lib/core/model/procedure/get_ordered_procedure_request_model.dart +++ b/lib/core/model/procedure/get_ordered_procedure_request_model.dart @@ -1,7 +1,7 @@ class GetOrderedProcedureRequestModel { - String vidaAuthTokenID; - int patientMRN; - int appointmentNo; + String? vidaAuthTokenID; + int? patientMRN; + int? appointmentNo; GetOrderedProcedureRequestModel( {this.vidaAuthTokenID, this.patientMRN, this.appointmentNo}); diff --git a/lib/core/model/procedure/get_procedure_model.dart b/lib/core/model/procedure/get_procedure_model.dart index 5c83b49b..fe218eea 100644 --- a/lib/core/model/procedure/get_procedure_model.dart +++ b/lib/core/model/procedure/get_procedure_model.dart @@ -1,15 +1,15 @@ class GetProcedureModel { - List entityList; - int rowcount; + List? entityList; + int? rowcount; dynamic statusMessage; GetProcedureModel({this.entityList, this.rowcount, this.statusMessage}); GetProcedureModel.fromJson(Map json) { if (json['entityList'] != null) { - entityList = new List(); + entityList = []; json['entityList'].forEach((v) { - entityList.add(new EntityList.fromJson(v)); + entityList!.add(new EntityList.fromJson(v)); }); } rowcount = json['rowcount']; @@ -19,7 +19,7 @@ class GetProcedureModel { Map toJson() { final Map data = new Map(); if (this.entityList != null) { - data['entityList'] = this.entityList.map((v) => v.toJson()).toList(); + data['entityList'] = this.entityList!.map((v) => v.toJson()).toList(); } data['rowcount'] = this.rowcount; data['statusMessage'] = this.statusMessage; @@ -28,18 +28,18 @@ class GetProcedureModel { } class EntityList { - bool allowedClinic; - String category; - String categoryID; - String genderValidation; - String group; - String orderedValidation; + bool? allowedClinic; + String? category; + String? categoryID; + String? genderValidation; + String? group; + String? orderedValidation; dynamic price; - String procedureId; - String procedureName; - String specialPermission; - String subGroup; - String template; + String? procedureId; + String? procedureName; + String? specialPermission; + String? subGroup; + String? template; EntityList( {this.allowedClinic, diff --git a/lib/core/model/procedure/get_procedure_req_model.dart b/lib/core/model/procedure/get_procedure_req_model.dart index 6202a520..309e657c 100644 --- a/lib/core/model/procedure/get_procedure_req_model.dart +++ b/lib/core/model/procedure/get_procedure_req_model.dart @@ -1,11 +1,11 @@ class GetProcedureReqModel { - int clinicId; - int patientMRN; - int pageSize; - int pageIndex; - List search; + int? clinicId; + int? patientMRN; + int? pageSize; + int? pageIndex; + List? search; dynamic category; - String vidaAuthTokenID; + String? vidaAuthTokenID; GetProcedureReqModel( {this.clinicId, diff --git a/lib/core/model/procedure/order-procedure.dart b/lib/core/model/procedure/order-procedure.dart index b49305ef..24865e44 100644 --- a/lib/core/model/procedure/order-procedure.dart +++ b/lib/core/model/procedure/order-procedure.dart @@ -1,28 +1,28 @@ class OrderProcedure { - String achiCode; - String appointmentDate; - int appointmentNo; - int categoryID; - String clinicDescription; - String cptCode; - int createdBy; - String createdOn; - String doctorName; - bool isApprovalCreated; - bool isApprovalRequired; - bool isCovered; - bool isInvoiced; - bool isReferralInvoiced; - bool isUncoveredByDoctor; - int lineItemNo; - String orderDate; - int orderNo; - int orderType; - String procedureId; - String procedureName; - String remarks; - String status; - String template; + String? achiCode; + String? appointmentDate; + int? appointmentNo; + int? categoryID; + String? clinicDescription; + String? cptCode; + int? createdBy; + String? createdOn; + String? doctorName; + bool? isApprovalCreated; + bool? isApprovalRequired; + bool? isCovered; + bool? isInvoiced; + bool? isReferralInvoiced; + bool? isUncoveredByDoctor; + int? lineItemNo; + String? orderDate; + int? orderNo; + int? orderType; + String? procedureId; + String? procedureName; + String? remarks; + String? status; + String? template; OrderProcedure( {this.achiCode, diff --git a/lib/core/model/procedure/post_procedure_req_model.dart b/lib/core/model/procedure/post_procedure_req_model.dart index b12563f8..729e08d8 100644 --- a/lib/core/model/procedure/post_procedure_req_model.dart +++ b/lib/core/model/procedure/post_procedure_req_model.dart @@ -1,11 +1,11 @@ import 'ControlsModel.dart'; class PostProcedureReqModel { - int patientMRN; - int appointmentNo; - int episodeID; - List procedures; - String vidaAuthTokenID; + int? patientMRN; + int? appointmentNo; + int? episodeID; + List? procedures; + String? vidaAuthTokenID; PostProcedureReqModel( {this.patientMRN, @@ -19,9 +19,9 @@ class PostProcedureReqModel { appointmentNo = json['AppointmentNo']; episodeID = json['EpisodeID']; if (json['Procedures'] != null) { - procedures = new List(); + procedures = []; json['Procedures'].forEach((v) { - procedures.add(new Procedures.fromJson(v)); + procedures!.add(new Procedures.fromJson(v)); }); } vidaAuthTokenID = json['VidaAuthTokenID']; @@ -33,7 +33,7 @@ class PostProcedureReqModel { data['AppointmentNo'] = this.appointmentNo; data['EpisodeID'] = this.episodeID; if (this.procedures != null) { - data['Procedures'] = this.procedures.map((v) => v.toJson()).toList(); + data['Procedures'] = this.procedures!.map((v) => v.toJson()).toList(); } data['VidaAuthTokenID'] = this.vidaAuthTokenID; return data; @@ -41,9 +41,9 @@ class PostProcedureReqModel { } class Procedures { - String procedure; - String category; - List controls; + String? procedure; + String? category; + List? controls; Procedures({this.procedure, this.category, this.controls}); @@ -51,9 +51,9 @@ class Procedures { procedure = json['Procedure']; category = json['Category']; if (json['Controls'] != null) { - controls = new List(); + controls = []; json['Controls'].forEach((v) { - controls.add(new Controls.fromJson(v)); + controls!.add(new Controls.fromJson(v)); }); } } @@ -63,7 +63,7 @@ class Procedures { data['Procedure'] = this.procedure; data['Category'] = this.category; if (this.controls != null) { - data['Controls'] = this.controls.map((v) => v.toJson()).toList(); + data['Controls'] = this.controls!.map((v) => v.toJson()).toList(); } return data; } diff --git a/lib/core/model/procedure/procedure_category_list_model.dart b/lib/core/model/procedure/procedure_category_list_model.dart index 849e84e5..d8eb45ea 100644 --- a/lib/core/model/procedure/procedure_category_list_model.dart +++ b/lib/core/model/procedure/procedure_category_list_model.dart @@ -1,6 +1,6 @@ class ProcedureCategoryListModel { - List entityList; - int rowcount; + List? entityList; + int? rowcount; dynamic statusMessage; ProcedureCategoryListModel( @@ -8,9 +8,9 @@ class ProcedureCategoryListModel { ProcedureCategoryListModel.fromJson(Map json) { if (json['entityList'] != null) { - entityList = new List(); + entityList = []; json['entityList'].forEach((v) { - entityList.add(new EntityList.fromJson(v)); + entityList!.add(new EntityList.fromJson(v)); }); } rowcount = json['rowcount']; @@ -20,7 +20,7 @@ class ProcedureCategoryListModel { Map toJson() { final Map data = new Map(); if (this.entityList != null) { - data['entityList'] = this.entityList.map((v) => v.toJson()).toList(); + data['entityList'] = this.entityList!.map((v) => v.toJson()).toList(); } data['rowcount'] = this.rowcount; data['statusMessage'] = this.statusMessage; @@ -29,8 +29,8 @@ class ProcedureCategoryListModel { } class EntityList { - int categoryId; - String categoryName; + int? categoryId; + String? categoryName; EntityList({this.categoryId, this.categoryName}); diff --git a/lib/core/model/procedure/procedure_templateModel.dart b/lib/core/model/procedure/procedure_templateModel.dart index 3b12d646..38a05693 100644 --- a/lib/core/model/procedure/procedure_templateModel.dart +++ b/lib/core/model/procedure/procedure_templateModel.dart @@ -1,13 +1,13 @@ class ProcedureTempleteModel { - String setupID; - int projectID; - int clinicID; - int doctorID; - int templateID; - String templateName; - bool isActive; - int createdBy; - String createdOn; + String? setupID; + int? projectID; + int? clinicID; + int? doctorID; + int? templateID; + String? templateName; + bool? isActive; + int? createdBy; + String? createdOn; dynamic editedBy; dynamic editedOn; diff --git a/lib/core/model/procedure/procedure_template_details_model.dart b/lib/core/model/procedure/procedure_template_details_model.dart index 96e13765..074ae43e 100644 --- a/lib/core/model/procedure/procedure_template_details_model.dart +++ b/lib/core/model/procedure/procedure_template_details_model.dart @@ -1,29 +1,29 @@ class ProcedureTempleteDetailsModel { - String setupID; - int projectID; - int clinicID; - int doctorID; - int templateID; - String templateName; - String procedureID; - bool isActive; - int createdBy; - String createdOn; + String? setupID; + int? projectID; + int? clinicID; + int? doctorID; + int? templateID; + String? templateName; + String? procedureID; + bool? isActive; + int? createdBy; + String? createdOn; dynamic editedBy; dynamic editedOn; - String procedureName; - String procedureNameN; - String alias; - String aliasN; - String categoryID; - String subGroupID; - String categoryDescription; - String categoryDescriptionN; - String categoryAlias; + String? procedureName; + String? procedureNameN; + String? alias; + String? aliasN; + String? categoryID; + String? subGroupID; + String? categoryDescription; + String? categoryDescriptionN; + String? categoryAlias; dynamic riskCategoryID; - String type = "1"; - String remarks; - int selectedType = 0; + String? type = "1"; + String? remarks; + int? selectedType = 0; ProcedureTempleteDetailsModel( {this.setupID, @@ -106,14 +106,14 @@ class ProcedureTempleteDetailsModel { } class ProcedureTempleteDetailsModelList { - List procedureTemplate = List(); - String templateName; - int templateId; + List procedureTemplate = []; + String? templateName; + int? templateId; ProcedureTempleteDetailsModelList( {this.templateName, this.templateId, - ProcedureTempleteDetailsModel template}) { - procedureTemplate.add(template); + ProcedureTempleteDetailsModel? template}) { + procedureTemplate.add(template!); } } diff --git a/lib/core/model/procedure/procedure_template_details_request_model.dart b/lib/core/model/procedure/procedure_template_details_request_model.dart index 6df6fc73..99c9f814 100644 --- a/lib/core/model/procedure/procedure_template_details_request_model.dart +++ b/lib/core/model/procedure/procedure_template_details_request_model.dart @@ -1,32 +1,32 @@ class ProcedureTempleteDetailsRequestModel { - int doctorID; - String firstName; - int templateID; - String middleName; - String lastName; - String patientMobileNumber; - String patientIdentificationID; - int patientID; - String from; - String to; - int searchType; - String mobileNo; - String identificationNo; - int editedBy; - int projectID; - int clinicID; - String tokenID; - int languageID; - String stamp; - String iPAdress; - double versionID; - int channel; - String sessionID; - bool isLoginForDoctorApp; - bool patientOutSA; - String vidaAuthTokenID; - String vidaRefreshTokenID; - int deviceTypeID; + int? doctorID; + String? firstName; + int? templateID; + String? middleName; + String? lastName; + String? patientMobileNumber; + String? patientIdentificationID; + int? patientID; + String? from; + String? to; + int? searchType; + String? mobileNo; + String? identificationNo; + int? editedBy; + int? projectID; + int? clinicID; + String? tokenID; + int? languageID; + String? stamp; + String? iPAdress; + double? versionID; + int? channel; + String? sessionID; + bool? isLoginForDoctorApp; + bool? patientOutSA; + String? vidaAuthTokenID; + String? vidaRefreshTokenID; + int? deviceTypeID; ProcedureTempleteDetailsRequestModel( {this.doctorID, diff --git a/lib/core/model/procedure/procedure_valadate_model.dart b/lib/core/model/procedure/procedure_valadate_model.dart index 3a3e23cf..ee41791f 100644 --- a/lib/core/model/procedure/procedure_valadate_model.dart +++ b/lib/core/model/procedure/procedure_valadate_model.dart @@ -1,6 +1,6 @@ class ProcedureValadteModel { - List entityList; - int rowcount; + List? entityList; + int? rowcount; dynamic statusMessage; dynamic success; @@ -9,9 +9,9 @@ class ProcedureValadteModel { ProcedureValadteModel.fromJson(Map json) { if (json['entityList'] != null) { - entityList = new List(); + entityList = []; json['entityList'].forEach((v) { - entityList.add(new EntityList.fromJson(v)); + entityList!.add(new EntityList.fromJson(v)); }); } rowcount = json['rowcount']; @@ -22,7 +22,7 @@ class ProcedureValadteModel { Map toJson() { final Map data = new Map(); if (this.entityList != null) { - data['entityList'] = this.entityList.map((v) => v.toJson()).toList(); + data['entityList'] = this.entityList!.map((v) => v.toJson()).toList(); } data['rowcount'] = this.rowcount; data['statusMessage'] = this.statusMessage; @@ -32,8 +32,8 @@ class ProcedureValadteModel { } class EntityList { - String procedureId; - List warringMessages; + String? procedureId; + List? warringMessages; EntityList({this.procedureId, this.warringMessages}); diff --git a/lib/core/model/procedure/procedure_valadate_request_model.dart b/lib/core/model/procedure/procedure_valadate_request_model.dart index 93aafbcf..92202820 100644 --- a/lib/core/model/procedure/procedure_valadate_request_model.dart +++ b/lib/core/model/procedure/procedure_valadate_request_model.dart @@ -1,9 +1,9 @@ class ProcedureValidationRequestModel { - String vidaAuthTokenID; - int patientMRN; - int appointmentNo; - int episodeID; - List procedure; + String? vidaAuthTokenID; + int? patientMRN; + int? appointmentNo; + int? episodeID; + List? procedure; ProcedureValidationRequestModel( {this.vidaAuthTokenID, diff --git a/lib/core/model/procedure/update_procedure_request_model.dart b/lib/core/model/procedure/update_procedure_request_model.dart index aee39879..889a6e18 100644 --- a/lib/core/model/procedure/update_procedure_request_model.dart +++ b/lib/core/model/procedure/update_procedure_request_model.dart @@ -1,13 +1,13 @@ import 'ControlsModel.dart'; class UpdateProcedureRequestModel { - int orderNo; - int patientMRN; - int appointmentNo; - int episodeID; - int lineItemNo; - ProcedureDetail procedureDetail; - String vidaAuthTokenID; + int? orderNo; + int? patientMRN; + int? appointmentNo; + int? episodeID; + int? lineItemNo; + ProcedureDetail? procedureDetail; + String? vidaAuthTokenID; UpdateProcedureRequestModel( {this.orderNo, @@ -38,7 +38,7 @@ class UpdateProcedureRequestModel { data['EpisodeID'] = this.episodeID; data['LineItemNo'] = this.lineItemNo; if (this.procedureDetail != null) { - data['procedureDetail'] = this.procedureDetail.toJson(); + data['procedureDetail'] = this.procedureDetail!.toJson(); } data['VidaAuthTokenID'] = this.vidaAuthTokenID; return data; @@ -46,9 +46,9 @@ class UpdateProcedureRequestModel { } class ProcedureDetail { - String procedure; - String category; - List controls; + String? procedure; + String? category; + List? controls; ProcedureDetail({this.procedure, this.category, this.controls}); @@ -56,9 +56,9 @@ class ProcedureDetail { procedure = json['Procedure']; category = json['Category']; if (json['Controls'] != null) { - controls = new List(); + controls = []; json['Controls'].forEach((v) { - controls.add(new Controls.fromJson(v)); + controls!.add(new Controls.fromJson(v)); }); } } @@ -68,7 +68,7 @@ class ProcedureDetail { data['Procedure'] = this.procedure; data['Category'] = this.category; if (this.controls != null) { - data['Controls'] = this.controls.map((v) => v.toJson()).toList(); + data['Controls'] = this.controls!.map((v) => v.toJson()).toList(); } return data; } diff --git a/lib/core/model/radiology/final_radiology.dart b/lib/core/model/radiology/final_radiology.dart index 07c4f984..8f5b8a5c 100644 --- a/lib/core/model/radiology/final_radiology.dart +++ b/lib/core/model/radiology/final_radiology.dart @@ -8,17 +8,17 @@ class FinalRadiology { dynamic invoiceNo; dynamic doctorID; dynamic clinicID; - DateTime orderDate; - DateTime reportDate; + DateTime? orderDate; + DateTime? reportDate; dynamic reportData; dynamic imageURL; dynamic procedureID; dynamic appodynamicmentNo; dynamic dIAPacsURL; - bool isRead; + bool? isRead; dynamic readOn; var admissionNo; - bool isInOutPatient; + bool? isInOutPatient; dynamic actualDoctorRate; dynamic clinicDescription; dynamic dIAPACSURL; @@ -28,8 +28,8 @@ class FinalRadiology { dynamic doctorTitle; dynamic gender; dynamic genderDescription; - bool isActiveDoctorProfile; - bool isExecludeDoctor; + bool? isActiveDoctorProfile; + bool? isExecludeDoctor; dynamic isInOutPatientDescription; dynamic isInOutPatientDescriptionN; dynamic nationalityFlagURL; @@ -39,10 +39,10 @@ class FinalRadiology { dynamic qR; dynamic reportDataHTML; dynamic reportDataTextdynamic; - List speciality; - bool isCVI; - bool isRadMedicalReport; - bool isLiveCareAppodynamicment; + List? speciality; + bool? isCVI; + bool? isRadMedicalReport; + bool? isLiveCareAppodynamicment; FinalRadiology( {this.setupID, @@ -185,9 +185,9 @@ class FinalRadiology { class FinalRadiologyList { dynamic filterName = ""; - List finalRadiologyList = List(); + List finalRadiologyList = []; - FinalRadiologyList({this.filterName, FinalRadiology finalRadiology}) { - finalRadiologyList.add(finalRadiology); + FinalRadiologyList({this.filterName, FinalRadiology? finalRadiology}) { + finalRadiologyList.add(finalRadiology!); } } diff --git a/lib/core/model/radiology/request_patient_rad_orders_details.dart b/lib/core/model/radiology/request_patient_rad_orders_details.dart index c511a1fc..bd90193b 100644 --- a/lib/core/model/radiology/request_patient_rad_orders_details.dart +++ b/lib/core/model/radiology/request_patient_rad_orders_details.dart @@ -1,24 +1,24 @@ class RequestPatientRadOrdersDetails { - int projectID; - int orderNo; - int invoiceNo; - String setupID; - String procedureID; - bool isMedicalReport; - bool isCVI; - double versionID; - int channel; - int languageID; - String iPAdress; - String generalid; - int patientOutSA; - String sessionID; - bool isDentalAllowedBackend; - int deviceTypeID; - int patientID; - String tokenID; - int patientTypeID; - int patientType; + int? projectID; + int? orderNo; + int? invoiceNo; + String? setupID; + String? procedureID; + bool? isMedicalReport; + bool? isCVI; + double? versionID; + int? channel; + int? languageID; + String? iPAdress; + String? generalid; + int? patientOutSA; + String? sessionID; + bool? isDentalAllowedBackend; + int? deviceTypeID; + int? patientID; + String? tokenID; + int? patientTypeID; + int? patientType; RequestPatientRadOrdersDetails( {this.projectID, diff --git a/lib/core/model/radiology/request_send_rad_report_email.dart b/lib/core/model/radiology/request_send_rad_report_email.dart index fc778571..37982fe8 100644 --- a/lib/core/model/radiology/request_send_rad_report_email.dart +++ b/lib/core/model/radiology/request_send_rad_report_email.dart @@ -1,30 +1,30 @@ class RequestSendRadReportEmail { - int channel; - String clinicName; - String dateofBirth; - int deviceTypeID; - String doctorName; - String generalid; - int invoiceNo; - String iPAdress; - bool isDentalAllowedBackend; - int languageID; - String orderDate; - int patientID; - String patientIditificationNum; - String patientMobileNumber; - String patientName; - int patientOutSA; - int patientType; - int patientTypeID; - int projectID; - String projectName; - String radResult; - String sessionID; - String setupID; - String to; - String tokenID; - double versionID; + int? channel; + String? clinicName; + String? dateofBirth; + int? deviceTypeID; + String? doctorName; + String? generalid; + int? invoiceNo; + String? iPAdress; + bool? isDentalAllowedBackend; + int? languageID; + String? orderDate; + int? patientID; + String? patientIditificationNum; + String? patientMobileNumber; + String? patientName; + int? patientOutSA; + int? patientType; + int? patientTypeID; + int? projectID; + String? projectName; + String? radResult; + String? sessionID; + String? setupID; + String? to; + String? tokenID; + double? versionID; RequestSendRadReportEmail( {this.channel, diff --git a/lib/core/model/referral/DischargeReferralPatient.dart b/lib/core/model/referral/DischargeReferralPatient.dart index 55f3948f..e1f60a38 100644 --- a/lib/core/model/referral/DischargeReferralPatient.dart +++ b/lib/core/model/referral/DischargeReferralPatient.dart @@ -2,56 +2,56 @@ import 'package:doctor_app_flutter/utils/date-utils.dart'; class DischargeReferralPatient { dynamic rowID; - int projectID; - int lineItemNo; - int doctorID; - int patientID; - String doctorName; + int? projectID; + int? lineItemNo; + int? doctorID; + int? patientID; + String? doctorName; dynamic doctorNameN; - String firstName; - String middleName; - String lastName; + String? firstName; + String? middleName; + String? lastName; dynamic firstNameN; dynamic middleNameN; dynamic lastNameN; - int gender; - String dateofBirth; - String mobileNumber; - String emailAddress; - String patientIdentificationNo; - int patientType; - String admissionNo; - String admissionDate; - String roomID; - String bedID; + int? gender; + String? dateofBirth; + String? mobileNumber; + String? emailAddress; + String? patientIdentificationNo; + int? patientType; + String? admissionNo; + String? admissionDate; + String? roomID; + String? bedID; dynamic nursingStationID; dynamic description; - String nationalityName; + String? nationalityName; dynamic nationalityNameN; - int referralDoctor; - int referringDoctor; - int referralClinic; - int referringClinic; - int referralStatus; - DateTime referralDate; - String referringDoctorRemarks; - String referredDoctorRemarks; - String referralResponseOn; - int priority; - int frequency; - String mAXResponseTime; - String dischargeDate; + int? referralDoctor; + int? referringDoctor; + int? referralClinic; + int? referringClinic; + int? referralStatus; + DateTime? referralDate; + String? referringDoctorRemarks; + String? referredDoctorRemarks; + String? referralResponseOn; + int? priority; + int? frequency; + String? mAXResponseTime; + String? dischargeDate; dynamic clinicID; - String age; - String clinicDescription; - String frequencyDescription; - String genderDescription; - bool isDoctorLate; - bool isDoctorResponse; - String nursingStationName; - String priorityDescription; - String referringClinicDescription; - String referringDoctorName; + String? age; + String? clinicDescription; + String? frequencyDescription; + String? genderDescription; + bool? isDoctorLate; + bool? isDoctorResponse; + String? nursingStationName; + String? priorityDescription; + String? referringClinicDescription; + String? referringDoctorName; DischargeReferralPatient( {this.rowID, diff --git a/lib/core/model/referral/MyReferralPatientModel.dart b/lib/core/model/referral/MyReferralPatientModel.dart index 7a17b1de..70ce1f6d 100644 --- a/lib/core/model/referral/MyReferralPatientModel.dart +++ b/lib/core/model/referral/MyReferralPatientModel.dart @@ -2,75 +2,75 @@ import 'package:doctor_app_flutter/utils/date-utils.dart'; class MyReferralPatientModel { dynamic rowID; - int projectID; - int lineItemNo; - int doctorID; - int patientID; - String doctorName; + int? projectID; + int? lineItemNo; + int? doctorID; + int? patientID; + String? doctorName; dynamic doctorNameN; - String firstName; - String middleName; - String lastName; + String? firstName; + String? middleName; + String? lastName; dynamic firstNameN; dynamic middleNameN; dynamic lastNameN; - int gender; - String dateofBirth; - String mobileNumber; - String emailAddress; - String patientIdentificationNo; - int patientType; - String admissionNo; - String admissionDate; - String roomID; - String bedID; + int? gender; + String? dateofBirth; + String? mobileNumber; + String? emailAddress; + String? patientIdentificationNo; + int? patientType; + String? admissionNo; + String? admissionDate; + String? roomID; + String? bedID; dynamic nursingStationID; dynamic description; - String nationalityName; + String? nationalityName; dynamic nationalityNameN; - String clinicDescription; - String clinicDescriptionN; - int referralDoctor; - int referringDoctor; - int referralClinic; - int referringClinic; - int referralStatus; - DateTime referralDate; - String referringDoctorRemarks; - String referredDoctorRemarks; - String referralResponseOn; - int priority; - int frequency; - String mAXResponseTime; - int episodeID; - int appointmentNo; - String appointmentDate; - int appointmentType; - int patientMRN; - String createdOn; - int clinicID; - String nationalityID; - String age; - String doctorImageURL; - String frequencyDescription; - String genderDescription; - bool isDoctorLate; - bool isDoctorResponse; - String nationalityFlagURL; - String nursingStationName; - String priorityDescription; - String referringClinicDescription; - String referringDoctorName; - int referalStatus; - String sourceSetupID; - int sourceProjectId; - String targetSetupID; - int targetProjectId; - int targetClinicID; - int targetDoctorID; - int sourceAppointmentNo; - int targetAppointmentNo; - String remarksFromSource; + String? clinicDescription; + String? clinicDescriptionN; + int? referralDoctor; + int? referringDoctor; + int? referralClinic; + int? referringClinic; + int? referralStatus; + DateTime? referralDate; + String? referringDoctorRemarks; + String? referredDoctorRemarks; + String? referralResponseOn; + int? priority; + int? frequency; + String? mAXResponseTime; + int? episodeID; + int? appointmentNo; + String? appointmentDate; + int? appointmentType; + int? patientMRN; + String? createdOn; + int? clinicID; + String? nationalityID; + String? age; + String? doctorImageURL; + String? frequencyDescription; + String? genderDescription; + bool? isDoctorLate; + bool? isDoctorResponse; + String? nationalityFlagURL; + String? nursingStationName; + String? priorityDescription; + String? referringClinicDescription; + String? referringDoctorName; + int? referalStatus; + String? sourceSetupID; + int? sourceProjectId; + String? targetSetupID; + int? targetProjectId; + int? targetClinicID; + int? targetDoctorID; + int? sourceAppointmentNo; + int? targetAppointmentNo; + String? remarksFromSource; MyReferralPatientModel( {this.rowID, @@ -306,6 +306,6 @@ class MyReferralPatientModel { } get patientName { - return this.firstName + " " + this.lastName; + return this.firstName! + " " + this.lastName!; } } diff --git a/lib/core/model/referral/MyReferralPatientRequestModel.dart b/lib/core/model/referral/MyReferralPatientRequestModel.dart index 437f5a0d..1a7e6103 100644 --- a/lib/core/model/referral/MyReferralPatientRequestModel.dart +++ b/lib/core/model/referral/MyReferralPatientRequestModel.dart @@ -1,27 +1,27 @@ class MyReferralPatientRequestModel { - int channel; - int clinicID; - int doctorID; - int editedBy; - String firstName; - String from; - String iPAdress; - bool isLoginForDoctorApp; - int languageID; - String lastName; - String middleName; - int patientID; - String patientIdentificationID; - String patientMobileNumber; - bool patientOutSA; - int patientTypeID; - int projectID; - String sessionID; - String stamp; - String to; - String tokenID; - double versionID; - String vidaAuthTokenID; + int? channel; + int? clinicID; + int? doctorID; + int? editedBy; + String? firstName; + String? from; + String? iPAdress; + bool? isLoginForDoctorApp; + int? languageID; + String? lastName; + String? middleName; + int? patientID; + String? patientIdentificationID; + String? patientMobileNumber; + bool? patientOutSA; + int? patientTypeID; + int? projectID; + String? sessionID; + String? stamp; + String? to; + String? tokenID; + double? versionID; + String? vidaAuthTokenID; MyReferralPatientRequestModel( {this.channel, diff --git a/lib/core/model/referral/ReferralRequest.dart b/lib/core/model/referral/ReferralRequest.dart index cf3c20fb..b3ad1e0e 100644 --- a/lib/core/model/referral/ReferralRequest.dart +++ b/lib/core/model/referral/ReferralRequest.dart @@ -1,28 +1,28 @@ class ReferralRequest { - String roomID; - String referralClinic; - String referralDoctor; - int createdBy; - int editedBy; - int patientID; - int patientTypeID; - int referringClinic; - int referringDoctor; - int projectID; - int admissionNo; - String referringDoctorRemarks; - String priority; - String frequency; - String extension; - int languageID; - String stamp; - String iPAdress; - double versionID; - int channel; - String tokenID; - String sessionID; - bool isLoginForDoctorApp; - bool patientOutSA; + String? roomID; + String? referralClinic; + String? referralDoctor; + int? createdBy; + int? editedBy; + int? patientID; + int? patientTypeID; + int? referringClinic; + int? referringDoctor; + int? projectID; + int? admissionNo; + String? referringDoctorRemarks; + String? priority; + String? frequency; + String? extension; + int? languageID; + String? stamp; + String? iPAdress; + double? versionID; + int? channel; + String? tokenID; + String? sessionID; + bool? isLoginForDoctorApp; + bool? patientOutSA; ReferralRequest( {this.roomID, diff --git a/lib/core/model/referral/add_referred_remarks_request.dart b/lib/core/model/referral/add_referred_remarks_request.dart index 14089513..5f7711aa 100644 --- a/lib/core/model/referral/add_referred_remarks_request.dart +++ b/lib/core/model/referral/add_referred_remarks_request.dart @@ -1,19 +1,19 @@ class AddReferredRemarksRequestModel { - int projectID; - int admissionNo; - int lineItemNo; - String referredDoctorRemarks; - int editedBy; - int referalStatus; - bool isLoginForDoctorApp; - String iPAdress; - bool patientOutSA; - String tokenID; - int languageID; - double versionID; - int channel; - String sessionID; - int deviceTypeID; + int? projectID; + int? admissionNo; + int? lineItemNo; + String? referredDoctorRemarks; + int? editedBy; + int? referalStatus; + bool? isLoginForDoctorApp; + String? iPAdress; + bool? patientOutSA; + String? tokenID; + int? languageID; + double? versionID; + int? channel; + String? sessionID; + int? deviceTypeID; AddReferredRemarksRequestModel( {this.projectID, diff --git a/lib/core/model/search_drug/get_medication_response_model.dart b/lib/core/model/search_drug/get_medication_response_model.dart index e48c41fe..3d6f6344 100644 --- a/lib/core/model/search_drug/get_medication_response_model.dart +++ b/lib/core/model/search_drug/get_medication_response_model.dart @@ -1,13 +1,13 @@ class GetMedicationResponseModel { - String description; - String genericName; - int itemId; - String keywords; + String? description; + String? genericName; + int? itemId; + String? keywords; dynamic price; dynamic quantity; dynamic mediSpanGPICode; - bool isNarcotic; - String uom; + bool? isNarcotic; + String? uom; GetMedicationResponseModel( {this.description, diff --git a/lib/core/model/search_drug/item_by_medicine_model.dart b/lib/core/model/search_drug/item_by_medicine_model.dart index 0a93a4f1..16e8819c 100644 --- a/lib/core/model/search_drug/item_by_medicine_model.dart +++ b/lib/core/model/search_drug/item_by_medicine_model.dart @@ -1,27 +1,27 @@ class ItemByMedicineModel { - List frequencies; - List routes; - List strengths; + List? frequencies; + List? routes; + List? strengths; ItemByMedicineModel({this.frequencies, this.routes, this.strengths}); ItemByMedicineModel.fromJson(Map json) { if (json['frequencies'] != null) { - frequencies = new List(); + frequencies = []; json['frequencies'].forEach((v) { - frequencies.add(new Frequencies.fromJson(v)); + frequencies!.add(new Frequencies.fromJson(v)); }); } if (json['routes'] != null) { - routes = new List(); + routes = []; json['routes'].forEach((v) { - routes.add(new Routes.fromJson(v)); + routes!.add(new Routes.fromJson(v)); }); } if (json['strengths'] != null) { - strengths = new List(); + strengths = []; json['strengths'].forEach((v) { - strengths.add(new Strengths.fromJson(v)); + strengths!.add(new Strengths.fromJson(v)); }); } } @@ -29,22 +29,22 @@ class ItemByMedicineModel { Map toJson() { final Map data = new Map(); if (this.frequencies != null) { - data['frequencies'] = this.frequencies.map((v) => v.toJson()).toList(); + data['frequencies'] = this.frequencies!.map((v) => v.toJson()).toList(); } if (this.routes != null) { - data['routes'] = this.routes.map((v) => v.toJson()).toList(); + data['routes'] = this.routes!.map((v) => v.toJson()).toList(); } if (this.strengths != null) { - data['strengths'] = this.strengths.map((v) => v.toJson()).toList(); + data['strengths'] = this.strengths!.map((v) => v.toJson()).toList(); } return data; } } class Frequencies { - String description; - bool isDefault; - int parameterCode; + String? description; + bool? isDefault; + int? parameterCode; Frequencies({this.description, this.isDefault, this.parameterCode}); @@ -64,9 +64,9 @@ class Frequencies { } class Strengths { - String description; - bool isDefault; - int parameterCode; + String? description; + bool? isDefault; + int? parameterCode; Strengths({this.description, this.isDefault, this.parameterCode}); @@ -86,9 +86,9 @@ class Strengths { } class Routes { - String description; - bool isDefault; - int parameterCode; + String? description; + bool? isDefault; + int? parameterCode; Routes({this.description, this.isDefault, this.parameterCode}); diff --git a/lib/core/model/search_drug/item_by_medicine_request_model.dart b/lib/core/model/search_drug/item_by_medicine_request_model.dart index 7460044b..2845edf4 100644 --- a/lib/core/model/search_drug/item_by_medicine_request_model.dart +++ b/lib/core/model/search_drug/item_by_medicine_request_model.dart @@ -1,6 +1,6 @@ class ItemByMedicineRequestModel { - String vidaAuthTokenID; - int medicineCode; + String? vidaAuthTokenID; + int? medicineCode; ItemByMedicineRequestModel({this.vidaAuthTokenID, this.medicineCode}); diff --git a/lib/core/model/search_drug/search_drug_model.dart b/lib/core/model/search_drug/search_drug_model.dart index 396526c1..759a4eaf 100644 --- a/lib/core/model/search_drug/search_drug_model.dart +++ b/lib/core/model/search_drug/search_drug_model.dart @@ -1,15 +1,15 @@ class SearchDrugModel { - List entityList; - int rowcount; + List? entityList; + int? rowcount; dynamic statusMessage; SearchDrugModel({this.entityList, this.rowcount, this.statusMessage}); SearchDrugModel.fromJson(Map json) { if (json['entityList'] != null) { - entityList = new List(); + entityList = []; json['entityList'].forEach((v) { - entityList.add(new EntityList.fromJson(v)); + entityList!.add(new EntityList.fromJson(v)); }); } rowcount = json['rowcount']; @@ -19,7 +19,7 @@ class SearchDrugModel { Map toJson() { final Map data = new Map(); if (this.entityList != null) { - data['entityList'] = this.entityList.map((v) => v.toJson()).toList(); + data['entityList'] = this.entityList!.map((v) => v.toJson()).toList(); } data['rowcount'] = this.rowcount; data['statusMessage'] = this.statusMessage; diff --git a/lib/core/model/search_drug/search_drug_request_model.dart b/lib/core/model/search_drug/search_drug_request_model.dart index 8548fd32..7a7125f7 100644 --- a/lib/core/model/search_drug/search_drug_request_model.dart +++ b/lib/core/model/search_drug/search_drug_request_model.dart @@ -1,5 +1,5 @@ class SearchDrugRequestModel { - List search; + List? search; // String vidaAuthTokenID; diff --git a/lib/core/model/sick_leave/sick_leave_doctor_request_model.dart b/lib/core/model/sick_leave/sick_leave_doctor_request_model.dart index c6837c03..8087481c 100644 --- a/lib/core/model/sick_leave/sick_leave_doctor_request_model.dart +++ b/lib/core/model/sick_leave/sick_leave_doctor_request_model.dart @@ -1,9 +1,9 @@ class GetSickLeaveDoctorRequestModel { - int patientMRN; - String appointmentNo; - int status; - String vidaAuthTokenID; - String vidaRefreshTokenID; + int? patientMRN; + String? appointmentNo; + int? status; + String? vidaAuthTokenID; + String? vidaRefreshTokenID; GetSickLeaveDoctorRequestModel( {this.patientMRN, diff --git a/lib/core/model/sick_leave/sick_leave_patient_model.dart b/lib/core/model/sick_leave/sick_leave_patient_model.dart index d4c15368..26c87b93 100644 --- a/lib/core/model/sick_leave/sick_leave_patient_model.dart +++ b/lib/core/model/sick_leave/sick_leave_patient_model.dart @@ -19,13 +19,13 @@ class SickLeavePatientModel { dynamic doctorTitle; dynamic gender; dynamic genderDescription; - bool isActiveDoctorProfile; - bool isDoctorAllowVedioCall; - bool isExecludeDoctor; - bool isInOutPatient; + bool? isActiveDoctorProfile; + bool? isDoctorAllowVedioCall; + bool? isExecludeDoctor; + bool? isInOutPatient; dynamic isInOutPatientDescription; dynamic isInOutPatientDescriptionN; - bool isLiveCareAppointment; + bool? isLiveCareAppointment; dynamic noOfPatientsRate; dynamic patientName; dynamic projectName; diff --git a/lib/core/model/sick_leave/sick_leave_patient_request_model.dart b/lib/core/model/sick_leave/sick_leave_patient_request_model.dart index 69b18f41..ba2a399c 100644 --- a/lib/core/model/sick_leave/sick_leave_patient_request_model.dart +++ b/lib/core/model/sick_leave/sick_leave_patient_request_model.dart @@ -1,17 +1,17 @@ class SickLeavePatientRequestModel { - double versionID; - int channel; - int languageID; - String iPAdress; - String generalid; - int patientOutSA; - int deviceTypeID; - int patientType; - int patientTypeID; - String tokenID; - int patientID; - int patientMRN; - String sessionID; + double? versionID; + int? channel; + int? languageID; + String? iPAdress; + String? generalid; + int? patientOutSA; + int? deviceTypeID; + int? patientType; + int? patientTypeID; + String? tokenID; + int? patientID; + int? patientMRN; + String? sessionID; SickLeavePatientRequestModel( {this.versionID, diff --git a/lib/core/model/sickleave/add_sickleave_request.dart b/lib/core/model/sickleave/add_sickleave_request.dart index d398153b..5e098da5 100644 --- a/lib/core/model/sickleave/add_sickleave_request.dart +++ b/lib/core/model/sickleave/add_sickleave_request.dart @@ -1,9 +1,9 @@ class AddSickLeaveRequest { - String patientMRN; - String appointmentNo; - String startDate; - String noOfDays; - String remarks; + String? patientMRN; + String? appointmentNo; + String? startDate; + String? noOfDays; + String? remarks; AddSickLeaveRequest( {this.patientMRN, diff --git a/lib/core/model/sickleave/extend_sick_leave_request.dart b/lib/core/model/sickleave/extend_sick_leave_request.dart index 8b61eb90..026fc8bd 100644 --- a/lib/core/model/sickleave/extend_sick_leave_request.dart +++ b/lib/core/model/sickleave/extend_sick_leave_request.dart @@ -1,8 +1,8 @@ class ExtendSickLeaveRequest { - String patientMRN; - String previousRequestNo; - String noOfDays; - String remarks; + String? patientMRN; + String? previousRequestNo; + String? noOfDays; + String? remarks; ExtendSickLeaveRequest( {this.patientMRN, this.previousRequestNo, this.noOfDays, this.remarks}); diff --git a/lib/core/model/sickleave/get_all_sickleave_response.dart b/lib/core/model/sickleave/get_all_sickleave_response.dart index cc8f489c..773bdebd 100644 --- a/lib/core/model/sickleave/get_all_sickleave_response.dart +++ b/lib/core/model/sickleave/get_all_sickleave_response.dart @@ -1,13 +1,13 @@ class GetAllSickLeaveResponse { - int appointmentNo; - bool isExtendedLeave; - int noOfDays; - int patientMRN; - String remarks; - int requestNo; - String startDate; - int status; - String statusDescription; + int? appointmentNo; + bool? isExtendedLeave; + int? noOfDays; + int? patientMRN; + String? remarks; + int? requestNo; + String? startDate; + int? status; + String? statusDescription; GetAllSickLeaveResponse( {this.appointmentNo, diff --git a/lib/core/model/sickleave/sick_leave_statisitics_model.dart b/lib/core/model/sickleave/sick_leave_statisitics_model.dart index aa715e3f..179664a6 100644 --- a/lib/core/model/sickleave/sick_leave_statisitics_model.dart +++ b/lib/core/model/sickleave/sick_leave_statisitics_model.dart @@ -1,7 +1,7 @@ class SickLeaveStatisticsModel { - String recommendedSickLeaveDays; - int totalLeavesByAllClinics; - int totalLeavesByDoctor; + String? recommendedSickLeaveDays; + int? totalLeavesByAllClinics; + int? totalLeavesByDoctor; SickLeaveStatisticsModel( {this.recommendedSickLeaveDays, diff --git a/lib/core/model/vte_assessment/vte_assessment_req_model.dart b/lib/core/model/vte_assessment/vte_assessment_req_model.dart index 1f0bd1fa..dda08133 100644 --- a/lib/core/model/vte_assessment/vte_assessment_req_model.dart +++ b/lib/core/model/vte_assessment/vte_assessment_req_model.dart @@ -1,7 +1,7 @@ class VteAssessmentRequestModel { - String setupID; - int parameterGroup; - int transactionNo; + String? setupID; + int? parameterGroup; + int? transactionNo; VteAssessmentRequestModel( {this.setupID = "010266", this.parameterGroup = 7, this.transactionNo}); diff --git a/lib/core/model/vte_assessment/vte_assessment_res_model.dart b/lib/core/model/vte_assessment/vte_assessment_res_model.dart index 8bd2c441..48c91646 100644 --- a/lib/core/model/vte_assessment/vte_assessment_res_model.dart +++ b/lib/core/model/vte_assessment/vte_assessment_res_model.dart @@ -1,13 +1,13 @@ class VteAssessmentResponseModel { - int lineItemNo; - String vTEType; - String ambulationProtocol; - String pharmacology; - String reasonsThrombo; - String riskScore; - int totalScore; - int createdBy; - String createdOn; + int? lineItemNo; + String? vTEType; + String? ambulationProtocol; + String? pharmacology; + String? reasonsThrombo; + String? riskScore; + int? totalScore; + int? createdBy; + String? createdOn; VteAssessmentResponseModel( {this.lineItemNo, diff --git a/lib/core/service/AnalyticsService.dart b/lib/core/service/AnalyticsService.dart index e194ed9a..ffb4d84a 100644 --- a/lib/core/service/AnalyticsService.dart +++ b/lib/core/service/AnalyticsService.dart @@ -3,13 +3,13 @@ import 'package:firebase_analytics/observer.dart'; import 'package:flutter/cupertino.dart'; class AnalyticsService { - final FirebaseAnalytics _analytics = FirebaseAnalytics(); + final FirebaseAnalytics _analytics = FirebaseAnalytics.instance; FirebaseAnalyticsObserver getAnalyticsObserver() => FirebaseAnalyticsObserver(analytics: _analytics); Future logEvent( - {@required String eventCategory, @required String eventAction}) async { + {required String eventCategory, required String eventAction}) async { await _analytics.logEvent(name: 'event', parameters: { "eventCategory": eventCategory, "eventAction": eventAction, diff --git a/lib/core/service/NavigationService.dart b/lib/core/service/NavigationService.dart index b94306b9..c4791ead 100644 --- a/lib/core/service/NavigationService.dart +++ b/lib/core/service/NavigationService.dart @@ -4,26 +4,26 @@ class NavigationService { final GlobalKey navigatorKey = new GlobalKey(); - Future navigateTo(String routeName, {Object arguments}) { - return navigatorKey.currentState.pushNamed(routeName, arguments: arguments); + Future navigateTo(String routeName, {Object? arguments}) { + return navigatorKey.currentState!.pushNamed(routeName, arguments: arguments); } - Future pushReplacementNamed(String routeName, {Object arguments}) { - return navigatorKey.currentState + Future pushReplacementNamed(String routeName, {Object? arguments}) { + return navigatorKey.currentState! .pushReplacementNamed(routeName, arguments: arguments); } Future pushNamedAndRemoveUntil(String routeName) { - return navigatorKey.currentState + return navigatorKey.currentState! .pushNamedAndRemoveUntil(routeName, (asd) => false); } Future pushAndRemoveUntil(Route newRoute) { - return navigatorKey.currentState + return navigatorKey.currentState! .pushAndRemoveUntil(newRoute, (asd) => false); } pop() { - return navigatorKey.currentState.pop(); + return navigatorKey.currentState!.pop(); } } diff --git a/lib/core/service/PatientRegistrationService.dart b/lib/core/service/PatientRegistrationService.dart index d9ad718f..35270675 100644 --- a/lib/core/service/PatientRegistrationService.dart +++ b/lib/core/service/PatientRegistrationService.dart @@ -9,14 +9,12 @@ import 'package:doctor_app_flutter/core/service/base/base_service.dart'; import 'package:doctor_app_flutter/core/viewModel/PatientRegistrationViewModel.dart'; class PatientRegistrationService extends BaseService { - GetPatientInfoResponseModel getPatientInfoResponseModel; - String logInTokenID; + GetPatientInfoResponseModel? getPatientInfoResponseModel; + String? logInTokenID; - checkPatientForRegistration( - CheckPatientForRegistrationModel registrationModel) async { + checkPatientForRegistration(CheckPatientForRegistrationModel registrationModel) async { hasError = false; - await baseAppClient.post(CHECK_PATIENT_FOR_REGISTRATION, - onSuccess: (dynamic response, int statusCode) { + await baseAppClient.post(CHECK_PATIENT_FOR_REGISTRATION, onSuccess: (dynamic response, int statusCode) { //TODO Elham* fix it logInTokenID = "OjEi/qgRekGICZm5/a4jbQ=="; //response["LogInTokenID"]; }, onFailure: (String error, int statusCode) { @@ -27,10 +25,8 @@ class PatientRegistrationService extends BaseService { getPatientInfo(GetPatientInfoRequestModel getPatientInfoRequestMode) async { hasError = false; - await baseAppClient.post(GET_PATIENT_INFO, - onSuccess: (dynamic response, int statusCode) { - getPatientInfoResponseModel = - GetPatientInfoResponseModel.fromJson(response); + await baseAppClient.post(GET_PATIENT_INFO, onSuccess: (dynamic response, int statusCode) { + getPatientInfoResponseModel = GetPatientInfoResponseModel.fromJson(response); print("ddd"); }, onFailure: (String error, int statusCode) { hasError = true; @@ -39,47 +35,36 @@ class PatientRegistrationService extends BaseService { } sendActivationCodeByOTPNotificationType( - {SendActivationCodeByOTPNotificationTypeForRegistrationModel - registrationModel, - int otpType, - PatientRegistrationViewModel model, - CheckPatientForRegistrationModel - checkPatientForRegistrationModel}) async { - registrationModel = - SendActivationCodeByOTPNotificationTypeForRegistrationModel( - oTPSendType: otpType, - patientIdentificationID: checkPatientForRegistrationModel - .patientIdentificationID, - patientMobileNumber: checkPatientForRegistrationModel - .patientMobileNumber, - zipCode: checkPatientForRegistrationModel.zipCode, - patientOutSA: 0, - healthId: model.getPatientInfoResponseModel.healthId, - dOB: checkPatientForRegistrationModel.dOB, - isRegister: checkPatientForRegistrationModel.isRegister, - isHijri: checkPatientForRegistrationModel.isHijri, - sessionID: null, - generalid: GENERAL_ID, - isDentalAllowedBackend: false, - projectOutSA: 0, - searchType: 1, - versionID: 7.1, - channel: 3, - nationalID: - model.checkPatientForRegistrationModel.patientIdentificationID, - patientID: 0, - mobileNo: model.checkPatientForRegistrationModel.patientMobileNumber - .toString(), - loginType: otpType, - logInTokenID: logInTokenID); + {SendActivationCodeByOTPNotificationTypeForRegistrationModel? registrationModel, + int? otpType, + PatientRegistrationViewModel? model, + CheckPatientForRegistrationModel? checkPatientForRegistrationModel}) async { + registrationModel = SendActivationCodeByOTPNotificationTypeForRegistrationModel( + oTPSendType: otpType, + patientIdentificationID: checkPatientForRegistrationModel!.patientIdentificationID, + patientMobileNumber: checkPatientForRegistrationModel.patientMobileNumber, + zipCode: checkPatientForRegistrationModel.zipCode, + patientOutSA: 0, + healthId: model!.getPatientInfoResponseModel.healthId, + dOB: checkPatientForRegistrationModel.dOB, + isRegister: checkPatientForRegistrationModel.isRegister, + isHijri: checkPatientForRegistrationModel.isHijri, + sessionID: null, + generalid: GENERAL_ID, + isDentalAllowedBackend: false, + projectOutSA: 0, + searchType: 1, + versionID: 7.1, + channel: 3, + nationalID: model.checkPatientForRegistrationModel!.patientIdentificationID, + patientID: 0, + mobileNo: model.checkPatientForRegistrationModel!.patientMobileNumber.toString(), + loginType: otpType, + logInTokenID: logInTokenID); hasError = false; - await baseAppClient - .post(SEND_ACTIVATION_CODE_BY_OTP_NOT_TYPE_FOR_REGISTRATION, - onSuccess: (dynamic response, int statusCode) { - registrationModel = - SendActivationCodeByOTPNotificationTypeForRegistrationModel.fromJson( - response); + await baseAppClient.post(SEND_ACTIVATION_CODE_BY_OTP_NOT_TYPE_FOR_REGISTRATION, onSuccess: (dynamic response, int statusCode) { + registrationModel = SendActivationCodeByOTPNotificationTypeForRegistrationModel.fromJson(response); }, onFailure: (String error, int statusCode) { hasError = true; super.error = error; @@ -88,8 +73,7 @@ class PatientRegistrationService extends BaseService { checkActivationCode(CheckActivationCodeModel registrationModel) async { hasError = false; - await baseAppClient.post(CHECK_ACTIVATION_CODE_FOR_PATIENT, - onSuccess: (dynamic response, int statusCode) { + await baseAppClient.post(CHECK_ACTIVATION_CODE_FOR_PATIENT, onSuccess: (dynamic response, int statusCode) { registrationModel = CheckActivationCodeModel.fromJson(response); }, onFailure: (String error, int statusCode) { hasError = true; @@ -99,9 +83,7 @@ class PatientRegistrationService extends BaseService { registrationPatient(PatientRegistrationModel registrationModel) async { hasError = false; - await baseAppClient.post(PATIENT_REGISTRATION, - onSuccess: (dynamic response, int statusCode) {}, - onFailure: (String error, int statusCode) { + await baseAppClient.post(PATIENT_REGISTRATION, onSuccess: (dynamic response, int statusCode) {}, onFailure: (String error, int statusCode) { hasError = true; super.error = error; }, body: registrationModel.toJson()); diff --git a/lib/core/service/VideoCallService.dart b/lib/core/service/VideoCallService.dart index ef42e1cc..98823ece 100644 --- a/lib/core/service/VideoCallService.dart +++ b/lib/core/service/VideoCallService.dart @@ -17,8 +17,8 @@ import '../../routes.dart'; import 'NavigationService.dart'; class VideoCallService extends BaseService { - StartCallRes startCallRes; - PatiantInformtion patient; + StartCallRes? startCallRes; + PatiantInformtion? patient; LiveCarePatientServices _liveCarePatientServices = locator(); @@ -34,21 +34,21 @@ class VideoCallService extends BaseService { await getDoctorProfile(isGetProfile: true); await VideoChannel.openVideoCallScreen( // TODO MOSA TEST - kToken: startCallRes.openTokenID, - kSessionId: startCallRes.openSessionID, + kToken: startCallRes!.openTokenID, + kSessionId: startCallRes!.openSessionID, kApiKey: '46209962', // kToken: "T1==cGFydG5lcl9pZD00NzI0Nzk1NCZzaWc9NGUyZjgxMjFlYTFkNzU5NjcxNDY2ZTM2ZjM3YTVhNTI2NGY0NTI2NzpzZXNzaW9uX2lkPTJfTVg0ME56STBOemsxTkg1LU1UWXlOVGN5TmpnMk5qZzNOMzQ1YUhCcGRtcDFXbVpDTDFkNE1qbDRkWFY2TTA4cmIySi1mZyZjcmVhdGVfdGltZT0xNjI1NzI2ODg5Jm5vbmNlPTAuNjc2Nzc4OTQxNjA1MTMxNSZyb2xlPXB1Ymxpc2hlciZleHBpcmVfdGltZT0xNjI4MzE4ODg4JmluaXRpYWxfbGF5b3V0X2NsYXNzX2xpc3Q9", // kSessionId: "2_MX40NzI0Nzk1NH5-MTYyNTcyNjg2Njg3N345aHBpdmp1WmZCL1d4Mjl4dXV6M08rb2J-fg", // kApiKey:'47247954', - vcId: patient.vcId, + vcId: patient!.vcId!, isRecording: isRecording, - patientName: patient.fullName ?? - (patient.firstName != null - ? "${patient.firstName} ${patient.lastName}" + patientName: patient!.fullName ?? + (patient!.firstName != null + ? "${patient!.firstName} ${patient!.lastName}" : "-"), tokenID: await sharedPref.getString(TOKEN), generalId: GENERAL_ID, - doctorId: doctorProfile.doctorID, + doctorId: doctorProfile.doctorID!, onFailure: (String error) { DrAppToastMsg.showErrorToast(error); }, @@ -57,13 +57,13 @@ class VideoCallService extends BaseService { onCallEnd: () { WidgetsBinding.instance.addPostFrameCallback((_) async { GifLoaderDialogUtils.showMyDialog( - locator().navigatorKey.currentContext); + locator().navigatorKey.currentContext!); endCall( - patient.vcId, + patient!.vcId!, false, ).then((value) { GifLoaderDialogUtils.hideDialog( - locator().navigatorKey.currentContext); + locator().navigatorKey.currentContext!); if (hasError) { DrAppToastMsg.showErrorToast(error); } else @@ -77,13 +77,13 @@ class VideoCallService extends BaseService { onCallNotRespond: (SessionStatusModel sessionStatusModel) { WidgetsBinding.instance.addPostFrameCallback((_) { GifLoaderDialogUtils.showMyDialog( - locator().navigatorKey.currentContext); + locator().navigatorKey.currentContext!); endCall( - patient.vcId, + patient!.vcId!, sessionStatusModel.sessionStatus == 3, ).then((value) { GifLoaderDialogUtils.hideDialog( - locator().navigatorKey.currentContext); + locator().navigatorKey.currentContext!); if (hasError) { DrAppToastMsg.showErrorToast(error); } else { @@ -101,7 +101,7 @@ class VideoCallService extends BaseService { hasError = false; await getDoctorProfile(isGetProfile: true); EndCallReq endCallReq = new EndCallReq(); - endCallReq.doctorId = doctorProfile.doctorID; + endCallReq.doctorId = doctorProfile!.doctorID; endCallReq.generalid = 'Cs2020@2016\$2958'; endCallReq.vCID = vCID; endCallReq.isDestroy = isPatient; diff --git a/lib/core/service/authentication_service.dart b/lib/core/service/authentication_service.dart index 6b5510a9..6e2ceb9a 100644 --- a/lib/core/service/authentication_service.dart +++ b/lib/core/service/authentication_service.dart @@ -1,3 +1,5 @@ +import 'dart:js_interop'; + import 'package:doctor_app_flutter/config/config.dart'; import 'package:doctor_app_flutter/core/model/auth/activation_Code_req_model.dart'; import 'package:doctor_app_flutter/core/model/auth/activation_code_for_verification_screen_model.dart'; @@ -59,7 +61,7 @@ class AuthenticationService extends BaseService { }, body: {"IMEI": imei, "TokenID": "@dm!n"}); } catch (error) { hasError = true; - super.error = error; + super.error = error.toString(); } } @@ -76,7 +78,7 @@ class AuthenticationService extends BaseService { }, body: userInfo.toJson()); } catch (error) { hasError = true; - super.error = error; + super.error = error.toString(); } } @@ -96,7 +98,7 @@ class AuthenticationService extends BaseService { }, body: activationCodeModel.toJson()); } catch (error) { hasError = true; - super.error = error; + super.error = error.toString(); } } @@ -116,7 +118,7 @@ class AuthenticationService extends BaseService { }, body: activationCodeModel.toJson()); } catch (error) { hasError = true; - super.error = error; + super.error = error.toString(); } } @@ -136,7 +138,7 @@ class AuthenticationService extends BaseService { }, body: checkActivationCodeRequestModel.toJson()); } catch (error) { hasError = true; - super.error = error; + super.error = error.toString(); } } @@ -153,7 +155,7 @@ class AuthenticationService extends BaseService { }, body: insertIMEIDetailsModel.toJson()); } catch (error) { hasError = true; - super.error = error; + super.error = error.toString(); } } @@ -172,7 +174,7 @@ class AuthenticationService extends BaseService { }, body: profileReqModel.toJson()); } catch (error) { hasError = true; - super.error = error; + super.error = error.toString(); } } } diff --git a/lib/core/service/base/base_service.dart b/lib/core/service/base/base_service.dart index c83f863d..1ad901ff 100644 --- a/lib/core/service/base/base_service.dart +++ b/lib/core/service/base/base_service.dart @@ -5,41 +5,40 @@ import 'package:doctor_app_flutter/core/model/patient/patiant_info_model.dart'; import 'package:doctor_app_flutter/utils/dr_app_shared_pref.dart'; class BaseService { - String error; + String? error; bool hasError = false; BaseAppClient baseAppClient = BaseAppClient(); - DrAppSharedPreferances sharedPref = new DrAppSharedPreferances(); - DoctorProfileModel doctorProfile; + DrAppSharedPreferances sharedPref = DrAppSharedPreferances(); + DoctorProfileModel? doctorProfile; List patientArrivalList = []; BaseService() { - doctorProfile = null; + doctorProfile = DoctorProfileModel(); } //TODO add the user login model when we need it - Future getDoctorProfile( - {bool isGetProfile = false}) async { + Future getDoctorProfile({bool isGetProfile = false}) async { if (isGetProfile) { - Map profile = await sharedPref.getObj(DOCTOR_PROFILE); + Map? profile = await sharedPref.getObj(DOCTOR_PROFILE); if (profile != null) { doctorProfile = DoctorProfileModel.fromJson(profile); if (doctorProfile != null) { - return doctorProfile; + return doctorProfile!; } } } if (doctorProfile == null) { - Map profile = await sharedPref.getObj(DOCTOR_PROFILE); + Map? profile = await sharedPref.getObj(DOCTOR_PROFILE); if (profile != null) { doctorProfile = DoctorProfileModel.fromJson(profile); if (doctorProfile != null) { - return doctorProfile; + return doctorProfile!; } } - return null; + return DoctorProfileModel(); } else { - return doctorProfile; + return doctorProfile!; } } } diff --git a/lib/core/service/home/dasboard_service.dart b/lib/core/service/home/dasboard_service.dart index 43d76c80..4d837753 100644 --- a/lib/core/service/home/dasboard_service.dart +++ b/lib/core/service/home/dasboard_service.dart @@ -8,7 +8,7 @@ class DashboardService extends BaseService { List get dashboardItemsList => _dashboardItemsList; bool hasVirtualClinic = false; - String sServiceID; + String? sServiceID; Future getDashboard() async { hasError = false; diff --git a/lib/core/service/home/scan_qr_service.dart b/lib/core/service/home/scan_qr_service.dart index c00abd97..1e241fc1 100644 --- a/lib/core/service/home/scan_qr_service.dart +++ b/lib/core/service/home/scan_qr_service.dart @@ -4,14 +4,14 @@ import 'package:doctor_app_flutter/core/service/base/base_service.dart'; import 'package:doctor_app_flutter/core/model/patient/patiant_info_model.dart'; class ScanQrService extends BaseService { - List myInPatientList = List(); - List inPatientList = List(); + List myInPatientList = []; + List inPatientList = []; Future getInPatient( PatientSearchRequestModel requestModel, bool isMyInpatient) async { hasError = false; await getDoctorProfile(); - requestModel.loginDoctorID = doctorProfile.doctorID; + requestModel.loginDoctorID = doctorProfile!.doctorID; requestModel.doctorID = 0; await baseAppClient.post( GET_PATIENT_IN_PATIENT_LIST, @@ -22,7 +22,7 @@ class ScanQrService extends BaseService { response['List_MyInPatient'].forEach((v) { PatiantInformtion patient = PatiantInformtion.fromJson(v); inPatientList.add(patient); - if (patient.doctorId == doctorProfile.doctorID) { + if (patient.doctorId == doctorProfile!.doctorID) { myInPatientList.add(patient); } }); diff --git a/lib/core/service/hospitals/hospitals_service.dart b/lib/core/service/hospitals/hospitals_service.dart index 96267d01..efa24209 100644 --- a/lib/core/service/hospitals/hospitals_service.dart +++ b/lib/core/service/hospitals/hospitals_service.dart @@ -4,7 +4,7 @@ import 'package:doctor_app_flutter/core/model/hospitals/get_hospitals_response_m import 'package:doctor_app_flutter/core/service/base/base_service.dart'; class HospitalsService extends BaseService { - List hospitals = List(); + List hospitals = []; Future getHospitals(GetHospitalsRequestModel getHospitalsRequestModel) async { hasError = false; diff --git a/lib/core/service/patient/DischargedPatientService.dart b/lib/core/service/patient/DischargedPatientService.dart index c270be8e..73abc2d8 100644 --- a/lib/core/service/patient/DischargedPatientService.dart +++ b/lib/core/service/patient/DischargedPatientService.dart @@ -4,15 +4,15 @@ import 'package:doctor_app_flutter/core/service/base/base_service.dart'; import 'package:doctor_app_flutter/core/model/patient/patiant_info_model.dart'; class DischargedPatientService extends BaseService { - List myDischargedPatients = List(); + List myDischargedPatients = []; - List myDischargeReferralPatients = List(); + List myDischargeReferralPatients = []; Future getDischargedPatient() async { hasError = false; Map body = Map(); await getDoctorProfile(isGetProfile: true); - body['DoctorID'] = doctorProfile.doctorID; + body['DoctorID'] = doctorProfile!.doctorID; body['FirstName'] = "0"; body['MiddleName'] = "0"; body['LastName'] = "0"; @@ -45,7 +45,7 @@ class DischargedPatientService extends BaseService { hasError = false; Map body = Map(); await getDoctorProfile(isGetProfile: true); - body['DoctorID'] = doctorProfile.doctorID; + body['DoctorID'] = doctorProfile!.doctorID; body['FirstName'] = "0"; body['MiddleName'] = "0"; body['LastName'] = "0"; diff --git a/lib/core/service/patient/LiveCarePatientServices.dart b/lib/core/service/patient/LiveCarePatientServices.dart index bdf8d1b5..c2ec316a 100644 --- a/lib/core/service/patient/LiveCarePatientServices.dart +++ b/lib/core/service/patient/LiveCarePatientServices.dart @@ -30,7 +30,7 @@ class LiveCarePatientServices extends BaseService { var transferToAdminResponse = {}; var isLoginResponse = {}; - StartCallRes _startCallRes; + StartCallRes _startCallRes = StartCallRes(); StartCallRes get startCallRes => _startCallRes; @@ -51,7 +51,7 @@ class LiveCarePatientServices extends BaseService { localPatientList.forEach((element) { if ((_patientList.singleWhere( (it) => it.patientId == element.patientId, - orElse: () => null)) == + orElse: () => PatiantInformtion())) == null) { _patientList.add(element); } @@ -62,7 +62,7 @@ class LiveCarePatientServices extends BaseService { _patientList.forEach((element) { if ((localPatientList.singleWhere( (it) => it.patientId == element.patientId, - orElse: () => null)) == + orElse: () => PatiantInformtion())) == null) { removedPatientList.add(element); } @@ -143,11 +143,11 @@ class LiveCarePatientServices extends BaseService { } Future isLogin( - {LiveCareUserLoginRequestModel isLoginRequestModel, - int loginStatus}) async { + {LiveCareUserLoginRequestModel? isLoginRequestModel, + int? loginStatus}) async { hasError = false; await getDoctorProfile(); - isLoginRequestModel.doctorId = super.doctorProfile.doctorID; + isLoginRequestModel!.doctorId = super.doctorProfile!.doctorID; await baseAppClient.post(LIVE_CARE_IS_LOGIN, onSuccess: (response, statusCode) async { isLoginResponse = response; @@ -172,13 +172,13 @@ class LiveCarePatientServices extends BaseService { }, body: {"VC_ID": vcID, "generalid": GENERAL_ID}, isLiveCare: _isLive); } - Future addPatientToDoctorList({int vcID}) async { + Future addPatientToDoctorList({int? vcID}) async { hasError = false; await getDoctorProfile(); AddPatientToDoctorListRequestModel addPatientToDoctorListRequestModel = AddPatientToDoctorListRequestModel(); - addPatientToDoctorListRequestModel.doctorId = super.doctorProfile.doctorID; + addPatientToDoctorListRequestModel.doctorId = super.doctorProfile!.doctorID; addPatientToDoctorListRequestModel.vCID = vcID; addPatientToDoctorListRequestModel.isOutKsa = false; addPatientToDoctorListRequestModel.generalid = GENERAL_ID; @@ -192,12 +192,12 @@ class LiveCarePatientServices extends BaseService { }, body: addPatientToDoctorListRequestModel.toJson(), isLiveCare: _isLive); } - Future removePatientFromDoctorList({int vcID}) async { + Future removePatientFromDoctorList({int? vcID}) async { hasError = false; AddPatientToDoctorListRequestModel addPatientToDoctorListRequestModel = AddPatientToDoctorListRequestModel(); await getDoctorProfile(); - addPatientToDoctorListRequestModel.doctorId = super.doctorProfile.doctorID; + addPatientToDoctorListRequestModel.doctorId = super.doctorProfile!.doctorID; addPatientToDoctorListRequestModel.vCID = vcID; addPatientToDoctorListRequestModel.isOutKsa = false; addPatientToDoctorListRequestModel.generalid = GENERAL_ID; diff --git a/lib/core/service/patient/MyReferralPatientService.dart b/lib/core/service/patient/MyReferralPatientService.dart index 18146986..9858405f 100644 --- a/lib/core/service/patient/MyReferralPatientService.dart +++ b/lib/core/service/patient/MyReferralPatientService.dart @@ -6,26 +6,25 @@ import 'package:doctor_app_flutter/core/service/base/base_service.dart'; import 'package:doctor_app_flutter/core/model/doctor/request_add_referred_doctor_remarks.dart'; class MyReferralInPatientService extends BaseService { - List myReferralPatients = List(); + List myReferralPatients = []; Future getMyReferralPatientService() async { hasError = false; await getDoctorProfile(); - MyReferralPatientRequestModel myReferralPatientRequestModel = - MyReferralPatientRequestModel( - doctorID: doctorProfile.doctorID, - firstName: "0", - middleName: "0", - lastName: "0", - patientMobileNumber: "0", - patientIdentificationID: "0", - patientID: 0, - from: "0", - to: "0", - stamp: DateTime.now().toIso8601String(), - isLoginForDoctorApp: true, - patientTypeID: 1); + MyReferralPatientRequestModel myReferralPatientRequestModel = MyReferralPatientRequestModel( + doctorID: doctorProfile!.doctorID, + firstName: "0", + middleName: "0", + lastName: "0", + patientMobileNumber: "0", + patientIdentificationID: "0", + patientID: 0, + from: "0", + to: "0", + stamp: DateTime.now().toIso8601String(), + isLoginForDoctorApp: true, + patientTypeID: 1); myReferralPatients.clear(); await baseAppClient.post( GET_MY_REFERRAL_INPATIENT, @@ -48,20 +47,19 @@ class MyReferralInPatientService extends BaseService { hasError = false; await getDoctorProfile(); - MyReferralPatientRequestModel myReferralPatientRequestModel = - MyReferralPatientRequestModel( - doctorID: doctorProfile.doctorID, - firstName: "0", - middleName: "0", - lastName: "0", - patientMobileNumber: "0", - patientIdentificationID: "0", - patientID: 0, - from: "0", - to: "0", - stamp: DateTime.now().toIso8601String(), - isLoginForDoctorApp: true, - patientTypeID: 1); + MyReferralPatientRequestModel myReferralPatientRequestModel = MyReferralPatientRequestModel( + doctorID: doctorProfile!.doctorID, + firstName: "0", + middleName: "0", + lastName: "0", + patientMobileNumber: "0", + patientIdentificationID: "0", + patientID: 0, + from: "0", + to: "0", + stamp: DateTime.now().toIso8601String(), + isLoginForDoctorApp: true, + patientTypeID: 1); myReferralPatients.clear(); await baseAppClient.post( GET_MY_REFERRAL_OUT_PATIENT, @@ -80,19 +78,15 @@ class MyReferralInPatientService extends BaseService { ); } - Future replay( - String referredDoctorRemarks, MyReferralPatientModel referral) async { + Future replay(String referredDoctorRemarks, MyReferralPatientModel referral) async { hasError = false; await getDoctorProfile(); - RequestAddReferredDoctorRemarks _requestAddReferredDoctorRemarks = - RequestAddReferredDoctorRemarks(); + RequestAddReferredDoctorRemarks _requestAddReferredDoctorRemarks = RequestAddReferredDoctorRemarks(); _requestAddReferredDoctorRemarks.projectID = referral.projectID; - _requestAddReferredDoctorRemarks.admissionNo = - referral.admissionNo.toString(); + _requestAddReferredDoctorRemarks.admissionNo = referral.admissionNo.toString(); _requestAddReferredDoctorRemarks.lineItemNo = referral.lineItemNo; - _requestAddReferredDoctorRemarks.referredDoctorRemarks = - referredDoctorRemarks; - _requestAddReferredDoctorRemarks.editedBy = doctorProfile.doctorID; + _requestAddReferredDoctorRemarks.referredDoctorRemarks = referredDoctorRemarks; + _requestAddReferredDoctorRemarks.editedBy = doctorProfile!.doctorID; _requestAddReferredDoctorRemarks.patientID = referral.patientID; _requestAddReferredDoctorRemarks.referringDoctor = referral.referringDoctor; await baseAppClient.post( @@ -106,25 +100,18 @@ class MyReferralInPatientService extends BaseService { ); } - Future replayReferred(String referredDoctorRemarks, - MyReferralPatientModel referral, int referralStatus) async { + Future replayReferred(String referredDoctorRemarks, MyReferralPatientModel referral, int referralStatus) async { hasError = false; await getDoctorProfile(); AddReferredRemarksRequestModel _requestAddReferredDoctorRemarks = - AddReferredRemarksRequestModel( - editedBy: doctorProfile.doctorID, - projectID: doctorProfile.projectID, - referredDoctorRemarks: referredDoctorRemarks, - referalStatus: referralStatus); + AddReferredRemarksRequestModel(editedBy: doctorProfile!.doctorID, projectID: doctorProfile!.projectID, referredDoctorRemarks: referredDoctorRemarks, referalStatus: referralStatus); _requestAddReferredDoctorRemarks.projectID = referral.projectID; //TODO Check this in case out patient - _requestAddReferredDoctorRemarks.admissionNo = - int.parse(referral.admissionNo); + _requestAddReferredDoctorRemarks.admissionNo = int.parse(referral.admissionNo!); _requestAddReferredDoctorRemarks.lineItemNo = referral.lineItemNo; - _requestAddReferredDoctorRemarks.referredDoctorRemarks = - referredDoctorRemarks; - _requestAddReferredDoctorRemarks.editedBy = doctorProfile.doctorID; + _requestAddReferredDoctorRemarks.referredDoctorRemarks = referredDoctorRemarks; + _requestAddReferredDoctorRemarks.editedBy = doctorProfile!.doctorID; _requestAddReferredDoctorRemarks.referalStatus = referralStatus; // _requestAddReferredDoctorRemarks.patientID = referral.patientID; diff --git a/lib/core/service/patient/PatientMuseService.dart b/lib/core/service/patient/PatientMuseService.dart index c34de9e0..893b6260 100644 --- a/lib/core/service/patient/PatientMuseService.dart +++ b/lib/core/service/patient/PatientMuseService.dart @@ -3,16 +3,15 @@ import 'package:doctor_app_flutter/core/model/patient_muse/PatientMuseResultsMod import 'package:doctor_app_flutter/core/service/base/base_service.dart'; class PatientMuseService extends BaseService { - List patientMuseResultsModelList = List(); + List patientMuseResultsModelList = []; - getECGPatient({int patientType, int patientOutSA, int patientID}) async { + getECGPatient({int? patientType, int? patientOutSA, int? patientID}) async { Map body = Map(); body['PatientType'] = patientType == 7 ? 1 : patientType; body['PatientOutSA'] = patientOutSA; body['PatientID'] = patientID; hasError = false; - await baseAppClient.post(GET_ECG, - onSuccess: (dynamic response, int statusCode) { + await baseAppClient.post(GET_ECG, onSuccess: (dynamic response, int statusCode) { patientMuseResultsModelList.clear(); response['HIS_GetPatientMuseResultsList'].forEach((v) { patientMuseResultsModelList.add(PatientMuseResultsModel.fromJson(v)); diff --git a/lib/core/service/patient/ReferralService.dart b/lib/core/service/patient/ReferralService.dart index 69e2a810..25469dc2 100644 --- a/lib/core/service/patient/ReferralService.dart +++ b/lib/core/service/patient/ReferralService.dart @@ -4,16 +4,16 @@ import 'package:doctor_app_flutter/core/service/base/base_service.dart'; class ReferralService extends BaseService { Future referralPatient( - {int admissionNo, - String roomID, - int referralClinic, - int referralDoctor, - int patientID, - int patientTypeID, - int priority, - int frequency, - String referringDoctorRemarks, - String extension}) async { + {int? admissionNo, + String? roomID, + int? referralClinic, + int? referralDoctor, + int? patientID, + int? patientTypeID, + int? priority, + int? frequency, + String? referringDoctorRemarks, + String? extension}) async { await getDoctorProfile(); ReferralRequest referralRequest = ReferralRequest(); referralRequest.admissionNo = admissionNo; @@ -25,11 +25,11 @@ class ReferralService extends BaseService { referralRequest.priority = priority.toString(); referralRequest.frequency = frequency.toString(); referralRequest.referringDoctorRemarks = referringDoctorRemarks; - referralRequest.referringClinic = doctorProfile.clinicID; - referralRequest.referringDoctor = doctorProfile.doctorID; + referralRequest.referringClinic = doctorProfile!.clinicID; + referralRequest.referringDoctor = doctorProfile!.doctorID; referralRequest.extension = extension; - referralRequest.editedBy = doctorProfile.doctorID; - referralRequest.createdBy = doctorProfile.doctorID; + referralRequest.editedBy = doctorProfile!.doctorID; + referralRequest.createdBy = doctorProfile!.doctorID; referralRequest.patientOutSA = false; await baseAppClient.post( diff --git a/lib/core/service/patient/patient-doctor-referral-service.dart b/lib/core/service/patient/patient-doctor-referral-service.dart index b61e18b9..62ffe818 100644 --- a/lib/core/service/patient/patient-doctor-referral-service.dart +++ b/lib/core/service/patient/patient-doctor-referral-service.dart @@ -15,7 +15,7 @@ import '../base/lookup-service.dart'; class PatientReferralService extends LookupService { List projectsList = []; List clinicsList = []; - List doctorsList = List(); + List doctorsList = []; List listMyReferredPatientModel = []; List pendingReferralList = []; List patientReferralList = []; diff --git a/lib/core/service/patient/patientInPatientService.dart b/lib/core/service/patient/patientInPatientService.dart index 9aabbdee..52883551 100644 --- a/lib/core/service/patient/patientInPatientService.dart +++ b/lib/core/service/patient/patientInPatientService.dart @@ -4,16 +4,16 @@ import 'package:doctor_app_flutter/core/service/base/base_service.dart'; import 'package:doctor_app_flutter/core/model/patient/patiant_info_model.dart'; class PatientInPatientService extends BaseService { - List inPatientList = List(); - List myInPatientList = List(); + List inPatientList = []; + List myInPatientList = []; Future getInPatientList( PatientSearchRequestModel requestModel, bool isMyInpatient) async { hasError = false; await getDoctorProfile(isGetProfile: true); - requestModel.loginDoctorID = doctorProfile.doctorID; + requestModel.loginDoctorID = doctorProfile!.doctorID; if (isMyInpatient) { - requestModel.doctorID = doctorProfile.doctorID; + requestModel.doctorID = doctorProfile!.doctorID; } else { requestModel.doctorID = 0; } @@ -27,7 +27,7 @@ class PatientInPatientService extends BaseService { response['List_MyInPatient'].forEach((v) { PatiantInformtion patient = PatiantInformtion.fromJson(v); inPatientList.add(patient); - if (patient.doctorId == doctorProfile.doctorID) { + if (patient.doctorId == doctorProfile!.doctorID) { myInPatientList.add(patient); } }); diff --git a/lib/core/service/patient/patient_service.dart b/lib/core/service/patient/patient_service.dart index a8eab765..1c458251 100644 --- a/lib/core/service/patient/patient_service.dart +++ b/lib/core/service/patient/patient_service.dart @@ -32,8 +32,8 @@ import 'package:doctor_app_flutter/core/service/base/base_service.dart'; class PatientService extends BaseService { List _patientVitalSignList = []; List patientVitalSignOrderdSubList = []; - List inPatientList = List(); - List myInPatientList = List(); + List inPatientList = []; + List myInPatientList = []; List get patientVitalSignList => _patientVitalSignList; @@ -112,7 +112,7 @@ class PatientService extends BaseService { STPReferralFrequencyRequest(); ClinicByProjectIdRequest _clinicByProjectIdRequest = ClinicByProjectIdRequest(); - ReferToDoctorRequest _referToDoctorRequest; + ReferToDoctorRequest? _referToDoctorRequest; Future getPatientList(patient, patientType, {isView}) async { hasError = false; @@ -170,9 +170,9 @@ class PatientService extends BaseService { hasError = false; await getDoctorProfile(); - requestModel.loginDoctorID = doctorProfile.doctorID; + requestModel.loginDoctorID = doctorProfile!.doctorID; if (isMyInpatient) { - requestModel.doctorID = doctorProfile.doctorID; + requestModel.doctorID = doctorProfile!.doctorID; } else { requestModel.doctorID = 0; } @@ -186,7 +186,7 @@ class PatientService extends BaseService { response['List_MyInPatient'].forEach((v) { PatiantInformtion patient = PatiantInformtion.fromJson(v); inPatientList.add(patient); - if (patient.doctorId == doctorProfile.doctorID) { + if (patient.doctorId == doctorProfile!.doctorID) { myInPatientList.add(patient); } }); @@ -436,23 +436,23 @@ class PatientService extends BaseService { // TODO send the total model insted of each parameter Future referToDoctor( - {String selectedDoctorID, - String selectedClinicID, - int admissionNo, - String extension, - String priority, - String frequency, - String referringDoctorRemarks, - int patientID, - int patientTypeID, - String roomID, - int projectID}) async { + {String? selectedDoctorID, + String? selectedClinicID, + int? admissionNo, + String? extension, + String? priority, + String? frequency, + String? referringDoctorRemarks, + int? patientID, + int? patientTypeID, + String? roomID, + int? projectID}) async { hasError = false; // TODO Change it to use it when we implement authentication user - Map profile = await sharedPref.getObj(DOCTOR_PROFILE); - DoctorProfileModel doctorProfile = new DoctorProfileModel.fromJson(profile); - int doctorID = doctorProfile.doctorID; - int clinicId = doctorProfile.clinicID; + Map? profile = await sharedPref.getObj(DOCTOR_PROFILE); + DoctorProfileModel doctorProfile = new DoctorProfileModel.fromJson(profile!); + int doctorID = doctorProfile.doctorID!; + int clinicId = doctorProfile.clinicID!; _referToDoctorRequest = ReferToDoctorRequest( projectID: projectID, admissionNo: admissionNo, @@ -477,7 +477,7 @@ class PatientService extends BaseService { hasError = true; super.error = error; }, - body: _referToDoctorRequest.toJson(), + body: _referToDoctorRequest!.toJson(), ); } diff --git a/lib/core/service/patient/profile/discharge_summary_servive.dart b/lib/core/service/patient/profile/discharge_summary_servive.dart index 2b3476a3..65700cc9 100644 --- a/lib/core/service/patient/profile/discharge_summary_servive.dart +++ b/lib/core/service/patient/profile/discharge_summary_servive.dart @@ -6,37 +6,30 @@ import 'package:doctor_app_flutter/core/model/discharge_summary/GetDischargeSumm class DischargeSummaryService extends BaseService { List _pendingDischargeSummaryList = []; - List get pendingDischargeSummaryList => - _pendingDischargeSummaryList; + List get pendingDischargeSummaryList => _pendingDischargeSummaryList; List _allDischargeSummaryList = []; - List get allDischargeSummaryList => - _allDischargeSummaryList; + List get allDischargeSummaryList => _allDischargeSummaryList; - Future getPendingDischargeSummary( - {GetDischargeSummaryReqModel getDischargeSummaryReqModel}) async { + Future getPendingDischargeSummary({GetDischargeSummaryReqModel? getDischargeSummaryReqModel}) async { hasError = false; - await baseAppClient.post(GET_PENDING_DISCHARGE_SUMMARY, - onSuccess: (dynamic response, int statusCode) { + await baseAppClient.post(GET_PENDING_DISCHARGE_SUMMARY, onSuccess: (dynamic response, int statusCode) { _pendingDischargeSummaryList.clear(); response['List_PendingDischargeSummary'].forEach( (v) { - _pendingDischargeSummaryList - .add(GetDischargeSummaryResModel.fromJson(v)); + _pendingDischargeSummaryList.add(GetDischargeSummaryResModel.fromJson(v)); }, ); }, onFailure: (String error, int statusCode) { hasError = true; super.error = error; - }, body: getDischargeSummaryReqModel.toJson()); + }, body: getDischargeSummaryReqModel!.toJson()); } - Future getAllDischargeSummary( - {GetDischargeSummaryReqModel getDischargeSummaryReqModel}) async { + Future getAllDischargeSummary({GetDischargeSummaryReqModel? getDischargeSummaryReqModel}) async { hasError = false; - await baseAppClient.post(GET_ALL_DISCHARGE_SUMMARY, - onSuccess: (dynamic response, int statusCode) { + await baseAppClient.post(GET_ALL_DISCHARGE_SUMMARY, onSuccess: (dynamic response, int statusCode) { _allDischargeSummaryList.clear(); response['List_DischargeSummary'].forEach( (v) { @@ -46,6 +39,6 @@ class DischargeSummaryService extends BaseService { }, onFailure: (String error, int statusCode) { hasError = true; super.error = error; - }, body: getDischargeSummaryReqModel.toJson()); + }, body: getDischargeSummaryReqModel!.toJson()); } } diff --git a/lib/core/service/patient/profile/intervention_medication_service.dart b/lib/core/service/patient/profile/intervention_medication_service.dart index a48a560e..ab33ad0d 100644 --- a/lib/core/service/patient/profile/intervention_medication_service.dart +++ b/lib/core/service/patient/profile/intervention_medication_service.dart @@ -18,7 +18,7 @@ class InterventionMedicationService extends BaseService { _allInterventionHistoryList; Future getInterventionMedication( - {InterventionMedicationReqModel interventionMedicationReqModel}) async { + {InterventionMedicationReqModel? interventionMedicationReqModel}) async { hasError = false; await baseAppClient.post(GET_INTERVENTION_MEDICATION, onSuccess: (dynamic response, int statusCode) { @@ -31,11 +31,11 @@ class InterventionMedicationService extends BaseService { }, onFailure: (String error, int statusCode) { hasError = true; super.error = error; - }, body: interventionMedicationReqModel.toJson()); + }, body: interventionMedicationReqModel!.toJson()); } Future getInterventionMedicationHistory( - {InterventionMedicationHistoryReqModel interventionMedicationHistoryReqModel}) async { + {InterventionMedicationHistoryReqModel? interventionMedicationHistoryReqModel}) async { hasError = false; await baseAppClient.post(GET_INTERVENTION_MEDICATION_HISTORY, onSuccess: (dynamic response, int statusCode) { @@ -48,11 +48,11 @@ class InterventionMedicationService extends BaseService { }, onFailure: (String error, int statusCode) { hasError = true; super.error = error; - }, body: interventionMedicationHistoryReqModel.toJson()); + }, body: interventionMedicationHistoryReqModel!.toJson()); } Future setAcceptedOrRejected( - {AcceptOrRejectReqModel acceptOrRejectReqModel}) async { + {AcceptOrRejectReqModel? acceptOrRejectReqModel}) async { hasError = false; await baseAppClient.post(SET_ACCEPTED_OR_REJECTED, onSuccess: (dynamic response, int statusCode) { @@ -61,6 +61,6 @@ class InterventionMedicationService extends BaseService { }, onFailure: (String error, int statusCode) { hasError = true; super.error = error; - }, body: acceptOrRejectReqModel.toJson()); + }, body: acceptOrRejectReqModel!.toJson()); } } diff --git a/lib/core/service/patient/profile/operation_report_servive.dart b/lib/core/service/patient/profile/operation_report_servive.dart index e4de18d9..e3ea294e 100644 --- a/lib/core/service/patient/profile/operation_report_servive.dart +++ b/lib/core/service/patient/profile/operation_report_servive.dart @@ -17,8 +17,8 @@ class OperationReportService extends BaseService { _operationDetailsList; Future getReservations( - {GetReservationsRequestModel getReservationsRequestModel, - int patientId}) async { + {GetReservationsRequestModel? getReservationsRequestModel, + int? patientId}) async { getReservationsRequestModel = GetReservationsRequestModel(patientID: patientId); @@ -39,7 +39,7 @@ class OperationReportService extends BaseService { } Future getOperationReportDetails({ - GetOperationDetailsRequestModel getOperationReportRequestModel, + GetOperationDetailsRequestModel? getOperationReportRequestModel, }) async { hasError = false; await baseAppClient.post(GET_OPERATION_DETAILS, @@ -55,7 +55,7 @@ class OperationReportService extends BaseService { }, onFailure: (String error, int statusCode) { hasError = true; super.error = error; - }, body: getOperationReportRequestModel.toJson()); + }, body: getOperationReportRequestModel!.toJson()); } Future updateOperationReport( diff --git a/lib/core/service/patient/profile/vte_assessment_service.dart b/lib/core/service/patient/profile/vte_assessment_service.dart index 651f2b50..0e6e4cd8 100644 --- a/lib/core/service/patient/profile/vte_assessment_service.dart +++ b/lib/core/service/patient/profile/vte_assessment_service.dart @@ -12,7 +12,7 @@ class VteAssessmentService extends BaseService { List get allVteHistoryList => _allVteHistoryList; Future getVteAssessment( - {VteAssessmentRequestModel vteAssessmentRequestModel}) async { + {VteAssessmentRequestModel? vteAssessmentRequestModel}) async { hasError = false; await baseAppClient.post(VTE_ASSESSMENT, onSuccess: (dynamic response, int statusCode) { @@ -25,6 +25,6 @@ class VteAssessmentService extends BaseService { }, onFailure: (String error, int statusCode) { hasError = true; super.error = error; - }, body: vteAssessmentRequestModel.toJson()); + }, body: vteAssessmentRequestModel!.toJson()); } } diff --git a/lib/core/service/patient_medical_file/ER_signin/ER_signin_service.dart b/lib/core/service/patient_medical_file/ER_signin/ER_signin_service.dart index 9e1de604..b16a932f 100644 --- a/lib/core/service/patient_medical_file/ER_signin/ER_signin_service.dart +++ b/lib/core/service/patient_medical_file/ER_signin/ER_signin_service.dart @@ -1,38 +1,12 @@ import 'package:doctor_app_flutter/config/config.dart'; import 'package:doctor_app_flutter/core/model/ER_sign_in/doctor_ER_sign_assessment_req_model.dart'; -import 'package:doctor_app_flutter/core/model/Prescriptions/Prescriptions.dart'; -import 'package:doctor_app_flutter/core/model/Prescriptions/get_medication_for_inpatient_model.dart'; -import 'package:doctor_app_flutter/core/model/Prescriptions/get_medication_for_inpatient_request_model.dart'; -import 'package:doctor_app_flutter/core/model/Prescriptions/perscription_pharmacy.dart'; -import 'package:doctor_app_flutter/core/model/Prescriptions/post_prescrition_req_model.dart'; -import 'package:doctor_app_flutter/core/model/Prescriptions/prescription_entity_model.dart'; -import 'package:doctor_app_flutter/core/model/Prescriptions/prescription_in_patient.dart'; -import 'package:doctor_app_flutter/core/model/Prescriptions/prescription_model.dart'; -import 'package:doctor_app_flutter/core/model/Prescriptions/prescription_report.dart'; -import 'package:doctor_app_flutter/core/model/Prescriptions/prescription_report_enh.dart'; -import 'package:doctor_app_flutter/core/model/Prescriptions/prescription_req_model.dart'; -import 'package:doctor_app_flutter/core/model/Prescriptions/prescriptions_order.dart'; -import 'package:doctor_app_flutter/core/model/Prescriptions/request_get_list_pharmacy_for_prescriptions.dart'; -import 'package:doctor_app_flutter/core/model/Prescriptions/request_prescription_report.dart'; -import 'package:doctor_app_flutter/core/model/Prescriptions/request_prescription_report_enh.dart'; -import 'package:doctor_app_flutter/core/model/SOAP/Allergy/get_allergies_res_model.dart'; -import 'package:doctor_app_flutter/core/model/SOAP/Assessment/get_assessment_res_model.dart'; -import 'package:doctor_app_flutter/core/model/calculate_box_request_model.dart'; -import 'package:doctor_app_flutter/core/model/search_drug/get_medication_response_model.dart'; -import 'package:doctor_app_flutter/core/model/search_drug/item_by_medicine_request_model.dart'; -import 'package:doctor_app_flutter/core/model/search_drug/search_drug_model.dart'; -import 'package:doctor_app_flutter/core/model/search_drug/search_drug_request_model.dart'; import 'package:doctor_app_flutter/core/service/base/lookup-service.dart'; -import 'package:doctor_app_flutter/core/model/SOAP/Assessment/get_assessment_req_model.dart'; -import 'package:doctor_app_flutter/core/model/patient/patiant_info_model.dart'; -import 'package:doctor_app_flutter/core/model/patient/vital_sign/patient-vital-sign-data.dart'; -import 'package:doctor_app_flutter/utils/date-utils.dart'; -import 'package:flutter/cupertino.dart'; + class ERSignInService extends LookupService { - Future signInERPatient({DoctorErSignAssessmentReqModel doctorErSignAssessmentReqModel}) async { + Future signInERPatient({DoctorErSignAssessmentReqModel? doctorErSignAssessmentReqModel}) async { hasError = false; @@ -43,7 +17,7 @@ class ERSignInService extends LookupService { }, onFailure: (String error, int statusCode) { hasError = true; super.error = error; - }, body: doctorErSignAssessmentReqModel.toJson()); + }, body: doctorErSignAssessmentReqModel!.toJson()); } } diff --git a/lib/core/service/patient_medical_file/insurance/InsuranceCardService.dart b/lib/core/service/patient_medical_file/insurance/InsuranceCardService.dart index 029f3b8c..16a036ce 100644 --- a/lib/core/service/patient_medical_file/insurance/InsuranceCardService.dart +++ b/lib/core/service/patient_medical_file/insurance/InsuranceCardService.dart @@ -16,16 +16,16 @@ class InsuranceCardService extends BaseService { _insuranceApprovalInPatientRequestModel = InsuranceApprovalInPatientRequestModel(); - List _insuranceApproval = List(); + List _insuranceApproval = []; List get insuranceApproval => _insuranceApproval; - List _insuranceApprovalInPatient = List(); + List _insuranceApprovalInPatient =[]; List get insuranceApprovalInPatient => _insuranceApprovalInPatient; - Future getInsuranceApprovalInPatient({int mrn}) async { + Future getInsuranceApprovalInPatient({int? mrn}) async { _insuranceApprovalInPatientRequestModel = InsuranceApprovalInPatientRequestModel( patientID: mrn, @@ -48,7 +48,7 @@ class InsuranceCardService extends BaseService { } Future getInsuranceApproval(PatiantInformtion patient, - {int appointmentNo, int projectId}) async { + {int? appointmentNo, int? projectId}) async { hasError = false; // _cardList.clear(); // if (appointmentNo != null) { diff --git a/lib/core/service/patient_medical_file/lab_order/labs_service.dart b/lib/core/service/patient_medical_file/lab_order/labs_service.dart index e4cb93bf..9fae9580 100644 --- a/lib/core/service/patient_medical_file/lab_order/labs_service.dart +++ b/lib/core/service/patient_medical_file/lab_order/labs_service.dart @@ -13,8 +13,8 @@ import 'package:doctor_app_flutter/core/model/patient/patiant_info_model.dart'; import '../../base/base_service.dart'; class LabsService extends BaseService { - List patientLabOrdersList = List(); - List _allSpecialLab = List(); + List patientLabOrdersList = []; + List _allSpecialLab = []; List get allSpecialLab => _allSpecialLab; @@ -28,7 +28,7 @@ class LabsService extends BaseService { String url = ""; if (isInpatient) { await getDoctorProfile(); - body['ProjectID'] = doctorProfile.projectID; + body['ProjectID'] = doctorProfile!.projectID; url = GET_PATIENT_LAB_OREDERS; } else { body['isDentalAllowedBackend'] = false; @@ -58,18 +58,18 @@ class LabsService extends BaseService { RequestPatientLabSpecialResult _requestPatientLabSpecialResult = RequestPatientLabSpecialResult(); - List patientLabSpecialResult = List(); - List labResultList = List(); - List labOrdersResultsList = List(); - List labOrdersResultHistoryList = List(); + List patientLabSpecialResult =[]; + List labResultList = []; + List labOrdersResultsList = []; + List labOrdersResultHistoryList = []; Future getLaboratoryResult( - {String projectID, - int clinicID, - String invoiceNo, - String orderNo, - PatiantInformtion patient, - bool isInpatient = false}) async { + {String? projectID, + int? clinicID, + String? invoiceNo, + String? orderNo, + PatiantInformtion? patient, + bool? isInpatient = false}) async { hasError = false; Map body = Map(); @@ -80,7 +80,7 @@ class LabsService extends BaseService { body = _requestPatientLabSpecialResult.toJson(); await baseAppClient.postPatient(GET_Patient_LAB_SPECIAL_RESULT, - patient: patient, onSuccess: (dynamic response, int statusCode) { + patient: patient!, onSuccess: (dynamic response, int statusCode) { patientLabSpecialResult.clear(); response['ListPLSR'].forEach((hospital) { @@ -93,9 +93,9 @@ class LabsService extends BaseService { } Future getPatientLabResult( - {PatientLabOrders patientLabOrder, - PatiantInformtion patient, - bool isInpatient}) async { + {PatientLabOrders? patientLabOrder, + PatiantInformtion? patient, + bool isInpatient = false}) async { hasError = false; String url = ""; @@ -106,14 +106,14 @@ class LabsService extends BaseService { } Map body = Map(); - body['InvoiceNo'] = patientLabOrder.invoiceNo; + body['InvoiceNo'] = patientLabOrder!.invoiceNo; body['OrderNo'] = patientLabOrder.orderNo; body['isDentalAllowedBackend'] = false; body['SetupID'] = patientLabOrder.setupID; body['ProjectID'] = patientLabOrder.projectID; body['ClinicID'] = patientLabOrder.clinicID ?? 0; - await baseAppClient.postPatient(url, patient: patient, + await baseAppClient.postPatient(url, patient: patient!, onSuccess: (dynamic response, int statusCode) { patientLabSpecialResult = []; labResultList = []; @@ -138,9 +138,9 @@ class LabsService extends BaseService { } Future getPatientLabOrdersResults( - {PatientLabOrders patientLabOrder, - String procedure, - PatiantInformtion patient}) async { + {PatientLabOrders? patientLabOrder, + String? procedure, + PatiantInformtion? patient}) async { hasError = false; Map body = Map(); if (patientLabOrder != null) { @@ -153,7 +153,7 @@ class LabsService extends BaseService { body['isDentalAllowedBackend'] = false; body['Procedure'] = procedure; await baseAppClient.postPatient(GET_Patient_LAB_ORDERS_RESULT, - patient: patient, onSuccess: (dynamic response, int statusCode) { + patient: patient!, onSuccess: (dynamic response, int statusCode) { labOrdersResultsList.clear(); response['ListPLR'].forEach((lab) { labOrdersResultsList.add(LabOrderResult.fromJson(lab)); @@ -167,7 +167,7 @@ class LabsService extends BaseService { RequestSendLabReportEmail _requestSendLabReportEmail = RequestSendLabReportEmail(); - Future sendLabReportEmail({PatientLabOrders patientLabOrder}) async { + Future sendLabReportEmail({PatientLabOrders? patientLabOrder}) async { // _requestSendLabReportEmail.projectID = patientLabOrder.projectID; // _requestSendLabReportEmail.invoiceNo = patientLabOrder.invoiceNo; // _requestSendLabReportEmail.doctorName = patientLabOrder.doctorName; @@ -192,9 +192,9 @@ class LabsService extends BaseService { } Future getPatientLabOrdersResultHistoryByDescription( - {PatientLabOrders patientLabOrder, - String procedureDescription, - PatiantInformtion patient}) async { + {PatientLabOrders? patientLabOrder, + String? procedureDescription, + PatiantInformtion? patient}) async { hasError = false; Map body = Map(); if (patientLabOrder != null) { @@ -206,7 +206,7 @@ class LabsService extends BaseService { body['ProcedureDescription'] = procedureDescription; await baseAppClient.postPatient( GET_PATIENT_LAB_ORDERS_RESULT_HISTORY_BY_DESCRIPTION, - patient: patient, onSuccess: (dynamic response, int statusCode) { + patient: patient!, onSuccess: (dynamic response, int statusCode) { labOrdersResultHistoryList.clear(); response['ListGeneralResultHistory'].forEach((lab) { labOrdersResultHistoryList.add(LabResultHistory.fromJson(lab)); @@ -217,7 +217,7 @@ class LabsService extends BaseService { }, body: body); } - Future getAllSpecialLabResult({int mrn}) async { + Future getAllSpecialLabResult({int? mrn}) async { _allSpecialLabResultRequestModel = AllSpecialLabResultRequestModel( patientID: mrn, patientType: 1, diff --git a/lib/core/service/patient_medical_file/medical_report/PatientMedicalReportService.dart b/lib/core/service/patient_medical_file/medical_report/PatientMedicalReportService.dart index b3bdd149..8bd55596 100644 --- a/lib/core/service/patient_medical_file/medical_report/PatientMedicalReportService.dart +++ b/lib/core/service/patient_medical_file/medical_report/PatientMedicalReportService.dart @@ -13,11 +13,10 @@ class PatientMedicalReportService extends BaseService { Map body = Map(); await getDoctorProfile(); body['AdmissionNo'] = patient.admissionNo; - body['SetupID'] = doctorProfile.setupID; - body['ProjectID'] = doctorProfile.projectID; + body['SetupID'] = doctorProfile!.setupID; + body['ProjectID'] = doctorProfile!.projectID; medicalReportList = []; - await baseAppClient.postPatient(PATIENT_MEDICAL_REPORT_GET_LIST, - onSuccess: (dynamic response, int statusCode) { + await baseAppClient.postPatient(PATIENT_MEDICAL_REPORT_GET_LIST, onSuccess: (dynamic response, int statusCode) { if (response['DAPP_ListMedicalReportList'] != null) { response['DAPP_ListMedicalReportList'].forEach((v) { medicalReportList.add(MedicalReportModel.fromJson(v)); @@ -36,8 +35,7 @@ class PatientMedicalReportService extends BaseService { body['SetupID'] = "91877"; body['TemplateID'] = 43; - await baseAppClient.post(PATIENT_MEDICAL_REPORT_GET_TEMPLATE, - onSuccess: (dynamic response, int statusCode) { + await baseAppClient.post(PATIENT_MEDICAL_REPORT_GET_TEMPLATE, onSuccess: (dynamic response, int statusCode) { medicalReportTemplate.clear(); if (response['DAPP_GetTemplateByIDList'] != null) { response['DAPP_GetTemplateByIDList'].forEach((v) { @@ -57,16 +55,13 @@ class PatientMedicalReportService extends BaseService { body['AdmissionNo'] = patient.admissionNo; body['MedicalReportHTML'] = htmlText; - await baseAppClient.postPatient(PATIENT_MEDICAL_REPORT_INSERT, - onSuccess: (dynamic response, int statusCode) {}, - onFailure: (String error, int statusCode) { + await baseAppClient.postPatient(PATIENT_MEDICAL_REPORT_INSERT, onSuccess: (dynamic response, int statusCode) {}, onFailure: (String error, int statusCode) { hasError = true; super.error = error.toString(); }, body: body, patient: patient); } - Future verifyMedicalReport( - PatiantInformtion patient, MedicalReportModel medicalReport) async { + Future verifyMedicalReport(PatiantInformtion patient, MedicalReportModel medicalReport) async { hasError = false; Map body = Map(); body['SetupID'] = "91877"; @@ -78,9 +73,7 @@ class PatientMedicalReportService extends BaseService { } if (body['DoctorID'] == null) body['DoctorID'] = doctorProfile?.doctorID; - await baseAppClient.postPatient(PATIENT_MEDICAL_REPORT_VERIFIED, - onSuccess: (dynamic response, int statusCode) {}, - onFailure: (String error, int statusCode) { + await baseAppClient.postPatient(PATIENT_MEDICAL_REPORT_VERIFIED, onSuccess: (dynamic response, int statusCode) {}, onFailure: (String error, int statusCode) { hasError = true; super.error = error.toString(); }, body: body, patient: patient); @@ -94,23 +87,20 @@ class PatientMedicalReportService extends BaseService { ? body['SetupID'] : SETUP_ID : SETUP_ID; - body['AdmissionNo'] = int.parse(patient.admissionNo); + body['AdmissionNo'] = int.parse(patient.admissionNo!); body['MedicalReportHTML'] = htmlText; if (body['ProjectID'] == null) { body['ProjectID'] = doctorProfile?.projectID; } if (body['DoctorID'] == null) body['DoctorID'] = doctorProfile?.doctorID; - await baseAppClient.postPatient(INSERT_MEDICAL_REPORT, - onSuccess: (dynamic response, int statusCode) {}, - onFailure: (String error, int statusCode) { + await baseAppClient.postPatient(INSERT_MEDICAL_REPORT, onSuccess: (dynamic response, int statusCode) {}, onFailure: (String error, int statusCode) { hasError = true; super.error = error.toString(); }, body: body, patient: patient); } - Future updateMedicalReport(PatiantInformtion patient, String htmlText, - int limitNumber, String invoiceNumber) async { + Future updateMedicalReport(PatiantInformtion patient, String htmlText, int limitNumber, String invoiceNumber) async { hasError = false; Map body = Map(); @@ -129,9 +119,7 @@ class PatientMedicalReportService extends BaseService { } if (body['DoctorID'] == null) body['DoctorID'] = doctorProfile?.doctorID; - await baseAppClient.postPatient(UPDATE_MEDICAL_REPORT, - onSuccess: (dynamic response, int statusCode) {}, - onFailure: (String error, int statusCode) { + await baseAppClient.postPatient(UPDATE_MEDICAL_REPORT, onSuccess: (dynamic response, int statusCode) {}, onFailure: (String error, int statusCode) { hasError = true; super.error = error.toString(); }, body: body, patient: patient); diff --git a/lib/core/service/patient_medical_file/medical_report/medical_file_service.dart b/lib/core/service/patient_medical_file/medical_report/medical_file_service.dart index 19eda72e..f174313c 100644 --- a/lib/core/service/patient_medical_file/medical_report/medical_file_service.dart +++ b/lib/core/service/patient_medical_file/medical_report/medical_file_service.dart @@ -4,14 +4,14 @@ import 'package:doctor_app_flutter/core/model/medical_report/medical_file_reques import 'package:doctor_app_flutter/core/service/base/base_service.dart'; class MedicalFileService extends BaseService { - List _medicalFileList = List(); + List _medicalFileList = []; List get medicalFileList => _medicalFileList; MedicalFileRequestModel _fileRequestModel = MedicalFileRequestModel( ); - Future getMedicalFile({int mrn}) async { + Future getMedicalFile({int? mrn}) async { _fileRequestModel = MedicalFileRequestModel(patientMRN: mrn); _fileRequestModel.iPAdress = "9.9.9.9"; hasError = false; diff --git a/lib/core/service/patient_medical_file/prescription/prescription_service.dart b/lib/core/service/patient_medical_file/prescription/prescription_service.dart index bda8907d..b7bbc811 100644 --- a/lib/core/service/patient_medical_file/prescription/prescription_service.dart +++ b/lib/core/service/patient_medical_file/prescription/prescription_service.dart @@ -29,15 +29,15 @@ import 'package:doctor_app_flutter/utils/date-utils.dart'; import 'package:flutter/cupertino.dart'; class PrescriptionService extends LookupService { - List _prescriptionList = List(); + List _prescriptionList = []; List get prescriptionList => _prescriptionList; - List _prescriptionListNew = List(); + List _prescriptionListNew = []; List get prescriptionListNew => _prescriptionListNew; - List _drugsList = List(); + List _drugsList = []; List get drugsList => _drugsList; List doctorsList = []; @@ -52,26 +52,21 @@ class PrescriptionService extends LookupService { dynamic boxQuantity; PrescriptionReqModel _prescriptionReqModel = PrescriptionReqModel(); - ItemByMedicineRequestModel _itemByMedicineRequestModel = - ItemByMedicineRequestModel(); + ItemByMedicineRequestModel _itemByMedicineRequestModel = ItemByMedicineRequestModel(); SearchDrugRequestModel _drugRequestModel = SearchDrugRequestModel( search: ["Amoxicillin"], ); - CalculateBoxQuantityRequestModel _boxQuantityRequestModel = - CalculateBoxQuantityRequestModel(); + CalculateBoxQuantityRequestModel _boxQuantityRequestModel = CalculateBoxQuantityRequestModel(); - PostPrescriptionReqModel _postPrescriptionReqModel = - PostPrescriptionReqModel(); + PostPrescriptionReqModel _postPrescriptionReqModel = PostPrescriptionReqModel(); - Future getItem({int itemID}) async { - _itemByMedicineRequestModel = - ItemByMedicineRequestModel(medicineCode: itemID); + Future getItem({required int itemID}) async { + _itemByMedicineRequestModel = ItemByMedicineRequestModel(medicineCode: itemID); hasError = false; - await baseAppClient.post(GET_ITEM_BY_MEDICINE, - onSuccess: (dynamic response, int statusCode) { + await baseAppClient.post(GET_ITEM_BY_MEDICINE, onSuccess: (dynamic response, int statusCode) { itemMedicineList = []; itemMedicineList = response['listItemByMedicineCode']['frequencies']; itemMedicineListRoute = response['listItemByMedicineCode']['routes']; @@ -82,11 +77,9 @@ class PrescriptionService extends LookupService { }, body: _itemByMedicineRequestModel.toJson()); } - Future getPatientAssessment( - GetAssessmentReqModel getAssessmentReqModel) async { + Future getPatientAssessment(GetAssessmentReqModel getAssessmentReqModel) async { hasError = false; - await baseAppClient.post(GET_ASSESSMENT, - onSuccess: (dynamic response, int statusCode) { + await baseAppClient.post(GET_ASSESSMENT, onSuccess: (dynamic response, int statusCode) { print("Success"); patientAssessmentList.clear(); response['AssessmentList']['entityList'].forEach((v) { @@ -98,19 +91,14 @@ class PrescriptionService extends LookupService { }, body: getAssessmentReqModel.toJson()); } - Future getPrescriptionListNew({int mrn, int appNo }) async { - _prescriptionReqModel = PrescriptionReqModel( - patientMRN: mrn, - appNo:appNo - ); + Future getPrescriptionListNew({required int mrn, required int appNo}) async { + _prescriptionReqModel = PrescriptionReqModel(patientMRN: mrn, appNo: appNo); hasError = false; _prescriptionList.clear(); _prescriptionListNew.clear(); - await baseAppClient.post(GET_PRESCRIPTION_LIST, - onSuccess: (dynamic response, int statusCode) { - _prescriptionList - .add(PrescriptionModel.fromJson(response['PrescriptionList'])); - if(response['PrescriptionList']!=null){ + await baseAppClient.post(GET_PRESCRIPTION_LIST, onSuccess: (dynamic response, int statusCode) { + _prescriptionList.add(PrescriptionModel.fromJson(response['PrescriptionList'])); + if (response['PrescriptionList'] != null) { response['PrescriptionList']["entityList"].forEach((prescriptions) { _prescriptionListNew.add(PrescriptionEntityModel.fromJson(prescriptions)); }); @@ -121,13 +109,12 @@ class PrescriptionService extends LookupService { }, body: _prescriptionReqModel.toJson()); } - Future getDrugs({String drugName}) async { + Future getDrugs({required String drugName}) async { _drugRequestModel = SearchDrugRequestModel(search: [drugName]); hasError = false; - await baseAppClient.post(SEARCH_DRUG, - onSuccess: (dynamic response, int statusCode) { + await baseAppClient.post(SEARCH_DRUG, onSuccess: (dynamic response, int statusCode) { doctorsList = []; doctorsList = response['MedicationList']['entityList']; }, onFailure: (String error, int statusCode) { @@ -139,8 +126,7 @@ class PrescriptionService extends LookupService { Future getMedicationList({String drug = ''}) async { hasError = false; _drugRequestModel.search = ["$drug"]; - await baseAppClient.post(SEARCH_DRUG, - onSuccess: (dynamic response, int statusCode) { + await baseAppClient.post(SEARCH_DRUG, onSuccess: (dynamic response, int statusCode) { allMedicationList = []; response['MedicationList']['entityList'].forEach((v) { allMedicationList.add(GetMedicationResponseModel.fromJson(v)); @@ -151,8 +137,7 @@ class PrescriptionService extends LookupService { }, body: _drugRequestModel.toJson()); } - Future postPrescription( - PostPrescriptionReqModel postProcedureReqModel) async { + Future postPrescription(PostPrescriptionReqModel postProcedureReqModel) async { hasError = false; //_prescriptionList.clear(); await baseAppClient.post( @@ -168,8 +153,7 @@ class PrescriptionService extends LookupService { ); } - Future updatePrescription( - PostPrescriptionReqModel updatePrescriptionReqModel) async { + Future updatePrescription(PostPrescriptionReqModel updatePrescriptionReqModel) async { hasError = false; //_prescriptionList.clear(); await baseAppClient.post( @@ -185,19 +169,10 @@ class PrescriptionService extends LookupService { ); } - Future getDrugToDrug( - VitalSignData vital, - List lstAssessments, - List allergy, - PatiantInformtion patient, - List prescription) async { + Future getDrugToDrug(VitalSignData vital, List lstAssessments, List allergy, PatiantInformtion patient, List prescription) async { Map request = { "Prescription": { - "objPatientInfo": { - "Gender": patient.gender == 1 ? 'Male' : 'Female', - "Age": AppDateUtils.convertDateFromServerFormat( - patient.dateofBirth, 'dd/MM/yyyy') - }, + "objPatientInfo": {"Gender": patient.gender == 1 ? 'Male' : 'Female', "Age": AppDateUtils.convertDateFromServerFormat(patient.dateofBirth!, 'dd/MM/yyyy')}, "objVitalSign": {"Height": vital?.heightCm, "Weight": vital?.weightKg}, "objPrescriptionItems": prescription, "objAllergies": getAllergiesObj(allergy), @@ -208,29 +183,21 @@ class PrescriptionService extends LookupService { }; hasError = false; - await baseAppClient.post(DRUG_TO_DRUG, - onSuccess: (dynamic response, int statusCode) { + await baseAppClient.post(DRUG_TO_DRUG, onSuccess: (dynamic response, int statusCode) { drugToDrug = []; - drugToDrug = - response['DrugToDrugResponse']['objPrescriptionCheckerResult']; + drugToDrug = response['DrugToDrugResponse']['objPrescriptionCheckerResult']; }, onFailure: (String error, int statusCode) { hasError = true; super.error = error; }, body: request); } - Future calculateBoxQuantity( - {int freq, int duration, int itemCode, double strength}) async { - _boxQuantityRequestModel = CalculateBoxQuantityRequestModel( - frequency: freq, - duration: duration, - itemCode: itemCode, - strength: strength); + Future calculateBoxQuantity({required int freq, required int duration, required int itemCode, required double strength}) async { + _boxQuantityRequestModel = CalculateBoxQuantityRequestModel(frequency: freq, duration: duration, itemCode: itemCode, strength: strength); hasError = false; - await baseAppClient.post(GET_BOX_QUANTITY, - onSuccess: (dynamic response, int statusCode) { + await baseAppClient.post(GET_BOX_QUANTITY, onSuccess: (dynamic response, int statusCode) { boxQuantity = response['BoxQuantity']; }, onFailure: (String error, int statusCode) { hasError = true; @@ -242,10 +209,7 @@ class PrescriptionService extends LookupService { var allergiesObj = []; allergies.forEach((element) { allergiesObj.add({ - "objProperties": { - 'Id': element.allergyDiseaseId, - 'Name': element.allergyDiseaseName - } + "objProperties": {'Id': element.allergyDiseaseId, 'Name': element.allergyDiseaseName} }); }); return allergiesObj; @@ -261,40 +225,32 @@ class PrescriptionService extends LookupService { return lstAssessmentsObj; } + List prescriptionsList = []; + List medicationForInPatient = []; + List prescriptionsOrderList = []; + List prescriptionInPatientList = []; - - List prescriptionsList = List(); - List medicationForInPatient = List(); - List prescriptionsOrderList = List(); - List prescriptionInPatientList = List(); - - GetMedicationForInPatientRequestModel _getMedicationForInPatientRequestModel = - GetMedicationForInPatientRequestModel(); + GetMedicationForInPatientRequestModel _getMedicationForInPatientRequestModel = GetMedicationForInPatientRequestModel(); Future getPrescriptions(PatiantInformtion patient) async { hasError = false; Map body = Map(); body['isDentalAllowedBackend'] = false; - await baseAppClient.postPatient(GET_PRESCRIPTION, patient: patient, - onSuccess: (dynamic response, int statusCode) { - prescriptionsList.clear(); - response['PatientPrescriptionList'].forEach((prescriptions) { - prescriptionsList.add(Prescriptions.fromJson(prescriptions)); - }); - }, onFailure: (String error, int statusCode) { - hasError = true; - super.error = error; - }, body: body); + await baseAppClient.postPatient(GET_PRESCRIPTION, patient: patient, onSuccess: (dynamic response, int statusCode) { + prescriptionsList.clear(); + response['PatientPrescriptionList'].forEach((prescriptions) { + prescriptionsList.add(Prescriptions.fromJson(prescriptions)); + }); + }, onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + }, body: body); } - RequestPrescriptionReport _requestPrescriptionReport = - RequestPrescriptionReport( - appointmentNo: 0, isDentalAllowedBackend: false); - List prescriptionReportList = List(); + RequestPrescriptionReport _requestPrescriptionReport = RequestPrescriptionReport(appointmentNo: 0, isDentalAllowedBackend: false); + List prescriptionReportList = []; - Future getPrescriptionReport( - {Prescriptions prescriptions, - @required PatiantInformtion patient}) async { + Future getPrescriptionReport({required Prescriptions prescriptions, required PatiantInformtion patient}) async { hasError = false; _requestPrescriptionReport.dischargeNo = prescriptions.dischargeNo; _requestPrescriptionReport.projectID = prescriptions.projectID; @@ -303,24 +259,17 @@ class PrescriptionService extends LookupService { _requestPrescriptionReport.episodeID = prescriptions.episodeID; _requestPrescriptionReport.appointmentNo = prescriptions.appointmentNo; - await baseAppClient.postPatient( - prescriptions.isInOutPatient - ? GET_PRESCRIPTION_REPORT_ENH - : GET_PRESCRIPTION_REPORT_NEW, - patient: patient, onSuccess: (dynamic response, int statusCode) { + await baseAppClient.postPatient(prescriptions.isInOutPatient! ? GET_PRESCRIPTION_REPORT_ENH : GET_PRESCRIPTION_REPORT_NEW, patient: patient, onSuccess: (dynamic response, int statusCode) { prescriptionReportList.clear(); prescriptionReportEnhList.clear(); - if (prescriptions.isInOutPatient) { + if (prescriptions.isInOutPatient!) { response['ListPRM'].forEach((prescriptions) { - prescriptionReportList - .add(PrescriptionReport.fromJson(prescriptions)); - prescriptionReportEnhList - .add(PrescriptionReportEnh.fromJson(prescriptions)); + prescriptionReportList.add(PrescriptionReport.fromJson(prescriptions)); + prescriptionReportEnhList.add(PrescriptionReportEnh.fromJson(prescriptions)); }); } else { response['INP_GetPrescriptionReport_List'].forEach((prescriptions) { - prescriptionReportList - .add(PrescriptionReport.fromJson(prescriptions)); + prescriptionReportList.add(PrescriptionReport.fromJson(prescriptions)); }); } }, onFailure: (String error, int statusCode) { @@ -329,30 +278,24 @@ class PrescriptionService extends LookupService { }, body: _requestPrescriptionReport.toJson()); } - RequestGetListPharmacyForPrescriptions - requestGetListPharmacyForPrescriptions = - RequestGetListPharmacyForPrescriptions( + RequestGetListPharmacyForPrescriptions requestGetListPharmacyForPrescriptions = RequestGetListPharmacyForPrescriptions( latitude: 0, longitude: 0, isDentalAllowedBackend: false, ); - List pharmacyPrescriptionsList = List(); - + List pharmacyPrescriptionsList = []; - RequestPrescriptionReportEnh _requestPrescriptionReportEnh = - RequestPrescriptionReportEnh( + RequestPrescriptionReportEnh _requestPrescriptionReportEnh = RequestPrescriptionReportEnh( isDentalAllowedBackend: false, ); - List prescriptionReportEnhList = List(); + List prescriptionReportEnhList = []; - Future getPrescriptionReportEnh( - {PrescriptionsOrder prescriptionsOrder, - @required PatiantInformtion patient}) async { + Future getPrescriptionReportEnh({PrescriptionsOrder? prescriptionsOrder, required PatiantInformtion patient}) async { ///This logic copy from the old app from class [order-history.component.ts] in line 45 bool isInPatient = false; prescriptionsList.forEach((element) { - if (prescriptionsOrder.appointmentNo == "0") { + if (prescriptionsOrder!.appointmentNo == "0") { if (element.dischargeNo == int.parse(prescriptionsOrder.dischargeID)) { _requestPrescriptionReportEnh.appointmentNo = element.appointmentNo; _requestPrescriptionReportEnh.clinicID = element.clinicID; @@ -360,18 +303,17 @@ class PrescriptionService extends LookupService { _requestPrescriptionReportEnh.episodeID = element.episodeID; _requestPrescriptionReportEnh.setupID = element.setupID; _requestPrescriptionReportEnh.dischargeNo = element.dischargeNo; - isInPatient = element.isInOutPatient; + isInPatient = element.isInOutPatient!; } } else { - if (int.parse(prescriptionsOrder.appointmentNo) == - element.appointmentNo) { + if (int.parse(prescriptionsOrder.appointmentNo) == element.appointmentNo) { _requestPrescriptionReportEnh.appointmentNo = element.appointmentNo; _requestPrescriptionReportEnh.clinicID = element.clinicID; _requestPrescriptionReportEnh.projectID = element.projectID; _requestPrescriptionReportEnh.episodeID = element.episodeID; _requestPrescriptionReportEnh.setupID = element.setupID; _requestPrescriptionReportEnh.dischargeNo = element.dischargeNo; - isInPatient = element.isInOutPatient; + isInPatient = element.isInOutPatient!; ///call inpGetPrescriptionReport } @@ -380,20 +322,16 @@ class PrescriptionService extends LookupService { hasError = false; - await baseAppClient.postPatient( - isInPatient ? GET_PRESCRIPTION_REPORT_ENH : GET_PRESCRIPTION_REPORT_NEW, - patient: patient, onSuccess: (dynamic response, int statusCode) { + await baseAppClient.postPatient(isInPatient ? GET_PRESCRIPTION_REPORT_ENH : GET_PRESCRIPTION_REPORT_NEW, patient: patient, onSuccess: (dynamic response, int statusCode) { prescriptionReportEnhList.clear(); if (isInPatient) { response['ListPRM'].forEach((prescriptions) { - prescriptionReportEnhList - .add(PrescriptionReportEnh.fromJson(prescriptions)); + prescriptionReportEnhList.add(PrescriptionReportEnh.fromJson(prescriptions)); }); } else { response['INP_GetPrescriptionReport_List'].forEach((prescriptions) { - PrescriptionReportEnh reportEnh = - PrescriptionReportEnh.fromJson(prescriptions); + PrescriptionReportEnh reportEnh = PrescriptionReportEnh.fromJson(prescriptions); reportEnh.itemDescription = prescriptions['ItemDescriptionN']; prescriptionReportEnhList.add(reportEnh); }); @@ -407,38 +345,32 @@ class PrescriptionService extends LookupService { Future getPrescriptionsOrders() async { Map body = Map(); body['isDentalAllowedBackend'] = false; - await baseAppClient.post(GET_PRESCRIPTIONS_ALL_ORDERS, - onSuccess: (dynamic response, int statusCode) { - prescriptionsOrderList.clear(); - response['PatientER_GetPatientAllPresOrdersList'] - .forEach((prescriptionsOrder) { - prescriptionsOrderList - .add(PrescriptionsOrder.fromJson(prescriptionsOrder)); - }); - }, onFailure: (String error, int statusCode) { - hasError = true; - super.error = error; - }, body: body); + await baseAppClient.post(GET_PRESCRIPTIONS_ALL_ORDERS, onSuccess: (dynamic response, int statusCode) { + prescriptionsOrderList.clear(); + response['PatientER_GetPatientAllPresOrdersList'].forEach((prescriptionsOrder) { + prescriptionsOrderList.add(PrescriptionsOrder.fromJson(prescriptionsOrder)); + }); + }, onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + }, body: body); } Future getMedicationForInPatient(PatiantInformtion patient) async { hasError = false; - _getMedicationForInPatientRequestModel = - GetMedicationForInPatientRequestModel( - isDentalAllowedBackend: false, - admissionNo: int.parse(patient.admissionNo), - projectID: patient.projectId, - ); - await baseAppClient.postPatient(GET_MEDICATION_FOR_IN_PATIENT, - patient: patient, onSuccess: (dynamic response, int statusCode) { - medicationForInPatient.clear(); - response['List_GetMedicationForInpatient'].forEach((prescriptions) { - medicationForInPatient - .add(GetMedicationForInPatientModel.fromJson(prescriptions)); - }); - }, onFailure: (String error, int statusCode) { - hasError = true; - super.error = error; - }, body: _getMedicationForInPatientRequestModel.toJson()); + _getMedicationForInPatientRequestModel = GetMedicationForInPatientRequestModel( + isDentalAllowedBackend: false, + admissionNo: int.parse(patient.admissionNo!), + projectID: patient.projectId, + ); + await baseAppClient.postPatient(GET_MEDICATION_FOR_IN_PATIENT, patient: patient, onSuccess: (dynamic response, int statusCode) { + medicationForInPatient.clear(); + response['List_GetMedicationForInpatient'].forEach((prescriptions) { + medicationForInPatient.add(GetMedicationForInPatientModel.fromJson(prescriptions)); + }); + }, onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + }, body: _getMedicationForInPatientRequestModel.toJson()); } } diff --git a/lib/core/service/patient_medical_file/procedure/procedure_service.dart b/lib/core/service/patient_medical_file/procedure/procedure_service.dart index 2c923694..db0b9be2 100644 --- a/lib/core/service/patient_medical_file/procedure/procedure_service.dart +++ b/lib/core/service/patient_medical_file/procedure/procedure_service.dart @@ -13,23 +13,23 @@ import 'package:doctor_app_flutter/core/model/procedure/update_procedure_request import 'package:doctor_app_flutter/core/service/base/base_service.dart'; class ProcedureService extends BaseService { - List _procedureList = List(); + List _procedureList =[]; List get procedureList => _procedureList; - List _valadteProcedureList = List(); + List _valadteProcedureList =[]; List get valadteProcedureList => _valadteProcedureList; - List _categoriesList = List(); + List _categoriesList =[]; List get categoriesList => _categoriesList; - List procedureslist = List(); + List procedureslist =[]; List categoryList = []; - // List _templateList = List(); + // List _templateList =[]; // List get templateList => _templateList; - List templateList = List(); + List templateList =[]; - List _templateDetailsList = List(); + List _templateDetailsList =[]; List get templateDetailsList => _templateDetailsList; @@ -53,7 +53,7 @@ class ProcedureService extends BaseService { ); Future getProcedureTemplate( - {int doctorId, int projectId, int clinicId, String categoryID, bool isLocalBusy}) async { + {int? doctorId, int? projectId, int? clinicId, String? categoryID, bool? isLocalBusy}) async { _procedureTempleteRequestModel = ProcedureTempleteRequestModel( // tokenID: "@dm!n", patientID: 0, @@ -86,7 +86,7 @@ class ProcedureService extends BaseService { } Future getProcedureTemplateDetails( - {int doctorId, int projectId, int clinicId, int templateId}) async { + {int? doctorId, int? projectId, int? clinicId, int? templateId}) async { _procedureTempleteDetailsRequestModel = ProcedureTempleteDetailsRequestModel( templateID: templateId, searchType: 1, patientID: 0); @@ -107,7 +107,7 @@ class ProcedureService extends BaseService { }, body: _procedureTempleteDetailsRequestModel.toJson()); } - Future getProcedure({int mrn, int appointmentNo}) async { + Future getProcedure({int? mrn, int? appointmentNo}) async { _getOrderedProcedureRequestModel = GetOrderedProcedureRequestModel( patientMRN: mrn, ); @@ -137,7 +137,7 @@ class ProcedureService extends BaseService { } Future getProcedureCategory( - {String categoryName, String categoryID, patientId}) async { + {String? categoryName, String? categoryID, patientId}) async { _getProcedureCategoriseReqModel = GetProcedureReqModel( search: ["$categoryName"], patientMRN: patientId, diff --git a/lib/core/service/patient_medical_file/radiology/radiology_service.dart b/lib/core/service/patient_medical_file/radiology/radiology_service.dart index 965fa03b..a554b7d2 100644 --- a/lib/core/service/patient_medical_file/radiology/radiology_service.dart +++ b/lib/core/service/patient_medical_file/radiology/radiology_service.dart @@ -6,14 +6,14 @@ import 'package:flutter/cupertino.dart'; import '../../base/base_service.dart'; class RadiologyService extends BaseService { - List finalRadiologyList = List(); + List finalRadiologyList =[]; String url = ''; Future getRadImageURL( - {int invoiceNo, - int lineItem, - int projectId, - @required PatiantInformtion patient}) async { + {required int invoiceNo, + required int lineItem, + required int projectId, + required PatiantInformtion patient}) async { hasError = false; final Map body = new Map(); body['InvoiceNo'] = invoiceNo; diff --git a/lib/core/service/patient_medical_file/sick_leave/sickleave_service.dart b/lib/core/service/patient_medical_file/sick_leave/sickleave_service.dart index 333ffeea..e7068c9e 100644 --- a/lib/core/service/patient_medical_file/sick_leave/sickleave_service.dart +++ b/lib/core/service/patient_medical_file/sick_leave/sickleave_service.dart @@ -20,7 +20,7 @@ class SickLeaveService extends BaseService { List reasonse = []; List get getAllSickLeave => _getAllsickLeave; - List _getAllsickLeave = List(); + List _getAllsickLeave =[]; List get coveringDoctorsList => _coveringDoctors; List _coveringDoctors = []; @@ -32,8 +32,8 @@ class SickLeaveService extends BaseService { dynamic get postReschedule => _postReschedule; dynamic _postReschedule; - List getAllSickLeavePatient = List(); - List getAllSickLeaveDoctor = List(); + List getAllSickLeavePatient =[]; + List getAllSickLeaveDoctor =[]; SickLeavePatientRequestModel _sickLeavePatientRequestModel = SickLeavePatientRequestModel(); @@ -171,7 +171,7 @@ class SickLeaveService extends BaseService { _getReScheduleLeave.sort((a, b) { var adate = a.dateTimeFrom; //before -> var adate = a.date; var bdate = b.dateTimeFrom; //var bdate = b.date; - return -adate.compareTo(bdate); + return -adate!.compareTo(bdate!); }); }, onFailure: (String error, int statusCode) { diff --git a/lib/core/service/patient_medical_file/soap/SOAP_service.dart b/lib/core/service/patient_medical_file/soap/SOAP_service.dart index 852029c3..cc47775c 100644 --- a/lib/core/service/patient_medical_file/soap/SOAP_service.dart +++ b/lib/core/service/patient_medical_file/soap/SOAP_service.dart @@ -32,7 +32,7 @@ class SOAPService extends LookupService { List patientProgressNoteList = []; List patientAssessmentList = []; - int episodeID; + int? episodeID; Future postEpisode(PostEpisodeReqModel postEpisodeReqModel) async { hasError = false; @@ -69,7 +69,7 @@ class SOAPService extends LookupService { print("Success"); }, onFailure: (String error, int statusCode) { hasError = true; - super.error = super.error + "\n" + error; + super.error = super.error! + "\n" + error; }, body: postAllergyRequestModel.toJson()); } @@ -81,7 +81,7 @@ class SOAPService extends LookupService { print("Success"); }, onFailure: (String error, int statusCode) { hasError = true; - super.error = super.error + "\n" + error; + super.error = super.error! + "\n" + error; }, body: postHistoriesRequestModel.toJson()); } @@ -154,7 +154,7 @@ class SOAPService extends LookupService { print("Success"); }, onFailure: (String error, int statusCode) { hasError = true; - super.error = super.error + "\n" + error; + super.error = super.error! + "\n" + error; }, body: patchHistoriesRequestModel.toJson()); } diff --git a/lib/core/service/patient_medical_file/ucaf/patient-ucaf-service.dart b/lib/core/service/patient_medical_file/ucaf/patient-ucaf-service.dart index 47a64fcd..fa874977 100644 --- a/lib/core/service/patient_medical_file/ucaf/patient-ucaf-service.dart +++ b/lib/core/service/patient_medical_file/ucaf/patient-ucaf-service.dart @@ -8,11 +8,11 @@ import 'package:doctor_app_flutter/core/model/patient/patiant_info_model.dart'; import 'package:doctor_app_flutter/core/model/patient/vital_sign/patient-vital-sign-history.dart'; class UcafService extends LookupService { - List patientChiefComplaintList; - List patientVitalSignsHistory; - List patientAssessmentList = []; - List orderProcedureList = []; - PrescriptionModel prescriptionList; + List? patientChiefComplaintList; + List? patientVitalSignsHistory; + late List patientAssessmentList; + List? orderProcedureList; + PrescriptionModel? prescriptionList; Future getPatientChiefComplaint(PatiantInformtion patient) async { hasError = false; @@ -22,17 +22,16 @@ class UcafService extends LookupService { body['EpisodeID'] = patient.episodeNo; body['DoctorID'] = ""; - patientChiefComplaintList = null; - await baseAppClient.post(GET_CHIEF_COMPLAINT, - onSuccess: (dynamic response, int statusCode) { + patientChiefComplaintList = []; + await baseAppClient.post(GET_CHIEF_COMPLAINT, onSuccess: (dynamic response, int statusCode) { print("Success"); if (patientChiefComplaintList != null) { - patientChiefComplaintList.clear(); + patientChiefComplaintList!.clear(); } else { - patientChiefComplaintList = new List(); + patientChiefComplaintList =[]; } response['List_ChiefComplaint']['entityList'].forEach((v) { - patientChiefComplaintList.add(GetChiefComplaintResModel.fromJson(v)); + patientChiefComplaintList!.add(GetChiefComplaintResModel.fromJson(v)); }); }, onFailure: (String error, int statusCode) { hasError = true; @@ -40,8 +39,7 @@ class UcafService extends LookupService { }, body: body); } - Future getInPatientVitalSignHistory( - PatiantInformtion patient, bool isInPatient) async { + Future getInPatientVitalSignHistory(PatiantInformtion patient, bool isInPatient) async { hasError = false; Map body = Map(); body['PatientID'] = patient.patientId; @@ -52,18 +50,18 @@ class UcafService extends LookupService { body['InOutPatientType'] = 2; } - patientVitalSignsHistory = null; + patientVitalSignsHistory = []; await baseAppClient.post( GET_PATIENT_VITAL_SIGN, onSuccess: (dynamic response, int statusCode) { if (patientVitalSignsHistory != null) { - patientVitalSignsHistory.clear(); + patientVitalSignsHistory!.clear(); } else { - patientVitalSignsHistory = new List(); + patientVitalSignsHistory = []; } if (response['List_DoctorPatientVitalSign'] != null) { response['List_DoctorPatientVitalSign'].forEach((v) { - patientVitalSignsHistory.add(new VitalSignHistory.fromJson(v)); + patientVitalSignsHistory!.add(new VitalSignHistory.fromJson(v)); }); } }, @@ -75,8 +73,7 @@ class UcafService extends LookupService { ); } - Future getPatientVitalSignsHistory( - PatiantInformtion patient, String fromDate, String toDate) async { + Future getPatientVitalSignsHistory(PatiantInformtion patient, String fromDate, String toDate) async { hasError = false; Map body = Map(); body['PatientMRN'] = patient.patientId; // patient.patientMRN @@ -94,13 +91,13 @@ class UcafService extends LookupService { GET_PATIENT_VITAL_SIGN_DATA, onSuccess: (dynamic response, int statusCode) { if (patientVitalSignsHistory != null) { - patientVitalSignsHistory.clear(); + patientVitalSignsHistory!.clear(); } else { - patientVitalSignsHistory = new List(); + patientVitalSignsHistory = []; } if (response['VitalSignsHistory'] != null) { response['VitalSignsHistory'].forEach((v) { - patientVitalSignsHistory.add(new VitalSignHistory.fromJson(v)); + patientVitalSignsHistory!.add(new VitalSignHistory.fromJson(v)); }); } }, @@ -119,8 +116,7 @@ class UcafService extends LookupService { body['AppointmentNo'] = patient.appointmentNo; body['EpisodeID'] = patient.episodeNo; - await baseAppClient.post(GET_ASSESSMENT, - onSuccess: (dynamic response, int statusCode) { + await baseAppClient.post(GET_ASSESSMENT, onSuccess: (dynamic response, int statusCode) { print("Success"); patientAssessmentList.clear(); response['AssessmentList']['entityList'].forEach((v) { @@ -142,10 +138,8 @@ class UcafService extends LookupService { hasError = false; prescriptionList = null; - await baseAppClient.post(GET_PRESCRIPTION_LIST, - onSuccess: (dynamic response, int statusCode) { - prescriptionList = - PrescriptionModel.fromJson(response['PrescriptionList']); + await baseAppClient.post(GET_PRESCRIPTION_LIST, onSuccess: (dynamic response, int statusCode) { + prescriptionList = PrescriptionModel.fromJson(response['PrescriptionList']); }, onFailure: (String error, int statusCode) { hasError = true; super.error = error; @@ -159,12 +153,11 @@ class UcafService extends LookupService { body['AppointmentNo'] = patient.appointmentNo; body['EpisodeID'] = patient.episodeNo; - await baseAppClient.post(GET_PROCEDURE_LIST, - onSuccess: (dynamic response, int statusCode) { + await baseAppClient.post(GET_PROCEDURE_LIST, onSuccess: (dynamic response, int statusCode) { print("Success"); - orderProcedureList.clear(); + orderProcedureList!.clear(); response['OrderedProcedureList']['entityList'].forEach((v) { - orderProcedureList.add(OrderProcedure.fromJson(v)); + orderProcedureList!.add(OrderProcedure.fromJson(v)); }); }, onFailure: (String error, int statusCode) { hasError = true; @@ -178,8 +171,7 @@ class UcafService extends LookupService { body['PatientMRN'] = patient.patientMRN; body['AppointmentNo'] = patient.appointmentNo; - await baseAppClient.post(POST_UCAF, - onSuccess: (dynamic response, int statusCode) { + await baseAppClient.post(POST_UCAF, onSuccess: (dynamic response, int statusCode) { print("Success"); }, onFailure: (String error, int statusCode) { hasError = true; diff --git a/lib/core/service/patient_medical_file/vital_sign/patient-vital-signs-service.dart b/lib/core/service/patient_medical_file/vital_sign/patient-vital-signs-service.dart index a74969d1..733b1362 100644 --- a/lib/core/service/patient_medical_file/vital_sign/patient-vital-signs-service.dart +++ b/lib/core/service/patient_medical_file/vital_sign/patient-vital-signs-service.dart @@ -5,7 +5,7 @@ import 'package:doctor_app_flutter/core/model/patient/vital_sign/patient-vital-s import 'package:doctor_app_flutter/core/model/patient/vital_sign/patient-vital-sign-history.dart'; class VitalSignsService extends BaseService { - VitalSignData patientVitalSigns; + VitalSignData? patientVitalSigns; List patientVitalSignsHistory = []; Future getPatientVitalSign(PatiantInformtion patient) async { diff --git a/lib/core/service/pending_order_service.dart b/lib/core/service/pending_order_service.dart index 17f6ea12..ead87a74 100644 --- a/lib/core/service/pending_order_service.dart +++ b/lib/core/service/pending_order_service.dart @@ -6,28 +6,19 @@ import 'package:doctor_app_flutter/core/model/pending_orders/pending_order_reque import 'package:doctor_app_flutter/core/model/pending_orders/pending_orders_model.dart'; class PendingOrderService extends BaseService { - List _pendingOrderList = List(); + List _pendingOrderList = []; List get pendingOrderList => _pendingOrderList; - List _admissionOrderList = List(); + List _admissionOrderList = []; List get admissionOrderList => _admissionOrderList; - Future getPendingOrders( - {PendingOrderRequestModel pendingOrderRequestModel, - int patientId, - int admissionNo}) async { - pendingOrderRequestModel = PendingOrderRequestModel( - patientID: patientId, - admissionNo: admissionNo, - patientTypeID: 1, - patientType: 1, - setupID: "010266"); + Future getPendingOrders({PendingOrderRequestModel? pendingOrderRequestModel, int? patientId, int? admissionNo}) async { + pendingOrderRequestModel = PendingOrderRequestModel(patientID: patientId, admissionNo: admissionNo, patientTypeID: 1, patientType: 1, setupID: "010266"); hasError = false; - await baseAppClient.post(GET_PENDING_ORDERS, - onSuccess: (dynamic response, int statusCode) { + await baseAppClient.post(GET_PENDING_ORDERS, onSuccess: (dynamic response, int statusCode) { print("Success"); _pendingOrderList.clear(); response['List_PendingOrders'].forEach( @@ -41,20 +32,11 @@ class PendingOrderService extends BaseService { }, body: pendingOrderRequestModel.toJson()); } - Future getAdmissionOrders( - {AdmissionOrdersRequestModel admissionOrdersRequestModel, - int patientId, - int admissionNo}) async { - admissionOrdersRequestModel = AdmissionOrdersRequestModel( - patientID: patientId, - admissionNo: admissionNo, - patientTypeID: 1, - patientType: 1, - setupID: "010266"); + Future getAdmissionOrders({AdmissionOrdersRequestModel? admissionOrdersRequestModel, int? patientId, int? admissionNo}) async { + admissionOrdersRequestModel = AdmissionOrdersRequestModel(patientID: patientId, admissionNo: admissionNo, patientTypeID: 1, patientType: 1, setupID: "010266"); hasError = false; - await baseAppClient.post(GET_ADMISSION_ORDERS, - onSuccess: (dynamic response, int statusCode) { + await baseAppClient.post(GET_ADMISSION_ORDERS, onSuccess: (dynamic response, int statusCode) { print("Success"); //admissionOrderList.clear(); response['List_AdmissionOrders'].forEach( diff --git a/lib/core/viewModel/DischargedPatientViewModel.dart b/lib/core/viewModel/DischargedPatientViewModel.dart index 90b86f74..f85643cc 100644 --- a/lib/core/viewModel/DischargedPatientViewModel.dart +++ b/lib/core/viewModel/DischargedPatientViewModel.dart @@ -19,9 +19,9 @@ class DischargedPatientViewModel extends BaseViewModel { if (strExist) { filterData = []; for (var i = 0; i < myDischargedPatient.length; i++) { - String firstName = myDischargedPatient[i].firstName.toUpperCase(); - String lastName = myDischargedPatient[i].lastName.toUpperCase(); - String mobile = myDischargedPatient[i].mobileNumber.toUpperCase(); + String firstName = myDischargedPatient[i].firstName!.toUpperCase(); + String lastName = myDischargedPatient[i].lastName!.toUpperCase(); + String mobile = myDischargedPatient[i].mobileNumber!.toUpperCase(); String patientID = myDischargedPatient[i].patientId.toString(); if (firstName.contains(str.toUpperCase()) || diff --git a/lib/core/viewModel/ER_sign_in/ER_sign_in_view_model.dart b/lib/core/viewModel/ER_sign_in/ER_sign_in_view_model.dart index 0bf10e76..f76c55a5 100644 --- a/lib/core/viewModel/ER_sign_in/ER_sign_in_view_model.dart +++ b/lib/core/viewModel/ER_sign_in/ER_sign_in_view_model.dart @@ -1,41 +1,29 @@ -import 'package:doctor_app_flutter/core/enum/filter_type.dart'; import 'package:doctor_app_flutter/core/enum/view_state.dart'; import 'package:doctor_app_flutter/core/model/ER_sign_in/doctor_ER_sign_assessment_req_model.dart'; -import 'package:doctor_app_flutter/core/model/Prescriptions/Prescriptions.dart'; -import 'package:doctor_app_flutter/core/model/Prescriptions/get_medication_for_inpatient_model.dart'; -import 'package:doctor_app_flutter/core/model/Prescriptions/perscription_pharmacy.dart'; -import 'package:doctor_app_flutter/core/model/Prescriptions/post_prescrition_req_model.dart'; -import 'package:doctor_app_flutter/core/model/Prescriptions/prescription_entity_model.dart'; -import 'package:doctor_app_flutter/core/model/Prescriptions/prescription_model.dart'; -import 'package:doctor_app_flutter/core/model/Prescriptions/prescription_report.dart'; -import 'package:doctor_app_flutter/core/model/Prescriptions/prescription_report_enh.dart'; -import 'package:doctor_app_flutter/core/model/SOAP/Allergy/get_allergies_res_model.dart'; -import 'package:doctor_app_flutter/core/model/SOAP/Assessment/get_assessment_res_model.dart'; -import 'package:doctor_app_flutter/core/model/patient/patiant_info_model.dart'; -import 'package:doctor_app_flutter/core/model/patient/vital_sign/patient-vital-sign-data.dart'; import 'package:doctor_app_flutter/core/service/patient_medical_file/ER_signin/ER_signin_service.dart'; -import 'package:doctor_app_flutter/core/service/patient_medical_file/prescription/prescription_service.dart'; import 'package:doctor_app_flutter/core/viewModel/base_view_model.dart'; import 'package:doctor_app_flutter/locator.dart'; -import 'package:flutter/cupertino.dart'; class ERSignInViewModel extends BaseViewModel { bool hasError = false; ERSignInService _ERSignInService = locator(); - Future signInERPatient({int patientId, int signInType}) async { + Future signInERPatient({int? patientId, int? signInType}) async { hasError = false; await getDoctorProfile(); - DoctorErSignAssessmentReqModel doctorErSignAssessmentReqModel = new DoctorErSignAssessmentReqModel(setupID:"010266", signInType:signInType, loginDoctorID:doctorProfile.doctorID, patientID: patientId ); + DoctorErSignAssessmentReqModel doctorErSignAssessmentReqModel = new DoctorErSignAssessmentReqModel( + setupID: "010266", + signInType: signInType, + loginDoctorID: doctorProfile!.doctorID, + patientID: patientId, + ); setState(ViewState.BusyLocal); await _ERSignInService.signInERPatient(doctorErSignAssessmentReqModel: doctorErSignAssessmentReqModel); if (_ERSignInService.hasError) { - error = _ERSignInService.error; + error = _ERSignInService.error!; setState(ViewState.ErrorLocal); } else setState(ViewState.Idle); } - - } diff --git a/lib/core/viewModel/InsuranceViewModel.dart b/lib/core/viewModel/InsuranceViewModel.dart index 2123c5bf..af267969 100644 --- a/lib/core/viewModel/InsuranceViewModel.dart +++ b/lib/core/viewModel/InsuranceViewModel.dart @@ -17,7 +17,7 @@ class InsuranceViewModel extends BaseViewModel { _insuranceCardService.insuranceApprovalInPatient; Future getInsuranceApproval(PatiantInformtion patient, - {int appointmentNo, int projectId}) async { + {int? appointmentNo, int? projectId}) async { error = ""; setState(ViewState.Busy); if (appointmentNo != null) @@ -32,7 +32,7 @@ class InsuranceViewModel extends BaseViewModel { setState(ViewState.Idle); } - Future getInsuranceInPatient({int mrn}) async { + Future getInsuranceInPatient({required int mrn}) async { //hasError = false; //_insuranceCardService.clearInsuranceCard(); setState(ViewState.Busy); diff --git a/lib/core/viewModel/LiveCarePatientViewModel.dart b/lib/core/viewModel/LiveCarePatientViewModel.dart index f90c7c9e..6644a73e 100644 --- a/lib/core/viewModel/LiveCarePatientViewModel.dart +++ b/lib/core/viewModel/LiveCarePatientViewModel.dart @@ -52,7 +52,7 @@ class LiveCarePatientViewModel extends BaseViewModel { Future endCall(int vCID, bool isPatient) async { await getDoctorProfile(isGetProfile: true); EndCallReq endCallReq = new EndCallReq(); - endCallReq.doctorId = doctorProfile.doctorID; + endCallReq.doctorId = doctorProfile!.doctorID; endCallReq.generalid = 'Cs2020@2016\$2958'; endCallReq.vCID = vCID; endCallReq.isDestroy = isPatient; @@ -72,18 +72,18 @@ class LiveCarePatientViewModel extends BaseViewModel { return token; } - Future startCall({int vCID, bool isReCall}) async { + Future startCall({required int vCID, required bool isReCall}) async { StartCallReq startCallReq = new StartCallReq(); await getDoctorProfile(); - startCallReq.clinicId = super.doctorProfile.clinicID; + startCallReq.clinicId = super.doctorProfile!.clinicID; startCallReq.vCID = vCID; //["VC_ID"]; startCallReq.isrecall = isReCall; - startCallReq.doctorId = doctorProfile.doctorID; + startCallReq.doctorId = doctorProfile!.doctorID; startCallReq.isOutKsa = false; //["IsOutKSA"]; - startCallReq.projectName = doctorProfile.projectName; - startCallReq.docotrName = doctorProfile.doctorName; - startCallReq.clincName = doctorProfile.clinicDescription; - startCallReq.docSpec = doctorProfile.doctorTitleForProfile; + startCallReq.projectName = doctorProfile!.projectName; + startCallReq.docotrName = doctorProfile!.doctorName; + startCallReq.clincName = doctorProfile!.clinicDescription; + startCallReq.docSpec = doctorProfile!.doctorTitleForProfile; startCallReq.generalid = 'Cs2020@2016\$2958'; setState(ViewState.BusyLocal); @@ -121,10 +121,10 @@ class LiveCarePatientViewModel extends BaseViewModel { } List getSelectedAlternativeServices() { - List selectedServices = List(); + List selectedServices = []; for (AlternativeService service in alternativeServicesList) { - if (service.isSelected) { - selectedServices.add(service.serviceID); + if (service.isSelected!) { + selectedServices.add(service.serviceID!); } } return selectedServices; @@ -171,11 +171,11 @@ class LiveCarePatientViewModel extends BaseViewModel { filterData = []; for (var i = 0; i < _liveCarePatientServices.patientList.length; i++) { String fullName = - _liveCarePatientServices.patientList[i].fullName.toUpperCase(); + _liveCarePatientServices.patientList[i].fullName!.toUpperCase(); String patientID = _liveCarePatientServices.patientList[i].patientId.toString(); String mobile = - _liveCarePatientServices.patientList[i].mobileNumber.toUpperCase(); + _liveCarePatientServices.patientList[i].mobileNumber!.toUpperCase(); if (fullName.contains(str.toUpperCase()) || patientID.contains(str) || @@ -196,7 +196,7 @@ class LiveCarePatientViewModel extends BaseViewModel { LiveCareUserLoginRequestModel userLoginRequestModel = new LiveCareUserLoginRequestModel(); userLoginRequestModel.isOutKsa = - (doctorProfile.projectID == 2 || doctorProfile.projectID == 3) ? 1 : 0; + (doctorProfile!.projectID == 2 || doctorProfile!.projectID == 3) ? 1 : 0; userLoginRequestModel.isLogin = loginStatus; userLoginRequestModel.generalid = "Cs2020@2016\$2958"; @@ -250,9 +250,9 @@ class LiveCarePatientViewModel extends BaseViewModel { ); } - updateInCallPatient({PatiantInformtion patient, appointmentNo}) { + updateInCallPatient({PatiantInformtion? patient, appointmentNo}) { _liveCarePatientServices.patientList.forEach((e) { - if (e.patientId == patient.patientId) { + if (e.patientId == patient!.patientId) { e.episodeNo = 0; e.appointmentNo = appointmentNo; return; diff --git a/lib/core/viewModel/PatientMuseViewModel.dart b/lib/core/viewModel/PatientMuseViewModel.dart index 94a14a43..3bbeac4c 100644 --- a/lib/core/viewModel/PatientMuseViewModel.dart +++ b/lib/core/viewModel/PatientMuseViewModel.dart @@ -11,7 +11,7 @@ class PatientMuseViewModel extends BaseViewModel { List get patientMuseResultsModelList => _patientMuseService.patientMuseResultsModelList; - getECGPatient({int patientType, int patientOutSA, int patientID}) async { + getECGPatient({int? patientType, int? patientOutSA, int? patientID}) async { setState(ViewState.Busy); await _patientMuseService.getECGPatient( patientID: patientID, diff --git a/lib/core/viewModel/PatientRegistrationViewModel.dart b/lib/core/viewModel/PatientRegistrationViewModel.dart index 7c715eb7..bec86318 100644 --- a/lib/core/viewModel/PatientRegistrationViewModel.dart +++ b/lib/core/viewModel/PatientRegistrationViewModel.dart @@ -12,23 +12,18 @@ import 'package:doctor_app_flutter/core/viewModel/base_view_model.dart'; import '../../locator.dart'; class PatientRegistrationViewModel extends BaseViewModel { - PatientRegistrationService _patientRegistrationService = - locator(); + PatientRegistrationService _patientRegistrationService = locator(); - GetPatientInfoResponseModel get getPatientInfoResponseModel => - _patientRegistrationService.getPatientInfoResponseModel; + GetPatientInfoResponseModel get getPatientInfoResponseModel => _patientRegistrationService.getPatientInfoResponseModel!; - CheckPatientForRegistrationModel checkPatientForRegistrationModel; + CheckPatientForRegistrationModel? checkPatientForRegistrationModel; - Future checkPatientForRegistration( - CheckPatientForRegistrationModel registrationModel) async { + Future checkPatientForRegistration(CheckPatientForRegistrationModel registrationModel) async { checkPatientForRegistrationModel = registrationModel; - checkPatientForRegistrationModel = - CheckPatientForRegistrationModel.fromJson(registrationModel.toJson()); + checkPatientForRegistrationModel = CheckPatientForRegistrationModel.fromJson(registrationModel.toJson()); setState(ViewState.BusyLocal); - await _patientRegistrationService - .checkPatientForRegistration(registrationModel); + await _patientRegistrationService.checkPatientForRegistration(registrationModel); if (_patientRegistrationService.hasError) { error = _patientRegistrationService.error; setState(ViewState.ErrorLocal); @@ -36,13 +31,11 @@ class PatientRegistrationViewModel extends BaseViewModel { setState(ViewState.Idle); } - Future getPatientInfo( - GetPatientInfoRequestModel getPatientInfoRequestModel) async { + Future getPatientInfo(GetPatientInfoRequestModel getPatientInfoRequestModel) async { setState(ViewState.BusyLocal); /// TODO Elham* return call service when it working - _patientRegistrationService.getPatientInfoResponseModel = - GetPatientInfoResponseModel.fromJson({ + _patientRegistrationService.getPatientInfoResponseModel = GetPatientInfoResponseModel.fromJson({ "Date": null, "LanguageID": 0, "ServiceName": 0, @@ -141,19 +134,12 @@ class PatientRegistrationViewModel extends BaseViewModel { setState(ViewState.Idle); } - Future sendActivationCodeByOTPNotificationType( - {SendActivationCodeByOTPNotificationTypeForRegistrationModel - registrationModel, - int otpType, - PatientRegistrationViewModel user}) async { + Future sendActivationCodeByOTPNotificationType({SendActivationCodeByOTPNotificationTypeForRegistrationModel? registrationModel, int? otpType, PatientRegistrationViewModel? user}) async { setState(ViewState.BusyLocal); print(checkPatientForRegistrationModel); print(checkPatientForRegistrationModel); - await _patientRegistrationService.sendActivationCodeByOTPNotificationType( - otpType: otpType, - model: this, - checkPatientForRegistrationModel: checkPatientForRegistrationModel); + await _patientRegistrationService.sendActivationCodeByOTPNotificationType(otpType: otpType, model: this, checkPatientForRegistrationModel: checkPatientForRegistrationModel); if (_patientRegistrationService.hasError) { error = _patientRegistrationService.error; setState(ViewState.ErrorLocal); @@ -164,15 +150,14 @@ class PatientRegistrationViewModel extends BaseViewModel { Future checkActivationCode(String code) async { CheckActivationCodeModel model = CheckActivationCodeModel( activationCode: code, - patientIdentificationID: - checkPatientForRegistrationModel.patientIdentificationID, - patientMobileNumber: checkPatientForRegistrationModel.patientMobileNumber, - zipCode: checkPatientForRegistrationModel.zipCode, + patientIdentificationID: checkPatientForRegistrationModel!.patientIdentificationID, + patientMobileNumber: checkPatientForRegistrationModel!.patientMobileNumber, + zipCode: checkPatientForRegistrationModel!.zipCode, patientOutSA: 0, healthId: getPatientInfoResponseModel.healthId, - dOB: checkPatientForRegistrationModel.dOB, - isRegister: checkPatientForRegistrationModel.isRegister, - isHijri: checkPatientForRegistrationModel.isHijri, + dOB: checkPatientForRegistrationModel!.dOB, + isRegister: checkPatientForRegistrationModel!.isRegister, + isHijri: checkPatientForRegistrationModel!.isHijri, sessionID: null, generalid: GENERAL_ID, forRegisteration: true, @@ -184,9 +169,9 @@ class PatientRegistrationViewModel extends BaseViewModel { // TODO Elham* loginType loginType: 4, logInTokenID: _patientRegistrationService.logInTokenID, - nationalID: checkPatientForRegistrationModel.patientIdentificationID, + nationalID: checkPatientForRegistrationModel!.patientIdentificationID, patientID: 0, - mobileNo: checkPatientForRegistrationModel.patientMobileNumber.toString(), + mobileNo: checkPatientForRegistrationModel!.patientMobileNumber.toString(), ); setState(ViewState.BusyLocal); await _patientRegistrationService.checkActivationCode(model); diff --git a/lib/core/viewModel/PatientSearchViewModel.dart b/lib/core/viewModel/PatientSearchViewModel.dart index 72eb876a..42e4f553 100644 --- a/lib/core/viewModel/PatientSearchViewModel.dart +++ b/lib/core/viewModel/PatientSearchViewModel.dart @@ -14,19 +14,16 @@ import 'base_view_model.dart'; class PatientSearchViewModel extends BaseViewModel { OutPatientService _outPatientService = locator(); - SpecialClinicsService _specialClinicsService = - locator(); + SpecialClinicsService _specialClinicsService = locator(); List get patientList => _outPatientService.patientList; - List - get specialClinicalCareMappingList => - _specialClinicsService.specialClinicalCareMappingList; + List get specialClinicalCareMappingList => _specialClinicsService.specialClinicalCareMappingList; List filterData = []; - DateTime selectedFromDate; - DateTime selectedToDate; + DateTime? selectedFromDate; + DateTime? selectedToDate; int firstSubsetIndex = 0; int inPatientPageSize = 20; @@ -39,19 +36,12 @@ class PatientSearchViewModel extends BaseViewModel { if (strExist) { filterData = []; for (var i = 0; i < _outPatientService.patientList.length; i++) { - String firstName = - _outPatientService.patientList[i].firstName.toUpperCase(); - String lastName = - _outPatientService.patientList[i].lastName.toUpperCase(); - String mobile = - _outPatientService.patientList[i].mobileNumber.toUpperCase(); - String patientID = - _outPatientService.patientList[i].patientId.toString(); - - if (firstName.contains(str.toUpperCase()) || - lastName.contains(str.toUpperCase()) || - mobile.contains(str) || - patientID.contains(str)) { + String firstName = _outPatientService.patientList[i].firstName!.toUpperCase(); + String lastName = _outPatientService.patientList[i].lastName!.toUpperCase(); + String mobile = _outPatientService.patientList[i].mobileNumber!.toUpperCase(); + String patientID = _outPatientService.patientList[i].patientId.toString(); + + if (firstName.contains(str.toUpperCase()) || lastName.contains(str.toUpperCase()) || mobile.contains(str) || patientID.contains(str)) { filterData.add(_outPatientService.patientList[i]); } } @@ -62,16 +52,15 @@ class PatientSearchViewModel extends BaseViewModel { } } - getOutPatient(PatientSearchRequestModel patientSearchRequestModel, - {bool isLocalBusy = false}) async { + getOutPatient(PatientSearchRequestModel patientSearchRequestModel, {bool isLocalBusy = false}) async { if (isLocalBusy) { setState(ViewState.BusyLocal); } else { setState(ViewState.Busy); } await getDoctorProfile(isGetProfile: true); - patientSearchRequestModel.loginDoctorID = doctorProfile.doctorID; - patientSearchRequestModel.doctorID = doctorProfile.doctorID; + patientSearchRequestModel.loginDoctorID = doctorProfile!.doctorID; + patientSearchRequestModel.doctorID = doctorProfile!.doctorID; await _outPatientService.getOutPatient(patientSearchRequestModel); if (_outPatientService.hasError) { error = _outPatientService.error; @@ -94,11 +83,9 @@ class PatientSearchViewModel extends BaseViewModel { setState(ViewState.Idle); } - getPatientFileInformation(PatientSearchRequestModel patientSearchRequestModel, - {bool isLocalBusy = false}) async { + getPatientFileInformation(PatientSearchRequestModel patientSearchRequestModel, {bool isLocalBusy = false}) async { setState(ViewState.Busy); - await _outPatientService - .getPatientFileInformation(patientSearchRequestModel); + await _outPatientService.getPatientFileInformation(patientSearchRequestModel); if (_outPatientService.hasError) { error = _outPatientService.error; setState(ViewState.Error); @@ -108,44 +95,24 @@ class PatientSearchViewModel extends BaseViewModel { } } - getPatientBasedOnDate( - {item, - PatientSearchRequestModel patientSearchRequestModel, - PatientType selectedPatientType, - bool isSearchWithKeyInfo, - OutPatientFilterType outPatientFilterType}) async { + getPatientBasedOnDate({item, PatientSearchRequestModel? patientSearchRequestModel, PatientType? selectedPatientType, bool? isSearchWithKeyInfo, OutPatientFilterType? outPatientFilterType}) async { String dateTo; String dateFrom; if (OutPatientFilterType.Previous == outPatientFilterType) { - selectedFromDate = DateTime( - DateTime.now().year, DateTime.now().month - 1, DateTime.now().day); - selectedToDate = DateTime( - DateTime.now().year, DateTime.now().month, DateTime.now().day - 1); - dateTo = AppDateUtils.convertDateToFormat(selectedToDate, 'yyyy-MM-dd'); - dateFrom = - AppDateUtils.convertDateToFormat(selectedFromDate, 'yyyy-MM-dd'); + selectedFromDate = DateTime(DateTime.now().year, DateTime.now().month - 1, DateTime.now().day); + selectedToDate = DateTime(DateTime.now().year, DateTime.now().month, DateTime.now().day - 1); + dateTo = AppDateUtils.convertDateToFormat(selectedToDate!, 'yyyy-MM-dd'); + dateFrom = AppDateUtils.convertDateToFormat(selectedFromDate!, 'yyyy-MM-dd'); } else if (OutPatientFilterType.NextWeek == outPatientFilterType) { - dateTo = AppDateUtils.convertDateToFormat( - DateTime(DateTime.now().year, DateTime.now().month, - DateTime.now().day + 7), - 'yyyy-MM-dd'); - - dateFrom = AppDateUtils.convertDateToFormat( - DateTime(DateTime.now().year, DateTime.now().month, - DateTime.now().day + 1), - 'yyyy-MM-dd'); + dateTo = AppDateUtils.convertDateToFormat(DateTime(DateTime.now().year, DateTime.now().month, DateTime.now().day + 7), 'yyyy-MM-dd'); + + dateFrom = AppDateUtils.convertDateToFormat(DateTime(DateTime.now().year, DateTime.now().month, DateTime.now().day + 1), 'yyyy-MM-dd'); } else { - dateFrom = AppDateUtils.convertDateToFormat( - DateTime( - DateTime.now().year, DateTime.now().month, DateTime.now().day), - 'yyyy-MM-dd'); - dateTo = AppDateUtils.convertDateToFormat( - DateTime( - DateTime.now().year, DateTime.now().month, DateTime.now().day), - 'yyyy-MM-dd'); + dateFrom = AppDateUtils.convertDateToFormat(DateTime(DateTime.now().year, DateTime.now().month, DateTime.now().day), 'yyyy-MM-dd'); + dateTo = AppDateUtils.convertDateToFormat(DateTime(DateTime.now().year, DateTime.now().month, DateTime.now().day), 'yyyy-MM-dd'); } PatientSearchRequestModel currentModel = PatientSearchRequestModel(); - currentModel.patientID = patientSearchRequestModel.patientID; + currentModel.patientID = patientSearchRequestModel!.patientID; currentModel.firstName = patientSearchRequestModel.firstName; currentModel.lastName = patientSearchRequestModel.lastName; currentModel.middleName = patientSearchRequestModel.middleName; @@ -156,27 +123,23 @@ class PatientSearchViewModel extends BaseViewModel { filterData = _outPatientService.patientList; } - PatientInPatientService _inPatientService = - locator(); + PatientInPatientService _inPatientService = locator(); List get inPatientList => _inPatientService.inPatientList; - List get myIinPatientList => - _inPatientService.myInPatientList; + List get myIinPatientList => _inPatientService.myInPatientList; - List filteredInPatientItems = List(); - List filteredMyInPatientItems = List(); + List filteredInPatientItems = []; + List filteredMyInPatientItems = []; - Future getInPatientList(PatientSearchRequestModel requestModel, - {bool isMyInpatient = false, bool isLocalBusy = false}) async { + Future getInPatientList(PatientSearchRequestModel requestModel, {bool isMyInpatient = false, bool isLocalBusy = false}) async { await getDoctorProfile(); if (isLocalBusy) { setState(ViewState.BusyLocal); } else { setState(ViewState.Busy); } - if (inPatientList.length == 0) - await _inPatientService.getInPatientList(requestModel, false); + if (inPatientList.length == 0) await _inPatientService.getInPatientList(requestModel, false); if (_inPatientService.hasError) { error = _inPatientService.error; if (isLocalBusy) { @@ -191,7 +154,7 @@ class PatientSearchViewModel extends BaseViewModel { } } - sortInPatient({bool isDes = false, bool isAllClinic, bool isMyInPatient}) { + sortInPatient({bool isDes = false, bool isAllClinic = false, bool isMyInPatient = false}) { if (isMyInPatient ? myIinPatientList.length > 0 : isAllClinic @@ -203,20 +166,15 @@ class PatientSearchViewModel extends BaseViewModel { ? [...inPatientList] : [...filteredInPatientItems]; if (isDes) - localInPatient.sort((PatiantInformtion a, PatiantInformtion b) => b - .admissionDateWithDateTimeForm - .compareTo(a.admissionDateWithDateTimeForm)); + localInPatient.sort((PatiantInformtion a, PatiantInformtion b) => b.admissionDateWithDateTimeForm!.compareTo(a.admissionDateWithDateTimeForm!)); else - localInPatient.sort((PatiantInformtion a, PatiantInformtion b) => a - .admissionDateWithDateTimeForm - .compareTo(b.admissionDateWithDateTimeForm)); + localInPatient.sort((PatiantInformtion a, PatiantInformtion b) => a.admissionDateWithDateTimeForm!.compareTo(b.admissionDateWithDateTimeForm!)); if (isMyInPatient) { filteredMyInPatientItems.clear(); filteredMyInPatientItems.addAll(localInPatient); } else if (isAllClinic) { resetInPatientPagination(); - filteredInPatientItems - .addAll(localInPatient.sublist(firstSubsetIndex, lastSubsetIndex)); + filteredInPatientItems.addAll(localInPatient.sublist(firstSubsetIndex, lastSubsetIndex)); } else { filteredInPatientItems.clear(); filteredInPatientItems.addAll(localInPatient); @@ -236,12 +194,9 @@ class PatientSearchViewModel extends BaseViewModel { await getDoctorProfile(); resetInPatientPagination(); if (inPatientList.length > 0) { - lastSubsetIndex = (inPatientList.length < inPatientPageSize - 1 - ? inPatientList.length - : inPatientPageSize - 1); + lastSubsetIndex = (inPatientList.length < inPatientPageSize - 1 ? inPatientList.length : inPatientPageSize - 1); - filteredInPatientItems - .addAll(inPatientList.sublist(firstSubsetIndex, lastSubsetIndex)); + filteredInPatientItems.addAll(inPatientList.sublist(firstSubsetIndex, lastSubsetIndex)); } if (myIinPatientList.length > 0) { @@ -254,23 +209,16 @@ class PatientSearchViewModel extends BaseViewModel { InpatientClinicList.clear(); inPatientList.forEach((element) { if (!InpatientClinicList.contains(element.clinicDescription)) { - InpatientClinicList.add(element.clinicDescription); + InpatientClinicList.add(element.clinicDescription!); } }); } addOnFilteredList() { if (lastSubsetIndex < inPatientList.length) { - firstSubsetIndex = firstSubsetIndex + - (inPatientList.length - lastSubsetIndex < inPatientPageSize - 1 - ? inPatientList.length - lastSubsetIndex - : inPatientPageSize - 1); - lastSubsetIndex = lastSubsetIndex + - (inPatientList.length - lastSubsetIndex < inPatientPageSize - 1 - ? inPatientList.length - lastSubsetIndex - : inPatientPageSize - 1); - filteredInPatientItems - .addAll(inPatientList.sublist(firstSubsetIndex, lastSubsetIndex)); + firstSubsetIndex = firstSubsetIndex + (inPatientList.length - lastSubsetIndex < inPatientPageSize - 1 ? inPatientList.length - lastSubsetIndex : inPatientPageSize - 1); + lastSubsetIndex = lastSubsetIndex + (inPatientList.length - lastSubsetIndex < inPatientPageSize - 1 ? inPatientList.length - lastSubsetIndex : inPatientPageSize - 1); + filteredInPatientItems.addAll(inPatientList.sublist(firstSubsetIndex, lastSubsetIndex)); setState(ViewState.Idle); } } @@ -282,7 +230,7 @@ class PatientSearchViewModel extends BaseViewModel { } } - filterByHospital({int hospitalId}) { + filterByHospital({required int hospitalId}) { filteredInPatientItems = []; for (var i = 0; i < inPatientList.length; i++) { if (inPatientList[i].projectId == hospitalId) { @@ -292,7 +240,7 @@ class PatientSearchViewModel extends BaseViewModel { notifyListeners(); } - filterByClinic({String clinicName}) { + filterByClinic({required String clinicName}) { filteredInPatientItems = []; for (var i = 0; i < inPatientList.length; i++) { if (inPatientList[i].clinicDescription == clinicName) { @@ -307,31 +255,21 @@ class PatientSearchViewModel extends BaseViewModel { _inPatientService.myInPatientList = []; } - void filterSearchResults(String query, - {bool isAllClinic, bool isMyInPatient}) { + void filterSearchResults(String query, {bool isAllClinic = false, bool isMyInPatient = false}) { var strExist = query.length > 0 ? true : false; if (isMyInPatient) { - List localFilteredMyInPatientItems = [ - ...myIinPatientList - ]; + List localFilteredMyInPatientItems = [...myIinPatientList]; if (strExist) { filteredMyInPatientItems.clear(); for (var i = 0; i < localFilteredMyInPatientItems.length; i++) { - String firstName = - localFilteredMyInPatientItems[i].firstName.toUpperCase(); - String lastName = - localFilteredMyInPatientItems[i].lastName.toUpperCase(); - String mobile = - localFilteredMyInPatientItems[i].mobileNumber.toUpperCase(); - String patientID = - localFilteredMyInPatientItems[i].patientId.toString(); - - if (firstName.contains(query.toUpperCase()) || - lastName.contains(query.toUpperCase()) || - mobile.contains(query) || - patientID.contains(query)) { + String firstName = localFilteredMyInPatientItems[i].firstName!.toUpperCase(); + String lastName = localFilteredMyInPatientItems[i].lastName!.toUpperCase(); + String mobile = localFilteredMyInPatientItems[i].mobileNumber!.toUpperCase(); + String patientID = localFilteredMyInPatientItems[i].patientId.toString(); + + if (firstName.contains(query.toUpperCase()) || lastName.contains(query.toUpperCase()) || mobile.contains(query) || patientID.contains(query)) { filteredMyInPatientItems.add(localFilteredMyInPatientItems[i]); } } @@ -346,15 +284,12 @@ class PatientSearchViewModel extends BaseViewModel { if (strExist) { filteredInPatientItems = []; for (var i = 0; i < inPatientList.length; i++) { - String firstName = inPatientList[i].firstName.toUpperCase(); - String lastName = inPatientList[i].lastName.toUpperCase(); - String mobile = inPatientList[i].mobileNumber.toUpperCase(); + String firstName = inPatientList[i].firstName!.toUpperCase(); + String lastName = inPatientList[i].lastName!.toUpperCase(); + String mobile = inPatientList[i].mobileNumber!.toUpperCase(); String patientID = inPatientList[i].patientId.toString(); - if (firstName.contains(query.toUpperCase()) || - lastName.contains(query.toUpperCase()) || - mobile.contains(query) || - patientID.contains(query)) { + if (firstName.contains(query.toUpperCase()) || lastName.contains(query.toUpperCase()) || mobile.contains(query) || patientID.contains(query)) { filteredInPatientItems.add(inPatientList[i]); } } @@ -365,33 +300,23 @@ class PatientSearchViewModel extends BaseViewModel { notifyListeners(); } } else { - List localFilteredInPatientItems = [ - ...filteredInPatientItems - ]; + List localFilteredInPatientItems = [...filteredInPatientItems]; if (strExist) { filteredInPatientItems.clear(); for (var i = 0; i < localFilteredInPatientItems.length; i++) { - String firstName = - localFilteredInPatientItems[i].firstName.toUpperCase(); - String lastName = - localFilteredInPatientItems[i].lastName.toUpperCase(); - String mobile = - localFilteredInPatientItems[i].mobileNumber.toUpperCase(); - String patientID = - localFilteredInPatientItems[i].patientId.toString(); - - if (firstName.contains(query.toUpperCase()) || - lastName.contains(query.toUpperCase()) || - mobile.contains(query) || - patientID.contains(query)) { + String firstName = localFilteredInPatientItems[i].firstName!.toUpperCase(); + String lastName = localFilteredInPatientItems[i].lastName!.toUpperCase(); + String mobile = localFilteredInPatientItems[i].mobileNumber!.toUpperCase(); + String patientID = localFilteredInPatientItems[i].patientId.toString(); + + if (firstName.contains(query.toUpperCase()) || lastName.contains(query.toUpperCase()) || mobile.contains(query) || patientID.contains(query)) { filteredInPatientItems.add(localFilteredInPatientItems[i]); } } notifyListeners(); } else { - if (localFilteredInPatientItems.length > 0) - filteredInPatientItems.clear(); + if (localFilteredInPatientItems.length > 0) filteredInPatientItems.clear(); filteredInPatientItems.addAll(localFilteredInPatientItems); notifyListeners(); } @@ -399,8 +324,7 @@ class PatientSearchViewModel extends BaseViewModel { } } - getSpecialClinicalCareMappingList(clinicId, - {bool isLocalBusy = false}) async { + getSpecialClinicalCareMappingList(clinicId, {bool isLocalBusy = false}) async { if (isLocalBusy) { setState(ViewState.BusyLocal); } else { diff --git a/lib/core/viewModel/SOAP_view_model.dart b/lib/core/viewModel/SOAP_view_model.dart index a145fa89..c46bb9c3 100644 --- a/lib/core/viewModel/SOAP_view_model.dart +++ b/lib/core/viewModel/SOAP_view_model.dart @@ -45,54 +45,41 @@ class SOAPViewModel extends BaseViewModel { List get allergiesList => _SOAPService.allergiesList; - List get allergySeverityList => - _SOAPService.allergySeverityList; + List get allergySeverityList => _SOAPService.allergySeverityList; List get historyFamilyList => _SOAPService.historyFamilyList; - List get historyMedicalList => - _SOAPService.historyMedicalList; + List get historyMedicalList => _SOAPService.historyMedicalList; List get historySportList => _SOAPService.historySportList; List get historySocialList => _SOAPService.historySocialList; - List get historySurgicalList => - _SOAPService.historySurgicalList; + List get historySurgicalList => _SOAPService.historySurgicalList; - List get mergeHistorySurgicalWithHistorySportList => - [...historySurgicalList, ...historySportList]; + List get mergeHistorySurgicalWithHistorySportList => [...historySurgicalList, ...historySportList]; - List get physicalExaminationList => - _SOAPService.physicalExaminationList; + List get physicalExaminationList => _SOAPService.physicalExaminationList; - List get listOfDiagnosisType => - _SOAPService.listOfDiagnosisType; + List get listOfDiagnosisType => _SOAPService.listOfDiagnosisType; - List get listOfDiagnosisCondition => - _SOAPService.listOfDiagnosisCondition; + List get listOfDiagnosisCondition => _SOAPService.listOfDiagnosisCondition; List get listOfICD10 => _SOAPService.listOfICD10; - List get patientChiefComplaintList => - _SOAPService.patientChiefComplaintList; + List get patientChiefComplaintList => _SOAPService.patientChiefComplaintList; - List get patientAllergiesList => - _SOAPService.patientAllergiesList; + List get patientAllergiesList => _SOAPService.patientAllergiesList; - List get patientHistoryList => - _SOAPService.patientHistoryList; + List get patientHistoryList => _SOAPService.patientHistoryList; - List get patientPhysicalExamList => - _SOAPService.patientPhysicalExamList; + List get patientPhysicalExamList => _SOAPService.patientPhysicalExamList; - List get patientProgressNoteList => - _SOAPService.patientProgressNoteList; + List get patientProgressNoteList => _SOAPService.patientProgressNoteList; - List get patientAssessmentList => - _SOAPService.patientAssessmentList; + List get patientAssessmentList => _SOAPService.patientAssessmentList; - int get episodeID => _SOAPService.episodeID; + int get episodeID => _SOAPService.episodeID!; bool isAddProgress = true; bool isAddExamInProgress = true; @@ -109,50 +96,49 @@ class SOAPViewModel extends BaseViewModel { get medicationFrequencyList => _SOAPService.medicationFrequencyListWithModel; - List get allMedicationList => - _prescriptionService.allMedicationList; + List get allMedicationList => _prescriptionService.allMedicationList; - SubjectiveCallBack subjectiveCallBack; + SubjectiveCallBack? subjectiveCallBack; setSubjectiveCallBack(SubjectiveCallBack callBack) { this.subjectiveCallBack = callBack; } nextOnSubjectPage(model) { - subjectiveCallBack.nextFunction(model); + subjectiveCallBack!.nextFunction(model); } - ObjectiveCallBack objectiveCallBack; + ObjectiveCallBack? objectiveCallBack; setObjectiveCallBack(ObjectiveCallBack callBack) { this.objectiveCallBack = callBack; } nextOnObjectivePage(model) { - objectiveCallBack.nextFunction(model); + objectiveCallBack!.nextFunction(model); } - AssessmentCallBack assessmentCallBack; + AssessmentCallBack? assessmentCallBack; setAssessmentCallBack(AssessmentCallBack callBack) { this.assessmentCallBack = callBack; } nextOnAssessmentPage(model) { - assessmentCallBack.nextFunction(model); + assessmentCallBack!.nextFunction(model); } - PlanCallBack planCallBack; + PlanCallBack? planCallBack; setPlanCallBack(PlanCallBack callBack) { this.planCallBack = callBack; } nextOnPlanPage(model) { - planCallBack.nextFunction(model); + planCallBack!.nextFunction(model); } - Future getMasterLookup(MasterKeysService masterKeys, - {bool isBusyLocal = false}) async { + + Future getMasterLookup(MasterKeysService masterKeys, {bool isBusyLocal = false}) async { if (isBusyLocal) { setState(ViewState.Busy); } else @@ -175,12 +161,9 @@ class SOAPViewModel extends BaseViewModel { setState(ViewState.Idle); } - Future postEpisodeForInPatient( - PostEpisodeForInpatientRequestModel - postEpisodeForInpatientRequestModel) async { + Future postEpisodeForInPatient(PostEpisodeForInpatientRequestModel postEpisodeForInpatientRequestModel) async { setState(ViewState.BusyLocal); - await _SOAPService.postEpisodeForInPatient( - postEpisodeForInpatientRequestModel); + await _SOAPService.postEpisodeForInPatient(postEpisodeForInpatientRequestModel); if (_SOAPService.hasError) { error = _SOAPService.error; setState(ViewState.ErrorLocal); @@ -188,8 +171,7 @@ class SOAPViewModel extends BaseViewModel { setState(ViewState.Idle); } - Future postPhysicalExam( - PostPhysicalExamRequestModel postPhysicalExamRequestModel) async { + Future postPhysicalExam(PostPhysicalExamRequestModel postPhysicalExamRequestModel) async { setState(ViewState.BusyLocal); await _SOAPService.postPhysicalExam(postPhysicalExamRequestModel); if (_SOAPService.hasError) { @@ -199,8 +181,7 @@ class SOAPViewModel extends BaseViewModel { setState(ViewState.Idle); } - Future postProgressNote( - PostProgressNoteRequestModel postProgressNoteRequestModel) async { + Future postProgressNote(PostProgressNoteRequestModel postProgressNoteRequestModel) async { setState(ViewState.BusyLocal); await _SOAPService.postProgressNote(postProgressNoteRequestModel); if (_SOAPService.hasError) { @@ -210,8 +191,7 @@ class SOAPViewModel extends BaseViewModel { setState(ViewState.Idle); } - Future postAssessment( - PostAssessmentRequestModel postAssessmentRequestModel) async { + Future postAssessment(PostAssessmentRequestModel postAssessmentRequestModel) async { setState(ViewState.BusyLocal); await _SOAPService.postAssessment(postAssessmentRequestModel); if (_SOAPService.hasError) { @@ -221,8 +201,7 @@ class SOAPViewModel extends BaseViewModel { setState(ViewState.Idle); } - Future patchPhysicalExam( - PostPhysicalExamRequestModel patchPhysicalExamRequestModel) async { + Future patchPhysicalExam(PostPhysicalExamRequestModel patchPhysicalExamRequestModel) async { setState(ViewState.BusyLocal); await _SOAPService.patchPhysicalExam(patchPhysicalExamRequestModel); if (_SOAPService.hasError) { @@ -232,8 +211,7 @@ class SOAPViewModel extends BaseViewModel { setState(ViewState.Idle); } - Future patchProgressNote( - PostProgressNoteRequestModel patchProgressNoteRequestModel) async { + Future patchProgressNote(PostProgressNoteRequestModel patchProgressNoteRequestModel) async { setState(ViewState.BusyLocal); await _SOAPService.patchProgressNote(patchProgressNoteRequestModel); if (_SOAPService.hasError) { @@ -243,8 +221,7 @@ class SOAPViewModel extends BaseViewModel { setState(ViewState.Idle); } - Future patchAssessment( - PatchAssessmentReqModel patchAssessmentRequestModel) async { + Future patchAssessment(PatchAssessmentReqModel patchAssessmentRequestModel) async { setState(ViewState.BusyLocal); await _SOAPService.patchAssessment(patchAssessmentRequestModel); if (_SOAPService.hasError) { @@ -254,8 +231,7 @@ class SOAPViewModel extends BaseViewModel { setState(ViewState.Idle); } - Future getPatientAllergy(GeneralGetReqForSOAP generalGetReqForSOAP, - {isLocalBusy = false}) async { + Future getPatientAllergy(GeneralGetReqForSOAP generalGetReqForSOAP, {isLocalBusy = false}) async { if (isLocalBusy) { setState(ViewState.BusyLocal); } else @@ -274,14 +250,8 @@ class SOAPViewModel extends BaseViewModel { String getAllergicNames(isArabic) { String allergiesString = ''; patientAllergiesList.forEach((element) { - MasterKeyModel selectedAllergy = getOneMasterKey( - masterKeys: MasterKeysService.Allergies, - id: element.allergyDiseaseId, - typeId: element.allergyDiseaseType); - if (selectedAllergy != null && element.isChecked) - allergiesString += - (isArabic ? selectedAllergy.nameAr : selectedAllergy.nameEn) + - ' , '; + MasterKeyModel selectedAllergy = getOneMasterKey(masterKeys: MasterKeysService.Allergies, id: element.allergyDiseaseId, typeId: element.allergyDiseaseType); + if (selectedAllergy != null && element.isChecked!) allergiesString += (isArabic ? selectedAllergy.nameAr : selectedAllergy.nameEn)! + ' , '; }); return allergiesString; } @@ -291,17 +261,15 @@ class SOAPViewModel extends BaseViewModel { ) async { GetPhysicalExamReqModel getPhysicalExamReqModel = GetPhysicalExamReqModel( patientMRN: patientInfo.patientMRN, - episodeID: patientInfo.episodeNo == null - ? "0" - : patientInfo.episodeNo.toString(), + episodeID: patientInfo.episodeNo == null ? "0" : patientInfo.episodeNo.toString(), appointmentNo: patientInfo.appointmentNo == null ? 0 : int.parse( patientInfo.appointmentNo.toString(), ), ); - if (patientInfo.admissionNo != null && patientInfo.admissionNo.isNotEmpty) - getPhysicalExamReqModel.admissionNo = int.parse(patientInfo.admissionNo); + if (patientInfo.admissionNo != null && patientInfo.admissionNo!.isNotEmpty) + getPhysicalExamReqModel.admissionNo = int.parse(patientInfo.admissionNo!); else getPhysicalExamReqModel.admissionNo = 0; setState(ViewState.Busy); @@ -313,8 +281,7 @@ class SOAPViewModel extends BaseViewModel { setState(ViewState.Idle); } - Future getPatientProgressNote( - GetProgressNoteReqModel getGetProgressNoteReqModel) async { + Future getPatientProgressNote(GetProgressNoteReqModel getGetProgressNoteReqModel) async { setState(ViewState.Busy); await _SOAPService.getPatientProgressNote(getGetProgressNoteReqModel); if (_SOAPService.hasError) { @@ -324,7 +291,6 @@ class SOAPViewModel extends BaseViewModel { setState(ViewState.Idle); } - Future getMedicationList() async { setState(ViewState.Busy); await _prescriptionService.getMedicationList(); @@ -337,11 +303,7 @@ class SOAPViewModel extends BaseViewModel { Future getEpisodeForInpatient(PatiantInformtion patient) async { setState(ViewState.BusyLocal); - GetEpisodeForInpatientReqModel getEpisodeForInpatientReqModel = - GetEpisodeForInpatientReqModel( - patientID: patient.patientId, - admissionNo: int.parse(patient.admissionNo), - patientTypeID: 1); + GetEpisodeForInpatientReqModel getEpisodeForInpatientReqModel = GetEpisodeForInpatientReqModel(patientID: patient.patientId, admissionNo: int.parse(patient.admissionNo!), patientTypeID: 1); await _SOAPService.getEpisodeForInpatient(getEpisodeForInpatientReqModel); if (_SOAPService.hasError) { error = _SOAPService.error; @@ -353,13 +315,11 @@ class SOAPViewModel extends BaseViewModel { } // ignore: missing_return - MasterKeyModel getOneMasterKey( - {@required MasterKeysService masterKeys, dynamic id, int typeId}) { + MasterKeyModel getOneMasterKey({required MasterKeysService masterKeys, dynamic id, int? typeId}) { switch (masterKeys) { case MasterKeysService.Allergies: List result = allergiesList.where((element) { - return element.id == id && - element.typeId == masterKeys.getMasterKeyService(); + return element.id == id && element.typeId == masterKeys.getMasterKeyService(); }).toList(); if (result.isNotEmpty) { return result.first; @@ -368,8 +328,7 @@ class SOAPViewModel extends BaseViewModel { case MasterKeysService.HistoryFamily: List result = historyFamilyList.where((element) { - return element.id == id && - element.typeId == masterKeys.getMasterKeyService(); + return element.id == id && element.typeId == masterKeys.getMasterKeyService(); }).toList(); if (result.isNotEmpty) { return result.first; @@ -377,8 +336,7 @@ class SOAPViewModel extends BaseViewModel { break; case MasterKeysService.HistoryMedical: List result = historyMedicalList.where((element) { - return element.id == id && - element.typeId == masterKeys.getMasterKeyService(); + return element.id == id && element.typeId == masterKeys.getMasterKeyService(); }).toList(); if (result.isNotEmpty) { return result.first; @@ -386,8 +344,7 @@ class SOAPViewModel extends BaseViewModel { break; case MasterKeysService.HistorySocial: List result = historySocialList.where((element) { - return element.id == id && - element.typeId == masterKeys.getMasterKeyService(); + return element.id == id && element.typeId == masterKeys.getMasterKeyService(); }).toList(); if (result.isNotEmpty) { return result.first; @@ -395,8 +352,7 @@ class SOAPViewModel extends BaseViewModel { break; case MasterKeysService.HistorySports: List result = historySocialList.where((element) { - return element.id == id && - element.typeId == masterKeys.getMasterKeyService(); + return element.id == id && element.typeId == masterKeys.getMasterKeyService(); }).toList(); if (result.isNotEmpty) { return result.first; @@ -412,8 +368,7 @@ class SOAPViewModel extends BaseViewModel { break; case MasterKeysService.PhysicalExamination: List result = physicalExaminationList.where((element) { - return element.id == id && - element.typeId == masterKeys.getMasterKeyService(); + return element.id == id && element.typeId == masterKeys.getMasterKeyService(); }).toList(); if (result.isNotEmpty) { return result.first; @@ -421,8 +376,7 @@ class SOAPViewModel extends BaseViewModel { break; case MasterKeysService.AllergySeverity: List result = allergySeverityList.where((element) { - return element.id == id && - element.typeId == masterKeys.getMasterKeyService(); + return element.id == id && element.typeId == masterKeys.getMasterKeyService(); }).toList(); if (result.isNotEmpty) { return result.first; @@ -430,8 +384,7 @@ class SOAPViewModel extends BaseViewModel { break; case MasterKeysService.DiagnosisType: List result = listOfDiagnosisType.where((element) { - return element.id == id && - element.typeId == masterKeys.getMasterKeyService(); + return element.id == id && element.typeId == masterKeys.getMasterKeyService(); }).toList(); if (result.isNotEmpty) { return result.first; @@ -439,8 +392,7 @@ class SOAPViewModel extends BaseViewModel { break; case MasterKeysService.DiagnosisCondition: List result = listOfDiagnosisCondition.where((element) { - return element.id == id && - element.typeId == masterKeys.getMasterKeyService(); + return element.id == id && element.typeId == masterKeys.getMasterKeyService(); }).toList(); if (result.isNotEmpty) { return result.first; @@ -454,14 +406,35 @@ class SOAPViewModel extends BaseViewModel { return result.first; } break; + + case MasterKeysService.physiotherapyGoals: + break; + case MasterKeysService.TemperatureMethods: + break; + case MasterKeysService.Speciality: + break; + case MasterKeysService.MedicationStrength: + break; + case MasterKeysService.MedicationDuration: + break; + case MasterKeysService.MedicationRoute: + break; + case MasterKeysService.MedicationFrequency: + break; + case MasterKeysService.MedicationDoseTime: + break; + case MasterKeysService.MedicationIndications: + break; + case MasterKeysService.AdmissionRequestType: + break; + case MasterKeysService.DiagnosisSelectionType: break; } + return MasterKeyModel(); } - int getFirstIndexForOldExamination( - List mySelectedExamination) { - Iterable examList = - mySelectedExamination.where((element) => !element.isLocal); + int getFirstIndexForOldExamination(List mySelectedExamination) { + Iterable examList = mySelectedExamination.where((element) => !element.isLocal!); if (examList.length > 0) { return mySelectedExamination.indexOf(examList.first); @@ -470,44 +443,25 @@ class SOAPViewModel extends BaseViewModel { } onUpdateSubjectStepStart(PatiantInformtion patientInfo) async { - GetChiefComplaintReqModel getChiefComplaintReqModel = - GetChiefComplaintReqModel( - admissionNo: - patientInfo - .admissionNo != - null - ? int.parse(patientInfo.admissionNo) - : null, - patientMRN: patientInfo.patientMRN, - appointmentNo: patientInfo.appointmentNo != null - ? int.parse(patientInfo.appointmentNo.toString()) - : null, - episodeId: patientInfo.episodeNo, - episodeID: patientInfo.episodeNo, - doctorID: ''); - var services = [ - _SOAPService.getPatientChiefComplaint(getChiefComplaintReqModel) - ]; + GetChiefComplaintReqModel getChiefComplaintReqModel = GetChiefComplaintReqModel( + admissionNo: patientInfo.admissionNo != null ? int.parse(patientInfo.admissionNo!) : null, + patientMRN: patientInfo.patientMRN, + appointmentNo: patientInfo.appointmentNo != null ? int.parse(patientInfo.appointmentNo.toString()) : null, + episodeId: patientInfo.episodeNo, + episodeID: patientInfo.episodeNo, + doctorID: ''); + var services = [_SOAPService.getPatientChiefComplaint(getChiefComplaintReqModel)]; if (patientInfo.admissionNo == null) { complaintsControllerError = ''; medicationControllerError = ''; illnessControllerError = ''; GetHistoryReqModel getHistoryReqModel = GetHistoryReqModel( - patientMRN: patientInfo.patientMRN, - episodeID: patientInfo.episodeNo.toString(), - appointmentNo: int.parse(patientInfo.appointmentNo.toString()), - doctorID: '', - editedBy: ''); - services.add( - _SOAPService.getPatientHistories(getHistoryReqModel, isFirst: true)); - - GeneralGetReqForSOAP generalGetReqForSOAP = GeneralGetReqForSOAP( - patientMRN: patientInfo.patientMRN, - episodeId: patientInfo.episodeNo, - appointmentNo: int.parse(patientInfo.appointmentNo.toString()), - doctorID: '', - editedBy: ''); + patientMRN: patientInfo.patientMRN, episodeID: patientInfo.episodeNo.toString(), appointmentNo: int.parse(patientInfo.appointmentNo.toString()), doctorID: '', editedBy: ''); + services.add(_SOAPService.getPatientHistories(getHistoryReqModel, isFirst: true)); + + GeneralGetReqForSOAP generalGetReqForSOAP = + GeneralGetReqForSOAP(patientMRN: patientInfo.patientMRN, episodeId: patientInfo.episodeNo, appointmentNo: int.parse(patientInfo.appointmentNo.toString()), doctorID: '', editedBy: ''); services.add(_SOAPService.getPatientAllergy(generalGetReqForSOAP)); } @@ -521,40 +475,28 @@ class SOAPViewModel extends BaseViewModel { if (patientHistoryList.isNotEmpty) { if (historyFamilyList.isEmpty) { if (services == null) { - services = [ - _SOAPService.getMasterLookup(MasterKeysService.HistoryFamily) - ]; + services = [_SOAPService.getMasterLookup(MasterKeysService.HistoryFamily)]; } else { - services.add( - _SOAPService.getMasterLookup(MasterKeysService.HistoryFamily)); + services.add(_SOAPService.getMasterLookup(MasterKeysService.HistoryFamily)); } } if (historyMedicalList.isEmpty) { if (services == null) { - services = [ - _SOAPService.getMasterLookup(MasterKeysService.HistoryMedical) - ]; + services = [_SOAPService.getMasterLookup(MasterKeysService.HistoryMedical)]; } else - services.add( - _SOAPService.getMasterLookup(MasterKeysService.HistoryMedical)); + services.add(_SOAPService.getMasterLookup(MasterKeysService.HistoryMedical)); } if (historySurgicalList.length == 0) { if (services == null) { - services = [ - _SOAPService.getMasterLookup(MasterKeysService.HistorySurgical) - ]; + services = [_SOAPService.getMasterLookup(MasterKeysService.HistorySurgical)]; } else - services.add( - _SOAPService.getMasterLookup(MasterKeysService.HistorySurgical)); + services.add(_SOAPService.getMasterLookup(MasterKeysService.HistorySurgical)); } if (historySportList.length == 0) { if (services == null) { - services = [ - _SOAPService.getMasterLookup(MasterKeysService.HistorySports) - ]; + services = [_SOAPService.getMasterLookup(MasterKeysService.HistorySports)]; } else - services.add( - _SOAPService.getMasterLookup(MasterKeysService.HistorySports)); + services.add(_SOAPService.getMasterLookup(MasterKeysService.HistorySports)); } } @@ -565,12 +507,9 @@ class SOAPViewModel extends BaseViewModel { services.add(_SOAPService.getMasterLookup(MasterKeysService.Allergies)); if (allergySeverityList.isEmpty) { if (services == null) { - services = [ - _SOAPService.getMasterLookup(MasterKeysService.AllergySeverity) - ]; + services = [_SOAPService.getMasterLookup(MasterKeysService.AllergySeverity)]; } else - services.add( - _SOAPService.getMasterLookup(MasterKeysService.AllergySeverity)); + services.add(_SOAPService.getMasterLookup(MasterKeysService.AllergySeverity)); } } @@ -588,42 +527,30 @@ class SOAPViewModel extends BaseViewModel { var services; if (medicationStrengthList.length == 0) { if (services == null) { - services = [ - _SOAPService.getMasterLookup(MasterKeysService.MedicationStrength) - ]; + services = [_SOAPService.getMasterLookup(MasterKeysService.MedicationStrength)]; } else { - services.add( - _SOAPService.getMasterLookup(MasterKeysService.MedicationStrength)); + services.add(_SOAPService.getMasterLookup(MasterKeysService.MedicationStrength)); } } if (medicationFrequencyList.length == 0) { if (services == null) { - services = [ - _SOAPService.getMasterLookup(MasterKeysService.MedicationFrequency) - ]; + services = [_SOAPService.getMasterLookup(MasterKeysService.MedicationFrequency)]; } else { - services.add(_SOAPService.getMasterLookup( - MasterKeysService.MedicationFrequency)); + services.add(_SOAPService.getMasterLookup(MasterKeysService.MedicationFrequency)); } } if (medicationDoseTimeList.length == 0) { if (services == null) { - services = [ - _SOAPService.getMasterLookup(MasterKeysService.MedicationDoseTime) - ]; + services = [_SOAPService.getMasterLookup(MasterKeysService.MedicationDoseTime)]; } else { - services.add( - _SOAPService.getMasterLookup(MasterKeysService.MedicationDoseTime)); + services.add(_SOAPService.getMasterLookup(MasterKeysService.MedicationDoseTime)); } } if (medicationRouteList.length == 0) { if (services == null) { - services = [ - _SOAPService.getMasterLookup(MasterKeysService.MedicationRoute) - ]; + services = [_SOAPService.getMasterLookup(MasterKeysService.MedicationRoute)]; } else { - services.add( - _SOAPService.getMasterLookup(MasterKeysService.MedicationRoute)); + services.add(_SOAPService.getMasterLookup(MasterKeysService.MedicationRoute)); } } if (allMedicationList.length == 0) { @@ -637,7 +564,7 @@ class SOAPViewModel extends BaseViewModel { final results = await Future.wait(services ?? []); if (_SOAPService.hasError || _prescriptionService.hasError) { - error = _SOAPService.error + _prescriptionService.error; + error = _SOAPService.error! + _prescriptionService.error!; setState(ViewState.ErrorLocal); } else setState(ViewState.Idle); @@ -645,25 +572,19 @@ class SOAPViewModel extends BaseViewModel { callAddAssessmentLookupsServices({bool allowSetState = true}) async { if (allowSetState) setState(ViewState.Busy); - var services; + dynamic services; if (listOfDiagnosisCondition.length == 0) { if (services == null) { - services = [ - _SOAPService.getMasterLookup(MasterKeysService.DiagnosisCondition) - ]; + services = [_SOAPService.getMasterLookup(MasterKeysService.DiagnosisCondition)]; } else { - services.add( - _SOAPService.getMasterLookup(MasterKeysService.DiagnosisCondition)); + services.add(_SOAPService.getMasterLookup(MasterKeysService.DiagnosisCondition)); } } if (listOfDiagnosisType.length == 0) { if (services == null) { - services = [ - _SOAPService.getMasterLookup(MasterKeysService.DiagnosisType) - ]; + services = [_SOAPService.getMasterLookup(MasterKeysService.DiagnosisType)]; } else { - services - .add(_SOAPService.getMasterLookup(MasterKeysService.DiagnosisType)); + services.add(_SOAPService.getMasterLookup(MasterKeysService.DiagnosisType)); } } if (listOfICD10.length == 0) { @@ -686,11 +607,14 @@ class SOAPViewModel extends BaseViewModel { onUpdateAssessmentStepStart(PatiantInformtion patientInfo) async { GetAssessmentReqModel getAssessmentReqModel = GetAssessmentReqModel( - patientMRN: patientInfo.patientMRN, - episodeID: patientInfo.episodeNo.toString(), - editedBy: '', - doctorID: '', - appointmentNo: int.parse(patientInfo.appointmentNo.toString())); + patientMRN: patientInfo.patientMRN!, + episodeID: patientInfo.episodeNo.toString(), + editedBy: '', + doctorID: '', + appointmentNo: int.parse( + patientInfo.appointmentNo.toString(), + ), + ); var services = [_SOAPService.getPatientAssessment(getAssessmentReqModel)]; @@ -707,37 +631,32 @@ class SOAPViewModel extends BaseViewModel { setState(ViewState.Idle); } - postSubjectServices( - {patientInfo, - String complaintsText, - String medicationText, - String illnessText, - List myHistoryList, - List myAllergiesList}) async { + postSubjectServices({ + patientInfo, + String? complaintsText, + String? medicationText, + String? illnessText, + List? myHistoryList, + List? myAllergiesList, + }) async { var services; - PostChiefComplaintRequestModel postChiefComplaintRequestModel = - createPostChiefComplaintRequestModel( - patientInfo: patientInfo, - illnessText: illnessText, - medicationText: medicationText, - complaintsText: complaintsText); + PostChiefComplaintRequestModel postChiefComplaintRequestModel = createPostChiefComplaintRequestModel( + patientInfo: patientInfo, + illnessText: illnessText!, + medicationText: medicationText!, + complaintsText: complaintsText!, + ); if (patientChiefComplaintList.isEmpty) { postChiefComplaintRequestModel.editedBy = ''; - services = [ - _SOAPService.postChiefComplaint(postChiefComplaintRequestModel) - ]; + services = [_SOAPService.postChiefComplaint(postChiefComplaintRequestModel)]; } else { postChiefComplaintRequestModel.editedBy = ''; - services = [ - _SOAPService.patchChiefComplaint(postChiefComplaintRequestModel) - ]; + services = [_SOAPService.patchChiefComplaint(postChiefComplaintRequestModel)]; } - if (myHistoryList.length != 0) { - PostHistoriesRequestModel postHistoriesRequestModel = - createPostHistoriesRequestModel( - patientInfo: patientInfo, myHistoryList: myHistoryList); + if (myHistoryList!.length != 0) { + PostHistoriesRequestModel postHistoriesRequestModel = createPostHistoriesRequestModel(patientInfo: patientInfo, myHistoryList: myHistoryList); if (patientHistoryList.isEmpty) { services.add(_SOAPService.postHistories(postHistoriesRequestModel)); @@ -746,10 +665,8 @@ class SOAPViewModel extends BaseViewModel { } } - if (myAllergiesList.length != 0) { - PostAllergyRequestModel postAllergyRequestModel = - createPostAllergyRequestModel( - myAllergiesList: myAllergiesList, patientInfo: patientInfo); + if (myAllergiesList!.length != 0) { + PostAllergyRequestModel postAllergyRequestModel = createPostAllergyRequestModel(myAllergiesList: myAllergiesList, patientInfo: patientInfo); if (patientAllergiesList.isEmpty) { services.add(_SOAPService.postAllergy(postAllergyRequestModel)); } else { @@ -766,15 +683,14 @@ class SOAPViewModel extends BaseViewModel { setState(ViewState.Idle); } - PostChiefComplaintRequestModel createPostChiefComplaintRequestModel( - {patientInfo, - String complaintsText, - String medicationText, - String illnessText}) { + PostChiefComplaintRequestModel createPostChiefComplaintRequestModel({ + patientInfo, + String? complaintsText, + String? medicationText, + String? illnessText, + }) { return new PostChiefComplaintRequestModel( - admissionNo: patientInfo.admissionNo != null - ? int.parse(patientInfo.admissionNo) - : null, + admissionNo: patientInfo.admissionNo != null ? int.parse(patientInfo.admissionNo) : null, patientMRN: patientInfo.patientMRN, episodeID: patientInfo.episodeNo ?? 0, appointmentNo: patientInfo.appointmentNo ?? 0, @@ -787,20 +703,17 @@ class SOAPViewModel extends BaseViewModel { numberOfWeeks: 0); } - PostHistoriesRequestModel createPostHistoriesRequestModel( - {patientInfo, List myHistoryList}) { - PostHistoriesRequestModel postHistoriesRequestModel = - new PostHistoriesRequestModel(doctorID: ''); - myHistoryList.forEach((history) { - if (postHistoriesRequestModel.listMedicalHistoryVM == null) - postHistoriesRequestModel.listMedicalHistoryVM = []; - postHistoriesRequestModel.listMedicalHistoryVM.add(ListMedicalHistoryVM( + PostHistoriesRequestModel createPostHistoriesRequestModel({patientInfo, List? myHistoryList}) { + PostHistoriesRequestModel postHistoriesRequestModel = new PostHistoriesRequestModel(doctorID: ''); + myHistoryList!.forEach((history) { + if (postHistoriesRequestModel.listMedicalHistoryVM == null) postHistoriesRequestModel.listMedicalHistoryVM = []; + postHistoriesRequestModel.listMedicalHistoryVM!.add(ListMedicalHistoryVM( patientMRN: patientInfo.patientMRN, episodeId: patientInfo.episodeNo, appointmentNo: patientInfo.appointmentNo, remarks: "", - historyId: history.selectedHistory.id, - historyType: history.selectedHistory.typeId, + historyId: history.selectedHistory!.id, + historyType: history.selectedHistory!.typeId, isChecked: history.isChecked, )); }); @@ -808,29 +721,24 @@ class SOAPViewModel extends BaseViewModel { return postHistoriesRequestModel; } - PostAllergyRequestModel createPostAllergyRequestModel( - {myAllergiesList, patientInfo}) { - PostAllergyRequestModel postAllergyRequestModel = - new PostAllergyRequestModel(); + PostAllergyRequestModel createPostAllergyRequestModel({myAllergiesList, patientInfo}) { + PostAllergyRequestModel postAllergyRequestModel = new PostAllergyRequestModel(); myAllergiesList.forEach((allergy) { - if (postAllergyRequestModel.listHisProgNotePatientAllergyDiseaseVM == - null) - postAllergyRequestModel.listHisProgNotePatientAllergyDiseaseVM = []; - postAllergyRequestModel.listHisProgNotePatientAllergyDiseaseVM.add( - ListHisProgNotePatientAllergyDiseaseVM( - allergyDiseaseId: allergy.selectedAllergy.id, - allergyDiseaseType: allergy.selectedAllergy.typeId, - patientMRN: patientInfo.patientMRN, - episodeId: patientInfo.episodeNo, - appointmentNo: patientInfo.appointmentNo, - severity: allergy.selectedAllergySeverity.id, - remarks: allergy.remark, - createdBy: allergy.createdBy ?? doctorProfile.doctorID, - createdOn: DateTime.now().toIso8601String(), - editedBy: doctorProfile.doctorID, - editedOn: DateTime.now().toIso8601String(), - isChecked: allergy.isChecked, - isUpdatedByNurse: false)); + if (postAllergyRequestModel.listHisProgNotePatientAllergyDiseaseVM == null) postAllergyRequestModel.listHisProgNotePatientAllergyDiseaseVM = []; + postAllergyRequestModel.listHisProgNotePatientAllergyDiseaseVM!.add(ListHisProgNotePatientAllergyDiseaseVM( + allergyDiseaseId: allergy.selectedAllergy.id, + allergyDiseaseType: allergy.selectedAllergy.typeId, + patientMRN: patientInfo.patientMRN, + episodeId: patientInfo.episodeNo, + appointmentNo: patientInfo.appointmentNo, + severity: allergy.selectedAllergySeverity.id, + remarks: allergy.remark, + createdBy: allergy.createdBy ?? doctorProfile!.doctorID, + createdOn: DateTime.now().toIso8601String(), + editedBy: doctorProfile!.doctorID!, + editedOn: DateTime.now().toIso8601String(), + isChecked: allergy.isChecked, + isUpdatedByNurse: false)); }); return postAllergyRequestModel; diff --git a/lib/core/viewModel/authentication_view_model.dart b/lib/core/viewModel/authentication_view_model.dart index 9f0b28e5..f7b8dcbf 100644 --- a/lib/core/viewModel/authentication_view_model.dart +++ b/lib/core/viewModel/authentication_view_model.dart @@ -26,8 +26,8 @@ import 'package:doctor_app_flutter/utils/utils.dart'; import 'package:doctor_app_flutter/utils/translations_delegate_base_utils.dart'; import 'package:firebase_messaging/firebase_messaging.dart'; import 'package:flutter/services.dart'; -import 'package:local_auth/auth_strings.dart'; import 'package:local_auth/local_auth.dart'; +import 'package:local_auth_ios/local_auth_ios.dart'; enum APP_STATUS { LOADING, UNAUTHENTICATED, AUTHENTICATED, UNVERIFIED } @@ -41,27 +41,21 @@ class AuthenticationViewModel extends BaseViewModel { NewLoginInformationModel get loginInfo => _authService.loginInfo; - List get doctorProfilesList => - _authService.doctorProfilesList; + List get doctorProfilesList => _authService.doctorProfilesList; - SendActivationCodeForDoctorAppResponseModel - get activationCodeVerificationScreenRes => - _authService.activationCodeVerificationScreenRes; + SendActivationCodeForDoctorAppResponseModel get activationCodeVerificationScreenRes => _authService.activationCodeVerificationScreenRes; - SendActivationCodeForDoctorAppResponseModel - get activationCodeForDoctorAppRes => - _authService.activationCodeForDoctorAppRes; + SendActivationCodeForDoctorAppResponseModel get activationCodeForDoctorAppRes => _authService.activationCodeForDoctorAppRes; - CheckActivationCodeForDoctorAppResponseModel - get checkActivationCodeForDoctorAppRes => - _authService.checkActivationCodeForDoctorAppRes; + CheckActivationCodeForDoctorAppResponseModel get checkActivationCodeForDoctorAppRes => _authService.checkActivationCodeForDoctorAppRes; - NewLoginInformationModel loggedUser; - GetIMEIDetailsModel user; + NewLoginInformationModel? loggedUser; + + GetIMEIDetailsModel user = GetIMEIDetailsModel(); UserModel userInfo = UserModel(); final LocalAuthentication auth = LocalAuthentication(); - List _availableBiometrics; + List? _availableBiometrics; final FirebaseMessaging _firebaseMessaging = FirebaseMessaging.instance; bool isLogin = false; @@ -88,32 +82,20 @@ class AuthenticationViewModel extends BaseViewModel { profileInfo['IMEI'] = token; profileInfo['LogInTypeID'] = await sharedPref.getInt(OTP_TYPE); profileInfo['BioMetricEnabled'] = true; - profileInfo['MobileNo'] = - loggedIn != null ? loggedIn['MobileNumber'] : user.mobile; - InsertIMEIDetailsModel insertIMEIDetailsModel = - InsertIMEIDetailsModel.fromJson(profileInfo); - insertIMEIDetailsModel.genderDescription = - profileInfo['Gender_Description']; - insertIMEIDetailsModel.genderDescriptionN = - profileInfo['Gender_DescriptionN']; - insertIMEIDetailsModel.genderDescriptionN = - profileInfo['Gender_DescriptionN']; + profileInfo['MobileNo'] = loggedIn != null ? loggedIn['MobileNumber'] : user.mobile; + InsertIMEIDetailsModel insertIMEIDetailsModel = InsertIMEIDetailsModel.fromJson(profileInfo); + insertIMEIDetailsModel.genderDescription = profileInfo['Gender_Description']; + insertIMEIDetailsModel.genderDescriptionN = profileInfo['Gender_DescriptionN']; + insertIMEIDetailsModel.genderDescriptionN = profileInfo['Gender_DescriptionN']; insertIMEIDetailsModel.titleDescription = profileInfo['Title_Description']; - insertIMEIDetailsModel.titleDescriptionN = - profileInfo['Title_DescriptionN']; + insertIMEIDetailsModel.titleDescriptionN = profileInfo['Title_DescriptionN']; insertIMEIDetailsModel.projectID = await sharedPref.getInt(PROJECT_ID); - insertIMEIDetailsModel.doctorID = loggedIn != null - ? loggedIn['List_MemberInformation'][0]['MemberID'] - : user.doctorID; - insertIMEIDetailsModel.outSA = - loggedIn != null ? loggedIn['PatientOutSA'] : user.outSA; - insertIMEIDetailsModel.vidaAuthTokenID = - await sharedPref.getString(VIDA_AUTH_TOKEN_ID); - insertIMEIDetailsModel.vidaRefreshTokenID = - await sharedPref.getString(VIDA_REFRESH_TOKEN_ID); + insertIMEIDetailsModel.doctorID = loggedIn != null ? loggedIn['List_MemberInformation'][0]['MemberID'] : user.doctorID; + insertIMEIDetailsModel.outSA = loggedIn != null ? loggedIn['PatientOutSA'] : user.outSA; + insertIMEIDetailsModel.vidaAuthTokenID = await sharedPref.getString(VIDA_AUTH_TOKEN_ID); + insertIMEIDetailsModel.vidaRefreshTokenID = await sharedPref.getString(VIDA_REFRESH_TOKEN_ID); insertIMEIDetailsModel.password = userInfo.password; - insertIMEIDetailsModel.loginDoctorID = loggedUser != null ? loggedUser.listMemberInformation[0].employeeID - : int.parse(user.editedBy.toString()); + insertIMEIDetailsModel.loginDoctorID = loggedUser != null ? loggedUser!.listMemberInformation![0].employeeID : int.parse(user.editedBy.toString()); await _authService.insertDeviceImei(insertIMEIDetailsModel); if (_authService.hasError) { @@ -131,35 +113,32 @@ class AuthenticationViewModel extends BaseViewModel { error = _authService.error; setState(ViewState.ErrorLocal); } else { - sharedPref.setInt(PROJECT_ID, userInfo.projectID); + sharedPref.setInt(PROJECT_ID, userInfo.projectID!); loggedUser = loginInfo; saveObjToString(LOGGED_IN_USER, loginInfo); sharedPref.remove(LAST_LOGIN_USER); - sharedPref.setString(TOKEN, loginInfo.logInTokenID); + sharedPref.setString(TOKEN, loginInfo.logInTokenID!); setState(ViewState.Idle); } } /// send activation code for for msg methods - Future sendActivationCodeVerificationScreen( - AuthMethodTypes authMethodType) async { + Future sendActivationCodeVerificationScreen(AuthMethodTypes authMethodType) async { setState(ViewState.BusyLocal); - ActivationCodeForVerificationScreenModel activationCodeModel = - ActivationCodeForVerificationScreenModel( - iMEI: user.iMEI, - facilityId: user.projectID, - memberID: user.doctorID, - loginDoctorID: int.parse(user.editedBy.toString()), - zipCode: user.outSA == true ? '971' : '966', - mobileNumber: user.mobile, - oTPSendType: authMethodType.getTypeIdService(), - isMobileFingerPrint: 1, - vidaAuthTokenID: user.vidaAuthTokenID, - vidaRefreshTokenID: user.vidaRefreshTokenID); + ActivationCodeForVerificationScreenModel activationCodeModel = ActivationCodeForVerificationScreenModel( + iMEI: user.iMEI, + facilityId: user.projectID, + memberID: user.doctorID, + loginDoctorID: int.parse(user.editedBy.toString()), + zipCode: user.outSA == true ? '971' : '966', + mobileNumber: user.mobile, + oTPSendType: authMethodType.getTypeIdService(), + isMobileFingerPrint: 1, + vidaAuthTokenID: user.vidaAuthTokenID, + vidaRefreshTokenID: user.vidaRefreshTokenID); await sharedPref.setString(DOCTOR_ID, user.editedBy.toString()); - await _authService - .sendActivationCodeVerificationScreen(activationCodeModel); + await _authService.sendActivationCodeVerificationScreen(activationCodeModel); if (_authService.hasError) { error = _authService.error; setState(ViewState.ErrorLocal); @@ -168,73 +147,60 @@ class AuthenticationViewModel extends BaseViewModel { } /// send activation code for silent login - Future sendActivationCodeForDoctorApp( - {AuthMethodTypes authMethodType, String password}) async { + Future sendActivationCodeForDoctorApp({AuthMethodTypes? authMethodType, String? password}) async { setState(ViewState.BusyLocal); int projectID = await sharedPref.getInt(PROJECT_ID); ActivationCodeModel activationCodeModel = ActivationCodeModel( facilityId: projectID, - memberID: loggedUser.listMemberInformation[0].memberID, - loginDoctorID: loggedUser.listMemberInformation[0].employeeID, - otpSendType: authMethodType.getTypeIdService().toString(), + memberID: loggedUser!.listMemberInformation![0].memberID, + loginDoctorID: loggedUser!.listMemberInformation![0].employeeID, + otpSendType: authMethodType!.getTypeIdService().toString(), ); - await sharedPref.setString(DOCTOR_ID, (loggedUser.listMemberInformation[0].employeeID).toString()); + await sharedPref.setString(DOCTOR_ID, (loggedUser!.listMemberInformation![0].employeeID).toString()); await _authService.sendActivationCodeForDoctorApp(activationCodeModel); if (_authService.hasError) { error = _authService.error; setState(ViewState.ErrorLocal); } else { - await sharedPref.setString( - TOKEN, _authService.activationCodeForDoctorAppRes.logInTokenID); + await sharedPref.setString(TOKEN, _authService.activationCodeForDoctorAppRes.logInTokenID!); setState(ViewState.Idle); } } /// check activation code for sms and whats app - Future checkActivationCodeForDoctorApp( - {String activationCode, bool isSilentLogin = false}) async { + Future checkActivationCodeForDoctorApp({String? activationCode, bool isSilentLogin = false}) async { setState(ViewState.BusyLocal); - CheckActivationCodeRequestModel checkActivationCodeForDoctorApp = - new CheckActivationCodeRequestModel( - zipCode: loggedUser != null ? loggedUser.zipCode : user.zipCode, - mobileNumber: - loggedUser != null ? loggedUser.mobileNumber : user.mobile, - projectID: await sharedPref.getInt(PROJECT_ID) != null - ? await sharedPref.getInt(PROJECT_ID) - : user.projectID, - logInTokenID: await sharedPref.getString(TOKEN), - activationCode: activationCode ?? '0000', - memberID: userInfo.userID != null - ? int.parse(userInfo.userID) - : user.doctorID, - password: userInfo.password, - facilityId: userInfo.projectID != null - ? userInfo.projectID.toString() - : user.projectID.toString(), - oTPSendType: await sharedPref.getInt(OTP_TYPE), - iMEI: localToken, - loginDoctorID: loggedUser != null ? loggedUser.listMemberInformation[0].employeeID - : int.parse(user.editedBy.toString()),///loggedUser.listMemberInformation[0].employeeID, - // loggedUser.listMemberInformation[0].employeeID, - isForSilentLogin: isSilentLogin, - generalid: "Cs2020@2016\$2958"); - await _authService - .checkActivationCodeForDoctorApp(checkActivationCodeForDoctorApp); + CheckActivationCodeRequestModel checkActivationCodeForDoctorApp = new CheckActivationCodeRequestModel( + zipCode: loggedUser != null ? loggedUser!.zipCode : user.zipCode, + mobileNumber: loggedUser != null ? loggedUser!.mobileNumber : user.mobile, + projectID: await sharedPref.getInt(PROJECT_ID) != null ? await sharedPref.getInt(PROJECT_ID) : user.projectID, + logInTokenID: await sharedPref.getString(TOKEN), + activationCode: activationCode ?? '0000', + memberID: userInfo.userID != null ? int.parse(userInfo.userID!) : user.doctorID, + password: userInfo.password, + facilityId: userInfo.projectID != null ? userInfo.projectID.toString() : user.projectID.toString(), + oTPSendType: await sharedPref.getInt(OTP_TYPE), + iMEI: localToken, + loginDoctorID: loggedUser != null ? loggedUser!.listMemberInformation![0].employeeID : int.parse(user.editedBy.toString()), + + ///loggedUser.listMemberInformation[0].employeeID, + // loggedUser.listMemberInformation[0].employeeID, + isForSilentLogin: isSilentLogin, + generalid: "Cs2020@2016\$2958"); + await _authService.checkActivationCodeForDoctorApp(checkActivationCodeForDoctorApp); if (_authService.hasError) { error = _authService.error; setState(ViewState.ErrorLocal); } else { - await setDataAfterSendActivationSuccess( - checkActivationCodeForDoctorAppRes); + await setDataAfterSendActivationSuccess(checkActivationCodeForDoctorAppRes); setState(ViewState.Idle); } } /// get list of Hospitals Future getHospitalsList(memberID) async { - GetHospitalsRequestModel getHospitalsRequestModel = - GetHospitalsRequestModel(); + GetHospitalsRequestModel getHospitalsRequestModel = GetHospitalsRequestModel(); getHospitalsRequestModel.memberID = memberID; await _hospitalsService.getHospitals(getHospitalsRequestModel); if (_hospitalsService.hasError) { @@ -266,16 +232,11 @@ class AuthenticationViewModel extends BaseViewModel { } /// add  token to shared preferences in case of send activation code is success - setDataAfterSendActivationSuccess( - CheckActivationCodeForDoctorAppResponseModel - sendActivationCodeForDoctorAppResponseModel) async { + setDataAfterSendActivationSuccess(CheckActivationCodeForDoctorAppResponseModel sendActivationCodeForDoctorAppResponseModel) async { // print("VerificationCode : " + sendActivationCodeForDoctorAppResponseModel.verificationCode); - await sharedPref.setString(VIDA_AUTH_TOKEN_ID, - sendActivationCodeForDoctorAppResponseModel.vidaAuthTokenID); - await sharedPref.setString(VIDA_REFRESH_TOKEN_ID, - sendActivationCodeForDoctorAppResponseModel.vidaRefreshTokenID); - await sharedPref.setString(TOKEN, - sendActivationCodeForDoctorAppResponseModel.authenticationTokenID); + await sharedPref.setString(VIDA_AUTH_TOKEN_ID, sendActivationCodeForDoctorAppResponseModel.vidaAuthTokenID!); + await sharedPref.setString(VIDA_REFRESH_TOKEN_ID, sendActivationCodeForDoctorAppResponseModel.vidaRefreshTokenID!); + await sharedPref.setString(TOKEN, sendActivationCodeForDoctorAppResponseModel.authenticationTokenID!); } saveObjToString(String key, value) async { @@ -284,18 +245,16 @@ class AuthenticationViewModel extends BaseViewModel { /// ask user to add his biometric showIOSAuthMessages() async { - const iosStrings = const IOSAuthMessages( - cancelButton: 'cancel', - goToSettingsButton: 'settings', - goToSettingsDescription: 'Please set up your Touch ID.', - lockOut: 'Please Enable Your Touch ID'); - + const iosStrings = IOSAuthMessages(cancelButton: 'cancel', goToSettingsButton: 'settings', goToSettingsDescription: 'Please set up your Touch ID.', lockOut: 'Please Enable Your Touch ID'); try { - await auth.authenticateWithBiometrics( - localizedReason: 'Scan your fingerprint to authenticate', + await auth.authenticate( + localizedReason: 'Scan your fingerprint to authenticate', + authMessages: [iosStrings], + options: AuthenticationOptions( useErrorDialogs: true, stickyAuth: true, - iOSAuthStrings: iosStrings); + ), + ); } on PlatformException catch (e) { DrAppToastMsg.showErrorToast(e.toString()); } @@ -308,12 +267,7 @@ class AuthenticationViewModel extends BaseViewModel { /// get doctor profile based on clinic model Future getDoctorProfileBasedOnClinic(ClinicModel clinicInfo) async { - ProfileReqModel docInfo = new ProfileReqModel( - doctorID: clinicInfo.doctorID, - clinicID: clinicInfo.clinicID, - license: true, - projectID: clinicInfo.projectID, - languageID: 2); + ProfileReqModel docInfo = new ProfileReqModel(doctorID: clinicInfo.doctorID, clinicID: clinicInfo.clinicID, license: true, projectID: clinicInfo.projectID, languageID: 2); ///TODO change the lan await _authService.getDoctorProfileBasedOnClinic(docInfo); @@ -328,17 +282,12 @@ class AuthenticationViewModel extends BaseViewModel { /// add some logic in case of check activation code is success onCheckActivationCodeSuccess({bool isSilentLogin = false}) async { - sharedPref.setString( - TOKEN, checkActivationCodeForDoctorAppRes.authenticationTokenID); - if (checkActivationCodeForDoctorAppRes.listDoctorProfile != null && - checkActivationCodeForDoctorAppRes.listDoctorProfile.isNotEmpty) { - localSetDoctorProfile( - checkActivationCodeForDoctorAppRes.listDoctorProfile[0]); + sharedPref.setString(TOKEN, checkActivationCodeForDoctorAppRes.authenticationTokenID!); + if (checkActivationCodeForDoctorAppRes.listDoctorProfile != null && checkActivationCodeForDoctorAppRes.listDoctorProfile!.isNotEmpty) { + localSetDoctorProfile(checkActivationCodeForDoctorAppRes.listDoctorProfile![0]); } else { - sharedPref.setObj( - CLINIC_NAME, checkActivationCodeForDoctorAppRes.listDoctorsClinic); - ClinicModel clinic = ClinicModel.fromJson( - checkActivationCodeForDoctorAppRes.listDoctorsClinic[0].toJson()); + sharedPref.setObj(CLINIC_NAME, checkActivationCodeForDoctorAppRes.listDoctorsClinic); + ClinicModel clinic = ClinicModel.fromJson(checkActivationCodeForDoctorAppRes.listDoctorsClinic![0].toJson()); await getDoctorProfileBasedOnClinic(clinic); } } @@ -348,8 +297,8 @@ class AuthenticationViewModel extends BaseViewModel { bool isAvailable = false; await _getAvailableBiometrics(); if (_availableBiometrics != null) { - for (var i = 0; i < _availableBiometrics.length; i++) { - if (biometricType == _availableBiometrics[i]) isAvailable = true; + for (var i = 0; i < _availableBiometrics!.length; i++) { + if (biometricType == _availableBiometrics![i]) isAvailable = true; } } return isAvailable; @@ -373,7 +322,7 @@ class AuthenticationViewModel extends BaseViewModel { setState(ViewState.Busy); var token = await _firebaseMessaging.getToken(); if (localToken == "") { - localToken = token; + localToken = token!; await _authService.selectDeviceImei(localToken); if (_authService.hasError) { @@ -382,11 +331,9 @@ class AuthenticationViewModel extends BaseViewModel { } else { if (_authService.dashboardItemsList.length > 0) { user = _authService.dashboardItemsList[0]; - sharedPref.setObj( - LAST_LOGIN_USER, _authService.dashboardItemsList[0]); - await sharedPref.setString( - VIDA_REFRESH_TOKEN_ID, user.vidaRefreshTokenID); - await sharedPref.setString(VIDA_AUTH_TOKEN_ID, user.vidaAuthTokenID); + sharedPref.setObj(LAST_LOGIN_USER, _authService.dashboardItemsList[0]); + await sharedPref.setString(VIDA_REFRESH_TOKEN_ID, user.vidaRefreshTokenID!); + await sharedPref.setString(VIDA_AUTH_TOKEN_ID, user.vidaAuthTokenID!); this.unverified = true; } setState(ViewState.Idle); @@ -440,7 +387,7 @@ class AuthenticationViewModel extends BaseViewModel { } deleteUser() { - user = null; + user = GetIMEIDetailsModel(); unverified = false; isLogin = false; } diff --git a/lib/core/viewModel/base_view_model.dart b/lib/core/viewModel/base_view_model.dart index 2cbc593b..a8049465 100644 --- a/lib/core/viewModel/base_view_model.dart +++ b/lib/core/viewModel/base_view_model.dart @@ -6,14 +6,14 @@ import 'package:flutter/material.dart'; class BaseViewModel extends ChangeNotifier { DrAppSharedPreferances sharedPref = new DrAppSharedPreferances(); - DoctorProfileModel doctorProfile; + DoctorProfileModel? doctorProfile; ViewState _state = ViewState.Idle; bool isInternetConnection = true; ViewState get state => _state; - String error = ""; + String? error = ""; //TODO add the user login model when we need it @@ -23,40 +23,39 @@ class BaseViewModel extends ChangeNotifier { notifyListeners(); } - Future getDoctorProfile( - {bool isGetProfile = false}) async { + Future getDoctorProfile({bool isGetProfile = false}) async { if (isGetProfile) { - Map profile = await sharedPref.getObj(DOCTOR_PROFILE); + Map profile = await sharedPref.getObj(DOCTOR_PROFILE); if (profile != null) { doctorProfile = DoctorProfileModel.fromJson(profile); if (doctorProfile != null) { - return doctorProfile; + return doctorProfile!; } } } if (doctorProfile == null) { - Map profile = await sharedPref.getObj(DOCTOR_PROFILE); + Map? profile = await sharedPref.getObj(DOCTOR_PROFILE); if (profile != null) { doctorProfile = DoctorProfileModel.fromJson(profile); if (doctorProfile != null) { - return doctorProfile; + return doctorProfile!; } } - return null; + return DoctorProfileModel(); } else { - return doctorProfile; + return doctorProfile!; } } void getIsolateDoctorProfile(bool isGetProfile) async { if (isGetProfile) { - Map profile = await sharedPref.getObj(DOCTOR_PROFILE); + Map? profile = await sharedPref.getObj(DOCTOR_PROFILE); if (profile != null) { doctorProfile = DoctorProfileModel.fromJson(profile); } } if (doctorProfile == null) { - Map profile = await sharedPref.getObj(DOCTOR_PROFILE); + Map? profile = await sharedPref.getObj(DOCTOR_PROFILE); if (profile != null) { doctorProfile = DoctorProfileModel.fromJson(profile); } diff --git a/lib/core/viewModel/dashboard_view_model.dart b/lib/core/viewModel/dashboard_view_model.dart index 7b1529fd..d25e56b9 100644 --- a/lib/core/viewModel/dashboard_view_model.dart +++ b/lib/core/viewModel/dashboard_view_model.dart @@ -15,24 +15,20 @@ import 'base_view_model.dart'; class DashboardViewModel extends BaseViewModel { final FirebaseMessaging _firebaseMessaging = FirebaseMessaging.instance; DashboardService _dashboardService = locator(); - SpecialClinicsService _specialClinicsService = - locator(); + SpecialClinicsService _specialClinicsService = locator(); DoctorReplyService _doctorReplyService = locator(); - List get dashboardItemsList => - _dashboardService.dashboardItemsList; + List get dashboardItemsList => _dashboardService.dashboardItemsList; bool get hasVirtualClinic => _dashboardService.hasVirtualClinic; - String get sServiceID => _dashboardService.sServiceID; + String? get sServiceID => _dashboardService.sServiceID; int get notRepliedCount => _doctorReplyService.notRepliedCount; - List get specialClinicalCareList => - _specialClinicsService.specialClinicalCareList; + List get specialClinicalCareList => _specialClinicsService.specialClinicalCareList; - Future startHomeScreenServices(ProjectViewModel projectsProvider, - AuthenticationViewModel authProvider) async { + Future startHomeScreenServices(ProjectViewModel projectsProvider, AuthenticationViewModel authProvider) async { setState(ViewState.Busy); await getDoctorProfile(isGetProfile: true); @@ -53,14 +49,13 @@ class DashboardViewModel extends BaseViewModel { } Future setFirebaseNotification(AuthenticationViewModel authProvider) async { - _firebaseMessaging.requestPermission( - sound: true, badge: true, alert: true, provisional: true); + _firebaseMessaging.requestPermission(sound: true, badge: true, alert: true, provisional: true); - _firebaseMessaging.getToken().then((String token) async { - if (token != '') { + _firebaseMessaging.getToken().then((String? token) async { + if (token != null && token != '') { // DEVICE_TOKEN = token; ///TODO Elham* return it back - authProvider.insertDeviceImei(token); + authProvider.insertDeviceImei(token); } }); } @@ -85,14 +80,13 @@ class DashboardViewModel extends BaseViewModel { // setState(ViewState.Idle); } - Future changeClinic( - int clinicId, AuthenticationViewModel authProvider) async { + Future changeClinic(int clinicId, AuthenticationViewModel authProvider) async { setState(ViewState.BusyLocal); await getDoctorProfile(); ClinicModel clinicModel = ClinicModel( - doctorID: doctorProfile.doctorID, + doctorID: doctorProfile!.doctorID, clinicID: clinicId, - projectID: doctorProfile.projectID, + projectID: doctorProfile!.projectID, ); await authProvider.getDoctorProfileBasedOnClinic(clinicModel); if (authProvider.state == ViewState.ErrorLocal) { @@ -102,13 +96,15 @@ class DashboardViewModel extends BaseViewModel { getPatientCount(DashboardModel inPatientCount) { int value = 0; - inPatientCount.summaryoptions.forEach((result) => {value += result.value}); + inPatientCount.summaryoptions!.forEach((result) { + value += result.value!; + }); return value.toString(); } GetSpecialClinicalCareListResponseModel getSpecialClinic(clinicId) { - GetSpecialClinicalCareListResponseModel special; + GetSpecialClinicalCareListResponseModel special = GetSpecialClinicalCareListResponseModel(); specialClinicalCareList.forEach((element) { if (element.clinicID == clinicId) { special = element; diff --git a/lib/core/viewModel/doctor_replay_view_model.dart b/lib/core/viewModel/doctor_replay_view_model.dart index 4cc51635..a63cc4b2 100644 --- a/lib/core/viewModel/doctor_replay_view_model.dart +++ b/lib/core/viewModel/doctor_replay_view_model.dart @@ -53,8 +53,8 @@ class DoctorReplayViewModel extends BaseViewModel { transactionNo: model.transactionNo.toString(), doctorResponse: response, infoStatus: 6, - createdBy: this.doctorProfile.doctorID, - infoEnteredBy: this.doctorProfile.doctorID, + createdBy: this.doctorProfile!.doctorID, + infoEnteredBy: this.doctorProfile!.doctorID, setupID: "010266"); setState(ViewState.BusyLocal); await _doctorReplyService.createDoctorResponse(createDoctorResponseModel); diff --git a/lib/core/viewModel/labs_view_model.dart b/lib/core/viewModel/labs_view_model.dart index 18e30adc..f15ee42f 100644 --- a/lib/core/viewModel/labs_view_model.dart +++ b/lib/core/viewModel/labs_view_model.dart @@ -23,8 +23,8 @@ class LabsViewModel extends BaseViewModel { List get allSpecialLabList => _labsService.allSpecialLab; - List _patientLabOrdersListClinic = List(); - List _patientLabOrdersListHospital = List(); + List _patientLabOrdersListClinic =[]; + List _patientLabOrdersListHospital =[]; List get patientLabOrdersList => filterType == FilterType.Clinic @@ -55,7 +55,7 @@ class LabsViewModel extends BaseViewModel { .add(element); } else { _patientLabOrdersListClinic.add(PatientLabOrdersList( - filterName: element.clinicDescription, + filterName: element.clinicDescription!, patientDoctorAppointment: element)); } @@ -75,7 +75,7 @@ class LabsViewModel extends BaseViewModel { .add(element); } else { _patientLabOrdersListHospital.add(PatientLabOrdersList( - filterName: element.projectName, + filterName: element.projectName!, patientDoctorAppointment: element)); } }); @@ -94,15 +94,15 @@ class LabsViewModel extends BaseViewModel { List get labResultList => _labsService.labResultList; - List labResultLists = List(); + List labResultLists =[]; getLaboratoryResult( - {String projectID, - int clinicID, - String invoiceNo, - String orderNo, - PatiantInformtion patient, - bool isInpatient}) async { + {String? projectID, + int? clinicID, + String? invoiceNo, + String? orderNo, + PatiantInformtion? patient, + bool? isInpatient}) async { setState(ViewState.Busy); await _labsService.getLaboratoryResult( invoiceNo: invoiceNo, @@ -120,14 +120,14 @@ class LabsViewModel extends BaseViewModel { } getPatientLabResult( - {PatientLabOrders patientLabOrder, - PatiantInformtion patient, - bool isInpatient}) async { + {PatientLabOrders? patientLabOrder, + PatiantInformtion? patient, + bool? isInpatient}) async { setState(ViewState.Busy); await _labsService.getPatientLabResult( patientLabOrder: patientLabOrder, patient: patient, - isInpatient: isInpatient); + isInpatient: isInpatient!); if (_labsService.hasError) { error = _labsService.error; setState(ViewState.Error); @@ -149,15 +149,15 @@ class LabsViewModel extends BaseViewModel { .add(element); } else { labResultLists - .add(LabResultList(filterName: element.testCode, lab: element)); + .add(LabResultList(filterName: element.testCode!, lab: element)); } }); } getPatientLabOrdersResults( - {PatientLabOrders patientLabOrder, - String procedure, - PatiantInformtion patient}) async { + {PatientLabOrders? patientLabOrder, + String? procedure, + PatiantInformtion? patient}) async { setState(ViewState.Busy); await _labsService.getPatientLabOrdersResults( patientLabOrder: patientLabOrder, @@ -170,9 +170,9 @@ class LabsViewModel extends BaseViewModel { bool isShouldClear = false; if (_labsService.labOrdersResultsList.length == 1) { labOrdersResultsList.forEach((element) { - if (element.resultValue.contains('/') || - element.resultValue.contains('*') || - element.resultValue.isEmpty) isShouldClear = true; + if (element.resultValue!.contains('/') || + element.resultValue!.contains('*') || + element.resultValue!.isEmpty) isShouldClear = true; }); } if (isShouldClear) _labsService.labOrdersResultsList.clear(); @@ -181,9 +181,9 @@ class LabsViewModel extends BaseViewModel { } getPatientLabResultHistoryByDescription( - {PatientLabOrders patientLabOrder, - String procedureDescription, - PatiantInformtion patient}) async { + {PatientLabOrders? patientLabOrder, + String? procedureDescription, + PatiantInformtion? patient}) async { setState(ViewState.Busy); await _labsService.getPatientLabOrdersResultHistoryByDescription( patientLabOrder: patientLabOrder, @@ -197,7 +197,7 @@ class LabsViewModel extends BaseViewModel { } } - sendLabReportEmail({PatientLabOrders patientLabOrder, String mes}) async { + sendLabReportEmail({PatientLabOrders? patientLabOrder, String? mes}) async { await _labsService.sendLabReportEmail(patientLabOrder: patientLabOrder); if (_labsService.hasError) { error = _labsService.error; @@ -205,7 +205,7 @@ class LabsViewModel extends BaseViewModel { DrAppToastMsg.showSuccesToast(mes); } - Future getAllSpecialLabResult({int patientId}) async { + Future getAllSpecialLabResult({required int patientId}) async { setState(ViewState.Busy); await _labsService.getAllSpecialLabResult(mrn: patientId); if (_labsService.hasError) { diff --git a/lib/core/viewModel/leave_rechdule_response.dart b/lib/core/viewModel/leave_rechdule_response.dart index 508d6731..0f18e7ad 100644 --- a/lib/core/viewModel/leave_rechdule_response.dart +++ b/lib/core/viewModel/leave_rechdule_response.dart @@ -1,16 +1,16 @@ class GetRescheduleLeavesResponse { - int clinicId; + int? clinicId; var coveringDoctorId; - String date; - String dateTimeFrom; - String dateTimeTo; - int doctorId; - int reasonId; - int requisitionNo; - int requisitionType; - int status; - String createdOn; - String statusDescription; + String? date; + String? dateTimeFrom; + String? dateTimeTo; + int? doctorId; + int? reasonId; + int? requisitionNo; + int? requisitionType; + int? status; + String? createdOn; + String? statusDescription; GetRescheduleLeavesResponse( {this.clinicId, diff --git a/lib/core/viewModel/livecare_view_model.dart b/lib/core/viewModel/livecare_view_model.dart index c6a3d2a1..447388a0 100644 --- a/lib/core/viewModel/livecare_view_model.dart +++ b/lib/core/viewModel/livecare_view_model.dart @@ -15,7 +15,7 @@ class LiveCareViewModel with ChangeNotifier { DrAppSharedPreferances sharedPref = new DrAppSharedPreferances(); List liveCarePendingList = []; - StartCallRes inCallResponse; + StartCallRes? inCallResponse; var transferToAdmin = {}; var endCallResponse = {}; bool isFinished = true; diff --git a/lib/core/viewModel/medical_file_view_model.dart b/lib/core/viewModel/medical_file_view_model.dart index 12aecf5e..c205c04b 100644 --- a/lib/core/viewModel/medical_file_view_model.dart +++ b/lib/core/viewModel/medical_file_view_model.dart @@ -11,7 +11,7 @@ class MedicalFileViewModel extends BaseViewModel { List get medicalFileList => _medicalFileService.medicalFileList; - Future getMedicalFile({int mrn}) async { + Future getMedicalFile({required int mrn}) async { hasError = false; //_insuranceCardService.clearInsuranceCard(); setState(ViewState.Busy); diff --git a/lib/core/viewModel/medicine_view_model.dart b/lib/core/viewModel/medicine_view_model.dart index 457d12b6..0dd02428 100644 --- a/lib/core/viewModel/medicine_view_model.dart +++ b/lib/core/viewModel/medicine_view_model.dart @@ -25,10 +25,8 @@ class MedicineViewModel extends BaseViewModel { ProcedureService _procedureService = locator(); PrescriptionService _prescriptionService = locator(); - - List get procedureTemplate => - _procedureService.templateList; - List templateList = List(); + List get procedureTemplate => _procedureService.templateList; + List templateList = []; get pharmacyItemsList => _medicineService.pharmacyItemsList; @@ -46,27 +44,21 @@ class MedicineViewModel extends BaseViewModel { get boxQuintity => _prescriptionService.boxQuantity; - get medicationIndicationsList => - _prescriptionService.medicationIndicationsList; + get medicationIndicationsList => _prescriptionService.medicationIndicationsList; get medicationDoseTimeList => _prescriptionService.medicationDoseTimeList; - List get patientAssessmentList => - _prescriptionService.patientAssessmentList; + List get patientAssessmentList => _prescriptionService.patientAssessmentList; - List get allMedicationList => - _prescriptionService.allMedicationList; + List get allMedicationList => _prescriptionService.allMedicationList; List get itemMedicineList => _prescriptionService.itemMedicineList; - List get itemMedicineListRoute => - _prescriptionService.itemMedicineListRoute; - - List get itemMedicineListUnit => - _prescriptionService.itemMedicineListUnit; + List get itemMedicineListRoute => _prescriptionService.itemMedicineListRoute; + List get itemMedicineListUnit => _prescriptionService.itemMedicineListUnit; - Future getItem({int itemID, bool isLocalBusy = false}) async { + Future getItem({required int itemID, bool isLocalBusy = false}) async { if (isLocalBusy) { setState(ViewState.BusyLocal); } else { @@ -80,39 +72,27 @@ class MedicineViewModel extends BaseViewModel { setState(ViewState.Idle); } - setTemplateListDependOnId() { procedureTemplate.forEach((element) { - List templateListData = templateList - .where((elementTemplate) => - elementTemplate.templateId == element.templateID) - .toList(); + List templateListData = templateList.where((elementTemplate) => elementTemplate.templateId == element.templateID).toList(); if (templateListData.length != 0) { - templateList[templateList.indexOf(templateListData[0])] - .procedureTemplate - .add(element); + templateList[templateList.indexOf(templateListData[0])].procedureTemplate.add(element); } else { - var template = ProcedureTempleteDetailsModelList( - templateName: element.templateName, - templateId: element.templateID, - template: element); + var template = ProcedureTempleteDetailsModelList(templateName: element.templateName, templateId: element.templateID, template: element); if (!templateList.contains(template)) templateList.add(template); } }); print(templateList.length.toString()); } - - - getPrescriptionForDrug( - List prescriptionList, - MedicineViewModel model, + List prescriptionList, + MedicineViewModel model, ) { var prescriptionDetails = []; if (prescriptionList.length > 0) { - prescriptionList[0].entityList.forEach((element) { + prescriptionList[0].entityList!.forEach((element) { if (element.mediSpanGPICode != null) { prescriptionDetails.add({ 'DrugId': element.mediSpanGPICode, @@ -131,52 +111,51 @@ class MedicineViewModel extends BaseViewModel { return prescriptionDetails; } - postPrescription( - {String duration, - String doseTimeIn, - String dose, - String drugId, - String strength, - String route, - String frequency, - String indication, - String instruction, - PrescriptionViewModel model, - DateTime doseTime, - String doseUnit, - String icdCode, - PatiantInformtion patient, - String patientType, - bool isLocalBusy = false, - BuildContext context, PrescriptionRequestModel prescriptionRequestModel}) async { + {String? duration, + String? doseTimeIn, + String? dose, + String? drugId, + String? strength, + String? route, + String? frequency, + String? indication, + String? instruction, + PrescriptionViewModel? model, + DateTime? doseTime, + String? doseUnit, + String? icdCode, + PatiantInformtion? patient, + String? patientType, + bool isLocalBusy = false, + BuildContext? context, + PrescriptionRequestModel? prescriptionRequestModel}) async { if (isLocalBusy) { setState(ViewState.BusyLocal); } else { setState(ViewState.Busy); } - PostPrescriptionReqModel postProcedureReqModel = - new PostPrescriptionReqModel(); - List prescriptionList = List(); + PostPrescriptionReqModel postProcedureReqModel = new PostPrescriptionReqModel(); + List prescriptionList = []; - postProcedureReqModel.appointmentNo = patient.appointmentNo; + postProcedureReqModel.appointmentNo = patient!.appointmentNo; postProcedureReqModel.clinicID = patient.clinicId; postProcedureReqModel.episodeID = patient.episodeNo; postProcedureReqModel.patientMRN = patient.patientMRN; prescriptionList.add(PrescriptionRequestModel( covered: true, - dose: double.parse(dose), - itemId: drugId.isEmpty ? 1 : int.parse(drugId), - doseUnitId: int.parse(doseUnit), - route: route.isEmpty ? 1 : int.parse(route), - frequency: frequency.isEmpty ? 1 : int.parse(frequency), + dose: double.parse(dose!), + itemId: drugId!.isEmpty ? 1 : int.parse(drugId!), + doseUnitId: int.parse(doseUnit!), + route: route!.isEmpty ? 1 : int.parse(route), + frequency: frequency!.isEmpty ? 1 : int.parse(frequency), remarks: instruction, approvalRequired: true, icdcode10Id: icdCode.toString(), - doseTime: doseTimeIn.isEmpty ? 1 : int.parse(doseTimeIn), - duration: duration.isEmpty ? 1 : int.parse(duration), - doseStartDate: doseTime.toIso8601String())); + doseTime: doseTimeIn!.isEmpty ? 1 : int.parse(doseTimeIn), + duration: duration!.isEmpty ? 1 : int.parse(duration), + doseStartDate: doseTime!.toIso8601String())); postProcedureReqModel.prescriptionRequestModel = prescriptionList; await _prescriptionService.postPrescription(postProcedureReqModel); if (_prescriptionService.hasError) { @@ -193,20 +172,14 @@ class MedicineViewModel extends BaseViewModel { } } - - - Future getAssessmentList ({PatiantInformtion patientInfo, bool isLocalBusy = false}) async { + Future getAssessmentList({PatiantInformtion? patientInfo, bool isLocalBusy = false}) async { if (isLocalBusy) { setState(ViewState.BusyLocal); } else { setState(ViewState.Busy); } - GetAssessmentReqModel getAssessmentReqModel = GetAssessmentReqModel( - patientMRN: patientInfo.patientMRN, - episodeID: patientInfo.episodeNo.toString(), - editedBy: '', - doctorID: '', - appointmentNo: patientInfo.appointmentNo); + GetAssessmentReqModel getAssessmentReqModel = + GetAssessmentReqModel(patientMRN: patientInfo!.patientMRN!, episodeID: patientInfo.episodeNo.toString(), editedBy: '', doctorID: '', appointmentNo: patientInfo.appointmentNo); if (medicationStrengthList.length == 0) { await getMedicationStrength(isLocalBusy: true); } @@ -229,7 +202,6 @@ class MedicineViewModel extends BaseViewModel { } } - Future getMedicineItem(String itemName) async { setState(ViewState.Busy); await _medicineService.getMedicineItem(itemName); @@ -240,16 +212,14 @@ class MedicineViewModel extends BaseViewModel { setState(ViewState.Idle); } - - getMedicationList( - {String drug, bool isLocalBusy = false}) async { + getMedicationList({String? drug, bool isLocalBusy = false}) async { if (isLocalBusy) { setState(ViewState.BusyLocal); } else { setState(ViewState.Busy); } await getDoctorProfile(isGetProfile: true); - await _prescriptionService.getMedicationList(drug: drug); + await _prescriptionService.getMedicationList(drug: drug!); if (_prescriptionService.hasError) { error = _prescriptionService.error; if (isLocalBusy) { @@ -262,8 +232,7 @@ class MedicineViewModel extends BaseViewModel { } } - Future getPatientAssessment( - GetAssessmentReqModel getAssessmentReqModel ,{bool isLocalBusy = false}) async { + Future getPatientAssessment(GetAssessmentReqModel getAssessmentReqModel, {bool isLocalBusy = false}) async { if (isLocalBusy) { setState(ViewState.BusyLocal); } else { @@ -277,29 +246,20 @@ class MedicineViewModel extends BaseViewModel { setState(ViewState.Idle); } - Future onInitiateAllPrescription({ - PrescriptionViewModel model, - PatiantInformtion patient, - ProcedureTempleteDetailsModel groupProcedures, - BuildContext context, - bool isLocalBusy = true - } - ) async { + Future onInitiateAllPrescription({PrescriptionViewModel? model, PatiantInformtion? patient, ProcedureTempleteDetailsModel? groupProcedures, BuildContext? context, bool isLocalBusy = true}) async { if (isLocalBusy) { setState(ViewState.BusyLocal); } else { setState(ViewState.Busy); } - model.getItem( - itemID: int.parse( - groupProcedures.aliasN.replaceAll("item code ;", ""))); - - GetAssessmentReqModel getAssessmentReqModel = GetAssessmentReqModel( - patientMRN: patient.patientMRN, - episodeID: patient.episodeNo.toString(), - editedBy: '', - doctorID: '', - appointmentNo: patient.appointmentNo); + model!.getItem( + itemID: int.parse( + groupProcedures!.aliasN!.replaceAll("item code ;", ""), + ), + ); + + GetAssessmentReqModel getAssessmentReqModel = + GetAssessmentReqModel(patientMRN: patient!.patientMRN!, episodeID: patient.episodeNo.toString(), editedBy: '', doctorID: '', appointmentNo: patient.appointmentNo); if (medicationStrengthList.length == 0) { await getMedicationStrength(); } @@ -318,22 +278,21 @@ class MedicineViewModel extends BaseViewModel { } else { setState(ViewState.Busy); } - await _prescriptionService - .getMasterLookup(MasterKeysService.MedicationStrength); + await _prescriptionService.getMasterLookup(MasterKeysService.MedicationStrength); if (_prescriptionService.hasError) { error = _prescriptionService.error; if (isLocalBusy) { setState(ViewState.ErrorLocal); } else { setState(ViewState.Error); - }} else + } + } else setState(ViewState.Idle); } Future getMedicationRoute() async { setState(ViewState.Busy); - await _prescriptionService - .getMasterLookup(MasterKeysService.MedicationRoute); + await _prescriptionService.getMasterLookup(MasterKeysService.MedicationRoute); if (_prescriptionService.hasError) { error = _prescriptionService.error; setState(ViewState.Error); @@ -343,8 +302,7 @@ class MedicineViewModel extends BaseViewModel { Future getMedicationIndications() async { setState(ViewState.Busy); - await _prescriptionService - .getMasterLookup(MasterKeysService.MedicationIndications); + await _prescriptionService.getMasterLookup(MasterKeysService.MedicationIndications); if (_prescriptionService.hasError) { error = _prescriptionService.error; setState(ViewState.Error); @@ -357,8 +315,8 @@ class MedicineViewModel extends BaseViewModel { setState(ViewState.BusyLocal); } else { setState(ViewState.Busy); - } await _prescriptionService - .getMasterLookup(MasterKeysService.MedicationDoseTime); + } + await _prescriptionService.getMasterLookup(MasterKeysService.MedicationDoseTime); if (_prescriptionService.hasError) { error = _prescriptionService.error; setState(ViewState.Error); @@ -368,8 +326,7 @@ class MedicineViewModel extends BaseViewModel { Future getMedicationFrequency() async { setState(ViewState.Busy); - await _prescriptionService - .getMasterLookup(MasterKeysService.MedicationFrequency); + await _prescriptionService.getMasterLookup(MasterKeysService.MedicationFrequency); if (_prescriptionService.hasError) { error = _prescriptionService.error; setState(ViewState.Error); @@ -383,8 +340,7 @@ class MedicineViewModel extends BaseViewModel { } else { setState(ViewState.Busy); } - await _prescriptionService - .getMasterLookup(MasterKeysService.MedicationDuration); + await _prescriptionService.getMasterLookup(MasterKeysService.MedicationDuration); if (_prescriptionService.hasError) { error = _prescriptionService.error; setState(ViewState.ErrorLocal); @@ -392,11 +348,14 @@ class MedicineViewModel extends BaseViewModel { setState(ViewState.Idle); } - Future getBoxQuantity( - {int itemCode, int duration, double strength, int freq}) async { + Future getBoxQuantity({int? itemCode, int? duration, double? strength, int? freq}) async { setState(ViewState.Busy); await _prescriptionService.calculateBoxQuantity( - strength: strength, itemCode: itemCode, duration: duration, freq: freq); + strength: strength!, + itemCode: itemCode!, + duration: duration!, + freq: freq!, + ); if (_prescriptionService.hasError) { error = _prescriptionService.error; setState(ViewState.Error); diff --git a/lib/core/viewModel/patient-admission-request-viewmodel.dart b/lib/core/viewModel/patient-admission-request-viewmodel.dart index e08c9a43..dd543642 100644 --- a/lib/core/viewModel/patient-admission-request-viewmodel.dart +++ b/lib/core/viewModel/patient-admission-request-viewmodel.dart @@ -39,7 +39,7 @@ class AdmissionRequestViewModel extends BaseViewModel { List get listOfDiagnosisSelectionTypes => _admissionRequestService.listOfDiagnosisSelectionTypes; - AdmissionRequest admissionRequestData; + AdmissionRequest? admissionRequestData; Future getSpecialityList() async { await getMasterLookup(MasterKeysService.Speciality); @@ -138,7 +138,7 @@ class AdmissionRequestViewModel extends BaseViewModel { Future makeAdmissionRequest() async { setState(ViewState.Busy); - await _admissionRequestService.makeAdmissionRequest(admissionRequestData); + await _admissionRequestService.makeAdmissionRequest(admissionRequestData!); if (_admissionRequestService.hasError) { error = _admissionRequestService.error; setState(ViewState.ErrorLocal); diff --git a/lib/core/viewModel/patient-referral-viewmodel.dart b/lib/core/viewModel/patient-referral-viewmodel.dart index 245664df..0074a496 100644 --- a/lib/core/viewModel/patient-referral-viewmodel.dart +++ b/lib/core/viewModel/patient-referral-viewmodel.dart @@ -242,25 +242,25 @@ class PatientReferralViewModel extends BaseViewModel { } Future makeInPatientReferral( - {PatiantInformtion patient, - int projectID, - int clinicID, - int doctorID, - int frequencyCode, - int priority, - String referralDate, - String remarks, - String ext, + {PatiantInformtion? patient, + int? projectID, + int? clinicID, + int? doctorID, + int? frequencyCode, + int? priority, + String? referralDate, + String? remarks, + String? ext, bool isLocalBusy = false}) async { if(isLocalBusy) setState(ViewState.BusyLocal); else setState(ViewState.Busy); await _referralService.referralPatient( - patientID: patient.patientId, + patientID: patient!.patientId, roomID: patient.roomId, referralClinic: clinicID, - admissionNo: int.parse(patient.admissionNo), + admissionNo: int.parse(patient.admissionNo!), referralDoctor: doctorID, patientTypeID: patient.patientType, referringDoctorRemarks: remarks, diff --git a/lib/core/viewModel/patient-ucaf-viewmodel.dart b/lib/core/viewModel/patient-ucaf-viewmodel.dart index a060f69f..04458804 100644 --- a/lib/core/viewModel/patient-ucaf-viewmodel.dart +++ b/lib/core/viewModel/patient-ucaf-viewmodel.dart @@ -18,27 +18,23 @@ import '../../locator.dart'; class UcafViewModel extends BaseViewModel { UcafService _ucafService = locator(); - List get patientChiefComplaintList => - _ucafService.patientChiefComplaintList; + List get patientChiefComplaintList => _ucafService.patientChiefComplaintList!; - List get patientVitalSignsHistory => - _ucafService.patientVitalSignsHistory; + List get patientVitalSignsHistory => _ucafService.patientVitalSignsHistory!; - List get patientAssessmentList => - _ucafService.patientAssessmentList; + List get patientAssessmentList => _ucafService.patientAssessmentList; List get diagnosisTypes => _ucafService.listOfDiagnosisType; - List get diagnosisConditions => - _ucafService.listOfDiagnosisCondition; + List get diagnosisConditions => _ucafService.listOfDiagnosisCondition; - PrescriptionModel get prescriptionList => _ucafService.prescriptionList; + PrescriptionModel get prescriptionList => _ucafService.prescriptionList!; - List get orderProcedures => _ucafService.orderProcedureList; + List get orderProcedures => _ucafService.orderProcedureList!; - Function saveUCAFOnTap; + Function? saveUCAFOnTap; - String selectedLanguage; + String? selectedLanguage; String heightCm = "0"; String weightKg = "0"; String bodyMax = "0"; @@ -64,8 +60,8 @@ class UcafViewModel extends BaseViewModel { Future getUCAFData(PatiantInformtion patient) async { // setState(ViewState.Busy); - String from; - String to; + String? from; + String? to; if (from == null || from == "0") { from = AppDateUtils.convertDateToFormat(DateTime.now(), 'yyyy-MM-dd'); } @@ -91,23 +87,16 @@ class UcafViewModel extends BaseViewModel { if (bodyMax == "0" || bodyMax == null || bodyMax == 'null') { bodyMax = element.bodyMassIndex.toString(); } - if (temperatureCelcius == "0" || - temperatureCelcius == null || - temperatureCelcius == 'null') { + if (temperatureCelcius == "0" || temperatureCelcius == null || temperatureCelcius == 'null') { temperatureCelcius = element.temperatureCelcius.toString(); } if (hartRat == "0" || hartRat == null || hartRat == 'null') { hartRat = element.pulseBeatPerMinute.toString(); } - if (respirationBeatPerMinute == "0" || - respirationBeatPerMinute == null || - respirationBeatPerMinute == 'null') { - respirationBeatPerMinute = - element.respirationBeatPerMinute.toString(); + if (respirationBeatPerMinute == "0" || respirationBeatPerMinute == null || respirationBeatPerMinute == 'null') { + respirationBeatPerMinute = element.respirationBeatPerMinute.toString(); } - if (bloodPressure == "0 / 0" || - bloodPressure == null || - bloodPressure == 'null') { + if (bloodPressure == "0 / 0" || bloodPressure == null || bloodPressure == 'null') { bloodPressure = element.bloodPressure.toString(); } }); @@ -126,8 +115,7 @@ class UcafViewModel extends BaseViewModel { } else { if (patientAssessmentList.isNotEmpty) { if (diagnosisConditions.length == 0) { - await _ucafService - .getMasterLookup(MasterKeysService.DiagnosisCondition); + await _ucafService.getMasterLookup(MasterKeysService.DiagnosisCondition); } if (diagnosisTypes.length == 0) { await _ucafService.getMasterLookup(MasterKeysService.DiagnosisType); @@ -169,29 +157,26 @@ class UcafViewModel extends BaseViewModel { } } - MasterKeyModel findMasterDataById( - {@required MasterKeysService masterKeys, dynamic id}) { + MasterKeyModel findMasterDataById({required MasterKeysService masterKeys, dynamic id}) { switch (masterKeys) { case MasterKeysService.DiagnosisCondition: List result = diagnosisConditions.where((element) { - return element.id == id && - element.typeId == masterKeys.getMasterKeyService(); + return element.id == id && element.typeId == masterKeys.getMasterKeyService(); }).toList(); if (result.isNotEmpty) { return result.first; } - return null; + return MasterKeyModel(); case MasterKeysService.DiagnosisType: List result = diagnosisTypes.where((element) { - return element.id == id && - element.typeId == masterKeys.getMasterKeyService(); + return element.id == id && element.typeId == masterKeys.getMasterKeyService(); }).toList(); if (result.isNotEmpty) { return result.first; } - return null; + return MasterKeyModel(); default: - return null; + return MasterKeyModel(); } } diff --git a/lib/core/viewModel/patient-vital-sign-viewmodel.dart b/lib/core/viewModel/patient-vital-sign-viewmodel.dart index c618bac4..3c33d4c6 100644 --- a/lib/core/viewModel/patient-vital-sign-viewmodel.dart +++ b/lib/core/viewModel/patient-vital-sign-viewmodel.dart @@ -11,10 +11,9 @@ import '../../locator.dart'; class VitalSignsViewModel extends BaseViewModel { VitalSignsService _vitalSignService = locator(); - VitalSignData get patientVitalSigns => _vitalSignService.patientVitalSigns; + VitalSignData get patientVitalSigns => _vitalSignService.patientVitalSigns!; - List get patientVitalSignsHistory => - _vitalSignService.patientVitalSignsHistory; + List get patientVitalSignsHistory => _vitalSignService.patientVitalSignsHistory; String heightCm = "0"; String weightKg = "0"; @@ -42,8 +41,7 @@ class VitalSignsViewModel extends BaseViewModel { } } - Future getPatientVitalSignHistory(PatiantInformtion patient, String from, - String to, bool isInPatient) async { + Future getPatientVitalSignHistory(PatiantInformtion patient, String from, String to, bool isInPatient) async { setState(ViewState.Busy); if (from == null || from == "0") { from = AppDateUtils.convertDateToFormat(DateTime.now(), 'yyyy-MM-dd'); @@ -72,50 +70,28 @@ class VitalSignsViewModel extends BaseViewModel { if (bodyMax == "0" || bodyMax == null || bodyMax == 'null') { bodyMax = element.bodyMassIndex.toString(); } - if (temperatureCelcius == "0" || - temperatureCelcius == null || - temperatureCelcius == 'null') { + if (temperatureCelcius == "0" || temperatureCelcius == null || temperatureCelcius == 'null') { temperatureCelcius = element.temperatureCelcius.toString(); } if (hartRat == "0" || hartRat == null || hartRat == 'null') { hartRat = element.pulseBeatPerMinute.toString(); } - if (respirationBeatPerMinute == "0" || - respirationBeatPerMinute == null || - respirationBeatPerMinute == 'null') { - respirationBeatPerMinute = - element.respirationBeatPerMinute.toString(); + if (respirationBeatPerMinute == "0" || respirationBeatPerMinute == null || respirationBeatPerMinute == 'null') { + respirationBeatPerMinute = element.respirationBeatPerMinute.toString(); } - if (bloodPressure == "0 / 0" || - bloodPressure == null || - bloodPressure == 'null') { + if (bloodPressure == "0 / 0" || bloodPressure == null || bloodPressure == 'null') { bloodPressure = element.bloodPressure.toString(); } - if (oxygenation == "0" || - oxygenation == null || - oxygenation == 'null') { - oxygenation = - "${element.sAO2.toString()}"; /* - ${element.fIO2.toString()}*/ + if (oxygenation == "0" || oxygenation == null || oxygenation == 'null') { + oxygenation = "${element.sAO2.toString()}"; /* - ${element.fIO2.toString()}*/ } if (painScore == null || painScore == "-") { - painScore = element.painScoreDesc.toString() != 'null' - ? element.painScoreDesc.toString() - : "-"; - painLocation = element.painLocation.toString() != 'null' - ? element.painLocation.toString() - : "-"; - painCharacter = element.painCharacter.toString() != 'null' - ? element.painCharacter.toString() - : "-"; - painDuration = element.painDuration.toString() != 'null' - ? element.painDuration.toString() - : "-"; - isPainDone = element.isPainManagementDone.toString() != 'null' - ? element.isPainManagementDone.toString() - : "-"; - painFrequency = element.painFrequency.toString() != 'null' - ? element.painFrequency.toString() - : "-"; + painScore = element.painScoreDesc.toString() != 'null' ? element.painScoreDesc.toString() : "-"; + painLocation = element.painLocation.toString() != 'null' ? element.painLocation.toString() : "-"; + painCharacter = element.painCharacter.toString() != 'null' ? element.painCharacter.toString() : "-"; + painDuration = element.painDuration.toString() != 'null' ? element.painDuration.toString() : "-"; + isPainDone = element.isPainManagementDone.toString() != 'null' ? element.isPainManagementDone.toString() : "-"; + painFrequency = element.painFrequency.toString() != 'null' ? element.painFrequency.toString() : "-"; } }); setState(ViewState.Idle); @@ -150,7 +126,7 @@ class VitalSignsViewModel extends BaseViewModel { } } - String getTempratureMethod(int temperatureCelciusMethod) { + String? getTempratureMethod(int temperatureCelciusMethod) { // temperatureCelciusMethod ( vital sign response field )- master 2005 if (temperatureCelciusMethod == 1) { return "Oral"; diff --git a/lib/core/viewModel/patient_view_model.dart b/lib/core/viewModel/patient_view_model.dart index daf25bac..ae28428b 100644 --- a/lib/core/viewModel/patient_view_model.dart +++ b/lib/core/viewModel/patient_view_model.dart @@ -255,17 +255,17 @@ class PatientViewModel extends BaseViewModel { } Future referToDoctor( - {String selectedDoctorID, - String selectedClinicID, - int admissionNo, - String extension, - String priority, - String frequency, - String referringDoctorRemarks, - int patientID, - int patientTypeID, - String roomID, - int projectID}) async { + {String? selectedDoctorID, + String? selectedClinicID, + int? admissionNo, + String? extension, + String? priority, + String? frequency, + String? referringDoctorRemarks, + int? patientID, + int? patientTypeID, + String? roomID, + int? projectID}) async { setState(ViewState.BusyLocal); await _patientService.referToDoctor( selectedClinicID: selectedClinicID, @@ -350,7 +350,7 @@ class PatientViewModel extends BaseViewModel { GetDiabeticChartValuesRequestModel requestModel = GetDiabeticChartValuesRequestModel( patientID: patient.patientId, - admissionNo: int.parse(patient.admissionNo), + admissionNo: int.parse(patient.admissionNo!), patientTypeID: 1, patientType: 1, resultType: resultType, diff --git a/lib/core/viewModel/pednding_orders_view_model.dart b/lib/core/viewModel/pednding_orders_view_model.dart index ab98403b..4cfc4f4a 100644 --- a/lib/core/viewModel/pednding_orders_view_model.dart +++ b/lib/core/viewModel/pednding_orders_view_model.dart @@ -15,7 +15,7 @@ class PendingOrdersViewModel extends BaseViewModel { List get admissionOrderList => _pendingOrderService.admissionOrderList; - Future getPendingOrders({int patientId, int admissionNo}) async { + Future getPendingOrders({required int patientId, required int admissionNo}) async { hasError = false; setState(ViewState.Busy); await _pendingOrderService.getPendingOrders( @@ -28,7 +28,7 @@ class PendingOrdersViewModel extends BaseViewModel { } } - Future getAdmissionOrders({int patientId, int admissionNo}) async { + Future getAdmissionOrders({required int patientId, required int admissionNo}) async { hasError = false; setState(ViewState.Busy); await _pendingOrderService.getAdmissionOrders( diff --git a/lib/core/viewModel/prescription/prescription_view_model.dart b/lib/core/viewModel/prescription/prescription_view_model.dart index d5101caf..c20c9aae 100644 --- a/lib/core/viewModel/prescription/prescription_view_model.dart +++ b/lib/core/viewModel/prescription/prescription_view_model.dart @@ -23,65 +23,56 @@ class PrescriptionViewModel extends BaseViewModel { PrescriptionService _prescriptionService = locator(); + List get medicationForInPatient => _prescriptionService.medicationForInPatient; - List get medicationForInPatient => - _prescriptionService.medicationForInPatient; + List get prescriptionList => _prescriptionService.prescriptionList; - List get prescriptionList => - _prescriptionService.prescriptionList; - List get prescriptionListNew => - _prescriptionService.prescriptionListNew; + List get prescriptionListNew => _prescriptionService.prescriptionListNew; - List get prescriptionReportList => - _prescriptionService.prescriptionReportList; - - List get pharmacyPrescriptionsList => - _prescriptionService.pharmacyPrescriptionsList; - - List get prescriptionReportEnhList => - _prescriptionService.prescriptionReportEnhList; + List get prescriptionReportList => _prescriptionService.prescriptionReportList; + List get pharmacyPrescriptionsList => _prescriptionService.pharmacyPrescriptionsList; + List get prescriptionReportEnhList => _prescriptionService.prescriptionReportEnhList; List get drugToDrug => _prescriptionService.drugToDrugList; - - List _prescriptionsOrderListClinic = List(); - List _prescriptionsOrderListHospital = List(); + List _prescriptionsOrderListClinic = []; + List _prescriptionsOrderListHospital = []; - List get prescriptionsList => - _prescriptionService.prescriptionsList; + List get prescriptionsList => _prescriptionService.prescriptionsList; - Future getItem({int itemID}) async { + Future getItem({required int itemID}) async { hasError = false; setState(ViewState.BusyLocal); await _prescriptionService.getItem(itemID: itemID); if (_prescriptionService.hasError) { - error = _prescriptionService.error; + error = _prescriptionService.error!; setState(ViewState.ErrorLocal); } else setState(ViewState.Idle); } - Future getPrescriptionListNew({int mrn,int appNo, bool isLocalBusy = false}) async { + Future getPrescriptionListNew({int? mrn, int appNo = 0, bool isLocalBusy = false}) async { hasError = false; - if(isLocalBusy) - setState(ViewState.BusyLocal); else setState(ViewState.Busy); - await _prescriptionService.getPrescriptionListNew(mrn: mrn, appNo:appNo ); + if (isLocalBusy) + setState(ViewState.BusyLocal); + else + setState(ViewState.Busy); + await _prescriptionService.getPrescriptionListNew(mrn: mrn!, appNo: appNo); if (_prescriptionService.hasError) { - error = _prescriptionService.error; + error = _prescriptionService.error!; setState(ViewState.ErrorLocal); } else setState(ViewState.Idle); } - Future postPrescription( - PostPrescriptionReqModel postProcedureReqModel, int mrn) async { + Future postPrescription(PostPrescriptionReqModel postProcedureReqModel, int mrn) async { hasError = false; setState(ViewState.BusyLocal); await _prescriptionService.postPrescription(postProcedureReqModel); if (_prescriptionService.hasError) { - error = _prescriptionService.error; + error = _prescriptionService.error!; setState(ViewState.ErrorLocal); } else { await getPrescriptionListNew(mrn: mrn); @@ -89,87 +80,66 @@ class PrescriptionViewModel extends BaseViewModel { } } - - Future getDrugToDrug( - VitalSignData vital, - List lstAssessments, - List allergy, - PatiantInformtion patient, - List prescription, + Future getDrugToDrug(VitalSignData vital, List lstAssessments, List allergy, PatiantInformtion patient, List prescription, {bool isLocalBusy = false}) async { hasError = false; // setState(ViewState.BusyLocal); - if(isLocalBusy) + if (isLocalBusy) setState(ViewState.BusyLocal); else setState(ViewState.Busy); - await _prescriptionService.getDrugToDrug( - vital, lstAssessments, allergy, patient, prescription); + await _prescriptionService.getDrugToDrug(vital, lstAssessments, allergy, patient, prescription); if (_prescriptionService.hasError) { - error = _prescriptionService.error; + error = _prescriptionService.error!; setState(ViewState.ErrorLocal); } else setState(ViewState.Idle); } - void _filterList() { _prescriptionService.prescriptionsList.forEach((element) { /// PrescriptionsList list sort clinic - List prescriptionsByClinic = - _prescriptionsOrderListClinic - .where((elementClinic) => - elementClinic.filterName == element.clinicDescription) - .toList(); + List prescriptionsByClinic = _prescriptionsOrderListClinic.where((elementClinic) => elementClinic.filterName == element.clinicDescription).toList(); if (prescriptionsByClinic.length != 0) { - _prescriptionsOrderListClinic[ - _prescriptionsOrderListClinic.indexOf(prescriptionsByClinic[0])] - .prescriptionsList - .add(element); + _prescriptionsOrderListClinic[_prescriptionsOrderListClinic.indexOf(prescriptionsByClinic[0])].prescriptionsList!.add(element); } else { - _prescriptionsOrderListClinic.add(PrescriptionsList( - filterName: element.clinicDescription, prescriptions: element)); + _prescriptionsOrderListClinic.add(PrescriptionsList(filterName: element.clinicDescription, prescriptions: element)); } /// PrescriptionsList list sort via hospital - List prescriptionsByHospital = - _prescriptionsOrderListHospital - .where( - (elementClinic) => elementClinic.filterName == element.name, - ) - .toList(); + List prescriptionsByHospital = _prescriptionsOrderListHospital + .where( + (elementClinic) => elementClinic.filterName == element.name, + ) + .toList(); if (prescriptionsByHospital.length != 0) { - _prescriptionsOrderListHospital[_prescriptionsOrderListHospital - .indexOf(prescriptionsByHospital[0])] - .prescriptionsList - .add(element); + _prescriptionsOrderListHospital[_prescriptionsOrderListHospital.indexOf(prescriptionsByHospital[0])].prescriptionsList!.add(element); } else { - _prescriptionsOrderListHospital.add(PrescriptionsList( - filterName: element.name, prescriptions: element)); + _prescriptionsOrderListHospital.add(PrescriptionsList(filterName: element.name, prescriptions: element)); } }); } - _getPrescriptionsOrders() async { await _prescriptionService.getPrescriptionsOrders(); if (_prescriptionService.hasError) { - error = _prescriptionService.error; + error = _prescriptionService.error!; setState(ViewState.ErrorLocal); } else { setState(ViewState.Idle); } } - getPrescriptions(PatiantInformtion patient, {String patientType, bool isLocalBusy = true}) async { - if(isLocalBusy) - setState(ViewState.BusyLocal); - else setState(ViewState.Busy); + getPrescriptions(PatiantInformtion patient, {String? patientType, bool isLocalBusy = true}) async { + if (isLocalBusy) + setState(ViewState.BusyLocal); + else + setState(ViewState.Busy); await _prescriptionService.getPrescriptions(patient); if (_prescriptionService.hasError) { - error = _prescriptionService.error; + error = _prescriptionService.error!; if (isLocalBusy) setState(ViewState.ErrorLocal); else @@ -186,21 +156,18 @@ class PrescriptionViewModel extends BaseViewModel { setState(ViewState.Busy); await _prescriptionService.getMedicationForInPatient(patient); if (_prescriptionService.hasError) { - error = _prescriptionService.error; + error = _prescriptionService.error!; setState(ViewState.Error); } else { setState(ViewState.Idle); } } - getPrescriptionReport( - {Prescriptions prescriptions, - @required PatiantInformtion patient}) async { + getPrescriptionReport({Prescriptions? prescriptions, required PatiantInformtion patient}) async { setState(ViewState.Busy); - await _prescriptionService.getPrescriptionReport( - prescriptions: prescriptions, patient: patient); + await _prescriptionService.getPrescriptionReport(prescriptions: prescriptions!, patient: patient); if (_prescriptionService.hasError) { - error = _prescriptionService.error; + error = _prescriptionService.error!; setState(ViewState.ErrorLocal); } else { setState(ViewState.Idle); diff --git a/lib/core/viewModel/procedure_View_model.dart b/lib/core/viewModel/procedure_View_model.dart index 76571092..4b3dc786 100644 --- a/lib/core/viewModel/procedure_View_model.dart +++ b/lib/core/viewModel/procedure_View_model.dart @@ -7,8 +7,7 @@ import 'package:doctor_app_flutter/core/model/labs/patient_lab_orders.dart'; import 'package:doctor_app_flutter/core/model/labs/patient_lab_special_result.dart'; import 'package:doctor_app_flutter/core/model/procedure/ControlsModel.dart'; import 'package:doctor_app_flutter/core/model/procedure/categories_procedure.dart'; -import 'package:doctor_app_flutter/core/model/procedure/categories_procedure.dart' - as cpe; +import 'package:doctor_app_flutter/core/model/procedure/categories_procedure.dart' as cpe; import 'package:doctor_app_flutter/core/model/procedure/get_ordered_procedure_model.dart'; import 'package:doctor_app_flutter/core/model/procedure/post_procedure_req_model.dart'; import 'package:doctor_app_flutter/core/model/procedure/procedure_templateModel.dart'; @@ -36,55 +35,39 @@ class ProcedureViewModel extends BaseViewModel { bool hasError = false; ProcedureService _procedureService = locator(); - List get procedureList => - _procedureService.procedureList; + List get procedureList => _procedureService.procedureList; - List get valadteProcedureList => - _procedureService.valadteProcedureList; + List get valadteProcedureList => _procedureService.valadteProcedureList; - List get categoriesList => - _procedureService.categoriesList; + List get categoriesList => _procedureService.categoriesList; List get categoryList => _procedureService.categoryList; RadiologyService _radiologyService = locator(); LabsService _labsService = locator(); - List _finalRadiologyListClinic = List(); - List _finalRadiologyListHospital = List(); + List _finalRadiologyListClinic = []; + List _finalRadiologyListHospital = []; - List get finalRadiologyList => - filterType == FilterType.Clinic - ? _finalRadiologyListClinic - : _finalRadiologyListHospital; + List get finalRadiologyList => filterType == FilterType.Clinic ? _finalRadiologyListClinic : _finalRadiologyListHospital; - List get radiologyList => - _radiologyService.finalRadiologyList; + List get radiologyList => _radiologyService.finalRadiologyList; - List get patientLabOrdersList => - _labsService.patientLabOrdersList; + List get patientLabOrdersList => _labsService.patientLabOrdersList; - List get labOrdersResultsList => - _labsService.labOrdersResultsList; + List get labOrdersResultsList => _labsService.labOrdersResultsList; - List get procedureTemplate => - _procedureService.templateList; - List templateList = List(); + List get procedureTemplate => _procedureService.templateList; + List templateList = []; - List get procedureTemplateDetails => - _procedureService.templateDetailsList; + List get procedureTemplateDetails => _procedureService.templateDetailsList; - Future getProcedure( - {int mrn, - String patientType, - int appointmentNo, - bool isLocalBusy = false}) async { + Future getProcedure({int? mrn, String? patientType, int? appointmentNo, bool isLocalBusy = false}) async { hasError = false; await getDoctorProfile(); if (isLocalBusy) setState(ViewState.BusyLocal); else setState(ViewState.Busy); - await _procedureService.getProcedure( - mrn: mrn, appointmentNo: appointmentNo); + await _procedureService.getProcedure(mrn: mrn, appointmentNo: appointmentNo); if (_procedureService.hasError) { error = _procedureService.error; if (patientType == "7") @@ -95,21 +78,14 @@ class ProcedureViewModel extends BaseViewModel { setState(ViewState.Idle); } - Future getProcedureCategory( - {String categoryName, - String categoryID, - patientId, - bool isLocalBusy = false}) async { + Future getProcedureCategory({String? categoryName, String? categoryID, patientId, bool isLocalBusy = false}) async { if (categoryName == null) return; hasError = false; if (isLocalBusy) setState(ViewState.BusyLocal); else setState(ViewState.Busy); - await _procedureService.getProcedureCategory( - categoryName: categoryName, - categoryID: categoryID, - patientId: patientId); + await _procedureService.getProcedureCategory(categoryName: categoryName, categoryID: categoryID, patientId: patientId); if (_procedureService.hasError) { error = _procedureService.error; setState(ViewState.ErrorLocal); @@ -129,17 +105,13 @@ class ProcedureViewModel extends BaseViewModel { setState(ViewState.Idle); } - Future getProcedureTemplate( - {String categoryID, - bool isLocalBusy = false, - BuildContext context}) async { + Future getProcedureTemplate({String? categoryID, bool isLocalBusy = false, BuildContext? context}) async { if (isLocalBusy) { setState(ViewState.BusyLocal); } else { setState(ViewState.Busy); } - await _procedureService.getProcedureTemplate( - categoryID: categoryID, isLocalBusy: false); + await _procedureService.getProcedureTemplate(categoryID: categoryID, isLocalBusy: false); if (_procedureService.hasError) { error = _procedureService.error; setState(ViewState.ErrorLocal); @@ -150,20 +122,12 @@ class ProcedureViewModel extends BaseViewModel { setTemplateListDependOnId() { procedureTemplate.forEach((element) { - List templateListData = templateList - .where((elementTemplate) => - elementTemplate.templateId == element.templateID) - .toList(); + List templateListData = templateList.where((elementTemplate) => elementTemplate.templateId == element.templateID).toList(); if (templateListData.length != 0) { - templateList[templateList.indexOf(templateListData[0])] - .procedureTemplate - .add(element); + templateList[templateList.indexOf(templateListData[0])].procedureTemplate.add(element); } else { - var template = ProcedureTempleteDetailsModelList( - templateName: element.templateName, - templateId: element.templateID, - template: element); + var template = ProcedureTempleteDetailsModelList(templateName: element.templateName, templateId: element.templateID, template: element); if (!templateList.contains(template)) templateList.add(template); } }); @@ -172,7 +136,7 @@ class ProcedureViewModel extends BaseViewModel { int tempId = 0; - Future getProcedureTemplateDetails({int templateId}) async { + Future getProcedureTemplateDetails({required int templateId}) async { tempId = templateId; hasError = false; //_insuranceCardService.clearInsuranceCard(); @@ -185,8 +149,7 @@ class ProcedureViewModel extends BaseViewModel { setState(ViewState.Idle); } - Future postProcedure(PostProcedureReqModel postProcedureReqModel, int mrn, - {bool isLocalBusy = false}) async { + Future postProcedure(PostProcedureReqModel postProcedureReqModel, int mrn, {bool isLocalBusy = false}) async { hasError = false; if (isLocalBusy) setState(ViewState.BusyLocal); @@ -197,14 +160,12 @@ class ProcedureViewModel extends BaseViewModel { error = _procedureService.error; setState(ViewState.ErrorLocal); } else { - await getProcedure(mrn: mrn, isLocalBusy:isLocalBusy); + await getProcedure(mrn: mrn, isLocalBusy: isLocalBusy); setState(ViewState.Idle); } } - Future validationProcedure( - ProcedureValidationRequestModel procedureValidateRequestModel, - {bool isLocalBusy = false}) async { + Future validationProcedure(ProcedureValidationRequestModel procedureValidateRequestModel, {bool isLocalBusy = false}) async { hasError = false; if (isLocalBusy) { setState(ViewState.BusyLocal); @@ -220,13 +181,13 @@ class ProcedureViewModel extends BaseViewModel { } } - Future updateProcedure( - {UpdateProcedureRequestModel updateProcedureRequestModel, - int mrn, bool isLocalBusy = false}) async { + Future updateProcedure({UpdateProcedureRequestModel? updateProcedureRequestModel, int? mrn, bool isLocalBusy = false}) async { hasError = false; - if(isLocalBusy)setState(ViewState.BusyLocal); else - setState(ViewState.Busy); - await _procedureService.updateProcedure(updateProcedureRequestModel); + if (isLocalBusy) + setState(ViewState.BusyLocal); + else + setState(ViewState.Busy); + await _procedureService.updateProcedure(updateProcedureRequestModel!); if (_procedureService.hasError) { error = _procedureService.error; setState(ViewState.ErrorLocal); @@ -235,11 +196,9 @@ class ProcedureViewModel extends BaseViewModel { //await getProcedure(mrn: mrn); } - void getPatientRadOrders(PatiantInformtion patient, - {String patientType, bool isInPatient = false}) async { + void getPatientRadOrders(PatiantInformtion patient, {String? patientType, bool isInPatient = false}) async { setState(ViewState.Busy); - await _radiologyService.getPatientRadOrders(patient, - isInPatient: isInPatient); + await _radiologyService.getPatientRadOrders(patient, isInPatient: isInPatient); if (_radiologyService.hasError) { error = _radiologyService.error; if (patientType == "7") @@ -248,39 +207,25 @@ class ProcedureViewModel extends BaseViewModel { setState(ViewState.ErrorLocal); } else { _radiologyService.finalRadiologyList.forEach((element) { - List finalRadiologyListClinic = - _finalRadiologyListClinic - .where((elementClinic) => - elementClinic.filterName == element.clinicDescription) - .toList(); + List finalRadiologyListClinic = _finalRadiologyListClinic.where((elementClinic) => elementClinic.filterName == element.clinicDescription).toList(); if (finalRadiologyListClinic.length != 0) { - _finalRadiologyListClinic[ - finalRadiologyListClinic.indexOf(finalRadiologyListClinic[0])] - .finalRadiologyList - .add(element); + _finalRadiologyListClinic[finalRadiologyListClinic.indexOf(finalRadiologyListClinic[0])].finalRadiologyList.add(element); } else { - _finalRadiologyListClinic.add(FinalRadiologyList( - filterName: element.clinicDescription, finalRadiology: element)); + _finalRadiologyListClinic.add(FinalRadiologyList(filterName: element.clinicDescription, finalRadiology: element)); } // FinalRadiologyList list sort via project - List finalRadiologyListHospital = - _finalRadiologyListHospital - .where( - (elementClinic) => - elementClinic.filterName == element.projectName, - ) - .toList(); + List finalRadiologyListHospital = _finalRadiologyListHospital + .where( + (elementClinic) => elementClinic.filterName == element.projectName, + ) + .toList(); if (finalRadiologyListHospital.length != 0) { - _finalRadiologyListHospital[finalRadiologyListHospital - .indexOf(finalRadiologyListHospital[0])] - .finalRadiologyList - .add(element); + _finalRadiologyListHospital[finalRadiologyListHospital.indexOf(finalRadiologyListHospital[0])].finalRadiologyList.add(element); } else { - _finalRadiologyListHospital.add(FinalRadiologyList( - filterName: element.projectName, finalRadiology: element)); + _finalRadiologyListHospital.add(FinalRadiologyList(filterName: element.projectName, finalRadiology: element)); } }); @@ -290,17 +235,9 @@ class ProcedureViewModel extends BaseViewModel { String get radImageURL => _radiologyService.url; - getRadImageURL( - {int invoiceNo, - int lineItem, - int projectId, - @required PatiantInformtion patient}) async { + getRadImageURL({int invoiceNo = 0, int lineItem = 0, int projectId = 0, required PatiantInformtion patient}) async { setState(ViewState.Busy); - await _radiologyService.getRadImageURL( - invoiceNo: invoiceNo, - lineItem: lineItem, - projectId: projectId, - patient: patient); + await _radiologyService.getRadImageURL(invoiceNo: invoiceNo, lineItem: lineItem, projectId: projectId, patient: patient); if (_radiologyService.hasError) { error = _radiologyService.error; setState(ViewState.Error); @@ -313,12 +250,11 @@ class ProcedureViewModel extends BaseViewModel { notifyListeners(); } - List get patientLabSpecialResult => - _labsService.patientLabSpecialResult; + List get patientLabSpecialResult => _labsService.patientLabSpecialResult; List get labResultList => _labsService.labResultList; - List labResultLists = List(); + List labResultLists = []; List get labResultListsCoustom { return labResultLists; @@ -335,19 +271,9 @@ class ProcedureViewModel extends BaseViewModel { } } - getLaboratoryResult( - {String projectID, - int clinicID, - String invoiceNo, - String orderNo, - PatiantInformtion patient}) async { + getLaboratoryResult({String? projectID, int? clinicID, String? invoiceNo, String? orderNo, PatiantInformtion? patient}) async { setState(ViewState.Busy); - await _labsService.getLaboratoryResult( - invoiceNo: invoiceNo, - orderNo: orderNo, - projectID: projectID, - clinicID: clinicID, - patient: patient); + await _labsService.getLaboratoryResult(invoiceNo: invoiceNo, orderNo: orderNo, projectID: projectID, clinicID: clinicID, patient: patient); if (_labsService.hasError) { error = _labsService.error; setState(ViewState.Error); @@ -356,15 +282,9 @@ class ProcedureViewModel extends BaseViewModel { } } - getPatientLabOrdersResults( - {PatientLabOrders patientLabOrder, - String procedure, - PatiantInformtion patient}) async { + getPatientLabOrdersResults({PatientLabOrders? patientLabOrder, String? procedure, PatiantInformtion? patient}) async { setState(ViewState.Busy); - await _labsService.getPatientLabOrdersResults( - patientLabOrder: patientLabOrder, - procedure: procedure, - patient: patient); + await _labsService.getPatientLabOrdersResults(patientLabOrder: patientLabOrder, procedure: procedure, patient: patient); if (_labsService.hasError) { error = _labsService.error; setState(ViewState.Error); @@ -372,9 +292,7 @@ class ProcedureViewModel extends BaseViewModel { bool isShouldClear = false; if (_labsService.labOrdersResultsList.length == 1) { labOrdersResultsList.forEach((element) { - if (element.resultValue.contains('/') || - element.resultValue.contains('*') || - element.resultValue.isEmpty) isShouldClear = true; + if (element.resultValue!.contains('/') || element.resultValue!.contains('*') || element.resultValue!.isEmpty) isShouldClear = true; }); } if (isShouldClear) _labsService.labOrdersResultsList.clear(); @@ -382,7 +300,7 @@ class ProcedureViewModel extends BaseViewModel { } } - sendLabReportEmail({PatientLabOrders patientLabOrder, String mes}) async { + sendLabReportEmail({PatientLabOrders? patientLabOrder, String? mes}) async { await _labsService.sendLabReportEmail(patientLabOrder: patientLabOrder); if (_labsService.hasError) { error = _labsService.error; @@ -391,11 +309,11 @@ class ProcedureViewModel extends BaseViewModel { } Future preparePostProcedure({ - String remarks, - String orderType, - PatiantInformtion patient, - List entityList, - ProcedureType procedureType, + String? remarks, + String? orderType, + PatiantInformtion? patient, + List? entityList, + ProcedureType? procedureType, bool isLocalBusy = false, }) async { ///TODO Roaa Move it to function @@ -405,64 +323,49 @@ class ProcedureViewModel extends BaseViewModel { setState(ViewState.Busy); } PostProcedureReqModel postProcedureReqModel = new PostProcedureReqModel(); - ProcedureValidationRequestModel procedureValadteRequestModel = - new ProcedureValidationRequestModel(); - procedureValadteRequestModel.patientMRN = patient.patientMRN; + ProcedureValidationRequestModel procedureValadteRequestModel = new ProcedureValidationRequestModel(); + procedureValadteRequestModel.patientMRN = patient!.patientMRN; procedureValadteRequestModel.episodeID = patient.episodeNo; procedureValadteRequestModel.appointmentNo = patient.appointmentNo; - List controlsProcedure = List(); + List controlsProcedure = []; postProcedureReqModel.appointmentNo = patient.appointmentNo; postProcedureReqModel.episodeID = patient.episodeNo; postProcedureReqModel.patientMRN = patient.patientMRN; - entityList.forEach((element) { - procedureValadteRequestModel.procedure = [element.procedureId]; - List controls = List(); + entityList!.forEach((element) { + procedureValadteRequestModel.procedure = [element.procedureId!]; + List controls = []; controls.add( - Controls( - code: "remarks", - controlValue: element.remarks != null ? element.remarks : ""), + Controls(code: "remarks", controlValue: element.remarks != null ? element.remarks : ""), ); controls.add( - Controls( - code: "ordertype", - controlValue: procedureType == ProcedureType.PROCEDURE - ? element.type ?? "1" - : "0"), + Controls(code: "ordertype", controlValue: procedureType == ProcedureType.PROCEDURE ? element.type ?? "1" : "0"), ); - controlsProcedure.add(Procedures( - category: element.categoryID, - procedure: element.procedureId, - controls: controls)); + controlsProcedure.add(Procedures(category: element.categoryID, procedure: element.procedureId, controls: controls)); }); postProcedureReqModel.procedures = controlsProcedure; - await validationProcedure(procedureValadteRequestModel, - isLocalBusy: isLocalBusy); + await validationProcedure(procedureValadteRequestModel, isLocalBusy: isLocalBusy); if (state == ViewState.Idle) { - if (valadteProcedureList[0].entityList.length == 0) { - await postProcedure(postProcedureReqModel, patient.patientMRN, - isLocalBusy: isLocalBusy); + if (valadteProcedureList[0].entityList!.length == 0) { + await postProcedure(postProcedureReqModel, patient.patientMRN!, isLocalBusy: isLocalBusy); if (state == ViewState.ErrorLocal) { Utils.showErrorToast(error); getProcedure(mrn: patient.patientMRN, isLocalBusy: isLocalBusy); } else if (state == ViewState.Idle) { DrAppToastMsg.showSuccesToast('procedure has been added'); - if (Navigator.canPop(AppGlobal.CONTEX)) - Navigator.pop(AppGlobal.CONTEX); - if (Navigator.canPop(AppGlobal.CONTEX)) - Navigator.pop(AppGlobal.CONTEX); + if (Navigator.canPop(AppGlobal.CONTEX)) Navigator.pop(AppGlobal.CONTEX); + if (Navigator.canPop(AppGlobal.CONTEX)) Navigator.pop(AppGlobal.CONTEX); } } else { if (state == ViewState.ErrorLocal) { Utils.showErrorToast(error); getProcedure(mrn: patient.patientMRN); } else if (state == ViewState.Idle) { - Utils.showErrorToast( - valadteProcedureList[0].entityList[0].warringMessages); + Utils.showErrorToast(valadteProcedureList[0].entityList![0].warringMessages); } } } else { @@ -470,40 +373,29 @@ class ProcedureViewModel extends BaseViewModel { } } - bool isEntityListSelected( - cpe.EntityList masterKey, List entityList) { - Iterable history = entityList - .where((element) => masterKey.procedureId == element.procedureId); + bool isEntityListSelected(cpe.EntityList masterKey, List entityList) { + Iterable history = entityList.where((element) => masterKey.procedureId == element.procedureId); if (history.length > 0) { return true; } return false; } - bool isProcedureEntityListSelected(ProcedureTempleteDetailsModel masterKey, - List entityList) { - Iterable history = entityList.where( - (element) => - masterKey.templateID == element.templateID && - masterKey.procedureName == element.procedureName); + bool isProcedureEntityListSelected(ProcedureTempleteDetailsModel masterKey, List entityList) { + Iterable history = entityList.where((element) => masterKey.templateID == element.templateID && masterKey.procedureName == element.procedureName); if (history.length > 0) { return true; } return false; } - Future addProcedures( - ProcedureViewModel model, - List items, - PatiantInformtion patient, - TextEditingController remarksController, - {bool isLocalBusy = false}) async { + Future addProcedures(ProcedureViewModel model, List items, PatiantInformtion patient, TextEditingController remarksController, {bool isLocalBusy = false}) async { if (isLocalBusy) { setState(ViewState.BusyLocal); } else { setState(ViewState.Busy); } - List entityList = List(); + List entityList = []; items.forEach((element) { entityList.add( cpe.EntityList( @@ -518,21 +410,16 @@ class ProcedureViewModel extends BaseViewModel { eventCategory: "Procedure Checkout Screen", eventAction: "Add New Procedure", ); - await model.preparePostProcedure( - entityList: entityList, - patient: patient, - remarks: remarksController.text, - isLocalBusy: isLocalBusy); + await model.preparePostProcedure(entityList: entityList, patient: patient, remarks: remarksController.text, isLocalBusy: isLocalBusy); } - Future filterSearchResults(String query, List masterList, - List items) async { - List dummySearchList = List(); + Future filterSearchResults(String query, List masterList, List items) async { + List dummySearchList = []; dummySearchList.addAll(masterList); if (query.isNotEmpty) { - List dummyListData = List(); + List dummyListData = []; dummySearchList.forEach((item) { - if (item.procedureName.toLowerCase().contains(query.toLowerCase())) { + if (item.procedureName!.toLowerCase().contains(query.toLowerCase())) { dummyListData.add(item); } }); @@ -544,17 +431,13 @@ class ProcedureViewModel extends BaseViewModel { } } - void filterProcedureSearchResults( - String query, - List masterList, - List items) { - List dummySearchList = List(); - if(masterList!= null) - dummySearchList.addAll(masterList); + void filterProcedureSearchResults(String query, List? masterList, List items) { + List dummySearchList = []; + if (masterList != null) dummySearchList.addAll(masterList); if (query.isNotEmpty) { - List dummyListData = List(); + List dummyListData = []; dummySearchList.forEach((item) { - if (item.templateName.toLowerCase().contains(query.toLowerCase())) { + if (item.templateName!.toLowerCase().contains(query.toLowerCase())) { dummyListData.add(item); } }); @@ -563,7 +446,7 @@ class ProcedureViewModel extends BaseViewModel { return; } else { items.clear(); - items.addAll(masterList); + items.addAll(masterList!); } } } diff --git a/lib/core/viewModel/profile/discharge_summary_view_model.dart b/lib/core/viewModel/profile/discharge_summary_view_model.dart index 40bd0852..18f242f7 100644 --- a/lib/core/viewModel/profile/discharge_summary_view_model.dart +++ b/lib/core/viewModel/profile/discharge_summary_view_model.dart @@ -17,8 +17,8 @@ class DischargeSummaryViewModel extends BaseViewModel { _dischargeSummaryService.allDischargeSummaryList; Future getPendingDischargeSummary({ - int patientId, - int admissionNo, + required int patientId, + required int admissionNo, }) async { GetDischargeSummaryReqModel getDischargeSummaryReqModel = GetDischargeSummaryReqModel( @@ -28,7 +28,7 @@ class DischargeSummaryViewModel extends BaseViewModel { await _dischargeSummaryService.getPendingDischargeSummary( getDischargeSummaryReqModel: getDischargeSummaryReqModel); if (_dischargeSummaryService.hasError) { - error = _dischargeSummaryService.error; + error = _dischargeSummaryService.error!; setState(ViewState.ErrorLocal); } else { setState(ViewState.Idle); @@ -36,8 +36,8 @@ class DischargeSummaryViewModel extends BaseViewModel { } Future getAllDischargeSummary({ - int patientId, - int admissionNo, + required int patientId, + required int admissionNo, }) async { GetDischargeSummaryReqModel getDischargeSummaryReqModel = GetDischargeSummaryReqModel( diff --git a/lib/core/viewModel/profile/intervention_medication_view_model.dart b/lib/core/viewModel/profile/intervention_medication_view_model.dart index ce52f827..d1d1da6d 100644 --- a/lib/core/viewModel/profile/intervention_medication_view_model.dart +++ b/lib/core/viewModel/profile/intervention_medication_view_model.dart @@ -14,50 +14,38 @@ import '../../service/patient/profile/intervention_medication_service.dart'; import '../../service/special_clinics/special_clinic_service.dart'; class InterventionMedicationViewModel extends BaseViewModel { - SpecialClinicsService _specialClinicsService = - locator(); + SpecialClinicsService _specialClinicsService = locator(); - List - get specialClinicalCareMappingList => - _specialClinicsService.specialClinicalCareMappingList; + List get specialClinicalCareMappingList => _specialClinicsService.specialClinicalCareMappingList; List filterData = []; DateTime selectedFromDate = DateTime.now(); DateTime selectedToDate = DateTime.now().add(Duration(days: 1)); - PatiantInformtion patient; + PatiantInformtion? patient; bool hasError = false; - InterventionMedicationService _interventionMedicationService = - locator(); + InterventionMedicationService _interventionMedicationService = locator(); - List get allInterventionList => - _interventionMedicationService.allInterventionList; + List get allInterventionList => _interventionMedicationService.allInterventionList; - List get allInterventionHistoryList => - _interventionMedicationService.allInterventionHistoryList; + List get allInterventionHistoryList => _interventionMedicationService.allInterventionHistoryList; Future getInterventionMedication({ - - int projectId, - int patientId, - DateTime fromDate, - DateTime toDate, - + int? projectId, + int? patientId, + DateTime? fromDate, + DateTime? toDate, }) async { - InterventionMedicationReqModel interventionMedicationReqModel = - InterventionMedicationReqModel( - - projectID: projectId, - patientID: patientId, - fromDate: AppDateUtils.convertDateToServerFormat(fromDate), - toDate: AppDateUtils.convertDateToServerFormat(toDate), - + InterventionMedicationReqModel interventionMedicationReqModel = InterventionMedicationReqModel( + projectID: projectId, + patientID: patientId, + fromDate: AppDateUtils.convertDateToServerFormat(fromDate!), + toDate: AppDateUtils.convertDateToServerFormat(toDate!), ); hasError = false; setState(ViewState.Busy); - await _interventionMedicationService.getInterventionMedication( - interventionMedicationReqModel: interventionMedicationReqModel); + await _interventionMedicationService.getInterventionMedication(interventionMedicationReqModel: interventionMedicationReqModel); if (_interventionMedicationService.hasError) { error = _interventionMedicationService.error; setState(ViewState.Error); @@ -66,34 +54,20 @@ class InterventionMedicationViewModel extends BaseViewModel { } } - Future getInterventionMedicationHistory( - { - int projectId, - int patientId, - int admissionNo, - int prescriptionNo, - int orderNo, - - bool isBusyLocal = false}) async { - InterventionMedicationHistoryReqModel - interventionMedicationHistoryReqModel = - InterventionMedicationHistoryReqModel( - - projectID: projectId, - patientID: patientId, - admissionNo: admissionNo, - prescriptionNo: prescriptionNo, - orderNo: orderNo, - + Future getInterventionMedicationHistory({int? projectId, int? patientId, int? admissionNo, int? prescriptionNo, int? orderNo, bool isBusyLocal = false}) async { + InterventionMedicationHistoryReqModel interventionMedicationHistoryReqModel = InterventionMedicationHistoryReqModel( + projectID: projectId, + patientID: patientId, + admissionNo: admissionNo, + prescriptionNo: prescriptionNo, + orderNo: orderNo, ); hasError = false; if (isBusyLocal) setState(ViewState.Busy); else setState(ViewState.Busy); - await _interventionMedicationService.getInterventionMedicationHistory( - interventionMedicationHistoryReqModel: - interventionMedicationHistoryReqModel); + await _interventionMedicationService.getInterventionMedicationHistory(interventionMedicationHistoryReqModel: interventionMedicationHistoryReqModel); if (_interventionMedicationService.hasError) { error = _interventionMedicationService.error; if (isBusyLocal) @@ -106,20 +80,17 @@ class InterventionMedicationViewModel extends BaseViewModel { } Future setAcceptedOrRejected({ - - String remarks, - int memberId, - int projectId, - int patientID, - int admissionNo, - int prescriptionNo, - int orderNo, - int interventionStatus, - int status, - + String? remarks, + int? memberId, + int? projectId, + int? patientID, + int? admissionNo, + int? prescriptionNo, + int? orderNo, + int? interventionStatus, + int? status, }) async { AcceptOrRejectReqModel acceptOrRejectReqModel = AcceptOrRejectReqModel( - projectID: projectId, patientID: patientID, admissionNo: admissionNo, @@ -130,13 +101,10 @@ class InterventionMedicationViewModel extends BaseViewModel { remarks: remarks, memberID: memberId, interventionStatus: interventionStatus, - status: status - - ); + status: status); hasError = false; setState(ViewState.BusyLocal); - await _interventionMedicationService.setAcceptedOrRejected( - acceptOrRejectReqModel: acceptOrRejectReqModel); + await _interventionMedicationService.setAcceptedOrRejected(acceptOrRejectReqModel: acceptOrRejectReqModel); if (_interventionMedicationService.hasError) { error = _interventionMedicationService.error; setState(ViewState.ErrorLocal); diff --git a/lib/core/viewModel/profile/pharmacy_intervention_view_model.dart b/lib/core/viewModel/profile/pharmacy_intervention_view_model.dart index bb0bd453..1fdc63cb 100644 --- a/lib/core/viewModel/profile/pharmacy_intervention_view_model.dart +++ b/lib/core/viewModel/profile/pharmacy_intervention_view_model.dart @@ -21,8 +21,8 @@ class PharmacyInterventionViewModel extends BaseViewModel { List filterData = []; - DateTime selectedFromDate; - DateTime selectedToDate; + DateTime? selectedFromDate; + DateTime? selectedToDate; int firstSubsetIndex = 0; int inPatientPageSize = 20; @@ -39,7 +39,7 @@ class PharmacyInterventionViewModel extends BaseViewModel { List get myIinPatientList => _inPatientService.myInPatientList; - List filteredInPatientItems = List(); - List filteredMyInPatientItems = List(); + List filteredInPatientItems = []; + List filteredMyInPatientItems = []; } diff --git a/lib/core/viewModel/profile/vte_assessment_view_model.dart b/lib/core/viewModel/profile/vte_assessment_view_model.dart index e4f1df14..5836a715 100644 --- a/lib/core/viewModel/profile/vte_assessment_view_model.dart +++ b/lib/core/viewModel/profile/vte_assessment_view_model.dart @@ -17,8 +17,8 @@ class VteAssessmentViewModel extends BaseViewModel { _VteAssessmentService.allVteHistoryList; Future getVteAssessment({ - int patientId, - int admissionNo, + int? patientId, + int? admissionNo, }) async { VteAssessmentRequestModel vteAssessmentRequestModel = VteAssessmentRequestModel( diff --git a/lib/core/viewModel/project_view_model.dart b/lib/core/viewModel/project_view_model.dart index 7e0c2468..215e11cd 100644 --- a/lib/core/viewModel/project_view_model.dart +++ b/lib/core/viewModel/project_view_model.dart @@ -17,7 +17,8 @@ Utils helpers = Utils(); class ProjectViewModel with ChangeNotifier { DrAppSharedPreferances sharedPref = DrAppSharedPreferances(); - Locale _appLocale; + late Locale _appLocale; + String currentLanguage = 'ar'; bool _isArabic = false; bool isInternetConnection = true; @@ -30,14 +31,12 @@ class ProjectViewModel with ChangeNotifier { Locale get appLocal => _appLocale; bool get isArabic => _isArabic; - StreamSubscription subscription; + late StreamSubscription subscription; ProjectViewModel() { loadSharedPrefLanguage(); - subscription = Connectivity() - .onConnectivityChanged - .listen((ConnectivityResult result) { + subscription = Connectivity().onConnectivityChanged.listen((ConnectivityResult result) { switch (result) { case ConnectivityResult.wifi: isInternetConnection = true; @@ -95,8 +94,7 @@ class ProjectViewModel with ChangeNotifier { try { dynamic localRes; - await baseAppClient.post(GET_CLINICS_FOR_DOCTOR, - onSuccess: (dynamic response, int statusCode) { + await baseAppClient.post(GET_CLINICS_FOR_DOCTOR, onSuccess: (dynamic response, int statusCode) { doctorClinicsList = []; response['List_DoctorsClinic'].forEach((v) { doctorClinicsList.add(new ClinicModel.fromJson(v)); @@ -114,7 +112,7 @@ class ProjectViewModel with ChangeNotifier { } void getProfile() async { - Map profile = await sharedPref.getObj(DOCTOR_PROFILE); + Map profile = await sharedPref.getObj(DOCTOR_PROFILE); DoctorProfileModel doctorProfile = new DoctorProfileModel.fromJson(profile); ClinicModel clinicModel = ClinicModel( doctorID: doctorProfile.doctorID, @@ -122,7 +120,6 @@ class ProjectViewModel with ChangeNotifier { projectID: doctorProfile.projectID, ); - await Provider.of(AppGlobal.CONTEX, listen: false) - .getDoctorProfileBasedOnClinic(clinicModel); + await Provider.of(AppGlobal.CONTEX, listen: false).getDoctorProfileBasedOnClinic(clinicModel); } } diff --git a/lib/core/viewModel/radiology_view_model.dart b/lib/core/viewModel/radiology_view_model.dart index 35b39cb7..df864605 100644 --- a/lib/core/viewModel/radiology_view_model.dart +++ b/lib/core/viewModel/radiology_view_model.dart @@ -12,8 +12,8 @@ class RadiologyViewModel extends BaseViewModel { FilterType filterType = FilterType.Clinic; RadiologyService _radiologyService = locator(); - List _finalRadiologyListClinic = List(); - List _finalRadiologyListHospital = List(); + List _finalRadiologyListClinic = []; + List _finalRadiologyListHospital = []; List get finalRadiologyList => filterType == FilterType.Clinic @@ -73,15 +73,15 @@ class RadiologyViewModel extends BaseViewModel { String get radImageURL => _radiologyService.url; getRadImageURL( - {int invoiceNo, - int lineItem, - int projectId, - @required PatiantInformtion patient}) async { + {int? invoiceNo, + int? lineItem, + int? projectId, + required PatiantInformtion patient}) async { setState(ViewState.Busy); await _radiologyService.getRadImageURL( - invoiceNo: invoiceNo, - lineItem: lineItem, - projectId: projectId, + invoiceNo: invoiceNo!, + lineItem: lineItem!, + projectId: projectId!, patient: patient); if (_radiologyService.hasError) { error = _radiologyService.error; diff --git a/lib/icons_app/doctor_app_icons.dart b/lib/icons_app/doctor_app_icons.dart index c962adcd..113fcbae 100644 --- a/lib/icons_app/doctor_app_icons.dart +++ b/lib/icons_app/doctor_app_icons.dart @@ -23,7 +23,7 @@ class DoctorApp { DoctorApp._(); static const _kFontFam = 'DoctorApp'; - static const String _kFontPkg = null; + static const String _kFontPkg = ""; static const IconData female_icon = IconData(0xe800, fontFamily: _kFontFam, fontPackage: _kFontPkg); diff --git a/lib/screens/ER_singin/ER_singin_screen.dart b/lib/screens/ER_singin/ER_singin_screen.dart index 0d9dbc5e..31a8cada 100644 --- a/lib/screens/ER_singin/ER_singin_screen.dart +++ b/lib/screens/ER_singin/ER_singin_screen.dart @@ -31,7 +31,7 @@ class ErSignInScreen extends StatefulWidget { } class _ErSignInScreenState extends State { - ProjectViewModel projectViewModel; + ProjectViewModel? projectViewModel; @override Widget build(BuildContext context) { projectViewModel = Provider.of(context); @@ -44,7 +44,7 @@ class _ErSignInScreenState extends State { , body: Center( child: Container( - margin: EdgeInsets.only(top: SizeConfig.realScreenHeight / 7), + margin: EdgeInsets.only(top: SizeConfig.realScreenHeight! / 7), child: FractionallySizedBox( widthFactor: 0.9, child: ListView( @@ -114,13 +114,12 @@ class _ErSignInScreenState extends State { } - signInERPatient ({BuildContext context, ERSignInViewModel model, patientId, signInType}) async { - GifLoaderDialogUtils.showMyDialog(context); - await model.signInERPatient(patientId:patientId, signInType: signInType ); + signInERPatient ({BuildContext? context, ERSignInViewModel? model, patientId, signInType}) async { + GifLoaderDialogUtils.showMyDialog(context!); + await model!.signInERPatient(patientId:patientId, signInType: signInType ); if(model.state == ViewState.ErrorLocal) { Utils.showErrorToast(model.error); } else { - /// TODO Elham* Create this in Utils DrAppToastMsg.showSuccesToast("Add successfully"); } GifLoaderDialogUtils.hideDialog(context); @@ -129,9 +128,9 @@ class _ErSignInScreenState extends State { } /// TODO Elham* Make this as custom Dialog - showMyDialog({BuildContext context, Function firstAction,Function secondAction, }) { + showMyDialog({BuildContext? context, Function? firstAction,Function? secondAction, }) { showDialog( - context: context, + context: context!, builder: (ctx) => Center( child: Container( width: MediaQuery.of(context).size.width * 0.8, @@ -172,7 +171,7 @@ class _ErSignInScreenState extends State { padding: EdgeInsets.all(20), color: Colors.white, child: AppText( - projectViewModel.isArabic + projectViewModel!.isArabic ? "الرجاء اختيار الإجراء الذي تريد القيام به" : 'Please choose the action you want to do ', fontSize: 15, @@ -189,7 +188,7 @@ class _ErSignInScreenState extends State { child: Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ - FlatButton( + ElevatedButton( child: AppText( "Sing In", fontWeight: FontWeight.w600, @@ -197,11 +196,9 @@ class _ErSignInScreenState extends State { fontSize: 16, ), //Text("Cancel"), onPressed: () async { - await firstAction(); - - + await firstAction!(); }), - FlatButton( + ElevatedButton( child: AppText( "Sing Out", fontWeight: FontWeight.w600, @@ -209,7 +206,7 @@ class _ErSignInScreenState extends State { fontSize: 16, ), //Text("Confirm", ), onPressed: () async { - await secondAction(); + await secondAction!(); }) ], ), diff --git a/lib/screens/auth/login_screen.dart b/lib/screens/auth/login_screen.dart index 0527742a..13489fe6 100644 --- a/lib/screens/auth/login_screen.dart +++ b/lib/screens/auth/login_screen.dart @@ -20,7 +20,7 @@ class LoginScreen extends StatefulWidget { } class _LoginScreenState extends State { - String platformImei; + String? platformImei; bool allowCallApi = true; //TODO change AppTextFormField to AppTextFormFieldCustom @@ -31,7 +31,7 @@ class _LoginScreenState extends State { List projectsList = []; FocusNode focusPass = FocusNode(); FocusNode focusProject = FocusNode(); - AuthenticationViewModel authenticationViewModel; + AuthenticationViewModel authenticationViewModel = AuthenticationViewModel(); @override Widget build(BuildContext context) { @@ -84,7 +84,7 @@ class _LoginScreenState extends State { fontWeight: FontWeight.bold, fontSize: SizeConfig.isMobile ? 24 - : SizeConfig.realScreenWidth * + : SizeConfig.realScreenWidth! * 0.029, fontFamily: 'Poppins'), ), @@ -93,7 +93,7 @@ class _LoginScreenState extends State { style: TextStyle( fontSize: SizeConfig.isMobile ? 16 - : SizeConfig.realScreenWidth * + : SizeConfig.realScreenWidth! * 0.030, fontWeight: FontWeight.w600, color: Color(0xFFD02127)), @@ -110,8 +110,8 @@ class _LoginScreenState extends State { mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ Container( - width: SizeConfig.realScreenWidth * 0.90, - height: SizeConfig.realScreenHeight * 0.65, + width: SizeConfig.realScreenWidth! * 0.90, + height: SizeConfig.realScreenHeight! * 0.65, child: Column( crossAxisAlignment: CrossAxisAlignment.start, @@ -221,8 +221,8 @@ class _LoginScreenState extends State { login( context, ) async { - if (loginFormKey.currentState.validate()) { - loginFormKey.currentState.save(); + if (loginFormKey.currentState!.validate()) { + loginFormKey.currentState!.save(); GifLoaderDialogUtils.showMyDialog(context); await authenticationViewModel.login(authenticationViewModel.userInfo); if (authenticationViewModel.state == ViewState.ErrorLocal) { @@ -248,10 +248,10 @@ class _LoginScreenState extends State { setState(() { authenticationViewModel.userInfo.projectID = projectsList[index].facilityId; - projectIdController.text = projectsList[index].facilityName; + projectIdController.text = projectsList[index].facilityName!; }); - primaryFocus.unfocus(); + primaryFocus!.unfocus(); } String memberID = ""; @@ -266,7 +266,7 @@ class _LoginScreenState extends State { setState(() { authenticationViewModel.userInfo.projectID = projectsList[0].facilityId; - projectIdController.text = projectsList[0].facilityName; + projectIdController.text = projectsList[0].facilityName!; }); } } diff --git a/lib/screens/auth/verification_methods_screen.dart b/lib/screens/auth/verification_methods_screen.dart index 03669eb7..c6a0b68f 100644 --- a/lib/screens/auth/verification_methods_screen.dart +++ b/lib/screens/auth/verification_methods_screen.dart @@ -35,17 +35,17 @@ class VerificationMethodsScreen extends StatefulWidget { }); @override - _VerificationMethodsScreenState createState() => - _VerificationMethodsScreenState(); + _VerificationMethodsScreenState createState() => _VerificationMethodsScreenState(); } class _VerificationMethodsScreenState extends State { - ProjectViewModel projectsProvider; + late ProjectViewModel projectsProvider; bool isMoreOption = false; bool onlySMSBox = false; - AuthMethodTypes fingerPrintBefore; - AuthMethodTypes selectedOption; - AuthenticationViewModel authenticationViewModel; + late AuthMethodTypes fingerPrintBefore; + + late AuthMethodTypes selectedOption; + AuthenticationViewModel authenticationViewModel = AuthenticationViewModel(); @override Widget build(BuildContext context) { @@ -64,16 +64,13 @@ class _VerificationMethodsScreenState extends State { crossAxisAlignment: CrossAxisAlignment.start, children: [ SizedBox( - height: SizeConfig.heightMultiplier * - (SizeConfig.isHeightVeryShort ? 6 : 4), + height: SizeConfig.heightMultiplier! * (SizeConfig.isHeightVeryShort ? 6 : 4), ), if (authenticationViewModel.isFromLogin) InkWell( onTap: () { - authenticationViewModel.setUnverified(false, - isFromLogin: false); - authenticationViewModel - .setAppStatus(APP_STATUS.UNAUTHENTICATED); + authenticationViewModel.setUnverified(false, isFromLogin: false); + authenticationViewModel.setAppStatus(APP_STATUS.UNAUTHENTICATED); }, child: Icon( Icons.arrow_back_ios, @@ -82,48 +79,38 @@ class _VerificationMethodsScreenState extends State { Column( children: [ SizedBox( - height: SizeConfig.heightMultiplier * - (SizeConfig.isHeightVeryShort ? 3 : 4), + height: SizeConfig.heightMultiplier! * (SizeConfig.isHeightVeryShort ? 3 : 4), ), - authenticationViewModel.user != null && - isMoreOption == false + authenticationViewModel.user != null && isMoreOption == false ? Column( mainAxisAlignment: MainAxisAlignment.spaceEvenly, crossAxisAlignment: CrossAxisAlignment.start, children: [ AppText( TranslationBase.of(context).welcomeBack, - fontSize: SizeConfig - .getTextMultiplierBasedOnWidth() * - 3.5, + fontSize: SizeConfig.getTextMultiplierBasedOnWidth() * 3.5, fontWeight: FontWeight.w600, color: AppGlobal.appTextColor, letterSpacing: -0.72, ), AppText( - Utils.convertToTitleCase( - authenticationViewModel.user.doctorName), - fontSize: SizeConfig - .getTextMultiplierBasedOnWidth() * - 6, + Utils.convertToTitleCase(authenticationViewModel.user.doctorName!), + fontSize: SizeConfig.getTextMultiplierBasedOnWidth() * 6, color: AppGlobal.appTextColor, fontWeight: FontWeight.bold, letterSpacing: -1.44, ), SizedBox( - height: SizeConfig.heightMultiplier * 4, + height: SizeConfig.heightMultiplier! * 4, ), AppText( TranslationBase.of(context).accountInfo, - fontSize: SizeConfig - .getTextMultiplierBasedOnWidth() * - 4.5, + fontSize: SizeConfig.getTextMultiplierBasedOnWidth() * 4.5, color: Color(0xFF2E303A), fontWeight: FontWeight.w600, letterSpacing: -0.64, ), - SizedBox( - height: SizeConfig.heightMultiplier * 4), + SizedBox(height: SizeConfig.heightMultiplier! * 4), Container( padding: EdgeInsets.all(15), decoration: BoxDecoration( @@ -131,164 +118,98 @@ class _VerificationMethodsScreenState extends State { borderRadius: BorderRadius.all( Radius.circular(10), ), - border: Border.all( - color: HexColor('#707070'), width: 0.1), + border: Border.all(color: HexColor('#707070'), width: 0.1), ), child: Row( - mainAxisAlignment: - MainAxisAlignment.spaceBetween, - crossAxisAlignment: - CrossAxisAlignment.start, + mainAxisAlignment: MainAxisAlignment.spaceBetween, + crossAxisAlignment: CrossAxisAlignment.start, children: [ Container( - width: SizeConfig.realScreenWidth * .5, + width: SizeConfig.realScreenWidth! * .5, padding: EdgeInsets.all(0), child: Column( - mainAxisAlignment: - MainAxisAlignment.start, + mainAxisAlignment: MainAxisAlignment.start, children: [ Text( - TranslationBase.of(context) - .lastLoginAt, + TranslationBase.of(context).lastLoginAt, overflow: TextOverflow.ellipsis, style: TextStyle( fontFamily: 'Poppins', - fontSize: SizeConfig - .getTextMultiplierBasedOnWidth() * - 4.5, + fontSize: SizeConfig.getTextMultiplierBasedOnWidth() * 4.5, color: Color(0xFF2E303A), fontWeight: FontWeight.w600, letterSpacing: -0.4), ), Container( - width: MediaQuery.of(context) - .size - .width * - 0.55, + width: MediaQuery.of(context).size.width * 0.55, child: RichText( text: TextSpan( - text: TranslationBase.of( - context) - .verifyWith + - ':', + text: TranslationBase.of(context).verifyWith + ':', style: TextStyle( - color: - Color(0xFF575757), - fontSize: SizeConfig - .getTextMultiplierBasedOnWidth() * - 3.5, + color: Color(0xFF575757), + fontSize: SizeConfig.getTextMultiplierBasedOnWidth() * 3.5, fontFamily: 'Poppins', - fontWeight: - FontWeight.w600, + fontWeight: FontWeight.w600, letterSpacing: -0.4), children: [ TextSpan( - text: authenticationViewModel - .getType( - authenticationViewModel - .user - .logInTypeID, - context), + text: authenticationViewModel.getType(authenticationViewModel.user.logInTypeID, context), style: TextStyle( - color: AppGlobal - .appTextColor, - fontSize: SizeConfig - .getTextMultiplierBasedOnWidth() * - 3.5, - fontFamily: - 'Poppins', - fontWeight: - FontWeight.w600, - letterSpacing: - -0.48), + color: AppGlobal.appTextColor, + fontSize: SizeConfig.getTextMultiplierBasedOnWidth() * 3.5, + fontFamily: 'Poppins', + fontWeight: FontWeight.w600, + letterSpacing: -0.48), ) ]), ), ), ], - crossAxisAlignment: - CrossAxisAlignment.start, + crossAxisAlignment: CrossAxisAlignment.start, ), ), Column( - mainAxisAlignment: - MainAxisAlignment.start, + mainAxisAlignment: MainAxisAlignment.start, children: [ AppText( - authenticationViewModel - .user.editedOn != - null - ? AppDateUtils - .getDayMonthYearDateFormatted( - AppDateUtils - .convertStringToDate( - authenticationViewModel - .user - .editedOn), - isMonthShort: true) - : authenticationViewModel - .user.createdOn != - null - ? AppDateUtils.getDayMonthYearDateFormatted( - AppDateUtils - .convertStringToDate( - authenticationViewModel - .user - .createdOn), - isMonthShort: true) + authenticationViewModel.user.editedOn != null + ? AppDateUtils.getDayMonthYearDateFormatted(AppDateUtils.convertStringToDate(authenticationViewModel.user.editedOn!), isMonthShort: true) + : authenticationViewModel.user.createdOn != null + ? AppDateUtils.getDayMonthYearDateFormatted(AppDateUtils.convertStringToDate(authenticationViewModel.user.createdOn!), isMonthShort: true) : '--', textAlign: TextAlign.right, - fontSize: SizeConfig - .getTextMultiplierBasedOnWidth() * - 4.5, + fontSize: SizeConfig.getTextMultiplierBasedOnWidth() * 4.5, color: Color(0xFF2E303A), fontWeight: FontWeight.w700, letterSpacing: -0.48, ), AppText( - authenticationViewModel - .user.editedOn != - null - ? AppDateUtils.getHour(AppDateUtils - .convertStringToDate( - authenticationViewModel - .user.editedOn)) - : authenticationViewModel - .user.createdOn != - null - ? AppDateUtils.getHour( - AppDateUtils - .convertStringToDate( - authenticationViewModel - .user - .createdOn)) + authenticationViewModel.user.editedOn != null + ? AppDateUtils.getHour(AppDateUtils.convertStringToDate(authenticationViewModel.user.editedOn!)) + : authenticationViewModel.user.createdOn != null + ? AppDateUtils.getHour(AppDateUtils.convertStringToDate(authenticationViewModel.user.createdOn!)) : '--', textAlign: TextAlign.right, - fontSize: SizeConfig - .getTextMultiplierBasedOnWidth() * - 3.5, + fontSize: SizeConfig.getTextMultiplierBasedOnWidth() * 3.5, fontWeight: FontWeight.w600, letterSpacing: -0.48, color: Color(0xFF575757), ) ], - crossAxisAlignment: - CrossAxisAlignment.end, + crossAxisAlignment: CrossAxisAlignment.end, ) ], ), ), SizedBox( - height: SizeConfig.heightMultiplier * 3, + height: SizeConfig.heightMultiplier! * 3, ), Row( children: [ //todo add translation AppText( "Please Verify", - fontSize: SizeConfig - .getTextMultiplierBasedOnWidth() * - 4.5, + fontSize: SizeConfig.getTextMultiplierBasedOnWidth() * 4.5, color: AppGlobal.appTextColor, fontWeight: FontWeight.w600, letterSpacing: -.64, @@ -296,154 +217,93 @@ class _VerificationMethodsScreenState extends State { ], ), SizedBox( - height: SizeConfig.heightMultiplier * 2, + height: SizeConfig.heightMultiplier! * 2, ), ], ) - : Column( - mainAxisAlignment: MainAxisAlignment.spaceEvenly, - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - this.onlySMSBox == false - ? Container( - margin: EdgeInsets.only( - bottom: 20, top: 30), - child: AppText( - TranslationBase.of(context) - .verifyLoginWith, - fontSize: SizeConfig - .getTextMultiplierBasedOnWidth() * - 4, - color: Color(0xFF2E303A), - fontWeight: FontWeight.bold, - textAlign: TextAlign.left, - ), - ) - : AppText( - TranslationBase.of(context) - .verifyFingerprint2, - fontSize: SizeConfig - .getTextMultiplierBasedOnWidth() * - 4, - textAlign: TextAlign.start, - ), - ]), - authenticationViewModel.user != null && - isMoreOption == false - ? Column( - mainAxisAlignment: MainAxisAlignment.start, - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Row( - mainAxisAlignment: - MainAxisAlignment.center, + : Column(mainAxisAlignment: MainAxisAlignment.spaceEvenly, crossAxisAlignment: CrossAxisAlignment.start, children: [ + this.onlySMSBox == false + ? Container( + margin: EdgeInsets.only(bottom: 20, top: 30), + child: AppText( + TranslationBase.of(context).verifyLoginWith, + fontSize: SizeConfig.getTextMultiplierBasedOnWidth() * 4, + color: Color(0xFF2E303A), + fontWeight: FontWeight.bold, + textAlign: TextAlign.left, + ), + ) + : AppText( + TranslationBase.of(context).verifyFingerprint2, + fontSize: SizeConfig.getTextMultiplierBasedOnWidth() * 4, + textAlign: TextAlign.start, + ), + ]), + authenticationViewModel.user != null && isMoreOption == false + ? Column(mainAxisAlignment: MainAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start, children: [ + Row(mainAxisAlignment: MainAxisAlignment.center, children: [ + Expanded( + child: InkWell( + onTap: () => { + // TODO check this logic it seem it will create bug to us + authenticateUser(AuthMethodTypes.Fingerprint, true) + }, + child: VerificationMethodsList( + authenticationViewModel: authenticationViewModel, + authMethodType: SelectedAuthMethodTypesService.getMethodsTypeService(authenticationViewModel.user.logInTypeID!), + authenticateUser: (AuthMethodTypes authMethodType, isActive) => authenticateUser(authMethodType, isActive), + )), + ), + Expanded( + child: VerificationMethodsList( + authenticationViewModel: authenticationViewModel, + authMethodType: AuthMethodTypes.MoreOptions, + onShowMore: () { + setState(() { + isMoreOption = true; + }); + }, + )) + ]), + ]) + : Column(mainAxisAlignment: MainAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start, children: [ + onlySMSBox == false + ? Row( + mainAxisAlignment: MainAxisAlignment.center, children: [ Expanded( - child: InkWell( - onTap: () => { - // TODO check this logic it seem it will create bug to us - authenticateUser( - AuthMethodTypes - .Fingerprint, - true) - }, - child: VerificationMethodsList( - authenticationViewModel: - authenticationViewModel, - authMethodType: - SelectedAuthMethodTypesService - .getMethodsTypeService( - authenticationViewModel - .user - .logInTypeID), - authenticateUser: - (AuthMethodTypes - authMethodType, - isActive) => - authenticateUser( - authMethodType, - isActive), - )), - ), + child: VerificationMethodsList( + authenticationViewModel: authenticationViewModel, + authMethodType: AuthMethodTypes.Fingerprint, + authenticateUser: (AuthMethodTypes authMethodType, isActive) => authenticateUser(authMethodType, isActive), + )), Expanded( child: VerificationMethodsList( - authenticationViewModel: - authenticationViewModel, - authMethodType: - AuthMethodTypes.MoreOptions, - onShowMore: () { - setState(() { - isMoreOption = true; - }); - }, + authenticationViewModel: authenticationViewModel, + authMethodType: AuthMethodTypes.FaceID, + authenticateUser: (AuthMethodTypes authMethodType, isActive) => authenticateUser(authMethodType, isActive), )) - ]), - ]) - : Column( - mainAxisAlignment: MainAxisAlignment.start, - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - onlySMSBox == false - ? Row( - mainAxisAlignment: - MainAxisAlignment.center, - children: [ - Expanded( - child: VerificationMethodsList( - authenticationViewModel: - authenticationViewModel, - authMethodType: - AuthMethodTypes.Fingerprint, - authenticateUser: (AuthMethodTypes - authMethodType, - isActive) => - authenticateUser( - authMethodType, isActive), - )), - Expanded( - child: VerificationMethodsList( - authenticationViewModel: - authenticationViewModel, - authMethodType: - AuthMethodTypes.FaceID, - authenticateUser: (AuthMethodTypes - authMethodType, - isActive) => - authenticateUser( - authMethodType, isActive), - )) - ], - ) - : SizedBox(), - Row( - mainAxisAlignment: MainAxisAlignment.center, - children: [ - Expanded( - child: VerificationMethodsList( - authenticationViewModel: - authenticationViewModel, - authMethodType: AuthMethodTypes.SMS, - authenticateUser: - (AuthMethodTypes authMethodType, - isActive) => - authenticateUser( - authMethodType, isActive), - )), - Expanded( - child: VerificationMethodsList( - authenticationViewModel: - authenticationViewModel, - authMethodType: - AuthMethodTypes.WhatsApp, - authenticateUser: - (AuthMethodTypes authMethodType, - isActive) => - authenticateUser( - authMethodType, isActive), - )) - ], - ), - ]), + ], + ) + : SizedBox(), + Row( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + Expanded( + child: VerificationMethodsList( + authenticationViewModel: authenticationViewModel, + authMethodType: AuthMethodTypes.SMS, + authenticateUser: (AuthMethodTypes authMethodType, isActive) => authenticateUser(authMethodType, isActive), + )), + Expanded( + child: VerificationMethodsList( + authenticationViewModel: authenticationViewModel, + authMethodType: AuthMethodTypes.WhatsApp, + authenticateUser: (AuthMethodTypes authMethodType, isActive) => authenticateUser(authMethodType, isActive), + )) + ], + ), + ]), // ) ], @@ -468,14 +328,12 @@ class _VerificationMethodsScreenState extends State { mainAxisAlignment: MainAxisAlignment.end, children: [ AppButton( - title: - TranslationBase.of(context).useAnotherAccount ?? '', + title: TranslationBase.of(context).useAnotherAccount ?? '', color: Color(0xFFD02127), //fontWeight: FontWeight.w700, onPressed: () { authenticationViewModel.deleteUser(); - authenticationViewModel - .setAppStatus(APP_STATUS.UNAUTHENTICATED); + authenticationViewModel.setAppStatus(APP_STATUS.UNAUTHENTICATED); }, ), SizedBox( @@ -489,15 +347,11 @@ class _VerificationMethodsScreenState extends State { ); } - sendActivationCodeByOtpNotificationType( - AuthMethodTypes authMethodType) async { - if (authMethodType == AuthMethodTypes.SMS || - authMethodType == AuthMethodTypes.WhatsApp) { + sendActivationCodeByOtpNotificationType(AuthMethodTypes authMethodType) async { + if (authMethodType == AuthMethodTypes.SMS || authMethodType == AuthMethodTypes.WhatsApp) { GifLoaderDialogUtils.showMyDialog(context); - await authenticationViewModel.sendActivationCodeForDoctorApp( - authMethodType: authMethodType, - password: authenticationViewModel.userInfo.password); + await authenticationViewModel.sendActivationCodeForDoctorApp(authMethodType: authMethodType, password: authenticationViewModel.userInfo.password); if (authenticationViewModel.state == ViewState.ErrorLocal) { Utils.showErrorToast(authenticationViewModel.error); GifLoaderDialogUtils.hideDialog(context); @@ -515,19 +369,14 @@ class _VerificationMethodsScreenState extends State { sendActivationCodeVerificationScreen(AuthMethodTypes authMethodType) async { GifLoaderDialogUtils.showMyDialog(context); - await authenticationViewModel - .sendActivationCodeVerificationScreen(authMethodType); + await authenticationViewModel.sendActivationCodeVerificationScreen(authMethodType); if (authenticationViewModel.state == ViewState.ErrorLocal) { GifLoaderDialogUtils.hideDialog(context); Utils.showErrorToast(authenticationViewModel.error); } else { - await sharedPref.setString( - TOKEN, - authenticationViewModel - .activationCodeVerificationScreenRes.logInTokenID); - if (authMethodType == AuthMethodTypes.SMS || - authMethodType == AuthMethodTypes.WhatsApp) { + await sharedPref.setString(TOKEN, authenticationViewModel.activationCodeVerificationScreenRes.logInTokenID!); + if (authMethodType == AuthMethodTypes.SMS || authMethodType == AuthMethodTypes.WhatsApp) { GifLoaderDialogUtils.hideDialog(context); this.startSMSService(authMethodType, isSilentLogin: true); } else { @@ -537,12 +386,10 @@ class _VerificationMethodsScreenState extends State { } authenticateUser(AuthMethodTypes authMethodType, isActive) { - if (authMethodType == AuthMethodTypes.Fingerprint || - authMethodType == AuthMethodTypes.FaceID) { + if (authMethodType == AuthMethodTypes.Fingerprint || authMethodType == AuthMethodTypes.FaceID) { fingerPrintBefore = authMethodType; } - this.selectedOption = - fingerPrintBefore != null ? fingerPrintBefore : authMethodType; + this.selectedOption = fingerPrintBefore != null ? fingerPrintBefore : authMethodType; switch (authMethodType) { case AuthMethodTypes.SMS: @@ -552,8 +399,7 @@ class _VerificationMethodsScreenState extends State { sendActivationCode(authMethodType); break; case AuthMethodTypes.Fingerprint: - this.loginWithFingerPrintOrFaceID( - AuthMethodTypes.Fingerprint, isActive); + this.loginWithFingerPrintOrFaceID(AuthMethodTypes.Fingerprint, isActive); break; case AuthMethodTypes.FaceID: this.loginWithFingerPrintOrFaceID(AuthMethodTypes.FaceID, isActive); @@ -572,13 +418,11 @@ class _VerificationMethodsScreenState extends State { } } - startSMSService(AuthMethodTypes type, {isSilentLogin: false}) { + startSMSService(AuthMethodTypes type, {isSilentLogin = false}) { new SMSOTP( context, type, - authenticationViewModel.loggedUser != null - ? authenticationViewModel.loggedUser.mobileNumber - : authenticationViewModel.user.mobile, + authenticationViewModel.loggedUser != null ? authenticationViewModel.loggedUser!.mobileNumber : authenticationViewModel.user.mobile, (value) { showDialog( context: context, @@ -594,18 +438,13 @@ class _VerificationMethodsScreenState extends State { ).displayDialog(context); } - loginWithFingerPrintOrFaceID( - AuthMethodTypes authMethodTypes, isActive) async { + loginWithFingerPrintOrFaceID(AuthMethodTypes authMethodTypes, isActive) async { if (isActive) { await authenticationViewModel.showIOSAuthMessages(); if (!mounted) return; if (authenticationViewModel.user != null && - (SelectedAuthMethodTypesService.getMethodsTypeService( - authenticationViewModel.user.logInTypeID) == - AuthMethodTypes.Fingerprint || - SelectedAuthMethodTypesService.getMethodsTypeService( - authenticationViewModel.user.logInTypeID) == - AuthMethodTypes.FaceID)) { + (SelectedAuthMethodTypesService.getMethodsTypeService(authenticationViewModel.user.logInTypeID!) == AuthMethodTypes.Fingerprint || + SelectedAuthMethodTypesService.getMethodsTypeService(authenticationViewModel.user.logInTypeID!) == AuthMethodTypes.FaceID)) { this.sendActivationCode(authMethodTypes); } else { setState(() { @@ -615,9 +454,8 @@ class _VerificationMethodsScreenState extends State { } } - checkActivationCode({String value, bool isSilentLogin = false}) async { - await authenticationViewModel.checkActivationCodeForDoctorApp( - activationCode: value, isSilentLogin: isSilentLogin); + checkActivationCode({String? value, bool isSilentLogin = false}) async { + await authenticationViewModel.checkActivationCodeForDoctorApp(activationCode: value, isSilentLogin: isSilentLogin); if (authenticationViewModel.state == ViewState.ErrorLocal) { Navigator.pop(context); Utils.showErrorToast(authenticationViewModel.error); diff --git a/lib/screens/base/base_view.dart b/lib/screens/base/base_view.dart index 7a5c93e6..66cdfc71 100644 --- a/lib/screens/base/base_view.dart +++ b/lib/screens/base/base_view.dart @@ -5,11 +5,11 @@ import 'package:provider/provider.dart'; import '../../locator.dart'; class BaseView extends StatefulWidget { - final Widget Function(BuildContext context, T model, Widget child) builder; - final Function(T) onModelReady; + final Widget Function(BuildContext context, T model, Widget? child) builder; + final Function(T)? onModelReady; BaseView({ - this.builder, + required this.builder, this.onModelReady, }); @@ -25,7 +25,7 @@ class _BaseViewState extends State> { @override void initState() { if (widget.onModelReady != null) { - widget.onModelReady(model); + widget.onModelReady!(model); } super.initState(); @@ -41,9 +41,7 @@ class _BaseViewState extends State> { @override void dispose() { - if (model != null) { - model = null; - } + if (model != null) {} super.dispose(); } diff --git a/lib/screens/doctor/doctor_replay/all_doctor_questions.dart b/lib/screens/doctor/doctor_replay/all_doctor_questions.dart index 7a7fb0ff..356e42fb 100644 --- a/lib/screens/doctor/doctor_replay/all_doctor_questions.dart +++ b/lib/screens/doctor/doctor_replay/all_doctor_questions.dart @@ -11,9 +11,9 @@ import 'package:flutter/material.dart'; import 'doctor_repaly_chat.dart'; class AllDoctorQuestions extends StatefulWidget { - final Function changeCurrentTab; + final Function? changeCurrentTab; - const AllDoctorQuestions({Key key, this.changeCurrentTab}) : super(key: key); + const AllDoctorQuestions({Key? key, this.changeCurrentTab}) : super(key: key); @override _AllDoctorQuestionsState createState() => _AllDoctorQuestionsState(); @@ -89,7 +89,7 @@ class _AllDoctorQuestionsState extends State { }); model.getDoctorReply(pageIndex: pageIndex); } - return; + return false; }, ), ), diff --git a/lib/screens/doctor/doctor_replay/doctor_repaly_chat.dart b/lib/screens/doctor/doctor_replay/doctor_repaly_chat.dart index 07c65e94..d6f15ebf 100644 --- a/lib/screens/doctor/doctor_replay/doctor_repaly_chat.dart +++ b/lib/screens/doctor/doctor_replay/doctor_repaly_chat.dart @@ -18,6 +18,7 @@ import 'package:flutter/material.dart'; import 'package:font_awesome_flutter/font_awesome_flutter.dart'; import 'package:hexcolor/hexcolor.dart'; import 'package:url_launcher/url_launcher.dart'; +import 'package:url_launcher/url_launcher_string.dart'; class DoctorReplayChat extends StatefulWidget { final ListGtMyPatientsQuestions reply; @@ -25,9 +26,9 @@ class DoctorReplayChat extends StatefulWidget { bool showMsgBox = false; DoctorReplayChat({ - Key key, - this.reply, - this.previousModel, + Key? key, + required this.reply, + required this.previousModel, }); @override @@ -39,8 +40,8 @@ class _DoctorReplayChatState extends State { @override Widget build(BuildContext context) { - if (widget.reply.doctorResponse.isNotEmpty) { - msgController.text = widget.reply.doctorResponse; + if (widget.reply.doctorResponse!.isNotEmpty) { + msgController.text = widget.reply.doctorResponse!; } else { widget.showMsgBox = true; } @@ -79,7 +80,7 @@ class _DoctorReplayChatState extends State { text: TextSpan( style: TextStyle( fontSize: 1.6 * - SizeConfig.textMultiplier, + SizeConfig.textMultiplier!, color: Colors.black), children: [ new TextSpan( @@ -192,9 +193,9 @@ class _DoctorReplayChatState extends State { horizontal: 0), child: InkWell( onTap: () { - launch("tel://" + + launchUrlString("tel://" + widget.reply - .mobileNumber); + .mobileNumber!); }, child: Icon( Icons.phone, @@ -230,7 +231,7 @@ class _DoctorReplayChatState extends State { AppDateUtils .getDateTimeFromServerFormat( widget.reply - .createdOn)) + .createdOn!)) : AppDateUtils.getHour( DateTime.now()), fontSize: SizeConfig @@ -266,7 +267,7 @@ class _DoctorReplayChatState extends State { .width * 0.7, child: AppText( - widget.reply.remarks, + widget.reply.remarks!, fontSize: 15, fontFamily: 'Poppins', color: Colors.white, @@ -288,7 +289,7 @@ class _DoctorReplayChatState extends State { height: 30, ), if (widget.reply.doctorResponse != null && - widget.reply.doctorResponse.isNotEmpty) + widget.reply.doctorResponse!.isNotEmpty) Align( alignment: Alignment.centerRight, child: Container( @@ -337,7 +338,7 @@ class _DoctorReplayChatState extends State { widget .previousModel .doctorProfile - .gender == + !.gender == 0 ? 'assets/images/male_avatar.png' : 'assets/images/female_avatar.png', @@ -357,8 +358,8 @@ class _DoctorReplayChatState extends State { child: AppText( widget .previousModel - .doctorProfile - .doctorName, + .doctorProfile! + .doctorName!, fontSize: SizeConfig .getTextMultiplierBasedOnWidth() * 3, @@ -442,7 +443,7 @@ class _DoctorReplayChatState extends State { 0.7, child: AppText( widget.reply - .doctorResponse, + .doctorResponse!, fontSize: 15, fontFamily: 'Poppins', diff --git a/lib/screens/doctor/doctor_replay/doctor_reply_screen.dart b/lib/screens/doctor/doctor_replay/doctor_reply_screen.dart index 8c9db4ad..997467f3 100644 --- a/lib/screens/doctor/doctor_replay/doctor_reply_screen.dart +++ b/lib/screens/doctor/doctor_replay/doctor_reply_screen.dart @@ -8,17 +8,10 @@ import 'package:provider/provider.dart'; import 'all_doctor_questions.dart'; import 'not_replaied_Doctor_Questions.dart'; -/* - *@author: Mohammad Aljammal - *@Date:28/4/2020 - *@param: - *@return: - *@desc: Doctor Reply Screen display data from GtMyPatientsQuestions service - */ class DoctorReplyScreen extends StatefulWidget { final Function changeCurrentTab; - const DoctorReplyScreen({Key key, this.changeCurrentTab}) : super(key: key); + const DoctorReplyScreen({Key? key, required this.changeCurrentTab}) : super(key: key); @override _DoctorReplyScreenState createState() => _DoctorReplyScreenState(); @@ -26,7 +19,7 @@ class DoctorReplyScreen extends StatefulWidget { class _DoctorReplyScreenState extends State with SingleTickerProviderStateMixin { - TabController _tabController; + TabController? _tabController; int _activeTab = 0; int pageIndex = 1; @@ -34,18 +27,18 @@ class _DoctorReplyScreenState extends State void initState() { super.initState(); _tabController = TabController(length: 2, vsync: this); - _tabController.addListener(_handleTabSelection); + _tabController!.addListener(_handleTabSelection); } @override void dispose() { super.dispose(); - _tabController.dispose(); + _tabController!.dispose(); } _handleTabSelection() { setState(() { - _activeTab = _tabController.index; + _activeTab = _tabController!.index; }); } diff --git a/lib/screens/doctor/doctor_replay/doctor_reply_widget.dart b/lib/screens/doctor/doctor_replay/doctor_reply_widget.dart index 0a8e851c..1747be59 100644 --- a/lib/screens/doctor/doctor_replay/doctor_reply_widget.dart +++ b/lib/screens/doctor/doctor_replay/doctor_reply_widget.dart @@ -13,12 +13,13 @@ import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:provider/provider.dart'; import 'package:url_launcher/url_launcher.dart'; +import 'package:url_launcher/url_launcher_string.dart'; class DoctorReplyWidget extends StatefulWidget { final ListGtMyPatientsQuestions reply; bool isShowMore = false; - DoctorReplyWidget({Key key, this.reply}); + DoctorReplyWidget({Key? key, required this.reply}); @override _DoctorReplyWidgetState createState() => _DoctorReplyWidgetState(); @@ -51,7 +52,7 @@ class _DoctorReplyWidgetState extends State { RichText( text: new TextSpan( style: new TextStyle( - fontSize: 2.0 * SizeConfig.textMultiplier, + fontSize: 2.0 * SizeConfig.textMultiplier!, color: Colors.black), children: [ new TextSpan( @@ -84,7 +85,7 @@ class _DoctorReplyWidgetState extends State { : AppGlobal.appGreenColor, fontWeight: FontWeight.w700, fontFamily: 'Poppins', - fontSize: 1.8 * SizeConfig.textMultiplier)), + fontSize: 1.8 * SizeConfig.textMultiplier!)), ], ), ), @@ -93,19 +94,19 @@ class _DoctorReplyWidgetState extends State { children: [ AppText( AppDateUtils.getDateTimeFromServerFormat( - widget.reply.createdOn) + widget.reply.createdOn!) .day .toString() + " " + AppDateUtils.getMonth( AppDateUtils.getDateTimeFromServerFormat( - widget.reply.createdOn) + widget.reply.createdOn!) .month) .toString() .substring(0, 3) + ' ' + AppDateUtils.getDateTimeFromServerFormat( - widget.reply.createdOn) + widget.reply.createdOn!) .year .toString(), fontFamily: 'Poppins', @@ -113,12 +114,12 @@ class _DoctorReplyWidgetState extends State { ), AppText( AppDateUtils.getDateTimeFromServerFormat( - widget.reply.createdOn) + widget.reply.createdOn!) .hour .toString() + ":" + AppDateUtils.getDateTimeFromServerFormat( - widget.reply.createdOn) + widget.reply.createdOn!) .minute .toString(), fontFamily: 'Poppins', @@ -134,7 +135,7 @@ class _DoctorReplyWidgetState extends State { Expanded( child: AppText( Utils.capitalize(widget.reply.patientName), - fontSize: SizeConfig.textMultiplier * 2.5, + fontSize: SizeConfig.textMultiplier! * 2.5, fontWeight: FontWeight.bold, fontFamily: 'Poppins', ), @@ -143,7 +144,7 @@ class _DoctorReplyWidgetState extends State { margin: EdgeInsets.symmetric(horizontal: 4), child: InkWell( onTap: () { - launch("tel://" + widget.reply.mobileNumber); + launchUrlString("tel://" + widget.reply.mobileNumber!); }, child: Icon( Icons.phone, @@ -213,7 +214,7 @@ class _DoctorReplyWidgetState extends State { label: TranslationBase.of(context).age + " : ", isCopyable: false, isExpanded: false, value: - "${AppDateUtils.getAgeByBirthday(widget.reply.dateofBirth, context)}", + "${AppDateUtils.getAgeByBirthday(widget.reply.dateofBirth!, context)}", ), SizedBox( height: 8, @@ -230,7 +231,7 @@ class _DoctorReplyWidgetState extends State { overflow: TextOverflow.ellipsis, text: new TextSpan( style: new TextStyle( - fontSize: 1.3 * SizeConfig.textMultiplier, + fontSize: 1.3 * SizeConfig.textMultiplier!, color: Color(0xFF575757)), children: [ new TextSpan( diff --git a/lib/screens/doctor/doctor_replay/not_replaied_doctor_questions.dart b/lib/screens/doctor/doctor_replay/not_replaied_doctor_questions.dart index 97f477b3..06e25dba 100644 --- a/lib/screens/doctor/doctor_replay/not_replaied_doctor_questions.dart +++ b/lib/screens/doctor/doctor_replay/not_replaied_doctor_questions.dart @@ -11,9 +11,9 @@ import 'package:flutter/material.dart'; import 'doctor_repaly_chat.dart'; class NotRepliedDoctorQuestions extends StatefulWidget { - final Function changeCurrentTab; + final Function? changeCurrentTab; - const NotRepliedDoctorQuestions({Key key, this.changeCurrentTab}) + const NotRepliedDoctorQuestions({Key? key, this.changeCurrentTab}) : super(key: key); @override @@ -91,7 +91,7 @@ class _NotRepliedDoctorQuestionsState extends State { model.getDoctorReply( pageIndex: pageIndex, isGettingNotReply: true); } - return; + return false; }, ), ), diff --git a/lib/screens/doctor/patient_arrival_screen.dart b/lib/screens/doctor/patient_arrival_screen.dart index bc7908cf..84b721af 100644 --- a/lib/screens/doctor/patient_arrival_screen.dart +++ b/lib/screens/doctor/patient_arrival_screen.dart @@ -14,9 +14,8 @@ class PatientArrivalScreen extends StatefulWidget { _PatientArrivalScreen createState() => _PatientArrivalScreen(); } -class _PatientArrivalScreen extends State - with SingleTickerProviderStateMixin { - TabController _tabController; +class _PatientArrivalScreen extends State with SingleTickerProviderStateMixin { + TabController? _tabController; var _patientSearchFormValues = PatientModel( FirstName: "0", MiddleName: "0", @@ -24,10 +23,8 @@ class _PatientArrivalScreen extends State PatientMobileNumber: "0", PatientIdentificationID: "0", PatientID: 0, - From: AppDateUtils.convertDateToFormat(DateTime.now(), 'yyyy-MM-dd') - .toString(), - To: AppDateUtils.convertDateToFormat(DateTime.now(), 'yyyy-MM-dd') - .toString(), + From: AppDateUtils.convertDateToFormat(DateTime.now(), 'yyyy-MM-dd').toString(), + To: AppDateUtils.convertDateToFormat(DateTime.now(), 'yyyy-MM-dd').toString(), LanguageID: 2, stamp: "2020-03-02T13:56:39.170Z", IPAdress: "11.11.11.11", @@ -47,7 +44,7 @@ class _PatientArrivalScreen extends State @override void dispose() { super.dispose(); - _tabController.dispose(); + _tabController!.dispose(); } @override @@ -68,9 +65,7 @@ class _PatientArrivalScreen extends State // 0.9, decoration: BoxDecoration( border: Border( - bottom: BorderSide( - color: Theme.of(context).dividerColor, - width: 0.9), //width: 0.7 + bottom: BorderSide(color: Theme.of(context).dividerColor, width: 0.9), //width: 0.7 ), color: Colors.white), child: Center( @@ -80,22 +75,19 @@ class _PatientArrivalScreen extends State indicatorWeight: 5.0, indicatorSize: TabBarIndicatorSize.tab, labelColor: Theme.of(context).primaryColor, - labelPadding: - EdgeInsets.only(top: 4.0, left: 35.0, right: 35.0), + labelPadding: EdgeInsets.only(top: 4.0, left: 35.0, right: 35.0), unselectedLabelColor: Colors.grey[800], tabs: [ Container( width: MediaQuery.of(context).size.width * 0.30, child: Center( - child: AppText( - TranslationBase.of(context).arrivalpatient), + child: AppText(TranslationBase.of(context).arrivalpatient), ), ), Container( width: MediaQuery.of(context).size.width * 0.30, child: Center( - child: AppText( - TranslationBase.of(context).rescheduleLeaves), + child: AppText(TranslationBase.of(context).rescheduleLeaves), ), ), ], diff --git a/lib/screens/home/dashboard_referral_patient.dart b/lib/screens/home/dashboard_referral_patient.dart index 8eaca455..16b31b84 100644 --- a/lib/screens/home/dashboard_referral_patient.dart +++ b/lib/screens/home/dashboard_referral_patient.dart @@ -1,4 +1,4 @@ -import 'package:charts_flutter/flutter.dart' as charts; +import 'package:charts_flutter/flutter.dart' as charts ; import 'package:doctor_app_flutter/config/config.dart'; import 'package:doctor_app_flutter/config/size_config.dart'; import 'package:doctor_app_flutter/core/viewModel/dashboard_view_model.dart'; @@ -14,10 +14,10 @@ import 'label.dart'; class DashboardReferralPatient extends StatelessWidget { final List dashboardItemList; final double height; - final DashboardViewModel model; + final DashboardViewModel? model; const DashboardReferralPatient( - {Key key, this.dashboardItemList, this.height, this.model}) + {Key? key, required this.dashboardItemList, required this.height, this.model}) : super(key: key); @override @@ -105,31 +105,31 @@ class DashboardReferralPatient extends StatelessWidget { children: [ RowCounts( dashboardItemList[2] - .summaryoptions[0] + .summaryoptions![0] .kPIParameter, dashboardItemList[2] - .summaryoptions[0] - .value, + .summaryoptions![0] + .value!, AppGlobal.appTextColor, height: height, ), RowCounts( dashboardItemList[2] - .summaryoptions[1] + .summaryoptions![1] .kPIParameter, dashboardItemList[2] - .summaryoptions[1] - .value, + .summaryoptions![1] + .value!, Color(0xFFC8D0DC), height: height, ), RowCounts( dashboardItemList[2] - .summaryoptions[2] + .summaryoptions![2] .kPIParameter, dashboardItemList[2] - .summaryoptions[2] - .value, + .summaryoptions![2] + .value!, Color(0xFFEC6666), height: height, ), @@ -152,9 +152,9 @@ class DashboardReferralPatient extends StatelessWidget { children: [ AppText( model - .getPatientCount(dashboardItemList[2]) + !.getPatientCount(dashboardItemList[2]) .toString(), - fontSize: SizeConfig.textMultiplier * 3.2, + fontSize: SizeConfig.textMultiplier! * 3.2, color: AppGlobal.appTextColor, fontWeight: FontWeight.bold, ) @@ -176,19 +176,19 @@ class DashboardReferralPatient extends StatelessWidget { List dashboardItemList) { final data = [ new GaugeSegment( - dashboardItemList[2].summaryoptions[0].kPIParameter, - getValue(dashboardItemList[1].summaryoptions[0].value), + dashboardItemList[2].summaryoptions![0].kPIParameter!, + getValue(dashboardItemList[1].summaryoptions![0].value), charts.ColorUtil.fromDartColor(AppGlobal.appTextColor)), new GaugeSegment( - dashboardItemList[2].summaryoptions[1].kPIParameter, - getValue(dashboardItemList[1].summaryoptions[1].value), + dashboardItemList[2].summaryoptions![1].kPIParameter!, + getValue(dashboardItemList[1].summaryoptions![1].value), charts.ColorUtil.fromDartColor( Color(0xFFC6CEDA), ), ), new GaugeSegment( - dashboardItemList[2].summaryoptions[2].kPIParameter, - getValue(dashboardItemList[1].summaryoptions[2].value), + dashboardItemList[2].summaryoptions![2].kPIParameter!, + getValue(dashboardItemList[1].summaryoptions![2].value), charts.ColorUtil.fromDartColor( Color(0xFFEC6666), ), @@ -202,7 +202,7 @@ class DashboardReferralPatient extends StatelessWidget { measureFn: (GaugeSegment segment, _) => segment.size, strokeWidthPxFn: (GaugeSegment segment, _) => 200, data: data, - colorFn: (GaugeSegment segment, _) => segment.color, + // colorFn: (GaugeSegment segment, _) => segment., ) ]; } diff --git a/lib/screens/home/dashboard_slider-item-widget.dart b/lib/screens/home/dashboard_slider-item-widget.dart index 040c19ea..e6ad1eea 100644 --- a/lib/screens/home/dashboard_slider-item-widget.dart +++ b/lib/screens/home/dashboard_slider-item-widget.dart @@ -21,16 +21,16 @@ class DashboardSliderItemWidget extends StatelessWidget { children: [ Container( margin: EdgeInsets.symmetric( - horizontal: SizeConfig.widthMultiplier * 1), + horizontal: SizeConfig.widthMultiplier! * 1), child: Label( - firstLine: Utils.getLabelFromKPI(item.kPIName), - secondLine: Utils.getNameFromKPI(item.kPIName), + firstLine: Utils.getLabelFromKPI(item.kPIName!), + secondLine: Utils.getNameFromKPI(item.kPIName!), ), ), ], ), new Container( - height: SizeConfig.heightMultiplier * + height: SizeConfig.heightMultiplier! * (SizeConfig.isHeightVeryShort ? 16 : SizeConfig.isHeightShort @@ -41,8 +41,8 @@ class DashboardSliderItemWidget extends StatelessWidget { child: ListView( scrollDirection: Axis.horizontal, children: - List.generate(item.summaryoptions.length, (int index) { - return GetActivityCard(item.summaryoptions[index]); + List.generate(item.summaryoptions!.length, (int index) { + return GetActivityCard(item.summaryoptions![index]); }))) ], ); diff --git a/lib/screens/home/dashboard_swipe_widget.dart b/lib/screens/home/dashboard_swipe_widget.dart index 7d92fe2a..fc2d2b1e 100644 --- a/lib/screens/home/dashboard_swipe_widget.dart +++ b/lib/screens/home/dashboard_swipe_widget.dart @@ -1,16 +1,13 @@ import 'package:doctor_app_flutter/config/size_config.dart'; import 'package:doctor_app_flutter/core/viewModel/dashboard_view_model.dart'; import 'package:doctor_app_flutter/core/model/dashboard/dashboard_model.dart'; -import 'package:doctor_app_flutter/utils/translations_delegate_base_utils.dart'; import 'package:doctor_app_flutter/widgets/dashboard/guage_chart.dart'; import 'package:doctor_app_flutter/widgets/dashboard/out_patient_stack.dart'; -import 'package:doctor_app_flutter/widgets/dashboard/row_count.dart'; import 'package:doctor_app_flutter/widgets/dashboard/swiper_rounded_pagination.dart'; -import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart'; -import 'package:doctor_app_flutter/widgets/shared/rounded_container_widget.dart'; import 'package:flutter/material.dart'; -import 'package:flutter_swiper/flutter_swiper.dart'; + import 'package:charts_flutter/flutter.dart' as charts; +import 'package:flutter_swiper_view/flutter_swiper_view.dart'; import 'dashboard_referral_patient.dart'; @@ -30,7 +27,7 @@ class _DashboardSwipeWidgetState extends State { @override Widget build(BuildContext context) { - double height = SizeConfig.heightMultiplier * + double height = SizeConfig.heightMultiplier! * (SizeConfig.isHeightVeryShort ? 40 : SizeConfig.isHeightLarge @@ -111,16 +108,16 @@ class _DashboardSwipeWidgetState extends State { List dashboardItemList) { final data = [ new GaugeSegment( - dashboardItemList[2].summaryoptions[0].kPIParameter, - getValue(dashboardItemList[1].summaryoptions[0].value), + dashboardItemList[2].summaryoptions![0].kPIParameter!, + getValue(dashboardItemList[1].summaryoptions![0].value), charts.MaterialPalette.black), new GaugeSegment( - dashboardItemList[2].summaryoptions[1].kPIParameter, - getValue(dashboardItemList[1].summaryoptions[1].value), + dashboardItemList[2].summaryoptions![1].kPIParameter!, + getValue(dashboardItemList[1].summaryoptions![1].value), charts.MaterialPalette.gray.shadeDefault), new GaugeSegment( - dashboardItemList[2].summaryoptions[2].kPIParameter, - getValue(dashboardItemList[1].summaryoptions[2].value), + dashboardItemList[2].summaryoptions![2].kPIParameter!, + getValue(dashboardItemList[1].summaryoptions![2].value), charts.MaterialPalette.red.shadeDefault), ]; @@ -130,7 +127,7 @@ class _DashboardSwipeWidgetState extends State { domainFn: (GaugeSegment segment, _) => segment.segment, measureFn: (GaugeSegment segment, _) => segment.size, data: data, - colorFn: (GaugeSegment segment, _) => segment.color, + // colorFn: (GaugeSegment segment, _) => segment.color, ) ]; } diff --git a/lib/screens/home/home_page_card.dart b/lib/screens/home/home_page_card.dart index 2fa182c2..1854fcf5 100644 --- a/lib/screens/home/home_page_card.dart +++ b/lib/screens/home/home_page_card.dart @@ -6,7 +6,7 @@ class HomePageCard extends StatelessWidget { this.imageName, this.child, this.onTap, - Key key, + Key? key, this.color, this.opacity = 0.4, this.margin, @@ -14,14 +14,14 @@ class HomePageCard extends StatelessWidget { this.gradient}) : super(key: key); final bool hasBorder; - final String imageName; - final Widget child; - final GestureTapCallback onTap; - final Color color; - final double opacity; - final double width; - final EdgeInsets margin; - final LinearGradient gradient; + final String? imageName; + final Widget? child; + final GestureTapCallback? onTap; + final Color? color; + final double? opacity; + final double? width; + final EdgeInsets? margin; + final LinearGradient? gradient; @override Widget build(BuildContext context) { diff --git a/lib/screens/home/home_patient_card.dart b/lib/screens/home/home_patient_card.dart index f44ace60..d2050b7e 100644 --- a/lib/screens/home/home_patient_card.dart +++ b/lib/screens/home/home_patient_card.dart @@ -4,15 +4,15 @@ import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart'; import 'package:flutter/material.dart'; class HomePatientCard extends StatelessWidget { - final Color backgroundColor; - final IconData cardIcon; - final String cardIconImage; - final Color backgroundIconColor; - final String text; - final Color textColor; - final VoidCallback onTap; - final double iconSize; - final LinearGradient gradient; + final Color? backgroundColor; + final IconData? cardIcon; + final String? cardIconImage; + final Color? backgroundIconColor; + final String? text; + final Color? textColor; + final VoidCallback? onTap; + final double? iconSize; + final LinearGradient? gradient; HomePatientCard({ this.backgroundColor, @@ -28,7 +28,7 @@ class HomePatientCard extends StatelessWidget { @override Widget build(BuildContext context) { - double width = SizeConfig.heightMultiplier * + double width = SizeConfig.heightMultiplier! * (SizeConfig.isHeightVeryShort ? 16 : SizeConfig.isHeightLarge @@ -38,7 +38,7 @@ class HomePatientCard extends StatelessWidget { color: backgroundColor, width: width, gradient: gradient, - margin: EdgeInsets.all(SizeConfig.widthMultiplier * 1.121), + margin: EdgeInsets.all(SizeConfig.widthMultiplier! * 1.121), child: Container( padding: EdgeInsets.all(8), child: Column( @@ -54,17 +54,17 @@ class HomePatientCard extends StatelessWidget { child: cardIcon != null ? Icon( cardIcon, - size: iconSize * 2, + size: iconSize! * 2, color: backgroundIconColor, ) : IconButton( icon: Image.asset( 'assets/images/patient_register.png', - width: iconSize * 2, - height: iconSize * 2, + width: iconSize! * 2, + height: iconSize! * 2, fit: BoxFit.fill, ), - iconSize: iconSize * 2, + iconSize: iconSize! * 2, color: backgroundIconColor, onPressed: () => null, ), @@ -83,7 +83,7 @@ class HomePatientCard extends StatelessWidget { color: textColor, ) : Image.asset( - cardIconImage, + cardIconImage!, height: iconSize, width: iconSize, ), @@ -99,8 +99,8 @@ class HomePatientCard extends StatelessWidget { Expanded( child: Container( child: AppText( - text, - color: textColor, + text!, + color: textColor!, textAlign: TextAlign.start, letterSpacing: -0.33, fontWeight: FontWeight.w600, diff --git a/lib/screens/home/home_screen.dart b/lib/screens/home/home_screen.dart index b361d1fe..c42810b5 100644 --- a/lib/screens/home/home_screen.dart +++ b/lib/screens/home/home_screen.dart @@ -39,9 +39,9 @@ import '../../widgets/shared/app_texts_widget.dart'; import 'label.dart'; class HomeScreen extends StatefulWidget { - HomeScreen({Key key, this.title}) : super(key: key); + HomeScreen({Key? key, this.title}) : super(key: key); - final String title; + final String? title; @override _HomeScreenState createState() => _HomeScreenState(); @@ -49,14 +49,14 @@ class HomeScreen extends StatefulWidget { class _HomeScreenState extends State { bool isLoading = false; - ProjectViewModel projectsProvider; + late ProjectViewModel projectsProvider; var _isInit = true; - DoctorProfileModel profile; + DoctorProfileModel profile = DoctorProfileModel(); bool isExpanded = false; bool isInpatient = false; int sliderActiveIndex = 0; var clinicId; - AuthenticationViewModel authenticationViewModel; + AuthenticationViewModel authenticationViewModel = AuthenticationViewModel(); int colorIndex = 0; @override @@ -71,8 +71,7 @@ class _HomeScreenState extends State { return BaseView( onModelReady: (model) async { - model.startHomeScreenServices( - projectsProvider, authenticationViewModel); + model.startHomeScreenServices(projectsProvider, authenticationViewModel); }, builder: (_, model, w) => AppScaffold( baseViewModel: model, @@ -87,12 +86,9 @@ class _HomeScreenState extends State { //TODO Elham* make it componet Container( width: 40, - margin: EdgeInsets.only( - left: projectsProvider.isArabic ? 0 : 32, - right: projectsProvider.isArabic ? 23 : 0), + margin: EdgeInsets.only(left: projectsProvider.isArabic ? 0 : 32, right: projectsProvider.isArabic ? 23 : 0), child: IconButton( - icon: SvgPicture.asset('assets/images/svgs/menu.svg', - height: 25, width: 10), + icon: SvgPicture.asset('assets/images/svgs/menu.svg', height: 25, width: 10), iconSize: 15, color: Colors.black, onPressed: () => Scaffold.of(context).openDrawer(), @@ -105,118 +101,69 @@ class _HomeScreenState extends State { children: [ Container( width: MediaQuery.of(context).size.width * .6, - child: projectsProvider.doctorClinicsList.length > - 0 + child: projectsProvider.doctorClinicsList.length > 0 ? Stack( children: [ DropdownButtonHideUnderline( child: DropdownButton( dropdownColor: Colors.white, - iconEnabledColor: - AppGlobal.appTextColor, + iconEnabledColor: AppGlobal.appTextColor, icon: Icon(Icons.keyboard_arrow_down), isExpanded: true, - value: clinicId == null - ? projectsProvider - .doctorClinicsList[0].clinicID - : clinicId, + value: clinicId == null ? projectsProvider.doctorClinicsList[0].clinicID : clinicId, iconSize: 25, elevation: 16, - selectedItemBuilder: - (BuildContext context) { - return projectsProvider - .doctorClinicsList - .map((item) { + selectedItemBuilder: (BuildContext context) { + return projectsProvider.doctorClinicsList.map((item) { return Row( mainAxisSize: MainAxisSize.max, - mainAxisAlignment: - MainAxisAlignment.end, + mainAxisAlignment: MainAxisAlignment.end, children: [ Column( - mainAxisAlignment: - MainAxisAlignment - .center, + mainAxisAlignment: MainAxisAlignment.center, children: [ Container( - padding: - EdgeInsets.all(0), - margin: - EdgeInsets.all(2), - decoration: - new BoxDecoration( - color: AppGlobal - .appRedColor, - borderRadius: - BorderRadius - .circular( - 20), + padding: EdgeInsets.all(0), + margin: EdgeInsets.all(2), + decoration: new BoxDecoration( + color: AppGlobal.appRedColor, + borderRadius: BorderRadius.circular(20), ), - constraints: - BoxConstraints( + constraints: BoxConstraints( minWidth: 20, minHeight: 20, ), child: Center( child: AppText( - projectsProvider - .doctorClinicsList - .length - .toString(), - color: - Colors.white, - letterSpacing: - -0.72, - fontWeight: - FontWeight - .w600, - fontSize: - projectsProvider - .isArabic - ? 10 - : 12, - textAlign: - TextAlign - .center, + projectsProvider.doctorClinicsList.length.toString(), + color: Colors.white, + letterSpacing: -0.72, + fontWeight: FontWeight.w600, + fontSize: projectsProvider.isArabic ? 10 : 12, + textAlign: TextAlign.center, ), )), ], ), - AppText( - Utils - .convertToTitleCase( - item.clinicName), - fontSize: 14, - letterSpacing: -0.96, - color: AppGlobal - .appTextColor, - fontWeight: - FontWeight.bold, - textAlign: TextAlign.end), + AppText(Utils.convertToTitleCase(item.clinicName!), + fontSize: 14, letterSpacing: -0.96, color: AppGlobal.appTextColor, fontWeight: FontWeight.bold, textAlign: TextAlign.end), ], ); }).toList(); }, onChanged: (newValue) async { clinicId = newValue; - GifLoaderDialogUtils.showMyDialog( - context); - await model.changeClinic(newValue, - authenticationViewModel); - GifLoaderDialogUtils.hideDialog( - context); - if (model.state == - ViewState.ErrorLocal) { - DrAppToastMsg.showErrorToast( - model.error); + GifLoaderDialogUtils.showMyDialog(context); + await model.changeClinic(int.parse(newValue.toString()), authenticationViewModel); + GifLoaderDialogUtils.hideDialog(context); + if (model.state == ViewState.ErrorLocal) { + DrAppToastMsg.showErrorToast(model.error); } }, - items: projectsProvider - .doctorClinicsList - .map((item) { + items: projectsProvider.doctorClinicsList.map((item) { return DropdownMenuItem( child: AppText( - Utils.convertToTitleCase( - item.clinicName), + Utils.convertToTitleCase(item.clinicName!), fontSize: 14, letterSpacing: -0.96, color: AppGlobal.appTextColor, @@ -229,8 +176,7 @@ class _HomeScreenState extends State { )), ], ) - : AppText( - TranslationBase.of(context).noClinic), + : AppText(TranslationBase.of(context).noClinic), ), ], ), @@ -260,29 +206,23 @@ class _HomeScreenState extends State { ? FractionallySizedBox( widthFactor: 0.90, child: Container( - child: Column( - mainAxisAlignment: - MainAxisAlignment.start, - children: [ - SizedBox( - height: 10, - ), - sliderActiveIndex == 1 - ? DashboardSliderItemWidget( - model.dashboardItemsList[4]) - : sliderActiveIndex == 0 - ? DashboardSliderItemWidget( - model.dashboardItemsList[3]) - : DashboardSliderItemWidget( - model.dashboardItemsList[6]), - ]))) + child: Column(mainAxisAlignment: MainAxisAlignment.start, children: [ + SizedBox( + height: 10, + ), + sliderActiveIndex == 1 + ? DashboardSliderItemWidget(model.dashboardItemsList[4]) + : sliderActiveIndex == 0 + ? DashboardSliderItemWidget(model.dashboardItemsList[3]) + : DashboardSliderItemWidget(model.dashboardItemsList[6]), + ]))) : SizedBox(), ], ) else Container( child: ErrorMessage( - error: model.error, + error: model.error!, )), FractionallySizedBox( // widthFactor: 0.90, @@ -306,7 +246,7 @@ class _HomeScreenState extends State { secondLine: TranslationBase.of(context).services, ), Container( - height: SizeConfig.heightMultiplier * + height: SizeConfig.heightMultiplier! * (SizeConfig.isHeightVeryShort ? 16 : SizeConfig.isHeightShort @@ -314,12 +254,9 @@ class _HomeScreenState extends State { : SizeConfig.isHeightLarge ? 15 : 13), - child: ListView( - scrollDirection: Axis.horizontal, - children: [ - ...homePatientsCardsWidget( - model, projectsProvider), - ])), + child: ListView(scrollDirection: Axis.horizontal, children: [ + ...homePatientsCardsWidget(model, projectsProvider), + ])), SizedBox( height: 20, ), @@ -336,37 +273,29 @@ class _HomeScreenState extends State { ); } - List homePatientsCardsWidget( - DashboardViewModel model, projectsProvider) { + List homePatientsCardsWidget(DashboardViewModel model, projectsProvider) { colorIndex = 0; - List backgroundColors = List(3); - backgroundColors[0] = LinearGradient( - begin: Alignment(-1.0, -2.0), - end: Alignment(1.0, 2.0), - colors: [ - AppGlobal.appRedColor, - Color(0xFFAD3B3B), - ]); //AppGlobal.appRedColor; - backgroundColors[1] = - LinearGradient(begin: Alignment.center, end: Alignment.center, colors: [ + List backgroundColors = []; + backgroundColors[0] = LinearGradient(begin: Alignment(-1.0, -2.0), end: Alignment(1.0, 2.0), colors: [ + AppGlobal.appRedColor, + Color(0xFFAD3B3B), + ]); //AppGlobal.appRedColor; + backgroundColors[1] = LinearGradient(begin: Alignment.center, end: Alignment.center, colors: [ Color(0xFFC9C9C9), Color(0xFFC9C9C9), ]); - backgroundColors[2] = LinearGradient( - begin: Alignment.center, - end: Alignment.center, - colors: [Color(0xFF71787E), AppGlobal.appTextColor]); - List backgroundIconColors = List(3); + backgroundColors[2] = LinearGradient(begin: Alignment.center, end: Alignment.center, colors: [Color(0xFF71787E), AppGlobal.appTextColor]); + List backgroundIconColors = []; backgroundIconColors[0] = Colors.white12; backgroundIconColors[1] = Colors.white38; backgroundIconColors[2] = Colors.white10; - List textColors = List(3); + List textColors = []; textColors[0] = Colors.white; textColors[1] = Color(0xFF353E47); textColors[2] = Colors.white; - List patientCards = List(); + List patientCards = []; if (model.hasVirtualClinic) { patientCards.add(HomePatientCard( @@ -375,8 +304,7 @@ class _HomeScreenState extends State { cardIcon: DoctorApp.livecare, textColor: textColors[colorIndex], iconSize: 21, - text: - "${TranslationBase.of(context).liveCare}\n${TranslationBase.of(context).patients}", + text: "${TranslationBase.of(context).liveCare}\n${TranslationBase.of(context).patients}", onTap: () { // TODO MOSA TEST // PatiantInformtion patient = PatiantInformtion( @@ -411,13 +339,12 @@ class _HomeScreenState extends State { backgroundIconColor: backgroundIconColors[colorIndex], cardIcon: DoctorApp.qr_reader, textColor: textColors[colorIndex], - text: "ER sign In" , + text: "ER sign In", onTap: () { Navigator.push( context, FadePage( - page: ErSignInScreen( - ), + page: ErSignInScreen(), ), ); }, @@ -435,8 +362,7 @@ class _HomeScreenState extends State { context, FadePage( page: InPatientScreen( - specialClinic: model.getSpecialClinic( - clinicId ?? projectsProvider.doctorClinicsList[0].clinicID), + specialClinic: model.getSpecialClinic(clinicId ?? projectsProvider.doctorClinicsList[0].clinicID), ), ), ); @@ -469,19 +395,17 @@ class _HomeScreenState extends State { textColor: textColors[colorIndex], text: TranslationBase.of(context).myOutPatient_2lines, onTap: () { - String date = AppDateUtils.convertDateToFormat( - DateTime( - DateTime.now().year, DateTime.now().month, DateTime.now().day), - 'yyyy-MM-dd'); + String date = AppDateUtils.convertDateToFormat(DateTime(DateTime.now().year, DateTime.now().month, DateTime.now().day), 'yyyy-MM-dd'); Navigator.push( context, MaterialPageRoute( builder: (context) => OutPatientsScreen( patientSearchRequestModel: PatientSearchRequestModel( - from: date, - to: date, - doctorID: authenticationViewModel.doctorProfile.doctorID), + from: date, + to: date, + doctorID: authenticationViewModel.doctorProfile!.doctorID, + ), ), settings: RouteSettings(name: 'OutPatientsScreen'), )); @@ -541,10 +465,7 @@ class _HomeScreenState extends State { )); changeColorIndex(); - return [ - ...List.generate(patientCards.length, (index) => patientCards[index]) - .toList() - ]; + return [...List.generate(patientCards.length, (index) => patientCards[index]).toList()]; } changeColorIndex() { diff --git a/lib/screens/home/label.dart b/lib/screens/home/label.dart index 89975660..32024613 100644 --- a/lib/screens/home/label.dart +++ b/lib/screens/home/label.dart @@ -5,18 +5,18 @@ import 'package:flutter/material.dart'; class Label extends StatelessWidget { Label({ - Key key, + Key? key, this.firstLine, this.secondLine, this.color = const Color(0xFF2E303A), this.secondLineFontSize, this.firstLineFontSize, }) : super(key: key); - final String firstLine; - final String secondLine; + final String? firstLine; + final String? secondLine; Color color; - final double secondLineFontSize; - final double firstLineFontSize; + final double? secondLineFontSize; + final double? firstLineFontSize; @override Widget build(BuildContext context) { @@ -25,7 +25,7 @@ class Label extends StatelessWidget { crossAxisAlignment: CrossAxisAlignment.start, children: [ AppText( - firstLine, + firstLine!, fontSize: firstLineFontSize ?? SizeConfig.getTextMultiplierBasedOnWidth() * (SizeConfig.isWidthLarge ? 2 : 3), @@ -36,7 +36,7 @@ class Label extends StatelessWidget { fontWeight: FontWeight.w600, ), AppText( - secondLine, + secondLine!, color: color, fontSize: secondLineFontSize ?? SizeConfig.getTextMultiplierBasedOnWidth() * diff --git a/lib/screens/live_care/end_call_screen.dart b/lib/screens/live_care/end_call_screen.dart index d4967663..dafa469b 100644 --- a/lib/screens/live_care/end_call_screen.dart +++ b/lib/screens/live_care/end_call_screen.dart @@ -26,8 +26,8 @@ class EndCallScreen extends StatefulWidget { final PatiantInformtion patient; const EndCallScreen({ - Key key, - this.patient, + Key? key, + required this.patient, }) : super(key: key); @override @@ -36,15 +36,15 @@ class EndCallScreen extends StatefulWidget { class _EndCallScreenState extends State { bool isInpatient = false; - PatiantInformtion patient; + PatiantInformtion patient = PatiantInformtion(); bool isDischargedPatient = false; bool isSearchAndOut = false; - String patientType; - String arrivalType; - String from; - String to; + String? patientType; + String? arrivalType; + String? from; + String? to; - LiveCarePatientViewModel liveCareModel; + LiveCarePatientViewModel liveCareModel = LiveCarePatientViewModel(); @override void initState() { @@ -55,24 +55,17 @@ class _EndCallScreenState extends State { @override void didChangeDependencies() { super.didChangeDependencies(); - final routeArgs = ModalRoute.of(context).settings.arguments as Map; + final routeArgs = ModalRoute.of(context)!.settings.arguments as Map; if (routeArgs.containsKey('patient')) patient = routeArgs['patient']; } @override Widget build(BuildContext context) { final List cardsList = [ - PatientProfileCardModel( - TranslationBase.of(context).resume, - TranslationBase.of(context).theCall, - '', - 'assets/images/svgs/profile_screen/vital signs.svg', - isInPatient: isInpatient, - color: AppGlobal.appGreenColor, onTap: () async { + PatientProfileCardModel(TranslationBase.of(context).resume, TranslationBase.of(context).theCall, '', 'assets/images/svgs/profile_screen/vital signs.svg', + isInPatient: isInpatient, color: AppGlobal.appGreenColor, onTap: () async { GifLoaderDialogUtils.showMyDialog(context); - await liveCareModel - .startCall(isReCall: false, vCID: patient.vcId) - .then((value) async { + await liveCareModel.startCall(isReCall: false, vCID: patient.vcId!).then((value) async { await liveCareModel.getDoctorProfile(); GifLoaderDialogUtils.hideDialog(context); if (liveCareModel.state == ViewState.ErrorLocal) { @@ -82,17 +75,12 @@ class _EndCallScreenState extends State { kToken: liveCareModel.startCallRes.openTokenID, kSessionId: liveCareModel.startCallRes.openSessionID, kApiKey: '46209962', - vcId: patient.vcId, - isRecording: liveCareModel.startCallRes != null - ? liveCareModel.startCallRes.isRecording - : false, - patientName: patient.fullName ?? - (patient.firstName != null - ? "${patient.firstName} ${patient.lastName}" - : "-"), + vcId: patient.vcId!, + isRecording: liveCareModel.startCallRes != null ? liveCareModel.startCallRes.isRecording! : false, + patientName: patient.fullName ?? (patient.firstName != null ? "${patient.firstName} ${patient.lastName}" : "-"), tokenID: await liveCareModel.getToken(), generalId: GENERAL_ID, - doctorId: liveCareModel.doctorProfile.doctorID, + doctorId: liveCareModel.doctorProfile!.doctorID!, onFailure: (String error) { DrAppToastMsg.showErrorToast(error); }, @@ -100,7 +88,7 @@ class _EndCallScreenState extends State { GifLoaderDialogUtils.showMyDialog(context); GifLoaderDialogUtils.showMyDialog(context); await liveCareModel.endCall( - patient.vcId, + patient.vcId!, false, ); GifLoaderDialogUtils.hideDialog(context); @@ -108,12 +96,11 @@ class _EndCallScreenState extends State { DrAppToastMsg.showErrorToast(liveCareModel.error); } }, - onCallNotRespond: - (SessionStatusModel sessionStatusModel) async { + onCallNotRespond: (SessionStatusModel sessionStatusModel) async { GifLoaderDialogUtils.showMyDialog(context); GifLoaderDialogUtils.showMyDialog(context); await liveCareModel.endCall( - patient.vcId, + patient.vcId!, sessionStatusModel.sessionStatus == 3, ); GifLoaderDialogUtils.hideDialog(context); @@ -127,33 +114,24 @@ class _EndCallScreenState extends State { DrAppToastMsg.showErrorToast(liveCareModel.error); } }, isDartIcon: true, dartIcon: DoctorApp.call), - PatientProfileCardModel( - TranslationBase.of(context).endLC, - TranslationBase.of(context).consultation, - '', - 'assets/images/svgs/profile_screen/vital signs.svg', - isInPatient: isInpatient, - color: Colors.red[800], onTap: () { - Utils.showConfirmationDialog(context, - "${TranslationBase.of(context).areYouSureYouWantTo} ${TranslationBase.of(context).endLC} ${TranslationBase.of(context).consultation} ?", - () async { + PatientProfileCardModel(TranslationBase.of(context).endLC, TranslationBase.of(context).consultation, '', 'assets/images/svgs/profile_screen/vital signs.svg', + isInPatient: isInpatient, color: Colors.red[800]!, onTap: () { + Utils.showConfirmationDialog(context, "${TranslationBase.of(context).areYouSureYouWantTo} ${TranslationBase.of(context).endLC} ${TranslationBase.of(context).consultation} ?", () async { Navigator.of(context).pop(); GifLoaderDialogUtils.showMyDialog(context); - await liveCareModel.getAlternativeServices(patient.vcId); + await liveCareModel.getAlternativeServices(patient.vcId!); GifLoaderDialogUtils.hideDialog(context); if (liveCareModel.state == ViewState.ErrorLocal) { DrAppToastMsg.showErrorToast(liveCareModel.error); } else { - showAlternativesDialog(context, liveCareModel, - (bool isConfirmed) async { + showAlternativesDialog(context, liveCareModel, (bool isConfirmed) async { GifLoaderDialogUtils.showMyDialog(context); - await liveCareModel.endCallWithCharge(patient.vcId, isConfirmed); + await liveCareModel.endCallWithCharge(patient.vcId!, isConfirmed); GifLoaderDialogUtils.hideDialog(context); if (liveCareModel.state == ViewState.ErrorLocal) { DrAppToastMsg.showErrorToast(liveCareModel.error); } else { - DrAppToastMsg.showSuccesToast( - "You successfully completed call with charge"); + DrAppToastMsg.showSuccesToast("You successfully completed call with charge"); Navigator.of(context).pop(); Navigator.of(context).pop(); } @@ -161,23 +139,16 @@ class _EndCallScreenState extends State { } }); }, isDartIcon: true, dartIcon: DoctorApp.end_consultaion), - PatientProfileCardModel( - TranslationBase.of(context).sendLC, - TranslationBase.of(context).instruction, - "", - 'assets/images/svgs/profile_screen/health summary.svg', onTap: () { - Utils.showConfirmationDialog(context, - "${TranslationBase.of(context).areYouSureYouWantTo} ${TranslationBase.of(context).sendLC} ${TranslationBase.of(context).instruction} ?", - () async { + PatientProfileCardModel(TranslationBase.of(context).sendLC, TranslationBase.of(context).instruction, "", 'assets/images/svgs/profile_screen/health summary.svg', onTap: () { + Utils.showConfirmationDialog(context, "${TranslationBase.of(context).areYouSureYouWantTo} ${TranslationBase.of(context).sendLC} ${TranslationBase.of(context).instruction} ?", () async { Navigator.of(context).pop(); GifLoaderDialogUtils.showMyDialog(context); - await liveCareModel.sendSMSInstruction(patient.vcId); + await liveCareModel.sendSMSInstruction(patient.vcId!); GifLoaderDialogUtils.hideDialog(context); if (liveCareModel.state == ViewState.ErrorLocal) { DrAppToastMsg.showErrorToast(liveCareModel.error); } else { - DrAppToastMsg.showSuccesToast( - "You successfully sent SMS instructions"); + DrAppToastMsg.showSuccesToast("You successfully sent SMS instructions"); } }); }, @@ -185,23 +156,15 @@ class _EndCallScreenState extends State { isDartIcon: true, // isDisable: true, dartIcon: DoctorApp.send_instruction), - PatientProfileCardModel( - TranslationBase.of(context).transferTo, - TranslationBase.of(context).admin, - '', - 'assets/images/svgs/profile_screen/health summary.svg', onTap: () { + PatientProfileCardModel(TranslationBase.of(context).transferTo, TranslationBase.of(context).admin, '', 'assets/images/svgs/profile_screen/health summary.svg', onTap: () { Navigator.push( context, MaterialPageRoute( - builder: (BuildContext context) => - LivaCareTransferToAdmin(patient: patient), + builder: (BuildContext context) => LivaCareTransferToAdmin(patient: patient), settings: RouteSettings(name: 'LivaCareTransferToAdmin'), ), ); - }, - isInPatient: isInpatient, - isDartIcon: true, - dartIcon: DoctorApp.transfer_to_admin), + }, isInPatient: isInpatient, isDartIcon: true, dartIcon: DoctorApp.transfer_to_admin), ]; return BaseView( @@ -217,8 +180,7 @@ class _EndCallScreenState extends State { Navigator.pop(context); }, isInpatient: isInpatient, - height: (patient.patientStatusType != null && - patient.patientStatusType == 43) + height: (patient.patientStatusType != null && patient.patientStatusType == 43) ? 210 : isDischargedPatient ? 240 @@ -233,8 +195,7 @@ class _EndCallScreenState extends State { child: ListView( children: [ Padding( - padding: - const EdgeInsets.symmetric(vertical: 15.0, horizontal: 15), + padding: const EdgeInsets.symmetric(vertical: 15.0, horizontal: 15), child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ @@ -251,28 +212,26 @@ class _EndCallScreenState extends State { SizedBox( height: 10, ), - StaggeredGridView.countBuilder( + MasonryGridView.count( shrinkWrap: true, physics: NeverScrollableScrollPhysics(), crossAxisSpacing: 10, mainAxisSpacing: 10, crossAxisCount: 3, itemCount: cardsList.length, - staggeredTileBuilder: (int index) => StaggeredTile.fit(1), - itemBuilder: (BuildContext context, int index) => - PatientProfileButton( + // staggeredTileBuilder: (int index) => StaggeredTile.fit(1), + itemBuilder: (BuildContext context, int index) => PatientProfileButton( patient: patient, - patientType: patientType, - arrivalType: arrivalType, - from: from, - to: to, + 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, + isDischargedPatient: cardsList[index].isDischargedPatient, isDisable: cardsList[index].isDisable, onTap: cardsList[index].onTap, isLoading: cardsList[index].isLoading, @@ -311,7 +270,7 @@ class _EndCallScreenState extends State { child: Center( child: AppButton( fontWeight: FontWeight.w700, - color: Colors.red[600], + color: Colors.red[600]!, title: "Close", //TranslationBase.of(context).close, onPressed: () { Navigator.of(context).pop(); @@ -330,8 +289,7 @@ class _EndCallScreenState extends State { ); } - showAlternativesDialog(BuildContext context, LiveCarePatientViewModel model, - Function(bool) okFunction) { + showAlternativesDialog(BuildContext context, LiveCarePatientViewModel model, Function(bool) okFunction) { return showDialog( context: context, barrierDismissible: false, // user must tap button! @@ -366,7 +324,7 @@ class _EndCallScreenState extends State { }, title: TranslationBase.of(context).cancel, fontColor: Colors.white, - color: Colors.red[600], + color: Colors.red[600]!, ), ], ), @@ -378,10 +336,10 @@ class _EndCallScreenState extends State { } class CheckBoxListWidget extends StatefulWidget { - final LiveCarePatientViewModel model; + final LiveCarePatientViewModel? model; const CheckBoxListWidget({ - Key key, + Key? key, this.model, }) : super(key: key); @@ -395,20 +353,19 @@ class _CheckBoxListState extends State { return SingleChildScrollView( child: Column( children: [ - ...widget.model.alternativeServicesList + ...widget.model!.alternativeServicesList .map( (element) => Container( child: CheckboxListTile( title: AppText( - element.serviceName, + element.serviceName!, fontWeight: FontWeight.normal, - fontSize: SizeConfig.textMultiplier * 2.2, + fontSize: SizeConfig.textMultiplier! * 2.2, ), value: element.isSelected, onChanged: (newValue) { setState(() { - widget.model - .setSelectedCheckboxValues(element, newValue); + widget.model!.setSelectedCheckboxValues(element, newValue!); }); }, activeColor: Color(0xFFD02127), diff --git a/lib/screens/live_care/live-care_transfer_to_admin.dart b/lib/screens/live_care/live-care_transfer_to_admin.dart index cfe0b4af..b5fd9594 100644 --- a/lib/screens/live_care/live-care_transfer_to_admin.dart +++ b/lib/screens/live_care/live-care_transfer_to_admin.dart @@ -21,9 +21,9 @@ import 'package:speech_to_text/speech_recognition_error.dart'; import 'package:speech_to_text/speech_to_text.dart' as stt; class LivaCareTransferToAdmin extends StatefulWidget { - final PatiantInformtion patient; + final PatiantInformtion? patient; - const LivaCareTransferToAdmin({Key key, this.patient}) : super(key: key); + const LivaCareTransferToAdmin({Key? key, this.patient}) : super(key: key); @override _LivaCareTransferToAdminState createState() => @@ -34,10 +34,10 @@ class _LivaCareTransferToAdminState extends State { stt.SpeechToText speech = stt.SpeechToText(); var recognizedWord; var event = RobotProvider(); - ProjectViewModel projectViewModel; + late ProjectViewModel projectViewModel; TextEditingController noteController = TextEditingController(); - String noteError; + String? noteError; void initState() { requestPermissions(); @@ -80,7 +80,7 @@ class _LivaCareTransferToAdminState extends State { maxLines: 35, minLines: 25, hasBorder: true, - validationError: noteError, + validationError: noteError!, ), Positioned( top: -2, @@ -122,7 +122,7 @@ class _LivaCareTransferToAdminState extends State { Navigator.of(context).pop(); GifLoaderDialogUtils.showMyDialog(context); await model.transferToAdmin( - widget.patient.vcId, noteController.text); + widget.patient!.vcId!, noteController.text); GifLoaderDialogUtils.hideDialog(context); if (model.state == ViewState.ErrorLocal) { DrAppToastMsg.showErrorToast(model.error); diff --git a/lib/screens/live_care/live_care_patient_screen.dart b/lib/screens/live_care/live_care_patient_screen.dart index f4a0f72e..df8feedf 100644 --- a/lib/screens/live_care/live_care_patient_screen.dart +++ b/lib/screens/live_care/live_care_patient_screen.dart @@ -24,22 +24,22 @@ class LiveCarePatientScreen extends StatefulWidget { class _LiveCarePatientScreenState extends State { final _controller = TextEditingController(); - Timer timer; - LiveCarePatientViewModel _liveCareViewModel; + Timer? timer; + LiveCarePatientViewModel? _liveCareViewModel; @override void initState() { super.initState(); timer = Timer.periodic(Duration(seconds: 10), (Timer t) { if (_liveCareViewModel != null) { - _liveCareViewModel.getPendingPatientERForDoctorApp(isFromTimer: true); + _liveCareViewModel!.getPendingPatientERForDoctorApp(isFromTimer: true); } }); } @override void dispose() { - _liveCareViewModel.isLogin(0); + _liveCareViewModel!.isLogin(0); _liveCareViewModel = null; timer?.cancel(); super.dispose(); @@ -84,6 +84,7 @@ class _LiveCarePatientScreenState extends State { color: Colors.black, ), iconSize: 20, + onPressed: () {}, ), ), model.state == ViewState.Idle @@ -92,8 +93,7 @@ class _LiveCarePatientScreenState extends State { child: model.filterData.isEmpty ? Center( child: ErrorMessage( - error: TranslationBase.of(context) - .youDontHaveAnyPatient, + error: TranslationBase.of(context).youDontHaveAnyPatient, ), ) : ListView.builder( @@ -104,8 +104,7 @@ class _LiveCarePatientScreenState extends State { return Padding( padding: EdgeInsets.all(8.0), child: PatientCard( - patientInfo: PatiantInformtion.fromJson( - model.filterData[index].toJson()), + patientInfo: PatiantInformtion.fromJson(model.filterData[index].toJson()), patientType: "0", arrivalType: "0", isFromSearch: false, @@ -113,20 +112,15 @@ class _LiveCarePatientScreenState extends State { isFromLiveCare: true, onTap: () { // TODO change the parameter to daynamic - Navigator.of(context).pushNamed( - PATIENTS_PROFILE, - arguments: { - "patient": - PatiantInformtion.fromJson( - model.filterData[index] - .toJson()), - "patientType": "0", - "isSearch": false, - "isInpatient": false, - "arrivalType": "0", - "isSearchAndOut": false, - "isFromLiveCare": true, - }); + Navigator.of(context).pushNamed(PATIENTS_PROFILE, arguments: { + "patient": PatiantInformtion.fromJson(model.filterData[index].toJson()), + "patientType": "0", + "isSearch": false, + "isInpatient": false, + "arrivalType": "0", + "isSearchAndOut": false, + "isFromLiveCare": true, + }); }, // isFromSearch: widget.isSearch, ), diff --git a/lib/screens/live_care/panding_list.dart b/lib/screens/live_care/panding_list.dart index 56cc95ff..d14e1bb3 100644 --- a/lib/screens/live_care/panding_list.dart +++ b/lib/screens/live_care/panding_list.dart @@ -20,7 +20,7 @@ DrAppSharedPreferances sharedPref = DrAppSharedPreferances(); class LiveCarePandingListScreen extends StatefulWidget { // In the constructor, require a item id. - LiveCarePandingListScreen({Key key}) : super(key: key); + LiveCarePandingListScreen({Key? key}) : super(key: key); @override _LiveCarePandingListState createState() => _LiveCarePandingListState(); @@ -30,7 +30,7 @@ class _LiveCarePandingListState extends State { List _data = []; Utils helpers = new Utils(); bool _isInit = true; - LiveCareViewModel _liveCareProvider; + LiveCareViewModel _liveCareProvider = LiveCareViewModel(); @override void didChangeDependencies() { @@ -47,27 +47,23 @@ class _LiveCarePandingListState extends State { return AppScaffold( appBarTitle: TranslationBase.of(context).livecare, body: Container( - child: ListView(scrollDirection: Axis.vertical, + child: ListView( + scrollDirection: Axis.vertical, // physics: const AlwaysScrollableScrollPhysics(), children: [ RoundedContainer( child: !_liveCareProvider.isFinished - ? Container( - height: SizeConfig.screenHeight, - width: SizeConfig.screenWidth, - child: DrAppCircularProgressIndeicator()) + ? Container(height: SizeConfig.screenHeight, width: SizeConfig.screenWidth, child: DrAppCircularProgressIndeicator()) : _liveCareProvider.hasError ? Center( child: Text( _liveCareProvider.errorMsg, - style: TextStyle( - color: Theme.of(context).errorColor), + style: TextStyle(color: Theme.of(context).errorColor), ), ) : Column( - children: _liveCareProvider.liveCarePendingList - .map((item) { + children: _liveCareProvider.liveCarePendingList.map((item) { return Container( decoration: myBoxDecoration(), child: InkWell( @@ -86,47 +82,18 @@ class _LiveCarePandingListState extends State { Column( children: [ Container( - decoration: - BoxDecoration( - gradient: LinearGradient( - begin: Alignment( - -1, - -1), - end: Alignment( - 1, 1), - colors: [ - Colors.grey[ - 100], - Colors.grey[ - 200], - ]), - boxShadow: [ - BoxShadow( - color: Color.fromRGBO( - 0, - 0, - 0, - 0.08), - offset: Offset( - 0.0, - 5.0), - blurRadius: - 16.0) - ], - borderRadius: - BorderRadius.all( - Radius.circular( - 50.0)), + decoration: BoxDecoration( + gradient: LinearGradient(begin: Alignment(-1, -1), end: Alignment(1, 1), colors: [ + Colors.grey[100]!, + Colors.grey[200]!, + ]), + boxShadow: [BoxShadow(color: Color.fromRGBO(0, 0, 0, 0.08), offset: Offset(0.0, 5.0), blurRadius: 16.0)], + borderRadius: BorderRadius.all(Radius.circular(50.0)), ), width: 80, height: 80, child: Icon( - item.gender == - "1" - ? DoctorApp - .male - : DoctorApp - .female_icon, + item.gender == "1" ? DoctorApp.male : DoctorApp.female_icon, size: 80, )), ], @@ -135,48 +102,25 @@ class _LiveCarePandingListState extends State { width: 20, ), Column( - crossAxisAlignment: - CrossAxisAlignment - .start, + crossAxisAlignment: CrossAxisAlignment.start, children: [ AppText( - item.patientName, - fontSize: 2.0 * - SizeConfig - .textMultiplier, - fontWeight: - FontWeight - .bold, + item.patientName!, + fontSize: 2.0 * SizeConfig.textMultiplier!, + fontWeight: FontWeight.bold, ), SizedBox( height: 8, ), AppText( - TranslationBase.of( - context) - .fileNo + - item.patientID - .toString(), - fontSize: 2.0 * - SizeConfig - .textMultiplier, - fontWeight: - FontWeight - .bold, + TranslationBase.of(context).fileNo + item.patientID.toString(), + fontSize: 2.0 * SizeConfig.textMultiplier!, + fontWeight: FontWeight.bold, ), AppText( - TranslationBase.of( - context) - .age + - ' ' + - item.age - .toString(), - fontSize: 2.0 * - SizeConfig - .textMultiplier, - fontWeight: - FontWeight - .bold, + TranslationBase.of(context).age + ' ' + item.age.toString(), + fontSize: 2.0 * SizeConfig.textMultiplier!, + fontWeight: FontWeight.bold, ), SizedBox( height: 8, @@ -193,8 +137,7 @@ class _LiveCarePandingListState extends State { Icons.video_call, size: 40, ), - color: Colors - .green, //Colors.black, + color: Colors.green, //Colors.black, onPressed: () => { _isInit = true, // sharedPref.setObj( @@ -255,11 +198,11 @@ class _LiveCarePandingListState extends State { MyGlobals myGlobals = new MyGlobals(); class MyGlobals { - GlobalKey _scaffoldKey; + GlobalKey? _scaffoldKey; MyGlobals() { _scaffoldKey = GlobalKey(); } - GlobalKey get scaffoldKey => _scaffoldKey; + GlobalKey get scaffoldKey => _scaffoldKey!; } diff --git a/lib/screens/live_care/video_call.dart b/lib/screens/live_care/video_call.dart index d3851be0..fc12d05b 100644 --- a/lib/screens/live_care/video_call.dart +++ b/lib/screens/live_care/video_call.dart @@ -19,7 +19,7 @@ class VideoCallPage extends StatefulWidget { final listContext; final LiveCarePatientViewModel model; - VideoCallPage({this.patientData, this.listContext, this.model}); + VideoCallPage({required this.patientData, this.listContext, required this.model}); @override _VideoCallPageState createState() => _VideoCallPageState(); @@ -28,10 +28,10 @@ class VideoCallPage extends StatefulWidget { DrAppSharedPreferances sharedPref = DrAppSharedPreferances(); class _VideoCallPageState extends State { - Timer _timmerInstance; + Timer? _timmerInstance; int _start = 0; String _timmer = ''; - LiveCareViewModel _liveCareProvider; + LiveCareViewModel _liveCareProvider = LiveCareViewModel(); bool _isInit = true; var _tokenData; bool isTransfer = false; @@ -68,12 +68,13 @@ class _VideoCallPageState extends State { kSessionId: tokenData.openSessionID, //'1_MX40NjgwMzIyNH5-MTU5MzY4MzYzODYwM35ucExWYVRVSm5Hcy9uWGZmM1lOa3czZHV-fg', kApiKey: '46209962', - vcId: widget.patientData.vcId, - isRecording: tokenData != null ? tokenData.isRecording : false, - patientName: widget.patientData.fullName ?? - widget.patientData.firstName != null - ? "${widget.patientData.firstName} ${widget.patientData.lastName}" - : "-", + vcId: widget.patientData.vcId!, + isRecording: tokenData != null ? tokenData.isRecording! : false, + patientName: widget.patientData.fullName == null + ? widget.patientData.firstName != null + ? "${widget.patientData.firstName} ${widget.patientData.lastName}" + : "-" + : "", tokenID: token, //"hfkjshdf347r8743", generalId: "Cs2020@2016\$2958", @@ -105,8 +106,7 @@ class _VideoCallPageState extends State { }); connectOpenTok(result); - }).catchError((error) => - {Utils.showErrorToast(error), Navigator.of(context).pop()}); + }).catchError((error) => {Utils.showErrorToast(error), Navigator.of(context).pop()}); } @override @@ -134,20 +134,14 @@ class _VideoCallPageState extends State { ), Text( _start == 0 ? 'Dailing' : 'Connected', - style: TextStyle( - color: Colors.deepPurpleAccent, - fontWeight: FontWeight.w300, - fontSize: 15), + style: TextStyle(color: Colors.deepPurpleAccent, fontWeight: FontWeight.w300, fontSize: 15), ), SizedBox( height: MediaQuery.of(context).size.height * 0.02, ), Text( - widget.patientData.fullName, - style: TextStyle( - color: Colors.deepPurpleAccent, - fontWeight: FontWeight.w900, - fontSize: 20), + widget.patientData.fullName!, + style: TextStyle(color: Colors.deepPurpleAccent, fontWeight: FontWeight.w900, fontSize: 20), ), SizedBox( height: MediaQuery.of(context).size.height * 0.02, @@ -155,10 +149,7 @@ class _VideoCallPageState extends State { Container( child: Text( _start == 0 ? 'Connecting...' : _timmer.toString(), - style: TextStyle( - color: Colors.deepPurpleAccent, - fontWeight: FontWeight.w300, - fontSize: 15), + style: TextStyle(color: Colors.deepPurpleAccent, fontWeight: FontWeight.w300, fontSize: 15), )), SizedBox( height: MediaQuery.of(context).size.height * 0.02, @@ -205,22 +196,20 @@ class _VideoCallPageState extends State { _showAlert(BuildContext context) async { await showDialog( context: context, - builder: (dialogContex) => AlertDialog(content: StatefulBuilder( - builder: (BuildContext context, StateSetter setState) { + builder: (dialogContex) => AlertDialog(content: StatefulBuilder(builder: (BuildContext context, StateSetter setState) { return Container( height: MediaQuery.of(context).size.height * 0.7, width: MediaQuery.of(context).size.width * .9, child: Stack( fit: StackFit.loose, - overflow: Overflow.visible, + clipBehavior: Clip.none, children: [ Positioned( right: -40.0, top: -40.0, child: InkResponse( onTap: () { - Navigator.of(context, rootNavigator: true) - .pop('dialog'); + Navigator.of(context, rootNavigator: true).pop('dialog'); Navigator.of(context).pop(); }, child: CircleAvatar( @@ -236,41 +225,57 @@ class _VideoCallPageState extends State { children: [ Padding( padding: EdgeInsets.all(8.0), - child: RaisedButton( + child: ElevatedButton( onPressed: () => {endCall()}, - child: - Text(TranslationBase.of(context).endcall), - color: Colors.red, - textColor: Colors.white, + child: Text(TranslationBase.of(context).endcall), + style: ButtonStyle( + backgroundColor: MaterialStateProperty.all( + Colors.red, + ), + textStyle: MaterialStateProperty.all( + TextStyle(color: Colors.white), + ), + ), )), Padding( padding: EdgeInsets.all(8.0), - child: RaisedButton( + child: ElevatedButton( onPressed: () => {resumeCall()}, - child: - Text(TranslationBase.of(context).resumecall), - color: AppGlobal.appGreenColor, - textColor: Colors.white, + child: Text(TranslationBase.of(context).resumecall), + style: ButtonStyle( + backgroundColor: MaterialStateProperty.all( + AppGlobal.appGreenColor, + ), + textStyle: MaterialStateProperty.all( + TextStyle(color: Colors.white), + ), + ), ), ), Padding( padding: EdgeInsets.all(8.0), - child: RaisedButton( + child: ElevatedButton( onPressed: () => {endCallWithCharge()}, - child: Text(TranslationBase.of(context) - .endcallwithcharge), - textColor: Colors.white, + child: Text(TranslationBase.of(context).endcallwithcharge), + style: ButtonStyle( + textStyle: MaterialStateProperty.all( + TextStyle(color: Colors.white), + ), + ), ), ), Padding( padding: EdgeInsets.all(8.0), - child: RaisedButton( + child: ElevatedButton( onPressed: () => { setState(() => {isTransfer = true}) }, - child: Text( - TranslationBase.of(context).transfertoadmin), - color: Colors.yellow[900], + child: Text(TranslationBase.of(context).transfertoadmin), + style: ButtonStyle( + backgroundColor: MaterialStateProperty.all( + Colors.yellow[900], + ), + ), ), ), isTransfer == true @@ -283,16 +288,17 @@ class _VideoCallPageState extends State { child: TextField( maxLines: 3, controller: notes, - decoration: InputDecoration.collapsed( - hintText: - "Enter your notes here"), + decoration: InputDecoration.collapsed(hintText: "Enter your notes here"), )), Center( - child: RaisedButton( - onPressed: () => - {this.transferToAdmin(notes)}, + child: ElevatedButton( + onPressed: () => {this.transferToAdmin(notes)}, child: Text('Transfer'), - color: Colors.yellow[900], + style: ButtonStyle( + backgroundColor: MaterialStateProperty.all( + Colors.yellow[900], + ), + ), )) ], ) @@ -312,33 +318,24 @@ class _VideoCallPageState extends State { transferToAdmin(notes) { closeRoute(); - _liveCareProvider - .transfterToAdmin(widget.patientData, notes) - .then((result) { + _liveCareProvider.transfterToAdmin(widget.patientData, notes).then((result) { connectOpenTok(result); - }).catchError((error) => - {Utils.showErrorToast(error), Navigator.of(context).pop()}); + }).catchError((error) => {Utils.showErrorToast(error), Navigator.of(context).pop()}); } endCall() { closeRoute(); - _liveCareProvider - .endCall(widget.patientData, false, doctorprofile['DoctorID']) - .then((result) { + _liveCareProvider.endCall(widget.patientData, false, doctorprofile['DoctorID']).then((result) { print(result); - }).catchError((error) => - {Utils.showErrorToast(error), Navigator.of(context).pop()}); + }).catchError((error) => {Utils.showErrorToast(error), Navigator.of(context).pop()}); } endCallWithCharge() { - _liveCareProvider - .endCallWithCharge(widget.patientData.vcId, doctorprofile['DoctorID']) - .then((result) { + _liveCareProvider.endCallWithCharge(widget.patientData.vcId, doctorprofile['DoctorID']).then((result) { closeRoute(); print('end callwith charge'); print(result); - }).catchError((error) => - {Utils.showErrorToast(error), Navigator.of(context).pop()}); + }).catchError((error) => {Utils.showErrorToast(error), Navigator.of(context).pop()}); } closeRoute() { diff --git a/lib/screens/medical-file/health_summary_page.dart b/lib/screens/medical-file/health_summary_page.dart index 95a9e0a5..3e5b702a 100644 --- a/lib/screens/medical-file/health_summary_page.dart +++ b/lib/screens/medical-file/health_summary_page.dart @@ -21,22 +21,20 @@ class HealthSummaryPage extends StatefulWidget { } class _HealthSummaryPageState extends State { - PatiantInformtion patient; + PatiantInformtion? patient; @override Widget build(BuildContext context) { - final routeArgs = ModalRoute.of(context).settings.arguments as Map; + final routeArgs = ModalRoute.of(context)!.settings.arguments as Map; patient = routeArgs['patient']; String patientType = routeArgs['patientType']; String arrivalType = routeArgs['arrivalType']; bool isInpatient = routeArgs['isInpatient']; return BaseView( - onModelReady: (model) => model.getMedicalFile(mrn: patient.patientId), - builder: - (BuildContext context, MedicalFileViewModel model, Widget child) => - AppScaffold( + onModelReady: (model) => model.getMedicalFile(mrn: patient!.patientId), + builder: (BuildContext context, MedicalFileViewModel model, Widget? child) => AppScaffold( appBar: PatientProfileAppBar( - patient, + patient!, isInpatient: isInpatient, ), isShowAppBar: true, @@ -48,8 +46,7 @@ class _HealthSummaryPageState extends State { child: Column( children: [ Padding( - padding: - EdgeInsets.symmetric(horizontal: 12.0, vertical: 8.0), + padding: EdgeInsets.symmetric(horizontal: 12.0, vertical: 8.0), child: Container( child: Padding( padding: const EdgeInsets.all(8.0), @@ -79,26 +76,17 @@ class _HealthSummaryPageState extends State { ), ), ), - (model.medicalFileList != null && - model.medicalFileList.length != 0) + (model.medicalFileList != null && model.medicalFileList.length != 0) ? ListView.builder( //physics: , physics: NeverScrollableScrollPhysics(), scrollDirection: Axis.vertical, shrinkWrap: true, - itemCount: model.medicalFileList[0].entityList[0] - .timelines.length, + itemCount: model.medicalFileList[0].entityList![0].timelines!.length, itemBuilder: (BuildContext ctxt, int index) { return InkWell( onTap: () async { - if (model - .medicalFileList[0] - .entityList[0] - .timelines[index] - .timeLineEvents[0] - .consulations - .length != - 0) + if (model.medicalFileList[0].entityList![0].timelines![index].timeLineEvents![0].consulations!.length != 0) await locator().logEvent( eventCategory: "Health Summary Page", eventAction: "Health Summary Details", @@ -107,93 +95,40 @@ class _HealthSummaryPageState extends State { context, MaterialPageRoute( builder: (context) => MedicalFileDetails( - age: patient.age is String - ? patient.age ?? "" - : "${patient.age}", - firstName: patient.firstName, - lastName: patient.lastName, - gender: patient.genderDescription, + age: patient!.age is String ? patient!.age ?? "" : "${patient!.age}", + firstName: patient!.firstName!, + lastName: patient!.lastName!, + gender: patient!.genderDescription!, encounterNumber: index, - pp: patient.patientId, - patient: patient, - doctorName: model - .medicalFileList[0] - .entityList[0] - .timelines[index] - .timeLineEvents[0] - .consulations - .isNotEmpty - ? model - .medicalFileList[0] - .entityList[0] - .timelines[index] - .doctorName + pp: patient!.patientId!, + patient: patient!, + doctorName: model.medicalFileList[0].entityList![0].timelines![index].timeLineEvents![0].consulations!.isNotEmpty + ? model.medicalFileList[0].entityList![0].timelines![index].doctorName! : "", - clinicName: model - .medicalFileList[0] - .entityList[0] - .timelines[index] - .timeLineEvents[0] - .consulations - .isNotEmpty - ? model - .medicalFileList[0] - .entityList[0] - .timelines[index] - .clinicName + clinicName: model.medicalFileList[0].entityList![0].timelines![index].timeLineEvents![0].consulations!.isNotEmpty + ? model.medicalFileList[0].entityList![0].timelines![index].clinicName! : "", - doctorImage: model - .medicalFileList[0] - .entityList[0] - .timelines[index] - .timeLineEvents[0] - .consulations - .isNotEmpty - ? model - .medicalFileList[0] - .entityList[0] - .timelines[index] - .doctorImage + doctorImage: model.medicalFileList[0].entityList![0].timelines![index].timeLineEvents![0].consulations!.isNotEmpty + ? model.medicalFileList[0].entityList![0].timelines![index].doctorImage! : "", - episode: - model.medicalFileList[0].entityList[0].timelines[index].timeLineEvents[0].consulations.isNotEmpty ? model.medicalFileList[0].entityList[0].timelines[index].timeLineEvents[0].consulations[0].episodeID.toString() : "", - vistDate: model.medicalFileList[0].entityList[0].timelines[index].date.toString()), - settings: RouteSettings( - name: 'MedicalFileDetails'), + episode: model.medicalFileList[0].entityList![0].timelines![index].timeLineEvents![0].consulations!.isNotEmpty + ? model.medicalFileList[0].entityList![0].timelines![index].timeLineEvents![0].consulations![0].episodeID.toString() + : "", + vistDate: model.medicalFileList[0].entityList![0].timelines![index].date.toString()), + settings: RouteSettings(name: 'MedicalFileDetails'), ), ); }, child: DoctorCard( - doctorName: model - .medicalFileList[0] - .entityList[0] - .timelines[index] - .doctorName, - clinic: model.medicalFileList[0].entityList[0] - .timelines[index].clinicName, - branch: model.medicalFileList[0].entityList[0] - .timelines[index].projectName, - profileUrl: model - .medicalFileList[0] - .entityList[0] - .timelines[index] - .doctorImage, - appointmentDate: - AppDateUtils.getDateTimeFromServerFormat( - model.medicalFileList[0].entityList[0] - .timelines[index].date, + doctorName: model.medicalFileList[0].entityList![0].timelines![index].doctorName!, + clinic: model.medicalFileList[0].entityList![0].timelines![index].clinicName!, + branch: model.medicalFileList[0].entityList![0].timelines![index].projectName!, + profileUrl: model.medicalFileList[0].entityList![0].timelines![index].doctorImage!, + appointmentDate: AppDateUtils.getDateTimeFromServerFormat( + model.medicalFileList[0].entityList![0].timelines![index].date!, ), isPrescriptions: true, - isShowEye: model - .medicalFileList[0] - .entityList[0] - .timelines[index] - .timeLineEvents[0] - .consulations - .length != - 0 - ? true - : false), + isShowEye: model.medicalFileList[0].entityList![0].timelines![index].timeLineEvents![0].consulations!.length != 0 ? true : false), ); }) : Center( diff --git a/lib/screens/medical-file/medical_file_details.dart b/lib/screens/medical-file/medical_file_details.dart index ae2fb0f0..bdf0c28c 100644 --- a/lib/screens/medical-file/medical_file_details.dart +++ b/lib/screens/medical-file/medical_file_details.dart @@ -16,77 +16,55 @@ import 'package:provider/provider.dart'; import '../../widgets/shared/errors/error_message.dart'; class MedicalFileDetails extends StatefulWidget { - String age; - String firstName; - String lastName; - String gender; - int encounterNumber; - int pp; - PatiantInformtion patient; - String clinicName; - String episode; - String doctorName; - String vistDate; - String doctorImage; + String? age; + String? firstName; + String? lastName; + String? gender; + int? encounterNumber; + int? pp; + PatiantInformtion? patient; + String? clinicName; + String? episode; + String? doctorName; + String? vistDate; + String? doctorImage; MedicalFileDetails( - {this.age, - this.firstName, - this.lastName, - this.gender, - this.encounterNumber, - this.pp, - this.patient, - this.doctorName, - this.vistDate, - this.clinicName, - this.episode, - this.doctorImage}); + {this.age, this.firstName, this.lastName, this.gender, this.encounterNumber, this.pp, this.patient, this.doctorName, this.vistDate, this.clinicName, this.episode, this.doctorImage}); @override _MedicalFileDetailsState createState() => _MedicalFileDetailsState( - firstName: firstName, - age: age, - lastName: lastName, - gender: gender, - encounterNumber: encounterNumber, - pp: pp, - patient: patient, - clinicName: clinicName, - doctorName: doctorName, - episode: episode, - vistDate: vistDate, - doctorImage: doctorImage, + firstName: firstName!, + age: age!, + lastName: lastName!, + gender: gender!, + encounterNumber: encounterNumber!, + pp: pp!, + patient: patient!, + clinicName: clinicName!, + doctorName: doctorName!, + episode: episode!, + vistDate: vistDate!, + doctorImage: doctorImage!, ); } class _MedicalFileDetailsState extends State { - int encounterNumber; - String age; - String firstName; - String lastName; - String gender; - int pp; - PatiantInformtion patient; - String clinicName; - String episode; - String doctorName; - String vistDate; - String doctorImage; + int? encounterNumber; + String? age; + String? firstName; + String? lastName; + String? gender; + int? pp; + PatiantInformtion? patient; + String? clinicName; + String? episode; + String? doctorName; + String? vistDate; + String? doctorImage; _MedicalFileDetailsState( - {this.age, - this.firstName, - this.lastName, - this.gender, - this.encounterNumber, - this.pp, - this.patient, - this.doctorName, - this.vistDate, - this.clinicName, - this.episode, - this.doctorImage}); + {this.age, this.firstName, this.lastName, this.gender, this.encounterNumber, this.pp, this.patient, this.doctorName, this.vistDate, this.clinicName, this.episode, this.doctorImage}); bool isPhysicalExam = true; bool isProcedureExpand = true; @@ -99,24 +77,21 @@ class _MedicalFileDetailsState extends State { return BaseView( onModelReady: (model) async { if (model.medicalFileList.length == 0) { - model.getMedicalFile(mrn: pp); + model.getMedicalFile(mrn: pp!); } }, - builder: - (BuildContext context, MedicalFileViewModel model, Widget child) => - AppScaffold( + builder: (BuildContext context, MedicalFileViewModel model, Widget? child) => AppScaffold( appBar: PatientProfileAppBar( - patient, - doctorName: doctorName, - profileUrl: doctorImage, - clinic: clinicName, + patient!, + doctorName: doctorName!, + profileUrl: doctorImage!, + clinic: clinicName!, isPrescriptions: true, isMedicalFile: true, - episode: episode, - visitDate: - '${AppDateUtils.getDayMonthYearDateFormatted(AppDateUtils.getDateTimeFromServerFormat( - vistDate, - ), isArabic: projectViewModel.isArabic)}', + episode: episode!, + visitDate: '${AppDateUtils.getDayMonthYearDateFormatted(AppDateUtils.getDateTimeFromServerFormat( + vistDate!, + ), isArabic: projectViewModel.isArabic)}', isAppointmentHeader: true, ), isShowAppBar: true, @@ -128,125 +103,67 @@ class _MedicalFileDetailsState extends State { child: Container( child: Column( children: [ - model.medicalFileList.length != 0 && - model - .medicalFileList[0] - .entityList[0] - .timelines[encounterNumber] - .timeLineEvents[0] - .consulations - .length != - 0 + model.medicalFileList.length != 0 && model.medicalFileList[0].entityList![0].timelines![encounterNumber!].timeLineEvents![0].consulations!.length != 0 ? Padding( padding: EdgeInsets.all(10.0), child: Container( child: Column( children: [ SizedBox(height: 25.0), - if (model.medicalFileList.length != 0 && - model - .medicalFileList[0] - .entityList[0] - .timelines[encounterNumber] - .timeLineEvents[0] - .consulations - .length != - 0) + if (model.medicalFileList.length != 0 && model.medicalFileList[0].entityList![0].timelines![encounterNumber!].timeLineEvents![0].consulations!.length != 0) Container( width: double.infinity, - margin: EdgeInsets.only( - top: 10, left: 10, right: 10), + margin: EdgeInsets.only(top: 10, left: 10, right: 10), padding: EdgeInsets.all(8.0), decoration: BoxDecoration( color: Colors.white, borderRadius: BorderRadius.all( Radius.circular(10.0), ), - border: Border.all( - color: Colors.grey[200], - width: 0.5), + border: Border.all(color: Colors.grey[200]!, width: 0.5), ), child: Padding( padding: const EdgeInsets.all(15.0), child: HeaderBodyExpandableNotifier( headerWidget: Row( - mainAxisAlignment: - MainAxisAlignment.spaceBetween, + mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ Row( children: [ - AppText( - TranslationBase.of( - context) - .historyOfPresentIllness - .toUpperCase(), - variant: isHistoryExpand - ? "bodyText" - : '', - bold: isHistoryExpand - ? true - : true, - color: Colors.black), + AppText(TranslationBase.of(context).historyOfPresentIllness.toUpperCase(), + variant: isHistoryExpand ? "bodyText" : '', bold: isHistoryExpand ? true : true, color: Colors.black), ], ), InkWell( onTap: () { setState(() { - isHistoryExpand = - !isHistoryExpand; + isHistoryExpand = !isHistoryExpand; }); }, - child: Icon(isHistoryExpand - ? EvaIcons.arrowUp - : EvaIcons.arrowDown)) + child: Icon(isHistoryExpand ? EvaIcons.arrowUp : EvaIcons.arrowDown)) ], ), bodyWidget: ListView.builder( - physics: - NeverScrollableScrollPhysics(), + physics: NeverScrollableScrollPhysics(), scrollDirection: Axis.vertical, shrinkWrap: true, - itemCount: model - .medicalFileList[0] - .entityList[0] - .timelines[encounterNumber] - .timeLineEvents[0] - .consulations[0] - .lstCheifComplaint - .length, - itemBuilder: (BuildContext ctxt, - int index) { + itemCount: model.medicalFileList[0].entityList![0].timelines![encounterNumber!].timeLineEvents![0].consulations![0].lstCheifComplaint!.length, + itemBuilder: (BuildContext ctxt, int index) { return Padding( padding: EdgeInsets.all(8.0), child: Container( child: Column( - mainAxisAlignment: - MainAxisAlignment - .center, + mainAxisAlignment: MainAxisAlignment.center, children: [ Row( children: [ Expanded( child: AppText( - model - .medicalFileList[ - 0] - .entityList[ - 0] - .timelines[ - encounterNumber] - .timeLineEvents[ - 0] - .consulations[ - 0] - .lstCheifComplaint[ - index] - .hOPI + model.medicalFileList[0].entityList![0].timelines![encounterNumber!].timeLineEvents![0].consulations![0].lstCheifComplaint![index].hOPI! .trim(), ), ), - SizedBox( - width: 35.0), + SizedBox(width: 35.0), ], ), ], @@ -265,87 +182,50 @@ class _MedicalFileDetailsState extends State { SizedBox( height: 30, ), - if (model.medicalFileList.length != 0 && - model - .medicalFileList[0] - .entityList[0] - .timelines[encounterNumber] - .timeLineEvents[0] - .consulations - .length != - 0) + if (model.medicalFileList.length != 0 && model.medicalFileList[0].entityList![0].timelines![encounterNumber!].timeLineEvents![0].consulations!.length != 0) Container( width: double.infinity, - margin: EdgeInsets.only( - top: 10, left: 10, right: 10), + margin: EdgeInsets.only(top: 10, left: 10, right: 10), padding: EdgeInsets.all(8.0), decoration: BoxDecoration( color: Colors.white, borderRadius: BorderRadius.all( Radius.circular(10.0), ), - border: Border.all( - color: Colors.grey[200], - width: 0.5), + border: Border.all(color: Colors.grey[200]!, width: 0.5), ), child: Padding( padding: const EdgeInsets.all(15.0), child: HeaderBodyExpandableNotifier( headerWidget: Row( - mainAxisAlignment: - MainAxisAlignment.spaceBetween, + mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ Row( children: [ - AppText( - TranslationBase.of( - context) - .assessment - .toUpperCase(), - variant: - isAssessmentExpand - ? "bodyText" - : '', - bold: isAssessmentExpand - ? true - : true, - color: Colors.black), + AppText(TranslationBase.of(context).assessment.toUpperCase(), + variant: isAssessmentExpand ? "bodyText" : '', bold: isAssessmentExpand ? true : true, color: Colors.black), ], ), InkWell( onTap: () { setState(() { - isAssessmentExpand = - !isAssessmentExpand; + isAssessmentExpand = !isAssessmentExpand; }); }, - child: Icon(isAssessmentExpand - ? EvaIcons.arrowUp - : EvaIcons.arrowDown)) + child: Icon(isAssessmentExpand ? EvaIcons.arrowUp : EvaIcons.arrowDown)) ], ), bodyWidget: ListView.builder( - physics: - NeverScrollableScrollPhysics(), + physics: NeverScrollableScrollPhysics(), scrollDirection: Axis.vertical, shrinkWrap: true, - itemCount: model - .medicalFileList[0] - .entityList[0] - .timelines[encounterNumber] - .timeLineEvents[0] - .consulations[0] - .lstAssessments - .length, - itemBuilder: (BuildContext ctxt, - int index) { + itemCount: model.medicalFileList[0].entityList![0].timelines![encounterNumber!].timeLineEvents![0].consulations![0].lstAssessments!.length, + itemBuilder: (BuildContext ctxt, int index) { return Padding( padding: EdgeInsets.all(8.0), child: Container( child: Column( - mainAxisAlignment: - MainAxisAlignment - .center, + mainAxisAlignment: MainAxisAlignment.center, children: [ Row( children: [ @@ -354,59 +234,27 @@ class _MedicalFileDetailsState extends State { fontSize: 13.0, ), AppText( - model - .medicalFileList[ - 0] - .entityList[0] - .timelines[ - encounterNumber] - .timeLineEvents[ - 0] - .consulations[ - 0] - .lstAssessments[ - index] - .iCD10 + model.medicalFileList[0].entityList![0].timelines![encounterNumber!].timeLineEvents![0].consulations![0].lstAssessments![index].iCD10! .trim(), fontSize: 13.5, - fontWeight: - FontWeight - .w700, + fontWeight: FontWeight.w700, ), - SizedBox( - width: 15.0), + SizedBox(width: 15.0), ], ), Row( children: [ AppText( - TranslationBase.of( - context) - .condition + - ": ", + TranslationBase.of(context).condition + ": ", fontSize: 12.5, ), Expanded( child: AppText( - model - .medicalFileList[ - 0] - .entityList[ - 0] - .timelines[ - encounterNumber] - .timeLineEvents[ - 0] - .consulations[ - 0] - .lstAssessments[ - index] - .condition + model.medicalFileList[0].entityList![0].timelines![encounterNumber!].timeLineEvents![0].consulations![0].lstAssessments![index] + .condition! .trim(), fontSize: 13.0, - fontWeight: - FontWeight - .w700, + fontWeight: FontWeight.w700, ), ), ], @@ -415,23 +263,9 @@ class _MedicalFileDetailsState extends State { children: [ Expanded( child: AppText( - model - .medicalFileList[ - 0] - .entityList[ - 0] - .timelines[ - encounterNumber] - .timeLineEvents[ - 0] - .consulations[ - 0] - .lstAssessments[ - index] - .description, - fontWeight: - FontWeight - .w700, + model.medicalFileList[0].entityList![0].timelines![encounterNumber!].timeLineEvents![0].consulations![0].lstAssessments![index] + .description!, + fontWeight: FontWeight.w700, fontSize: 15.0, ), ) @@ -440,32 +274,14 @@ class _MedicalFileDetailsState extends State { Row( children: [ AppText( - TranslationBase.of( - context) - .type + - ": ", + TranslationBase.of(context).type + ": ", fontSize: 15.5, ), Expanded( child: AppText( - model - .medicalFileList[ - 0] - .entityList[ - 0] - .timelines[ - encounterNumber] - .timeLineEvents[ - 0] - .consulations[ - 0] - .lstAssessments[ - index] - .type, + model.medicalFileList[0].entityList![0].timelines![encounterNumber!].timeLineEvents![0].consulations![0].lstAssessments![index].type!, fontSize: 16.0, - fontWeight: - FontWeight - .w700, + fontWeight: FontWeight.w700, ), ), ], @@ -474,17 +290,7 @@ class _MedicalFileDetailsState extends State { height: 15.0, ), AppText( - model - .medicalFileList[ - 0] - .entityList[0] - .timelines[ - encounterNumber] - .timeLineEvents[0] - .consulations[0] - .lstAssessments[ - index] - .remarks + model.medicalFileList[0].entityList![0].timelines![encounterNumber!].timeLineEvents![0].consulations![0].lstAssessments![index].remarks! .trim(), ), Divider( @@ -508,86 +314,50 @@ class _MedicalFileDetailsState extends State { SizedBox( height: 30, ), - if (model.medicalFileList.length != 0 && - model - .medicalFileList[0] - .entityList[0] - .timelines[encounterNumber] - .timeLineEvents[0] - .consulations - .length != - 0) + if (model.medicalFileList.length != 0 && model.medicalFileList[0].entityList![0].timelines![encounterNumber!].timeLineEvents![0].consulations!.length != 0) Container( width: double.infinity, - margin: EdgeInsets.only( - top: 10, left: 10, right: 10), + margin: EdgeInsets.only(top: 10, left: 10, right: 10), padding: EdgeInsets.all(8.0), decoration: BoxDecoration( color: Colors.white, borderRadius: BorderRadius.all( Radius.circular(10.0), ), - border: Border.all( - color: Colors.grey[200], - width: 0.5), + border: Border.all(color: Colors.grey[200]!, width: 0.5), ), child: Padding( padding: const EdgeInsets.all(15.0), child: HeaderBodyExpandableNotifier( headerWidget: Row( - mainAxisAlignment: - MainAxisAlignment.spaceBetween, + mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ Row( children: [ - AppText( - TranslationBase.of( - context) - .test - .toUpperCase(), - variant: isProcedureExpand - ? "bodyText" - : '', - bold: isProcedureExpand - ? true - : true, - color: Colors.black), + AppText(TranslationBase.of(context).test.toUpperCase(), + variant: isProcedureExpand ? "bodyText" : '', bold: isProcedureExpand ? true : true, color: Colors.black), ], ), InkWell( onTap: () { setState(() { - isProcedureExpand = - !isProcedureExpand; + isProcedureExpand = !isProcedureExpand; }); }, - child: Icon(isProcedureExpand - ? EvaIcons.arrowUp - : EvaIcons.arrowDown)) + child: Icon(isProcedureExpand ? EvaIcons.arrowUp : EvaIcons.arrowDown)) ], ), bodyWidget: ListView.builder( - physics: - NeverScrollableScrollPhysics(), + physics: NeverScrollableScrollPhysics(), scrollDirection: Axis.vertical, shrinkWrap: true, - itemCount: model - .medicalFileList[0] - .entityList[0] - .timelines[encounterNumber] - .timeLineEvents[0] - .consulations[0] - .lstProcedure - .length, - itemBuilder: (BuildContext ctxt, - int index) { + itemCount: model.medicalFileList[0].entityList![0].timelines![encounterNumber!].timeLineEvents![0].consulations![0].lstProcedure!.length, + itemBuilder: (BuildContext ctxt, int index) { return Padding( padding: EdgeInsets.all(8.0), child: Container( child: Column( - mainAxisAlignment: - MainAxisAlignment - .center, + mainAxisAlignment: MainAxisAlignment.center, children: [ Row( children: [ @@ -597,65 +367,28 @@ class _MedicalFileDetailsState extends State { 'Procedure ID: ', ), AppText( - model - .medicalFileList[ - 0] - .entityList[ - 0] - .timelines[ - encounterNumber] - .timeLineEvents[ - 0] - .consulations[ - 0] - .lstProcedure[ - index] - .procedureId + model.medicalFileList[0].entityList![0].timelines![encounterNumber!].timeLineEvents![0].consulations![0].lstProcedure![index] + .procedureId! .trim(), - fontSize: - 13.5, - fontWeight: - FontWeight - .w700, + fontSize: 13.5, + fontWeight: FontWeight.w700, ), ], ), - SizedBox( - width: 35.0), + SizedBox(width: 35.0), Column( children: [ AppText( - TranslationBase.of( - context) - .orderDate + - ": ", + TranslationBase.of(context).orderDate + ": ", ), AppText( - AppDateUtils - .getDateFormatted( - DateTime - .parse( - model - .medicalFileList[ - 0] - .entityList[ - 0] - .timelines[ - encounterNumber] - .timeLineEvents[ - 0] - .consulations[ - 0] - .lstProcedure[ - index] - .orderDate + AppDateUtils.getDateFormatted(DateTime.parse( + model.medicalFileList[0].entityList![0].timelines![encounterNumber!].timeLineEvents![0].consulations![0].lstProcedure![index] + .orderDate! .trim(), )), - fontSize: - 13.5, - fontWeight: - FontWeight - .w700, + fontSize: 13.5, + fontWeight: FontWeight.w700, ), ], ), @@ -668,23 +401,8 @@ class _MedicalFileDetailsState extends State { children: [ Expanded( child: AppText( - model - .medicalFileList[ - 0] - .entityList[ - 0] - .timelines[ - encounterNumber] - .timeLineEvents[ - 0] - .consulations[ - 0] - .lstProcedure[ - index] - .procName, - fontWeight: - FontWeight - .w700, + model.medicalFileList[0].entityList![0].timelines![encounterNumber!].timeLineEvents![0].consulations![0].lstProcedure![index].procName!, + fontWeight: FontWeight.w700, ), ) ], @@ -695,23 +413,9 @@ class _MedicalFileDetailsState extends State { 'CPT Code : ', ), AppText( - model - .medicalFileList[ - 0] - .entityList[0] - .timelines[ - encounterNumber] - .timeLineEvents[ - 0] - .consulations[ - 0] - .lstProcedure[ - index] - .patientID + model.medicalFileList[0].entityList![0].timelines![encounterNumber!].timeLineEvents![0].consulations![0].lstProcedure![index].patientID .toString(), - fontWeight: - FontWeight - .w700, + fontWeight: FontWeight.w700, ), ], ), @@ -739,79 +443,45 @@ class _MedicalFileDetailsState extends State { SizedBox( height: 30, ), - if (model.medicalFileList.length != 0 && - model - .medicalFileList[0] - .entityList[0] - .timelines[encounterNumber] - .timeLineEvents[0] - .consulations - .length != - 0) + if (model.medicalFileList.length != 0 && model.medicalFileList[0].entityList![0].timelines![encounterNumber!].timeLineEvents![0].consulations!.length != 0) Container( width: double.infinity, - margin: EdgeInsets.only( - top: 10, left: 10, right: 10), + margin: EdgeInsets.only(top: 10, left: 10, right: 10), padding: EdgeInsets.all(8.0), decoration: BoxDecoration( color: Colors.white, borderRadius: BorderRadius.all( Radius.circular(10.0), ), - border: Border.all( - color: Colors.grey[200], - width: 0.5), + border: Border.all(color: Colors.grey[200]!, width: 0.5), ), child: Padding( padding: const EdgeInsets.all(15.0), child: HeaderBodyExpandableNotifier( headerWidget: Row( - mainAxisAlignment: - MainAxisAlignment.spaceBetween, + mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ Row( children: [ - AppText( - TranslationBase.of( - context) - .physicalSystemExamination - .toUpperCase(), - variant: isPhysicalExam - ? "bodyText" - : '', - bold: isPhysicalExam - ? true - : true, - color: Colors.black), + AppText(TranslationBase.of(context).physicalSystemExamination.toUpperCase(), + variant: isPhysicalExam ? "bodyText" : '', bold: isPhysicalExam ? true : true, color: Colors.black), ], ), InkWell( onTap: () { setState(() { - isPhysicalExam = - !isPhysicalExam; + isPhysicalExam = !isPhysicalExam; }); }, - child: Icon(isPhysicalExam - ? EvaIcons.arrowUp - : EvaIcons.arrowDown)) + child: Icon(isPhysicalExam ? EvaIcons.arrowUp : EvaIcons.arrowDown)) ], ), bodyWidget: ListView.builder( - physics: - NeverScrollableScrollPhysics(), + physics: NeverScrollableScrollPhysics(), scrollDirection: Axis.vertical, shrinkWrap: true, - itemCount: model - .medicalFileList[0] - .entityList[0] - .timelines[encounterNumber] - .timeLineEvents[0] - .consulations[0] - .lstPhysicalExam - .length, - itemBuilder: (BuildContext ctxt, - int index) { + itemCount: model.medicalFileList[0].entityList![0].timelines![encounterNumber!].timeLineEvents![0].consulations![0].lstPhysicalExam!.length, + itemBuilder: (BuildContext ctxt, int index) { return Padding( padding: EdgeInsets.all(8.0), child: Container( @@ -819,75 +489,27 @@ class _MedicalFileDetailsState extends State { children: [ Row( children: [ - AppText(TranslationBase.of( - context) - .examType + - ": "), + AppText(TranslationBase.of(context).examType + ": "), AppText( - model - .medicalFileList[ - 0] - .entityList[0] - .timelines[ - encounterNumber] - .timeLineEvents[ - 0] - .consulations[ - 0] - .lstPhysicalExam[ - index] - .examDesc, - fontWeight: - FontWeight - .w700, + model.medicalFileList[0].entityList![0].timelines![encounterNumber!].timeLineEvents![0].consulations![0].lstPhysicalExam![index].examDesc!, + fontWeight: FontWeight.w700, ), ], ), Row( children: [ AppText( - model - .medicalFileList[ - 0] - .entityList[0] - .timelines[ - encounterNumber] - .timeLineEvents[ - 0] - .consulations[ - 0] - .lstPhysicalExam[ - index] - .examDesc, - fontWeight: - FontWeight - .w700, + model.medicalFileList[0].entityList![0].timelines![encounterNumber!].timeLineEvents![0].consulations![0].lstPhysicalExam![index].examDesc!, + fontWeight: FontWeight.w700, ) ], ), Row( children: [ - AppText(TranslationBase.of( - context) - .abnormal + - ": "), + AppText(TranslationBase.of(context).abnormal + ": "), AppText( - model - .medicalFileList[ - 0] - .entityList[0] - .timelines[ - encounterNumber] - .timeLineEvents[ - 0] - .consulations[ - 0] - .lstPhysicalExam[ - index] - .abnormal, - fontWeight: - FontWeight - .w700, + model.medicalFileList[0].entityList![0].timelines![encounterNumber!].timeLineEvents![0].consulations![0].lstPhysicalExam![index].abnormal!, + fontWeight: FontWeight.w700, ), ], ), @@ -895,17 +517,7 @@ class _MedicalFileDetailsState extends State { height: 15.0, ), AppText( - model - .medicalFileList[ - 0] - .entityList[0] - .timelines[ - encounterNumber] - .timeLineEvents[0] - .consulations[0] - .lstPhysicalExam[ - index] - .remarks, + model.medicalFileList[0].entityList![0].timelines![encounterNumber!].timeLineEvents![0].consulations![0].lstPhysicalExam![index].remarks!, ), Divider( height: 1, diff --git a/lib/screens/medicine/medicine_search_screen.dart b/lib/screens/medicine/medicine_search_screen.dart index 67b8d6ca..9637338d 100644 --- a/lib/screens/medicine/medicine_search_screen.dart +++ b/lib/screens/medicine/medicine_search_screen.dart @@ -25,10 +25,10 @@ import 'package:speech_to_text/speech_to_text.dart'; DrAppSharedPreferances sharedPref = DrAppSharedPreferances(); -class MedicineSearchScreen extends StatefulWidget with DrAppToastMsg { +class MedicineSearchScreen extends StatefulWidget { MedicineSearchScreen({this.changeLoadingState}); - final Function changeLoadingState; + final Function? changeLoadingState; @override _MedicineSearchState createState() => _MedicineSearchState(); @@ -45,11 +45,11 @@ class _MedicineSearchState extends State { GlobalKey key = new GlobalKey>(); - String lastError; + String? lastError; double level = 0.0; double minSoundLevel = 50000; double maxSoundLevel = -50000; - String recognizedWord; + String? recognizedWord; @override void didChangeDependencies() { @@ -239,7 +239,7 @@ class _MedicineSearchState extends State { setState(() { recognizedWord = result.recognizedWords; lastStatus = ''; - myController.text = recognizedWord; + myController.text = recognizedWord!; Future.delayed(const Duration(seconds: 2), () { }); }); diff --git a/lib/screens/medicine/pharmacies_list_screen.dart b/lib/screens/medicine/pharmacies_list_screen.dart index f610f991..92f4550d 100644 --- a/lib/screens/medicine/pharmacies_list_screen.dart +++ b/lib/screens/medicine/pharmacies_list_screen.dart @@ -27,11 +27,9 @@ DrAppSharedPreferances sharedPref = DrAppSharedPreferances(); class PharmaciesListScreen extends StatefulWidget { final int itemID; + final String? url; - final String url; - - PharmaciesListScreen({Key key, @required this.itemID, this.url}) - : super(key: key); + PharmaciesListScreen({Key? key, required this.itemID, this.url}) : super(key: key); @override _PharmaciesListState createState() => _PharmaciesListState(); @@ -39,7 +37,7 @@ class PharmaciesListScreen extends StatefulWidget { class _PharmaciesListState extends State { Utils helpers = new Utils(); - ProjectViewModel projectsProvider; + late ProjectViewModel projectsProvider; @override Widget build(BuildContext context) { @@ -54,218 +52,190 @@ class _PharmaciesListState extends State { widthFactor: 0.95, child: Container( height: SizeConfig.screenHeight, - child: ListView( - shrinkWrap: true, - scrollDirection: Axis.vertical, - physics: const AlwaysScrollableScrollPhysics(), - children: [ - model.pharmaciesList.length > 0 - ? MedicineItemWidget( - label: model.pharmaciesList[0]["ItemDescription"], - url: widget.url, - showArrow: false, - showPrice: true, - price: model.pharmaciesList[0]["SellingPrice"] - .toString(), - ) - : Container(), - Container( - margin: EdgeInsets.only( - top: SizeConfig.widthMultiplier * 2, - bottom: SizeConfig.widthMultiplier * 2, - right: SizeConfig.widthMultiplier * 4, - left: SizeConfig.widthMultiplier * 4, - ), - child: Align( - alignment: Alignment.centerLeft, - child: AppText( - TranslationBase.of(context).youCanFindItIn, - fontWeight: FontWeight.bold, - ), - ), - alignment: projectsProvider.isArabic - ? Alignment.topRight - : Alignment.topLeft, + child: ListView(shrinkWrap: true, scrollDirection: Axis.vertical, physics: const AlwaysScrollableScrollPhysics(), children: [ + model.pharmaciesList.length > 0 + ? MedicineItemWidget( + label: model.pharmaciesList[0]["ItemDescription"], + url: widget.url!, + showArrow: false, + showPrice: true, + price: model.pharmaciesList[0]["SellingPrice"].toString(), + ) + : Container(), + Container( + margin: EdgeInsets.only( + top: SizeConfig.widthMultiplier! * 2, + bottom: SizeConfig.widthMultiplier! * 2, + right: SizeConfig.widthMultiplier! * 4, + left: SizeConfig.widthMultiplier! * 4, + ), + child: Align( + alignment: Alignment.centerLeft, + child: AppText( + TranslationBase.of(context).youCanFindItIn, + fontWeight: FontWeight.bold, ), - Container( - width: SizeConfig.screenWidth * 0.99, - margin: EdgeInsets.only(left: 10, right: 10), - child: ListView.builder( - shrinkWrap: true, - physics: const NeverScrollableScrollPhysics(), - itemCount: model.pharmaciesList == null - ? 0 - : model.pharmaciesList.length, - itemBuilder: (BuildContext context, int index) { - return CardWithBgWidget( - bgColor: Colors.transparent, - hasBorder: false, - widget: Row( - children: [ - Expanded( - flex: 1, - child: ClipRRect( - borderRadius: - BorderRadius.all(Radius.circular(7)), - child: Image.network( - model.pharmaciesList[index] - ["ProjectImageURL"], - height: - SizeConfig.imageSizeMultiplier * 15, - width: - SizeConfig.imageSizeMultiplier * 15, - fit: BoxFit.cover, - ), - ), - ), - Expanded( - flex: 4, - child: AppText( - Utils.convertToTitleCase( - model.pharmaciesList[index] - ["LocationDescription"] ?? - ''), - margin: 10, - fontHeight: 1.4, - color: AppGlobal.appTextColor, - textAlign: TextAlign.start, - fontWeight: FontWeight.w600, - letterSpacing: -0.33, - ), + ), + alignment: projectsProvider.isArabic ? Alignment.topRight : Alignment.topLeft, + ), + Container( + width: SizeConfig.screenWidth! * 0.99, + margin: EdgeInsets.only(left: 10, right: 10), + child: ListView.builder( + shrinkWrap: true, + physics: const NeverScrollableScrollPhysics(), + itemCount: model.pharmaciesList == null ? 0 : model.pharmaciesList.length, + itemBuilder: (BuildContext context, int index) { + return CardWithBgWidget( + bgColor: Colors.transparent, + hasBorder: false, + widget: Row( + children: [ + Expanded( + flex: 1, + child: ClipRRect( + borderRadius: BorderRadius.all(Radius.circular(7)), + child: Image.network( + model.pharmaciesList[index]["ProjectImageURL"], + height: SizeConfig.imageSizeMultiplier! * 15, + width: SizeConfig.imageSizeMultiplier! * 15, + fit: BoxFit.cover, ), + ), + ), + Expanded( + flex: 4, + child: AppText( + Utils.convertToTitleCase(model.pharmaciesList[index]["LocationDescription"] ?? ''), + margin: 10, + fontHeight: 1.4, + color: AppGlobal.appTextColor, + textAlign: TextAlign.start, + fontWeight: FontWeight.w600, + letterSpacing: -0.33, + ), + ), - Column( - crossAxisAlignment: - CrossAxisAlignment.start, - mainAxisAlignment: MainAxisAlignment.end, - children: [ - InkWell( - onTap: () async { - MapsLauncher.launchCoordinates( - double.parse( - model.pharmaciesList[index] - ["Latitude"]), - double.parse( - model.pharmaciesList[index] - ["Longitude"]), - model.pharmaciesList[index] - ["LocationDescription"]); - }, - child: Container( - decoration: BoxDecoration( - color: Colors.grey, - borderRadius: - BorderRadius.circular(10), - ), - // color:Colors.red[600], + Column( + crossAxisAlignment: CrossAxisAlignment.start, + mainAxisAlignment: MainAxisAlignment.end, + children: [ + InkWell( + onTap: () async { + MapsLauncher.launchCoordinates(double.parse(model.pharmaciesList[index]["Latitude"]), double.parse(model.pharmaciesList[index]["Longitude"]), + model.pharmaciesList[index]["LocationDescription"]); + }, + child: Container( + decoration: BoxDecoration( + color: Colors.grey, + borderRadius: BorderRadius.circular(10), + ), + // color:Colors.red[600], - child: Row( - children: [ - Icon( - Icons.pin_drop, - size: 15, - color: Colors.white, - ), - SizedBox( - width: 2, - ), - AppText( - "location", - fontSize: 8, - color: Colors.white, - ), - ], + child: Row( + children: [ + Icon( + Icons.pin_drop, + size: 15, + color: Colors.white, ), - padding: EdgeInsets.all(6), - ), + SizedBox( + width: 2, + ), + AppText( + "location", + fontSize: 8, + color: Colors.white, + ), + ], ), - SizedBox( - height: 10, + padding: EdgeInsets.all(6), + ), + ), + SizedBox( + height: 10, + ), + InkWell( + onTap: () { + launch("tel://" + model.pharmaciesList[index]["PhoneNumber"]); + }, + child: Container( + decoration: BoxDecoration( + color: Colors.grey, + borderRadius: BorderRadius.circular(10), ), - InkWell( - onTap: () { - launch("tel://" + - model.pharmaciesList[index] - ["PhoneNumber"]); - }, - child: Container( - decoration: BoxDecoration( - color: Colors.grey, - borderRadius: - BorderRadius.circular(10), - ), - // color:Colors.red[600], + // color:Colors.red[600], - child: Row( - children: [ - Icon( - DoctorApp.call, - size: 12, - color: Colors.white, - ), - SizedBox( - width: 2, - ), - AppText( - "Call Now", - fontSize: 8, - color: Colors.white, - ), - ], + child: Row( + children: [ + Icon( + DoctorApp.call, + size: 12, + color: Colors.white, + ), + SizedBox( + width: 2, ), - padding: EdgeInsets.all(6), - ), + AppText( + "Call Now", + fontSize: 8, + color: Colors.white, + ), + ], ), - ], + padding: EdgeInsets.all(6), + ), ), - // Expanded( - // flex: 2, - // child: Wrap( - // direction: Axis.horizontal, - // alignment: WrapAlignment.end, - // crossAxisAlignment: WrapCrossAlignment.end, - // children: [ - // Padding( - // padding: EdgeInsets.all(5), - // child: InkWell( - // child: Icon( - // Icons.call, - // color: Colors.red, - // ), - // onTap: () => launch("tel://" + - // model.pharmaciesList[index] - // ["PhoneNumber"]), - // ), - // ), - // Padding( - // padding: EdgeInsets.all(5), - // child: InkWell( - // child: Icon( - // Icons.pin_drop, - // color: Colors.red, - // ), - // onTap: () { - // MapsLauncher.launchCoordinates( - // double.parse( - // model.pharmaciesList[index] - // ["Latitude"]), - // double.parse( - // model.pharmaciesList[index] - // ["Longitude"]), - // model.pharmaciesList[index] - // ["LocationDescription"]); - // }, - // ), - // ), - // ], - // ), - // ), ], ), - ); - }), - ) - ]), + // Expanded( + // flex: 2, + // child: Wrap( + // direction: Axis.horizontal, + // alignment: WrapAlignment.end, + // crossAxisAlignment: WrapCrossAlignment.end, + // children: [ + // Padding( + // padding: EdgeInsets.all(5), + // child: InkWell( + // child: Icon( + // Icons.call, + // color: Colors.red, + // ), + // onTap: () => launch("tel://" + + // model.pharmaciesList[index] + // ["PhoneNumber"]), + // ), + // ), + // Padding( + // padding: EdgeInsets.all(5), + // child: InkWell( + // child: Icon( + // Icons.pin_drop, + // color: Colors.red, + // ), + // onTap: () { + // MapsLauncher.launchCoordinates( + // double.parse( + // model.pharmaciesList[index] + // ["Latitude"]), + // double.parse( + // model.pharmaciesList[index] + // ["Longitude"]), + // model.pharmaciesList[index] + // ["LocationDescription"]); + // }, + // ), + // ), + // ], + // ), + // ), + ], + ), + ); + }), + ) + ]), ), ), ), @@ -277,9 +247,12 @@ class _PharmaciesListState extends State { return Image.memory(base64Decode(base64String)); } - //TODO CHECK THE URL IS NULL OR NOT Uint8List dataFromBase64String(String base64String) { - if (base64String != null) return base64Decode(base64String); + if (base64String != null) { + return base64Decode(base64String); + } else { + return Uint8List(0); + } } String base64String(Uint8List data) { diff --git a/lib/screens/patient-sick-leave/add_patient_sick_leave_screen.dart b/lib/screens/patient-sick-leave/add_patient_sick_leave_screen.dart index 14bc4f1f..5990bdc8 100644 --- a/lib/screens/patient-sick-leave/add_patient_sick_leave_screen.dart +++ b/lib/screens/patient-sick-leave/add_patient_sick_leave_screen.dart @@ -28,15 +28,13 @@ Utils helpers = Utils(); class AddPatientSickLeaveScreen extends StatefulWidget { final appointmentNo; final patientMRN; - final PatiantInformtion patient; - final SickLeaveViewModel previousModel; + final PatiantInformtion? patient; + final SickLeaveViewModel? previousModel; - AddPatientSickLeaveScreen( - {this.appointmentNo, this.patientMRN, this.patient, this.previousModel}); + AddPatientSickLeaveScreen({this.appointmentNo, this.patientMRN, this.patient, this.previousModel}); @override - _AddPatientSickLeaveScreenState createState() => - _AddPatientSickLeaveScreenState(); + _AddPatientSickLeaveScreenState createState() => _AddPatientSickLeaveScreenState(); } class _AddPatientSickLeaveScreenState extends State { @@ -46,7 +44,7 @@ class _AddPatientSickLeaveScreenState extends State { TextEditingController _clinicController = new TextEditingController(); TextEditingController _doctorController = new TextEditingController(); TextEditingController _remarkController = new TextEditingController(); - DateTime currentDate; + DateTime? currentDate; AddSickLeaveRequest addSickLeave = AddSickLeaveRequest(); bool isFormSubmitted = false; @@ -65,9 +63,7 @@ class _AddPatientSickLeaveScreenState extends State { final df = new DateFormat('yyyy-MM-dd'); addSickLeave.startDate = df.format(pickedDate); currentDate = pickedDate; - _toDateController.text = AppDateUtils.getDayMonthYearDateFormatted( - pickedDate, - isMonthShort: true); + _toDateController.text = AppDateUtils.getDayMonthYearDateFormatted(pickedDate, isMonthShort: true); }); }); } @@ -82,10 +78,9 @@ class _AddPatientSickLeaveScreenState extends State { return BaseView( onModelReady: (model) async { await model.getDoctorProfile(); - _clinicController.text = model.doctorProfile.clinicDescription; - _doctorController.text = model.doctorProfile.doctorName; - await model.preSickLeaveStatistics( - widget.appointmentNo, widget.patientMRN); + _clinicController.text = model.doctorProfile!.clinicDescription!; + _doctorController.text = model.doctorProfile!.doctorName!; + await model.preSickLeaveStatistics(widget.appointmentNo, widget.patientMRN); }, builder: (_, model, w) => GestureDetector( onTap: () { @@ -109,17 +104,12 @@ class _AddPatientSickLeaveScreenState extends State { ), AppTextFieldCustom( height: Utils.getTextFieldHeight(), - hintText: TranslationBase.of(context).sickLeave + - ' ' + - TranslationBase.of(context).days, + hintText: TranslationBase.of(context).sickLeave + ' ' + TranslationBase.of(context).days, maxLines: 1, minLines: 1, dropDownColor: Colors.white, isTextFieldHasSuffix: true, - inputFormatters: [ - FilteringTextInputFormatter.allow( - RegExp(ONLY_NUMBERS)) - ], + inputFormatters: [FilteringTextInputFormatter.allow(RegExp(ONLY_NUMBERS))], inputType: TextInputType.number, controller: _numberOfDayController, onChanged: (value) { @@ -128,11 +118,7 @@ class _AddPatientSickLeaveScreenState extends State { addSickLeave.noOfDays = value; }); }, - validationError: isFormSubmitted && - (addSickLeave.noOfDays == null) - ? TranslationBase.of(context) - .pleaseEnterNoOfDays - : null, + validationError: isFormSubmitted && (addSickLeave.noOfDays == null) ? TranslationBase.of(context).pleaseEnterNoOfDays : "", ), SizedBox( height: 10, @@ -143,28 +129,23 @@ class _AddPatientSickLeaveScreenState extends State { Utils.hideKeyboard(context); _presentDatePicker(); }, - hintText: - TranslationBase.of(context).sickLeaveDate, + hintText: TranslationBase.of(context).sickLeaveDate, enabled: false, maxLines: 1, minLines: 1, isTextFieldHasSuffix: true, - suffixIcon: - IconButton(icon: Icon(Icons.calendar_today)), - inputFormatters: [ - FilteringTextInputFormatter.allow( - RegExp(ONLY_NUMBERS)) - ], + suffixIcon: IconButton( + icon: Icon(Icons.calendar_today), + onPressed: () {}, + ), + inputFormatters: [FilteringTextInputFormatter.allow(RegExp(ONLY_NUMBERS))], controller: _toDateController, onChanged: (value) { setState(() { addSickLeave.startDate = value; }); }, - validationError: isFormSubmitted && - (addSickLeave.startDate == null) - ? TranslationBase.of(context).pleaseEnterDate - : null, + validationError: isFormSubmitted && (addSickLeave.startDate == null) ? TranslationBase.of(context).pleaseEnterDate : "", ), SizedBox( height: 5, @@ -177,22 +158,16 @@ class _AddPatientSickLeaveScreenState extends State { minLines: 1, dropDownColor: Colors.white, isTextFieldHasSuffix: true, - inputFormatters: [ - FilteringTextInputFormatter.allow( - RegExp(ONLY_NUMBERS)) - ], + inputFormatters: [FilteringTextInputFormatter.allow(RegExp(ONLY_NUMBERS))], controller: _clinicController, onChanged: (value) {}, ), SizedBox( height: 10, ), - model.sickLeaveStatistics - .recommendedSickLeaveDays != - null + model.sickLeaveStatistics.recommendedSickLeaveDays != null ? Row( - crossAxisAlignment: - CrossAxisAlignment.center, + crossAxisAlignment: CrossAxisAlignment.center, children: [ SizedBox( width: 10, @@ -207,8 +182,7 @@ class _AddPatientSickLeaveScreenState extends State { ), Expanded( child: AppText( - model.sickLeaveStatistics - .recommendedSickLeaveDays, + model.sickLeaveStatistics.recommendedSickLeaveDays!, textAlign: TextAlign.start, fontSize: 12, color: AppGlobal.inProgressColor, @@ -230,10 +204,7 @@ class _AddPatientSickLeaveScreenState extends State { minLines: 1, dropDownColor: Colors.white, isTextFieldHasSuffix: true, - inputFormatters: [ - FilteringTextInputFormatter.allow( - RegExp(ONLY_NUMBERS)) - ], + inputFormatters: [FilteringTextInputFormatter.allow(RegExp(ONLY_NUMBERS))], controller: _doctorController, onChanged: (value) {}, ), @@ -255,17 +226,14 @@ class _AddPatientSickLeaveScreenState extends State { }, ), SizedBox( - height: SizeConfig.heightMultiplier * - (SizeConfig.isHeightVeryShort ? 12 : 10) + - 20, + height: SizeConfig.heightMultiplier! * (SizeConfig.isHeightVeryShort ? 12 : 10) + 20, ), ], ), ), ), ), - bottomSheet: model.state == ViewState.Busy || - model.state == ViewState.Busy + bottomSheet: model.state == ViewState.Busy || model.state == ViewState.Busy ? Container( height: 0, ) @@ -275,11 +243,9 @@ class _AddPatientSickLeaveScreenState extends State { borderRadius: BorderRadius.all( Radius.circular(0.0), ), - border: Border.all( - color: HexColor('#707070'), width: 0), + border: Border.all(color: HexColor('#707070'), width: 0), ), - height: SizeConfig.heightMultiplier * - (SizeConfig.isHeightVeryShort ? 12 : 10), + height: SizeConfig.heightMultiplier! * (SizeConfig.isHeightVeryShort ? 12 : 10), width: double.infinity, child: Column( children: [ @@ -289,8 +255,7 @@ class _AddPatientSickLeaveScreenState extends State { FractionallySizedBox( widthFactor: 0.9, child: AppButton( - title: TranslationBase.of(context) - .addSickLeaverequest, + title: TranslationBase.of(context).addSickLeaverequest, color: AppGlobal.appGreenColor, onPressed: () async { submitForm(model); @@ -315,16 +280,14 @@ class _AddPatientSickLeaveScreenState extends State { return; } else { GifLoaderDialogUtils.showMyDialog(context); - addSickLeave.patientMRN = widget.patient.patientMRN.toString(); - addSickLeave.appointmentNo = widget.patient.appointmentNo.toString(); + addSickLeave.patientMRN = widget.patient!.patientMRN.toString(); + addSickLeave.appointmentNo = widget.patient!.appointmentNo.toString(); await model.addSickLeave(addSickLeave); if (model.state == ViewState.ErrorLocal) { Utils.showErrorToast(model.error); } else { - await widget.previousModel - .getSickLeaveForPatient(widget.patient, isLocalBusy: true); - DrAppToastMsg.showSuccesToast( - TranslationBase.of(context).replySuccessfully); + await widget.previousModel!.getSickLeaveForPatient(widget.patient!, isLocalBusy: true); + DrAppToastMsg.showSuccesToast(TranslationBase.of(context).replySuccessfully); Navigator.of(context).pop(); } diff --git a/lib/screens/patient-sick-leave/patient_sick_leave_screen.dart b/lib/screens/patient-sick-leave/patient_sick_leave_screen.dart index 2c0a406c..d81ffa82 100644 --- a/lib/screens/patient-sick-leave/patient_sick_leave_screen.dart +++ b/lib/screens/patient-sick-leave/patient_sick_leave_screen.dart @@ -23,13 +23,13 @@ import 'package:flutter/material.dart'; import 'package:provider/provider.dart'; class PatientSickLeaveScreen extends StatelessWidget { - PatiantInformtion patient; + late PatiantInformtion patient; @override Widget build(BuildContext context) { ProjectViewModel projectsProvider = Provider.of(context); - final routeArgs = ModalRoute.of(context).settings.arguments as Map; + final routeArgs = ModalRoute.of(context)!.settings.arguments as Map; patient = routeArgs['patient']; bool isInpatient = routeArgs['isInpatient']; return BaseView( @@ -39,7 +39,7 @@ class PatientSickLeaveScreen extends StatelessWidget { builder: (_, model, w) => AppScaffold( baseViewModel: model, isShowAppBar: true, - backgroundColor: Colors.grey[100], + backgroundColor: Colors.grey[100]!, appBar: PatientProfileAppBar( patient, isInpatient: isInpatient, diff --git a/lib/screens/patients/In_patient/InPatientHeader.dart b/lib/screens/patients/In_patient/InPatientHeader.dart index 8084d835..90966f45 100644 --- a/lib/screens/patients/In_patient/InPatientHeader.dart +++ b/lib/screens/patients/In_patient/InPatientHeader.dart @@ -6,10 +6,10 @@ import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart'; import 'package:flutter/material.dart'; import 'package:provider/provider.dart'; -class InPatientHeader extends StatelessWidget with PreferredSizeWidget { +class InPatientHeader extends StatelessWidget { InPatientHeader( - {this.model, - this.specialClinic, + {required this.model, + required this.specialClinic, this.activeTab, this.selectedMapId, this.onChangeFunc}) @@ -96,7 +96,7 @@ class InPatientHeader extends StatelessWidget with PreferredSizeWidget { AppText( selectedMapId == null ? TranslationBase.of(context).all - : item.description, + : item.description!, fontSize: 12, color: Colors.black, fontWeight: FontWeight.bold, @@ -111,7 +111,7 @@ class InPatientHeader extends StatelessWidget with PreferredSizeWidget { items: model.specialClinicalCareMappingList.map((item) { return DropdownMenuItem( child: AppText( - item.description, + item.description!, textAlign: TextAlign.left, ), value: item.nursingStationID, diff --git a/lib/screens/patients/In_patient/NoData.dart b/lib/screens/patients/In_patient/NoData.dart index 5507972a..2e702d0d 100644 --- a/lib/screens/patients/In_patient/NoData.dart +++ b/lib/screens/patients/In_patient/NoData.dart @@ -4,7 +4,7 @@ import 'package:flutter/material.dart'; class NoData extends StatelessWidget { const NoData({ - Key key, + Key? key, }) : super(key: key); @override diff --git a/lib/screens/patients/In_patient/in_patient_list_page.dart b/lib/screens/patients/In_patient/in_patient_list_page.dart index af223001..536342f3 100644 --- a/lib/screens/patients/In_patient/in_patient_list_page.dart +++ b/lib/screens/patients/In_patient/in_patient_list_page.dart @@ -17,20 +17,14 @@ import 'list_of_my_inpatient.dart'; class InPatientListPage extends StatefulWidget { final bool isMyInPatient; - final PatientSearchViewModel patientSearchViewModel; + final PatientSearchViewModel? patientSearchViewModel; final bool isAllClinic; final bool showBottomSheet; - final String selectedClinicName; + final String? selectedClinicName; final Function onChangeValue; - InPatientListPage( - {this.isMyInPatient, - this.patientSearchViewModel, - this.selectedClinicName, - this.onChangeValue, - this.isAllClinic, - this.showBottomSheet}); + InPatientListPage({this.isMyInPatient = false, this.patientSearchViewModel, this.selectedClinicName, required this.onChangeValue, this.isAllClinic = false, this.showBottomSheet = false}); @override _InPatientListPageState createState() => _InPatientListPageState(); @@ -51,14 +45,13 @@ class _InPatientListPageState extends State { @override Widget build(BuildContext context) { return AppScaffold( - baseViewModel: widget.patientSearchViewModel, + baseViewModel: widget.patientSearchViewModel!, isShowAppBar: false, backgroundColor: Color(0xFFF8F8F8), body: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ - if (!widget.isMyInPatient && - widget.patientSearchViewModel.inPatientList.isNotEmpty) + if (!widget.isMyInPatient && widget.patientSearchViewModel!.inPatientList.isNotEmpty) Container( margin: EdgeInsets.only(left: 10.0, right: 10, top: 10), child: Row( @@ -72,13 +65,9 @@ class _InPatientListPageState extends State { groupValue: widget.isAllClinic ? 1 : 2, onChanged: (value) { setState(() { - widget.onChangeValue( - isAllClinic: true, - showBottomSheet: false, - selectedClinicName: null); + widget.onChangeValue(isAllClinic: true, showBottomSheet: false, selectedClinicName: null); - widget.patientSearchViewModel - .setDefaultInPatientList(); + widget.patientSearchViewModel!.setDefaultInPatientList(); }); }, activeColor: Colors.red, @@ -90,25 +79,16 @@ class _InPatientListPageState extends State { ], ), onTap: () { - widget.onChangeValue( - isAllClinic: true, - showBottomSheet: false, - selectedClinicName: null); + widget.onChangeValue(isAllClinic: true, showBottomSheet: false, selectedClinicName: null); - widget.patientSearchViewModel.setDefaultInPatientList(); + widget.patientSearchViewModel!.setDefaultInPatientList(); }, ), - if (widget - .patientSearchViewModel.InpatientClinicList.isNotEmpty) + if (widget.patientSearchViewModel!.InpatientClinicList.isNotEmpty) InkWell( onTap: () { - if (widget.patientSearchViewModel.InpatientClinicList - .length > - 0) { - widget.onChangeValue( - isAllClinic: false, - showBottomSheet: true, - selectedClinicName: widget.selectedClinicName); + if (widget.patientSearchViewModel!.InpatientClinicList.length > 0) { + widget.onChangeValue(isAllClinic: false, showBottomSheet: true, selectedClinicName: widget.selectedClinicName); } }, child: Row( @@ -117,26 +97,17 @@ class _InPatientListPageState extends State { value: 2, groupValue: widget.isAllClinic ? 1 : 2, onChanged: (value) { - if (widget.patientSearchViewModel - .InpatientClinicList.length > - 0) { - widget.onChangeValue( - isAllClinic: false, - showBottomSheet: true, - selectedClinicName: - widget.selectedClinicName); + if (widget.patientSearchViewModel!.InpatientClinicList.length > 0) { + widget.onChangeValue(isAllClinic: false, showBottomSheet: true, selectedClinicName: widget.selectedClinicName); } }, activeColor: Colors.red, ), AppText( - widget.selectedClinicName ?? - TranslationBase.of(context).clinicSelect, + widget.selectedClinicName ?? TranslationBase.of(context).clinicSelect, fontSize: 15, ), - Container( - margin: EdgeInsets.only(bottom: 10), - child: Icon(FontAwesomeIcons.sortDown)) + Container(margin: EdgeInsets.only(bottom: 10), child: Icon(FontAwesomeIcons.sortDown)) ], )), ], @@ -148,51 +119,31 @@ class _InPatientListPageState extends State { setState(() { hasQuery = true; }); - widget.patientSearchViewModel.filterSearchResults(value, - isAllClinic: widget.isAllClinic, - isMyInPatient: widget.isMyInPatient); + widget.patientSearchViewModel!.filterSearchResults(value, isAllClinic: widget.isAllClinic, isMyInPatient: widget.isMyInPatient); }, marginTop: widget.isMyInPatient ? 15 : 5, positionedChild: IconButton( icon: Icon( - isSortDes - ? FontAwesomeIcons.sortAmountDown - : FontAwesomeIcons.sortAmountUp, + isSortDes ? FontAwesomeIcons.sortAmountDown : FontAwesomeIcons.sortAmountUp, color: Colors.black, ), iconSize: 20, // padding: EdgeInsets.only(bottom: 30), onPressed: () { GifLoaderDialogUtils.showMyDialog(context); - widget.patientSearchViewModel.sortInPatient( - isDes: isSortDes, - isAllClinic: widget.isAllClinic, - isMyInPatient: widget.isMyInPatient); + widget.patientSearchViewModel!.sortInPatient(isDes: isSortDes, isAllClinic: widget.isAllClinic, isMyInPatient: widget.isMyInPatient); isSortDes = !isSortDes; GifLoaderDialogUtils.hideDialog(context); }, ), ), - widget.patientSearchViewModel.state == ViewState.Idle - ? (widget.isMyInPatient && - widget.patientSearchViewModel.myIinPatientList.length > 0) - ? ListOfMyInpatient( - isAllClinic: widget.isAllClinic, - hasQuery: hasQuery, - patientSearchViewModel: widget.patientSearchViewModel) - : widget.patientSearchViewModel.filteredInPatientItems - .length > - 0 - ? (widget.isMyInPatient && - widget.patientSearchViewModel.myIinPatientList - .length == - 0) + widget.patientSearchViewModel!.state == ViewState.Idle + ? (widget.isMyInPatient && widget.patientSearchViewModel!.myIinPatientList.length > 0) + ? ListOfMyInpatient(isAllClinic: widget.isAllClinic, hasQuery: hasQuery, patientSearchViewModel: widget.patientSearchViewModel!) + : widget.patientSearchViewModel!.filteredInPatientItems.length > 0 + ? (widget.isMyInPatient && widget.patientSearchViewModel!.myIinPatientList.length == 0) ? NoData() - : ListOfAllInPatient( - isAllClinic: widget.isAllClinic, - hasQuery: hasQuery, - patientSearchViewModel: - widget.patientSearchViewModel) + : ListOfAllInPatient(isAllClinic: widget.isAllClinic, hasQuery: hasQuery, patientSearchViewModel: widget.patientSearchViewModel!) : NoData() : Center( child: Container( @@ -220,15 +171,9 @@ class _InPatientListPageState extends State { children: [ InkWell( onTap: () { - widget.onChangeValue( - isAllClinic: widget.isAllClinic, - showBottomSheet: false, - selectedClinicName: widget.selectedClinicName); + widget.onChangeValue(isAllClinic: widget.isAllClinic, showBottomSheet: false, selectedClinicName: widget.selectedClinicName); }, - child: Icon(DoctorApp.close_1, - size: SizeConfig.getTextMultiplierBasedOnWidth() * - 4.5, - color: Color(0xFF2B353E))) + child: Icon(DoctorApp.close_1, size: SizeConfig.getTextMultiplierBasedOnWidth() * 4.5, color: Color(0xFF2B353E))) ], ), Row( @@ -246,48 +191,32 @@ class _InPatientListPageState extends State { ), Expanded( child: ListView.builder( - itemCount: widget - .patientSearchViewModel.InpatientClinicList.length, + itemCount: widget.patientSearchViewModel!.InpatientClinicList.length, scrollDirection: Axis.vertical, physics: ScrollPhysics(), shrinkWrap: true, itemBuilder: (context, index) { return InkWell( onTap: () { - widget.onChangeValue( - isAllClinic: false, - showBottomSheet: false, - selectedClinicName: widget - .patientSearchViewModel - .InpatientClinicList[index]); + widget.onChangeValue(isAllClinic: false, showBottomSheet: false, selectedClinicName: widget.patientSearchViewModel!.InpatientClinicList[index]); - widget.patientSearchViewModel.filterByClinic( - clinicName: widget.patientSearchViewModel - .InpatientClinicList[index]); + widget.patientSearchViewModel!.filterByClinic(clinicName: widget.patientSearchViewModel!.InpatientClinicList[index]); }, child: Row( children: [ Radio( - value: widget.patientSearchViewModel - .InpatientClinicList[index], + value: widget.patientSearchViewModel!.InpatientClinicList[index], groupValue: widget.selectedClinicName, onChanged: (value) { setState(() { - widget.onChangeValue( - isAllClinic: false, - showBottomSheet: false, - selectedClinicName: widget - .patientSearchViewModel - .InpatientClinicList[index]); - widget.patientSearchViewModel - .filterByClinic(clinicName: value); + widget.onChangeValue(isAllClinic: false, showBottomSheet: false, selectedClinicName: widget.patientSearchViewModel!.InpatientClinicList[index]); + widget.patientSearchViewModel!.filterByClinic(clinicName: value!); }); }, activeColor: Colors.red, ), AppText( - widget.patientSearchViewModel - .InpatientClinicList[index], + widget.patientSearchViewModel!.InpatientClinicList[index], fontFamily: 'Poppins', fontWeight: FontWeight.w600, fontSize: 15, diff --git a/lib/screens/patients/In_patient/in_patient_screen.dart b/lib/screens/patients/In_patient/in_patient_screen.dart index b705cd49..13686536 100644 --- a/lib/screens/patients/In_patient/in_patient_screen.dart +++ b/lib/screens/patients/In_patient/in_patient_screen.dart @@ -22,9 +22,9 @@ class InPatientScreen extends StatefulWidget { bool isAllClinic = true; bool showBottomSheet = false; - String selectedClinicName; + String selectedClinicName = ""; - InPatientScreen({Key key, this.specialClinic}); + InPatientScreen({Key? key, required this.specialClinic}); @override _InPatientScreenState createState() => _InPatientScreenState(); @@ -32,9 +32,9 @@ class InPatientScreen extends StatefulWidget { class _InPatientScreenState extends State with SingleTickerProviderStateMixin { - TabController _tabController; + late TabController _tabController; int _activeTab = 0; - int selectedMapId; + int selectedMapId = 0; @override void initState() { @@ -209,12 +209,12 @@ class _InPatientScreenState extends State bool isFirst = false, bool isMiddle = false, bool isLast = false, - BuildContext context}) { - ProjectViewModel projectsProvider = Provider.of(context); + BuildContext? context}) { + ProjectViewModel projectsProvider = Provider.of(context!); return Center( child: Container( - height: TabUtils.getTabHeight(context), + height: TabUtils.getTabHeight(context!), decoration: TabUtils.getBoxTabsBoxDecoration( isActive: isActive, isFirst: isFirst, diff --git a/lib/screens/patients/In_patient/list_of_all_in_patient.dart b/lib/screens/patients/In_patient/list_of_all_in_patient.dart index 5c84e819..cce9a190 100644 --- a/lib/screens/patients/In_patient/list_of_all_in_patient.dart +++ b/lib/screens/patients/In_patient/list_of_all_in_patient.dart @@ -7,10 +7,10 @@ import 'NoData.dart'; class ListOfAllInPatient extends StatelessWidget { const ListOfAllInPatient({ - Key key, - @required this.isAllClinic, - @required this.hasQuery, - this.patientSearchViewModel, + Key? key, + required this.isAllClinic, + required this.hasQuery, + required this.patientSearchViewModel, }) : super(key: key); final bool isAllClinic; @@ -41,7 +41,7 @@ class ListOfAllInPatient extends StatelessWidget { isInpatient: true, isMyPatient: patientSearchViewModel .filteredInPatientItems[index].doctorId == - patientSearchViewModel.doctorProfile.doctorID, + patientSearchViewModel.doctorProfile!.doctorID, onTap: () { FocusScopeNode currentFocus = FocusScope.of(context); if (!currentFocus.hasPrimaryFocus) { @@ -60,7 +60,7 @@ class ListOfAllInPatient extends StatelessWidget { "arrivalType": "1", "isMyPatient": patientSearchViewModel .filteredInPatientItems[index].doctorId == - patientSearchViewModel.doctorProfile.doctorID, + patientSearchViewModel.doctorProfile!.doctorID, }); }, ); @@ -78,7 +78,7 @@ class ListOfAllInPatient extends StatelessWidget { patientSearchViewModel.removeOnFilteredList(); } } - return; + return false; }, ), ), diff --git a/lib/screens/patients/In_patient/list_of_my_inpatient.dart b/lib/screens/patients/In_patient/list_of_my_inpatient.dart index 5f33bc77..2f646fc7 100644 --- a/lib/screens/patients/In_patient/list_of_my_inpatient.dart +++ b/lib/screens/patients/In_patient/list_of_my_inpatient.dart @@ -7,10 +7,10 @@ import 'NoData.dart'; class ListOfMyInpatient extends StatelessWidget { const ListOfMyInpatient({ - Key key, - @required this.isAllClinic, - @required this.hasQuery, - this.patientSearchViewModel, + Key? key, + required this.isAllClinic, + required this.hasQuery, + required this.patientSearchViewModel, }) : super(key: key); final bool isAllClinic; @@ -61,7 +61,7 @@ class ListOfMyInpatient extends StatelessWidget { ); }), onNotification: (t) { - return; + return false; }, ), ), diff --git a/lib/screens/patients/out_patient/filter_date_page.dart b/lib/screens/patients/out_patient/filter_date_page.dart index c0c82852..bf1e3580 100644 --- a/lib/screens/patients/out_patient/filter_date_page.dart +++ b/lib/screens/patients/out_patient/filter_date_page.dart @@ -18,9 +18,7 @@ class FilterDatePage extends StatefulWidget { final OutPatientFilterType outPatientFilterType; final PatientSearchViewModel patientSearchViewModel; - const FilterDatePage( - {Key key, this.outPatientFilterType, this.patientSearchViewModel}) - : super(key: key); + const FilterDatePage({Key? key, required this.outPatientFilterType, required this.patientSearchViewModel}) : super(key: key); @override _FilterDatePageState createState() => _FilterDatePageState(); @@ -48,10 +46,7 @@ class _FilterDatePageState extends State { crossAxisAlignment: CrossAxisAlignment.start, children: [ BottomSheetTitle( - title: (OutPatientFilterType.Previous == - widget.outPatientFilterType) - ? " Filter Previous Out Patient" - : "Filter Nextweek Out Patient", + title: (OutPatientFilterType.Previous == widget.outPatientFilterType) ? " Filter Previous Out Patient" : "Filter Nextweek Out Patient", ), SizedBox( height: 10.0, @@ -64,19 +59,13 @@ class _FilterDatePageState extends State { Container( color: Colors.white, child: InkWell( - onTap: () => selectDate(context, - firstDate: - getFirstDate(widget.outPatientFilterType), - lastDate: - getLastDate(widget.outPatientFilterType)), + onTap: () => selectDate(context, firstDate: getFirstDate(widget.outPatientFilterType), lastDate: getLastDate(widget.outPatientFilterType)), child: TextField( decoration: textFieldSelectorDecoration( TranslationBase.of(context).fromDate, - widget.patientSearchViewModel - .selectedFromDate != - null + widget.patientSearchViewModel.selectedFromDate != null ? "${AppDateUtils.convertStringToDateFormat(widget.patientSearchViewModel.selectedFromDate.toString(), "yyyy-MM-dd")}" - : null, + : "", true, suffixIcon: Icon( Icons.calendar_today, @@ -92,20 +81,13 @@ class _FilterDatePageState extends State { Container( color: Colors.white, child: InkWell( - onTap: () => selectDate(context, - isFromDate: false, - firstDate: - getFirstDate(widget.outPatientFilterType), - lastDate: - getLastDate(widget.outPatientFilterType)), + onTap: () => selectDate(context, isFromDate: false, firstDate: getFirstDate(widget.outPatientFilterType), lastDate: getLastDate(widget.outPatientFilterType)), child: TextField( decoration: textFieldSelectorDecoration( TranslationBase.of(context).toDate, - widget.patientSearchViewModel - .selectedToDate != - null + widget.patientSearchViewModel.selectedToDate != null ? "${AppDateUtils.convertStringToDateFormat(widget.patientSearchViewModel.selectedToDate.toString(), "yyyy-MM-dd")}" - : null, + : "", true, suffixIcon: Icon( Icons.calendar_today, @@ -148,41 +130,25 @@ class _FilterDatePageState extends State { padding: 10, color: AppGlobal.appGreenColor, onPressed: () async { - if (widget.patientSearchViewModel.selectedFromDate == - null || - widget.patientSearchViewModel.selectedToDate == - null) { - Utils.showErrorToast( - "Please Select All The date Fields "); + if (widget.patientSearchViewModel.selectedFromDate == null || widget.patientSearchViewModel.selectedToDate == null) { + Utils.showErrorToast("Please Select All The date Fields "); } else { - Duration difference = widget - .patientSearchViewModel.selectedToDate - .difference(widget - .patientSearchViewModel.selectedFromDate); + Duration difference = widget.patientSearchViewModel.selectedToDate!.difference(widget.patientSearchViewModel.selectedFromDate!); if (difference.inDays > 90) { - Utils.showErrorToast( - "The difference between from date and end date must be less than 3 months"); + Utils.showErrorToast("The difference between from date and end date must be less than 3 months"); } else { - String dateTo = AppDateUtils.convertDateToFormat( - widget.patientSearchViewModel.selectedToDate, - 'yyyy-MM-dd'); - String dateFrom = AppDateUtils.convertDateToFormat( - widget.patientSearchViewModel.selectedFromDate, - 'yyyy-MM-dd'); + String dateTo = AppDateUtils.convertDateToFormat(widget.patientSearchViewModel.selectedToDate!, 'yyyy-MM-dd'); + String dateFrom = AppDateUtils.convertDateToFormat(widget.patientSearchViewModel.selectedFromDate!, 'yyyy-MM-dd'); - PatientSearchRequestModel currentModel = - PatientSearchRequestModel(); + PatientSearchRequestModel currentModel = PatientSearchRequestModel(); currentModel.to = dateTo; currentModel.from = dateFrom; GifLoaderDialogUtils.showMyDialog(context); - await widget.patientSearchViewModel - .getOutPatient(currentModel, isLocalBusy: true); + await widget.patientSearchViewModel.getOutPatient(currentModel, isLocalBusy: true); GifLoaderDialogUtils.hideDialog(context); - if (widget.patientSearchViewModel.state == - ViewState.ErrorLocal) { - Utils.showErrorToast( - widget.patientSearchViewModel.error); + if (widget.patientSearchViewModel.state == ViewState.ErrorLocal) { + Utils.showErrorToast(widget.patientSearchViewModel.error); } else { Navigator.of(context).pop(); } @@ -201,16 +167,13 @@ class _FilterDatePageState extends State { )); } - selectDate(BuildContext context, - {bool isFromDate = true, DateTime firstDate, lastDate}) async { + selectDate(BuildContext context, {bool isFromDate = true, DateTime? firstDate, lastDate}) async { Utils.hideKeyboard(context); - DateTime selectedDate = isFromDate - ? this.widget.patientSearchViewModel.selectedFromDate ?? firstDate - : this.widget.patientSearchViewModel.selectedToDate ?? lastDate; - final DateTime picked = await showDatePicker( + DateTime selectedDate = isFromDate ? this.widget.patientSearchViewModel.selectedFromDate ?? firstDate : this.widget.patientSearchViewModel.selectedToDate ?? lastDate; + final DateTime? picked = await showDatePicker( context: context, initialDate: selectedDate, - firstDate: firstDate, + firstDate: firstDate!, lastDate: lastDate, initialEntryMode: DatePickerEntryMode.calendar, ); @@ -234,27 +197,21 @@ class _FilterDatePageState extends State { getFirstDate(OutPatientFilterType outPatientFilterType) { if (outPatientFilterType == OutPatientFilterType.Previous) { - return DateTime( - DateTime.now().year - 20, DateTime.now().month, DateTime.now().day); + return DateTime(DateTime.now().year - 20, DateTime.now().month, DateTime.now().day); } else { - return DateTime( - DateTime.now().year, DateTime.now().month, DateTime.now().day + 1); + return DateTime(DateTime.now().year, DateTime.now().month, DateTime.now().day + 1); } } getLastDate(OutPatientFilterType outPatientFilterType) { if (outPatientFilterType == OutPatientFilterType.Previous) { - return DateTime( - DateTime.now().year, DateTime.now().month, DateTime.now().day - 1); + return DateTime(DateTime.now().year, DateTime.now().month, DateTime.now().day - 1); } else { - return DateTime( - DateTime.now().year, DateTime.now().month, DateTime.now().day + 7); + return DateTime(DateTime.now().year, DateTime.now().month, DateTime.now().day + 7); } } - InputDecoration textFieldSelectorDecoration( - String hintText, String selectedText, bool isDropDown, - {Icon suffixIcon}) { + InputDecoration textFieldSelectorDecoration(String hintText, String selectedText, bool isDropDown, {Icon? suffixIcon}) { return InputDecoration( focusedBorder: OutlineInputBorder( borderSide: BorderSide(color: Color(0xFFCCCCCC), width: 2.0), diff --git a/lib/screens/patients/out_patient/out_patient_screen.dart b/lib/screens/patients/out_patient/out_patient_screen.dart index 733ba1a1..e56080f6 100644 --- a/lib/screens/patients/out_patient/out_patient_screen.dart +++ b/lib/screens/patients/out_patient/out_patient_screen.dart @@ -29,13 +29,13 @@ class OutPatientsScreen extends StatefulWidget { final isAppbar; final arrivalType; final isView; - final PatientType selectedPatientType; - final PatientSearchRequestModel patientSearchRequestModel; + final PatientType? selectedPatientType; + final PatientSearchRequestModel? patientSearchRequestModel; final bool isSearchWithKeyInfo; final bool isSearch; final bool isInpatient; final bool isSearchAndOut; - final String searchKey; + final String? searchKey; OutPatientsScreen( {this.patientSearchForm, @@ -56,21 +56,18 @@ class OutPatientsScreen extends StatefulWidget { } class _OutPatientsScreenState extends State { - int clinicId; - AuthenticationViewModel authenticationViewModel; - + int? clinicId; + AuthenticationViewModel authenticationViewModel = AuthenticationViewModel(); List _times = []; - int _activeLocation = 1; - String patientType; - String patientTypeTitle; + String? patientType; + String? patientTypeTitle; var selectedFilter = 1; - String arrivalType; - ProjectViewModel projectsProvider; + String? arrivalType; + late ProjectViewModel projectsProvider; var isView; final _controller = TextEditingController(); - - PatientModel patient; + late PatientModel patient; OutPatientFilterType outPatientFilterType = OutPatientFilterType.Today; bool isSortDes = true; @@ -88,7 +85,7 @@ class _OutPatientsScreenState extends State { return BaseView( onModelReady: (model) async { - await model.getOutPatient(widget.patientSearchRequestModel); + await model.getOutPatient(widget.patientSearchRequestModel!); }, builder: (_, model, w) => AppScaffold( appBarTitle: "Search Patient", @@ -107,8 +104,7 @@ class _OutPatientsScreenState extends State { mainAxisSize: MainAxisSize.max, crossAxisAlignment: CrossAxisAlignment.center, children: _times.map((item) { - bool _isActive = - _times[_activeLocation] == item ? true : false; + bool _isActive = _times[_activeLocation] == item ? true : false; return Expanded( child: InkWell( @@ -128,8 +124,7 @@ class _OutPatientsScreenState extends State { await model.getPatientBasedOnDate( item: item, selectedPatientType: widget.selectedPatientType, - patientSearchRequestModel: - widget.patientSearchRequestModel, + patientSearchRequestModel: widget.patientSearchRequestModel, isSearchWithKeyInfo: widget.isSearchWithKeyInfo, outPatientFilterType: outPatientFilterType); GifLoaderDialogUtils.hideDialog(context); @@ -140,24 +135,15 @@ class _OutPatientsScreenState extends State { decoration: TabUtils.getBoxTabsBoxDecoration( isActive: _isActive, isFirst: _times.indexOf(item) == 0, - isLast: - _times.indexOf(item) == _times.length - 1, - isMiddle: _times.indexOf(item) != 0 && - _times.indexOf(item) != _times.length - 1, + isLast: _times.indexOf(item) == _times.length - 1, + isMiddle: _times.indexOf(item) != 0 && _times.indexOf(item) != _times.length - 1, projectViewModel: projectsProvider), child: Center( child: Row( mainAxisAlignment: MainAxisAlignment.center, children: [ - TabUtils.getTabText( - title: item, isActive: _isActive), - _isActive && - _activeLocation != 0 && - model.state == ViewState.Idle - ? TabUtils.getTabCounter( - isActive: _isActive, - counter: model.filterData.length) - : Container(), + TabUtils.getTabText(title: item, isActive: _isActive), + _isActive && _activeLocation != 0 && model.state == ViewState.Idle ? TabUtils.getTabCounter(isActive: _isActive, counter: model.filterData.length) : Container(), ], ), ), @@ -177,9 +163,7 @@ class _OutPatientsScreenState extends State { marginTop: 5, suffixIcon: IconButton( icon: Icon( - _activeLocation != 0 - ? DoctorApp.filter_1 - : FontAwesomeIcons.slidersH, + _activeLocation != 0 ? DoctorApp.filter_1 : FontAwesomeIcons.slidersH, color: Colors.black, ), iconSize: 20, @@ -189,21 +173,17 @@ class _OutPatientsScreenState extends State { Navigator.push( context, MaterialPageRoute( - builder: (BuildContext context) => - FilterDatePage( + builder: (BuildContext context) => FilterDatePage( outPatientFilterType: outPatientFilterType, patientSearchViewModel: model, ), - settings: RouteSettings( - name: 'FilterOutPatentDateScreen'), + settings: RouteSettings(name: 'FilterOutPatentDateScreen'), )); }, ), positionedChild: IconButton( icon: Icon( - isSortDes - ? FontAwesomeIcons.sortAmountDown - : FontAwesomeIcons.sortAmountUp, + isSortDes ? FontAwesomeIcons.sortAmountDown : FontAwesomeIcons.sortAmountUp, color: Colors.black, ), iconSize: 20, @@ -218,8 +198,7 @@ class _OutPatientsScreenState extends State { child: model.filterData.isEmpty ? Center( child: ErrorMessage( - error: TranslationBase.of(context) - .youDontHaveAnyPatient, + error: TranslationBase.of(context).youDontHaveAnyPatient, ), ) : ListView.builder( @@ -227,37 +206,27 @@ class _OutPatientsScreenState extends State { shrinkWrap: true, itemCount: model.filterData.length, itemBuilder: (BuildContext ctxt, int index) { - if (_activeLocation != 0 || - (model.filterData[index].patientStatusType != - null && - model.filterData[index] - .patientStatusType == - 43)) + if (_activeLocation != 0 || (model.filterData[index].patientStatusType != null && model.filterData[index].patientStatusType == 43)) return Padding( - padding: EdgeInsets.symmetric( - horizontal: 8, vertical: 0), + padding: EdgeInsets.symmetric(horizontal: 8, vertical: 0), child: PatientCard( patientInfo: model.filterData[index], - patientType: patientType, - arrivalType: arrivalType, + patientType: patientType!, + arrivalType: arrivalType!, isFromSearch: widget.isSearchAndOut, isInpatient: widget.isInpatient, onTap: () { // TODO change the parameter to daynamic - Navigator.of(context).pushNamed( - PATIENTS_PROFILE, - arguments: { - "patient": model.filterData[index], - "patientType": "1", - "from": widget - .patientSearchRequestModel.from, - "to": widget - .patientSearchRequestModel.from, - "isSearch": false, - "isInpatient": false, - "arrivalType": "7", - "isSearchAndOut": false, - }); + Navigator.of(context).pushNamed(PATIENTS_PROFILE, arguments: { + "patient": model.filterData[index], + "patientType": "1", + "from": widget.patientSearchRequestModel!.from, + "to": widget.patientSearchRequestModel!.from, + "isSearch": false, + "isInpatient": false, + "arrivalType": "7", + "isSearchAndOut": false, + }); }, // isFromSearch: widget.isSearch, ), diff --git a/lib/screens/patients/patient_search/patient_search_header.dart b/lib/screens/patients/patient_search/patient_search_header.dart index 085a8822..b8fee5df 100644 --- a/lib/screens/patients/patient_search/patient_search_header.dart +++ b/lib/screens/patients/patient_search/patient_search_header.dart @@ -1,10 +1,10 @@ import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart'; import 'package:flutter/material.dart'; -class PatientSearchHeader extends StatelessWidget with PreferredSizeWidget { - final String title; +class PatientSearchHeader extends StatelessWidget { + final String? title; - const PatientSearchHeader({Key key, this.title}) : super(key: key); + const PatientSearchHeader({Key? key, this.title}) : super(key: key); @override Widget build(BuildContext context) { @@ -24,7 +24,7 @@ class PatientSearchHeader extends StatelessWidget with PreferredSizeWidget { ), Expanded( child: AppText( - title, + title!, fontSize: 24.0, fontWeight: FontWeight.w700, color: Color(0xFF2B353E), diff --git a/lib/screens/patients/patient_search/patient_search_result_screen.dart b/lib/screens/patients/patient_search/patient_search_result_screen.dart index a2d04ec5..8c64ea1a 100644 --- a/lib/screens/patients/patient_search/patient_search_result_screen.dart +++ b/lib/screens/patients/patient_search/patient_search_result_screen.dart @@ -18,13 +18,13 @@ import 'package:provider/provider.dart'; // ignore: must_be_immutable class PatientsSearchResultScreen extends StatefulWidget { - final PatientType selectedPatientType; - final PatientSearchRequestModel patientSearchRequestModel; + final PatientType? selectedPatientType; + final PatientSearchRequestModel? patientSearchRequestModel; final bool isSearchWithKeyInfo; final bool isSearch; final bool isInpatient; final bool isSearchAndOut; - final String searchKey; + final String? searchKey; PatientsSearchResultScreen( {this.selectedPatientType, @@ -42,18 +42,18 @@ class PatientsSearchResultScreen extends StatefulWidget { class _PatientsSearchResultScreenState extends State { - int clinicId; - AuthenticationViewModel authenticationViewModel; + int? clinicId; + AuthenticationViewModel authenticationViewModel = AuthenticationViewModel(); - String patientType; - String patientTypeTitle; + String? patientType; + String? patientTypeTitle; var selectedFilter = 1; - String arrivalType; - ProjectViewModel projectsProvider; + String? arrivalType; + late ProjectViewModel projectsProvider; var isView; final _controller = TextEditingController(); - PatientModel patient; + late PatientModel patient; @override Widget build(BuildContext context) { @@ -62,10 +62,10 @@ class _PatientsSearchResultScreenState onModelReady: (model) async { if (!widget.isSearchWithKeyInfo && widget.selectedPatientType == PatientType.OutPatient) { - await model.getOutPatient(widget.patientSearchRequestModel); + await model.getOutPatient(widget.patientSearchRequestModel!); } else { await model - .getPatientFileInformation(widget.patientSearchRequestModel); + .getPatientFileInformation(widget.patientSearchRequestModel!); } }, builder: (_, model, w) => AppScaffold( @@ -89,7 +89,7 @@ class _PatientsSearchResultScreenState DoctorApp.filter_1, color: Colors.black, ), - iconSize: 20, + iconSize: 20, onPressed: () { }, // padding: EdgeInsets.only(bottom: 30), ), ), @@ -114,8 +114,8 @@ class _PatientsSearchResultScreenState padding: EdgeInsets.all(8.0), child: PatientCard( patientInfo: model.filterData[index], - patientType: patientType, - arrivalType: arrivalType, + patientType: patientType!, + arrivalType: arrivalType!, isFromSearch: widget.isSearchAndOut, isInpatient: widget.isInpatient, onTap: () { @@ -126,9 +126,9 @@ class _PatientsSearchResultScreenState "patient": model.filterData[index], "patientType": "1", "from": widget - .patientSearchRequestModel.from, + .patientSearchRequestModel!.from, "to": widget - .patientSearchRequestModel.from, + .patientSearchRequestModel!.from, "isSearch": widget.isSearch, "isInpatient": widget.isInpatient, "arrivalType": "7", diff --git a/lib/screens/patients/patient_search/patient_search_screen.dart b/lib/screens/patients/patient_search/patient_search_screen.dart index 721650b3..8e1c7116 100644 --- a/lib/screens/patients/patient_search/patient_search_screen.dart +++ b/lib/screens/patients/patient_search/patient_search_screen.dart @@ -30,7 +30,7 @@ class _PatientSearchScreenState extends State { TextEditingController middleNameInfoController = TextEditingController(); TextEditingController lastNameFileInfoController = TextEditingController(); PatientType selectedPatientType = PatientType.inPatient; - AuthenticationViewModel authenticationViewModel; + AuthenticationViewModel authenticationViewModel = AuthenticationViewModel(); @override Widget build(BuildContext context) { @@ -78,7 +78,7 @@ class _PatientSearchScreenState extends State { lastNameFileInfoController .text.isEmpty)) ? TranslationBase.of(context).emptyMessage - : null, + : "", ), SizedBox( height: 5, @@ -139,7 +139,7 @@ class _PatientSearchScreenState extends State { }); PatientSearchRequestModel patientSearchRequestModel = PatientSearchRequestModel( - doctorID: authenticationViewModel.doctorProfile.doctorID); + doctorID: authenticationViewModel.doctorProfile!.doctorID); if (showOther) { patientSearchRequestModel.firstName = firstNameInfoController.text.trim().isEmpty diff --git a/lib/screens/patients/patient_search/time_bar.dart b/lib/screens/patients/patient_search/time_bar.dart index 5c61c63a..24da6b6f 100644 --- a/lib/screens/patients/patient_search/time_bar.dart +++ b/lib/screens/patients/patient_search/time_bar.dart @@ -8,13 +8,13 @@ import 'package:flutter/material.dart'; import 'package:hexcolor/hexcolor.dart'; class TimeBar extends StatefulWidget { - final PatientSearchViewModel model; - final PatientType selectedPatientType; - final PatientSearchRequestModel patientSearchRequestModel; - final bool isSearchWithKeyInfo; + final PatientSearchViewModel? model; + final PatientType? selectedPatientType; + final PatientSearchRequestModel? patientSearchRequestModel; + final bool? isSearchWithKeyInfo; const TimeBar( - {Key key, + {Key? key, this.model, this.selectedPatientType, this.patientSearchRequestModel, @@ -36,7 +36,7 @@ class _TimeBarState extends State { int _activeLocation = 0; return Container( height: MediaQuery.of(context).size.height * 0.0619, - width: SizeConfig.screenWidth * 0.94, + width: SizeConfig.screenWidth! * 0.94, decoration: BoxDecoration( color: Color(0Xffffffff), borderRadius: BorderRadius.circular(12.5), @@ -55,7 +55,7 @@ class _TimeBarState extends State { child: Center( child: Container( height: MediaQuery.of(context).size.height * 0.058, - width: SizeConfig.screenWidth * 0.2334, + width: SizeConfig.screenWidth! * 0.2334, decoration: BoxDecoration( borderRadius: BorderRadius.only( bottomRight: Radius.circular(12.5), @@ -83,7 +83,7 @@ class _TimeBarState extends State { _activeLocation = _locations.indexOf(item); }); GifLoaderDialogUtils.showMyDialog(context); - await widget.model.getPatientBasedOnDate( + await widget.model!.getPatientBasedOnDate( item: item, selectedPatientType: widget.selectedPatientType, patientSearchRequestModel: @@ -100,7 +100,7 @@ class _TimeBarState extends State { color: Colors.white), alignment: Alignment.center, height: 1, - width: SizeConfig.screenWidth * 0.23, + width: SizeConfig.screenWidth! * 0.23, ) : Container() ]); diff --git a/lib/screens/patients/profile/admission-orders/admission_orders_screen.dart b/lib/screens/patients/profile/admission-orders/admission_orders_screen.dart index 5b2ccfb7..409fade1 100644 --- a/lib/screens/patients/profile/admission-orders/admission_orders_screen.dart +++ b/lib/screens/patients/profile/admission-orders/admission_orders_screen.dart @@ -14,7 +14,7 @@ import 'package:flutter/material.dart'; import 'package:provider/provider.dart'; class AdmissionOrdersScreen extends StatefulWidget { - const AdmissionOrdersScreen({Key key}) : super(key: key); + const AdmissionOrdersScreen({Key? key}) : super(key: key); @override _AdmissionOrdersScreenState createState() => _AdmissionOrdersScreenState(); @@ -23,23 +23,23 @@ class AdmissionOrdersScreen extends StatefulWidget { class _AdmissionOrdersScreenState extends State { bool isDischargedPatient = false; - AuthenticationViewModel authenticationViewModel; + AuthenticationViewModel authenticationViewModel = AuthenticationViewModel(); - ProjectViewModel projectViewModel; + late ProjectViewModel projectViewModel; @override Widget build(BuildContext context) { authenticationViewModel = Provider.of(context); projectViewModel = Provider.of(context); - final routeArgs = ModalRoute.of(context).settings.arguments as Map; + final routeArgs = ModalRoute.of(context)!.settings.arguments as Map; PatiantInformtion patient = routeArgs['patient']; String arrivalType = routeArgs['arrivalType']; if (routeArgs.containsKey('isDischargedPatient')) isDischargedPatient = routeArgs['isDischargedPatient']; return BaseView( onModelReady: (model) => model.getAdmissionOrders( - admissionNo: int.parse(patient.admissionNo), - patientId: patient.patientMRN), + admissionNo: int.parse(patient.admissionNo!), + patientId: patient.patientMRN!), builder: (_, model, w) => AppScaffold( baseViewModel: model, backgroundColor: Theme.of(context).scaffoldBackgroundColor, @@ -220,7 +220,7 @@ class _AdmissionOrdersScreenState extends State { .getDateTimeFromServerFormat(model .admissionOrderList[ index] - .createdOn), + .createdOn!), isArabic: projectViewModel .isArabic, @@ -246,7 +246,7 @@ class _AdmissionOrdersScreenState extends State { .getDateTimeFromServerFormat(model .admissionOrderList[ index] - .createdOn)) + .createdOn!)) : AppDateUtils.getHour( DateTime.now()), fontWeight: FontWeight.w600, diff --git a/lib/screens/patients/profile/admission_request/admission_request_first_screen.dart b/lib/screens/patients/profile/admission_request/admission_request_first_screen.dart index 4f7c61e9..f65ffafc 100644 --- a/lib/screens/patients/profile/admission_request/admission_request_first_screen.dart +++ b/lib/screens/patients/profile/admission_request/admission_request_first_screen.dart @@ -26,12 +26,10 @@ import '../../../../routes.dart'; class AdmissionRequestFirstScreen extends StatefulWidget { @override - _AdmissionRequestThirdScreenState createState() => - _AdmissionRequestThirdScreenState(); + _AdmissionRequestThirdScreenState createState() => _AdmissionRequestThirdScreenState(); } -class _AdmissionRequestThirdScreenState - extends State { +class _AdmissionRequestThirdScreenState extends State { final _dietTypeRemarksController = TextEditingController(); final _sickLeaveCommentsController = TextEditingController(); final _postMedicalHistoryController = TextEditingController(); @@ -44,16 +42,11 @@ class _AdmissionRequestThirdScreenState bool _isSickLeaveRequired = false; bool _patientPregnant = false; - String clinicError; - String doctorError; - String sickLeaveCommentError; - String dietTypeError; - String medicalHistoryError; - String surgicalHistoryError; + String clinicError = '', doctorError = '', sickLeaveCommentError = '', dietTypeError = '', medicalHistoryError = '', surgicalHistoryError = ''; @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']; String patientType = routeArgs['patientType']; String arrivalType = routeArgs['arrivalType']; @@ -92,8 +85,7 @@ class _AdmissionRequestThirdScreenState height: 15, ), Container( - margin: - EdgeInsets.symmetric(vertical: 0, horizontal: 16), + margin: EdgeInsets.symmetric(vertical: 0, horizontal: 16), child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ @@ -102,7 +94,7 @@ class _AdmissionRequestThirdScreenState child: AppText( Utils.convertToTitleCase(TranslationBase.of(context).specialityAndDoctorDetail), color: Color(0xFF2E303A), - fontSize: SizeConfig.textMultiplier * 1.8, + fontSize: SizeConfig.textMultiplier! * 1.8, fontWeight: FontWeight.w700, ), ), @@ -120,45 +112,27 @@ class _AdmissionRequestThirdScreenState : _selectedClinic['clinicNameEnglish'] : null, enabled: false, - onClick: model.clinicList != null && - model.clinicList.length > 0 + onClick: model.clinicList != null && model.clinicList.length > 0 ? () { - openListDialogField( - projectViewModel.isArabic - ? 'clinicNameArabic' - : 'clinicNameEnglish', - 'clinicID', - model.clinicList, (selectedValue) { + openListDialogField(projectViewModel.isArabic ? 'clinicNameArabic' : 'clinicNameEnglish', 'clinicID', model.clinicList, (selectedValue) { setState(() { _selectedClinic = selectedValue; }); }); } : () async { - GifLoaderDialogUtils.showMyDialog( - context); - await model.getClinics().then((_) => - GifLoaderDialogUtils.hideDialog( - context)); - if (model.state == ViewState.Idle && - model.clinicList.length > 0) { - openListDialogField( - projectViewModel.isArabic - ? 'clinicNameArabic' - : 'clinicNameEnglish', - 'clinicID', - model.clinicList, (selectedValue) { + GifLoaderDialogUtils.showMyDialog(context); + await model.getClinics().then((_) => GifLoaderDialogUtils.hideDialog(context)); + if (model.state == ViewState.Idle && model.clinicList.length > 0) { + openListDialogField(projectViewModel.isArabic ? 'clinicNameArabic' : 'clinicNameEnglish', 'clinicID', model.clinicList, (selectedValue) { setState(() { _selectedClinic = selectedValue; }); }); - } else if (model.state == - ViewState.ErrorLocal) { - DrAppToastMsg.showErrorToast( - model.error); + } else if (model.state == ViewState.ErrorLocal) { + DrAppToastMsg.showErrorToast(model.error); } else { - DrAppToastMsg.showErrorToast( - "Empty List"); + DrAppToastMsg.showErrorToast("Empty List"); } }, ), @@ -169,50 +143,34 @@ class _AdmissionRequestThirdScreenState height: screenSize.height * 0.075, hintText: TranslationBase.of(context).doctor, isTextFieldHasSuffix: true, - dropDownText: _selectedDoctor != null - ? _selectedDoctor['DoctorName'] - : null, + dropDownText: _selectedDoctor != null ? _selectedDoctor['DoctorName'] : null, enabled: false, validationError: doctorError, onClick: _selectedClinic != null - ? model.doctorsList != null && - model.doctorsList.length > 0 + ? model.doctorsList != null && model.doctorsList.length > 0 ? () { - openListDialogField('DoctorName', - 'DoctorID', model.doctorsList, - (selectedValue) { + openListDialogField('DoctorName', 'DoctorID', model.doctorsList, (selectedValue) { setState(() { _selectedDoctor = selectedValue; }); }); } : () async { - GifLoaderDialogUtils.showMyDialog( - context); - await model - .getClinicDoctors( - _selectedClinic['clinicID']) - .then((_) => GifLoaderDialogUtils - .hideDialog(context)); - if (model.state == ViewState.Idle && - model.doctorsList.length > 0) { - openListDialogField('DoctorName', - 'DoctorID', model.doctorsList, - (selectedValue) { + GifLoaderDialogUtils.showMyDialog(context); + await model.getClinicDoctors(_selectedClinic['clinicID']).then((_) => GifLoaderDialogUtils.hideDialog(context)); + if (model.state == ViewState.Idle && model.doctorsList.length > 0) { + openListDialogField('DoctorName', 'DoctorID', model.doctorsList, (selectedValue) { setState(() { _selectedDoctor = selectedValue; }); }); - } else if (model.state == - ViewState.ErrorLocal) { - DrAppToastMsg.showErrorToast( - model.error); + } else if (model.state == ViewState.ErrorLocal) { + DrAppToastMsg.showErrorToast(model.error); } else { - DrAppToastMsg.showErrorToast( - "Empty List"); + DrAppToastMsg.showErrorToast("Empty List"); } } - : null, + : () {}, ), SizedBox( height: 16, @@ -222,7 +180,7 @@ class _AdmissionRequestThirdScreenState child: AppText( TranslationBase.of(context).patientDetails, fontFamily: 'Poppins', - fontSize: SizeConfig.textMultiplier * 1.8, + fontSize: SizeConfig.textMultiplier! * 1.8, fontWeight: FontWeight.w700, ), ), @@ -232,17 +190,16 @@ class _AdmissionRequestThirdScreenState TranslationBase.of(context).patientPregnant, fontWeight: FontWeight.normal, fontFamily: 'Poppins', - fontSize: SizeConfig.textMultiplier * 2.0, + fontSize: SizeConfig.textMultiplier! * 2.0, ), value: _patientPregnant, activeColor: HexColor("#D02127"), onChanged: (newValue) { setState(() { - _patientPregnant = newValue; + _patientPregnant = newValue!; }); }, - controlAffinity: - ListTileControlAffinity.leading, + controlAffinity: ListTileControlAffinity.leading, contentPadding: EdgeInsets.all(0), ), CheckboxListTile( @@ -250,13 +207,13 @@ class _AdmissionRequestThirdScreenState TranslationBase.of(context).isSickLeaveRequired, fontWeight: FontWeight.normal, fontFamily: 'Poppins', - fontSize: SizeConfig.textMultiplier * 2.0, + fontSize: SizeConfig.textMultiplier! * 2.0, ), value: _isSickLeaveRequired, activeColor: HexColor("#D02127"), onChanged: (newValue) { setState(() { - _isSickLeaveRequired = newValue; + _isSickLeaveRequired = newValue!; }); }, controlAffinity: ListTileControlAffinity.leading, @@ -266,8 +223,7 @@ class _AdmissionRequestThirdScreenState height: 8, ), AppTextFieldCustom( - hintText: - TranslationBase.of(context).sickLeaveComments, + hintText: TranslationBase.of(context).sickLeaveComments, controller: _sickLeaveCommentsController, minLines: 2, maxLines: 4, @@ -282,45 +238,29 @@ class _AdmissionRequestThirdScreenState hintText: TranslationBase.of(context).dietType, isTextFieldHasSuffix: true, validationError: dietTypeError, - dropDownText: _selectedDietType != null - ? _selectedDietType['nameEn'] - : null, + dropDownText: _selectedDietType != null ? _selectedDietType['nameEn'] : null, enabled: false, - onClick: model.dietTypesList != null && - model.dietTypesList.length > 0 + onClick: model.dietTypesList != null && model.dietTypesList.length > 0 ? () { - openListDialogField( - 'nameEn', 'id', model.dietTypesList, - (selectedValue) { + openListDialogField('nameEn', 'id', model.dietTypesList, (selectedValue) { setState(() { _selectedDietType = selectedValue; }); }); } : () async { - GifLoaderDialogUtils.showMyDialog( - context); - await model - .getDietTypes(patient.patientId) - .then((_) => - GifLoaderDialogUtils.hideDialog( - context)); - if (model.state == ViewState.Idle && - model.dietTypesList.length > 0) { - openListDialogField( - 'nameEn', 'id', model.dietTypesList, - (selectedValue) { + GifLoaderDialogUtils.showMyDialog(context); + await model.getDietTypes(patient.patientId).then((_) => GifLoaderDialogUtils.hideDialog(context)); + if (model.state == ViewState.Idle && model.dietTypesList.length > 0) { + openListDialogField('nameEn', 'id', model.dietTypesList, (selectedValue) { setState(() { _selectedDietType = selectedValue; }); }); - } else if (model.state == - ViewState.ErrorLocal) { - DrAppToastMsg.showErrorToast( - model.error); + } else if (model.state == ViewState.ErrorLocal) { + DrAppToastMsg.showErrorToast(model.error); } else { - DrAppToastMsg.showErrorToast( - "Empty List"); + DrAppToastMsg.showErrorToast("Empty List"); } }, ), @@ -328,8 +268,7 @@ class _AdmissionRequestThirdScreenState height: 10, ), AppTextFieldCustom( - hintText: - TranslationBase.of(context).dietTypeRemarks, + hintText: TranslationBase.of(context).dietTypeRemarks, controller: _dietTypeRemarksController, minLines: 4, maxLines: 6, @@ -339,8 +278,7 @@ class _AdmissionRequestThirdScreenState height: 10, ), AppTextFieldCustom( - hintText: TranslationBase.of(context) - .pastMedicalHistory, + hintText: TranslationBase.of(context).pastMedicalHistory, controller: _postMedicalHistoryController, minLines: 4, maxLines: 6, @@ -351,8 +289,7 @@ class _AdmissionRequestThirdScreenState height: 10, ), AppTextFieldCustom( - hintText: TranslationBase.of(context) - .pastSurgicalHistory, + hintText: TranslationBase.of(context).pastSurgicalHistory, controller: _postSurgicalHistoryController, minLines: 2, maxLines: 4, @@ -385,82 +322,57 @@ class _AdmissionRequestThirdScreenState _sickLeaveCommentsController.text != "" && _postMedicalHistoryController.text != "" && _postSurgicalHistoryController.text != "") { - model.admissionRequestData.patientMRN = - patient.patientMRN; - model.admissionRequestData.appointmentNo = - patient.appointmentNo; - model.admissionRequestData.episodeID = patient.episodeNo; - model.admissionRequestData.admissionRequestNo = 0; + model.admissionRequestData!.patientMRN = patient.patientMRN; + model.admissionRequestData!.appointmentNo = patient.appointmentNo; + model.admissionRequestData!.episodeID = patient.episodeNo; + model.admissionRequestData!.admissionRequestNo = 0; - model.admissionRequestData.admitToClinic = - _selectedClinic['clinicID']; - model.admissionRequestData.mrpDoctorID = - _selectedDoctor['DoctorID']; + model.admissionRequestData!.admitToClinic = _selectedClinic['clinicID']; + model.admissionRequestData!.mrpDoctorID = _selectedDoctor['DoctorID']; - model.admissionRequestData.isPregnant = _patientPregnant; - model.admissionRequestData.isSickLeaveRequired = - _isSickLeaveRequired; - model.admissionRequestData.sickLeaveComments = - _sickLeaveCommentsController.text; - model.admissionRequestData.isDietType = - _selectedDietType != null ? true : false; - model.admissionRequestData.dietType = - _selectedDietType != null - ? _selectedDietType['id'] - : 0; - model.admissionRequestData.dietRemarks = - _dietTypeRemarksController.text; - model.admissionRequestData.pastMedicalHistory = - _postMedicalHistoryController.text; - model.admissionRequestData.pastSurgicalHistory = - _postSurgicalHistoryController.text; + model.admissionRequestData!.isPregnant = _patientPregnant; + model.admissionRequestData!.isSickLeaveRequired = _isSickLeaveRequired; + model.admissionRequestData!.sickLeaveComments = _sickLeaveCommentsController.text; + model.admissionRequestData!.isDietType = _selectedDietType != null ? true : false; + model.admissionRequestData!.dietType = _selectedDietType != null ? _selectedDietType['id'] : 0; + model.admissionRequestData!.dietRemarks = _dietTypeRemarksController.text; + model.admissionRequestData!.pastMedicalHistory = _postMedicalHistoryController.text; + model.admissionRequestData!.pastSurgicalHistory = _postSurgicalHistoryController.text; Navigator.of(context) - .pushNamed(PATIENT_ADMISSION_REQUEST_2, arguments: { - 'patient': patient, - 'patientType': patientType, - 'arrivalType': arrivalType, - 'admission-data': model.admissionRequestData - }); + .pushNamed(PATIENT_ADMISSION_REQUEST_2, arguments: {'patient': patient, 'patientType': patientType, 'arrivalType': arrivalType, 'admission-data': model.admissionRequestData}); } else { - DrAppToastMsg.showErrorToast( - TranslationBase.of(context).pleaseFill); + DrAppToastMsg.showErrorToast(TranslationBase.of(context).pleaseFill); setState(() { if (_selectedClinic == null) { - clinicError = - TranslationBase.of(context).fieldRequired; + clinicError = TranslationBase.of(context).fieldRequired; } else { - clinicError = null; + clinicError = ""; } if (_selectedDoctor == null) { - doctorError = - TranslationBase.of(context).fieldRequired; + doctorError = TranslationBase.of(context).fieldRequired; } else { - doctorError = null; + doctorError = ""; } if (_sickLeaveCommentsController.text == "") { - sickLeaveCommentError = - TranslationBase.of(context).fieldRequired; + sickLeaveCommentError = TranslationBase.of(context).fieldRequired; } else { - sickLeaveCommentError = null; + sickLeaveCommentError = ""; } if (_selectedDietType == null) { - dietTypeError = - TranslationBase.of(context).fieldRequired; + dietTypeError = TranslationBase.of(context).fieldRequired; } else { - dietTypeError = null; + dietTypeError = ""; } if (_postMedicalHistoryController.text == "") { - medicalHistoryError = - TranslationBase.of(context).fieldRequired; + medicalHistoryError = TranslationBase.of(context).fieldRequired; } else { - medicalHistoryError = null; + medicalHistoryError = ""; } if (_postSurgicalHistoryController.text == "") { - surgicalHistoryError = - TranslationBase.of(context).fieldRequired; + surgicalHistoryError = TranslationBase.of(context).fieldRequired; } else { - surgicalHistoryError = null; + surgicalHistoryError = ""; } }); } @@ -470,8 +382,7 @@ class _AdmissionRequestThirdScreenState ); } - void openListDialogField(String attributeName, String attributeValueId, - List list, Function(dynamic selectedValue) okFunction) { + void openListDialogField(String attributeName, String attributeValueId, List list, Function(dynamic selectedValue) okFunction) { ListSelectDialog dialog = ListSelectDialog( list: list, attributeName: attributeName, diff --git a/lib/screens/patients/profile/admission_request/admission_request_second_screen.dart b/lib/screens/patients/profile/admission_request/admission_request_second_screen.dart index adab2bf7..18c48f10 100644 --- a/lib/screens/patients/profile/admission_request/admission_request_second_screen.dart +++ b/lib/screens/patients/profile/admission_request/admission_request_second_screen.dart @@ -31,12 +31,10 @@ import '../../../../routes.dart'; class AdmissionRequestSecondScreen extends StatefulWidget { @override - _AdmissionRequestSecondScreenState createState() => - _AdmissionRequestSecondScreenState(); + _AdmissionRequestSecondScreenState createState() => _AdmissionRequestSecondScreenState(); } -class _AdmissionRequestSecondScreenState - extends State { +class _AdmissionRequestSecondScreenState extends State { final _postPlansEstimatedCostController = TextEditingController(); final _estimatedCostController = TextEditingController(); final _expectedDaysController = TextEditingController(); @@ -45,28 +43,28 @@ class _AdmissionRequestSecondScreenState final _complicationsController = TextEditingController(); final _otherProceduresController = TextEditingController(); - DateTime _expectedAdmissionDate; + DateTime? _expectedAdmissionDate; dynamic _selectedFloor; dynamic _selectedWard; dynamic _selectedRoomCategory; dynamic _selectedAdmissionType; - String costError; - String plansError; - String otherInterventionsError; - String expectedDaysError; - String expectedDatesError; - String floorError; - String roomError; - String treatmentsError; - String complicationsError; - String proceduresError; - String admissionTypeError; + String costError = '', + plansError = '', + otherInterventionsError = '', + expectedDaysError = '', + expectedDatesError = '', + floorError = '', + roomError = '', + treatmentsError = '', + complicationsError = '', + proceduresError = '', + admissionTypeError = ''; @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']; String patientType = routeArgs['patientType']; String arrivalType = routeArgs['arrivalType']; @@ -77,583 +75,455 @@ class _AdmissionRequestSecondScreenState return BaseView( builder: (_, model, w) => AppScaffold( - baseViewModel: model, - isShowAppBar: true, - appBar: PatientProfileAppBar(patient), - appBarTitle: TranslationBase.of(context).admissionRequest, - body: GestureDetector( - onTap: () { - FocusScopeNode currentFocus = FocusScope.of(context); - if (!currentFocus.hasPrimaryFocus) { - currentFocus.unfocus(); - } - }, - child: Column( - children: [ - Expanded( - child: SingleChildScrollView( - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - SizedBox( - height: 15, - ), - ServiceTitle( - title: "${TranslationBase.of(context).admission}", - subTitle: TranslationBase.of(context).request, - ), - SizedBox( - height: 15, - ), - Container( - margin: - EdgeInsets.symmetric(vertical: 0, horizontal: 16), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - AppText( - Utils.convertToTitleCase(TranslationBase.of(context) - .postPlansEstimatedCost,), - color: Color(0xFF2E303A), - fontSize: SizeConfig.textMultiplier * 1.8, - fontWeight: FontWeight.w700, - ), - SizedBox( - height: 10, - ), - AppTextFieldCustom( - height: screenSize.height * 0.075, - hintText: - TranslationBase.of(context).estimatedCost, - controller: _estimatedCostController, - validationError: costError, - inputType: TextInputType.number, - inputFormatters: [ - FilteringTextInputFormatter.allow( - RegExp(ONLY_NUMBERS)) - ], - ), - SizedBox( - height: 10, - ), - AppTextFieldCustom( - hintText: TranslationBase.of(context).postPlans, - controller: _postPlansEstimatedCostController, - inputType: TextInputType.multiline, - validationError: plansError, - minLines: 4, - maxLines: 6, - ), - SizedBox( - height: 10, - ), - AppTextFieldCustom( - hintText: TranslationBase.of(context) - .otherDepartmentsInterventions, - controller: - _otherDepartmentsInterventionsController, - inputType: TextInputType.multiline, - validationError: otherInterventionsError, - minLines: 2, - maxLines: 4, + baseViewModel: model, + isShowAppBar: true, + appBar: PatientProfileAppBar(patient), + appBarTitle: TranslationBase.of(context).admissionRequest, + body: GestureDetector( + onTap: () { + FocusScopeNode currentFocus = FocusScope.of(context); + if (!currentFocus.hasPrimaryFocus) { + currentFocus.unfocus(); + } + }, + child: Column( + children: [ + Expanded( + child: SingleChildScrollView( + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + SizedBox( + height: 15, + ), + ServiceTitle( + title: "${TranslationBase.of(context).admission}", + subTitle: TranslationBase.of(context).request, + ), + SizedBox( + height: 15, + ), + Container( + margin: EdgeInsets.symmetric(vertical: 0, horizontal: 16), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + AppText( + Utils.convertToTitleCase( + TranslationBase.of(context).postPlansEstimatedCost, ), - SizedBox( - height: 10, - ), - AppText( - TranslationBase.of(context).otherInformation, - color: Color(0xFF2E303A), - fontSize: SizeConfig.textMultiplier * 1.8, - fontWeight: FontWeight.w700, - ), - SizedBox( - height: 10, - ), - AppTextFieldCustom( - height: screenSize.height * 0.075, - hintText: - TranslationBase.of(context).expectedDays, - controller: _expectedDaysController, - validationError: expectedDaysError, - inputType: TextInputType.number, - inputFormatters: [ - FilteringTextInputFormatter.allow( - RegExp(ONLY_NUMBERS)) - ], - ), - SizedBox( - height: 10, - ), - AppTextFieldCustom( - height: screenSize.height * 0.075, - hintText: TranslationBase.of(context) - .expectedAdmissionDate, - dropDownText: _expectedAdmissionDate != null - ? "${AppDateUtils.convertStringToDateFormat(_expectedAdmissionDate.toString(), "yyyy-MM-dd")}" - : null, - enabled: false, - isTextFieldHasSuffix: true, - validationError: expectedDatesError, - suffixIcon: IconButton( - icon: Icon( + color: Color(0xFF2E303A), + fontSize: SizeConfig.textMultiplier! * 1.8, + fontWeight: FontWeight.w700, + ), + SizedBox( + height: 10, + ), + AppTextFieldCustom( + height: screenSize.height * 0.075, + hintText: TranslationBase.of(context).estimatedCost, + controller: _estimatedCostController, + validationError: costError, + inputType: TextInputType.number, + inputFormatters: [FilteringTextInputFormatter.allow(RegExp(ONLY_NUMBERS))], + ), + SizedBox( + height: 10, + ), + AppTextFieldCustom( + hintText: TranslationBase.of(context).postPlans, + controller: _postPlansEstimatedCostController, + inputType: TextInputType.multiline, + validationError: plansError, + minLines: 4, + maxLines: 6, + ), + SizedBox( + height: 10, + ), + AppTextFieldCustom( + hintText: TranslationBase.of(context).otherDepartmentsInterventions, + controller: _otherDepartmentsInterventionsController, + inputType: TextInputType.multiline, + validationError: otherInterventionsError, + minLines: 2, + maxLines: 4, + ), + SizedBox( + height: 10, + ), + AppText( + TranslationBase.of(context).otherInformation, + color: Color(0xFF2E303A), + fontSize: SizeConfig.textMultiplier! * 1.8, + fontWeight: FontWeight.w700, + ), + SizedBox( + height: 10, + ), + AppTextFieldCustom( + height: screenSize.height * 0.075, + hintText: TranslationBase.of(context).expectedDays, + controller: _expectedDaysController, + validationError: expectedDaysError, + inputType: TextInputType.number, + inputFormatters: [ + FilteringTextInputFormatter.allow( + RegExp(ONLY_NUMBERS), + ) + ], + ), + SizedBox( + height: 10, + ), + AppTextFieldCustom( + height: screenSize.height * 0.075, + hintText: TranslationBase.of(context).expectedAdmissionDate, + dropDownText: _expectedAdmissionDate != null ? "${AppDateUtils.convertStringToDateFormat(_expectedAdmissionDate.toString(), "yyyy-MM-dd")}" : "", + enabled: false, + isTextFieldHasSuffix: true, + validationError: expectedDatesError, + suffixIcon: IconButton( + icon: Icon( Icons.calendar_today, color: Colors.black, - )), - onClick: () { - if (_expectedAdmissionDate == null) { - _expectedAdmissionDate = DateTime.now(); - } - _selectDate(context, _expectedAdmissionDate, - (picked) { - setState(() { - _expectedAdmissionDate = picked; - }); - }); - }, - ), - SizedBox( - height: 10, + ), + onPressed: () {}, ), - AppTextFieldCustom( - height: screenSize.height * 0.075, - hintText: TranslationBase.of(context).floor, - dropDownText: _selectedFloor != null - ? _selectedFloor['description'] - : null, - enabled: false, - isTextFieldHasSuffix: true, - validationError: floorError, - onClick: model.floorList != null && - model.floorList.length > 0 - ? () { - openListDialogField( - 'description', - 'floorID', - model.floorList, (selectedValue) { + onClick: () { + if (_expectedAdmissionDate == null) { + _expectedAdmissionDate = DateTime.now(); + } + _selectDate(context, _expectedAdmissionDate!, (picked) { + setState(() { + _expectedAdmissionDate = picked; + }); + }); + }, + ), + SizedBox( + height: 10, + ), + AppTextFieldCustom( + height: screenSize.height * 0.075, + hintText: TranslationBase.of(context).floor, + dropDownText: _selectedFloor != null ? _selectedFloor['description'] : null, + enabled: false, + isTextFieldHasSuffix: true, + validationError: floorError, + onClick: model.floorList != null && model.floorList.length > 0 + ? () { + openListDialogField('description', 'floorID', model.floorList, (selectedValue) { + setState(() { + _selectedFloor = selectedValue; + }); + }); + } + : () async { + GifLoaderDialogUtils.showMyDialog(context); + await model.getFloors().then((_) => GifLoaderDialogUtils.hideDialog(context)); + if (model.state == ViewState.Idle && model.floorList.length > 0) { + openListDialogField('description', 'floorID', model.floorList, (selectedValue) { setState(() { _selectedFloor = selectedValue; }); }); + } else if (model.state == ViewState.ErrorLocal) { + DrAppToastMsg.showErrorToast(model.error); + } else { + DrAppToastMsg.showErrorToast("Empty List"); } - : () async { - GifLoaderDialogUtils.showMyDialog( - context); - await model.getFloors().then((_) => - GifLoaderDialogUtils.hideDialog( - context)); - if (model.state == ViewState.Idle && - model.floorList.length > 0) { - openListDialogField( - 'description', - 'floorID', - model.floorList, (selectedValue) { - setState(() { - _selectedFloor = selectedValue; - }); - }); - } else if (model.state == - ViewState.ErrorLocal) { - DrAppToastMsg.showErrorToast( - model.error); - } else { - DrAppToastMsg.showErrorToast( - "Empty List"); - } - }, - ), - SizedBox( - height: 10, - ), - AppTextFieldCustom( - height: screenSize.height * 0.075, - hintText: TranslationBase.of(context).ward, - dropDownText: _selectedWard != null - ? _selectedWard['description'] - : null, - enabled: false, - isTextFieldHasSuffix: true, - onClick: model.wardList != null && - model.wardList.length > 0 - ? () { - openListDialogField( - 'description', - 'nursingStationID', - model.wardList, (selectedValue) { + }, + ), + SizedBox( + height: 10, + ), + AppTextFieldCustom( + height: screenSize.height * 0.075, + hintText: TranslationBase.of(context).ward, + dropDownText: _selectedWard != null ? _selectedWard['description'] : null, + enabled: false, + isTextFieldHasSuffix: true, + onClick: model.wardList != null && model.wardList.length > 0 + ? () { + openListDialogField('description', 'nursingStationID', model.wardList, (selectedValue) { + setState(() { + _selectedWard = selectedValue; + }); + }); + } + : () async { + GifLoaderDialogUtils.showMyDialog(context); + await model.getWards().then((_) => GifLoaderDialogUtils.hideDialog(context)); + if (model.state == ViewState.Idle && model.wardList.length > 0) { + openListDialogField('description', 'nursingStationID', model.wardList, (selectedValue) { setState(() { _selectedWard = selectedValue; }); }); + } else if (model.state == ViewState.ErrorLocal) { + DrAppToastMsg.showErrorToast(model.error); + } else { + DrAppToastMsg.showErrorToast("Empty List"); } - : () async { - GifLoaderDialogUtils.showMyDialog( - context); - await model.getWards().then((_) => - GifLoaderDialogUtils.hideDialog( - context)); - if (model.state == ViewState.Idle && - model.wardList.length > 0) { - openListDialogField( - 'description', - 'nursingStationID', - model.wardList, (selectedValue) { - setState(() { - _selectedWard = selectedValue; - }); - }); - } else if (model.state == - ViewState.ErrorLocal) { - DrAppToastMsg.showErrorToast( - model.error); - } else { - DrAppToastMsg.showErrorToast( - "Empty List"); - } - }, - ), - SizedBox( - height: 10, - ), - AppTextFieldCustom( - height: screenSize.height * 0.075, - hintText: - TranslationBase.of(context).roomCategory, - dropDownText: _selectedRoomCategory != null - ? _selectedRoomCategory['description'] - : null, - enabled: false, - isTextFieldHasSuffix: true, - validationError: roomError, - onClick: model.roomCategoryList != null && - model.roomCategoryList.length > 0 - ? () { - openListDialogField( - 'description', - 'categoryID', - model.roomCategoryList, - (selectedValue) { + }, + ), + SizedBox( + height: 10, + ), + AppTextFieldCustom( + height: screenSize.height * 0.075, + hintText: TranslationBase.of(context).roomCategory, + dropDownText: _selectedRoomCategory != null ? _selectedRoomCategory['description'] : null, + enabled: false, + isTextFieldHasSuffix: true, + validationError: roomError, + onClick: model.roomCategoryList != null && model.roomCategoryList.length > 0 + ? () { + openListDialogField('description', 'categoryID', model.roomCategoryList, (selectedValue) { + setState(() { + _selectedRoomCategory = selectedValue; + }); + }); + } + : () async { + GifLoaderDialogUtils.showMyDialog(context); + await model.getRoomCategories().then((_) => GifLoaderDialogUtils.hideDialog(context)); + if (model.state == ViewState.Idle && model.roomCategoryList.length > 0) { + openListDialogField('description', 'categoryID', model.roomCategoryList, (selectedValue) { setState(() { - _selectedRoomCategory = - selectedValue; + _selectedRoomCategory = selectedValue; }); }); + } else if (model.state == ViewState.ErrorLocal) { + DrAppToastMsg.showErrorToast(model.error); + } else { + DrAppToastMsg.showErrorToast("Empty List"); } - : () async { - GifLoaderDialogUtils.showMyDialog( - context); - await model.getRoomCategories().then( - (_) => - GifLoaderDialogUtils.hideDialog( - context)); - if (model.state == ViewState.Idle && - model.roomCategoryList.length > 0) { - openListDialogField( - 'description', - 'categoryID', - model.roomCategoryList, - (selectedValue) { - setState(() { - _selectedRoomCategory = - selectedValue; - }); - }); - } else if (model.state == - ViewState.ErrorLocal) { - DrAppToastMsg.showErrorToast( - model.error); - } else { - DrAppToastMsg.showErrorToast( - "Empty List"); - } - }, - ), - SizedBox( - height: 10, - ), - AppTextFieldCustom( - hintText: - TranslationBase.of(context).treatmentLine, - controller: _treatmentLineController, - inputType: TextInputType.multiline, - validationError: treatmentsError, - minLines: 3, - maxLines: 5, - ), - SizedBox( - height: 10, - ), - AppTextFieldCustom( - hintText: - TranslationBase.of(context).complications, - controller: _complicationsController, - inputType: TextInputType.multiline, - validationError: complicationsError, - minLines: 3, - maxLines: 5, - ), - SizedBox( - height: 10, - ), - AppTextFieldCustom( - hintText: - TranslationBase.of(context).otherProcedure, - controller: _otherProceduresController, - inputType: TextInputType.multiline, - validationError: proceduresError, - minLines: 3, - maxLines: 5, - ), - SizedBox( - height: 10, - ), - AppTextFieldCustom( - height: screenSize.height * 0.075, - hintText: - TranslationBase.of(context).admissionType, - dropDownText: _selectedAdmissionType != null - ? _selectedAdmissionType['nameEn'] - : null, - enabled: false, - isTextFieldHasSuffix: true, - validationError: admissionTypeError, - onClick: model.admissionTypeList != null && - model.admissionTypeList.length > 0 - ? () { - openListDialogField('nameEn', 'id', - model.admissionTypeList, - (selectedValue) { + }, + ), + SizedBox( + height: 10, + ), + AppTextFieldCustom( + hintText: TranslationBase.of(context).treatmentLine, + controller: _treatmentLineController, + inputType: TextInputType.multiline, + validationError: treatmentsError, + minLines: 3, + maxLines: 5, + ), + SizedBox( + height: 10, + ), + AppTextFieldCustom( + hintText: TranslationBase.of(context).complications, + controller: _complicationsController, + inputType: TextInputType.multiline, + validationError: complicationsError, + minLines: 3, + maxLines: 5, + ), + SizedBox( + height: 10, + ), + AppTextFieldCustom( + hintText: TranslationBase.of(context).otherProcedure, + controller: _otherProceduresController, + inputType: TextInputType.multiline, + validationError: proceduresError, + minLines: 3, + maxLines: 5, + ), + SizedBox( + height: 10, + ), + AppTextFieldCustom( + height: screenSize.height * 0.075, + hintText: TranslationBase.of(context).admissionType, + dropDownText: _selectedAdmissionType != null ? _selectedAdmissionType['nameEn'] : null, + enabled: false, + isTextFieldHasSuffix: true, + validationError: admissionTypeError, + onClick: model.admissionTypeList != null && model.admissionTypeList.length > 0 + ? () { + openListDialogField('nameEn', 'id', model.admissionTypeList, (selectedValue) { + setState(() { + _selectedAdmissionType = selectedValue; + }); + }); + } + : () async { + GifLoaderDialogUtils.showMyDialog(context); + await model.getMasterLookup(MasterKeysService.AdmissionRequestType).then((_) => GifLoaderDialogUtils.hideDialog(context)); + if (model.state == ViewState.Idle && model.admissionTypeList.length > 0) { + openListDialogField('nameEn', 'id', model.admissionTypeList, (selectedValue) { setState(() { - _selectedAdmissionType = - selectedValue; + _selectedAdmissionType = selectedValue; }); }); + } else if (model.state == ViewState.ErrorLocal) { + DrAppToastMsg.showErrorToast(model.error); + } else { + DrAppToastMsg.showErrorToast("Empty List"); } - : () async { - GifLoaderDialogUtils.showMyDialog( - context); - await model - .getMasterLookup(MasterKeysService - .AdmissionRequestType) - .then((_) => - GifLoaderDialogUtils.hideDialog( - context)); - if (model.state == ViewState.Idle && - model.admissionTypeList.length > - 0) { - openListDialogField('nameEn', 'id', - model.admissionTypeList, - (selectedValue) { - setState(() { - _selectedAdmissionType = - selectedValue; - }); - }); - } else if (model.state == - ViewState.ErrorLocal) { - DrAppToastMsg.showErrorToast( - model.error); - } else { - DrAppToastMsg.showErrorToast( - "Empty List"); - } - }, - ), - SizedBox( - height: 100, - ), - ], - ), + }, + ), + SizedBox( + height: 100, + ), + ], ), - ], - ), + ), + ], ), ), - ], - ), + ), + ], ), + ), bottomSheet: BottomSheetContainer( widget: Row( - children: [ - Container( - width: MediaQuery.of(context).size.width * 0.4, - child: AppButton( - title: TranslationBase.of(context).previous, - color: HexColor('#EFEFEF'), - fontColor: Colors.black, - onPressed: () { - Navigator.pop(context); - }, - ), - ), - SizedBox( - width: 10, - ), - Container( - width: MediaQuery.of(context).size.width * 0.4, - child: AppButton( - title: TranslationBase.of(context).next, - color: AppGlobal.appRedColor, - fontColor: Colors.white, - onPressed: () async { - await locator().logEvent( - eventCategory: "Admission Request Second Screen", - eventAction: "Go To Admission Request Three", - ); - if (_estimatedCostController.text != "" && - _postPlansEstimatedCostController.text != "" && - _expectedDaysController.text != "" && - _expectedAdmissionDate != null && - _otherDepartmentsInterventionsController.text != - "" && - _selectedFloor != null && - _selectedRoomCategory != - null /*_selectedWard is not required*/ && - _treatmentLineController.text != "" && - _complicationsController.text != "" && - _otherProceduresController.text != "" && - _selectedAdmissionType != null) { - model.admissionRequestData = admissionRequest; + children: [ + Container( + width: MediaQuery.of(context).size.width * 0.4, + child: AppButton( + title: TranslationBase.of(context).previous, + color: HexColor('#EFEFEF'), + fontColor: Colors.black, + onPressed: () { + Navigator.pop(context); + }, + ), + ), + SizedBox( + width: 10, + ), + Container( + width: MediaQuery.of(context).size.width * 0.4, + child: AppButton( + title: TranslationBase.of(context).next, + color: AppGlobal.appRedColor, + fontColor: Colors.white, + onPressed: () async { + await locator().logEvent( + eventCategory: "Admission Request Second Screen", + eventAction: "Go To Admission Request Three", + ); + if (_estimatedCostController.text != "" && + _postPlansEstimatedCostController.text != "" && + _expectedDaysController.text != "" && + _expectedAdmissionDate != null && + _otherDepartmentsInterventionsController.text != "" && + _selectedFloor != null && + _selectedRoomCategory != null /*_selectedWard is not required*/ && + _treatmentLineController.text != "" && + _complicationsController.text != "" && + _otherProceduresController.text != "" && + _selectedAdmissionType != null) { + model.admissionRequestData = admissionRequest; - model.admissionRequestData.estimatedCost = - int.parse(_estimatedCostController.text); - model.admissionRequestData - .elementsForImprovement = - _postPlansEstimatedCostController.text; + model.admissionRequestData!.estimatedCost = int.parse(_estimatedCostController.text); + model.admissionRequestData!.elementsForImprovement = _postPlansEstimatedCostController.text; - model.admissionRequestData.expectedDays = - int.parse(_expectedDaysController.text); - model.admissionRequestData.admissionDate = - _expectedAdmissionDate.toIso8601String(); - model.admissionRequestData - .otherDepartmentInterventions = - _otherDepartmentsInterventionsController.text; - model.admissionRequestData.admissionLocationID = - _selectedFloor['floorID']; - model.admissionRequestData.wardID = - _selectedWard != null - ? _selectedWard['nursingStationID'] - : 0; - model.admissionRequestData.roomCategoryID = - _selectedRoomCategory['categoryID']; + model.admissionRequestData!.expectedDays = int.parse(_expectedDaysController.text); + model.admissionRequestData!.admissionDate = _expectedAdmissionDate!.toIso8601String(); + model.admissionRequestData!.otherDepartmentInterventions = _otherDepartmentsInterventionsController.text; + model.admissionRequestData!.admissionLocationID = _selectedFloor['floorID']; + model.admissionRequestData!.wardID = _selectedWard != null ? _selectedWard['nursingStationID'] : 0; + model.admissionRequestData!.roomCategoryID = _selectedRoomCategory['categoryID']; - model.admissionRequestData - .admissionRequestProcedures = []; + model.admissionRequestData!.admissionRequestProcedures = []; - model.admissionRequestData.mainLineOfTreatment = - _treatmentLineController.text; - model.admissionRequestData.complications = - _complicationsController.text; - model.admissionRequestData.otherProcedures = - _otherProceduresController.text; - model.admissionRequestData.admissionType = - _selectedAdmissionType['id']; + model.admissionRequestData!.mainLineOfTreatment = _treatmentLineController.text; + model.admissionRequestData!.complications = _complicationsController.text; + model.admissionRequestData!.otherProcedures = _otherProceduresController.text; + model.admissionRequestData!.admissionType = _selectedAdmissionType['id']; - Navigator.of(context).pushNamed( - PATIENT_ADMISSION_REQUEST_3, - arguments: { - 'patient': patient, - 'patientType': patientType, - 'arrivalType': arrivalType, - 'admission-data': model.admissionRequestData - }); - } else { - DrAppToastMsg.showErrorToast( - TranslationBase.of(context).pleaseFill); + Navigator.of(context) + .pushNamed(PATIENT_ADMISSION_REQUEST_3, arguments: {'patient': patient, 'patientType': patientType, 'arrivalType': arrivalType, 'admission-data': model.admissionRequestData}); + } else { + DrAppToastMsg.showErrorToast(TranslationBase.of(context).pleaseFill); - setState(() { - if (_estimatedCostController.text == "") { - costError = - TranslationBase.of(context).fieldRequired; - } else { - costError = null; - } + setState(() { + if (_estimatedCostController.text == "") { + costError = TranslationBase.of(context).fieldRequired; + } else { + costError = ""; + } - if (_postPlansEstimatedCostController.text == - "") { - plansError = - TranslationBase.of(context).fieldRequired; - } else { - plansError = null; - } + if (_postPlansEstimatedCostController.text == "") { + plansError = TranslationBase.of(context).fieldRequired; + } else { + plansError = ""; + } - if (_expectedDaysController.text == "") { - expectedDaysError = - TranslationBase.of(context).fieldRequired; - } else { - expectedDaysError = null; - } + if (_expectedDaysController.text == "") { + expectedDaysError = TranslationBase.of(context).fieldRequired; + } else { + expectedDaysError = ""; + } - if (_expectedAdmissionDate == null) { - expectedDatesError = - TranslationBase.of(context).fieldRequired; - } else { - expectedDatesError = null; - } + if (_expectedAdmissionDate == null) { + expectedDatesError = TranslationBase.of(context).fieldRequired; + } else { + expectedDatesError = ""; + } - if (_otherDepartmentsInterventionsController - .text == - "") { - otherInterventionsError = - TranslationBase.of(context).fieldRequired; - } else { - otherInterventionsError = null; - } + if (_otherDepartmentsInterventionsController.text == "") { + otherInterventionsError = TranslationBase.of(context).fieldRequired; + } else { + otherInterventionsError = ""; + } - if (_selectedFloor == null) { - floorError = - TranslationBase.of(context).fieldRequired; - } else { - floorError = null; - } + if (_selectedFloor == null) { + floorError = TranslationBase.of(context).fieldRequired; + } else { + floorError = ""; + } - if (_selectedRoomCategory == null) { - roomError = - TranslationBase.of(context).fieldRequired; - } else { - roomError = null; - } + if (_selectedRoomCategory == null) { + roomError = TranslationBase.of(context).fieldRequired; + } else { + roomError = ""; + } - if (_treatmentLineController.text == "") { - treatmentsError = - TranslationBase.of(context).fieldRequired; - } else { - treatmentsError = null; - } + if (_treatmentLineController.text == "") { + treatmentsError = TranslationBase.of(context).fieldRequired; + } else { + treatmentsError = ""; + } - if (_complicationsController.text == "") { - complicationsError = - TranslationBase.of(context).fieldRequired; - } else { - complicationsError = null; - } + if (_complicationsController.text == "") { + complicationsError = TranslationBase.of(context).fieldRequired; + } else { + complicationsError = ""; + } - if (_otherProceduresController.text == "") { - proceduresError = - TranslationBase.of(context).fieldRequired; - } else { - proceduresError = null; - } + if (_otherProceduresController.text == "") { + proceduresError = TranslationBase.of(context).fieldRequired; + } else { + proceduresError = ""; + } - if (_selectedAdmissionType == null) { - admissionTypeError = - TranslationBase.of(context).fieldRequired; - } else { - admissionTypeError = null; - } - }); + if (_selectedAdmissionType == null) { + admissionTypeError = TranslationBase.of(context).fieldRequired; + } else { + admissionTypeError = ""; } - }, - ), - ), - ], - ) - ), + }); + } + }, + ), + ), + ], + )), ), ); } - Future _selectDate(BuildContext context, DateTime dateTime, - Function(DateTime picked) updateDate) async { - final DateTime picked = await showDatePicker( + Future _selectDate(BuildContext context, DateTime dateTime, Function(DateTime picked) updateDate) async { + final DateTime? picked = await showDatePicker( context: context, initialDate: dateTime, firstDate: DateTime.now(), @@ -665,8 +535,7 @@ class _AdmissionRequestSecondScreenState } } - void openListDialogField(String attributeName, String attributeValueId, - List list, Function(dynamic selectedValue) okFunction) { + void openListDialogField(String attributeName, String attributeValueId, List list, Function(dynamic selectedValue) okFunction) { ListSelectDialog dialog = ListSelectDialog( list: list, attributeName: attributeName, diff --git a/lib/screens/patients/profile/admission_request/admission_request_third_screen.dart b/lib/screens/patients/profile/admission_request/admission_request_third_screen.dart index 0a732a1d..b7ddb536 100644 --- a/lib/screens/patients/profile/admission_request/admission_request_third_screen.dart +++ b/lib/screens/patients/profile/admission_request/admission_request_third_screen.dart @@ -27,23 +27,19 @@ import '../../../../routes.dart'; class AdmissionRequestThirdScreen extends StatefulWidget { @override - _AdmissionRequestThirdScreenState createState() => - _AdmissionRequestThirdScreenState(); + _AdmissionRequestThirdScreenState createState() => _AdmissionRequestThirdScreenState(); } -class _AdmissionRequestThirdScreenState - extends State { +class _AdmissionRequestThirdScreenState extends State { dynamic _selectedDiagnosis; dynamic _selectedIcd; dynamic _selectedDiagnosisType; - String diagnosisError; - String icdError; - String diagnosisTypeError; + String diagnosisError = '', icdError = '', diagnosisTypeError = ''; @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']; AdmissionRequest admissionRequest = routeArgs['admission-data']; @@ -88,7 +84,7 @@ class _AdmissionRequestThirdScreenState AppText( TranslationBase.of(context).diagnosisDetail, color: Color(0xFF2E303A), - fontSize: SizeConfig.textMultiplier * 1.8, + fontSize: SizeConfig.textMultiplier! * 1.8, fontWeight: FontWeight.w700, ), SizedBox( @@ -97,18 +93,13 @@ class _AdmissionRequestThirdScreenState AppTextFieldCustom( height: screenSize.height * 0.075, hintText: TranslationBase.of(context).diagnosis, - dropDownText: _selectedDiagnosis != null - ? _selectedDiagnosis['nameEn'] - : null, + dropDownText: _selectedDiagnosis != null ? _selectedDiagnosis['nameEn'] : null, enabled: false, isTextFieldHasSuffix: true, validationError: diagnosisError, - onClick: model.diagnosisTypesList != null && - model.diagnosisTypesList.length > 0 + onClick: model.diagnosisTypesList != null && model.diagnosisTypesList.length > 0 ? () { - openListDialogField('nameEn', 'id', - model.diagnosisTypesList, - (selectedValue) { + openListDialogField('nameEn', 'id', model.diagnosisTypesList, (selectedValue) { setState(() { _selectedDiagnosis = selectedValue; }); @@ -116,24 +107,17 @@ class _AdmissionRequestThirdScreenState } : () async { GifLoaderDialogUtils.showMyDialog(context); - await model.getDiagnosis().then((_) => - GifLoaderDialogUtils.hideDialog( - context)); - if (model.state == ViewState.Idle && - model.diagnosisTypesList.length > 0) { - openListDialogField('nameEn', 'id', - model.diagnosisTypesList, - (selectedValue) { + await model.getDiagnosis().then((_) => GifLoaderDialogUtils.hideDialog(context)); + if (model.state == ViewState.Idle && model.diagnosisTypesList.length > 0) { + openListDialogField('nameEn', 'id', model.diagnosisTypesList, (selectedValue) { setState(() { _selectedDiagnosis = selectedValue; }); }); - } else if (model.state == - ViewState.ErrorLocal) { + } else if (model.state == ViewState.ErrorLocal) { DrAppToastMsg.showErrorToast(model.error); } else { - DrAppToastMsg.showErrorToast( - "Empty List"); + DrAppToastMsg.showErrorToast("Empty List"); } }, ), @@ -143,18 +127,13 @@ class _AdmissionRequestThirdScreenState AppTextFieldCustom( height: screenSize.height * 0.075, hintText: TranslationBase.of(context).icd, - dropDownText: _selectedIcd != null - ? _selectedIcd['description'] - : null, + dropDownText: _selectedIcd != null ? _selectedIcd['description'] : null, enabled: false, isTextFieldHasSuffix: true, validationError: icdError, - onClick: model.icdCodes != null && - model.icdCodes.length > 0 + onClick: model.icdCodes != null && model.icdCodes.length > 0 ? () { - openListDialogField( - 'description', 'code', model.icdCodes, - (selectedValue) { + openListDialogField('description', 'code', model.icdCodes, (selectedValue) { setState(() { _selectedIcd = selectedValue; }); @@ -162,26 +141,17 @@ class _AdmissionRequestThirdScreenState } : () async { GifLoaderDialogUtils.showMyDialog(context); - await model - .getICDCodes(patient.patientMRN) - .then((_) => - GifLoaderDialogUtils.hideDialog( - context)); - if (model.state == ViewState.Idle && - model.icdCodes.length > 0) { - openListDialogField( - 'description', 'code', model.icdCodes, - (selectedValue) { + await model.getICDCodes(patient.patientMRN!).then((_) => GifLoaderDialogUtils.hideDialog(context)); + if (model.state == ViewState.Idle && model.icdCodes.length > 0) { + openListDialogField('description', 'code', model.icdCodes, (selectedValue) { setState(() { _selectedIcd = selectedValue; }); }); - } else if (model.state == - ViewState.ErrorLocal) { + } else if (model.state == ViewState.ErrorLocal) { DrAppToastMsg.showErrorToast(model.error); } else { - DrAppToastMsg.showErrorToast( - "Empty List"); + DrAppToastMsg.showErrorToast("Empty List"); } }, ), @@ -191,20 +161,13 @@ class _AdmissionRequestThirdScreenState AppTextFieldCustom( height: screenSize.height * 0.075, hintText: TranslationBase.of(context).diagnoseType, - dropDownText: _selectedDiagnosisType != null - ? _selectedDiagnosisType['description'] - : null, + dropDownText: _selectedDiagnosisType != null ? _selectedDiagnosisType['description'] : null, enabled: false, isTextFieldHasSuffix: true, validationError: diagnosisTypeError, - onClick: model.listOfDiagnosisSelectionTypes != - null && - model.listOfDiagnosisSelectionTypes.length > - 0 + onClick: model.listOfDiagnosisSelectionTypes != null && model.listOfDiagnosisSelectionTypes.length > 0 ? () { - openListDialogField('description', 'code', - model.listOfDiagnosisSelectionTypes, - (selectedValue) { + openListDialogField('description', 'code', model.listOfDiagnosisSelectionTypes, (selectedValue) { setState(() { _selectedDiagnosisType = selectedValue; }); @@ -212,30 +175,17 @@ class _AdmissionRequestThirdScreenState } : () async { GifLoaderDialogUtils.showMyDialog(context); - await model - .getMasterLookup(MasterKeysService - .DiagnosisSelectionType) - .then((_) => - GifLoaderDialogUtils.hideDialog( - context)); - if (model.state == ViewState.Idle && - model.listOfDiagnosisSelectionTypes - .length > - 0) { - openListDialogField('description', 'code', - model.listOfDiagnosisSelectionTypes, - (selectedValue) { + await model.getMasterLookup(MasterKeysService.DiagnosisSelectionType).then((_) => GifLoaderDialogUtils.hideDialog(context)); + if (model.state == ViewState.Idle && model.listOfDiagnosisSelectionTypes.length > 0) { + openListDialogField('description', 'code', model.listOfDiagnosisSelectionTypes, (selectedValue) { setState(() { - _selectedDiagnosisType = - selectedValue; + _selectedDiagnosisType = selectedValue; }); }); - } else if (model.state == - ViewState.ErrorLocal) { + } else if (model.state == ViewState.ErrorLocal) { DrAppToastMsg.showErrorToast(model.error); } else { - DrAppToastMsg.showErrorToast( - "Empty List"); + DrAppToastMsg.showErrorToast("Empty List"); } }, ), @@ -274,62 +224,49 @@ class _AdmissionRequestThirdScreenState eventCategory: "Admission Request Third Screen", eventAction: "Submit Admission Request", ); - if (_selectedDiagnosis != null && - _selectedIcd != null && - _selectedDiagnosisType != null) { + if (_selectedDiagnosis != null && _selectedIcd != null && _selectedDiagnosisType != null) { model.admissionRequestData = admissionRequest; dynamic admissionRequestDiagnoses = [ { - 'diagnosisDescription': - _selectedDiagnosis['nameEn'], + 'diagnosisDescription': _selectedDiagnosis['nameEn'], 'diagnosisType': _selectedDiagnosis['id'], 'icdCode': _selectedIcd['code'], - 'icdCodeDescription': - _selectedIcd['description'], + 'icdCodeDescription': _selectedIcd['description'], 'type': _selectedDiagnosisType['code'], 'remarks': "", 'isActive': true, } ]; - model.admissionRequestData - .admissionRequestDiagnoses = - admissionRequestDiagnoses; + model.admissionRequestData!.admissionRequestDiagnoses = admissionRequestDiagnoses; await model.makeAdmissionRequest(); if (model.state == ViewState.ErrorLocal) { DrAppToastMsg.showErrorToast(model.error); } else { - DrAppToastMsg.showSuccesToast( - TranslationBase.of(context) - .admissionRequestSuccessMsg); - Navigator.popUntil(context, - ModalRoute.withName(PATIENTS_PROFILE)); + DrAppToastMsg.showSuccesToast(TranslationBase.of(context).admissionRequestSuccessMsg); + Navigator.popUntil(context, ModalRoute.withName(PATIENTS_PROFILE)); } } else { - DrAppToastMsg.showErrorToast( - TranslationBase.of(context).pleaseFill); + DrAppToastMsg.showErrorToast(TranslationBase.of(context).pleaseFill); setState(() { if (_selectedDiagnosis == null) { - diagnosisError = - TranslationBase.of(context).fieldRequired; + diagnosisError = TranslationBase.of(context).fieldRequired; } else { - diagnosisError = null; + diagnosisError = ""; } if (_selectedIcd == null) { - icdError = - TranslationBase.of(context).fieldRequired; + icdError = TranslationBase.of(context).fieldRequired; } else { - icdError = null; + icdError = ""; } if (_selectedDiagnosisType == null) { - diagnosisTypeError = - TranslationBase.of(context).fieldRequired; + diagnosisTypeError = TranslationBase.of(context).fieldRequired; } else { - diagnosisTypeError = null; + diagnosisTypeError = ""; } }); } @@ -344,100 +281,87 @@ class _AdmissionRequestThirdScreenState ), bottomSheet: BottomSheetContainer( widget: Row( - children: [ - Container( - width: MediaQuery.of(context).size.width * 0.4, - child: AppButton( - title: TranslationBase.of(context).previous, - color: HexColor("#EAEAEA"), - fontColor: Colors.black, - onPressed: () { - Navigator.pop(context); - }, - ), - ), - SizedBox(width: 10,), - Container( - width: MediaQuery.of(context).size.width * 0.4, - child: AppButton( - title: TranslationBase.of(context).submit, - color: HexColor("#359846"), - onPressed: () async { - await locator().logEvent( - eventCategory: "Admission Request Third Screen", - eventAction: "Submit Admission Request", - ); - if (_selectedDiagnosis != null && - _selectedIcd != null && - _selectedDiagnosisType != null) { - model.admissionRequestData = admissionRequest; + children: [ + Container( + width: MediaQuery.of(context).size.width * 0.4, + child: AppButton( + title: TranslationBase.of(context).previous, + color: HexColor("#EAEAEA"), + fontColor: Colors.black, + onPressed: () { + Navigator.pop(context); + }, + ), + ), + SizedBox( + width: 10, + ), + Container( + width: MediaQuery.of(context).size.width * 0.4, + child: AppButton( + title: TranslationBase.of(context).submit, + color: HexColor("#359846"), + onPressed: () async { + await locator().logEvent( + eventCategory: "Admission Request Third Screen", + eventAction: "Submit Admission Request", + ); + if (_selectedDiagnosis != null && _selectedIcd != null && _selectedDiagnosisType != null) { + model.admissionRequestData = admissionRequest; - dynamic admissionRequestDiagnoses = [ - { - 'diagnosisDescription': - _selectedDiagnosis['nameEn'], - 'diagnosisType': _selectedDiagnosis['id'], - 'icdCode': _selectedIcd['code'], - 'icdCodeDescription': - _selectedIcd['description'], - 'type': _selectedDiagnosisType['code'], - 'remarks': "", - 'isActive': true, - } - ]; - model.admissionRequestData - .admissionRequestDiagnoses = - admissionRequestDiagnoses; + dynamic admissionRequestDiagnoses = [ + { + 'diagnosisDescription': _selectedDiagnosis['nameEn'], + 'diagnosisType': _selectedDiagnosis['id'], + 'icdCode': _selectedIcd['code'], + 'icdCodeDescription': _selectedIcd['description'], + 'type': _selectedDiagnosisType['code'], + 'remarks': "", + 'isActive': true, + } + ]; + model.admissionRequestData!.admissionRequestDiagnoses = admissionRequestDiagnoses; - await model.makeAdmissionRequest(); - if (model.state == ViewState.ErrorLocal) { - DrAppToastMsg.showErrorToast(model.error); - } else { - DrAppToastMsg.showSuccesToast( - TranslationBase.of(context) - .admissionRequestSuccessMsg); - Navigator.popUntil(context, - ModalRoute.withName(PATIENTS_PROFILE)); - } - } else { - DrAppToastMsg.showErrorToast( - TranslationBase.of(context).pleaseFill); + await model.makeAdmissionRequest(); + if (model.state == ViewState.ErrorLocal) { + DrAppToastMsg.showErrorToast(model.error); + } else { + DrAppToastMsg.showSuccesToast(TranslationBase.of(context).admissionRequestSuccessMsg); + Navigator.popUntil(context, ModalRoute.withName(PATIENTS_PROFILE)); + } + } else { + DrAppToastMsg.showErrorToast(TranslationBase.of(context).pleaseFill); - setState(() { - if (_selectedDiagnosis == null) { - diagnosisError = - TranslationBase.of(context).fieldRequired; - } else { - diagnosisError = null; - } + setState(() { + if (_selectedDiagnosis == null) { + diagnosisError = TranslationBase.of(context).fieldRequired; + } else { + diagnosisError = ""; + } - if (_selectedIcd == null) { - icdError = - TranslationBase.of(context).fieldRequired; - } else { - icdError = null; - } + if (_selectedIcd == null) { + icdError = TranslationBase.of(context).fieldRequired; + } else { + icdError = ""; + } - if (_selectedDiagnosisType == null) { - diagnosisTypeError = - TranslationBase.of(context).fieldRequired; - } else { - diagnosisTypeError = null; - } - }); + if (_selectedDiagnosisType == null) { + diagnosisTypeError = TranslationBase.of(context).fieldRequired; + } else { + diagnosisTypeError = ""; } - }, - ), - ), - ], - ) - ), + }); + } + }, + ), + ), + ], + )), ), ); } - void openListDialogField(String attributeName, String attributeValueId, - List list, Function(dynamic selectedValue) okFunction) { + void openListDialogField(String attributeName, String attributeValueId, List list, Function(dynamic selectedValue) okFunction) { ListSelectDialog dialog = ListSelectDialog( list: list, attributeName: attributeName, diff --git a/lib/screens/patients/profile/diabetic_chart/diabetic_chart.dart b/lib/screens/patients/profile/diabetic_chart/diabetic_chart.dart index 2b85cdb3..bb804d06 100644 --- a/lib/screens/patients/profile/diabetic_chart/diabetic_chart.dart +++ b/lib/screens/patients/profile/diabetic_chart/diabetic_chart.dart @@ -22,7 +22,7 @@ import 'diabetic_details_blood_pressurewideget.dart'; class DiabeticChart extends StatefulWidget { DiabeticChart({ - Key key, + Key? key, }) : super(key: key); @override @@ -38,25 +38,21 @@ class _DiabeticChartState extends State { DiabeticType(nameAr: "Urine Glucose", nameEn: "Urine Glucose", value: 1), DiabeticType(nameAr: "Urine Acet", nameEn: "Urine Acet", value: 2), DiabeticType(nameAr: "Blood Glucose", nameEn: "Blood Glucose", value: 3), - DiabeticType( - nameAr: "Blood Glucose(Glucometer)", - nameEn: "Blood Glucose(Glucometer)", - value: 4) + DiabeticType(nameAr: "Blood Glucose(Glucometer)", nameEn: "Blood Glucose(Glucometer)", value: 4) ]; - DiabeticType selectedDiabeticType; + DiabeticType selectedDiabeticType = DiabeticType(); @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']; ProjectViewModel projectsProvider = Provider.of(context); return BaseView( onModelReady: (model) async { selectedDiabeticType = diabeticType[2]; - await model.getDiabeticChartValues(patient, selectedDiabeticType.value, - isLocalBusy: false); + await model.getDiabeticChartValues(patient, selectedDiabeticType.value!, isLocalBusy: false); generateData(model); }, builder: (_, model, w) => AppScaffold( @@ -103,18 +99,13 @@ class _DiabeticChartState extends State { child: AppText( diabeticType.length.toString(), color: Colors.white, - fontSize: - projectsProvider.isArabic ? 10 : 11, + fontSize: projectsProvider.isArabic ? 10 : 11, textAlign: TextAlign.center, ), )), ], ), - AppText(selectedDiabeticType.nameEn, - fontSize: 12, - color: Colors.black, - fontWeight: FontWeight.bold, - textAlign: TextAlign.end), + AppText(selectedDiabeticType.nameEn!, fontSize: 12, color: Colors.black, fontWeight: FontWeight.bold, textAlign: TextAlign.end), ], ); }).toList(); @@ -126,7 +117,7 @@ class _DiabeticChartState extends State { items: diabeticType.map((item) { return DropdownMenuItem( child: AppText( - item.nameEn, + item.nameEn!, textAlign: TextAlign.left, ), value: item.value, @@ -142,11 +133,9 @@ class _DiabeticChartState extends State { children: [ Container( margin: EdgeInsets.symmetric(horizontal: 8), - decoration: BoxDecoration( - color: Colors.white, - borderRadius: BorderRadius.circular(12)), + decoration: BoxDecoration(color: Colors.white, borderRadius: BorderRadius.circular(12)), child: LineChartForDiabetic( - title: selectedDiabeticType.nameEn, + title: selectedDiabeticType.nameEn!, isOX: false, timeSeries1: timeSeriesData1, // timeSeries2: timeSeriesData2, @@ -154,19 +143,15 @@ class _DiabeticChartState extends State { ), ), Container( - margin: EdgeInsets.symmetric( - horizontal: 8, vertical: 16), - padding: EdgeInsets.only( - top: 16, right: 18.0, left: 16.0), - decoration: BoxDecoration( - color: Colors.white, - borderRadius: BorderRadius.circular(12)), + margin: EdgeInsets.symmetric(horizontal: 8, vertical: 16), + padding: EdgeInsets.only(top: 16, right: 18.0, left: 16.0), + decoration: BoxDecoration(color: Colors.white, borderRadius: BorderRadius.circular(12)), child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ AppText( TranslationBase.of(context).graphDetails, - fontSize: SizeConfig.textMultiplier * 2.3, + fontSize: SizeConfig.textMultiplier! * 2.3, fontWeight: FontWeight.bold, fontFamily: 'Poppins', ), @@ -174,8 +159,7 @@ class _DiabeticChartState extends State { height: 8, ), DiabeticDetails( - diabeticDetailsList: - model.diabeticChartValuesList, + diabeticDetailsList: model.diabeticChartValuesList, ), ], ), @@ -183,9 +167,7 @@ class _DiabeticChartState extends State { ], ), ) - : Center( - child: ErrorMessage( - error: TranslationBase.of(context).noItem)), + : Center(child: ErrorMessage(error: TranslationBase.of(context).noItem)), ], ), )), @@ -196,22 +178,19 @@ class _DiabeticChartState extends State { if (model.diabeticChartValuesList.length > 0) { model.diabeticChartValuesList.toList().forEach( (element) { - DateTime elementDate = - AppDateUtils.getDateTimeFromServerFormat(element.dateChart); - if (element.resultValue.toInt() != 0) + DateTime elementDate = AppDateUtils.getDateTimeFromServerFormat(element.dateChart!); + if (element.resultValue!.toInt() != 0) timeSeriesData1.add( TimeSeriesSales2( - new DateTime( - elementDate.year, elementDate.month, elementDate.day), - element.resultValue.toDouble(), + new DateTime(elementDate.year, elementDate.month, elementDate.day), + element.resultValue!.toDouble(), ), ); - if (element.resultValue.toInt() != 0) + if (element.resultValue!.toInt() != 0) timeSeriesData2.add( TimeSeriesSales2( - new DateTime( - elementDate.year, elementDate.month, elementDate.day), - element.resultValue.toDouble(), + new DateTime(elementDate.year, elementDate.month, elementDate.day), + element.resultValue!.toDouble(), ), ); }, @@ -227,8 +206,7 @@ class _DiabeticChartState extends State { timeSeriesData2.clear(); }); - await model.getDiabeticChartValues(patient, selectedDiabeticType.value, - isLocalBusy: true); + await model.getDiabeticChartValues(patient, selectedDiabeticType.value!, isLocalBusy: true); if (model.state == ViewState.ErrorLocal) { Utils.showErrorToast(model.error); } diff --git a/lib/screens/patients/profile/diabetic_chart/diabetic_details_blood_pressurewideget.dart b/lib/screens/patients/profile/diabetic_chart/diabetic_details_blood_pressurewideget.dart index b085008b..3daced66 100644 --- a/lib/screens/patients/profile/diabetic_chart/diabetic_details_blood_pressurewideget.dart +++ b/lib/screens/patients/profile/diabetic_chart/diabetic_details_blood_pressurewideget.dart @@ -10,10 +10,10 @@ import 'package:flutter/material.dart'; import 'package:provider/provider.dart'; class DiabeticDetails extends StatefulWidget { - final List diabeticDetailsList; + final List? diabeticDetailsList; DiabeticDetails({ - Key key, + Key? key, this.diabeticDetailsList, }); @@ -40,7 +40,7 @@ class _VitalSignDetailsWidgetState extends State { padding: EdgeInsets.all(8), child: AppText( TranslationBase.of(context).date, - fontSize: SizeConfig.textMultiplier * 1.5, + fontSize: SizeConfig.textMultiplier! * 1.5, fontWeight: FontWeight.bold, fontFamily: 'Poppins', ), @@ -54,7 +54,7 @@ class _VitalSignDetailsWidgetState extends State { child: Container( child: AppText( "Result", - fontSize: SizeConfig.textMultiplier * 1.5, + fontSize: SizeConfig.textMultiplier! * 1.5, fontWeight: FontWeight.bold, fontFamily: 'Poppins', ), @@ -72,7 +72,7 @@ class _VitalSignDetailsWidgetState extends State { Table( border: TableBorder( horizontalInside: - BorderSide(width: 1.0, color: Colors.grey[300]), + BorderSide(width: 1.0, color: Colors.grey[300]!), ), children: fullData(projectViewModel), ), @@ -84,10 +84,10 @@ class _VitalSignDetailsWidgetState extends State { List fullData(ProjectViewModel projectViewModel) { List tableRow = []; - widget.diabeticDetailsList.forEach((diabetic) { + widget.diabeticDetailsList!.forEach((diabetic) { var data = diabetic.resultValue; DateTime elementDate = - AppDateUtils.getDateTimeFromServerFormat(diabetic.dateChart); + AppDateUtils.getDateTimeFromServerFormat(diabetic.dateChart!); if (data != 0) tableRow.add(TableRow(children: [ Container( @@ -97,7 +97,7 @@ class _VitalSignDetailsWidgetState extends State { child: AppText( '${projectViewModel.isArabic ? AppDateUtils.getWeekDayArabic(elementDate.weekday) : AppDateUtils.getWeekDay(elementDate.weekday)}, ${elementDate.day} ${projectViewModel.isArabic ? AppDateUtils.getMonthArabic(elementDate.month) : AppDateUtils.getMonth(elementDate.month)}, ${elementDate.year} ${AppDateUtils.getHour(elementDate)}', // textAlign: TextAlign.center, - fontSize: SizeConfig.textMultiplier * 1.6, + fontSize: SizeConfig.textMultiplier! * 1.6, fontWeight: FontWeight.w600, fontFamily: 'Poppins', @@ -111,7 +111,7 @@ class _VitalSignDetailsWidgetState extends State { child: AppText( '${diabetic.resultValue}', // textAlign: TextAlign.center, - fontSize: SizeConfig.textMultiplier * 1.6, + fontSize: SizeConfig.textMultiplier! * 1.6, fontWeight: FontWeight.w600, fontFamily: 'Poppins', diff --git a/lib/screens/patients/profile/diabetic_chart/line_chart_for_diabetic.dart b/lib/screens/patients/profile/diabetic_chart/line_chart_for_diabetic.dart index 093a5f69..a7966c85 100644 --- a/lib/screens/patients/profile/diabetic_chart/line_chart_for_diabetic.dart +++ b/lib/screens/patients/profile/diabetic_chart/line_chart_for_diabetic.dart @@ -5,16 +5,15 @@ import 'package:fl_chart/fl_chart.dart'; import 'package:flutter/material.dart'; class LineChartForDiabetic extends StatelessWidget { - final String title; - final List timeSeries1; - final int indexes; + final String? title; + final List? timeSeries1; + final int? indexes; final bool isOX; - LineChartForDiabetic( - {this.title, this.timeSeries1, this.indexes, this.isOX = false}); + LineChartForDiabetic({this.title, this.timeSeries1, this.indexes, this.isOX = false}); - List xAxixs = List(); - List yAxixs = List(); + List xAxixs = []; + List yAxixs = []; @override Widget build(BuildContext context) { @@ -38,8 +37,8 @@ class LineChartForDiabetic extends StatelessWidget { crossAxisAlignment: CrossAxisAlignment.start, children: [ AppText( - title, - fontSize: SizeConfig.textMultiplier * 2.1, + title!, + fontSize: SizeConfig.textMultiplier! * 2.1, fontWeight: FontWeight.bold, fontFamily: 'Poppins', textAlign: TextAlign.center, @@ -52,11 +51,10 @@ class LineChartForDiabetic extends StatelessWidget { ), Expanded( child: Padding( - padding: - const EdgeInsets.only(right: 18.0, left: 16.0, top: 15), + padding: const EdgeInsets.only(right: 18.0, left: 16.0, top: 15), child: LineChart( sampleData1(context), - swapAnimationDuration: const Duration(milliseconds: 250), + duration: const Duration(milliseconds: 250), ), ), ), @@ -70,9 +68,9 @@ class LineChartForDiabetic extends StatelessWidget { } getXaxix() { - for (int index = 0; index < timeSeries1.length; index++) { - int mIndex = indexes * index; - if (mIndex < timeSeries1.length) { + for (int index = 0; index < timeSeries1!.length; index++) { + int mIndex = indexes! * index; + if (mIndex < timeSeries1!.length) { xAxixs.add(mIndex); } } @@ -84,48 +82,80 @@ class LineChartForDiabetic extends StatelessWidget { touchTooltipData: LineTouchTooltipData( tooltipBgColor: Colors.white, ), - touchCallback: (LineTouchResponse touchResponse) {}, + touchCallback: (FlTouchEvent event, LineTouchResponse? touchResponse) {}, handleBuiltInTouches: true, ), - gridData: FlGridData( - show: true, drawVerticalLine: true, drawHorizontalLine: true), + gridData: FlGridData(show: true, drawVerticalLine: true, drawHorizontalLine: true), titlesData: FlTitlesData( - bottomTitles: SideTitles( + bottomTitles: AxisTitles( + sideTitles: SideTitles( showTitles: true, - getTextStyles: (context, value) { - return TextStyle( - color: Colors.black, - fontSize: 10, - ); - }, - rotateAngle: -65, - //rotateAngle:-65, - interval: 100, - margin: 22, - getTitles: (value) { - if (timeSeries1.length < 15) { - if (timeSeries1.length > value.toInt()) { - return '${timeSeries1[value.toInt()].time.month}/ ${timeSeries1[value.toInt()].time.year}'; + getTitlesWidget: (value, meta) { + if (timeSeries1!.length < 15) { + if (timeSeries1!.length > value.toInt()) { + return Text( + '${timeSeries1![value.toInt()].time.month}/ ${timeSeries1![value.toInt()].time.year}', + style: TextStyle( + color: Colors.black, + fontSize: 10, + ), + ); } else - return ''; + return Text(""); } else { if (value.toInt() == 0) - return '${timeSeries1[value.toInt()].time.month}/ ${timeSeries1[value.toInt()].time.year}'; - if (value.toInt() == timeSeries1.length - 1) - return '${timeSeries1[value.toInt()].time.month}/ ${timeSeries1[value.toInt()].time.year}'; + return Text( + '${timeSeries1![value.toInt()].time.month}/ ${timeSeries1![value.toInt()].time.year}', + style: TextStyle( + color: Colors.black, + fontSize: 10, + ), + ); + if (value.toInt() == timeSeries1!.length - 1) + return Text( + '${timeSeries1![value.toInt()].time.month}/ ${timeSeries1![value.toInt()].time.year}', + style: TextStyle( + color: Colors.black, + fontSize: 10, + ), + ); if (xAxixs.contains(value.toInt())) { - return '${timeSeries1[value.toInt()].time.month}/ ${timeSeries1[value.toInt()].time.year}'; + return Text( + '${timeSeries1![value.toInt()].time.month}/ ${timeSeries1![value.toInt()].time.year}', + style: TextStyle( + color: Colors.black, + fontSize: 10, + ), + ); } } - return ''; + return Text( + "", + style: TextStyle( + color: Colors.black, + fontSize: 10, + ), + ); }, - ), - leftTitles: SideTitles( + // rotateAngle: -65, + //rotateAngle:-65, + interval: 100, + reservedSize: 22, + // getTitles: (value) { + // + // }, + )), + leftTitles: AxisTitles( + sideTitles: SideTitles( showTitles: true, - getTextStyles: (context, value) { - return TextStyle( - color: Colors.black, - fontSize: 10, + // getTextStyles: + getTitlesWidget: (val, MetaVal) { + return Text( + "", + style: TextStyle( + color: Colors.black, + fontSize: 10, + ), ); }, interval: getMaxY() - getMinY() <= 500 @@ -133,8 +163,8 @@ class LineChartForDiabetic extends StatelessWidget { : getMaxY() - getMinY() <= 1000 ? 100 : 200, - margin: 12, - ), + reservedSize: 12, + )), ), borderData: FlBorderData( show: true, @@ -155,7 +185,7 @@ class LineChartForDiabetic extends StatelessWidget { ), ), minX: 0, - maxX: (timeSeries1.length - 1).toDouble(), + maxX: (timeSeries1!.length - 1).toDouble(), maxY: getMaxY() + 0.3, minY: getMinY(), lineBarsData: getData(context), @@ -164,8 +194,8 @@ class LineChartForDiabetic extends StatelessWidget { double getMaxY() { double max = 0; - timeSeries1.forEach((element) { - double resultValueDouble = element.sales; + timeSeries1!.forEach((element) { + double resultValueDouble = element.sales!; if (resultValueDouble > max) max = resultValueDouble; }); // timeSeries2.forEach((element) { @@ -177,9 +207,9 @@ class LineChartForDiabetic extends StatelessWidget { } double getMinY() { - double min = timeSeries1[0].sales; - timeSeries1.forEach((element) { - double resultValueDouble = element.sales; + double min = timeSeries1![0].sales!; + timeSeries1!.forEach((element) { + double resultValueDouble = element.sales!; if (resultValueDouble < min) min = resultValueDouble; }); // timeSeries2.forEach((element) { @@ -193,12 +223,12 @@ class LineChartForDiabetic extends StatelessWidget { } List getData(context) { - List spots = List(); - for (int index = 0; index < timeSeries1.length; index++) { - spots.add(FlSpot(index.toDouble(), timeSeries1[index].sales)); + List spots = []; + for (int index = 0; index < timeSeries1!.length; index++) { + spots.add(FlSpot(index.toDouble(), timeSeries1![index].sales!)); } - List spots2 = List(); + List spots2 = []; // for (int index = 0; index < timeSeries2.length; index++) { // spots2.add(FlSpot(index.toDouble(), timeSeries2[index].sales)); // } @@ -206,7 +236,7 @@ class LineChartForDiabetic extends StatelessWidget { final LineChartBarData lineChartBarData1 = LineChartBarData( spots: spots, isCurved: true, - colors: [Colors.red], + color: Colors.red, barWidth: 5, isStrokeCapRound: true, dotData: FlDotData( @@ -219,7 +249,7 @@ class LineChartForDiabetic extends StatelessWidget { final LineChartBarData lineChartBarData2 = LineChartBarData( spots: spots2, isCurved: true, - colors: [Colors.red], + color: Colors.red, barWidth: 5, isStrokeCapRound: true, dotData: FlDotData( @@ -230,7 +260,7 @@ class LineChartForDiabetic extends StatelessWidget { ), ); - List lineChartData = List(); + List lineChartData = []; if (spots.isNotEmpty) { lineChartData.add(lineChartBarData1); } diff --git a/lib/screens/patients/profile/diagnosis/diagnosis_screen.dart b/lib/screens/patients/profile/diagnosis/diagnosis_screen.dart index d7fbc46f..06194156 100644 --- a/lib/screens/patients/profile/diagnosis/diagnosis_screen.dart +++ b/lib/screens/patients/profile/diagnosis/diagnosis_screen.dart @@ -19,7 +19,7 @@ import 'package:provider/provider.dart'; DrAppSharedPreferances sharedPref = new DrAppSharedPreferances(); class DiagnosisScreen extends StatefulWidget { - const DiagnosisScreen({Key key}) : super(key: key); + const DiagnosisScreen({Key? key}) : super(key: key); @override _ProgressNoteState createState() => _ProgressNoteState(); @@ -27,19 +27,19 @@ class DiagnosisScreen extends StatefulWidget { class _ProgressNoteState extends State { bool isDischargedPatient = false; - AuthenticationViewModel authenticationViewModel; - ProjectViewModel projectViewModel; + AuthenticationViewModel authenticationViewModel = AuthenticationViewModel(); + late ProjectViewModel projectViewModel; getDiagnosisForInPatient(BuildContext context, PatientViewModel model, {bool isLocalBusy = false}) async { - final routeArgs = ModalRoute.of(context).settings.arguments as Map; + final routeArgs = ModalRoute.of(context)!.settings.arguments as Map; PatiantInformtion patient = routeArgs['patient']; String type = await sharedPref.getString(SLECTED_PATIENT_TYPE); print(type); GetDiagnosisForInPatientRequestModel getDiagnosisForInPatientRequestModel = GetDiagnosisForInPatientRequestModel( - admissionNo: int.parse(patient.admissionNo), + admissionNo: int.parse(patient.admissionNo!), patientTypeID: patient.patientType, patientID: patient.patientId, setupID: "010266"); @@ -50,7 +50,7 @@ class _ProgressNoteState extends State { Widget build(BuildContext context) { authenticationViewModel = Provider.of(context); projectViewModel = Provider.of(context); - final routeArgs = ModalRoute.of(context).settings.arguments as Map; + final routeArgs = ModalRoute.of(context)!.settings.arguments as Map; PatiantInformtion patient = routeArgs['patient']; if (routeArgs.containsKey('isDischargedPatient')) isDischargedPatient = routeArgs['isDischargedPatient']; @@ -151,7 +151,7 @@ class _ProgressNoteState extends State { .getDateTimeFromServerFormat(model .diagnosisForInPatientList[ index] - .createdOn), + .createdOn!), isArabic: projectViewModel .isArabic, @@ -177,7 +177,7 @@ class _ProgressNoteState extends State { .getDateTimeFromServerFormat(model .diagnosisForInPatientList[ index] - .createdOn)) + .createdOn!)) : AppDateUtils.getHour( DateTime.now()), fontWeight: FontWeight.w600, @@ -208,7 +208,7 @@ class _ProgressNoteState extends State { model .diagnosisForInPatientList[ index] - .iCDCode10ID, + .iCDCode10ID!, fontSize: 12, isCopyable: true, ), @@ -230,7 +230,7 @@ class _ProgressNoteState extends State { model .diagnosisForInPatientList[ index] - .asciiDesc, + .asciiDesc!, fontSize: 12, isCopyable: true, ), diff --git a/lib/screens/patients/profile/discharge_summary/all_discharge_summary.dart b/lib/screens/patients/profile/discharge_summary/all_discharge_summary.dart index d9cab95b..c4bf99a2 100644 --- a/lib/screens/patients/profile/discharge_summary/all_discharge_summary.dart +++ b/lib/screens/patients/profile/discharge_summary/all_discharge_summary.dart @@ -10,8 +10,8 @@ import 'package:flutter/material.dart'; import 'discharge_Summary_widget.dart'; class AllDischargeSummary extends StatefulWidget { - final Function changeCurrentTab; - final PatiantInformtion patient; + final Function? changeCurrentTab; + final PatiantInformtion? patient; const AllDischargeSummary({this.changeCurrentTab, this.patient}); @@ -27,8 +27,8 @@ class _AllDischargeSummaryState extends State { return BaseView( onModelReady: (model) { model.getAllDischargeSummary( - patientId: widget.patient.patientId, - admissionNo: int.parse(widget.patient.admissionNo), + patientId: widget.patient!.patientId!, + admissionNo: int.parse(widget.patient!.admissionNo!), ); }, builder: (_, model, w) => AppScaffold( diff --git a/lib/screens/patients/profile/discharge_summary/discharge_Summary_widget.dart b/lib/screens/patients/profile/discharge_summary/discharge_Summary_widget.dart index 245f32c5..140a72e2 100644 --- a/lib/screens/patients/profile/discharge_summary/discharge_Summary_widget.dart +++ b/lib/screens/patients/profile/discharge_summary/discharge_Summary_widget.dart @@ -15,7 +15,7 @@ class DischargeSummaryWidget extends StatefulWidget { final GetDischargeSummaryResModel dischargeSummary; bool isShowMore = false; - DischargeSummaryWidget({Key key, this.dischargeSummary}); + DischargeSummaryWidget({Key? key, required this.dischargeSummary}); @override _DischargeSummaryWidgetState createState() => _DischargeSummaryWidgetState(); @@ -39,7 +39,7 @@ class _DischargeSummaryWidgetState extends State { borderRadius: BorderRadius.all( Radius.circular(10.0), ), - border: Border.all(color: Colors.grey[200], width: 0.5), + border: Border.all(color: Colors.grey[200]!, width: 0.5), ), child: Padding( padding: EdgeInsets.all(15.0), @@ -52,41 +52,26 @@ class _DischargeSummaryWidgetState extends State { children: [ CustomRow( label: TranslationBase.of(context).doctorName + ": ", - value: - widget.dischargeSummary.createdByName.toString() ?? - "".toString(), + value: widget.dischargeSummary.createdByName.toString() ?? "".toString(), isCopyable: false, ), CustomRow( label: TranslationBase.of(context).branch + ": ", - value: widget.dischargeSummary.projectName.toString() ?? - "".toString(), + value: widget.dischargeSummary.projectName.toString() ?? "".toString(), isCopyable: false, ), CustomRow( label: TranslationBase.of(context).clinicName + ": ", - value: widget.dischargeSummary.clinicName.toString() ?? - "".toString(), + value: widget.dischargeSummary.clinicName.toString() ?? "".toString(), isCopyable: false, ), CustomRow( label: TranslationBase.of(context).dischargeDate + ": ", - value: AppDateUtils.getDateTimeFromServerFormat( - widget.dischargeSummary.createdOn) - .day - .toString() + + value: AppDateUtils.getDateTimeFromServerFormat(widget.dischargeSummary.createdOn!).day.toString() + " " + - AppDateUtils.getMonth( - AppDateUtils.getDateTimeFromServerFormat( - widget.dischargeSummary.createdOn) - .month) - .toString() - .substring(0, 3) + + AppDateUtils.getMonth(AppDateUtils.getDateTimeFromServerFormat(widget.dischargeSummary.createdOn!).month).toString().substring(0, 3) + ' ' + - AppDateUtils.getDateTimeFromServerFormat( - widget.dischargeSummary.createdOn) - .year - .toString(), + AppDateUtils.getDateTimeFromServerFormat(widget.dischargeSummary.createdOn!).year.toString(), isCopyable: false, ), ], @@ -100,9 +85,7 @@ class _DischargeSummaryWidgetState extends State { isCardExpanded = !isCardExpanded; }); }, - child: Icon(isCardExpanded - ? EvaIcons.arrowUp - : EvaIcons.arrowDown)) + child: Icon(isCardExpanded ? EvaIcons.arrowUp : EvaIcons.arrowDown)) ], ), ], @@ -124,29 +107,20 @@ class _DischargeSummaryWidgetState extends State { maxLines: 3, overflow: TextOverflow.ellipsis, text: new TextSpan( - style: new TextStyle( - fontSize: 1.3 * SizeConfig.textMultiplier, - color: Color(0xFF575757)), + style: new TextStyle(fontSize: 1.3 * SizeConfig.textMultiplier!, color: Color(0xFF575757)), children: [ new TextSpan( - text: TranslationBase.of(context) - .pastMedicalHistory + - ": ", + text: TranslationBase.of(context).pastMedicalHistory + ": ", style: TextStyle( - fontSize: SizeConfig - .getTextMultiplierBasedOnWidth() * - 2.8, + fontSize: SizeConfig.getTextMultiplierBasedOnWidth() * 2.8, color: Color(0xFF575757), //TranslationBase.of(context).doctorResponse + " : ", )), new TextSpan( - text: Utils.parseHtmlString( - widget.dischargeSummary.pastHistory), + text: Utils.parseHtmlString(widget.dischargeSummary.pastHistory!), style: TextStyle( fontFamily: 'Poppins', - fontSize: SizeConfig - .getTextMultiplierBasedOnWidth() * - 3, + fontSize: SizeConfig.getTextMultiplierBasedOnWidth() * 3, color: Color(0xFF2E303A), fontWeight: FontWeight.w700, )), @@ -163,30 +137,20 @@ class _DischargeSummaryWidgetState extends State { maxLines: 3, overflow: TextOverflow.ellipsis, text: new TextSpan( - style: new TextStyle( - fontSize: 1.3 * SizeConfig.textMultiplier, - color: Color(0xFF575757)), + style: new TextStyle(fontSize: 1.3 * SizeConfig.textMultiplier!, color: Color(0xFF575757)), children: [ new TextSpan( - text: TranslationBase.of(context) - .investigation + - ": ", + text: TranslationBase.of(context).investigation + ": ", style: TextStyle( - fontSize: SizeConfig - .getTextMultiplierBasedOnWidth() * - 2.8, + fontSize: SizeConfig.getTextMultiplierBasedOnWidth() * 2.8, color: Color(0xFF575757), //TranslationBase.of(context).doctorResponse + " : ", )), new TextSpan( - text: Utils.parseHtmlString( - widget.dischargeSummary.investigations ?? - ""), + text: Utils.parseHtmlString(widget.dischargeSummary.investigations ?? ""), style: TextStyle( fontFamily: 'Poppins', - fontSize: SizeConfig - .getTextMultiplierBasedOnWidth() * - 3, + fontSize: SizeConfig.getTextMultiplierBasedOnWidth() * 3, color: Color(0xFF2E303A), fontWeight: FontWeight.w700, )), @@ -203,29 +167,20 @@ class _DischargeSummaryWidgetState extends State { maxLines: 3, overflow: TextOverflow.ellipsis, text: new TextSpan( - style: new TextStyle( - fontSize: 1.3 * SizeConfig.textMultiplier, - color: Color(0xFF575757)), + style: new TextStyle(fontSize: 1.3 * SizeConfig.textMultiplier!, color: Color(0xFF575757)), children: [ new TextSpan( - text: TranslationBase.of(context) - .investigation + - ": ", + text: TranslationBase.of(context).investigation + ": ", style: TextStyle( - fontSize: SizeConfig - .getTextMultiplierBasedOnWidth() * - 2.8, + fontSize: SizeConfig.getTextMultiplierBasedOnWidth() * 2.8, color: Color(0xFF575757), //TranslationBase.of(context).doctorResponse + " : ", )), new TextSpan( - text: Utils.parseHtmlString(widget - .dischargeSummary.conditionOnDischarge), + text: Utils.parseHtmlString(widget.dischargeSummary.conditionOnDischarge!), style: TextStyle( fontFamily: 'Poppins', - fontSize: SizeConfig - .getTextMultiplierBasedOnWidth() * - 3, + fontSize: SizeConfig.getTextMultiplierBasedOnWidth() * 3, color: Color(0xFF2E303A), fontWeight: FontWeight.w700, )), @@ -242,29 +197,20 @@ class _DischargeSummaryWidgetState extends State { maxLines: 3, overflow: TextOverflow.ellipsis, text: new TextSpan( - style: new TextStyle( - fontSize: 1.3 * SizeConfig.textMultiplier, - color: Color(0xFF575757)), + style: new TextStyle(fontSize: 1.3 * SizeConfig.textMultiplier!, color: Color(0xFF575757)), children: [ new TextSpan( - text: TranslationBase.of(context) - .planedProcedure + - ": ", + text: TranslationBase.of(context).planedProcedure + ": ", style: TextStyle( - fontSize: SizeConfig - .getTextMultiplierBasedOnWidth() * - 2.8, + fontSize: SizeConfig.getTextMultiplierBasedOnWidth() * 2.8, color: Color(0xFF575757), //TranslationBase.of(context).doctorResponse + " : ", )), new TextSpan( - text: Utils.parseHtmlString( - widget.dischargeSummary.planedProcedure), + text: Utils.parseHtmlString(widget.dischargeSummary.planedProcedure!), style: TextStyle( fontFamily: 'Poppins', - fontSize: SizeConfig - .getTextMultiplierBasedOnWidth() * - 3, + fontSize: SizeConfig.getTextMultiplierBasedOnWidth() * 3, color: Color(0xFF2E303A), fontWeight: FontWeight.w700, )), diff --git a/lib/screens/patients/profile/discharge_summary/discharge_summary.dart b/lib/screens/patients/profile/discharge_summary/discharge_summary.dart index 010832a1..d674ea93 100644 --- a/lib/screens/patients/profile/discharge_summary/discharge_summary.dart +++ b/lib/screens/patients/profile/discharge_summary/discharge_summary.dart @@ -12,9 +12,9 @@ import 'all_discharge_summary.dart'; import 'pending_discharge_summary.dart'; class DischargeSummaryPage extends StatefulWidget { - final Function changeCurrentTab; + final Function? changeCurrentTab; - const DischargeSummaryPage({Key key, this.changeCurrentTab}) + const DischargeSummaryPage({Key? key, this.changeCurrentTab}) : super(key: key); @override @@ -23,7 +23,7 @@ class DischargeSummaryPage extends StatefulWidget { class _DoctorReplyScreenState extends State with SingleTickerProviderStateMixin { - TabController _tabController; + late TabController _tabController; int _activeTab = 0; int pageIndex = 1; @@ -49,12 +49,12 @@ class _DoctorReplyScreenState extends State @override Widget build(BuildContext context) { final screenSize = MediaQuery.of(context).size; - final routeArgs = ModalRoute.of(context).settings.arguments as Map; + final routeArgs = ModalRoute.of(context)!.settings.arguments as Map; PatiantInformtion patient = routeArgs['patient']; return WillPopScope( onWillPop: () async { - widget.changeCurrentTab(); + widget.changeCurrentTab!(); return false; }, child: AppScaffold( @@ -150,7 +150,7 @@ Widget tabWidget(Size screenSize, bool isActive, String title, children: [ AppText( title, - fontSize: SizeConfig.textMultiplier * 1.5, + fontSize: SizeConfig.textMultiplier! * 1.5, color: isActive ? Colors.white : Color(0xFF2B353E), fontWeight: FontWeight.w700, ), @@ -167,7 +167,7 @@ Widget tabWidget(Size screenSize, bool isActive, String title, child: FittedBox( child: AppText( "$counter", - fontSize: SizeConfig.textMultiplier * 1.5, + fontSize: SizeConfig.textMultiplier! * 1.5, color: !isActive ? Colors.white : Color(0xFFD02127), fontWeight: FontWeight.w700, ), diff --git a/lib/screens/patients/profile/discharge_summary/pending_discharge_summary.dart b/lib/screens/patients/profile/discharge_summary/pending_discharge_summary.dart index 211b5408..185420d7 100644 --- a/lib/screens/patients/profile/discharge_summary/pending_discharge_summary.dart +++ b/lib/screens/patients/profile/discharge_summary/pending_discharge_summary.dart @@ -10,10 +10,10 @@ import 'package:flutter/material.dart'; import 'discharge_Summary_widget.dart'; class PendingDischargeSummary extends StatefulWidget { - final Function changeCurrentTab; - final PatiantInformtion patient; + final Function? changeCurrentTab; + final PatiantInformtion? patient; - const PendingDischargeSummary({Key key, this.changeCurrentTab, this.patient}) + const PendingDischargeSummary({Key? key, this.changeCurrentTab, this.patient}) : super(key: key); @override @@ -29,8 +29,8 @@ class _PendingDischargeSummaryState extends State { return BaseView( onModelReady: (model) { model.getPendingDischargeSummary( - patientId: widget.patient.patientId, - admissionNo: int.parse(widget.patient.admissionNo), + patientId: widget.patient!.patientId!, + admissionNo: int.parse(widget.patient!.admissionNo!), ); }, builder: (_, model, w) => AppScaffold( diff --git a/lib/screens/patients/profile/lab_result/history/line_chart_curved_lab_history.dart b/lib/screens/patients/profile/lab_result/history/line_chart_curved_lab_history.dart index e07990b9..a87f8235 100644 --- a/lib/screens/patients/profile/lab_result/history/line_chart_curved_lab_history.dart +++ b/lib/screens/patients/profile/lab_result/history/line_chart_curved_lab_history.dart @@ -17,7 +17,7 @@ class LineChartCurvedLabHistory extends StatefulWidget { class LineChartCurvedLabHistoryState extends State { bool isShowingMainData; - List xAxixs = List(); + List xAxixs = []; int indexes = 0; @override @@ -200,7 +200,7 @@ class LineChartCurvedLabHistoryState extends State { } List getData() { - List spots = List(); + List spots = []; for (int index = 0; index < widget.labResultHistory.length; index++) { try { var resultValueDouble = diff --git a/lib/screens/patients/profile/notes/note/update_note.dart b/lib/screens/patients/profile/notes/note/update_note.dart index 71e86a4a..d4a78eca 100644 --- a/lib/screens/patients/profile/notes/note/update_note.dart +++ b/lib/screens/patients/profile/notes/note/update_note.dart @@ -239,7 +239,7 @@ class _UpdateNoteOrderState extends State { ), bottomSheet: Container( height: progressNoteController.text.isNotEmpty ? 130 : 70, - margin: EdgeInsets.all(SizeConfig.widthMultiplier * 5), + margin: EdgeInsets.all(SizeConfig.widthMultiplier! * 5), child: Column( children: [ if (progressNoteController.text.isNotEmpty) diff --git a/lib/screens/patients/profile/operation_report/update_operation_report.dart b/lib/screens/patients/profile/operation_report/update_operation_report.dart index 62536bb3..282ce990 100644 --- a/lib/screens/patients/profile/operation_report/update_operation_report.dart +++ b/lib/screens/patients/profile/operation_report/update_operation_report.dart @@ -523,7 +523,7 @@ class _UpdateOperationReportState extends State { ) : Container( height: 70, - margin: EdgeInsets.all(SizeConfig.widthMultiplier * 5), + margin: EdgeInsets.all(SizeConfig.widthMultiplier! * 5), child: Column( children: [ Container( 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 d12ec115..b1297892 100644 --- a/lib/screens/patients/profile/profile_screen/patient_profile_screen.dart +++ b/lib/screens/patients/profile/profile_screen/patient_profile_screen.dart @@ -248,7 +248,7 @@ class _PatientProfileScreenState extends State : AppGlobal.appRedColor, fontColor: Colors.white, // vPadding: 8, - height: SizeConfig.heightMultiplier * + height: SizeConfig.heightMultiplier! * (SizeConfig.isHeightVeryShort ? 9 : 6), radius: 30, hPadding: 25, @@ -286,7 +286,7 @@ class _PatientProfileScreenState extends State : AppGlobal.appRedColor, fontColor: Colors.white, // vPadding: 8, - height: SizeConfig.heightMultiplier * + height: SizeConfig.heightMultiplier! * (SizeConfig.isHeightVeryShort ? 9 : 6), radius: 30, hPadding: 25, diff --git a/lib/screens/patients/profile/referral/refer_details/refer-patient-screen-in-patient.dart b/lib/screens/patients/profile/referral/refer_details/refer-patient-screen-in-patient.dart index b5d47fde..0067d5fb 100644 --- a/lib/screens/patients/profile/referral/refer_details/refer-patient-screen-in-patient.dart +++ b/lib/screens/patients/profile/referral/refer_details/refer-patient-screen-in-patient.dart @@ -140,7 +140,7 @@ class _PatientMakeInPatientReferralScreenState extends State _priorityList = List(); + List _priorityList = []; _priorityList.add(priority1); _priorityList.add(priority2); _priorityList.add(priority3); @@ -149,7 +149,7 @@ class _PatientMakeInPatientReferralScreenState extends State { String patientType = routeArgs['patientType']; String arrivalType = routeArgs['arrivalType']; - referToList = List(); + referToList = []; dynamic sameBranch = { "id": 1, "name": TranslationBase.of(context).sameBranch diff --git a/lib/screens/patients/profile/referral/referral_details/add_replay_on_referral_patient.dart b/lib/screens/patients/profile/referral/referral_details/add_replay_on_referral_patient.dart index 607f3c25..c5cf13cd 100644 --- a/lib/screens/patients/profile/referral/referral_details/add_replay_on_referral_patient.dart +++ b/lib/screens/patients/profile/referral/referral_details/add_replay_on_referral_patient.dart @@ -120,7 +120,7 @@ class _AddReplayOnReferralPatientState ), Container( // height: replayOnReferralController.text.isNotEmpty ? 130 : 70, - // margin: EdgeInsets.all(SizeConfig.widthMultiplier * 5), + // margin: EdgeInsets.all(SizeConfig.widthMultiplier! * 5), child: Column( children: [ replayOnReferralController.text.isEmpty 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 6f564f03..036109b0 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 @@ -382,7 +382,7 @@ class _AddAssessmentDetailsState extends State { ), ), SizedBox( - height: SizeConfig.heightMultiplier * + height: SizeConfig.heightMultiplier! * (SizeConfig.isHeightVeryShort ? 20 : SizeConfig.isHeightShort 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 c898ec77..54dff45f 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 @@ -44,7 +44,7 @@ class UpdateAssessmentPage extends StatefulWidget { class _UpdateAssessmentPageState extends State implements AssessmentCallBack { bool isAssessmentExpand = false; - List mySelectedAssessmentList = List(); + List mySelectedAssessmentList = []; @override Widget build(BuildContext context) { 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 fc7e629b..c86ed059 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 @@ -30,7 +30,7 @@ class ExaminationsListSearchWidget extends StatefulWidget { class _ExaminationsListSearchWidgetState extends State { int expandedIndex = -1; - List items = List(); + List items = []; TextEditingController filteredSearchController = TextEditingController(); @override @@ -85,10 +85,10 @@ class _ExaminationsListSearchWidgetState } void filterSearchResults(String query) { - List dummySearchList = List(); + List dummySearchList = []; dummySearchList.addAll(widget.masterList); if (query.isNotEmpty) { - List dummyListData = List(); + List dummyListData = []; dummySearchList.forEach((item) { if (item.nameAr.toLowerCase().contains(query.toLowerCase()) || item.nameEn.toLowerCase().contains(query.toLowerCase())) { 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 1d51c4c3..18d599ae 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 @@ -45,7 +45,7 @@ class UpdateObjectivePage extends StatefulWidget { class _UpdateObjectivePageState extends State implements ObjectiveCallBack { bool isSysExaminationExpand = false; - List mySelectedExamination = List(); + List mySelectedExamination = []; BoxDecoration containerBorderDecoration( Color containerColor, Color borderColor) { @@ -192,7 +192,7 @@ class _UpdateObjectivePageState extends State isExpanded: isSysExaminationExpand, ), SizedBox( - height: SizeConfig.heightMultiplier * + height: SizeConfig.heightMultiplier! * (SizeConfig.isHeightVeryShort ? 14 : 12), ) ], 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 d1d647f5..cf115f08 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 @@ -341,7 +341,7 @@ class _UpdatePlanPageState extends State isExpanded: isProgressExpanded, ), SizedBox( - height: SizeConfig.heightMultiplier * + height: SizeConfig.heightMultiplier! * (SizeConfig.isHeightVeryShort ? 20 : 10), ), ], 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 8934e6a7..a15bf5bd 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 @@ -55,7 +55,7 @@ class SOAPStepHeader extends StatelessWidget { ), ), SizedBox( - height: SizeConfig.heightMultiplier * + height: SizeConfig.heightMultiplier! * (SizeConfig.isHeightVeryShort ? 1 : 2), ), ], diff --git a/lib/screens/patients/profile/soap_update/shared_soap_widgets/bottom_sheet_title.dart b/lib/screens/patients/profile/soap_update/shared_soap_widgets/bottom_sheet_title.dart index ef7f246d..2a7d69d8 100644 --- a/lib/screens/patients/profile/soap_update/shared_soap_widgets/bottom_sheet_title.dart +++ b/lib/screens/patients/profile/soap_update/shared_soap_widgets/bottom_sheet_title.dart @@ -9,7 +9,7 @@ class BottomSheetTitle extends StatelessWidget with PreferredSizeWidget { }) : super(key: key); final String title; - double headerHeight = SizeConfig.heightMultiplier * 15; + double headerHeight = SizeConfig.heightMultiplier! * 15; @override Widget build(BuildContext context) { 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 cb1cb2f1..30e9a8c2 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 @@ -37,7 +37,7 @@ class StepsWidget extends StatelessWidget { ? 10 : 10); double containerHeight = - SizeConfig.heightMultiplier * (SizeConfig.isHeightVeryShort ? 16 : 15); + SizeConfig.heightMultiplier! * (SizeConfig.isHeightVeryShort ? 16 : 15); return !projectViewModel.isArabic ? Stack( 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 9fc5425c..7931d064 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 @@ -42,7 +42,7 @@ class MasterKeyCheckboxSearchAllergiesWidget extends StatefulWidget { class _MasterKeyCheckboxSearchAllergiesWidgetState extends State { - List items = List(); + List items = []; TextEditingController filteredSearchController = TextEditingController(); @override @@ -121,10 +121,10 @@ class _MasterKeyCheckboxSearchAllergiesWidgetState } void filterSearchResults(String query) { - List dummySearchList = List(); + List dummySearchList = []; dummySearchList.addAll(widget.masterList); if (query.isNotEmpty) { - List dummyListData = List(); + List dummyListData = []; dummySearchList.forEach((items) { if (items.nameAr.toLowerCase().contains(query.toLowerCase()) || items.nameEn.toLowerCase().contains(query.toLowerCase())) { diff --git a/lib/screens/patients/profile/soap_update/subjective/medication/add_medication.dart b/lib/screens/patients/profile/soap_update/subjective/medication/add_medication.dart index 7a89fe05..7c91fad4 100644 --- a/lib/screens/patients/profile/soap_update/subjective/medication/add_medication.dart +++ b/lib/screens/patients/profile/soap_update/subjective/medication/add_medication.dart @@ -78,7 +78,7 @@ class _AddMedicationState extends State { child: Column( children: [ SizedBox( - height: SizeConfig.heightMultiplier * + height: SizeConfig.heightMultiplier! * (SizeConfig.isHeightVeryShort ? 2 : SizeConfig.isHeightShort @@ -406,7 +406,7 @@ class _AddMedicationState extends State { : null, ), SizedBox( - height: SizeConfig.heightMultiplier * + height: SizeConfig.heightMultiplier! * (SizeConfig.isHeightVeryShort ? 20 : SizeConfig.isHeightShort diff --git a/lib/screens/patients/profile/soap_update/subjective/update_subjective_page.dart b/lib/screens/patients/profile/soap_update/subjective/update_subjective_page.dart index 53195a47..7e5855b3 100644 --- a/lib/screens/patients/profile/soap_update/subjective/update_subjective_page.dart +++ b/lib/screens/patients/profile/soap_update/subjective/update_subjective_page.dart @@ -46,8 +46,8 @@ class _UpdateSubjectivePageState extends State TextEditingController medicationController = TextEditingController(); final formKey = GlobalKey(); - List myAllergiesList = List(); - List myHistoryList = List(); + List myAllergiesList = []; + List myHistoryList = []; getHistory(SOAPViewModel model) async { widget.changeLoadingState(true); @@ -223,7 +223,7 @@ class _UpdateSubjectivePageState extends State isExpanded: isChiefExpand, ), SizedBox( - height: SizeConfig.heightMultiplier * + height: SizeConfig.heightMultiplier! * (SizeConfig.isHeightVeryShort ? 4 : 2), ), if (widget.patientInfo.admissionNo == null) @@ -243,7 +243,7 @@ class _UpdateSubjectivePageState extends State isExpanded: isHistoryExpand, ), SizedBox( - height: SizeConfig.heightMultiplier * + height: SizeConfig.heightMultiplier! * (SizeConfig.isHeightVeryShort ? 4 : 2), ), if (widget.patientInfo.admissionNo == null) @@ -268,7 +268,7 @@ class _UpdateSubjectivePageState extends State isExpanded: isAllergiesExpand, ), SizedBox( - height: SizeConfig.heightMultiplier * + height: SizeConfig.heightMultiplier! * (SizeConfig.isHeightVeryShort ? 20 : 10), ), ], diff --git a/lib/screens/patients/profile/soap_update/update_soap_index.dart b/lib/screens/patients/profile/soap_update/update_soap_index.dart index 155e92ed..6a2ff4b6 100644 --- a/lib/screens/patients/profile/soap_update/update_soap_index.dart +++ b/lib/screens/patients/profile/soap_update/update_soap_index.dart @@ -31,8 +31,8 @@ class _UpdateSoapIndexState extends State with TickerProviderStateMixin { PageController _controller; int _currentIndex = 0; - List myAllergiesList = List(); - List myHistoryList = List(); + List myAllergiesList = []; + List myHistoryList = []; changePageViewIndex(pageIndex, {isChangeState = true}) { if (pageIndex != _currentIndex && isChangeState) changeLoadingState(true); @@ -138,7 +138,7 @@ class _UpdateSoapIndexState extends State ), border: Border.all(color: HexColor('#707070'), width: 0), ), - height: SizeConfig.heightMultiplier * + height: SizeConfig.heightMultiplier! * (SizeConfig.isHeightVeryShort ? 12 : 10), width: double.infinity, child: Column( @@ -186,7 +186,7 @@ class _UpdateSoapIndexState extends State child: AppButton( title: TranslationBase.of(context).previous, color: Colors.grey[300], - // height: SizeConfig.heightMultiplier * + // height: SizeConfig.heightMultiplier! * // (SizeConfig.isHeightVeryShort ? 8 : 6), // padding: 10, fontColor: Colors.black, @@ -208,7 +208,7 @@ class _UpdateSoapIndexState extends State : TranslationBase.of(context).next, fontWeight: FontWeight.w600, color: Colors.red[700], - // height: SizeConfig.heightMultiplier * + // height: SizeConfig.heightMultiplier! * // (SizeConfig.isHeightVeryShort ? 8 : 6), // padding: 10, disabled: model.state == ViewState.BusyLocal, diff --git a/lib/screens/patients/profile/vital_sign/line_chart_curved.dart b/lib/screens/patients/profile/vital_sign/line_chart_curved.dart index ae102b88..8c8425fd 100644 --- a/lib/screens/patients/profile/vital_sign/line_chart_curved.dart +++ b/lib/screens/patients/profile/vital_sign/line_chart_curved.dart @@ -12,8 +12,8 @@ class LineChartCurved extends StatelessWidget { LineChartCurved({this.title, this.timeSeries, this.indexes}); - List xAxixs = List(); - List yAxixs = List(); + List xAxixs = []; + List yAxixs = []; // DateFormat format = DateFormat("yyyy-MM-dd"); DateFormat yearFormat = DateFormat("yyyy/MMM/dd"); @@ -263,7 +263,7 @@ class LineChartCurved extends StatelessWidget { } List getData(context) { - List spots = List(); + List spots = []; isDatesSameYear = true; int previousDateYear = 0; for (int index = 0; index < timeSeries.length; index++) { diff --git a/lib/screens/patients/profile/vital_sign/line_chart_curved_blood_pressure.dart b/lib/screens/patients/profile/vital_sign/line_chart_curved_blood_pressure.dart index f4def5ee..a7e62166 100644 --- a/lib/screens/patients/profile/vital_sign/line_chart_curved_blood_pressure.dart +++ b/lib/screens/patients/profile/vital_sign/line_chart_curved_blood_pressure.dart @@ -19,8 +19,8 @@ class LineChartCurvedBloodPressure extends StatelessWidget { this.timeSeries2, this.isOX = false}); - List xAxixs = List(); - List yAxixs = List(); + List xAxixs = []; + List yAxixs = []; @override Widget build(BuildContext context) { @@ -269,12 +269,12 @@ class LineChartCurvedBloodPressure extends StatelessWidget { // } List getData(context) { - List spots = List(); + List spots = []; for (int index = 0; index < timeSeries1.length; index++) { spots.add(FlSpot(index.toDouble(), timeSeries1[index].sales)); } - List spots2 = List(); + List spots2 = []; for (int index = 0; index < timeSeries2.length; index++) { spots2.add(FlSpot(index.toDouble(), timeSeries2[index].sales)); } @@ -306,7 +306,7 @@ class LineChartCurvedBloodPressure extends StatelessWidget { ), ); - List lineChartData = List(); + List lineChartData = []; if (spots.isNotEmpty) { lineChartData.add(lineChartBarData1); } diff --git a/lib/screens/patients/profile/vital_sign/vital_sign_item.dart b/lib/screens/patients/profile/vital_sign/vital_sign_item.dart index 20d5b439..4caa47ce 100644 --- a/lib/screens/patients/profile/vital_sign/vital_sign_item.dart +++ b/lib/screens/patients/profile/vital_sign/vital_sign_item.dart @@ -25,9 +25,9 @@ class VitalSignItem extends StatelessWidget { @override Widget build(BuildContext context) { return RoundedContainer( - // margin: 0.025 * SizeConfig.realScreenWidth, - // height: 0.15 * SizeConfig.realScreenHeight, - // width: 0.45 * SizeConfig.realScreenWidth, + // margin: 0.025 * SizeConfig.realScreenWidth!, + // height: 0.15 * SizeConfig.realScreenHeight!, + // width: 0.45 * SizeConfig.realScreenWidth!, child: Container( padding: EdgeInsets.all(5), child: Column( diff --git a/lib/screens/patients/register_patient/RegisterSearchPatientPage.dart b/lib/screens/patients/register_patient/RegisterSearchPatientPage.dart index edb0e059..05d2da79 100644 --- a/lib/screens/patients/register_patient/RegisterSearchPatientPage.dart +++ b/lib/screens/patients/register_patient/RegisterSearchPatientPage.dart @@ -60,7 +60,7 @@ class _RegisterSearchPatientPageState extends State { @override void initState() { _phoneCode.text = ""; - countryList = List(); + countryList = []; dynamic ksaCountry = {"id": 967, "name": "Saudi Arabia"}; dynamic uaeCountry = {"id": 971, "name": "United Arab Emirates"}; diff --git a/lib/screens/prescription/add_prescription/add_drug/add_drug_widget.dart b/lib/screens/prescription/add_prescription/add_drug/add_drug_widget.dart index 255a3e72..d56019fc 100644 --- a/lib/screens/prescription/add_prescription/add_drug/add_drug_widget.dart +++ b/lib/screens/prescription/add_prescription/add_drug/add_drug_widget.dart @@ -66,8 +66,8 @@ class _AddDrugWidgetState extends State { appBar: BottomSheetTitle(title: TranslationBase.of(context).addMedication), body: Container( - height: SizeConfig.realScreenHeight * .8, - width: SizeConfig.realScreenWidth, + height: SizeConfig.realScreenHeight! * .8, + width: SizeConfig.realScreenWidth!, child: SingleChildScrollView( child: Column( children: [ diff --git a/lib/screens/prescription/add_prescription/add_drug/drug_to_drug.dart b/lib/screens/prescription/add_prescription/add_drug/drug_to_drug.dart index 18125bd2..fbbc538d 100644 --- a/lib/screens/prescription/add_prescription/add_drug/drug_to_drug.dart +++ b/lib/screens/prescription/add_prescription/add_drug/drug_to_drug.dart @@ -64,7 +64,7 @@ class _DrugToDrug extends State { NetworkBaseView( baseViewModel: prescriptionViewModel, child: Container( - height: SizeConfig.realScreenHeight * .9, + height: SizeConfig.realScreenHeight! * .9, child: new ListView.builder( itemCount: expandableList.length, itemBuilder: (context, i) { @@ -93,7 +93,7 @@ class _DrugToDrug extends State { }).toList()); })))) : Container( - height: SizeConfig.realScreenHeight * .45, + height: SizeConfig.realScreenHeight! * .45, child: GifLoaderContainer() ); } diff --git a/lib/screens/prescription/add_prescription/prescription_form_widget.dart b/lib/screens/prescription/add_prescription/prescription_form_widget.dart index 803e8d7d..48b214e3 100644 --- a/lib/screens/prescription/add_prescription/prescription_form_widget.dart +++ b/lib/screens/prescription/add_prescription/prescription_form_widget.dart @@ -416,7 +416,7 @@ class _PrescriptionFormWidgetState extends State { ), SizedBox(height: spaceBetweenTextFields), Container( - margin: EdgeInsets.all(SizeConfig.widthMultiplier * 5), + margin: EdgeInsets.all(SizeConfig.widthMultiplier! * 5), child: Wrap( alignment: WrapAlignment.center, children: [ diff --git a/lib/screens/prescription/prescription_checkout_screen.dart b/lib/screens/prescription/prescription_checkout_screen.dart index e9bcbbcb..7c6fb86a 100644 --- a/lib/screens/prescription/prescription_checkout_screen.dart +++ b/lib/screens/prescription/prescription_checkout_screen.dart @@ -70,7 +70,7 @@ class _PrescriptionCheckOutScreenState String patientType}) async { PostPrescriptionReqModel postProcedureReqModel = new PostPrescriptionReqModel(); - List prescriptionList = List(); + List prescriptionList = []; postProcedureReqModel.appointmentNo = patient.appointmentNo; postProcedureReqModel.clinicID = patient.clinicId; @@ -634,7 +634,7 @@ class _PrescriptionCheckOutScreenState SizedBox(height: spaceBetweenTextFields), Container( margin: EdgeInsets.all( - SizeConfig.widthMultiplier * 5), + SizeConfig.widthMultiplier! * 5), child: Wrap( alignment: WrapAlignment.center, children: [ diff --git a/lib/screens/procedures/add_procedure_page.dart b/lib/screens/procedures/add_procedure_page.dart index bedfea99..7fbb620a 100644 --- a/lib/screens/procedures/add_procedure_page.dart +++ b/lib/screens/procedures/add_procedure_page.dart @@ -40,8 +40,8 @@ class _AddProcedurePageState extends State { TextEditingController procedureController = TextEditingController(); TextEditingController remarksController = TextEditingController(); - List entityList = List(); - List entityListProcedure = List(); + List entityList = []; + List entityListProcedure = []; TextEditingController procedureName = TextEditingController(); dynamic selectedCategory; diff --git a/lib/screens/procedures/entity_list_checkbox_search_widget.dart b/lib/screens/procedures/entity_list_checkbox_search_widget.dart index 3a3f6b09..8088373b 100644 --- a/lib/screens/procedures/entity_list_checkbox_search_widget.dart +++ b/lib/screens/procedures/entity_list_checkbox_search_widget.dart @@ -47,9 +47,9 @@ class _EntityListCheckboxSearchWidgetState }); } - List items = List(); - List remarksList = List(); - List typeList = List(); + List items = []; + List remarksList = []; + List typeList = []; @override void initState() { diff --git a/lib/screens/procedures/favorite_procedure/add_favourite_procedure.dart b/lib/screens/procedures/favorite_procedure/add_favourite_procedure.dart index f69f2c35..096c27ed 100644 --- a/lib/screens/procedures/favorite_procedure/add_favourite_procedure.dart +++ b/lib/screens/procedures/favorite_procedure/add_favourite_procedure.dart @@ -38,7 +38,7 @@ class _AddFavouriteProcedureState extends State { ProcedureViewModel model; PatiantInformtion patient; - List entityList = List(); + List entityList = []; ProcedureTempleteDetailsModel groupProcedures; @override diff --git a/lib/screens/procedures/favorite_procedure/entity_list_fav_procedure.dart b/lib/screens/procedures/favorite_procedure/entity_list_fav_procedure.dart index 3b6537ff..632ec2e2 100644 --- a/lib/screens/procedures/favorite_procedure/entity_list_fav_procedure.dart +++ b/lib/screens/procedures/favorite_procedure/entity_list_fav_procedure.dart @@ -64,10 +64,10 @@ class _EntityListCheckboxSearchFavProceduresWidgetState }); } - List items = List(); - List itemsProcedure = List(); - List remarksList = List(); - List typeList = List(); + List items = []; + List itemsProcedure = []; + List remarksList = []; + List typeList = []; @override void initState() { diff --git a/lib/screens/procedures/favorite_procedure/procedure_checkout_screen.dart b/lib/screens/procedures/favorite_procedure/procedure_checkout_screen.dart index 4f85827d..38d748cc 100644 --- a/lib/screens/procedures/favorite_procedure/procedure_checkout_screen.dart +++ b/lib/screens/procedures/favorite_procedure/procedure_checkout_screen.dart @@ -36,9 +36,9 @@ class ProcedureCheckOutScreen extends StatefulWidget { } class _ProcedureCheckOutScreenState extends State { - List remarksList = List(); + List remarksList = []; final TextEditingController remarksController = TextEditingController(); - List typeList = List(); + List typeList = []; @override Widget build(BuildContext context) { @@ -192,7 +192,7 @@ class _ProcedureCheckOutScreenState extends State { ), ///TODO Elham* use our custom bottomsheet bottomSheet: Container( - margin: EdgeInsets.all(SizeConfig.widthMultiplier * 5), + margin: EdgeInsets.all(SizeConfig.widthMultiplier! * 5), child: Wrap( alignment: WrapAlignment.center, children: [ diff --git a/lib/screens/procedures/update_procedure.dart b/lib/screens/procedures/update_procedure.dart index 1885582f..d2610d87 100644 --- a/lib/screens/procedures/update_procedure.dart +++ b/lib/screens/procedures/update_procedure.dart @@ -89,7 +89,7 @@ class _UpdateProcedureWidgetState extends State { widget.remarksController.text = widget.remarks; } - List entityList = List(); + List entityList = []; dynamic selectedCategory; /// TODO Roaa Add translation and make sure it working fine @@ -204,7 +204,7 @@ class _UpdateProcedureWidgetState extends State { String categoryId}) async { UpdateProcedureRequestModel updateProcedureReqModel = new UpdateProcedureRequestModel(); - List controls = List(); + List controls = []; ProcedureDetail controlsProcedure = new ProcedureDetail(); updateProcedureReqModel.appointmentNo = patient.appointmentNo; diff --git a/lib/screens/qr_reader/QR_reader_screen.dart b/lib/screens/qr_reader/QR_reader_screen.dart index d1fc601a..9b363fb3 100644 --- a/lib/screens/qr_reader/QR_reader_screen.dart +++ b/lib/screens/qr_reader/QR_reader_screen.dart @@ -37,7 +37,7 @@ class _QrReaderScreenState extends State { TranslationBase.of(context).qr + TranslationBase.of(context).reader, body: Center( child: Container( - margin: EdgeInsets.only(top: SizeConfig.realScreenHeight / 7), + margin: EdgeInsets.only(top: SizeConfig.realScreenHeight! / 7), child: FractionallySizedBox( widthFactor: 0.9, child: ListView( diff --git a/lib/screens/reschedule_leaves/reschedule_leave.dart b/lib/screens/reschedule_leaves/reschedule_leave.dart index 3ebf5b97..3cafc621 100644 --- a/lib/screens/reschedule_leaves/reschedule_leave.dart +++ b/lib/screens/reschedule_leaves/reschedule_leave.dart @@ -135,11 +135,11 @@ class _RescheduleLeaveScreen extends State { width: double.infinity, child: Padding( padding: EdgeInsets.only( - top: SizeConfig.widthMultiplier * 0.9, + top: SizeConfig.widthMultiplier! * 0.9, bottom: - SizeConfig.widthMultiplier * 0.9, - right: SizeConfig.widthMultiplier * 3, - left: SizeConfig.widthMultiplier * 3), + SizeConfig.widthMultiplier! * 0.9, + right: SizeConfig.widthMultiplier! * 3, + left: SizeConfig.widthMultiplier! * 3), child: Column( crossAxisAlignment: CrossAxisAlignment.start, @@ -447,11 +447,11 @@ class _RescheduleLeaveScreen extends State { width: double.infinity, child: Padding( padding: EdgeInsets.only( - top: SizeConfig.widthMultiplier * 0.9, + top: SizeConfig.widthMultiplier! * 0.9, bottom: - SizeConfig.widthMultiplier * 0.9, - right: SizeConfig.widthMultiplier * 3, - left: SizeConfig.widthMultiplier * 3), + SizeConfig.widthMultiplier! * 0.9, + right: SizeConfig.widthMultiplier! * 3, + left: SizeConfig.widthMultiplier! * 3), child: Column( crossAxisAlignment: CrossAxisAlignment.start, @@ -544,11 +544,11 @@ class _RescheduleLeaveScreen extends State { width: double.infinity, child: Padding( padding: EdgeInsets.only( - top: SizeConfig.widthMultiplier * 0.9, + top: SizeConfig.widthMultiplier! * 0.9, bottom: - SizeConfig.widthMultiplier * 0.9, - right: SizeConfig.widthMultiplier * 3, - left: SizeConfig.widthMultiplier * 3), + SizeConfig.widthMultiplier! * 0.9, + right: SizeConfig.widthMultiplier! * 3, + left: SizeConfig.widthMultiplier! * 3), child: Column( crossAxisAlignment: CrossAxisAlignment.start, @@ -651,7 +651,7 @@ class _RescheduleLeaveScreen extends State { SizedBox(height: SizeConfig.screenHeight * .3), Container( margin: EdgeInsets.all( - SizeConfig.widthMultiplier * 5), + SizeConfig.widthMultiplier! * 5), child: Wrap( alignment: WrapAlignment.center, children: [ diff --git a/lib/utils/utils.dart b/lib/utils/utils.dart index 20222ac6..d641a78b 100644 --- a/lib/utils/utils.dart +++ b/lib/utils/utils.dart @@ -71,7 +71,7 @@ class Utils { builder: (BuildContext builder) { return Container( // height: 500, - height: SizeConfig.realScreenHeight * 0.4, + height: SizeConfig.realScreenHeight! * 0.4, color: Color(0xfff7f7f7), child: Column( mainAxisAlignment: MainAxisAlignment.end, @@ -102,7 +102,7 @@ class Utils { ), ), Container( - height: SizeConfig.realScreenHeight * 0.3, + height: SizeConfig.realScreenHeight! * 0.3, color: Color(0xfff7f7f7), child: buildPickerItems( context, items, decKey, onSelectFun, model)) @@ -303,7 +303,7 @@ class Utils { } static double getTextFieldHeight() { - return SizeConfig.heightMultiplier * + return SizeConfig.heightMultiplier! * (SizeConfig.isHeightVeryShort ? 10 : SizeConfig.isHeightShort diff --git a/lib/widgets/auth/method_type_card.dart b/lib/widgets/auth/method_type_card.dart index c11e6dc7..126b89de 100644 --- a/lib/widgets/auth/method_type_card.dart +++ b/lib/widgets/auth/method_type_card.dart @@ -22,7 +22,7 @@ class MethodTypeCard extends StatelessWidget { @override Widget build(BuildContext context) { - double cardHeight = SizeConfig.heightMultiplier * + double cardHeight = SizeConfig.heightMultiplier! * (SizeConfig.isHeightVeryShort ? 22 : SizeConfig.isHeightLarge @@ -49,11 +49,11 @@ class MethodTypeCard extends StatelessWidget { children: [ isSvg ? SvgPicture.asset(assetPath, - width: SizeConfig.widthMultiplier * (14), + width: SizeConfig.widthMultiplier! * (14), height: cardHeight * 0.20) : Image.asset( assetPath, - width: SizeConfig.widthMultiplier * (12), + width: SizeConfig.widthMultiplier! * (12), height: cardHeight * 0.35, // height: , ), diff --git a/lib/widgets/bottom_sheet/bottom_sheet_container.dart b/lib/widgets/bottom_sheet/bottom_sheet_container.dart index 31fee2b6..a4c39adb 100644 --- a/lib/widgets/bottom_sheet/bottom_sheet_container.dart +++ b/lib/widgets/bottom_sheet/bottom_sheet_container.dart @@ -7,7 +7,7 @@ class BottomSheetContainer extends StatelessWidget { final Function onTap; final String label; final Widget widget; - double headerHeight = SizeConfig.heightMultiplier * 12; + double headerHeight = SizeConfig.heightMultiplier! * 12; BottomSheetContainer({Key key, this.onTap, this.label, this.widget}) : super(key: key); @@ -27,7 +27,7 @@ class BottomSheetContainer extends StatelessWidget { children: [ Container( margin: EdgeInsets.only( - top: headerHeight * (SizeConfig.isWidthLarge ? 0.3 : 0.2), left: SizeConfig.heightMultiplier*4.5 + top: headerHeight * (SizeConfig.isWidthLarge ? 0.3 : 0.2), left: SizeConfig.heightMultiplier!*4.5 ), child: Center( child: Row( diff --git a/lib/widgets/bottom_sheet/custom_bottom_sheet_container.dart b/lib/widgets/bottom_sheet/custom_bottom_sheet_container.dart index af7d0a4c..ac24a861 100644 --- a/lib/widgets/bottom_sheet/custom_bottom_sheet_container.dart +++ b/lib/widgets/bottom_sheet/custom_bottom_sheet_container.dart @@ -9,7 +9,7 @@ class CustomBottomSheetContainer extends StatelessWidget { final Function onTap; final String label; - double headerHeight = SizeConfig.heightMultiplier * 12; + double headerHeight = SizeConfig.heightMultiplier! * 12; CustomBottomSheetContainer({Key key, this.onTap, this.label}) : super(key: key); diff --git a/lib/widgets/dashboard/activity_button.dart b/lib/widgets/dashboard/activity_button.dart index 4b4c96da..c7db3a6c 100644 --- a/lib/widgets/dashboard/activity_button.dart +++ b/lib/widgets/dashboard/activity_button.dart @@ -10,7 +10,7 @@ class GetActivityCard extends StatelessWidget { @override Widget build(BuildContext context) { - double width = SizeConfig.heightMultiplier * + double width = SizeConfig.heightMultiplier! * (SizeConfig.isHeightVeryShort ? 16 : SizeConfig.isHeightShort @@ -21,9 +21,9 @@ class GetActivityCard extends StatelessWidget { return Container( width: width, padding: EdgeInsets.symmetric( - horizontal: SizeConfig.heightMultiplier * .4, - vertical: SizeConfig.heightMultiplier * .2), - margin: EdgeInsets.all(SizeConfig.widthMultiplier * 1), + horizontal: SizeConfig.heightMultiplier! * .4, + vertical: SizeConfig.heightMultiplier! * .2), + margin: EdgeInsets.all(SizeConfig.widthMultiplier! * 1), decoration: BoxDecoration( color: Colors.white, border: Border.all(width: 1.5, color: Color(0xFFEFEFEF)), diff --git a/lib/widgets/dashboard/guage_chart.dart b/lib/widgets/dashboard/guage_chart.dart index a2693ca7..c34af994 100644 --- a/lib/widgets/dashboard/guage_chart.dart +++ b/lib/widgets/dashboard/guage_chart.dart @@ -1,11 +1,11 @@ -import 'package:charts_flutter/flutter.dart' as charts; +import 'package:flutter_charts/flutter_charts.dart' as charts; import 'package:flutter/material.dart'; class GaugeChart extends StatelessWidget { - final List seriesList; + final List seriesList; final bool animate; - GaugeChart(this.seriesList, {this.animate}); + GaugeChart(this.seriesList, {this.animate = false}); /// Creates a [PieChart] with sample data and no transition. factory GaugeChart.withSampleData() { @@ -49,7 +49,7 @@ class GaugeChart extends StatelessWidget { class GaugeSegment { final String segment; final int size; - final charts.Color color; + final charts. color; GaugeSegment(this.segment, this.size, this.color); } diff --git a/lib/widgets/dashboard/out_patient_stack.dart b/lib/widgets/dashboard/out_patient_stack.dart index 888a7dba..8fea0149 100644 --- a/lib/widgets/dashboard/out_patient_stack.dart +++ b/lib/widgets/dashboard/out_patient_stack.dart @@ -12,7 +12,7 @@ class GetOutPatientStack extends StatelessWidget { @override Widget build(BuildContext context) { - double barHeight = SizeConfig.heightMultiplier * + double barHeight = SizeConfig.heightMultiplier! * (SizeConfig.isHeightVeryShort ? 20 : SizeConfig.isHeightLarge diff --git a/lib/widgets/medicine/medicine_item_widget.dart b/lib/widgets/medicine/medicine_item_widget.dart index 3a0fb929..e32bd53d 100644 --- a/lib/widgets/medicine/medicine_item_widget.dart +++ b/lib/widgets/medicine/medicine_item_widget.dart @@ -37,7 +37,7 @@ class _MedicineItemWidgetState extends State { @override Widget build(BuildContext context) { return CardWithBgWidget( - // height: SizeConfig.heightMultiplier * 12.9, + // height: SizeConfig.heightMultiplier! * 12.9, bgColor: Colors.transparent, hasBorder: false, widget: Padding( diff --git a/lib/widgets/patients/profile/app_bar/patient-profile-app-bar.dart b/lib/widgets/patients/profile/app_bar/patient-profile-app-bar.dart index c27c9dd7..8def36c8 100644 --- a/lib/widgets/patients/profile/app_bar/patient-profile-app-bar.dart +++ b/lib/widgets/patients/profile/app_bar/patient-profile-app-bar.dart @@ -424,7 +424,7 @@ class PatientProfileAppBar extends StatelessWidget with PreferredSizeWidget { ? 137 : SizeConfig.isHeightShort ? 190 - : SizeConfig.heightMultiplier * + : SizeConfig.heightMultiplier! * (SizeConfig.isWidthLarge ? 25 : 20) : height); } diff --git a/lib/widgets/patients/profile/prescription_in_patinets_widget.dart b/lib/widgets/patients/profile/prescription_in_patinets_widget.dart index dd37d88f..1ca0d530 100644 --- a/lib/widgets/patients/profile/prescription_in_patinets_widget.dart +++ b/lib/widgets/patients/profile/prescription_in_patinets_widget.dart @@ -57,8 +57,8 @@ class PrescriptionInPatientWidget extends StatelessWidget { ), )) : Container( - margin: EdgeInsets.fromLTRB(SizeConfig.realScreenWidth * 0.05, 0, - SizeConfig.realScreenWidth * 0.05, 0), + margin: EdgeInsets.fromLTRB(SizeConfig.realScreenWidth! * 0.05, 0, + SizeConfig.realScreenWidth! * 0.05, 0), child: ListView.builder( itemCount: prescriptionReportForInPatientList.length, itemBuilder: (BuildContext context, int index) { diff --git a/lib/widgets/patients/profile/prescription_out_patinets_widget.dart b/lib/widgets/patients/profile/prescription_out_patinets_widget.dart index ed31bc61..3883fe2c 100644 --- a/lib/widgets/patients/profile/prescription_out_patinets_widget.dart +++ b/lib/widgets/patients/profile/prescription_out_patinets_widget.dart @@ -56,8 +56,8 @@ class PrescriptionOutPatientWidget extends StatelessWidget { ), )) : Container( - margin: EdgeInsets.fromLTRB(SizeConfig.realScreenWidth * 0.05, 0, - SizeConfig.realScreenWidth * 0.05, 0), + margin: EdgeInsets.fromLTRB(SizeConfig.realScreenWidth! * 0.05, 0, + SizeConfig.realScreenWidth! * 0.05, 0), child: ListView.builder( itemCount: patientPrescriptionsList.length, itemBuilder: (BuildContext context, int index) { diff --git a/lib/widgets/shared/app_drawer_widget.dart b/lib/widgets/shared/app_drawer_widget.dart index 5700db9c..3fa1eb2b 100644 --- a/lib/widgets/shared/app_drawer_widget.dart +++ b/lib/widgets/shared/app_drawer_widget.dart @@ -40,7 +40,7 @@ class _AppDrawerState extends State { child: ListView(padding: EdgeInsets.zero, children: [ Container( margin: EdgeInsets.symmetric(horizontal: 15), - // height: SizeConfig.heightMultiplier * 50, + // height: SizeConfig.heightMultiplier! * 50, child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ @@ -246,7 +246,7 @@ class _AppDrawerState extends State { ])) ])), ), - width: SizeConfig.realScreenWidth * 0.80, + width: SizeConfig.realScreenWidth! * 0.80, margin: EdgeInsets.all(0), customCornerRaduis: false, diff --git a/lib/widgets/shared/bottom_navigation_item.dart b/lib/widgets/shared/bottom_navigation_item.dart index 6554a8bd..5fcba7be 100644 --- a/lib/widgets/shared/bottom_navigation_item.dart +++ b/lib/widgets/shared/bottom_navigation_item.dart @@ -59,9 +59,9 @@ class BottomNavigationItem extends StatelessWidget { Container( child: SvgPicture.asset( svgPath, - width: SizeConfig.widthMultiplier * (10), + width: SizeConfig.widthMultiplier! * (10), height: SizeConfig.getHeightMultiplier( - height: SizeConfig.heightMultiplier * + height: SizeConfig.heightMultiplier! * (SizeConfig.isHeightVeryShort ? 10 : SizeConfig.isHeightShort diff --git a/lib/widgets/shared/buttons/app_buttons_widget.dart b/lib/widgets/shared/buttons/app_buttons_widget.dart index 395a8cd2..7090169e 100644 --- a/lib/widgets/shared/buttons/app_buttons_widget.dart +++ b/lib/widgets/shared/buttons/app_buttons_widget.dart @@ -58,7 +58,7 @@ class _AppButtonState extends State { } return Container( // height: MediaQuery.of(context).size.height * 0.075, - height: widget.height?? SizeConfig.heightMultiplier * + height: widget.height?? SizeConfig.heightMultiplier! * (SizeConfig.isHeightVeryShort ? 6 :SizeConfig.isHeightShort?5.5: 5), child: IgnorePointer( ignoring: widget.loading || widget.disabled, @@ -76,8 +76,8 @@ class _AppButtonState extends State { : EdgeInsets.only( top: widget.padding, bottom: widget.padding, - //right: SizeConfig.widthMultiplier * widget.padding, - //left: SizeConfig.widthMultiplier * widget.padding + //right: SizeConfig.widthMultiplier! * widget.padding, + //left: SizeConfig.widthMultiplier! * widget.padding ), child: Row( mainAxisSize: MainAxisSize.max, diff --git a/lib/widgets/shared/dialogs/dailog-list-select.dart b/lib/widgets/shared/dialogs/dailog-list-select.dart index 36eeb62b..ee2cd6e7 100644 --- a/lib/widgets/shared/dialogs/dailog-list-select.dart +++ b/lib/widgets/shared/dialogs/dailog-list-select.dart @@ -31,7 +31,7 @@ class ListSelectDialog extends StatefulWidget { } class _ListSelectDialogState extends State { - List items = List(); + List items = []; @override void initState() { @@ -126,10 +126,10 @@ class _ListSelectDialogState extends State { } void filterSearchResults(String query) { - List dummySearchList = List(); + List dummySearchList = []; dummySearchList.addAll(widget.list); if (query.isNotEmpty) { - List dummyListData = List(); + List dummyListData = []; dummySearchList.forEach((item) { if ("${item[widget.attributeName].toString()}" .toLowerCase() diff --git a/lib/widgets/shared/master_key_checkbox_search_widget.dart b/lib/widgets/shared/master_key_checkbox_search_widget.dart index ca8fbac8..bcbd84ad 100644 --- a/lib/widgets/shared/master_key_checkbox_search_widget.dart +++ b/lib/widgets/shared/master_key_checkbox_search_widget.dart @@ -41,7 +41,7 @@ class MasterKeyCheckboxSearchWidget extends StatefulWidget { class _MasterKeyCheckboxSearchWidgetState extends State { - List items = List(); + List items = []; TextEditingController filteredSearchController = TextEditingController(); @override @@ -163,10 +163,10 @@ class _MasterKeyCheckboxSearchWidgetState } void filterSearchResults(String query) { - List dummySearchList = List(); + List dummySearchList = []; dummySearchList.addAll(widget.masterList); if (query.isNotEmpty) { - List dummyListData = List(); + List dummyListData = []; dummySearchList.forEach((item) { if (item.nameAr.toLowerCase().contains(query.toLowerCase()) || item.nameEn.toLowerCase().contains(query.toLowerCase())) { diff --git a/lib/widgets/shared/speech-text-popup.dart b/lib/widgets/shared/speech-text-popup.dart index ecb001b5..fc3ff941 100644 --- a/lib/widgets/shared/speech-text-popup.dart +++ b/lib/widgets/shared/speech-text-popup.dart @@ -84,8 +84,8 @@ class _MyStatefulBuilderState extends State { Widget build(BuildContext context) => AlertDialog( content: Container( color: Colors.white, - height: SizeConfig.realScreenHeight * 0.5, - width: SizeConfig.realScreenWidth * 0.8, + height: SizeConfig.realScreenHeight! * 0.5, + width: SizeConfig.realScreenWidth! * 0.8, child: Container( child: Column(children: [ Row( diff --git a/pubspec.yaml b/pubspec.yaml index 2b347826..4c1a1633 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -28,9 +28,8 @@ dependencies: flutter: sdk: flutter hexcolor: ^3.0.1 - flutter_localizations: - sdk: flutter - intl: ^0.18.1 + + intl: any flutter_device_type: ^0.4.0 http: ^1.1.2 provider: ^6.1.1 @@ -44,9 +43,11 @@ dependencies: connectivity: ^3.0.6 maps_launcher: ^2.2.0 url_launcher: ^6.2.1 -# charts_flutter: ^0.12.0 - flutter_charts: ^0.5.2 + charts_flutter: any + #flutter_charts: ^0.5.2 + #gelin: ^0.1.6 #flutter_swiper: ^1.1.6 + flutter_swiper_view: ^1.1.8 #Icons eva_icons_flutter: ^3.1.0 font_awesome_flutter: ^10.6.0