From 76f8b37d1e7eaa9e177565aae6abaaf6d27b5009 Mon Sep 17 00:00:00 2001 From: "Aamir.Muhammad" Date: Thu, 30 Nov 2023 15:23:56 +0300 Subject: [PATCH] Null Safety Update --- .../selected_items/my_selected_allergy.dart | 17 +- .../my_selected_examination.dart | 10 +- lib/main.dart | 2 - lib/screens/live_care/end_call_screen.dart | 12 +- .../patients/DischargedPatientPage.dart | 22 +- lib/screens/patients/ECGPage.dart | 12 +- .../ReferralDischargedPatientDetails.dart | 183 +-- .../ReferralDischargedPatientPage.dart | 24 +- .../insurance_approval_screen_patient.dart | 38 +- .../patients/insurance_approvals_details.dart | 1181 +++++++---------- ...t_patient_prescription_details_screen.dart | 18 +- .../profile/UCAF/page_stepper_widget.dart | 22 +- .../profile/UCAF/ucaf_detail_screen.dart | 30 +- .../profile/UCAF/ucaf_input_screen.dart | 23 +- .../profile/UCAF/ucaf_pager_screen.dart | 25 +- .../UCAF/widgets/diagnosis_widget.dart | 22 +- .../UCAF/widgets/medication_widget.dart | 24 +- .../UCAF/widgets/pocedures_widget.dart | 28 +- .../lab_result_history_chart_and_detials.dart | 8 +- .../lab_result_history_details_wideget.dart | 14 +- .../line_chart_curved_lab_history.dart | 108 +- .../laboratory_result/flow_chart_page.dart | 2 +- .../lab_result_details_wideget.dart | 14 +- .../laboratory_result/lab_result_widget.dart | 60 +- .../laboratory_result_page.dart | 22 +- .../laboratory_result_widget.dart | 32 +- .../profile/lab_result/labs_home_page.dart | 62 +- .../all_lab_special_result_page.dart | 46 +- .../special_lab_result_details_page.dart | 2 +- .../AddVerifyMedicalReport.dart | 99 +- .../MedicalReportDetailPage.dart | 6 +- .../medical_report/MedicalReportPage.dart | 36 +- .../notes/note/progress_note_screen.dart | 812 +++++------- .../profile/notes/note/update_note.dart | 156 +-- .../nursing_note/nursing_note_screen.dart | 20 +- .../operation_report/operation_report.dart | 268 ++-- .../update_operation_report.dart | 348 ++--- .../pending_orders/pending_orders_screen.dart | 18 +- .../intervention_medication.dart | 277 ++-- ...ntervention_medication_history_screen.dart | 12 +- .../pharmacy_intervention_screen.dart | 78 +- ...n_patient_prescription_details_screen.dart | 22 +- ...out_patient_prescription_details_item.dart | 8 +- .../patient_profile_card_model.dart | 6 +- .../patient_profile_screen.dart | 218 ++- .../profile_gird_for_InPatient.dart | 118 +- .../profile_gird_for_other.dart | 142 +- .../profile_gird_for_search.dart | 40 +- .../radiology/radiology_details_page.dart | 53 +- .../radiology/radiology_home_page.dart | 48 +- .../radiology/radiology_report_screen.dart | 4 +- .../refer-patient-screen-in-patient.dart | 907 ++++++------- .../refer_details/refer-patient-screen.dart | 200 +-- .../referred-patient-screen.dart | 38 +- .../referred_patient_detail_in-paint.dart | 82 +- .../add_replay_on_referral_patient.dart | 32 +- .../my-referral-detail-screen.dart | 181 +-- .../my-referral-inpatient-screen.dart | 81 +- .../patient_referral_screen.dart | 10 +- .../referral_patient_detail_in-paint.dart | 253 ++-- .../assessment/add_assessment_details.dart | 573 ++++---- .../assessment/update_assessment_page.dart | 44 +- .../objective/add_examination_page.dart | 19 +- .../objective/add_examination_widget.dart | 85 +- .../objective/examination_item_card.dart | 18 +- .../examinations_list_search_widget.dart | 22 +- .../objective/update_objective_page.dart | 155 +-- .../soap_update/plan/update_plan_page.dart | 130 +- .../shared_soap_widgets/SOAP_open_items.dart | 6 +- .../shared_soap_widgets/SOAP_step_header.dart | 19 +- .../bottom_sheet_title.dart | 6 +- .../expandable_SOAP_widget.dart | 28 +- .../shared_soap_widgets/remark_text.dart | 4 +- .../shared_soap_widgets/remove_button.dart | 6 +- .../steper/Step_details_widget.dart | 4 +- .../steper/status_Label.dart | 9 +- .../steper/steps_widget.dart | 91 +- .../profile/soap_update/soap_utils.dart | 2 +- .../subjective/allergies/add_allergies.dart | 125 +- .../subjective/allergies/allergies_item.dart | 96 +- ..._key_checkbox_search_allergies_widget.dart | 32 +- .../allergies/update_allergies_widget.dart | 78 +- .../update_Chief_complaints.dart | 27 +- .../history/add_history_dialog.dart | 71 +- .../subjective/history/priority_bar.dart | 21 +- .../history/update_history_widget.dart | 38 +- .../subjective/medication/add_medication.dart | 600 ++++----- .../medication/update_medication_widget.dart | 4 +- .../subjective/update_subjective_page.dart | 165 +-- .../soap_update/update_soap_index.dart | 67 +- .../profile/vital_sign/line_chart_curved.dart | 182 ++- .../line_chart_curved_blood_pressure.dart | 154 +-- .../vital_sign_detail_pain_scale.dart | 28 +- ...al_sign_details_blood_pressurewideget.dart | 30 +- .../vital_sign/vital_sign_details_screen.dart | 345 ++--- .../vital_sign_details_wideget.dart | 16 +- .../profile/vital_sign/vital_sign_item.dart | 16 +- .../vital_sign_item_details_screen.dart | 32 +- .../vital_sing_chart_and_detials.dart | 14 +- .../vital_sing_chart_blood_pressure.dart | 18 +- .../vte_assessment/vte_assessment_screen.dart | 340 ++--- .../register_patient/CustomEditableText.dart | 14 +- .../RegisterConfirmationPatientPage.dart | 281 ++-- .../register_patient/RegisterPatientPage.dart | 8 +- .../RegisterSearchPatientPage.dart | 60 +- .../VerifyActivationCodePage.dart | 4 +- .../register_patient/VerifyMethodPage.dart | 226 +--- .../add_drug/add_drug_widget.dart | 80 +- .../add_drug/drug_to_drug.dart | 4 +- .../add_prescription/add_prescription.dart | 59 +- .../prescription_form_widget.dart | 156 +-- .../search_preescription_widget.dart | 34 +- .../preacription_items_widget.dart | 250 ++-- pubspec.yaml | 2 +- 114 files changed, 4511 insertions(+), 7023 deletions(-) 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 c3e17a8c..98df9c52 100644 --- a/lib/core/model/SOAP/selected_items/my_selected_allergy.dart +++ b/lib/core/model/SOAP/selected_items/my_selected_allergy.dart @@ -4,19 +4,12 @@ class MySelectedAllergy { MasterKeyModel? selectedAllergySeverity; MasterKeyModel? selectedAllergy; String? remark; - bool? isChecked; - bool? isExpanded; - bool? isLocal; + bool isChecked; + bool isExpanded; + bool isLocal; int? createdBy; - bool? hasValidationError; + bool hasValidationError; MySelectedAllergy( - {this.selectedAllergySeverity, - this.selectedAllergy, - this.remark, - this.isChecked, - this.isExpanded = true, - this.isLocal = true, - this.createdBy, - this.hasValidationError = false}); + {this.selectedAllergySeverity, this.selectedAllergy, this.remark, this.isChecked = false, this.isExpanded = true, this.isLocal = true, this.createdBy, this.hasValidationError = false}); } 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 29092efb..2ab28c27 100644 --- a/lib/core/model/SOAP/selected_items/my_selected_examination.dart +++ b/lib/core/model/SOAP/selected_items/my_selected_examination.dart @@ -3,11 +3,11 @@ 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; + bool isNormal; + bool isAbnormal; + bool notExamined; + bool isNew; + bool isLocal; int? createdBy; String? createdOn; String? editedOn; diff --git a/lib/main.dart b/lib/main.dart index 59ea002c..9a5ca8b5 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -7,8 +7,6 @@ import 'package:firebase_analytics/observer.dart'; import 'package:firebase_core/firebase_core.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; -import 'package:flutter_localizations/flutter_localizations.dart'; -import 'package:hexcolor/hexcolor.dart'; import 'package:provider/provider.dart'; import './config/size_config.dart'; diff --git a/lib/screens/live_care/end_call_screen.dart b/lib/screens/live_care/end_call_screen.dart index dafa469b..537522fc 100644 --- a/lib/screens/live_care/end_call_screen.dart +++ b/lib/screens/live_care/end_call_screen.dart @@ -23,11 +23,11 @@ import 'package:flutter_staggered_grid_view/flutter_staggered_grid_view.dart'; import 'package:hexcolor/hexcolor.dart'; class EndCallScreen extends StatefulWidget { - final PatiantInformtion patient; + final PatiantInformtion? patient; const EndCallScreen({ Key? key, - required this.patient, + this.patient, }) : super(key: key); @override @@ -49,7 +49,7 @@ class _EndCallScreenState extends State { @override void initState() { super.initState(); - if (widget.patient != null) patient = widget.patient; + if (widget.patient != null) patient = widget.patient!; } @override @@ -233,11 +233,11 @@ class _EndCallScreenState extends State { isInPatient: cardsList[index].isInPatient, isDischargedPatient: cardsList[index].isDischargedPatient, isDisable: cardsList[index].isDisable, - onTap: cardsList[index].onTap, + onTap: cardsList[index].onTap!, isLoading: cardsList[index].isLoading, isDartIcon: cardsList[index].isDartIcon, - dartIcon: cardsList[index].dartIcon, - color: cardsList[index].color, + dartIcon: cardsList[index].dartIcon!, + color: cardsList[index].color!, ), ), ], diff --git a/lib/screens/patients/DischargedPatientPage.dart b/lib/screens/patients/DischargedPatientPage.dart index 778bd1bf..97464ca9 100644 --- a/lib/screens/patients/DischargedPatientPage.dart +++ b/lib/screens/patients/DischargedPatientPage.dart @@ -29,7 +29,7 @@ class _DischargedPatientState extends State { builder: (_, model, w) => AppScaffold( //appBarTitle: 'Discharged Patient', //subtitle: "Last Three Months", - backgroundColor: Colors.grey[200], + backgroundColor: Colors.grey[200]!, isShowAppBar: false, baseViewModel: model, body: model.myDischargedPatient.isEmpty @@ -58,7 +58,7 @@ class _DischargedPatientState extends State { DoctorApp.filter_1, color: Colors.black, ), - iconSize: 20, + iconSize: 20, onPressed: () { }, ), ), SizedBox( @@ -155,17 +155,17 @@ class _DischargedPatientState extends State { .filterData[ index] .nationalityName - .trim() + !.trim() : model.filterData[index].nationality != null ? model .filterData[ index] .nationality - .trim() + !.trim() : model.filterData[index].nationalityId != null - ? model.filterData[index].nationalityId + ? model.filterData[index].nationalityId! : "", fontWeight: FontWeight @@ -187,7 +187,7 @@ class _DischargedPatientState extends State { .network( model.filterData[index].nationalityFlagURL != null - ? model.filterData[index].nationalityFlagURL + ? model.filterData[index].nationalityFlagURL! : '', height: 25, @@ -196,7 +196,7 @@ class _DischargedPatientState extends State { errorBuilder: (BuildContext context, Object exception, - StackTrace + StackTrace? stackTrace) { return AppText( '', @@ -254,7 +254,7 @@ class _DischargedPatientState extends State { style: new TextStyle( fontSize: 2.0 * SizeConfig - .textMultiplier, + .textMultiplier!, color: Colors .black), children: < @@ -292,7 +292,7 @@ class _DischargedPatientState extends State { new TextStyle( fontSize: 2.0 * SizeConfig - .textMultiplier, + .textMultiplier!, color: Colors .black, fontFamily: @@ -330,7 +330,7 @@ class _DischargedPatientState extends State { new TextStyle( fontSize: 2.0 * SizeConfig - .textMultiplier, + .textMultiplier!, color: Colors .black, fontFamily: @@ -369,7 +369,7 @@ class _DischargedPatientState extends State { .w300, ), AppText( - "${AppDateUtils.convertStringToDate(model.filterData[index].dischargeDate).difference(AppDateUtils.getDateTimeFromServerFormat(model.filterData[index].admissionDate)).inDays + 1}", + "${AppDateUtils.convertStringToDate(model.filterData[index].dischargeDate!).difference(AppDateUtils.getDateTimeFromServerFormat(model.filterData[index].admissionDate!)).inDays + 1}", fontSize: 15, fontWeight: diff --git a/lib/screens/patients/ECGPage.dart b/lib/screens/patients/ECGPage.dart index d35b4ee3..683698a5 100644 --- a/lib/screens/patients/ECGPage.dart +++ b/lib/screens/patients/ECGPage.dart @@ -17,7 +17,7 @@ import 'package:url_launcher/url_launcher.dart'; class ECGPage extends StatelessWidget { @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['patient-type']; String arrivalType = routeArgs['arrival-type']; @@ -60,7 +60,7 @@ class ECGPage extends StatelessWidget { (index) => InkWell( onTap: () async { await launch(model - .patientMuseResultsModelList[index].imageURL); + .patientMuseResultsModelList[index].imageURL!); }, child: Container( width: double.infinity, @@ -92,7 +92,7 @@ class ECGPage extends StatelessWidget { text: TextSpan( style: TextStyle( fontSize: 1.6 * - SizeConfig.textMultiplier, + SizeConfig.textMultiplier!, color: Colors.black), children: [ new TextSpan( @@ -122,15 +122,15 @@ class ECGPage extends StatelessWidget { CrossAxisAlignment.end, children: [ AppText( - '${AppDateUtils.getDayMonthYearDateFormatted(model.patientMuseResultsModelList[index].createdOnDateTime, isArabic: projectViewModel.isArabic)}', + '${AppDateUtils.getDayMonthYearDateFormatted(model.patientMuseResultsModelList[index].createdOnDateTime!, isArabic: projectViewModel.isArabic)}', color: Colors.black, fontWeight: FontWeight.w600, fontSize: 14, ), AppText( - '${AppDateUtils.getHour(model.patientMuseResultsModelList[index].createdOnDateTime)}', + '${AppDateUtils.getHour(model.patientMuseResultsModelList[index].createdOnDateTime!)}', fontWeight: FontWeight.w600, - color: Colors.grey[700], + color: Colors.grey[700]!, fontSize: 14, ), ], diff --git a/lib/screens/patients/ReferralDischargedPatientDetails.dart b/lib/screens/patients/ReferralDischargedPatientDetails.dart index e7b9277e..6a6f65d3 100644 --- a/lib/screens/patients/ReferralDischargedPatientDetails.dart +++ b/lib/screens/patients/ReferralDischargedPatientDetails.dart @@ -50,9 +50,8 @@ class ReferralDischargedPatientDetails extends StatelessWidget { ), Expanded( child: AppText( - (Utils.capitalize( - "${referredPatient.firstName} ${referredPatient.lastName}")), - fontSize: SizeConfig.textMultiplier * 2.5, + (Utils.capitalize("${referredPatient.firstName} ${referredPatient.lastName}")), + fontSize: SizeConfig.textMultiplier! * 2.5, fontWeight: FontWeight.bold, fontFamily: 'Poppins', ), @@ -68,20 +67,15 @@ class ReferralDischargedPatientDetails extends StatelessWidget { ), InkWell( onTap: () { - PatiantInformtion patient = - model.getPatientFromDischargeReferralPatient( - referredPatient); - Navigator.of(context) - .pushNamed(PATIENTS_PROFILE, arguments: { + PatiantInformtion patient = model.getPatientFromDischargeReferralPatient(referredPatient); + Navigator.of(context).pushNamed(PATIENTS_PROFILE, arguments: { "patient": patient, "patientType": "1", "isInpatient": true, "arrivalType": "1", "isDischargedPatient": true, - "from": AppDateUtils.convertDateToFormat( - DateTime.now(), 'yyyy-MM-dd'), - "to": AppDateUtils.convertDateToFormat( - DateTime.now(), 'yyyy-MM-dd'), + "from": AppDateUtils.convertDateToFormat(DateTime.now(), 'yyyy-MM-dd'), + "to": AppDateUtils.convertDateToFormat(DateTime.now(), 'yyyy-MM-dd'), }); }, child: Icon( @@ -112,27 +106,26 @@ class ReferralDischargedPatientDetails extends StatelessWidget { child: Column( children: [ Row( - mainAxisAlignment: - MainAxisAlignment.spaceBetween, + mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ AppText( - "${model.getReferralStatusNameByCode(referredPatient.referralStatus, context)}", + "${model.getReferralStatusNameByCode(referredPatient.referralStatus!, context)}", fontFamily: 'Poppins', - fontSize: 1.9 * SizeConfig.textMultiplier, + fontSize: 1.9 * SizeConfig.textMultiplier!, fontWeight: FontWeight.w700, color: referredPatient.referralStatus == 1 ? AppGlobal.inProgressColor : referredPatient.referralStatus == 46 ? AppGlobal.appGreenColor - : Colors.red[700], + : Colors.red[700]!, ), AppText( AppDateUtils.getDayMonthYearDateFormatted( - referredPatient.referralDate, + referredPatient.referralDate!, ), fontFamily: 'Poppins', fontWeight: FontWeight.w600, - fontSize: 2.0 * SizeConfig.textMultiplier, + fontSize: 2.0 * SizeConfig.textMultiplier!, color: Color(0XFF28353E), ) ], @@ -145,19 +138,15 @@ class ReferralDischargedPatientDetails extends StatelessWidget { "Admission Date: ", fontFamily: 'Poppins', fontWeight: FontWeight.w600, - fontSize: 1.7 * SizeConfig.textMultiplier, + fontSize: 1.7 * SizeConfig.textMultiplier!, color: Color(0XFF575757), ), Expanded( child: AppText( - AppDateUtils - .convertDateFromServerFormat( - referredPatient.admissionDate, - "dd MMM,yyyy"), + AppDateUtils.convertDateFromServerFormat(referredPatient.admissionDate!, "dd MMM,yyyy"), fontFamily: 'Poppins', fontWeight: FontWeight.w700, - fontSize: - 1.8 * SizeConfig.textMultiplier, + fontSize: 1.8 * SizeConfig.textMultiplier!, color: Color(0XFF2E303A), ), ), @@ -171,19 +160,15 @@ class ReferralDischargedPatientDetails extends StatelessWidget { "Discharge Date: ", fontFamily: 'Poppins', fontWeight: FontWeight.w600, - fontSize: 1.7 * SizeConfig.textMultiplier, + fontSize: 1.7 * SizeConfig.textMultiplier!, color: Color(0XFF575757), ), Expanded( child: AppText( - AppDateUtils - .convertDateFromServerFormat( - referredPatient.dischargeDate, - "dd MMM,yyyy"), + AppDateUtils.convertDateFromServerFormat(referredPatient.dischargeDate!, "dd MMM,yyyy"), fontFamily: 'Poppins', fontWeight: FontWeight.w700, - fontSize: - 1.8 * SizeConfig.textMultiplier, + fontSize: 1.8 * SizeConfig.textMultiplier!, color: Color(0XFF2E303A), ), ), @@ -197,16 +182,15 @@ class ReferralDischargedPatientDetails extends StatelessWidget { "Number of Days: ", fontFamily: 'Poppins', fontWeight: FontWeight.w600, - fontSize: 1.7 * SizeConfig.textMultiplier, + fontSize: 1.7 * SizeConfig.textMultiplier!, color: Color(0XFF575757), ), Expanded( child: AppText( - "${AppDateUtils.convertStringToDate(referredPatient.dischargeDate).difference(AppDateUtils.convertStringToDate(referredPatient.admissionDate)).inDays + 1}", + "${AppDateUtils.convertStringToDate(referredPatient.dischargeDate!).difference(AppDateUtils.convertStringToDate(referredPatient.admissionDate!)).inDays + 1}", fontFamily: 'Poppins', fontWeight: FontWeight.w700, - fontSize: - 1.8 * SizeConfig.textMultiplier, + fontSize: 1.8 * SizeConfig.textMultiplier!, color: Color(0XFF2E303A), ), ), @@ -220,44 +204,38 @@ class ReferralDischargedPatientDetails extends StatelessWidget { "Referring Doctor ", fontFamily: 'Poppins', fontWeight: FontWeight.w600, - fontSize: 1.7 * SizeConfig.textMultiplier, + fontSize: 1.7 * SizeConfig.textMultiplier!, color: Color(0XFF575757), ), Expanded( child: AppText( - referredPatient.referringDoctorName, + referredPatient.referringDoctorName!, fontFamily: 'Poppins', fontWeight: FontWeight.w700, - fontSize: - 1.8 * SizeConfig.textMultiplier, + fontSize: 1.8 * SizeConfig.textMultiplier!, color: Color(0XFF2E303A), ), ), ], ), Row( - mainAxisAlignment: - MainAxisAlignment.spaceBetween, + mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ Row( - mainAxisAlignment: - MainAxisAlignment.start, + mainAxisAlignment: MainAxisAlignment.start, children: [ AppText( - TranslationBase.of(context) - .fileNumber, + TranslationBase.of(context).fileNumber, fontFamily: 'Poppins', fontWeight: FontWeight.w600, - fontSize: - 1.7 * SizeConfig.textMultiplier, + fontSize: 1.7 * SizeConfig.textMultiplier!, color: Color(0XFF575757), ), AppText( "${referredPatient.patientID}", fontFamily: 'Poppins', fontWeight: FontWeight.w700, - fontSize: - 1.8 * SizeConfig.textMultiplier, + fontSize: 1.8 * SizeConfig.textMultiplier!, color: Color(0XFF2E303A), ), ], @@ -265,60 +243,48 @@ class ReferralDischargedPatientDetails extends StatelessWidget { ], ), Row( - mainAxisAlignment: - MainAxisAlignment.spaceBetween, + mainAxisAlignment: MainAxisAlignment.spaceBetween, crossAxisAlignment: CrossAxisAlignment.center, children: [ Expanded( child: Column( children: [ Row( - mainAxisAlignment: - MainAxisAlignment.start, + mainAxisAlignment: MainAxisAlignment.start, children: [ AppText( "${TranslationBase.of(context).refClinic}: ", fontFamily: 'Poppins', fontWeight: FontWeight.w600, - fontSize: 1.7 * - SizeConfig.textMultiplier, + fontSize: 1.7 * SizeConfig.textMultiplier!, color: Color(0XFF575757), ), AppText( - referredPatient - .referringClinicDescription, + referredPatient.referringClinicDescription!, fontFamily: 'Poppins', fontWeight: FontWeight.w700, - fontSize: 1.8 * - SizeConfig.textMultiplier, + fontSize: 1.8 * SizeConfig.textMultiplier!, color: Color(0XFF2E303A), ), ], ), Row( - mainAxisAlignment: - MainAxisAlignment.start, - crossAxisAlignment: - CrossAxisAlignment.start, + mainAxisAlignment: MainAxisAlignment.start, + crossAxisAlignment: CrossAxisAlignment.start, children: [ AppText( - TranslationBase.of(context) - .frequency + - ": ", + TranslationBase.of(context).frequency + ": ", fontFamily: 'Poppins', fontWeight: FontWeight.w600, - fontSize: 1.7 * - SizeConfig.textMultiplier, + fontSize: 1.7 * SizeConfig.textMultiplier!, color: Color(0XFF575757), ), Expanded( child: AppText( - referredPatient - .frequencyDescription, + referredPatient.frequencyDescription!, fontFamily: 'Poppins', fontWeight: FontWeight.w700, - fontSize: 1.8 * - SizeConfig.textMultiplier, + fontSize: 1.8 * SizeConfig.textMultiplier!, color: Color(0XFF2E303A), ), ), @@ -334,20 +300,18 @@ class ReferralDischargedPatientDetails extends StatelessWidget { crossAxisAlignment: CrossAxisAlignment.start, children: [ AppText( - TranslationBase.of(context).priority + - ": ", + TranslationBase.of(context).priority + ": ", fontFamily: 'Poppins', fontWeight: FontWeight.w600, - fontSize: 1.7 * SizeConfig.textMultiplier, + fontSize: 1.7 * SizeConfig.textMultiplier!, color: Color(0XFF575757), ), Expanded( child: AppText( - referredPatient.priorityDescription, + referredPatient.priorityDescription!, fontFamily: 'Poppins', fontWeight: FontWeight.w700, - fontSize: - 1.8 * SizeConfig.textMultiplier, + fontSize: 1.8 * SizeConfig.textMultiplier!, color: Color(0XFF2E303A), ), ), @@ -361,17 +325,15 @@ class ReferralDischargedPatientDetails extends StatelessWidget { "Referring Clinic ", fontFamily: 'Poppins', fontWeight: FontWeight.w600, - fontSize: 1.7 * SizeConfig.textMultiplier, + fontSize: 1.7 * SizeConfig.textMultiplier!, color: Color(0XFF575757), ), Expanded( child: AppText( - referredPatient - .referringClinicDescription, + referredPatient.referringClinicDescription!, fontFamily: 'Poppins', fontWeight: FontWeight.w700, - fontSize: - 1.8 * SizeConfig.textMultiplier, + fontSize: 1.8 * SizeConfig.textMultiplier!, color: Color(0XFF2E303A), ), ), @@ -385,7 +347,7 @@ class ReferralDischargedPatientDetails extends StatelessWidget { "Frequency ", fontFamily: 'Poppins', fontWeight: FontWeight.w600, - fontSize: 1.7 * SizeConfig.textMultiplier, + fontSize: 1.7 * SizeConfig.textMultiplier!, color: Color(0XFF575757), ), Expanded( @@ -393,8 +355,7 @@ class ReferralDischargedPatientDetails extends StatelessWidget { referredPatient.frequency.toString(), fontFamily: 'Poppins', fontWeight: FontWeight.w700, - fontSize: - 1.8 * SizeConfig.textMultiplier, + fontSize: 1.8 * SizeConfig.textMultiplier!, color: Color(0XFF2E303A), ), ), @@ -408,7 +369,7 @@ class ReferralDischargedPatientDetails extends StatelessWidget { "Priority ", fontFamily: 'Poppins', fontWeight: FontWeight.w600, - fontSize: 1.7 * SizeConfig.textMultiplier, + fontSize: 1.7 * SizeConfig.textMultiplier!, color: Color(0XFF575757), ), Expanded( @@ -416,8 +377,7 @@ class ReferralDischargedPatientDetails extends StatelessWidget { referredPatient.frequency.toString(), fontFamily: 'Poppins', fontWeight: FontWeight.w700, - fontSize: - 1.8 * SizeConfig.textMultiplier, + fontSize: 1.8 * SizeConfig.textMultiplier!, color: Color(0XFF2E303A), ), ), @@ -428,24 +388,18 @@ class ReferralDischargedPatientDetails extends StatelessWidget { crossAxisAlignment: CrossAxisAlignment.start, children: [ AppText( - TranslationBase.of(context) - .maxResponseTime + - ": ", + TranslationBase.of(context).maxResponseTime + ": ", fontFamily: 'Poppins', fontWeight: FontWeight.w600, - fontSize: 1.7 * SizeConfig.textMultiplier, + fontSize: 1.7 * SizeConfig.textMultiplier!, color: Color(0XFF575757), ), Expanded( child: AppText( - AppDateUtils - .convertDateFromServerFormat( - referredPatient.mAXResponseTime, - "dd MMM,yyyy"), + AppDateUtils.convertDateFromServerFormat(referredPatient.mAXResponseTime!, "dd MMM,yyyy"), fontFamily: 'Poppins', fontWeight: FontWeight.w700, - fontSize: - 1.8 * SizeConfig.textMultiplier, + fontSize: 1.8 * SizeConfig.textMultiplier!, color: Color(0XFF2E303A), ), ), @@ -455,8 +409,7 @@ class ReferralDischargedPatientDetails extends StatelessWidget { crossAxisAlignment: CrossAxisAlignment.start, children: [ Container( - margin: - EdgeInsets.only(left: 10, right: 0), + margin: EdgeInsets.only(left: 10, right: 0), child: Image.asset( 'assets/images/patient/ic_ref_arrow_left.png', height: 50, @@ -500,30 +453,22 @@ class ReferralDischargedPatientDetails extends StatelessWidget { Expanded( flex: 4, child: Container( - margin: EdgeInsets.only( - left: 10, - top: 30, - right: 10, - bottom: 0), + margin: EdgeInsets.only(left: 10, top: 30, right: 10, bottom: 0), child: Column( - crossAxisAlignment: - CrossAxisAlignment.start, + crossAxisAlignment: CrossAxisAlignment.start, children: [ AppText( "${TranslationBase.of(context).dr} ${referredPatient.referringDoctorName}", fontFamily: 'Poppins', fontWeight: FontWeight.w800, - fontSize: 1.5 * - SizeConfig.textMultiplier, + fontSize: 1.5 * SizeConfig.textMultiplier!, color: Colors.black, ), AppText( - referredPatient - .referringClinicDescription, + referredPatient.referringClinicDescription!, fontFamily: 'Poppins', fontWeight: FontWeight.w700, - fontSize: 1.3 * - SizeConfig.textMultiplier, + fontSize: 1.3 * SizeConfig.textMultiplier!, color: Color(0XFF2E303A), ), ], @@ -563,14 +508,14 @@ class ReferralDischargedPatientDetails extends StatelessWidget { TranslationBase.of(context).remarks, fontFamily: 'Poppins', fontWeight: FontWeight.w700, - fontSize: 2.4 * SizeConfig.textMultiplier, + fontSize: 2.4 * SizeConfig.textMultiplier!, color: Color(0XFF2E303A), ), AppText( - referredPatient.referringDoctorRemarks, + referredPatient.referringDoctorRemarks!, fontFamily: 'Poppins', fontWeight: FontWeight.w600, - fontSize: 1.8 * SizeConfig.textMultiplier, + fontSize: 1.8 * SizeConfig.textMultiplier!, color: Color(0XFF2E303A), ), SizedBox( diff --git a/lib/screens/patients/ReferralDischargedPatientPage.dart b/lib/screens/patients/ReferralDischargedPatientPage.dart index 57a48de5..0ee33ee2 100644 --- a/lib/screens/patients/ReferralDischargedPatientPage.dart +++ b/lib/screens/patients/ReferralDischargedPatientPage.dart @@ -26,7 +26,7 @@ class _ReferralDischargedPatientPageState onModelReady: (model) => model.gtMyDischargeReferralPatient(), builder: (_, model, w) => AppScaffold( appBarTitle: 'Referral Discharged ', - backgroundColor: Colors.grey[200], + backgroundColor: Colors.grey[200]!, isShowAppBar: false, baseViewModel: model, body: model.myDischargeReferralPatient.isEmpty @@ -63,27 +63,27 @@ class _ReferralDischargedPatientPageState model.getReferralStatusNameByCode( model .myDischargeReferralPatient[index] - .referralStatus, + .referralStatus!, context), referralStatusCode: model .myDischargeReferralPatient[index] - .referralStatus, + .referralStatus!, patientName: model .myDischargeReferralPatient[index] - .firstName + + .firstName! + " " + model.myDischargeReferralPatient[index] - .lastName, + .lastName!, patientGender: model - .myDischargeReferralPatient[index].gender, + .myDischargeReferralPatient[index].gender!, referredDate: AppDateUtils.getDayMonthYearDateFormatted( model .myDischargeReferralPatient[index] - .referralDate), + .referralDate!), referredTime: AppDateUtils.getTimeHHMMA(model .myDischargeReferralPatient[index] - .referralDate), + .referralDate!), patientID: "${model.myDischargeReferralPatient[index].patientID}", isSameBranch: false, @@ -93,20 +93,20 @@ class _ReferralDischargedPatientPageState "${model.myDischargeReferralPatient[index].referringClinicDescription}", remark: model .myDischargeReferralPatient[index] - .referringDoctorRemarks, + .referringDoctorRemarks!, nationality: model .myDischargeReferralPatient[index] - .nationalityName, + .nationalityName!, nationalityFlag: '', //model.myDischargeReferralPatient[index].nationalityFlagURL, //TODO From backend doctorAvatar: '', //model.myDischargeReferralPatient[index].doctorImageURL, //TODO From backend referralDoctorName: model .myDischargeReferralPatient[index] - .referringDoctorName, + .referringDoctorName!, clinicDescription: model .myDischargeReferralPatient[index] - .referringClinicDescription, + .referringClinicDescription!, infoIcon: Icon(FontAwesomeIcons.arrowRight, size: 25, color: Colors.black), ), diff --git a/lib/screens/patients/insurance_approval_screen_patient.dart b/lib/screens/patients/insurance_approval_screen_patient.dart index bc5f5ec8..1c672582 100644 --- a/lib/screens/patients/insurance_approval_screen_patient.dart +++ b/lib/screens/patients/insurance_approval_screen_patient.dart @@ -20,7 +20,7 @@ import '../base/base_view.dart'; class InsuranceApprovalScreenNew extends StatefulWidget { final int appointmentNo; - InsuranceApprovalScreenNew({this.appointmentNo}); + InsuranceApprovalScreenNew({this.appointmentNo = 0}); @override _InsuranceApprovalScreenNewState createState() => @@ -32,7 +32,7 @@ class _InsuranceApprovalScreenNewState @override Widget build(BuildContext context) { ProjectViewModel 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']; patient = routeArgs['patient']; String patientType = routeArgs['patientType']; @@ -42,10 +42,10 @@ class _InsuranceApprovalScreenNewState ? (model) => model.getInsuranceInPatient(mrn: patient.patientId) : patient.appointmentNo != null ? (model) => model.getInsuranceApproval(patient, - appointmentNo: int.parse(patient?.appointmentNo.toString()), + appointmentNo: int.parse(patient.appointmentNo!.toString()), projectId: patient.projectId) : (model) => model.getInsuranceApproval(patient), - builder: (BuildContext context, InsuranceViewModel model, Widget child) => + builder: (BuildContext context, InsuranceViewModel model, Widget? child) => AppScaffold( appBar: PatientProfileAppBar( patient, @@ -58,9 +58,9 @@ class _InsuranceApprovalScreenNewState ? SingleChildScrollView( child: Container( margin: EdgeInsets.only( - left: SizeConfig.screenWidth * 0.004, - right: SizeConfig.screenWidth * 0.004, - top: SizeConfig.screenWidth * 0.04, + left: SizeConfig.screenWidth! * 0.004, + right: SizeConfig.screenWidth! * 0.004, + top: SizeConfig.screenWidth! * 0.04, ), child: model.insuranceApprovalInPatient.length != 0 ? Column( @@ -93,13 +93,13 @@ class _InsuranceApprovalScreenNewState patientOut: "In Patient", profileUrl: model .insuranceApprovalInPatient[index] - .doctorImage, + .doctorImage!, clinic: model .insuranceApprovalInPatient[index] - .clinicName, + .clinicName!, doctorName: model .insuranceApprovalInPatient[index] - .doctorName, + .doctorName!, approvalNo: model .insuranceApprovalInPatient[index] .approvalNo @@ -111,7 +111,7 @@ class _InsuranceApprovalScreenNewState '', branch2: model .insuranceApprovalInPatient[index] - .projectName, + .projectName!, ), ), ), @@ -127,9 +127,9 @@ class _InsuranceApprovalScreenNewState : SingleChildScrollView( child: Container( margin: EdgeInsets.only( - left: SizeConfig.screenWidth * 0.004, - right: SizeConfig.screenWidth * 0.004, - top: SizeConfig.screenWidth * 0.04, + left: SizeConfig.screenWidth! * 0.004, + right: SizeConfig.screenWidth! * 0.004, + top: SizeConfig.screenWidth! * 0.04, ), child: model.insuranceApproval.length != 0 ? Column( @@ -168,13 +168,13 @@ class _InsuranceApprovalScreenNewState }, child: DoctorCardInsurance( patientOut: model.insuranceApproval[index] - .patientDescription, + .patientDescription!, profileUrl: model - .insuranceApproval[index].doctorImage, + .insuranceApproval[index].doctorImage!, clinic: model - .insuranceApproval[index].clinicName, + .insuranceApproval[index].clinicName!, doctorName: model - .insuranceApproval[index].doctorName, + .insuranceApproval[index].doctorName!, approvalNo: model .insuranceApproval[index].approvalNo .toString(), @@ -184,7 +184,7 @@ class _InsuranceApprovalScreenNewState .approvalStatusDescption ?? '', branch2: model - .insuranceApproval[index].projectName, + .insuranceApproval[index].projectName!, ), ), ), diff --git a/lib/screens/patients/insurance_approvals_details.dart b/lib/screens/patients/insurance_approvals_details.dart index 2f96d2eb..1e8b190e 100644 --- a/lib/screens/patients/insurance_approvals_details.dart +++ b/lib/screens/patients/insurance_approvals_details.dart @@ -17,791 +17,554 @@ import 'package:provider/provider.dart'; import '../../config/config.dart'; class InsuranceApprovalsDetails extends StatefulWidget { - PatiantInformtion patient; + PatiantInformtion? patient; int indexInsurance; String patientType; - InsuranceApprovalsDetails( - {this.patient, this.indexInsurance, this.patientType}); + InsuranceApprovalsDetails({this.patient, this.indexInsurance = 0, this.patientType = ''}); @override - _InsuranceApprovalsDetailsState createState() => - _InsuranceApprovalsDetailsState( - patient: patient, - indexInsurance: indexInsurance, - patientType: patientType); + _InsuranceApprovalsDetailsState createState() => _InsuranceApprovalsDetailsState(patient: patient!, indexInsurance: indexInsurance, patientType: patientType); } class _InsuranceApprovalsDetailsState extends State { - PatiantInformtion patient; + PatiantInformtion? patient; int indexInsurance; String patientType; - _InsuranceApprovalsDetailsState( - {this.patient, this.indexInsurance, this.patientType}); + _InsuranceApprovalsDetailsState({this.patient, this.indexInsurance = 0, this.patientType = ''}); @override Widget build(BuildContext context) { ProjectViewModel projectViewModel = Provider.of(context); - final routeArgs = ModalRoute.of(context).settings.arguments as Map; + final routeArgs = ModalRoute.of(context)!.settings.arguments as Map; return BaseView( onModelReady: (model) => model.insuranceApprovalInPatient.length == 0 - ? patient.admissionNo != null - ? (model) => model.getInsuranceInPatient(mrn: patient.patientId) - : patient.appointmentNo != null - ? (model) => model.getInsuranceApproval(patient, - appointmentNo: patient.appointmentNo, - projectId: patient.projectId) + ? patient!.admissionNo != null + ? (model) => model.getInsuranceInPatient(mrn: patient!.patientId) + : patient!.appointmentNo != null + ? (model) => model.getInsuranceApproval(patient, appointmentNo: patient!.appointmentNo, projectId: patient!.projectId) : (model) => model.getInsuranceApproval(patient) : null, - builder: (BuildContext context, InsuranceViewModel model, Widget child) => - AppScaffold( - isShowAppBar: true, - baseViewModel: model, - appBar: PatientProfileAppBar(patient), - body: patient.admissionNo != null - ? SingleChildScrollView( - child: Container( - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - ServiceTitle( - title: TranslationBase.of(context).insurance22, - subTitle: TranslationBase.of(context).approvals22, - ), - Container( - margin: EdgeInsets.all(10), - decoration: BoxDecoration( - border: Border.all( - width: 0.5, - color: Colors.white, - ), - borderRadius: BorderRadius.all( - Radius.circular(15.0), - ), - color: Colors.white), - child: Padding( - padding: const EdgeInsets.all(8.0), - child: Column( + builder: (BuildContext context, InsuranceViewModel model, Widget? child) => AppScaffold( + isShowAppBar: true, + baseViewModel: model, + appBar: PatientProfileAppBar(patient!), + body: patient!.admissionNo != null + ? SingleChildScrollView( + child: Container( + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + ServiceTitle( + title: TranslationBase.of(context).insurance22, + subTitle: TranslationBase.of(context).approvals22, + ), + Container( + margin: EdgeInsets.all(10), + decoration: BoxDecoration( + border: Border.all( + width: 0.5, + color: Colors.white, + ), + borderRadius: BorderRadius.all( + Radius.circular(15.0), + ), + color: Colors.white), + child: Padding( + padding: const EdgeInsets.all(8.0), + child: Column( + children: [ + Row( children: [ - Row( - children: [ - AppText( - model - .insuranceApprovalInPatient[ - indexInsurance] - .approvalStatusDescption != - null - ? model - .insuranceApprovalInPatient[ - indexInsurance] - .approvalStatusDescption ?? - "" - : "", - color: model - .insuranceApprovalInPatient[ - indexInsurance] - .approvalStatusDescption != - null - ? "${model.insuranceApprovalInPatient[indexInsurance].approvalStatusDescption}" == - "Approved" || - "${model.insuranceApprovalInPatient[indexInsurance].approvalStatusDescption}" == - "تمت الموافقة" - ? AppGlobal.appGreenColor - : Color(0xffD02127) - : Color(0xffD02127), - letterSpacing: -0.4, - fontWeight: FontWeight.w600, - fontSize: SizeConfig - .getTextMultiplierBasedOnWidth() * - 2.7, - ), - ], - ), - Row( - children: [ - AppText( - model - .insuranceApprovalInPatient[ - indexInsurance] - .doctorName - .toUpperCase(), - color: Color(0xff2E303A), - fontSize: 16, - letterSpacing: -0.64, - fontWeight: FontWeight.w600, - ) - ], + AppText( + model.insuranceApprovalInPatient[indexInsurance].approvalStatusDescption != null + ? model.insuranceApprovalInPatient[indexInsurance].approvalStatusDescption ?? "" + : "", + color: model.insuranceApprovalInPatient[indexInsurance].approvalStatusDescption != null + ? "${model.insuranceApprovalInPatient[indexInsurance].approvalStatusDescption}" == "Approved" || + "${model.insuranceApprovalInPatient[indexInsurance].approvalStatusDescption}" == "تمت الموافقة" + ? AppGlobal.appGreenColor + : Color(0xffD02127) + : Color(0xffD02127), + letterSpacing: -0.4, + fontWeight: FontWeight.w600, + fontSize: SizeConfig.getTextMultiplierBasedOnWidth() * 2.7, ), - Padding( - padding: const EdgeInsets.symmetric( - horizontal: 8.0), - child: Row( + ], + ), + Row( + children: [ + AppText( + model.insuranceApprovalInPatient[indexInsurance].doctorName!.toUpperCase(), + color: Color(0xff2E303A), + fontSize: 16, + letterSpacing: -0.64, + fontWeight: FontWeight.w600, + ) + ], + ), + Padding( + padding: const EdgeInsets.symmetric(horizontal: 8.0), + child: Row( + children: [ + Column( children: [ - Column( - children: [ - Container( - height: MediaQuery.of(context) - .size - .height * - 0.065, - width: MediaQuery.of(context) - .size - .height * - 0.065, - child: CircleAvatar( - radius: SizeConfig - .imageSizeMultiplier * - 12, - // radius: (52) - child: ClipRRect( - borderRadius: - BorderRadius.circular( - 50), - child: Image.network( - model - .insuranceApprovalInPatient[ - indexInsurance] - .doctorImage, - fit: BoxFit.fill, - width: 700, - ), - ), - backgroundColor: - Colors.transparent, + Container( + height: MediaQuery.of(context).size.height * 0.065, + width: MediaQuery.of(context).size.height * 0.065, + child: CircleAvatar( + radius: SizeConfig.imageSizeMultiplier! * 12, + // radius: (52) + child: ClipRRect( + borderRadius: BorderRadius.circular(50), + child: Image.network( + model.insuranceApprovalInPatient[indexInsurance].doctorImage!, + fit: BoxFit.fill, + width: 700, ), ), - ], - ), - Expanded( - child: Padding( - padding: - const EdgeInsets.symmetric( - horizontal: 8.0), - child: Column( - crossAxisAlignment: - CrossAxisAlignment.start, - //mainAxisAlignment: MainAxisAlignment.center, - children: [ - SizedBox( - height: 25.0, - ), - CustomRow( - label: TranslationBase.of( - context) - .clinic + - ": ", - value: model - .insuranceApprovalInPatient[ - indexInsurance] - .clinicName, - ), - CustomRow( - label: TranslationBase.of( - context) - .approvalNo + - ": ", - value: model - .insuranceApprovalInPatient[ - indexInsurance] - .approvalNo - .toString(), - ), - CustomRow( - label: 'Unused Count:', - value: model - .insuranceApprovalInPatient[ - indexInsurance] - .unUsedCount - .toString(), - ), - CustomRow( - label: TranslationBase.of( - context) - .companyName + - ": ", - value: 'Sample'), - CustomRow( - label: TranslationBase.of( - context) - .receiptOn + - ": ", - value: - '${AppDateUtils.getDayMonthYearDateFormatted(AppDateUtils.getDateTimeFromServerFormat(model.insuranceApprovalInPatient[indexInsurance].receiptOn ?? ""), isArabic: projectViewModel.isArabic)}'), - CustomRow( - label: TranslationBase.of( - context) - .expiryDate + - ": ", - value: - '${AppDateUtils.getDayMonthYearDateFormatted(AppDateUtils.getDateTimeFromServerFormat(model.insuranceApprovalInPatient[indexInsurance].expiryDate ?? ""), isArabic: projectViewModel.isArabic)}'), - ], - ), + backgroundColor: Colors.transparent, ), ), ], ), - ), - SizedBox( - height: 20.0, - ), - Container( - child: Column( - children: [ - Padding( - padding: const EdgeInsets.symmetric( - horizontal: 8.0), - child: Row( - children: [ - Expanded( - child: AppText( - TranslationBase.of(context) - .procedure, - fontWeight: FontWeight.w600, - color: Color(0xff2E303A), - letterSpacing: -0.48, - fontSize: SizeConfig - .getTextMultiplierBasedOnWidth() * - 2.9, - ), - ), - Expanded( - child: AppText( - TranslationBase.of(context) - .status, - fontWeight: FontWeight.w600, - color: Color(0xff2E303A), - letterSpacing: -0.48, - fontSize: SizeConfig - .getTextMultiplierBasedOnWidth() * - 2.9, - ), - ), - Expanded( - child: AppText( - TranslationBase.of(context) - .usageStatus, - fontWeight: FontWeight.w600, - color: Color(0xff2E303A), - letterSpacing: -0.48, - fontSize: SizeConfig - .getTextMultiplierBasedOnWidth() * - 2.9, - ), - ) - ], - ), - ), - Divider( - color: Colors.black, + Expanded( + child: Padding( + padding: const EdgeInsets.symmetric(horizontal: 8.0), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + //mainAxisAlignment: MainAxisAlignment.center, + children: [ + SizedBox( + height: 25.0, + ), + CustomRow( + label: TranslationBase.of(context).clinic + ": ", + value: model.insuranceApprovalInPatient[indexInsurance].clinicName!, + ), + CustomRow( + label: TranslationBase.of(context).approvalNo + ": ", + value: model.insuranceApprovalInPatient[indexInsurance].approvalNo.toString(), + ), + CustomRow( + label: 'Unused Count:', + value: model.insuranceApprovalInPatient[indexInsurance].unUsedCount.toString(), + ), + CustomRow(label: TranslationBase.of(context).companyName + ": ", value: 'Sample'), + CustomRow( + label: TranslationBase.of(context).receiptOn + ": ", + value: + '${AppDateUtils.getDayMonthYearDateFormatted(AppDateUtils.getDateTimeFromServerFormat(model.insuranceApprovalInPatient[indexInsurance].receiptOn ?? ""), isArabic: projectViewModel.isArabic)}'), + CustomRow( + label: TranslationBase.of(context).expiryDate + ": ", + value: + '${AppDateUtils.getDayMonthYearDateFormatted(AppDateUtils.getDateTimeFromServerFormat(model.insuranceApprovalInPatient[indexInsurance].expiryDate ?? ""), isArabic: projectViewModel.isArabic)}'), + ], ), - Padding( - padding: const EdgeInsets.symmetric( - horizontal: 8.0), - child: ListView.builder( - shrinkWrap: true, - physics: ScrollPhysics(), - itemCount: model - .insuranceApprovalInPatient[ - indexInsurance] - .apporvalDetails - .length, - itemBuilder: - (BuildContext context, - int index) { - return Container( - child: Column( + ), + ), + ], + ), + ), + SizedBox( + height: 20.0, + ), + Container( + child: Column( + children: [ + Padding( + padding: const EdgeInsets.symmetric(horizontal: 8.0), + child: Row( + children: [ + Expanded( + child: AppText( + TranslationBase.of(context).procedure, + fontWeight: FontWeight.w600, + color: Color(0xff2E303A), + letterSpacing: -0.48, + fontSize: SizeConfig.getTextMultiplierBasedOnWidth() * 2.9, + ), + ), + Expanded( + child: AppText( + TranslationBase.of(context).status, + fontWeight: FontWeight.w600, + color: Color(0xff2E303A), + letterSpacing: -0.48, + fontSize: SizeConfig.getTextMultiplierBasedOnWidth() * 2.9, + ), + ), + Expanded( + child: AppText( + TranslationBase.of(context).usageStatus, + fontWeight: FontWeight.w600, + color: Color(0xff2E303A), + letterSpacing: -0.48, + fontSize: SizeConfig.getTextMultiplierBasedOnWidth() * 2.9, + ), + ) + ], + ), + ), + Divider( + color: Colors.black, + ), + Padding( + padding: const EdgeInsets.symmetric(horizontal: 8.0), + child: ListView.builder( + shrinkWrap: true, + physics: ScrollPhysics(), + itemCount: model.insuranceApprovalInPatient[indexInsurance].apporvalDetails!.length, + itemBuilder: (BuildContext context, int index) { + return Container( + child: Column( + children: [ + Row( children: [ - Row( - children: [ - Expanded( - child: Container( - child: AppText( - model - .insuranceApprovalInPatient[ - indexInsurance] - ?.apporvalDetails[ - index] - ?.procedureName ?? - "", - textAlign: - TextAlign - .center, - fontSize: - SizeConfig - .getTextMultiplierBasedOnWidth() * - 2.7, - letterSpacing: - -0.4, - color: Color( - 0xff575757), - fontWeight: - FontWeight - .w500, - ), - ), - ), - Expanded( - child: Container( - child: AppText( - model - .insuranceApprovalInPatient[ - indexInsurance] - ?.apporvalDetails[ - index] - ?.status ?? - "", - textAlign: - TextAlign - .center, - fontSize: - SizeConfig - .getTextMultiplierBasedOnWidth() * - 2.7, - letterSpacing: - -0.4, - color: Color( - 0xff575757), - fontWeight: - FontWeight - .w500, - ), - ), - ), - Expanded( - child: Container( - child: AppText( - model - .insuranceApprovalInPatient[ - indexInsurance] - ?.apporvalDetails[ - index] - ?.isInvoicedDesc ?? - "", - textAlign: - TextAlign - .center, - fontSize: - SizeConfig - .getTextMultiplierBasedOnWidth() * - 2.7, - letterSpacing: - -0.4, - color: Color( - 0xff575757), - fontWeight: - FontWeight - .w500, - ), - ), + Expanded( + child: Container( + child: AppText( + model.insuranceApprovalInPatient[indexInsurance].apporvalDetails![index].procedureName ?? "", + textAlign: TextAlign.center, + fontSize: SizeConfig.getTextMultiplierBasedOnWidth() * 2.7, + letterSpacing: -0.4, + color: Color(0xff575757), + fontWeight: FontWeight.w500, ), - ], + ), ), - SizedBox( - width: 5, + Expanded( + child: Container( + child: AppText( + model.insuranceApprovalInPatient[indexInsurance].apporvalDetails![index].status ?? "", + textAlign: TextAlign.center, + fontSize: SizeConfig.getTextMultiplierBasedOnWidth() * 2.7, + letterSpacing: -0.4, + color: Color(0xff575757), + fontWeight: FontWeight.w500, + ), + ), ), - Divider( - color: Colors.black38, + Expanded( + child: Container( + child: AppText( + model.insuranceApprovalInPatient[indexInsurance].apporvalDetails![index].isInvoicedDesc ?? "", + textAlign: TextAlign.center, + fontSize: SizeConfig.getTextMultiplierBasedOnWidth() * 2.7, + letterSpacing: -0.4, + color: Color(0xff575757), + fontWeight: FontWeight.w500, + ), + ), ), ], ), - ); - }), - ), - ], + SizedBox( + width: 5, + ), + Divider( + color: Colors.black38, + ), + ], + ), + ); + }), ), - ), - ], + ], + ), ), - ), + ], ), - ], + ), ), - ), - ) - : SingleChildScrollView( - child: Container( - child: Column( - children: [ - Padding( - padding: const EdgeInsets.all(8.0), - child: Column( + ], + ), + ), + ) + : SingleChildScrollView( + child: Container( + child: Column( + children: [ + Padding( + padding: const EdgeInsets.all(8.0), + child: Column( + children: [ + Row( children: [ - Row( - children: [ - AppText( - TranslationBase.of(context).insurance22, - fontSize: 15.0, - fontWeight: FontWeight.w600, - fontFamily: 'Poppins', - ), - ], - ), - Row( - children: [ - AppText( - TranslationBase.of(context).approvals22, - fontSize: 30.0, - fontWeight: FontWeight.w700, - ), - ], + AppText( + TranslationBase.of(context).insurance22, + fontSize: 15.0, + fontWeight: FontWeight.w600, + fontFamily: 'Poppins', ), ], ), - ), - Container( - margin: EdgeInsets.all(10), - decoration: BoxDecoration( - border: Border.all( - width: 0.5, - color: Colors.white, - ), - borderRadius: BorderRadius.all( - Radius.circular(15.0), + Row( + children: [ + AppText( + TranslationBase.of(context).approvals22, + fontSize: 30.0, + fontWeight: FontWeight.w700, ), - color: Colors.white), - child: Padding( - padding: const EdgeInsets.all(8.0), - child: Column( + ], + ), + ], + ), + ), + Container( + margin: EdgeInsets.all(10), + decoration: BoxDecoration( + border: Border.all( + width: 0.5, + color: Colors.white, + ), + borderRadius: BorderRadius.all( + Radius.circular(15.0), + ), + color: Colors.white), + child: Padding( + padding: const EdgeInsets.all(8.0), + child: Column( + children: [ + Row( children: [ - Row( - children: [ - AppText( - model - .insuranceApproval[ - indexInsurance] - .approvalStatusDescption != - null - ? model - .insuranceApproval[ - indexInsurance] - .approvalStatusDescption ?? - "" - : "", - color: model - .insuranceApproval[ - indexInsurance] - .approvalStatusDescption != - null - ? "${model.insuranceApproval[indexInsurance].approvalStatusDescption}" == - "Approved" - ? AppGlobal.appGreenColor - : Color(0xffD02127) - : Color(0xffD02127), - ), - ], - ), - Row( - children: [ - AppText( - model - .insuranceApproval[indexInsurance] - .doctorName - .toUpperCase(), - color: Colors.black, - fontSize: 18, - fontWeight: FontWeight.bold, - ) - ], + AppText( + model.insuranceApproval[indexInsurance].approvalStatusDescption != null ? model.insuranceApproval[indexInsurance].approvalStatusDescption ?? "" : "", + color: model.insuranceApproval[indexInsurance].approvalStatusDescption != null + ? "${model.insuranceApproval[indexInsurance].approvalStatusDescption}" == "Approved" + ? AppGlobal.appGreenColor + : Color(0xffD02127) + : Color(0xffD02127), ), - Padding( - padding: const EdgeInsets.symmetric( - horizontal: 8.0), - child: Row( + ], + ), + Row( + children: [ + AppText( + model.insuranceApproval[indexInsurance].doctorName!.toUpperCase(), + color: Colors.black, + fontSize: 18, + fontWeight: FontWeight.bold, + ) + ], + ), + Padding( + padding: const EdgeInsets.symmetric(horizontal: 8.0), + child: Row( + children: [ + Column( children: [ - Column( - children: [ - Container( - height: 85.0, - width: 85.0, - child: CircleAvatar( - radius: SizeConfig - .imageSizeMultiplier * - 12, - // radius: (52) - child: ClipRRect( - borderRadius: - BorderRadius.circular( - 50), - child: Image.network( - model - .insuranceApproval[ - indexInsurance] - .doctorImage, - fit: BoxFit.fill, - width: 700, - ), - ), - backgroundColor: - Colors.transparent, + Container( + height: 85.0, + width: 85.0, + child: CircleAvatar( + radius: SizeConfig.imageSizeMultiplier! * 12, + // radius: (52) + child: ClipRRect( + borderRadius: BorderRadius.circular(50), + child: Image.network( + model.insuranceApproval[indexInsurance].doctorImage!, + fit: BoxFit.fill, + width: 700, ), ), - ], + backgroundColor: Colors.transparent, + ), ), - Expanded( - child: Padding( - padding: - const EdgeInsets.symmetric( - horizontal: 8.0), - child: Column( - crossAxisAlignment: - CrossAxisAlignment.start, - //mainAxisAlignment: MainAxisAlignment.center, + ], + ), + Expanded( + child: Padding( + padding: const EdgeInsets.symmetric(horizontal: 8.0), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + //mainAxisAlignment: MainAxisAlignment.center, + children: [ + SizedBox( + height: 25.0, + ), + Row( children: [ - SizedBox( - height: 25.0, + AppText( + TranslationBase.of(context).clinic + ": ", + color: Colors.grey[500]!, + fontSize: 14, ), - Row( - children: [ - AppText( - TranslationBase.of( - context) - .clinic + - ": ", - color: Colors.grey[500], - fontSize: 14, - ), - Expanded( - child: AppText( - model - .insuranceApproval[ - indexInsurance] - .clinicName, - fontSize: 14, - ), - ) - ], + Expanded( + child: AppText( + model.insuranceApproval[indexInsurance].clinicName!, + fontSize: 14, + ), + ) + ], + ), + Row( + children: [ + AppText( + TranslationBase.of(context).approvalNo + ": ", + color: Colors.grey[500]!, + fontSize: 14, ), - Row( - children: [ - AppText( - TranslationBase.of( - context) - .approvalNo + - ": ", - color: Colors.grey[500], - fontSize: 14, - ), - AppText( - model - .insuranceApproval[ - indexInsurance] - .approvalNo - .toString(), - fontSize: 14, - ) - ], + AppText( + model.insuranceApproval[indexInsurance].approvalNo.toString(), + fontSize: 14, + ) + ], + ), + Row( + children: [ + AppText( + TranslationBase.of(context).unusedCount + ": ", + color: Colors.grey[500]!, + fontSize: 14, ), - Row( - children: [ - AppText( - TranslationBase.of( - context) - .unusedCount + - ": ", - color: Colors.grey[500], - fontSize: 14, - ), - AppText( - model - .insuranceApproval[ - indexInsurance] - .unUsedCount - .toString(), - fontSize: 14, - ) - ], + AppText( + model.insuranceApproval[indexInsurance].unUsedCount.toString(), + fontSize: 14, + ) + ], + ), + Row( + children: [ + AppText( + TranslationBase.of(context).companyName + ": ", + color: Colors.grey[500]!, ), - Row( - children: [ - AppText( - TranslationBase.of( - context) - .companyName + - ": ", - color: Colors.grey[500], - ), - AppText('Sample') - ], + AppText('Sample') + ], + ), + Row( + children: [ + AppText( + TranslationBase.of(context).receiptOn + ": ", + color: Colors.grey[500]!, ), - Row( - children: [ - AppText( - TranslationBase.of( - context) - .receiptOn + - ": ", - color: Colors.grey[500], - ), - Expanded( - child: AppText( - '${AppDateUtils.getDayMonthYearDateFormatted(AppDateUtils.getDateTimeFromServerFormat(model.insuranceApproval[indexInsurance].rceiptOn), isArabic: projectViewModel.isArabic)}', - color: Colors.black, - fontWeight: - FontWeight.w600, - ), - ), - ], + Expanded( + child: AppText( + '${AppDateUtils.getDayMonthYearDateFormatted(AppDateUtils.getDateTimeFromServerFormat(model.insuranceApproval[indexInsurance].rceiptOn!), isArabic: projectViewModel.isArabic)}', + color: Colors.black, + fontWeight: FontWeight.w600, + ), ), - Row( - children: [ - AppText( - TranslationBase.of( - context) - .expiryDate + - ": ", - color: Colors.grey[500], - ), - if (model - .insuranceApproval[ - indexInsurance] - .expiryDate != - null) - AppText( - '${AppDateUtils.getDayMonthYearDateFormatted(AppDateUtils.getDateTimeFromServerFormat(model.insuranceApproval[indexInsurance].expiryDate), isArabic: projectViewModel.isArabic)}', - color: Colors.black, - fontWeight: - FontWeight.w600, - ), - ], + ], + ), + Row( + children: [ + AppText( + TranslationBase.of(context).expiryDate + ": ", + color: Colors.grey[500]!, ), + if (model.insuranceApproval[indexInsurance].expiryDate != null) + AppText( + '${AppDateUtils.getDayMonthYearDateFormatted(AppDateUtils.getDateTimeFromServerFormat(model.insuranceApproval[indexInsurance].expiryDate!), isArabic: projectViewModel.isArabic)}', + color: Colors.black, + fontWeight: FontWeight.w600, + ), ], ), - ), + ], ), - ], + ), ), - ), - SizedBox( - height: 20.0, - ), - Container( - child: Column( - children: [ - Padding( - padding: const EdgeInsets.symmetric( - horizontal: 8.0), - child: Row( - children: [ - Expanded( - child: AppText( - TranslationBase.of(context) - .procedure, - fontWeight: FontWeight.w700, - ), - ), - Expanded( - child: AppText( - TranslationBase.of(context) - .status, - fontWeight: FontWeight.w700, - ), - ), - Expanded( - child: AppText( - TranslationBase.of(context) - .usageStatus, - fontWeight: FontWeight.w700, - ), - ) - ], + ], + ), + ), + SizedBox( + height: 20.0, + ), + Container( + child: Column( + children: [ + Padding( + padding: const EdgeInsets.symmetric(horizontal: 8.0), + child: Row( + children: [ + Expanded( + child: AppText( + TranslationBase.of(context).procedure, + fontWeight: FontWeight.w700, + ), ), - ), - Divider( - color: Colors.black, - ), - Padding( - padding: const EdgeInsets.symmetric( - horizontal: 8.0), - child: ListView.builder( - shrinkWrap: true, - physics: ScrollPhysics(), - itemCount: model - .insuranceApproval[ - indexInsurance] - .apporvalDetails - .length, - itemBuilder: - (BuildContext context, - int index) { - return Container( - child: Column( + Expanded( + child: AppText( + TranslationBase.of(context).status, + fontWeight: FontWeight.w700, + ), + ), + Expanded( + child: AppText( + TranslationBase.of(context).usageStatus, + fontWeight: FontWeight.w700, + ), + ) + ], + ), + ), + Divider( + color: Colors.black, + ), + Padding( + padding: const EdgeInsets.symmetric(horizontal: 8.0), + child: ListView.builder( + shrinkWrap: true, + physics: ScrollPhysics(), + itemCount: model.insuranceApproval[indexInsurance].apporvalDetails!.length, + itemBuilder: (BuildContext context, int index) { + return Container( + child: Column( + children: [ + Row( children: [ - Row( - children: [ - Expanded( - child: Container( - child: AppText( - model - .insuranceApproval[ - indexInsurance] - ?.apporvalDetails[ - index] - ?.procedureName ?? - "", - textAlign: - TextAlign - .start, - ), - ), - ), - Expanded( - child: Container( - child: AppText( - model - .insuranceApproval[ - indexInsurance] - ?.apporvalDetails[ - index] - ?.status ?? - "", - textAlign: - TextAlign - .center, - ), - ), - ), - Expanded( - child: Container( - child: AppText( - model - .insuranceApproval[ - indexInsurance] - ?.apporvalDetails[ - index] - ?.isInvoicedDesc ?? - "", - textAlign: - TextAlign - .center, - ), - ), + Expanded( + child: Container( + child: AppText( + model.insuranceApproval[indexInsurance].apporvalDetails![index].procedureName ?? "", + textAlign: TextAlign.start, ), - ], + ), ), - SizedBox( - width: 5, + Expanded( + child: Container( + child: AppText( + model.insuranceApproval[indexInsurance].apporvalDetails![index].status ?? "", + textAlign: TextAlign.center, + ), + ), ), - Divider( - color: Colors.black38, + Expanded( + child: Container( + child: AppText( + model.insuranceApproval[indexInsurance].apporvalDetails![index].isInvoicedDesc ?? "", + textAlign: TextAlign.center, + ), + ), ), ], ), - ); - }), - ), - ], + SizedBox( + width: 5, + ), + Divider( + color: Colors.black38, + ), + ], + ), + ); + }), ), - ), - ], + ], + ), ), - ), + ], ), - ], + ), ), - ), - )), + ], + ), + ), + )), ); } } diff --git a/lib/screens/patients/out_patient_prescription_details_screen.dart b/lib/screens/patients/out_patient_prescription_details_screen.dart index ccc2a7eb..bb2377ab 100644 --- a/lib/screens/patients/out_patient_prescription_details_screen.dart +++ b/lib/screens/patients/out_patient_prescription_details_screen.dart @@ -10,23 +10,21 @@ import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; class OutPatientPrescriptionDetailsScreen extends StatefulWidget { - final PrescriptionResModel prescriptionResModel; + final PrescriptionResModel? prescriptionResModel; - OutPatientPrescriptionDetailsScreen({Key key, this.prescriptionResModel}); + OutPatientPrescriptionDetailsScreen({Key? key, this.prescriptionResModel}); @override - _OutPatientPrescriptionDetailsScreenState createState() => - _OutPatientPrescriptionDetailsScreenState(); + _OutPatientPrescriptionDetailsScreenState createState() => _OutPatientPrescriptionDetailsScreenState(); } -class _OutPatientPrescriptionDetailsScreenState - extends State { +class _OutPatientPrescriptionDetailsScreenState extends State { getPrescriptionReport(BuildContext context, PatientViewModel model) { RequestPrescriptionReport prescriptionReqModel = RequestPrescriptionReport( - appointmentNo: widget.prescriptionResModel.appointmentNo, - episodeID: widget.prescriptionResModel.episodeID, - setupID: widget.prescriptionResModel.setupID, - patientTypeID: widget.prescriptionResModel.patientID); + appointmentNo: widget.prescriptionResModel!.appointmentNo, + episodeID: widget.prescriptionResModel!.episodeID, + setupID: widget.prescriptionResModel!.setupID, + patientTypeID: widget.prescriptionResModel!.patientID); model.getPrescriptionReport(prescriptionReqModel.toJson()); } diff --git a/lib/screens/patients/profile/UCAF/page_stepper_widget.dart b/lib/screens/patients/profile/UCAF/page_stepper_widget.dart index d883e31f..08c62ff6 100644 --- a/lib/screens/patients/profile/UCAF/page_stepper_widget.dart +++ b/lib/screens/patients/profile/UCAF/page_stepper_widget.dart @@ -9,18 +9,18 @@ import '../../../../config/config.dart'; class PageStepperWidget extends StatelessWidget { final int stepsCount; final int currentStepIndex; - final Size screenSize; - final List stepsTitles; + final Size? screenSize; + final List? stepsTitles; PageStepperWidget( - {this.stepsCount, - this.currentStepIndex, + {this.stepsCount = 0, + this.currentStepIndex = 0, this.screenSize, this.stepsTitles}); @override Widget build(BuildContext context) { - double dividerWidth = (screenSize.width / stepsCount) - (10 * stepsCount); + double dividerWidth = (screenSize!.width / stepsCount) - (10 * stepsCount); return Container( margin: EdgeInsets.symmetric(vertical: 16.0, horizontal: 16.0), @@ -37,7 +37,7 @@ class PageStepperWidget extends StatelessWidget { i == stepsCount, i < currentStepIndex, dividerWidth, - stepsTitles: stepsTitles, + stepsTitles: stepsTitles!, ) else StepWidget( @@ -46,7 +46,7 @@ class PageStepperWidget extends StatelessWidget { i == stepsCount, i < currentStepIndex, dividerWidth, - stepsTitles: stepsTitles, + stepsTitles: stepsTitles!, ) ], ) @@ -62,7 +62,7 @@ class StepWidget extends StatelessWidget { final bool isFinalStep; final bool isStepFinish; final double dividerWidth; - final List stepsTitles; + final List? stepsTitles; StepWidget(this.index, this.isInProgress, this.isFinalStep, this.isStepFinish, this.dividerWidth, @@ -132,11 +132,11 @@ class StepWidget extends StatelessWidget { AppText( stepsTitles == null ? "${TranslationBase.of(context).step} $index" - : "${stepsTitles[index - 1]}", + : "${stepsTitles![index - 1]}", fontWeight: FontWeight.bold, color: status == StepStatus.Locked ? Color(0xFF969696) : Colors.black, fontFamily: 'Poppins', - fontSize: SizeConfig.textMultiplier * 1.6, + fontSize: SizeConfig.textMultiplier! * 1.6, ), Container( margin: EdgeInsets.symmetric(vertical: 4), @@ -167,7 +167,7 @@ class StepWidget extends StatelessWidget { fontWeight: FontWeight.bold, textAlign: TextAlign.center, fontFamily: 'Poppins', - fontSize: SizeConfig.textMultiplier * 1.4, + fontSize: SizeConfig.textMultiplier! * 1.4, color: status == StepStatus.InProgress ? Color(0xFFCC9B14) : status == StepStatus.Locked diff --git a/lib/screens/patients/profile/UCAF/ucaf_detail_screen.dart b/lib/screens/patients/profile/UCAF/ucaf_detail_screen.dart index be1fc989..6d753285 100644 --- a/lib/screens/patients/profile/UCAF/ucaf_detail_screen.dart +++ b/lib/screens/patients/profile/UCAF/ucaf_detail_screen.dart @@ -2,6 +2,7 @@ import 'package:doctor_app_flutter/core/enum/view_state.dart'; import 'package:doctor_app_flutter/core/model/patient/patiant_info_model.dart'; import 'package:doctor_app_flutter/core/viewModel/patient-ucaf-viewmodel.dart'; import 'package:doctor_app_flutter/core/viewModel/project_view_model.dart'; +import 'package:doctor_app_flutter/routes.dart'; import 'package:doctor_app_flutter/screens/base/base_view.dart'; import 'package:doctor_app_flutter/screens/patients/profile/UCAF/widgets/diagnosis_widget.dart'; import 'package:doctor_app_flutter/screens/patients/profile/UCAF/widgets/medication_widget.dart'; @@ -14,12 +15,11 @@ import 'package:doctor_app_flutter/widgets/shared/errors/error_message.dart'; import 'package:flutter/material.dart'; import 'package:provider/provider.dart'; -import '../../../../routes.dart'; class UcafDetailScreen extends StatefulWidget { final PatiantInformtion patient; final UcafViewModel model; - final Function changeLoadingState; + final Function? changeLoadingState; UcafDetailScreen(this.patient, this.model, {this.changeLoadingState}); @@ -32,7 +32,7 @@ class _UcafDetailScreenState extends State { final PatiantInformtion patient; final UcafViewModel model; - UcafViewModel ucafModel; + UcafViewModel ucafModel = UcafViewModel(); int _activeTap = 0; @@ -41,9 +41,9 @@ class _UcafDetailScreenState extends State { @override void initState() { model.saveUCAFOnTap = () async { - widget.changeLoadingState(true); + widget.changeLoadingState!(true); await ucafModel.postUCAF(patient); - widget.changeLoadingState(false); + widget.changeLoadingState!(false); if (ucafModel.state == ViewState.Idle) { DrAppToastMsg.showSuccesToast( TranslationBase.of(context).postUcafSuccessMsg); @@ -67,7 +67,7 @@ class _UcafDetailScreenState extends State { model.resetDataInFirst(firstPage: false); await model.getLanguage(); await model.getPatientAssessment(patient); - widget.changeLoadingState(false); + widget.changeLoadingState!(false); }, builder: (_, model, w) => AppScaffold( baseViewModel: model, @@ -134,18 +134,18 @@ class _UcafDetailScreenState extends State { onTap: () async { print(__treatmentSteps.indexOf(item)); if (__treatmentSteps.indexOf(item) == 0) { - widget.changeLoadingState(true); + widget.changeLoadingState!(true); await model.getPatientAssessment(patient); - widget.changeLoadingState(false); + widget.changeLoadingState!(false); } else if (__treatmentSteps.indexOf(item) == 1) { - widget.changeLoadingState(true); + widget.changeLoadingState!(true); await model.getPrescription(patient); - widget.changeLoadingState(false); + widget.changeLoadingState!(false); } if (__treatmentSteps.indexOf(item) == 2) { - widget.changeLoadingState(true); + widget.changeLoadingState!(true); await model.getOrderProcedures(patient); - widget.changeLoadingState(false); + widget.changeLoadingState!(false); } setState(() { _activeTap = __treatmentSteps.indexOf(item); @@ -181,18 +181,18 @@ class _UcafDetailScreenState extends State { } break; case 1: - if (model.prescriptionList != null && model.prescriptionList.entityList != null && model.prescriptionList.entityList.isNotEmpty) { + if (model.prescriptionList != null && model.prescriptionList.entityList != null && model.prescriptionList.entityList!.isNotEmpty) { return [ ListView.builder( itemCount: model.prescriptionList != null - ? model.prescriptionList.entityList.length + ? model.prescriptionList.entityList!.length : 0, scrollDirection: Axis.vertical, physics: ScrollPhysics(), shrinkWrap: true, itemBuilder: (context, index) { return MedicationWidget( - model, model.prescriptionList.entityList[index]); + model, model.prescriptionList.entityList![index]); }) ];} else { diff --git a/lib/screens/patients/profile/UCAF/ucaf_input_screen.dart b/lib/screens/patients/profile/UCAF/ucaf_input_screen.dart index 66930a5d..32e7d7ae 100644 --- a/lib/screens/patients/profile/UCAF/ucaf_input_screen.dart +++ b/lib/screens/patients/profile/UCAF/ucaf_input_screen.dart @@ -7,15 +7,14 @@ import 'package:doctor_app_flutter/utils/translations_delegate_base_utils.dart'; import 'package:doctor_app_flutter/utils/utils.dart'; import 'package:doctor_app_flutter/widgets/shared/app_scaffold_widget.dart'; import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart'; +import 'package:doctor_app_flutter/widgets/shared/errors/error_message.dart'; import 'package:doctor_app_flutter/widgets/shared/text_fields/app-textfield-custom.dart'; import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; -import '../../../../widgets/shared/errors/error_message.dart'; - class UCAFInputScreen extends StatefulWidget { final PatiantInformtion patient; - final Function changeLoadingState; + final Function? changeLoadingState; UCAFInputScreen(this.patient, {this.changeLoadingState}); @@ -63,7 +62,7 @@ class _UCAFInputScreenState extends State { onModelReady: (model) async { model.resetDataInFirst(); await model.getUCAFData(patient); - widget.changeLoadingState(false); + widget.changeLoadingState!(false); }, builder: (_, model, w) => AppScaffold( baseViewModel: model, @@ -100,7 +99,7 @@ class _UCAFInputScreenState extends State { AppText( "BP (H/L)", fontSize: - SizeConfig.textMultiplier * 1.8, + SizeConfig.textMultiplier! * 1.8, color: Colors.black, fontWeight: FontWeight.normal, ), @@ -110,7 +109,7 @@ class _UCAFInputScreenState extends State { AppText( "${model.bloodPressure}", fontSize: - SizeConfig.textMultiplier * 2, + SizeConfig.textMultiplier! * 2, color: Colors.grey.shade800, fontWeight: FontWeight.w700, ), @@ -123,7 +122,7 @@ class _UCAFInputScreenState extends State { AppText( "${TranslationBase.of(context).temperature}", fontSize: - SizeConfig.textMultiplier * 1.8, + SizeConfig.textMultiplier! * 1.8, color: Colors.black, fontWeight: FontWeight.normal, ), @@ -134,7 +133,7 @@ class _UCAFInputScreenState extends State { child: AppText( "${model.temperatureCelcius}(C), ${(double.parse(model.temperatureCelcius) * (9 / 5) + 32).toStringAsFixed(2)}(F)", fontSize: - SizeConfig.textMultiplier * 2, + SizeConfig.textMultiplier! * 2, color: Colors.grey.shade800, fontWeight: FontWeight.w700, ), @@ -149,7 +148,7 @@ class _UCAFInputScreenState extends State { AppText( "${TranslationBase.of(context).pulseBeats}:", fontSize: - SizeConfig.textMultiplier * 1.8, + SizeConfig.textMultiplier! * 1.8, color: Colors.black, fontWeight: FontWeight.normal, ), @@ -159,7 +158,7 @@ class _UCAFInputScreenState extends State { AppText( "${model.hartRat}", fontSize: - SizeConfig.textMultiplier * 2, + SizeConfig.textMultiplier! * 2, color: Colors.grey.shade800, fontWeight: FontWeight.w700, ), @@ -172,7 +171,7 @@ class _UCAFInputScreenState extends State { Utils.convertToTitleCase(TranslationBase.of(context) .chiefComplaintsAndSymptoms), fontFamily: 'Poppins', - fontSize: SizeConfig.textMultiplier * 2.2, + fontSize: SizeConfig.textMultiplier! * 2.2, fontWeight: FontWeight.w700, color: Color(0xFF2E303A), ), @@ -184,7 +183,7 @@ class _UCAFInputScreenState extends State { TranslationBase.of(context).instruction, dropDownText: Utils.parseHtmlString(model .patientChiefComplaintList[0] - .chiefComplaint + '\n'), + .chiefComplaint! + '\n'), controller: _additionalComplaintsController, inputType: TextInputType.multiline, enabled: false, diff --git a/lib/screens/patients/profile/UCAF/ucaf_pager_screen.dart b/lib/screens/patients/profile/UCAF/ucaf_pager_screen.dart index c701a7b4..a0c8b0c5 100644 --- a/lib/screens/patients/profile/UCAF/ucaf_pager_screen.dart +++ b/lib/screens/patients/profile/UCAF/ucaf_pager_screen.dart @@ -1,6 +1,7 @@ import 'package:doctor_app_flutter/config/config.dart'; import 'package:doctor_app_flutter/core/model/patient/patiant_info_model.dart'; import 'package:doctor_app_flutter/core/viewModel/patient-ucaf-viewmodel.dart'; +import 'package:doctor_app_flutter/routes.dart'; import 'package:doctor_app_flutter/screens/base/base_view.dart'; import 'package:doctor_app_flutter/screens/patients/profile/UCAF/page_stepper_widget.dart'; import 'package:doctor_app_flutter/utils/translations_delegate_base_utils.dart'; @@ -9,13 +10,11 @@ import 'package:doctor_app_flutter/widgets/patients/profile/app_bar/patient-prof import 'package:doctor_app_flutter/widgets/shared/app_scaffold_widget.dart'; import 'package:doctor_app_flutter/widgets/shared/buttons/app_buttons_widget.dart'; import 'package:flutter/material.dart'; - -import '../../../../routes.dart'; import 'ucaf_detail_screen.dart'; import 'ucaf_input_screen.dart'; class UCAFPagerScreen extends StatefulWidget { - const UCAFPagerScreen({Key key}) : super(key: key); + const UCAFPagerScreen({Key? key}) : super(key: key); @override _UCAFPagerScreenState createState() => _UCAFPagerScreenState(); @@ -23,17 +22,17 @@ class UCAFPagerScreen extends StatefulWidget { class _UCAFPagerScreenState extends State with TickerProviderStateMixin { - PageController _controller; + PageController? _controller; int _currentIndex = 0; bool _isLoading = true; - PatiantInformtion patient; - String patientType; - String arrivalType; + PatiantInformtion? patient; + String? patientType; + String? arrivalType; changePageViewIndex(pageIndex, {isChangeState = true}) { if (pageIndex != _currentIndex && isChangeState) changeLoadingState(true); - _controller.jumpToPage(pageIndex); + _controller!.jumpToPage(pageIndex); setState(() { _currentIndex = pageIndex; }); @@ -53,7 +52,7 @@ class _UCAFPagerScreenState extends State @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']; patientType = routeArgs['patientType']; arrivalType = routeArgs['arrivalType']; @@ -64,7 +63,7 @@ class _UCAFPagerScreenState extends State builder: (_, model, w) => AppScaffold( isShowAppBar: true, isLoading: _isLoading, - appBar: PatientProfileAppBar(patient), + appBar: PatientProfileAppBar(patient!), appBarTitle: TranslationBase.of(context).ucaf, body: Column( crossAxisAlignment: CrossAxisAlignment.start, @@ -101,11 +100,11 @@ class _UCAFPagerScreenState extends State scrollDirection: Axis.horizontal, children: [ UCAFInputScreen( - patient, + patient!, changeLoadingState: changeLoadingState, ), UcafDetailScreen( - patient, + patient!, model, changeLoadingState: changeLoadingState, ), @@ -178,7 +177,7 @@ class _UCAFPagerScreenState extends State color: AppGlobal.appRedColor, fontColor: Colors.white, onPressed: () { - model.saveUCAFOnTap(); + model.saveUCAFOnTap!(); }, ), ), diff --git a/lib/screens/patients/profile/UCAF/widgets/diagnosis_widget.dart b/lib/screens/patients/profile/UCAF/widgets/diagnosis_widget.dart index 5ac4555a..8616d38a 100644 --- a/lib/screens/patients/profile/UCAF/widgets/diagnosis_widget.dart +++ b/lib/screens/patients/profile/UCAF/widgets/diagnosis_widget.dart @@ -34,20 +34,20 @@ class DiagnosisWidget extends StatelessWidget { label: "${TranslationBase.of(context).diagnoseType}: ", value: diagnosisType != null ? model.selectedLanguage == 'ar' - ? diagnosisType.nameAr - : diagnosisType.nameEn + ? diagnosisType.nameAr! + : diagnosisType.nameEn! : "-", - valueSize: SizeConfig.textMultiplier * 1.8, - labelSize: SizeConfig.textMultiplier * 1.6, + valueSize: SizeConfig.textMultiplier! * 1.8, + labelSize: SizeConfig.textMultiplier! * 1.6, ), SizedBox( height: 4, ), CustomRow( label: "", - value: diagnosis.asciiDesc, - valueSize: SizeConfig.textMultiplier * 1.8, - labelSize: SizeConfig.textMultiplier * 1.6, + value: diagnosis.asciiDesc!, + valueSize: SizeConfig.textMultiplier! * 1.8, + labelSize: SizeConfig.textMultiplier! * 1.6, isExpanded: true, ), SizedBox( @@ -57,8 +57,8 @@ class DiagnosisWidget extends StatelessWidget { CustomRow( label: "${TranslationBase.of(context).condition}: ", value: "${diagnosisCondition != null ? model.selectedLanguage == 'ar' ? diagnosisCondition.nameAr : diagnosisCondition.nameEn : "-"}", - valueSize: SizeConfig.textMultiplier * 1.8, - labelSize: SizeConfig.textMultiplier * 1.6, + valueSize: SizeConfig.textMultiplier! * 1.8, + labelSize: SizeConfig.textMultiplier! * 1.6, ), SizedBox( height: 4, @@ -68,8 +68,8 @@ class DiagnosisWidget extends StatelessWidget { CustomRow( label: "${TranslationBase.of(context).icd}:", value: "${diagnosis.icdCode10ID}", - valueSize: SizeConfig.textMultiplier * 1.8, - labelSize: SizeConfig.textMultiplier * 1.6, + valueSize: SizeConfig.textMultiplier! * 1.8, + labelSize: SizeConfig.textMultiplier! * 1.6, ), SizedBox( diff --git a/lib/screens/patients/profile/UCAF/widgets/medication_widget.dart b/lib/screens/patients/profile/UCAF/widgets/medication_widget.dart index 49d2832e..48136712 100644 --- a/lib/screens/patients/profile/UCAF/widgets/medication_widget.dart +++ b/lib/screens/patients/profile/UCAF/widgets/medication_widget.dart @@ -26,8 +26,8 @@ class MedicationWidget extends StatelessWidget { label: "${TranslationBase.of(context).id}: ", value: "${prescription.medicineCode}", isExpanded: false, - valueSize: SizeConfig.textMultiplier * 1.8, - labelSize: SizeConfig.textMultiplier * 1.6, + valueSize: SizeConfig.textMultiplier! * 1.8, + labelSize: SizeConfig.textMultiplier! * 1.6, ), SizedBox( width: 16, @@ -36,8 +36,8 @@ class MedicationWidget extends StatelessWidget { label: "${TranslationBase.of(context).price}: ", value: "${prescription.medicationPrice}", isExpanded: false, - valueSize: SizeConfig.textMultiplier * 1.8, - labelSize: SizeConfig.textMultiplier * 1.6, + valueSize: SizeConfig.textMultiplier! * 1.8, + labelSize: SizeConfig.textMultiplier! * 1.6, ), SizedBox( width: 16, @@ -46,8 +46,8 @@ class MedicationWidget extends StatelessWidget { label: "${TranslationBase.of(context).quantity}: ", value: "${prescription.quantity}", isExpanded: false, - valueSize: SizeConfig.textMultiplier * 1.8, - labelSize: SizeConfig.textMultiplier * 1.6, + valueSize: SizeConfig.textMultiplier! * 1.8, + labelSize: SizeConfig.textMultiplier! * 1.6, ), ], ), @@ -58,8 +58,8 @@ class MedicationWidget extends StatelessWidget { label: "${TranslationBase.of(context).durDays}: ", value: "${prescription.doseDurationDays}", isExpanded: false, - valueSize: SizeConfig.textMultiplier * 1.8, - labelSize: SizeConfig.textMultiplier * 1.6, + valueSize: SizeConfig.textMultiplier! * 1.8, + labelSize: SizeConfig.textMultiplier! * 1.6, ), SizedBox( height: 4, @@ -68,8 +68,8 @@ class MedicationWidget extends StatelessWidget { label: " ", value: Utils.convertToTitleCase("${prescription.medicationName}"), isExpanded: true, - valueSize: SizeConfig.textMultiplier * 1.8, - labelSize: SizeConfig.textMultiplier * 1.6, + valueSize: SizeConfig.textMultiplier! * 1.8, + labelSize: SizeConfig.textMultiplier! * 1.6, ), SizedBox( height: 4, @@ -79,8 +79,8 @@ class MedicationWidget extends StatelessWidget { label: " ", value: Utils.convertToTitleCase("${prescription.doseDetail}"), isExpanded: true, - valueSize: SizeConfig.textMultiplier * 1.8, - labelSize: SizeConfig.textMultiplier * 1.6, + valueSize: SizeConfig.textMultiplier! * 1.8, + labelSize: SizeConfig.textMultiplier! * 1.6, ), ], )); diff --git a/lib/screens/patients/profile/UCAF/widgets/pocedures_widget.dart b/lib/screens/patients/profile/UCAF/widgets/pocedures_widget.dart index 2842f35d..6e7a9654 100644 --- a/lib/screens/patients/profile/UCAF/widgets/pocedures_widget.dart +++ b/lib/screens/patients/profile/UCAF/widgets/pocedures_widget.dart @@ -26,16 +26,16 @@ class ProceduresWidget extends StatelessWidget { label: "${TranslationBase.of(context).codeNo}: ", value: "${procedure.achiCode}", isExpanded: false, - valueSize: SizeConfig.textMultiplier * 1.8, - labelSize: SizeConfig.textMultiplier * 1.6, + valueSize: SizeConfig.textMultiplier! * 1.8, + labelSize: SizeConfig.textMultiplier! * 1.6, ), SizedBox(width: 10,), CustomRow( label: "${TranslationBase.of(context).quantity}: ", value: "${procedure.lineItemNo}", isExpanded: false, - valueSize: SizeConfig.textMultiplier * 1.8, - labelSize: SizeConfig.textMultiplier * 1.6, + valueSize: SizeConfig.textMultiplier! * 1.8, + labelSize: SizeConfig.textMultiplier! * 1.6, ), ], ), @@ -45,8 +45,8 @@ class ProceduresWidget extends StatelessWidget { CustomRow( label: "", value: "${procedure.procedureName}", - valueSize: SizeConfig.textMultiplier * 1.8, - labelSize: SizeConfig.textMultiplier * 1.6, + valueSize: SizeConfig.textMultiplier! * 1.8, + labelSize: SizeConfig.textMultiplier! * 1.6, ), SizedBox( height: 4, @@ -58,9 +58,9 @@ class ProceduresWidget extends StatelessWidget { label: "${TranslationBase.of(context).covered}: ", value: "${procedure.isCovered}", isExpanded: false, - valueSize: SizeConfig.textMultiplier * 1.8, - labelSize: SizeConfig.textMultiplier * 1.6, - valueColor: procedure.isCovered + valueSize: SizeConfig.textMultiplier! * 1.8, + labelSize: SizeConfig.textMultiplier! * 1.6, + valueColor: procedure.isCovered! ? AppGlobal.appGreenColor : AppGlobal.appRedColor, ), @@ -68,8 +68,8 @@ class ProceduresWidget extends StatelessWidget { label: "${TranslationBase.of(context).approvalRequired}: ", value: "${procedure.isApprovalRequired}", isExpanded: false, - valueSize: SizeConfig.textMultiplier * 1.8, - labelSize: SizeConfig.textMultiplier * 1.6, + valueSize: SizeConfig.textMultiplier! * 1.8, + labelSize: SizeConfig.textMultiplier! * 1.6, ), @@ -83,9 +83,9 @@ class ProceduresWidget extends StatelessWidget { label: "${TranslationBase.of(context).uncoveredByDoctor}: ", value: "${procedure.isUncoveredByDoctor}", isExpanded: false, - valueSize: SizeConfig.textMultiplier * 1.8, - labelSize: SizeConfig.textMultiplier * 1.6, - valueColor: procedure.isCovered + valueSize: SizeConfig.textMultiplier! * 1.8, + labelSize: SizeConfig.textMultiplier! * 1.6, + valueColor: procedure.isCovered! ? AppGlobal.appGreenColor : AppGlobal.appRedColor, ), diff --git a/lib/screens/patients/profile/lab_result/history/lab_result_history_chart_and_detials.dart b/lib/screens/patients/profile/lab_result/history/lab_result_history_chart_and_detials.dart index aea99af0..ca7c7400 100644 --- a/lib/screens/patients/profile/lab_result/history/lab_result_history_chart_and_detials.dart +++ b/lib/screens/patients/profile/lab_result/history/lab_result_history_chart_and_detials.dart @@ -9,9 +9,9 @@ import 'line_chart_curved_lab_history.dart'; class LabResultHistoryChartAndDetails extends StatelessWidget { LabResultHistoryChartAndDetails({ - Key key, - @required this.labResultHistory, - @required this.name, + Key? key, + required this.labResultHistory, + required this.name, }) : super(key: key); final List labResultHistory; @@ -43,7 +43,7 @@ class LabResultHistoryChartAndDetails extends StatelessWidget { children: [ AppText( TranslationBase.of(context).graphDetails, - fontSize: SizeConfig.textMultiplier * 2.1, + fontSize: SizeConfig.textMultiplier! * 2.1, fontWeight: FontWeight.bold, ), SizedBox( diff --git a/lib/screens/patients/profile/lab_result/history/lab_result_history_details_wideget.dart b/lib/screens/patients/profile/lab_result/history/lab_result_history_details_wideget.dart index df213e11..d5626896 100644 --- a/lib/screens/patients/profile/lab_result/history/lab_result_history_details_wideget.dart +++ b/lib/screens/patients/profile/lab_result/history/lab_result_history_details_wideget.dart @@ -12,7 +12,7 @@ class LabResultHistoryDetailsWidget extends StatefulWidget { final List labResultHistory; LabResultHistoryDetailsWidget({ - this.labResultHistory, + required this.labResultHistory, }); @override @@ -39,7 +39,7 @@ class _VitalSignDetailsWidgetState padding: EdgeInsets.all(8), child: AppText( TranslationBase.of(context).date, - fontSize: SizeConfig.textMultiplier * 1.6, + fontSize: SizeConfig.textMultiplier! * 1.6, fontWeight: FontWeight.bold, ), ), @@ -51,7 +51,7 @@ class _VitalSignDetailsWidgetState child: Container( child: AppText( TranslationBase.of(context).labResult, - fontSize: SizeConfig.textMultiplier * 1.6, + fontSize: SizeConfig.textMultiplier! * 1.6, fontWeight: FontWeight.bold, ), // height: 60 @@ -67,7 +67,7 @@ class _VitalSignDetailsWidgetState ), Table( border: TableBorder.symmetric( - inside: BorderSide(width: 1.0, color: Colors.grey[300]), + inside: BorderSide(width: 1.0, color: Colors.grey[300]!), ), children: fullData(projectViewModel), ), @@ -80,7 +80,7 @@ class _VitalSignDetailsWidgetState List fullData(ProjectViewModel projectViewModel) { List tableRow = []; widget.labResultHistory.forEach((vital) { - var date = AppDateUtils.convertStringToDate(vital.verifiedOnDateTime); + var date = AppDateUtils.convertStringToDate(vital.verifiedOnDateTime!); tableRow.add(TableRow(children: [ Container( child: Container( @@ -88,7 +88,7 @@ class _VitalSignDetailsWidgetState color: Colors.white, child: AppText( '${projectViewModel.isArabic ? AppDateUtils.getWeekDayArabic(date.weekday) : AppDateUtils.getWeekDay(date.weekday)} ,${date.day} ${projectViewModel.isArabic ? AppDateUtils.getMonthArabic(date.month) : AppDateUtils.getMonth(date.month)} ${date.year}', - fontSize: SizeConfig.textMultiplier * 1.8, + fontSize: SizeConfig.textMultiplier! * 1.8, fontWeight: FontWeight.w600, ), ), @@ -99,7 +99,7 @@ class _VitalSignDetailsWidgetState color: Colors.white, child: AppText( '${vital.resultValue}', - fontSize: SizeConfig.textMultiplier * 1.8, + fontSize: SizeConfig.textMultiplier! * 1.8, fontWeight: FontWeight.w600, ), ), 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 a87f8235..d2c4e4f3 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 @@ -9,14 +9,13 @@ class LineChartCurvedLabHistory extends StatefulWidget { final String title; final List labResultHistory; - LineChartCurvedLabHistory({this.title, this.labResultHistory}); + LineChartCurvedLabHistory({required this.title, required this.labResultHistory}); @override State createState() => LineChartCurvedLabHistoryState(); } class LineChartCurvedLabHistoryState extends State { - bool isShowingMainData; List xAxixs = []; int indexes = 0; @@ -24,7 +23,6 @@ class LineChartCurvedLabHistoryState extends State { void initState() { super.initState(); getXaxix(); - isShowingMainData = true; } getXaxix() { @@ -56,7 +54,7 @@ class LineChartCurvedLabHistoryState extends State { ), AppText( widget.title, - fontSize: SizeConfig.textMultiplier * 2.1, + fontSize: SizeConfig.textMultiplier! * 2.1, fontWeight: FontWeight.bold, fontFamily: 'Poppins', textAlign: TextAlign.center, @@ -69,7 +67,7 @@ class LineChartCurvedLabHistoryState extends State { padding: const EdgeInsets.only(right: 16.0, left: 8.0), child: LineChart( sampleData1(), - swapAnimationDuration: const Duration(milliseconds: 250), + duration: const Duration(milliseconds: 250), ), ), ), @@ -90,56 +88,73 @@ class LineChartCurvedLabHistoryState extends State { touchTooltipData: LineTouchTooltipData( tooltipBgColor: Colors.white, ), - touchCallback: (LineTouchResponse touchResponse) {}, + touchCallback: (event, 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, - ); - }, - margin: 28, - rotateAngle: -65, - getTitles: (value) { - print(value); - DateTime date = AppDateUtils.convertStringToDate( - widget.labResultHistory[value.toInt()].verifiedOnDateTime); + reservedSize: 28, + // rotateAngle: -65, + getTitlesWidget: (value, meta) { + DateTime date = AppDateUtils.convertStringToDate(widget.labResultHistory[value.toInt()].verifiedOnDateTime!); if (widget.labResultHistory.length < 8) { if (widget.labResultHistory.length > value.toInt()) { - return '${date.day}/ ${date.year}'; + return Text( + '${date.day}/ ${date.year}', + style: TextStyle( + color: Colors.black, + fontSize: 10, + ), + ); } else - return ''; + return Text(""); } else { - if (value.toInt() == 0) return '${date.day}/ ${date.year}'; + if (value.toInt() == 0) + return Text( + '${date.day}/ ${date.year}', + style: TextStyle( + color: Colors.black, + fontSize: 10, + ), + ); if (value.toInt() == widget.labResultHistory.length - 1) - return '${date.day}/ ${date.year}'; + return Text( + '${date.day}/ ${date.year}', + style: TextStyle( + color: Colors.black, + fontSize: 10, + ), + ); if (xAxixs.contains(value.toInt())) { - return '${date.day}/ ${date.year}'; + return Text( + '${date.day}/ ${date.year}', + style: TextStyle( + color: Colors.black, + fontSize: 10, + ), + ); } } - return ''; + return Text(""); }, - ), - leftTitles: SideTitles( - showTitles: true, - getTextStyles: (context, value) { - return TextStyle( - color: Colors.black, - fontSize: 10, - ); - }, - getTitles: (value) { - return '${value.toInt()}'; - }, - margin: 8, - //reservedSize: 30, + )), + leftTitles: AxisTitles( + sideTitles: SideTitles( + showTitles: true, + getTitlesWidget: (value, meta) { + return Text('${value.toInt()}', + style: TextStyle( + color: Colors.black, + fontSize: 10, + )); + }, + reservedSize: 8, + //reservedSize: 30, + ), ), ), borderData: FlBorderData( @@ -172,7 +187,7 @@ class LineChartCurvedLabHistoryState extends State { double max = 0; widget.labResultHistory.forEach((element) { try { - double resultValueDouble = double.parse(element.resultValue); + double resultValueDouble = double.parse(element.resultValue!); if (resultValueDouble > max) max = resultValueDouble; } catch (e) { print(e); @@ -185,10 +200,10 @@ class LineChartCurvedLabHistoryState extends State { double getMinY() { double min = 0; try { - min = double.parse(widget.labResultHistory[0].resultValue); + min = double.parse(widget.labResultHistory[0].resultValue!); widget.labResultHistory.forEach((element) { - double resultValueDouble = double.parse(element.resultValue); + double resultValueDouble = double.parse(element.resultValue!); if (resultValueDouble < min) min = resultValueDouble; }); } catch (e) { @@ -203,8 +218,7 @@ class LineChartCurvedLabHistoryState extends State { List spots = []; for (int index = 0; index < widget.labResultHistory.length; index++) { try { - var resultValueDouble = - double.parse(widget.labResultHistory[index].resultValue); + var resultValueDouble = double.parse(widget.labResultHistory[index].resultValue!); spots.add(FlSpot(index.toDouble(), resultValueDouble)); } catch (e) { print(e); @@ -215,7 +229,7 @@ class LineChartCurvedLabHistoryState extends State { final LineChartBarData lineChartBarData1 = LineChartBarData( spots: spots, isCurved: true, - colors: [Colors.red], + color: Colors.red, barWidth: 3, isStrokeCapRound: true, curveSmoothness: 0.12, diff --git a/lib/screens/patients/profile/lab_result/laboratory_result/flow_chart_page.dart b/lib/screens/patients/profile/lab_result/laboratory_result/flow_chart_page.dart index 685478eb..df42cd82 100644 --- a/lib/screens/patients/profile/lab_result/laboratory_result/flow_chart_page.dart +++ b/lib/screens/patients/profile/lab_result/laboratory_result/flow_chart_page.dart @@ -17,7 +17,7 @@ class FlowChartPage extends StatelessWidget { final bool isInpatient; FlowChartPage( - {this.patientLabOrder, this.filterName, this.patient, this.isInpatient}); + {required this.patientLabOrder, required this.filterName, required this.patient, required this.isInpatient}); @override Widget build(BuildContext context) { diff --git a/lib/screens/patients/profile/lab_result/laboratory_result/lab_result_details_wideget.dart b/lib/screens/patients/profile/lab_result/laboratory_result/lab_result_details_wideget.dart index 82e2dc7f..0b0a1e68 100644 --- a/lib/screens/patients/profile/lab_result/laboratory_result/lab_result_details_wideget.dart +++ b/lib/screens/patients/profile/lab_result/laboratory_result/lab_result_details_wideget.dart @@ -12,7 +12,7 @@ class LabResultDetailsWidget extends StatefulWidget { final List labResult; LabResultDetailsWidget({ - this.labResult, + required this.labResult, }); @override @@ -38,7 +38,7 @@ class _VitalSignDetailsWidgetState extends State { padding: EdgeInsets.all(8), child: AppText( TranslationBase.of(context).date, - fontSize: SizeConfig.textMultiplier * 1.6, + fontSize: SizeConfig.textMultiplier! * 1.6, fontWeight: FontWeight.bold, fontFamily: 'Poppins', ), @@ -51,7 +51,7 @@ class _VitalSignDetailsWidgetState extends State { child: Container( child: AppText( TranslationBase.of(context).labResult, - fontSize: SizeConfig.textMultiplier * 1.6, + fontSize: SizeConfig.textMultiplier! * 1.6, fontWeight: FontWeight.bold, fontFamily: 'Poppins', ), @@ -68,7 +68,7 @@ class _VitalSignDetailsWidgetState extends State { ), Table( border: TableBorder.symmetric( - inside: BorderSide(width: 1.0, color: Colors.grey[300]), + inside: BorderSide(width: 1.0, color: Colors.grey[300]!), ), children: fullData(projectViewModel), ), @@ -81,7 +81,7 @@ class _VitalSignDetailsWidgetState extends State { List fullData(ProjectViewModel projectViewModel) { List tableRow = []; widget.labResult.forEach((vital) { - var date = AppDateUtils.convertStringToDate(vital.verifiedOnDateTime); + var date = AppDateUtils.convertStringToDate(vital.verifiedOnDateTime!); tableRow.add(TableRow(children: [ Container( child: Container( @@ -89,7 +89,7 @@ class _VitalSignDetailsWidgetState extends State { color: Colors.white, child: AppText( '${projectViewModel.isArabic ? AppDateUtils.getWeekDayArabic(date.weekday) : AppDateUtils.getWeekDay(date.weekday)} ,${date.day} ${projectViewModel.isArabic ? AppDateUtils.getMonthArabic(date.month) : AppDateUtils.getMonth(date.month)} ${date.year}', - fontSize: SizeConfig.textMultiplier * 1.8, + fontSize: SizeConfig.textMultiplier! * 1.8, fontWeight: FontWeight.w600, fontFamily: 'Poppins', ), @@ -101,7 +101,7 @@ class _VitalSignDetailsWidgetState extends State { color: Colors.white, child: AppText( '${vital.resultValue}', - fontSize: SizeConfig.textMultiplier * 1.8, + fontSize: SizeConfig.textMultiplier! * 1.8, fontWeight: FontWeight.w600, fontFamily: 'Poppins', ), diff --git a/lib/screens/patients/profile/lab_result/laboratory_result/lab_result_widget.dart b/lib/screens/patients/profile/lab_result/laboratory_result/lab_result_widget.dart index 8ec84997..96ad469c 100644 --- a/lib/screens/patients/profile/lab_result/laboratory_result/lab_result_widget.dart +++ b/lib/screens/patients/profile/lab_result/laboratory_result/lab_result_widget.dart @@ -18,15 +18,8 @@ class LabResultWidget extends StatelessWidget { final PatiantInformtion patient; final bool isInpatient; - LabResultWidget( - {Key key, - this.filterName, - this.patientLabResultList, - this.patientLabOrder, - this.patient, - this.isInpatient}) - : super(key: key); - ProjectViewModel projectViewModel; + LabResultWidget({Key? key, required this.filterName, required this.patientLabResultList, required this.patientLabOrder, required this.patient, required this.isInpatient}) : super(key: key); + late ProjectViewModel projectViewModel; @override Widget build(BuildContext context) { @@ -45,7 +38,7 @@ class LabResultWidget extends StatelessWidget { children: [ AppText( filterName, - fontSize: SizeConfig.textMultiplier * 2.0, + fontSize: SizeConfig.textMultiplier! * 2.0, fontWeight: FontWeight.w700, ), ], @@ -63,7 +56,7 @@ class LabResultWidget extends StatelessWidget { child: AppText( TranslationBase.of(context).description, color: Colors.black, - fontSize: SizeConfig.textMultiplier * 2.0, + fontSize: SizeConfig.textMultiplier! * 2.0, fontWeight: FontWeight.w700, ), ), @@ -75,7 +68,7 @@ class LabResultWidget extends StatelessWidget { child: AppText( TranslationBase.of(context).value, color: Colors.black, - fontSize: SizeConfig.textMultiplier * 2.0, + fontSize: SizeConfig.textMultiplier! * 2.0, fontWeight: FontWeight.w700, ), ), @@ -86,7 +79,7 @@ class LabResultWidget extends StatelessWidget { child: Center( child: AppText( TranslationBase.of(context).range, - fontSize: SizeConfig.textMultiplier * 2.0, + fontSize: SizeConfig.textMultiplier! * 2.0, fontWeight: FontWeight.w700, ), ), @@ -128,9 +121,9 @@ class LabResultWidget extends StatelessWidget { padding: EdgeInsets.all(10), child: Center( child: AppText( - patientLabResultList[index].description, + patientLabResultList[index].description!, textAlign: TextAlign.center, - fontSize: SizeConfig.textMultiplier * 1.8, + fontSize: SizeConfig.textMultiplier! * 1.8, isCopyable: true, ), ), @@ -140,20 +133,14 @@ class LabResultWidget extends StatelessWidget { child: Row( mainAxisAlignment: MainAxisAlignment.center, children: [ - if (patientLabResultList[index] - .checkResultStatus() != - 0) + if (patientLabResultList[index].checkResultStatus() != 0) Container( decoration: BoxDecoration( shape: BoxShape.circle, color: Colors.red.shade700, ), child: Icon( - patientLabResultList[index] - .checkResultStatus() == - 1 - ? Icons.arrow_upward - : Icons.arrow_downward, + patientLabResultList[index].checkResultStatus() == 1 ? Icons.arrow_upward : Icons.arrow_downward, color: Colors.white, size: 16, ), @@ -161,19 +148,13 @@ class LabResultWidget extends StatelessWidget { Expanded( child: Container( alignment: Alignment.center, - padding: EdgeInsets.symmetric( - vertical: 10, horizontal: 4), + padding: EdgeInsets.symmetric(vertical: 10, horizontal: 4), child: Center( child: AppText( - patientLabResultList[index] - .resultValue ?? - "" + - " " + - "${patientLabResultList[index].uOM ?? ""}", + patientLabResultList[index].resultValue ?? "" + " " + "${patientLabResultList[index].uOM ?? ""}", textAlign: TextAlign.center, isCopyable: true, - fontSize: - SizeConfig.textMultiplier * 1.8, + fontSize: SizeConfig.textMultiplier! * 1.8, ), ), ), @@ -187,9 +168,9 @@ class LabResultWidget extends StatelessWidget { // color: Colors.white, child: Center( child: AppText( - patientLabResultList[index].referanceRange, + patientLabResultList[index].referanceRange!, textAlign: TextAlign.center, - fontSize: SizeConfig.textMultiplier * 1.8, + fontSize: SizeConfig.textMultiplier! * 1.8, isCopyable: true, ), ), @@ -203,8 +184,7 @@ class LabResultWidget extends StatelessWidget { context, FadePage( page: FlowChartPage( - filterName: patientLabResultList[index] - .description, + filterName: patientLabResultList[index].description!, patientLabOrder: patientLabOrder, patient: patient, isInpatient: isInpatient, @@ -219,7 +199,7 @@ class LabResultWidget extends StatelessWidget { TranslationBase.of(context).showMoreBtn, textDecoration: TextDecoration.underline, color: Colors.red.shade700, - fontSize: SizeConfig.textMultiplier * 1.8, + fontSize: SizeConfig.textMultiplier! * 1.8, fontWeight: FontWeight.w700, ), ], @@ -290,7 +270,7 @@ class LabResultWidget extends StatelessWidget { color: Colors.white, child: Center( child: AppText( - lab.description, + lab.description!, textAlign: TextAlign.center, ), ), @@ -302,7 +282,7 @@ class LabResultWidget extends StatelessWidget { color: Colors.white, child: Center( child: AppText( - lab.resultValue + " " + lab.uOM, + lab.resultValue! + " " + lab.uOM!, textAlign: TextAlign.center, ), ), @@ -314,7 +294,7 @@ class LabResultWidget extends StatelessWidget { color: Colors.white, child: Center( child: AppText( - lab.referanceRange, + lab.referanceRange!, textAlign: TextAlign.center, ), ), diff --git a/lib/screens/patients/profile/lab_result/laboratory_result/laboratory_result_page.dart b/lib/screens/patients/profile/lab_result/laboratory_result/laboratory_result_page.dart index c377d04e..564e605b 100644 --- a/lib/screens/patients/profile/lab_result/laboratory_result/laboratory_result_page.dart +++ b/lib/screens/patients/profile/lab_result/laboratory_result/laboratory_result_page.dart @@ -17,12 +17,12 @@ class LaboratoryResultPage extends StatefulWidget { final bool isInpatient; LaboratoryResultPage( - {Key key, - this.patientLabOrders, - this.patient, - this.patientType, - this.arrivalType, - this.isInpatient}); + {Key? key, + required this.patientLabOrders, + required this.patient, + required this.patientType, + required this.arrivalType, + required this.isInpatient}); @override _LaboratoryResultPageState createState() => _LaboratoryResultPageState(); @@ -42,7 +42,7 @@ class _LaboratoryResultPageState extends State { widget.patient, isInpatient: widget.isInpatient, isFromLabResult: true, - appointmentDate: widget.patientLabOrders.orderDate, + appointmentDate: widget.patientLabOrders.orderDate!, ), baseViewModel: model, body: AppScaffold( @@ -50,11 +50,11 @@ class _LaboratoryResultPageState extends State { body: SingleChildScrollView( child: LaboratoryResultWidget( onTap: () async {}, - billNo: widget.patientLabOrders.invoiceNo, + billNo: widget.patientLabOrders.invoiceNo!, details: model.patientLabSpecialResult.length > 0 - ? model.patientLabSpecialResult[0].resultDataHTML - : null, - orderNo: widget.patientLabOrders.orderNo, + ? model.patientLabSpecialResult[0].resultDataHTML! + : "", + orderNo: widget.patientLabOrders.orderNo!, patientLabOrder: widget.patientLabOrders, patient: widget.patient, isInpatient: widget.patientType == "1", diff --git a/lib/screens/patients/profile/lab_result/laboratory_result/laboratory_result_widget.dart b/lib/screens/patients/profile/lab_result/laboratory_result/laboratory_result_widget.dart index 97d10d88..e5b780ef 100644 --- a/lib/screens/patients/profile/lab_result/laboratory_result/laboratory_result_widget.dart +++ b/lib/screens/patients/profile/lab_result/laboratory_result/laboratory_result_widget.dart @@ -16,16 +16,16 @@ import 'package:flutter_html/flutter_html.dart'; import 'package:provider/provider.dart'; class LaboratoryResultWidget extends StatefulWidget { - final GestureTapCallback onTap; - final String billNo; - final String details; - final String orderNo; - final PatientLabOrders patientLabOrder; - final PatiantInformtion patient; - final bool isInpatient; + final GestureTapCallback? onTap; + final String? billNo; + final String? details; + final String? orderNo; + final PatientLabOrders? patientLabOrder; + final PatiantInformtion? patient; + final bool? isInpatient; const LaboratoryResultWidget( - {Key key, + {Key? key, this.onTap, this.billNo, this.details, @@ -42,7 +42,7 @@ class LaboratoryResultWidget extends StatefulWidget { class _LaboratoryResultWidgetState extends State { bool _isShowMoreGeneral = true; bool _isShowMore = true; - ProjectViewModel projectViewModel; + late ProjectViewModel projectViewModel; @override Widget build(BuildContext context) { @@ -97,7 +97,7 @@ class _LaboratoryResultWidgetState extends State { TranslationBase.of(context) .generalResult, fontSize: - SizeConfig.textMultiplier * 2.3, + SizeConfig.textMultiplier! * 2.3, bold: false, ))), Container( @@ -141,15 +141,15 @@ class _LaboratoryResultWidgetState extends State { itemBuilder: (context, index) { return LabResultWidget( patientLabOrder: - widget.patientLabOrder, + widget.patientLabOrder!, filterName: model .labResultLists[index] .filterName, patientLabResultList: model .labResultLists[index] .patientLabResultList, - patient: widget.patient, - isInpatient: widget.isInpatient, + patient: widget.patient!, + isInpatient: widget.isInpatient!, ); }), ], @@ -168,7 +168,7 @@ class _LaboratoryResultWidgetState extends State { SizedBox( height: 15, ), - if (widget.details != null && widget.details.isNotEmpty) + if (widget.details != null && widget.details!.isNotEmpty) Column( children: [ InkWell( @@ -196,7 +196,7 @@ class _LaboratoryResultWidgetState extends State { TranslationBase.of(context) .specialResult, fontSize: - SizeConfig.textMultiplier * 2.3, + SizeConfig.textMultiplier! * 2.3, bold: false, ))), Container( @@ -228,7 +228,7 @@ class _LaboratoryResultWidgetState extends State { duration: Duration(milliseconds: 7000), child: Container( width: double.infinity, - child: !Utils.isTextHtml(widget.details) + child: !Utils.isTextHtml(widget.details!) ? AppText( widget.details ?? TranslationBase.of(context) diff --git a/lib/screens/patients/profile/lab_result/labs_home_page.dart b/lib/screens/patients/profile/lab_result/labs_home_page.dart index 4ac476d0..4feff254 100644 --- a/lib/screens/patients/profile/lab_result/labs_home_page.dart +++ b/lib/screens/patients/profile/lab_result/labs_home_page.dart @@ -24,17 +24,17 @@ class LabsHomePage extends StatefulWidget { } class _LabsHomePageState extends State { - String patientType; + String? patientType; - String arrivalType; - PatiantInformtion patient; - bool isInpatient; - bool isFromLiveCare; + String? arrivalType; + PatiantInformtion? patient; + bool? isInpatient; + bool? isFromLiveCare; @override void didChangeDependencies() { super.didChangeDependencies(); - final routeArgs = ModalRoute.of(context).settings.arguments as Map; + final routeArgs = ModalRoute.of(context)!.settings.arguments as Map; patient = routeArgs['patient']; patientType = routeArgs['patientType']; arrivalType = routeArgs['arrivalType']; @@ -48,14 +48,14 @@ class _LabsHomePageState extends State { Widget build(BuildContext context) { ProjectViewModel projectViewModel = Provider.of(context); return BaseView( - onModelReady: (model) => model.getLabs(patient, isInpatient: false), + onModelReady: (model) => model.getLabs(patient!, isInpatient: false), builder: (context, ProcedureViewModel model, widget) => AppScaffold( baseViewModel: model, - backgroundColor: Colors.grey[100], + backgroundColor: Colors.grey[100]!, isShowAppBar: true, appBar: PatientProfileAppBar( - patient, - isInpatient: isInpatient, + patient!, + isInpatient: isInpatient!, ), body: SingleChildScrollView( physics: BouncingScrollPhysics(), @@ -68,22 +68,22 @@ class _LabsHomePageState extends State { height: 12, ), if ((model.patientLabOrdersList.isNotEmpty && - patient.patientStatusType != 43)|| (patient.patientStatusType != null && - patient.patientStatusType == 43)) + patient!.patientStatusType != 43)|| (patient!.patientStatusType != null && + patient!.patientStatusType == 43)) ServiceTitle( title: TranslationBase.of(context).lab, subTitle: TranslationBase.of(context).result, ), - if ((patient.patientStatusType != null && - patient.patientStatusType == 43) || - (isFromLiveCare && patient.appointmentNo != null)) + if ((patient!.patientStatusType != null && + patient!.patientStatusType == 43) || + (isFromLiveCare! && patient!.appointmentNo != null)) AddNewOrder( onTap: () { Navigator.push( context, MaterialPageRoute( builder: (context) => BaseAddProcedureTabPage( - patient: patient, + patient: patient!, previousProcedureViewModel: model, procedureType: ProcedureType.LAB_RESULT, ), @@ -116,10 +116,10 @@ class _LabsHomePageState extends State { width: 20, decoration: BoxDecoration( color: model.patientLabOrdersList[index] - .isLiveCareAppointment + .isLiveCareAppointment! ? Colors.red[900] : !model.patientLabOrdersList[index] - .isInOutPatient + .isInOutPatient! ? Colors.black : Color(0xffa9a089), borderRadius: BorderRadius.only( @@ -141,12 +141,12 @@ class _LabsHomePageState extends State { child: Center( child: Text( model.patientLabOrdersList[index] - .isLiveCareAppointment + .isLiveCareAppointment! ? TranslationBase.of(context) .liveCare .toUpperCase() : !model.patientLabOrdersList[index] - .isInOutPatient + .isInOutPatient! ? TranslationBase.of(context) .inPatientLabel .toUpperCase() @@ -170,26 +170,26 @@ class _LabsHomePageState extends State { page: LaboratoryResultPage( patientLabOrders: model.patientLabOrdersList[index], - patient: patient, - isInpatient: isInpatient, - arrivalType: arrivalType, - patientType: patientType, + patient: patient!, + isInpatient: isInpatient!, + arrivalType: arrivalType!, + patientType: patientType!, ), ), ), doctorName: - Utils.convertToTitleCase(model.patientLabOrdersList[index].doctorName), + Utils.convertToTitleCase(model.patientLabOrdersList[index].doctorName!), invoiceNO: ' ${model.patientLabOrdersList[index].invoiceNo}', profileUrl: model - .patientLabOrdersList[index].doctorImageURL, + .patientLabOrdersList[index].doctorImageURL!, branch: - model.patientLabOrdersList[index].projectName, + model.patientLabOrdersList[index].projectName!, clinic: - Utils.convertToTitleCase(model.patientLabOrdersList[index].clinicDescription), + Utils.convertToTitleCase(model.patientLabOrdersList[index].clinicDescription!), appointmentDate: - model.patientLabOrdersList[index].createdOn, - orderNo: model.patientLabOrdersList[index].orderNo, + model.patientLabOrdersList[index].createdOn!, + orderNo: model.patientLabOrdersList[index].orderNo!, isShowTime: false, ), ), @@ -198,7 +198,7 @@ class _LabsHomePageState extends State { ), ), if (model.patientLabOrdersList.isEmpty && - patient.patientStatusType != 43) + patient!.patientStatusType != 43) Center( child: ErrorMessage( error: TranslationBase.of(context).noDataAvailable, diff --git a/lib/screens/patients/profile/lab_result/special_result/all_lab_special_result_page.dart b/lib/screens/patients/profile/lab_result/special_result/all_lab_special_result_page.dart index 9233b453..dc7886a1 100644 --- a/lib/screens/patients/profile/lab_result/special_result/all_lab_special_result_page.dart +++ b/lib/screens/patients/profile/lab_result/special_result/all_lab_special_result_page.dart @@ -18,24 +18,24 @@ import 'package:provider/provider.dart'; import '../../../../../widgets/shared/errors/error_message.dart'; class AllLabSpecialResult extends StatefulWidget { - const AllLabSpecialResult({Key key}) : super(key: key); + const AllLabSpecialResult({Key? key}) : super(key: key); @override _AllLabSpecialResultState createState() => _AllLabSpecialResultState(); } class _AllLabSpecialResultState extends State { - String patientType; + String? patientType; - String arrivalType; - PatiantInformtion patient; - bool isInpatient; - bool isFromLiveCare; + String? arrivalType; + PatiantInformtion? patient; + bool? isInpatient; + bool? isFromLiveCare; @override void didChangeDependencies() { super.didChangeDependencies(); - final routeArgs = ModalRoute.of(context).settings.arguments as Map; + final routeArgs = ModalRoute.of(context)!.settings.arguments as Map; patient = routeArgs['patient']; patientType = routeArgs['patientType']; arrivalType = routeArgs['arrivalType']; @@ -50,14 +50,14 @@ class _AllLabSpecialResultState extends State { ProjectViewModel projectViewModel = Provider.of(context); return BaseView( onModelReady: (model) => - model.getAllSpecialLabResult(patientId: patient.patientMRN), + model.getAllSpecialLabResult(patientId: patient!.patientMRN!), builder: (context, LabsViewModel model, widget) => AppScaffold( baseViewModel: model, - backgroundColor: Colors.grey[100], + backgroundColor: Colors.grey[100]!, isShowAppBar: true, appBar: PatientProfileAppBar( - patient, - isInpatient: isInpatient, + patient!, + isInpatient: isInpatient!, ), body: SingleChildScrollView( physics: BouncingScrollPhysics(), @@ -102,10 +102,10 @@ class _AllLabSpecialResultState extends State { height: 160, decoration: BoxDecoration( color: model.allSpecialLabList[index] - .isLiveCareAppointment - ? Colors.red[900] + .isLiveCareAppointment! + ? Colors.red[900]! : !model.allSpecialLabList[index] - .isInOutPatient + .isInOutPatient! ? Colors.black : Color(0xffa9a089), borderRadius: BorderRadius.only( @@ -127,12 +127,12 @@ class _AllLabSpecialResultState extends State { child: Center( child: Text( model.allSpecialLabList[index] - .isLiveCareAppointment + .isLiveCareAppointment! ? TranslationBase.of(context) .liveCare .toUpperCase() : !model.allSpecialLabList[index] - .isInOutPatient + .isInOutPatient! ? TranslationBase.of(context) .inPatientLabel .toUpperCase() @@ -151,26 +151,26 @@ class _AllLabSpecialResultState extends State { FadePage( page: SpecialLabResultDetailsPage( resultData: model.allSpecialLabList[index] - .resultDataHTML, - patient: patient, + .resultDataHTML!, + patient: patient!, ), ), ), doctorName: - Utils.convertToTitleCase(model.allSpecialLabList[index].doctorName), + Utils.convertToTitleCase(model.allSpecialLabList[index].doctorName!), invoiceNO: ' ${model.allSpecialLabList[index].invoiceNo}', profileUrl: model - .allSpecialLabList[index].doctorImageURL, + .allSpecialLabList[index].doctorImageURL!, branch: - model.allSpecialLabList[index].projectName, + model.allSpecialLabList[index].projectName!, clinic: - Utils.convertToTitleCase(model.allSpecialLabList[index].clinicDescription), + Utils.convertToTitleCase(model.allSpecialLabList[index].clinicDescription!), appointmentDate: AppDateUtils.getDateTimeFromServerFormat( model.allSpecialLabList[index].createdOn, ), - orderNo: model.allSpecialLabList[index].orderNo, + orderNo: model.allSpecialLabList[index].orderNo!, isShowTime: false, ), ), diff --git a/lib/screens/patients/profile/lab_result/special_result/special_lab_result_details_page.dart b/lib/screens/patients/profile/lab_result/special_result/special_lab_result_details_page.dart index 9dacd974..c3c47010 100644 --- a/lib/screens/patients/profile/lab_result/special_result/special_lab_result_details_page.dart +++ b/lib/screens/patients/profile/lab_result/special_result/special_lab_result_details_page.dart @@ -13,7 +13,7 @@ class SpecialLabResultDetailsPage extends StatelessWidget { final String resultData; final PatiantInformtion patient; - const SpecialLabResultDetailsPage({Key key, this.resultData, this.patient}) + const SpecialLabResultDetailsPage({Key? key, required this.resultData, required this.patient}) : super(key: key); @override diff --git a/lib/screens/patients/profile/medical_report/AddVerifyMedicalReport.dart b/lib/screens/patients/profile/medical_report/AddVerifyMedicalReport.dart index 8bbba445..fb3a89b1 100644 --- a/lib/screens/patients/profile/medical_report/AddVerifyMedicalReport.dart +++ b/lib/screens/patients/profile/medical_report/AddVerifyMedicalReport.dart @@ -16,24 +16,15 @@ import 'package:permission_handler/permission_handler.dart'; import '../../../../config/config.dart'; class AddVerifyMedicalReport extends StatefulWidget { - final PatiantInformtion patient; - final String patientType; - final String arrivalType; - final MedicalReportModel medicalReport; - final PatientMedicalReportViewModel model; - final MedicalReportStatus status; - final String medicalNote; + final PatiantInformtion? patient; + final String? patientType; + final String? arrivalType; + final MedicalReportModel? medicalReport; + final PatientMedicalReportViewModel? model; + final MedicalReportStatus? status; + final String? medicalNote; - const AddVerifyMedicalReport( - {Key key, - this.patient, - this.patientType, - this.arrivalType, - this.medicalReport, - this.model, - this.status, - this.medicalNote}) - : super(key: key); + const AddVerifyMedicalReport({Key? key, this.patient, this.patientType, this.arrivalType, this.medicalReport, this.model, this.status, this.medicalNote}) : super(key: key); @override _AddVerifyMedicalReportState createState() => _AddVerifyMedicalReportState(); @@ -53,9 +44,7 @@ class _AddVerifyMedicalReportState extends State { builder: (_, model, w) => AppScaffold( baseViewModel: model, isShowAppBar: true, - appBarTitle: widget.status == MedicalReportStatus.ADD - ? TranslationBase.of(context).medicalReportAdd - : TranslationBase.of(context).medicalReportVerify, + appBarTitle: widget.status == MedicalReportStatus.ADD ? TranslationBase.of(context).medicalReportAdd : TranslationBase.of(context).medicalReportVerify, backgroundColor: Theme.of(context).scaffoldBackgroundColor, body: Column( children: [ @@ -72,26 +61,14 @@ class _AddVerifyMedicalReportState extends State { children: [ if (model.medicalReportTemplate.length > 0) HtmlRichEditor( - initialText: (widget.medicalReport != - null - ? widget.medicalNote - : widget - .model - .medicalReportTemplate[ - 0] - .templateText - .length > - 0 - ? widget - .model - .medicalReportTemplate[0] - .templateText + initialText: (widget.medicalReport != null + ? widget.medicalNote! + : widget.model!.medicalReportTemplate[0].templateText!.length > 0 + ? widget.model!.medicalReportTemplate[0].templateText! : ""), controller: _controller, hint: "Write the medical report ", - height: - MediaQuery.of(context).size.height * - 0.75, + height: MediaQuery.of(context).size.height * 0.75, ), ], ), @@ -109,43 +86,30 @@ class _AddVerifyMedicalReportState extends State { children: [ Expanded( child: AppButton( - title: widget.status == MedicalReportStatus.ADD - ? TranslationBase.of(context).save - : TranslationBase.of(context).save, + title: widget.status == MedicalReportStatus.ADD ? TranslationBase.of(context).save : TranslationBase.of(context).save, color: Color(0xffEAEAEA), fontColor: Colors.black, // disabled: progressNoteController.text.isEmpty, fontWeight: FontWeight.w700, onPressed: () async { - txtOfMedicalReport = await _controller.getText(); + txtOfMedicalReport = (await _controller.getText())!; if (txtOfMedicalReport.isNotEmpty) { GifLoaderDialogUtils.showMyDialog(context); widget.medicalReport != null - ? await widget.model.updateMedicalReport( - widget.patient, - txtOfMedicalReport, - widget.medicalReport != null - ? widget.medicalReport.lineItemNo - : null, - widget.medicalReport != null - ? widget.medicalReport.invoiceNo - : null) - : await widget.model.addMedicalReport( - widget.patient, txtOfMedicalReport); + ? await widget.model!.updateMedicalReport(widget.patient!, txtOfMedicalReport, widget.medicalReport != null ? widget.medicalReport!.lineItemNo! : 0, + widget.medicalReport != null ? widget.medicalReport!.invoiceNo! : "") + : await widget.model!.addMedicalReport(widget.patient!, txtOfMedicalReport); //model.getMedicalReportList(patient); Navigator.pop(context); GifLoaderDialogUtils.hideDialog(context); - if (widget.model.state == - ViewState.ErrorLocal) { - DrAppToastMsg.showErrorToast( - widget.model.error); + if (widget.model!.state == ViewState.ErrorLocal) { + DrAppToastMsg.showErrorToast(widget.model!.error); } } else { - DrAppToastMsg.showErrorToast( - "Please enter medical note"); + DrAppToastMsg.showErrorToast("Please enter medical note"); } }, ), @@ -156,28 +120,21 @@ class _AddVerifyMedicalReportState extends State { if (widget.medicalReport != null) Expanded( child: AppButton( - title: widget.status == MedicalReportStatus.ADD - ? TranslationBase.of(context).add - : TranslationBase.of(context).verify, + title: widget.status == MedicalReportStatus.ADD ? TranslationBase.of(context).add : TranslationBase.of(context).verify, color: AppGlobal.appGreenColor, fontWeight: FontWeight.w700, onPressed: () async { - txtOfMedicalReport = - await _controller.getText(); + txtOfMedicalReport = (await _controller.getText())!; if (txtOfMedicalReport.isNotEmpty) { GifLoaderDialogUtils.showMyDialog(context); - await widget.model.verifyMedicalReport( - widget.patient, widget.medicalReport); + await widget.model!.verifyMedicalReport(widget.patient!, widget.medicalReport!); GifLoaderDialogUtils.hideDialog(context); Navigator.pop(context); - if (widget.model.state == - ViewState.ErrorLocal) { - DrAppToastMsg.showErrorToast( - widget.model.error); + if (widget.model!.state == ViewState.ErrorLocal) { + DrAppToastMsg.showErrorToast(widget.model!.error); } } else { - DrAppToastMsg.showErrorToast( - "Please enter medical note"); + DrAppToastMsg.showErrorToast("Please enter medical note"); } }, ), diff --git a/lib/screens/patients/profile/medical_report/MedicalReportDetailPage.dart b/lib/screens/patients/profile/medical_report/MedicalReportDetailPage.dart index 6fd3867e..03631a3b 100644 --- a/lib/screens/patients/profile/medical_report/MedicalReportDetailPage.dart +++ b/lib/screens/patients/profile/medical_report/MedicalReportDetailPage.dart @@ -17,7 +17,7 @@ class MedicalReportDetailPage extends StatelessWidget { @override Widget build(BuildContext context) { ProjectViewModel 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 patientType = routeArgs['patientType']; String arrivalType = routeArgs['arrivalType']; @@ -43,13 +43,13 @@ class MedicalReportDetailPage extends StatelessWidget { children: [ AppText( "${TranslationBase.of(context).medical}", - fontSize: SizeConfig.textMultiplier * 1.6, + fontSize: SizeConfig.textMultiplier! * 1.6, fontWeight: FontWeight.w700, color: Color(0xFF2E303A), ), AppText( TranslationBase.of(context).report, - fontSize: SizeConfig.textMultiplier * 3, + fontSize: SizeConfig.textMultiplier! * 3, fontWeight: FontWeight.bold, color: Color(0xFF2E303A), ) diff --git a/lib/screens/patients/profile/medical_report/MedicalReportPage.dart b/lib/screens/patients/profile/medical_report/MedicalReportPage.dart index 2ba5aed3..72a3c742 100644 --- a/lib/screens/patients/profile/medical_report/MedicalReportPage.dart +++ b/lib/screens/patients/profile/medical_report/MedicalReportPage.dart @@ -34,7 +34,7 @@ class MedicalReportPage extends StatefulWidget { class _MedicalReportPageState extends State { @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']; @@ -64,13 +64,13 @@ class _MedicalReportPageState extends State { children: [ AppText( "${TranslationBase.of(context).medical}", - fontSize: SizeConfig.textMultiplier * 1.6, + fontSize: SizeConfig.textMultiplier! * 1.6, fontWeight: FontWeight.w700, color: Color(0xFF2E303A), ), AppText( TranslationBase.of(context).report, - fontSize: SizeConfig.textMultiplier * 3, + fontSize: SizeConfig.textMultiplier! * 3, fontWeight: FontWeight.bold, color: Color(0xFF2E303A), ) @@ -159,7 +159,7 @@ class _MedicalReportPageState extends State { 1 ? Color(0xFFCC9B14) : AppGlobal.appGreenColor, - fontSize: 1.4 * SizeConfig.textMultiplier, + fontSize: 1.4 * SizeConfig.textMultiplier!, bold: true, ), AppText( @@ -170,7 +170,7 @@ class _MedicalReportPageState extends State { : model.medicalReportList[index] .doctorName ?? "", - fontSize: 1.9 * SizeConfig.textMultiplier, + fontSize: 1.9 * SizeConfig.textMultiplier!, fontWeight: FontWeight.w700, color: Color(0xFF2E303A), ), @@ -180,16 +180,16 @@ class _MedicalReportPageState extends State { crossAxisAlignment: CrossAxisAlignment.end, children: [ AppText( - '${AppDateUtils.convertDateFromServerFormat(model.medicalReportList[index].editedOn ?? model.medicalReportList[index].createdOn, "dd MMM yyyy")}', + '${AppDateUtils.convertDateFromServerFormat(model.medicalReportList[index].editedOn ?? model.medicalReportList[index].createdOn!, "dd MMM yyyy")}', color: Color(0xFF2E303A), fontWeight: FontWeight.w600, - fontSize: 1.6 * SizeConfig.textMultiplier, + fontSize: 1.6 * SizeConfig.textMultiplier!, ), AppText( - '${AppDateUtils.convertDateFromServerFormat(model.medicalReportList[index].editedOn ?? model.medicalReportList[index].createdOn, "hh:mm a")}', + '${AppDateUtils.convertDateFromServerFormat(model.medicalReportList[index].editedOn ?? model.medicalReportList[index].createdOn!, "hh:mm a")}', color: Color(0xFF2E303A), fontWeight: FontWeight.w600, - fontSize: 1.5 * SizeConfig.textMultiplier, + fontSize: 1.5 * SizeConfig.textMultiplier!, ), ], ), @@ -204,11 +204,11 @@ class _MedicalReportPageState extends State { child: LargeAvatar( name: projectViewModel.isArabic ? model - .medicalReportList[index].doctorNameN + .medicalReportList[index].doctorNameN! : model - .medicalReportList[index].doctorName, + .medicalReportList[index].doctorName!, url: model - .medicalReportList[index].doctorImageURL, + .medicalReportList[index].doctorImageURL!, ), width: 50, height: 50, @@ -222,21 +222,21 @@ class _MedicalReportPageState extends State { AppText( projectViewModel.isArabic ? model.medicalReportList[index] - .projectNameN + .projectNameN! : model.medicalReportList[index] - .projectName, + .projectName!, fontSize: - 1.6 * SizeConfig.textMultiplier, + 1.6 * SizeConfig.textMultiplier!, color: Color(0xFF2E303A), ), AppText( projectViewModel.isArabic ? model.medicalReportList[index] - .clinicNameN + .clinicNameN! : model.medicalReportList[index] - .clinicName, + .clinicName!, fontSize: - 1.6 * SizeConfig.textMultiplier, + 1.6 * SizeConfig.textMultiplier!, color: Color(0xFF2E303A), ), ], diff --git a/lib/screens/patients/profile/notes/note/progress_note_screen.dart b/lib/screens/patients/profile/notes/note/progress_note_screen.dart index 19882b9c..2347f936 100644 --- a/lib/screens/patients/profile/notes/note/progress_note_screen.dart +++ b/lib/screens/patients/profile/notes/note/progress_note_screen.dart @@ -32,22 +32,21 @@ DrAppSharedPreferances sharedPref = new DrAppSharedPreferances(); class ProgressNoteScreen extends StatefulWidget { final int visitType; - const ProgressNoteScreen({Key key, this.visitType}) : super(key: key); + const ProgressNoteScreen({Key? key, required this.visitType}) : super(key: key); @override _ProgressNoteState createState() => _ProgressNoteState(); } class _ProgressNoteState extends State { - List notesList; + List? notesList; var filteredNotesList; bool isDischargedPatient = false; - AuthenticationViewModel authenticationViewModel; - ProjectViewModel projectViewModel; + AuthenticationViewModel authenticationViewModel = AuthenticationViewModel(); + late ProjectViewModel projectViewModel; - getProgressNoteList(BuildContext context, PatientViewModel model, - {bool isLocalBusy = false}) async { - final routeArgs = ModalRoute.of(context).settings.arguments as Map; + getProgressNoteList(BuildContext context, PatientViewModel model, {bool isLocalBusy = false}) async { + final routeArgs = ModalRoute.of(context)!.settings.arguments as Map; PatiantInformtion patient = routeArgs['patient']; String token = await sharedPref.getString(TOKEN); String type = await sharedPref.getString(SLECTED_PATIENT_TYPE); @@ -56,15 +55,12 @@ class _ProgressNoteState extends State { ProgressNoteRequest progressNoteRequest = ProgressNoteRequest( visitType: widget.visitType, // if equal 5 then this will return progress note - admissionNo: int.parse(patient.admissionNo), + admissionNo: int.parse(patient.admissionNo!), projectID: patient.projectId, tokenID: token, patientTypeID: patient.patientType, languageID: 2); - model - .getPatientProgressNote(progressNoteRequest.toJson(), - isLocalBusy: isLocalBusy) - .then((c) { + model.getPatientProgressNote(progressNoteRequest.toJson(), isLocalBusy: isLocalBusy).then((c) { notesList = model.patientProgressNoteList; }); } @@ -73,11 +69,10 @@ 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']; String arrivalType = routeArgs['arrivalType']; - if (routeArgs.containsKey('isDischargedPatient')) - isDischargedPatient = routeArgs['isDischargedPatient']; + if (routeArgs.containsKey('isDischargedPatient')) isDischargedPatient = routeArgs['isDischargedPatient']; return BaseView( onModelReady: (model) => getProgressNoteList(context, model), builder: (_, model, w) => AppScaffold( @@ -88,513 +83,340 @@ class _ProgressNoteState extends State { patient, isInpatient: true, ), - body: Container( - color: Colors.grey[200], - child: Column( - children: [ - if (!isDischargedPatient) - AddNewOrder( - onTap: () async { - await locator().logEvent( - eventCategory: "Progress Note Screen", - eventAction: "Update Progress Note", - ); - Navigator.push( - context, - MaterialPageRoute( - builder: (context) => UpdateNoteOrder( - patientModel: model, - patient: patient, - visitType: widget.visitType, - isUpdate: false, - ), - settings: RouteSettings(name: 'UpdateNoteOrder'), - ), - ); - }, - label: widget.visitType == 3 - ? TranslationBase.of(context).addNewOrderSheet - : TranslationBase.of(context).addProgressNote, + body: Container( + color: Colors.grey[200], + child: Column( + children: [ + if (!isDischargedPatient) + AddNewOrder( + onTap: () async { + await locator().logEvent( + eventCategory: "Progress Note Screen", + eventAction: "Update Progress Note", + ); + Navigator.push( + context, + MaterialPageRoute( + builder: (context) => UpdateNoteOrder( + patientModel: model, + patient: patient, + visitType: widget.visitType, + isUpdate: false, + ), + settings: RouteSettings(name: 'UpdateNoteOrder'), ), - Expanded( - child: Container( - child: ListView.builder( - itemCount: model.patientProgressNoteList.length, - itemBuilder: (BuildContext ctxt, int index) { - return FractionallySizedBox( - widthFactor: 0.95, - child: CardWithBgWidget( - hasBorder: false, - bgColor: model.patientProgressNoteList[index] - .status == - 1 && - authenticationViewModel - .doctorProfile.doctorID != - model - .patientProgressNoteList[ - index] - .createdBy - ? Color(0xFFCC9B14) - : model.patientProgressNoteList[index] - .status == - 4 - ? Colors.red.shade700 - : model.patientProgressNoteList[index] - .status == - 2 - ? AppGlobal.appGreenColor - : Color(0xFFCC9B14), - widget: Column( - children: [ - Column( - crossAxisAlignment: - CrossAxisAlignment.start, + ); + }, + label: widget.visitType == 3 ? TranslationBase.of(context).addNewOrderSheet : TranslationBase.of(context).addProgressNote, + ), + Expanded( + child: Container( + child: ListView.builder( + itemCount: model.patientProgressNoteList.length, + itemBuilder: (BuildContext ctxt, int index) { + return FractionallySizedBox( + widthFactor: 0.95, + child: CardWithBgWidget( + hasBorder: false, + bgColor: model.patientProgressNoteList[index].status == 1 && authenticationViewModel.doctorProfile!.doctorID != model.patientProgressNoteList[index].createdBy + ? Color(0xFFCC9B14) + : model.patientProgressNoteList[index].status == 4 + ? Colors.red.shade700 + : model.patientProgressNoteList[index].status == 2 + ? AppGlobal.appGreenColor + : Color(0xFFCC9B14), + widget: Column( + children: [ + Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + if (model.patientProgressNoteList[index].status == 1 && authenticationViewModel.doctorProfile!.doctorID != model.patientProgressNoteList[index].createdBy) + AppText( + TranslationBase.of(context).notePending, + fontWeight: FontWeight.bold, + color: Color(0xFFCC9B14), + fontSize: 12, + ), + if (model.patientProgressNoteList[index].status == 4) + AppText( + TranslationBase.of(context).noteCanceled, + fontWeight: FontWeight.bold, + color: Colors.red.shade700, + fontSize: 12, + ), + if (model.patientProgressNoteList[index].status == 2) + AppText( + TranslationBase.of(context).noteVerified, + fontWeight: FontWeight.bold, + color: AppGlobal.appGreenColor, + fontSize: 12, + ), + if (model.patientProgressNoteList[index].status != 2 && + model.patientProgressNoteList[index].status != 4 && + authenticationViewModel.doctorProfile!.doctorID == model.patientProgressNoteList[index].createdBy) + Row( + crossAxisAlignment: CrossAxisAlignment.start, children: [ - if (model - .patientProgressNoteList[ - index] - .status == - 1 && - authenticationViewModel - .doctorProfile.doctorID != - model - .patientProgressNoteList[ - index] - .createdBy) - AppText( - TranslationBase.of(context) - .notePending, - fontWeight: FontWeight.bold, - color: Color(0xFFCC9B14), - fontSize: 12, - ), - if (model - .patientProgressNoteList[ - index] - .status == - 4) - AppText( - TranslationBase.of(context) - .noteCanceled, - fontWeight: FontWeight.bold, - color: Colors.red.shade700, - fontSize: 12, - ), - if (model - .patientProgressNoteList[ - index] - .status == - 2) - AppText( - TranslationBase.of(context) - .noteVerified, - fontWeight: FontWeight.bold, - color: AppGlobal.appGreenColor, - fontSize: 12, - ), - if (model.patientProgressNoteList[index].status != 2 && - model - .patientProgressNoteList[ - index] - .status != - 4 && - authenticationViewModel - .doctorProfile.doctorID == - model - .patientProgressNoteList[ - index] - .createdBy) - Row( - crossAxisAlignment: - CrossAxisAlignment.start, - children: [ - InkWell( - onTap: () { - Navigator.push( - context, - MaterialPageRoute( - builder: (context) => - UpdateNoteOrder( - note: model - .patientProgressNoteList[ - index], - patientModel: - model, - patient: - patient, - visitType: widget - .visitType, - isUpdate: true, - )), - ); - }, - child: Container( - decoration: BoxDecoration( - color: Colors.grey[600], - borderRadius: - BorderRadius.circular( - 10), - ), - // color:Colors.red[600], + InkWell( + onTap: () { + Navigator.push( + context, + MaterialPageRoute( + builder: (context) => UpdateNoteOrder( + note: model.patientProgressNoteList[index], + patientModel: model, + patient: patient, + visitType: widget.visitType, + isUpdate: true, + )), + ); + }, + child: Container( + decoration: BoxDecoration( + color: Colors.grey[600], + borderRadius: BorderRadius.circular(10), + ), + // color:Colors.red[600], - child: Row( - children: [ - Icon( - DoctorApp.edit_1, - size: 12, - color: Colors.white, - ), - SizedBox( - width: 2, - ), - AppText( - TranslationBase.of( - context) - .update, - fontSize: 10, - color: Colors.white, - ), - ], - ), - padding: EdgeInsets.all(6), + child: Row( + children: [ + Icon( + DoctorApp.edit_1, + size: 12, + color: Colors.white, ), - ), - SizedBox( - width: 10, - ), - InkWell( - onTap: () async { - showMyDialog( - context: context, - actionName: "verify", - confirmFun: () async { - GifLoaderDialogUtils - .showMyDialog( - context); - UpdateNoteReqModel - reqModel = - UpdateNoteReqModel( - admissionNo: int - .parse(patient - .admissionNo), - cancelledNote: - false, - lineItemNo: model - .patientProgressNoteList[ - index] - .lineItemNo, - conditionId: model - .patientProgressNoteList[ - index].condition, - createdBy: model - .patientProgressNoteList[ - index] - .createdBy, - notes: model - .patientProgressNoteList[ - index] - .notes, - verifiedNote: true, - patientTypeID: - patient - .patientType, - patientOutSA: false, - ); - await model - .updatePatientProgressNote( - reqModel); - await getProgressNoteList( - context, model, - isLocalBusy: - true); - GifLoaderDialogUtils - .hideDialog( - context); - }); - }, - child: Container( - decoration: BoxDecoration( - color: AppGlobal - .appGreenColor, - borderRadius: - BorderRadius.circular( - 10), - ), - // color:Colors.red[600], - - child: Row( - children: [ - Icon( - FontAwesomeIcons - .check, - size: 12, - color: Colors.white, - ), - SizedBox( - width: 2, - ), - AppText( - TranslationBase.of( - context) - .noteVerify, - fontSize: 10, - color: Colors.white, - ), - ], - ), - padding: EdgeInsets.all(6), + SizedBox( + width: 2, ), - ), - SizedBox( - width: 10, - ), - InkWell( - onTap: () async { - showMyDialog( - context: context, - actionName: - TranslationBase.of( - context) - .cancel, - confirmFun: () async { - GifLoaderDialogUtils - .showMyDialog( - context, - ); - UpdateNoteReqModel - reqModel = - UpdateNoteReqModel( - admissionNo: int - .parse(patient - .admissionNo), - conditionId: model - .patientProgressNoteList[ - index].condition, - cancelledNote: true, - lineItemNo: model - .patientProgressNoteList[ - index] - .lineItemNo, - createdBy: model - .patientProgressNoteList[ - index] - .createdBy, - notes: model - .patientProgressNoteList[ - index] - .notes, - verifiedNote: false, - patientTypeID: - patient - .patientType, - patientOutSA: false, - ); - await model - .updatePatientProgressNote( - reqModel); - await getProgressNoteList( - context, model, - isLocalBusy: - true); - GifLoaderDialogUtils - .hideDialog( - context); - }); - }, - child: Container( - decoration: BoxDecoration( - color: Colors.red[600], - borderRadius: - BorderRadius.circular( - 10), - ), - // color:Colors.red[600], - - child: Row( - children: [ - Icon( - FontAwesomeIcons - .trash, - size: 12, - color: Colors.white, - ), - SizedBox( - width: 2, - ), - AppText( - 'Cancel', - fontSize: 10, - color: Colors.white, - ), - ], - ), - padding: EdgeInsets.all(6), + AppText( + TranslationBase.of(context).update, + fontSize: 10, + color: Colors.white, ), - ), - SizedBox( - width: 10, - ) - ], + ], + ), + padding: EdgeInsets.all(6), ), + ), SizedBox( - height: 10, + width: 10, ), - Row( - mainAxisAlignment: - MainAxisAlignment.spaceBetween, - crossAxisAlignment: - CrossAxisAlignment.start, - children: [ - Container( - width: MediaQuery.of(context) - .size - .width * - 0.60, - child: Column( - crossAxisAlignment: - CrossAxisAlignment.start, - children: [ - Row( - crossAxisAlignment: - CrossAxisAlignment - .start, - children: [ - AppText( - TranslationBase.of( - context) - .createdBy + ' ', - fontSize: 10, - ), - Expanded( - child: AppText( - model - .patientProgressNoteList[ - index] - .doctorName ?? - '', - fontWeight: - FontWeight.w600, - fontSize: 12, - isCopyable: true, - ), - ), - ], - ), - Row( - crossAxisAlignment: - CrossAxisAlignment - .start, - children: [ - AppText( - TranslationBase.of(context).conditionDescription + ' : ', - fontSize: 10, - ), - Expanded( - child: AppText( - model.patientProgressNoteList[index].conditionDescription ?? '', - fontWeight: - FontWeight.w600, - fontSize: 12, - isCopyable: true, - ), - ), - ], - ), - ], - ), + InkWell( + onTap: () async { + showMyDialog( + context: context, + actionName: "verify", + confirmFun: () async { + GifLoaderDialogUtils.showMyDialog(context); + UpdateNoteReqModel reqModel = UpdateNoteReqModel( + admissionNo: int.parse(patient.admissionNo!), + cancelledNote: false, + lineItemNo: model.patientProgressNoteList[index].lineItemNo, + conditionId: model.patientProgressNoteList[index].condition, + createdBy: model.patientProgressNoteList[index].createdBy, + notes: model.patientProgressNoteList[index].notes, + verifiedNote: true, + patientTypeID: patient.patientType, + patientOutSA: false, + ); + await model.updatePatientProgressNote(reqModel); + await getProgressNoteList(context, model, isLocalBusy: true); + GifLoaderDialogUtils.hideDialog(context); + }); + }, + child: Container( + decoration: BoxDecoration( + color: AppGlobal.appGreenColor, + borderRadius: BorderRadius.circular(10), ), - Column( + // color:Colors.red[600], + + child: Row( children: [ - AppText( - model - .patientProgressNoteList[ - index] - .createdOn != - null - ? AppDateUtils.getDayMonthYearDateFormatted( - AppDateUtils - .getDateTimeFromServerFormat(model - .patientProgressNoteList[ - index] - .createdOn), - isArabic: - projectViewModel - .isArabic, - isMonthShort: true) - : AppDateUtils - .getDayMonthYearDateFormatted( - DateTime.now(), - isArabic: - projectViewModel - .isArabic), - fontWeight: FontWeight.w600, - fontSize: 14, - isCopyable: true, + Icon( + FontAwesomeIcons.check, + size: 12, + color: Colors.white, + ), + SizedBox( + width: 2, ), AppText( - model - .patientProgressNoteList[ - index] - .createdOn != - null - ? AppDateUtils.getHour( - AppDateUtils - .getDateTimeFromServerFormat(model - .patientProgressNoteList[ - index] - .createdOn)) - : AppDateUtils.getHour( - DateTime.now()), - fontWeight: FontWeight.w600, - fontSize: 14, - isCopyable: true, + TranslationBase.of(context).noteVerify, + fontSize: 10, + color: Colors.white, ), ], - crossAxisAlignment: - CrossAxisAlignment.end, - ) - ], + ), + padding: EdgeInsets.all(6), + ), ), SizedBox( - height: 8, + width: 10, ), - Row( - mainAxisAlignment: - MainAxisAlignment.start, - children: [ - Expanded( - child: AppText( - model - .patientProgressNoteList[ - index] - .notes, + InkWell( + onTap: () async { + showMyDialog( + context: context, + actionName: TranslationBase.of(context).cancel, + confirmFun: () async { + GifLoaderDialogUtils.showMyDialog( + context, + ); + UpdateNoteReqModel reqModel = UpdateNoteReqModel( + admissionNo: int.parse(patient.admissionNo!), + conditionId: model.patientProgressNoteList[index].condition, + cancelledNote: true, + lineItemNo: model.patientProgressNoteList[index].lineItemNo, + createdBy: model.patientProgressNoteList[index].createdBy, + notes: model.patientProgressNoteList[index].notes, + verifiedNote: false, + patientTypeID: patient.patientType, + patientOutSA: false, + ); + await model.updatePatientProgressNote(reqModel); + await getProgressNoteList(context, model, isLocalBusy: true); + GifLoaderDialogUtils.hideDialog(context); + }); + }, + child: Container( + decoration: BoxDecoration( + color: Colors.red[600], + borderRadius: BorderRadius.circular(10), + ), + // color:Colors.red[600], + + child: Row( + children: [ + Icon( + FontAwesomeIcons.trash, + size: 12, + color: Colors.white, + ), + SizedBox( + width: 2, + ), + AppText( + 'Cancel', fontSize: 10, - isCopyable: true, + color: Colors.white, ), - ), - ]) + ], + ), + padding: EdgeInsets.all(6), + ), + ), + SizedBox( + width: 10, + ) ], ), - SizedBox( - height: 20, + SizedBox( + height: 10, + ), + Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Container( + width: MediaQuery.of(context).size.width * 0.60, + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Row( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + AppText( + TranslationBase.of(context).createdBy + ' ', + fontSize: 10, + ), + Expanded( + child: AppText( + model.patientProgressNoteList[index].doctorName ?? '', + fontWeight: FontWeight.w600, + fontSize: 12, + isCopyable: true, + ), + ), + ], + ), + Row( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + AppText( + TranslationBase.of(context).conditionDescription + ' : ', + fontSize: 10, + ), + Expanded( + child: AppText( + model.patientProgressNoteList[index].conditionDescription ?? '', + fontWeight: FontWeight.w600, + fontSize: 12, + isCopyable: true, + ), + ), + ], + ), + ], + ), + ), + Column( + children: [ + AppText( + model.patientProgressNoteList[index].createdOn != null + ? AppDateUtils.getDayMonthYearDateFormatted(AppDateUtils.getDateTimeFromServerFormat(model.patientProgressNoteList[index].createdOn!), + isArabic: projectViewModel.isArabic, isMonthShort: true) + : AppDateUtils.getDayMonthYearDateFormatted(DateTime.now(), isArabic: projectViewModel.isArabic), + fontWeight: FontWeight.w600, + fontSize: 14, + isCopyable: true, + ), + AppText( + model.patientProgressNoteList[index].createdOn != null + ? AppDateUtils.getHour(AppDateUtils.getDateTimeFromServerFormat(model.patientProgressNoteList[index].createdOn!)) + : AppDateUtils.getHour(DateTime.now()), + fontWeight: FontWeight.w600, + fontSize: 14, + isCopyable: true, + ), + ], + crossAxisAlignment: CrossAxisAlignment.end, + ) + ], + ), + SizedBox( + height: 8, + ), + Row(mainAxisAlignment: MainAxisAlignment.start, children: [ + Expanded( + child: AppText( + model.patientProgressNoteList[index].notes!, + fontSize: 10, + isCopyable: true, + ), ), - ], - ), + ]) + ], ), - ); - }), - ), - ), - ], + SizedBox( + height: 20, + ), + ], + ), + ), + ); + }), ), ), + ], + ), + ), ), ); } - /// TODO Elham* Make this as custom Dialog - showMyDialog({BuildContext context, Function confirmFun, String actionName}) { + showMyDialog({required BuildContext context, required Function confirmFun, required String actionName}) { showDialog( context: context, builder: (ctx) => Center( @@ -637,9 +459,7 @@ class _ProgressNoteState extends State { padding: EdgeInsets.all(20), color: Colors.white, child: AppText( - projectViewModel.isArabic - ? "هل أنت متأكد أنك تريد تنفيذ $actionName هذا الأمر؟" - : 'Are you sure you want $actionName this order?', + projectViewModel.isArabic ? "هل أنت متأكد أنك تريد تنفيذ $actionName هذا الأمر؟" : 'Are you sure you want $actionName this order?', fontSize: 15, textAlign: TextAlign.center, ), @@ -654,7 +474,7 @@ class _ProgressNoteState extends State { child: Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ - FlatButton( + ElevatedButton( child: AppText( TranslationBase.of(context).cancel, fontWeight: FontWeight.w600, @@ -664,7 +484,7 @@ class _ProgressNoteState extends State { onPressed: () { Navigator.of(context).pop(); }), - FlatButton( + ElevatedButton( child: AppText( TranslationBase.of(context).noteConfirm, fontWeight: FontWeight.w600, diff --git a/lib/screens/patients/profile/notes/note/update_note.dart b/lib/screens/patients/profile/notes/note/update_note.dart index d4a78eca..a2ed1417 100644 --- a/lib/screens/patients/profile/notes/note/update_note.dart +++ b/lib/screens/patients/profile/notes/note/update_note.dart @@ -30,24 +30,15 @@ import '../../../../../widgets/shared/dialogs/dailog-list-select.dart'; import '../../../../base/base_view.dart'; class UpdateNoteOrder extends StatefulWidget { - final NoteModel note; - final PatientViewModel patientModel; - final PatiantInformtion patient; - final int visitType; + final NoteModel? note; + final PatientViewModel? patientModel; + final PatiantInformtion? patient; + final int? visitType; final bool isUpdate; - final List elementList; - final Function(dynamic) okFunction; + final List? elementList; + final Function(dynamic)? okFunction; - const UpdateNoteOrder( - {Key key, - this.note, - this.patientModel, - this.patient, - this.visitType, - this.isUpdate, - this.elementList, - this.okFunction}) - : super(key: key); + UpdateNoteOrder({Key? key, this.note, this.patientModel, this.patient, this.visitType, this.isUpdate = false, this.elementList, this.okFunction}) : super(key: key); @override _UpdateNoteOrderState createState() => _UpdateNoteOrderState(); @@ -55,12 +46,12 @@ class UpdateNoteOrder extends StatefulWidget { class _UpdateNoteOrderState extends State { dynamic selectValue; - int selectedType; + int selectedType = 0; bool isSubmitted = false; stt.SpeechToText speech = stt.SpeechToText(); var recognizedWord; var event = RobotProvider(); - ProjectViewModel projectViewModel; + late ProjectViewModel projectViewModel; TextEditingController progressNoteController = TextEditingController(); @@ -90,12 +81,10 @@ class _UpdateNoteOrderState extends State { projectViewModel = Provider.of(context); if (widget.note != null) { - progressNoteController.text = widget.note.notes; - if(selectValue==null) - selectValue={}; - selectValue[keyId] = widget.note.condition; - selectValue['Description'] = widget.note.conditionDescription; - + progressNoteController.text = widget.note!.notes!; + if (selectValue == null) selectValue = {}; + selectValue[keyId] = widget.note!.condition; + selectValue['Description'] = widget.note!.conditionDescription!; } return BaseView( @@ -115,14 +104,8 @@ class _UpdateNoteOrderState extends State { children: [ BottomSheetTitle( title: widget.visitType == 3 - ? (widget.isUpdate - ? TranslationBase.of(context).noteUpdate - : TranslationBase.of(context).noteAdd) + - TranslationBase.of(context).orderSheet - : (widget.isUpdate - ? TranslationBase.of(context).noteUpdate - : TranslationBase.of(context).noteAdd) + - TranslationBase.of(context).progressNote, + ? (widget.isUpdate ? TranslationBase.of(context).noteUpdate : TranslationBase.of(context).noteAdd) + TranslationBase.of(context).orderSheet + : (widget.isUpdate ? TranslationBase.of(context).noteUpdate : TranslationBase.of(context).noteAdd) + TranslationBase.of(context).progressNote, ), SizedBox( height: 10.0, @@ -136,11 +119,7 @@ class _UpdateNoteOrderState extends State { ListSelectDialog dialog = ListSelectDialog( list: model.stpMasterList, attributeName: 'Description', - attributeValueId: - model.stpMasterList.length == 1 - ? model.stpMasterList[0]['${keyId}'] - .toString() - : '${keyId}', + attributeValueId: model.stpMasterList.length == 1 ? model.stpMasterList[0]['${keyId}'].toString() : '${keyId}', okText: TranslationBase.of(context).ok, okFunction: (selectedValue) => { setState(() { @@ -159,7 +138,7 @@ class _UpdateNoteOrderState extends State { } : null, child: AppTextFieldCustom( - hintText: TranslationBase.of(context).selectCondition,//'Select Condition', + hintText: TranslationBase.of(context).selectCondition, //'Select Condition', dropDownText: model.stpMasterList.length == 1 ? model.stpMasterList[0]['Description'] : selectValue == null @@ -182,19 +161,8 @@ class _UpdateNoteOrderState extends State { children: [ AppTextFieldCustom( hintText: widget.visitType == 3 - ? (widget.isUpdate - ? TranslationBase.of(context) - .noteUpdate - : TranslationBase.of(context) - .noteAdd) + - TranslationBase.of(context).orderSheet - : (widget.isUpdate - ? TranslationBase.of(context) - .noteUpdate - : TranslationBase.of(context) - .noteAdd) + - TranslationBase.of(context) - .progressNote, + ? (widget.isUpdate! ? TranslationBase.of(context).noteUpdate : TranslationBase.of(context).noteAdd) + TranslationBase.of(context).orderSheet + : (widget.isUpdate! ? TranslationBase.of(context).noteUpdate : TranslationBase.of(context).noteAdd) + TranslationBase.of(context).progressNote, //TranslationBase.of(context).addProgressNote, controller: progressNoteController, maxLines: 40, @@ -202,26 +170,18 @@ class _UpdateNoteOrderState extends State { hasBorder: true, // isTextFieldHasSuffix: true, - validationError: progressNoteController - .text.isEmpty && - isSubmitted - ? TranslationBase.of(context).emptyMessage - : null, + validationError: progressNoteController.text.isEmpty && isSubmitted ? TranslationBase.of(context).emptyMessage : "", ), Positioned( top: -2, //MediaQuery.of(context).size.height * 0, - right: projectViewModel.isArabic - ? MediaQuery.of(context).size.width * 0.75 - : 15, + right: projectViewModel.isArabic ? MediaQuery.of(context).size.width * 0.75 : 15, child: Column( children: [ IconButton( - icon: Icon(DoctorApp.speechtotext, - color: Colors.black, size: 35), + icon: Icon(DoctorApp.speechtotext, color: Colors.black, size: 35), onPressed: () { - initSpeechState() - .then((value) => {onVoiceText()}); + initSpeechState().then((value) => {onVoiceText()}); }, ), ], @@ -258,14 +218,8 @@ class _UpdateNoteOrderState extends State { margin: EdgeInsets.all(5), child: AppButton( title: widget.visitType == 3 - ? (widget.isUpdate - ? TranslationBase.of(context).noteUpdate - : TranslationBase.of(context).noteAdd) + - TranslationBase.of(context).orderSheet - : (widget.isUpdate - ? TranslationBase.of(context).noteUpdate - : TranslationBase.of(context).noteAdd) + - TranslationBase.of(context).progressNote, + ? (widget.isUpdate ? TranslationBase.of(context).noteUpdate : TranslationBase.of(context).noteAdd) + TranslationBase.of(context).orderSheet + : (widget.isUpdate ? TranslationBase.of(context).noteUpdate : TranslationBase.of(context).noteAdd) + TranslationBase.of(context).progressNote, color: AppGlobal.appGreenColor, // disabled: progressNoteController.text.isEmpty, fontWeight: FontWeight.w700, @@ -275,61 +229,51 @@ class _UpdateNoteOrderState extends State { }); if (progressNoteController.text.trim().isNotEmpty) { GifLoaderDialogUtils.showMyDialog(context); - Map profile = await sharedPref.getObj(DOCTOR_PROFILE); + Map profile = await sharedPref.getObj(DOCTOR_PROFILE); - DoctorProfileModel doctorProfile = - DoctorProfileModel.fromJson(profile); + DoctorProfileModel doctorProfile = DoctorProfileModel.fromJson(profile); if (widget.isUpdate) { UpdateNoteReqModel reqModel = UpdateNoteReqModel( - admissionNo: - int.parse(widget.patient.admissionNo), + admissionNo: int.parse(widget.patient!.admissionNo!), cancelledNote: false, - lineItemNo: widget.note.lineItemNo, - createdBy: widget.note.createdBy, + lineItemNo: widget.note!.lineItemNo!, + createdBy: widget.note!.createdBy!, notes: progressNoteController.text, verifiedNote: false, - patientTypeID: widget.patient.patientType, + patientTypeID: widget.patient!.patientType, patientOutSA: false, conditionId: selectValue['ParameterCode']); - await widget.patientModel - .updatePatientProgressNote(reqModel); + await widget.patientModel!.updatePatientProgressNote(reqModel); } else { CreateNoteModel reqModel = CreateNoteModel( - admissionNo: - int.parse(widget.patient.admissionNo), + admissionNo: int.parse(widget.patient!.admissionNo!), createdBy: doctorProfile.doctorID, visitType: widget.visitType, - patientID: widget.patient.patientId, + patientID: widget.patient!.patientId, nursingRemarks: ' ', - patientTypeID: widget.patient.patientType, + patientTypeID: widget.patient!.patientType, patientOutSA: false, notes: progressNoteController.text, conditionId: selectValue['ParameterCode']); - await widget.patientModel - .createPatientProgressNote(reqModel); + await widget.patientModel!.createPatientProgressNote(reqModel); } - if (widget.patientModel.state == - ViewState.ErrorLocal) { - Utils.showErrorToast(widget.patientModel.error); + if (widget.patientModel!.state == ViewState.ErrorLocal) { + Utils.showErrorToast(widget.patientModel!.error); } else { - ProgressNoteRequest progressNoteRequest = - ProgressNoteRequest( - visitType: widget.visitType, - // if equal 5 then this will return progress note - admissionNo: - int.parse(widget.patient.admissionNo), - projectID: widget.patient.projectId, - patientTypeID: widget.patient.patientType, - languageID: 2); - await widget.patientModel.getPatientProgressNote( - progressNoteRequest.toJson()); + ProgressNoteRequest progressNoteRequest = ProgressNoteRequest( + visitType: widget.visitType, + // if equal 5 then this will return progress note + admissionNo: int.parse(widget.patient!.admissionNo!), + projectID: widget.patient!.projectId, + patientTypeID: widget.patient!.patientType, + languageID: 2); + await widget.patientModel!.getPatientProgressNote(progressNoteRequest.toJson()); } GifLoaderDialogUtils.hideDialog(context); - DrAppToastMsg.showSuccesToast( - TranslationBase.of(context).yourOrderAddedSuccessfully); + DrAppToastMsg.showSuccesToast(TranslationBase.of(context).yourOrderAddedSuccessfully); Navigator.of(context).pop(); } else { Utils.showErrorToast(TranslationBase.of(context).youCannotAddOnlySpaces); @@ -345,8 +289,7 @@ class _UpdateNoteOrderState extends State { onVoiceText() async { new SpeechToText(context: context).showAlertDialog(context); var lang = TranslationBase.of(AppGlobal.CONTEX).locale.languageCode; - bool available = await speech.initialize( - onStatus: statusListener, onError: errorListener); + bool available = await speech.initialize(onStatus: statusListener, onError: errorListener); if (available) { speech.listen( onResult: resultListener, @@ -390,8 +333,7 @@ class _UpdateNoteOrderState extends State { } Future initSpeechState() async { - bool hasSpeech = await speech.initialize( - onError: errorListener, onStatus: statusListener); + bool hasSpeech = await speech.initialize(onError: errorListener, onStatus: statusListener); print(hasSpeech); if (!mounted) return; } diff --git a/lib/screens/patients/profile/notes/nursing_note/nursing_note_screen.dart b/lib/screens/patients/profile/notes/nursing_note/nursing_note_screen.dart index 37cdd870..d4499286 100644 --- a/lib/screens/patients/profile/notes/nursing_note/nursing_note_screen.dart +++ b/lib/screens/patients/profile/notes/nursing_note/nursing_note_screen.dart @@ -20,29 +20,29 @@ import 'package:provider/provider.dart'; DrAppSharedPreferances sharedPref = new DrAppSharedPreferances(); class NursingProgressNoteScreen extends StatefulWidget { - const NursingProgressNoteScreen({Key key}) : super(key: key); + const NursingProgressNoteScreen({Key? key}) : super(key: key); @override _ProgressNoteState createState() => _ProgressNoteState(); } class _ProgressNoteState extends State { - List notesList; + List notesList = []; var filteredNotesList; bool isDischargedPatient = false; - AuthenticationViewModel authenticationViewModel; - ProjectViewModel projectViewModel; + AuthenticationViewModel authenticationViewModel = AuthenticationViewModel(); + late ProjectViewModel projectViewModel; getProgressNoteList(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); GetNursingProgressNoteRequestModel getNursingProgressNoteRequestModel = GetNursingProgressNoteRequestModel( - admissionNo: int.parse(patient.admissionNo), + admissionNo: int.parse(patient.admissionNo!), patientTypeID: patient.patientType, patientID: patient.patientId, setupID: "010266"); @@ -53,7 +53,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']; @@ -156,7 +156,7 @@ class _ProgressNoteState extends State { .getDateTimeFromServerFormat(model .patientNursingProgressNoteList[ index] - .createdOn), + .createdOn!), isArabic: projectViewModel .isArabic, @@ -182,7 +182,7 @@ class _ProgressNoteState extends State { .getDateTimeFromServerFormat(model .patientNursingProgressNoteList[ index] - .createdOn)) + .createdOn!)) : AppDateUtils.getHour( DateTime.now()), fontWeight: FontWeight.w600, @@ -207,7 +207,7 @@ class _ProgressNoteState extends State { model .patientNursingProgressNoteList[ index] - .notes, + .notes!, fontSize: 10, isCopyable: true, ), diff --git a/lib/screens/patients/profile/operation_report/operation_report.dart b/lib/screens/patients/profile/operation_report/operation_report.dart index 4462f981..f6dd8dbc 100644 --- a/lib/screens/patients/profile/operation_report/operation_report.dart +++ b/lib/screens/patients/profile/operation_report/operation_report.dart @@ -24,31 +24,30 @@ import '../../../../widgets/shared/app_texts_widget.dart'; DrAppSharedPreferances sharedPref = new DrAppSharedPreferances(); class OperationReportScreen extends StatefulWidget { - final int visitType; + final int? visitType; - const OperationReportScreen({Key key, this.visitType}) : super(key: key); + const OperationReportScreen({Key? key, this.visitType}) : super(key: key); @override _ProgressNoteState createState() => _ProgressNoteState(); } class _ProgressNoteState extends State { - List notesList; + List notesList = []; var filteredNotesList; bool isDischargedPatient = false; - AuthenticationViewModel authenticationViewModel; - ProjectViewModel projectViewModel; + AuthenticationViewModel authenticationViewModel = AuthenticationViewModel(); + 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']; - if (routeArgs.containsKey('isDischargedPatient')) - isDischargedPatient = routeArgs['isDischargedPatient']; + if (routeArgs.containsKey('isDischargedPatient')) isDischargedPatient = routeArgs['isDischargedPatient']; return BaseView( - onModelReady: (model) => model.getReservations(patient.patientMRN), + onModelReady: (model) => model.getReservations(patient.patientMRN!), builder: (_, model, w) => AppScaffold( baseViewModel: model, backgroundColor: Theme.of(context).scaffoldBackgroundColor, @@ -59,8 +58,7 @@ class _ProgressNoteState extends State { ), body: Container( color: Colors.grey[200], - child: model.reservationList == null || - model.reservationList.length == 0 + child: model.reservationList == null || model.reservationList.length == 0 ? Center( child: ErrorMessage( error: TranslationBase.of(context).noDataAvailable, @@ -81,46 +79,29 @@ class _ProgressNoteState extends State { widget: Column( children: [ Column( - crossAxisAlignment: - CrossAxisAlignment.start, - mainAxisAlignment: - MainAxisAlignment.start, + crossAxisAlignment: CrossAxisAlignment.start, + mainAxisAlignment: MainAxisAlignment.start, children: [ Row( - mainAxisAlignment: - MainAxisAlignment.spaceBetween, - crossAxisAlignment: - CrossAxisAlignment.start, + mainAxisAlignment: MainAxisAlignment.spaceBetween, + crossAxisAlignment: CrossAxisAlignment.start, children: [ Container( - width: MediaQuery.of(context) - .size - .width * - 0.60, + width: MediaQuery.of(context).size.width * 0.60, child: Column( - crossAxisAlignment: - CrossAxisAlignment.start, + crossAxisAlignment: CrossAxisAlignment.start, children: [ Row( - crossAxisAlignment: - CrossAxisAlignment - .start, + crossAxisAlignment: CrossAxisAlignment.start, children: [ AppText( - TranslationBase.of( - context) - .createdBy, + TranslationBase.of(context).createdBy, fontSize: 10, ), Expanded( child: AppText( - model - .reservationList[ - index] - .doctorName ?? - '', - fontWeight: - FontWeight.w600, + model.reservationList[index].doctorName ?? '', + fontWeight: FontWeight.w600, fontSize: 12, ), ), @@ -132,146 +113,83 @@ class _ProgressNoteState extends State { Column( children: [ AppText( - model.reservationList[index] - .createdOn != - null - ? AppDateUtils.getDayMonthYearDateFormatted( - AppDateUtils - .getDateTimeFromServerFormat(model - .reservationList[ - index] - .createdOn), - isArabic: - projectViewModel - .isArabic, - isMonthShort: true) - : AppDateUtils - .getDayMonthYearDateFormatted( - DateTime.now(), - isArabic: - projectViewModel - .isArabic), + model.reservationList[index].createdOn != null + ? AppDateUtils.getDayMonthYearDateFormatted(AppDateUtils.getDateTimeFromServerFormat(model.reservationList[index].createdOn!), + isArabic: projectViewModel.isArabic, isMonthShort: true) + : AppDateUtils.getDayMonthYearDateFormatted(DateTime.now(), isArabic: projectViewModel.isArabic), fontWeight: FontWeight.w600, fontSize: 14, ), AppText( - model.reservationList[index] - .createdOn != - null - ? AppDateUtils.getHour( - AppDateUtils - .getDateTimeFromServerFormat(model - .reservationList[ - index] - .createdOn)) - : AppDateUtils.getHour( - DateTime.now()), + model.reservationList[index].createdOn != null + ? AppDateUtils.getHour(AppDateUtils.getDateTimeFromServerFormat(model.reservationList[index].createdOn!)) + : AppDateUtils.getHour(DateTime.now()), fontWeight: FontWeight.w600, fontSize: 14, ), ], - crossAxisAlignment: - CrossAxisAlignment.end, + crossAxisAlignment: CrossAxisAlignment.end, ) ], ), SizedBox( height: 8, ), - Row( - mainAxisAlignment: - MainAxisAlignment.start, - children: [ - AppText( - TranslationBase.of(context) - .reservation, - fontSize: 10, - ), - Expanded( - child: AppText( - model.reservationList[index] - .oTReservationID - .toString(), - fontSize: 10, - ), - ) - ]), + Row(mainAxisAlignment: MainAxisAlignment.start, children: [ + AppText( + TranslationBase.of(context).reservation, + fontSize: 10, + ), + Expanded( + child: AppText( + model.reservationList[index].oTReservationID.toString(), + fontSize: 10, + ), + ) + ]), SizedBox( height: 8, ), - if (model.reservationList[index] - .operationDate != - null) - Row( - mainAxisAlignment: - MainAxisAlignment.start, - children: [ - AppText( - TranslationBase.of(context) - .operationDate, - fontSize: 10, - ), - Expanded( - child: AppText( - AppDateUtils.getDayMonthYearDateFormatted( - AppDateUtils - .getDateTimeFromServerFormat(model - .reservationList[ - index] - .operationDate), - isArabic: - projectViewModel - .isArabic, - isMonthShort: true), - fontSize: 10, - ), - ) - ]), - if (model.reservationList[index] - .timeStart != - null) - Row( - mainAxisAlignment: - MainAxisAlignment.start, - children: [ - AppText( - TranslationBase.of(context) - .operationTimeStart, - fontSize: 10, - ), - Expanded( - child: AppText( - model - .reservationList[ - index] - .timeStart, - fontSize: 10, - ), - ) - ]), - if (model.reservationList[index] - .remarks != - null) - Row( - mainAxisAlignment: - MainAxisAlignment.start, - children: [ - AppText( - TranslationBase.of(context) - .remarks, - fontSize: 10, - ), - Expanded( - child: AppText( - model - .reservationList[ - index] - .remarks ?? - '', - fontSize: 10, - ), - ), - ]) + if (model.reservationList[index].operationDate != null) + Row(mainAxisAlignment: MainAxisAlignment.start, children: [ + AppText( + TranslationBase.of(context).operationDate, + fontSize: 10, + ), + Expanded( + child: AppText( + AppDateUtils.getDayMonthYearDateFormatted(AppDateUtils.getDateTimeFromServerFormat(model.reservationList[index].operationDate!), + isArabic: projectViewModel.isArabic, isMonthShort: true), + fontSize: 10, + ), + ) + ]), + if (model.reservationList[index].timeStart != null) + Row(mainAxisAlignment: MainAxisAlignment.start, children: [ + AppText( + TranslationBase.of(context).operationTimeStart, + fontSize: 10, + ), + Expanded( + child: AppText( + model.reservationList[index].timeStart!, + fontSize: 10, + ), + ) + ]), + if (model.reservationList[index].remarks != null) + Row(mainAxisAlignment: MainAxisAlignment.start, children: [ + AppText( + TranslationBase.of(context).remarks, + fontSize: 10, + ), + Expanded( + child: AppText( + model.reservationList[index].remarks ?? '', + fontSize: 10, + ), + ), + ]) ], ), @@ -287,28 +205,20 @@ class _ProgressNoteState extends State { // index] // .createdBy) Row( - crossAxisAlignment: - CrossAxisAlignment.start, - mainAxisAlignment: - MainAxisAlignment.end, + crossAxisAlignment: CrossAxisAlignment.start, + mainAxisAlignment: MainAxisAlignment.end, children: [ InkWell( onTap: () async { - await locator() - .logEvent( - eventCategory: - "Operation Report Screen", - eventAction: - "Update Operation Report ", + await locator().logEvent( + eventCategory: "Operation Report Screen", + eventAction: "Update Operation Report ", ); Navigator.push( context, MaterialPageRoute( - builder: (context) => - UpdateOperationReport( - reservation: model - .reservationList[ - index], + builder: (context) => UpdateOperationReport( + reservation: model.reservationList[index], patient: patient, isUpdate: true, )), @@ -317,8 +227,7 @@ class _ProgressNoteState extends State { child: Container( decoration: BoxDecoration( color: AppGlobal.appGreenColor, - borderRadius: - BorderRadius.circular(10), + borderRadius: BorderRadius.circular(10), ), // color:Colors.red[600], @@ -333,8 +242,7 @@ class _ProgressNoteState extends State { width: 2, ), AppText( - TranslationBase.of(context) - .operationReports, + TranslationBase.of(context).operationReports, fontSize: 10, color: Colors.white, ), 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 282ce990..86b69cec 100644 --- a/lib/screens/patients/profile/operation_report/update_operation_report.dart +++ b/lib/screens/patients/profile/operation_report/update_operation_report.dart @@ -1,3 +1,4 @@ +import 'package:doctor_app_flutter/config/config.dart'; import 'package:doctor_app_flutter/config/size_config.dart'; import 'package:doctor_app_flutter/core/enum/view_state.dart'; import 'package:doctor_app_flutter/core/provider/robot_provider.dart'; @@ -20,18 +21,14 @@ import 'package:flutter/material.dart'; import 'package:provider/provider.dart'; import 'package:speech_to_text/speech_to_text.dart' as stt; -import '../../../../config/config.dart'; - class UpdateOperationReport extends StatefulWidget { - final GetReservationsResponseModel reservation; - - // final OperationReportViewModel operationReportViewModel; - final PatiantInformtion patient; - final int visitType; - final bool isUpdate; + final GetReservationsResponseModel? reservation; + final PatiantInformtion? patient; + final int? visitType; + final bool? isUpdate; const UpdateOperationReport( - {Key key, + {Key? key, // this.operationReportViewModel, this.patient, this.visitType, @@ -44,12 +41,12 @@ class UpdateOperationReport extends StatefulWidget { } class _UpdateOperationReportState extends State { - int selectedType; + int? selectedType; bool isSubmitted = false; stt.SpeechToText speech = stt.SpeechToText(); var recognizedWord; var event = RobotProvider(); - ProjectViewModel projectViewModel; + late ProjectViewModel projectViewModel; TextEditingController preOpDiagmosisController = TextEditingController(); TextEditingController postOpDiagmosisNoteController = TextEditingController(); @@ -63,13 +60,11 @@ class _UpdateOperationReportState extends State { TextEditingController complicationDetailsController = TextEditingController(); TextEditingController bloodLossDetailController = TextEditingController(); TextEditingController histopathSpecimenController = TextEditingController(); - TextEditingController microbiologySpecimenController = - TextEditingController(); + TextEditingController microbiologySpecimenController = TextEditingController(); TextEditingController otherSpecimenController = TextEditingController(); TextEditingController scrubNurseController = TextEditingController(); TextEditingController circulatingNurseController = TextEditingController(); - TextEditingController BloodTransfusedDetailController = - TextEditingController(); + TextEditingController BloodTransfusedDetailController = TextEditingController(); TextEditingController anasthetistController = TextEditingController(); TextEditingController OTReservationID = TextEditingController(); @@ -91,33 +86,30 @@ class _UpdateOperationReportState extends State { return BaseView( onModelReady: (model) async { - await model.getOperationReportDetails(widget.reservation); - OTReservationID.text = widget.reservation.oTReservationID.toString(); + await model.getOperationReportDetails(widget.reservation!); + OTReservationID.text = widget.reservation!.oTReservationID.toString(); if (model.operationDetailsList.isNotEmpty) { - GetOperationDetailsResponseModel oldDetails = - model.operationDetailsList[0]; - - postOpDiagmosisNoteController.text = oldDetails.postOpInstruction; - preOpDiagmosisController.text = oldDetails.preOpDiagnosis; - surgeonController.text = oldDetails.surgeon; - assistantNoteController.text = oldDetails.assistant; - operationController.text = oldDetails.operation; - inasionController.text = oldDetails.inasion; - findingController.text = oldDetails.finding; - surgeryProcedureController.text = oldDetails.surgeryProcedure; - postOpInstructionController.text = oldDetails.postOpInstruction; - complicationDetailsController.text = oldDetails.complicationDetail; - bloodLossDetailController.text = oldDetails.bloodLossDetail; - histopathSpecimenController.text = oldDetails.histopathSpecimen; - microbiologySpecimenController.text = - oldDetails.microbiologySpecimen; - otherSpecimenController.text = oldDetails.otherSpecimen; + GetOperationDetailsResponseModel oldDetails = model.operationDetailsList[0]; + + postOpDiagmosisNoteController.text = oldDetails.postOpInstruction!; + preOpDiagmosisController.text = oldDetails.preOpDiagnosis!; + surgeonController.text = oldDetails.surgeon!; + assistantNoteController.text = oldDetails.assistant!; + operationController.text = oldDetails.operation!; + inasionController.text = oldDetails.inasion!; + findingController.text = oldDetails.finding!; + surgeryProcedureController.text = oldDetails.surgeryProcedure!; + postOpInstructionController.text = oldDetails.postOpInstruction!; + complicationDetailsController.text = oldDetails.complicationDetail!; + bloodLossDetailController.text = oldDetails.bloodLossDetail!; + histopathSpecimenController.text = oldDetails.histopathSpecimen!; + microbiologySpecimenController.text = oldDetails.microbiologySpecimen!; + otherSpecimenController.text = oldDetails.otherSpecimen!; scrubNurseController.text = oldDetails.scrubNurse; circulatingNurseController.text = oldDetails.circulatingNurse; - BloodTransfusedDetailController.text = - oldDetails.bloodTransfusedDetail; - anasthetistController.text = oldDetails.anasthetist; + BloodTransfusedDetailController.text = oldDetails.bloodTransfusedDetail; + anasthetistController.text = oldDetails.anasthetist!; } }, builder: (_, model, w) => AppScaffold( @@ -146,8 +138,7 @@ class _UpdateOperationReportState extends State { child: Column( children: [ AppTextFieldCustom( - hintText: TranslationBase.of(context) - .reservation, + hintText: TranslationBase.of(context).reservation, controller: OTReservationID, maxLines: 1, minLines: 1, @@ -158,95 +149,63 @@ class _UpdateOperationReportState extends State { height: 4, ), AppTextFieldCustom( - hintText: TranslationBase.of(context) - .preOperationDiagnosis, + hintText: TranslationBase.of(context).preOperationDiagnosis, controller: preOpDiagmosisController, maxLines: 20, minLines: 8, hasBorder: true, - // isTextFieldHasSuffix: true, - validationError: preOpDiagmosisController - .text.isEmpty && - isSubmitted - ? TranslationBase.of(context) - .emptyMessage - : null, + validationError: preOpDiagmosisController.text.isEmpty && isSubmitted ? TranslationBase.of(context).emptyMessage : "", ), SizedBox( height: 4, ), AppTextFieldCustom( - hintText: TranslationBase.of(context) - .postOperationDiagnosis, + hintText: TranslationBase.of(context).postOperationDiagnosis, controller: postOpDiagmosisNoteController, maxLines: 20, minLines: 8, hasBorder: true, // isTextFieldHasSuffix: true, - validationError: - postOpDiagmosisNoteController - .text.isEmpty && - isSubmitted - ? TranslationBase.of(context) - .emptyMessage - : null, + validationError: postOpDiagmosisNoteController.text.isEmpty && isSubmitted ? TranslationBase.of(context).emptyMessage : "", ), SizedBox( height: 4, ), AppTextFieldCustom( - hintText: - TranslationBase.of(context).surgeon, + hintText: TranslationBase.of(context).surgeon, controller: surgeonController, maxLines: 1, minLines: 1, hasBorder: true, // isTextFieldHasSuffix: true, - validationError: - surgeonController.text.isEmpty && - isSubmitted - ? TranslationBase.of(context) - .emptyMessage - : null, + validationError: surgeonController.text.isEmpty && isSubmitted ? TranslationBase.of(context).emptyMessage : "", ), SizedBox( height: 4, ), AppTextFieldCustom( - hintText: - TranslationBase.of(context).assistant, + hintText: TranslationBase.of(context).assistant, controller: assistantNoteController, maxLines: 1, minLines: 1, hasBorder: true, // isTextFieldHasSuffix: true, - validationError: assistantNoteController - .text.isEmpty && - isSubmitted - ? TranslationBase.of(context) - .emptyMessage - : null, + validationError: assistantNoteController.text.isEmpty && isSubmitted ? TranslationBase.of(context).emptyMessage : "", ), SizedBox( height: 4, ), AppTextFieldCustom( - hintText: - TranslationBase.of(context).operation, + hintText: TranslationBase.of(context).operation, controller: operationController, maxLines: 20, minLines: 4, hasBorder: true, // isTextFieldHasSuffix: true, - validationError: - operationController.text.isEmpty && - isSubmitted - ? TranslationBase.of(context) - .emptyMessage - : null, + validationError: operationController.text.isEmpty && isSubmitted ? TranslationBase.of(context).emptyMessage : "", ), SizedBox( height: 4, @@ -260,248 +219,162 @@ class _UpdateOperationReportState extends State { hasBorder: true, // isTextFieldHasSuffix: true, - validationError: - inasionController.text.isEmpty && - isSubmitted - ? TranslationBase.of(context) - .emptyMessage - : null, + validationError: inasionController.text.isEmpty && isSubmitted ? TranslationBase.of(context).emptyMessage : "", ), SizedBox( height: 4, ), AppTextFieldCustom( - hintText: - TranslationBase.of(context).finding, + hintText: TranslationBase.of(context).finding, controller: findingController, maxLines: 20, minLines: 4, hasBorder: true, // isTextFieldHasSuffix: true, - validationError: - findingController.text.isEmpty && - isSubmitted - ? TranslationBase.of(context) - .emptyMessage - : null, + validationError: findingController.text.isEmpty && isSubmitted ? TranslationBase.of(context).emptyMessage : "", ), SizedBox( height: 4, ), AppTextFieldCustom( - hintText: TranslationBase.of(context) - .surgeryProcedure, + hintText: TranslationBase.of(context).surgeryProcedure, controller: surgeryProcedureController, maxLines: 20, minLines: 8, hasBorder: true, // isTextFieldHasSuffix: true, - validationError: - surgeryProcedureController - .text.isEmpty && - isSubmitted - ? TranslationBase.of(context) - .emptyMessage - : null, + validationError: surgeryProcedureController.text.isEmpty && isSubmitted ? TranslationBase.of(context).emptyMessage : "", ), SizedBox( height: 4, ), AppTextFieldCustom( - hintText: TranslationBase.of(context) - .postOperationInstruction, + hintText: TranslationBase.of(context).postOperationInstruction, controller: postOpInstructionController, maxLines: 20, minLines: 8, hasBorder: true, // isTextFieldHasSuffix: true, - validationError: - postOpInstructionController - .text.isEmpty && - isSubmitted - ? TranslationBase.of(context) - .emptyMessage - : null, + validationError: postOpInstructionController.text.isEmpty && isSubmitted ? TranslationBase.of(context).emptyMessage : "", ), SizedBox( height: 4, ), AppTextFieldCustom( - hintText: TranslationBase.of(context) - .complicationDetails1, + hintText: TranslationBase.of(context).complicationDetails1, controller: complicationDetailsController, maxLines: 20, minLines: 4, hasBorder: true, // isTextFieldHasSuffix: true, - validationError: - complicationDetailsController - .text.isEmpty && - isSubmitted - ? TranslationBase.of(context) - .emptyMessage - : null, + validationError: complicationDetailsController.text.isEmpty && isSubmitted ? TranslationBase.of(context).emptyMessage : "", ), SizedBox( height: 4, ), AppTextFieldCustom( - hintText: TranslationBase.of(context) - .bloodLossDetail, + hintText: TranslationBase.of(context).bloodLossDetail, controller: bloodLossDetailController, maxLines: 20, minLines: 4, hasBorder: true, // isTextFieldHasSuffix: true, - validationError: bloodLossDetailController - .text.isEmpty && - isSubmitted - ? TranslationBase.of(context) - .emptyMessage - : null, + validationError: bloodLossDetailController.text.isEmpty && isSubmitted ? TranslationBase.of(context).emptyMessage : "", ), SizedBox( height: 4, ), AppTextFieldCustom( - hintText: TranslationBase.of(context) - .histopathSpecimen, + hintText: TranslationBase.of(context).histopathSpecimen, controller: histopathSpecimenController, maxLines: 20, minLines: 4, hasBorder: true, // isTextFieldHasSuffix: true, - validationError: - histopathSpecimenController - .text.isEmpty && - isSubmitted - ? TranslationBase.of(context) - .emptyMessage - : null, + validationError: histopathSpecimenController.text.isEmpty && isSubmitted ? TranslationBase.of(context).emptyMessage : "", ), SizedBox( height: 4, ), AppTextFieldCustom( - hintText: TranslationBase.of(context) - .microbiologySpecimen, - controller: - microbiologySpecimenController, + hintText: TranslationBase.of(context).microbiologySpecimen, + controller: microbiologySpecimenController, maxLines: 20, minLines: 4, hasBorder: true, // isTextFieldHasSuffix: true, - validationError: - microbiologySpecimenController - .text.isEmpty && - isSubmitted - ? TranslationBase.of(context) - .emptyMessage - : null, + validationError: microbiologySpecimenController.text.isEmpty && isSubmitted ? TranslationBase.of(context).emptyMessage : "", ), SizedBox( height: 4, ), AppTextFieldCustom( - hintText: TranslationBase.of(context) - .otherSpecimen, + hintText: TranslationBase.of(context).otherSpecimen, controller: otherSpecimenController, maxLines: 20, minLines: 4, hasBorder: true, // isTextFieldHasSuffix: true, - validationError: otherSpecimenController - .text.isEmpty && - isSubmitted - ? TranslationBase.of(context) - .emptyMessage - : null, + validationError: otherSpecimenController.text.isEmpty && isSubmitted ? TranslationBase.of(context).emptyMessage : "", ), SizedBox( height: 4, ), AppTextFieldCustom( - hintText: TranslationBase.of(context) - .scrubNurse, + hintText: TranslationBase.of(context).scrubNurse, controller: scrubNurseController, maxLines: 1, minLines: 1, hasBorder: true, // isTextFieldHasSuffix: true, - validationError: - scrubNurseController.text.isEmpty && - isSubmitted - ? TranslationBase.of(context) - .emptyMessage - : null, + validationError: scrubNurseController.text.isEmpty && isSubmitted ? TranslationBase.of(context).emptyMessage : "", ), SizedBox( height: 4, ), AppTextFieldCustom( - hintText: TranslationBase.of(context) - .circulatingNurse, + hintText: TranslationBase.of(context).circulatingNurse, controller: circulatingNurseController, maxLines: 1, minLines: 1, hasBorder: true, // isTextFieldHasSuffix: true, - validationError: - circulatingNurseController - .text.isEmpty && - isSubmitted - ? TranslationBase.of(context) - .emptyMessage - : null, + validationError: circulatingNurseController.text.isEmpty && isSubmitted ? TranslationBase.of(context).emptyMessage : "", ), SizedBox( height: 4, ), AppTextFieldCustom( - hintText: TranslationBase.of(context) - .bloodTransfusedDetail, - controller: - BloodTransfusedDetailController, + hintText: TranslationBase.of(context).bloodTransfusedDetail, + controller: BloodTransfusedDetailController, maxLines: 20, minLines: 4, hasBorder: true, // isTextFieldHasSuffix: true, - validationError: - BloodTransfusedDetailController - .text.isEmpty && - isSubmitted - ? TranslationBase.of(context) - .emptyMessage - : null, + validationError: BloodTransfusedDetailController.text.isEmpty && isSubmitted ? TranslationBase.of(context).emptyMessage : "", ), SizedBox( height: 4, ), AppTextFieldCustom( - hintText: TranslationBase.of(context) - .anesthetist, + hintText: TranslationBase.of(context).anesthetist, controller: anasthetistController, maxLines: 1, minLines: 1, hasBorder: true, // isTextFieldHasSuffix: true, - validationError: - anasthetistController.text.isEmpty && - isSubmitted - ? TranslationBase.of(context) - .emptyMessage - : null, + validationError: anasthetistController.text.isEmpty && isSubmitted ? TranslationBase.of(context).emptyMessage : "", ), SizedBox( height: 250, @@ -529,11 +402,7 @@ class _UpdateOperationReportState extends State { Container( margin: EdgeInsets.all(5), child: AppButton( - title: (widget.isUpdate - ? TranslationBase.of(context).noteUpdate - : TranslationBase.of(context).noteAdd) + - " " + - TranslationBase.of(context).operationReports, + title: (widget.isUpdate! ? TranslationBase.of(context).noteUpdate : TranslationBase.of(context).noteAdd) + " " + TranslationBase.of(context).operationReports, color: AppGlobal.appGreenColor, // disabled: operationReportsController.text.isEmpty, fontWeight: FontWeight.w700, @@ -545,55 +414,33 @@ class _UpdateOperationReportState extends State { GifLoaderDialogUtils.showMyDialog(context); await model.getDoctorProfile(); - CreateUpdateOperationReportRequestModel - createUpdateOperationReportRequestModel = - CreateUpdateOperationReportRequestModel( - inasion: inasionController.text, - - /// TODO Elham* Add dynamic reservation - reservationNo: widget - .reservation.oTReservationID, - preOpDiagmosis: - preOpDiagmosisController.text, - postOpDiagmosis: - postOpDiagmosisNoteController - .text, - surgeon: surgeonController.text, - assistant: - assistantNoteController.text, - anasthetist: - assistantNoteController.text, - operation: operationController.text, - finding: findingController.text, - surgeryProcedure: - surgeonController.text, - postOpInstruction: - postOpInstructionController.text, - complicationDetails: - complicationDetailsController - .text, - bloodLossDetail: - bloodLossDetailController.text, - histopathSpecimen: - histopathSpecimenController.text, - microbiologySpecimen: - microbiologySpecimenController - .text, - otherSpecimen: - otherSpecimenController.text, - scrubNurse: surgeonController.text, - circulatingNurse: - circulatingNurseController.text, - bloodTransfusedDetail: - bloodLossDetailController.text, - patientID: widget.patient.patientId, - admissionNo: int.parse( - widget.patient.admissionNo), - createdBy: - model.doctorProfile.doctorID, - setupID: "010266"); - await model.updateOperationReport( - createUpdateOperationReportRequestModel); + CreateUpdateOperationReportRequestModel createUpdateOperationReportRequestModel = CreateUpdateOperationReportRequestModel( + inasion: inasionController.text, + + /// TODO Elham* Add dynamic reservation + reservationNo: widget.reservation!.oTReservationID, + preOpDiagmosis: preOpDiagmosisController.text, + postOpDiagmosis: postOpDiagmosisNoteController.text, + surgeon: surgeonController.text, + assistant: assistantNoteController.text, + anasthetist: assistantNoteController.text, + operation: operationController.text, + finding: findingController.text, + surgeryProcedure: surgeonController.text, + postOpInstruction: postOpInstructionController.text, + complicationDetails: complicationDetailsController.text, + bloodLossDetail: bloodLossDetailController.text, + histopathSpecimen: histopathSpecimenController.text, + microbiologySpecimen: microbiologySpecimenController.text, + otherSpecimen: otherSpecimenController.text, + scrubNurse: surgeonController.text, + circulatingNurse: circulatingNurseController.text, + bloodTransfusedDetail: bloodLossDetailController.text, + patientID: widget.patient!.patientId!, + admissionNo: int.parse(widget.patient!.admissionNo!), + createdBy: model.doctorProfile!.doctorID!, + setupID: "010266"); + await model.updateOperationReport(createUpdateOperationReportRequestModel); if (model.state == ViewState.ErrorLocal) { Utils.showErrorToast(model.error); @@ -601,8 +448,7 @@ class _UpdateOperationReportState extends State { // await model.( // operationReportsRequest.toJson()); - DrAppToastMsg.showSuccesToast( - "Your Order added Successfully"); + DrAppToastMsg.showSuccesToast("Your Order added Successfully"); } GifLoaderDialogUtils.hideDialog(context); } diff --git a/lib/screens/patients/profile/pending_orders/pending_orders_screen.dart b/lib/screens/patients/profile/pending_orders/pending_orders_screen.dart index 2dae22f5..93c8bbf7 100644 --- a/lib/screens/patients/profile/pending_orders/pending_orders_screen.dart +++ b/lib/screens/patients/profile/pending_orders/pending_orders_screen.dart @@ -10,22 +10,18 @@ import 'package:doctor_app_flutter/widgets/shared/errors/error_message.dart'; import 'package:flutter/material.dart'; class PendingOrdersScreen extends StatelessWidget { - const PendingOrdersScreen({Key key}) : super(key: key); + const PendingOrdersScreen({Key? key}) : super(key: key); @override Widget build(BuildContext context) { - final routeArgs = ModalRoute.of(context).settings.arguments as Map; + final routeArgs = ModalRoute.of(context)!.settings.arguments as Map; PatiantInformtion patient = routeArgs['patient']; patient = routeArgs['patient']; String patientType = routeArgs['patientType']; bool isInpatient = routeArgs['isInpatient']; return BaseView( - onModelReady: (model) => model.getPendingOrders( - patientId: patient.patientMRN, - admissionNo: int.parse(patient.admissionNo)), - builder: - (BuildContext context, PendingOrdersViewModel model, Widget child) => - AppScaffold( + onModelReady: (model) => model.getPendingOrders(patientId: patient.patientMRN!, admissionNo: int.parse(patient.admissionNo!)), + builder: (BuildContext context, PendingOrdersViewModel model, Widget? child) => AppScaffold( appBar: PatientProfileAppBar( patient, isInpatient: isInpatient, @@ -33,8 +29,7 @@ class PendingOrdersScreen extends StatelessWidget { isShowAppBar: true, baseViewModel: model, appBarTitle: "Pending Orders", - body: model.pendingOrdersList == null || - model.pendingOrdersList.length == 0 + body: model.pendingOrdersList == null || model.pendingOrdersList.length == 0 ? Center( child: ErrorMessage( error: TranslationBase.of(context).noDataAvailable, @@ -83,8 +78,7 @@ class PendingOrdersScreen extends StatelessWidget { children: [ Padding( padding: EdgeInsets.all(8.0), - child: AppText( - model.pendingOrdersList[index].notes), + child: AppText(model.pendingOrdersList[index].notes!), ), SizedBox( height: 20, diff --git a/lib/screens/patients/profile/pharmacy-intervention/intervention_medication.dart b/lib/screens/patients/profile/pharmacy-intervention/intervention_medication.dart index 3adc4226..6f9269ce 100644 --- a/lib/screens/patients/profile/pharmacy-intervention/intervention_medication.dart +++ b/lib/screens/patients/profile/pharmacy-intervention/intervention_medication.dart @@ -1,4 +1,5 @@ import 'package:doctor_app_flutter/core/viewModel/authentication_view_model.dart'; +import 'package:doctor_app_flutter/core/viewModel/profile/intervention_medication_view_model.dart'; import 'package:doctor_app_flutter/core/viewModel/project_view_model.dart'; import 'package:doctor_app_flutter/core/model/patient/patiant_info_model.dart'; import 'package:doctor_app_flutter/screens/base/base_view.dart'; @@ -11,29 +12,27 @@ import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart'; import 'package:doctor_app_flutter/widgets/shared/card_with_bg_widget.dart'; import 'package:doctor_app_flutter/widgets/shared/errors/error_message.dart'; import 'package:doctor_app_flutter/widgets/shared/user-guid/CusomRow.dart'; +import 'package:doctor_app_flutter/widgets/transitions/fade_page.dart'; import 'package:flutter/material.dart'; import 'package:provider/provider.dart'; -import '../../../../core/viewModel/profile/intervention_medication_view_model.dart'; -import '../../../../widgets/transitions/fade_page.dart'; import 'intervention_medication_history_screen.dart'; DrAppSharedPreferances sharedPref = new DrAppSharedPreferances(); class InterventionMedicationScreen extends StatefulWidget { - final PatiantInformtion patient; - final InterventionMedicationViewModel previousModel; - const InterventionMedicationScreen(this.patient, {Key key, this.previousModel}) : super(key: key); + final PatiantInformtion? patient; + final InterventionMedicationViewModel? previousModel; + + const InterventionMedicationScreen(this.patient, {Key? key, this.previousModel}) : super(key: key); @override - _InterventionMedicationScreenState createState() => - _InterventionMedicationScreenState(); + _InterventionMedicationScreenState createState() => _InterventionMedicationScreenState(); } -class _InterventionMedicationScreenState - extends State { +class _InterventionMedicationScreenState extends State { bool isDischargedPatient = false; - AuthenticationViewModel authenticationViewModel; - ProjectViewModel projectViewModel; + AuthenticationViewModel authenticationViewModel = AuthenticationViewModel(); + late ProjectViewModel projectViewModel; @override Widget build(BuildContext context) { @@ -42,164 +41,142 @@ class _InterventionMedicationScreenState return BaseView( onModelReady: (model) => model.getInterventionMedication( - patientId: widget.patient.patientId, - //admissionNo: int.parse(widget.patient.admissionNo), - fromDate: widget.previousModel.selectedFromDate, - toDate: widget.previousModel.selectedToDate, + patientId: widget.patient!.patientId, + //admissionNo: int.parse(widget.patient.admissionNo), + fromDate: widget.previousModel!.selectedFromDate, + toDate: widget.previousModel!.selectedToDate, ), - builder: (_, model, w) => AppScaffold( baseViewModel: model, backgroundColor: Theme.of(context).scaffoldBackgroundColor, appBar: PatientProfileAppBar( - widget.patient, + widget.patient!, isInpatient: true, ), - body: model.allInterventionList == null || - model.allInterventionList.length == 0 + body: model.allInterventionList == null || model.allInterventionList.length == 0 ? Center( child: ErrorMessage( error: TranslationBase.of(context).noDataAvailable, ), ) - : Container( - color: Colors.grey[200], - child: Column( - children: [ - Expanded( - child: Container( - child: ListView.builder( - itemCount: model.allInterventionList.length, - itemBuilder: (BuildContext ctxt, int index) { - return InkWell( - child: FractionallySizedBox( - widthFactor: 0.95, - child: CardWithBgWidget( - hasBorder: false, - bgColor: Colors.transparent, - widget: Column( - children: [ - Column( - crossAxisAlignment: - CrossAxisAlignment.start, - children: [ - SizedBox( - height: 10, - ), - Row( - mainAxisAlignment: - MainAxisAlignment - .spaceBetween, - crossAxisAlignment: - CrossAxisAlignment.start, - children: [ - Container( - width: MediaQuery.of(context) - .size - .width * - 0.60, - child: Column( - crossAxisAlignment: - CrossAxisAlignment - .start, + : Container( + color: Colors.grey[200], + child: Column( + children: [ + Expanded( + child: Container( + child: ListView.builder( + itemCount: model.allInterventionList.length, + itemBuilder: (BuildContext ctxt, int index) { + return InkWell( + child: FractionallySizedBox( + widthFactor: 0.95, + child: CardWithBgWidget( + hasBorder: false, + bgColor: Colors.transparent, + widget: Column( + children: [ + Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + SizedBox( + height: 10, + ), + Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Container( + width: MediaQuery.of(context).size.width * 0.60, + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + CustomRow( + valueSize: 14, + label: '', + value: model.allInterventionList[index].cS!, + ) + ], + ), + ), + Column( + children: [ + Row( + crossAxisAlignment: CrossAxisAlignment.start, children: [ - CustomRow( - valueSize: 14, - label: '', - value: model.allInterventionList[index].cS, - ) + AppText( + AppDateUtils.getDayMonthYearDateFormatted(AppDateUtils.convertStringToDate(model.allInterventionList[index].startDatetime!), + isArabic: projectViewModel.isArabic, isMonthShort: true), + fontWeight: FontWeight.w600, + fontSize: 14, + color: Color(0xFF2B353E), + ), ], ), - ), - Column( - children: [ - Row( - crossAxisAlignment: - CrossAxisAlignment - .start, - children: [ - AppText( - AppDateUtils.getDayMonthYearDateFormatted( - AppDateUtils.convertStringToDate(model - .allInterventionList[ - index] - .startDatetime), - isArabic: - projectViewModel - .isArabic, - isMonthShort: - true), - fontWeight: - FontWeight.w600, - fontSize: 14, - color: Color(0xFF2B353E), - ), - ], - ), - ], - ) - ], - ), - SizedBox( - height: 8, - ), - CustomRow( - labelSize: 12, - valueSize: 12, - label: TranslationBase.of(context).description, - value: model.allInterventionList[index].description, - ), - SizedBox( - height: 8, - ), - CustomRow( - labelSize: 12, - valueSize: 12, - label: TranslationBase.of(context).medication, - value: model.allInterventionList[index].medication, - ), - SizedBox( - height: 8, - ), - CustomRow( - labelSize: 12, - valueSize: 12, - label: TranslationBase.of(context).doctorComments, - value: model.allInterventionList[index].doctorComments, - ), - SizedBox( - height: 8, - ), - CustomRow( - labelSize: 12, - valueSize: 12, - label: TranslationBase.of(context).statusDescription, - value: model.allInterventionList[index].statusDescription, - ), - ], - ), - SizedBox( - height: 20, - ), - ], - ), + ], + ) + ], + ), + SizedBox( + height: 8, + ), + CustomRow( + labelSize: 12, + valueSize: 12, + label: TranslationBase.of(context).description, + value: model.allInterventionList[index].description!, + ), + SizedBox( + height: 8, + ), + CustomRow( + labelSize: 12, + valueSize: 12, + label: TranslationBase.of(context).medication, + value: model.allInterventionList[index].medication!, + ), + SizedBox( + height: 8, + ), + CustomRow( + labelSize: 12, + valueSize: 12, + label: TranslationBase.of(context).doctorComments, + value: model.allInterventionList[index].doctorComments!, + ), + SizedBox( + height: 8, + ), + CustomRow( + labelSize: 12, + valueSize: 12, + label: TranslationBase.of(context).statusDescription, + value: model.allInterventionList[index].statusDescription!, + ), + ], + ), + SizedBox( + height: 20, + ), + ], ), ), - onTap: () { - Navigator.push( - context, - FadePage( - page: InterventionMedicationHistoryScreen(widget.patient, model.allInterventionList[index]), - ), - ); - }, - ); - }), - ), + ), + onTap: () { + Navigator.push( + context, + FadePage( + page: InterventionMedicationHistoryScreen(widget.patient!, model.allInterventionList[index]), + ), + ); + }, + ); + }), ), - ], - ), + ), + ], ), + ), ), ); } diff --git a/lib/screens/patients/profile/pharmacy-intervention/intervention_medication_history_screen.dart b/lib/screens/patients/profile/pharmacy-intervention/intervention_medication_history_screen.dart index 3a1e4138..d8a976bb 100644 --- a/lib/screens/patients/profile/pharmacy-intervention/intervention_medication_history_screen.dart +++ b/lib/screens/patients/profile/pharmacy-intervention/intervention_medication_history_screen.dart @@ -27,7 +27,7 @@ DrAppSharedPreferances sharedPref = new DrAppSharedPreferances(); class InterventionMedicationHistoryScreen extends StatefulWidget { final PatiantInformtion patient; final InterventionMedicationResModel interventionMedication; - const InterventionMedicationHistoryScreen(this.patient, this.interventionMedication, {Key key}) : super(key: key); + const InterventionMedicationHistoryScreen(this.patient, this.interventionMedication, {Key? key}) : super(key: key); @override _InterventionMedicationHistoryScreenState createState() => _InterventionMedicationHistoryScreenState(); @@ -35,8 +35,8 @@ class InterventionMedicationHistoryScreen extends StatefulWidget { class _InterventionMedicationHistoryScreenState extends State { bool isDischargedPatient = false; - AuthenticationViewModel authenticationViewModel; - ProjectViewModel projectViewModel; + AuthenticationViewModel authenticationViewModel = AuthenticationViewModel(); + late ProjectViewModel projectViewModel; @override Widget build(BuildContext context) { @@ -107,7 +107,7 @@ class _InterventionMedicationHistoryScreenState extends State - _PharmacyInterventionScreenState(); + _PharmacyInterventionScreenState createState() => _PharmacyInterventionScreenState(); } -class _PharmacyInterventionScreenState - extends State { +class _PharmacyInterventionScreenState extends State { @override void initState() { // TODO: implement initState @@ -37,7 +35,7 @@ class _PharmacyInterventionScreenState @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']; return BaseView( builder: (_, model, w) => AppScaffold( @@ -52,10 +50,7 @@ class _PharmacyInterventionScreenState crossAxisAlignment: CrossAxisAlignment.start, children: [ BottomSheetTitle( - title: (OutPatientFilterType.Previous == - widget.outPatientFilterType) - ? "" - : TranslationBase.of(context).pharmacyIntervention, + title: (OutPatientFilterType.Previous == widget.outPatientFilterType) ? "" : TranslationBase.of(context).pharmacyIntervention, ), SizedBox( height: 10.0, @@ -71,24 +66,13 @@ class _PharmacyInterventionScreenState onTap: () => selectDate( context, model, - firstDate: DateTime( - DateTime.now().year - 20, - DateTime.now().month, - DateTime.now().day), - lastDate: DateTime( - DateTime.now().year, - DateTime.now().month, - DateTime.now().day + 100), - selectedDate: model.selectedFromDate != null - ? model.selectedFromDate - : DateTime.now(), + firstDate: DateTime(DateTime.now().year - 20, DateTime.now().month, DateTime.now().day), + lastDate: DateTime(DateTime.now().year, DateTime.now().month, DateTime.now().day + 100), + selectedDate: model.selectedFromDate != null ? model.selectedFromDate : DateTime.now(), ), child: TextField( decoration: textFieldSelectorDecoration( - TranslationBase.of(context).fromDate, - "${AppDateUtils.convertStringToDateFormat(model.selectedFromDate.toString(), "yyyy-MM-dd")}" - , - true, + TranslationBase.of(context).fromDate, "${AppDateUtils.convertStringToDateFormat(model.selectedFromDate.toString(), "yyyy-MM-dd")}", true, suffixIcon: Icon( Icons.calendar_today, color: Colors.black, @@ -107,24 +91,13 @@ class _PharmacyInterventionScreenState context, model, isFromDate: false, - firstDate: DateTime( - DateTime.now().year - 20, - DateTime.now().month, - DateTime.now().day), - lastDate: DateTime( - DateTime.now().year, - DateTime.now().month, - DateTime.now().day + 100), - selectedDate: model.selectedToDate != null - ? model.selectedToDate - : DateTime.now().add(Duration(days: 1)), + firstDate: DateTime(DateTime.now().year - 20, DateTime.now().month, DateTime.now().day), + lastDate: DateTime(DateTime.now().year, DateTime.now().month, DateTime.now().day + 100), + selectedDate: model.selectedToDate != null ? model.selectedToDate : DateTime.now().add(Duration(days: 1)), ), child: TextField( decoration: textFieldSelectorDecoration( - TranslationBase.of(context).toDate, - "${AppDateUtils.convertStringToDateFormat(model.selectedToDate.toString(), "yyyy-MM-dd")}" - , - true, + TranslationBase.of(context).toDate, "${AppDateUtils.convertStringToDateFormat(model.selectedToDate.toString(), "yyyy-MM-dd")}", true, suffixIcon: Icon( Icons.calendar_today, color: Colors.black, @@ -169,8 +142,7 @@ class _PharmacyInterventionScreenState Navigator.push( context, MaterialPageRoute( - builder: (context) => - InterventionMedicationScreen( + builder: (context) => InterventionMedicationScreen( patient, previousModel: model, )), @@ -188,16 +160,12 @@ class _PharmacyInterventionScreenState ))); } - selectDate(BuildContext context, InterventionMedicationViewModel model, - {bool isFromDate = true, - DateTime firstDate, - lastDate, - selectedDate}) async { + selectDate(BuildContext context, InterventionMedicationViewModel model, {bool isFromDate = true, DateTime? firstDate, lastDate, selectedDate}) async { Utils.hideKeyboard(context); - final DateTime picked = await showDatePicker( + final DateTime? picked = await showDatePicker( context: context, initialDate: selectedDate, - firstDate: firstDate, + firstDate: firstDate!, lastDate: lastDate, initialEntryMode: DatePickerEntryMode.calendar, ); @@ -219,9 +187,7 @@ class _PharmacyInterventionScreenState } } - 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/profile/prescriptions/in_patient_prescription_details_screen.dart b/lib/screens/patients/profile/prescriptions/in_patient_prescription_details_screen.dart index 20571c55..8f83d031 100644 --- a/lib/screens/patients/profile/prescriptions/in_patient_prescription_details_screen.dart +++ b/lib/screens/patients/profile/prescriptions/in_patient_prescription_details_screen.dart @@ -17,10 +17,10 @@ class InpatientPrescriptionDetailsScreen extends StatefulWidget { class _InpatientPrescriptionDetailsScreenState extends State { bool _showDetails = false; - String error; - TextEditingController answerController; + String? error; + TextEditingController answerController = TextEditingController(); bool _isInit = true; - PrescriptionReportForInPatient prescription; + PrescriptionReportForInPatient prescription = PrescriptionReportForInPatient(); @override void initState() { @@ -31,7 +31,7 @@ class _InpatientPrescriptionDetailsScreenState void didChangeDependencies() { super.didChangeDependencies(); if (_isInit) { - final routeArgs = ModalRoute.of(context).settings.arguments as Map; + final routeArgs = ModalRoute.of(context)!.settings.arguments as Map; prescription = routeArgs['prescription']; } _isInit = false; @@ -49,8 +49,8 @@ class _InpatientPrescriptionDetailsScreenState mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ AppText( - prescription.itemDescription, - fontSize: 2.5 * SizeConfig.textMultiplier, + prescription.itemDescription!, + fontSize: 2.5 * SizeConfig.textMultiplier!, fontWeight: FontWeight.bold, ), InkWell( @@ -96,11 +96,11 @@ class _InpatientPrescriptionDetailsScreenState key: 'UOM'), buildTableRow( des: - '${AppDateUtils.getDate(prescription.startDatetime)}', + '${AppDateUtils.getDate(prescription.startDatetime!)}', key: 'Start Date'), buildTableRow( des: - '${AppDateUtils.getDate(prescription.stopDatetime)}', + '${AppDateUtils.getDate(prescription.stopDatetime!)}', key: 'Stop Date'), buildTableRow( des: '${prescription.noOfDoses}', @@ -115,7 +115,7 @@ class _InpatientPrescriptionDetailsScreenState key: 'Pharmacy Remarks'), buildTableRow( des: - '${AppDateUtils.getDate(prescription.prescriptionDatetime)}', + '${AppDateUtils.getDate(prescription.prescriptionDatetime!)}', key: 'Prescription Date'), buildTableRow( des: '${prescription.refillID}', @@ -160,7 +160,7 @@ class _InpatientPrescriptionDetailsScreenState child: Container( child: AppText( key, - fontSize: 1.7 * SizeConfig.textMultiplier, + fontSize: 1.7 * SizeConfig.textMultiplier!, fontWeight: FontWeight.bold, textAlign: TextAlign.start, ), @@ -176,7 +176,7 @@ class _InpatientPrescriptionDetailsScreenState children: [ AppText( '${des}', - fontSize: 1.7 * SizeConfig.textMultiplier, + fontSize: 1.7 * SizeConfig.textMultiplier!, fontWeight: FontWeight.w300, textAlign: TextAlign.center, ) diff --git a/lib/screens/patients/profile/prescriptions/out_patient_prescription_details_item.dart b/lib/screens/patients/profile/prescriptions/out_patient_prescription_details_item.dart index c6f96dde..ba4f0bff 100644 --- a/lib/screens/patients/profile/prescriptions/out_patient_prescription_details_item.dart +++ b/lib/screens/patients/profile/prescriptions/out_patient_prescription_details_item.dart @@ -7,7 +7,7 @@ import 'package:flutter/material.dart'; class OutPatientPrescriptionDetailsItem extends StatefulWidget { final PrescriptionReport prescriptionReport; - OutPatientPrescriptionDetailsItem({Key key, this.prescriptionReport}); + OutPatientPrescriptionDetailsItem({Key? key, required this.prescriptionReport}); @override _OutPatientPrescriptionDetailsItemState createState() => @@ -30,7 +30,7 @@ class _OutPatientPrescriptionDetailsItemState flex: 5, child: AppText( '${widget.prescriptionReport.itemDescription} ', - fontSize: 2.5 * SizeConfig.textMultiplier, + fontSize: 2.5 * SizeConfig.textMultiplier!, fontWeight: FontWeight.bold, ), ), @@ -106,7 +106,7 @@ class _OutPatientPrescriptionDetailsItemState child: Container( child: AppText( key, - fontSize: 1.7 * SizeConfig.textMultiplier, + fontSize: 1.7 * SizeConfig.textMultiplier!, fontWeight: FontWeight.bold, textAlign: TextAlign.start, ), @@ -122,7 +122,7 @@ class _OutPatientPrescriptionDetailsItemState children: [ AppText( '${des}', - fontSize: 1.7 * SizeConfig.textMultiplier, + fontSize: 1.7 * SizeConfig.textMultiplier!, fontWeight: FontWeight.w300, textAlign: TextAlign.center, ) diff --git a/lib/screens/patients/profile/profile_screen/patient_profile_card_model.dart b/lib/screens/patients/profile/profile_screen/patient_profile_card_model.dart index e4351d91..8e0cc6d6 100644 --- a/lib/screens/patients/profile/profile_screen/patient_profile_card_model.dart +++ b/lib/screens/patients/profile/profile_screen/patient_profile_card_model.dart @@ -8,12 +8,12 @@ class PatientProfileCardModel { final bool isInPatient; final bool isDisable; final bool isLoading; - final Function onTap; + final Function? onTap; final bool isDischargedPatient; final bool isSelectInpatient; final bool isDartIcon; - final IconData dartIcon; - final Color color; + final IconData? dartIcon; + final Color? color; PatientProfileCardModel( this.nameLine1, 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 b1297892..b447130b 100644 --- a/lib/screens/patients/profile/profile_screen/patient_profile_screen.dart +++ b/lib/screens/patients/profile/profile_screen/patient_profile_screen.dart @@ -9,6 +9,8 @@ import 'package:doctor_app_flutter/core/viewModel/SOAP_view_model.dart'; import 'package:doctor_app_flutter/core/model/SOAP/post_episode_req_model.dart'; import 'package:doctor_app_flutter/core/model/SOAP/in_patient/post_episode_for_Inpatient_request_model.dart'; import 'package:doctor_app_flutter/core/model/patient/patiant_info_model.dart'; +import 'package:doctor_app_flutter/locator.dart'; +import 'package:doctor_app_flutter/routes.dart'; import 'package:doctor_app_flutter/screens/base/base_view.dart'; import 'package:doctor_app_flutter/screens/live_care/end_call_screen.dart'; import 'package:doctor_app_flutter/screens/patients/profile/profile_screen/profile_gird_for_InPatient.dart'; @@ -26,17 +28,13 @@ import 'package:flutter_svg/svg.dart'; import 'package:hexcolor/hexcolor.dart'; import 'package:quiver/async.dart'; -import '../../../../locator.dart'; -import '../../../../routes.dart'; - class PatientProfileScreen extends StatefulWidget { @override _PatientProfileScreenState createState() => _PatientProfileScreenState(); } -class _PatientProfileScreenState extends State - with SingleTickerProviderStateMixin { - PatiantInformtion patient; +class _PatientProfileScreenState extends State with SingleTickerProviderStateMixin { + PatiantInformtion patient = PatiantInformtion(); LiveCarePatientViewModel _liveCareViewModel = LiveCarePatientViewModel(); bool isFromSearch = false; @@ -48,16 +46,16 @@ class _PatientProfileScreenState extends State bool isDischargedPatient = false; bool isSearchAndOut = false; bool isCallStarted = false; - String patientType; - String arrivalType; - String from; - String to; - TabController _tabController; + String? patientType; + String? arrivalType; + String? from; + String? to; + TabController? _tabController; int index = 0; int _activeTab = 0; - StreamController videoCallDurationStreamController; - Stream videoCallDurationStream = (() async* {})(); + late StreamController videoCallDurationStreamController; + late Stream videoCallDurationStream; @override void initState() { @@ -69,17 +67,17 @@ class _PatientProfileScreenState extends State @override void dispose() { - _tabController.dispose(); + _tabController!.dispose(); super.dispose(); if (isFromLiveCare) { - _liveCareViewModel.removePatientFromDoctorList(patient.vcId); + _liveCareViewModel.removePatientFromDoctorList(patient.vcId!); } } @override void didChangeDependencies() { super.didChangeDependencies(); - final routeArgs = ModalRoute.of(context).settings.arguments as Map; + final routeArgs = ModalRoute.of(context)!.settings.arguments as Map; patient = routeArgs['patient']; patientType = routeArgs['patientType']; arrivalType = routeArgs['arrivalType']; @@ -112,23 +110,22 @@ class _PatientProfileScreenState extends State _activeTab = 1; } - StreamSubscription callTimer; + late StreamSubscription callTimer; callConnected() { - callTimer = - CountdownTimer(Duration(minutes: 90), Duration(seconds: 1)).listen(null) - ..onDone(() { - callTimer.cancel(); - }) - ..onData((data) { - var t = Utils.timeFrom(duration: data.elapsed); - videoCallDurationStreamController.sink.add(t); - }); + callTimer = CountdownTimer(Duration(minutes: 90), Duration(seconds: 1)).listen(null) + ..onDone(() { + callTimer.cancel(); + }) + ..onData((data) { + var t = Utils.timeFrom(duration: data.elapsed); + videoCallDurationStreamController.sink.add(t); + }); } callDisconnected() { callTimer.cancel(); - videoCallDurationStreamController.sink.add(null); + videoCallDurationStreamController.sink.add(""); setState(() { isCallStarted = false; @@ -140,8 +137,7 @@ class _PatientProfileScreenState extends State final screenSize = MediaQuery.of(context).size; return BaseView( onModelReady: (model) async { - if (isFromLiveCare && patient.patientStatus == 1) - await model.addPatientToDoctorList(patient.vcId); + if (isFromLiveCare && patient.patientStatus == 1) await model.addPatientToDoctorList(patient.vcId!); }, builder: (_, model, w) => AppScaffold( baseViewModel: model, @@ -154,13 +150,11 @@ class _PatientProfileScreenState extends State children: [ Column( children: [ - PatientProfileHeaderNewDesignAppBar( - patient, arrivalType ?? '0', patientType, + PatientProfileHeaderNewDesignAppBar(patient, arrivalType ?? '0', patientType!, videoCallDurationStream: videoCallDurationStream, isInpatient: isInpatient, isFromLiveCare: isFromLiveCare, - height: (patient.patientStatusType != null && - patient.patientStatusType == 43) + height: (patient.patientStatusType != null && patient.patientStatusType == 43) ? 210 : isDischargedPatient ? 240 @@ -178,32 +172,31 @@ class _PatientProfileScreenState extends State child: isSearchAndOut ? ProfileGridForSearch( patient: patient, - patientType: patientType, - arrivalType: arrivalType, + patientType: patientType!, + arrivalType: arrivalType!, isInpatient: isInpatient, - from: from, - to: to, + from: from!, + to: to!, ) : isInpatient ? ProfileGridForInPatient( patient: patient, - patientType: patientType, - arrivalType: arrivalType, + patientType: patientType!, + arrivalType: arrivalType!, isInpatient: isInpatient, - from: from, - to: to, - isDischargedPatient: - isDischargedPatient, + from: from!, + to: to!, + isDischargedPatient: isDischargedPatient, isFromSearch: isFromSearch, ) : ProfileGridForOther( patient: patient, - patientType: patientType, - arrivalType: arrivalType, + patientType: patientType!, + arrivalType: arrivalType!, isInpatient: isInpatient, isFromLiveCare: isFromLiveCare, - from: from, - to: to, + from: from!, + to: to!, ), ), SizedBox( @@ -218,8 +211,7 @@ class _PatientProfileScreenState extends State ? true : isFromLiveCare ? patient.episodeNo != null - : patient.patientStatusType != null && - patient.patientStatusType == 43) + : patient.patientStatusType != null && patient.patientStatusType == 43) BaseView( onModelReady: (model) async { model.getDoctorProfile(); @@ -237,10 +229,8 @@ class _PatientProfileScreenState extends State if (patient.episodeNo == 0) AppButton( loading: model.state == ViewState.BusyLocal, - disabled: - model.state == ViewState.BusyLocal, - title: - "${TranslationBase.of(context).createNew}\n${TranslationBase.of(context).episode}", + disabled: model.state == ViewState.BusyLocal, + title: "${TranslationBase.of(context).createNew}\n${TranslationBase.of(context).episode}", color: isFromLiveCare || isInpatient ? AppGlobal.appRedColor : patient.patientStatusType == 43 @@ -248,8 +238,7 @@ class _PatientProfileScreenState extends State : AppGlobal.appRedColor, fontColor: Colors.white, // vPadding: 8, - height: SizeConfig.heightMultiplier! * - (SizeConfig.isHeightVeryShort ? 9 : 6), + height: SizeConfig.heightMultiplier! * (SizeConfig.isHeightVeryShort ? 9 : 6), radius: 30, hPadding: 25, fontWeight: FontWeight.normal, @@ -260,34 +249,24 @@ class _PatientProfileScreenState extends State height: 30, ), onPressed: () async { - if ((isFromLiveCare && - patient.appointmentNo != null) || - patient.patientStatusType == 43 || - isInpatient) { - createEpisode( - patient: patient, model: model); + if ((isFromLiveCare && patient.appointmentNo != null) || patient.patientStatusType == 43 || isInpatient) { + createEpisode(patient: patient, model: model); } }, ), if (patient.episodeNo != 0) AppButton( - loading: - model.state == ViewState.BusyLocal, - disabled: - model.state == ViewState.BusyLocal, - title: - "${TranslationBase.of(context).update}\n${TranslationBase.of(context).episode}", - color: ((isInpatient) || - isFromLiveCare) && - model.state != ViewState.BusyLocal + loading: model.state == ViewState.BusyLocal, + disabled: model.state == ViewState.BusyLocal, + title: "${TranslationBase.of(context).update}\n${TranslationBase.of(context).episode}", + color: ((isInpatient) || isFromLiveCare) && model.state != ViewState.BusyLocal ? AppGlobal.appRedColor : patient.patientStatusType == 43 - ?AppGlobal.appRedColor + ? AppGlobal.appRedColor : AppGlobal.appRedColor, fontColor: Colors.white, // vPadding: 8, - height: SizeConfig.heightMultiplier! * - (SizeConfig.isHeightVeryShort ? 9 : 6), + height: SizeConfig.heightMultiplier! * (SizeConfig.isHeightVeryShort ? 9 : 6), radius: 30, hPadding: 25, fontWeight: FontWeight.normal, @@ -298,19 +277,12 @@ class _PatientProfileScreenState extends State height: 30, ), onPressed: () async { - await locator() - .logEvent( + await locator().logEvent( eventCategory: "Patient Profile ", eventAction: "Update Episode", ); - if ((isFromLiveCare && - patient.appointmentNo != null && - patient.appointmentNo != 0) || - patient.patientStatusType == 43 || - isInpatient) { - Navigator.of(context).pushNamed( - UPDATE_EPISODE, - arguments: {'patient': patient}); + if ((isFromLiveCare && patient.appointmentNo != null && patient.appointmentNo != 0) || patient.patientStatusType == 43 || isInpatient) { + Navigator.of(context).pushNamed(UPDATE_EPISODE, arguments: {'patient': patient}); } }), ], @@ -342,14 +314,9 @@ class _PatientProfileScreenState extends State child: Center( child: AppButton( fontWeight: FontWeight.w700, - color: isCallFinished - ? Colors.red[600] - : AppGlobal.appGreenColor, - title: isCallFinished - ? TranslationBase.of(context).endCall - : TranslationBase.of(context).initiateCall, - disabled: isCallStarted || - model.state == ViewState.BusyLocal, + color: isCallFinished ? Colors.red[600]! : AppGlobal.appGreenColor, + title: isCallFinished ? TranslationBase.of(context).endCall : TranslationBase.of(context).initiateCall, + disabled: isCallStarted || model.state == ViewState.BusyLocal, onPressed: () async { // TODO MOSA TEST // AppPermissionsUtils @@ -367,50 +334,32 @@ class _PatientProfileScreenState extends State Navigator.push( context, MaterialPageRoute( - builder: (BuildContext context) => - EndCallScreen(patient: patient), - settings: - RouteSettings(name: 'EndCallScreen'), + builder: (BuildContext context) => EndCallScreen(patient: patient), + settings: RouteSettings(name: 'EndCallScreen'), ), ); } else { GifLoaderDialogUtils.showMyDialog(context); - await model.startCall( - isReCall: false, vCID: patient.vcId); + await model.startCall(isReCall: false, vCID: patient.vcId!); if (model.state == ViewState.ErrorLocal) { GifLoaderDialogUtils.hideDialog(context); Utils.showErrorToast(model.error); } else { await model.getDoctorProfile(); - patient.appointmentNo = int.parse(model - .startCallRes.appointmentNo - .toString()); + patient.appointmentNo = int.parse(model.startCallRes.appointmentNo.toString()); patient.episodeNo = 0; - model.updateInCallPatient( - patient: patient, - appointmentNo: int.parse(model - .startCallRes.appointmentNo - .toString())); + model.updateInCallPatient(patient: patient, appointmentNo: int.parse(model.startCallRes.appointmentNo.toString())); setState(() { isCallStarted = true; }); GifLoaderDialogUtils.hideDialog(context); - AppPermissionsUtils - .requestVideoCallPermission( - context: context, - onTapGrant: () { - locator() - .openVideo( - model.startCallRes, - patient, - model.startCallRes != null - ? model.startCallRes - .isRecording - : true, - callConnected, - callDisconnected); - }); + AppPermissionsUtils.requestVideoCallPermission( + context: context, + onTapGrant: () { + locator() + .openVideo(model.startCallRes, patient, model.startCallRes != null ? model.startCallRes.isRecording! : true, callConnected, callDisconnected); + }); } } }, @@ -424,29 +373,24 @@ class _PatientProfileScreenState extends State ], ), ) - : null, + : SizedBox(), ), ); } - createEpisode({PatiantInformtion patient, SOAPViewModel model}) async { + createEpisode({PatiantInformtion? patient, SOAPViewModel? model}) async { await locator().logEvent( eventCategory: "Patient Profile", eventAction: "Create Episode", ); GifLoaderDialogUtils.showMyDialog(context); - if (patient.admissionNo != null && patient.admissionNo.isNotEmpty) { - PostEpisodeForInpatientRequestModel postEpisodeReqModel = - PostEpisodeForInpatientRequestModel( - admissionNo: int.parse(patient.admissionNo), - patientID: patient.patientId); - await model.postEpisodeForInPatient(postEpisodeReqModel); + if (patient!.admissionNo != null && patient.admissionNo!.isNotEmpty) { + PostEpisodeForInpatientRequestModel postEpisodeReqModel = PostEpisodeForInpatientRequestModel(admissionNo: int.parse(patient.admissionNo!), patientID: patient.patientId); + await model!.postEpisodeForInPatient(postEpisodeReqModel); } else { - PostEpisodeReqModel postEpisodeReqModel = PostEpisodeReqModel( - appointmentNo: int.parse(patient.appointmentNo.toString()), - patientMRN: patient.patientMRN); + PostEpisodeReqModel postEpisodeReqModel = PostEpisodeReqModel(appointmentNo: int.parse(patient.appointmentNo.toString()), patientMRN: patient.patientMRN); - await model.postEpisode(postEpisodeReqModel); + await model!.postEpisode(postEpisodeReqModel); } GifLoaderDialogUtils.hideDialog(context); @@ -454,8 +398,7 @@ class _PatientProfileScreenState extends State Utils.showErrorToast(model.error); } else { patient.episodeNo = model.episodeID; - Navigator.of(context) - .pushNamed(CREATE_EPISODE, arguments: {'patient': patient}); + Navigator.of(context).pushNamed(CREATE_EPISODE, arguments: {'patient': patient}); } } } @@ -469,12 +412,7 @@ class AvatarWidget extends StatelessWidget { Widget build(BuildContext context) { return Container( decoration: BoxDecoration( - boxShadow: [ - BoxShadow( - color: Color.fromRGBO(0, 0, 0, 0.08), - offset: Offset(0.0, 5.0), - blurRadius: 16.0) - ], + boxShadow: [BoxShadow(color: Color.fromRGBO(0, 0, 0, 0.08), offset: Offset(0.0, 5.0), blurRadius: 16.0)], borderRadius: BorderRadius.all(Radius.circular(35.0)), color: Color(0xffCCCCCC), ), diff --git a/lib/screens/patients/profile/profile_screen/profile_gird_for_InPatient.dart b/lib/screens/patients/profile/profile_screen/profile_gird_for_InPatient.dart index 6a50a897..4032265b 100644 --- a/lib/screens/patients/profile/profile_screen/profile_gird_for_InPatient.dart +++ b/lib/screens/patients/profile/profile_screen/profile_gird_for_InPatient.dart @@ -8,102 +8,44 @@ import '../../../../routes.dart'; // ignore: must_be_immutable class ProfileGridForInPatient extends StatelessWidget { - final PatiantInformtion patient; - final String patientType; - final String arrivalType; - final double height; + final PatiantInformtion? patient; + final String? patientType; + final String? arrivalType; + final double? height; final bool isInpatient; final bool isDischargedPatient; final bool isFromSearch; - String from; - String to; + String? from; + String? to; ProfileGridForInPatient( - {Key key, - this.patient, - this.patientType, - this.arrivalType, - this.height, - this.isInpatient, - this.from, - this.to, - this.isDischargedPatient, - this.isFromSearch}) + {Key? key, this.patient, this.patientType, this.arrivalType, this.height, this.isInpatient = false, this.from, this.to, this.isDischargedPatient = false, this.isFromSearch = false}) : super(key: key); @override Widget build(BuildContext context) { final List cardsList = [ - PatientProfileCardModel( - TranslationBase.of(context).vital, - TranslationBase.of(context).signs, - VITAL_SIGN_DETAILS, - 'assets/images/svgs/profile_screen/vital signs.svg', - isInPatient: isInpatient), - PatientProfileCardModel( - TranslationBase.of(context).lab, - TranslationBase.of(context).result, - LAB_RESULT, - 'assets/images/svgs/profile_screen/lab results.svg', - isInPatient: isInpatient), - PatientProfileCardModel( - TranslationBase.of(context).lab, - TranslationBase.of(context).special, - ALL_SPECIAL_LAB_RESULT, - 'assets/images/svgs/profile_screen/lab results.svg', + PatientProfileCardModel(TranslationBase.of(context).vital, TranslationBase.of(context).signs, VITAL_SIGN_DETAILS, 'assets/images/svgs/profile_screen/vital signs.svg', isInPatient: isInpatient), + PatientProfileCardModel(TranslationBase.of(context).lab, TranslationBase.of(context).result, LAB_RESULT, 'assets/images/svgs/profile_screen/lab results.svg', isInPatient: isInpatient), + PatientProfileCardModel(TranslationBase.of(context).lab, TranslationBase.of(context).special, ALL_SPECIAL_LAB_RESULT, 'assets/images/svgs/profile_screen/lab results.svg', isInPatient: isInpatient), - PatientProfileCardModel( - TranslationBase.of(context).radiology, - TranslationBase.of(context).result, - RADIOLOGY_PATIENT, - 'assets/images/svgs/profile_screen/Radiology.svg', + PatientProfileCardModel(TranslationBase.of(context).radiology, TranslationBase.of(context).result, RADIOLOGY_PATIENT, 'assets/images/svgs/profile_screen/Radiology.svg', isInPatient: isInpatient), - PatientProfileCardModel( - TranslationBase.of(context).patient, - TranslationBase.of(context).prescription + ' (${TranslationBase.of(context).old})', - ORDER_PRESCRIPTION_OLD, + PatientProfileCardModel(TranslationBase.of(context).patient, TranslationBase.of(context).prescription + ' (${TranslationBase.of(context).old})', ORDER_PRESCRIPTION_OLD, 'assets/images/svgs/profile_screen/order prescription.svg', isInPatient: isInpatient), - PatientProfileCardModel( - TranslationBase.of(context).patient, - TranslationBase.of(context).prescription, - ORDER_PRESCRIPTION_NEW, - 'assets/images/svgs/profile_screen/order prescription.svg', + PatientProfileCardModel(TranslationBase.of(context).patient, TranslationBase.of(context).prescription, ORDER_PRESCRIPTION_NEW, 'assets/images/svgs/profile_screen/order prescription.svg', isInPatient: isInpatient), - - PatientProfileCardModel( - TranslationBase.of(context).progress, - TranslationBase.of(context).note, - PROGRESS_NOTE, - 'assets/images/svgs/profile_screen/Progress notes.svg', - isInPatient: isInpatient, - isDischargedPatient: isDischargedPatient), - PatientProfileCardModel( - TranslationBase.of(context).order, - TranslationBase.of(context).sheet, - ORDER_NOTE, - 'assets/images/svgs/profile_screen/order sheets.svg', - isInPatient: isInpatient, - isDischargedPatient: isDischargedPatient), - PatientProfileCardModel( - TranslationBase.of(context).orders, - TranslationBase.of(context).procedures, - ORDER_PROCEDURE, - 'assets/images/svgs/profile_screen/Order Procedures.svg', + PatientProfileCardModel(TranslationBase.of(context).progress, TranslationBase.of(context).note, PROGRESS_NOTE, 'assets/images/svgs/profile_screen/Progress notes.svg', + isInPatient: isInpatient, isDischargedPatient: isDischargedPatient), + PatientProfileCardModel(TranslationBase.of(context).order, TranslationBase.of(context).sheet, ORDER_NOTE, 'assets/images/svgs/profile_screen/order sheets.svg', + isInPatient: isInpatient, isDischargedPatient: isDischargedPatient), + PatientProfileCardModel(TranslationBase.of(context).orders, TranslationBase.of(context).procedures, ORDER_PROCEDURE, 'assets/images/svgs/profile_screen/Order Procedures.svg', isInPatient: isInpatient), - PatientProfileCardModel( - TranslationBase.of(context).health, - TranslationBase.of(context).summary, - HEALTH_SUMMARY, - 'assets/images/svgs/profile_screen/health summary.svg', + PatientProfileCardModel(TranslationBase.of(context).health, TranslationBase.of(context).summary, HEALTH_SUMMARY, 'assets/images/svgs/profile_screen/health summary.svg', isInPatient: isInpatient), - PatientProfileCardModel( - TranslationBase.of(context).medical, - TranslationBase.of(context).report, - PATIENT_MEDICAL_REPORT, - 'assets/images/svgs/profile_screen/medical report.svg', - isInPatient: isInpatient, - isDisable: false), + PatientProfileCardModel(TranslationBase.of(context).medical, TranslationBase.of(context).report, PATIENT_MEDICAL_REPORT, 'assets/images/svgs/profile_screen/medical report.svg', + isInPatient: isInpatient, isDisable: false), PatientProfileCardModel( TranslationBase.of(context).referral, TranslationBase.of(context).patient, @@ -112,11 +54,7 @@ class ProfileGridForInPatient extends StatelessWidget { isInPatient: isInpatient, isDisable: isDischargedPatient || isFromSearch, ), - PatientProfileCardModel( - TranslationBase.of(context).insurance, - TranslationBase.of(context).approvals, - PATIENT_INSURANCE_APPROVALS_NEW, - 'assets/images/svgs/profile_screen/insurance approval.svg', + PatientProfileCardModel(TranslationBase.of(context).insurance, TranslationBase.of(context).approvals, PATIENT_INSURANCE_APPROVALS_NEW, 'assets/images/svgs/profile_screen/insurance approval.svg', isInPatient: isInpatient), PatientProfileCardModel( TranslationBase.of(context).discharge, @@ -205,11 +143,11 @@ class ProfileGridForInPatient extends StatelessWidget { //change the number as you want children: cardsList.map((item) { return PatientProfileButton( - patient: patient, - patientType: patientType, - arrivalType: arrivalType, - from: from, - to: to, + patient: patient!, + patientType: patientType!, + arrivalType: arrivalType!, + from: from!, + to: to!, nameLine1: item.nameLine1, nameLine2: item.nameLine2, route: item.route, @@ -217,7 +155,7 @@ class ProfileGridForInPatient extends StatelessWidget { isInPatient: item.isInPatient, isDischargedPatient: item.isDischargedPatient, isDisable: item.isDisable, - onTap: item.onTap, + onTap: item.onTap!, isLoading: item.isLoading, ); }).toList(), diff --git a/lib/screens/patients/profile/profile_screen/profile_gird_for_other.dart b/lib/screens/patients/profile/profile_screen/profile_gird_for_other.dart index 1084f7f2..60ed4f29 100644 --- a/lib/screens/patients/profile/profile_screen/profile_gird_for_other.dart +++ b/lib/screens/patients/profile/profile_screen/profile_gird_for_other.dart @@ -1,137 +1,61 @@ import 'package:doctor_app_flutter/core/model/patient/patiant_info_model.dart'; +import 'package:doctor_app_flutter/routes.dart'; import 'package:doctor_app_flutter/screens/patients/profile/profile_screen/patient_profile_card_model.dart'; import 'package:doctor_app_flutter/utils/translations_delegate_base_utils.dart'; import 'package:doctor_app_flutter/widgets/patients/profile/PatientProfileButton.dart'; import 'package:flutter/material.dart'; -import '../../../../routes.dart'; - // ignore: must_be_immutable class ProfileGridForOther extends StatelessWidget { - final PatiantInformtion patient; - final String patientType; - final String arrivalType; - final double height; + final PatiantInformtion? patient; + final String? patientType; + final String? arrivalType; + final double? height; final bool isInpatient; final bool isFromLiveCare; - String from; - String to; + String? from; + String? to; - ProfileGridForOther( - {Key key, - this.patient, - this.patientType, - this.arrivalType, - this.height, - this.isInpatient, - this.from, - this.to, - this.isFromLiveCare}) - : super(key: key); + ProfileGridForOther({Key? key, this.patient, this.patientType, this.arrivalType, this.height , this.isInpatient = false, this.from, this.to, this.isFromLiveCare = false}) : super(key: key); @override Widget build(BuildContext context) { final List cardsList = [ - PatientProfileCardModel( - TranslationBase.of(context).vital, - TranslationBase.of(context).signs, - VITAL_SIGN_DETAILS, - 'assets/images/svgs/profile_screen/vital signs.svg', - isInPatient: isInpatient), - PatientProfileCardModel( - TranslationBase.of(context).lab, - TranslationBase.of(context).result, - LAB_RESULT, - 'assets/images/svgs/profile_screen/lab results.svg', - isInPatient: isInpatient), - PatientProfileCardModel( - TranslationBase.of(context).lab, - TranslationBase.of(context).special, - ALL_SPECIAL_LAB_RESULT, - 'assets/images/svgs/profile_screen/lab results.svg', - isInPatient: isInpatient), - PatientProfileCardModel( - TranslationBase.of(context).radiology, - TranslationBase.of(context).service, - RADIOLOGY_PATIENT, - 'assets/images/svgs/profile_screen/health summary.svg', + PatientProfileCardModel(TranslationBase.of(context).vital, TranslationBase.of(context).signs, VITAL_SIGN_DETAILS, 'assets/images/svgs/profile_screen/vital signs.svg', isInPatient: isInpatient), + PatientProfileCardModel(TranslationBase.of(context).lab, TranslationBase.of(context).result, LAB_RESULT, 'assets/images/svgs/profile_screen/lab results.svg', isInPatient: isInpatient), + PatientProfileCardModel(TranslationBase.of(context).lab, TranslationBase.of(context).special, ALL_SPECIAL_LAB_RESULT, 'assets/images/svgs/profile_screen/lab results.svg', isInPatient: isInpatient), - PatientProfileCardModel( - TranslationBase.of(context).orders, - TranslationBase.of(context).prescription + ' (${TranslationBase.of(context).old})', - ORDER_PRESCRIPTION_OLD, - 'assets/images/svgs/profile_screen/order prescription.svg', + PatientProfileCardModel(TranslationBase.of(context).radiology, TranslationBase.of(context).service, RADIOLOGY_PATIENT, 'assets/images/svgs/profile_screen/health summary.svg', isInPatient: isInpatient), - PatientProfileCardModel( - TranslationBase.of(context).patient, - TranslationBase.of(context).prescription, - ORDER_PRESCRIPTION_NEW, + PatientProfileCardModel(TranslationBase.of(context).orders, TranslationBase.of(context).prescription + ' (${TranslationBase.of(context).old})', ORDER_PRESCRIPTION_OLD, 'assets/images/svgs/profile_screen/order prescription.svg', isInPatient: isInpatient), - PatientProfileCardModel( - TranslationBase.of(context).health, - TranslationBase.of(context).summary, - HEALTH_SUMMARY, - 'assets/images/svgs/profile_screen/health summary.svg', + PatientProfileCardModel(TranslationBase.of(context).patient, TranslationBase.of(context).prescription, ORDER_PRESCRIPTION_NEW, 'assets/images/svgs/profile_screen/order prescription.svg', isInPatient: isInpatient), - PatientProfileCardModel(TranslationBase.of(context).patient, "ECG", - PATIENT_ECG, 'assets/images/svgs/profile_screen/ECG.svg', + PatientProfileCardModel(TranslationBase.of(context).health, TranslationBase.of(context).summary, HEALTH_SUMMARY, 'assets/images/svgs/profile_screen/health summary.svg', isInPatient: isInpatient), - PatientProfileCardModel( - TranslationBase.of(context).orders, - TranslationBase.of(context).procedures, - ORDER_PROCEDURE, - 'assets/images/svgs/profile_screen/Order Procedures.svg', + PatientProfileCardModel(TranslationBase.of(context).patient, "ECG", PATIENT_ECG, 'assets/images/svgs/profile_screen/ECG.svg', isInPatient: isInpatient), + PatientProfileCardModel(TranslationBase.of(context).orders, TranslationBase.of(context).procedures, ORDER_PROCEDURE, 'assets/images/svgs/profile_screen/Order Procedures.svg', isInPatient: isInpatient), - PatientProfileCardModel( - TranslationBase.of(context).insurance, - TranslationBase.of(context).service, - PATIENT_INSURANCE_APPROVALS_NEW, - 'assets/images/svgs/profile_screen/insurance approval.svg', + PatientProfileCardModel(TranslationBase.of(context).insurance, TranslationBase.of(context).service, PATIENT_INSURANCE_APPROVALS_NEW, 'assets/images/svgs/profile_screen/insurance approval.svg', isInPatient: isInpatient), - PatientProfileCardModel( - TranslationBase.of(context).patientSick, - TranslationBase.of(context).leave, - ADD_SICKLEAVE, - 'assets/images/svgs/profile_screen/patient sick leave.svg', + PatientProfileCardModel(TranslationBase.of(context).patientSick, TranslationBase.of(context).leave, ADD_SICKLEAVE, 'assets/images/svgs/profile_screen/patient sick leave.svg', isInPatient: isInpatient), - if (isFromLiveCare || - (patient.appointmentNo != null && patient.appointmentNo != 0)) - PatientProfileCardModel( - TranslationBase.of(context).patient, - TranslationBase.of(context).ucaf, - PATIENT_UCAF_REQUEST, - 'assets/images/svgs/profile_screen/UCAF.svg', - isInPatient: isInpatient, - isDisable: isFromLiveCare - ? patient.appointmentNo == null - : patient.patientStatusType != 43 || - patient.appointmentNo == null), - if (isFromLiveCare || - (patient.appointmentNo != null && patient.appointmentNo != 0)) + if (isFromLiveCare || (patient!.appointmentNo != null && patient!.appointmentNo != 0)) + PatientProfileCardModel(TranslationBase.of(context).patient, TranslationBase.of(context).ucaf, PATIENT_UCAF_REQUEST, 'assets/images/svgs/profile_screen/UCAF.svg', + isInPatient: isInpatient, isDisable: isFromLiveCare ? patient!.appointmentNo == null : patient!.patientStatusType != 43 || patient!.appointmentNo == null), + if (isFromLiveCare || (patient!.appointmentNo != null && patient!.appointmentNo != 0)) PatientProfileCardModel( TranslationBase.of(context).referral, TranslationBase.of(context).patient, REFER_PATIENT_TO_DOCTOR, 'assets/images/svgs/profile_screen/refer patient.svg', isInPatient: isInpatient, - isDisable: isFromLiveCare - ? patient.appointmentNo == null - : patient.patientStatusType != 43 || - patient.appointmentNo == null, + isDisable: isFromLiveCare ? patient!.appointmentNo == null : patient!.patientStatusType != 43 || patient!.appointmentNo == null, ), - if (isFromLiveCare || - (patient.appointmentNo != null && patient.appointmentNo != 0)) - PatientProfileCardModel( - TranslationBase.of(context).admission, - TranslationBase.of(context).request, - PATIENT_ADMISSION_REQUEST, - 'assets/images/svgs/profile_screen/admission req.svg', - isInPatient: isInpatient, - isDisable: isFromLiveCare - ? patient.appointmentNo == null - : patient.patientStatusType != 43 || - patient.appointmentNo == null), + if (isFromLiveCare || (patient!.appointmentNo != null && patient!.appointmentNo != 0)) + PatientProfileCardModel(TranslationBase.of(context).admission, TranslationBase.of(context).request, PATIENT_ADMISSION_REQUEST, 'assets/images/svgs/profile_screen/admission req.svg', + isInPatient: isInpatient, isDisable: isFromLiveCare ? patient!.appointmentNo == null : patient!.patientStatusType != 43 || patient!.appointmentNo == null), ]; return Padding( padding: const EdgeInsets.symmetric(vertical: 15.0, horizontal: 15), @@ -148,11 +72,11 @@ class ProfileGridForOther extends StatelessWidget { //change the number as you want children: cardsList.map((item) { return PatientProfileButton( - patient: patient, - patientType: patientType, - arrivalType: arrivalType, - from: from, - to: to, + patient: patient!, + patientType: patientType!, + arrivalType: arrivalType!, + from: from!, + to: to!, nameLine1: item.nameLine1, nameLine2: item.nameLine2, route: item.route, @@ -160,7 +84,7 @@ class ProfileGridForOther extends StatelessWidget { isInPatient: item.isInPatient, isDischargedPatient: item.isDischargedPatient, isDisable: item.isDisable, - onTap: item.onTap, + onTap: item.onTap!, isLoading: item.isLoading, ); }).toList(), diff --git a/lib/screens/patients/profile/profile_screen/profile_gird_for_search.dart b/lib/screens/patients/profile/profile_screen/profile_gird_for_search.dart index 08fa43d2..365cd3b4 100644 --- a/lib/screens/patients/profile/profile_screen/profile_gird_for_search.dart +++ b/lib/screens/patients/profile/profile_screen/profile_gird_for_search.dart @@ -7,21 +7,21 @@ import 'package:flutter/material.dart'; import '../../../../routes.dart'; class ProfileGridForSearch extends StatelessWidget { - final PatiantInformtion patient; - final String patientType; - final String arrivalType; - final double height; + final PatiantInformtion? patient; + final String? patientType; + final String? arrivalType; + final double? height; final bool isInpatient; - String from; - String to; + String? from; + String? to; ProfileGridForSearch( - {Key key, + {Key? key, this.patient, this.patientType, this.arrivalType, this.height, - this.isInpatient, + this.isInpatient = false, this.from, this.to}) : super(key: key); @@ -92,30 +92,30 @@ class ProfileGridForSearch extends StatelessWidget { ADD_SICKLEAVE, 'assets/images/svgs/profile_screen/patient sick leave.svg', isInPatient: isInpatient), - if (patient.appointmentNo != null && patient.appointmentNo != 0) + if (patient!.appointmentNo != null && patient!.appointmentNo != 0) PatientProfileCardModel( TranslationBase.of(context).patient, TranslationBase.of(context).ucaf, PATIENT_UCAF_REQUEST, 'assets/images/svgs/profile_screen/UCAF.svg', isInPatient: isInpatient, - isDisable: patient.patientStatusType != 43 ? true : false), - if (patient.appointmentNo != null && patient.appointmentNo != 0) + isDisable: patient!.patientStatusType != 43 ? true : false), + if (patient!.appointmentNo != null && patient!.appointmentNo != 0) PatientProfileCardModel( TranslationBase.of(context).referral, TranslationBase.of(context).patient, REFER_PATIENT_TO_DOCTOR, 'assets/images/svgs/profile_screen/refer patient.svg', isInPatient: isInpatient, - isDisable: patient.patientStatusType != 43 ? true : false), - if (patient.appointmentNo != null && patient.appointmentNo != 0) + isDisable: patient!.patientStatusType != 43 ? true : false), + if (patient!.appointmentNo != null && patient!.appointmentNo != 0) PatientProfileCardModel( TranslationBase.of(context).admission, TranslationBase.of(context).request, PATIENT_ADMISSION_REQUEST, 'assets/images/svgs/profile_screen/admission req.svg', isInPatient: isInpatient, - isDisable: patient.patientStatusType != 43 ? true : false), + isDisable: patient!.patientStatusType != 43 ? true : false), ]; return Padding( @@ -133,11 +133,11 @@ class ProfileGridForSearch extends StatelessWidget { //change the number as you want children: cardsList.map((item) { return PatientProfileButton( - patient: patient, - patientType: patientType, - arrivalType: arrivalType, - from: from, - to: to, + patient: patient!, + patientType: patientType!, + arrivalType: arrivalType!, + from: from!, + to: to!, nameLine1: item.nameLine1, nameLine2: item.nameLine2, route: item.route, @@ -145,7 +145,7 @@ class ProfileGridForSearch extends StatelessWidget { isInPatient: item.isInPatient, isDischargedPatient: item.isDischargedPatient, isDisable: item.isDisable, - onTap: item.onTap, + onTap: item.onTap!, isLoading: item.isLoading, ); }).toList(), diff --git a/lib/screens/patients/profile/radiology/radiology_details_page.dart b/lib/screens/patients/profile/radiology/radiology_details_page.dart index 27d6e077..2cb282ba 100644 --- a/lib/screens/patients/profile/radiology/radiology_details_page.dart +++ b/lib/screens/patients/profile/radiology/radiology_details_page.dart @@ -2,6 +2,7 @@ import 'package:doctor_app_flutter/core/model/radiology/final_radiology.dart'; import 'package:doctor_app_flutter/core/service/AnalyticsService.dart'; import 'package:doctor_app_flutter/core/viewModel/radiology_view_model.dart'; import 'package:doctor_app_flutter/core/model/patient/patiant_info_model.dart'; +import 'package:doctor_app_flutter/locator.dart'; import 'package:doctor_app_flutter/screens/base/base_view.dart'; import 'package:doctor_app_flutter/utils/translations_delegate_base_utils.dart'; import 'package:doctor_app_flutter/widgets/patients/profile/app_bar/patient-profile-app-bar.dart'; @@ -11,46 +12,35 @@ import 'package:doctor_app_flutter/widgets/shared/buttons/app_buttons_widget.dar import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:url_launcher/url_launcher.dart'; - -import '../../../../locator.dart'; +import 'package:url_launcher/url_launcher_string.dart'; class RadiologyDetailsPage extends StatelessWidget { - final FinalRadiology finalRadiology; - final PatiantInformtion patient; - final String patientType; - final String arrivalType; + final FinalRadiology? finalRadiology; + final PatiantInformtion? patient; + final String? patientType; + final String? arrivalType; final bool isInpatient; - RadiologyDetailsPage( - {Key key, - this.finalRadiology, - this.patient, - this.patientType, - this.arrivalType, - this.isInpatient = false}); + RadiologyDetailsPage({Key? key, this.finalRadiology, this.patient, this.patientType, this.arrivalType, this.isInpatient = false}); @override Widget build(BuildContext context) { return BaseView( - onModelReady: (model) => model.getRadImageURL( - patient: patient, - projectId: finalRadiology.projectID, - lineItem: finalRadiology.invoiceLineItemNo, - invoiceNo: finalRadiology.invoiceNo), + onModelReady: (model) => model.getRadImageURL(patient: patient!, projectId: finalRadiology!.projectID, lineItem: finalRadiology!.invoiceLineItemNo, invoiceNo: finalRadiology!.invoiceNo), builder: (_, model, widget) => AppScaffold( appBar: PatientProfileAppBar( - patient, - appointmentDate: finalRadiology.orderDate, - doctorName: finalRadiology.doctorName, - clinic: finalRadiology.clinicDescription, - branch: finalRadiology.projectName, - profileUrl: finalRadiology.doctorImageURL, - invoiceNO: finalRadiology.invoiceNo.toString(), + patient!, + appointmentDate: finalRadiology!.orderDate!, + doctorName: finalRadiology!.doctorName, + clinic: finalRadiology!.clinicDescription, + branch: finalRadiology!.projectName, + profileUrl: finalRadiology!.doctorImageURL, + invoiceNO: finalRadiology!.invoiceNo.toString(), isAppointmentHeader: true, ), isShowAppBar: true, baseViewModel: model, - body: SingleChildScrollView( + body: SingleChildScrollView( child: Column( mainAxisSize: MainAxisSize.max, crossAxisAlignment: CrossAxisAlignment.center, @@ -78,7 +68,7 @@ class RadiologyDetailsPage extends StatelessWidget { Padding( padding: const EdgeInsets.all(8.0), child: AppText( - '${finalRadiology.reportData.trim()}', + '${finalRadiology!.reportData.trim()}', textAlign: TextAlign.start, isCopyable: true, fontSize: 17, @@ -99,23 +89,22 @@ class RadiologyDetailsPage extends StatelessWidget { height: 80, width: double.maxFinite, child: Container( - margin: - EdgeInsets.only(left: 35, right: 35, top: 12, bottom: 12), + margin: EdgeInsets.only(left: 35, right: 35, top: 12, bottom: 12), child: AppButton( color: Color(0xffD02127), - disabled: finalRadiology.dIAPACSURL == "", + disabled: finalRadiology!.dIAPACSURL == "", onPressed: () async { await locator().logEvent( eventCategory: "RadiologyDetailsPage", eventAction: "Open Radiology Image", ); - launch(model.radImageURL); + launchUrlString(model.radImageURL); }, title: TranslationBase.of(context).openRad, ), ), ) - : null, + : SizedBox(), ), ); } diff --git a/lib/screens/patients/profile/radiology/radiology_home_page.dart b/lib/screens/patients/profile/radiology/radiology_home_page.dart index 12b54a3c..2fbc6737 100644 --- a/lib/screens/patients/profile/radiology/radiology_home_page.dart +++ b/lib/screens/patients/profile/radiology/radiology_home_page.dart @@ -12,12 +12,12 @@ import 'package:doctor_app_flutter/widgets/patients/profile/add-order/addNewOrde import 'package:doctor_app_flutter/widgets/patients/profile/app_bar/patient-profile-app-bar.dart'; import 'package:doctor_app_flutter/widgets/shared/app_scaffold_widget.dart'; import 'package:doctor_app_flutter/widgets/shared/doctor_card.dart'; +import 'package:doctor_app_flutter/widgets/shared/errors/error_message.dart'; import 'package:doctor_app_flutter/widgets/transitions/fade_page.dart'; import 'package:doctor_app_flutter/widgets/transitions/slide_up_page.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:provider/provider.dart'; -import '../../../../widgets/shared/errors/error_message.dart'; class RadiologyHomePage extends StatefulWidget { @override @@ -25,16 +25,16 @@ class RadiologyHomePage extends StatefulWidget { } class _RadiologyHomePageState extends State { - String patientType; - PatiantInformtion patient; - String arrivalType; - bool isInpatient; - bool isFromLiveCare; + String? patientType; + PatiantInformtion? patient; + String? arrivalType; + bool isInpatient = false; + bool isFromLiveCare = false; @override void didChangeDependencies() { super.didChangeDependencies(); - final routeArgs = ModalRoute.of(context).settings.arguments as Map; + final routeArgs = ModalRoute.of(context)!.settings.arguments as Map; patient = routeArgs['patient']; patientType = routeArgs['patientType']; arrivalType = routeArgs['arrivalType']; @@ -47,14 +47,14 @@ class _RadiologyHomePageState extends State { Widget build(BuildContext context) { ProjectViewModel projectViewModel = Provider.of(context); return BaseView( - onModelReady: (model) => model.getPatientRadOrders(patient, + onModelReady: (model) => model.getPatientRadOrders(patient!, patientType: patientType, isInPatient: false), builder: (_, model, widget) => AppScaffold( isShowAppBar: true, - backgroundColor: Colors.grey[100], + backgroundColor: Colors.grey[100]!, // appBarTitle: TranslationBase.of(context).radiology, appBar: PatientProfileAppBar( - patient, + patient!, isInpatient: isInpatient, ), baseViewModel: model, @@ -67,27 +67,27 @@ class _RadiologyHomePageState extends State { height: 12, ), if (model.radiologyList.isNotEmpty && - patient.patientStatusType != 43) + patient!.patientStatusType != 43) ServiceTitle( title: TranslationBase.of(context).radiology, subTitle: TranslationBase.of(context).result, ), - if (patient.patientStatusType != null && - patient.patientStatusType == 43) + if (patient!.patientStatusType != null && + patient!.patientStatusType == 43) ServiceTitle( title: TranslationBase.of(context).radiology, subTitle: TranslationBase.of(context).result, ), - if ((patient.patientStatusType != null && - patient.patientStatusType == 43) || - (isFromLiveCare && patient.appointmentNo != null)) + if ((patient!.patientStatusType != null && + patient!.patientStatusType == 43) || + (isFromLiveCare && patient!.appointmentNo != null)) AddNewOrder( onTap: () { Navigator.push( context, SlideUpPageRoute( widget: BaseAddProcedureTabPage( - patient: patient, + patient: patient!, previousProcedureViewModel: model, procedureType: ProcedureType.RADIOLOGY, ), @@ -118,9 +118,9 @@ class _RadiologyHomePageState extends State { decoration: BoxDecoration( //Colors.red[900] Color(0xff404545) color: model.radiologyList[index] - .isLiveCareAppodynamicment - ? Colors.red[900] - : !model.radiologyList[index].isInOutPatient + .isLiveCareAppodynamicment! + ? Colors.red[900]! + : !model.radiologyList[index].isInOutPatient! ? Colors.black : Color(0xffa9a089), borderRadius: BorderRadius.only( @@ -142,12 +142,12 @@ class _RadiologyHomePageState extends State { child: Center( child: Text( model.radiologyList[index] - .isLiveCareAppodynamicment + .isLiveCareAppodynamicment! ? TranslationBase.of(context) .liveCare .toUpperCase() : !model.radiologyList[index] - .isInOutPatient + .isInOutPatient! ? TranslationBase.of(context) .inPatientLabel .toUpperCase() @@ -173,7 +173,7 @@ class _RadiologyHomePageState extends State { Utils.convertToTitleCase(model.radiologyList[index].clinicDescription), appointmentDate: model.radiologyList[index].orderDate ?? - model.radiologyList[index].reportDate, + model.radiologyList[index].reportDate!, onTap: () { Navigator.push( context, @@ -192,7 +192,7 @@ class _RadiologyHomePageState extends State { ), )), if (model.radiologyList.isEmpty && - patient.patientStatusType != 43) + patient!.patientStatusType != 43) Center( child: ErrorMessage( error: TranslationBase.of(context).noDataAvailable, diff --git a/lib/screens/patients/profile/radiology/radiology_report_screen.dart b/lib/screens/patients/profile/radiology/radiology_report_screen.dart index 6e5f2d4f..9e9aef27 100644 --- a/lib/screens/patients/profile/radiology/radiology_report_screen.dart +++ b/lib/screens/patients/profile/radiology/radiology_report_screen.dart @@ -11,7 +11,7 @@ class RadiologyReportScreen extends StatelessWidget { final String reportData; final String url; - RadiologyReportScreen({Key key, this.reportData, this.url}); + RadiologyReportScreen({Key? key, required this.reportData, required this.url}); @override Widget build(BuildContext context) { @@ -35,7 +35,7 @@ class RadiologyReportScreen extends StatelessWidget { ), child: AppText( reportData, - fontSize: 2.5 * SizeConfig.textMultiplier, + fontSize: 2.5 * SizeConfig.textMultiplier!, ), ), SizedBox( 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 0067d5fb..0abfd3d3 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 @@ -28,13 +28,12 @@ import 'package:speech_to_text/speech_to_text.dart' as stt; class PatientMakeInPatientReferralScreen extends StatefulWidget { @override - _PatientMakeInPatientReferralScreenState createState() => - _PatientMakeInPatientReferralScreenState(); + _PatientMakeInPatientReferralScreenState createState() => _PatientMakeInPatientReferralScreenState(); } -class _PatientMakeInPatientReferralScreenState extends State{ - PatiantInformtion patient; - List referToList; +class _PatientMakeInPatientReferralScreenState extends State { + PatiantInformtion? patient; + List? referToList; dynamic _referTo; dynamic _selectedBranch; dynamic _selectedClinic; @@ -44,19 +43,17 @@ class _PatientMakeInPatientReferralScreenState extends State initSpeechState() async { - bool hasSpeech = await speech.initialize( - onError: errorListener, onStatus: statusListener); + bool hasSpeech = await speech.initialize(onError: errorListener, onStatus: statusListener); print(hasSpeech); if (!mounted) return; } @override Widget build(BuildContext context) { - dynamic priority1 = { "ParameterCode": 1, "Description": TranslationBase.of(context).veryUrgent.toUpperCase(), @@ -145,503 +139,427 @@ class _PatientMakeInPatientReferralScreenState extends State( onModelReady: (model) => model.getReferralFrequencyList(), builder: (_, model, w) => AppScaffold( - baseViewModel: model, - appBarTitle: TranslationBase.of(context).referPatient, - isShowAppBar: true, - appBar: PatientProfileAppBar( - patient, - isInpatient: isInpatient, - ), - body: SingleChildScrollView( - child: Container( - child: Column( - mainAxisAlignment: MainAxisAlignment.spaceAround, - children: [ - Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - SizedBox( - height: 10, - ), - Padding( - padding: const EdgeInsets.all(8.0), - child: ServiceTitle( - title: TranslationBase.of(context).refer, - subTitle: TranslationBase.of(context).patient, + baseViewModel: model, + appBarTitle: TranslationBase.of(context).referPatient, + isShowAppBar: true, + appBar: PatientProfileAppBar( + patient!, + isInpatient: isInpatient, + ), + body: SingleChildScrollView( + child: Container( + child: Column( + mainAxisAlignment: MainAxisAlignment.spaceAround, + children: [ + Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + SizedBox( + height: 10, ), - ), - Container( - margin: EdgeInsets.symmetric(vertical: 0, horizontal: 16), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - AppTextFieldCustom( - height: screenSize.height * 0.075, - hintText: TranslationBase.of(context).branch, - dropDownText: - _referTo != null ? _referTo['name'] : null, - enabled: false, - isTextFieldHasSuffix: true, - validationError: branchError, - onClick: referToList != null - ? () { - ListSelectDialog dialog = ListSelectDialog( - list: referToList, - attributeName: 'name', - attributeValueId: 'id', - okText: TranslationBase.of(context).ok, - okFunction: (selectedValue) { - setState(() { - _referTo = selectedValue; - _selectedBranch = null; + Padding( + padding: const EdgeInsets.all(8.0), + child: ServiceTitle( + title: TranslationBase.of(context).refer, + subTitle: TranslationBase.of(context).patient, + ), + ), + Container( + margin: EdgeInsets.symmetric(vertical: 0, horizontal: 16), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + AppTextFieldCustom( + height: screenSize.height * 0.075, + hintText: TranslationBase.of(context).branch, + dropDownText: _referTo != null ? _referTo['name'] : null, + enabled: false, + isTextFieldHasSuffix: true, + validationError: branchError!, + onClick: referToList != null + ? () { + ListSelectDialog dialog = ListSelectDialog( + list: referToList!, + attributeName: 'name', + attributeValueId: 'id', + okText: TranslationBase.of(context).ok, + okFunction: (selectedValue) { + setState(() { + _referTo = selectedValue; + _selectedBranch = null; + _selectedClinic = null; + _selectedDoctor = null; + model.getDoctorBranch().then((value) async { + _selectedBranch = value; + if (_referTo['id'] == 1) { + GifLoaderDialogUtils.showMyDialog(context); + await model.getClinics(_selectedBranch['facilityId']).then((_) => GifLoaderDialogUtils.hideDialog(context)); + if (model.state == ViewState.ErrorLocal) { + DrAppToastMsg.showErrorToast(model.error); + } + } else { + _selectedBranch = null; + } + }); + }); + }, + ); + showDialog( + barrierDismissible: false, + context: context, + builder: (BuildContext context) { + return dialog; + }, + ); + } + : () {}, + ), + SizedBox( + height: 10, + ), + AppTextFieldCustom( + height: screenSize.height * 0.075, + hintText: TranslationBase.of(context).hospital, + dropDownText: _selectedBranch != null ? _selectedBranch['facilityName'] : null, + enabled: false, + isTextFieldHasSuffix: true, + validationError: hospitalError!, + onClick: model.branchesList != null && model.branchesList.length > 0 && _referTo != null && _referTo['id'] == 2 + ? () { + ListSelectDialog dialog = ListSelectDialog( + list: model.branchesList, + attributeName: 'facilityName', + attributeValueId: 'facilityId', + okText: TranslationBase.of(context).ok, + okFunction: (selectedValue) async { + _selectedBranch = selectedValue; _selectedClinic = null; _selectedDoctor = null; - model - .getDoctorBranch() - .then((value) async { - _selectedBranch = value; - if (_referTo['id'] == 1) { - GifLoaderDialogUtils.showMyDialog( - context); - await model - .getClinics(_selectedBranch[ - 'facilityId']) - .then((_) => - GifLoaderDialogUtils - .hideDialog(context)); - if (model.state == - ViewState.ErrorLocal) { - DrAppToastMsg.showErrorToast( - model.error); - } - } else { - _selectedBranch = null; - } + GifLoaderDialogUtils.showMyDialog(context); + await model.getClinics(_selectedBranch['facilityId']).then((_) => GifLoaderDialogUtils.hideDialog(context)); + if (model.state == ViewState.ErrorLocal) { + DrAppToastMsg.showErrorToast(model.error); + } + }, + ); + showDialog( + barrierDismissible: false, + context: context, + builder: (BuildContext context) { + return dialog; + }, + ); + } + : () {}, + ), + SizedBox( + height: 10, + ), + AppTextFieldCustom( + height: screenSize.height * 0.075, + hintText: TranslationBase.of(context).clinic, + dropDownText: _selectedClinic != null ? _selectedClinic['ClinicDescription'] : null, + enabled: false, + isTextFieldHasSuffix: true, + validationError: clinicError!, + onClick: _selectedBranch != null && model.clinicsList != null && model.clinicsList.length > 0 + ? () { + ListSelectDialog dialog = ListSelectDialog( + list: model.clinicsList, + attributeName: 'ClinicDescription', + attributeValueId: 'ClinicID', + usingSearch: true, + hintSearchText: TranslationBase.of(context).clinicSearch, + okText: TranslationBase.of(context).ok, + okFunction: (selectedValue) async { + _selectedDoctor = null; + _selectedClinic = selectedValue; + GifLoaderDialogUtils.showMyDialog(context); + await model.getClinicDoctors(patient!, _selectedClinic['ClinicID'], _selectedBranch['facilityId']).then((_) => GifLoaderDialogUtils.hideDialog(context)); + if (model.state == ViewState.ErrorLocal) { + DrAppToastMsg.showErrorToast(model.error); + } + }, + ); + showDialog( + barrierDismissible: false, + context: context, + builder: (BuildContext context) { + return dialog; + }, + ); + } + : () {}, + ), + SizedBox( + height: 10, + ), + AppTextFieldCustom( + height: screenSize.height * 0.075, + hintText: TranslationBase.of(context).doctor, + dropDownText: _selectedDoctor != null ? _selectedDoctor['Name'] : null, + enabled: false, + isTextFieldHasSuffix: true, + validationError: doctorError!, + onClick: _selectedClinic != null && model.doctorsList != null && model.doctorsList.length > 0 + ? () { + ListSelectDialog dialog = ListSelectDialog( + list: model.doctorsList, + attributeName: 'Name', + attributeValueId: 'DoctorID', + usingSearch: true, + hintSearchText: TranslationBase.of(context).doctorSearch, + okText: TranslationBase.of(context).ok, + okFunction: (selectedValue) { + setState(() { + _selectedDoctor = selectedValue; }); - }); - }, - ); - showDialog( - barrierDismissible: false, - context: context, - builder: (BuildContext context) { - return dialog; - }, - ); - } - : null, - ), - SizedBox( - height: 10, - ), - AppTextFieldCustom( - height: screenSize.height * 0.075, - hintText: TranslationBase.of(context).hospital, - dropDownText: _selectedBranch != null - ? _selectedBranch['facilityName'] - : null, - enabled: false, - isTextFieldHasSuffix: true, - validationError: hospitalError, - onClick: model.branchesList != null && - model.branchesList.length > 0 && - _referTo != null && - _referTo['id'] == 2 - ? () { - ListSelectDialog dialog = ListSelectDialog( - list: model.branchesList, - attributeName: 'facilityName', - attributeValueId: 'facilityId', - okText: TranslationBase.of(context).ok, - okFunction: (selectedValue) async { - _selectedBranch = selectedValue; - _selectedClinic = null; - _selectedDoctor = null; - GifLoaderDialogUtils.showMyDialog( - context); - await model - .getClinics( - _selectedBranch['facilityId']) - .then((_) => - GifLoaderDialogUtils.hideDialog( - context)); - if (model.state == - ViewState.ErrorLocal) { - DrAppToastMsg.showErrorToast( - model.error); - } - }, - ); - showDialog( - barrierDismissible: false, - context: context, - builder: (BuildContext context) { - return dialog; - }, - ); - } - : null, - ), - SizedBox( - height: 10, - ), - AppTextFieldCustom( - height: screenSize.height * 0.075, - hintText: TranslationBase.of(context).clinic, - dropDownText: _selectedClinic != null - ? _selectedClinic['ClinicDescription'] - : null, - enabled: false, - isTextFieldHasSuffix: true, - validationError: clinicError, - onClick: _selectedBranch != null && - model.clinicsList != null && - model.clinicsList.length > 0 - ? () { - ListSelectDialog dialog = ListSelectDialog( - list: model.clinicsList, - attributeName: 'ClinicDescription', - attributeValueId: 'ClinicID', - usingSearch: true, - hintSearchText: - TranslationBase.of(context) - .clinicSearch, - okText: TranslationBase.of(context).ok, - okFunction: (selectedValue) async { - _selectedDoctor = null; - _selectedClinic = selectedValue; - GifLoaderDialogUtils.showMyDialog( - context); - await model - .getClinicDoctors( - patient, - _selectedClinic['ClinicID'], - _selectedBranch['facilityId']) - .then((_) => - GifLoaderDialogUtils.hideDialog( - context)); - if (model.state == - ViewState.ErrorLocal) { - DrAppToastMsg.showErrorToast( - model.error); - } - }, - ); - showDialog( - barrierDismissible: false, - context: context, - builder: (BuildContext context) { - return dialog; - }, - ); - } - : null, - ), - SizedBox( - height: 10, - ), - AppTextFieldCustom( - height: screenSize.height * 0.075, - hintText: TranslationBase.of(context).doctor, - dropDownText: _selectedDoctor != null - ? _selectedDoctor['Name'] - : null, - enabled: false, - isTextFieldHasSuffix: true, - validationError: doctorError, - onClick: _selectedClinic != null && - model.doctorsList != null && - model.doctorsList.length > 0 - ? () { - ListSelectDialog dialog = ListSelectDialog( - list: model.doctorsList, - attributeName: 'Name', - attributeValueId: 'DoctorID', - usingSearch: true, - hintSearchText: - TranslationBase.of(context) - .doctorSearch, - okText: TranslationBase.of(context).ok, - okFunction: (selectedValue) { - setState(() { - _selectedDoctor = selectedValue; - }); - }, - ); - showDialog( - barrierDismissible: false, - context: context, - builder: (BuildContext context) { - return dialog; - }, - ); - } - : () { - if (_selectedClinic == null) { - DrAppToastMsg.showErrorToast( - "You need to select a clinic first"); - } else if (model.doctorsList == null || - model.doctorsList.length == 0) { - DrAppToastMsg.showErrorToast( - "There is no doctors for this clinic"); + }, + ); + showDialog( + barrierDismissible: false, + context: context, + builder: (BuildContext context) { + return dialog; + }, + ); } + : () { + if (_selectedClinic == null) { + DrAppToastMsg.showErrorToast("You need to select a clinic first"); + } else if (model.doctorsList == null || model.doctorsList.length == 0) { + DrAppToastMsg.showErrorToast("There is no doctors for this clinic"); + } + }, + ), + SizedBox( + height: 10, + ), + AppTextFieldCustom( + height: screenSize.height * 0.075, + hintText: TranslationBase.of(context).priority, + dropDownText: _selectedPriority != null ? _selectedPriority['Description'] : null, + enabled: false, + isTextFieldHasSuffix: true, + validationError: frequencyError!, + onClick: () { + ListSelectDialog dialog = ListSelectDialog( + list: _priorityList, + attributeName: 'Description', + attributeValueId: 'Description', + usingSearch: false, + okText: TranslationBase.of(context).ok, + okFunction: (selectedValue) { + setState(() { + _selectedPriority = selectedValue; + _activePriority = selectedValue["ParameterCode"]; + }); }, - ), - SizedBox( - height: 10, - ), - AppTextFieldCustom( - height: screenSize.height * 0.075, - hintText: - TranslationBase.of(context).priority, - dropDownText: _selectedPriority != null - ? _selectedPriority['Description'] - : null, - enabled: false, - isTextFieldHasSuffix: true, - validationError: frequencyError, - onClick: () { - ListSelectDialog dialog = ListSelectDialog( - list: _priorityList, - attributeName: 'Description', - attributeValueId: 'Description', - usingSearch: false, - okText: TranslationBase.of(context).ok, - okFunction: (selectedValue) { - setState(() { - _selectedPriority = selectedValue; - _activePriority = selectedValue["ParameterCode"]; - }); - }, - ); - showDialog( - barrierDismissible: false, - context: context, - builder: (BuildContext context) { - return dialog; - }, - ); - }, - ), - - SizedBox( - height: 10, - ), - Padding( - padding: const EdgeInsets.all(4.0), - child: AppText( - "${TranslationBase.of(context).replayBefore}: ${getPriority()}", - fontWeight: FontWeight.normal, - fontSize: SizeConfig.textMultiplier * 1.9, + ); + showDialog( + barrierDismissible: false, + context: context, + builder: (BuildContext context) { + return dialog; + }, + ); + }, ), - ), - SizedBox( - height: 10, - ), - AppTextFieldCustom( - height: screenSize.height * 0.075, - hintText: - TranslationBase.of(context).referralFrequency, - dropDownText: _selectedFrequency != null - ? _selectedFrequency['Description'] - : null, - enabled: false, - isTextFieldHasSuffix: true, - validationError: frequencyError, - onClick: () { - ListSelectDialog dialog = ListSelectDialog( - list: model.referralFrequencyList, - attributeName: 'Description', - attributeValueId: 'ParameterCode', - usingSearch: true, - hintSearchText: TranslationBase.of(context) - .selectReferralFrequency, - okText: TranslationBase.of(context).ok, - okFunction: (selectedValue) { - setState(() { - _selectedFrequency = selectedValue; - }); - }, - ); - showDialog( - barrierDismissible: false, - context: context, - builder: (BuildContext context) { - return dialog; - }, - ); - }, - ), - SizedBox( - height: 10, - ), - AppTextFieldCustom( - hintText: TranslationBase.of(context).ext, - controller: _extController, - inputType: TextInputType.text, - ), - SizedBox( - height: 10, - ), - Stack( - children: [ - AppTextFieldCustom( - validationError: remarkError, - hintText: "Remarks", - controller: _remarksController, - inputType: TextInputType.multiline, - minLines: 4, - maxLines: 6, + SizedBox( + height: 10, + ), + Padding( + padding: const EdgeInsets.all(4.0), + child: AppText( + "${TranslationBase.of(context).replayBefore}: ${getPriority()}", + fontWeight: FontWeight.normal, + fontSize: SizeConfig.textMultiplier! * 1.9, ), - Positioned( - top: 0, - right: 15, - child: IconButton( - icon: Icon( - DoctorApp.speechtotext, - color: Colors.black, - size: 35, - ), - onPressed: () { - initSpeechState() - .then((value) => {onVoiceText()}); + ), + SizedBox( + height: 10, + ), + AppTextFieldCustom( + height: screenSize.height * 0.075, + hintText: TranslationBase.of(context).referralFrequency, + dropDownText: _selectedFrequency != null ? _selectedFrequency['Description'] : null, + enabled: false, + isTextFieldHasSuffix: true, + validationError: frequencyError!, + onClick: () { + ListSelectDialog dialog = ListSelectDialog( + list: model.referralFrequencyList, + attributeName: 'Description', + attributeValueId: 'ParameterCode', + usingSearch: true, + hintSearchText: TranslationBase.of(context).selectReferralFrequency, + okText: TranslationBase.of(context).ok, + okFunction: (selectedValue) { + setState(() { + _selectedFrequency = selectedValue; + }); + }, + ); + showDialog( + barrierDismissible: false, + context: context, + builder: (BuildContext context) { + return dialog; }, + ); + }, + ), + SizedBox( + height: 10, + ), + AppTextFieldCustom( + hintText: TranslationBase.of(context).ext, + controller: _extController, + inputType: TextInputType.text, + ), + SizedBox( + height: 10, + ), + Stack( + children: [ + AppTextFieldCustom( + validationError: remarkError!, + hintText: "Remarks", + controller: _remarksController, + inputType: TextInputType.multiline, + minLines: 4, + maxLines: 6, ), - ), - ], - ), - SizedBox( - height: 100, - ) - ], + Positioned( + top: 0, + right: 15, + child: IconButton( + icon: Icon( + DoctorApp.speechtotext, + color: Colors.black, + size: 35, + ), + onPressed: () { + initSpeechState().then((value) => {onVoiceText()}); + }, + ), + ), + ], + ), + SizedBox( + height: 100, + ) + ], + ), + ) + ], + ), + Column( + children: [ + _remarksController.text.isEmpty + ? SizedBox() + : Container( + margin: EdgeInsets.all(5), + child: AppButton( + title: TranslationBase.of(context).clearText, + onPressed: () { + setState(() { + _remarksController.text = ''; + }); + }, + )), + SizedBox( + height: 10, ), - ) - ], - ), - Column( - children: [ - _remarksController.text.isEmpty - ? SizedBox() - : Container( - margin: EdgeInsets.all(5), - child: AppButton( - title: TranslationBase.of(context).clearText, - onPressed: () { - setState(() { - _remarksController.text = ''; - }); - }, - )), - SizedBox( - height: 10, - ), - ], - ), - ], + ], + ), + ], + ), ), ), - ), - bottomSheet: - model.state != ViewState.Idle + bottomSheet: model.state != ViewState.Idle ? Container( - height: 0, - ) - :CustomBottomSheetContainer( - label: "${TranslationBase.of(context).refer}", - onTap: () async { - setState(() { - if (_referTo == null) { - branchError = - TranslationBase.of(context).fieldRequired; - } else { - branchError = null; - } - if (_selectedBranch == null) { - hospitalError = - TranslationBase.of(context).fieldRequired; - } else { - hospitalError = null; - } - if (_selectedClinic == null) { - clinicError = - TranslationBase.of(context).fieldRequired; - } else { - clinicError = null; - } - if (_selectedDoctor == null) { - doctorError = - TranslationBase.of(context).fieldRequired; - } else { - doctorError = null; - } - if (_selectedFrequency == null) { - frequencyError = - TranslationBase.of(context).fieldRequired; - } else { - frequencyError = null; - } - if (_selectedPriority == null) { - remarkError = - TranslationBase.of(context).fieldRequired; - } else { - remarkError = null; - } - }); - if (_selectedFrequency == null || - _selectedPriority == null || - _selectedBranch == null || - _selectedClinic == null || - _selectedDoctor == null || - _remarksController.text == null || - _extController.text == null) return; - { - GifLoaderDialogUtils.showMyDialog(context); - await model.makeInPatientReferral( - patient: patient, - projectID: _selectedBranch['facilityId'], - clinicID: _selectedClinic['ClinicID'], - doctorID: _selectedDoctor['DoctorID'], - frequencyCode: - _selectedFrequency['ParameterCode'], - ext: _extController.text, - remarks: _remarksController.text, - priority: _activePriority, - referralDate: appointmentDate, - isLocalBusy: true); - GifLoaderDialogUtils.hideDialog(context); - if (model.state == ViewState.ErrorLocal) - DrAppToastMsg.showErrorToast(model.error); - else { - DrAppToastMsg.showSuccesToast( - TranslationBase.of(context) - .referralSuccessMsg); - Navigator.pop(context); - } - } - }, - ) - ), + height: 0, + ) + : CustomBottomSheetContainer( + label: "${TranslationBase.of(context).refer}", + onTap: () async { + setState(() { + if (_referTo == null) { + branchError = TranslationBase.of(context).fieldRequired; + } else { + branchError = null; + } + if (_selectedBranch == null) { + hospitalError = TranslationBase.of(context).fieldRequired; + } else { + hospitalError = null; + } + if (_selectedClinic == null) { + clinicError = TranslationBase.of(context).fieldRequired; + } else { + clinicError = null; + } + if (_selectedDoctor == null) { + doctorError = TranslationBase.of(context).fieldRequired; + } else { + doctorError = null; + } + if (_selectedFrequency == null) { + frequencyError = TranslationBase.of(context).fieldRequired; + } else { + frequencyError = null; + } + if (_selectedPriority == null) { + remarkError = TranslationBase.of(context).fieldRequired; + } else { + remarkError = null; + } + }); + if (_selectedFrequency == null || + _selectedPriority == null || + _selectedBranch == null || + _selectedClinic == null || + _selectedDoctor == null || + _remarksController.text == null || + _extController.text == null) return; + { + GifLoaderDialogUtils.showMyDialog(context); + await model.makeInPatientReferral( + patient: patient, + projectID: _selectedBranch['facilityId'], + clinicID: _selectedClinic['ClinicID'], + doctorID: _selectedDoctor['DoctorID'], + frequencyCode: _selectedFrequency['ParameterCode'], + ext: _extController.text, + remarks: _remarksController.text, + priority: _activePriority, + referralDate: appointmentDate, + isLocalBusy: true); + GifLoaderDialogUtils.hideDialog(context); + if (model.state == ViewState.ErrorLocal) + DrAppToastMsg.showErrorToast(model.error); + else { + DrAppToastMsg.showSuccesToast(TranslationBase.of(context).referralSuccessMsg); + Navigator.pop(context); + } + } + }, + )), ); } @@ -666,8 +584,7 @@ class _PatientMakeInPatientReferralScreenState extends State - _PatientMakeReferralScreenState(); + _PatientMakeReferralScreenState createState() => _PatientMakeReferralScreenState(); } class _PatientMakeReferralScreenState extends State { - PatiantInformtion patient; - List referToList; + PatiantInformtion? patient; + List? referToList; dynamic _referTo; dynamic _selectedBranch; dynamic _selectedClinic; dynamic _selectedDoctor; - DateTime appointmentDate; + DateTime? appointmentDate; final _remarksController = TextEditingController(); - String branchError = null; - String hospitalError = null; - String clinicError = null; - String doctorError = null; + String branchError = ''; + String hospitalError = ''; + String clinicError = ''; + String doctorError = ''; @override void initState() { @@ -49,32 +48,26 @@ class _PatientMakeReferralScreenState extends State { @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']; referToList = []; - dynamic sameBranch = { - "id": 1, - "name": TranslationBase.of(context).sameBranch - }; - dynamic otherBranch = { - "id": 2, - "name": TranslationBase.of(context).otherBranch - }; - referToList.add(sameBranch); - referToList.add(otherBranch); + dynamic sameBranch = {"id": 1, "name": TranslationBase.of(context).sameBranch}; + dynamic otherBranch = {"id": 2, "name": TranslationBase.of(context).otherBranch}; + referToList!.add(sameBranch); + referToList!.add(otherBranch); final screenSize = MediaQuery.of(context).size; return BaseView( - onModelReady: (model) => model.getPatientReferral(patient), + onModelReady: (model) => model.getPatientReferral(patient!), builder: (_, model, w) => AppScaffold( baseViewModel: model, appBarTitle: TranslationBase.of(context).referPatient, isShowAppBar: true, - appBar: PatientProfileAppBar(patient), + appBar: PatientProfileAppBar(patient!), body: SingleChildScrollView( child: Container( child: Column( @@ -93,19 +86,9 @@ class _PatientMakeReferralScreenState extends State { model.patientReferral.length == 0 ? referralForm(model, screenSize) : PatientReferralItemWidget( - referralStatus: model - .patientReferral[ - model.patientReferral.length - 1] - .referralStatus, - patientName: model - .patientReferral[ - model.patientReferral.length - 1] - .patientName, - patientGender: model - .patientReferral[ - model.patientReferral.length - 1] - .patientDetails - .gender, + referralStatus: model.patientReferral[model.patientReferral.length - 1].referralStatus!, + patientName: model.patientReferral[model.patientReferral.length - 1].patientName!, + patientGender: model.patientReferral[model.patientReferral.length - 1].patientDetails!.gender!, ///TODO Elham* check this // referredDate: model @@ -118,35 +101,15 @@ class _PatientMakeReferralScreenState extends State { // model.patientReferral.length - 1] // .referredOn // .split(" ")[1], - patientID: - "${model.patientReferral[model.patientReferral.length - 1].patientID}", - isSameBranch: model - .patientReferral[ - model.patientReferral.length - 1] - .isReferralDoctorSameBranch, + patientID: "${model.patientReferral[model.patientReferral.length - 1].patientID}", + isSameBranch: model.patientReferral[model.patientReferral.length - 1].isReferralDoctorSameBranch, isReferral: true, - remark: model - .patientReferral[ - model.patientReferral.length - 1] - .remarksFromSource, - nationality: model - .patientReferral[ - model.patientReferral.length - 1] - .patientDetails - .nationalityName, - nationalityFlag: model - .patientReferral[ - model.patientReferral.length - 1] - .nationalityFlagUrl, - doctorAvatar: model - .patientReferral[ - model.patientReferral.length - 1] - .doctorImageUrl, - referralDoctorName: model - .patientReferral[ - model.patientReferral.length - 1] - .referredByDoctorInfo, - clinicDescription: null, + remark: model.patientReferral[model.patientReferral.length - 1].remarksFromSource!, + nationality: model.patientReferral[model.patientReferral.length - 1].patientDetails!.nationalityName!, + nationalityFlag: model.patientReferral[model.patientReferral.length - 1].nationalityFlagUrl!, + doctorAvatar: model.patientReferral[model.patientReferral.length - 1].doctorImageUrl!, + referralDoctorName: model.patientReferral[model.patientReferral.length - 1].referredByDoctorInfo!, + clinicDescription: "", ), SizedBox( height: 10, @@ -162,46 +125,32 @@ class _PatientMakeReferralScreenState extends State { eventAction: "Submit Refer", ); if (_referTo == null) { - branchError = - TranslationBase.of(context).fieldRequired; + branchError = TranslationBase.of(context).fieldRequired; } else { - branchError = null; + branchError = ""; } if (_selectedBranch == null) { - hospitalError = - TranslationBase.of(context).fieldRequired; + hospitalError = TranslationBase.of(context).fieldRequired; } else { - hospitalError = null; + hospitalError = ""; } 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 (appointmentDate == null || - _selectedBranch == null || - _selectedClinic == null || - _selectedDoctor == null || - _remarksController.text == null) return; + if (appointmentDate == null || _selectedBranch == null || _selectedClinic == null || _selectedDoctor == null || _remarksController.text == null) return; model .makeReferral( - patient, - appointmentDate.toIso8601String(), - _selectedBranch['facilityId'], - _selectedClinic['ClinicID'], - _selectedDoctor['DoctorID'], - _remarksController.text) + patient!, appointmentDate!.toIso8601String(), _selectedBranch['facilityId'], _selectedClinic['ClinicID'], _selectedDoctor['DoctorID'], _remarksController.text) .then((_) { - DrAppToastMsg.showSuccesToast( - TranslationBase.of(context).referralSuccessMsg); + DrAppToastMsg.showSuccesToast(TranslationBase.of(context).referralSuccessMsg); Navigator.pop(context); }); }), @@ -229,7 +178,7 @@ class _PatientMakeReferralScreenState extends State { onClick: referToList != null ? () { ListSelectDialog dialog = ListSelectDialog( - list: referToList, + list: referToList!, attributeName: 'name', attributeValueId: 'id', okText: TranslationBase.of(context).ok, @@ -243,10 +192,7 @@ class _PatientMakeReferralScreenState extends State { _selectedBranch = value; if (_referTo['id'] == 1) { GifLoaderDialogUtils.showMyDialog(context); - await model - .getClinics(_selectedBranch['facilityId']) - .then((_) => - GifLoaderDialogUtils.hideDialog(context)); + await model.getClinics(_selectedBranch['facilityId']).then((_) => GifLoaderDialogUtils.hideDialog(context)); if (model.state == ViewState.ErrorLocal) { DrAppToastMsg.showErrorToast(model.error); } @@ -265,7 +211,7 @@ class _PatientMakeReferralScreenState extends State { }, ); } - : null, + : () {}, ), SizedBox( height: 10, @@ -273,16 +219,11 @@ class _PatientMakeReferralScreenState extends State { AppTextFieldCustom( height: screenSize.height * 0.075, hintText: TranslationBase.of(context).hospital, - dropDownText: _selectedBranch != null - ? _selectedBranch['facilityName'] - : null, + dropDownText: _selectedBranch != null ? _selectedBranch['facilityName'] : null, enabled: false, isTextFieldHasSuffix: true, validationError: hospitalError, - onClick: model.branchesList != null && - model.branchesList.length > 0 && - _referTo != null && - _referTo['id'] == 2 + onClick: model.branchesList != null && model.branchesList.length > 0 && _referTo != null && _referTo['id'] == 2 ? () { ListSelectDialog dialog = ListSelectDialog( list: model.branchesList, @@ -294,10 +235,7 @@ class _PatientMakeReferralScreenState extends State { _selectedClinic = null; _selectedDoctor = null; GifLoaderDialogUtils.showMyDialog(context); - await model - .getClinics(_selectedBranch['facilityId']) - .then((_) => - GifLoaderDialogUtils.hideDialog(context)); + await model.getClinics(_selectedBranch['facilityId']).then((_) => GifLoaderDialogUtils.hideDialog(context)); if (model.state == ViewState.ErrorLocal) { DrAppToastMsg.showErrorToast(model.error); } @@ -311,7 +249,7 @@ class _PatientMakeReferralScreenState extends State { }, ); } - : null, + : () {}, ), SizedBox( height: 10, @@ -319,15 +257,11 @@ class _PatientMakeReferralScreenState extends State { AppTextFieldCustom( height: screenSize.height * 0.075, hintText: TranslationBase.of(context).clinic, - dropDownText: _selectedClinic != null - ? _selectedClinic['ClinicDescription'] - : null, + dropDownText: _selectedClinic != null ? _selectedClinic['ClinicDescription'] : null, enabled: false, isTextFieldHasSuffix: true, validationError: clinicError, - onClick: _selectedBranch != null && - model.clinicsList != null && - model.clinicsList.length > 0 + onClick: _selectedBranch != null && model.clinicsList != null && model.clinicsList.length > 0 ? () { ListSelectDialog dialog = ListSelectDialog( list: model.clinicsList, @@ -340,13 +274,7 @@ class _PatientMakeReferralScreenState extends State { _selectedDoctor = null; _selectedClinic = selectedValue; GifLoaderDialogUtils.showMyDialog(context); - await model - .getClinicDoctors( - patient, - _selectedClinic['ClinicID'], - _selectedBranch['facilityId']) - .then((_) => - GifLoaderDialogUtils.hideDialog(context)); + await model.getClinicDoctors(patient!, _selectedClinic['ClinicID'], _selectedBranch['facilityId']).then((_) => GifLoaderDialogUtils.hideDialog(context)); if (model.state == ViewState.ErrorLocal) { DrAppToastMsg.showErrorToast(model.error); } @@ -360,7 +288,7 @@ class _PatientMakeReferralScreenState extends State { }, ); } - : null, + : () {}, ), SizedBox( height: 10, @@ -368,14 +296,11 @@ class _PatientMakeReferralScreenState extends State { AppTextFieldCustom( height: screenSize.height * 0.075, hintText: TranslationBase.of(context).doctor, - dropDownText: - _selectedDoctor != null ? _selectedDoctor['Name'] : null, + dropDownText: _selectedDoctor != null ? _selectedDoctor['Name'] : null, enabled: false, isTextFieldHasSuffix: true, validationError: doctorError, - onClick: _selectedClinic != null && - model.doctorsList != null && - model.doctorsList.length > 0 + onClick: _selectedClinic != null && model.doctorsList != null && model.doctorsList.length > 0 ? () { ListSelectDialog dialog = ListSelectDialog( list: model.doctorsList, @@ -400,12 +325,9 @@ class _PatientMakeReferralScreenState extends State { } : () { if (_selectedClinic == null) { - DrAppToastMsg.showErrorToast( - "You need to select a clinic first"); - } else if (model.doctorsList == null || - model.doctorsList.length == 0) { - DrAppToastMsg.showErrorToast( - "There is no doctors for this clinic"); + DrAppToastMsg.showErrorToast("You need to select a clinic first"); + } else if (model.doctorsList == null || model.doctorsList.length == 0) { + DrAppToastMsg.showErrorToast("There is no doctors for this clinic"); } }, ), @@ -415,16 +337,16 @@ class _PatientMakeReferralScreenState extends State { AppTextFieldCustom( height: screenSize.height * 0.075, hintText: TranslationBase.of(context).date, - dropDownText: appointmentDate != null - ? "${AppDateUtils.convertDateToFormat(appointmentDate, "yyyy-MM-dd")}" - : null, + dropDownText: appointmentDate != null ? "${AppDateUtils.convertDateToFormat(appointmentDate!, "yyyy-MM-dd")}" : "", enabled: false, isTextFieldHasSuffix: true, suffixIcon: IconButton( - icon: Icon( - Icons.calendar_today, - color: Colors.black, - )), + icon: Icon( + Icons.calendar_today, + color: Colors.black, + ), + onPressed: () {}, + ), onClick: () { _selectDate(context, model); }, @@ -447,7 +369,7 @@ class _PatientMakeReferralScreenState extends State { _selectDate(BuildContext context, PatientReferralViewModel model) async { // https://medium.com/flutter-community/a-deep-dive-into-datepicker-in-flutter-37e84f7d8d6c good reference // https://stackoverflow.com/a/63147062/6246772 to customize a date picker - final DateTime picked = await showDatePicker( + final DateTime? picked = await showDatePicker( context: context, initialDate: appointmentDate, firstDate: DateTime.now().add(Duration(hours: 2)), diff --git a/lib/screens/patients/profile/referral/refer_details/referred-patient-screen.dart b/lib/screens/patients/profile/referral/refer_details/referred-patient-screen.dart index b8f087d0..42e4637f 100644 --- a/lib/screens/patients/profile/referral/refer_details/referred-patient-screen.dart +++ b/lib/screens/patients/profile/referral/refer_details/referred-patient-screen.dart @@ -8,11 +8,11 @@ import 'package:doctor_app_flutter/utils/translations_delegate_base_utils.dart'; import 'package:doctor_app_flutter/widgets/patients/patient-referral-item-widget.dart'; import 'package:doctor_app_flutter/widgets/shared/app_scaffold_widget.dart'; import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart'; +import 'package:doctor_app_flutter/widgets/shared/errors/error_message.dart'; import 'package:doctor_app_flutter/widgets/shared/loader/gif_loader_dialog_utils.dart'; import 'package:doctor_app_flutter/widgets/transitions/fade_page.dart'; import 'package:flutter/material.dart'; import 'package:font_awesome_flutter/font_awesome_flutter.dart'; -import '../../../../../widgets/shared/errors/error_message.dart'; class ReferredPatientScreen extends StatefulWidget { @override @@ -81,31 +81,31 @@ class _ReferredPatientScreenState extends State { child: PatientReferralItemWidget( referralStatus: model .getReferredPatientItem(index) - .referralStatusDesc, + .referralStatusDesc!, referralStatusCode: model .getReferredPatientItem(index) - .referralStatus, + .referralStatus!, patientName: "${model.getReferredPatientItem(index).firstName} ${model.getReferredPatientItem(index).middleName} ${model.getReferredPatientItem(index).lastName}", patientGender: model .getReferredPatientItem(index) - .gender, + .gender!, referredDate: model.state == ViewState.BusyLocal ?"": AppDateUtils.getDayMonthYearDateFormatted( patientType == PatientType.IN_PATIENT? AppDateUtils.getDateTimeFromServerFormat( - model.getReferredPatientItem(index).referralDate, + model.getReferredPatientItem(index).referralDate!, ):AppDateUtils.getDateTimeFromString( - model.getReferredPatientItem(index).referralDate, + model.getReferredPatientItem(index).referralDate!, ), isMonthShort: true ), referredTime:model.state == ViewState.BusyLocal ?"":AppDateUtils.getHour( patientType == PatientType.IN_PATIENT? AppDateUtils.getDateTimeFromServerFormat( - model.getReferredPatientItem(index).referralDate, + model.getReferredPatientItem(index).referralDate!, ):AppDateUtils.getDateTimeFromString( - model.getReferredPatientItem(index).referralDate, + model.getReferredPatientItem(index).referralDate!, ), // isMonthShort: true ), @@ -117,21 +117,21 @@ class _ReferredPatientScreenState extends State { isReferral: false, remark: model .getReferredPatientItem(index) - .referringDoctorRemarks, + .referringDoctorRemarks!, nationality: model .getReferredPatientItem(index) - .nationalityName, + .nationalityName!, nationalityFlag: model .getReferredPatientItem(index) - .nationalityFlagURL, + .nationalityFlagURL!, doctorAvatar: model .getReferredPatientItem(index) - .doctorImageURL, + .doctorImageURL!, referralDoctorName: "${TranslationBase.of(context).dr} ${model.getReferredPatientItem(index).referralDoctorName}", clinicDescription: model .getReferredPatientItem(index) - .referralClinicDescription, + .referralClinicDescription!, infoIcon: Icon(FontAwesomeIcons.arrowRight, size: 25, color: Colors.black), ), @@ -176,10 +176,10 @@ class _PatientTypeRadioWidgetState extends State { title: AppText(TranslationBase.of(context).inPatient), value: PatientType.IN_PATIENT, groupValue: patientType, - onChanged: (PatientType value) { + onChanged: (PatientType? value) { setState(() { - patientType = value; - radioOnChange(value); + patientType = value!; + radioOnChange(value!); }); }, ), @@ -189,10 +189,10 @@ class _PatientTypeRadioWidgetState extends State { title: AppText(TranslationBase.of(context).outpatient), value: PatientType.OUT_PATIENT, groupValue: patientType, - onChanged: (PatientType value) { + onChanged: (PatientType? value) { setState(() { - patientType = value; - radioOnChange(value); + patientType = value!; + radioOnChange(value!); }); }, ), diff --git a/lib/screens/patients/profile/referral/refer_details/referred_patient_detail_in-paint.dart b/lib/screens/patients/profile/referral/refer_details/referred_patient_detail_in-paint.dart index 77a6efbb..bd2ed818 100644 --- a/lib/screens/patients/profile/referral/refer_details/referred_patient_detail_in-paint.dart +++ b/lib/screens/patients/profile/referral/refer_details/referred_patient_detail_in-paint.dart @@ -6,6 +6,7 @@ import 'package:doctor_app_flutter/core/viewModel/patient-referral-viewmodel.dar import 'package:doctor_app_flutter/icons_app/doctor_app_icons.dart'; import 'package:doctor_app_flutter/core/model/patient/my_referral/my_referred_patient_model.dart'; import 'package:doctor_app_flutter/core/model/patient/patiant_info_model.dart'; +import 'package:doctor_app_flutter/routes.dart'; import 'package:doctor_app_flutter/screens/base/base_view.dart'; import 'package:doctor_app_flutter/utils/date-utils.dart'; import 'package:doctor_app_flutter/utils/dr_app_toast_msg.dart'; @@ -15,7 +16,6 @@ import 'package:doctor_app_flutter/widgets/shared/app_scaffold_widget.dart'; import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart'; import 'package:doctor_app_flutter/widgets/shared/buttons/app_buttons_widget.dart'; import 'package:flutter/material.dart'; -import '../../../../../routes.dart'; class ReferredPatientDetailScreen extends StatelessWidget { final MyReferredPatientModel referredPatient; @@ -54,7 +54,7 @@ class ReferredPatientDetailScreen extends StatelessWidget { child: AppText( (Utils.capitalize( "${referredPatient.firstName} ${referredPatient.lastName}")), - fontSize: SizeConfig.textMultiplier * 2.5, + fontSize: SizeConfig.textMultiplier!! * 2.5, fontWeight: FontWeight.bold, fontFamily: 'Poppins', ), @@ -133,8 +133,8 @@ class ReferredPatientDetailScreen extends StatelessWidget { AppText( TranslationBase.of(context).viewProfile, fontWeight: FontWeight.w700, - fontSize: 1.7 * SizeConfig.textMultiplier, - color: Colors.red[700], + fontSize: 1.7 * SizeConfig.textMultiplier!, + color: Colors.red[700]!, ) ], ), @@ -150,23 +150,23 @@ class ReferredPatientDetailScreen extends StatelessWidget { MainAxisAlignment.spaceBetween, children: [ AppText( - referredPatient.referralStatusDesc, + referredPatient.referralStatusDesc!, fontFamily: 'Poppins', - fontSize: 1.9 * SizeConfig.textMultiplier, + fontSize: 1.9 * SizeConfig.textMultiplier!, fontWeight: FontWeight.w700, color: referredPatient.referralStatus == 1 ? AppGlobal.inProgressColor : referredPatient.referralStatus == 46 ? AppGlobal.appGreenColor - : Colors.red[700], + : Colors.red[700]!, ), AppText( AppDateUtils.convertDateFromServerFormat( - referredPatient.referralDate, + referredPatient.referralDate!, "dd MMM,yyyy"), fontFamily: 'Poppins', fontWeight: FontWeight.w600, - fontSize: 2.0 * SizeConfig.textMultiplier, + fontSize: 2.0 * SizeConfig.textMultiplier!, color: Color(0XFF28353E), ) ], @@ -185,7 +185,7 @@ class ReferredPatientDetailScreen extends StatelessWidget { fontFamily: 'Poppins', fontWeight: FontWeight.w600, fontSize: - 1.7 * SizeConfig.textMultiplier, + 1.7 * SizeConfig.textMultiplier!, color: Color(0XFF575757), ), AppText( @@ -199,11 +199,11 @@ class ReferredPatientDetailScreen extends StatelessWidget { ), AppText( AppDateUtils.convertDateFromServerFormat( - referredPatient.referralDate, + referredPatient.referralDate!, "hh:mm a"), fontFamily: 'Poppins', fontWeight: FontWeight.w600, - fontSize: 1.8 * SizeConfig.textMultiplier, + fontSize: 1.8 * SizeConfig.textMultiplier!, color: Color(0XFF575757), ) ], @@ -225,13 +225,13 @@ class ReferredPatientDetailScreen extends StatelessWidget { fontFamily: 'Poppins', fontWeight: FontWeight.w600, fontSize: 1.7 * - SizeConfig.textMultiplier, + SizeConfig.textMultiplier!, color: Color(0XFF575757), ), Expanded( child: AppText( referredPatient - .referralClinicDescription, + .referralClinicDescription!, fontFamily: 'Poppins', fontWeight: FontWeight.w700, fontSize: 13, @@ -256,13 +256,13 @@ class ReferredPatientDetailScreen extends StatelessWidget { fontFamily: 'Poppins', fontWeight: FontWeight.w600, fontSize: 1.7 * - SizeConfig.textMultiplier, + SizeConfig.textMultiplier!, color: Color(0XFF575757), ), Expanded( child: AppText( referredPatient - .frequencyDescription, + .frequencyDescription!, fontFamily: 'Poppins', fontWeight: FontWeight.w700, fontSize: 14, @@ -279,12 +279,12 @@ class ReferredPatientDetailScreen extends StatelessWidget { AppText( referredPatient.nationalityName != null - ? referredPatient.nationalityName + ? referredPatient.nationalityName! : "", fontWeight: FontWeight.bold, color: Color(0xFF2E303A), fontSize: - 1.4 * SizeConfig.textMultiplier, + 1.4 * SizeConfig.textMultiplier!, ), referredPatient.nationalityFlagURL != null @@ -293,13 +293,13 @@ class ReferredPatientDetailScreen extends StatelessWidget { BorderRadius.circular(20.0), child: Image.network( referredPatient - .nationalityFlagURL, + .nationalityFlagURL!, height: 25, width: 30, errorBuilder: (BuildContext context, Object exception, - StackTrace stackTrace) { + StackTrace? stackTrace) { return Text('No Image'); }, )) @@ -320,11 +320,11 @@ class ReferredPatientDetailScreen extends StatelessWidget { fontFamily: 'Poppins', fontWeight: FontWeight.w600, fontSize: - 1.7 * SizeConfig.textMultiplier, + 1.7 * SizeConfig.textMultiplier!, color: Color(0XFF575757), ), AppText( - referredPatient.priorityDescription, + referredPatient.priorityDescription!, fontFamily: 'Poppins', fontWeight: FontWeight.w700, fontSize: 14, @@ -345,7 +345,7 @@ class ReferredPatientDetailScreen extends StatelessWidget { fontFamily: 'Poppins', fontWeight: FontWeight.w600, fontSize: - 1.7 * SizeConfig.textMultiplier, + 1.7 * SizeConfig.textMultiplier!, color: Color(0XFF575757), ), Expanded( @@ -355,13 +355,13 @@ class ReferredPatientDetailScreen extends StatelessWidget { ? AppDateUtils .convertDateFromServerFormat( referredPatient - .mAXResponseTime, + .mAXResponseTime!, "dd MMM,yyyy") : '', fontFamily: 'Poppins', fontWeight: FontWeight.w700, fontSize: - 1.8 * SizeConfig.textMultiplier, + 1.8 * SizeConfig.textMultiplier!, color: Color(0XFF2E303A), ), ), @@ -393,13 +393,13 @@ class ReferredPatientDetailScreen extends StatelessWidget { borderRadius: BorderRadius.circular(20.0), child: Image.network( - referredPatient.doctorImageURL, + referredPatient.doctorImageURL!, height: 25, width: 30, errorBuilder: (BuildContext context, Object exception, - StackTrace stackTrace) { + StackTrace? stackTrace) { return Text('No Image'); }, )) @@ -429,16 +429,16 @@ class ReferredPatientDetailScreen extends StatelessWidget { fontFamily: 'Poppins', fontWeight: FontWeight.w800, fontSize: 1.5 * - SizeConfig.textMultiplier, + SizeConfig.textMultiplier!, color: Colors.black, ), AppText( referredPatient - .referralClinicDescription, + .referralClinicDescription!, fontFamily: 'Poppins', fontWeight: FontWeight.w700, fontSize: 1.3 * - SizeConfig.textMultiplier, + SizeConfig.textMultiplier!, color: Color(0XFF2E303A), ), ], @@ -478,14 +478,14 @@ class ReferredPatientDetailScreen extends StatelessWidget { TranslationBase.of(context).remarks, fontFamily: 'Poppins', fontWeight: FontWeight.w700, - fontSize: 2.4 * SizeConfig.textMultiplier, + fontSize: 2.4 * SizeConfig.textMultiplier!, color: Color(0XFF2E303A), ), AppText( - referredPatient.referringDoctorRemarks, + referredPatient.referringDoctorRemarks!, fontFamily: 'Poppins', fontWeight: FontWeight.w600, - fontSize: 1.8 * SizeConfig.textMultiplier, + fontSize: 1.8 * SizeConfig.textMultiplier!, color: Color(0XFF2E303A), ), SizedBox( @@ -502,12 +502,12 @@ class ReferredPatientDetailScreen extends StatelessWidget { ? ClipRRect( borderRadius: BorderRadius.circular(20.0), child: Image.network( - referredPatient.doctorImageURL, + referredPatient.doctorImageURL!, height: 25, width: 30, errorBuilder: (BuildContext context, Object exception, - StackTrace stackTrace) { + StackTrace? stackTrace) { return Text('No Image'); }, )) @@ -528,22 +528,22 @@ class ReferredPatientDetailScreen extends StatelessWidget { TranslationBase.of(context).reply, fontFamily: 'Poppins', fontWeight: FontWeight.w700, - fontSize: 1.8 * SizeConfig.textMultiplier, + fontSize: 1.8 * SizeConfig.textMultiplier!, color: Color(0XFF2E303A), ), AppText( referredPatient.referredDoctorRemarks == null ? '' - : referredPatient.referredDoctorRemarks + : referredPatient.referredDoctorRemarks! .isNotEmpty ? referredPatient - .referredDoctorRemarks + .referredDoctorRemarks! : TranslationBase.of(context) .notRepliedYet, fontFamily: 'Poppins', fontWeight: FontWeight.w600, - fontSize: 1.6 * SizeConfig.textMultiplier, + fontSize: 1.6 * SizeConfig.textMultiplier!, color: Color(0XFF2E303A), ), ], @@ -561,14 +561,14 @@ class ReferredPatientDetailScreen extends StatelessWidget { margin: EdgeInsets.symmetric(horizontal: 16, vertical: 16), child: AppButton( title: TranslationBase.of(context).acknowledged, - color: Colors.red[700], + color: Colors.red[700]!, fontColor: Colors.white, fontWeight: FontWeight.w700, hPadding: 8, vPadding: 12, disabled: referredPatient.referredDoctorRemarks == null ? true - : referredPatient.referredDoctorRemarks.isNotEmpty + : referredPatient.referredDoctorRemarks!.isNotEmpty ? false : true, onPressed: () async { 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 c5cf13cd..e18c9cb9 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 @@ -22,16 +22,16 @@ import 'package:speech_to_text/speech_recognition_error.dart'; import 'package:speech_to_text/speech_to_text.dart' as stt; class AddReplayOnReferralPatient extends StatefulWidget { - final PatientReferralViewModel patientReferralViewModel; - final MyReferralPatientModel myReferralInPatientModel; - final AddReferredRemarksRequestModel myReferralInPatientRequestModel; + final PatientReferralViewModel? patientReferralViewModel; + final MyReferralPatientModel? myReferralInPatientModel; + final AddReferredRemarksRequestModel? myReferralInPatientRequestModel; final bool isEdited; const AddReplayOnReferralPatient( - {Key key, + {Key? key, this.patientReferralViewModel, this.myReferralInPatientModel, - this.isEdited, + this.isEdited = false, this.myReferralInPatientRequestModel}) : super(key: key); @@ -55,7 +55,7 @@ class _AddReplayOnReferralPatientState requestPermissions(); super.initState(); replayOnReferralController.text = - widget.myReferralInPatientModel.referredDoctorRemarks ?? ""; + widget.myReferralInPatientModel!.referredDoctorRemarks ?? ""; } @override @@ -91,7 +91,7 @@ class _AddReplayOnReferralPatientState .text.isEmpty && isSubmitted ? TranslationBase.of(context).emptyMessage - : null, + : "", ), Positioned( top: 0, @@ -150,14 +150,14 @@ class _AddReplayOnReferralPatientState if (replayOnReferralController.text.isNotEmpty) { GifLoaderDialogUtils.showMyDialog(context); await widget.patientReferralViewModel - .replayReferred( + !.replayReferred( replayOnReferralController.text.trim(), - widget.myReferralInPatientModel, + widget.myReferralInPatientModel!, reject); - if (widget.patientReferralViewModel.state == + if (widget.patientReferralViewModel!.state == ViewState.ErrorLocal) { Utils.showErrorToast( - widget.patientReferralViewModel.error); + widget.patientReferralViewModel!.error); } else { GifLoaderDialogUtils.hideDialog(context); DrAppToastMsg.showSuccesToast( @@ -175,7 +175,7 @@ class _AddReplayOnReferralPatientState }, title: TranslationBase.of(context).reject, fontColor: Colors.white, - color: Colors.red[600], + color: Colors.red[600]!, ), ), SizedBox( @@ -190,14 +190,14 @@ class _AddReplayOnReferralPatientState if (replayOnReferralController.text.isNotEmpty) { GifLoaderDialogUtils.showMyDialog(context); await widget.patientReferralViewModel - .replayReferred( + !.replayReferred( replayOnReferralController.text.trim(), - widget.myReferralInPatientModel, + widget.myReferralInPatientModel!, replay); - if (widget.patientReferralViewModel.state == + if (widget.patientReferralViewModel!.state == ViewState.ErrorLocal) { Utils.showErrorToast( - widget.patientReferralViewModel.error); + widget.patientReferralViewModel!.error); } else { GifLoaderDialogUtils.hideDialog(context); DrAppToastMsg.showSuccesToast( diff --git a/lib/screens/patients/profile/referral/referral_details/my-referral-detail-screen.dart b/lib/screens/patients/profile/referral/referral_details/my-referral-detail-screen.dart index 26cafe90..d91a7a09 100644 --- a/lib/screens/patients/profile/referral/referral_details/my-referral-detail-screen.dart +++ b/lib/screens/patients/profile/referral/referral_details/my-referral-detail-screen.dart @@ -17,10 +17,9 @@ import 'package:flutter/material.dart'; // ignore: must_be_immutable class MyReferralDetailScreen extends StatelessWidget { - final MyReferralPatientModel referralPatient; + final MyReferralPatientModel? referralPatient; - const MyReferralDetailScreen({Key key, this.referralPatient}) - : super(key: key); + const MyReferralDetailScreen({Key? key, this.referralPatient}) : super(key: key); @override Widget build(BuildContext context) { @@ -55,15 +54,13 @@ class MyReferralDetailScreen extends StatelessWidget { ), Expanded( child: AppText( - (Utils.capitalize(referralPatient.firstName + - " " + - referralPatient.lastName)), - fontSize: SizeConfig.textMultiplier * 2.5, + (Utils.capitalize(referralPatient!.firstName! + " " + referralPatient!.lastName!)), + fontSize: SizeConfig.textMultiplier! * 2.5, fontWeight: FontWeight.bold, fontFamily: 'Poppins', ), ), - referralPatient.gender == 1 + referralPatient!.gender == 1 ? Icon( DoctorApp.male_2, color: Colors.blue, @@ -83,9 +80,7 @@ class MyReferralDetailScreen extends StatelessWidget { width: 60, height: 60, child: Image.asset( - referralPatient.gender == 1 - ? 'assets/images/male_avatar.png' - : 'assets/images/female_avatar.png', + referralPatient!.gender == 1 ? 'assets/images/male_avatar.png' : 'assets/images/female_avatar.png', fit: BoxFit.cover, ), ), @@ -97,140 +92,102 @@ class MyReferralDetailScreen extends StatelessWidget { child: Column( children: [ Row( - mainAxisAlignment: - MainAxisAlignment.spaceBetween, + mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ AppText( - referralPatient.referralStatus != null - ? model.getReferralStatusNameByCode( - referralPatient.referralStatus, - context) - : "", + referralPatient!.referralStatus != null ? model.getReferralStatusNameByCode(referralPatient!.referralStatus!, context) : "", fontFamily: 'Poppins', - fontSize: 1.9 * SizeConfig.textMultiplier, + fontSize: 1.9 * SizeConfig.textMultiplier!, fontWeight: FontWeight.w700, - color: referralPatient.referralStatus == 1 + color: referralPatient!.referralStatus == 1 ? AppGlobal.inProgressColor - : referralPatient.referralStatus == - 46 || - referralPatient - .referralStatus == - 2 + : referralPatient!.referralStatus == 46 || referralPatient!.referralStatus == 2 ? AppGlobal.appGreenColor - : Colors.red[700], + : Colors.red[700]!, ), AppText( - AppDateUtils.getDayMonthYearDateFormatted( - referralPatient.referralDate), + AppDateUtils.getDayMonthYearDateFormatted(referralPatient!.referralDate!), fontFamily: 'Poppins', fontWeight: FontWeight.w600, - fontSize: 2.0 * SizeConfig.textMultiplier, + fontSize: 2.0 * SizeConfig.textMultiplier!, color: Color(0XFF28353E), ) ], ), Row( - mainAxisAlignment: - MainAxisAlignment.spaceBetween, + mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ Row( - mainAxisAlignment: - MainAxisAlignment.start, + mainAxisAlignment: MainAxisAlignment.start, children: [ AppText( - TranslationBase.of(context) - .fileNumber, + TranslationBase.of(context).fileNumber, fontFamily: 'Poppins', fontWeight: FontWeight.w600, - fontSize: - 1.7 * SizeConfig.textMultiplier, + fontSize: 1.7 * SizeConfig.textMultiplier!, color: Color(0XFF575757), ), AppText( - "${referralPatient.patientID}", + "${referralPatient!.patientID}", fontFamily: 'Poppins', fontWeight: FontWeight.w700, - fontSize: - 1.8 * SizeConfig.textMultiplier, + fontSize: 1.8 * SizeConfig.textMultiplier!, color: Color(0XFF2E303A), ), ], ), AppText( - AppDateUtils.getTimeHHMMA( - referralPatient.referralDate), + AppDateUtils.getTimeHHMMA(referralPatient!.referralDate!), fontFamily: 'Poppins', fontWeight: FontWeight.w600, - fontSize: 1.8 * SizeConfig.textMultiplier, + fontSize: 1.8 * SizeConfig.textMultiplier!, color: Color(0XFF575757), ) ], ), Row( - mainAxisAlignment: - MainAxisAlignment.spaceBetween, + mainAxisAlignment: MainAxisAlignment.spaceBetween, crossAxisAlignment: CrossAxisAlignment.center, children: [ Expanded( child: Column( children: [ Row( - mainAxisAlignment: - MainAxisAlignment.start, + mainAxisAlignment: MainAxisAlignment.start, children: [ AppText( - TranslationBase.of(context) - .referredFrom, + TranslationBase.of(context).referredFrom, fontFamily: 'Poppins', fontWeight: FontWeight.w600, - fontSize: 1.7 * - SizeConfig.textMultiplier, + fontSize: 1.7 * SizeConfig.textMultiplier!, color: Color(0XFF575757), ), AppText( - referralPatient - .targetProjectId == - referralPatient - .sourceProjectId - ? TranslationBase.of( - context) - .sameBranch - : TranslationBase.of( - context) - .otherBranch, + referralPatient!.targetProjectId == referralPatient!.sourceProjectId ? TranslationBase.of(context).sameBranch : TranslationBase.of(context).otherBranch, fontFamily: 'Poppins', fontWeight: FontWeight.w700, - fontSize: 1.8 * - SizeConfig.textMultiplier, + fontSize: 1.8 * SizeConfig.textMultiplier!, color: Color(0XFF2E303A), ), ], ), Row( - mainAxisAlignment: - MainAxisAlignment.start, - crossAxisAlignment: - CrossAxisAlignment.start, + mainAxisAlignment: MainAxisAlignment.start, + crossAxisAlignment: CrossAxisAlignment.start, children: [ AppText( - TranslationBase.of(context) - .remarks + - " : ", + TranslationBase.of(context).remarks + " : ", fontFamily: 'Poppins', fontWeight: FontWeight.w600, - fontSize: 1.7 * - SizeConfig.textMultiplier, + fontSize: 1.7 * SizeConfig.textMultiplier!, color: Color(0XFF575757), ), Expanded( child: AppText( - referralPatient - .referringDoctorRemarks ?? - '', + referralPatient!.referringDoctorRemarks ?? '', fontFamily: 'Poppins', fontWeight: FontWeight.w700, - fontSize: 1.8 * - SizeConfig.textMultiplier, + fontSize: 1.8 * SizeConfig.textMultiplier!, color: Color(0XFF2E303A), ), ), @@ -242,29 +199,19 @@ class MyReferralDetailScreen extends StatelessWidget { Row( children: [ AppText( - referralPatient.nationalityName != - null - ? referralPatient.nationalityName - : "", + referralPatient!.nationalityName != null ? referralPatient!.nationalityName! : "", fontWeight: FontWeight.bold, color: Color(0xFF2E303A), - fontSize: - 1.4 * SizeConfig.textMultiplier, + fontSize: 1.4 * SizeConfig.textMultiplier!, ), - referralPatient.nationalityFlagURL != - null + referralPatient!.nationalityFlagURL != null ? ClipRRect( - borderRadius: - BorderRadius.circular(20.0), + borderRadius: BorderRadius.circular(20.0), child: Image.network( - referralPatient - .nationalityFlagURL, + referralPatient!.nationalityFlagURL!, height: 25, width: 30, - errorBuilder: (BuildContext - context, - Object exception, - StackTrace stackTrace) { + errorBuilder: (BuildContext context, Object exception, StackTrace? stackTrace) { return Text('No Image'); }, )) @@ -277,8 +224,7 @@ class MyReferralDetailScreen extends StatelessWidget { crossAxisAlignment: CrossAxisAlignment.start, children: [ Container( - margin: - EdgeInsets.only(left: 10, right: 0), + margin: EdgeInsets.only(left: 10, right: 0), child: Image.asset( 'assets/images/patient/ic_ref_arrow_up.png', height: 50, @@ -286,20 +232,14 @@ class MyReferralDetailScreen extends StatelessWidget { ), ), Container( - margin: EdgeInsets.only( - left: 0, - top: 25, - right: 0, - bottom: 0), - padding: EdgeInsets.only( - left: 4.0, right: 4.0), + margin: EdgeInsets.only(left: 0, top: 25, right: 0, bottom: 0), + padding: EdgeInsets.only(left: 4.0, right: 4.0), child: Container( width: 40, height: 40, child: CircleAvatar( radius: 25.0, - backgroundImage: NetworkImage( - referralPatient.doctorImageURL), + backgroundImage: NetworkImage(referralPatient!.doctorImageURL!), backgroundColor: Colors.transparent, ), ), @@ -307,19 +247,14 @@ class MyReferralDetailScreen extends StatelessWidget { Expanded( flex: 4, child: Container( - margin: EdgeInsets.only( - left: 10, - top: 25, - right: 10, - bottom: 0), + margin: EdgeInsets.only(left: 10, top: 25, right: 10, bottom: 0), child: Column( children: [ AppText( - referralPatient.doctorName, + referralPatient!.doctorName!, fontFamily: 'Poppins', fontWeight: FontWeight.w700, - fontSize: 1.7 * - SizeConfig.textMultiplier, + fontSize: 1.7 * SizeConfig.textMultiplier!, color: Color(0XFF2E303A), ), ], @@ -350,12 +285,11 @@ class MyReferralDetailScreen extends StatelessWidget { padding: const EdgeInsets.symmetric(horizontal: 16), child: SizedBox( child: ProfileMedicalInfoWidgetSearch( - patient: model - .getPatientFromReferralO(referralPatient), + patient: model.getPatientFromReferralO(referralPatient!), patientType: "7", isInpatient: false, - from: null, - to: null, + from: "", + to: "", ), ), ), @@ -364,7 +298,7 @@ class MyReferralDetailScreen extends StatelessWidget { ), ), ), - if (referralPatient.referralStatus == 1) + if (referralPatient!.referralStatus == 1) Container( margin: EdgeInsets.symmetric(horizontal: 16, vertical: 16), child: Row( @@ -378,13 +312,11 @@ class MyReferralDetailScreen extends StatelessWidget { vPadding: 12, disabled: model.state == ViewState.Busy, onPressed: () async { - await model.responseReferral(referralPatient, true); + await model.responseReferral(referralPatient!, true); if (model.state == ViewState.ErrorLocal) { DrAppToastMsg.showErrorToast(model.error); } else { - DrAppToastMsg.showSuccesToast( - TranslationBase.of(context) - .referralSuccessMsgAccept); + DrAppToastMsg.showSuccesToast(TranslationBase.of(context).referralSuccessMsgAccept); model.getMyReferralOutPatientService(); Navigator.pop(context); Navigator.pop(context); @@ -404,14 +336,11 @@ class MyReferralDetailScreen extends StatelessWidget { vPadding: 12, disabled: model.state == ViewState.Busy, onPressed: () async { - await model.responseReferral( - referralPatient, false); + await model.responseReferral(referralPatient!, false); if (model.state == ViewState.ErrorLocal) { DrAppToastMsg.showErrorToast(model.error); } else { - DrAppToastMsg.showSuccesToast( - TranslationBase.of(context) - .referralSuccessMsgReject); + DrAppToastMsg.showSuccesToast(TranslationBase.of(context).referralSuccessMsgReject); model.getMyReferralOutPatientService(); Navigator.pop(context); Navigator.pop(context); diff --git a/lib/screens/patients/profile/referral/referral_details/my-referral-inpatient-screen.dart b/lib/screens/patients/profile/referral/referral_details/my-referral-inpatient-screen.dart index 0e22ab25..a9c306c8 100644 --- a/lib/screens/patients/profile/referral/referral_details/my-referral-inpatient-screen.dart +++ b/lib/screens/patients/profile/referral/referral_details/my-referral-inpatient-screen.dart @@ -8,16 +8,15 @@ import 'package:doctor_app_flutter/utils/date-utils.dart'; import 'package:doctor_app_flutter/utils/translations_delegate_base_utils.dart'; import 'package:doctor_app_flutter/widgets/patients/patient-referral-item-widget.dart'; import 'package:doctor_app_flutter/widgets/shared/app_scaffold_widget.dart'; +import 'package:doctor_app_flutter/widgets/shared/errors/error_message.dart'; import 'package:doctor_app_flutter/widgets/shared/loader/gif_loader_dialog_utils.dart'; import 'package:doctor_app_flutter/widgets/transitions/fade_page.dart'; import 'package:flutter/material.dart'; import 'package:font_awesome_flutter/font_awesome_flutter.dart'; -import '../../../../../widgets/shared/errors/error_message.dart'; class MyReferralInPatientScreen extends StatefulWidget { @override - _MyReferralInPatientScreenState createState() => - _MyReferralInPatientScreenState(); + _MyReferralInPatientScreenState createState() => _MyReferralInPatientScreenState(); } class _MyReferralInPatientScreenState extends State { @@ -45,8 +44,7 @@ class _MyReferralInPatientScreenState extends State { if (patientType == PatientType.IN_PATIENT) { await model.getMyReferralPatientService(localBusy: true); } else { - await model.getMyReferralOutPatientService( - localBusy: true); + await model.getMyReferralOutPatientService(localBusy: true); } GifLoaderDialogUtils.hideDialog(context); }, @@ -73,78 +71,41 @@ class _MyReferralInPatientScreenState extends State { itemBuilder: (context, index) { return InkWell( onTap: () { - if (patientType == - PatientType.OUT_PATIENT) { + if (patientType == PatientType.OUT_PATIENT) { Navigator.push( context, FadePage( - page: MyReferralDetailScreen( - referralPatient: - model.myReferralPatients[ - index]), + page: MyReferralDetailScreen(referralPatient: model.myReferralPatients[index]), ), ); } else { Navigator.push( context, FadePage( - page: ReferralPatientDetailScreen( - model.myReferralPatients[ - index], - model), + page: ReferralPatientDetailScreen(model.myReferralPatients[index], model), ), ); } }, child: PatientReferralItemWidget( - referralStatus: - model.getReferralStatusNameByCode( - model.myReferralPatients[index] - .referralStatus, - context), - referralStatusCode: model - .myReferralPatients[index] - .referralStatus, - patientName: model - .myReferralPatients[index] - .patientName, - patientGender: model - .myReferralPatients[index].gender, - referredDate: AppDateUtils - .getDayMonthYearDateFormatted(model - .myReferralPatients[index] - .referralDate), - referredTime: AppDateUtils.getTimeHHMMA( - model.myReferralPatients[index] - .referralDate), - patientID: - "${model.myReferralPatients[index].patientID}", + referralStatus: model.getReferralStatusNameByCode(model.myReferralPatients[index].referralStatus!, context), + referralStatusCode: model.myReferralPatients[index].referralStatus!, + patientName: model.myReferralPatients[index].patientName, + patientGender: model.myReferralPatients[index].gender!, + referredDate: AppDateUtils.getDayMonthYearDateFormatted(model.myReferralPatients[index].referralDate!), + referredTime: AppDateUtils.getTimeHHMMA(model.myReferralPatients[index].referralDate!), + patientID: "${model.myReferralPatients[index].patientID}", isSameBranch: false, isReferral: true, isReferralClinic: true, - referralClinic: - "${model.myReferralPatients[index].referringClinicDescription}", - remark: model.myReferralPatients[index] - .referringDoctorRemarks, - nationality: model - .myReferralPatients[index] - .nationalityName, - nationalityFlag: model - .myReferralPatients[index] - .nationalityFlagURL, - doctorAvatar: model - .myReferralPatients[index] - .doctorImageURL, - referralDoctorName: model - .myReferralPatients[index] - .referringDoctorName, - clinicDescription: model - .myReferralPatients[index] - .referringClinicDescription, - infoIcon: Icon( - FontAwesomeIcons.arrowRight, - size: 25, - color: Colors.black), + referralClinic: "${model.myReferralPatients[index].referringClinicDescription}", + remark: model.myReferralPatients[index].referringDoctorRemarks!, + nationality: model.myReferralPatients[index].nationalityName!, + nationalityFlag: model.myReferralPatients[index].nationalityFlagURL!, + doctorAvatar: model.myReferralPatients[index].doctorImageURL!, + referralDoctorName: model.myReferralPatients[index].referringDoctorName!, + clinicDescription: model.myReferralPatients[index].referringClinicDescription!, + infoIcon: Icon(FontAwesomeIcons.arrowRight, size: 25, color: Colors.black), ), ); }) diff --git a/lib/screens/patients/profile/referral/referral_details/patient_referral_screen.dart b/lib/screens/patients/profile/referral/referral_details/patient_referral_screen.dart index e606c1bc..0e69d2e5 100644 --- a/lib/screens/patients/profile/referral/referral_details/patient_referral_screen.dart +++ b/lib/screens/patients/profile/referral/referral_details/patient_referral_screen.dart @@ -1,5 +1,6 @@ import 'dart:ui'; import 'package:doctor_app_flutter/core/viewModel/project_view_model.dart'; +import 'package:doctor_app_flutter/screens/patients/ReferralDischargedPatientPage.dart'; import 'package:doctor_app_flutter/screens/patients/patient_search/patient_search_header.dart'; import 'package:doctor_app_flutter/screens/patients/profile/referral/refer_details/referred-patient-screen.dart'; import 'package:doctor_app_flutter/utils/tab_utils.dart'; @@ -8,7 +9,6 @@ import 'package:doctor_app_flutter/widgets/shared/app_scaffold_widget.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:provider/provider.dart'; -import '../../../ReferralDischargedPatientPage.dart'; import 'my-referral-inpatient-screen.dart'; class PatientReferralScreen extends StatefulWidget { @@ -18,26 +18,26 @@ class PatientReferralScreen extends StatefulWidget { class _PatientReferralScreen extends State with SingleTickerProviderStateMixin { - TabController _tabController; + TabController? _tabController; int index = 0; @override void initState() { super.initState(); _tabController = TabController(length: 3, vsync: this); - _tabController.addListener(_handleTabSelection); + _tabController!.addListener(_handleTabSelection); } _handleTabSelection() { setState(() { - index = _tabController.index; + index = _tabController!.index; }); } @override void dispose() { super.dispose(); - _tabController.dispose(); + _tabController!.dispose(); } @override diff --git a/lib/screens/patients/profile/referral/referral_details/referral_patient_detail_in-paint.dart b/lib/screens/patients/profile/referral/referral_details/referral_patient_detail_in-paint.dart index b901056e..97ab938e 100644 --- a/lib/screens/patients/profile/referral/referral_details/referral_patient_detail_in-paint.dart +++ b/lib/screens/patients/profile/referral/referral_details/referral_patient_detail_in-paint.dart @@ -23,8 +23,7 @@ class ReferralPatientDetailScreen extends StatelessWidget { final MyReferralPatientModel referredPatient; final PatientReferralViewModel patientReferralViewModel; - ReferralPatientDetailScreen( - this.referredPatient, this.patientReferralViewModel); + ReferralPatientDetailScreen(this.referredPatient, this.patientReferralViewModel); @override Widget build(BuildContext context) { @@ -55,9 +54,8 @@ class ReferralPatientDetailScreen extends StatelessWidget { ), Expanded( child: AppText( - (Utils.capitalize( - "${referredPatient.firstName} ${referredPatient.lastName}")), - fontSize: SizeConfig.textMultiplier * 2.5, + (Utils.capitalize("${referredPatient.firstName} ${referredPatient.lastName}")), + fontSize: SizeConfig.textMultiplier! * 2.5, fontWeight: FontWeight.bold, fontFamily: 'Poppins', ), @@ -73,18 +71,14 @@ class ReferralPatientDetailScreen extends StatelessWidget { ), InkWell( onTap: () { - PatiantInformtion patient = model - .getPatientFromReferralO(referredPatient); - Navigator.of(context) - .pushNamed(PATIENTS_PROFILE, arguments: { + PatiantInformtion patient = model.getPatientFromReferralO(referredPatient); + Navigator.of(context).pushNamed(PATIENTS_PROFILE, arguments: { "patient": patient, "patientType": "1", "isInpatient": true, "arrivalType": "1", - "from": AppDateUtils.convertDateToFormat( - DateTime.now(), 'yyyy-MM-dd'), - "to": AppDateUtils.convertDateToFormat( - DateTime.now(), 'yyyy-MM-dd'), + "from": AppDateUtils.convertDateToFormat(DateTime.now(), 'yyyy-MM-dd'), + "to": AppDateUtils.convertDateToFormat(DateTime.now(), 'yyyy-MM-dd'), }); }, child: Icon( @@ -101,18 +95,14 @@ class ReferralPatientDetailScreen extends StatelessWidget { children: [ InkWell( onTap: () { - PatiantInformtion patient = model - .getPatientFromReferralO(referredPatient); - Navigator.of(context) - .pushNamed(PATIENTS_PROFILE, arguments: { + PatiantInformtion patient = model.getPatientFromReferralO(referredPatient); + Navigator.of(context).pushNamed(PATIENTS_PROFILE, arguments: { "patient": patient, "patientType": "1", "isInpatient": true, "arrivalType": "1", - "from": AppDateUtils.convertDateToFormat( - DateTime.now(), 'yyyy-MM-dd'), - "to": AppDateUtils.convertDateToFormat( - DateTime.now(), 'yyyy-MM-dd'), + "from": AppDateUtils.convertDateToFormat(DateTime.now(), 'yyyy-MM-dd'), + "to": AppDateUtils.convertDateToFormat(DateTime.now(), 'yyyy-MM-dd'), }); }, child: Padding( @@ -121,9 +111,7 @@ class ReferralPatientDetailScreen extends StatelessWidget { width: 60, height: 60, child: Image.asset( - referredPatient.gender == 1 - ? 'assets/images/male_avatar.png' - : 'assets/images/female_avatar.png', + referredPatient.gender == 1 ? 'assets/images/male_avatar.png' : 'assets/images/female_avatar.png', fit: BoxFit.cover, ), ), @@ -135,8 +123,8 @@ class ReferralPatientDetailScreen extends StatelessWidget { AppText( TranslationBase.of(context).viewProfile, fontWeight: FontWeight.w700, - fontSize: 1.7 * SizeConfig.textMultiplier, - color: Colors.red[700], + fontSize: 1.7 * SizeConfig.textMultiplier!, + color: Colors.red[700]!, ) ], ), @@ -147,103 +135,87 @@ class ReferralPatientDetailScreen extends StatelessWidget { child: Column( children: [ Row( - mainAxisAlignment: - MainAxisAlignment.spaceBetween, + mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ AppText( - "${model.getReferralStatusNameByCode(referredPatient.referralStatus, context)}", + "${model.getReferralStatusNameByCode(referredPatient.referralStatus!, context)}", fontFamily: 'Poppins', - fontSize: 1.7 * SizeConfig.textMultiplier, + fontSize: 1.7 * SizeConfig.textMultiplier!, fontWeight: FontWeight.w700, color: referredPatient.referralStatus == 1 ? AppGlobal.inProgressColor - : referredPatient.referralStatus == - 46 || - referredPatient - .referralStatus == - 2 + : referredPatient.referralStatus == 46 || referredPatient.referralStatus == 2 ? AppGlobal.appGreenColor - : Colors.red[700], + : Colors.red[700]!, ), AppText( AppDateUtils.getDayMonthYearDateFormatted( - referredPatient.referralDate, + referredPatient.referralDate!, ), fontFamily: 'Poppins', fontWeight: FontWeight.w600, - fontSize: 1.8 * SizeConfig.textMultiplier, + fontSize: 1.8 * SizeConfig.textMultiplier!, color: Color(0XFF28353E), ) ], ), Row( - mainAxisAlignment: - MainAxisAlignment.spaceBetween, + mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ Row( - mainAxisAlignment: - MainAxisAlignment.start, + mainAxisAlignment: MainAxisAlignment.start, children: [ AppText( - TranslationBase.of(context) - .fileNumber, + TranslationBase.of(context).fileNumber, fontFamily: 'Poppins', fontWeight: FontWeight.w600, - fontSize: - 1.5 * SizeConfig.textMultiplier, + fontSize: 1.5 * SizeConfig.textMultiplier!, color: Color(0XFF575757), ), AppText( "${referredPatient.patientID}", fontFamily: 'Poppins', fontWeight: FontWeight.w700, - fontSize: - 1.6 * SizeConfig.textMultiplier, + fontSize: 1.6 * SizeConfig.textMultiplier!, color: Color(0XFF2E303A), ), ], ), AppText( AppDateUtils.getTimeHHMMA( - referredPatient.referralDate, + referredPatient.referralDate!, ), fontFamily: 'Poppins', fontWeight: FontWeight.w600, - fontSize: 1.6 * SizeConfig.textMultiplier, + fontSize: 1.6 * SizeConfig.textMultiplier!, color: Color(0XFF575757), ) ], ), Row( - mainAxisAlignment: - MainAxisAlignment.spaceBetween, + mainAxisAlignment: MainAxisAlignment.spaceBetween, crossAxisAlignment: CrossAxisAlignment.center, children: [ Expanded( child: Column( children: [ Row( - mainAxisAlignment: - MainAxisAlignment.start, - crossAxisAlignment: - CrossAxisAlignment.start, + mainAxisAlignment: MainAxisAlignment.start, + crossAxisAlignment: CrossAxisAlignment.start, children: [ AppText( "${TranslationBase.of(context).refClinic}: ", fontFamily: 'Poppins', fontWeight: FontWeight.w600, - fontSize: 1.5 * - SizeConfig.textMultiplier, + fontSize: 1.5 * SizeConfig.textMultiplier!, color: Color(0XFF575757), ), Expanded( child: AppText( - referredPatient - .referringClinicDescription, + referredPatient.referringClinicDescription!, fontFamily: 'Poppins', fontWeight: FontWeight.w700, - fontSize: 1.6 * - SizeConfig.textMultiplier, + fontSize: 1.6 * SizeConfig.textMultiplier!, color: Color(0XFF2E303A), ), ), @@ -251,31 +223,22 @@ class ReferralPatientDetailScreen extends StatelessWidget { ), if (referredPatient.frequency != null) Row( - mainAxisAlignment: - MainAxisAlignment.start, - crossAxisAlignment: - CrossAxisAlignment.start, + mainAxisAlignment: MainAxisAlignment.start, + crossAxisAlignment: CrossAxisAlignment.start, children: [ AppText( - TranslationBase.of(context) - .frequency + - ": ", + TranslationBase.of(context).frequency + ": ", fontFamily: 'Poppins', fontWeight: FontWeight.w600, - fontSize: 1.5 * - SizeConfig.textMultiplier, + fontSize: 1.5 * SizeConfig.textMultiplier!, color: Color(0XFF575757), ), Expanded( child: AppText( - referredPatient - .frequencyDescription ?? - '', + referredPatient.frequencyDescription ?? '', fontFamily: 'Poppins', fontWeight: FontWeight.w700, - fontSize: 1.6 * - SizeConfig - .textMultiplier, + fontSize: 1.6 * SizeConfig.textMultiplier!, color: Color(0XFF2E303A), ), ), @@ -287,29 +250,19 @@ class ReferralPatientDetailScreen extends StatelessWidget { Row( children: [ AppText( - referredPatient.nationalityName != - null - ? referredPatient.nationalityName - : "", + referredPatient.nationalityName != null ? referredPatient.nationalityName! : "", fontWeight: FontWeight.bold, color: Color(0xFF2E303A), - fontSize: - 1.4 * SizeConfig.textMultiplier, + fontSize: 1.4 * SizeConfig.textMultiplier!, ), - referredPatient.nationalityFlagURL != - null + referredPatient.nationalityFlagURL != null ? ClipRRect( - borderRadius: - BorderRadius.circular(20.0), + borderRadius: BorderRadius.circular(20.0), child: Image.network( - referredPatient - .nationalityFlagURL, + referredPatient.nationalityFlagURL!, height: 25, width: 30, - errorBuilder: (BuildContext - context, - Object exception, - StackTrace stackTrace) { + errorBuilder: (BuildContext context, Object exception, StackTrace? stackTrace) { return Text('No Image'); }, )) @@ -321,26 +274,21 @@ class ReferralPatientDetailScreen extends StatelessWidget { if (referredPatient.priorityDescription != null) Row( mainAxisAlignment: MainAxisAlignment.start, - crossAxisAlignment: - CrossAxisAlignment.start, + crossAxisAlignment: CrossAxisAlignment.start, children: [ AppText( - TranslationBase.of(context).priority + - ": ", + TranslationBase.of(context).priority + ": ", fontFamily: 'Poppins', fontWeight: FontWeight.w600, - fontSize: - 1.5 * SizeConfig.textMultiplier, + fontSize: 1.5 * SizeConfig.textMultiplier!, color: Color(0XFF575757), ), Expanded( child: AppText( - referredPatient.priorityDescription ?? - '', + referredPatient.priorityDescription ?? '', fontFamily: 'Poppins', fontWeight: FontWeight.w700, - fontSize: - 1.6 * SizeConfig.textMultiplier, + fontSize: 1.6 * SizeConfig.textMultiplier!, color: Color(0XFF2E303A), ), ), @@ -349,33 +297,21 @@ class ReferralPatientDetailScreen extends StatelessWidget { if (referredPatient.mAXResponseTime != null) Row( mainAxisAlignment: MainAxisAlignment.start, - crossAxisAlignment: - CrossAxisAlignment.start, + crossAxisAlignment: CrossAxisAlignment.start, children: [ AppText( - TranslationBase.of(context) - .maxResponseTime + - ": ", + TranslationBase.of(context).maxResponseTime + ": ", fontFamily: 'Poppins', fontWeight: FontWeight.w600, - fontSize: - 1.5 * SizeConfig.textMultiplier, + fontSize: 1.5 * SizeConfig.textMultiplier!, color: Color(0XFF575757), ), Expanded( child: AppText( - referredPatient.mAXResponseTime != - null - ? AppDateUtils - .convertDateFromServerFormat( - referredPatient - .mAXResponseTime, - "dd MMM,yyyy") - : '', + referredPatient.mAXResponseTime != null ? AppDateUtils.convertDateFromServerFormat(referredPatient.mAXResponseTime!, "dd MMM,yyyy") : '', fontFamily: 'Poppins', fontWeight: FontWeight.w700, - fontSize: - 1.6 * SizeConfig.textMultiplier, + fontSize: 1.6 * SizeConfig.textMultiplier!, color: Color(0XFF2E303A), ), ), @@ -385,8 +321,7 @@ class ReferralPatientDetailScreen extends StatelessWidget { crossAxisAlignment: CrossAxisAlignment.start, children: [ Container( - margin: - EdgeInsets.only(left: 10, right: 0), + margin: EdgeInsets.only(left: 10, right: 0), child: Image.asset( 'assets/images/patient/ic_ref_arrow_up.png', height: 50, @@ -394,34 +329,22 @@ class ReferralPatientDetailScreen extends StatelessWidget { ), ), Container( - margin: EdgeInsets.only( - left: 0, - top: 25, - right: 0, - bottom: 0), - padding: EdgeInsets.only( - left: 4.0, right: 4.0), - child: referredPatient.doctorImageURL != - null + margin: EdgeInsets.only(left: 0, top: 25, right: 0, bottom: 0), + padding: EdgeInsets.only(left: 4.0, right: 4.0), + child: referredPatient.doctorImageURL != null ? ClipRRect( - borderRadius: - BorderRadius.circular(20.0), + borderRadius: BorderRadius.circular(20.0), child: Image.network( - referredPatient.doctorImageURL, + referredPatient.doctorImageURL!, height: 25, width: 30, - errorBuilder: - (BuildContext context, - Object exception, - StackTrace stackTrace) { + errorBuilder: (BuildContext context, Object exception, StackTrace? stackTrace) { return Text(''); }, )) : Container( child: Image.asset( - referredPatient.gender == 1 - ? 'assets/images/male_avatar.png' - : 'assets/images/female_avatar.png', + referredPatient.gender == 1 ? 'assets/images/male_avatar.png' : 'assets/images/female_avatar.png', fit: BoxFit.cover, ), ), @@ -429,30 +352,22 @@ class ReferralPatientDetailScreen extends StatelessWidget { Expanded( flex: 4, child: Container( - margin: EdgeInsets.only( - left: 10, - top: 30, - right: 10, - bottom: 0), + margin: EdgeInsets.only(left: 10, top: 30, right: 10, bottom: 0), child: Column( - crossAxisAlignment: - CrossAxisAlignment.start, + crossAxisAlignment: CrossAxisAlignment.start, children: [ AppText( "${TranslationBase.of(context).dr} ${referredPatient.referringDoctorName}", fontFamily: 'Poppins', fontWeight: FontWeight.w800, - fontSize: 1.5 * - SizeConfig.textMultiplier, + fontSize: 1.5 * SizeConfig.textMultiplier!, color: Colors.black, ), AppText( - referredPatient - .referringClinicDescription, + referredPatient.referringClinicDescription!, fontFamily: 'Poppins', fontWeight: FontWeight.w700, - fontSize: 1.3 * - SizeConfig.textMultiplier, + fontSize: 1.3 * SizeConfig.textMultiplier!, color: Color(0XFF2E303A), ), ], @@ -476,10 +391,8 @@ class ReferralPatientDetailScreen extends StatelessWidget { children: [ Container( width: double.infinity, - margin: - EdgeInsets.symmetric(horizontal: 16, vertical: 16), - padding: - EdgeInsets.symmetric(horizontal: 16, vertical: 16), + margin: EdgeInsets.symmetric(horizontal: 16, vertical: 16), + padding: EdgeInsets.symmetric(horizontal: 16, vertical: 16), decoration: BoxDecoration( color: Colors.white, shape: BoxShape.rectangle, @@ -496,14 +409,14 @@ class ReferralPatientDetailScreen extends StatelessWidget { TranslationBase.of(context).remarks, fontFamily: 'Poppins', fontWeight: FontWeight.w700, - fontSize: 2.4 * SizeConfig.textMultiplier, + fontSize: 2.4 * SizeConfig.textMultiplier!, color: Color(0XFF2E303A), ), AppText( referredPatient.referringDoctorRemarks ?? '', fontFamily: 'Poppins', fontWeight: FontWeight.w600, - fontSize: 1.8 * SizeConfig.textMultiplier, + fontSize: 1.8 * SizeConfig.textMultiplier!, color: Color(0XFF2E303A), ), SizedBox( @@ -512,14 +425,11 @@ class ReferralPatientDetailScreen extends StatelessWidget { ], ), ), - if (referredPatient.referredDoctorRemarks != null && - referredPatient.referredDoctorRemarks.isNotEmpty) + if (referredPatient.referredDoctorRemarks != null && referredPatient.referredDoctorRemarks!.isNotEmpty) Container( width: double.infinity, - margin: - EdgeInsets.symmetric(horizontal: 16, vertical: 0), - padding: EdgeInsets.symmetric( - horizontal: 16, vertical: 16), + margin: EdgeInsets.symmetric(horizontal: 16, vertical: 0), + padding: EdgeInsets.symmetric(horizontal: 16, vertical: 16), decoration: BoxDecoration( color: Colors.white, shape: BoxShape.rectangle, @@ -536,14 +446,14 @@ class ReferralPatientDetailScreen extends StatelessWidget { TranslationBase.of(context).reply, fontFamily: 'Poppins', fontWeight: FontWeight.w700, - fontSize: 2.4 * SizeConfig.textMultiplier, + fontSize: 2.4 * SizeConfig.textMultiplier!, color: Color(0XFF2E303A), ), AppText( referredPatient.referredDoctorRemarks ?? '', fontFamily: 'Poppins', fontWeight: FontWeight.w600, - fontSize: 1.8 * SizeConfig.textMultiplier, + fontSize: 1.8 * SizeConfig.textMultiplier!, color: Color(0XFF2E303A), ), SizedBox( @@ -561,7 +471,7 @@ class ReferralPatientDetailScreen extends StatelessWidget { margin: EdgeInsets.symmetric(horizontal: 16, vertical: 16), child: AppButton( title: TranslationBase.of(context).replay, - color: Colors.red[700], + color: Colors.red[700]!, fontColor: Colors.white, fontWeight: FontWeight.w700, hPadding: 8, @@ -577,10 +487,7 @@ class ReferralPatientDetailScreen extends StatelessWidget { widget: AddReplayOnReferralPatient( patientReferralViewModel: patientReferralViewModel, myReferralInPatientModel: referredPatient, - isEdited: - referredPatient.referredDoctorRemarks != null && - referredPatient - .referredDoctorRemarks.isNotEmpty, + isEdited: referredPatient.referredDoctorRemarks != null && referredPatient.referredDoctorRemarks!.isNotEmpty, ), ), ); 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 036109b0..44371a88 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 @@ -26,20 +26,13 @@ import 'package:flutter/material.dart'; import 'package:provider/provider.dart'; class AddAssessmentDetails extends StatefulWidget { - final MySelectedAssessment mySelectedAssessment; - final List mySelectedAssessmentList; - final Function(MySelectedAssessment mySelectedAssessment, bool isUpdate) - addSelectedAssessment; - final PatiantInformtion patientInfo; + final MySelectedAssessment? mySelectedAssessment; + final List? mySelectedAssessmentList; + final Function(MySelectedAssessment mySelectedAssessment, bool isUpdate)? addSelectedAssessment; + final PatiantInformtion? patientInfo; final bool isUpdate; - AddAssessmentDetails( - {Key key, - this.mySelectedAssessment, - this.addSelectedAssessment, - this.patientInfo, - this.isUpdate = false, - this.mySelectedAssessmentList}); + AddAssessmentDetails({Key? key, this.mySelectedAssessment, this.addSelectedAssessment, this.patientInfo, this.isUpdate = false, this.mySelectedAssessmentList}); @override _AddAssessmentDetailsState createState() => _AddAssessmentDetailsState(); @@ -52,56 +45,36 @@ class _AddAssessmentDetailsState extends State { TextEditingController typeController = TextEditingController(); TextEditingController icdNameController = TextEditingController(); - GlobalKey key = new GlobalKey>(); + GlobalKey> key = GlobalKey>(); bool isFormSubmitted = false; @override Widget build(BuildContext context) { ProjectViewModel projectViewModel = Provider.of(context); - remarkController.text = widget.mySelectedAssessment.remark ?? ""; - appointmentIdController.text = - widget.mySelectedAssessment.appointmentId.toString(); + remarkController.text = widget.mySelectedAssessment!.remark ?? ""; + appointmentIdController.text = widget.mySelectedAssessment!.appointmentId.toString(); if (widget.isUpdate) { - if (widget.mySelectedAssessment.selectedDiagnosisCondition != null) - conditionController.text = projectViewModel.isArabic - ? widget.mySelectedAssessment.selectedDiagnosisCondition.nameAr - : widget.mySelectedAssessment.selectedDiagnosisCondition.nameEn; - if (widget.mySelectedAssessment.selectedDiagnosisType != null) - typeController.text = projectViewModel.isArabic - ? widget.mySelectedAssessment.selectedDiagnosisType.nameAr - : widget.mySelectedAssessment.selectedDiagnosisType.nameEn; - if (widget.mySelectedAssessment.selectedICD != null) - icdNameController.text = widget.mySelectedAssessment.selectedICD.code; + if (widget.mySelectedAssessment!.selectedDiagnosisCondition != null) + conditionController.text = projectViewModel.isArabic ? widget.mySelectedAssessment!.selectedDiagnosisCondition!.nameAr! : widget.mySelectedAssessment!.selectedDiagnosisCondition!.nameEn!; + if (widget.mySelectedAssessment!.selectedDiagnosisType != null) + typeController.text = projectViewModel.isArabic ? widget.mySelectedAssessment!.selectedDiagnosisType!.nameAr! : widget.mySelectedAssessment!.selectedDiagnosisType!.nameEn!; + if (widget.mySelectedAssessment!.selectedICD != null) icdNameController.text = widget.mySelectedAssessment!.selectedICD!.code; } - InputDecoration textFieldSelectorDecoration( - String hintText, String selectedText, bool isDropDown, - {IconData icon, String validationError}) { + InputDecoration textFieldSelectorDecoration(String hintText, String selectedText, bool isDropDown, {IconData? icon, String? validationError}) { return new InputDecoration( fillColor: Colors.white, contentPadding: EdgeInsets.symmetric(vertical: 15, horizontal: 10), focusedBorder: OutlineInputBorder( - borderSide: BorderSide( - color: (validationError != null - ? Colors.red.shade700 - : Color(0xFFEFEFEF)), - width: 2.5), + borderSide: BorderSide(color: (validationError != null ? Colors.red.shade700 : Color(0xFFEFEFEF)), width: 2.5), borderRadius: BorderRadius.circular(8), ), enabledBorder: OutlineInputBorder( - borderSide: BorderSide( - color: (validationError != null - ? Colors.red.shade700 - : Color(0xFFEFEFEF)), - width: 2.5), + borderSide: BorderSide(color: (validationError != null ? Colors.red.shade700 : Color(0xFFEFEFEF)), width: 2.5), borderRadius: BorderRadius.circular(8), ), disabledBorder: OutlineInputBorder( - borderSide: BorderSide( - color: (validationError != null - ? Colors.red.shade700 - : Color(0xFFEFEFEF)), - width: 2.5), + borderSide: BorderSide(color: (validationError != null ? Colors.red.shade700 : Color(0xFFEFEFEF)), width: 2.5), borderRadius: BorderRadius.circular(8), ), hintText: selectedText != null ? selectedText : hintText, @@ -123,8 +96,7 @@ class _AddAssessmentDetailsState extends State { builder: (_, model, w) => AppScaffold( baseViewModel: model, isShowAppBar: true, - appBar: BottomSheetTitle( - title: TranslationBase.of(context).addAssessmentDetails), + appBar: BottomSheetTitle(title: TranslationBase.of(context).addAssessmentDetails), backgroundColor: Theme.of(context).scaffoldBackgroundColor, body: SingleChildScrollView( child: Center( @@ -133,263 +105,196 @@ class _AddAssessmentDetailsState extends State { FractionallySizedBox( widthFactor: 0.9, child: Container( - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - SizedBox( - height: 16, - ), - Container( - margin: EdgeInsets.only(left: 0, right: 0, top: 15), - child: AppTextFieldCustom( - // height: 55.0, - height: Utils.getTextFieldHeight(), + child: Column(crossAxisAlignment: CrossAxisAlignment.start, children: [ + SizedBox( + height: 16, + ), + Container( + margin: EdgeInsets.only(left: 0, right: 0, top: 15), + child: AppTextFieldCustom( + // height: 55.0, + height: Utils.getTextFieldHeight(), - hintText: - TranslationBase.of(context).appointmentNumber, - isTextFieldHasSuffix: false, - enabled: false, - controller: appointmentIdController, - ), - ), - SizedBox( - height: 10, - ), - Container( - child: InkWell( - onTap: model.listOfICD10 != null - ? () { - setState(() { - widget.mySelectedAssessment - .selectedICD = null; - icdNameController.text = null; - }); - } - : null, - child: widget - .mySelectedAssessment.selectedICD == - null - ? CustomAutoCompleteTextField( - isShowError: isFormSubmitted && - widget.mySelectedAssessment - .selectedICD == - null, - child: AutoCompleteTextField< - MasterKeyModel>( - decoration: TextFieldsUtils - .textFieldSelectorDecoration( - TranslationBase.of(context) - .nameOrICD, - null, - true, - suffixIcon: Icons.search), - itemSubmitted: (item) => setState(() { - widget.mySelectedAssessment - .selectedICD = item; - icdNameController.text = - '${item.code.trim()}/${item.description}'; - }), - key: key, - suggestions: model.listOfICD10, - itemBuilder: (context, suggestion) => - new Padding( - child: AppText( - suggestion.description + - " / " + - suggestion.code - .toString()), - padding: EdgeInsets.all(8.0)), - itemSorter: (a, b) => 1, - itemFilter: (suggestion, input) => - suggestion.description - .toLowerCase() - .startsWith( - input.toLowerCase()) || - suggestion.description - .toLowerCase() - .startsWith( - input.toLowerCase()) || - suggestion.code - .toLowerCase() - .startsWith( - input.toLowerCase()), - ), - ) - : AppTextFieldCustom( - height: Utils.getTextFieldHeight(), - onClick: model.listOfICD10 != null - ? () { - setState(() { - widget.mySelectedAssessment - .selectedICD = null; - icdNameController.text = null; - }); - } - : null, - hintText: TranslationBase.of(context) - .nameOrICD, - maxLines: 1, - minLines: 1, - controller: icdNameController, - enabled: true, - isTextFieldHasSuffix: true, - suffixIcon: IconButton( - icon: Icon( - Icons.search, - color: Colors.grey.shade600, - )), - )), - ), - if (widget.mySelectedAssessment.selectedICD != null) - Column( - children: [ - SizedBox( - height: 3, - ), - Container( - width: - MediaQuery.of(context).size.width * 0.7, - child: AppText( - widget.mySelectedAssessment.selectedICD - .description + - (' (${widget.mySelectedAssessment.selectedICD.code} )'), - color: Color(0xFF575757), - fontSize: 10, - fontWeight: FontWeight.w700, - letterSpacing: -0.4, - ), - ), - ], - ), - SizedBox( - height: 7, - ), - AppTextFieldCustom( - height: Utils.getTextFieldHeight(), - onClick: model.listOfDiagnosisCondition != null - ? () { - MasterKeyDailog dialog = MasterKeyDailog( - list: model.listOfDiagnosisCondition, - okText: TranslationBase.of(context).ok, - selectedValue: widget.mySelectedAssessment - .selectedDiagnosisCondition, - okFunction: - (MasterKeyModel selectedValue) { - setState(() { - widget.mySelectedAssessment - .selectedDiagnosisCondition = - selectedValue; - conditionController - .text = projectViewModel - .isArabic - ? widget - .mySelectedAssessment - .selectedDiagnosisCondition - .nameAr - : widget - .mySelectedAssessment - .selectedDiagnosisCondition - .nameEn; - }); - }, - ); - showDialog( - barrierDismissible: false, - context: context, - builder: (BuildContext context) { - return dialog; - }, - ); - } - : null, - hintText: TranslationBase.of(context).condition, - maxLines: 1, - minLines: 1, - controller: conditionController, - isTextFieldHasSuffix: true, - enabled: false, - hasBorder: true, - validationError: isFormSubmitted && - widget.mySelectedAssessment - .selectedDiagnosisCondition == - null - ? TranslationBase.of(context).emptyMessage - : null, - ), - SizedBox( - height: 10, - ), - AppTextFieldCustom( - height: Utils.getTextFieldHeight(), - onClick: model.listOfDiagnosisType != null + hintText: TranslationBase.of(context).appointmentNumber, + isTextFieldHasSuffix: false, + enabled: false, + controller: appointmentIdController, + ), + ), + SizedBox( + height: 10, + ), + Container( + child: InkWell( + onTap: model.listOfICD10 != null ? () { - MasterKeyDailog dialog = MasterKeyDailog( - list: model.listOfDiagnosisType, - okText: TranslationBase.of(context).ok, - selectedValue: widget.mySelectedAssessment - .selectedDiagnosisType, - okFunction: - (MasterKeyModel selectedValue) { - setState(() { - widget.mySelectedAssessment - .selectedDiagnosisType = - selectedValue; - typeController.text = - projectViewModel.isArabic - ? selectedValue.nameAr - : selectedValue.nameEn; - }); - }, - ); - showDialog( - barrierDismissible: false, - context: context, - builder: (BuildContext context) { - return dialog; - }, - ); + setState(() { + widget.mySelectedAssessment!.selectedICD = null; + icdNameController.text = ""; + }); } : null, - hintText: TranslationBase.of(context).dType, - maxLines: 1, - minLines: 1, - enabled: false, - isTextFieldHasSuffix: true, - controller: typeController, - hasBorder: true, - validationError: isFormSubmitted && - widget.mySelectedAssessment - .selectedDiagnosisType == - null - ? TranslationBase.of(context).emptyMessage - : null, - ), - SizedBox( - height: 10, - ), - Container( - margin: EdgeInsets.only(left: 0, right: 0, top: 15), - child: AppTextFieldCustom( - hintText: TranslationBase.of(context).remarks, - maxLines: 18, - minLines: 5, - inputType: TextInputType.multiline, - controller: remarkController, - onChanged: (value) { - widget.mySelectedAssessment.remark = - remarkController.text; - }, + child: widget.mySelectedAssessment!.selectedICD == null + ? CustomAutoCompleteTextField( + isShowError: isFormSubmitted && widget.mySelectedAssessment!.selectedICD == null, + child: AutoCompleteTextField( + decoration: TextFieldsUtils.textFieldSelectorDecoration(TranslationBase.of(context).nameOrICD, "", true, suffixIcon: Icons.search), + itemSubmitted: (item) => setState(() { + widget.mySelectedAssessment!.selectedICD = item; + icdNameController.text = '${item.code.trim()}/${item.description}'; + }), + key: key, + suggestions: model.listOfICD10, + itemBuilder: (context, suggestion) => new Padding(child: AppText(suggestion.description + " / " + suggestion.code.toString()), padding: EdgeInsets.all(8.0)), + itemSorter: (a, b) => 1, + itemFilter: (suggestion, input) => + suggestion.description.toLowerCase().startsWith(input.toLowerCase()) || + suggestion.description.toLowerCase().startsWith(input.toLowerCase()) || + suggestion.code.toLowerCase().startsWith(input.toLowerCase()), + ), + ) + : AppTextFieldCustom( + height: Utils.getTextFieldHeight(), + onClick: model.listOfICD10 != null + ? () { + setState(() { + widget.mySelectedAssessment!.selectedICD = null; + icdNameController.text = ""; + }); + } + : () {}, + hintText: TranslationBase.of(context).nameOrICD, + maxLines: 1, + minLines: 1, + controller: icdNameController, + enabled: true, + isTextFieldHasSuffix: true, + suffixIcon: IconButton( + icon: Icon( + Icons.search, + color: Colors.grey.shade600, + ), + onPressed: () {}, + ), + )), + ), + if (widget.mySelectedAssessment!.selectedICD != null) + Column( + children: [ + SizedBox( + height: 3, + ), + Container( + width: MediaQuery.of(context).size.width * 0.7, + child: AppText( + widget.mySelectedAssessment!.selectedICD!.description + (' (${widget.mySelectedAssessment!.selectedICD!.code} )'), + color: Color(0xFF575757), + fontSize: 10, + fontWeight: FontWeight.w700, + letterSpacing: -0.4, + ), ), - ), - SizedBox( - height: SizeConfig.heightMultiplier! * - (SizeConfig.isHeightVeryShort - ? 20 - : SizeConfig.isHeightShort - ? 15 - : 10), - ), - ])), + ], + ), + SizedBox( + height: 7, + ), + AppTextFieldCustom( + height: Utils.getTextFieldHeight(), + onClick: model.listOfDiagnosisCondition != null + ? () { + MasterKeyDailog dialog = MasterKeyDailog( + list: model.listOfDiagnosisCondition, + okText: TranslationBase.of(context).ok, + selectedValue: widget.mySelectedAssessment!.selectedDiagnosisCondition!, + okFunction: (MasterKeyModel selectedValue) { + setState(() { + widget.mySelectedAssessment!.selectedDiagnosisCondition = selectedValue; + conditionController.text = projectViewModel.isArabic + ? widget.mySelectedAssessment!.selectedDiagnosisCondition!.nameAr! + : widget.mySelectedAssessment!.selectedDiagnosisCondition!.nameEn!; + }); + }, + ); + showDialog( + barrierDismissible: false, + context: context, + builder: (BuildContext context) { + return dialog; + }, + ); + } + : () {}, + hintText: TranslationBase.of(context).condition, + maxLines: 1, + minLines: 1, + controller: conditionController, + isTextFieldHasSuffix: true, + enabled: false, + hasBorder: true, + validationError: isFormSubmitted && widget.mySelectedAssessment!.selectedDiagnosisCondition == null ? TranslationBase.of(context).emptyMessage : "", + ), + SizedBox( + height: 10, + ), + AppTextFieldCustom( + height: Utils.getTextFieldHeight(), + onClick: model.listOfDiagnosisType != null + ? () { + MasterKeyDailog dialog = MasterKeyDailog( + list: model.listOfDiagnosisType, + okText: TranslationBase.of(context).ok, + selectedValue: widget.mySelectedAssessment!.selectedDiagnosisType!, + okFunction: (MasterKeyModel selectedValue) { + setState(() { + widget.mySelectedAssessment!.selectedDiagnosisType = selectedValue; + typeController.text = projectViewModel.isArabic ? selectedValue.nameAr! : selectedValue.nameEn!; + }); + }, + ); + showDialog( + barrierDismissible: false, + context: context, + builder: (BuildContext context) { + return dialog; + }, + ); + } + : () {}, + hintText: TranslationBase.of(context).dType, + maxLines: 1, + minLines: 1, + enabled: false, + isTextFieldHasSuffix: true, + controller: typeController, + hasBorder: true, + validationError: isFormSubmitted && widget.mySelectedAssessment!.selectedDiagnosisType == null ? TranslationBase.of(context).emptyMessage : "", + ), + SizedBox( + height: 10, + ), + Container( + margin: EdgeInsets.only(left: 0, right: 0, top: 15), + child: AppTextFieldCustom( + hintText: TranslationBase.of(context).remarks, + maxLines: 18, + minLines: 5, + inputType: TextInputType.multiline, + controller: remarkController, + onChanged: (value) { + widget.mySelectedAssessment!.remark = remarkController.text; + }, + ), + ), + SizedBox( + height: SizeConfig.heightMultiplier! * + (SizeConfig.isHeightVeryShort + ? 20 + : SizeConfig.isHeightShort + ? 15 + : 10), + ), + ])), ), ], ), @@ -400,26 +305,17 @@ class _AddAssessmentDetailsState extends State { height: 0, ) : CustomBottomSheetContainer( - label: (widget.isUpdate - ? 'Update Assessment Details' - : 'Add Assessment Details'), + label: (widget.isUpdate ? 'Update Assessment Details' : 'Add Assessment Details'), onTap: () async { setState(() { isFormSubmitted = true; }); - widget.mySelectedAssessment.remark = remarkController.text; - widget.mySelectedAssessment.appointmentId = - int.parse(appointmentIdController.text); - if (widget.mySelectedAssessment - .selectedDiagnosisCondition != - null && - widget.mySelectedAssessment.selectedDiagnosisType != - null && - widget.mySelectedAssessment.selectedICD != null) { - await submitAssessment( - isUpdate: widget.isUpdate, - model: model, - mySelectedAssessment: widget.mySelectedAssessment); + widget.mySelectedAssessment!.remark = remarkController.text; + widget.mySelectedAssessment!.appointmentId = int.parse(appointmentIdController.text); + if (widget.mySelectedAssessment!.selectedDiagnosisCondition != null && + widget.mySelectedAssessment!.selectedDiagnosisType != null && + widget.mySelectedAssessment!.selectedICD != null) { + await submitAssessment(isUpdate: widget.isUpdate, model: model, mySelectedAssessment: widget.mySelectedAssessment!); } }, ), @@ -428,51 +324,44 @@ class _AddAssessmentDetailsState extends State { ); } - submitAssessment( - {SOAPViewModel model, - MySelectedAssessment mySelectedAssessment, - bool isUpdate = false}) async { + submitAssessment({SOAPViewModel? model, MySelectedAssessment? mySelectedAssessment, bool isUpdate = false}) async { GifLoaderDialogUtils.showMyDialog(context); if (isUpdate) { PatchAssessmentReqModel patchAssessmentReqModel = PatchAssessmentReqModel( - patientMRN: widget.patientInfo.patientMRN, - episodeID: widget.patientInfo.episodeNo, - appointmentNo: widget.patientInfo.appointmentNo, - remarks: mySelectedAssessment.remark, + patientMRN: widget.patientInfo!.patientMRN, + episodeID: widget.patientInfo!.episodeNo, + appointmentNo: widget.patientInfo!.appointmentNo, + remarks: mySelectedAssessment!.remark, complexDiagnosis: true, - conditionId: mySelectedAssessment.selectedDiagnosisCondition.id, - diagnosisTypeId: mySelectedAssessment.selectedDiagnosisType.id, - icdcode10Id: mySelectedAssessment.selectedICD.code, + conditionId: mySelectedAssessment.selectedDiagnosisCondition!.id, + diagnosisTypeId: mySelectedAssessment.selectedDiagnosisType!.id, + icdcode10Id: mySelectedAssessment.selectedICD!.code, prevIcdCode10ID: mySelectedAssessment.icdCode10ID); - await model.patchAssessment(patchAssessmentReqModel); + await model!.patchAssessment(patchAssessmentReqModel); } else { PostAssessmentRequestModel postAssessmentRequestModel = - new PostAssessmentRequestModel( - patientMRN: widget.patientInfo.patientMRN, - episodeId: widget.patientInfo.episodeNo, - appointmentNo: widget.patientInfo.appointmentNo, - icdCodeDetails: [ - new IcdCodeDetails( - remarks: mySelectedAssessment.remark, - complexDiagnosis: true, - conditionId: mySelectedAssessment.selectedDiagnosisCondition.id, - diagnosisTypeId: mySelectedAssessment.selectedDiagnosisType.id, - icdcode10Id: mySelectedAssessment.selectedICD.code) - ]); + new PostAssessmentRequestModel(patientMRN: widget.patientInfo!.patientMRN, episodeId: widget.patientInfo!.episodeNo, appointmentNo: widget.patientInfo!.appointmentNo, icdCodeDetails: [ + new IcdCodeDetails( + remarks: mySelectedAssessment!.remark, + complexDiagnosis: true, + conditionId: mySelectedAssessment.selectedDiagnosisCondition!.id, + diagnosisTypeId: mySelectedAssessment.selectedDiagnosisType!.id, + icdcode10Id: mySelectedAssessment.selectedICD!.code) + ]); - await model.postAssessment(postAssessmentRequestModel); + await model!.postAssessment(postAssessmentRequestModel); } GifLoaderDialogUtils.hideDialog(context); if (model.state == ViewState.ErrorLocal) { Utils.showErrorToast(model.error); } else { - Map profile = await sharedPref.getObj(DOCTOR_PROFILE); + Map profile = await sharedPref.getObj(DOCTOR_PROFILE); DoctorProfileModel doctorProfile = DoctorProfileModel.fromJson(profile); - mySelectedAssessment.icdCode10ID = mySelectedAssessment.selectedICD.code; + mySelectedAssessment.icdCode10ID = mySelectedAssessment.selectedICD!.code; mySelectedAssessment.doctorName = doctorProfile.doctorName; - widget.addSelectedAssessment(mySelectedAssessment, isUpdate); + widget.addSelectedAssessment!(mySelectedAssessment, isUpdate); Navigator.of(context).pop(); } } 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 54dff45f..e759199b 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 @@ -25,13 +25,13 @@ import 'assessment_call_back.dart'; // ignore: must_be_immutable class UpdateAssessmentPage extends StatefulWidget { - final Function changePageViewIndex; - final PatiantInformtion patientInfo; - final Function changeLoadingState; - final int currentIndex; + final Function? changePageViewIndex; + final PatiantInformtion? patientInfo; + final Function? changeLoadingState; + final int? currentIndex; UpdateAssessmentPage( - {Key key, + {Key? key, this.changePageViewIndex, this.patientInfo, this.changeLoadingState, @@ -55,7 +55,7 @@ class _UpdateAssessmentPageState extends State model.setAssessmentCallBack(this); mySelectedAssessmentList.clear(); - await model.onUpdateAssessmentStepStart(widget.patientInfo); + await model.onUpdateAssessmentStepStart(widget.patientInfo!); if (model.patientAssessmentList.isNotEmpty) { model.patientAssessmentList.forEach((element) { @@ -92,7 +92,7 @@ class _UpdateAssessmentPageState extends State }); } - widget.changeLoadingState(false); + widget.changeLoadingState!(false); }, builder: (_, model, w) => AppScaffold( isShowAppBar: false, @@ -108,9 +108,9 @@ class _UpdateAssessmentPageState extends State mainAxisAlignment: MainAxisAlignment.start, children: [ SOAPStepHeader( - currentIndex: widget.currentIndex, - changePageViewIndex: widget.changePageViewIndex, - patientInfo: widget.patientInfo, + currentIndex: widget.currentIndex!, + changePageViewIndex: widget.changePageViewIndex!, + patientInfo: widget.patientInfo!, ), ExpandableSOAPWidget( headerTitle: TranslationBase.of(context).assessment, @@ -163,7 +163,7 @@ class _UpdateAssessmentPageState extends State ), new TextSpan( text: assessment - .selectedICD.code + .selectedICD!.code .trim() .toUpperCase() ?? ""), @@ -180,7 +180,7 @@ class _UpdateAssessmentPageState extends State .getDayMonthYearDateFormatted( DateTime.parse( assessment - .createdOn), isMonthShort: true) + .createdOn!), isMonthShort: true) : AppDateUtils .getDayMonthYearDateFormatted( DateTime.now()), @@ -194,7 +194,7 @@ class _UpdateAssessmentPageState extends State ? AppDateUtils.getHour( DateTime.parse( assessment - .createdOn)) + .createdOn!)) : AppDateUtils.getHour( DateTime.now()), fontWeight: FontWeight.w600, @@ -239,7 +239,7 @@ class _UpdateAssessmentPageState extends State children: [ new TextSpan( text: assessment - .selectedICD.description + .selectedICD!.description .toString(), ), ], @@ -309,10 +309,10 @@ class _UpdateAssessmentPageState extends State .isArabic ? assessment .selectedDiagnosisCondition - .nameAr + !.nameAr : assessment .selectedDiagnosisCondition - .nameEn, + !.nameEn, style: new TextStyle( fontSize: SizeConfig .getTextMultiplierBasedOnWidth() * @@ -349,10 +349,10 @@ class _UpdateAssessmentPageState extends State .isArabic ? assessment .selectedDiagnosisType - .nameAr + !.nameAr : assessment .selectedDiagnosisType - .nameEn, + !.nameEn, style: new TextStyle( fontSize: SizeConfig .getTextMultiplierBasedOnWidth() * @@ -489,10 +489,10 @@ class _UpdateAssessmentPageState extends State } openAssessmentDialog(BuildContext context, - {MySelectedAssessment assessment, bool isUpdate, SOAPViewModel model}) { + {MySelectedAssessment? assessment, bool isUpdate = false, SOAPViewModel? model}) { if (assessment == null) { assessment = SoapUtils.generateMySelectedAssessment( - remark: '', appointmentNo: widget.patientInfo.appointmentNo); + remark: '', appointmentNo: widget.patientInfo!.appointmentNo); } showModalBottomSheet( backgroundColor: Colors.white, @@ -519,8 +519,8 @@ class _UpdateAssessmentPageState extends State if (mySelectedAssessmentList.isEmpty) { Utils.showErrorToast(TranslationBase.of(context).assessmentErrorMsg); } else { - widget.changeLoadingState(true); - widget.changePageViewIndex(3); + widget.changeLoadingState!(true); + widget.changePageViewIndex!(3); } } } diff --git a/lib/screens/patients/profile/soap_update/objective/add_examination_page.dart b/lib/screens/patients/profile/soap_update/objective/add_examination_page.dart index 6b2a3fd6..d2696e1c 100644 --- a/lib/screens/patients/profile/soap_update/objective/add_examination_page.dart +++ b/lib/screens/patients/profile/soap_update/objective/add_examination_page.dart @@ -9,13 +9,12 @@ import 'package:doctor_app_flutter/utils/translations_delegate_base_utils.dart'; import 'package:doctor_app_flutter/widgets/bottom_sheet/custom_bottom_sheet_container.dart'; import 'package:doctor_app_flutter/widgets/shared/app_scaffold_widget.dart'; import 'package:flutter/material.dart'; - import 'examinations_list_search_widget.dart'; class AddExaminationPage extends StatefulWidget { - final List mySelectedExamination; - final Function(List) addSelectedExamination; - final Function(MasterKeyModel) removeExamination; + final List? mySelectedExamination; + final Function(List)? addSelectedExamination; + final Function(MasterKeyModel)? removeExamination; AddExaminationPage( {this.mySelectedExamination, @@ -27,12 +26,12 @@ class AddExaminationPage extends StatefulWidget { } class _AddExaminationPageState extends State { - List mySelectedExaminationLocal; + List mySelectedExaminationLocal = []; @override initState() { super.initState(); - mySelectedExaminationLocal = [...widget.mySelectedExamination]; + mySelectedExaminationLocal = [...?widget.mySelectedExamination]; } @override @@ -73,7 +72,7 @@ class _AddExaminationPageState extends State { children: [ ExaminationsListSearchWidget( mySelectedExamination: - widget.mySelectedExamination, + widget.mySelectedExamination!, masterList: model.physicalExaminationList, isServiceSelected: (master) => isServiceSelected(master), @@ -106,7 +105,7 @@ class _AddExaminationPageState extends State { label: "${TranslationBase.of(context).addExamination}", onTap: () { widget - .addSelectedExamination(mySelectedExaminationLocal); + .addSelectedExamination!(mySelectedExaminationLocal); }, ), )); @@ -115,8 +114,8 @@ class _AddExaminationPageState extends State { isServiceSelected(MasterKeyModel masterKey) { Iterable exam = mySelectedExaminationLocal.where( (element) => - masterKey.id == element.selectedExamination.id && - masterKey.typeId == element.selectedExamination.typeId); + masterKey.id == element.selectedExamination!.id && + masterKey.typeId == element.selectedExamination!.typeId); if (exam.length > 0) { return true; } diff --git a/lib/screens/patients/profile/soap_update/objective/add_examination_widget.dart b/lib/screens/patients/profile/soap_update/objective/add_examination_widget.dart index ace85ff1..2ffd706b 100644 --- a/lib/screens/patients/profile/soap_update/objective/add_examination_widget.dart +++ b/lib/screens/patients/profile/soap_update/objective/add_examination_widget.dart @@ -13,20 +13,21 @@ import 'package:provider/provider.dart'; // ignore: must_be_immutable class AddExaminationWidget extends StatefulWidget { - MasterKeyModel item; - final Function(MySelectedExamination) removeExamination; - final Function(MySelectedExamination) addExamination; - final bool Function(MasterKeyModel) isServiceSelected; + MasterKeyModel? item; + final Function(MySelectedExamination)? removeExamination; + final Function(MySelectedExamination)? addExamination; + final bool Function(MasterKeyModel)? isServiceSelected; bool isExpand; - final Function expandClick; - final List mySelectedExamination; + + final Function? expandClick; + final List? mySelectedExamination; AddExaminationWidget({ this.item, this.removeExamination, this.addExamination, this.isServiceSelected, - this.isExpand, + this.isExpand = false, this.expandClick, this.mySelectedExamination, }); @@ -42,14 +43,14 @@ class _AddExaminationWidgetState extends State { @override void initState() { - if (getSelectedExam(widget.item) != null) { - examination = getSelectedExam(widget.item); - status = examination.isNormal + if (getSelectedExam(widget.item!) != null) { + examination = getSelectedExam(widget.item!); + status = examination.isNormal! ? 1 - : examination.isAbnormal + : examination.isAbnormal! ? 2 : 3; - remarksController.text = examination.remark; + remarksController.text = examination.remark!; } else { examination.selectedExamination = widget.item; } @@ -72,22 +73,20 @@ class _AddExaminationWidgetState extends State { child: Row( children: [ Checkbox( - value: widget.isServiceSelected(widget.item), + value: widget.isServiceSelected!(widget.item!), activeColor: Colors.red[800], - onChanged: (bool newValue) { + onChanged: (bool? newValue) { onExamTap(); }), Container( child: AppText( projectViewModel.isArabic - ? widget.item.nameAr != null && - widget.item.nameAr != "" - ? widget.item.nameAr - : widget.item.nameEn - : widget.item.nameEn, + ? widget.item!.nameAr != null && widget.item!.nameAr != "" + ? widget.item!.nameAr! + : widget.item!.nameEn! + : widget.item!.nameEn!, color: Color(0xFF575757), - fontSize: SizeConfig.getTextMultiplierBasedOnWidth() * - (SizeConfig.isWidthLarge ? 3 : 3.8), + fontSize: SizeConfig.getTextMultiplierBasedOnWidth() * (SizeConfig.isWidthLarge ? 3 : 3.8), letterSpacing: -0.56, ), ), @@ -97,10 +96,9 @@ class _AddExaminationWidgetState extends State { Container( margin: EdgeInsets.symmetric(horizontal: 8), child: InkWell( - onTap: widget.expandClick, - child: Icon(widget.isExpand - ? Icons.keyboard_arrow_up - : Icons.keyboard_arrow_down)), + onTap: widget.expandClick!(), + child: Icon(widget.isExpand! ? Icons.keyboard_arrow_up : Icons.keyboard_arrow_down), + ), ), ], ), @@ -115,7 +113,7 @@ class _AddExaminationWidgetState extends State { TranslationBase.of(context).status, fontWeight: FontWeight.bold, fontFamily: 'Poppins', - fontSize: SizeConfig.textMultiplier * 1.6, + fontSize: SizeConfig.textMultiplier! * 1.6, ), ), Row( @@ -144,9 +142,7 @@ class _AddExaminationWidgetState extends State { ), child: Container( decoration: BoxDecoration( - color: status == 1 - ? HexColor("#D02127") - : Colors.white, + color: status == 1 ? HexColor("#D02127") : Colors.white, shape: BoxShape.circle, ), ), @@ -155,7 +151,7 @@ class _AddExaminationWidgetState extends State { TranslationBase.of(context).normal, fontWeight: FontWeight.normal, fontFamily: 'Poppins', - fontSize: SizeConfig.textMultiplier * 1.6, + fontSize: SizeConfig.textMultiplier! * 1.6, ), ], ), @@ -184,9 +180,7 @@ class _AddExaminationWidgetState extends State { ), child: Container( decoration: BoxDecoration( - color: status == 2 - ? HexColor("#D02127") - : Colors.white, + color: status == 2 ? HexColor("#D02127") : Colors.white, shape: BoxShape.circle, ), ), @@ -195,7 +189,7 @@ class _AddExaminationWidgetState extends State { TranslationBase.of(context).abnormal, fontWeight: FontWeight.normal, fontFamily: 'Poppins', - fontSize: SizeConfig.textMultiplier * 1.6, + fontSize: SizeConfig.textMultiplier! * 1.6, ), ], ), @@ -225,9 +219,7 @@ class _AddExaminationWidgetState extends State { ), child: Container( decoration: BoxDecoration( - color: status == 3 - ? HexColor("#D02127") - : Colors.white, + color: status == 3 ? HexColor("#D02127") : Colors.white, shape: BoxShape.circle, ), ), @@ -237,7 +229,7 @@ class _AddExaminationWidgetState extends State { TranslationBase.of(context).notExamined, fontWeight: FontWeight.normal, fontFamily: 'Poppins', - fontSize: SizeConfig.textMultiplier * 1.6, + fontSize: SizeConfig.textMultiplier! * 1.6, ), ), ], @@ -268,28 +260,25 @@ class _AddExaminationWidgetState extends State { onExamTap() { setState(() { - if (widget.isServiceSelected(widget.item)) { - if (examination.isLocal) widget.removeExamination(examination); - widget.expandClick(); + if (widget.isServiceSelected!(widget.item!)) { + if (examination.isLocal) widget.removeExamination!(examination); + widget.expandClick!(); } else { examination.isNormal = status == 1; examination.isAbnormal = status == 2; examination.notExamined = status == 3; examination.remark = remarksController.text; - widget.addExamination(examination); - widget.expandClick(); + widget.addExamination!(examination); + widget.expandClick!(); } }); } MySelectedExamination getSelectedExam(MasterKeyModel masterKey) { - Iterable exam = widget.mySelectedExamination.where( - (element) => - masterKey.id == element.selectedExamination.id && - masterKey.typeId == element.selectedExamination.typeId); + Iterable exam = widget.mySelectedExamination!.where((element) => masterKey.id == element.selectedExamination!.id && masterKey.typeId == element.selectedExamination!.typeId); if (exam.length > 0) { return exam.first; } - return null; + return MySelectedExamination(); } } diff --git a/lib/screens/patients/profile/soap_update/objective/examination_item_card.dart b/lib/screens/patients/profile/soap_update/objective/examination_item_card.dart index 54f54e35..9b0d752b 100644 --- a/lib/screens/patients/profile/soap_update/objective/examination_item_card.dart +++ b/lib/screens/patients/profile/soap_update/objective/examination_item_card.dart @@ -32,15 +32,15 @@ class ExaminationItemCard extends StatelessWidget { child: Container( child: AppText( projectViewModel.isArabic - ? examination.selectedExamination.nameAr != null && - examination.selectedExamination.nameAr != "" - ? examination.selectedExamination.nameAr - : examination.selectedExamination.nameEn - : examination.selectedExamination.nameEn, + ? examination.selectedExamination!.nameAr != null && + examination.selectedExamination!.nameAr != "" + ? examination.selectedExamination!.nameAr! + : examination.selectedExamination!.nameEn! + : examination.selectedExamination!.nameEn!, fontWeight: FontWeight.w600, fontFamily: 'Poppins', color: Color(0xFF2B353E), - fontSize: SizeConfig.textMultiplier * 1.8, + fontSize: SizeConfig.textMultiplier! * 1.8, ), )), ], @@ -61,7 +61,7 @@ class ExaminationItemCard extends StatelessWidget { ? Colors.red.shade800 : Colors.grey.shade800 : AppGlobal.appGreenColor, - fontSize: SizeConfig.textMultiplier * 1.8, + fontSize: SizeConfig.textMultiplier! * 1.8, ), if (!examination.notExamined) RemoveButton( @@ -75,8 +75,8 @@ class ExaminationItemCard extends StatelessWidget { SizedBox( height: 4, ), - if (examination.remark.isNotEmpty) - RemarkText(remark: examination.remark), + if (examination.remark!.isNotEmpty) + RemarkText(remark: examination.remark!), ], ), ); diff --git a/lib/screens/patients/profile/soap_update/objective/examinations_list_search_widget.dart b/lib/screens/patients/profile/soap_update/objective/examinations_list_search_widget.dart index c86ed059..6084abdc 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 @@ -9,11 +9,11 @@ import 'package:flutter/material.dart'; import 'add_examination_widget.dart'; class ExaminationsListSearchWidget extends StatefulWidget { - final Function(MySelectedExamination) removeExamination; - final Function(MySelectedExamination) addExamination; - final bool Function(MasterKeyModel) isServiceSelected; - final List masterList; - final List mySelectedExamination; + final Function(MySelectedExamination)? removeExamination; + final Function(MySelectedExamination)? addExamination; + final bool Function(MasterKeyModel)? isServiceSelected; + final List? masterList; + final List? mySelectedExamination; ExaminationsListSearchWidget( {this.removeExamination, @@ -35,7 +35,7 @@ class _ExaminationsListSearchWidgetState @override void initState() { - items.addAll(widget.masterList); + items.addAll(widget.masterList as Iterable); super.initState(); } @@ -56,7 +56,7 @@ class _ExaminationsListSearchWidgetState icon: Icon( Icons.search, color: Colors.black, - )), + ), onPressed: () { },), ), DividerWithSpacesAround( height: 2, @@ -86,12 +86,12 @@ class _ExaminationsListSearchWidgetState void filterSearchResults(String query) { List dummySearchList = []; - dummySearchList.addAll(widget.masterList); + dummySearchList.addAll(widget.masterList as Iterable); if (query.isNotEmpty) { List dummyListData = []; dummySearchList.forEach((item) { - if (item.nameAr.toLowerCase().contains(query.toLowerCase()) || - item.nameEn.toLowerCase().contains(query.toLowerCase())) { + if (item.nameAr!.toLowerCase().contains(query.toLowerCase()) || + item.nameEn!.toLowerCase().contains(query.toLowerCase())) { dummyListData.add(item); } }); @@ -103,7 +103,7 @@ class _ExaminationsListSearchWidgetState } else { setState(() { items.clear(); - items.addAll(widget.masterList); + items.addAll(widget.masterList as Iterable); }); } } 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 18d599ae..7ac48f78 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 @@ -26,29 +26,22 @@ import 'examination_item_card.dart'; import 'objective_call_back.dart'; class UpdateObjectivePage extends StatefulWidget { - final Function changePageViewIndex; - final Function changeLoadingState; + final Function? changePageViewIndex; + final Function? changeLoadingState; final int currentIndex; - final PatiantInformtion patientInfo; + final PatiantInformtion? patientInfo; - UpdateObjectivePage( - {Key key, - this.changePageViewIndex, - this.patientInfo, - this.changeLoadingState, - this.currentIndex}); + UpdateObjectivePage({Key? key, this.changePageViewIndex, this.patientInfo, this.changeLoadingState, this.currentIndex = 0}); @override _UpdateObjectivePageState createState() => _UpdateObjectivePageState(); } -class _UpdateObjectivePageState extends State - implements ObjectiveCallBack { +class _UpdateObjectivePageState extends State implements ObjectiveCallBack { bool isSysExaminationExpand = false; List mySelectedExamination = []; - BoxDecoration containerBorderDecoration( - Color containerColor, Color borderColor) { + BoxDecoration containerBorderDecoration(Color containerColor, Color borderColor) { return BoxDecoration( color: containerColor, shape: BoxShape.rectangle, @@ -67,7 +60,7 @@ class _UpdateObjectivePageState extends State model.setObjectiveCallBack(this); mySelectedExamination.clear(); model.isAddExamInProgress = true; - await model.getPatientPhysicalExam(widget.patientInfo); + await model.getPatientPhysicalExam(widget.patientInfo!); if (model.patientPhysicalExamList.isNotEmpty) { if (model.physicalExaminationList.length == 0) { await model.getMasterLookup(MasterKeysService.PhysicalExamination); @@ -77,8 +70,7 @@ class _UpdateObjectivePageState extends State masterKeys: MasterKeysService.PhysicalExamination, id: element.examId, ); - MySelectedExamination tempEam = - SoapUtils.generateMySelectedExamination( + MySelectedExamination tempEam = SoapUtils.generateMySelectedExamination( examination: examMaster, remark: element.remarks, isNormal: element.isNormal, @@ -93,7 +85,7 @@ class _UpdateObjectivePageState extends State mySelectedExamination.add(tempEam); }); } - widget.changeLoadingState(false); + widget.changeLoadingState!(false); }, builder: (_, model, w) => AppScaffold( isShowAppBar: false, @@ -109,12 +101,11 @@ class _UpdateObjectivePageState extends State children: [ SOAPStepHeader( currentIndex: widget.currentIndex, - changePageViewIndex: widget.changePageViewIndex, - patientInfo: widget.patientInfo, + changePageViewIndex: widget.changePageViewIndex!, + patientInfo: widget.patientInfo!, ), ExpandableSOAPWidget( - headerTitle: - TranslationBase.of(context).physicalSystemExamination, + headerTitle: TranslationBase.of(context).physicalSystemExamination, onTap: () { setState(() { isSysExaminationExpand = !isSysExaminationExpand; @@ -123,14 +114,12 @@ class _UpdateObjectivePageState extends State child: Column( children: [ SOAPOpenItems( - label: - "${TranslationBase.of(context).addExamination}", + label: "${TranslationBase.of(context).addExamination}", onTap: () { openExaminationList(context); }, ), - if (mySelectedExamination.isNotEmpty && - mySelectedExamination.first.isLocal) + if (mySelectedExamination.isNotEmpty && mySelectedExamination.first.isLocal) Row( children: [ AppText( @@ -143,25 +132,14 @@ class _UpdateObjectivePageState extends State ), Column( children: mySelectedExamination - .sublist( - 0, - model.getFirstIndexForOldExamination( - mySelectedExamination) == - -1 - ? 0 - : model.getFirstIndexForOldExamination( - mySelectedExamination)) + .sublist(0, model.getFirstIndexForOldExamination(mySelectedExamination) == -1 ? 0 : model.getFirstIndexForOldExamination(mySelectedExamination)) .map((examination) { return ExaminationItemCard(examination, () { - removeExamination( - examination.selectedExamination); + removeExamination(examination.selectedExamination!); }); }).toList(), ), - if (mySelectedExamination.isNotEmpty && - model.getFirstIndexForOldExamination( - mySelectedExamination) > - -1) + if (mySelectedExamination.isNotEmpty && model.getFirstIndexForOldExamination(mySelectedExamination) > -1) Row( children: [ AppText( @@ -174,16 +152,10 @@ class _UpdateObjectivePageState extends State ), Column( children: mySelectedExamination - .sublist(model.getFirstIndexForOldExamination( - mySelectedExamination) == - -1 - ? 0 - : model.getFirstIndexForOldExamination( - mySelectedExamination)) + .sublist(model.getFirstIndexForOldExamination(mySelectedExamination) == -1 ? 0 : model.getFirstIndexForOldExamination(mySelectedExamination)) .map((examination) { return ExaminationItemCard(examination, () { - removeExamination( - examination.selectedExamination); + removeExamination(examination.selectedExamination!); }); }).toList(), ) @@ -192,8 +164,7 @@ class _UpdateObjectivePageState extends State isExpanded: isSysExaminationExpand, ), SizedBox( - height: SizeConfig.heightMultiplier! * - (SizeConfig.isHeightVeryShort ? 14 : 12), + height: SizeConfig.heightMultiplier! * (SizeConfig.isHeightVeryShort ? 14 : 12), ) ], ), @@ -206,40 +177,27 @@ class _UpdateObjectivePageState extends State submitUpdateObjectivePage(SOAPViewModel model) async { if (mySelectedExamination.isNotEmpty) { - if (!model.isAddExamInProgress && - widget.patientInfo.admissionNo != null && - widget.patientInfo.admissionNo.isNotEmpty) { + if (!model.isAddExamInProgress && widget.patientInfo!.admissionNo != null && widget.patientInfo!.admissionNo!.isNotEmpty) { Navigator.of(context).pop(); } else { - widget.changeLoadingState(true); - Map profile = await sharedPref.getObj(DOCTOR_PROFILE); + widget.changeLoadingState!(true); + Map profile = await sharedPref.getObj(DOCTOR_PROFILE); DoctorProfileModel doctorProfile = DoctorProfileModel.fromJson(profile); - PostPhysicalExamRequestModel postPhysicalExamRequestModel = - new PostPhysicalExamRequestModel(); + PostPhysicalExamRequestModel postPhysicalExamRequestModel = new PostPhysicalExamRequestModel(); mySelectedExamination.forEach((exam) { - if (postPhysicalExamRequestModel - .listHisProgNotePhysicalExaminationVM == - null) - postPhysicalExamRequestModel.listHisProgNotePhysicalExaminationVM = - []; - ListHisProgNotePhysicalExaminationVM - listHisProgNotePhysicalExaminationVM = - ListHisProgNotePhysicalExaminationVM( - patientMRN: widget.patientInfo.patientMRN, - episodeId: widget.patientInfo.episodeNo == null - ? 0 - : widget.patientInfo.episodeNo, - appointmentNo: widget.patientInfo.appointmentNo == null - ? 0 - : widget.patientInfo.appointmentNo, + if (postPhysicalExamRequestModel.listHisProgNotePhysicalExaminationVM == null) postPhysicalExamRequestModel.listHisProgNotePhysicalExaminationVM = []; + ListHisProgNotePhysicalExaminationVM listHisProgNotePhysicalExaminationVM = ListHisProgNotePhysicalExaminationVM( + patientMRN: widget.patientInfo!.patientMRN, + episodeId: widget.patientInfo!.episodeNo == null ? 0 : widget.patientInfo!.episodeNo, + appointmentNo: widget.patientInfo!.appointmentNo == null ? 0 : widget.patientInfo!.appointmentNo, remarks: exam.remark ?? '', createdBy: exam.createdBy ?? doctorProfile.doctorID, createdOn: exam.createdOn ?? DateTime.now().toIso8601String(), editedBy: doctorProfile.doctorID, editedOn: DateTime.now().toIso8601String(), - examId: exam.selectedExamination.id, - examType: exam.selectedExamination.typeId, + examId: exam.selectedExamination!.id, + examType: exam.selectedExamination!.typeId, isAbnormal: exam.isAbnormal, isNormal: exam.isNormal, notExamined: exam.notExamined, @@ -255,15 +213,12 @@ class _UpdateObjectivePageState extends State : "Not Examined", isNew: exam.isNew, ); - if (widget.patientInfo.admissionNo != null && - widget.patientInfo.admissionNo.isNotEmpty) { - listHisProgNotePhysicalExaminationVM.admissionNo = - int.parse(widget.patientInfo.admissionNo); + if (widget.patientInfo!.admissionNo != null && widget.patientInfo!.admissionNo!.isNotEmpty) { + listHisProgNotePhysicalExaminationVM.admissionNo = int.parse(widget.patientInfo!.admissionNo!); } else { listHisProgNotePhysicalExaminationVM.admissionNo = 0; } - postPhysicalExamRequestModel.listHisProgNotePhysicalExaminationVM - .add(listHisProgNotePhysicalExaminationVM); + postPhysicalExamRequestModel.listHisProgNotePhysicalExaminationVM!.add(listHisProgNotePhysicalExaminationVM); }); if (model.patientPhysicalExamList.isEmpty) { @@ -273,22 +228,20 @@ class _UpdateObjectivePageState extends State } if (model.state == ViewState.ErrorLocal) { - widget.changeLoadingState(false); + widget.changeLoadingState!(false); Utils.showErrorToast(model.error); - if (widget.patientInfo.admissionNo != null && - widget.patientInfo.admissionNo.isNotEmpty) { + if (widget.patientInfo!.admissionNo != null && widget.patientInfo!.admissionNo!.isNotEmpty) { // Navigator.of(context).pop(); model.isAddExamInProgress = false; } } else { - if (widget.patientInfo.admissionNo != null && - widget.patientInfo.admissionNo.isNotEmpty) { + if (widget.patientInfo!.admissionNo != null && widget.patientInfo!.admissionNo!.isNotEmpty) { // Navigator.of(context).pop(); - widget.changeLoadingState(false); + widget.changeLoadingState!(false); model.isAddExamInProgress = false; } else { - widget.changeLoadingState(true); - widget.changePageViewIndex(2); + widget.changeLoadingState!(true); + widget.changePageViewIndex!(2); } } } @@ -298,10 +251,7 @@ class _UpdateObjectivePageState extends State } removeExamination(MasterKeyModel masterKey) { - Iterable history = mySelectedExamination.where( - (element) => - masterKey.id == element.selectedExamination.id && - masterKey.typeId == element.selectedExamination.typeId); + Iterable history = mySelectedExamination.where((element) => masterKey.id == element.selectedExamination!.id && masterKey.typeId == element.selectedExamination!.typeId); if (history.length > 0) { setState(() { @@ -322,16 +272,16 @@ class _UpdateObjectivePageState extends State FadePage( page: AddExaminationPage( mySelectedExamination: mySelectedExamination, - addSelectedExamination: - (List mySelectedExaminationLocal) { + addSelectedExamination: (List mySelectedExaminationLocal) { setState(() { { mySelectedExaminationLocal.forEach((element) { - if ((mySelectedExamination.singleWhere( - (it) => - it.selectedExamination.id == - element.selectedExamination.id, - orElse: () => null)) == + if (( + mySelectedExamination.singleWhere( + (it) => it.selectedExamination!.id == element.selectedExamination!.id, + orElse: () => MySelectedExamination(), + ), + ) == null) { mySelectedExamination.insert(0, element); } @@ -340,18 +290,13 @@ class _UpdateObjectivePageState extends State /// remove items. List removedList = []; mySelectedExamination.forEach((element) { - if ((mySelectedExaminationLocal.singleWhere( - (it) => - it.selectedExamination.id == - element.selectedExamination.id, - orElse: () => null)) == - null) { + if ((mySelectedExaminationLocal.singleWhere((it) => it.selectedExamination!.id == element.selectedExamination!.id, orElse: () => MySelectedExamination())) == null) { removedList.add(element); } }); removedList.forEach((element) { - removeExamination(element.selectedExamination); + removeExamination(element.selectedExamination!); }); Navigator.of(context).pop(); } diff --git a/lib/screens/patients/profile/soap_update/plan/update_plan_page.dart b/lib/screens/patients/profile/soap_update/plan/update_plan_page.dart index cf115f08..30622cf0 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 @@ -22,16 +22,16 @@ import '../shared_soap_widgets/SOAP_step_header.dart'; import '../shared_soap_widgets/expandable_SOAP_widget.dart'; class UpdatePlanPage extends StatefulWidget { - final Function changePageViewIndex; - final PatiantInformtion patientInfo; - final Function changeLoadingState; - final Function changeStateFun; - final SOAPViewModel sOAPViewModel; + final Function? changePageViewIndex; + final PatiantInformtion? patientInfo; + final Function? changeLoadingState; + final Function? changeStateFun; + final SOAPViewModel? sOAPViewModel; - final int currentIndex; + final int? currentIndex; UpdatePlanPage( - {Key key, + {Key? key, this.changePageViewIndex, this.patientInfo, this.changeLoadingState, @@ -81,34 +81,34 @@ class _UpdatePlanPageState extends State GetProgressNoteReqModel getGetProgressNoteReqModel = GetProgressNoteReqModel( appointmentNo: - int.parse(widget.patientInfo.appointmentNo.toString()), - patientMRN: widget.patientInfo.patientMRN, - episodeID: widget.patientInfo.episodeNo.toString(), + int.parse(widget.patientInfo!.appointmentNo.toString()), + patientMRN: widget.patientInfo!.patientMRN, + episodeID: widget.patientInfo!.episodeNo.toString(), editedBy: '', doctorID: ''); await widget.sOAPViewModel - .getPatientProgressNote(getGetProgressNoteReqModel); + !.getPatientProgressNote(getGetProgressNoteReqModel); ///TODO set progressNote in model; - if (widget.sOAPViewModel.patientProgressNoteList.isNotEmpty) { + if (widget.sOAPViewModel!.patientProgressNoteList.isNotEmpty) { progressNoteController.text = Utils.parseHtmlString( - widget.sOAPViewModel.patientProgressNoteList[0].planNote); + widget.sOAPViewModel!.patientProgressNoteList[0].planNote!); patientProgressNote.planNote = progressNoteController.text; patientProgressNote.createdByName = - widget.sOAPViewModel.patientProgressNoteList[0].createdByName; + widget.sOAPViewModel!.patientProgressNoteList[0].createdByName; patientProgressNote.createdOn = - widget.sOAPViewModel.patientProgressNoteList[0].createdOn; + widget.sOAPViewModel!.patientProgressNoteList[0].createdOn; patientProgressNote.editedOn = - widget.sOAPViewModel.patientProgressNoteList[0].editedOn; + widget.sOAPViewModel!.patientProgressNoteList[0].editedOn; patientProgressNote.editedByName = - widget.sOAPViewModel.patientProgressNoteList[0].editedByName; + widget.sOAPViewModel!.patientProgressNoteList[0].editedByName; patientProgressNote.appointmentNo = - widget.sOAPViewModel.patientProgressNoteList[0].appointmentNo; + widget.sOAPViewModel!.patientProgressNoteList[0].appointmentNo; setState(() { isAddProgress = isAddProgress; - widget.sOAPViewModel.isAddProgress = isAddProgress; - widget.sOAPViewModel.progressNoteText = progressNoteController.text; + widget.sOAPViewModel!.isAddProgress = isAddProgress; + widget.sOAPViewModel!.progressNoteText = progressNoteController.text; }); } } @@ -117,40 +117,40 @@ class _UpdatePlanPageState extends State Widget build(BuildContext context) { return BaseView( onModelReady: (model) async { - widget.sOAPViewModel.setPlanCallBack(this); + widget.sOAPViewModel!.setPlanCallBack(this); GetProgressNoteReqModel getGetProgressNoteReqModel = GetProgressNoteReqModel( appointmentNo: - int.parse(widget.patientInfo.appointmentNo.toString()), - patientMRN: widget.patientInfo.patientMRN, - episodeID: widget.patientInfo.episodeNo.toString(), + int.parse(widget.patientInfo!.appointmentNo.toString()), + patientMRN: widget.patientInfo!.patientMRN, + episodeID: widget.patientInfo!.episodeNo.toString(), editedBy: '', doctorID: ''); await widget.sOAPViewModel - .getPatientProgressNote(getGetProgressNoteReqModel); + !.getPatientProgressNote(getGetProgressNoteReqModel); - if (widget.sOAPViewModel.patientProgressNoteList.isNotEmpty) { + if (widget.sOAPViewModel!.patientProgressNoteList.isNotEmpty) { progressNoteController.text = Utils.parseHtmlString( - widget.sOAPViewModel.patientProgressNoteList[0].planNote); + widget.sOAPViewModel!.patientProgressNoteList[0].planNote!); patientProgressNote.planNote = progressNoteController.text; patientProgressNote.createdByName = - widget.sOAPViewModel.patientProgressNoteList[0].createdByName; + widget.sOAPViewModel!.patientProgressNoteList[0].createdByName; patientProgressNote.createdOn = - widget.sOAPViewModel.patientProgressNoteList[0].createdOn; + widget.sOAPViewModel!.patientProgressNoteList[0].createdOn; patientProgressNote.editedOn = - widget.sOAPViewModel.patientProgressNoteList[0].editedOn; + widget.sOAPViewModel!.patientProgressNoteList[0].editedOn; patientProgressNote.editedByName = - widget.sOAPViewModel.patientProgressNoteList[0].editedByName; + widget.sOAPViewModel!.patientProgressNoteList[0].editedByName; patientProgressNote.appointmentNo = - widget.sOAPViewModel.patientProgressNoteList[0].appointmentNo; - widget.sOAPViewModel.progressNoteText = progressNoteController.text; + widget.sOAPViewModel!.patientProgressNoteList[0].appointmentNo; + widget.sOAPViewModel!.progressNoteText = progressNoteController.text; setState(() { isAddProgress = false; - widget.sOAPViewModel.isAddProgress = false; + widget.sOAPViewModel!.isAddProgress = false; }); } - widget.changeLoadingState(false); + widget.changeLoadingState!(false); }, builder: (_, model, w) => AppScaffold( backgroundColor: Theme.of(context).scaffoldBackgroundColor, @@ -163,9 +163,9 @@ class _UpdatePlanPageState extends State child: Column( children: [ SOAPStepHeader( - currentIndex: widget.currentIndex, - changePageViewIndex: widget.changePageViewIndex, - patientInfo: widget.patientInfo, + currentIndex: widget.currentIndex!, + changePageViewIndex: widget.changePageViewIndex!, + patientInfo: widget.patientInfo!, ), SizedBox( height: 10, @@ -199,7 +199,7 @@ class _UpdatePlanPageState extends State patientProgressNote.planNote = value; model.progressNoteText = value; - widget.changeStateFun(); + widget.changeStateFun!(); }); }, ), @@ -258,7 +258,7 @@ class _UpdatePlanPageState extends State .getDayMonthYearDateFormatted( DateTime.parse( patientProgressNote - .createdOn)) + .createdOn!)) : AppDateUtils .getDayMonthYearDateFormatted( DateTime.now()), @@ -293,7 +293,7 @@ class _UpdatePlanPageState extends State ? AppDateUtils.getHour( DateTime.parse( patientProgressNote - .createdOn)) + .createdOn!)) : AppDateUtils.getHour( DateTime.now()), fontWeight: FontWeight.w600, @@ -322,7 +322,7 @@ class _UpdatePlanPageState extends State setState(() { isAddProgress = true; widget.sOAPViewModel - .isAddProgress = true; + !.isAddProgress = true; }); }, child: Icon( @@ -354,62 +354,62 @@ class _UpdatePlanPageState extends State submitPlan(SOAPViewModel model) async { if (progressNoteController.text.isNotEmpty) { - widget.changeLoadingState(true); + widget.changeLoadingState!(true); PostProgressNoteRequestModel postProgressNoteRequestModel = new PostProgressNoteRequestModel( - patientMRN: widget.patientInfo.patientMRN, - episodeId: widget.patientInfo.episodeNo, - appointmentNo: widget.patientInfo.appointmentNo, + patientMRN: widget.patientInfo!.patientMRN, + episodeId: widget.patientInfo!.episodeNo!, + appointmentNo: widget.patientInfo!.appointmentNo, planNote: patientProgressNote.planNote, doctorID: '', editedBy: ''); - if (widget.sOAPViewModel.patientProgressNoteList.isEmpty) { + if (widget.sOAPViewModel!.patientProgressNoteList.isEmpty) { await widget.sOAPViewModel - .postProgressNote(postProgressNoteRequestModel); + ! .postProgressNote(postProgressNoteRequestModel); } else { - Map profile = await sharedPref.getObj(DOCTOR_PROFILE); + Map profile = await sharedPref.getObj(DOCTOR_PROFILE); DoctorProfileModel doctorProfile = DoctorProfileModel.fromJson(profile); postProgressNoteRequestModel.editedBy = doctorProfile.doctorID; await widget.sOAPViewModel - .patchProgressNote(postProgressNoteRequestModel); + !.patchProgressNote(postProgressNoteRequestModel); } - if (widget.sOAPViewModel.state == ViewState.ErrorLocal) { - Utils.showErrorToast(widget.sOAPViewModel.error); + if (widget.sOAPViewModel!.state == ViewState.ErrorLocal) { + Utils.showErrorToast(widget.sOAPViewModel!.error); } else { GetProgressNoteReqModel getGetProgressNoteReqModel = GetProgressNoteReqModel( appointmentNo: - int.parse(widget.patientInfo.appointmentNo.toString()), - patientMRN: widget.patientInfo.patientMRN, - episodeID: widget.patientInfo.episodeNo.toString(), + int.parse(widget.patientInfo!.appointmentNo.toString()), + patientMRN: widget.patientInfo!.patientMRN, + episodeID: widget.patientInfo!.episodeNo.toString(), editedBy: '', doctorID: ''); await widget.sOAPViewModel - .getPatientProgressNote(getGetProgressNoteReqModel); - if (widget.sOAPViewModel.patientProgressNoteList.isNotEmpty) { + !.getPatientProgressNote(getGetProgressNoteReqModel); + if (widget.sOAPViewModel!.patientProgressNoteList.isNotEmpty) { progressNoteController.text = Utils.parseHtmlString( - widget.sOAPViewModel.patientProgressNoteList[0].planNote); + widget.sOAPViewModel!.patientProgressNoteList[0].planNote!); patientProgressNote.planNote = progressNoteController.text; patientProgressNote.createdByName = - widget.sOAPViewModel.patientProgressNoteList[0].createdByName; + widget.sOAPViewModel!.patientProgressNoteList[0].createdByName; patientProgressNote.createdOn = - widget.sOAPViewModel.patientProgressNoteList[0].createdOn; + widget.sOAPViewModel!.patientProgressNoteList[0].createdOn; patientProgressNote.editedOn = - widget.sOAPViewModel.patientProgressNoteList[0].editedOn; + widget.sOAPViewModel!.patientProgressNoteList[0].editedOn; patientProgressNote.editedByName = - widget.sOAPViewModel.patientProgressNoteList[0].editedByName; + widget.sOAPViewModel!.patientProgressNoteList[0].editedByName; patientProgressNote.appointmentNo = - widget.sOAPViewModel.patientProgressNoteList[0].appointmentNo; + widget.sOAPViewModel!.patientProgressNoteList[0].appointmentNo; setState(() { isAddProgress = false; - widget.sOAPViewModel.isAddProgress = false; + widget.sOAPViewModel!.isAddProgress = false; }); } } - widget.changeLoadingState(false); + widget.changeLoadingState!(false); } else { Utils.showErrorToast(TranslationBase.of(context).progressNoteErrorMsg); } diff --git a/lib/screens/patients/profile/soap_update/shared_soap_widgets/SOAP_open_items.dart b/lib/screens/patients/profile/soap_update/shared_soap_widgets/SOAP_open_items.dart index 0e8c7301..071d3fa3 100644 --- a/lib/screens/patients/profile/soap_update/shared_soap_widgets/SOAP_open_items.dart +++ b/lib/screens/patients/profile/soap_update/shared_soap_widgets/SOAP_open_items.dart @@ -4,15 +4,15 @@ import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart'; import 'package:flutter/material.dart'; class SOAPOpenItems extends StatelessWidget { - final Function onTap; + final Function? onTap; final String label; - const SOAPOpenItems({Key key, this.onTap, this.label}) : super(key: key); + const SOAPOpenItems({Key? key, this.onTap, this.label = ''}) : super(key: key); @override Widget build(BuildContext context) { return InkWell( - onTap: onTap, + onTap: onTap!(), child: Container( padding: EdgeInsets.symmetric(vertical: 8, horizontal: 8.0), margin: EdgeInsets.symmetric(vertical: 8), 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 a15bf5bd..cecd05a3 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 @@ -7,15 +7,15 @@ import 'package:flutter/material.dart'; class SOAPStepHeader extends StatelessWidget { const SOAPStepHeader({ - Key key, + Key? key, this.currentIndex, this.changePageViewIndex, this.patientInfo, }) : super(key: key); - final int currentIndex; - final Function changePageViewIndex; - final PatiantInformtion patientInfo; + final int? currentIndex; + final Function? changePageViewIndex; + final PatiantInformtion? patientInfo; @override Widget build(BuildContext context) { @@ -32,16 +32,14 @@ class SOAPStepHeader extends StatelessWidget { ), AppText( TranslationBase.of(context).createNew, - fontSize: SizeConfig.getTextMultiplierBasedOnWidth() * - (SizeConfig.isWidthLarge ? 3 : 4), + fontSize: SizeConfig.getTextMultiplierBasedOnWidth() * (SizeConfig.isWidthLarge ? 3 : 4), fontWeight: FontWeight.w700, letterSpacing: -0.72, color: Color(0xFF2E303A), ), AppText( TranslationBase.of(context).episode, - fontSize: SizeConfig.getTextMultiplierBasedOnWidth() * - (SizeConfig.isWidthLarge ? 6 : 8), + fontSize: SizeConfig.getTextMultiplierBasedOnWidth() * (SizeConfig.isWidthLarge ? 6 : 8), fontWeight: FontWeight.bold, letterSpacing: -1.44, color: Color(0xFF2E303A), @@ -49,14 +47,13 @@ class SOAPStepHeader extends StatelessWidget { Container( color: Theme.of(context).scaffoldBackgroundColor, child: StepsWidget( - index: currentIndex, + index: currentIndex ?? 0, changeCurrentTab: changePageViewIndex, patientInfo: patientInfo, ), ), SizedBox( - height: SizeConfig.heightMultiplier! * - (SizeConfig.isHeightVeryShort ? 1 : 2), + 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 2a7d69d8..4144fdf6 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 @@ -2,10 +2,10 @@ import 'package:doctor_app_flutter/config/size_config.dart'; import 'package:doctor_app_flutter/icons_app/doctor_app_icons.dart'; import 'package:flutter/material.dart'; -class BottomSheetTitle extends StatelessWidget with PreferredSizeWidget { +class BottomSheetTitle extends StatelessWidget { BottomSheetTitle({ - Key key, - this.title, + Key? key, + this.title = '', }) : super(key: key); final String title; diff --git a/lib/screens/patients/profile/soap_update/shared_soap_widgets/expandable_SOAP_widget.dart b/lib/screens/patients/profile/soap_update/shared_soap_widgets/expandable_SOAP_widget.dart index e9164cdc..00bfbca0 100644 --- a/lib/screens/patients/profile/soap_update/shared_soap_widgets/expandable_SOAP_widget.dart +++ b/lib/screens/patients/profile/soap_update/shared_soap_widgets/expandable_SOAP_widget.dart @@ -8,25 +8,17 @@ import 'package:hexcolor/hexcolor.dart'; class ExpandableSOAPWidget extends StatelessWidget { final bool isExpanded; - final Widget child; - final Function onTap; + final Widget? child; + final Function? onTap; final headerTitle; final bool isRequired; - const ExpandableSOAPWidget( - {Key key, - this.isExpanded, - this.child, - this.onTap, - this.headerTitle, - this.isRequired = true}) - : super(key: key); + const ExpandableSOAPWidget({Key? key, this.isExpanded = false, this.child, this.onTap, this.headerTitle, this.isRequired = true}) : super(key: key); @override Widget build(BuildContext context) { return Container( - padding: EdgeInsets.symmetric( - vertical: SizeConfig.isHeightVeryShort ? 10 : 20, horizontal: 10), + padding: EdgeInsets.symmetric(vertical: SizeConfig.isHeightVeryShort ? 10 : 20, horizontal: 10), decoration: BoxDecoration( color: Colors.white, borderRadius: BorderRadius.all( @@ -36,12 +28,12 @@ class ExpandableSOAPWidget extends StatelessWidget { ), child: HeaderBodyExpandableNotifier( headerWidget: InkWell( - onTap: onTap, + onTap: onTap!(), child: Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ InkWell( - onTap: onTap, + onTap: onTap!(), child: Row( children: [ AppText( @@ -66,15 +58,13 @@ class ExpandableSOAPWidget extends StatelessWidget { ), ), InkWell( - onTap: onTap, - child: Icon(isExpanded - ? EvaIcons.arrowIosUpwardOutline - : EvaIcons.arrowIosDownwardOutline), + onTap: onTap!(), + child: Icon(isExpanded ? EvaIcons.arrowIosUpwardOutline : EvaIcons.arrowIosDownwardOutline), ) ], ), ), - bodyWidget: child, + bodyWidget: child!, isExpand: isExpanded, ), ); diff --git a/lib/screens/patients/profile/soap_update/shared_soap_widgets/remark_text.dart b/lib/screens/patients/profile/soap_update/shared_soap_widgets/remark_text.dart index c3a66b77..6b0584c9 100644 --- a/lib/screens/patients/profile/soap_update/shared_soap_widgets/remark_text.dart +++ b/lib/screens/patients/profile/soap_update/shared_soap_widgets/remark_text.dart @@ -5,8 +5,8 @@ class RemarkText extends StatelessWidget { final String remark; const RemarkText({ - Key key, - this.remark, + Key? key, + this.remark = '', }) : super(key: key); @override diff --git a/lib/screens/patients/profile/soap_update/shared_soap_widgets/remove_button.dart b/lib/screens/patients/profile/soap_update/shared_soap_widgets/remove_button.dart index 17a4ce62..52bee25b 100644 --- a/lib/screens/patients/profile/soap_update/shared_soap_widgets/remove_button.dart +++ b/lib/screens/patients/profile/soap_update/shared_soap_widgets/remove_button.dart @@ -6,10 +6,10 @@ import 'package:font_awesome_flutter/font_awesome_flutter.dart'; import 'package:hexcolor/hexcolor.dart'; class RemoveButton extends StatelessWidget { - final Function onTap; + final Function? onTap; final String label; - const RemoveButton({Key key, this.onTap, this.label}) : super(key: key); + const RemoveButton({Key? key, this.onTap, this.label = ''}) : super(key: key); @override Widget build(BuildContext context) { @@ -32,7 +32,7 @@ class RemoveButton extends StatelessWidget { ), ], ), - onTap: onTap, + onTap: onTap!(), ); } } diff --git a/lib/screens/patients/profile/soap_update/shared_soap_widgets/steper/Step_details_widget.dart b/lib/screens/patients/profile/soap_update/shared_soap_widgets/steper/Step_details_widget.dart index 75ec62f8..d81f8a4b 100644 --- a/lib/screens/patients/profile/soap_update/shared_soap_widgets/steper/Step_details_widget.dart +++ b/lib/screens/patients/profile/soap_update/shared_soap_widgets/steper/Step_details_widget.dart @@ -7,8 +7,8 @@ class StepDetailsWidget extends StatelessWidget { final double marginLeft; const StepDetailsWidget({ - Key key, - this.stepLabel, + Key? key, + this.stepLabel = '', this.marginLeft = 0, }) : super(key: key); diff --git a/lib/screens/patients/profile/soap_update/shared_soap_widgets/steper/status_Label.dart b/lib/screens/patients/profile/soap_update/shared_soap_widgets/steper/status_Label.dart index aaf05f96..70326fd4 100644 --- a/lib/screens/patients/profile/soap_update/shared_soap_widgets/steper/status_Label.dart +++ b/lib/screens/patients/profile/soap_update/shared_soap_widgets/steper/status_Label.dart @@ -1,16 +1,15 @@ +import 'package:doctor_app_flutter/config/config.dart'; import 'package:doctor_app_flutter/config/size_config.dart'; import 'package:doctor_app_flutter/utils/translations_delegate_base_utils.dart'; import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart'; import 'package:flutter/material.dart'; import 'package:hexcolor/hexcolor.dart'; -import '../../../../../../config/config.dart'; - class StatusLabel extends StatelessWidget { const StatusLabel({ - Key key, - this.stepId, - this.selectedStepId, + Key? key, + this.stepId = 0, + this.selectedStepId = 0, }) : super(key: key); final int stepId; diff --git a/lib/screens/patients/profile/soap_update/shared_soap_widgets/steper/steps_widget.dart b/lib/screens/patients/profile/soap_update/shared_soap_widgets/steper/steps_widget.dart index 30e9a8c2..e2f21a7a 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 @@ -1,3 +1,4 @@ +import 'package:doctor_app_flutter/config/config.dart'; import 'package:doctor_app_flutter/config/size_config.dart'; import 'package:doctor_app_flutter/core/viewModel/project_view_model.dart'; import 'package:doctor_app_flutter/core/model/patient/patiant_info_model.dart'; @@ -7,21 +8,15 @@ import 'package:flutter/material.dart'; import 'package:font_awesome_flutter/font_awesome_flutter.dart'; import 'package:provider/provider.dart'; -import '../../../../../../config/config.dart'; import 'Step_details_widget.dart'; class StepsWidget extends StatelessWidget { final int index; - final Function changeCurrentTab; + final Function? changeCurrentTab; final double height; - final PatiantInformtion patientInfo; + final PatiantInformtion? patientInfo; - StepsWidget( - {Key key, - this.index, - this.changeCurrentTab, - this.height = 0.0, - this.patientInfo}); + StepsWidget({Key? key, this.index = 0, this.changeCurrentTab, this.height = 0.0, this.patientInfo}); @override Widget build(BuildContext context) { @@ -36,8 +31,7 @@ class StepsWidget extends StatelessWidget { : SizeConfig.isHeightShort ? 10 : 10); - double containerHeight = - SizeConfig.heightMultiplier! * (SizeConfig.isHeightVeryShort ? 16 : 15); + double containerHeight = SizeConfig.heightMultiplier! * (SizeConfig.isHeightVeryShort ? 16 : 15); return !projectViewModel.isArabic ? Stack( @@ -51,11 +45,7 @@ class StepsWidget extends StatelessWidget { top: 30, child: Center( child: Container( - width: MediaQuery.of(context).size.width * - (patientInfo.admissionNo == null || - patientInfo.admissionNo.isEmpty - ? 0.9 - : 0.85), + width: MediaQuery.of(context).size.width * (patientInfo!.admissionNo == null || patientInfo!.admissionNo!.isEmpty ? 0.9 : 0.85), child: Divider( color: Colors.grey, height: 0.75, @@ -68,7 +58,7 @@ class StepsWidget extends StatelessWidget { top: circleTop, left: 0, child: InkWell( - onTap: () => changeCurrentTab(0), + onTap: () => changeCurrentTab!(0), child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ @@ -80,8 +70,7 @@ class StepsWidget extends StatelessWidget { ? Border.all(color: Color(0xFFCC9B14), width: 2) : index > 0 ? null - : Border.all( - color: Colors.black, width: 0.75), + : Border.all(color: Colors.black, width: 0.75), shape: BoxShape.circle, color: index == 0 ? Color(0xFFCC9B14) @@ -115,12 +104,9 @@ class StepsWidget extends StatelessWidget { ), Positioned( top: circleTop, - left: patientInfo.admissionNo == null || - patientInfo.admissionNo.isEmpty - ? MediaQuery.of(context).size.width * 0.25 - : MediaQuery.of(context).size.width * 0.71, + left: patientInfo!.admissionNo == null || patientInfo!.admissionNo!.isEmpty ? MediaQuery.of(context).size.width * 0.25 : MediaQuery.of(context).size.width * 0.71, child: InkWell( - onTap: () => index >= 1 ? changeCurrentTab(1) : null, + onTap: () => index >= 1 ? changeCurrentTab!(1) : null, child: Column( crossAxisAlignment: CrossAxisAlignment.center, children: [ @@ -132,8 +118,7 @@ class StepsWidget extends StatelessWidget { ? Border.all(color: Color(0xFFCC9B14), width: 2) : index > 2 ? null - : Border.all( - color: Color(0xFFCCCCCC), width: 0.75), + : Border.all(color: Color(0xFFCCCCCC), width: 0.75), shape: BoxShape.circle, color: index == 1 ? Color(0xFFCC9B14) @@ -167,14 +152,13 @@ class StepsWidget extends StatelessWidget { ), ), ), - if (patientInfo.admissionNo == null || - patientInfo.admissionNo.isEmpty) + if (patientInfo!.admissionNo == null || patientInfo!.admissionNo!.isEmpty) Positioned( top: circleTop, left: MediaQuery.of(context).size.width * 0.47, child: InkWell( onTap: () { - if (index >= 3) changeCurrentTab(2); + if (index >= 3) changeCurrentTab!(2); }, child: Column( crossAxisAlignment: CrossAxisAlignment.center, @@ -187,8 +171,7 @@ class StepsWidget extends StatelessWidget { ? Border.all(color: Color(0xFFCC9B14), width: 2) : index > 2 ? null - : Border.all( - color: Color(0xFFCCCCCC), width: 0.75), + : Border.all(color: Color(0xFFCCCCCC), width: 0.75), shape: BoxShape.circle, color: index == 2 ? Color(0xFFCC9B14) @@ -222,13 +205,12 @@ class StepsWidget extends StatelessWidget { ), ), ), - if (patientInfo.admissionNo == null || - patientInfo.admissionNo.isEmpty) + if (patientInfo!.admissionNo == null || patientInfo!.admissionNo!.isEmpty) Positioned( top: circleTop, right: 0, child: InkWell( - onTap: () => index >= 3 ? changeCurrentTab(4) : null, + onTap: () => index >= 3 ? changeCurrentTab!(4) : null, child: Column( crossAxisAlignment: CrossAxisAlignment.end, children: [ @@ -240,8 +222,7 @@ class StepsWidget extends StatelessWidget { ? Border.all(color: Color(0xFFCC9B14), width: 2) : index > 3 ? null - : Border.all( - color: Color(0xFFCCCCCC), width: 0.75), + : Border.all(color: Color(0xFFCCCCCC), width: 0.75), shape: BoxShape.circle, color: index == 3 ? Color(0xFFCC9B14) @@ -289,11 +270,7 @@ class StepsWidget extends StatelessWidget { top: 30, child: Center( child: Container( - width: MediaQuery.of(context).size.width * - (patientInfo.admissionNo == null || - patientInfo.admissionNo.isEmpty - ? 0.9 - : 0.85), + width: MediaQuery.of(context).size.width * (patientInfo!.admissionNo == null || patientInfo!.admissionNo!.isEmpty ? 0.9 : 0.85), child: Divider( color: Colors.grey, height: 0.75, @@ -306,7 +283,7 @@ class StepsWidget extends StatelessWidget { top: circleTop, right: 0, child: InkWell( - onTap: () => changeCurrentTab(0), + onTap: () => changeCurrentTab!(0), child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ @@ -318,8 +295,7 @@ class StepsWidget extends StatelessWidget { ? Border.all(color: Color(0xFFCC9B14), width: 2) : index > 0 ? null - : Border.all( - color: Colors.black, width: 0.75), + : Border.all(color: Colors.black, width: 0.75), shape: BoxShape.circle, color: index == 0 ? Color(0xFFCC9B14) @@ -352,13 +328,9 @@ class StepsWidget extends StatelessWidget { ), Positioned( top: circleTop, - right: MediaQuery.of(context).size.width * - (patientInfo.admissionNo == null || - patientInfo.admissionNo.isEmpty - ? 0.25 - : 0.71), + right: MediaQuery.of(context).size.width * (patientInfo!.admissionNo == null || patientInfo!.admissionNo!.isEmpty ? 0.25 : 0.71), child: InkWell( - onTap: () => index >= 2 ? changeCurrentTab(1) : null, + onTap: () => index >= 2 ? changeCurrentTab!(1) : null, child: Column( crossAxisAlignment: CrossAxisAlignment.center, children: [ @@ -370,8 +342,7 @@ class StepsWidget extends StatelessWidget { ? Border.all(color: Color(0xFFCC9B14), width: 2) : index > 2 ? null - : Border.all( - color: Color(0xFFCCCCCC), width: 0.75), + : Border.all(color: Color(0xFFCCCCCC), width: 0.75), shape: BoxShape.circle, color: index == 1 ? Color(0xFFCC9B14) @@ -402,13 +373,12 @@ class StepsWidget extends StatelessWidget { ), ), ), - if (patientInfo.admissionNo == null || - patientInfo.admissionNo.isEmpty) + if (patientInfo!.admissionNo == null || patientInfo!.admissionNo!.isEmpty) Positioned( top: circleTop, right: MediaQuery.of(context).size.width * 0.50, child: InkWell( - onTap: () => index >= 3 ? changeCurrentTab(2) : null, + onTap: () => index >= 3 ? changeCurrentTab!(2) : null, child: Column( crossAxisAlignment: CrossAxisAlignment.center, children: [ @@ -420,8 +390,7 @@ class StepsWidget extends StatelessWidget { ? Border.all(color: Color(0xFFCC9B14), width: 2) : index > 2 ? null - : Border.all( - color: Color(0xFFCCCCCC), width: 0.75), + : Border.all(color: Color(0xFFCCCCCC), width: 0.75), shape: BoxShape.circle, color: index == 2 ? Color(0xFFCC9B14) @@ -457,13 +426,12 @@ class StepsWidget extends StatelessWidget { ), ), ), - if (patientInfo.admissionNo == null || - patientInfo.admissionNo.isEmpty) + if (patientInfo!.admissionNo == null || patientInfo!.admissionNo!.isEmpty) Positioned( top: circleTop, left: 0, child: InkWell( - onTap: () => index >= 3 ? changeCurrentTab(4) : null, + onTap: () => index >= 3 ? changeCurrentTab!(4) : null, child: Column( crossAxisAlignment: CrossAxisAlignment.end, children: [ @@ -475,8 +443,7 @@ class StepsWidget extends StatelessWidget { ? Border.all(color: Color(0xFFCC9B14), width: 2) : index > 3 ? null - : Border.all( - color: Color(0xFFCCCCCC), width: 0.75), + : Border.all(color: Color(0xFFCCCCCC), width: 0.75), shape: BoxShape.circle, color: index == 3 ? Color(0xFFCC9B14) diff --git a/lib/screens/patients/profile/soap_update/soap_utils.dart b/lib/screens/patients/profile/soap_update/soap_utils.dart index 29ed59d7..a7206aa2 100644 --- a/lib/screens/patients/profile/soap_update/soap_utils.dart +++ b/lib/screens/patients/profile/soap_update/soap_utils.dart @@ -20,7 +20,7 @@ class SoapUtils { isChecked = false, remark, isLocal = true, - int createdBy, + int? createdBy, bool isExpanded = false}) { MySelectedAllergy mySelectedAllergy = MySelectedAllergy( selectedAllergy: allergy, diff --git a/lib/screens/patients/profile/soap_update/subjective/allergies/add_allergies.dart b/lib/screens/patients/profile/soap_update/subjective/allergies/add_allergies.dart index abcc72ad..e06bd80d 100644 --- a/lib/screens/patients/profile/soap_update/subjective/allergies/add_allergies.dart +++ b/lib/screens/patients/profile/soap_update/subjective/allergies/add_allergies.dart @@ -16,25 +16,24 @@ import '../../shared_soap_widgets/bottom_sheet_title.dart'; import 'master_key_checkbox_search_allergies_widget.dart'; class AddAllergies extends StatefulWidget { - final Function addAllergiesFun; - final List myAllergiesList; + final Function? addAllergiesFun; + final List? myAllergiesList; - const AddAllergies({Key key, this.addAllergiesFun, this.myAllergiesList}) - : super(key: key); + const AddAllergies({Key? key, this.addAllergiesFun, this.myAllergiesList}) : super(key: key); @override _AddAllergiesState createState() => _AddAllergiesState(); } class _AddAllergiesState extends State { - List allergiesList; - List allergySeverityList; - List myAllergiesListLocal; + List allergiesList = []; + List allergySeverityList = []; + List myAllergiesListLocal = []; @override initState() { super.initState(); - myAllergiesListLocal = [...widget.myAllergiesList]; + myAllergiesListLocal = [...?widget.myAllergiesList]; } GlobalKey key = new GlobalKey>(); @@ -61,54 +60,48 @@ class _AddAllergiesState extends State { ), body: Center( child: Container( - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - SizedBox( - height: 10, - ), - SizedBox( - height: 16, - ), - Expanded( + child: Column(crossAxisAlignment: CrossAxisAlignment.start, children: [ + SizedBox( + height: 10, + ), + SizedBox( + height: 16, + ), + Expanded( + child: Center( + child: FractionallySizedBox( + widthFactor: 0.9, child: Center( - child: FractionallySizedBox( - widthFactor: 0.9, - child: Center( - child: NetworkBaseView( - baseViewModel: model, - child: MasterKeyCheckboxSearchAllergiesWidget( - model: model, - masterList: model.allergiesList, - removeAllergy: (master) { - setState(() { - removeAllergyFromLocalList(master); - }); - }, - addAllergy: - (MySelectedAllergy mySelectedAllergy) { - addAllergyLocally(mySelectedAllergy); - }, - addSelectedAllergy: () { - setState(() { - widget - .addAllergiesFun(myAllergiesListLocal); - }); - }, - isServiceSelected: (master) => - isServiceSelected(master), - getServiceSelectedAllergy: (master) => - getSelectedAllergy(master), - ), - ), + child: NetworkBaseView( + baseViewModel: model, + child: MasterKeyCheckboxSearchAllergiesWidget( + model: model, + masterList: model.allergiesList, + removeAllergy: (master) { + setState(() { + removeAllergyFromLocalList(master); + }); + }, + addAllergy: (MySelectedAllergy mySelectedAllergy) { + addAllergyLocally(mySelectedAllergy); + }, + addSelectedAllergy: () { + setState(() { + widget.addAllergiesFun!(myAllergiesListLocal); + }); + }, + isServiceSelected: (master) => isServiceSelected(master), + getServiceSelectedAllergy: (master) => getSelectedAllergy(master), ), ), ), ), - SizedBox( - height: MediaQuery.of(context).size.height * 0.11, - ), - ]), + ), + ), + SizedBox( + height: MediaQuery.of(context).size.height * 0.11, + ), + ]), ), ), bottomSheet: model.state != ViewState.Idle @@ -119,7 +112,7 @@ class _AddAllergiesState extends State { label: TranslationBase.of(context).addAllergies, onTap: () { setState(() { - widget.addAllergiesFun(myAllergiesListLocal); + widget.addAllergiesFun!(myAllergiesListLocal); }); }, ), @@ -129,11 +122,8 @@ class _AddAllergiesState extends State { } isServiceSelected(MasterKeyModel masterKey) { - Iterable allergy = myAllergiesListLocal.where( - (element) => - masterKey.id == element.selectedAllergy.id && - masterKey.typeId == element.selectedAllergy.typeId && - element.isChecked); + Iterable allergy = + myAllergiesListLocal.where((element) => masterKey.id == element.selectedAllergy?.id && masterKey.typeId == element.selectedAllergy?.typeId && element.isChecked!); if (allergy.length > 0) { return true; } @@ -141,20 +131,16 @@ class _AddAllergiesState extends State { } removeAllergyFromLocalList(MasterKeyModel masterKey) { - myAllergiesListLocal - .removeWhere((element) => element.selectedAllergy.id == masterKey.id); + myAllergiesListLocal.removeWhere((element) => element.selectedAllergy!.id == masterKey.id); } MySelectedAllergy getSelectedAllergy(MasterKeyModel masterKey) { - Iterable allergy = myAllergiesListLocal.where( - (element) => - masterKey.id == element.selectedAllergy.id && - masterKey.typeId == element.selectedAllergy.typeId && - element.isChecked); + Iterable allergy = + myAllergiesListLocal.where((element) => masterKey.id == element.selectedAllergy!.id && masterKey.typeId == element.selectedAllergy!.typeId && element.isChecked!); if (allergy.length > 0) { return allergy.first; } - return null; + return MySelectedAllergy(); } addAllergyLocally(MySelectedAllergy mySelectedAllergy) { @@ -164,18 +150,13 @@ class _AddAllergiesState extends State { setState(() { List allergy = // ignore: missing_return - myAllergiesListLocal - .where((element) => - mySelectedAllergy.selectedAllergy.id == - element.selectedAllergy.id) - .toList(); + myAllergiesListLocal.where((element) => mySelectedAllergy.selectedAllergy!.id == element.selectedAllergy!.id).toList(); if (allergy.isEmpty) { myAllergiesListLocal.add(mySelectedAllergy); } else { allergy.first.selectedAllergy = mySelectedAllergy.selectedAllergy; - allergy.first.selectedAllergySeverity = - mySelectedAllergy.selectedAllergySeverity; + allergy.first.selectedAllergySeverity = mySelectedAllergy.selectedAllergySeverity; allergy.first.remark = mySelectedAllergy.remark; allergy.first.isChecked = mySelectedAllergy.isChecked; } diff --git a/lib/screens/patients/profile/soap_update/subjective/allergies/allergies_item.dart b/lib/screens/patients/profile/soap_update/subjective/allergies/allergies_item.dart index 8d5aa253..957c23db 100644 --- a/lib/screens/patients/profile/soap_update/subjective/allergies/allergies_item.dart +++ b/lib/screens/patients/profile/soap_update/subjective/allergies/allergies_item.dart @@ -17,49 +17,39 @@ import 'package:provider/provider.dart'; import '../../soap_utils.dart'; class AddAllergiesItem extends StatefulWidget { - final SOAPViewModel model; - final Function(MasterKeyModel) removeAllergy; - final Function(MySelectedAllergy mySelectedAllergy) addAllergy; - final bool Function(MasterKeyModel) isServiceSelected; - final MySelectedAllergy Function(MasterKeyModel) getServiceSelectedAllergy; + final SOAPViewModel? model; + final Function(MasterKeyModel)? removeAllergy; + final Function(MySelectedAllergy mySelectedAllergy)? addAllergy; + final bool Function(MasterKeyModel)? isServiceSelected; + final MySelectedAllergy Function(MasterKeyModel)? getServiceSelectedAllergy; + final MasterKeyModel? item; - final MasterKeyModel item; - - const AddAllergiesItem( - {Key key, - this.model, - this.removeAllergy, - this.addAllergy, - this.isServiceSelected, - this.getServiceSelectedAllergy, - this.item}) - : super(key: key); + const AddAllergiesItem({Key? key, this.model, this.removeAllergy, this.addAllergy, this.isServiceSelected, this.getServiceSelectedAllergy, this.item}) : super(key: key); @override _AddAllergiesItemState createState() => _AddAllergiesItemState(); } class _AddAllergiesItemState extends State { - MasterKeyModel _selectedAllergySeverity; + MasterKeyModel _selectedAllergySeverity = MasterKeyModel(); bool isSubmitted = false; @override Widget build(BuildContext context) { ProjectViewModel projectViewModel = Provider.of(context); - bool isSelected = widget.isServiceSelected(widget.item); - MySelectedAllergy mySelectedAllergy; + bool isSelected = widget.isServiceSelected!(widget.item!); + MySelectedAllergy mySelectedAllergy = MySelectedAllergy(); if (isSelected) { - mySelectedAllergy = widget.getServiceSelectedAllergy(widget.item); + mySelectedAllergy = widget.getServiceSelectedAllergy!(widget.item!); } - TextEditingController remarkController = TextEditingController( - text: isSelected ? mySelectedAllergy.remark : null); + TextEditingController remarkController = TextEditingController(text: isSelected ? mySelectedAllergy.remark : null); TextEditingController severityController = TextEditingController( text: isSelected ? mySelectedAllergy.selectedAllergySeverity != null ? projectViewModel.isArabic - ? mySelectedAllergy.selectedAllergySeverity.nameAr - : mySelectedAllergy.selectedAllergySeverity.nameEn + ? mySelectedAllergy.selectedAllergySeverity!.nameAr + : mySelectedAllergy.selectedAllergySeverity!.nameEn : null : null); return HeaderBodyExpandableNotifier( @@ -69,9 +59,9 @@ class _AddAllergiesItemState extends State { Row( children: [ Checkbox( - value: widget.isServiceSelected(widget.item), + value: widget.isServiceSelected!(widget.item!), activeColor: Colors.red[800], - onChanged: (bool newValue) { + onChanged: (bool? newValue) { onTapItem(); }), InkWell( @@ -79,13 +69,12 @@ class _AddAllergiesItemState extends State { child: Container( child: AppText( projectViewModel.isArabic - ? widget.item.nameAr != "" - ? widget.item.nameAr - : widget.item.nameEn - : widget.item.nameEn, + ? widget.item!.nameAr != "" + ? widget.item!.nameAr! + : widget.item!.nameEn! + : widget.item!.nameEn!, color: Color(0xFF575757), - fontSize: SizeConfig.getTextMultiplierBasedOnWidth() * - (SizeConfig.isWidthLarge ? 3 : 3.8), + fontSize: SizeConfig.getTextMultiplierBasedOnWidth() * (SizeConfig.isWidthLarge ? 3 : 3.8), letterSpacing: -0.56, ), width: MediaQuery.of(context).size.width * 0.55, @@ -97,15 +86,12 @@ class _AddAllergiesItemState extends State { onTap: () { if (mySelectedAllergy != null) { setState(() { - mySelectedAllergy.isExpanded = - mySelectedAllergy.isExpanded ? false : true; + mySelectedAllergy.isExpanded = mySelectedAllergy.isExpanded == null ? false : true; }); } }, child: Icon( - (mySelectedAllergy != null ? mySelectedAllergy.isExpanded : false) - ? EvaIcons.arrowIosUpwardOutline - : EvaIcons.arrowIosDownwardOutline, + (mySelectedAllergy != null ? mySelectedAllergy.isExpanded! : false) ? EvaIcons.arrowIosUpwardOutline : EvaIcons.arrowIosDownwardOutline, color: Color(0xFF575757), size: 20, ), @@ -119,17 +105,15 @@ class _AddAllergiesItemState extends State { child: Column( children: [ AppTextFieldCustom( - onClick: widget.model.allergySeverityList != null + onClick: widget.model!.allergySeverityList != null ? () { MasterKeyDailog dialog = MasterKeyDailog( - list: widget.model.allergySeverityList, - selectedValue: - mySelectedAllergy.selectedAllergySeverity, + list: widget.model!.allergySeverityList, + selectedValue: mySelectedAllergy.selectedAllergySeverity!, okText: TranslationBase.of(context).ok, okFunction: (selectedValue) { setState(() { - mySelectedAllergy.selectedAllergySeverity = - selectedValue; + mySelectedAllergy.selectedAllergySeverity = selectedValue; }); }, ); @@ -141,18 +125,15 @@ class _AddAllergiesItemState extends State { }, ); } - : null, + : () {}, isTextFieldHasSuffix: true, hintText: TranslationBase.of(context).selectSeverity + "*", enabled: false, maxLines: 1, minLines: 1, height: Utils.getTextFieldHeight(), - validationError: mySelectedAllergy != null && - mySelectedAllergy.selectedAllergySeverity == null && - mySelectedAllergy.hasValidationError - ? TranslationBase.of(context).severityValidationError - : null, + validationError: + mySelectedAllergy != null && mySelectedAllergy.selectedAllergySeverity == null && mySelectedAllergy.hasValidationError! ? TranslationBase.of(context).severityValidationError : "", controller: severityController, ), SizedBox( @@ -177,24 +158,17 @@ class _AddAllergiesItemState extends State { ), ), ), - isExpand: - mySelectedAllergy != null ? mySelectedAllergy.isExpanded : false, + isExpand: mySelectedAllergy != null ? mySelectedAllergy.isExpanded! : false, ); } onTapItem() { setState(() { - if (widget.isServiceSelected(widget.item)) { - widget.removeAllergy(widget.item); + if (widget.isServiceSelected!(widget.item!)) { + widget.removeAllergy!(widget.item!); } else { - MySelectedAllergy mySelectedAllergy = - SoapUtils.generateMySelectedAllergy( - allergy: widget.item, - allergySeverity: _selectedAllergySeverity, - remark: null, - isChecked: true, - isExpanded: true); - widget.addAllergy(mySelectedAllergy); + MySelectedAllergy mySelectedAllergy = SoapUtils.generateMySelectedAllergy(allergy: widget.item, allergySeverity: _selectedAllergySeverity, remark: null, isChecked: true, isExpanded: true); + widget.addAllergy!(mySelectedAllergy); } }); } 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 7931d064..b6b64e2d 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 @@ -11,19 +11,19 @@ import 'package:flutter/material.dart'; import 'allergies_item.dart'; class MasterKeyCheckboxSearchAllergiesWidget extends StatefulWidget { - final SOAPViewModel model; - final Function() addSelectedAllergy; - final Function(MasterKeyModel) removeAllergy; - final Function(MySelectedAllergy mySelectedAllergy) addAllergy; - final bool Function(MasterKeyModel) isServiceSelected; - final MySelectedAllergy Function(MasterKeyModel) getServiceSelectedAllergy; + final SOAPViewModel? model; + final Function()? addSelectedAllergy; + final Function(MasterKeyModel)? removeAllergy; + final Function(MySelectedAllergy mySelectedAllergy)? addAllergy; + final bool Function(MasterKeyModel)? isServiceSelected; + final MySelectedAllergy Function(MasterKeyModel)? getServiceSelectedAllergy; - final List masterList; - final String buttonName; - final String hintSearchText; + final List? masterList; + final String? buttonName; + final String? hintSearchText; MasterKeyCheckboxSearchAllergiesWidget( - {Key key, + {Key? key, this.model, this.addSelectedAllergy, this.removeAllergy, @@ -47,7 +47,7 @@ class _MasterKeyCheckboxSearchAllergiesWidgetState @override void initState() { - items.addAll(widget.masterList); + items.addAll(widget.masterList!); super.initState(); } @@ -78,7 +78,7 @@ class _MasterKeyCheckboxSearchAllergiesWidgetState icon: Icon( Icons.search, color: Colors.black, - )), + ), onPressed: () { },), ), DividerWithSpacesAround(), SizedBox( @@ -122,12 +122,12 @@ class _MasterKeyCheckboxSearchAllergiesWidgetState void filterSearchResults(String query) { List dummySearchList = []; - dummySearchList.addAll(widget.masterList); + dummySearchList.addAll(widget.masterList as Iterable); if (query.isNotEmpty) { List dummyListData = []; dummySearchList.forEach((items) { - if (items.nameAr.toLowerCase().contains(query.toLowerCase()) || - items.nameEn.toLowerCase().contains(query.toLowerCase())) { + if (items.nameAr!.toLowerCase().contains(query.toLowerCase()) || + items.nameEn!.toLowerCase().contains(query.toLowerCase())) { dummyListData.add(items); } }); @@ -139,7 +139,7 @@ class _MasterKeyCheckboxSearchAllergiesWidgetState } else { setState(() { items.clear(); - items.addAll(widget.masterList); + items.addAll(widget.masterList as Iterable); }); } } diff --git a/lib/screens/patients/profile/soap_update/subjective/allergies/update_allergies_widget.dart b/lib/screens/patients/profile/soap_update/subjective/allergies/update_allergies_widget.dart index c9040871..cdb63244 100644 --- a/lib/screens/patients/profile/soap_update/subjective/allergies/update_allergies_widget.dart +++ b/lib/screens/patients/profile/soap_update/subjective/allergies/update_allergies_widget.dart @@ -15,9 +15,9 @@ import 'add_allergies.dart'; // ignore: must_be_immutable class UpdateAllergiesWidget extends StatefulWidget { - List myAllergiesList; + List? myAllergiesList; - UpdateAllergiesWidget({Key key, this.myAllergiesList}); + UpdateAllergiesWidget({Key? key, this.myAllergiesList}); @override _UpdateAllergiesWidgetState createState() => _UpdateAllergiesWidgetState(); @@ -45,7 +45,7 @@ class _UpdateAllergiesWidgetState extends State { Container( margin: EdgeInsets.only(left: 15, right: 15, top: 15), child: Column( - children: widget.myAllergiesList.map((selectedAllergy) { + children: widget.myAllergiesList!.map((selectedAllergy) { return Column( crossAxisAlignment: CrossAxisAlignment.start, mainAxisAlignment: MainAxisAlignment.start, @@ -62,36 +62,20 @@ class _UpdateAllergiesWidgetState extends State { crossAxisAlignment: CrossAxisAlignment.start, children: [ AppText( - projectViewModel.isArabic - ? selectedAllergy.selectedAllergy.nameAr - : selectedAllergy.selectedAllergy.nameEn - .toUpperCase(), - textDecoration: selectedAllergy.isChecked - ? null - : TextDecoration.lineThrough, + projectViewModel.isArabic ? selectedAllergy.selectedAllergy!.nameAr! : selectedAllergy.selectedAllergy!.nameEn!.toUpperCase(), + textDecoration: selectedAllergy.isChecked! ? TextDecoration.none : TextDecoration.lineThrough, bold: true, color: Color(0xFF2B353E), - fontSize: - SizeConfig.getTextMultiplierBasedOnWidth() * - 3.5, + fontSize: SizeConfig.getTextMultiplierBasedOnWidth() * 3.5, fontWeight: FontWeight.w700, letterSpacing: -0.48, // fontHeight:0.18 , ), AppText( - projectViewModel.isArabic - ? selectedAllergy - .selectedAllergySeverity.nameAr - : selectedAllergy - .selectedAllergySeverity.nameEn - .toUpperCase(), - textDecoration: selectedAllergy.isChecked - ? null - : TextDecoration.lineThrough, + projectViewModel.isArabic ? selectedAllergy.selectedAllergySeverity!.nameAr! : selectedAllergy.selectedAllergySeverity!.nameEn!.toUpperCase(), + textDecoration: selectedAllergy.isChecked! ? TextDecoration.none : TextDecoration.lineThrough, color: Color(0xFFCC9B14), - fontSize: - SizeConfig.getTextMultiplierBasedOnWidth() * - 3, + fontSize: SizeConfig.getTextMultiplierBasedOnWidth() * 3, fontWeight: FontWeight.w700, letterSpacing: -0.48, ), @@ -110,7 +94,7 @@ class _UpdateAllergiesWidgetState extends State { child: Row( children: [ RemarkText( - remark: selectedAllergy.remark, + remark: selectedAllergy.remark!, ), ], ), @@ -132,18 +116,14 @@ class _UpdateAllergiesWidgetState extends State { removeAllergy(MySelectedAllergy mySelectedAllergy) { List allergy = // ignore: missing_return - widget.myAllergiesList - .where((element) => - mySelectedAllergy.selectedAllergySeverity.id == - element.selectedAllergySeverity.id && - mySelectedAllergy.selectedAllergy.id == - element.selectedAllergy.id) + widget.myAllergiesList! + .where((element) => mySelectedAllergy.selectedAllergySeverity!.id == element.selectedAllergySeverity!.id && mySelectedAllergy.selectedAllergy!.id == element.selectedAllergy!.id) .toList(); if (allergy.length > 0) { if (allergy.first.isLocal) { setState(() { - widget.myAllergiesList.remove(allergy.first); + widget.myAllergiesList!.remove(allergy.first); }); } setState(() { @@ -152,8 +132,7 @@ class _UpdateAllergiesWidgetState extends State { } } - openAllergiesList( - BuildContext context, Function changeParentState, removeAllergy) { + openAllergiesList(BuildContext context, Function changeParentState, removeAllergy) { showModalBottomSheet( backgroundColor: Colors.white, isScrollControlled: true, @@ -172,24 +151,26 @@ class _UpdateAllergiesWidgetState extends State { }); if (isAllDataFilled) { mySelectedAllergy.forEach((element) { - if ((widget.myAllergiesList.singleWhere( - (it) => - it.selectedAllergy.id == - element.selectedAllergy.id, - orElse: () => null)) == + if (( + widget.myAllergiesList!.singleWhere( + (it) => it.selectedAllergy!.id == element.selectedAllergy!.id, + orElse: () => MySelectedAllergy(), + ), + ) == null) { - widget.myAllergiesList.add(element); + widget.myAllergiesList!.add(element); } }); /// remove items. List removedList = []; - widget.myAllergiesList.forEach((element) { - if ((mySelectedAllergy.singleWhere( - (it) => - it.selectedAllergy.id == - element.selectedAllergy.id, - orElse: () => null)) == + widget.myAllergiesList!.forEach((element) { + if (( + mySelectedAllergy.singleWhere( + (it) => it.selectedAllergy!.id == element.selectedAllergy!.id, + orElse: () => MySelectedAllergy(), + ), + ) == null) { removedList.add(element); } @@ -201,8 +182,7 @@ class _UpdateAllergiesWidgetState extends State { changeParentState(); Navigator.of(context).pop(); } else { - Utils.showErrorToast( - TranslationBase.of(context).requiredMsg); + Utils.showErrorToast(TranslationBase.of(context).requiredMsg); } }); }); diff --git a/lib/screens/patients/profile/soap_update/subjective/cheif_complaints/update_Chief_complaints.dart b/lib/screens/patients/profile/soap_update/subjective/cheif_complaints/update_Chief_complaints.dart index adc92ccb..e13af574 100644 --- a/lib/screens/patients/profile/soap_update/subjective/cheif_complaints/update_Chief_complaints.dart +++ b/lib/screens/patients/profile/soap_update/subjective/cheif_complaints/update_Chief_complaints.dart @@ -7,14 +7,14 @@ import '../medication/update_medication_widget.dart'; class UpdateChiefComplaints extends StatelessWidget { const UpdateChiefComplaints({ - Key key, - @required this.formKey, - @required this.complaintsController, - @required this.illnessController, - @required this.medicationController, - this.complaintsControllerError, - this.illnessControllerError, - this.medicationControllerError, + Key? key, + required this.formKey, + required this.complaintsController, + required this.illnessController, + required this.medicationController, + this.complaintsControllerError = '', + this.illnessControllerError = '', + this.medicationControllerError = '', }) : super(key: key); final GlobalKey formKey; @@ -41,9 +41,7 @@ class UpdateChiefComplaints extends StatelessWidget { minLines: 7, hasBorder: true, inputType: TextInputType.multiline, - validationError: complaintsControllerError != '' - ? complaintsControllerError - : null, + validationError: complaintsControllerError != '' ? complaintsControllerError : "", ), SizedBox( height: 20, @@ -56,8 +54,7 @@ class UpdateChiefComplaints extends StatelessWidget { maxLines: 25, minLines: 7, hasBorder: true, - validationError: - illnessControllerError != '' ? illnessControllerError : null, + validationError: illnessControllerError != '' ? illnessControllerError : "", ), SizedBox( height: 10, @@ -75,9 +72,7 @@ class UpdateChiefComplaints extends StatelessWidget { minLines: 7, hasBorder: true, inputType: TextInputType.multiline, - validationError: medicationControllerError != '' - ? medicationControllerError - : null, + validationError: medicationControllerError != '' ? medicationControllerError : "", ), SizedBox( height: 10, diff --git a/lib/screens/patients/profile/soap_update/subjective/history/add_history_dialog.dart b/lib/screens/patients/profile/soap_update/subjective/history/add_history_dialog.dart index 5a407d21..24d35ae6 100644 --- a/lib/screens/patients/profile/soap_update/subjective/history/add_history_dialog.dart +++ b/lib/screens/patients/profile/soap_update/subjective/history/add_history_dialog.dart @@ -16,20 +16,13 @@ import '../../shared_soap_widgets/bottom_sheet_title.dart'; import 'priority_bar.dart'; class AddHistoryDialog extends StatefulWidget { - final Function changePageViewIndex; - final PageController controller; - final List myHistoryList; - final Function addSelectedHistories; - final Function(MasterKeyModel) removeHistory; + final Function? changePageViewIndex; + final PageController? controller; + final List? myHistoryList; + final Function? addSelectedHistories; + final Function(MasterKeyModel)? removeHistory; - const AddHistoryDialog( - {Key key, - this.changePageViewIndex, - this.controller, - this.myHistoryList, - this.addSelectedHistories, - this.removeHistory}) - : super(key: key); + const AddHistoryDialog({Key? key, this.changePageViewIndex, this.controller, this.myHistoryList, this.addSelectedHistories, this.removeHistory}) : super(key: key); @override _AddHistoryDialogState createState() => _AddHistoryDialogState(); @@ -58,8 +51,7 @@ class _AddHistoryDialogState extends State { builder: (_, model, w) => AppScaffold( baseViewModel: model, isShowAppBar: true, - appBar: - BottomSheetTitle(title: TranslationBase.of(context).addHistory), + appBar: BottomSheetTitle(title: TranslationBase.of(context).addHistory), body: Center( child: Container( child: Column( @@ -68,7 +60,7 @@ class _AddHistoryDialogState extends State { height: 10, ), PriorityBar(onTap: (activePriority) async { - widget.changePageViewIndex(activePriority); + widget.changePageViewIndex!(activePriority); }), SizedBox( height: 20, @@ -91,7 +83,7 @@ class _AddHistoryDialogState extends State { masterList: model.historyFamilyList, removeHistory: (history) { setState(() { - widget.removeHistory(history); + widget.removeHistory!(history); }); }, addHistory: (history) { @@ -100,21 +92,19 @@ class _AddHistoryDialogState extends State { }); }, addSelectedHistories: () { - widget.addSelectedHistories(); + widget.addSelectedHistories!(); }, - isServiceSelected: (master) => - isServiceSelected(master), + isServiceSelected: (master) => isServiceSelected(master), ), ), NetworkBaseView( baseViewModel: model, child: MasterKeyCheckboxSearchWidget( model: model, - masterList: model - .mergeHistorySurgicalWithHistorySportList, + masterList: model.mergeHistorySurgicalWithHistorySportList, removeHistory: (history) { setState(() { - widget.removeHistory(history); + widget.removeHistory!(history); }); }, addHistory: (history) { @@ -123,10 +113,9 @@ class _AddHistoryDialogState extends State { }); }, addSelectedHistories: () { - widget.addSelectedHistories(); + widget.addSelectedHistories!(); }, - isServiceSelected: (master) => - isServiceSelected(master), + isServiceSelected: (master) => isServiceSelected(master), ), ), NetworkBaseView( @@ -136,7 +125,7 @@ class _AddHistoryDialogState extends State { masterList: model.historyMedicalList, removeHistory: (history) { setState(() { - widget.removeHistory(history); + widget.removeHistory!(history); }); }, addHistory: (history) { @@ -145,10 +134,9 @@ class _AddHistoryDialogState extends State { }); }, addSelectedHistories: () { - widget.addSelectedHistories(); + widget.addSelectedHistories!(); }, - isServiceSelected: (master) => - isServiceSelected(master), + isServiceSelected: (master) => isServiceSelected(master), ), ), ], @@ -168,7 +156,7 @@ class _AddHistoryDialogState extends State { : CustomBottomSheetContainer( label: TranslationBase.of(context).addSelectedHistories, onTap: () { - widget.addSelectedHistories(); + widget.addSelectedHistories!(); }, ), ), @@ -176,21 +164,13 @@ class _AddHistoryDialogState extends State { } createAndAddHistory(MasterKeyModel history) { - List myhistory = widget.myHistoryList - .where((element) => - history.id == element.selectedHistory.id && - history.typeId == element.selectedHistory.typeId) - .toList(); + List myhistory = widget.myHistoryList!.where((element) => history.id == element.selectedHistory!.id && history.typeId == element.selectedHistory!.typeId).toList(); if (myhistory.isEmpty) { setState(() { - MySelectedHistory mySelectedHistory = - SoapUtils.generateMySelectedHistory( - remark: history.remarks ?? "", - history: history, - isChecked: true); + MySelectedHistory mySelectedHistory = SoapUtils.generateMySelectedHistory(remark: history.remarks ?? "", history: history, isChecked: true); - widget.myHistoryList.add(mySelectedHistory); + widget.myHistoryList!.add(mySelectedHistory); }); } else { myhistory.first.isChecked = true; @@ -198,11 +178,8 @@ class _AddHistoryDialogState extends State { } isServiceSelected(MasterKeyModel masterKey) { - Iterable history = widget.myHistoryList.where( - (element) => - masterKey.id == element.selectedHistory.id && - masterKey.typeId == element.selectedHistory.typeId && - element.isChecked); + Iterable history = + widget.myHistoryList!.where((element) => masterKey.id == element.selectedHistory!.id && masterKey.typeId == element.selectedHistory!.typeId && element.isChecked!); if (history.length > 0) { return true; } diff --git a/lib/screens/patients/profile/soap_update/subjective/history/priority_bar.dart b/lib/screens/patients/profile/soap_update/subjective/history/priority_bar.dart index cadab120..52c23047 100644 --- a/lib/screens/patients/profile/soap_update/subjective/history/priority_bar.dart +++ b/lib/screens/patients/profile/soap_update/subjective/history/priority_bar.dart @@ -6,9 +6,9 @@ import 'package:hexcolor/hexcolor.dart'; import 'package:provider/provider.dart'; class PriorityBar extends StatefulWidget { - final Function onTap; + final Function? onTap; - const PriorityBar({Key key, this.onTap}) : super(key: key); + const PriorityBar({Key? key, this.onTap}) : super(key: key); @override _PriorityBarState createState() => _PriorityBarState(); @@ -28,8 +28,7 @@ class _PriorityBarState extends State { "طبي", ]; - BoxDecoration containerBorderDecoration( - Color containerColor, Color borderColor) { + BoxDecoration containerBorderDecoration(Color containerColor, Color borderColor) { return BoxDecoration(); } @@ -58,19 +57,13 @@ class _PriorityBarState extends State { children: [ Container( height: screenSize.height * 0.070, - decoration: containerBorderDecoration( - _isActive ? HexColor("#B8382B") : Colors.white, - _isActive ? HexColor("#B8382B") : Colors.white), + decoration: containerBorderDecoration(_isActive ? HexColor("#B8382B") : Colors.white, _isActive ? HexColor("#B8382B") : Colors.white), child: Center( child: Text( - (projectViewModel.isArabic) - ? _prioritiesAr[index] - : item, + (projectViewModel.isArabic) ? _prioritiesAr[index] : item, textAlign: TextAlign.center, style: TextStyle( - fontSize: - SizeConfig.getTextMultiplierBasedOnWidth() * - 3.5, + fontSize: SizeConfig.getTextMultiplierBasedOnWidth() * 3.5, color: Colors.black, fontWeight: FontWeight.bold, ), @@ -87,7 +80,7 @@ class _PriorityBarState extends State { ), ), onTap: () { - widget.onTap(_priorities.indexOf(item)); + widget.onTap!(_priorities.indexOf(item)); setState(() { _activePriority = _priorities.indexOf(item); diff --git a/lib/screens/patients/profile/soap_update/subjective/history/update_history_widget.dart b/lib/screens/patients/profile/soap_update/subjective/history/update_history_widget.dart index 4868da78..a5ec04f7 100644 --- a/lib/screens/patients/profile/soap_update/subjective/history/update_history_widget.dart +++ b/lib/screens/patients/profile/soap_update/subjective/history/update_history_widget.dart @@ -12,20 +12,19 @@ import '../../shared_soap_widgets/SOAP_open_items.dart'; import 'add_history_dialog.dart'; class UpdateHistoryWidget extends StatefulWidget { - final List myHistoryList; + final List? myHistoryList; - const UpdateHistoryWidget({Key key, this.myHistoryList}) : super(key: key); + const UpdateHistoryWidget({Key? key, this.myHistoryList}) : super(key: key); @override _UpdateHistoryWidgetState createState() => _UpdateHistoryWidgetState(); } -class _UpdateHistoryWidgetState extends State - with TickerProviderStateMixin { - PageController _controller; +class _UpdateHistoryWidgetState extends State with TickerProviderStateMixin { + PageController? _controller; changePageViewIndex(pageIndex) { - _controller.jumpToPage(pageIndex); + _controller!.jumpToPage(pageIndex); } @override @@ -52,7 +51,7 @@ class _UpdateHistoryWidgetState extends State Container( margin: EdgeInsets.only(left: 15, right: 15, top: 15), child: Column( - children: widget.myHistoryList.map((myHistory) { + children: widget.myHistoryList!.map((myHistory) { return Column( children: [ Row( @@ -60,23 +59,18 @@ class _UpdateHistoryWidgetState extends State children: [ Container( child: AppText( - projectViewModel.isArabic - ? myHistory.selectedHistory.nameAr - : myHistory.selectedHistory.nameEn, - textDecoration: myHistory.isChecked - ? null - : TextDecoration.lineThrough, + projectViewModel.isArabic ? myHistory.selectedHistory!.nameAr! : myHistory.selectedHistory!.nameEn!, + textDecoration: myHistory.isChecked! ? TextDecoration.none : TextDecoration.lineThrough, color: Color(0xFF2B353E), - fontSize: - SizeConfig.getTextMultiplierBasedOnWidth() * 3.5, + fontSize: SizeConfig.getTextMultiplierBasedOnWidth() * 3.5, fontWeight: FontWeight.w700, letterSpacing: -0.48, ), width: MediaQuery.of(context).size.width * 0.5, ), - if (myHistory.isChecked) + if (myHistory.isChecked!) RemoveButton( - onTap: () => removeHistory(myHistory.selectedHistory), + onTap: () => removeHistory(myHistory.selectedHistory!), ) ], ), @@ -95,16 +89,12 @@ class _UpdateHistoryWidgetState extends State removeHistory(MasterKeyModel historyKey) { List history = // ignore: missing_return - widget.myHistoryList - .where((element) => - historyKey.id == element.selectedHistory.id && - historyKey.typeId == element.selectedHistory.typeId) - .toList(); + widget.myHistoryList!.where((element) => historyKey.id == element.selectedHistory!.id && historyKey.typeId == element.selectedHistory!.typeId).toList(); if (history.length > 0) { - if (history.first.isLocal) { + if (history.first.isLocal!) { setState(() { - widget.myHistoryList.remove(history.first); + widget.myHistoryList!.remove(history.first); }); } else { setState(() { 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 7c91fad4..ea899467 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 @@ -23,30 +23,28 @@ import '../../shared_soap_widgets/bottom_sheet_title.dart'; // ignore: must_be_immutable class AddMedication extends StatefulWidget { - final Function addMedicationFun; - TextEditingController medicationController; + final Function? addMedicationFun; + TextEditingController? medicationController; - AddMedication({Key key, this.addMedicationFun, this.medicationController}) - : super(key: key); + AddMedication({Key? key, this.addMedicationFun, this.medicationController}) : super(key: key); @override _AddMedicationState createState() => _AddMedicationState(); } class _AddMedicationState extends State { - MasterKeyModel _selectedMedicationDose; - MasterKeyModel _selectedMedicationStrength; - MasterKeyModel _selectedMedicationRoute; - MasterKeyModel _selectedMedicationFrequency; + MasterKeyModel _selectedMedicationDose = MasterKeyModel(); + MasterKeyModel _selectedMedicationStrength = MasterKeyModel(); + MasterKeyModel _selectedMedicationRoute = MasterKeyModel(); + MasterKeyModel _selectedMedicationFrequency = MasterKeyModel(); TextEditingController doseController = TextEditingController(); TextEditingController strengthController = TextEditingController(); TextEditingController routeController = TextEditingController(); TextEditingController frequencyController = TextEditingController(); - GetMedicationResponseModel _selectedMedication; + GetMedicationResponseModel _selectedMedication = GetMedicationResponseModel(); - GlobalKey key = - new GlobalKey>(); + GlobalKey> key = new GlobalKey>(); bool isFormSubmitted = false; @override @@ -65,359 +63,248 @@ class _AddMedicationState extends State { ), body: Center( child: Container( - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - SizedBox( - height: 10, - ), - Expanded( - child: FractionallySizedBox( - widthFactor: 0.9, - child: SingleChildScrollView( - child: Column( - children: [ - SizedBox( - height: SizeConfig.heightMultiplier! * - (SizeConfig.isHeightVeryShort + child: Column(crossAxisAlignment: CrossAxisAlignment.start, children: [ + SizedBox( + height: 10, + ), + Expanded( + child: FractionallySizedBox( + widthFactor: 0.9, + child: SingleChildScrollView( + child: Column( + children: [ + SizedBox( + height: SizeConfig.heightMultiplier! * + (SizeConfig.isHeightVeryShort + ? 2 + : SizeConfig.isHeightShort ? 2 - : SizeConfig.isHeightShort - ? 2 - : 2), - ), - Container( - // height: screenSize.height * 0.070, - child: InkWell( - onTap: model.allMedicationList != null - ? () { - setState(() { - _selectedMedication = null; - }); - } - : null, - child: _selectedMedication == null - ? CustomAutoCompleteTextField( - isShowError: isFormSubmitted && - _selectedMedication == null, - child: AutoCompleteTextField< - GetMedicationResponseModel>( - decoration: TextFieldsUtils - .textFieldSelectorDecoration( - TranslationBase.of( - context) - .searchMedicineNameHere, - null, - true, - suffixIcon: - Icons.search), - itemSubmitted: (item) => - setState(() => - _selectedMedication = - item), - key: key, - suggestions: - model.allMedicationList, - itemBuilder: (context, - suggestion) => - new Padding( - child: AppText(suggestion - .description + - '/' + - suggestion - .genericName), - padding: EdgeInsets.all( - 8.0)), - itemSorter: (a, b) => 1, - itemFilter: (suggestion, - input) => - suggestion.genericName.toLowerCase().startsWith( - input.toLowerCase()) || - suggestion.description - .toLowerCase() - .startsWith(input - .toLowerCase()) || - suggestion.keywords - .toLowerCase() - .startsWith(input - .toLowerCase()), - ), - ) - : AppTextFieldCustom( - height: - Utils.getTextFieldHeight(), - hintText: _selectedMedication != - null - ? _selectedMedication - .description + - (' (${_selectedMedication.genericName} )') - : TranslationBase.of(context) - .searchMedicineNameHere, - minLines: 1, - maxLines: 1, - isTextFieldHasSuffix: true, - suffixIcon: IconButton( - icon: Icon( - Icons.search, - color: Colors.grey.shade600, - )), - enabled: false, - ), - ), - ), - if (_selectedMedication != null) - Column( - children: [ - SizedBox( - height: 3, - ), - Container( - width: MediaQuery.of(context) - .size - .width * - 0.7, - child: AppText( - _selectedMedication.description + - (' (${_selectedMedication.genericName} )'), - color: Color(0xFF575757), - fontSize: 10, - fontWeight: FontWeight.w700, - letterSpacing: -0.4, + : 2), + ), + Container( + // height: screenSize.height * 0.070, + child: InkWell( + onTap: model.allMedicationList != null + ? () { + setState(() { + _selectedMedication = GetMedicationResponseModel(); + }); + } + : null, + child: _selectedMedication == null + ? CustomAutoCompleteTextField( + isShowError: isFormSubmitted && _selectedMedication == null, + child: AutoCompleteTextField( + decoration: TextFieldsUtils.textFieldSelectorDecoration(TranslationBase.of(context).searchMedicineNameHere, "", true, suffixIcon: Icons.search), + itemSubmitted: (item) => setState(() => _selectedMedication = item), + key: key, + suggestions: model.allMedicationList, + itemBuilder: (context, suggestion) => new Padding(child: AppText(suggestion.description! + '/' + suggestion.genericName!), padding: EdgeInsets.all(8.0)), + itemSorter: (a, b) => 1, + itemFilter: (suggestion, input) => + suggestion.genericName!.toLowerCase().startsWith(input.toLowerCase()) || + suggestion.description!.toLowerCase().startsWith(input.toLowerCase()) || + suggestion.keywords!.toLowerCase().startsWith(input.toLowerCase()), ), + ) + : AppTextFieldCustom( + height: Utils.getTextFieldHeight(), + hintText: _selectedMedication != null + ? _selectedMedication.description! + (' (${_selectedMedication.genericName} )') + : TranslationBase.of(context).searchMedicineNameHere, + minLines: 1, + maxLines: 1, + isTextFieldHasSuffix: true, + suffixIcon: IconButton( + icon: Icon( + Icons.search, + color: Colors.grey.shade600, + ), onPressed: () { },), + enabled: false, ), - ], + ), + ), + if (_selectedMedication != null) + Column( + children: [ + SizedBox( + height: 3, ), - SizedBox( - height: 5, - ), - AppTextFieldCustom( - height: Utils.getTextFieldHeight(), - enabled: false, - onClick: model.medicationDoseTimeList != - null - ? () { - MasterKeyDailog dialog = - MasterKeyDailog( - list: - model.medicationDoseTimeList, - okText: - TranslationBase.of(context) - .ok, - selectedValue: - _selectedMedicationDose, - okFunction: (selectedValue) { - setState(() { - _selectedMedicationDose = - selectedValue; + Container( + width: MediaQuery.of(context).size.width * 0.7, + child: AppText( + _selectedMedication.description! + (' (${_selectedMedication.genericName} )'), + color: Color(0xFF575757), + fontSize: 10, + fontWeight: FontWeight.w700, + letterSpacing: -0.4, + ), + ), + ], + ), + SizedBox( + height: 5, + ), + AppTextFieldCustom( + height: Utils.getTextFieldHeight(), + enabled: false, + onClick: model.medicationDoseTimeList != null + ? () { + MasterKeyDailog dialog = MasterKeyDailog( + list: model.medicationDoseTimeList, + okText: TranslationBase.of(context).ok, + selectedValue: _selectedMedicationDose, + okFunction: (selectedValue) { + setState(() { + _selectedMedicationDose = selectedValue; - doseController - .text = projectViewModel - .isArabic - ? _selectedMedicationDose - .nameAr - : _selectedMedicationDose - .nameEn; - }); - }, - ); - showDialog( - barrierDismissible: false, - context: context, - builder: (BuildContext context) { - return dialog; - }, - ); - } - : null, - hintText: - TranslationBase.of(context).doseTime, - maxLines: 1, - minLines: 1, - isTextFieldHasSuffix: true, - controller: doseController, - validationError: isFormSubmitted && - _selectedMedicationDose == null - ? TranslationBase.of(context) - .emptyMessage - : null, - ), - SizedBox( - height: 5, - ), - AppTextFieldCustom( - height: Utils.getTextFieldHeight(), - enabled: false, - isTextFieldHasSuffix: true, - onClick: model.medicationStrengthList != - null - ? () { - MasterKeyDailog dialog = - MasterKeyDailog( - list: - model.medicationStrengthList, - okText: - TranslationBase.of(context) - .ok, - selectedValue: - _selectedMedicationStrength, - okFunction: (selectedValue) { - setState(() { - _selectedMedicationStrength = - selectedValue; + doseController.text = projectViewModel.isArabic ? _selectedMedicationDose.nameAr! : _selectedMedicationDose.nameEn!; + }); + }, + ); + showDialog( + barrierDismissible: false, + context: context, + builder: (BuildContext context) { + return dialog; + }, + ); + } + : (){}, + hintText: TranslationBase.of(context).doseTime, + maxLines: 1, + minLines: 1, + isTextFieldHasSuffix: true, + controller: doseController, + validationError: isFormSubmitted && _selectedMedicationDose == null ? TranslationBase.of(context).emptyMessage : "", + ), + SizedBox( + height: 5, + ), + AppTextFieldCustom( + height: Utils.getTextFieldHeight(), + enabled: false, + isTextFieldHasSuffix: true, + onClick: model.medicationStrengthList != null + ? () { + MasterKeyDailog dialog = MasterKeyDailog( + list: model.medicationStrengthList, + okText: TranslationBase.of(context).ok, + selectedValue: _selectedMedicationStrength, + okFunction: (selectedValue) { + setState(() { + _selectedMedicationStrength = selectedValue; - strengthController - .text = projectViewModel - .isArabic - ? _selectedMedicationStrength - .nameAr - : _selectedMedicationStrength - .nameEn; - }); - }, - ); - showDialog( - barrierDismissible: false, - context: context, - builder: (BuildContext context) { - return dialog; - }, - ); - } - : null, - hintText: - TranslationBase.of(context).strength, - maxLines: 1, - minLines: 1, - controller: strengthController, - validationError: isFormSubmitted && - _selectedMedicationStrength == null - ? TranslationBase.of(context) - .emptyMessage - : null, - ), - SizedBox( - height: 5, - ), - SizedBox( - height: 5, - ), - AppTextFieldCustom( - height: Utils.getTextFieldHeight(), - enabled: false, - isTextFieldHasSuffix: true, - onClick: model.medicationRouteList != null - ? () { - MasterKeyDailog dialog = - MasterKeyDailog( - list: model.medicationRouteList, - selectedValue: - _selectedMedicationRoute, - okText: - TranslationBase.of(context) - .ok, - okFunction: (selectedValue) { - setState(() { - _selectedMedicationRoute = - selectedValue; + strengthController.text = projectViewModel.isArabic ? _selectedMedicationStrength.nameAr! : _selectedMedicationStrength.nameEn!; + }); + }, + ); + showDialog( + barrierDismissible: false, + context: context, + builder: (BuildContext context) { + return dialog; + }, + ); + } + : (){}, + hintText: TranslationBase.of(context).strength, + maxLines: 1, + minLines: 1, + controller: strengthController, + validationError: isFormSubmitted && _selectedMedicationStrength == null ? TranslationBase.of(context).emptyMessage : "", + ), + SizedBox( + height: 5, + ), + SizedBox( + height: 5, + ), + AppTextFieldCustom( + height: Utils.getTextFieldHeight(), + enabled: false, + isTextFieldHasSuffix: true, + onClick: model.medicationRouteList != null + ? () { + MasterKeyDailog dialog = MasterKeyDailog( + list: model.medicationRouteList, + selectedValue: _selectedMedicationRoute, + okText: TranslationBase.of(context).ok, + okFunction: (selectedValue) { + setState(() { + _selectedMedicationRoute = selectedValue; - routeController - .text = projectViewModel - .isArabic - ? _selectedMedicationRoute - .nameAr - : _selectedMedicationRoute - .nameEn; - }); - }, - ); - showDialog( - barrierDismissible: false, - context: context, - builder: (BuildContext context) { - return dialog; - }, - ); - } - : null, - hintText: TranslationBase.of(context).route, - maxLines: 1, - minLines: 1, - controller: routeController, - validationError: isFormSubmitted && - _selectedMedicationRoute == null - ? TranslationBase.of(context) - .emptyMessage - : null, - ), - SizedBox( - height: 5, - ), - SizedBox( - height: 5, - ), - AppTextFieldCustom( - height: Utils.getTextFieldHeight(), - onClick: model.medicationFrequencyList != - null - ? () { - MasterKeyDailog dialog = - MasterKeyDailog( - list: - model.medicationFrequencyList, - okText: - TranslationBase.of(context) - .ok, - selectedValue: - _selectedMedicationFrequency, - okFunction: (selectedValue) { - setState(() { - _selectedMedicationFrequency = - selectedValue; + routeController.text = projectViewModel.isArabic ? _selectedMedicationRoute.nameAr! : _selectedMedicationRoute.nameEn!; + }); + }, + ); + showDialog( + barrierDismissible: false, + context: context, + builder: (BuildContext context) { + return dialog; + }, + ); + } + : (){}, + hintText: TranslationBase.of(context).route, + maxLines: 1, + minLines: 1, + controller: routeController, + validationError: isFormSubmitted && _selectedMedicationRoute == null ? TranslationBase.of(context).emptyMessage : "", + ), + SizedBox( + height: 5, + ), + SizedBox( + height: 5, + ), + AppTextFieldCustom( + height: Utils.getTextFieldHeight(), + onClick: model.medicationFrequencyList != null + ? () { + MasterKeyDailog dialog = MasterKeyDailog( + list: model.medicationFrequencyList, + okText: TranslationBase.of(context).ok, + selectedValue: _selectedMedicationFrequency, + okFunction: (selectedValue) { + setState(() { + _selectedMedicationFrequency = selectedValue; - frequencyController - .text = projectViewModel - .isArabic - ? _selectedMedicationFrequency - .nameAr - : _selectedMedicationFrequency - .nameEn; - }); - }, - ); - showDialog( - barrierDismissible: false, - context: context, - builder: (BuildContext context) { - return dialog; - }, - ); - } - : null, - hintText: - TranslationBase.of(context).frequency, - enabled: false, - maxLines: 1, - minLines: 1, - isTextFieldHasSuffix: true, - controller: frequencyController, - validationError: isFormSubmitted && - _selectedMedicationFrequency == null - ? TranslationBase.of(context) - .emptyMessage - : null, - ), - SizedBox( - height: SizeConfig.heightMultiplier! * - (SizeConfig.isHeightVeryShort - ? 20 - : SizeConfig.isHeightShort - ? 15 - : 10), - ), - ], + frequencyController.text = projectViewModel.isArabic ? _selectedMedicationFrequency.nameAr! : _selectedMedicationFrequency.nameEn!; + }); + }, + ); + showDialog( + barrierDismissible: false, + context: context, + builder: (BuildContext context) { + return dialog; + }, + ); + } + : (){}, + hintText: TranslationBase.of(context).frequency, + enabled: false, + maxLines: 1, + minLines: 1, + isTextFieldHasSuffix: true, + controller: frequencyController, + validationError: isFormSubmitted && _selectedMedicationFrequency == null ? TranslationBase.of(context).emptyMessage : "", + ), + SizedBox( + height: SizeConfig.heightMultiplier! * + (SizeConfig.isHeightVeryShort + ? 20 + : SizeConfig.isHeightShort + ? 15 + : 10), ), - )), - ), - ]), + ], + ), + )), + ), + ]), ), ), bottomSheet: model.state != ViewState.Idle @@ -435,8 +322,7 @@ class _AddMedicationState extends State { _selectedMedicationStrength != null && _selectedMedicationRoute != null && _selectedMedicationFrequency != null) { - widget.medicationController.text = widget - .medicationController.text + + widget.medicationController!.text = widget.medicationController!.text + '${_selectedMedication.description} (${TranslationBase.of(context).doseTime} ) ${doseController.text} (${TranslationBase.of(context).strength}) ${strengthController.text} (${TranslationBase.of(context).route}) ${routeController.text} (${TranslationBase.of(context).frequency}) ${frequencyController.text} \n \n'; Navigator.of(context).pop(); } diff --git a/lib/screens/patients/profile/soap_update/subjective/medication/update_medication_widget.dart b/lib/screens/patients/profile/soap_update/subjective/medication/update_medication_widget.dart index 62071372..37b25b3a 100644 --- a/lib/screens/patients/profile/soap_update/subjective/medication/update_medication_widget.dart +++ b/lib/screens/patients/profile/soap_update/subjective/medication/update_medication_widget.dart @@ -6,10 +6,10 @@ import '../../shared_soap_widgets/SOAP_open_items.dart'; import 'add_medication.dart'; class UpdateMedicationWidget extends StatefulWidget { - final TextEditingController medicationController; + final TextEditingController? medicationController; UpdateMedicationWidget({ - Key key, + Key? key, this.medicationController, }); 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 7e5855b3..a2501595 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 @@ -20,24 +20,18 @@ import 'cheif_complaints/update_Chief_complaints.dart'; import 'history/update_history_widget.dart'; class UpdateSubjectivePage extends StatefulWidget { - final Function changePageViewIndex; - final Function changeLoadingState; - final PatiantInformtion patientInfo; - final int currentIndex; + final Function? changePageViewIndex; + final Function? changeLoadingState; + final PatiantInformtion? patientInfo; + final int? currentIndex; - UpdateSubjectivePage( - {Key key, - this.changePageViewIndex, - this.patientInfo, - this.changeLoadingState, - this.currentIndex}); + UpdateSubjectivePage({Key? key, this.changePageViewIndex, this.patientInfo, this.changeLoadingState, this.currentIndex}); @override _UpdateSubjectivePageState createState() => _UpdateSubjectivePageState(); } -class _UpdateSubjectivePageState extends State - implements SubjectiveCallBack { +class _UpdateSubjectivePageState extends State implements SubjectiveCallBack { bool isChiefExpand = false; bool isHistoryExpand = false; bool isAllergiesExpand = false; @@ -50,70 +44,46 @@ class _UpdateSubjectivePageState extends State List myHistoryList = []; getHistory(SOAPViewModel model) async { - widget.changeLoadingState(true); + widget.changeLoadingState!(true); if (model.patientHistoryList.isNotEmpty) { model.patientHistoryList.forEach((element) { - if (element.historyType == - MasterKeysService.HistoryFamily.getMasterKeyService()) { + if (element.historyType == MasterKeysService.HistoryFamily.getMasterKeyService()) { MasterKeyModel history = model.getOneMasterKey( masterKeys: MasterKeysService.HistoryFamily, id: element.historyId, ); if (history != null) { - MySelectedHistory mySelectedHistory = - SoapUtils.generateMySelectedHistory( - history: history, - isChecked: element.isChecked, - remark: element.remarks, - isLocal: false); + MySelectedHistory mySelectedHistory = SoapUtils.generateMySelectedHistory(history: history, isChecked: element.isChecked, remark: element.remarks, isLocal: false); myHistoryList.add(mySelectedHistory); } } - if (element.historyType == - MasterKeysService.HistoryMedical.getMasterKeyService()) { + if (element.historyType == MasterKeysService.HistoryMedical.getMasterKeyService()) { MasterKeyModel history = model.getOneMasterKey( masterKeys: MasterKeysService.HistoryMedical, id: element.historyId, ); if (history != null) { - MySelectedHistory mySelectedHistory = - SoapUtils.generateMySelectedHistory( - history: history, - isChecked: element.isChecked, - remark: element.remarks, - isLocal: false); + MySelectedHistory mySelectedHistory = SoapUtils.generateMySelectedHistory(history: history, isChecked: element.isChecked, remark: element.remarks, isLocal: false); myHistoryList.add(mySelectedHistory); } } - if (element.historyType == - MasterKeysService.HistorySports.getMasterKeyService()) { + if (element.historyType == MasterKeysService.HistorySports.getMasterKeyService()) { MasterKeyModel history = model.getOneMasterKey( masterKeys: MasterKeysService.HistorySports, id: element.historyId, ); if (history != null) { - MySelectedHistory mySelectedHistory = - SoapUtils.generateMySelectedHistory( - history: history, - isChecked: element.isChecked, - remark: element.remarks, - isLocal: false); + MySelectedHistory mySelectedHistory = SoapUtils.generateMySelectedHistory(history: history, isChecked: element.isChecked, remark: element.remarks, isLocal: false); myHistoryList.add(mySelectedHistory); } } - if (element.historyType == - MasterKeysService.HistorySurgical.getMasterKeyService()) { + if (element.historyType == MasterKeysService.HistorySurgical.getMasterKeyService()) { MasterKeyModel history = model.getOneMasterKey( masterKeys: MasterKeysService.HistorySurgical, id: element.historyId, ); if (history != null) { - MySelectedHistory mySelectedHistory = - SoapUtils.generateMySelectedHistory( - history: history, - isChecked: element.isChecked, - remark: element.remarks, - isLocal: false); + MySelectedHistory mySelectedHistory = SoapUtils.generateMySelectedHistory(history: history, isChecked: element.isChecked, remark: element.remarks, isLocal: false); myHistoryList.add(mySelectedHistory); } } @@ -124,17 +94,10 @@ class _UpdateSubjectivePageState extends State getAllergies(SOAPViewModel model) async { if (model.patientAllergiesList.isNotEmpty) { model.patientAllergiesList.forEach((element) { - MasterKeyModel selectedAllergy = model.getOneMasterKey( - masterKeys: MasterKeysService.Allergies, - id: element.allergyDiseaseId, - typeId: element.allergyDiseaseType); + MasterKeyModel selectedAllergy = model.getOneMasterKey(masterKeys: MasterKeysService.Allergies, id: element.allergyDiseaseId, typeId: element.allergyDiseaseType); MasterKeyModel selectedAllergySeverity; if (element.severity == 0) { - selectedAllergySeverity = MasterKeyModel( - id: 0, - typeId: MasterKeysService.AllergySeverity.getMasterKeyService(), - nameAr: '', - nameEn: ''); + selectedAllergySeverity = MasterKeyModel(id: 0, typeId: MasterKeysService.AllergySeverity.getMasterKeyService(), nameAr: '', nameEn: ''); } else { selectedAllergySeverity = model.getOneMasterKey( masterKeys: MasterKeysService.AllergySeverity, @@ -142,17 +105,10 @@ class _UpdateSubjectivePageState extends State ); } - MySelectedAllergy mySelectedAllergy = - SoapUtils.generateMySelectedAllergy( - allergy: selectedAllergy, - isChecked: element.isChecked, - createdBy: element.createdBy, - remark: element.remarks, - isLocal: false, - allergySeverity: selectedAllergySeverity); + MySelectedAllergy mySelectedAllergy = SoapUtils.generateMySelectedAllergy( + allergy: selectedAllergy, isChecked: element.isChecked, createdBy: element.createdBy!, remark: element.remarks, isLocal: false, allergySeverity: selectedAllergySeverity); - if (selectedAllergy != null && selectedAllergySeverity != null) - myAllergiesList.add(mySelectedAllergy); + if (selectedAllergy != null && selectedAllergySeverity != null) myAllergiesList.add(mySelectedAllergy); }); } } @@ -164,26 +120,23 @@ class _UpdateSubjectivePageState extends State myAllergiesList.clear(); myHistoryList.clear(); model.setSubjectiveCallBack(this); - await model.onUpdateSubjectStepStart(widget.patientInfo); + await model.onUpdateSubjectStepStart(widget.patientInfo!); if (model.patientChiefComplaintList.isNotEmpty) { isChiefExpand = true; - complaintsController.text = Utils.parseHtmlString( - model.patientChiefComplaintList[0].chiefComplaint); - illnessController.text = model.patientChiefComplaintList[0].hopi; - medicationController.text = - !(model.patientChiefComplaintList[0].currentMedication).isNotEmpty - ? model.patientChiefComplaintList[0].currentMedication + - '\n \n' - : model.patientChiefComplaintList[0].currentMedication; + complaintsController.text = Utils.parseHtmlString(model.patientChiefComplaintList[0].chiefComplaint!); + illnessController.text = model.patientChiefComplaintList[0].hopi!; + medicationController.text = !(model.patientChiefComplaintList[0].currentMedication)!.isNotEmpty + ? model.patientChiefComplaintList[0].currentMedication! + '\n \n' + : model.patientChiefComplaintList[0].currentMedication!; } - if (widget.patientInfo.admissionNo == null) { + if (widget.patientInfo!.admissionNo == null) { await getHistory(model); await getAllergies(model); } - widget.changeLoadingState(false); + widget.changeLoadingState!(false); }, builder: (_, model, w) => AppScaffold( isShowAppBar: false, @@ -214,19 +167,16 @@ class _UpdateSubjectivePageState extends State complaintsController: complaintsController, illnessController: illnessController, medicationController: medicationController, - complaintsControllerError: - model.complaintsControllerError, + complaintsControllerError: model.complaintsControllerError, illnessControllerError: model.illnessControllerError, - medicationControllerError: - model.medicationControllerError, + medicationControllerError: model.medicationControllerError, ), isExpanded: isChiefExpand, ), SizedBox( - height: SizeConfig.heightMultiplier! * - (SizeConfig.isHeightVeryShort ? 4 : 2), + height: SizeConfig.heightMultiplier! * (SizeConfig.isHeightVeryShort ? 4 : 2), ), - if (widget.patientInfo.admissionNo == null) + if (widget.patientInfo!.admissionNo == null) ExpandableSOAPWidget( headerTitle: TranslationBase.of(context).histories, isRequired: false, @@ -236,17 +186,14 @@ class _UpdateSubjectivePageState extends State }); }, child: Column( - children: [ - UpdateHistoryWidget(myHistoryList: myHistoryList) - ], + children: [UpdateHistoryWidget(myHistoryList: myHistoryList)], ), isExpanded: isHistoryExpand, ), SizedBox( - height: SizeConfig.heightMultiplier! * - (SizeConfig.isHeightVeryShort ? 4 : 2), + height: SizeConfig.heightMultiplier! * (SizeConfig.isHeightVeryShort ? 4 : 2), ), - if (widget.patientInfo.admissionNo == null) + if (widget.patientInfo!.admissionNo == null) ExpandableSOAPWidget( headerTitle: TranslationBase.of(context).allergiesSoap, isRequired: false, @@ -268,8 +215,7 @@ class _UpdateSubjectivePageState extends State isExpanded: isAllergiesExpand, ), SizedBox( - height: SizeConfig.heightMultiplier! * - (SizeConfig.isHeightVeryShort ? 20 : 10), + height: SizeConfig.heightMultiplier! * (SizeConfig.isHeightVeryShort ? 20 : 10), ), ], ), @@ -280,20 +226,16 @@ class _UpdateSubjectivePageState extends State ); } - addSubjectiveInfo( - {SOAPViewModel model, - List myAllergiesList, - List myHistoryList}) async { + addSubjectiveInfo({SOAPViewModel? model, List? myAllergiesList, List? myHistoryList}) async { if (FocusScope.of(context).hasFocus) FocusScope.of(context).unfocus(); - widget.changeLoadingState(true); - formKey.currentState.save(); - formKey.currentState.validate(); + widget.changeLoadingState!(true); + formKey.currentState!.save(); + formKey.currentState!.validate(); - model.complaintsControllerError = ''; + model!.complaintsControllerError = ''; model.medicationControllerError = ''; model.illnessControllerError = ''; - if (complaintsController.text.isNotEmpty && - illnessController.text.isNotEmpty) { + if (complaintsController.text.isNotEmpty && illnessController.text.isNotEmpty) { await model.postSubjectServices( patientInfo: widget.patientInfo, complaintsText: complaintsController.text, @@ -303,38 +245,31 @@ class _UpdateSubjectivePageState extends State myAllergiesList: myAllergiesList, ); - widget.changeLoadingState(true); + widget.changeLoadingState!(true); - widget.changePageViewIndex(1); + widget.changePageViewIndex!(1); } else { setState(() { if (complaintsController.text.isEmpty) { - model.complaintsControllerError = - TranslationBase.of(context).emptyMessage; + model.complaintsControllerError = TranslationBase.of(context).emptyMessage; } if (illnessController.text.isEmpty) { - model.illnessControllerError = - TranslationBase.of(context).emptyMessage; + model.illnessControllerError = TranslationBase.of(context).emptyMessage; } if (medicationController.text.isEmpty) { - model.medicationControllerError = - TranslationBase.of(context).emptyMessage; + model.medicationControllerError = TranslationBase.of(context).emptyMessage; } }); - widget.changeLoadingState(false); - Utils.showErrorToast( - TranslationBase.of(context).chiefComplaintErrorMsg); + widget.changeLoadingState!(false); + Utils.showErrorToast(TranslationBase.of(context).chiefComplaintErrorMsg); } } @override Function nextFunction(model) { - addSubjectiveInfo( - model: model, - myAllergiesList: myAllergiesList, - myHistoryList: myHistoryList); + return addSubjectiveInfo(model: model, myAllergiesList: myAllergiesList, myHistoryList: myHistoryList); } } 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 6a2ff4b6..a312f8d2 100644 --- a/lib/screens/patients/profile/soap_update/update_soap_index.dart +++ b/lib/screens/patients/profile/soap_update/update_soap_index.dart @@ -21,22 +21,21 @@ import 'plan/update_plan_page.dart'; class UpdateSoapIndex extends StatefulWidget { final bool isUpdate; - const UpdateSoapIndex({Key key, this.isUpdate}) : super(key: key); + const UpdateSoapIndex({Key? key, this.isUpdate = false}) : super(key: key); @override _UpdateSoapIndexState createState() => _UpdateSoapIndexState(); } -class _UpdateSoapIndexState extends State - with TickerProviderStateMixin { - PageController _controller; +class _UpdateSoapIndexState extends State with TickerProviderStateMixin { + PageController? _controller; int _currentIndex = 0; List myAllergiesList = []; List myHistoryList = []; changePageViewIndex(pageIndex, {isChangeState = true}) { if (pageIndex != _currentIndex && isChangeState) changeLoadingState(true); - _controller.jumpToPage(pageIndex); + _controller!.jumpToPage(pageIndex); setState(() { _currentIndex = pageIndex; }); @@ -63,7 +62,7 @@ class _UpdateSoapIndexState extends State @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']; return BaseView( builder: (_, model, w) => AppScaffold( @@ -75,9 +74,7 @@ class _UpdateSoapIndexState extends State crossAxisAlignment: CrossAxisAlignment.start, children: [ Container( - decoration: BoxDecoration( - boxShadow: [], - color: Theme.of(context).scaffoldBackgroundColor), + decoration: BoxDecoration(boxShadow: [], color: Theme.of(context).scaffoldBackgroundColor), child: Column( mainAxisAlignment: MainAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start, @@ -95,21 +92,9 @@ class _UpdateSoapIndexState extends State }, scrollDirection: Axis.horizontal, children: [ - UpdateSubjectivePage( - changePageViewIndex: changePageViewIndex, - currentIndex: _currentIndex, - patientInfo: patient, - changeLoadingState: changeLoadingState), - UpdateObjectivePage( - changePageViewIndex: changePageViewIndex, - currentIndex: _currentIndex, - patientInfo: patient, - changeLoadingState: changeLoadingState), - UpdateAssessmentPage( - changePageViewIndex: changePageViewIndex, - currentIndex: _currentIndex, - patientInfo: patient, - changeLoadingState: changeLoadingState), + UpdateSubjectivePage(changePageViewIndex: changePageViewIndex, currentIndex: _currentIndex, patientInfo: patient, changeLoadingState: changeLoadingState), + UpdateObjectivePage(changePageViewIndex: changePageViewIndex, currentIndex: _currentIndex, patientInfo: patient, changeLoadingState: changeLoadingState), + UpdateAssessmentPage(changePageViewIndex: changePageViewIndex, currentIndex: _currentIndex, patientInfo: patient, changeLoadingState: changeLoadingState), UpdatePlanPage( changePageViewIndex: changePageViewIndex, currentIndex: _currentIndex, @@ -138,8 +123,7 @@ class _UpdateSoapIndexState extends State ), 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: [ @@ -147,9 +131,7 @@ class _UpdateSoapIndexState extends State height: 10, ), Container( - child: FractionallySizedBox( - widthFactor: .80, - child: getBottomSheet(model, patient)), + child: FractionallySizedBox(widthFactor: .80, child: getBottomSheet(model, patient)), ), SizedBox( height: 5, @@ -169,7 +151,7 @@ class _UpdateSoapIndexState extends State child: AppButton( title: TranslationBase.of(context).next, fontWeight: FontWeight.w600, - color: Colors.red[700], + color: Colors.red[700]!, onPressed: () async { model.nextOnSubjectPage(model); }, @@ -185,7 +167,7 @@ class _UpdateSoapIndexState extends State Expanded( child: AppButton( title: TranslationBase.of(context).previous, - color: Colors.grey[300], + color: Colors.grey[300]!, // height: SizeConfig.heightMultiplier! * // (SizeConfig.isHeightVeryShort ? 8 : 6), // padding: 10, @@ -201,13 +183,9 @@ class _UpdateSoapIndexState extends State ), Expanded( child: AppButton( - title: patient.admissionNo != null && - patient.admissionNo.isNotEmpty && - !model.isAddExamInProgress - ? TranslationBase.of(context).finish - : TranslationBase.of(context).next, + title: patient.admissionNo != null && patient.admissionNo!.isNotEmpty && !model.isAddExamInProgress ? TranslationBase.of(context).finish : TranslationBase.of(context).next, fontWeight: FontWeight.w600, - color: Colors.red[700], + color: Colors.red[700]!, // height: SizeConfig.heightMultiplier! * // (SizeConfig.isHeightVeryShort ? 8 : 6), // padding: 10, @@ -230,7 +208,7 @@ class _UpdateSoapIndexState extends State Expanded( child: AppButton( title: TranslationBase.of(context).previous, - color: Colors.grey[300], + color: Colors.grey[300]!, fontColor: Colors.black, fontWeight: FontWeight.w600, disabled: model.state == ViewState.BusyLocal, @@ -246,8 +224,7 @@ class _UpdateSoapIndexState extends State child: AppButton( title: TranslationBase.of(context).next, fontWeight: FontWeight.w600, - color: Colors.red[700], - + color: Colors.red[700]!, disabled: model.state == ViewState.BusyLocal, onPressed: () async { model.nextOnAssessmentPage(model); @@ -267,7 +244,7 @@ class _UpdateSoapIndexState extends State Expanded( child: AppButton( title: TranslationBase.of(context).previous, - color: Colors.grey[300], + color: Colors.grey[300]!, fontColor: Colors.black, fontWeight: FontWeight.w600, disabled: model.state == ViewState.BusyLocal, @@ -281,12 +258,9 @@ class _UpdateSoapIndexState extends State ), Expanded( child: AppButton( - - title: model.isAddProgress - ? TranslationBase.of(context).next - : TranslationBase.of(context).finish, + title: model.isAddProgress ? TranslationBase.of(context).next : TranslationBase.of(context).finish, fontWeight: FontWeight.w600, - color: Colors.red[700], + color: Colors.red[700]!, disabled: model.progressNoteText.isEmpty, onPressed: () async { model.nextOnPlanPage(model); @@ -299,5 +273,6 @@ class _UpdateSoapIndexState extends State } break; } + return SizedBox(); } } 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 8c8425fd..51cc3bb9 100644 --- a/lib/screens/patients/profile/vital_sign/line_chart_curved.dart +++ b/lib/screens/patients/profile/vital_sign/line_chart_curved.dart @@ -7,10 +7,10 @@ import 'package:intl/intl.dart'; class LineChartCurved extends StatelessWidget { final String title; - final List timeSeries; + final List? timeSeries; final int indexes; - LineChartCurved({this.title, this.timeSeries, this.indexes}); + LineChartCurved({this.title = '', this.timeSeries, this.indexes = 0}); List xAxixs = []; List yAxixs = []; @@ -46,7 +46,7 @@ class LineChartCurved extends StatelessWidget { children: [ AppText( title, - fontSize: SizeConfig.textMultiplier * 2.1, + fontSize: SizeConfig.textMultiplier! * 2.1, fontWeight: FontWeight.bold, fontFamily: 'Poppins', textAlign: TextAlign.center, @@ -62,7 +62,7 @@ class LineChartCurved extends StatelessWidget { padding: const EdgeInsets.only(right: 18.0, left: 16.0), child: LineChart( sampleData1(context), - swapAnimationDuration: const Duration(milliseconds: 250), + duration: const Duration(milliseconds: 250), ), ), ), @@ -78,110 +78,97 @@ class LineChartCurved extends StatelessWidget { } getXaxix() { - for (int index = 0; index < timeSeries.length; index++) { + for (int index = 0; index < timeSeries!.length; index++) { int mIndex = indexes * index; - if (mIndex < timeSeries.length) { + if (mIndex < timeSeries!.length) { xAxixs.add(mIndex); } } } getYaxix() { - int indexess = (timeSeries.length * 0.30).toInt(); - for (int index = 0; index < timeSeries.length; index++) { + int indexess = (timeSeries!.length * 0.30).toInt(); + for (int index = 0; index < timeSeries!.length; index++) { int mIndex = indexess * index; - if (mIndex < timeSeries.length) { - yAxixs.add(timeSeries[mIndex].sales); + if (mIndex < timeSeries!.length) { + yAxixs.add(timeSeries![mIndex].sales!); } } } - LineChartData sampleData1(context) { return LineChartData( lineTouchData: LineTouchData( touchTooltipData: LineTouchTooltipData( tooltipBgColor: Colors.white, ), - touchCallback: (LineTouchResponse touchResponse) {}, + touchCallback: (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( - showTitles: true, - getTextStyles: (context, value) { - return TextStyle( - color: Colors.black, - fontSize: 10, - ); - }, - rotateAngle: -65, - //rotateAngle:-65, - margin: 22, - getTitles: (value) { - if (timeSeries.length < 15) { - if (timeSeries.length > value.toInt()) { - DateTime dateTime = timeSeries[value.toInt()].time; - if (isDatesSameYear) { - return monthFormat.format(dateTime); + bottomTitles: AxisTitles( + sideTitles: SideTitles( + showTitles: true, + //rotateAngle: -65, + //rotateAngle:-65, + reservedSize: 22, + getTitlesWidget: (value, meta) { + if (timeSeries!.length < 15) { + if (timeSeries!.length > value.toInt()) { + DateTime dateTime = timeSeries![value.toInt()].time; + if (isDatesSameYear) { + return Text( + monthFormat.format(dateTime), + style: TextStyle( + color: Colors.black, + fontSize: 10, + ), + ); + } else { + return Text( + yearFormat.format(dateTime), + style: TextStyle( + color: Colors.black, + fontSize: 10, + ), + ); + } } else { - return yearFormat.format(dateTime); + return Text(''); } } else { - return ''; - } - } else { - if (value.toInt() == 0 || - value.toInt() == timeSeries.length - 1 || - xAxixs.contains(value.toInt())) { - DateTime dateTime = timeSeries[value.toInt()].time; - if (isDatesSameYear) { - return monthFormat.format(dateTime); - } else { - return yearFormat.format(dateTime); + if (value.toInt() == 0 || value.toInt() == timeSeries!.length - 1 || xAxixs.contains(value.toInt())) { + DateTime dateTime = timeSeries![value.toInt()].time; + if (isDatesSameYear) { + return Text( + monthFormat.format(dateTime), + style: TextStyle( + color: Colors.black, + fontSize: 10, + ), + ); + } else { + return Text( + yearFormat.format(dateTime), + style: TextStyle( + color: Colors.black, + fontSize: 10, + ), + ); + } } } - } - - /*if (timeSeries.length < 15) { - if (timeSeries.length > value.toInt()) { - DateTime dateTime = timeSeries[value.toInt()].time; - return '${timeSeries[value.toInt()].time.month}/ ${timeSeries[value.toInt()].time.year}'; - } else - return ''; - } else { - if (value.toInt() == 0) - return '${timeSeries[value.toInt()].time.month}/ ${timeSeries[value.toInt()].time.year}'; - if (value.toInt() == timeSeries.length - 1) - return '${timeSeries[value.toInt()].time.month}/ ${timeSeries[value.toInt()].time.year}'; - if (xAxixs.contains(value.toInt())) { - return '${timeSeries[value.toInt()].time.month}/ ${timeSeries[value.toInt()].time.year}'; - } - }*/ - return ''; - }, - ), - leftTitles: SideTitles( - showTitles: true, - getTextStyles: (cxt, value) => const TextStyle( - color: Colors.black, - fontWeight: FontWeight.bold, - fontSize: 10, - ), - interval:getInterval(), - - // getTitles: (value) { - // if (value.toInt() == 0) - // return '${value.toInt()}'; - // else if (value.toInt() % horizontalInterval == 0) - // return '${value.toInt()}'; - // else - // return ''; - // }, - margin: 12, + return Text(''); + }, ), + ), + leftTitles: AxisTitles( + sideTitles: SideTitles( + showTitles: true, + interval: getInterval(), + reservedSize: 12, + )), ), borderData: FlBorderData( show: true, @@ -202,7 +189,7 @@ class LineChartCurved extends StatelessWidget { ), ), minX: 0, - maxX: (timeSeries.length - 1).toDouble(), + maxX: (timeSeries!.length - 1).toDouble(), maxY: getMaxY() + getInterval(), minY: 0, lineBarsData: getData(context), @@ -230,21 +217,18 @@ class LineChartCurved extends StatelessWidget { // return value.toDouble(); // } - - double getInterval(){ - + double getInterval() { return getMaxY() - getMinY() <= 100 ? 20 : getMaxY() - getMinY() <= 1000 - ? 100 - : 200; - + ? 100 + : 200; } double getMaxY() { double max = 0; - timeSeries.forEach((element) { - double resultValueDouble = element.sales; + timeSeries!.forEach((element) { + double resultValueDouble = element.sales!; if (resultValueDouble > max) max = resultValueDouble; }); @@ -252,9 +236,9 @@ class LineChartCurved extends StatelessWidget { } double getMinY() { - double min = timeSeries[0].sales; - timeSeries.forEach((element) { - double resultValueDouble = element.sales; + double min = timeSeries![0].sales!; + timeSeries!.forEach((element) { + double resultValueDouble = element.sales!; if (resultValueDouble < min) min = resultValueDouble; }); int value = min.toInt(); @@ -266,20 +250,18 @@ class LineChartCurved extends StatelessWidget { List spots = []; isDatesSameYear = true; int previousDateYear = 0; - for (int index = 0; index < timeSeries.length; index++) { - spots.add(FlSpot(index.toDouble(), timeSeries[index].sales)); - if (isDatesSameYear == false || - (previousDateYear != 0 && - previousDateYear != timeSeries[index].time.year)) { + for (int index = 0; index < timeSeries!.length; index++) { + spots.add(FlSpot(index.toDouble(), timeSeries![index].sales!)); + if (isDatesSameYear == false || (previousDateYear != 0 && previousDateYear != timeSeries![index].time.year)) { isDatesSameYear = false; } - previousDateYear = timeSeries[index].time.year; + previousDateYear = timeSeries![index].time.year; } final LineChartBarData lineChartBarData1 = LineChartBarData( spots: spots, isCurved: true, - colors: [Colors.red] /*[Theme.of(context).primaryColor]*/, + color: Colors.red /*[Theme.of(context).primaryColor]*/, barWidth: 5, isStrokeCapRound: true, dotData: FlDotData( 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 a7e62166..e843a4d1 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 @@ -7,17 +7,12 @@ import 'package:flutter/material.dart'; class LineChartCurvedBloodPressure extends StatelessWidget { final String title; - final List timeSeries1; - final List timeSeries2; + final List? timeSeries1; + final List? timeSeries2; final int indexes; final bool isOX; - LineChartCurvedBloodPressure( - {this.title, - this.timeSeries1, - this.indexes, - this.timeSeries2, - this.isOX = false}); + LineChartCurvedBloodPressure({this.title = '', this.timeSeries1, this.indexes = 0, this.timeSeries2, this.isOX = false}); List xAxixs = []; List yAxixs = []; @@ -45,7 +40,7 @@ class LineChartCurvedBloodPressure extends StatelessWidget { children: [ AppText( title, - fontSize: SizeConfig.textMultiplier * 2.1, + fontSize: SizeConfig.textMultiplier! * 2.1, fontWeight: FontWeight.bold, fontFamily: 'Poppins', textAlign: TextAlign.center, @@ -58,11 +53,10 @@ class LineChartCurvedBloodPressure extends StatelessWidget { ), Expanded( child: Padding( - padding: - const EdgeInsets.only(right: 18.0, left: 16.0, top: 15), + padding: const EdgeInsets.only(right: 18.0, left: 16.0, top: 15), child: LineChart( sampleData1(context), - swapAnimationDuration: const Duration(milliseconds: 250), + duration: const Duration(milliseconds: 250), ), ), ), @@ -78,15 +72,12 @@ class LineChartCurvedBloodPressure extends StatelessWidget { Container( width: 20, height: 20, - decoration: BoxDecoration( - shape: BoxShape.rectangle, - color: Theme.of(context).primaryColor), + decoration: BoxDecoration(shape: BoxShape.rectangle, color: Theme.of(context).primaryColor), ), SizedBox( width: 5, ), - AppText( - isOX ? "SAO2" : TranslationBase.of(context).systolicLng) + AppText(isOX ? "SAO2" : TranslationBase.of(context).systolicLng) ], ), SizedBox( @@ -97,8 +88,7 @@ class LineChartCurvedBloodPressure extends StatelessWidget { Container( width: 20, height: 20, - decoration: BoxDecoration( - shape: BoxShape.rectangle, color: Colors.red), + decoration: BoxDecoration(shape: BoxShape.rectangle, color: Colors.red), ), SizedBox( width: 5, @@ -117,9 +107,9 @@ class LineChartCurvedBloodPressure extends StatelessWidget { } getXaxix() { - for (int index = 0; index < timeSeries1.length; index++) { + for (int index = 0; index < timeSeries1!.length; index++) { int mIndex = indexes * index; - if (mIndex < timeSeries1.length) { + if (mIndex < timeSeries1!.length) { xAxixs.add(mIndex); } } @@ -131,54 +121,73 @@ class LineChartCurvedBloodPressure extends StatelessWidget { touchTooltipData: LineTouchTooltipData( tooltipBgColor: Colors.white, ), - touchCallback: (LineTouchResponse touchResponse) {}, + touchCallback: (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, //rotateAngle:-65, - margin: 22, - getTitles: (value) { - if (timeSeries1.length < 15) { - if (timeSeries1.length > value.toInt()) { - return '${timeSeries1[value.toInt()].time.month}/ ${timeSeries1[value.toInt()].time.year}'; + reservedSize: 22, + 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(""); }, - ), - leftTitles: SideTitles( + )), + leftTitles: AxisTitles( + sideTitles: SideTitles( showTitles: true, - getTextStyles: (cxt, value) => const TextStyle( - color: Colors.black, - fontWeight: FontWeight.bold, - fontSize: 10, - ), - interval:getInterval(), - getTitles: (value) { - return '${value.toInt()}'; + interval: getInterval(), + getTitlesWidget: (value, meta) { + return Text( + '${value.toInt()}', + style: TextStyle( + color: Colors.black, + fontWeight: FontWeight.bold, + fontSize: 10, + ), + ); }, - margin: 12, - ), + reservedSize: 12, + )), ), borderData: FlBorderData( show: true, @@ -200,28 +209,24 @@ class LineChartCurvedBloodPressure extends StatelessWidget { ), minX: 0, maxX: 0, - maxY: getMaxY() + getInterval(), + maxY: getMaxY() + getInterval(), minY: 0, lineBarsData: getData(context), ); } - double getInterval(){ - + double getInterval() { return getMaxY() - getMinY() <= 100 ? 20 : getMaxY() - getMinY() <= 1000 - ? 100 - : 200; - + ? 100 + : 200; } - - double getMaxY() { double max = 0; - timeSeries1.forEach((element) { - double resultValueDouble = element.sales; + timeSeries1!.forEach((element) { + double resultValueDouble = element.sales!; if (resultValueDouble > max) max = resultValueDouble; }); @@ -229,15 +234,16 @@ class LineChartCurvedBloodPressure 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; }); int value = min.toInt(); return value.toDouble(); } + // double getMaxY() { // double max = 0; // timeSeries1.forEach((element) { @@ -270,19 +276,19 @@ class LineChartCurvedBloodPressure extends StatelessWidget { List getData(context) { List spots = []; - for (int index = 0; index < timeSeries1.length; index++) { - spots.add(FlSpot(index.toDouble(), timeSeries1[index].sales)); + for (int index = 0; index < timeSeries1!.length; index++) { + spots.add(FlSpot(index.toDouble(), timeSeries1![index].sales!)); } List spots2 = []; - for (int index = 0; index < timeSeries2.length; index++) { - spots2.add(FlSpot(index.toDouble(), timeSeries2[index].sales)); + for (int index = 0; index < timeSeries2!.length; index++) { + spots2.add(FlSpot(index.toDouble(), timeSeries2![index].sales!)); } final LineChartBarData lineChartBarData1 = LineChartBarData( spots: spots, isCurved: true, - colors: [Theme.of(context).primaryColor], + color: Theme.of(context).primaryColor, barWidth: 5, isStrokeCapRound: true, dotData: FlDotData( @@ -295,7 +301,7 @@ class LineChartCurvedBloodPressure extends StatelessWidget { final LineChartBarData lineChartBarData2 = LineChartBarData( spots: spots2, isCurved: true, - colors: [Colors.red], + color: Colors.red, barWidth: 5, isStrokeCapRound: true, dotData: FlDotData( diff --git a/lib/screens/patients/profile/vital_sign/vital_sign_detail_pain_scale.dart b/lib/screens/patients/profile/vital_sign/vital_sign_detail_pain_scale.dart index f2975031..effeb998 100644 --- a/lib/screens/patients/profile/vital_sign/vital_sign_detail_pain_scale.dart +++ b/lib/screens/patients/profile/vital_sign/vital_sign_detail_pain_scale.dart @@ -98,7 +98,7 @@ class VitalSignDetailPainScale extends StatelessWidget { TranslationBase.of(context) .painScale, fontSize: - SizeConfig.textMultiplier * 1.5, + SizeConfig.textMultiplier! * 1.5, color: Color(0XFF28353E), fontWeight: FontWeight.w600, ), @@ -112,7 +112,7 @@ class VitalSignDetailPainScale extends StatelessWidget { fontWeight: FontWeight.w700, color: Color(0XFF28353E), fontSize: - SizeConfig.textMultiplier * + SizeConfig.textMultiplier! * 1.3, ), ), @@ -128,7 +128,7 @@ class VitalSignDetailPainScale extends StatelessWidget { child: AppText( "Location", fontSize: - SizeConfig.textMultiplier * 1.5, + SizeConfig.textMultiplier! * 1.5, color: Color(0XFF28353E), fontWeight: FontWeight.w600, ), @@ -142,7 +142,7 @@ class VitalSignDetailPainScale extends StatelessWidget { fontWeight: FontWeight.w700, color: Color(0XFF28353E), fontSize: - SizeConfig.textMultiplier * + SizeConfig.textMultiplier! * 1.3, ), ), @@ -157,7 +157,7 @@ class VitalSignDetailPainScale extends StatelessWidget { child: AppText( "Character", fontSize: - SizeConfig.textMultiplier * 1.5, + SizeConfig.textMultiplier! * 1.5, color: Color(0XFF28353E), fontWeight: FontWeight.w600, ), @@ -171,7 +171,7 @@ class VitalSignDetailPainScale extends StatelessWidget { fontWeight: FontWeight.w700, color: Color(0XFF28353E), fontSize: - SizeConfig.textMultiplier * + SizeConfig.textMultiplier! * 1.3, ), ), @@ -186,7 +186,7 @@ class VitalSignDetailPainScale extends StatelessWidget { child: AppText( "Duration", fontSize: - SizeConfig.textMultiplier * 1.5, + SizeConfig.textMultiplier! * 1.5, color: Color(0XFF28353E), fontWeight: FontWeight.w600, ), @@ -200,7 +200,7 @@ class VitalSignDetailPainScale extends StatelessWidget { fontWeight: FontWeight.w700, color: Color(0XFF28353E), fontSize: - SizeConfig.textMultiplier * + SizeConfig.textMultiplier! * 1.3, ), ), @@ -216,7 +216,7 @@ class VitalSignDetailPainScale extends StatelessWidget { TranslationBase.of(context) .painManagement, fontSize: - SizeConfig.textMultiplier * 1.5, + SizeConfig.textMultiplier! * 1.5, color: Color(0XFF28353E), fontWeight: FontWeight.w600, ), @@ -230,7 +230,7 @@ class VitalSignDetailPainScale extends StatelessWidget { fontWeight: FontWeight.w700, color: Color(0XFF28353E), fontSize: - SizeConfig.textMultiplier * + SizeConfig.textMultiplier! * 1.3, ), ), @@ -245,7 +245,7 @@ class VitalSignDetailPainScale extends StatelessWidget { child: AppText( "Frequency", fontSize: - SizeConfig.textMultiplier * 1.5, + SizeConfig.textMultiplier! * 1.5, color: Color(0XFF28353E), fontWeight: FontWeight.w600, ), @@ -259,7 +259,7 @@ class VitalSignDetailPainScale extends StatelessWidget { fontWeight: FontWeight.w700, color: Color(0XFF28353E), fontSize: - SizeConfig.textMultiplier * + SizeConfig.textMultiplier! * 1.3, ), ), @@ -281,13 +281,13 @@ class VitalSignDetailPainScale extends StatelessWidget { "${AppDateUtils.convertDateFromServerFormat(vitalList[index].createdOn, "E , dd MMM")}", fontWeight: FontWeight.w700, color: Color(0XFF28353E), - fontSize: SizeConfig.textMultiplier * 1.6, + fontSize: SizeConfig.textMultiplier! * 1.6, ), AppText( "${AppDateUtils.convertDateFromServerFormat(vitalList[index].createdOn, "hh:mm a")}", fontWeight: FontWeight.w700, color: Color(0XFF28353E), - fontSize: SizeConfig.textMultiplier * 1.6, + fontSize: SizeConfig.textMultiplier! * 1.6, ), ], ), diff --git a/lib/screens/patients/profile/vital_sign/vital_sign_details_blood_pressurewideget.dart b/lib/screens/patients/profile/vital_sign/vital_sign_details_blood_pressurewideget.dart index f27d9f91..39570af0 100644 --- a/lib/screens/patients/profile/vital_sign/vital_sign_details_blood_pressurewideget.dart +++ b/lib/screens/patients/profile/vital_sign/vital_sign_details_blood_pressurewideget.dart @@ -9,7 +9,7 @@ import 'package:flutter/material.dart'; import 'package:provider/provider.dart'; class VitalSignBloodPressureWidget extends StatefulWidget { - final List vitalList; + final List? vitalList; final String title1; final String title2; final String title3; @@ -17,13 +17,13 @@ class VitalSignBloodPressureWidget extends StatefulWidget { final String viewKey2; VitalSignBloodPressureWidget( - {Key key, + {Key? key, this.vitalList, - this.title1, - this.title2, - this.viewKey1, - this.title3, - this.viewKey2}); + this.title1 = '' , + this.title2 = '', + this.viewKey1 = '', + this.title3 = '', + this.viewKey2 = ''}); @override _VitalSignDetailsWidgetState createState() => _VitalSignDetailsWidgetState(); @@ -48,7 +48,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', ), @@ -62,7 +62,7 @@ class _VitalSignDetailsWidgetState extends State { child: Container( child: AppText( widget.title2, - fontSize: SizeConfig.textMultiplier * 1.5, + fontSize: SizeConfig.textMultiplier! * 1.5, fontWeight: FontWeight.bold, fontFamily: 'Poppins', ), @@ -76,7 +76,7 @@ class _VitalSignDetailsWidgetState extends State { child: Container( child: AppText( widget.title3, - fontSize: SizeConfig.textMultiplier * 1.5, + fontSize: SizeConfig.textMultiplier! * 1.5, fontWeight: FontWeight.bold, fontFamily: 'Poppins', ), @@ -94,7 +94,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), ), @@ -122,7 +122,7 @@ class _VitalSignDetailsWidgetState extends State { height: 60), ), ]));*/ - widget.vitalList.forEach((vital) { + widget.vitalList!.forEach((vital) { var data = vital.toJson()[widget.viewKey1]; DateTime elementDate = AppDateUtils.getDateTimeFromServerFormat(vital.createdOn); @@ -135,7 +135,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', @@ -149,7 +149,7 @@ class _VitalSignDetailsWidgetState extends State { child: AppText( '${vital.toJson()[widget.viewKey1]}', // textAlign: TextAlign.center, - fontSize: SizeConfig.textMultiplier * 1.6, + fontSize: SizeConfig.textMultiplier! * 1.6, fontWeight: FontWeight.w600, fontFamily: 'Poppins', @@ -163,7 +163,7 @@ class _VitalSignDetailsWidgetState extends State { child: AppText( '${vital.toJson()[widget.viewKey2]}', // 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/vital_sign/vital_sign_details_screen.dart b/lib/screens/patients/profile/vital_sign/vital_sign_details_screen.dart index d2375196..1e1c41ea 100644 --- a/lib/screens/patients/profile/vital_sign/vital_sign_details_screen.dart +++ b/lib/screens/patients/profile/vital_sign/vital_sign_details_screen.dart @@ -20,12 +20,11 @@ class VitalSignDetailsScreen extends StatelessWidget { int projectID; bool isNotOneAppointment; - VitalSignDetailsScreen( - {this.appointmentNo, this.projectID, this.isNotOneAppointment = true}); + VitalSignDetailsScreen({this.appointmentNo = 0, this.projectID = 0, this.isNotOneAppointment = true}); @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']; @@ -36,8 +35,7 @@ class VitalSignDetailsScreen extends StatelessWidget { String assetBasePath = "${imageBasePath}patient/vital_signs/"; return BaseView( - onModelReady: (model) => - model.getPatientVitalSignHistory(patient, from, to, isInpatient), + onModelReady: (model) => model.getPatientVitalSignHistory(patient, from, to, isInpatient), builder: (_, mode, widget) => AppScaffold( baseViewModel: mode, isShowAppBar: true, @@ -59,13 +57,13 @@ class VitalSignDetailsScreen extends StatelessWidget { children: [ AppText( "${patient.firstName ?? patient?.patientDetails?.firstName ?? patient.fullName ?? ''}'s", - fontSize: SizeConfig.textMultiplier * 1.6, + fontSize: SizeConfig.textMultiplier! * 1.6, fontWeight: FontWeight.w700, color: Color(0xFF2E303A), ), AppText( TranslationBase.of(context).vitalSign, - fontSize: SizeConfig.textMultiplier * 3, + fontSize: SizeConfig.textMultiplier! * 3, fontWeight: FontWeight.bold, color: Color(0xFF2E303A), ) @@ -76,8 +74,7 @@ class VitalSignDetailsScreen extends StatelessWidget { height: MediaQuery.of(context).size.height * 0.23, width: double.infinity, padding: EdgeInsets.all(12.0), - margin: EdgeInsets.symmetric( - horizontal: 16.0, vertical: 8.0), + margin: EdgeInsets.symmetric(horizontal: 16.0, vertical: 8.0), decoration: BoxDecoration( shape: BoxShape.rectangle, color: Colors.white, @@ -93,7 +90,7 @@ class VitalSignDetailsScreen extends StatelessWidget { AppText( "${TranslationBase.of(context).yourBodyMassIndex} ${mode.bodyMax}", color: Color(0xFF2E303A), - fontSize: SizeConfig.textMultiplier * 2.0, + fontSize: SizeConfig.textMultiplier! * 2.0, fontWeight: FontWeight.w700, ), Row( @@ -101,17 +98,11 @@ class VitalSignDetailsScreen extends StatelessWidget { children: [ Expanded( child: Column( - crossAxisAlignment: - CrossAxisAlignment.center, + crossAxisAlignment: CrossAxisAlignment.center, children: [ Image.asset( - mode.getBMIStatus() != 1 - ? '${assetBasePath}underweight_BMI.png' - : '${assetBasePath}underweight_BMI-r.png', - height: MediaQuery.of(context) - .size - .height * - 0.10, + mode.getBMIStatus() != 1 ? '${assetBasePath}underweight_BMI.png' : '${assetBasePath}underweight_BMI-r.png', + height: MediaQuery.of(context).size.height * 0.10, ), const SizedBox( height: 4, @@ -119,38 +110,26 @@ class VitalSignDetailsScreen extends StatelessWidget { AppText( "${TranslationBase.of(context).bmiUnderWeight}", fontFamily: 'Poppins', - fontSize: - SizeConfig.textMultiplier * 1.15, - color: mode.getBMIStatus() == 1 - ? Color(0XFFD02127) - : null, + fontSize: SizeConfig.textMultiplier! * 1.15, + color: mode.getBMIStatus() == 1 ? Color(0XFFD02127) : Colors.grey, fontWeight: FontWeight.w700, ), AppText( "(<18.5)", fontFamily: 'Poppins', - fontSize: - SizeConfig.textMultiplier * 1.15, - color: mode.getBMIStatus() == 1 - ? Color(0XFFD02127) - : null, + fontSize: SizeConfig.textMultiplier! * 1.15, + color: mode.getBMIStatus() == 1 ? Color(0XFFD02127) : Colors.grey, fontWeight: FontWeight.w700, ), ], )), Expanded( child: Column( - crossAxisAlignment: - CrossAxisAlignment.center, + crossAxisAlignment: CrossAxisAlignment.center, children: [ Image.asset( - mode.getBMIStatus() != 2 - ? '${assetBasePath}health_BMI.png' - : '${assetBasePath}health_BMI-r.png', - height: MediaQuery.of(context) - .size - .height * - 0.10, + mode.getBMIStatus() != 2 ? '${assetBasePath}health_BMI.png' : '${assetBasePath}health_BMI-r.png', + height: MediaQuery.of(context).size.height * 0.10, ), const SizedBox( height: 4, @@ -159,40 +138,27 @@ class VitalSignDetailsScreen extends StatelessWidget { child: AppText( "${TranslationBase.of(context).normal}", fontFamily: 'Poppins', - fontSize: - SizeConfig.textMultiplier * - 1.15, + fontSize: SizeConfig.textMultiplier! * 1.15, fontWeight: FontWeight.w700, - color: mode.getBMIStatus() == 2 - ? Color(0XFFD02127) - : null, + color: mode.getBMIStatus() == 2 ? Color(0XFFD02127) : Colors.grey, ), ), AppText( "(18.5-24.9)", fontFamily: 'Poppins', - fontSize: - SizeConfig.textMultiplier * 1.15, + fontSize: SizeConfig.textMultiplier! * 1.15, fontWeight: FontWeight.w700, - color: mode.getBMIStatus() == 2 - ? Color(0XFFD02127) - : null, + color: mode.getBMIStatus() == 2 ? Color(0XFFD02127) : Colors.grey, ), ], )), Expanded( child: Column( - crossAxisAlignment: - CrossAxisAlignment.center, + crossAxisAlignment: CrossAxisAlignment.center, children: [ Image.asset( - mode.getBMIStatus() != 3 - ? '${assetBasePath}ovrweight_BMI.png' - : '${assetBasePath}ovrweight_BMI-r.png', - height: MediaQuery.of(context) - .size - .height * - 0.10, + mode.getBMIStatus() != 3 ? '${assetBasePath}ovrweight_BMI.png' : '${assetBasePath}ovrweight_BMI-r.png', + height: MediaQuery.of(context).size.height * 0.10, ), const SizedBox( height: 4, @@ -200,38 +166,26 @@ class VitalSignDetailsScreen extends StatelessWidget { AppText( "${TranslationBase.of(context).bmiOverWeight}", fontFamily: 'Poppins', - fontSize: - SizeConfig.textMultiplier * 1.155, + fontSize: SizeConfig.textMultiplier! * 1.155, fontWeight: FontWeight.w700, - color: mode.getBMIStatus() == 3 - ? Color(0XFFD02127) - : null, + color: mode.getBMIStatus() == 3 ? Color(0XFFD02127) : Colors.grey, ), AppText( "(25-29.9)", fontFamily: 'Poppins', - fontSize: - SizeConfig.textMultiplier * 1.155, + fontSize: SizeConfig.textMultiplier! * 1.155, fontWeight: FontWeight.w700, - color: mode.getBMIStatus() == 3 - ? Color(0XFFD02127) - : null, + color: mode.getBMIStatus() == 3 ? Color(0XFFD02127) : Colors.grey, ), ], )), Expanded( child: Column( - crossAxisAlignment: - CrossAxisAlignment.center, + crossAxisAlignment: CrossAxisAlignment.center, children: [ Image.asset( - mode.getBMIStatus() != 4 - ? '${assetBasePath}Obese_BMI.png' - : '${assetBasePath}Obese_BMI-r.png', - height: MediaQuery.of(context) - .size - .height * - 0.10, + mode.getBMIStatus() != 4 ? '${assetBasePath}Obese_BMI.png' : '${assetBasePath}Obese_BMI-r.png', + height: MediaQuery.of(context).size.height * 0.10, ), const SizedBox( height: 4, @@ -239,38 +193,26 @@ class VitalSignDetailsScreen extends StatelessWidget { AppText( "${TranslationBase.of(context).bmiObese}", fontFamily: 'Poppins', - fontSize: - SizeConfig.textMultiplier * 1.15, + fontSize: SizeConfig.textMultiplier! * 1.15, fontWeight: FontWeight.w700, - color: mode.getBMIStatus() == 4 - ? Color(0XFFD02127) - : null, + color: mode.getBMIStatus() == 4 ? Color(0XFFD02127) : Colors.grey, ), AppText( "(30-34.9)", fontFamily: 'Poppins', - fontSize: - SizeConfig.textMultiplier * 1.15, + fontSize: SizeConfig.textMultiplier! * 1.15, fontWeight: FontWeight.w700, - color: mode.getBMIStatus() == 4 - ? Color(0XFFD02127) - : null, + color: mode.getBMIStatus() == 4 ? Color(0XFFD02127) : Colors.grey, ), ], )), Expanded( child: Column( - crossAxisAlignment: - CrossAxisAlignment.center, + crossAxisAlignment: CrossAxisAlignment.center, children: [ Image.asset( - mode.getBMIStatus() != 5 - ? '${assetBasePath}Obese_BMI.png' - : '${assetBasePath}Obese_BMI-r.png', - height: MediaQuery.of(context) - .size - .height * - 0.10, + mode.getBMIStatus() != 5 ? '${assetBasePath}Obese_BMI.png' : '${assetBasePath}Obese_BMI-r.png', + height: MediaQuery.of(context).size.height * 0.10, ), const SizedBox( height: 4, @@ -280,24 +222,17 @@ class VitalSignDetailsScreen extends StatelessWidget { child: AppText( "${TranslationBase.of(context).bmiObeseExtreme}", fontFamily: 'Poppins', - fontSize: - SizeConfig.textMultiplier * - 1.15, + fontSize: SizeConfig.textMultiplier! * 1.15, fontWeight: FontWeight.w700, - color: mode.getBMIStatus() == 5 - ? Color(0XFFD02127) - : null, + color: mode.getBMIStatus() == 5 ? Color(0XFFD02127) : Colors.grey, ), ), AppText( "(35<)", fontFamily: 'Poppins', - fontSize: - SizeConfig.textMultiplier * 1.15, + fontSize: SizeConfig.textMultiplier! * 1.15, fontWeight: FontWeight.w700, - color: mode.getBMIStatus() == 5 - ? Color(0XFFD02127) - : null, + color: mode.getBMIStatus() == 5 ? Color(0XFFD02127) : Colors.grey, ), ], )), @@ -309,8 +244,7 @@ class VitalSignDetailsScreen extends StatelessWidget { Expanded( child: SingleChildScrollView( child: Container( - margin: EdgeInsets.symmetric( - horizontal: 16.0, vertical: 16), + margin: EdgeInsets.symmetric(horizontal: 16.0, vertical: 16), child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ @@ -326,16 +260,10 @@ class VitalSignDetailsScreen extends StatelessWidget { ? Navigator.push( context, FadePage( - page: - VitalSignItemDetailsScreen( - pageKey: vitalSignDetails - .Height, - pageTitle: - TranslationBase.of( - context) - .height, - vitalList: mode - .patientVitalSignsHistory, + page: VitalSignItemDetailsScreen( + pageKey: vitalSignDetails.Height, + pageTitle: TranslationBase.of(context).height, + vitalList: mode.patientVitalSignsHistory, patient: patient, patientType: patientType, arrivalType: arrivalType, @@ -345,40 +273,28 @@ class VitalSignDetailsScreen extends StatelessWidget { : null, child: Container( child: VitalSignItem( - des: TranslationBase.of(context) - .height, - imagePath: - "${assetBasePath}height.png", + des: TranslationBase.of(context).height, + imagePath: "${assetBasePath}height.png", lastVal: mode.heightCm, - unit: TranslationBase.of(context) - .cm, + unit: TranslationBase.of(context).cm, ), ), ), if (isNotOneAppointment) InkWell( onTap: () async { - await locator() - .logEvent( - eventCategory: - "Vital Sign Details Screen", - eventAction: - "Vital Sign Details", + await locator().logEvent( + eventCategory: "Vital Sign Details Screen", + eventAction: "Vital Sign Details", ); Navigator.push( context, FadePage( - page: - VitalSignItemDetailsScreen( - pageKey: - vitalSignDetails.Weight, - pageTitle: - TranslationBase.of( - context) - .weight, - vitalList: mode - .patientVitalSignsHistory, + page: VitalSignItemDetailsScreen( + pageKey: vitalSignDetails.Weight, + pageTitle: TranslationBase.of(context).weight, + vitalList: mode.patientVitalSignsHistory, patient: patient, patientType: patientType, arrivalType: arrivalType, @@ -387,12 +303,9 @@ class VitalSignDetailsScreen extends StatelessWidget { ); }, child: VitalSignItem( - des: TranslationBase.of(context) - .weight, - imagePath: - "${assetBasePath}weight.png", - unit: TranslationBase.of(context) - .kg, + des: TranslationBase.of(context).weight, + imagePath: "${assetBasePath}weight.png", + unit: TranslationBase.of(context).kg, lastVal: mode.weightKg, ), ), @@ -401,16 +314,10 @@ class VitalSignDetailsScreen extends StatelessWidget { ? Navigator.push( context, FadePage( - page: - VitalSignItemDetailsScreen( - pageKey: vitalSignDetails - .Temperature, - pageTitle: - TranslationBase.of( - context) - .temperature, - vitalList: mode - .patientVitalSignsHistory, + page: VitalSignItemDetailsScreen( + pageKey: vitalSignDetails.Temperature, + pageTitle: TranslationBase.of(context).temperature, + vitalList: mode.patientVitalSignsHistory, patient: patient, patientType: patientType, arrivalType: arrivalType, @@ -420,13 +327,10 @@ class VitalSignDetailsScreen extends StatelessWidget { : null, child: Container( child: VitalSignItem( - des: TranslationBase.of(context) - .temperature, - imagePath: - "${assetBasePath}temperature.png", + des: TranslationBase.of(context).temperature, + imagePath: "${assetBasePath}temperature.png", lastVal: mode.temperatureCelcius, - unit: TranslationBase.of(context) - .tempC, + unit: TranslationBase.of(context).tempC, ), ), ), @@ -435,16 +339,10 @@ class VitalSignDetailsScreen extends StatelessWidget { ? Navigator.push( context, FadePage( - page: - VitalSignItemDetailsScreen( - pageKey: vitalSignDetails - .heart, - pageTitle: - TranslationBase.of( - context) - .heart, - vitalList: mode - .patientVitalSignsHistory, + page: VitalSignItemDetailsScreen( + pageKey: vitalSignDetails.heart, + pageTitle: TranslationBase.of(context).heart, + vitalList: mode.patientVitalSignsHistory, patient: patient, patientType: patientType, arrivalType: arrivalType, @@ -453,13 +351,10 @@ class VitalSignDetailsScreen extends StatelessWidget { ) : null, child: VitalSignItem( - des: TranslationBase.of(context) - .heart, - imagePath: - "${assetBasePath}heart_rate.png", + des: TranslationBase.of(context).heart, + imagePath: "${assetBasePath}heart_rate.png", lastVal: mode.hartRat, - unit: - TranslationBase.of(context).bpm, + unit: TranslationBase.of(context).bpm, ), ), InkWell( @@ -467,16 +362,10 @@ class VitalSignDetailsScreen extends StatelessWidget { ? Navigator.push( context, FadePage( - page: - VitalSignItemDetailsScreen( - pageKey: vitalSignDetails - .Respiration, - pageTitle: - TranslationBase.of( - context) - .respirationRate, - vitalList: mode - .patientVitalSignsHistory, + page: VitalSignItemDetailsScreen( + pageKey: vitalSignDetails.Respiration, + pageTitle: TranslationBase.of(context).respirationRate, + vitalList: mode.patientVitalSignsHistory, patient: patient, patientType: patientType, arrivalType: arrivalType, @@ -485,14 +374,10 @@ class VitalSignDetailsScreen extends StatelessWidget { ) : null, child: VitalSignItem( - des: TranslationBase.of(context) - .respirationRate, - imagePath: - "${assetBasePath}respiration_rate.png", - lastVal: - mode.respirationBeatPerMinute, - unit: TranslationBase.of(context) - .respirationSigns, + des: TranslationBase.of(context).respirationRate, + imagePath: "${assetBasePath}respiration_rate.png", + lastVal: mode.respirationBeatPerMinute, + unit: TranslationBase.of(context).respirationSigns, ), ), InkWell( @@ -500,16 +385,10 @@ class VitalSignDetailsScreen extends StatelessWidget { ? Navigator.push( context, FadePage( - page: - VitalSignItemDetailsScreen( - pageKey: vitalSignDetails - .BloodPressure, - pageTitle: - TranslationBase.of( - context) - .bloodPressure, - vitalList: mode - .patientVitalSignsHistory, + page: VitalSignItemDetailsScreen( + pageKey: vitalSignDetails.BloodPressure, + pageTitle: TranslationBase.of(context).bloodPressure, + vitalList: mode.patientVitalSignsHistory, patient: patient, patientType: patientType, arrivalType: arrivalType, @@ -518,13 +397,10 @@ class VitalSignDetailsScreen extends StatelessWidget { ) : null, child: VitalSignItem( - des: TranslationBase.of(context) - .bloodPressure, - imagePath: - "${assetBasePath}blood_pressure.png", + des: TranslationBase.of(context).bloodPressure, + imagePath: "${assetBasePath}blood_pressure.png", lastVal: mode.bloodPressure, - unit: TranslationBase.of(context) - .sysDias, + unit: TranslationBase.of(context).sysDias, ), ), InkWell( @@ -532,16 +408,10 @@ class VitalSignDetailsScreen extends StatelessWidget { ? Navigator.push( context, FadePage( - page: - VitalSignItemDetailsScreen( - pageKey: vitalSignDetails - .Oxygenation, - pageTitle: - TranslationBase.of( - context) - .oxygenation, - vitalList: mode - .patientVitalSignsHistory, + page: VitalSignItemDetailsScreen( + pageKey: vitalSignDetails.Oxygenation, + pageTitle: TranslationBase.of(context).oxygenation, + vitalList: mode.patientVitalSignsHistory, patient: patient, patientType: patientType, arrivalType: arrivalType, @@ -550,10 +420,8 @@ class VitalSignDetailsScreen extends StatelessWidget { ) : null, child: VitalSignItem( - des: TranslationBase.of(context) - .oxygenation, - imagePath: - "${assetBasePath}oxg.png", + des: TranslationBase.of(context).oxygenation, + imagePath: "${assetBasePath}oxg.png", lastVal: "${mode.oxygenation}%", unit: "", ), @@ -563,16 +431,10 @@ class VitalSignDetailsScreen extends StatelessWidget { ? Navigator.push( context, FadePage( - page: - VitalSignItemDetailsScreen( - pageKey: vitalSignDetails - .PainScale, - pageTitle: - TranslationBase.of( - context) - .painScale, - vitalList: mode - .patientVitalSignsHistory, + page: VitalSignItemDetailsScreen( + pageKey: vitalSignDetails.PainScale, + pageTitle: TranslationBase.of(context).painScale, + vitalList: mode.patientVitalSignsHistory, patient: patient, patientType: patientType, arrivalType: arrivalType, @@ -581,13 +443,10 @@ class VitalSignDetailsScreen extends StatelessWidget { ) : null, child: VitalSignItem( - des: TranslationBase.of(context) - .painScale, - imagePath: - "${assetBasePath}painScale.png", + des: TranslationBase.of(context).painScale, + imagePath: "${assetBasePath}painScale.png", lastVal: mode.painScore, - unit: TranslationBase.of(context) - .severe, + unit: TranslationBase.of(context).severe, ), ), ], diff --git a/lib/screens/patients/profile/vital_sign/vital_sign_details_wideget.dart b/lib/screens/patients/profile/vital_sign/vital_sign_details_wideget.dart index 5c804f2d..ee27ddf8 100644 --- a/lib/screens/patients/profile/vital_sign/vital_sign_details_wideget.dart +++ b/lib/screens/patients/profile/vital_sign/vital_sign_details_wideget.dart @@ -9,13 +9,13 @@ import 'package:flutter/material.dart'; import 'package:provider/provider.dart'; class VitalSignDetailsWidget extends StatefulWidget { - final List vitalList; + final List? vitalList; final String title1; final String title2; final String viewKey; VitalSignDetailsWidget( - {Key key, this.vitalList, this.title1, this.title2, this.viewKey}); + {Key? key, this.vitalList, this.title1 = '', this.title2 = '', this.viewKey =''}); @override _VitalSignDetailsWidgetState createState() => _VitalSignDetailsWidgetState(); @@ -53,7 +53,7 @@ class _VitalSignDetailsWidgetState extends State { ),*/ child: AppText( TranslationBase.of(context).date, - fontSize: SizeConfig.textMultiplier * 1.6, + fontSize: SizeConfig.textMultiplier! * 1.6, fontWeight: FontWeight.bold, fontFamily: 'Poppins', ), @@ -74,7 +74,7 @@ class _VitalSignDetailsWidgetState extends State { ),*/ child: AppText( widget.title2, - fontSize: SizeConfig.textMultiplier * 1.6, + fontSize: SizeConfig.textMultiplier! * 1.6, fontWeight: FontWeight.bold, fontFamily: 'Poppins', ), @@ -92,7 +92,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), ), @@ -107,7 +107,7 @@ class _VitalSignDetailsWidgetState extends State { /* tableRow.add(TableRow(children: [ ]));*/ - widget.vitalList.forEach((vital) { + widget.vitalList!.forEach((vital) { var data = vital.toJson()[widget.viewKey]; DateTime elementDate = AppDateUtils.getDateTimeFromServerFormat(vital.createdOn); @@ -120,7 +120,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.8, + fontSize: SizeConfig.textMultiplier! * 1.8, fontWeight: FontWeight.w600, fontFamily: 'Poppins', @@ -134,7 +134,7 @@ class _VitalSignDetailsWidgetState extends State { child: AppText( '${vital.toJson()[widget.viewKey]}', // textAlign: TextAlign.center, - fontSize: SizeConfig.textMultiplier * 1.8, + fontSize: SizeConfig.textMultiplier! * 1.8, fontWeight: FontWeight.w600, fontFamily: 'Poppins', 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 4caa47ce..d5aac9ba 100644 --- a/lib/screens/patients/profile/vital_sign/vital_sign_item.dart +++ b/lib/screens/patients/profile/vital_sign/vital_sign_item.dart @@ -13,13 +13,13 @@ class VitalSignItem extends StatelessWidget { final double width; const VitalSignItem( - {Key key, - @required this.des, + {Key? key, + required this.des, this.lastVal = 'N/A', this.unit = '', - this.height, - this.width, - @required this.imagePath}) + this.height = 0, + this.width = 0, + required this.imagePath}) : super(key: key); @override @@ -50,7 +50,7 @@ class VitalSignItem extends StatelessWidget { AppText( "$lastVal", fontFamily: 'Poppins', - fontSize: SizeConfig.textMultiplier * 1.4, + fontSize: SizeConfig.textMultiplier! * 1.4, fontWeight: FontWeight.bold, color: Color(0xFF2E303A), margin: 0, @@ -61,7 +61,7 @@ class VitalSignItem extends StatelessWidget { AppText( "$unit", fontFamily: 'Poppins', - fontSize: SizeConfig.textMultiplier * 1.2, + fontSize: SizeConfig.textMultiplier! * 1.2, fontWeight: FontWeight.w700, color: Color(0xFFD02127), margin: 0, @@ -100,7 +100,7 @@ class VitalSignItem extends StatelessWidget { child: AppText( "$des", color: Color(0xFF2E303A), - fontSize: SizeConfig.textMultiplier * 1.3, + fontSize: SizeConfig.textMultiplier! * 1.3, fontWeight: FontWeight.bold, ), ), diff --git a/lib/screens/patients/profile/vital_sign/vital_sign_item_details_screen.dart b/lib/screens/patients/profile/vital_sign/vital_sign_item_details_screen.dart index 95147ba0..b06a6784 100644 --- a/lib/screens/patients/profile/vital_sign/vital_sign_item_details_screen.dart +++ b/lib/screens/patients/profile/vital_sign/vital_sign_item_details_screen.dart @@ -14,22 +14,22 @@ import 'package:flutter/material.dart'; import 'package:provider/provider.dart'; class VitalSignItemDetailsScreen extends StatelessWidget { - final vitalSignDetails pageKey; + final vitalSignDetails? pageKey; final String pageTitle; - List VSchart; - PatiantInformtion patient; + List? VSchart; + PatiantInformtion? patient; String patientType; String arrivalType; VitalSignItemDetailsScreen( {this.vitalList, this.pageKey, - this.pageTitle, + this.pageTitle = '', this.patient, - this.patientType, - this.arrivalType}); + this.patientType = '', + this.arrivalType = ''}); - final List vitalList; + final List? vitalList; @override Widget build(BuildContext context) { @@ -191,7 +191,7 @@ class VitalSignItemDetailsScreen extends StatelessWidget { backgroundColor: Color.fromRGBO(248, 248, 248, 1), isShowAppBar: true, appBar: PatientProfileAppBar( - patient, + patient!, ), body: SingleChildScrollView( child: Column( @@ -203,15 +203,15 @@ class VitalSignItemDetailsScreen extends StatelessWidget { crossAxisAlignment: CrossAxisAlignment.start, children: [ AppText( - "${patient.firstName ?? patient?.patientDetails?.firstName ?? patient.fullName ?? ''}'s", + "${patient!.firstName ?? patient?.patientDetails?.firstName ?? patient!.fullName ?? ''}'s", fontFamily: 'Poppins', - fontSize: SizeConfig.textMultiplier * 1.6, + fontSize: SizeConfig.textMultiplier! * 1.6, fontWeight: FontWeight.w600, ), AppText( TranslationBase.of(context).vitalSign, fontFamily: 'Poppins', - fontSize: SizeConfig.textMultiplier * 3, + fontSize: SizeConfig.textMultiplier! * 3, fontWeight: FontWeight.bold, ) ], @@ -221,20 +221,20 @@ class VitalSignItemDetailsScreen extends StatelessWidget { child: ListView( shrinkWrap: true, physics: NeverScrollableScrollPhysics(), - children: VSchart.map((chartInfo) { - var vitalListTemp = vitalList.where( + children: VSchart!.map((chartInfo) { + var vitalListTemp = vitalList!.where( (element) => element.toJson()[chartInfo['viewKey']] != null, ); if (chartInfo['viewKey'] == 'PainScore') { - return VitalSignDetailPainScale(vitalList); + return VitalSignDetailPainScale(vitalList!); } if (vitalListTemp.length != 0 && chartInfo['viewKey'] == 'BloodPressure' || chartInfo['viewKey'] == 'O2') { return VitalSingChartBloodPressure( - vitalList: vitalList, + vitalList: vitalList!, name: projectViewModel.isArabic ? chartInfo['nameAr'] : chartInfo['name'], @@ -256,7 +256,7 @@ class VitalSignItemDetailsScreen extends StatelessWidget { return vitalListTemp.length != 0 ? VitalSingChartAndDetials( - vitalList: vitalList, + vitalList: vitalList!, name: projectViewModel.isArabic ? chartInfo['nameAr'] : chartInfo['name'], diff --git a/lib/screens/patients/profile/vital_sign/vital_sing_chart_and_detials.dart b/lib/screens/patients/profile/vital_sign/vital_sing_chart_and_detials.dart index 69a30384..6eb47056 100644 --- a/lib/screens/patients/profile/vital_sign/vital_sing_chart_and_detials.dart +++ b/lib/screens/patients/profile/vital_sign/vital_sing_chart_and_detials.dart @@ -11,12 +11,12 @@ import 'line_chart_curved.dart'; class VitalSingChartAndDetials extends StatelessWidget { VitalSingChartAndDetials({ - Key key, - @required this.vitalList, - @required this.name, - @required this.viewKey, - @required this.title1, - @required this.title2, + Key? key, + required this.vitalList, + required this.name, + required this.viewKey, + required this.title1, + required this.title2, }) : super(key: key); final List vitalList; @@ -57,7 +57,7 @@ class VitalSingChartAndDetials extends StatelessWidget { children: [ AppText( TranslationBase.of(context).graphDetails, - fontSize: SizeConfig.textMultiplier * 2.1, + fontSize: SizeConfig.textMultiplier! * 2.1, fontWeight: FontWeight.bold, fontFamily: 'Poppins', ), diff --git a/lib/screens/patients/profile/vital_sign/vital_sing_chart_blood_pressure.dart b/lib/screens/patients/profile/vital_sign/vital_sing_chart_blood_pressure.dart index 874bb4f8..0a0bd6e4 100644 --- a/lib/screens/patients/profile/vital_sign/vital_sing_chart_blood_pressure.dart +++ b/lib/screens/patients/profile/vital_sign/vital_sing_chart_blood_pressure.dart @@ -11,14 +11,14 @@ import 'line_chart_curved_blood_pressure.dart'; class VitalSingChartBloodPressure extends StatelessWidget { VitalSingChartBloodPressure({ - Key key, - @required this.vitalList, - @required this.name, - @required this.viewKey1, - @required this.viewKey2, - @required this.title1, - @required this.title2, - @required this.title3, + Key? key, + required this.vitalList, + required this.name, + required this.viewKey1, + required this.viewKey2, + required this.title1, + required this.title2, + required this.title3, }) : super(key: key); final List vitalList; @@ -64,7 +64,7 @@ class VitalSingChartBloodPressure extends StatelessWidget { children: [ AppText( TranslationBase.of(context).graphDetails, - fontSize: SizeConfig.textMultiplier * 2.3, + fontSize: SizeConfig.textMultiplier! * 2.3, fontWeight: FontWeight.bold, fontFamily: 'Poppins', ), diff --git a/lib/screens/patients/profile/vte_assessment/vte_assessment_screen.dart b/lib/screens/patients/profile/vte_assessment/vte_assessment_screen.dart index 8af9830b..2b2cc9e2 100644 --- a/lib/screens/patients/profile/vte_assessment/vte_assessment_screen.dart +++ b/lib/screens/patients/profile/vte_assessment/vte_assessment_screen.dart @@ -20,7 +20,7 @@ import 'package:provider/provider.dart'; DrAppSharedPreferances sharedPref = new DrAppSharedPreferances(); class VteAssessmentScreen extends StatefulWidget { - const VteAssessmentScreen({Key key}) : super(key: key); + const VteAssessmentScreen({Key? key}) : super(key: key); @override _ProgressNoteState createState() => _ProgressNoteState(); @@ -28,23 +28,22 @@ class VteAssessmentScreen extends StatefulWidget { class _ProgressNoteState extends State { bool isDischargedPatient = false; - AuthenticationViewModel authenticationViewModel; - ProjectViewModel projectViewModel; + AuthenticationViewModel authenticationViewModel = AuthenticationViewModel(); + 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']; - if (routeArgs.containsKey('isDischargedPatient')) - isDischargedPatient = routeArgs['isDischargedPatient']; + if (routeArgs.containsKey('isDischargedPatient')) isDischargedPatient = routeArgs['isDischargedPatient']; return BaseView( - onModelReady: (model) => model.getVteAssessment(patientId: patient.patientId, + onModelReady: (model) => model.getVteAssessment( + patientId: patient.patientId, // admissionNo: 2016023498 - admissionNo:int.parse(patient.admissionNo) - ), + admissionNo: int.parse(patient.admissionNo!)), builder: (_, model, w) => AppScaffold( baseViewModel: model, backgroundColor: Theme.of(context).scaffoldBackgroundColor, @@ -52,230 +51,159 @@ class _ProgressNoteState extends State { patient, isInpatient: true, ), - body: model.allVteHistoryList == null || - model.allVteHistoryList.length == 0 + body: model.allVteHistoryList == null || model.allVteHistoryList.length == 0 ? Center( - child: ErrorMessage( - error: TranslationBase.of(context).noDataAvailable, - ), - ) + child: ErrorMessage( + error: TranslationBase.of(context).noDataAvailable, + ), + ) : Container( - color: Colors.grey[200], - child: Column( - children: [ - Expanded( - child: Container( - child: ListView.builder( - itemCount: model.allVteHistoryList.length, - itemBuilder: (BuildContext ctxt, int index) { - return FractionallySizedBox( - widthFactor: 0.95, - child: CardWithBgWidget( - hasBorder: false, - bgColor: Colors.transparent, - widget: Column( - children: [ - Column( - crossAxisAlignment: - CrossAxisAlignment.start, - children: [ - SizedBox( - height: 10, - ), - Row( - mainAxisAlignment: - MainAxisAlignment.spaceBetween, - crossAxisAlignment: - CrossAxisAlignment.start, - children: [ - Container( - width: MediaQuery.of(context) - .size - .width * - 0.60, - child: Column( - crossAxisAlignment: - CrossAxisAlignment.start, + color: Colors.grey[200], + child: Column( + children: [ + Expanded( + child: Container( + child: ListView.builder( + itemCount: model.allVteHistoryList.length, + itemBuilder: (BuildContext ctxt, int index) { + return FractionallySizedBox( + widthFactor: 0.95, + child: CardWithBgWidget( + hasBorder: false, + bgColor: Colors.transparent, + widget: Column( + children: [ + Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + SizedBox( + height: 10, + ), + Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + crossAxisAlignment: CrossAxisAlignment.start, children: [ - Row( - crossAxisAlignment: - CrossAxisAlignment - .start, + Container( + width: MediaQuery.of(context).size.width * 0.60, + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Row( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + AppText( + model.allVteHistoryList[index].riskScore!, + fontWeight: FontWeight.w600, + fontSize: 14, + ), + ], + ), + ], + ), + ), + Column( children: [ AppText( - model - .allVteHistoryList[ - index].riskScore, + model.allVteHistoryList[index].createdOn != null + ? AppDateUtils.getDayMonthYearDateFormatted(AppDateUtils.getDateTimeFromString(model.allVteHistoryList[index].createdOn!), + isArabic: projectViewModel.isArabic, isMonthShort: true) + : AppDateUtils.getDayMonthYearDateFormatted(DateTime.now(), isArabic: projectViewModel.isArabic), fontWeight: FontWeight.w600, fontSize: 14, + isCopyable: true, + ), + AppText( + model.allVteHistoryList[index].createdOn != null + ? AppDateUtils.getHour(AppDateUtils.getDateTimeFromString(model.allVteHistoryList[index].createdOn!)) + : AppDateUtils.getHour(DateTime.now()), + fontWeight: FontWeight.w600, + fontSize: 14, + isCopyable: true, ), - ], - ), + crossAxisAlignment: CrossAxisAlignment.end, + ) ], ), - ), - Column( - children: [ + SizedBox( + height: 8, + ), + Row(mainAxisAlignment: MainAxisAlignment.start, children: [ AppText( - model - .allVteHistoryList[ - index] - .createdOn != - null - ? AppDateUtils.getDayMonthYearDateFormatted( - AppDateUtils - .getDateTimeFromString(model - .allVteHistoryList[ - index] - .createdOn), - isArabic: - projectViewModel - .isArabic, - isMonthShort: true) - : AppDateUtils - .getDayMonthYearDateFormatted( - DateTime.now(), - isArabic: - projectViewModel - .isArabic), - fontWeight: FontWeight.w600, - fontSize: 14, - isCopyable: true, + TranslationBase.of(context).VTE_Type + " : ", + fontSize: 12, ), - AppText( - model - .allVteHistoryList[ - index] - .createdOn != - null - ? AppDateUtils.getHour( - AppDateUtils - .getDateTimeFromString(model - .allVteHistoryList[ - index] - .createdOn)) - : AppDateUtils.getHour( - DateTime.now()), - fontWeight: FontWeight.w600, - fontSize: 14, - isCopyable: true, + Expanded( + child: AppText( + model.allVteHistoryList[index].vTEType!, + fontSize: 12, + isCopyable: true, + ), ), - ], - crossAxisAlignment: - CrossAxisAlignment.end, - ) - ], - ), - SizedBox( - height: 8, - ), - Row( - mainAxisAlignment: - MainAxisAlignment.start, - children: [ - AppText( - TranslationBase.of(context) - .VTE_Type + - " : ", - fontSize: 12, + ]), + SizedBox( + height: 8, ), - Expanded( - child: AppText( - model - .allVteHistoryList[ - index] - .vTEType, + Row(mainAxisAlignment: MainAxisAlignment.start, children: [ + AppText( + TranslationBase.of(context).pharmacology + " : ", fontSize: 12, - isCopyable: true, ), - ), - ]), - SizedBox( - height: 8, - ), - Row( - mainAxisAlignment: - MainAxisAlignment.start, - children: [ - AppText( - TranslationBase.of(context) - .pharmacology + - " : ", - fontSize: 12, - ), - Expanded( - child: AppText( - model - .allVteHistoryList[ - index] - .pharmacology, - fontSize: 12, - isCopyable: true, + Expanded( + child: AppText( + model.allVteHistoryList[index].pharmacology!, + fontSize: 12, + isCopyable: true, + ), ), + ]), + SizedBox( + height: 8, ), - ]), - SizedBox( - height: 8, - ), - Row( - mainAxisAlignment: - MainAxisAlignment.start, - children: [ - AppText( - TranslationBase.of(context) - .reasonsThrombo + - " : ", - fontSize: 12, - ), - Expanded( - child: AppText( - model - .allVteHistoryList[ - index] - .reasonsThrombo, + Row(mainAxisAlignment: MainAxisAlignment.start, children: [ + AppText( + TranslationBase.of(context).reasonsThrombo + " : ", fontSize: 12, - isCopyable: true, ), + Expanded( + child: AppText( + model.allVteHistoryList[index].reasonsThrombo!, + fontSize: 12, + isCopyable: true, + ), + ), + ]), + SizedBox( + height: 8, ), - ]), - SizedBox( - height: 8, - ), - Row( - mainAxisAlignment: - MainAxisAlignment.start, - children: [ - AppText( - "Ambulation Protocol : ", - fontSize: 12, - ), - Expanded( - child: AppText( - model - .allVteHistoryList[ - index] - .ambulationProtocol, + Row(mainAxisAlignment: MainAxisAlignment.start, children: [ + AppText( + "Ambulation Protocol : ", fontSize: 12, - isCopyable: true, ), - ), - ]) - ], - ), - SizedBox( - height: 20, + Expanded( + child: AppText( + model.allVteHistoryList[index].ambulationProtocol!, + fontSize: 12, + isCopyable: true, + ), + ), + ]) + ], + ), + SizedBox( + height: 20, + ), + ], + ), ), - ], - ), - ), - ); - }), + ); + }), + ), + ), + ], ), ), - ], - ), - ), ), ); } diff --git a/lib/screens/patients/register_patient/CustomEditableText.dart b/lib/screens/patients/register_patient/CustomEditableText.dart index f53a96fe..b029e7e2 100644 --- a/lib/screens/patients/register_patient/CustomEditableText.dart +++ b/lib/screens/patients/register_patient/CustomEditableText.dart @@ -6,11 +6,11 @@ import 'package:flutter/material.dart'; class CustomEditableText extends StatefulWidget { CustomEditableText({ - Key key, - @required this.controller, - this.hint, + Key? key, + required this.controller, + this.hint = '', this.isEditable = false, - this.isSubmitted, + this.isSubmitted = false, }) : super(key: key); final TextEditingController controller; @@ -37,7 +37,7 @@ class _CustomEditableTextState extends State { borderRadius: BorderRadius.all(Radius.circular(20)), border: Border.fromBorderSide( BorderSide( - color: Colors.grey[300], + color: Colors.grey[300]!, width: 2, ), ), @@ -55,7 +55,7 @@ class _CustomEditableTextState extends State { AppText( widget.controller.text, fontSize: 12, - color: Colors.grey[600], + color: Colors.grey[600]!, ), ], ), @@ -82,7 +82,7 @@ class _CustomEditableTextState extends State { validationError: widget.controller.text.isEmpty && widget.isSubmitted ? TranslationBase.of(context).emptyMessage - : null, + : "", maxLines: 1, minLines: 1, hasBorder: true, diff --git a/lib/screens/patients/register_patient/RegisterConfirmationPatientPage.dart b/lib/screens/patients/register_patient/RegisterConfirmationPatientPage.dart index 3270e8ce..ea91454c 100644 --- a/lib/screens/patients/register_patient/RegisterConfirmationPatientPage.dart +++ b/lib/screens/patients/register_patient/RegisterConfirmationPatientPage.dart @@ -25,46 +25,36 @@ import 'package:provider/provider.dart'; import 'CustomEditableText.dart'; class RegisterConfirmationPatientPage extends StatefulWidget { - final OperationReportViewModel operationReportViewModel; - final PatiantInformtion patient; - final PatientRegistrationViewModel model; + final OperationReportViewModel? operationReportViewModel; + final PatiantInformtion? patient; + final PatientRegistrationViewModel? model; - const RegisterConfirmationPatientPage( - {Key key, this.operationReportViewModel, this.patient, this.model}) - : super(key: key); + const RegisterConfirmationPatientPage({Key? key, this.operationReportViewModel, this.patient, this.model}) : super(key: key); @override - _RegisterConfirmationPatientPageState createState() => - _RegisterConfirmationPatientPageState(); + _RegisterConfirmationPatientPageState createState() => _RegisterConfirmationPatientPageState(); } -class _RegisterConfirmationPatientPageState - extends State { +class _RegisterConfirmationPatientPageState extends State { bool isSubmitted = false; - ProjectViewModel projectViewModel; - TextEditingController firstNameN; - TextEditingController middleNameN; - TextEditingController lastNameN; - TextEditingController firstNameAr; - TextEditingController middleNameAr; - TextEditingController lastNameAr; - TextEditingController emailAddressController; + late ProjectViewModel projectViewModel; + TextEditingController firstNameN = TextEditingController(), middleNameN = TextEditingController(), lastNameN = TextEditingController(); + TextEditingController firstNameAr = TextEditingController(); + TextEditingController middleNameAr = TextEditingController(); + TextEditingController lastNameAr = TextEditingController(); + TextEditingController emailAddressController = TextEditingController(); TextEditingController langController = TextEditingController(text: "English"); int selectedLang = 1; @override void initState() { - firstNameN = TextEditingController( - text: widget.model.getPatientInfoResponseModel.firstNameEn); + firstNameN = TextEditingController(text: widget.model!.getPatientInfoResponseModel.firstNameEn); middleNameN = TextEditingController(text: ""); - lastNameN = TextEditingController( - text: widget.model.getPatientInfoResponseModel.lastNameEn); + lastNameN = TextEditingController(text: widget.model!.getPatientInfoResponseModel.lastNameEn); - firstNameAr = TextEditingController( - text: widget.model.getPatientInfoResponseModel.firstNameAr); + firstNameAr = TextEditingController(text: widget.model!.getPatientInfoResponseModel.firstNameAr); middleNameAr = TextEditingController(text: ""); - lastNameAr = TextEditingController( - text: widget.model.getPatientInfoResponseModel.lastNameAr); + lastNameAr = TextEditingController(text: widget.model!.getPatientInfoResponseModel.lastNameAr); emailAddressController = TextEditingController(text: ""); super.initState(); } @@ -95,49 +85,27 @@ class _RegisterConfirmationPatientPageState widthFactor: 0.9, child: Column( children: [ - CustomEditableText( - controller: firstNameN, - isSubmitted: isSubmitted, - hint: TranslationBase.of(context).firstName), + CustomEditableText(controller: firstNameN, isSubmitted: isSubmitted, hint: TranslationBase.of(context).firstName), SizedBox( height: 4, ), - CustomEditableText( - controller: middleNameN, - isEditable: middleNameN.text.isEmpty, - isSubmitted: isSubmitted, - hint: TranslationBase.of(context).middleName), + CustomEditableText(controller: middleNameN, isEditable: middleNameN.text.isEmpty, isSubmitted: isSubmitted, hint: TranslationBase.of(context).middleName), SizedBox( height: 4, ), - CustomEditableText( - controller: lastNameN, - isSubmitted: isSubmitted, - hint: TranslationBase.of(context).lastName), + CustomEditableText(controller: lastNameN, isSubmitted: isSubmitted, hint: TranslationBase.of(context).lastName), SizedBox( height: 20, ), - CustomEditableText( - controller: firstNameAr, - isSubmitted: isSubmitted, - hint: - TranslationBase.of(context).firstNameInAr), + CustomEditableText(controller: firstNameAr, isSubmitted: isSubmitted, hint: TranslationBase.of(context).firstNameInAr), SizedBox( height: 4, ), - CustomEditableText( - controller: middleNameAr, - isEditable: middleNameN.text.isEmpty, - isSubmitted: isSubmitted, - hint: - TranslationBase.of(context).middleNameInAr), + CustomEditableText(controller: middleNameAr, isEditable: middleNameN.text.isEmpty, isSubmitted: isSubmitted, hint: TranslationBase.of(context).middleNameInAr), SizedBox( height: 4, ), - CustomEditableText( - controller: lastNameAr, - isSubmitted: isSubmitted, - hint: TranslationBase.of(context).lastNameInAr), + CustomEditableText(controller: lastNameAr, isSubmitted: isSubmitted, hint: TranslationBase.of(context).lastNameInAr), SizedBox( height: 20, ), @@ -147,38 +115,27 @@ class _RegisterConfirmationPatientPageState child: Column( children: [ Row( - mainAxisAlignment: - MainAxisAlignment.spaceBetween, + mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ Column( - crossAxisAlignment: - CrossAxisAlignment.start, + crossAxisAlignment: CrossAxisAlignment.start, children: [ + AppText(TranslationBase.of(context).healthID, fontSize: 12, color: Colors.black), AppText( - TranslationBase.of(context) - .healthID, - fontSize: 12, - color: Colors.black), - AppText( - "${widget.model.getPatientInfoResponseModel.healthId}", + "${widget.model!.getPatientInfoResponseModel.healthId}", fontSize: 12, - color: Colors.grey[600], + color: Colors.grey[600]!, ), ], ), Column( - crossAxisAlignment: - CrossAxisAlignment.start, + crossAxisAlignment: CrossAxisAlignment.start, children: [ + AppText(TranslationBase.of(context).identityNumber, fontSize: 12, color: Colors.black), AppText( - TranslationBase.of(context) - .identityNumber, - fontSize: 12, - color: Colors.black), - AppText( - "${widget.model.getPatientInfoResponseModel.idNumber}", + "${widget.model!.getPatientInfoResponseModel.idNumber}", fontSize: 12, - color: Colors.grey[600], + color: Colors.grey[600]!, ), ], ), @@ -191,38 +148,27 @@ class _RegisterConfirmationPatientPageState height: 20, ), Row( - mainAxisAlignment: - MainAxisAlignment.spaceBetween, + mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ Column( - crossAxisAlignment: - CrossAxisAlignment.start, + crossAxisAlignment: CrossAxisAlignment.start, children: [ + AppText(TranslationBase.of(context).nationality, fontSize: 12, color: Colors.black), AppText( - TranslationBase.of(context) - .nationality, - fontSize: 12, - color: Colors.black), - AppText( - "${widget.model.getPatientInfoResponseModel.nationality}", + "${widget.model!.getPatientInfoResponseModel.nationality}", fontSize: 12, - color: Colors.grey[600], + color: Colors.grey[600]!, ), ], ), Column( - crossAxisAlignment: - CrossAxisAlignment.start, + crossAxisAlignment: CrossAxisAlignment.start, children: [ + AppText(TranslationBase.of(context).occupation, fontSize: 12, color: Colors.black), AppText( - TranslationBase.of(context) - .occupation, - fontSize: 12, - color: Colors.black), - AppText( - "${widget.model.getPatientInfoResponseModel.occupation}", + "${widget.model!.getPatientInfoResponseModel.occupation}", fontSize: 12, - color: Colors.grey[600], + color: Colors.grey[600]!, ), ], ), @@ -235,22 +181,16 @@ class _RegisterConfirmationPatientPageState height: 20, ), Row( - mainAxisAlignment: - MainAxisAlignment.spaceBetween, + mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ Column( - crossAxisAlignment: - CrossAxisAlignment.start, + crossAxisAlignment: CrossAxisAlignment.start, children: [ + AppText(TranslationBase.of(context).mobileNo, fontSize: 12, color: Colors.black), AppText( - TranslationBase.of(context) - .mobileNo, - fontSize: 12, - color: Colors.black), - AppText( - "${widget.model.checkPatientForRegistrationModel.patientMobileNumber}", + "${widget.model!.checkPatientForRegistrationModel!.patientMobileNumber}", fontSize: 12, - color: Colors.grey[600], + color: Colors.grey[600]!, ), ], ), @@ -272,8 +212,7 @@ class _RegisterConfirmationPatientPageState onClick: () { openMaritalStatusList(context); }, - hintText: - TranslationBase.of(context).maritalStatus, + hintText: TranslationBase.of(context).maritalStatus, maxLines: 1, minLines: 1, isTextFieldHasSuffix: true, @@ -316,11 +255,7 @@ class _RegisterConfirmationPatientPageState maxLines: 1, minLines: 1, hasBorder: true, - validationError: - emailAddressController.text.isEmpty && - isSubmitted - ? TranslationBase.of(context).emptyMessage - : null, + validationError: emailAddressController.text.isEmpty && isSubmitted ? TranslationBase.of(context).emptyMessage : "", ), SizedBox( height: 400, @@ -375,87 +310,59 @@ class _RegisterConfirmationPatientPageState isSubmitted = true; }); if (isFormValid()) { - print( - widget.model.getPatientInfoResponseModel.dateOfBirth); + print(widget.model!.getPatientInfoResponseModel.dateOfBirth); - var dateFormat = DateFormat('MM/dd/yyyy').parse( - widget.model.getPatientInfoResponseModel.dateOfBirth); - String wellFormat = - "${dateFormat.day}\/${dateFormat.month}\/${dateFormat.year}"; + var dateFormat = DateFormat('MM/dd/yyyy').parse(widget.model!.getPatientInfoResponseModel.dateOfBirth!); + String wellFormat = "${dateFormat.day}\/${dateFormat.month}\/${dateFormat.year}"; print( dateFormat.toUtc().toString(), ); HijriCalendar hijriDate = HijriCalendar.fromDate( - new DateTime( - dateFormat.year, dateFormat.month, dateFormat.day), + new DateTime(dateFormat.year, dateFormat.month, dateFormat.day), ); // return ; GifLoaderDialogUtils.showMyDialog(context); - PatientRegistrationModel patientRegistrationModel = - PatientRegistrationModel( - patientobject: Patientobject( - tempValue: true, - patientIdentificationNo: widget - .model - .checkPatientForRegistrationModel - .patientIdentificationID - .toString(), - patientIdentificationType: 1, - firstName: firstNameAr.text, - firstNameN: firstNameN.text, - lastName: lastNameAr.text, - lastNameN: lastNameN.text, - middleName: middleNameAr.text, - middleNameN: middleNameN.text, - strDateofBirth: dateFormat.toUtc().toString(), - dateofBirth: AppDateUtils.convertToServerFormat( - widget.model.getPatientInfoResponseModel - .dateOfBirth, - 'MM/dd/yyyy'), - dateofBirthN: '$hijriDate', - gender: (widget.model.getPatientInfoResponseModel.gender == "M") - ? 1 - : 2, - sourceType: "1", - patientOutSA: 0, - nationalityID: widget - .model - .getPatientInfoResponseModel - .nationalityCode, - //todo Elham* change static value to dynamic - preferredLanguage: selectedLang.toString(), - marital: "0", - eHealthIDField: widget.model - .getPatientInfoResponseModel.healthId, - emailAddress: emailAddressController.text, - mobileNumber: widget - .model - .checkPatientForRegistrationModel - .patientMobileNumber), - isHijri: 0, - logInTokenID: "zjgvKtLC/EK+saznJ/OkiA==", - isDentalAllowedBackend: false, + PatientRegistrationModel patientRegistrationModel = PatientRegistrationModel( + patientobject: Patientobject( + tempValue: true, + patientIdentificationNo: widget.model!.checkPatientForRegistrationModel!.patientIdentificationID.toString(), + patientIdentificationType: 1, + firstName: firstNameAr.text, + firstNameN: firstNameN.text, + lastName: lastNameAr.text, + lastNameN: lastNameN.text, + middleName: middleNameAr.text, + middleNameN: middleNameN.text, + strDateofBirth: dateFormat.toUtc().toString(), + dateofBirth: AppDateUtils.convertToServerFormat(widget.model!.getPatientInfoResponseModel.dateOfBirth!, 'MM/dd/yyyy'), + dateofBirthN: '$hijriDate', + gender: (widget.model!.getPatientInfoResponseModel.gender == "M") ? 1 : 2, + sourceType: "1", patientOutSA: 0, - sessionID: null, - patientMobileNumber: widget - .model - .checkPatientForRegistrationModel - .patientMobileNumber - .toString(), - healthId: - widget.model.getPatientInfoResponseModel.healthId, - generalid: GENERAL_ID, - patientIdentificationID: widget.model.checkPatientForRegistrationModel.patientIdentificationID.toString(), - dOB: wellFormat, - zipCode: widget.model.checkPatientForRegistrationModel.zipCode); - await widget.model - .registrationPatient(patientRegistrationModel); - if (widget.model.state == ViewState.ErrorLocal) { - Utils.showErrorToast(widget.model.error); + nationalityID: widget.model!.getPatientInfoResponseModel.nationalityCode, + //todo Elham* change static value to dynamic + preferredLanguage: selectedLang.toString(), + marital: "0", + eHealthIDField: widget.model!.getPatientInfoResponseModel.healthId, + emailAddress: emailAddressController.text, + mobileNumber: widget.model!.checkPatientForRegistrationModel!.patientMobileNumber), + isHijri: 0, + logInTokenID: "zjgvKtLC/EK+saznJ/OkiA==", + isDentalAllowedBackend: false, + patientOutSA: 0, + sessionID: null, + patientMobileNumber: widget.model!.checkPatientForRegistrationModel!.patientMobileNumber.toString(), + healthId: widget.model!.getPatientInfoResponseModel.healthId, + generalid: GENERAL_ID, + patientIdentificationID: widget.model!.checkPatientForRegistrationModel!.patientIdentificationID.toString(), + dOB: wellFormat, + zipCode: widget.model!.checkPatientForRegistrationModel!.zipCode); + await widget.model!.registrationPatient(patientRegistrationModel); + if (widget.model!.state == ViewState.ErrorLocal) { + Utils.showErrorToast(widget.model!.error); } else { - DrAppToastMsg.showSuccesToast( - "Patient added Successfully"); + DrAppToastMsg.showSuccesToast("Patient added Successfully"); Navigator.of(context).pop(); } @@ -500,10 +407,7 @@ class _RegisterConfirmationPatientPageState onTap: () { Navigator.of(context).pop(); }, - 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))), ), ], ), @@ -608,10 +512,7 @@ class _RegisterConfirmationPatientPageState onTap: () { Navigator.of(context).pop(); }, - 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))), ), ], ), diff --git a/lib/screens/patients/register_patient/RegisterPatientPage.dart b/lib/screens/patients/register_patient/RegisterPatientPage.dart index 8e6b69ab..8acb10ad 100644 --- a/lib/screens/patients/register_patient/RegisterPatientPage.dart +++ b/lib/screens/patients/register_patient/RegisterPatientPage.dart @@ -13,7 +13,7 @@ import 'package:flutter/material.dart'; import 'RegisterSearchPatientPage.dart'; class RegisterPatientPage extends StatefulWidget { - const RegisterPatientPage({Key key}) : super(key: key); + const RegisterPatientPage({Key? key}) : super(key: key); @override _RegisterPatientPageState createState() => _RegisterPatientPageState(); @@ -21,13 +21,13 @@ class RegisterPatientPage extends StatefulWidget { class _RegisterPatientPageState extends State with TickerProviderStateMixin { - PageController _controller; + PageController? _controller; int _currentIndex = 0; bool _isLoading = false; changePageViewIndex(pageIndex, {isChangeState = true}) { if (pageIndex != _currentIndex && isChangeState) changeLoadingState(true); - _controller.jumpToPage(pageIndex); + _controller!.jumpToPage(pageIndex); setState(() { _currentIndex = pageIndex; }); @@ -47,7 +47,7 @@ class _RegisterPatientPageState extends State @override void dispose() { - _controller.dispose(); + _controller!.dispose(); super.dispose(); } diff --git a/lib/screens/patients/register_patient/RegisterSearchPatientPage.dart b/lib/screens/patients/register_patient/RegisterSearchPatientPage.dart index 05d2da79..f672cb7a 100644 --- a/lib/screens/patients/register_patient/RegisterSearchPatientPage.dart +++ b/lib/screens/patients/register_patient/RegisterSearchPatientPage.dart @@ -20,11 +20,11 @@ import 'package:hijri/hijri_calendar.dart'; import 'package:hijri_picker/hijri_picker.dart'; class RegisterSearchPatientPage extends StatefulWidget { - final Function changePageViewIndex; - final PatientRegistrationViewModel model; + final Function? changePageViewIndex; + final PatientRegistrationViewModel? model; const RegisterSearchPatientPage( - {Key key, this.changePageViewIndex, this.model}) + {Key? key, this.changePageViewIndex, this.model}) : super(key: key); @override @@ -33,10 +33,10 @@ class RegisterSearchPatientPage extends StatefulWidget { } class _RegisterSearchPatientPageState extends State { - String countryError; + String countryError = ''; dynamic _selectedCountry; - List countryList; + List countryList = []; dynamic country; @@ -46,14 +46,14 @@ class _RegisterSearchPatientPageState extends State { TextEditingController(text: "508079569"); TextEditingController _phoneCode = TextEditingController(text: "966"); - String phoneError; + String phoneError = ''; TextEditingController _idController = TextEditingController(text: "1062938285"); - String idError; + String idError = ''; - DateTime _birthDateInGregorian; - String birthdateError; + DateTime? _birthDateInGregorian; + String birthdateError = ''; var birthDateInHijri = new HijriCalendar.now(); CalenderType calenderType = CalenderType.Gregorian; @@ -114,7 +114,7 @@ class _RegisterSearchPatientPageState extends State { /// TODO Elham* add transaltion return AppScaffold( - baseViewModel: widget.model, + baseViewModel: widget.model!, isShowAppBar: false, body: Column( children: [ @@ -129,7 +129,7 @@ class _RegisterSearchPatientPageState extends State { AppText( TranslationBase.of(context).askForIdentification, fontFamily: 'Poppins', - fontSize: SizeConfig.textMultiplier * 2.2, + fontSize: SizeConfig.textMultiplier! * 2.2, fontWeight: FontWeight.w800, ), SizedBox( @@ -187,7 +187,7 @@ class _RegisterSearchPatientPageState extends State { validationError: _phoneController.text.isEmpty && isSubmitted ? TranslationBase.of(context).emptyMessage - : null, + : "", ), ), ), @@ -203,14 +203,14 @@ class _RegisterSearchPatientPageState extends State { controller: _idController, validationError: _idController.text.isEmpty && isSubmitted ? TranslationBase.of(context).emptyMessage - : null, + : "", ), SizedBox( height: 12, ), AppText( TranslationBase.of(context).calender, - fontSize: SizeConfig.textMultiplier * 1.8, + fontSize: SizeConfig.textMultiplier! * 1.8, fontWeight: FontWeight.w800, ), SizedBox( @@ -224,9 +224,9 @@ class _RegisterSearchPatientPageState extends State { AppText(TranslationBase.of(context).gregorian), value: CalenderType.Gregorian, groupValue: calenderType, - onChanged: (CalenderType value) { + onChanged: (CalenderType? value) { setState(() { - calenderType = value; + calenderType = value!; }); }, ), @@ -236,9 +236,9 @@ class _RegisterSearchPatientPageState extends State { title: AppText(TranslationBase.of(context).hijri), value: CalenderType.Hijri, groupValue: calenderType, - onChanged: (CalenderType value) { + onChanged: (CalenderType? value) { setState(() { - calenderType = value; + calenderType = value!; }); }, ), @@ -257,7 +257,7 @@ class _RegisterSearchPatientPageState extends State { validationError: _birthDateInGregorian == null && isSubmitted ? TranslationBase.of(context).emptyMessage - : null, + : "", suffixIcon: IconButton( icon: Icon( Icons.calendar_today, @@ -269,7 +269,7 @@ class _RegisterSearchPatientPageState extends State { if (_birthDateInGregorian == null) { _birthDateInGregorian = DateTime.now(); } - _selectDate(context, _birthDateInGregorian, + _selectDate(context, _birthDateInGregorian!, (dynamic selectedDate) { setState(() { if (calenderType == CalenderType.Hijri) { @@ -345,7 +345,7 @@ class _RegisterSearchPatientPageState extends State { if (country == null) { countryError = TranslationBase.of(context).fieldRequired; } else { - countryError = null; + countryError = ""; } if (isFormValid()) { GifLoaderDialogUtils.showMyDialog(context); @@ -365,7 +365,7 @@ class _RegisterSearchPatientPageState extends State { generalid: GENERAL_ID, dOB: "${AppDateUtils.convertStringToDateFormat(_birthDateInGregorian.toString(), "yyyy/MM/dd")}"); - await widget.model.checkPatientForRegistration( + await widget.model!.checkPatientForRegistration( checkPatientForRegistrationModel); GetPatientInfoRequestModel getPatientInfoRequestModel = GetPatientInfoRequestModel( @@ -380,15 +380,15 @@ class _RegisterSearchPatientPageState extends State { dOB: "31/07/1988", //"${AppDateUtils.convertStringToDateFormat(_birthDate.toString(), "dd/MM/yyyy")}" ); - if (widget.model.state == ViewState.ErrorLocal) { - Utils.showErrorToast(widget.model.error); + if (widget.model!.state == ViewState.ErrorLocal) { + Utils.showErrorToast(widget.model!.error); } else { await widget.model - .getPatientInfo(getPatientInfoRequestModel); - if (widget.model.state == ViewState.ErrorLocal) { - Utils.showErrorToast(widget.model.error); + !.getPatientInfo(getPatientInfoRequestModel); + if (widget.model!.state == ViewState.ErrorLocal) { + Utils.showErrorToast(widget.model!.error); } else { - widget.changePageViewIndex(1); + widget.changePageViewIndex!(1); } } GifLoaderDialogUtils.hideDialog(context); @@ -418,7 +418,7 @@ class _RegisterSearchPatientPageState extends State { Function(dynamic) updateDate) async { if (calenderType == CalenderType.Hijri) { HijriCalendar hijriDate = HijriCalendar.fromDate(DateTime.now()); - final HijriCalendar pickedH = await showHijriDatePicker( + final HijriCalendar? pickedH = await showHijriDatePicker( context: context, initialDate: birthDateInHijri ?? hijriDate, lastDate: new HijriCalendar() @@ -433,7 +433,7 @@ class _RegisterSearchPatientPageState extends State { ); if (pickedH != null && birthDateInHijri != pickedH) updateDate(pickedH); } else { - final DateTime picked = await showDatePicker( + final DateTime? picked = await showDatePicker( context: context, initialDate: dateTime ?? DateTime.now(), firstDate: DateTime(DateTime.now().year - 150), diff --git a/lib/screens/patients/register_patient/VerifyActivationCodePage.dart b/lib/screens/patients/register_patient/VerifyActivationCodePage.dart index d58e5a3b..afc6ea63 100644 --- a/lib/screens/patients/register_patient/VerifyActivationCodePage.dart +++ b/lib/screens/patients/register_patient/VerifyActivationCodePage.dart @@ -6,7 +6,7 @@ import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart'; import 'package:flutter/material.dart'; class VerifyActivationCodePage extends StatefulWidget { - const VerifyActivationCodePage({Key key}) : super(key: key); + const VerifyActivationCodePage({Key? key}) : super(key: key); @override _VerifyActivationCodePageState createState() => @@ -33,7 +33,7 @@ class _VerifyActivationCodePageState extends State { AppText( "Please enter the verification code sent to 02221552", fontFamily: 'Poppins', - fontSize: SizeConfig.textMultiplier * 2.2, + fontSize: SizeConfig.textMultiplier! * 2.2, fontWeight: FontWeight.w800, ), ], diff --git a/lib/screens/patients/register_patient/VerifyMethodPage.dart b/lib/screens/patients/register_patient/VerifyMethodPage.dart index 44a95489..45359dea 100644 --- a/lib/screens/patients/register_patient/VerifyMethodPage.dart +++ b/lib/screens/patients/register_patient/VerifyMethodPage.dart @@ -11,8 +11,8 @@ import 'package:flutter/material.dart'; import 'package:hexcolor/hexcolor.dart'; class ActivationPage extends StatefulWidget { - final PatientRegistrationViewModel model; - final Function changePageViewIndex; + final PatientRegistrationViewModel? model; + final Function? changePageViewIndex; ActivationPage({this.model, this.changePageViewIndex}); @@ -26,7 +26,7 @@ class _ActivationPageState extends State { TextStyle buildTextStyle() { return TextStyle( - fontSize: SizeConfig.textMultiplier * 3, + fontSize: SizeConfig.textMultiplier! * 3, ); } @@ -49,7 +49,7 @@ class _ActivationPageState extends State { @override Widget build(BuildContext context) { return AppScaffold( - baseViewModel: widget.model, + baseViewModel: widget.model!, isShowAppBar: false, body: Column( children: [ @@ -67,7 +67,7 @@ class _ActivationPageState extends State { AppText( "Please select how you want to be verified", fontFamily: 'Poppins', - fontSize: SizeConfig.textMultiplier * 2.2, + fontSize: SizeConfig.textMultiplier! * 2.2, fontWeight: FontWeight.w800, ), Row( @@ -86,36 +86,25 @@ class _ActivationPageState extends State { // otpType: 1); }, child: Container( - height: - MediaQuery.of(context).size.height * - 0.233, + height: MediaQuery.of(context).size.height * 0.233, margin: EdgeInsets.all(10), decoration: BoxDecoration( color: Colors.white, 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: Column( children: [ Row( children: [ Padding( - padding: EdgeInsets.symmetric( - horizontal: 10), + padding: EdgeInsets.symmetric(horizontal: 10), child: Image.asset( "assets/images/verify-sms.png", - height: MediaQuery.of(context) - .size - .height * - 0.15, - width: MediaQuery.of(context) - .size - .width * - 0.15, + height: MediaQuery.of(context).size.height * 0.15, + width: MediaQuery.of(context).size.width * 0.15, ), ), ], @@ -125,8 +114,7 @@ class _ActivationPageState extends State { ), Center( child: AppText( - TranslationBase.of(context) - .verifySMS, + TranslationBase.of(context).verifySMS, fontSize: 14, color: Color(0xFF2E303A), fontWeight: FontWeight.bold, @@ -146,36 +134,25 @@ class _ActivationPageState extends State { }); }, child: Container( - height: - MediaQuery.of(context).size.height * - 0.233, + height: MediaQuery.of(context).size.height * 0.233, margin: EdgeInsets.all(10), decoration: BoxDecoration( color: Colors.white, 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: Column( children: [ Row( children: [ Padding( - padding: EdgeInsets.symmetric( - horizontal: 10.0), + padding: EdgeInsets.symmetric(horizontal: 10.0), child: Image.asset( "assets/images/verify-whtsapp.png", - height: MediaQuery.of(context) - .size - .height * - 0.15, - width: MediaQuery.of(context) - .size - .width * - 0.15, + height: MediaQuery.of(context).size.height * 0.15, + width: MediaQuery.of(context).size.width * 0.15, ), ), ], @@ -185,8 +162,7 @@ class _ActivationPageState extends State { ), Center( child: AppText( - TranslationBase.of(context) - .verifyWhatsApp, + TranslationBase.of(context).verifyWhatsApp, fontSize: 14, color: Color(0xFF2E303A), fontWeight: FontWeight.bold, @@ -214,7 +190,7 @@ class _ActivationPageState extends State { AppText( TranslationBase.of(context).verificationMessage, fontFamily: 'Poppins', - fontSize: SizeConfig.textMultiplier * 2.2, + fontSize: SizeConfig.textMultiplier! * 2.2, fontWeight: FontWeight.w800, ), Row( @@ -231,79 +207,54 @@ class _ActivationPageState extends State { child: Directionality( textDirection: TextDirection.ltr, child: Row( - mainAxisAlignment: - MainAxisAlignment.start, + mainAxisAlignment: MainAxisAlignment.start, children: [ Container( - width: SizeConfig - .realScreenWidth * - 0.16, + width: SizeConfig.realScreenWidth! * 0.16, margin: EdgeInsets.all(5), child: TextFormField( - textInputAction: - TextInputAction.next, + textInputAction: TextInputAction.next, style: buildTextStyle(), autofocus: true, maxLength: 1, controller: digit1, textAlign: TextAlign.center, - keyboardType: - TextInputType.number, - decoration: - buildInputDecoration( - context), + keyboardType: TextInputType.number, + decoration: buildInputDecoration(context), onSaved: (val) {}, //validator: validateCodeDigit, onFieldSubmitted: (_) { - FocusScope.of(context) - .requestFocus( - focusD2); + FocusScope.of(context).requestFocus(focusD2); }, onChanged: (val) { if (val.length == 1) { - FocusScope.of(context) - .requestFocus( - focusD2); - verifyAccountFormValue[ - 'digit1'] = - val.trim(); + FocusScope.of(context).requestFocus(focusD2); + verifyAccountFormValue['digit1'] = val.trim(); //checkValue(); } }, ), ), Container( - width: SizeConfig - .realScreenWidth * - 0.16, + width: SizeConfig.realScreenWidth! * 0.16, margin: EdgeInsets.all(5), child: TextFormField( focusNode: focusD2, - textInputAction: - TextInputAction.next, + textInputAction: TextInputAction.next, maxLength: 1, controller: digit2, textAlign: TextAlign.center, style: buildTextStyle(), - keyboardType: - TextInputType.number, - decoration: - buildInputDecoration( - context), + keyboardType: TextInputType.number, + decoration: buildInputDecoration(context), onSaved: (val) {}, onFieldSubmitted: (_) { - FocusScope.of(context) - .requestFocus( - focusD3); + FocusScope.of(context).requestFocus(focusD3); }, onChanged: (val) { if (val.length == 1) { - FocusScope.of(context) - .requestFocus( - focusD3); - verifyAccountFormValue[ - 'digit2'] = - val.trim(); + FocusScope.of(context).requestFocus(focusD3); + verifyAccountFormValue['digit2'] = val.trim(); //checkValue(); } }, @@ -312,37 +263,24 @@ class _ActivationPageState extends State { ), Container( margin: EdgeInsets.all(5), - width: SizeConfig - .realScreenWidth * - 0.16, + width: SizeConfig.realScreenWidth! * 0.16, child: TextFormField( focusNode: focusD3, - textInputAction: - TextInputAction.next, + textInputAction: TextInputAction.next, maxLength: 1, controller: digit3, - textAlign: - TextAlign.center, + textAlign: TextAlign.center, style: buildTextStyle(), - keyboardType: - TextInputType.number, - decoration: - buildInputDecoration( - context), + keyboardType: TextInputType.number, + decoration: buildInputDecoration(context), onSaved: (val) {}, onFieldSubmitted: (_) { - FocusScope.of(context) - .requestFocus( - focusD4); + FocusScope.of(context).requestFocus(focusD4); }, onChanged: (val) { if (val.length == 1) { - FocusScope.of(context) - .requestFocus( - focusD4); - verifyAccountFormValue[ - 'digit3'] = - val.trim(); + FocusScope.of(context).requestFocus(focusD4); + verifyAccountFormValue['digit3'] = val.trim(); //checkValue(); } }, @@ -351,31 +289,21 @@ class _ActivationPageState extends State { )), Container( margin: EdgeInsets.all(5), - width: SizeConfig - .realScreenWidth * - 0.16, + width: SizeConfig.realScreenWidth! * 0.16, child: TextFormField( focusNode: focusD4, maxLength: 1, - textAlign: - TextAlign.center, + textAlign: TextAlign.center, style: buildTextStyle(), controller: digit4, - keyboardType: - TextInputType.number, - decoration: - buildInputDecoration( - context), + keyboardType: TextInputType.number, + decoration: buildInputDecoration(context), onFieldSubmitted: (_) { - FocusScope.of(context) - .requestFocus( - focusD4); + FocusScope.of(context).requestFocus(focusD4); }, onChanged: (val) { if (val.length == 1) { - verifyAccountFormValue[ - 'digit4'] = - val.trim(); + verifyAccountFormValue['digit4'] = val.trim(); //checkValue(); } }, @@ -388,27 +316,20 @@ class _ActivationPageState extends State { ), Padding( padding: const EdgeInsets.all(12.0), - child: Column( - mainAxisAlignment: - MainAxisAlignment.start, - crossAxisAlignment: - CrossAxisAlignment.start, - children: [ - AppText( - TranslationBase.of(context) - .validationMessage + - ' ', - fontWeight: FontWeight.w600, - fontSize: 14, - ), - // AppText( - // displayTime, - // color: Colors.red, - // textAlign: TextAlign.start, - // fontWeight: FontWeight.bold, - // fontSize: 14, - // ) - ]), + child: Column(mainAxisAlignment: MainAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start, children: [ + AppText( + TranslationBase.of(context).validationMessage + ' ', + fontWeight: FontWeight.w600, + fontSize: 14, + ), + // AppText( + // displayTime, + // color: Colors.red, + // textAlign: TextAlign.start, + // fontWeight: FontWeight.bold, + // fontSize: 14, + // ) + ]), ) ], ))), @@ -458,16 +379,15 @@ class _ActivationPageState extends State { fontColor: Colors.white, onPressed: () async { GifLoaderDialogUtils.showMyDialog(context); - await widget.model.checkActivationCode( - "${digit1.text}${digit2.text}${digit3.text}${digit4.text}"); - if (widget.model.state == ViewState.ErrorLocal) { - Utils.showErrorToast(widget.model.error); + await widget.model!.checkActivationCode("${digit1.text}${digit2.text}${digit3.text}${digit4.text}"); + if (widget.model!.state == ViewState.ErrorLocal) { + Utils.showErrorToast(widget.model!.error); //TODO Elham* remove this - widget.changePageViewIndex(2); + widget.changePageViewIndex!(2); GifLoaderDialogUtils.hideDialog(context); } else { GifLoaderDialogUtils.hideDialog(context); - widget.changePageViewIndex(2); + widget.changePageViewIndex!(2); } }, ), @@ -476,15 +396,15 @@ class _ActivationPageState extends State { ], ), ) - : null); + : SizedBox()); } sendActivationCode(type) async { GifLoaderDialogUtils.showMyDialog(context); - await widget.model.sendActivationCodeByOTPNotificationType(otpType: type); + await widget.model!.sendActivationCodeByOTPNotificationType(otpType: type); - if (widget.model.state == ViewState.ErrorLocal) { - Utils.showErrorToast(widget.model.error); + if (widget.model!.state == ViewState.ErrorLocal) { + Utils.showErrorToast(widget.model!.error); GifLoaderDialogUtils.hideDialog(context); // TODO Elham* retuen the else setState(() { @@ -502,15 +422,15 @@ class _ActivationPageState extends State { counterText: " ", enabledBorder: OutlineInputBorder( borderRadius: BorderRadius.all(Radius.circular(10)), - borderSide: BorderSide(color: Colors.grey[300]), + borderSide: BorderSide(color: Colors.grey[300]!), ), focusedBorder: OutlineInputBorder( borderRadius: BorderRadius.all(Radius.circular(10.0)), - borderSide: BorderSide(color: Colors.grey[300]), + borderSide: BorderSide(color: Colors.grey[300]!), ), errorBorder: OutlineInputBorder( borderRadius: BorderRadius.all(Radius.circular(10.0)), - borderSide: BorderSide(color: Colors.grey[300]), + borderSide: BorderSide(color: Colors.grey[300]!), ), focusedErrorBorder: OutlineInputBorder( borderRadius: BorderRadius.all(Radius.circular(10.0)), 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 d56019fc..3ea62911 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 @@ -17,10 +17,10 @@ import 'package:flutter/material.dart'; import 'drug_to_drug.dart'; class AddDrugWidget extends StatefulWidget { - final PatiantInformtion patient; - final List prescriptionList; - final MedicineViewModel medicineModel; - final PrescriptionViewModel modelPrescription; + final PatiantInformtion? patient; + final List? prescriptionList; + final MedicineViewModel? medicineModel; + final PrescriptionViewModel? modelPrescription; final dynamic units; final dynamic route; final dynamic frequency; @@ -28,14 +28,14 @@ class AddDrugWidget extends StatefulWidget { final dynamic doseTime; final dynamic uom; final dynamic x; - final GetMedicationResponseModel selectedMedication; + final GetMedicationResponseModel? selectedMedication; final String strength; final String indication; final String instruction; - final DateTime selectedDate; + final DateTime? selectedDate; const AddDrugWidget( - {Key key, + {Key? key, this.patient, this.prescriptionList, this.medicineModel, @@ -48,9 +48,9 @@ class AddDrugWidget extends StatefulWidget { this.uom, this.x, this.selectedMedication, - this.strength, - this.indication, - this.instruction, + this.strength = '', + this.indication = '', + this.instruction = '', this.selectedDate}) : super(key: key); @@ -62,25 +62,19 @@ class _AddDrugWidgetState extends State { @override Widget build(BuildContext context) { return AppScaffold( - baseViewModel: widget.medicineModel, - appBar: - BottomSheetTitle(title: TranslationBase.of(context).addMedication), + baseViewModel: widget.medicineModel!, + appBar: BottomSheetTitle(title: TranslationBase.of(context).addMedication), body: Container( height: SizeConfig.realScreenHeight! * .8, width: SizeConfig.realScreenWidth!, child: SingleChildScrollView( child: Column( children: [ - DrugToDrug( - widget.patient, - widget.medicineModel.getPrescriptionForDrug( - widget.prescriptionList, widget.medicineModel), - widget.medicineModel.patientAssessmentList), + DrugToDrug(widget.patient!, widget.medicineModel!.getPrescriptionForDrug(widget.prescriptionList!, widget.medicineModel!), widget.medicineModel!.patientAssessmentList), ], )), ), - bottomSheet: widget.medicineModel.state == ViewState.BusyLocal || - widget.medicineModel.state == ViewState.Busy + bottomSheet: widget.medicineModel!.state == ViewState.BusyLocal || widget.medicineModel!.state == ViewState.Busy ? Container( height: 0, ) @@ -88,54 +82,36 @@ class _AddDrugWidgetState extends State { label: TranslationBase.of(context).addMedication, onTap: () async { GifLoaderDialogUtils.showMyDialog(context); - await widget.medicineModel.postPrescription( + await widget.medicineModel!.postPrescription( isLocalBusy: true, - icdCode: widget.medicineModel.patientAssessmentList.isNotEmpty - ? widget.medicineModel.patientAssessmentList[0] - .icdCode10ID.isEmpty + icdCode: widget.medicineModel!.patientAssessmentList.isNotEmpty + ? widget.medicineModel!.patientAssessmentList[0].icdCode10ID!.isEmpty ? "test" - : widget.medicineModel.patientAssessmentList[0] - .icdCode10ID - .toString() + : widget.medicineModel!.patientAssessmentList[0].icdCode10ID.toString() : "test", dose: widget.strength, doseUnit: - widget.medicineModel.itemMedicineListUnit.length == 1 - ? widget.medicineModel - .itemMedicineListUnit[0]['parameterCode'] - .toString() - : widget.units['parameterCode'].toString(), + widget.medicineModel!.itemMedicineListUnit.length == 1 ? widget.medicineModel!.itemMedicineListUnit[0]['parameterCode'].toString() : widget.units['parameterCode'].toString(), patient: widget.patient, doseTimeIn: widget.doseTime['id'].toString(), model: widget.modelPrescription, duration: widget.duration['id'].toString(), - frequency: widget.medicineModel.itemMedicineList.length == 1 - ? widget - .medicineModel.itemMedicineList[0]['parameterCode'] - .toString() - : widget.frequency['parameterCode'].toString(), - route: widget.medicineModel.itemMedicineListRoute.length == 1 - ? widget.medicineModel - .itemMedicineListRoute[0]['parameterCode'] - .toString() - : widget.route['parameterCode'].toString(), - drugId: widget.selectedMedication.itemId.toString(), + frequency: widget.medicineModel!.itemMedicineList.length == 1 ? widget.medicineModel!.itemMedicineList[0]['parameterCode'].toString() : widget.frequency['parameterCode'].toString(), + route: + widget.medicineModel!.itemMedicineListRoute.length == 1 ? widget.medicineModel!.itemMedicineListRoute[0]['parameterCode'].toString() : widget.route['parameterCode'].toString(), + drugId: widget.selectedMedication!.itemId.toString(), strength: widget.strength, indication: widget.indication, instruction: widget.instruction, doseTime: widget.selectedDate, ); - if (widget.medicineModel.state == ViewState.ErrorLocal) { + if (widget.medicineModel!.state == ViewState.ErrorLocal) { GifLoaderDialogUtils.hideDialog(context); - Utils.showErrorToast(widget.medicineModel.error); - } else if (widget.modelPrescription.state == ViewState.Idle) { - await widget.modelPrescription.getPrescriptionListNew( - appNo: widget.patient.appointmentNo, - mrn: widget.patient.patientMRN, - isLocalBusy: true); + Utils.showErrorToast(widget.medicineModel!.error); + } else if (widget.modelPrescription!.state == ViewState.Idle) { + await widget.modelPrescription!.getPrescriptionListNew(appNo: widget.patient!.appointmentNo, mrn: widget.patient!.patientMRN, isLocalBusy: true); GifLoaderDialogUtils.hideDialog(context); - DrAppToastMsg.showSuccesToast( - TranslationBase.of(context).medicationHasBeenAdded); + DrAppToastMsg.showSuccesToast(TranslationBase.of(context).medicationHasBeenAdded); Navigator.of(context).pop(); Navigator.of(context).pop(); } 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 fbbc538d..d5d92dc3 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 @@ -60,7 +60,7 @@ class _DrugToDrug extends State { widget.patient, widget.prescription), builder: (BuildContext context, PrescriptionViewModel prescriptionViewModel, - Widget child) => + Widget? child) => NetworkBaseView( baseViewModel: prescriptionViewModel, child: Container( @@ -88,7 +88,7 @@ class _DrugToDrug extends State { padding: EdgeInsets.all(10), child: AppText( item['comment'], - color: Colors.red[900], + color: Colors.red[900]!, )); }).toList()); })))) diff --git a/lib/screens/prescription/add_prescription/add_prescription.dart b/lib/screens/prescription/add_prescription/add_prescription.dart index 074a01fe..a48811a6 100644 --- a/lib/screens/prescription/add_prescription/add_prescription.dart +++ b/lib/screens/prescription/add_prescription/add_prescription.dart @@ -18,21 +18,20 @@ class AddPrescription extends StatefulWidget { final PatiantInformtion patient; final List prescriptionList; - AddPrescription( - this.prescriptionViewModel, this.patient, this.prescriptionList); + AddPrescription(this.prescriptionViewModel, this.patient, this.prescriptionList); @override _AddPrescriptionState createState() => _AddPrescriptionState(); } class _AddPrescriptionState extends State { - String routeError; - String frequencyError; - String doseTimeError; - String durationError; - String unitError; - String strengthError; - int selectedType; + String routeError = ''; + String frequencyError = ''; + String doseTimeError = ''; + String durationError = ''; + String unitError = ''; + String strengthError = ''; + int selectedType = 0; bool visibilitySearch = true; @@ -44,13 +43,12 @@ class _AddPrescriptionState extends State { bool visibilityPrescriptionForm = false; final myController = TextEditingController(); - DateTime selectedDate; - int strengthChar; - GetMedicationResponseModel _selectedMedication; - MedicineViewModel medicineViewModel; + DateTime? selectedDate; + int strengthChar = 0; + GetMedicationResponseModel? _selectedMedication; + MedicineViewModel? medicineViewModel; - GlobalKey key = - new GlobalKey>(); + GlobalKey> key = GlobalKey>(); TextEditingController drugIdController = TextEditingController(); TextEditingController doseController = TextEditingController(); @@ -71,7 +69,7 @@ class _AddPrescriptionState extends State { dynamic box; dynamic x; - PatiantInformtion patient; + PatiantInformtion? patient; @override Widget build(BuildContext context) { @@ -79,7 +77,7 @@ class _AddPrescriptionState extends State { builder: ( BuildContext context, MedicineViewModel model, - Widget child, + Widget? child, ) => NetworkBaseView( baseViewModel: model, @@ -91,15 +89,13 @@ class _AddPrescriptionState extends State { initialChildSize: 0.98, maxChildSize: 0.98, minChildSize: 0.9, - builder: - (BuildContext context, ScrollController scrollController) { + builder: (BuildContext context, ScrollController scrollController) { return SingleChildScrollView( child: Container( height: MediaQuery.of(context).size.height * 1.65, color: Color(0xffF8F8F8), child: Padding( - padding: EdgeInsets.symmetric( - horizontal: 12.0, vertical: 10.0), + padding: EdgeInsets.symmetric(horizontal: 12.0, vertical: 10.0), child: Column( children: [ Column( @@ -118,14 +114,10 @@ class _AddPrescriptionState extends State { Visibility( visible: visibilitySearch, child: SearchPrescriptionWidget( - spaceBetweenTextFields: - spaceBetweenTextFields, + spaceBetweenTextFields: spaceBetweenTextFields, medicineViewModel: model, - prescriptionViewModel: - widget.prescriptionViewModel, - onItemSelected: - (GetMedicationResponseModel - medication) async { + prescriptionViewModel: widget.prescriptionViewModel, + onItemSelected: (GetMedicationResponseModel medication) async { setState(() { visibilitySearch = !visibilitySearch; _selectedMedication = medication; @@ -133,8 +125,7 @@ class _AddPrescriptionState extends State { GifLoaderDialogUtils.showMyDialog(context); await model.getAssessmentList(patientInfo: widget.patient, isLocalBusy: true); GifLoaderDialogUtils.hideDialog(context); - }, - + }, ), ), Visibility( @@ -144,12 +135,10 @@ class _AddPrescriptionState extends State { children: [ PrescriptionFormWidget( patient: widget.patient, - prescriptionViewModel: - widget.prescriptionViewModel, + prescriptionViewModel: widget.prescriptionViewModel, medicineViewModel: model, - prescriptionList: - widget.prescriptionList, - selectedMedication: _selectedMedication, + prescriptionList: widget.prescriptionList, + selectedMedication: _selectedMedication!, ), ], ), diff --git a/lib/screens/prescription/add_prescription/prescription_form_widget.dart b/lib/screens/prescription/add_prescription/prescription_form_widget.dart index 48b214e3..3c819577 100644 --- a/lib/screens/prescription/add_prescription/prescription_form_widget.dart +++ b/lib/screens/prescription/add_prescription/prescription_form_widget.dart @@ -29,33 +29,27 @@ import '../../../widgets/transitions/slide_up_page.dart'; import 'add_drug/add_drug_widget.dart'; class PrescriptionFormWidget extends StatefulWidget { - final PatiantInformtion patient; - final List prescriptionList; - final PrescriptionViewModel prescriptionViewModel; - final MedicineViewModel medicineViewModel; - final GetMedicationResponseModel selectedMedication; + final PatiantInformtion? patient; + final List? prescriptionList; + final PrescriptionViewModel? prescriptionViewModel; + final MedicineViewModel? medicineViewModel; + final GetMedicationResponseModel? selectedMedication; - const PrescriptionFormWidget( - {Key key, - this.patient, - this.prescriptionList, - this.prescriptionViewModel, - this.medicineViewModel, - this.selectedMedication}); + const PrescriptionFormWidget({Key? key, this.patient, this.prescriptionList, this.prescriptionViewModel, this.medicineViewModel, this.selectedMedication}); @override _PrescriptionFormWidgetState createState() => _PrescriptionFormWidgetState(); } class _PrescriptionFormWidgetState extends State { - String routeError; - String frequencyError; - String doseTimeError; - String durationError; - String unitError; - String strengthError; + String? routeError; + String? frequencyError; + String? doseTimeError; + String? durationError; + String? unitError; + String? strengthError; - int selectedType; + int? selectedType; TextEditingController strengthController = TextEditingController(); TextEditingController unitController = TextEditingController(); @@ -66,9 +60,8 @@ class _PrescriptionFormWidgetState extends State { bool visibilitySearch = true; DateTime selectedDate = DateTime.now(); - int strengthChar; - GlobalKey key = - new GlobalKey>(); + int? strengthChar; + GlobalKey key = new GlobalKey>(); TextEditingController drugIdController = TextEditingController(); TextEditingController doseController = TextEditingController(); @@ -97,8 +90,7 @@ class _PrescriptionFormWidgetState extends State { onVoiceText() async { new SpeechToText(context: context).showAlertDialog(context); var lang = TranslationBase.of(AppGlobal.CONTEX).locale.languageCode; - bool available = await speech.initialize( - onStatus: statusListener, onError: errorListener); + bool available = await speech.initialize(onStatus: statusListener, onError: errorListener); if (available) { speech.listen( onResult: resultListener, @@ -135,8 +127,7 @@ class _PrescriptionFormWidgetState extends State { } Future initSpeechState() async { - bool hasSpeech = await speech.initialize( - onError: errorListener, onStatus: statusListener); + bool hasSpeech = await speech.initialize(onError: errorListener, onStatus: statusListener); print(hasSpeech); if (!mounted) return; } @@ -174,7 +165,7 @@ class _PrescriptionFormWidgetState extends State { value: 1, groupValue: selectedType, onChanged: (value) { - setSelectedType(value); + setSelectedType(value!); }, ), Text(TranslationBase.of(context).regular), @@ -185,8 +176,8 @@ class _PrescriptionFormWidgetState extends State { children: [ Container( width: MediaQuery.of(context).size.width * 0.35, - child: AppTextFieldCustom( - validationError: strengthError, + child: AppTextFieldCustom( + validationError: strengthError!, hintText: TranslationBase.of(context).strength, isTextFieldHasSuffix: false, enabled: true, @@ -195,10 +186,9 @@ class _PrescriptionFormWidgetState extends State { setState(() { strengthChar = value.length; }); - if (strengthChar >= 5) { + if (strengthChar! >= 5) { DrAppToastMsg.showErrorToast( - TranslationBase.of(context) - .only5DigitsAllowedForStrength, + TranslationBase.of(context).only5DigitsAllowedForStrength, ); } }, @@ -212,15 +202,12 @@ class _PrescriptionFormWidgetState extends State { ), PrescriptionTextFiled( width: MediaQuery.of(context).size.width * 0.510, - element: - widget.medicineViewModel.itemMedicineListUnit.length == 1 - ? widget.medicineViewModel.itemMedicineListUnit[0] - : units, - elementError: unitError, + element: widget.medicineViewModel!.itemMedicineListUnit.length == 1 ? widget.medicineViewModel!.itemMedicineListUnit[0] : units, + elementError: unitError!, keyName: 'description', keyId: 'parameterCode', hintText: TranslationBase.of(context).unit, - elementList: widget.medicineViewModel.itemMedicineListUnit, + elementList: widget.medicineViewModel!.itemMedicineListUnit, okFunction: (selectedValue) { setState(() { units = selectedValue; @@ -232,11 +219,9 @@ class _PrescriptionFormWidgetState extends State { ), SizedBox(height: spaceBetweenTextFields), PrescriptionTextFiled( - elementList: widget.medicineViewModel.itemMedicineListRoute, - element: widget.medicineViewModel.itemMedicineListRoute.length == 1 - ? route = widget.medicineViewModel.itemMedicineListRoute[0] - : route, - elementError: routeError, + elementList: widget.medicineViewModel!.itemMedicineListRoute, + element: widget.medicineViewModel!.itemMedicineListRoute.length == 1 ? route = widget.medicineViewModel!.itemMedicineListRoute[0] : route, + elementError: routeError!, keyId: 'parameterCode', keyName: 'description', okFunction: (selectedValue) { @@ -250,27 +235,19 @@ class _PrescriptionFormWidgetState extends State { SizedBox(height: spaceBetweenTextFields), PrescriptionTextFiled( hintText: TranslationBase.of(context).frequency, - elementError: frequencyError, + elementError: frequencyError!, // element: frequency, - element: widget.medicineViewModel.itemMedicineListRoute.length == 1 - ? frequency = widget.medicineViewModel.itemMedicineListRoute[0] - : frequency, - elementList: widget.medicineViewModel.itemMedicineList, + element: widget.medicineViewModel!.itemMedicineListRoute.length == 1 ? frequency = widget.medicineViewModel!.itemMedicineListRoute[0] : frequency, + elementList: widget.medicineViewModel!.itemMedicineList, keyId: 'parameterCode', keyName: 'description', okFunction: (selectedValue) { setState(() { frequency = selectedValue; frequency['isDefault'] = true; - if (widget.selectedMedication != null && - duration != null && - frequency != null && - strengthController.text != null) { - widget.medicineViewModel.getBoxQuantity( - freq: frequency['parameterCode'], - duration: duration['id'], - itemCode: widget.selectedMedication.itemId, - strength: double.parse(strengthController.text)); + if (widget.selectedMedication != null && duration != null && frequency != null && strengthController.text != null) { + widget.medicineViewModel + !.getBoxQuantity(freq: frequency['parameterCode'], duration: duration['id'], itemCode: widget.selectedMedication!.itemId, strength: double.parse(strengthController.text)); return; } @@ -279,9 +256,9 @@ class _PrescriptionFormWidgetState extends State { SizedBox(height: spaceBetweenTextFields), PrescriptionTextFiled( hintText: TranslationBase.of(context).doseTime, - elementError: doseTimeError, + elementError: doseTimeError!, element: doseTime, - elementList: widget.medicineViewModel.medicationDoseTimeList, + elementList: widget.medicineViewModel!.medicationDoseTimeList, keyId: 'id', keyName: 'nameEn', okFunction: (selectedValue) { @@ -290,7 +267,7 @@ class _PrescriptionFormWidgetState extends State { }); }), SizedBox(height: spaceBetweenTextFields), - if (widget.medicineViewModel.patientAssessmentList.isNotEmpty) + if (widget.medicineViewModel!.patientAssessmentList.isNotEmpty) Container( height: screenSize.height * 0.070, width: double.infinity, @@ -300,9 +277,7 @@ class _PrescriptionFormWidgetState extends State { Container( width: MediaQuery.of(context).size.width * 0.29, child: AppTextFieldCustom( - hintText: widget - .medicineViewModel.patientAssessmentList[0].icdCode10ID - .toString(), + hintText: widget.medicineViewModel!.patientAssessmentList[0].icdCode10ID.toString(), enabled: true, ), ), @@ -311,32 +286,29 @@ class _PrescriptionFormWidgetState extends State { color: Colors.white, child: AppTextFieldCustom( maxLines: 5, - hintText: widget - .medicineViewModel.patientAssessmentList[0].asciiDesc - .toString(), + hintText: widget.medicineViewModel!.patientAssessmentList[0].asciiDesc.toString(), enabled: true, ), ), ], ), ), - SizedBox(height: spaceBetweenTextFields), Container( + SizedBox(height: spaceBetweenTextFields), + Container( color: Colors.transparent, child: InkWell( - onTap: () => selectDate(context, widget.prescriptionViewModel), + onTap: () => selectDate(context, widget.prescriptionViewModel!), child: AppTextFieldCustom( - validationError: strengthError, + validationError: strengthError!, hintText: TranslationBase.of(context).date, isTextFieldHasSuffix: true, suffixIcon: IconButton( icon: Icon( Icons.calendar_today, color: Colors.black, - ), + ), onPressed: () { }, ), - dropDownText: selectedDate != null - ? "${AppDateUtils.convertStringToDateFormat(selectedDate.toString(), "yyyy-MM-dd")}" - : null, + dropDownText: selectedDate != null ? "${AppDateUtils.convertStringToDateFormat(selectedDate.toString(), "yyyy-MM-dd")}" : "", enabled: false, ), ), @@ -344,19 +316,16 @@ class _PrescriptionFormWidgetState extends State { SizedBox(height: spaceBetweenTextFields), PrescriptionTextFiled( element: duration, - elementError: durationError, + elementError: durationError!, hintText: TranslationBase.of(context).duration, - elementList: widget.medicineViewModel.medicationDurationList, + elementList: widget.medicineViewModel!.medicationDurationList, keyName: 'nameEn', keyId: 'id', okFunction: (selectedValue) { setState(() { duration = selectedValue; - if (widget.selectedMedication != null && - duration != null && - frequency != null && - strengthController.text != null) { - box = widget.medicineViewModel.boxQuintity; + if (widget.selectedMedication != null && duration != null && frequency != null && strengthController.text != null) { + box = widget.medicineViewModel!.boxQuintity; return; } }); @@ -378,17 +347,13 @@ class _PrescriptionFormWidgetState extends State { child: AppTextFieldCustom( hintText: TranslationBase.of(context).boxQuantity, isTextFieldHasSuffix: false, - dropDownText: box != null - ? widget.medicineViewModel.boxQuintity.toString() - : null, + dropDownText: box != null ? widget.medicineViewModel!.boxQuintity.toString() : "", enabled: false, ), ), SizedBox(height: spaceBetweenTextFields), Container( - decoration: BoxDecoration( - borderRadius: BorderRadius.all(Radius.circular(6.0)), - border: Border.all(width: 1.0, color: HexColor("#CCCCCC"))), + decoration: BoxDecoration(borderRadius: BorderRadius.all(Radius.circular(6.0)), border: Border.all(width: 1.0, color: HexColor("#CCCCCC"))), child: Stack( children: [ TextFields( @@ -425,7 +390,7 @@ class _PrescriptionFormWidgetState extends State { title: TranslationBase.of(context).addMedication, fontWeight: FontWeight.w600, onPressed: () async { - addMedicationButton(widget.medicineViewModel); + addMedicationButton(widget.medicineViewModel!); }, ), ], @@ -440,7 +405,7 @@ class _PrescriptionFormWidgetState extends State { Utils.hideKeyboard(context); DateTime selectedDate; selectedDate = DateTime.now(); - final DateTime picked = await showDatePicker( + final DateTime? picked = await showDatePicker( context: context, initialDate: selectedDate, firstDate: DateTime.now(), @@ -459,14 +424,9 @@ class _PrescriptionFormWidgetState extends State { eventCategory: "Add Prescription Form", eventAction: "Add Prescription", ); - if (duration != null && - doseTime != null && - frequency != null && - selectedDate != null && - strengthController.text != "") { - if (widget.selectedMedication.isNarcotic == true) { - DrAppToastMsg.showErrorToast(TranslationBase.of(context) - .narcoticMedicineCanOnlyBePrescribedFromVida); + if (duration != null && doseTime != null && frequency != null && selectedDate != null && strengthController.text != "") { + if (widget.selectedMedication!.isNarcotic == true) { + DrAppToastMsg.showErrorToast(TranslationBase.of(context).narcoticMedicineCanOnlyBePrescribedFromVida); Navigator.pop(context); return; } @@ -480,7 +440,7 @@ class _PrescriptionFormWidgetState extends State { return; } - if (formKey.currentState.validate()) { + if (formKey.currentState!.validate()) { Navigator.push( context, SlideUpPageRoute( @@ -541,6 +501,6 @@ class _PrescriptionFormWidgetState extends State { } }); } - formKey.currentState.save(); + formKey.currentState!.save(); } } diff --git a/lib/screens/prescription/add_prescription/search_preescription_widget.dart b/lib/screens/prescription/add_prescription/search_preescription_widget.dart index 4bc4d668..0476e45b 100644 --- a/lib/screens/prescription/add_prescription/search_preescription_widget.dart +++ b/lib/screens/prescription/add_prescription/search_preescription_widget.dart @@ -17,18 +17,12 @@ import '../../base/base_view.dart'; final myController = TextEditingController(); class SearchPrescriptionWidget extends StatelessWidget { - final double spaceBetweenTextFields; - final MedicineViewModel medicineViewModel; - final PrescriptionViewModel prescriptionViewModel; - final Function(GetMedicationResponseModel) onItemSelected; + final double? spaceBetweenTextFields; + final MedicineViewModel? medicineViewModel; + final PrescriptionViewModel? prescriptionViewModel; + final Function(GetMedicationResponseModel)? onItemSelected; - const SearchPrescriptionWidget( - {Key key, - this.spaceBetweenTextFields, - this.medicineViewModel, - this.prescriptionViewModel, - this.onItemSelected}) - : super(key: key); + const SearchPrescriptionWidget({Key? key, this.spaceBetweenTextFields, this.medicineViewModel, this.prescriptionViewModel, this.onItemSelected}) : super(key: key); @override Widget build(BuildContext context) { @@ -37,7 +31,7 @@ class SearchPrescriptionWidget extends StatelessWidget { builder: ( BuildContext context, MedicineViewModel model, - Widget child, + Widget? child, ) => NetworkBaseView( baseViewModel: model, @@ -46,9 +40,7 @@ class SearchPrescriptionWidget extends StatelessWidget { FractionallySizedBox( widthFactor: 0.9, child: Container( - decoration: BoxDecoration( - borderRadius: BorderRadius.all(Radius.circular(6.0)), - border: Border.all(width: 1.0, color: HexColor("#CCCCCC"))), + decoration: BoxDecoration(borderRadius: BorderRadius.all(Radius.circular(6.0)), border: Border.all(width: 1.0, color: HexColor("#CCCCCC"))), padding: EdgeInsets.all(10), child: AppTextFormField( borderColor: Colors.white, @@ -93,19 +85,15 @@ class SearchPrescriptionWidget extends StatelessWidget { child: ListView.builder( padding: const EdgeInsets.only(top: 20), scrollDirection: Axis.vertical, - itemCount: model.allMedicationList == null - ? 0 - : model.allMedicationList.length, + itemCount: model.allMedicationList == null ? 0 : model.allMedicationList.length, itemBuilder: (BuildContext context, int index) { return InkWell( - child: MedicineItemWidget( - label: - model.allMedicationList[index].description), + child: MedicineItemWidget(label: model.allMedicationList[index].description!), onTap: () async { GifLoaderDialogUtils.showMyDialog(context); - await model.getItem(itemID: model.allMedicationList[index].itemId, isLocalBusy: true); + await model.getItem(itemID: model.allMedicationList[index].itemId!, isLocalBusy: true); GifLoaderDialogUtils.hideDialog(context); - onItemSelected(model.allMedicationList[index]); + onItemSelected!(model.allMedicationList[index]); // uom = _selectedMedication.uom; }, ); diff --git a/lib/screens/prescription/prescriptions_items/preacription_items_widget.dart b/lib/screens/prescription/prescriptions_items/preacription_items_widget.dart index 542f17de..9988c710 100644 --- a/lib/screens/prescription/prescriptions_items/preacription_items_widget.dart +++ b/lib/screens/prescription/prescriptions_items/preacription_items_widget.dart @@ -7,150 +7,144 @@ import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import '../../../widgets/shared/dialogs/ShowImageDialog.dart'; - class PrescriptionItemsWidget extends StatelessWidget { - final String itemDescription; - final String route; - final String frequency; + final String? itemDescription; + final String? route; + final String? frequency; final dynamic dailyDoses; - final String imageSRCUrl; - final String remarks; - final int days; - final PrescriptionViewModel prescriptionViewModel; - + final String? imageSRCUrl; + final String? remarks; + final int? days; + final PrescriptionViewModel? prescriptionViewModel; - - PrescriptionItemsWidget( - {this.itemDescription, - this.route, - this.frequency, - this.dailyDoses, - this.imageSRCUrl, - this.remarks, - this.days, this.prescriptionViewModel, - }); + PrescriptionItemsWidget({ + this.itemDescription, + this.route, + this.frequency, + this.dailyDoses, + this.imageSRCUrl, + this.remarks, + this.days, + this.prescriptionViewModel, + }); @override Widget build(BuildContext context) { return Column( children: [ - ...List.generate( - // TODO Elham* List.generate to list.builder - prescriptionViewModel.prescriptionReportEnhList.length, - (index) => Container( - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(12), - color: Colors.white, - ), - margin: EdgeInsets.all(12), - child: Padding( - padding: const EdgeInsets.all(8.0), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Container( - margin: EdgeInsets.only(left: 18, right: 18), - child: AppText( - prescriptionViewModel.prescriptionReportEnhList[index].itemDescription, - bold: true, - ), - ), - SizedBox( - height: 12, + ...List.generate( + // TODO Elham* List.generate to list.builder + prescriptionViewModel!.prescriptionReportEnhList.length, + (index) => Container( + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(12), + color: Colors.white, + ), + margin: EdgeInsets.all(12), + child: Padding( + padding: const EdgeInsets.all(8.0), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Container( + margin: EdgeInsets.only(left: 18, right: 18), + child: AppText( + prescriptionViewModel!.prescriptionReportEnhList[index].itemDescription!, + bold: true, ), - Row( - mainAxisAlignment: MainAxisAlignment.start, - crossAxisAlignment: CrossAxisAlignment.center, - children: [ - SizedBox( - width: 18, - ), - Container( - decoration: BoxDecoration( - shape: BoxShape.circle, - border: Border.all( - width: 0.5, color: Colors.grey)), - height: 55, - width: 55, - child: InkWell( - onTap: () { - showDialog( - context: context, - builder: (ctx) => ShowImageDialog( - imageUrl: prescriptionViewModel.prescriptionReportEnhList[index].imageSRCUrl, - )); - }, - child: Stack( - children: [ - Padding( - padding: const EdgeInsets.all(8.0), - child: Image.network( - prescriptionViewModel.prescriptionReportEnhList[index].imageSRCUrl, - fit: BoxFit.cover, - ), - ), - Positioned( - top: 10, - right: 10, - child: Icon( - EvaIcons.search, - color: Colors.grey, - size: 35, - )) - ], - ), - ), - ), - SizedBox( - width: 10, - ), - Expanded( - child: Column( - crossAxisAlignment: - CrossAxisAlignment.start, + ), + SizedBox( + height: 12, + ), + Row( + mainAxisAlignment: MainAxisAlignment.start, + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + SizedBox( + width: 18, + ), + Container( + decoration: BoxDecoration(shape: BoxShape.circle, border: Border.all(width: 0.5, color: Colors.grey)), + height: 55, + width: 55, + child: InkWell( + onTap: () { + showDialog( + context: context, + builder: (ctx) => ShowImageDialog( + imageUrl: prescriptionViewModel!.prescriptionReportEnhList[index].imageSRCUrl!, + )); + }, + child: Stack( children: [ - CustomRow( - label: TranslationBase.of(context).route + ' : ', - value: " " + prescriptionViewModel.prescriptionReportEnhList[index].route ?? '', - labelSize: 13, - valueSize: 13, - ), - CustomRow( - label: TranslationBase.of(context).frequency + ' : ', - value: " " + prescriptionViewModel.prescriptionReportEnhList[index].frequency ?? '', - labelSize: 13, - valueSize: 13, - ), - CustomRow( - label: TranslationBase.of(context).dailyDoses + ' : ', - value: " " + prescriptionViewModel.prescriptionReportEnhList[index].doseDailyQuantity.toString() ?? '', - labelSize: 13, - valueSize: 13, - ), - CustomRow( - label: TranslationBase.of(context).duration + ' : ', - value: " " + prescriptionViewModel.prescriptionReportList[index].days.toString() ?? '', - labelSize: 13, - valueSize: 13, - ), - SizedBox( - height: 12, - ), - CustomRow( - label: '', - value: prescriptionViewModel.prescriptionReportList[index].remarks ?? '', - valueSize: 14, + Padding( + padding: const EdgeInsets.all(8.0), + child: Image.network( + prescriptionViewModel!.prescriptionReportEnhList[index].imageSRCUrl!, + fit: BoxFit.cover, + ), ), + Positioned( + top: 10, + right: 10, + child: Icon( + EvaIcons.search, + color: Colors.grey, + size: 35, + )) ], ), - ) - ], - ) - ], - ), + ), + ), + SizedBox( + width: 10, + ), + Expanded( + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + CustomRow( + label: TranslationBase.of(context).route + ' : ', + value: " " + prescriptionViewModel!.prescriptionReportEnhList[index].route! ?? '', + labelSize: 13, + valueSize: 13, + ), + CustomRow( + label: TranslationBase.of(context).frequency + ' : ', + value: " " + prescriptionViewModel!.prescriptionReportEnhList[index].frequency! ?? '', + labelSize: 13, + valueSize: 13, + ), + CustomRow( + label: TranslationBase.of(context).dailyDoses + ' : ', + value: " " + prescriptionViewModel!.prescriptionReportEnhList[index].doseDailyQuantity.toString() ?? '', + labelSize: 13, + valueSize: 13, + ), + CustomRow( + label: TranslationBase.of(context).duration + ' : ', + value: " " + prescriptionViewModel!.prescriptionReportList[index].days.toString() ?? '', + labelSize: 13, + valueSize: 13, + ), + SizedBox( + height: 12, + ), + CustomRow( + label: '', + value: prescriptionViewModel!.prescriptionReportList[index].remarks ?? '', + valueSize: 14, + ), + ], + ), + ) + ], + ) + ], ), ), ), + ), ], ); } diff --git a/pubspec.yaml b/pubspec.yaml index 4c1a1633..092ad1d6 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -28,7 +28,7 @@ dependencies: flutter: sdk: flutter hexcolor: ^3.0.1 - + #flutter_localization: any intl: any flutter_device_type: ^0.4.0 http: ^1.1.2