From f097005b8cb1ab2630ee1055c9ffb8596db3fb4a Mon Sep 17 00:00:00 2001 From: Elham Rababh Date: Thu, 16 Dec 2021 15:45:03 +0200 Subject: [PATCH] screen fixes 4 --- .../PatientMedicalReportViewModel.dart | 4 +- .../patients/patient_search/time_bar.dart | 110 ----- .../profile/UCAF/UCAF-detail-screen.dart | 83 ++-- .../profile/UCAF/UCAF-input-screen.dart | 3 +- .../profile/UCAF/page-stepper-widget.dart | 59 +-- .../profile/UCAF/ucaf_pager_screen.dart | 4 +- .../profile/lab_result/LabResultWidget.dart | 2 +- .../Lab_Result_details_wideget.dart | 4 +- .../AddVerifyMedicalReport.dart | 2 +- .../medical_report/MedicalReportPage.dart | 4 +- .../nursing_note/nursing_note_screen.dart | 2 +- .../operation_report/operation_report.dart | 5 +- .../update_operation_report.dart | 6 +- .../profile_gird_for_other.dart | 38 +- .../profile_gird_for_search.dart | 38 +- .../radiology/radiology_details_page.dart | 9 +- .../radiology/radiology_home_page.dart | 37 +- .../radiology/radiology_report_screen.dart | 4 +- .../referral/AddReplayOnReferralPatient.dart | 8 +- .../ReplySummeryOnReferralPatient.dart | 2 +- .../my-referral-inpatient-screen.dart | 14 +- .../referral/my-referral-patient-screen.dart | 55 +-- .../referral/patient_referral_screen.dart | 15 +- .../refer-patient-screen-in-patient.dart | 33 +- .../referral/refer-patient-screen.dart | 115 ++--- .../referral_patient_detail_in-paint.dart | 68 ++- .../referral/referred-patient-screen.dart | 16 +- .../referred_patient_detail_in-paint.dart | 38 +- .../assessment/add_assessment_details.dart | 415 +++++++----------- .../assessment/update_assessment_page.dart | 190 ++++---- .../objective/add_examination_page.dart | 128 +++--- .../objective/examination_item_card.dart | 46 +- .../objective/update_objective_page.dart | 73 ++- .../shared_soap_widgets/SOAP_open_items.dart | 4 +- .../bottom_sheet_title.dart | 2 +- .../expandable_SOAP_widget.dart | 9 +- .../allergies/update_allergies_widget.dart | 142 +++--- .../update_Chief_complaints.dart | 14 +- .../history/add_history_dialog.dart | 240 +++++----- .../subjective/history/priority_bar.dart | 2 +- .../history/update_history_widget.dart | 32 +- .../medication/update_medication_widget.dart | 2 +- .../subjective/update_subjective_page.dart | 202 ++++----- .../soap_update/update_soap_index.dart | 26 +- ...al_sign_details_blood_pressurewideget.dart | 16 +- .../vital_sign_details_wideget.dart | 4 +- .../profile/vital_sign/vital_sign_item.dart | 10 +- .../vital_sign_item_details_screen.dart | 24 +- .../vital_sing_chart_and_detials.dart | 12 +- .../vital_sing_chart_blood_pressure.dart | 16 +- 50 files changed, 1044 insertions(+), 1343 deletions(-) delete mode 100644 lib/screens/patients/patient_search/time_bar.dart diff --git a/lib/core/viewModel/PatientMedicalReportViewModel.dart b/lib/core/viewModel/PatientMedicalReportViewModel.dart index 1ba983ce..9648292f 100644 --- a/lib/core/viewModel/PatientMedicalReportViewModel.dart +++ b/lib/core/viewModel/PatientMedicalReportViewModel.dart @@ -68,9 +68,9 @@ class PatientMedicalReportViewModel extends BaseViewModel { } } - Future updateMedicalReport(PatiantInformtion patient, String htmlText, int limitNumber, String invoiceNumber) async { + Future updateMedicalReport(PatiantInformtion patient, String htmlText, dynamic limitNumber, String? invoiceNumber) async { setState(ViewState.Busy); - await _service.updateMedicalReport(patient, htmlText, limitNumber, invoiceNumber); + await _service.updateMedicalReport(patient, htmlText, limitNumber!, invoiceNumber!); if (_service.hasError) { error = _service.error!; await getMedicalReportList(patient); diff --git a/lib/screens/patients/patient_search/time_bar.dart b/lib/screens/patients/patient_search/time_bar.dart deleted file mode 100644 index a1d61dce..00000000 --- a/lib/screens/patients/patient_search/time_bar.dart +++ /dev/null @@ -1,110 +0,0 @@ -import 'package:doctor_app_flutter/config/size_config.dart'; -import 'package:doctor_app_flutter/core/enum/patient_type.dart'; -import 'package:doctor_app_flutter/core/model/patient_muse/PatientSearchRequestModel.dart'; -import 'package:doctor_app_flutter/core/viewModel/PatientSearchViewModel.dart'; -import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; -import 'package:doctor_app_flutter/widgets/shared/loader/gif_loader_dialog_utils.dart'; -import 'package:flutter/material.dart'; -import 'package:hexcolor/hexcolor.dart'; - -class TimeBar extends StatefulWidget { - final PatientSearchViewModel model; - final PatientType selectedPatientType; - final PatientSearchRequestModel patientSearchRequestModel; - final bool isSearchWithKeyInfo; - - const TimeBar( - {Key ? key, - this.model, - this.selectedPatientType, - this.patientSearchRequestModel, - this.isSearchWithKeyInfo}) - : super(key: key); - @override - _TimeBarState createState() => _TimeBarState(); -} - -class _TimeBarState extends State { - @override - Widget build(BuildContext context) { - List _locations = [ - TranslationBase.of(context).today, - TranslationBase.of(context).tomorrow, - TranslationBase.of(context).nextWeek, - ]; - int _activeLocation = 0; - return Container( - height: MediaQuery.of(context).size.height * 0.0619, - width: SizeConfig.screenWidth * 0.94, - decoration: BoxDecoration( - color: Color(0Xffffffff), - borderRadius: BorderRadius.circular(12.5), - // border: Border.all( - // width: 0.5, - // ), - ), - child: Row( - mainAxisAlignment: MainAxisAlignment.spaceEvenly, - mainAxisSize: MainAxisSize.max, - crossAxisAlignment: CrossAxisAlignment.center, - children: _locations.map((item) { - bool _isActive = _locations[_activeLocation] == item ? true : false; - return Column(mainAxisSize: MainAxisSize.min, children: [ - InkWell( - child: Center( - child: Container( - height: MediaQuery.of(context).size.height * 0.058, - width: SizeConfig.screenWidth * 0.2334, - decoration: BoxDecoration( - borderRadius: BorderRadius.only( - bottomRight: Radius.circular(12.5), - topRight: Radius.circular(12.5), - topLeft: Radius.circular(9.5), - bottomLeft: Radius.circular(9.5)), - color: _isActive ? HexColor("#B8382B") : Colors.white, - ), - child: Center( - child: Text( - item, - style: TextStyle( - fontSize: 12, - color: _isActive - ? Colors.white - : Colors.black, //Colors.black, - - fontWeight: FontWeight.normal, - ), - ), - )), - ), - onTap: () async { - setState(() { - _activeLocation = _locations.indexOf(item); - }); - GifLoaderDialogUtils.showMyDialog(context); - await widget.model.getPatientBasedOnDate( - item: item, - selectedPatientType: widget.selectedPatientType, - patientSearchRequestModel: - widget.patientSearchRequestModel, - isSearchWithKeyInfo: widget.isSearchWithKeyInfo); - GifLoaderDialogUtils.hideDialog(context); - }), - _isActive - ? Container( - decoration: BoxDecoration( - borderRadius: BorderRadius.only( - bottomRight: Radius.circular(10), - topRight: Radius.circular(10)), - color: Colors.white), - alignment: Alignment.center, - height: 1, - width: SizeConfig.screenWidth * 0.23, - ) - : Container() - ]); - }).toList(), - ), - ); - } -} diff --git a/lib/screens/patients/profile/UCAF/UCAF-detail-screen.dart b/lib/screens/patients/profile/UCAF/UCAF-detail-screen.dart index 7cd7288e..9e96679a 100644 --- a/lib/screens/patients/profile/UCAF/UCAF-detail-screen.dart +++ b/lib/screens/patients/profile/UCAF/UCAF-detail-screen.dart @@ -1,4 +1,3 @@ -import 'package:doctor_app_flutter/config/config.dart'; import 'package:doctor_app_flutter/config/size_config.dart'; import 'package:doctor_app_flutter/core/enum/master_lookup_key.dart'; import 'package:doctor_app_flutter/core/enum/viewstate.dart'; @@ -8,6 +7,7 @@ import 'package:doctor_app_flutter/models/SOAP/GetAssessmentResModel.dart'; import 'package:doctor_app_flutter/models/SOAP/master_key_model.dart'; import 'package:doctor_app_flutter/models/SOAP/order-procedure.dart'; import 'package:doctor_app_flutter/models/patient/patiant_info_model.dart'; +import 'package:doctor_app_flutter/models/patient/profile/patient_profile_app_bar_model.dart'; import 'package:doctor_app_flutter/screens/base/base_view.dart'; import 'package:doctor_app_flutter/util/dr_app_toast_msg.dart'; import 'package:doctor_app_flutter/util/helpers.dart'; @@ -33,8 +33,8 @@ class UcafDetailScreen extends StatefulWidget { } class _UcafDetailScreenState extends State { - PatiantInformtion patient; - UcafViewModel model; + PatiantInformtion patient; + UcafViewModel model; late UcafViewModel ucafModel; @@ -74,48 +74,47 @@ class _UcafDetailScreenState extends State { widget.changeLoadingState(false); }, builder: (_, model, w) => AppScaffold( - baseViewModel: model, - isShowAppBar: false, - body: Column( - children: [ - Expanded( - child: Container( - child: SingleChildScrollView( - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Container( - margin: EdgeInsets.symmetric( - vertical: 16, horizontal: 16), - child: Column( - children: [ - treatmentStepsBar( - context, model, screenSize, patient), - SizedBox( - height: 16, - ), - ...getSelectedTreatmentStepItem( - context, model), - ], + baseViewModel: model, + isShowAppBar: false, + body: Column( + children: [ + Expanded( + child: Container( + child: SingleChildScrollView( + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Container( + margin: EdgeInsets.symmetric( + vertical: 16, horizontal: 16), + child: Column( + children: [ + treatmentStepsBar( + context, model, screenSize, patient), + SizedBox( + height: 16, ), - ), - ], + ...getSelectedTreatmentStepItem( + context, model), + ], + ), ), - ), + ], ), ), - - ], + ), ), - )); + ], + ), + )); } Widget treatmentStepsBar(BuildContext _context, UcafViewModel model, Size screenSize, PatiantInformtion patient) { List __treatmentSteps = [ - TranslationBase.of(context).diagnosis.toUpperCase(), - TranslationBase.of(context).medications.toUpperCase(), - TranslationBase.of(context).procedures.toUpperCase(), + TranslationBase.of(context).diagnosis ?? "".toUpperCase(), + TranslationBase.of(context).medications ?? "".toUpperCase(), + TranslationBase.of(context).procedures ?? "".toUpperCase(), ]; return Container( height: screenSize.height * 0.070, @@ -200,14 +199,14 @@ class _UcafDetailScreenState extends State { 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]); }) ]; break; @@ -245,10 +244,10 @@ class DiagnosisWidget extends StatelessWidget { @override Widget build(BuildContext context) { - MasterKeyModel diagnosisType = model.findMasterDataById( + MasterKeyModel? diagnosisType = model.findMasterDataById( masterKeys: MasterKeysService.DiagnosisType, id: diagnosis.diagnosisTypeID); - MasterKeyModel diagnosisCondition = model.findMasterDataById( + MasterKeyModel? diagnosisCondition = model.findMasterDataById( masterKeys: MasterKeysService.DiagnosisCondition, id: diagnosis.conditionID); @@ -265,8 +264,8 @@ class DiagnosisWidget extends StatelessWidget { AppText( diagnosisType != null ? model.selectedLanguage == 'ar' - ? diagnosisType.nameAr - : diagnosisType.nameEn + ? diagnosisType.nameAr + : diagnosisType.nameEn : "-", fontWeight: FontWeight.normal, fontSize: SizeConfig.textMultiplier * 2.0, @@ -521,7 +520,7 @@ class ProceduresWidget extends StatelessWidget { AppText( "${procedure.isCovered}", fontWeight: FontWeight.normal, - color: procedure.isCovered ? AppGlobal.appGreenColor : Colors.red, + color: procedure.isCovered! ? Colors.green : Colors.red, fontSize: SizeConfig.textMultiplier * 2.0, ), SizedBox( diff --git a/lib/screens/patients/profile/UCAF/UCAF-input-screen.dart b/lib/screens/patients/profile/UCAF/UCAF-input-screen.dart index 64b1bd29..adbc2a50 100644 --- a/lib/screens/patients/profile/UCAF/UCAF-input-screen.dart +++ b/lib/screens/patients/profile/UCAF/UCAF-input-screen.dart @@ -261,7 +261,8 @@ class _UCAFInputScreenState extends State { TranslationBase.of(context).instruction, dropDownText: Helpers.parseHtmlString(model .patientChiefComplaintList[0] - .chiefComplaint ), + .chiefComplaint! ?? + ""), controller: _additionalComplaintsController, inputType: TextInputType.multiline, enabled: false, diff --git a/lib/screens/patients/profile/UCAF/page-stepper-widget.dart b/lib/screens/patients/profile/UCAF/page-stepper-widget.dart index 3aa89949..408219d8 100644 --- a/lib/screens/patients/profile/UCAF/page-stepper-widget.dart +++ b/lib/screens/patients/profile/UCAF/page-stepper-widget.dart @@ -19,10 +19,10 @@ class PageStepperWidget extends StatelessWidget { final List ?stepsTitles; PageStepperWidget( - { this.stepsCount, - this.currentStepIndex, - this.screenSize, - this.stepsTitles}); + {required this.stepsCount, + required this.currentStepIndex, + required this.screenSize, + this.stepsTitles}); @override Widget build(BuildContext context) { @@ -63,7 +63,6 @@ class PageStepperWidget extends StatelessWidget { } class StepWidget extends StatelessWidget { - final int index; final bool isInProgress; final bool isFinalStep; @@ -81,9 +80,9 @@ class StepWidget extends StatelessWidget { if (isInProgress) { status = StepStatus.InProgress; } else { - if(isStepFinish){ + if (isStepFinish) { status = StepStatus.Completed; - }else { + } else { status = StepStatus.Locked; } } @@ -99,20 +98,28 @@ class StepWidget extends StatelessWidget { width: 30, height: 30, decoration: BoxDecoration( - color: status == StepStatus.InProgress ? Color(0xFFCC9B14) : status == StepStatus.Locked ? Color(0xFFE3E3E3) : Color(0xFF359846), + color: status == StepStatus.InProgress + ? Color(0xFFCC9B14) + : status == StepStatus.Locked + ? Color(0xFFE3E3E3) + : Color(0xFF359846), shape: BoxShape.circle, border: Border.all( - color: status == StepStatus.InProgress ? Color(0xFFCC9B14) : status == StepStatus.Locked ? Color(0xFFE3E3E3) : Color(0xFF359846), + color: status == StepStatus.InProgress + ? Color(0xFFCC9B14) + : status == StepStatus.Locked + ? Color(0xFFE3E3E3) + : Color(0xFF359846), width: 1), ), child: Center( child: Icon( - Icons.check, - size: 20, - color: status == StepStatus.Locked - ? Color(0xFF969696) - : Colors.white, - )), + Icons.check, + size: 20, + color: status == StepStatus.Locked + ? Color(0xFF969696) + : Colors.white, + )), ), if (!isFinalStep) Container( @@ -144,23 +151,25 @@ class StepWidget extends StatelessWidget { color: status == StepStatus.InProgress ? Color(0xFFF1E9D3) : status == StepStatus.Locked - ? Color(0x29797979) - : Color(0xFFD8E8D8), + ? Color(0x29797979) + : Color(0xFFD8E8D8), borderRadius: BorderRadius.all( Radius.circular(4.0), ), - border: Border.all(color: status == StepStatus.InProgress - ? Color(0xFFF1E9D3) - : status == StepStatus.Locked - ? Color(0x29797979) - : Color(0xFFD8E8D8), width: 0.30), + border: Border.all( + color: status == StepStatus.InProgress + ? Color(0xFFF1E9D3) + : status == StepStatus.Locked + ? Color(0x29797979) + : Color(0xFFD8E8D8), + width: 0.30), ), child: AppText( status == StepStatus.InProgress ? "inProgress" : status == StepStatus.Locked - ? "Locked" - : "Completed", + ? "Locked" + : "Completed", fontWeight: FontWeight.bold, textAlign: TextAlign.center, fontFamily: 'Poppins', @@ -181,4 +190,4 @@ enum StepStatus { InProgress, Locked, Completed, -} \ No newline at end of file +} diff --git a/lib/screens/patients/profile/UCAF/ucaf_pager_screen.dart b/lib/screens/patients/profile/UCAF/ucaf_pager_screen.dart index 4408fdb0..acaf3a98 100644 --- a/lib/screens/patients/profile/UCAF/ucaf_pager_screen.dart +++ b/lib/screens/patients/profile/UCAF/ucaf_pager_screen.dart @@ -18,7 +18,7 @@ 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(); @@ -56,7 +56,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']; diff --git a/lib/screens/patients/profile/lab_result/LabResultWidget.dart b/lib/screens/patients/profile/lab_result/LabResultWidget.dart index e5fc4475..99a8d73d 100644 --- a/lib/screens/patients/profile/lab_result/LabResultWidget.dart +++ b/lib/screens/patients/profile/lab_result/LabResultWidget.dart @@ -331,7 +331,7 @@ class LabResultWidget extends StatelessWidget { color: Colors.white, child: Center( child: AppText( - lab.resultValue + " " + lab.uOM, + lab.resultValue! + " " + lab.uOM!, textAlign: TextAlign.center, ), ), diff --git a/lib/screens/patients/profile/lab_result/Lab_Result_details_wideget.dart b/lib/screens/patients/profile/lab_result/Lab_Result_details_wideget.dart index 764cef34..64ed4550 100644 --- a/lib/screens/patients/profile/lab_result/Lab_Result_details_wideget.dart +++ b/lib/screens/patients/profile/lab_result/Lab_Result_details_wideget.dart @@ -74,7 +74,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), ), @@ -87,7 +87,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( diff --git a/lib/screens/patients/profile/medical_report/AddVerifyMedicalReport.dart b/lib/screens/patients/profile/medical_report/AddVerifyMedicalReport.dart index c76b82aa..bd6fd476 100644 --- a/lib/screens/patients/profile/medical_report/AddVerifyMedicalReport.dart +++ b/lib/screens/patients/profile/medical_report/AddVerifyMedicalReport.dart @@ -122,7 +122,7 @@ class _AddVerifyMedicalReportState extends State { ? await widget.model!.updateMedicalReport( widget.patient!, txtOfMedicalReport, - widget.medicalReport != null + widget.medicalReport! != null ? widget.medicalReport!.lineItemNo! : '', widget.medicalReport != null diff --git a/lib/screens/patients/profile/medical_report/MedicalReportPage.dart b/lib/screens/patients/profile/medical_report/MedicalReportPage.dart index 92bae5bb..c794edae 100644 --- a/lib/screens/patients/profile/medical_report/MedicalReportPage.dart +++ b/lib/screens/patients/profile/medical_report/MedicalReportPage.dart @@ -168,13 +168,13 @@ 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, ), 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, 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 5acd1926..90adbba9 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 @@ -84,7 +84,7 @@ class _ProgressNoteState extends State { model.patientNursingProgressNoteList.length == 0 ? Center( child: ErrorMessage( - error: TranslationBase.of(context).noDataAvailable, + error: TranslationBase.of(context)!.noDataAvailable!, ), ) : Container( diff --git a/lib/screens/patients/profile/operation_report/operation_report.dart b/lib/screens/patients/profile/operation_report/operation_report.dart index b67f3583..37ed90ce 100644 --- a/lib/screens/patients/profile/operation_report/operation_report.dart +++ b/lib/screens/patients/profile/operation_report/operation_report.dart @@ -34,9 +34,8 @@ import '../../../../widgets/shared/app_texts_widget.dart'; DrAppSharedPreferances sharedPref = new DrAppSharedPreferances(); class OperationReportScreen extends StatefulWidget { - final int visitType; - const OperationReportScreen({Key? key, this.visitType}) : super(key: key); + const OperationReportScreen({Key? key}) : super(key: key); @override _ProgressNoteState createState() => _ProgressNoteState(); @@ -74,7 +73,7 @@ class _ProgressNoteState extends State { model.reservationList == null || model.reservationList.length == 0 ? Center( child: ErrorMessage( - error: TranslationBase.of(context).noDataAvailable, ), + error: TranslationBase.of(context).noDataAvailable!, ), ): Column( children: [ Expanded( 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 e4eac5ab..a23ec9a4 100644 --- a/lib/screens/patients/profile/operation_report/update_operation_report.dart +++ b/lib/screens/patients/profile/operation_report/update_operation_report.dart @@ -219,7 +219,7 @@ class _UpdateOperationReportState extends State { height: 4, ), AppTextFieldCustom( - hintText:TranslationBase.of(context).assistant, + hintText:TranslationBase.of(context).assistant!, controller: assistantNoteController, maxLines: 1, minLines: 1, @@ -237,8 +237,8 @@ class _UpdateOperationReportState extends State { height: 4, ), AppTextFieldCustom( - hintText: - TranslationBase.of(context).operation, + hintText: "Operation", + //TranslationBase.of(context).addoperationReports, controller: operationController, maxLines: 20, minLines: 4, 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 51fae4c9..e8013bc9 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 @@ -34,14 +34,14 @@ class ProfileGridForOther extends StatelessWidget { Widget build(BuildContext context) { final List cardsList = [ PatientProfileCardModel( - TranslationBase.of(context).vital, - TranslationBase.of(context).signs, + 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, + TranslationBase.of(context).lab!, + TranslationBase.of(context).result!, LAB_RESULT, 'assets/images/svgs/profile_screen/lab results.svg', isInPatient: isInpatient), @@ -64,37 +64,37 @@ class ProfileGridForOther extends StatelessWidget { 'assets/images/svgs/profile_screen/order prescription.svg', isInPatient: isInpatient), PatientProfileCardModel( - TranslationBase.of(context).health, - TranslationBase.of(context).summary, + TranslationBase.of(context).health!, + TranslationBase.of(context).summary!, HEALTH_SUMMARY, 'assets/images/svgs/profile_screen/health summary.svg', isInPatient: isInpatient), - PatientProfileCardModel(TranslationBase.of(context).patient, "ECG", + 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, + 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, + 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, + 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, + TranslationBase.of(context).patient!, + TranslationBase.of(context).ucaf!, PATIENT_UCAF_REQUEST, 'assets/images/svgs/profile_screen/UCAF.svg', isInPatient: isInpatient, @@ -105,8 +105,8 @@ class ProfileGridForOther extends StatelessWidget { if (isFromLiveCare || (patient.appointmentNo != null && patient.appointmentNo != 0)) PatientProfileCardModel( - TranslationBase.of(context).referral, - TranslationBase.of(context).patient, + TranslationBase.of(context).referral!, + TranslationBase.of(context).patient!, REFER_PATIENT_TO_DOCTOR, 'assets/images/svgs/profile_screen/refer patient.svg', isInPatient: isInpatient, @@ -118,8 +118,8 @@ class ProfileGridForOther extends StatelessWidget { if (isFromLiveCare || (patient.appointmentNo != null && patient.appointmentNo != 0)) PatientProfileCardModel( - TranslationBase.of(context).admission, - TranslationBase.of(context).request, + TranslationBase.of(context).admission!, + TranslationBase.of(context).request!, PATIENT_ADMISSION_REQUEST, 'assets/images/svgs/profile_screen/admission req.svg', isInPatient: isInpatient, 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 87fceb48..cfd7f160 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 @@ -31,14 +31,14 @@ class ProfileGridForSearch extends StatelessWidget { Widget build(BuildContext context) { final List cardsList = [ PatientProfileCardModel( - TranslationBase.of(context).vital, - TranslationBase.of(context).signs, + 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, + TranslationBase.of(context).lab!, + TranslationBase.of(context).result!, LAB_RESULT, 'assets/images/svgs/profile_screen/lab results.svg', isInPatient: isInpatient), @@ -61,52 +61,52 @@ class ProfileGridForSearch extends StatelessWidget { 'assets/images/svgs/profile_screen/order prescription.svg', isInPatient: isInpatient), PatientProfileCardModel( - TranslationBase.of(context).health, - TranslationBase.of(context).summary, + TranslationBase.of(context).health!, + TranslationBase.of(context).summary!, HEALTH_SUMMARY, 'assets/images/svgs/profile_screen/health summary.svg', isInPatient: isInpatient), - PatientProfileCardModel(TranslationBase.of(context).patient, "ECG", + 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, + 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, + TranslationBase.of(context).insurance!, + TranslationBase.of(context).service!, PATIENT_INSURANCE_APPROVALS_NEW, 'assets/images/svgs/profile_screen/vital signs.svg', isInPatient: isInpatient), PatientProfileCardModel( - TranslationBase.of(context).patientSick, - TranslationBase.of(context).leave, + TranslationBase.of(context).patientSick!, + TranslationBase.of(context).leave!, ADD_SICKLEAVE, 'assets/images/svgs/profile_screen/patient sick leave.svg', isInPatient: isInpatient), if (patient.appointmentNo != null && patient.appointmentNo != 0) PatientProfileCardModel( - TranslationBase.of(context).patient, - TranslationBase.of(context).ucaf, + 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) PatientProfileCardModel( - TranslationBase.of(context).referral, - TranslationBase.of(context).patient, + 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) PatientProfileCardModel( - TranslationBase.of(context).admission, - TranslationBase.of(context).request, + TranslationBase.of(context).admission!, + TranslationBase.of(context).request!, PATIENT_ADMISSION_REQUEST, 'assets/images/svgs/profile_screen/admission req.svg', isInPatient: isInpatient, diff --git a/lib/screens/patients/profile/radiology/radiology_details_page.dart b/lib/screens/patients/profile/radiology/radiology_details_page.dart index 0cc89795..d03bc10c 100644 --- a/lib/screens/patients/profile/radiology/radiology_details_page.dart +++ b/lib/screens/patients/profile/radiology/radiology_details_page.dart @@ -17,12 +17,13 @@ import '../../../../locator.dart'; class RadiologyDetailsPage extends StatelessWidget { final FinalRadiology finalRadiology; final PatiantInformtion patient; - final String patientType; - final String arrivalType; + final String? patientType; + final String? arrivalType; final bool isInpatient; RadiologyDetailsPage( - {Key? key, this.finalRadiology, this.patient, this.patientType, this.arrivalType, this.isInpatient = false}); + {Key? key, required this.finalRadiology, required this.patient, this.patientType, this.arrivalType, + this.isInpatient = false}); @override Widget build(BuildContext context) { @@ -106,7 +107,7 @@ class RadiologyDetailsPage extends StatelessWidget { ); launch(model.radImageURL); }, - label: TranslationBase.of(context).openRad, + label: TranslationBase.of(context).openRad ?? "", ), ), ) diff --git a/lib/screens/patients/profile/radiology/radiology_home_page.dart b/lib/screens/patients/profile/radiology/radiology_home_page.dart index 958301fd..8179e25a 100644 --- a/lib/screens/patients/profile/radiology/radiology_home_page.dart +++ b/lib/screens/patients/profile/radiology/radiology_home_page.dart @@ -1,6 +1,7 @@ import 'package:doctor_app_flutter/core/viewModel/procedure_View_model.dart'; import 'package:doctor_app_flutter/core/viewModel/project_view_model.dart'; import 'package:doctor_app_flutter/models/patient/patiant_info_model.dart'; +import 'package:doctor_app_flutter/models/patient/profile/patient_profile_app_bar_model.dart'; import 'package:doctor_app_flutter/screens/base/base_view.dart'; import 'package:doctor_app_flutter/screens/patients/profile/radiology/radiology_details_page.dart'; import 'package:doctor_app_flutter/screens/procedures/ProcedureType.dart'; @@ -23,16 +24,16 @@ class RadiologyHomePage extends StatefulWidget { } class _RadiologyHomePageState extends State { - String patientType; - PatiantInformtion patient; - String arrivalType; - bool isInpatient; - bool isFromLiveCare; + String? patientType; + late PatiantInformtion patient; + late String arrivalType; + late bool isInpatient; + late 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,10 +51,8 @@ class _RadiologyHomePageState extends State { isShowAppBar: true, backgroundColor: Colors.grey[100], // appBarTitle: TranslationBase.of(context).radiology, - appBar: PatientProfileAppBar( - patient, - isInpatient: isInpatient, - ), + patientProfileAppBarModel: PatientProfileAppBarModel( + patient: patient, isInpatient:isInpatient,), baseViewModel: model, body: FractionallySizedBox( widthFactor: 1.0, @@ -118,7 +117,7 @@ class _RadiologyHomePageState extends State { settingRoute: 'AddProcedureTabPage'), ); }, - label: TranslationBase.of(context).applyForRadiologyOrder, + label: TranslationBase.of(context).applyForRadiologyOrder ?? "", ), ...List.generate( model.radiologyList.length, @@ -140,9 +139,9 @@ class _RadiologyHomePageState extends State { height: 160, decoration: BoxDecoration( //Colors.red[900] Color(0xff404545) - color: model.radiologyList[index].isLiveCareAppodynamicment + color: model.radiologyList[index].isLiveCareAppodynamicment! ? Colors.red[900] - : !model.radiologyList[index].isInOutPatient + : !model.radiologyList[index].isInOutPatient! ? Colors.black : Color(0xffa9a089), borderRadius: BorderRadius.only( @@ -155,11 +154,11 @@ class _RadiologyHomePageState extends State { quarterTurns: 3, child: Center( child: Text( - model.radiologyList[index].isLiveCareAppodynamicment - ? TranslationBase.of(context).liveCare.toUpperCase() - : !model.radiologyList[index].isInOutPatient - ? TranslationBase.of(context).inPatientLabel.toUpperCase() - : TranslationBase.of(context).outpatient.toUpperCase(), + model.radiologyList[index]!.isLiveCareAppodynamicment! + ? TranslationBase.of(context).liveCare!.toUpperCase() + : !model.radiologyList[index].isInOutPatient! + ? TranslationBase.of(context).inPatientLabel!.toUpperCase() + : TranslationBase.of(context).outpatient!.toUpperCase(), style: TextStyle(color: Colors.white), ), )), @@ -173,7 +172,7 @@ class _RadiologyHomePageState extends State { branch: '${model.radiologyList[index].projectName}', clinic: model.radiologyList[index].clinicDescription, appointmentDate: - model.radiologyList[index].orderDate ?? model.radiologyList[index].reportDate, + model.radiologyList[index].orderDate ?? model.radiologyList[index].reportDate!, onTap: () { Navigator.push( context, diff --git a/lib/screens/patients/profile/radiology/radiology_report_screen.dart b/lib/screens/patients/profile/radiology/radiology_report_screen.dart index 7b917ef2..3bb7f94d 100644 --- a/lib/screens/patients/profile/radiology/radiology_report_screen.dart +++ b/lib/screens/patients/profile/radiology/radiology_report_screen.dart @@ -11,12 +11,12 @@ 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) { return AppScaffold( - appBarTitle: TranslationBase.of(context).radiologyReport, + appBarTitle: TranslationBase.of(context).radiologyReport ?? "", body: SingleChildScrollView( child: Column( children: [ diff --git a/lib/screens/patients/profile/referral/AddReplayOnReferralPatient.dart b/lib/screens/patients/profile/referral/AddReplayOnReferralPatient.dart index 9d37a61f..05bd2305 100644 --- a/lib/screens/patients/profile/referral/AddReplayOnReferralPatient.dart +++ b/lib/screens/patients/profile/referral/AddReplayOnReferralPatient.dart @@ -26,13 +26,11 @@ import 'ReplySummeryOnReferralPatient.dart'; class AddReplayOnReferralPatient extends StatefulWidget { final PatientReferralViewModel patientReferralViewModel; final MyReferralPatientModel myReferralInPatientModel; - final AddReferredRemarksRequestModel myReferralInPatientRequestModel; - final bool isEdited; + final AddReferredRemarksRequestModel? myReferralInPatientRequestModel; + final bool? isEdited; const AddReplayOnReferralPatient( - {Key? key, - this.patientReferralViewModel, - this.myReferralInPatientModel, + {Key? key, required this.patientReferralViewModel, required this.myReferralInPatientModel, this.isEdited, this.myReferralInPatientRequestModel}) : super(key: key); diff --git a/lib/screens/patients/profile/referral/ReplySummeryOnReferralPatient.dart b/lib/screens/patients/profile/referral/ReplySummeryOnReferralPatient.dart index 72bd6825..4c162ea5 100644 --- a/lib/screens/patients/profile/referral/ReplySummeryOnReferralPatient.dart +++ b/lib/screens/patients/profile/referral/ReplySummeryOnReferralPatient.dart @@ -38,7 +38,7 @@ class _ReplySummeryOnReferralPatientState builder: (_, model, w) => AppScaffold( baseViewModel: model, isShowAppBar: true, - appBarTitle: TranslationBase.of(context).summeryReply, + appBarTitle: TranslationBase.of(context).summeryReply!, body: Container( child: Column( children: [ diff --git a/lib/screens/patients/profile/referral/my-referral-inpatient-screen.dart b/lib/screens/patients/profile/referral/my-referral-inpatient-screen.dart index b2242ff7..94c1b66e 100644 --- a/lib/screens/patients/profile/referral/my-referral-inpatient-screen.dart +++ b/lib/screens/patients/profile/referral/my-referral-inpatient-screen.dart @@ -32,7 +32,7 @@ class _MyReferralInPatientScreenState extends State { builder: (_, model, w) => AppScaffold( baseViewModel: model, isShowAppBar: false, - appBarTitle: TranslationBase.of(context).referPatient, + appBarTitle: TranslationBase.of(context).referPatient ?? "", body: Column( children: [ Container( @@ -112,8 +112,8 @@ class _MyReferralInPatientScreenState extends State { child: PatientReferralItemWidget( referralStatus: model.getReferralStatusNameByCode( - model.myReferralPatients[index] - .referralStatus, + model.myReferralPatients[index]! + .referralStatus!, context), referralStatusCode: model .myReferralPatients[index] @@ -125,11 +125,11 @@ class _MyReferralInPatientScreenState extends State { .myReferralPatients[index].gender, referredDate: AppDateUtils .getDayMonthYearDateFormatted(model - .myReferralPatients[index] - .referralDate), + .myReferralPatients[index]! + .referralDate!), referredTime: AppDateUtils.getTimeHHMMA( - model.myReferralPatients[index] - .referralDate), + model.myReferralPatients[index]! + .referralDate!!), patientID: "${model.myReferralPatients[index].patientID}", isSameBranch: false, diff --git a/lib/screens/patients/profile/referral/my-referral-patient-screen.dart b/lib/screens/patients/profile/referral/my-referral-patient-screen.dart index 2eefeb43..03488886 100644 --- a/lib/screens/patients/profile/referral/my-referral-patient-screen.dart +++ b/lib/screens/patients/profile/referral/my-referral-patient-screen.dart @@ -17,7 +17,7 @@ class MyReferralPatientScreen extends StatelessWidget { builder: (_, model, w) => AppScaffold( baseViewModel: model, isShowAppBar: false, - appBarTitle: TranslationBase.of(context).referPatient, + appBarTitle: TranslationBase.of(context).referPatient ?? "", body: model.pendingReferral == null || model.pendingReferral.length == 0 ? Center( child: Column( @@ -50,49 +50,30 @@ class MyReferralPatientScreen extends StatelessWidget { model.pendingReferral.length, (index) => InkWell( onTap: () { - Navigator.of(context).pushNamed(MY_REFERRAL_DETAIL, - arguments: { - 'referral': model.pendingReferral[index] - }); + Navigator.of(context) + .pushNamed(MY_REFERRAL_DETAIL, arguments: {'referral': model.pendingReferral[index]}); }, child: PatientReferralItemWidget( - referralStatus: - model.pendingReferral[index].referralStatus, - patientName: - model.pendingReferral[index].patientName, - patientGender: model - .pendingReferral[index].patientDetails.gender, - referredDate: model - .pendingReferral[index].referredOn - .split(" ")[0], - referredTime: model - .pendingReferral[index].referredOn - .split(" ")[1], - patientID: - "${model.pendingReferral[index].patientID}", - isSameBranch: model.pendingReferral[index] - .isReferralDoctorSameBranch, + referralStatus: model.pendingReferral[index].referralStatus, + patientName: model.pendingReferral[index].patientName, + patientGender: model.pendingReferral[index].patientDetails?.gender, + referredDate: model.pendingReferral[index].referredOn!.split(" ")[0], + referredTime: model.pendingReferral[index].referredOn!.split(" ")[1], + patientID: "${model.pendingReferral[index].patientID}", + isSameBranch: model.pendingReferral[index].isReferralDoctorSameBranch, isReferral: true, - remark: - model.pendingReferral[index].remarksFromSource, - nationality: model.pendingReferral[index] - .patientDetails.nationalityName, - nationalityFlag: - model.pendingReferral[index].nationalityFlagUrl, - doctorAvatar: - model.pendingReferral[index].doctorImageUrl, - referralDoctorName: model - .pendingReferral[index].referredByDoctorInfo, + remark: model.pendingReferral[index].remarksFromSource, + nationality: model.pendingReferral[index].patientDetails!.nationalityName, + nationalityFlag: model.pendingReferral[index].nationalityFlagUrl, + doctorAvatar: model.pendingReferral[index].doctorImageUrl, + referralDoctorName: model.pendingReferral[index].referredByDoctorInfo, clinicDescription: null, infoIcon: InkWell( onTap: () { - Navigator.of(context) - .pushNamed(MY_REFERRAL_DETAIL, arguments: { - 'referral': model.pendingReferral[index] - }); + Navigator.of(context).pushNamed(MY_REFERRAL_DETAIL, + arguments: {'referral': model.pendingReferral[index]}); }, - child: Icon(FontAwesomeIcons.arrowRight, - size: 25, color: Colors.black), + child: Icon(FontAwesomeIcons.arrowRight, size: 25, color: Colors.black), ), ), ), diff --git a/lib/screens/patients/profile/referral/patient_referral_screen.dart b/lib/screens/patients/profile/referral/patient_referral_screen.dart index 59e58198..13bf0cb4 100644 --- a/lib/screens/patients/profile/referral/patient_referral_screen.dart +++ b/lib/screens/patients/profile/referral/patient_referral_screen.dart @@ -21,9 +21,8 @@ class PatientReferralScreen extends StatefulWidget { _PatientReferralScreen createState() => _PatientReferralScreen(); } -class _PatientReferralScreen extends State - with SingleTickerProviderStateMixin { - TabController _tabController; +class _PatientReferralScreen extends State with SingleTickerProviderStateMixin { + late TabController _tabController; int index = 0; @override @@ -52,9 +51,9 @@ class _PatientReferralScreen extends State return AppScaffold( isShowAppBar: true, appBar: PatientSearchHeader( - title: TranslationBase.of(context).patientsreferral, + title: TranslationBase.of(context).patientsreferral!, ), - appBarTitle: TranslationBase.of(context).patientsreferral, + appBarTitle: TranslationBase.of(context).patientsreferral!, body: Scaffold( extendBodyBehindAppBar: true, // backgroundColor: Colors.white, @@ -81,7 +80,7 @@ class _PatientReferralScreen extends State decoration: Helpers.getBoxTabsBoxDecoration( isActive: index == 0, isFirst: true, projectViewModel:projectsProvider ), child: Center( - child: Helpers.getTabText(title:TranslationBase.of(context).myReferredPatient, isActive:index == 0 ) + child: Helpers.getTabText(title:TranslationBase.of(context).myReferredPatient!, isActive:index == 0 ) ), ), Center( @@ -89,7 +88,7 @@ class _PatientReferralScreen extends State decoration:Helpers.getBoxTabsBoxDecoration( isActive: index == 1, isMiddle: true, projectViewModel:projectsProvider ), child: Center( - child:Helpers.getTabText(title:TranslationBase.of(context).referral, isActive:index == 1 ) + child:Helpers.getTabText(title:TranslationBase.of(context).referral!, isActive:index == 1 ) ), ), ), @@ -98,7 +97,7 @@ class _PatientReferralScreen extends State decoration:Helpers.getBoxTabsBoxDecoration( isActive: index == 2, isLast: true, projectViewModel:projectsProvider ), child: Center( - child: Helpers.getTabText(title:TranslationBase.of(context).discharged, isActive:index == 2 ), + child: Helpers.getTabText(title:TranslationBase.of(context).discharged!, isActive:index == 2 ), ), ), ), diff --git a/lib/screens/patients/profile/referral/refer-patient-screen-in-patient.dart b/lib/screens/patients/profile/referral/refer-patient-screen-in-patient.dart index a6502733..4fab04fb 100644 --- a/lib/screens/patients/profile/referral/refer-patient-screen-in-patient.dart +++ b/lib/screens/patients/profile/referral/refer-patient-screen-in-patient.dart @@ -5,6 +5,7 @@ import 'package:doctor_app_flutter/core/provider/robot_provider.dart'; import 'package:doctor_app_flutter/core/viewModel/patient-referral-viewmodel.dart'; import 'package:doctor_app_flutter/icons_app/doctor_app_icons.dart'; import 'package:doctor_app_flutter/models/patient/patiant_info_model.dart'; +import 'package:doctor_app_flutter/models/patient/profile/patient_profile_app_bar_model.dart'; import 'package:doctor_app_flutter/screens/base/base_view.dart'; import 'package:doctor_app_flutter/util/dr_app_toast_msg.dart'; import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; @@ -31,8 +32,8 @@ class PatientMakeInPatientReferralScreen extends StatefulWidget { class _PatientMakeInPatientReferralScreenState extends State { - PatiantInformtion patient; - List referToList; + late PatiantInformtion patient; + late List referToList; dynamic _referTo; dynamic _selectedBranch; dynamic _selectedClinic; @@ -41,13 +42,13 @@ class _PatientMakeInPatientReferralScreenState final _remarksController = TextEditingController(); final _extController = TextEditingController(); int _activePriority = 1; - String appointmentDate; + late String appointmentDate; - String branchError; - String hospitalError; - String clinicError; - String doctorError; - String frequencyError; + String? branchError; + String? hospitalError; + String? clinicError; + String? doctorError; + String? frequencyError; stt.SpeechToText speech = stt.SpeechToText(); var reconizedWord; var event = RobotProvider(); @@ -121,7 +122,7 @@ class _PatientMakeInPatientReferralScreenState @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']; @@ -144,12 +145,10 @@ class _PatientMakeInPatientReferralScreenState onModelReady: (model) => model.getReferralFrequencyList(), builder: (_, model, w) => AppScaffold( baseViewModel: model, - appBarTitle: TranslationBase.of(context).referPatient, + appBarTitle: TranslationBase.of(context).referPatient!, isShowAppBar: true, - appBar: PatientProfileAppBar( - patient, - isInpatient: isInpatient, - ), + patientProfileAppBarModel: PatientProfileAppBarModel( + patient: patient, isInpatient:isInpatient,), body: SingleChildScrollView( child: Container( child: Column( @@ -593,9 +592,9 @@ class _PatientMakeInPatientReferralScreenState Widget priorityBar(BuildContext _context, Size screenSize) { List _priorities = [ - TranslationBase.of(context).veryUrgent.toUpperCase(), - TranslationBase.of(context).urgent.toUpperCase(), - TranslationBase.of(context).routine.toUpperCase(), + TranslationBase.of(context).veryUrgent!.toUpperCase(), + TranslationBase.of(context).urgent!.toUpperCase(), + TranslationBase.of(context).routine!.toUpperCase(), ]; return Container( height: screenSize.height * 0.070, diff --git a/lib/screens/patients/profile/referral/refer-patient-screen.dart b/lib/screens/patients/profile/referral/refer-patient-screen.dart index 850e017e..5ade907e 100644 --- a/lib/screens/patients/profile/referral/refer-patient-screen.dart +++ b/lib/screens/patients/profile/referral/refer-patient-screen.dart @@ -4,6 +4,7 @@ import 'package:doctor_app_flutter/core/service/AnalyticsService.dart'; import 'package:doctor_app_flutter/core/viewModel/patient-referral-viewmodel.dart'; import 'package:doctor_app_flutter/locator.dart'; import 'package:doctor_app_flutter/models/patient/patiant_info_model.dart'; +import 'package:doctor_app_flutter/models/patient/profile/patient_profile_app_bar_model.dart'; import 'package:doctor_app_flutter/screens/base/base_view.dart'; import 'package:doctor_app_flutter/util/date-utils.dart'; import 'package:doctor_app_flutter/util/dr_app_toast_msg.dart'; @@ -23,24 +24,23 @@ import 'package:hexcolor/hexcolor.dart'; class PatientMakeReferralScreen extends StatefulWidget { // previous design page is: ReferPatientScreen @override - _PatientMakeReferralScreenState createState() => - _PatientMakeReferralScreenState(); + _PatientMakeReferralScreenState createState() => _PatientMakeReferralScreenState(); } class _PatientMakeReferralScreenState extends State { - PatiantInformtion patient; - List referToList; + late PatiantInformtion patient; + late List referToList; dynamic _referTo; dynamic _selectedBranch; dynamic _selectedClinic; dynamic _selectedDoctor; - DateTime appointmentDate; + late DateTime appointmentDate; final _remarksController = TextEditingController(); - String branchError = null; - String hospitalError = null; - String clinicError = null; - String doctorError = null; + String? branchError = null; + String? hospitalError = null; + String? clinicError = null; + String? doctorError = null; @override void initState() { @@ -51,7 +51,7 @@ 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']; @@ -74,9 +74,9 @@ class _PatientMakeReferralScreenState extends State { onModelReady: (model) => model.getPatientReferral(patient), builder: (_, model, w) => AppScaffold( baseViewModel: model, - appBarTitle: TranslationBase.of(context).referPatient, + appBarTitle: TranslationBase.of(context).referPatient!, isShowAppBar: true, - appBar: PatientProfileAppBar(patient), + patientProfileAppBarModel: PatientProfileAppBarModel(patient:patient), body: SingleChildScrollView( child: Container( child: Column( @@ -110,57 +110,25 @@ 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, - referredDate: model - .patientReferral[ - model.patientReferral.length - 1] - .referredOn - .split(" ")[0], - referredTime: model - .patientReferral[ - model.patientReferral.length - 1] - .referredOn - .split(" ")[1], - patientID: - "${model.patientReferral[model.patientReferral.length - 1].patientID}", - isSameBranch: model - .patientReferral[ - model.patientReferral.length - 1] - .isReferralDoctorSameBranch, + 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, + referredDate: + model.patientReferral[model.patientReferral.length - 1].referredOn?.split(" ")[0], + referredTime: + model.patientReferral[model.patientReferral.length - 1].referredOn?.split(" ")[1], + 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, + 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, ), ], @@ -180,26 +148,22 @@ class _PatientMakeReferralScreenState extends State { setState(() { if (_referTo == null) { - branchError = - TranslationBase.of(context).fieldRequired; + branchError = TranslationBase.of(context).fieldRequired!; } else { branchError = null; } if (_selectedBranch == null) { - hospitalError = - TranslationBase.of(context).fieldRequired; + hospitalError = TranslationBase.of(context).fieldRequired!; } else { hospitalError = null; } if (_selectedClinic == null) { - clinicError = - TranslationBase.of(context).fieldRequired; + clinicError = TranslationBase.of(context).fieldRequired!; } else { clinicError = null; } if (_selectedDoctor == null) { - doctorError = - TranslationBase.of(context).fieldRequired; + doctorError = TranslationBase.of(context).fieldRequired!; } else { doctorError = null; } @@ -443,10 +407,11 @@ class _PatientMakeReferralScreenState extends State { enabled: false, isTextFieldHasSuffix: true, suffixIcon: IconButton( + onPressed: () {}, icon: Icon( - Icons.calendar_today, - color: Colors.black, - )), + Icons.calendar_today, + color: Colors.black, + )), onClick: () { _selectDate(context, model); }, @@ -469,12 +434,12 @@ 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)), lastDate: DateTime(2040), - initialEntryMode: DatePickerEntryMode.calendar, + initialEntryMode: DatePickerEntryMode.calendar!, ); if (picked != null && picked != appointmentDate) { setState(() { diff --git a/lib/screens/patients/profile/referral/referral_patient_detail_in-paint.dart b/lib/screens/patients/profile/referral/referral_patient_detail_in-paint.dart index d88d5a95..fb694a0d 100644 --- a/lib/screens/patients/profile/referral/referral_patient_detail_in-paint.dart +++ b/lib/screens/patients/profile/referral/referral_patient_detail_in-paint.dart @@ -22,7 +22,6 @@ import 'AddReplayOnReferralPatient.dart'; class ReferralPatientDetailScreen extends StatelessWidget { final MyReferralPatientModel referredPatient; final PatientReferralViewModel patientReferralViewModel; - ReferralPatientDetailScreen(this.referredPatient, this.patientReferralViewModel); @override @@ -140,7 +139,7 @@ class ReferralPatientDetailScreen extends StatelessWidget { mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ AppText( - "${model.getReferralStatusNameByCode(referredPatient.referralStatus, context)}", + "${model.getReferralStatusNameByCode(referredPatient.referralStatus!, context)}", fontFamily: 'Poppins', fontSize: 1.7 * SizeConfig.textMultiplier, fontWeight: FontWeight.w700, @@ -152,7 +151,7 @@ class ReferralPatientDetailScreen extends StatelessWidget { ), AppText( AppDateUtils.getDayMonthYearDateFormatted( - referredPatient.referralDate, + referredPatient.referralDate!, ), fontFamily: 'Poppins', fontWeight: FontWeight.w600, @@ -185,7 +184,7 @@ class ReferralPatientDetailScreen extends StatelessWidget { ), AppText( AppDateUtils.getTimeHHMMA( - referredPatient.referralDate, + referredPatient.referralDate!, ), fontFamily: 'Poppins', fontWeight: FontWeight.w600, @@ -223,29 +222,28 @@ class ReferralPatientDetailScreen extends StatelessWidget { ), ], ), - if (referredPatient.frequency != null) - Row( - mainAxisAlignment: MainAxisAlignment.start, - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - AppText( - TranslationBase.of(context).frequency + ": ", + if (referredPatient.frequency != null)Row( + mainAxisAlignment: MainAxisAlignment.start, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + AppText( + TranslationBase.of(context).frequency! + ": ", + fontFamily: 'Poppins', + fontWeight: FontWeight.w600, + fontSize: 1.5 * SizeConfig.textMultiplier, + color: Color(0XFF575757), + ), + Expanded( + child: AppText( + referredPatient.frequencyDescription?? '', fontFamily: 'Poppins', - fontWeight: FontWeight.w600, - fontSize: 1.5 * SizeConfig.textMultiplier, - color: Color(0XFF575757), - ), - Expanded( - child: AppText( - referredPatient.frequencyDescription ?? '', - fontFamily: 'Poppins', - fontWeight: FontWeight.w700, - fontSize: 1.6 * SizeConfig.textMultiplier, - color: Color(0XFF2E303A), - ), + fontWeight: FontWeight.w700, + fontSize: 1.6 * SizeConfig.textMultiplier, + color: Color(0XFF2E303A), ), - ], - ), + ), + ], + ), ], ), ), @@ -263,11 +261,11 @@ class ReferralPatientDetailScreen extends StatelessWidget { ? ClipRRect( borderRadius: BorderRadius.circular(20.0), child: Image.network( - referredPatient.nationalityFlagURL, + referredPatient.nationalityFlagURL!, height: 25, width: 30, errorBuilder: - (BuildContext context, Object exception, StackTrace stackTrace) { + (BuildContext context, Object exception, StackTrace? stackTrace) { return Text('No Image'); }, )) @@ -282,7 +280,7 @@ class ReferralPatientDetailScreen extends StatelessWidget { crossAxisAlignment: CrossAxisAlignment.start, children: [ AppText( - TranslationBase.of(context).priority + ": ", + TranslationBase.of(context).priority! + ": ", fontFamily: 'Poppins', fontWeight: FontWeight.w600, fontSize: 1.5 * SizeConfig.textMultiplier, @@ -290,7 +288,7 @@ class ReferralPatientDetailScreen extends StatelessWidget { ), Expanded( child: AppText( - referredPatient.priorityDescription ?? '', + referredPatient.priorityDescription! ?? '', fontFamily: 'Poppins', fontWeight: FontWeight.w700, fontSize: 1.6 * SizeConfig.textMultiplier, @@ -305,7 +303,7 @@ class ReferralPatientDetailScreen extends StatelessWidget { crossAxisAlignment: CrossAxisAlignment.start, children: [ AppText( - TranslationBase.of(context).maxResponseTime + ": ", + TranslationBase.of(context).maxResponseTime! + ": ", fontFamily: 'Poppins', fontWeight: FontWeight.w600, fontSize: 1.5 * SizeConfig.textMultiplier, @@ -315,7 +313,7 @@ class ReferralPatientDetailScreen extends StatelessWidget { child: AppText( referredPatient.mAXResponseTime != null ? AppDateUtils.convertDateFromServerFormat( - referredPatient.mAXResponseTime, "dd MMM,yyyy") + referredPatient.mAXResponseTime!, "dd MMM,yyyy") : '', fontFamily: 'Poppins', fontWeight: FontWeight.w700, @@ -343,11 +341,11 @@ class ReferralPatientDetailScreen 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) { + (BuildContext context, Object exception, StackTrace? stackTrace) { return Text(''); }, )) @@ -437,7 +435,7 @@ class ReferralPatientDetailScreen extends StatelessWidget { ), ), if (referredPatient.referredDoctorRemarks != null && - referredPatient.referredDoctorRemarks.isNotEmpty) + referredPatient.referredDoctorRemarks!.isNotEmpty) Container( width: double.infinity, margin: EdgeInsets.symmetric(horizontal: 16, vertical: 0), @@ -501,7 +499,7 @@ class ReferralPatientDetailScreen extends StatelessWidget { patientReferralViewModel: patientReferralViewModel, myReferralInPatientModel: referredPatient, isEdited: referredPatient.referredDoctorRemarks != null && - referredPatient.referredDoctorRemarks.isNotEmpty, + referredPatient.referredDoctorRemarks!.isNotEmpty, ), ), ); diff --git a/lib/screens/patients/profile/referral/referred-patient-screen.dart b/lib/screens/patients/profile/referral/referred-patient-screen.dart index 354ee04f..facead22 100644 --- a/lib/screens/patients/profile/referral/referred-patient-screen.dart +++ b/lib/screens/patients/profile/referral/referred-patient-screen.dart @@ -27,7 +27,7 @@ class _ReferredPatientScreenState extends State { builder: (_, model, w) => AppScaffold( baseViewModel: model, isShowAppBar: false, - appBarTitle: TranslationBase.of(context).referredPatient, + appBarTitle: TranslationBase.of(context).referredPatient!, body: Column( children: [ Container( @@ -107,13 +107,13 @@ class _ReferredPatientScreenState extends State { .convertDateFromServerFormat( model .getReferredPatientItem(index) - .referralDate, + .referralDate!, "dd/MM/yyyy"), referredTime: AppDateUtils .convertDateFromServerFormat( model .getReferredPatientItem(index) - .referralDate, + .referralDate!, "hh:mm a"), patientID: "${model.getReferredPatientItem(index).patientID}", @@ -182,9 +182,9 @@ 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; + patientType = value!; radioOnChange(value); }); }, @@ -195,10 +195,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/referred_patient_detail_in-paint.dart b/lib/screens/patients/profile/referral/referred_patient_detail_in-paint.dart index 21634d0f..04cf6a1d 100644 --- a/lib/screens/patients/profile/referral/referred_patient_detail_in-paint.dart +++ b/lib/screens/patients/profile/referral/referred_patient_detail_in-paint.dart @@ -163,8 +163,7 @@ class ReferredPatientDetailScreen extends StatelessWidget { ), AppText( AppDateUtils.convertDateFromServerFormat( - referredPatient.referralDate, - "dd MMM,yyyy"), + referredPatient.referralDate ?? "", "dd MMM,yyyy"), fontFamily: 'Poppins', fontWeight: FontWeight.w600, fontSize: 2.0 * SizeConfig.textMultiplier, @@ -200,8 +199,7 @@ class ReferredPatientDetailScreen extends StatelessWidget { ), AppText( AppDateUtils.convertDateFromServerFormat( - referredPatient.referralDate, - "hh:mm a"), + referredPatient.referralDate ?? "", "hh:mm a"), fontFamily: 'Poppins', fontWeight: FontWeight.w600, fontSize: 1.8 * SizeConfig.textMultiplier, @@ -252,7 +250,7 @@ class ReferredPatientDetailScreen extends StatelessWidget { children: [ AppText( TranslationBase.of(context) - .frequency + + .frequency! + ": ", fontFamily: 'Poppins', fontWeight: FontWeight.w600, @@ -294,13 +292,11 @@ 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) { + errorBuilder: + (BuildContext context, Object exception, StackTrace? stackTrace) { return Text('No Image'); }, )) @@ -316,7 +312,7 @@ class ReferredPatientDetailScreen extends StatelessWidget { CrossAxisAlignment.start, children: [ AppText( - TranslationBase.of(context).priority + + TranslationBase.of(context).priority! + ": ", fontFamily: 'Poppins', fontWeight: FontWeight.w600, @@ -341,7 +337,7 @@ class ReferredPatientDetailScreen extends StatelessWidget { children: [ AppText( TranslationBase.of(context) - .maxResponseTime + + .maxResponseTime! + ": ", fontFamily: 'Poppins', fontWeight: FontWeight.w600, @@ -356,7 +352,7 @@ class ReferredPatientDetailScreen extends StatelessWidget { ? AppDateUtils .convertDateFromServerFormat( referredPatient - .mAXResponseTime, + .mAXResponseTime!, "dd MMM,yyyy") : '', fontFamily: 'Poppins', @@ -394,13 +390,11 @@ 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) { + (BuildContext context, Object exception, StackTrace? stackTrace) { return Text('No Image'); }, )) @@ -503,12 +497,10 @@ 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) { + errorBuilder: (BuildContext context, Object exception, StackTrace? stackTrace) { return Text('No Image'); }, )) @@ -536,7 +528,7 @@ class ReferredPatientDetailScreen extends StatelessWidget { referredPatient.referredDoctorRemarks == null ? '' - : referredPatient.referredDoctorRemarks + : referredPatient.referredDoctorRemarks! .isNotEmpty ? referredPatient .referredDoctorRemarks @@ -570,7 +562,7 @@ class ReferredPatientDetailScreen extends StatelessWidget { vPadding: 12, disabled: referredPatient.referredDoctorRemarks == null ? true - : referredPatient.referredDoctorRemarks.isNotEmpty + : referredPatient.referredDoctorRemarks!.isNotEmpty ? false : true, onPressed: () async { 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 af55c61b..1972b167 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 @@ -29,17 +29,17 @@ class AddAssessmentDetails extends StatefulWidget { final MySelectedAssessment mySelectedAssessment; final List mySelectedAssessmentList; final Function(MySelectedAssessment mySelectedAssessment, bool isUpdate) - addSelectedAssessment; + addSelectedAssessment; final PatiantInformtion patientInfo; final bool isUpdate; AddAssessmentDetails( - {Key ? key, - this.mySelectedAssessment, - this.addSelectedAssessment, - this.patientInfo, - this.isUpdate = false, - this.mySelectedAssessmentList}); + {Key? key, + required this.mySelectedAssessment, + required this.addSelectedAssessment, + required this.patientInfo, + this.isUpdate = false, + required this.mySelectedAssessmentList}); @override _AddAssessmentDetailsState createState() => _AddAssessmentDetailsState(); @@ -60,48 +60,37 @@ class _AddAssessmentDetailsState extends State { ProjectViewModel projectViewModel = Provider.of(context); remarkController.text = widget.mySelectedAssessment.remark ?? ""; - appointmentIdController.text = - widget.mySelectedAssessment.appointmentId.toString(); + 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; + ? 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; + ? widget.mySelectedAssessment.selectedDiagnosisType!.nameAr ?? "" + : widget.mySelectedAssessment.selectedDiagnosisType!.nameEn ?? ""; if (widget.mySelectedAssessment.selectedICD != null) - icdNameController.text = widget.mySelectedAssessment.selectedICD.code; + 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, @@ -135,9 +124,7 @@ class _AddAssessmentDetailsState extends State { FractionallySizedBox( widthFactor: 0.9, child: Container( - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ + child: Column(crossAxisAlignment: CrossAxisAlignment.start, children: [ SizedBox( height: 16, ), @@ -145,10 +132,7 @@ class _AddAssessmentDetailsState extends State { margin: EdgeInsets.only(left: 0, right: 0, top: 15), child: AppTextFieldCustom( // height: 55.0, - height: Helpers.getTextFieldHeight(), - - hintText: - TranslationBase.of(context).appointmentNumber, + height: Helpers.getTextFieldHeight(),hintText: TranslationBase.of(context).appointmentNumber, isTextFieldHasSuffix: false, enabled: false, controller: appointmentIdController, @@ -161,155 +145,109 @@ class _AddAssessmentDetailsState extends State { child: InkWell( onTap: model.listOfICD10 != null ? () { - setState(() { - widget.mySelectedAssessment - .selectedICD = null; - icdNameController.text = null; - }); - } + setState(() { + widget.mySelectedAssessment.selectedICD = null; + icdNameController.text = null!; + }); + } : null, - child: widget - .mySelectedAssessment.selectedICD == - 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: Helpers.getTextFieldHeight(), + 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}'; + }), + 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: Helpers.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, - )), + ? () { + 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( + onPressed: () {}, + 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, - ), - ), - ], + 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: Helpers.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, + height: Helpers.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, @@ -317,10 +255,8 @@ class _AddAssessmentDetailsState extends State { isTextFieldHasSuffix: true, enabled: false, hasBorder: true, - validationError: isFormSubmitted && - widget.mySelectedAssessment - .selectedDiagnosisCondition == - null + validationError: + isFormSubmitted && widget.mySelectedAssessment.selectedDiagnosisCondition == null ? TranslationBase.of(context).emptyMessage : null, ), @@ -328,36 +264,28 @@ class _AddAssessmentDetailsState extends State { height: 10, ), AppTextFieldCustom( - height: Helpers.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; - }, - ); - } - : null, + height: Helpers.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; + }, + ); + } + : null, hintText: TranslationBase.of(context).dType, maxLines: 1, minLines: 1, @@ -365,10 +293,7 @@ class _AddAssessmentDetailsState extends State { isTextFieldHasSuffix: true, controller: typeController, hasBorder: true, - validationError: isFormSubmitted && - widget.mySelectedAssessment - .selectedDiagnosisType == - null + validationError: isFormSubmitted && widget.mySelectedAssessment.selectedDiagnosisType == null ? TranslationBase.of(context).emptyMessage : null, ), @@ -384,8 +309,7 @@ class _AddAssessmentDetailsState extends State { inputType: TextInputType.multiline, controller: remarkController, onChanged: (value) { - widget.mySelectedAssessment.remark = - remarkController.text; + widget.mySelectedAssessment.remark = remarkController.text; }, ), ), @@ -402,31 +326,23 @@ class _AddAssessmentDetailsState extends State { bottomSheet: model.state == ViewState.Busy?Container(height: 0,): BottomSheetDialogButton( - 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.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); + mySelectedAssessment: widget.mySelectedAssessment); } }, + ), ), ), @@ -434,9 +350,7 @@ class _AddAssessmentDetailsState extends State { } submitAssessment( - {SOAPViewModel model, - MySelectedAssessment mySelectedAssessment, - bool isUpdate = false}) async { + {required SOAPViewModel model, required MySelectedAssessment mySelectedAssessment, bool isUpdate = false}) async { GifLoaderDialogUtils.showMyDialog(context); if (isUpdate) { PatchAssessmentReqModel patchAssessmentReqModel = PatchAssessmentReqModel( @@ -445,25 +359,24 @@ class _AddAssessmentDetailsState extends State { 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); } else { - PostAssessmentRequestModel postAssessmentRequestModel = - new PostAssessmentRequestModel( - patientMRN: widget.patientInfo.patientMRN, - episodeId: widget.patientInfo.episodeNo, - appointmentNo: widget.patientInfo.appointmentNo, - icdCodeDetails: [ + 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) + conditionId: mySelectedAssessment.selectedDiagnosisCondition!.id, + diagnosisTypeId: mySelectedAssessment.selectedDiagnosisType!.id, + icdcode10Id: mySelectedAssessment.selectedICD!.code) ]); await model.postAssessment(postAssessmentRequestModel); @@ -476,9 +389,9 @@ class _AddAssessmentDetailsState extends State { Map profile = await sharedPref.getObj(DOCTOR_PROFILE); DoctorProfileModel doctorProfile = DoctorProfileModel.fromJson(profile); - mySelectedAssessment.icdCode10ID = mySelectedAssessment.selectedICD.code; - mySelectedAssessment.doctorName = doctorProfile!.doctorName; - widget.addSelectedAssessment(mySelectedAssessment, isUpdate); + mySelectedAssessment.icdCode10ID = mySelectedAssessment.selectedICD!.code; + mySelectedAssessment.doctorName = doctorProfile.doctorName; + 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 836b0356..963efb36 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 @@ -30,13 +30,12 @@ class UpdateAssessmentPage extends StatefulWidget { final PatiantInformtion patientInfo; final Function changeLoadingState; final int currentIndex; - UpdateAssessmentPage( - {Key ? key, - this.changePageViewIndex, - this.patientInfo, - this.changeLoadingState, - this.currentIndex}); + {Key? key, + required this.changePageViewIndex, + required this.patientInfo, + required this.changeLoadingState, + required this.currentIndex}); @override _UpdateAssessmentPageState createState() => _UpdateAssessmentPageState(); @@ -56,37 +55,34 @@ 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) { - MasterKeyModel diagnosisType = model.getOneMasterKey( + MasterKeyModel? diagnosisType = model.getOneMasterKey( masterKeys: MasterKeysService.DiagnosisType, id: element.diagnosisTypeID, ); - MasterKeyModel selectedICD = model.getOneMasterKey( + MasterKeyModel? selectedICD = model.getOneMasterKey( masterKeys: MasterKeysService.ICD10, id: element.icdCode10ID, ); - MasterKeyModel diagnosisCondition = model.getOneMasterKey( + MasterKeyModel? diagnosisCondition = model.getOneMasterKey( masterKeys: MasterKeysService.DiagnosisCondition, id: element.conditionID, ); - if (diagnosisCondition != null && - diagnosisType != null && - diagnosisCondition != null) { - MySelectedAssessment temMySelectedAssessment = - SoapUtils.generateMySelectedAssessment( - appointmentNo: element.appointmentNo, - remark: element.remarks, - diagnosisType: diagnosisType, - diagnosisCondition: diagnosisCondition, - selectedICD: selectedICD, - doctorID: element.doctorID, - doctorName: element.doctorName, - createdBy: element.createdBy, - createdOn: element.createdOn, - icdCode10ID: element.icdCode10ID); + if (diagnosisCondition != null && diagnosisType != null && diagnosisCondition != null) { + MySelectedAssessment temMySelectedAssessment = SoapUtils.generateMySelectedAssessment( + appointmentNo: element.appointmentNo, + remark: element.remarks, + diagnosisType: diagnosisType, + diagnosisCondition: diagnosisCondition, + selectedICD: selectedICD, + doctorID: element.doctorID, + doctorName: element.doctorName, + createdBy: element.createdBy, + createdOn: element.createdOn, + icdCode10ID: element.icdCode10ID); mySelectedAssessmentList.add(temMySelectedAssessment); } @@ -128,7 +124,7 @@ class _UpdateAssessmentPageState extends State children: [ SOAPOpenItems( label: - "${TranslationBase.of(context).addAssessment}", + "${TranslationBase.of(context).addAssessment}", onTap: () { openAssessmentDialog(context, isUpdate: false, model: model); @@ -139,25 +135,25 @@ class _UpdateAssessmentPageState extends State ), Column( children: - mySelectedAssessmentList.map((assessment) { + mySelectedAssessmentList.map((assessment) { return Container( margin: EdgeInsets.only( left: 5, right: 5, top: 15, bottom: 15), child: Row( mainAxisAlignment: - MainAxisAlignment.spaceBetween, + MainAxisAlignment.spaceBetween, crossAxisAlignment: - CrossAxisAlignment.start, + CrossAxisAlignment.start, children: [ Column( crossAxisAlignment: - CrossAxisAlignment.start, + CrossAxisAlignment.start, children: [ RichText( text: new TextSpan( style: new TextStyle( fontSize: SizeConfig - .getTextMultiplierBasedOnWidth() * + .getTextMultiplierBasedOnWidth() * 3.6, color: Color(0xFF2E303A), fontFamily: 'Poppins', @@ -169,23 +165,23 @@ class _UpdateAssessmentPageState extends State ), new TextSpan( text: assessment - .selectedICD!.code - .trim() - .toUpperCase() ?? + .selectedICD!.code + .trim() + .toUpperCase() ?? ""), ], ), ), Container( width: MediaQuery.of(context) - .size - .width * + .size + .width * 0.50, child: RichText( text: new TextSpan( style: new TextStyle( fontSize: SizeConfig - .getTextMultiplierBasedOnWidth() * + .getTextMultiplierBasedOnWidth() * 5, color: Color(0xFF2E303A), fontFamily: 'Poppins', @@ -206,7 +202,7 @@ class _UpdateAssessmentPageState extends State text: new TextSpan( style: new TextStyle( fontSize: SizeConfig - .getTextMultiplierBasedOnWidth() * + .getTextMultiplierBasedOnWidth() * 3.5, color: Color(0xFF2E303A), fontFamily: 'Poppins', @@ -215,11 +211,11 @@ class _UpdateAssessmentPageState extends State children: [ new TextSpan( text: TranslationBase.of( - context) + context) .appointmentNo, style: new TextStyle( fontSize: SizeConfig - .getTextMultiplierBasedOnWidth() * + .getTextMultiplierBasedOnWidth() * 3, letterSpacing: -0.4, color: Color(0xFF575757), @@ -227,11 +223,11 @@ class _UpdateAssessmentPageState extends State ), new TextSpan( text: assessment.appointmentId - .toString() ?? + .toString() ?? "", style: new TextStyle( fontSize: SizeConfig - .getTextMultiplierBasedOnWidth() * + .getTextMultiplierBasedOnWidth() * 3.6, letterSpacing: -0.48, color: Color(0xFF2B353E), @@ -244,7 +240,7 @@ class _UpdateAssessmentPageState extends State text: new TextSpan( style: new TextStyle( fontSize: SizeConfig - .getTextMultiplierBasedOnWidth() * + .getTextMultiplierBasedOnWidth() * 3, color: Color(0xFF2E303A), fontFamily: 'Poppins', @@ -252,8 +248,8 @@ class _UpdateAssessmentPageState extends State children: [ new TextSpan( text: TranslationBase.of( - context) - .condition! + + context) + .condition! + " : ", style: new TextStyle( letterSpacing: -0.4, @@ -262,16 +258,16 @@ class _UpdateAssessmentPageState extends State ), new TextSpan( text: projectViewModel - .isArabic + .isArabic ? assessment - .selectedDiagnosisCondition! - .nameAr! + .selectedDiagnosisCondition! + .nameAr! : assessment - .selectedDiagnosisCondition! - .nameEn!, + .selectedDiagnosisCondition! + .nameEn!, style: new TextStyle( fontSize: SizeConfig - .getTextMultiplierBasedOnWidth() * + .getTextMultiplierBasedOnWidth() * 3.6, letterSpacing: -0.48, color: Color(0xFF2B353E), @@ -284,7 +280,7 @@ class _UpdateAssessmentPageState extends State text: new TextSpan( style: new TextStyle( fontSize: SizeConfig - .getTextMultiplierBasedOnWidth() * + .getTextMultiplierBasedOnWidth() * 3, color: Color(0xFF2E303A), fontFamily: 'Poppins', @@ -292,8 +288,8 @@ class _UpdateAssessmentPageState extends State children: [ new TextSpan( text: TranslationBase.of( - context) - .dType! + + context) + .dType! + ' : ', style: new TextStyle( letterSpacing: -0.4, @@ -302,16 +298,16 @@ class _UpdateAssessmentPageState extends State ), new TextSpan( text: projectViewModel - .isArabic + .isArabic ? assessment - .selectedDiagnosisType! - .nameAr + .selectedDiagnosisType! + .nameAr : assessment - .selectedDiagnosisType! - .nameEn, + .selectedDiagnosisType! + .nameEn, style: new TextStyle( fontSize: SizeConfig - .getTextMultiplierBasedOnWidth() * + .getTextMultiplierBasedOnWidth() * 3.6, letterSpacing: -0.48, color: Color(0xFF2B353E), @@ -325,21 +321,21 @@ class _UpdateAssessmentPageState extends State text: new TextSpan( style: new TextStyle( fontSize: SizeConfig - .getTextMultiplierBasedOnWidth() * + .getTextMultiplierBasedOnWidth() * 3.6, color: Color(0xFF2E303A), fontFamily: 'Poppins', fontWeight: - FontWeight.w600), + FontWeight.w600), children: [ new TextSpan( text: TranslationBase.of( - context) - .doctor! + + context) + .doctor! + ' : ', style: new TextStyle( fontSize: SizeConfig - .getTextMultiplierBasedOnWidth() * + .getTextMultiplierBasedOnWidth() * 3, letterSpacing: -0.4, color: Color(0xFF575757), @@ -347,11 +343,11 @@ class _UpdateAssessmentPageState extends State ), new TextSpan( text: - assessment.doctorName ?? - '', + assessment.doctorName ?? + '', style: new TextStyle( fontSize: SizeConfig - .getTextMultiplierBasedOnWidth() * + .getTextMultiplierBasedOnWidth() * 3.6, letterSpacing: -0.48, color: Color(0xFF2B353E), @@ -365,24 +361,24 @@ class _UpdateAssessmentPageState extends State ), Row( mainAxisAlignment: - MainAxisAlignment.start, + MainAxisAlignment.start, crossAxisAlignment: - CrossAxisAlignment.start, + CrossAxisAlignment.start, children: [ SizedBox( height: 6, ), AppText( (assessment.remark != null && - assessment.remark != - '') + assessment.remark != + '') ? TranslationBase.of( - context) - .remarks! + - " : " + context) + .remarks! + + " : " : '', fontSize: SizeConfig - .getTextMultiplierBasedOnWidth() * + .getTextMultiplierBasedOnWidth() * 3, color: Color(0xFF2E303A), fontFamily: 'Poppins', @@ -396,41 +392,41 @@ class _UpdateAssessmentPageState extends State ), Column( crossAxisAlignment: - CrossAxisAlignment.end, + CrossAxisAlignment.end, children: [ Row( children: [ Column( crossAxisAlignment: - CrossAxisAlignment.end, + CrossAxisAlignment.end, children: [ AppText( assessment.createdOn != null ? AppDateUtils - .getDayMonthYearDateFormatted( - DateTime.parse( - assessment! - .createdOn!)) + .getDayMonthYearDateFormatted( + DateTime.parse( + assessment! + .createdOn!)) : AppDateUtils - .getDayMonthYearDateFormatted( - DateTime.now()), + .getDayMonthYearDateFormatted( + DateTime.now()), fontWeight: FontWeight.w600, fontSize: SizeConfig - .getTextMultiplierBasedOnWidth() * + .getTextMultiplierBasedOnWidth() * 3.6, ), AppText( assessment.createdOn != null ? AppDateUtils.getHour( - DateTime.parse( - assessment! - .createdOn!)) + DateTime.parse( + assessment! + .createdOn!)) : AppDateUtils.getHour( - DateTime.now()), + DateTime.now()), fontWeight: FontWeight.w600, color: Color(0xFF575757), fontSize: SizeConfig - .getTextMultiplierBasedOnWidth() * + .getTextMultiplierBasedOnWidth() * 3.6, ), ], @@ -439,8 +435,8 @@ class _UpdateAssessmentPageState extends State ), SizedBox( height: MediaQuery.of(context) - .size - .height * + .size + .height * 0.05, ), InkWell( @@ -481,10 +477,9 @@ class _UpdateAssessmentPageState extends State } openAssessmentDialog(BuildContext context, - {MySelectedAssessment assessment, bool isUpdate, SOAPViewModel model}) { + {MySelectedAssessment? assessment, required bool isUpdate, required SOAPViewModel model}) { if (assessment == null) { - assessment = SoapUtils.generateMySelectedAssessment( - remark: '', appointmentNo: widget.patientInfo.appointmentNo); + assessment = SoapUtils.generateMySelectedAssessment(remark: '', appointmentNo: widget.patientInfo.appointmentNo); } showModalBottomSheet( backgroundColor: Colors.white, @@ -492,12 +487,11 @@ class _UpdateAssessmentPageState extends State context: context, builder: (context) { return AddAssessmentDetails( - mySelectedAssessment: assessment, + mySelectedAssessment: assessment!, patientInfo: widget.patientInfo, isUpdate: isUpdate, mySelectedAssessmentList: mySelectedAssessmentList, - addSelectedAssessment: (MySelectedAssessment mySelectedAssessment, - bool isUpdate) async { + addSelectedAssessment: (MySelectedAssessment mySelectedAssessment, bool isUpdate) async { setState(() { if (!isUpdate) mySelectedAssessmentList.add(mySelectedAssessment); 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 e73788e9..82e9b3fb 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 @@ -18,9 +18,7 @@ class AddExaminationPage extends StatefulWidget { final Function(MasterKeyModel) removeExamination; AddExaminationPage( - {this.mySelectedExamination, - this.addSelectedExamination, - this.removeExamination}); + {required this.mySelectedExamination, required this.addSelectedExamination, required this.removeExamination}); @override _AddExaminationPageState createState() => _AddExaminationPageState(); @@ -44,78 +42,74 @@ class _AddExaminationPageState extends State { } }, builder: (_, model, w) => AppScaffold( - baseViewModel: model, - isShowAppBar: true, - appBar: BottomSheetTitle( - title: "${TranslationBase.of(context).addExamination}", - ), - backgroundColor: Color.fromRGBO(248, 248, 248, 1), - body: Column( - mainAxisAlignment: MainAxisAlignment.start, - children: [ - Expanded( - child: SingleChildScrollView( - child: Column( - children: [ - Container( - margin: EdgeInsets.all(16.0), - padding: EdgeInsets.all(0.0), - decoration: BoxDecoration( - shape: BoxShape.rectangle, - color: Colors.white, - borderRadius: BorderRadius.circular(12), - border: Border.fromBorderSide(BorderSide( - color: Colors.grey.shade400, - width: 0.4, - )), - ), - child: Column( - children: [ - ExaminationsListSearchWidget( - mySelectedExamination: - widget.mySelectedExamination, - masterList: model.physicalExaminationList, - isServiceSelected: (master) => - isServiceSelected(master), - removeExamination: (selectedExamination) { - setState(() { - mySelectedExaminationLocal.remove(selectedExamination); - }); - }, - addExamination: (selectedExamination) { + baseViewModel: model, + isShowAppBar: true, + appBar: BottomSheetTitle( + title: "${TranslationBase.of(context).addExamination}", + ), + backgroundColor: Color.fromRGBO(248, 248, 248, 1), + body: Column( + mainAxisAlignment: MainAxisAlignment.start, + + children: [ + Expanded( + child: SingleChildScrollView( + child: Column( + children: [ + Container( + margin: EdgeInsets.all(16.0), + padding: EdgeInsets.all(0.0), + decoration: BoxDecoration( + shape: BoxShape.rectangle, + color: Colors.white, + borderRadius: BorderRadius.circular(12), + border: Border.fromBorderSide(BorderSide( + color: Colors.grey.shade400, + width: 0.4, + )), + ), + child: Column( + children: [ + ExaminationsListSearchWidget( + mySelectedExamination: + widget.mySelectedExamination,masterList: model.physicalExaminationList, + isServiceSelected: (master) => isServiceSelected(master), + removeExamination: (selectedExamination) { + setState(() { + mySelectedExaminationLocal.remove(selectedExamination); + }); + }, + addExamination: (selectedExamination) { - mySelectedExaminationLocal - .insert(0, selectedExamination); - // setState(() {}); - }, - ), - ], + mySelectedExaminationLocal.insert(0, selectedExamination); + // setState(() {}); + }, ), - ), - ], + ], + ), ), - ), + ], ), - ], + ), ), - bottomSheet: model.state != ViewState.Idle - ? Container( - height: 0, - ) - : BottomSheetDialogButton( - label: "${TranslationBase.of(context).addExamination}", - onTap: () { - widget.addSelectedExamination(mySelectedExaminationLocal); - }, - ), - )); + ], + ), + bottomSheet: model.state != ViewState.Idle + ? Container( + height: 0, + ) + : BottomSheetDialogButton( + label: "${TranslationBase.of(context).addExamination}", + onTap: () { + widget.addSelectedExamination(mySelectedExaminationLocal); + }, + ), + )); } isServiceSelected(MasterKeyModel masterKey) { - Iterable exam = mySelectedExaminationLocal.where( - (element) => - masterKey.id == element.selectedExamination.id && - masterKey.typeId == element.selectedExamination.typeId); + Iterable exam = mySelectedExaminationLocal.where((element) => + 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/examination_item_card.dart b/lib/screens/patients/profile/soap_update/objective/examination_item_card.dart index af3a419b..d0c18be3 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 @@ -1,4 +1,3 @@ -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/models/SOAP/selected_items/my_selected_examination.dart'; @@ -11,7 +10,7 @@ import 'package:provider/provider.dart'; class ExaminationItemCard extends StatelessWidget { final MySelectedExamination examination; - final Function removeExamination; + final VoidCallback removeExamination; ExaminationItemCard(this.examination, this.removeExamination); @@ -30,37 +29,36 @@ class ExaminationItemCard extends StatelessWidget { children: [ Expanded( child: Container( - child: AppText( - projectViewModel.isArabic - ? 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, - ), - )), + child: AppText( + projectViewModel.isArabic + ? 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, + ), + )), ], ), Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ AppText( - !examination.isNormal - ? examination.isAbnormal - ? TranslationBase.of(context).abnormal - : TranslationBase.of(context).notExamined + !examination.isNormal! + ? examination.isAbnormal! + ? TranslationBase.of(context).abnormal + : TranslationBase.of(context).notExamined : TranslationBase.of(context).normal, fontWeight: FontWeight.bold, fontFamily: 'Poppins', - color: !examination.isNormal - ? examination.isAbnormal - ? Colors.red.shade800 - : Colors.grey.shade800 - : AppGlobal.appGreenColor, + color: !examination.isNormal! + ? examination.isAbnormal! + ? Colors.red.shade800 + : Colors.grey.shade800 + : Colors.green.shade800, fontSize: SizeConfig.textMultiplier * 1.8, ), if (!examination.notExamined) 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 c1721ff2..d9d55925 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 @@ -1,4 +1,3 @@ -import 'package:doctor_app_flutter/config/config.dart'; import 'package:doctor_app_flutter/config/shared_pref_kay.dart'; import 'package:doctor_app_flutter/config/size_config.dart'; import 'package:doctor_app_flutter/core/enum/master_lookup_key.dart'; @@ -32,11 +31,11 @@ class UpdateObjectivePage extends StatefulWidget { final PatiantInformtion patientInfo; UpdateObjectivePage( - {Key ? key, - this.changePageViewIndex, - this.patientInfo, - this.changeLoadingState, - this.currentIndex}); + {Key? key, + required this.changePageViewIndex, + required this.patientInfo, + required this.changeLoadingState, + required this.currentIndex}); @override _UpdateObjectivePageState createState() => _UpdateObjectivePageState(); @@ -47,8 +46,7 @@ class _UpdateObjectivePageState extends State bool isSysExaminationExpand = false; List mySelectedExamination = []; - BoxDecoration containerBorderDecoration( - Color containerColor, Color borderColor) { + BoxDecoration containerBorderDecoration(Color containerColor, Color borderColor) { return BoxDecoration( color: containerColor, shape: BoxShape.rectangle, @@ -78,7 +76,7 @@ class _UpdateObjectivePageState extends State id: element.examId, ); MySelectedExamination tempEam = - SoapUtils.generateMySelectedExamination( + SoapUtils.generateMySelectedExamination( examination: examMaster, remark: element.remarks, isNormal: element.isNormal, @@ -108,13 +106,13 @@ class _UpdateObjectivePageState extends State crossAxisAlignment: CrossAxisAlignment.start, children: [ SOAPStepHeader( - currentIndex: widget.currentIndex, - changePageViewIndex: widget.changePageViewIndex, + currentIndex: widget.currentIndex, + changePageViewIndex: widget.changePageViewIndex, patientInfo: widget.patientInfo, ), ExpandableSOAPWidget( headerTitle: - TranslationBase.of(context).physicalSystemExamination, + TranslationBase.of(context).physicalSystemExamination, onTap: () { setState(() { isSysExaminationExpand = !isSysExaminationExpand; @@ -124,7 +122,7 @@ class _UpdateObjectivePageState extends State children: [ SOAPOpenItems( label: - "${TranslationBase.of(context).addExamination}", + "${TranslationBase.of(context).addExamination}", onTap: () { openExaminationList(context); }, @@ -144,13 +142,13 @@ class _UpdateObjectivePageState extends State Column( children: mySelectedExamination .sublist( - 0, - model.getFirstIndexForOldExamination( - mySelectedExamination) == - -1 - ? 0 - : model.getFirstIndexForOldExamination( - mySelectedExamination)) + 0, + model.getFirstIndexForOldExamination( + mySelectedExamination) == + -1 + ? 0 + : model.getFirstIndexForOldExamination( + mySelectedExamination)) .map((examination) { return ExaminationItemCard(examination, () { removeExamination( @@ -160,7 +158,7 @@ class _UpdateObjectivePageState extends State ), if (mySelectedExamination.isNotEmpty && model.getFirstIndexForOldExamination( - mySelectedExamination) > + mySelectedExamination) > -1) Row( children: [ @@ -168,18 +166,18 @@ class _UpdateObjectivePageState extends State "Verified", fontWeight: FontWeight.w600, fontFamily: 'Poppins', - color: AppGlobal.appGreenColor, + color: Colors.green, ), ], ), Column( children: mySelectedExamination .sublist(model.getFirstIndexForOldExamination( - mySelectedExamination) == - -1 - ? 0 - : model.getFirstIndexForOldExamination( - mySelectedExamination)) + mySelectedExamination) == + -1 + ? 0 + : model.getFirstIndexForOldExamination( + mySelectedExamination)) .map((examination) { return ExaminationItemCard(examination, () { removeExamination( @@ -228,9 +226,9 @@ class _UpdateObjectivePageState extends State 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, + createdBy: exam.createdBy ?? doctorProfile.doctorID, createdOn: exam.createdOn ?? DateTime.now().toIso8601String(), - editedBy: doctorProfile!.doctorID, + editedBy: doctorProfile.doctorID, editedOn: DateTime.now().toIso8601String(), examId: exam.selectedExamination!.id, examType: exam.selectedExamination!.typeId, @@ -295,9 +293,8 @@ class _UpdateObjectivePageState extends State removeExamination(MasterKeyModel masterKey) { Iterable history = mySelectedExamination.where( - (element) => - masterKey.id == element.selectedExamination.id && - masterKey.typeId == element.selectedExamination.typeId); + (element) => + masterKey.id == element.selectedExamination?.id && masterKey.typeId == element.selectedExamination?.typeId); if (history.length > 0) { setState(() { @@ -325,8 +322,8 @@ class _UpdateObjectivePageState extends State mySelectedExaminationLocal.forEach((element) { if ((mySelectedExamination.singleWhere( (it) => - it.selectedExamination!.id == - element.selectedExamination!.id)) == + it.selectedExamination!.id == + element.selectedExamination!.id)) == null) { mySelectedExamination.insert(0,element); } @@ -336,10 +333,10 @@ class _UpdateObjectivePageState extends State List removedList = []; mySelectedExamination.forEach((element) { if ((mySelectedExaminationLocal.singleWhere( - (it) => - it.selectedExamination!.id == - element.selectedExamination!.id, - )) == + (it) => + it.selectedExamination!.id == + element.selectedExamination!.id, + )) == null) { removedList.add(element); } 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 217daf7b..f2cc707e 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,10 +4,10 @@ import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart'; import 'package:flutter/material.dart'; class SOAPOpenItems extends StatelessWidget { - final Function onTap; + final VoidCallback onTap; final String label; - const SOAPOpenItems({Key? key, this.onTap, this.label}) : super(key: key); + const SOAPOpenItems({Key? key, required this.onTap, required this.label}) : super(key: key); @override Widget build(BuildContext context) { return InkWell( 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 dd111610..b451ce85 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 @@ -5,7 +5,7 @@ import 'package:flutter/material.dart'; class BottomSheetTitle extends StatelessWidget with PreferredSizeWidget { BottomSheetTitle({ Key? key, - this.title, + required 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 114eaab4..bf743f7f 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 @@ -9,12 +9,17 @@ import 'package:hexcolor/hexcolor.dart'; class ExpandableSOAPWidget extends StatelessWidget { final bool isExpanded; final Widget child; - final Function onTap; + final VoidCallback onTap; final headerTitle; final bool isRequired; const ExpandableSOAPWidget( - {Key? key, this.isExpanded, this.child, this.onTap, this.headerTitle, this.isRequired= true}) + {Key? key, + required this.isExpanded, + required this.child, + required this.onTap, + this.headerTitle, + this.isRequired = true}) : super(key: key); @override 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 74ad8881..297d77ab 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 @@ -17,7 +17,7 @@ import 'add_allergies.dart'; class UpdateAllergiesWidget extends StatefulWidget { List myAllergiesList; - UpdateAllergiesWidget({Key? key, this.myAllergiesList}); + UpdateAllergiesWidget({Key? key, required this.myAllergiesList}); @override _UpdateAllergiesWidgetState createState() => _UpdateAllergiesWidgetState(); @@ -38,6 +38,7 @@ class _UpdateAllergiesWidgetState extends State { onTap: () { openAllergiesList(context, changeAllState, removeAllergy); }, + ), SizedBox( height: 20, @@ -46,78 +47,75 @@ class _UpdateAllergiesWidgetState extends State { margin: EdgeInsets.only(left: 15, right: 15, top: 15), child: Column( children: widget.myAllergiesList.map((selectedAllergy) { - return Column( - crossAxisAlignment: CrossAxisAlignment.start, - mainAxisAlignment: MainAxisAlignment.start, - children: [ - Column( + return Column( crossAxisAlignment: CrossAxisAlignment.start, + mainAxisAlignment: MainAxisAlignment.start, children: [ - Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, + Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ - Container( - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - AppText( - projectViewModel.isArabic - ? selectedAllergy.selectedAllergy.nameAr - : selectedAllergy.selectedAllergy.nameEn - .toUpperCase(), - textDecoration: selectedAllergy.isChecked - ? null - : TextDecoration.lineThrough, - bold: true, - color: Color(0xFF2B353E), - fontSize: SizeConfig.getTextMultiplierBasedOnWidth() *3.5, - fontWeight: FontWeight.w700, - letterSpacing: -0.48, - // fontHeight:0.18 , - ), - AppText( - projectViewModel.isArabic - ? selectedAllergy + Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Container( + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + AppText( + projectViewModel.isArabic + ? selectedAllergy.selectedAllergy!.nameAr + : selectedAllergy.selectedAllergy!.nameEn!.toUpperCase(), + textDecoration: selectedAllergy.isChecked! ? null : TextDecoration.lineThrough, + bold: true, + color: Color(0xFF2B353E), + fontSize: SizeConfig.getTextMultiplierBasedOnWidth() *3.5, + fontWeight: FontWeight.w700, + letterSpacing: -0.48, + // fontHeight:0.18 , + ), + AppText( + projectViewModel.isArabic + ? selectedAllergy .selectedAllergySeverity!.nameAr - : selectedAllergy + : selectedAllergy .selectedAllergySeverity!.nameEn! .toUpperCase(), - textDecoration: selectedAllergy!.isChecked! - ? null - : TextDecoration.lineThrough, - color: Color(0xFFCC9B14), - fontSize: SizeConfig.getTextMultiplierBasedOnWidth() *3, - fontWeight: FontWeight.w700, - letterSpacing: -0.48, + textDecoration: selectedAllergy!.isChecked! + ? null + : TextDecoration.lineThrough, + color: Color(0xFFCC9B14), + fontSize: SizeConfig.getTextMultiplierBasedOnWidth() *3, + fontWeight: FontWeight.w700, + letterSpacing: -0.48, + ), + ], ), + width: MediaQuery.of(context).size.width * 0.5, + ), + if (selectedAllergy.isChecked!) + RemoveButton( + onTap: () => removeAllergy(selectedAllergy), + ) + ], + ), + Padding( + padding: const EdgeInsets.symmetric(vertical: 8), + child: Row( + children: [ + RemarkText(remark: selectedAllergy.remark,), ], ), - width: MediaQuery.of(context).size.width * 0.5, ), - if (selectedAllergy.isChecked) - RemoveButton( - onTap: () => removeAllergy(selectedAllergy), - ) + DividerWithSpacesAround() ], ), - Padding( - padding: const EdgeInsets.symmetric(vertical: 8), - child: Row( - children: [ - RemarkText(remark: selectedAllergy.remark,), - ], - ), + SizedBox( + height: 10, ), - DividerWithSpacesAround() ], - ), - SizedBox( - height: 10, - ), - ], - ); - }).toList()), + ); + }).toList()), ) ], ); @@ -125,14 +123,13 @@ 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) - .toList(); + // ignore: missing_return + 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!) { @@ -167,9 +164,9 @@ class _UpdateAllergiesWidgetState extends State { if (isAllDataFilled) { mySelectedAllergy.forEach((element) { if ((widget.myAllergiesList.singleWhere( - (it) => - it.selectedAllergy!.id == - element.selectedAllergy!.id,)) == + (it) => + it.selectedAllergy!.id == + element.selectedAllergy!.id,)) == null) { widget.myAllergiesList.add(element); } @@ -180,8 +177,8 @@ class _UpdateAllergiesWidgetState extends State { widget.myAllergiesList.forEach((element) { if ((mySelectedAllergy.singleWhere( (it) => - it.selectedAllergy!.id == - element.selectedAllergy!.id)) == + it.selectedAllergy!.id == + element.selectedAllergy!.id)) == null) { removedList.add(element); } @@ -193,8 +190,7 @@ class _UpdateAllergiesWidgetState extends State { changeParentState(); Navigator.of(context).pop(); } else { - Helpers.showErrorToast( - TranslationBase.of(context).requiredMsg); + Helpers.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 9602e4b1..eac11c31 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 @@ -8,13 +8,13 @@ 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, + required this.formKey, + required this.complaintsController, + required this.illnessController, + required this.medicationController, + required this.complaintsControllerError, + required this.illnessControllerError, + required this.medicationControllerError, }) : super(key: key); final GlobalKey formKey; 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 49c559a0..a6937867 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 @@ -23,12 +23,12 @@ class AddHistoryDialog extends StatefulWidget { final Function(MasterKeyModel) removeHistory; const AddHistoryDialog( - {Key ? key, - this.changePageViewIndex, - this.controller, - this.myHistoryList, - this.addSelectedHistories, - this.removeHistory}) + {Key? key, + required this.changePageViewIndex, + required this.controller, + required this.myHistoryList, + required this.addSelectedHistories, + required this.removeHistory}) : super(key: key); @override @@ -59,136 +59,135 @@ class _AddHistoryDialogState extends State { baseViewModel: model, isShowAppBar: true, appBar: - BottomSheetTitle(title: TranslationBase.of(context).addHistory!), + BottomSheetTitle(title: TranslationBase.of(context).addHistory!), body: Center( child: Container( child: Column( - children: [ - SizedBox( - height: 10, - ), - PriorityBar(onTap: (activePriority) async { - widget.changePageViewIndex(activePriority); - }), - SizedBox( - height: 20, - ), - Expanded( - child: FractionallySizedBox( - widthFactor: 0.9, - child: PageView( - physics: NeverScrollableScrollPhysics(), - controller: widget.controller, - onPageChanged: (index) { - setState(() {}); - }, - scrollDirection: Axis.horizontal, - children: [ - NetworkBaseView( - baseViewModel: model, - child: MasterKeyCheckboxSearchWidget( - model: model, - masterList: model.historyFamilyList, - removeHistory: (history) { - setState(() { - widget.removeHistory(history); - }); - }, - addHistory: (history) { - setState(() { - createAndAddHistory(history); - }); - }, - addSelectedHistories: () { - widget.addSelectedHistories(); - }, - isServiceSelected: (master) => - isServiceSelected(master), - ), - ), - NetworkBaseView( - baseViewModel: model, - child: MasterKeyCheckboxSearchWidget( - model: model, - masterList: model - .mergeHistorySurgicalWithHistorySportList, - removeHistory: (history) { - setState(() { - widget.removeHistory(history); - }); - }, - addHistory: (history) { - setState(() { - createAndAddHistory(history); - }); - }, - addSelectedHistories: () { - widget.addSelectedHistories(); - }, - isServiceSelected: (master) => - isServiceSelected(master), - ), - ), - NetworkBaseView( - baseViewModel: model, - child: MasterKeyCheckboxSearchWidget( - model: model, - masterList: model.historyMedicalList, - removeHistory: (history) { - setState(() { - widget.removeHistory(history); - }); - }, - addHistory: (history) { - setState(() { - createAndAddHistory(history); - }); - }, - addSelectedHistories: () { - widget.addSelectedHistories(); - }, - isServiceSelected: (master) => - isServiceSelected(master), - ), + children: [ + SizedBox( + height: 10, + ), + PriorityBar(onTap: (activePriority) async { + widget.changePageViewIndex(activePriority); + }), + SizedBox( + height: 20, + ), + Expanded( + child: FractionallySizedBox( + widthFactor: 0.9, + child: PageView( + physics: NeverScrollableScrollPhysics(), + controller: widget.controller, + onPageChanged: (index) { + setState(() {}); + }, + scrollDirection: Axis.horizontal, + children: [ + NetworkBaseView( + baseViewModel: model, + child: MasterKeyCheckboxSearchWidget( + model: model, + masterList: model.historyFamilyList, + removeHistory: (history) { + setState(() { + widget.removeHistory(history); + }); + }, + addHistory: (history) { + setState(() { + createAndAddHistory(history); + }); + }, + addSelectedHistories: () { + widget.addSelectedHistories(); + }, + isServiceSelected: (master) => + isServiceSelected(master), + ), + ), + NetworkBaseView( + baseViewModel: model, + child: MasterKeyCheckboxSearchWidget( + model: model, + masterList: model + .mergeHistorySurgicalWithHistorySportList, + removeHistory: (history) { + setState(() { + widget.removeHistory(history); + }); + }, + addHistory: (history) { + setState(() { + createAndAddHistory(history); + }); + }, + addSelectedHistories: () { + widget.addSelectedHistories(); + }, + isServiceSelected: (master) => + isServiceSelected(master), + ), + ), + NetworkBaseView( + baseViewModel: model, + child: MasterKeyCheckboxSearchWidget( + model: model, + masterList: model.historyMedicalList, + removeHistory: (history) { + setState(() { + widget.removeHistory(history); + }); + }, + addHistory: (history) { + setState(() { + createAndAddHistory(history); + }); + }, + addSelectedHistories: () { + widget.addSelectedHistories(); + }, + isServiceSelected: (master) => + isServiceSelected(master), + ), + ), + ], ), - ], + ), ), - ), - ), - SizedBox( - height: MediaQuery.of(context).size.height * 0.11, - ) - ], - )), + SizedBox( + height: MediaQuery.of(context).size.height * 0.11, + ) + ], + )), ), bottomSheet: model.state != ViewState.Idle ? Container( - height: 0, - ) + height: 0, + ) : BottomSheetDialogButton( - label: TranslationBase.of(context).addSelectedHistories, - onTap: () { - widget.addSelectedHistories(); - }, - ), + label: TranslationBase.of(context).addSelectedHistories, + onTap: () { + widget.addSelectedHistories(); + }, + ), ), )); } createAndAddHistory(MasterKeyModel history) { List myhistory = widget.myHistoryList - .where((element) => - history.id == element.selectedHistory.id && - history.typeId == element.selectedHistory.typeId) + .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); + SoapUtils.generateMySelectedHistory( + remark: history.remarks ?? "", + history: history, + isChecked: true); widget.myHistoryList.add(mySelectedHistory); }); @@ -198,11 +197,10 @@ 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 9b530d99..a4aa674f 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 @@ -8,7 +8,7 @@ import 'package:provider/provider.dart'; class PriorityBar extends StatefulWidget { final Function onTap; - const PriorityBar({Key ? key, this.onTap}) : super(key: key); + const PriorityBar({Key? key, required this.onTap}) : super(key: key); @override _PriorityBarState createState() => _PriorityBarState(); 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 39031685..7ead4c3f 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 @@ -14,15 +14,14 @@ import 'add_history_dialog.dart'; class UpdateHistoryWidget extends StatefulWidget { final List myHistoryList; - const UpdateHistoryWidget({Key ? key, this.myHistoryList}) : super(key: key); + const UpdateHistoryWidget({Key? key, required this.myHistoryList}) : super(key: key); @override _UpdateHistoryWidgetState createState() => _UpdateHistoryWidgetState(); } -class _UpdateHistoryWidgetState extends State - with TickerProviderStateMixin { - PageController _controller; +class _UpdateHistoryWidgetState extends State with TickerProviderStateMixin { + late PageController _controller; changePageViewIndex(pageIndex) { _controller.jumpToPage(pageIndex); @@ -61,16 +60,14 @@ class _UpdateHistoryWidgetState extends State Container( child: AppText( projectViewModel.isArabic - ? myHistory.selectedHistory.nameAr - : myHistory.selectedHistory.nameEn, - textDecoration: myHistory.isChecked - ? null - : TextDecoration.lineThrough, + ? myHistory.selectedHistory!.nameAr + : myHistory.selectedHistory!.nameEn, + + textDecoration: myHistory.isChecked! ? null : TextDecoration.lineThrough, color: Color(0xFF2B353E), fontSize: SizeConfig.getTextMultiplierBasedOnWidth() *3.5, fontWeight: FontWeight.w700, - letterSpacing: -0.48, - ), + letterSpacing: -0.48,), width: MediaQuery.of(context).size.width * 0.5, ), if (myHistory!.isChecked!) @@ -93,14 +90,13 @@ 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(); + // ignore: missing_return + widget.myHistoryList + .where((element) => + historyKey.id == element.selectedHistory!.id && historyKey.typeId == element.selectedHistory!.typeId) + .toList(); - if (history.length > 0) { + if (history.length > 0){ if (history!.first!.isLocal!) { setState(() { widget.myHistoryList.remove(history.first); 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 66415288..fa8d2a6e 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 @@ -10,7 +10,7 @@ class UpdateMedicationWidget extends StatefulWidget { UpdateMedicationWidget({ Key? key, - this.medicationController, + required this.medicationController, }); @override 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 0c07483d..b9b4d118 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 @@ -26,11 +26,11 @@ class UpdateSubjectivePage extends StatefulWidget { final int currentIndex; UpdateSubjectivePage( - {Key ? key, - this.changePageViewIndex, - this.patientInfo, - this.changeLoadingState, - this.currentIndex}); + {Key? key, + required this.changePageViewIndex, + required this.patientInfo, + required this.changeLoadingState, + required this.currentIndex}); @override _UpdateSubjectivePageState createState() => _UpdateSubjectivePageState(); @@ -53,67 +53,63 @@ class _UpdateSubjectivePageState extends State widget.changeLoadingState(true); if (model.patientHistoryList.isNotEmpty) { model.patientHistoryList.forEach((element) { - if (element.historyType == - MasterKeysService.HistoryFamily.getMasterKeyService()) { - MasterKeyModel history = model.getOneMasterKey( + 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); + SoapUtils.generateMySelectedHistory( + history: history, + isChecked: element.isChecked, + remark: element.remarks, + isLocal: false); myHistoryList.add(mySelectedHistory); } } - if (element.historyType == - MasterKeysService.HistoryMedical.getMasterKeyService()) { - MasterKeyModel history = model.getOneMasterKey( + 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); + SoapUtils.generateMySelectedHistory( + history: history, + isChecked: element.isChecked, + remark: element.remarks, + isLocal: false); myHistoryList.add(mySelectedHistory); } } - if (element.historyType == - MasterKeysService.HistorySports.getMasterKeyService()) { - MasterKeyModel history = model.getOneMasterKey( + 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); + SoapUtils.generateMySelectedHistory( + history: history, + isChecked: element.isChecked, + remark: element.remarks, + isLocal: false); myHistoryList.add(mySelectedHistory); } } - if (element.historyType == - MasterKeysService.HistorySurgical.getMasterKeyService()) { - MasterKeyModel history = model.getOneMasterKey( + 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); + SoapUtils.generateMySelectedHistory( + history: history, + isChecked: element.isChecked, + remark: element.remarks, + isLocal: false); myHistoryList.add(mySelectedHistory); } } @@ -124,35 +120,30 @@ 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(), + id: 0, typeId: MasterKeysService.AllergySeverity.getMasterKeyService(), nameAr: '', nameEn: ''); } else { selectedAllergySeverity = model.getOneMasterKey( masterKeys: MasterKeysService.AllergySeverity, id: element.severity, - ); + )!; } 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); + 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); }); } } @@ -168,14 +159,11 @@ class _UpdateSubjectivePageState extends State if (model.patientChiefComplaintList.isNotEmpty) { isChiefExpand = true; - complaintsController.text = Helpers.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 = Helpers.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) { await getHistory(model); @@ -215,10 +203,10 @@ class _UpdateSubjectivePageState extends State illnessController: illnessController, medicationController: medicationController, complaintsControllerError: - model.complaintsControllerError, + model.complaintsControllerError, illnessControllerError: model.illnessControllerError, medicationControllerError: - model.medicationControllerError, + model.medicationControllerError, ), isExpanded: isChiefExpand, ), @@ -226,47 +214,43 @@ class _UpdateSubjectivePageState extends State height: SizeConfig.heightMultiplier * (SizeConfig.isHeightVeryShort ? 4 : 2), ), - if (widget.patientInfo.admissionNo == null) - ExpandableSOAPWidget( - headerTitle: TranslationBase.of(context).histories, - isRequired: false, - onTap: () { - setState(() { - isHistoryExpand = !isHistoryExpand; - }); - }, - child: Column( - children: [ - UpdateHistoryWidget(myHistoryList: myHistoryList) - ], - ), - isExpanded: isHistoryExpand, + if (widget.patientInfo.admissionNo == null) ExpandableSOAPWidget( + headerTitle: TranslationBase.of(context).histories, + isRequired: false, + onTap: () { + setState(() { + isHistoryExpand = !isHistoryExpand; + }); + }, + child: Column( + children: [UpdateHistoryWidget(myHistoryList: myHistoryList)], ), + isExpanded: isHistoryExpand, + ), SizedBox( height: SizeConfig.heightMultiplier * (SizeConfig.isHeightVeryShort ? 4 : 2), ), - if (widget.patientInfo.admissionNo == null) - ExpandableSOAPWidget( - headerTitle: TranslationBase.of(context).allergiesSoap, - isRequired: false, - onTap: () { - setState(() { - isAllergiesExpand = !isAllergiesExpand; - }); - }, - child: Column( - children: [ - UpdateAllergiesWidget( - myAllergiesList: myAllergiesList, - ), - SizedBox( - height: 30, - ), - ], - ), - isExpanded: isAllergiesExpand, + if (widget.patientInfo.admissionNo == null) ExpandableSOAPWidget( + headerTitle: TranslationBase.of(context).allergiesSoap, + isRequired: false, + onTap: () { + setState(() { + isAllergiesExpand = !isAllergiesExpand; + }); + }, + child: Column( + children: [ + UpdateAllergiesWidget( + myAllergiesList: myAllergiesList, + ), + SizedBox( + height: 30, + ), + ], ), + isExpanded: isAllergiesExpand, + ), SizedBox( height: SizeConfig.heightMultiplier * (SizeConfig.isHeightVeryShort ? 20 : 10), @@ -282,8 +266,8 @@ class _UpdateSubjectivePageState extends State addSubjectiveInfo( {required SOAPViewModel model, - required List myAllergiesList, - required List myHistoryList}) async { + required List myAllergiesList, + required List myHistoryList}) async { if (FocusScope.of(context).hasFocus) FocusScope.of(context).unfocus(); widget.changeLoadingState(true); formKey.currentState!.save(); @@ -310,21 +294,17 @@ class _UpdateSubjectivePageState extends State } else { setState(() { if (complaintsController.text.isEmpty) { - model.complaintsControllerError = - TranslationBase.of(context).emptyMessage; + model.complaintsControllerError = TranslationBase.of(context).emptyMessage!; } else if (complaintsController.text.length < 25) { - model.complaintsControllerError = - TranslationBase.of(context).chiefComplaintLength; + model.complaintsControllerError = TranslationBase.of(context).chiefComplaintLength!; } 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!; } }); @@ -335,8 +315,8 @@ class _UpdateSubjectivePageState extends State } @override - VoidCallback? nextFunction(model) { - addSubjectiveInfo( + VoidCallback? nextFunction(model) { + 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 41629fb7..85f1a744 100644 --- a/lib/screens/patients/profile/soap_update/update_soap_index.dart +++ b/lib/screens/patients/profile/soap_update/update_soap_index.dart @@ -4,6 +4,7 @@ import 'package:doctor_app_flutter/core/viewModel/SOAP_view_model.dart'; import 'package:doctor_app_flutter/models/SOAP/selected_items/my_selected_allergy.dart'; import 'package:doctor_app_flutter/models/SOAP/selected_items/my_selected_history.dart'; import 'package:doctor_app_flutter/models/patient/patiant_info_model.dart'; +import 'package:doctor_app_flutter/models/patient/profile/patient_profile_app_bar_model.dart'; import 'package:doctor_app_flutter/screens/base/base_view.dart'; import 'package:doctor_app_flutter/screens/patients/profile/soap_update/subjective/update_subjective_page.dart'; import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; @@ -21,22 +22,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, required this.isUpdate}) : 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; }); @@ -64,7 +64,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( @@ -72,8 +72,8 @@ class _UpdateSoapIndexState extends State isShowAppBar: true, appBar: PatientProfileAppBar(patient), patientProfileAppBarModel: PatientProfileAppBarModel( - isInpatient:patient.admissionNo== null || patient.admissionNo!.isEmpty?false:true , - patient: patient + isInpatient:patient.admissionNo== null || patient.admissionNo!.isEmpty?false:true , + patient: patient ), body: SingleChildScrollView( child: Column( @@ -149,8 +149,8 @@ class _UpdateSoapIndexState extends State ), Container( child: FractionallySizedBox( - widthFactor: .80, - child: getBottomSheet(model, patient) + widthFactor: .80, + child: getBottomSheet(model, patient) ), ), SizedBox( @@ -258,7 +258,7 @@ class _UpdateSoapIndexState extends State padding: 10, disabled: model.state == ViewState.BusyLocal, onPressed: () async { - model.nextOnAssessmentPage(model); + model.nextOnAssessmentPage(model); }, ), ), @@ -283,7 +283,7 @@ class _UpdateSoapIndexState extends State fontWeight: FontWeight.w600, disabled: model.state == ViewState.BusyLocal, onPressed: () async { - changePageViewIndex(2); + changePageViewIndex(2); }, ), ), @@ -302,7 +302,7 @@ class _UpdateSoapIndexState extends State color: Colors.red[700], disabled: model.progressNoteText.isEmpty, onPressed: () async { - model.nextOnPlanPage(model); + model.nextOnPlanPage(model); }, ), ), 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 6567f3cd..b99e66b4 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 @@ -17,13 +17,13 @@ class VitalSignBloodPressureWidget extends StatefulWidget { final String viewKey2; VitalSignBloodPressureWidget( - {Key ? key, - this.vitalList, - this.title1, - this.title2, - this.viewKey1, - this.title3, - this.viewKey2}); + {Key? key, + required this.vitalList, + required this.title1, + required this.title2, + required this.viewKey1, + required this.title3, + required this.viewKey2}); @override _VitalSignDetailsWidgetState createState() => _VitalSignDetailsWidgetState(); @@ -96,7 +96,7 @@ class _VitalSignDetailsWidgetState extends State { ), Table( border: TableBorder( - horizontalInside: BorderSide(width: 1.0, color: Colors.grey[300]), + horizontalInside: BorderSide(width: 1.0, color: Colors.grey[300]!), ), children: fullData(projectViewModel), ), 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 f248e037..520438d8 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 @@ -15,7 +15,7 @@ class VitalSignDetailsWidget extends StatefulWidget { final String viewKey; VitalSignDetailsWidget( - {Key ? key, this.vitalList, this.title1, this.title2, this.viewKey}); + {Key? key, required this.vitalList, required this.title1, required this.title2, required this.viewKey}); @override _VitalSignDetailsWidgetState createState() => _VitalSignDetailsWidgetState(); @@ -93,7 +93,7 @@ class _VitalSignDetailsWidgetState extends State { ), Table( border: TableBorder( - horizontalInside: BorderSide(width: 1.0, color: Colors.grey[300]), + horizontalInside: BorderSide(width: 1.0, color: Colors.grey[300]!), ), children: fullData(projectViewModel), ), 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 c02cb5b1..d051f98c 100644 --- a/lib/screens/patients/profile/vital_sign/vital_sign_item.dart +++ b/lib/screens/patients/profile/vital_sign/vital_sign_item.dart @@ -9,17 +9,17 @@ class VitalSignItem extends StatelessWidget { final String lastVal; final String unit; final String imagePath; - final double height; - final double width; + final double? height; + 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}) + required this.imagePath}) : super(key: key); @override 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 0ed9da56..b8b8958f 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,20 +14,20 @@ import 'package:flutter/material.dart'; import 'package:provider/provider.dart'; class VitalSignItemDetailsScreen extends StatelessWidget { - final vitalSignDetails pageKey; - final String pageTitle; - List VSchart; + final vitalSignDetails? pageKey; + final String? pageTitle; + List? VSchart; PatiantInformtion patient; String patientType; String arrivalType; VitalSignItemDetailsScreen( - {this.vitalList, - this.pageKey, - this.pageTitle, - this.patient, - this.patientType, - this.arrivalType}); + {required this.vitalList, + required this.pageKey, + required this.pageTitle, + required this.patient, + required this.patientType, + required this.arrivalType}); final List vitalList; @@ -187,7 +187,7 @@ class VitalSignItemDetailsScreen extends StatelessWidget { default: } return AppScaffold( - appBarTitle: pageTitle, + appBarTitle: pageTitle ?? "", backgroundColor: Color.fromRGBO(248, 248, 248, 1), isShowAppBar: true, appBar: PatientProfileAppBar( @@ -202,7 +202,7 @@ 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, fontWeight: FontWeight.w600, @@ -220,7 +220,7 @@ class VitalSignItemDetailsScreen extends StatelessWidget { child: ListView( shrinkWrap: true, physics: NeverScrollableScrollPhysics(), - children: VSchart.map((chartInfo) { + children: VSchart!.map((chartInfo) { var vitalListTemp = vitalList.where( (element) => element.toJson()[chartInfo['viewKey']] != null, ); 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 ffb26985..1f9a9280 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 'LineChartCurved.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; 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 a9b6a665..adfb124b 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 'LineChartCurvedBloodPressure.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;