From ea497ff8b106321b24fa26a0adda8dab8e5a21af Mon Sep 17 00:00:00 2001 From: Aamir Date: Sun, 17 Dec 2023 14:34:11 +0300 Subject: [PATCH] Null Safety Fixes & Overrides --- lib/client/base_app_client.dart | 2 + lib/client/http_Overrides.dart | 8 ++ lib/config/config.dart | 2 +- .../PatientRegistrationModel.dart | 6 +- .../patient/LiveCarePatientServices.dart | 56 ++++--------- lib/core/viewModel/SOAP_view_model.dart | 9 +- .../viewModel/authentication_view_model.dart | 2 +- lib/main.dart | 4 + .../live_care/live_care_patient_screen.dart | 84 +++++++++++++++++-- .../patient_profile_screen.dart | 4 +- .../objective/add_examination_page.dart | 39 ++++----- .../objective/add_examination_widget.dart | 24 +++--- .../examinations_list_search_widget.dart | 8 +- .../subjective/medication/add_medication.dart | 4 +- .../patients/patient_card/PatientCard.dart | 2 +- 15 files changed, 154 insertions(+), 100 deletions(-) create mode 100644 lib/client/http_Overrides.dart diff --git a/lib/client/base_app_client.dart b/lib/client/base_app_client.dart index 86704430..07160811 100644 --- a/lib/client/base_app_client.dart +++ b/lib/client/base_app_client.dart @@ -113,6 +113,8 @@ class BaseAppClient { // } body['DeviceTypeID'] = Platform.isAndroid ? 1 : 2; + // body['ClinicID'] = 501; + // body['ProjectID'] = 12; // body['DoctorID'] = 1002; //3844083 // body['TokenID'] = "@dm!n"; diff --git a/lib/client/http_Overrides.dart b/lib/client/http_Overrides.dart new file mode 100644 index 00000000..d2a470ba --- /dev/null +++ b/lib/client/http_Overrides.dart @@ -0,0 +1,8 @@ +import 'dart:io'; + +class MyHttpOverrides extends HttpOverrides { + @override + HttpClient createHttpClient(SecurityContext? context) { + return super.createHttpClient(context)..badCertificateCallback = (X509Certificate cert, String host, int port) => true; + } +} diff --git a/lib/config/config.dart b/lib/config/config.dart index 60021613..831c9cdf 100644 --- a/lib/config/config.dart +++ b/lib/config/config.dart @@ -19,7 +19,7 @@ const BASE_URL = 'https://uat.hmgwebservices.com/'; const PHARMACY_ITEMS_URL = "Services/Lists.svc/REST/GetPharmcyItems_Region_enh"; const PHARMACY_LIST_URL = "Services/Patients.svc/REST/GetPharmcyList"; -const PATIENT_PROGRESS_NOTE_URL = "Services/DoctorApplication.svc/REST/GetProgressNoteForInPatient"; +const PATIENT_PROGRESS_NOTE_URL = "Services/DoctorApplicathttps://uat.hmgwebservices.com/Services/DoctorApplication.svc/REST/GetPendingPatientERForDoctorAppion.svc/REST/GetProgressNoteForInPatient"; const PATIENT_INSURANCE_APPROVALS_URL = "Services/DoctorApplication.svc/REST/GetApprovalStatusForInpatient"; const PATIENT_REFER_TO_DOCTOR_URL = "Services/DoctorApplication.svc/REST/ReferToDoctor"; const PATIENT_GET_DOCTOR_BY_CLINIC_URL = "Services/DoctorApplication.svc/REST/GetDoctorsByClinicID"; diff --git a/lib/core/model/PatientRegistration/PatientRegistrationModel.dart b/lib/core/model/PatientRegistration/PatientRegistrationModel.dart index a73ecb0b..e9b8b117 100644 --- a/lib/core/model/PatientRegistration/PatientRegistrationModel.dart +++ b/lib/core/model/PatientRegistration/PatientRegistrationModel.dart @@ -9,7 +9,7 @@ class PatientRegistrationModel { String? iPAdress; String? generalid; int? patientOutSA; - Null sessionID; + dynamic sessionID; bool? isDentalAllowedBackend; int? deviceTypeID; String? tokenID; @@ -39,9 +39,7 @@ class PatientRegistrationModel { this.zipCode}); PatientRegistrationModel.fromJson(Map json) { - patientobject = json['Patientobject'] != null - ? new Patientobject.fromJson(json['Patientobject']) - : null; + patientobject = json['Patientobject'] != null ? new Patientobject.fromJson(json['Patientobject']) : null; patientIdentificationID = json['PatientIdentificationID']; patientMobileNumber = json['PatientMobileNumber']; logInTokenID = json['LogInTokenID']; diff --git a/lib/core/service/patient/LiveCarePatientServices.dart b/lib/core/service/patient/LiveCarePatientServices.dart index c2ec316a..9a3079f3 100644 --- a/lib/core/service/patient/LiveCarePatientServices.dart +++ b/lib/core/service/patient/LiveCarePatientServices.dart @@ -3,11 +3,11 @@ import 'package:doctor_app_flutter/core/model/live_care/AlternativeServicesList. import 'package:doctor_app_flutter/core/model/live_care/PendingPatientERForDoctorAppRequestModel.dart'; import 'package:doctor_app_flutter/core/model/live_care/add_patient_to_doctor_list_request_model.dart'; import 'package:doctor_app_flutter/core/model/live_care/live_care_login_reguest_model.dart'; -import 'package:doctor_app_flutter/core/service/base/base_service.dart'; import 'package:doctor_app_flutter/core/model/livecare/end_call_req.dart'; import 'package:doctor_app_flutter/core/model/livecare/start_call_req.dart'; import 'package:doctor_app_flutter/core/model/livecare/start_call_res.dart'; import 'package:doctor_app_flutter/core/model/patient/patiant_info_model.dart'; +import 'package:doctor_app_flutter/core/service/base/base_service.dart'; class LiveCarePatientServices extends BaseService { List _patientList = []; @@ -34,9 +34,7 @@ class LiveCarePatientServices extends BaseService { StartCallRes get startCallRes => _startCallRes; - Future getPendingPatientERForDoctorApp( - PendingPatientERForDoctorAppRequestModel - pendingPatientERForDoctorAppRequestModel) async { + Future getPendingPatientERForDoctorApp(PendingPatientERForDoctorAppRequestModel pendingPatientERForDoctorAppRequestModel) async { hasError = false; await baseAppClient.post( GET_PENDING_PATIENT_ER_FOR_DOCTOR_APP, @@ -49,10 +47,7 @@ class LiveCarePatientServices extends BaseService { /// add new items. localPatientList.forEach((element) { - if ((_patientList.singleWhere( - (it) => it.patientId == element.patientId, - orElse: () => PatiantInformtion())) == - null) { + if (!_patientList.any((it) => it.patientId == element.patientId)) { _patientList.add(element); } }); @@ -60,10 +55,7 @@ class LiveCarePatientServices extends BaseService { /// remove items. List removedPatientList = []; _patientList.forEach((element) { - if ((localPatientList.singleWhere( - (it) => it.patientId == element.patientId, - orElse: () => PatiantInformtion())) == - null) { + if (localPatientList.any((it) => it.patientId == element.patientId)) { removedPatientList.add(element); } }); @@ -92,8 +84,7 @@ class LiveCarePatientServices extends BaseService { Future startCall(StartCallReq startCallReq) async { hasError = false; - await baseAppClient.post(START_LIVE_CARE_CALL, - onSuccess: (response, statusCode) async { + await baseAppClient.post(START_LIVE_CARE_CALL, onSuccess: (response, statusCode) async { _startCallRes = StartCallRes.fromJson(response); }, onFailure: (String error, int statusCode) { hasError = true; @@ -103,23 +94,17 @@ class LiveCarePatientServices extends BaseService { Future endCallWithCharge(int vcID, List altServiceList) async { hasError = false; - await baseAppClient.post(END_CALL_WITH_CHARGE, - onSuccess: (dynamic response, int statusCode) { + await baseAppClient.post(END_CALL_WITH_CHARGE, onSuccess: (dynamic response, int statusCode) { endCallResponse = response; }, onFailure: (String error, int statusCode) { hasError = true; super.error = error; - }, body: { - "VC_ID": vcID, - "AltServiceList": altServiceList, - "generalid": GENERAL_ID - }, isLiveCare: _isLive); + }, body: {"VC_ID": vcID, "AltServiceList": altServiceList, "generalid": GENERAL_ID}, isLiveCare: _isLive); } Future transferToAdmin(int vcID, String notes) async { hasError = false; - await baseAppClient.post(TRANSFERT_TO_ADMIN, - onSuccess: (dynamic response, int statusCode) { + await baseAppClient.post(TRANSFERT_TO_ADMIN, onSuccess: (dynamic response, int statusCode) { transferToAdminResponse = response; }, onFailure: (String error, int statusCode) { hasError = true; @@ -133,8 +118,7 @@ class LiveCarePatientServices extends BaseService { Future sendSMSInstruction(int vcID) async { hasError = false; - await baseAppClient.post(SEND_SMS_INSTRUCTIONS, - onSuccess: (dynamic response, int statusCode) { + await baseAppClient.post(SEND_SMS_INSTRUCTIONS, onSuccess: (dynamic response, int statusCode) { transferToAdminResponse = response; }, onFailure: (String error, int statusCode) { hasError = true; @@ -142,14 +126,11 @@ class LiveCarePatientServices extends BaseService { }, body: {"VC_ID": vcID, "generalid": GENERAL_ID}, isLiveCare: _isLive); } - Future isLogin( - {LiveCareUserLoginRequestModel? isLoginRequestModel, - int? loginStatus}) async { + Future isLogin({LiveCareUserLoginRequestModel? isLoginRequestModel, int? loginStatus}) async { hasError = false; await getDoctorProfile(); isLoginRequestModel!.doctorId = super.doctorProfile!.doctorID; - await baseAppClient.post(LIVE_CARE_IS_LOGIN, - onSuccess: (response, statusCode) async { + await baseAppClient.post(LIVE_CARE_IS_LOGIN, onSuccess: (response, statusCode) async { isLoginResponse = response; }, onFailure: (String error, int statusCode) { hasError = true; @@ -161,8 +142,7 @@ class LiveCarePatientServices extends BaseService { hasError = false; alternativeServicesList.clear(); - await baseAppClient.post(GET_ALTERNATIVE_SERVICE, - onSuccess: (dynamic response, int statusCode) { + await baseAppClient.post(GET_ALTERNATIVE_SERVICE, onSuccess: (dynamic response, int statusCode) { response['AlternativeServicesList'].forEach((v) { alternativeServicesList.add(AlternativeService.fromJson(v)); }); @@ -175,16 +155,14 @@ class LiveCarePatientServices extends BaseService { Future addPatientToDoctorList({int? vcID}) async { hasError = false; await getDoctorProfile(); - AddPatientToDoctorListRequestModel addPatientToDoctorListRequestModel = - AddPatientToDoctorListRequestModel(); + AddPatientToDoctorListRequestModel addPatientToDoctorListRequestModel = AddPatientToDoctorListRequestModel(); addPatientToDoctorListRequestModel.doctorId = super.doctorProfile!.doctorID; addPatientToDoctorListRequestModel.vCID = vcID; addPatientToDoctorListRequestModel.isOutKsa = false; addPatientToDoctorListRequestModel.generalid = GENERAL_ID; - await baseAppClient.post(ADD_PATIENT_TO_DOCTOR, - onSuccess: (response, statusCode) async { + await baseAppClient.post(ADD_PATIENT_TO_DOCTOR, onSuccess: (response, statusCode) async { isLoginResponse = response; }, onFailure: (String error, int statusCode) { hasError = true; @@ -194,16 +172,14 @@ class LiveCarePatientServices extends BaseService { Future removePatientFromDoctorList({int? vcID}) async { hasError = false; - AddPatientToDoctorListRequestModel addPatientToDoctorListRequestModel = - AddPatientToDoctorListRequestModel(); + AddPatientToDoctorListRequestModel addPatientToDoctorListRequestModel = AddPatientToDoctorListRequestModel(); await getDoctorProfile(); addPatientToDoctorListRequestModel.doctorId = super.doctorProfile!.doctorID; addPatientToDoctorListRequestModel.vCID = vcID; addPatientToDoctorListRequestModel.isOutKsa = false; addPatientToDoctorListRequestModel.generalid = GENERAL_ID; - await baseAppClient.post(REMOVE_PATIENT_FROM_DOCTOR, - onSuccess: (response, statusCode) async { + await baseAppClient.post(REMOVE_PATIENT_FROM_DOCTOR, onSuccess: (response, statusCode) async { isLoginResponse = response; }, onFailure: (String error, int statusCode) { hasError = true; diff --git a/lib/core/viewModel/SOAP_view_model.dart b/lib/core/viewModel/SOAP_view_model.dart index 38c6575d..35358ad0 100644 --- a/lib/core/viewModel/SOAP_view_model.dart +++ b/lib/core/viewModel/SOAP_view_model.dart @@ -140,9 +140,12 @@ class SOAPViewModel extends BaseViewModel { Future getMasterLookup(MasterKeysService masterKeys, {bool isBusyLocal = false, String searchKey = "", bool allowSetState = false}) async { if (isBusyLocal) { setState(ViewState.Busy); - } else { + } else setState(ViewState.Busy); - } + + //else + // setState(ViewState.Busy); + await _SOAPService.getMasterLookup(masterKeys, searchKey: searchKey); if (_SOAPService.hasError) { error = _SOAPService.error; @@ -559,7 +562,7 @@ class SOAPViewModel extends BaseViewModel { final results = services; if (_SOAPService.hasError || _prescriptionService.hasError) { - error = _SOAPService.error! + _prescriptionService.error!; + error = _SOAPService.error.toString() + _prescriptionService.error.toString(); if (allowSetState) setState(ViewState.ErrorLocal); } else if (allowSetState) setState(ViewState.Idle); } diff --git a/lib/core/viewModel/authentication_view_model.dart b/lib/core/viewModel/authentication_view_model.dart index 7e21feb8..af282ea4 100644 --- a/lib/core/viewModel/authentication_view_model.dart +++ b/lib/core/viewModel/authentication_view_model.dart @@ -66,7 +66,7 @@ class AuthenticationViewModel extends BaseViewModel { bool unverified = false; bool isFromLogin = false; APP_STATUS appStatus = APP_STATUS.LOADING; - String localToken = ""; + String? localToken = ""; bool isHuawei = false; AuthenticationViewModel({bool checkDeviceInfo = false}) { diff --git a/lib/main.dart b/lib/main.dart index ad3be8ab..92478404 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -1,3 +1,6 @@ +import 'dart:io'; + +import 'package:doctor_app_flutter/client/http_Overrides.dart'; import 'package:doctor_app_flutter/config/config.dart'; import 'package:doctor_app_flutter/config/size_config.dart'; import 'package:doctor_app_flutter/core/provider/robot_provider.dart'; @@ -18,6 +21,7 @@ import 'package:provider/provider.dart'; void main() async { WidgetsFlutterBinding.ensureInitialized(); await Firebase.initializeApp(); + HttpOverrides.global = MyHttpOverrides(); setupLocator(); runApp(MyApp()); } diff --git a/lib/screens/live_care/live_care_patient_screen.dart b/lib/screens/live_care/live_care_patient_screen.dart index 1ab0b411..827cec7e 100644 --- a/lib/screens/live_care/live_care_patient_screen.dart +++ b/lib/screens/live_care/live_care_patient_screen.dart @@ -1,21 +1,18 @@ import 'dart:async'; import 'package:doctor_app_flutter/core/enum/view_state.dart'; +import 'package:doctor_app_flutter/core/model/patient/patiant_info_model.dart'; import 'package:doctor_app_flutter/core/viewModel/LiveCarePatientViewModel.dart'; import 'package:doctor_app_flutter/icons_app/doctor_app_icons.dart'; -import 'package:doctor_app_flutter/core/model/patient/patiant_info_model.dart'; +import 'package:doctor_app_flutter/routes.dart'; import 'package:doctor_app_flutter/screens/base/base_view.dart'; import 'package:doctor_app_flutter/screens/patients/patient_search/patient_search_header.dart'; -import 'package:doctor_app_flutter/utils/translations_delegate_base_utils.dart'; import 'package:doctor_app_flutter/widgets/patients/patient_card/PatientCard.dart'; import 'package:doctor_app_flutter/widgets/shared/app_loader_widget.dart'; import 'package:doctor_app_flutter/widgets/shared/app_scaffold_widget.dart'; -import 'package:doctor_app_flutter/widgets/shared/errors/error_message.dart'; import 'package:doctor_app_flutter/widgets/shared/text_fields/app_text_field_custom_serach.dart'; import 'package:flutter/material.dart'; -import '../../routes.dart'; - class LiveCarePatientScreen extends StatefulWidget { @override _LiveCarePatientScreenState createState() => _LiveCarePatientScreenState(); @@ -102,6 +99,74 @@ class _LiveCarePatientScreenState extends State { shrinkWrap: true, itemCount: model.filterData.length, itemBuilder: (BuildContext ctxt, int index) { + // + + String jsonString = ''' + { + "PatientID": 1231755, + "SetupID": "010266", + "PatientType": 1, + "FirstName": "TAMER", + "MiddleName": "MUSA", + "LastName": "FANASHEH", + "FirstNameN": "", + "MiddleNameN": "موسى", + "LastNameN": "", + "Gender": 1, + "DateofBirth": "/Date(558910800000+0300)/", + "DateofBirthN": "25/01/1408", + "NationalityID": "JOR", + "PhoneResi": "", + "PhoneOffice": "", + "MobileNumber": "0537503378", + "FaxNumber": "", + "EmailAddress": "sultan.khan@cloudsolutions.com.sa", + "IsEmailAlertRequired": true, + "IsSMSAlertRequired": true, + "PreferredLanguage": "1", + "EmergencyContactName": "MOH", + "EmergencyContactNo": "0507845867", + "PatientIdentificationType": 2, + "PatientIdentificationNo": "2344670985", + "ProjectID": 15, + "ReceiveHealthSummaryReport": true, + "NoShowCount": 0, + "IsPatientHasMobileDeviceToken": true, + "EditedBy": 102, + "IsIVRStopped": true, + "CRSClientIdentifierID": null, + "CRSVerificationStatus": null, + "CRSVerifiedBy": null, + "CRSVerificationStatusDesc": "Sent for Manual Verification", + "CRSVerificationStatusDescN": "Sent for Manual Verification", + "NumberPosition": 1, + "Status": 2, + "IsPrivilegedMember": null, + "Address": "gffffff al malga", + "Age": 36, + "EmaiLAddress": "sultan.khan@cloudsolutions.com.sa", + "GenderDescription": "Male", + "GenderImage": "https://hmgwebservices.com/Images/GenderAvtar/Male.jpg", + "IsPatientDataVerified": false, + "IsPatientPrivilegedMember": false, + "NationalityDescription": "Jordanian", + "NationalityFlagURL": "https://hmgwebservices.com/Images/flag/JOR.png", + "POBox": "", + "PatientDataVerified": 3, + "PatientName": "TAMER MUSA FANASHEH", + "PatientTypeDescription": "Permanent File", + "PatientTypeDescriptionN": null, + "StatusDscription": "Active ", + "TempAddress": "", + "UpcomingAppointmentsNumber": 0, + "ZipCode": "966" + } + '''; + + // Map jsonObject = json.decode(jsonString); + + // + return Padding( padding: EdgeInsets.all(8.0), child: PatientCard( @@ -112,7 +177,7 @@ class _LiveCarePatientScreenState extends State { isInpatient: false, isFromLiveCare: true, onTap: () { - // TODO change the parameter to daynamic + // TODO change the parameter to daynamic Navigator.of(context).pushNamed(PATIENTS_PROFILE, arguments: { "patient": PatiantInformtion.fromJson(model.filterData[index].toJson()), "patientType": "0", @@ -122,6 +187,13 @@ class _LiveCarePatientScreenState extends State { "isSearchAndOut": false, "isFromLiveCare": true, }); + + // AppPermissionsUtils.requestVideoCallPermission( + // context: context, + // onTapGrant: () { + // locator().openVideo(model.startCallRes!, PatiantInformtion.fromJson(model.filterData[index].toJson()), + // model.startCallRes != null ? model.startCallRes!.isRecording! : true, callConnected, callDisconnected); + // }); }, // isFromSearch: widget.isSearch, ), diff --git a/lib/screens/patients/profile/profile_screen/patient_profile_screen.dart b/lib/screens/patients/profile/profile_screen/patient_profile_screen.dart index d0622caf..80162a49 100644 --- a/lib/screens/patients/profile/profile_screen/patient_profile_screen.dart +++ b/lib/screens/patients/profile/profile_screen/patient_profile_screen.dart @@ -203,8 +203,8 @@ class _PatientProfileScreenState extends State with Single arrivalType: arrivalType!, isInpatient: isInpatient, isFromLiveCare: isFromLiveCare, - from: from!, - to: to!, + from: from ?? "", + to: to ?? "", projectViewModel: projectViewModel, ), ), 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 d2696e1c..64d8caf8 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 @@ -1,25 +1,23 @@ import 'package:doctor_app_flutter/core/enum/master_lookup_key.dart'; import 'package:doctor_app_flutter/core/enum/view_state.dart'; -import 'package:doctor_app_flutter/core/viewModel/SOAP_view_model.dart'; import 'package:doctor_app_flutter/core/model/SOAP/master_key_model.dart'; import 'package:doctor_app_flutter/core/model/SOAP/selected_items/my_selected_examination.dart'; +import 'package:doctor_app_flutter/core/viewModel/SOAP_view_model.dart'; import 'package:doctor_app_flutter/screens/base/base_view.dart'; import 'package:doctor_app_flutter/screens/patients/profile/soap_update/shared_soap_widgets/bottom_sheet_title.dart'; import 'package:doctor_app_flutter/utils/translations_delegate_base_utils.dart'; import 'package:doctor_app_flutter/widgets/bottom_sheet/custom_bottom_sheet_container.dart'; import 'package:doctor_app_flutter/widgets/shared/app_scaffold_widget.dart'; import 'package:flutter/material.dart'; + import 'examinations_list_search_widget.dart'; class AddExaminationPage extends StatefulWidget { final List? mySelectedExamination; - final Function(List)? addSelectedExamination; - final Function(MasterKeyModel)? removeExamination; + final Function(List) addSelectedExamination; + final Function(MasterKeyModel) removeExamination; - AddExaminationPage( - {this.mySelectedExamination, - this.addSelectedExamination, - this.removeExamination}); + AddExaminationPage({this.mySelectedExamination, required this.addSelectedExamination, required this.removeExamination}); @override _AddExaminationPageState createState() => _AddExaminationPageState(); @@ -39,7 +37,9 @@ class _AddExaminationPageState extends State { return BaseView( onModelReady: (model) async { if (model.physicalExaminationList.length == 0) { - await model.getMasterLookup(MasterKeysService.PhysicalExamination); + await model.getMasterLookup( + MasterKeysService.PhysicalExamination, + ); } }, builder: (_, model, w) => AppScaffold( @@ -71,21 +71,17 @@ class _AddExaminationPageState extends State { child: Column( children: [ ExaminationsListSearchWidget( - mySelectedExamination: - widget.mySelectedExamination!, + mySelectedExamination: widget.mySelectedExamination!, masterList: model.physicalExaminationList, - isServiceSelected: (master) => - isServiceSelected(master), + isServiceSelected: (master) => isServiceSelected(master), removeExamination: (selectedExamination) { setState(() { - mySelectedExaminationLocal - .remove(selectedExamination); + mySelectedExaminationLocal.remove(selectedExamination); }); }, addExamination: (selectedExamination) { - mySelectedExaminationLocal.insert( - 0, selectedExamination); - // setState(() {}); + mySelectedExaminationLocal.insert(0, selectedExamination); + //setState(() {}); }, ), ], @@ -104,19 +100,16 @@ class _AddExaminationPageState extends State { : CustomBottomSheetContainer( label: "${TranslationBase.of(context).addExamination}", onTap: () { - widget - .addSelectedExamination!(mySelectedExaminationLocal); + 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) { + print("--------------"); return true; } return false; diff --git a/lib/screens/patients/profile/soap_update/objective/add_examination_widget.dart b/lib/screens/patients/profile/soap_update/objective/add_examination_widget.dart index 8058a638..c7f015f8 100644 --- a/lib/screens/patients/profile/soap_update/objective/add_examination_widget.dart +++ b/lib/screens/patients/profile/soap_update/objective/add_examination_widget.dart @@ -14,9 +14,9 @@ import 'package:provider/provider.dart'; // ignore: must_be_immutable class AddExaminationWidget extends StatefulWidget { MasterKeyModel? item; - final Function(MySelectedExamination)? removeExamination; - final Function(MySelectedExamination)? addExamination; - final bool Function(MasterKeyModel)? isServiceSelected; + final Function(MySelectedExamination) removeExamination; + final Function(MySelectedExamination) addExamination; + final bool Function(MasterKeyModel) isServiceSelected; bool isExpand; final Function() expandClick; @@ -24,9 +24,9 @@ class AddExaminationWidget extends StatefulWidget { AddExaminationWidget({ this.item, - this.removeExamination, - this.addExamination, - this.isServiceSelected, + required this.removeExamination, + required this.addExamination, + required this.isServiceSelected, this.isExpand = false, required this.expandClick, this.mySelectedExamination, @@ -73,7 +73,7 @@ class _AddExaminationWidgetState extends State { child: Row( children: [ Checkbox( - value: widget.isServiceSelected!(widget.item!), + value: widget.isServiceSelected(widget.item!), activeColor: Colors.red[800], onChanged: (bool? newValue) { onExamTap(); @@ -262,16 +262,16 @@ class _AddExaminationWidgetState extends State { onExamTap() { setState(() { - if (widget.isServiceSelected!(widget.item!)) { - if (examination.isLocal) widget.removeExamination!(examination); - widget.expandClick; + if (widget.isServiceSelected(widget.item!)) { + if (examination.isLocal) widget.removeExamination(examination); + widget.expandClick(); } else { examination.isNormal = status == 1; examination.isAbnormal = status == 2; examination.notExamined = status == 3; examination.remark = remarksController.text; - widget.addExamination!(examination); - widget.expandClick; + widget.addExamination(examination); + widget.expandClick(); } }); } diff --git a/lib/screens/patients/profile/soap_update/objective/examinations_list_search_widget.dart b/lib/screens/patients/profile/soap_update/objective/examinations_list_search_widget.dart index 025634f8..c27eefb2 100644 --- a/lib/screens/patients/profile/soap_update/objective/examinations_list_search_widget.dart +++ b/lib/screens/patients/profile/soap_update/objective/examinations_list_search_widget.dart @@ -9,13 +9,13 @@ import 'package:flutter/material.dart'; import 'add_examination_widget.dart'; class ExaminationsListSearchWidget extends StatefulWidget { - final Function(MySelectedExamination)? removeExamination; - final Function(MySelectedExamination)? addExamination; - final bool Function(MasterKeyModel)? isServiceSelected; + final Function(MySelectedExamination) removeExamination; + final Function(MySelectedExamination) addExamination; + final bool Function(MasterKeyModel) isServiceSelected; final List? masterList; final List? mySelectedExamination; - ExaminationsListSearchWidget({this.removeExamination, this.addExamination, this.isServiceSelected, this.masterList, this.mySelectedExamination}); + ExaminationsListSearchWidget({required this.removeExamination, required this.addExamination, required this.isServiceSelected, this.masterList, this.mySelectedExamination}); @override _ExaminationsListSearchWidgetState createState() => _ExaminationsListSearchWidgetState(); diff --git a/lib/screens/patients/profile/soap_update/subjective/medication/add_medication.dart b/lib/screens/patients/profile/soap_update/subjective/medication/add_medication.dart index c89b16a2..62f764e6 100644 --- a/lib/screens/patients/profile/soap_update/subjective/medication/add_medication.dart +++ b/lib/screens/patients/profile/soap_update/subjective/medication/add_medication.dart @@ -54,9 +54,7 @@ class _AddMedicationState extends State { return FractionallySizedBox( child: BaseView( onModelReady: (model) async { - model.onAddMedicationStart(allowSetState: false).whenComplete(() { - setState(() {}); - }); + model.onAddMedicationStart(allowSetState: false).whenComplete(() {}); }, builder: (_, model, w) => AppScaffold( baseViewModel: model, diff --git a/lib/widgets/patients/patient_card/PatientCard.dart b/lib/widgets/patients/patient_card/PatientCard.dart index e240be93..16099da5 100644 --- a/lib/widgets/patients/patient_card/PatientCard.dart +++ b/lib/widgets/patients/patient_card/PatientCard.dart @@ -394,7 +394,7 @@ class PatientCard extends StatelessWidget { children: [ CustomRow( label: TranslationBase.of(context).clinic + " : ", - value: patientInfo!.clinicName!, + value: patientInfo!.clinicName ?? "", ), ], ),