Null Safety Fixes & Overrides

update_flutter_3.16.0_voipcall
Aamir Muhammad 2 years ago
parent 693d352669
commit ea497ff8b1

@ -113,6 +113,8 @@ class BaseAppClient {
// } // }
body['DeviceTypeID'] = Platform.isAndroid ? 1 : 2; body['DeviceTypeID'] = Platform.isAndroid ? 1 : 2;
// body['ClinicID'] = 501;
// body['ProjectID'] = 12;
// body['DoctorID'] = 1002; //3844083 // body['DoctorID'] = 1002; //3844083
// body['TokenID'] = "@dm!n"; // body['TokenID'] = "@dm!n";

@ -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;
}
}

@ -19,7 +19,7 @@ const BASE_URL = 'https://uat.hmgwebservices.com/';
const PHARMACY_ITEMS_URL = "Services/Lists.svc/REST/GetPharmcyItems_Region_enh"; const PHARMACY_ITEMS_URL = "Services/Lists.svc/REST/GetPharmcyItems_Region_enh";
const PHARMACY_LIST_URL = "Services/Patients.svc/REST/GetPharmcyList"; 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_INSURANCE_APPROVALS_URL = "Services/DoctorApplication.svc/REST/GetApprovalStatusForInpatient";
const PATIENT_REFER_TO_DOCTOR_URL = "Services/DoctorApplication.svc/REST/ReferToDoctor"; const PATIENT_REFER_TO_DOCTOR_URL = "Services/DoctorApplication.svc/REST/ReferToDoctor";
const PATIENT_GET_DOCTOR_BY_CLINIC_URL = "Services/DoctorApplication.svc/REST/GetDoctorsByClinicID"; const PATIENT_GET_DOCTOR_BY_CLINIC_URL = "Services/DoctorApplication.svc/REST/GetDoctorsByClinicID";

@ -9,7 +9,7 @@ class PatientRegistrationModel {
String? iPAdress; String? iPAdress;
String? generalid; String? generalid;
int? patientOutSA; int? patientOutSA;
Null sessionID; dynamic sessionID;
bool? isDentalAllowedBackend; bool? isDentalAllowedBackend;
int? deviceTypeID; int? deviceTypeID;
String? tokenID; String? tokenID;
@ -39,9 +39,7 @@ class PatientRegistrationModel {
this.zipCode}); this.zipCode});
PatientRegistrationModel.fromJson(Map<String, dynamic> json) { PatientRegistrationModel.fromJson(Map<String, dynamic> json) {
patientobject = json['Patientobject'] != null patientobject = json['Patientobject'] != null ? new Patientobject.fromJson(json['Patientobject']) : null;
? new Patientobject.fromJson(json['Patientobject'])
: null;
patientIdentificationID = json['PatientIdentificationID']; patientIdentificationID = json['PatientIdentificationID'];
patientMobileNumber = json['PatientMobileNumber']; patientMobileNumber = json['PatientMobileNumber'];
logInTokenID = json['LogInTokenID']; logInTokenID = json['LogInTokenID'];

@ -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/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/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/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/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_req.dart';
import 'package:doctor_app_flutter/core/model/livecare/start_call_res.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/model/patient/patiant_info_model.dart';
import 'package:doctor_app_flutter/core/service/base/base_service.dart';
class LiveCarePatientServices extends BaseService { class LiveCarePatientServices extends BaseService {
List<PatiantInformtion> _patientList = []; List<PatiantInformtion> _patientList = [];
@ -34,9 +34,7 @@ class LiveCarePatientServices extends BaseService {
StartCallRes get startCallRes => _startCallRes; StartCallRes get startCallRes => _startCallRes;
Future getPendingPatientERForDoctorApp( Future getPendingPatientERForDoctorApp(PendingPatientERForDoctorAppRequestModel pendingPatientERForDoctorAppRequestModel) async {
PendingPatientERForDoctorAppRequestModel
pendingPatientERForDoctorAppRequestModel) async {
hasError = false; hasError = false;
await baseAppClient.post( await baseAppClient.post(
GET_PENDING_PATIENT_ER_FOR_DOCTOR_APP, GET_PENDING_PATIENT_ER_FOR_DOCTOR_APP,
@ -49,10 +47,7 @@ class LiveCarePatientServices extends BaseService {
/// add new items. /// add new items.
localPatientList.forEach((element) { localPatientList.forEach((element) {
if ((_patientList.singleWhere( if (!_patientList.any((it) => it.patientId == element.patientId)) {
(it) => it.patientId == element.patientId,
orElse: () => PatiantInformtion())) ==
null) {
_patientList.add(element); _patientList.add(element);
} }
}); });
@ -60,10 +55,7 @@ class LiveCarePatientServices extends BaseService {
/// remove items. /// remove items.
List<PatiantInformtion> removedPatientList = []; List<PatiantInformtion> removedPatientList = [];
_patientList.forEach((element) { _patientList.forEach((element) {
if ((localPatientList.singleWhere( if (localPatientList.any((it) => it.patientId == element.patientId)) {
(it) => it.patientId == element.patientId,
orElse: () => PatiantInformtion())) ==
null) {
removedPatientList.add(element); removedPatientList.add(element);
} }
}); });
@ -92,8 +84,7 @@ class LiveCarePatientServices extends BaseService {
Future startCall(StartCallReq startCallReq) async { Future startCall(StartCallReq startCallReq) async {
hasError = false; hasError = false;
await baseAppClient.post(START_LIVE_CARE_CALL, await baseAppClient.post(START_LIVE_CARE_CALL, onSuccess: (response, statusCode) async {
onSuccess: (response, statusCode) async {
_startCallRes = StartCallRes.fromJson(response); _startCallRes = StartCallRes.fromJson(response);
}, onFailure: (String error, int statusCode) { }, onFailure: (String error, int statusCode) {
hasError = true; hasError = true;
@ -103,23 +94,17 @@ class LiveCarePatientServices extends BaseService {
Future endCallWithCharge(int vcID, List<int> altServiceList) async { Future endCallWithCharge(int vcID, List<int> altServiceList) async {
hasError = false; hasError = false;
await baseAppClient.post(END_CALL_WITH_CHARGE, await baseAppClient.post(END_CALL_WITH_CHARGE, onSuccess: (dynamic response, int statusCode) {
onSuccess: (dynamic response, int statusCode) {
endCallResponse = response; endCallResponse = response;
}, onFailure: (String error, int statusCode) { }, onFailure: (String error, int statusCode) {
hasError = true; hasError = true;
super.error = error; super.error = error;
}, body: { }, body: {"VC_ID": vcID, "AltServiceList": altServiceList, "generalid": GENERAL_ID}, isLiveCare: _isLive);
"VC_ID": vcID,
"AltServiceList": altServiceList,
"generalid": GENERAL_ID
}, isLiveCare: _isLive);
} }
Future transferToAdmin(int vcID, String notes) async { Future transferToAdmin(int vcID, String notes) async {
hasError = false; hasError = false;
await baseAppClient.post(TRANSFERT_TO_ADMIN, await baseAppClient.post(TRANSFERT_TO_ADMIN, onSuccess: (dynamic response, int statusCode) {
onSuccess: (dynamic response, int statusCode) {
transferToAdminResponse = response; transferToAdminResponse = response;
}, onFailure: (String error, int statusCode) { }, onFailure: (String error, int statusCode) {
hasError = true; hasError = true;
@ -133,8 +118,7 @@ class LiveCarePatientServices extends BaseService {
Future sendSMSInstruction(int vcID) async { Future sendSMSInstruction(int vcID) async {
hasError = false; hasError = false;
await baseAppClient.post(SEND_SMS_INSTRUCTIONS, await baseAppClient.post(SEND_SMS_INSTRUCTIONS, onSuccess: (dynamic response, int statusCode) {
onSuccess: (dynamic response, int statusCode) {
transferToAdminResponse = response; transferToAdminResponse = response;
}, onFailure: (String error, int statusCode) { }, onFailure: (String error, int statusCode) {
hasError = true; hasError = true;
@ -142,14 +126,11 @@ class LiveCarePatientServices extends BaseService {
}, body: {"VC_ID": vcID, "generalid": GENERAL_ID}, isLiveCare: _isLive); }, body: {"VC_ID": vcID, "generalid": GENERAL_ID}, isLiveCare: _isLive);
} }
Future isLogin( Future isLogin({LiveCareUserLoginRequestModel? isLoginRequestModel, int? loginStatus}) async {
{LiveCareUserLoginRequestModel? isLoginRequestModel,
int? loginStatus}) async {
hasError = false; hasError = false;
await getDoctorProfile(); await getDoctorProfile();
isLoginRequestModel!.doctorId = super.doctorProfile!.doctorID; isLoginRequestModel!.doctorId = super.doctorProfile!.doctorID;
await baseAppClient.post(LIVE_CARE_IS_LOGIN, await baseAppClient.post(LIVE_CARE_IS_LOGIN, onSuccess: (response, statusCode) async {
onSuccess: (response, statusCode) async {
isLoginResponse = response; isLoginResponse = response;
}, onFailure: (String error, int statusCode) { }, onFailure: (String error, int statusCode) {
hasError = true; hasError = true;
@ -161,8 +142,7 @@ class LiveCarePatientServices extends BaseService {
hasError = false; hasError = false;
alternativeServicesList.clear(); alternativeServicesList.clear();
await baseAppClient.post(GET_ALTERNATIVE_SERVICE, await baseAppClient.post(GET_ALTERNATIVE_SERVICE, onSuccess: (dynamic response, int statusCode) {
onSuccess: (dynamic response, int statusCode) {
response['AlternativeServicesList'].forEach((v) { response['AlternativeServicesList'].forEach((v) {
alternativeServicesList.add(AlternativeService.fromJson(v)); alternativeServicesList.add(AlternativeService.fromJson(v));
}); });
@ -175,16 +155,14 @@ class LiveCarePatientServices extends BaseService {
Future addPatientToDoctorList({int? vcID}) async { Future addPatientToDoctorList({int? vcID}) async {
hasError = false; hasError = false;
await getDoctorProfile(); await getDoctorProfile();
AddPatientToDoctorListRequestModel addPatientToDoctorListRequestModel = AddPatientToDoctorListRequestModel addPatientToDoctorListRequestModel = AddPatientToDoctorListRequestModel();
AddPatientToDoctorListRequestModel();
addPatientToDoctorListRequestModel.doctorId = super.doctorProfile!.doctorID; addPatientToDoctorListRequestModel.doctorId = super.doctorProfile!.doctorID;
addPatientToDoctorListRequestModel.vCID = vcID; addPatientToDoctorListRequestModel.vCID = vcID;
addPatientToDoctorListRequestModel.isOutKsa = false; addPatientToDoctorListRequestModel.isOutKsa = false;
addPatientToDoctorListRequestModel.generalid = GENERAL_ID; addPatientToDoctorListRequestModel.generalid = GENERAL_ID;
await baseAppClient.post(ADD_PATIENT_TO_DOCTOR, await baseAppClient.post(ADD_PATIENT_TO_DOCTOR, onSuccess: (response, statusCode) async {
onSuccess: (response, statusCode) async {
isLoginResponse = response; isLoginResponse = response;
}, onFailure: (String error, int statusCode) { }, onFailure: (String error, int statusCode) {
hasError = true; hasError = true;
@ -194,16 +172,14 @@ class LiveCarePatientServices extends BaseService {
Future removePatientFromDoctorList({int? vcID}) async { Future removePatientFromDoctorList({int? vcID}) async {
hasError = false; hasError = false;
AddPatientToDoctorListRequestModel addPatientToDoctorListRequestModel = AddPatientToDoctorListRequestModel addPatientToDoctorListRequestModel = AddPatientToDoctorListRequestModel();
AddPatientToDoctorListRequestModel();
await getDoctorProfile(); await getDoctorProfile();
addPatientToDoctorListRequestModel.doctorId = super.doctorProfile!.doctorID; addPatientToDoctorListRequestModel.doctorId = super.doctorProfile!.doctorID;
addPatientToDoctorListRequestModel.vCID = vcID; addPatientToDoctorListRequestModel.vCID = vcID;
addPatientToDoctorListRequestModel.isOutKsa = false; addPatientToDoctorListRequestModel.isOutKsa = false;
addPatientToDoctorListRequestModel.generalid = GENERAL_ID; addPatientToDoctorListRequestModel.generalid = GENERAL_ID;
await baseAppClient.post(REMOVE_PATIENT_FROM_DOCTOR, await baseAppClient.post(REMOVE_PATIENT_FROM_DOCTOR, onSuccess: (response, statusCode) async {
onSuccess: (response, statusCode) async {
isLoginResponse = response; isLoginResponse = response;
}, onFailure: (String error, int statusCode) { }, onFailure: (String error, int statusCode) {
hasError = true; hasError = true;

@ -140,9 +140,12 @@ class SOAPViewModel extends BaseViewModel {
Future getMasterLookup(MasterKeysService masterKeys, {bool isBusyLocal = false, String searchKey = "", bool allowSetState = false}) async { Future getMasterLookup(MasterKeysService masterKeys, {bool isBusyLocal = false, String searchKey = "", bool allowSetState = false}) async {
if (isBusyLocal) { if (isBusyLocal) {
setState(ViewState.Busy); setState(ViewState.Busy);
} else { } else
setState(ViewState.Busy); setState(ViewState.Busy);
}
//else
// setState(ViewState.Busy);
await _SOAPService.getMasterLookup(masterKeys, searchKey: searchKey); await _SOAPService.getMasterLookup(masterKeys, searchKey: searchKey);
if (_SOAPService.hasError) { if (_SOAPService.hasError) {
error = _SOAPService.error; error = _SOAPService.error;
@ -559,7 +562,7 @@ class SOAPViewModel extends BaseViewModel {
final results = services; final results = services;
if (_SOAPService.hasError || _prescriptionService.hasError) { if (_SOAPService.hasError || _prescriptionService.hasError) {
error = _SOAPService.error! + _prescriptionService.error!; error = _SOAPService.error.toString() + _prescriptionService.error.toString();
if (allowSetState) setState(ViewState.ErrorLocal); if (allowSetState) setState(ViewState.ErrorLocal);
} else if (allowSetState) setState(ViewState.Idle); } else if (allowSetState) setState(ViewState.Idle);
} }

@ -66,7 +66,7 @@ class AuthenticationViewModel extends BaseViewModel {
bool unverified = false; bool unverified = false;
bool isFromLogin = false; bool isFromLogin = false;
APP_STATUS appStatus = APP_STATUS.LOADING; APP_STATUS appStatus = APP_STATUS.LOADING;
String localToken = ""; String? localToken = "";
bool isHuawei = false; bool isHuawei = false;
AuthenticationViewModel({bool checkDeviceInfo = false}) { AuthenticationViewModel({bool checkDeviceInfo = false}) {

@ -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/config.dart';
import 'package:doctor_app_flutter/config/size_config.dart'; import 'package:doctor_app_flutter/config/size_config.dart';
import 'package:doctor_app_flutter/core/provider/robot_provider.dart'; import 'package:doctor_app_flutter/core/provider/robot_provider.dart';
@ -18,6 +21,7 @@ import 'package:provider/provider.dart';
void main() async { void main() async {
WidgetsFlutterBinding.ensureInitialized(); WidgetsFlutterBinding.ensureInitialized();
await Firebase.initializeApp(); await Firebase.initializeApp();
HttpOverrides.global = MyHttpOverrides();
setupLocator(); setupLocator();
runApp(MyApp()); runApp(MyApp());
} }

@ -1,21 +1,18 @@
import 'dart:async'; import 'dart:async';
import 'package:doctor_app_flutter/core/enum/view_state.dart'; 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/core/viewModel/LiveCarePatientViewModel.dart';
import 'package:doctor_app_flutter/icons_app/doctor_app_icons.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/base/base_view.dart';
import 'package:doctor_app_flutter/screens/patients/patient_search/patient_search_header.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/patients/patient_card/PatientCard.dart';
import 'package:doctor_app_flutter/widgets/shared/app_loader_widget.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/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:doctor_app_flutter/widgets/shared/text_fields/app_text_field_custom_serach.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import '../../routes.dart';
class LiveCarePatientScreen extends StatefulWidget { class LiveCarePatientScreen extends StatefulWidget {
@override @override
_LiveCarePatientScreenState createState() => _LiveCarePatientScreenState(); _LiveCarePatientScreenState createState() => _LiveCarePatientScreenState();
@ -102,6 +99,74 @@ class _LiveCarePatientScreenState extends State<LiveCarePatientScreen> {
shrinkWrap: true, shrinkWrap: true,
itemCount: model.filterData.length, itemCount: model.filterData.length,
itemBuilder: (BuildContext ctxt, int index) { 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<String, dynamic> jsonObject = json.decode(jsonString);
//
return Padding( return Padding(
padding: EdgeInsets.all(8.0), padding: EdgeInsets.all(8.0),
child: PatientCard( child: PatientCard(
@ -112,7 +177,7 @@ class _LiveCarePatientScreenState extends State<LiveCarePatientScreen> {
isInpatient: false, isInpatient: false,
isFromLiveCare: true, isFromLiveCare: true,
onTap: () { onTap: () {
// TODO change the parameter to daynamic // TODO change the parameter to daynamic
Navigator.of(context).pushNamed(PATIENTS_PROFILE, arguments: { Navigator.of(context).pushNamed(PATIENTS_PROFILE, arguments: {
"patient": PatiantInformtion.fromJson(model.filterData[index].toJson()), "patient": PatiantInformtion.fromJson(model.filterData[index].toJson()),
"patientType": "0", "patientType": "0",
@ -122,6 +187,13 @@ class _LiveCarePatientScreenState extends State<LiveCarePatientScreen> {
"isSearchAndOut": false, "isSearchAndOut": false,
"isFromLiveCare": true, "isFromLiveCare": true,
}); });
// AppPermissionsUtils.requestVideoCallPermission(
// context: context,
// onTapGrant: () {
// locator<VideoCallService>().openVideo(model.startCallRes!, PatiantInformtion.fromJson(model.filterData[index].toJson()),
// model.startCallRes != null ? model.startCallRes!.isRecording! : true, callConnected, callDisconnected);
// });
}, },
// isFromSearch: widget.isSearch, // isFromSearch: widget.isSearch,
), ),

@ -203,8 +203,8 @@ class _PatientProfileScreenState extends State<PatientProfileScreen> with Single
arrivalType: arrivalType!, arrivalType: arrivalType!,
isInpatient: isInpatient, isInpatient: isInpatient,
isFromLiveCare: isFromLiveCare, isFromLiveCare: isFromLiveCare,
from: from!, from: from ?? "",
to: to!, to: to ?? "",
projectViewModel: projectViewModel, projectViewModel: projectViewModel,
), ),
), ),

@ -1,25 +1,23 @@
import 'package:doctor_app_flutter/core/enum/master_lookup_key.dart'; 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/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/master_key_model.dart';
import 'package:doctor_app_flutter/core/model/SOAP/selected_items/my_selected_examination.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/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/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/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/bottom_sheet/custom_bottom_sheet_container.dart';
import 'package:doctor_app_flutter/widgets/shared/app_scaffold_widget.dart'; import 'package:doctor_app_flutter/widgets/shared/app_scaffold_widget.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'examinations_list_search_widget.dart'; import 'examinations_list_search_widget.dart';
class AddExaminationPage extends StatefulWidget { class AddExaminationPage extends StatefulWidget {
final List<MySelectedExamination>? mySelectedExamination; final List<MySelectedExamination>? mySelectedExamination;
final Function(List<MySelectedExamination>)? addSelectedExamination; final Function(List<MySelectedExamination>) addSelectedExamination;
final Function(MasterKeyModel)? removeExamination; final Function(MasterKeyModel) removeExamination;
AddExaminationPage( AddExaminationPage({this.mySelectedExamination, required this.addSelectedExamination, required this.removeExamination});
{this.mySelectedExamination,
this.addSelectedExamination,
this.removeExamination});
@override @override
_AddExaminationPageState createState() => _AddExaminationPageState(); _AddExaminationPageState createState() => _AddExaminationPageState();
@ -39,7 +37,9 @@ class _AddExaminationPageState extends State<AddExaminationPage> {
return BaseView<SOAPViewModel>( return BaseView<SOAPViewModel>(
onModelReady: (model) async { onModelReady: (model) async {
if (model.physicalExaminationList.length == 0) { if (model.physicalExaminationList.length == 0) {
await model.getMasterLookup(MasterKeysService.PhysicalExamination); await model.getMasterLookup(
MasterKeysService.PhysicalExamination,
);
} }
}, },
builder: (_, model, w) => AppScaffold( builder: (_, model, w) => AppScaffold(
@ -71,21 +71,17 @@ class _AddExaminationPageState extends State<AddExaminationPage> {
child: Column( child: Column(
children: [ children: [
ExaminationsListSearchWidget( ExaminationsListSearchWidget(
mySelectedExamination: mySelectedExamination: widget.mySelectedExamination!,
widget.mySelectedExamination!,
masterList: model.physicalExaminationList, masterList: model.physicalExaminationList,
isServiceSelected: (master) => isServiceSelected: (master) => isServiceSelected(master),
isServiceSelected(master),
removeExamination: (selectedExamination) { removeExamination: (selectedExamination) {
setState(() { setState(() {
mySelectedExaminationLocal mySelectedExaminationLocal.remove(selectedExamination);
.remove(selectedExamination);
}); });
}, },
addExamination: (selectedExamination) { addExamination: (selectedExamination) {
mySelectedExaminationLocal.insert( mySelectedExaminationLocal.insert(0, selectedExamination);
0, selectedExamination); //setState(() {});
// setState(() {});
}, },
), ),
], ],
@ -104,19 +100,16 @@ class _AddExaminationPageState extends State<AddExaminationPage> {
: CustomBottomSheetContainer( : CustomBottomSheetContainer(
label: "${TranslationBase.of(context).addExamination}", label: "${TranslationBase.of(context).addExamination}",
onTap: () { onTap: () {
widget widget.addSelectedExamination(mySelectedExaminationLocal);
.addSelectedExamination!(mySelectedExaminationLocal);
}, },
), ),
)); ));
} }
isServiceSelected(MasterKeyModel masterKey) { isServiceSelected(MasterKeyModel masterKey) {
Iterable<MySelectedExamination> exam = mySelectedExaminationLocal.where( Iterable<MySelectedExamination> exam = mySelectedExaminationLocal.where((element) => masterKey.id == element.selectedExamination!.id && masterKey.typeId == element.selectedExamination!.typeId);
(element) =>
masterKey.id == element.selectedExamination!.id &&
masterKey.typeId == element.selectedExamination!.typeId);
if (exam.length > 0) { if (exam.length > 0) {
print("--------------");
return true; return true;
} }
return false; return false;

@ -14,9 +14,9 @@ import 'package:provider/provider.dart';
// ignore: must_be_immutable // ignore: must_be_immutable
class AddExaminationWidget extends StatefulWidget { class AddExaminationWidget extends StatefulWidget {
MasterKeyModel? item; MasterKeyModel? item;
final Function(MySelectedExamination)? removeExamination; final Function(MySelectedExamination) removeExamination;
final Function(MySelectedExamination)? addExamination; final Function(MySelectedExamination) addExamination;
final bool Function(MasterKeyModel)? isServiceSelected; final bool Function(MasterKeyModel) isServiceSelected;
bool isExpand; bool isExpand;
final Function() expandClick; final Function() expandClick;
@ -24,9 +24,9 @@ class AddExaminationWidget extends StatefulWidget {
AddExaminationWidget({ AddExaminationWidget({
this.item, this.item,
this.removeExamination, required this.removeExamination,
this.addExamination, required this.addExamination,
this.isServiceSelected, required this.isServiceSelected,
this.isExpand = false, this.isExpand = false,
required this.expandClick, required this.expandClick,
this.mySelectedExamination, this.mySelectedExamination,
@ -73,7 +73,7 @@ class _AddExaminationWidgetState extends State<AddExaminationWidget> {
child: Row( child: Row(
children: [ children: [
Checkbox( Checkbox(
value: widget.isServiceSelected!(widget.item!), value: widget.isServiceSelected(widget.item!),
activeColor: Colors.red[800], activeColor: Colors.red[800],
onChanged: (bool? newValue) { onChanged: (bool? newValue) {
onExamTap(); onExamTap();
@ -262,16 +262,16 @@ class _AddExaminationWidgetState extends State<AddExaminationWidget> {
onExamTap() { onExamTap() {
setState(() { setState(() {
if (widget.isServiceSelected!(widget.item!)) { if (widget.isServiceSelected(widget.item!)) {
if (examination.isLocal) widget.removeExamination!(examination); if (examination.isLocal) widget.removeExamination(examination);
widget.expandClick; widget.expandClick();
} else { } else {
examination.isNormal = status == 1; examination.isNormal = status == 1;
examination.isAbnormal = status == 2; examination.isAbnormal = status == 2;
examination.notExamined = status == 3; examination.notExamined = status == 3;
examination.remark = remarksController.text; examination.remark = remarksController.text;
widget.addExamination!(examination); widget.addExamination(examination);
widget.expandClick; widget.expandClick();
} }
}); });
} }

@ -9,13 +9,13 @@ import 'package:flutter/material.dart';
import 'add_examination_widget.dart'; import 'add_examination_widget.dart';
class ExaminationsListSearchWidget extends StatefulWidget { class ExaminationsListSearchWidget extends StatefulWidget {
final Function(MySelectedExamination)? removeExamination; final Function(MySelectedExamination) removeExamination;
final Function(MySelectedExamination)? addExamination; final Function(MySelectedExamination) addExamination;
final bool Function(MasterKeyModel)? isServiceSelected; final bool Function(MasterKeyModel) isServiceSelected;
final List<MasterKeyModel>? masterList; final List<MasterKeyModel>? masterList;
final List<MySelectedExamination>? mySelectedExamination; final List<MySelectedExamination>? 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 @override
_ExaminationsListSearchWidgetState createState() => _ExaminationsListSearchWidgetState(); _ExaminationsListSearchWidgetState createState() => _ExaminationsListSearchWidgetState();

@ -54,9 +54,7 @@ class _AddMedicationState extends State<AddMedication> {
return FractionallySizedBox( return FractionallySizedBox(
child: BaseView<SOAPViewModel>( child: BaseView<SOAPViewModel>(
onModelReady: (model) async { onModelReady: (model) async {
model.onAddMedicationStart(allowSetState: false).whenComplete(() { model.onAddMedicationStart(allowSetState: false).whenComplete(() {});
setState(() {});
});
}, },
builder: (_, model, w) => AppScaffold( builder: (_, model, w) => AppScaffold(
baseViewModel: model, baseViewModel: model,

@ -394,7 +394,7 @@ class PatientCard extends StatelessWidget {
children: [ children: [
CustomRow( CustomRow(
label: TranslationBase.of(context).clinic + " : ", label: TranslationBase.of(context).clinic + " : ",
value: patientInfo!.clinicName!, value: patientInfo!.clinicName ?? "",
), ),
], ],
), ),

Loading…
Cancel
Save