diff --git a/lib/config/config.dart b/lib/config/config.dart index 1173941d..c8a195a7 100644 --- a/lib/config/config.dart +++ b/lib/config/config.dart @@ -281,7 +281,6 @@ var SERVICES_PATIANT_HEADER_AR = [ "المريض الواصل" ]; - const PRIMARY_COLOR = 0xff515B5D; const TRANSACTION_NO = 0; diff --git a/lib/config/localized_values.dart b/lib/config/localized_values.dart index 0a094b9b..6500c10e 100644 --- a/lib/config/localized_values.dart +++ b/lib/config/localized_values.dart @@ -282,7 +282,7 @@ const Map> localizedValues = { 'indication': {'en': 'Indication', 'ar': 'دواعي الاستخدام'}, 'duration': {'en': 'Duration', 'ar': 'المدة الزمنية'}, 'instruction': {'en': 'Instructions', 'ar': 'إرشادات'}, - 'addMedication': {'en': 'ADD MEDICATION', 'ar': 'اضف الدواء'}, + 'addMedication': {'en': 'Add Medication', 'ar': 'اضف الدواء'}, 'route': {'en': 'Route', 'ar': 'المسار'}, 'reschedule-leave': {'en': 'Reschedule and leaves', 'ar': 'إعادة الجدولة والأوراق'}, 'no-reschedule-leave': {'en': 'No Reschedule and leaves', 'ar': 'لا إعادة جدولة ويغادر'}, @@ -704,4 +704,9 @@ const Map> localizedValues = { "edit": {"en": "Edit", "ar": "تعديل"}, "summeryReply": {"en": "Summary Reply", "ar": "موجز الرد"}, "finish": {"en": "Finish", "ar": "انهاء"}, + "severityValidationError": {"en": "Please add allergy severity", "ar": "الرجاء إضافة شدة الحساسية"}, + "inProgress": {"en": "inProgress", "ar": "تحت المعالجه"}, + "Completed": {"en": "Completed", "ar": "مكتمل"}, + "Locked": {"en": "Locked", "ar": "مقفل"}, + }; diff --git a/lib/config/size_config.dart b/lib/config/size_config.dart index 6b996b3f..abb3ddd6 100644 --- a/lib/config/size_config.dart +++ b/lib/config/size_config.dart @@ -17,15 +17,31 @@ class SizeConfig { static bool isPortrait = true; static bool isMobilePortrait = false; static bool isMobile = false; - + static bool isHeightShort = false; + static bool isHeightVeryShort = false; + static bool isHeightMiddle = false; + static bool isHeightLarge = false; + static bool isWidthLarge = false; void init(BoxConstraints constraints, Orientation orientation) { realScreenHeight = constraints.maxHeight; realScreenWidth = constraints.maxWidth; - - if (constraints.maxWidth <= MAX_SMALL_SCREEN) { isMobile = true; } + if (constraints.maxHeight < 600) { + isHeightVeryShort = true; + } else if (constraints.maxHeight < 800) { + isHeightShort = true; + } else if (constraints.maxHeight < 1000) { + isHeightMiddle = true; + } else { + isHeightLarge = true; + } + + if (constraints.maxWidth > 600) { + isWidthLarge = true; + } + if (orientation == Orientation.portrait) { isPortrait = true; if (realScreenWidth < 450) { @@ -59,5 +75,32 @@ class SizeConfig { print('widthMultiplier $widthMultiplier'); print('isPortrait $isPortrait'); print('isMobilePortrait $isMobilePortrait'); + + } + + static getTextMultiplierBasedOnWidth({double width}) { + // TODO handel LandScape case + if (width != null) { + return width / 100; + } + return widthMultiplier; + } + + static getWidthMultiplier({double width}) { + // TODO handel LandScape case + if (width != null) { + return width / 100; + } + return widthMultiplier; + } + + static getHeightMultiplier({double height}) { + // TODO handel LandScape case + if (height != null) { + return height / 100; + } + return heightMultiplier; + } + } diff --git a/lib/core/viewModel/SOAP_view_model.dart b/lib/core/viewModel/SOAP_view_model.dart index 8b789cbc..d42098a2 100644 --- a/lib/core/viewModel/SOAP_view_model.dart +++ b/lib/core/viewModel/SOAP_view_model.dart @@ -26,6 +26,12 @@ import 'package:doctor_app_flutter/models/SOAP/post_chief_complaint_request_mode import 'package:doctor_app_flutter/models/SOAP/post_histories_request_model.dart'; import 'package:doctor_app_flutter/models/SOAP/post_physical_exam_request_model.dart'; import 'package:doctor_app_flutter/models/SOAP/post_progress_note_request_model.dart'; +import 'package:doctor_app_flutter/models/SOAP/selected_items/my_selected_examination.dart'; +import 'package:doctor_app_flutter/models/patient/patiant_info_model.dart'; +import 'package:doctor_app_flutter/screens/patients/profile/soap_update/assessment/assessment_call_back.dart'; +import 'package:doctor_app_flutter/screens/patients/profile/soap_update/objective/objective_call_back.dart'; +import 'package:doctor_app_flutter/screens/patients/profile/soap_update/plan/plan_call_back.dart'; +import 'package:doctor_app_flutter/screens/patients/profile/soap_update/subjective/subjective_call_back.dart'; import 'package:flutter/material.dart'; import '../../locator.dart'; @@ -85,6 +91,13 @@ class SOAPViewModel extends BaseViewModel { _SOAPService.patientAssessmentList; int get episodeID => _SOAPService.episodeID; + bool isAddProgress = true; + bool isAddExamInProgress = true; + String progressNoteText =""; + String complaintsControllerError = ''; + String medicationControllerError = ''; + String illnessControllerError = ''; + get medicationStrengthList => _SOAPService.medicationStrengthListWithModel; get medicationDoseTimeList => _SOAPService.medicationDoseTimeListWithModel; get medicationRouteList => _SOAPService.medicationRouteListWithModel; @@ -92,6 +105,43 @@ class SOAPViewModel extends BaseViewModel { List get allMedicationList => _prescriptionService.allMedicationList; + SubjectiveCallBack subjectiveCallBack; + setSubjectiveCallBack(SubjectiveCallBack callBack) + { + this.subjectiveCallBack = callBack; + } + nextOnSubjectPage(model){ + subjectiveCallBack.nextFunction(model); + } + + ObjectiveCallBack objectiveCallBack; + setObjectiveCallBack(ObjectiveCallBack callBack) + { + this.objectiveCallBack = callBack; + } + nextOnObjectivePage(model){ + objectiveCallBack.nextFunction(model); + } + + + AssessmentCallBack assessmentCallBack; + setAssessmentCallBack(AssessmentCallBack callBack) + { + this.assessmentCallBack = callBack; + } + nextOnAssessmentPage(model){ + assessmentCallBack.nextFunction(model); + } + + PlanCallBack planCallBack; + setPlanCallBack(PlanCallBack callBack) + { + this.planCallBack = callBack; + } + nextOnPlanPage(model){ + planCallBack.nextFunction(model); + } + Future getAllergies(GetAllergiesRequestModel getAllergiesRequestModel) async { setState(ViewState.Busy); await _SOAPService.getAllergies(getAllergiesRequestModel); @@ -311,8 +361,21 @@ class SOAPViewModel extends BaseViewModel { setState(ViewState.Idle); } - Future getPatientPhysicalExam( - GetPhysicalExamReqModel getPhysicalExamReqModel) async { + Future getPatientPhysicalExam(PatiantInformtion patientInfo, + ) async { + + GetPhysicalExamReqModel getPhysicalExamReqModel = + GetPhysicalExamReqModel( + patientMRN: patientInfo.patientMRN, + episodeID: patientInfo.episodeNo == null?"0":patientInfo.episodeNo.toString(), + appointmentNo: patientInfo.appointmentNo == null ?0:int.parse( + patientInfo.appointmentNo.toString(), + ), + ); + if(patientInfo.admissionNo !=null &&patientInfo.admissionNo.isNotEmpty) + getPhysicalExamReqModel.admissionNo =int.parse(patientInfo.admissionNo); + else + getPhysicalExamReqModel.admissionNo = 0; setState(ViewState.Busy); await _SOAPService.getPatientPhysicalExam(getPhysicalExamReqModel); if (_SOAPService.hasError) { @@ -466,4 +529,15 @@ class SOAPViewModel extends BaseViewModel { break; } } + + int getFirstIndexForOldExamination(List mySelectedExamination){ + Iterable examList = mySelectedExamination.where( + (element) => !element.isLocal); + + if (examList.length > 0) { + return mySelectedExamination.indexOf(examList.first); + } else + return -1; + + } } diff --git a/lib/core/viewModel/authentication_view_model.dart b/lib/core/viewModel/authentication_view_model.dart index 56bf519e..217b7b58 100644 --- a/lib/core/viewModel/authentication_view_model.dart +++ b/lib/core/viewModel/authentication_view_model.dart @@ -294,8 +294,7 @@ class AuthenticationViewModel extends BaseViewModel { clinicID: clinicInfo.clinicID, license: true, projectID: clinicInfo.projectID, - tokenID: '', - languageID: 2);//TODO change the lan + languageID: 2);///TODO change the lan await _authService.getDoctorProfileBasedOnClinic(docInfo); if (_authService.hasError) { error = _authService.error; diff --git a/lib/locator.dart b/lib/locator.dart index aa259758..3ee2650c 100644 --- a/lib/locator.dart +++ b/lib/locator.dart @@ -109,7 +109,7 @@ void setupLocator() { locator.registerFactory(() => PatientViewModel()); locator.registerFactory(() => DashboardViewModel()); locator.registerFactory(() => SickLeaveViewModel()); - locator.registerFactory(() => SOAPViewModel()); + locator.registerLazySingleton(() => SOAPViewModel()); locator.registerFactory(() => PatientReferralViewModel()); locator.registerFactory(() => PrescriptionViewModel()); locator.registerFactory(() => ProcedureViewModel()); diff --git a/lib/models/SOAP/ChiefComplaint/GetChiefComplaintReqModel.dart b/lib/models/SOAP/ChiefComplaint/GetChiefComplaintReqModel.dart index 80188dfe..f04fd8d4 100644 --- a/lib/models/SOAP/ChiefComplaint/GetChiefComplaintReqModel.dart +++ b/lib/models/SOAP/ChiefComplaint/GetChiefComplaintReqModel.dart @@ -4,9 +4,10 @@ class GetChiefComplaintReqModel { int episodeId; int episodeID; dynamic doctorID; + int admissionNo; GetChiefComplaintReqModel( - {this.patientMRN, this.appointmentNo, this.episodeId, this.episodeID, this.doctorID}); + {this.patientMRN, this.appointmentNo, this.episodeId, this.episodeID, this.doctorID, this.admissionNo}); GetChiefComplaintReqModel.fromJson(Map json) { patientMRN = json['PatientMRN']; @@ -14,16 +15,27 @@ class GetChiefComplaintReqModel { episodeId = json['EpisodeId']; episodeID = json['EpisodeID']; doctorID = json['DoctorID']; - -} + admissionNo = json['admissionNo']; + } Map toJson() { final Map data = new Map(); data['PatientMRN'] = this.patientMRN; - data['AppointmentNo'] = this.appointmentNo; - data['EpisodeId'] = this.episodeId; - data['EpisodeID'] = this.episodeID; - data['DoctorID'] = this.doctorID; + if (this.appointmentNo != null) { + data['AppointmentNo'] = this.appointmentNo; + } + if (this.episodeId != null) { + data['EpisodeId'] = this.episodeId; + } + if (episodeID != null) { + data['EpisodeID'] = this.episodeID; + } + if (doctorID != null) { + data['DoctorID'] = this.doctorID; + } + if (this.admissionNo != null) { + data['AdmissionNo'] = this.admissionNo; + } return data; } diff --git a/lib/models/SOAP/GetPhysicalExamReqModel.dart b/lib/models/SOAP/GetPhysicalExamReqModel.dart index 5145c419..710dafd1 100644 --- a/lib/models/SOAP/GetPhysicalExamReqModel.dart +++ b/lib/models/SOAP/GetPhysicalExamReqModel.dart @@ -1,6 +1,7 @@ class GetPhysicalExamReqModel { int patientMRN; int appointmentNo; + int admissionNo; String episodeID; String from; String to; @@ -10,6 +11,7 @@ class GetPhysicalExamReqModel { GetPhysicalExamReqModel({ this.patientMRN, this.appointmentNo, + this.admissionNo, this.episodeID, this.from, this.to, @@ -31,11 +33,13 @@ class GetPhysicalExamReqModel { final Map data = new Map(); data['PatientMRN'] = this.patientMRN; data['AppointmentNo'] = this.appointmentNo; + data['AdmissionNo'] = this.admissionNo; data['EpisodeID'] = this.episodeID; data['From'] = this.from; data['To'] = this.to; data['DoctorID'] = this.doctorID; data['EditedBy'] = this.editedBy; + return data; } } diff --git a/lib/models/SOAP/my_selected_allergy.dart b/lib/models/SOAP/my_selected_allergy.dart deleted file mode 100644 index 90031230..00000000 --- a/lib/models/SOAP/my_selected_allergy.dart +++ /dev/null @@ -1,54 +0,0 @@ -import 'package:doctor_app_flutter/models/SOAP/master_key_model.dart'; - -class MySelectedAllergy { - MasterKeyModel selectedAllergySeverity; - MasterKeyModel selectedAllergy; - String remark; - bool isChecked; - bool isExpanded; - bool isLocal; - int createdBy; - bool hasValidationError; - - MySelectedAllergy( - {this.selectedAllergySeverity, - this.selectedAllergy, - this.remark, - this.isChecked, - this.isExpanded = true, - this.isLocal = true, - this.createdBy, - this.hasValidationError = false}); - - MySelectedAllergy.fromJson(Map json) { - selectedAllergySeverity = json['selectedAllergySeverity'] != null - ? new MasterKeyModel.fromJson(json['selectedAllergySeverity']) - : null; - selectedAllergy = json['selectedAllergy'] != null - ? new MasterKeyModel.fromJson(json['selectedAllergy']) - : null; - remark = json['remark']; - isChecked = json['isChecked']; - isExpanded = json['isExpanded']; - isLocal = json['isLocal']; - createdBy = json['createdBy']; - hasValidationError = json['hasValidationError']; - } - - Map toJson() { - final Map data = new Map(); - if (this.selectedAllergySeverity != null) { - data['selectedAllergySeverity'] = this.selectedAllergySeverity.toJson(); - } - if (this.selectedAllergy != null) { - data['selectedAllergy'] = this.selectedAllergy.toJson(); - } - data['remark'] = this.remark; - data['isChecked'] = this.isChecked; - data['isExpanded'] = this.isExpanded; - data['createdBy'] = this.createdBy; - data['isLocal'] = this.isLocal; - data['hasValidationError'] = this.hasValidationError; - return data; - } -} diff --git a/lib/models/SOAP/my_selected_assement.dart b/lib/models/SOAP/my_selected_assement.dart deleted file mode 100644 index 4d4afc2d..00000000 --- a/lib/models/SOAP/my_selected_assement.dart +++ /dev/null @@ -1,65 +0,0 @@ -import 'package:doctor_app_flutter/models/SOAP/master_key_model.dart'; - -class MySelectedAssessment { - MasterKeyModel selectedICD; - MasterKeyModel selectedDiagnosisCondition; - MasterKeyModel selectedDiagnosisType; - String remark; - int appointmentId; - int createdBy; - String createdOn; - int doctorID; - String doctorName; - String icdCode10ID; - - MySelectedAssessment( - {this.selectedICD, - this.selectedDiagnosisCondition, - this.selectedDiagnosisType, - this.remark, this.appointmentId, this.createdBy, - this.createdOn, - this.doctorID, - this.doctorName, - this.icdCode10ID}); - - MySelectedAssessment.fromJson(Map json) { - selectedICD = json['selectedICD'] != null - ? new MasterKeyModel.fromJson(json['selectedICD']) - : null; - selectedDiagnosisCondition = json['selectedDiagnosisCondition'] != null - ? new MasterKeyModel.fromJson(json['selectedDiagnosisCondition']) - : null; - selectedDiagnosisType = json['selectedDiagnosisType'] != null - ? new MasterKeyModel.fromJson(json['selectedDiagnosisType']) - : null; - remark = json['remark']; - appointmentId = json['appointmentId']; - createdBy = json['createdBy']; - createdOn = json['createdOn']; - doctorID = json['doctorID']; - doctorName = json['doctorName']; - icdCode10ID = json['icdCode10ID']; - } - - Map toJson() { - final Map data = new Map(); - - if (this.selectedICD != null) { - data['selectedICD'] = this.selectedICD.toJson(); - } - if (this.selectedDiagnosisCondition != null) { - data['selectedICD'] = this.selectedDiagnosisCondition.toJson(); - } - if (this.selectedDiagnosisType != null) { - data['selectedICD'] = this.selectedDiagnosisType.toJson(); - } - data['remark'] = this.remark; - data['appointmentId'] = this.appointmentId; - data['createdBy'] = this.createdBy; - data['createdOn'] = this.createdOn; - data['doctorID'] = this.doctorID; - data['doctorName'] = this.doctorName; - data['icdCode10ID'] = this.icdCode10ID; - return data; - } -} diff --git a/lib/models/SOAP/my_selected_examination.dart b/lib/models/SOAP/my_selected_examination.dart deleted file mode 100644 index 6a3ecf99..00000000 --- a/lib/models/SOAP/my_selected_examination.dart +++ /dev/null @@ -1,61 +0,0 @@ -import 'package:doctor_app_flutter/models/SOAP/master_key_model.dart'; - -class MySelectedExamination { - MasterKeyModel selectedExamination; - String remark; - bool isNormal; - bool isAbnormal; - bool notExamined; - bool isNew; - bool isLocal; - int createdBy; - String createdOn; - String editedOn; - - MySelectedExamination({ - this.selectedExamination, - this.remark, - this.isNormal = false, - this.isAbnormal = false, - this.notExamined = true, - this.isNew = true, - this.isLocal = true, - this.createdBy, - this.createdOn, - this.editedOn, - }); - - MySelectedExamination.fromJson(Map json) { - selectedExamination = json['selectedExamination'] != null - ? new MasterKeyModel.fromJson(json['selectedExamination']) - : null; - remark = json['remark']; - isNormal = json['isNormal']; - isAbnormal = json['isAbnormal']; - notExamined = json['notExamined']; - isNew = json['isNew']; - createdBy = json['createdBy']; - createdOn = json['createdOn']; - editedOn = json['editedOn']; - isLocal = json['isLocal']; - } - - Map toJson() { - final Map data = new Map(); - - if (this.selectedExamination != null) { - data['selectedExamination'] = this.selectedExamination.toJson(); - } - data['remark'] = this.remark; - data['isNormal'] = this.isNormal; - data['isAbnormal'] = this.isAbnormal; - data['notExamined'] = this.notExamined; - data['isNew'] = this.isNew; - data['createdBy'] = this.createdBy; - data['createdOn'] = this.createdOn; - data['editedOn'] = this.editedOn; - data['isLocal'] = this.isLocal; - - return data; - } -} diff --git a/lib/models/SOAP/my_selected_history.dart b/lib/models/SOAP/my_selected_history.dart deleted file mode 100644 index 91f66910..00000000 --- a/lib/models/SOAP/my_selected_history.dart +++ /dev/null @@ -1,33 +0,0 @@ -import 'package:doctor_app_flutter/models/SOAP/master_key_model.dart'; - -class MySelectedHistory { - MasterKeyModel selectedHistory; - String remark; - bool isChecked; - bool isLocal; - - MySelectedHistory( - { this.selectedHistory, this.remark, this.isChecked, this.isLocal = true}); - - MySelectedHistory.fromJson(Map json) { - - selectedHistory = json['selectedHistory'] != null - ? new MasterKeyModel.fromJson(json['selectedHistory']) - : null; - remark = json['remark']; - remark = json['isChecked']; - isLocal = json['isLocal']; - } - - Map toJson() { - final Map data = new Map(); - - if (this.selectedHistory != null) { - data['selectedHistory'] = this.selectedHistory.toJson(); - } - data['remark'] = this.remark; - data['isChecked'] = this.remark; - data['isLocal'] = this.isLocal; - return data; - } -} diff --git a/lib/models/SOAP/post_chief_complaint_request_model.dart b/lib/models/SOAP/post_chief_complaint_request_model.dart index f1e9c2b4..682342df 100644 --- a/lib/models/SOAP/post_chief_complaint_request_model.dart +++ b/lib/models/SOAP/post_chief_complaint_request_model.dart @@ -2,6 +2,7 @@ class PostChiefComplaintRequestModel { int appointmentNo; int episodeID; int patientMRN; + int admissionNo; String chiefComplaint; String hopi; String currentMedication; @@ -11,7 +12,6 @@ class PostChiefComplaintRequestModel { dynamic doctorID; dynamic editedBy; - PostChiefComplaintRequestModel( {this.appointmentNo, this.episodeID, @@ -23,7 +23,8 @@ class PostChiefComplaintRequestModel { this.isLactation, this.doctorID, this.editedBy, - this.numberOfWeeks}); + this.numberOfWeeks, + this.admissionNo}); PostChiefComplaintRequestModel.fromJson(Map json) { appointmentNo = json['AppointmentNo']; @@ -37,12 +38,18 @@ class PostChiefComplaintRequestModel { numberOfWeeks = json['numberOfWeeks']; doctorID = json['DoctorID']; editedBy = json['EditedBy']; + admissionNo = json['AdmissionNo']; } Map toJson() { final Map data = new Map(); - data['AppointmentNo'] = this.appointmentNo; - data['EpisodeID'] = this.episodeID; + if (appointmentNo != null) { + data['AppointmentNo'] = this.appointmentNo; + } + + if (episodeID != null) { + data['EpisodeID'] = this.episodeID; + } data['PatientMRN'] = this.patientMRN; data['chiefComplaint'] = this.chiefComplaint; data['Hopi'] = this.hopi; @@ -51,7 +58,12 @@ class PostChiefComplaintRequestModel { data['isLactation'] = this.isLactation; data['numberOfWeeks'] = this.numberOfWeeks; data['DoctorID'] = this.doctorID; - data['EditedBy'] = this.editedBy; + if (editedBy != null) { + data['EditedBy'] = this.editedBy; + } + if (admissionNo != null) { + data['AdmissionNo'] = this.admissionNo; + } return data; } diff --git a/lib/models/SOAP/post_physical_exam_request_model.dart b/lib/models/SOAP/post_physical_exam_request_model.dart index 52836232..f056f168 100644 --- a/lib/models/SOAP/post_physical_exam_request_model.dart +++ b/lib/models/SOAP/post_physical_exam_request_model.dart @@ -1,12 +1,13 @@ - class PostPhysicalExamRequestModel { - List listHisProgNotePhysicalExaminationVM; + List + listHisProgNotePhysicalExaminationVM; PostPhysicalExamRequestModel({this.listHisProgNotePhysicalExaminationVM}); PostPhysicalExamRequestModel.fromJson(Map json) { if (json['listHisProgNotePhysicalExaminationVM'] != null) { - listHisProgNotePhysicalExaminationVM = new List(); + listHisProgNotePhysicalExaminationVM = + new List(); json['listHisProgNotePhysicalExaminationVM'].forEach((v) { listHisProgNotePhysicalExaminationVM .add(new ListHisProgNotePhysicalExaminationVM.fromJson(v)); @@ -17,98 +18,105 @@ class PostPhysicalExamRequestModel { Map toJson() { final Map data = new Map(); if (this.listHisProgNotePhysicalExaminationVM != null) { - data['listHisProgNotePhysicalExaminationVM'] = - this.listHisProgNotePhysicalExaminationVM.map((v) => v.toJson()).toList(); + data['listHisProgNotePhysicalExaminationVM'] = this + .listHisProgNotePhysicalExaminationVM + .map((v) => v.toJson()) + .toList(); } return data; } } - class ListHisProgNotePhysicalExaminationVM { - int episodeId; - int appointmentNo; - int examType; - int examId; - int patientMRN; - bool isNormal; - bool isAbnormal; - bool notExamined; - String examName; - String examinationTypeName; - int examinationType; - String remarks; - bool isNew; - int createdBy; - String createdOn; - String createdByName; - int editedBy; - String editedOn; - String editedByName; +class ListHisProgNotePhysicalExaminationVM { + int episodeId; + int appointmentNo; + int admissionNo; + int examType; + int examId; + int patientMRN; + bool isNormal; + bool isAbnormal; + bool notExamined; + String examName; + String examinationTypeName; + int examinationType; + String remarks; + bool isNew; + int createdBy; + String createdOn; + String createdByName; + int editedBy; + String editedOn; + String editedByName; - ListHisProgNotePhysicalExaminationVM( - {this.episodeId, - this.appointmentNo, - this.examType, - this.examId, - this.patientMRN, - this.isNormal, - this.isAbnormal, - this.notExamined, - this.examName, - this.examinationTypeName, - this.examinationType, - this.remarks, - this.isNew, - this.createdBy, - this.createdOn, - this.createdByName, - this.editedBy, - this.editedOn, - this.editedByName}); + ListHisProgNotePhysicalExaminationVM( + {this.episodeId, + this.appointmentNo, + this.admissionNo, + this.examType, + this.examId, + this.patientMRN, + this.isNormal, + this.isAbnormal, + this.notExamined, + this.examName, + this.examinationTypeName, + this.examinationType, + this.remarks, + this.isNew, + this.createdBy, + this.createdOn, + this.createdByName, + this.editedBy, + this.editedOn, + this.editedByName}); - ListHisProgNotePhysicalExaminationVM.fromJson(Map json) { - episodeId = json['episodeId']; - appointmentNo = json['appointmentNo']; - examType = json['examType']; - examId = json['examId']; - patientMRN = json['patientMRN']; - isNormal = json['isNormal']; - isAbnormal = json['isAbnormal']; - notExamined = json['notExamined']; - examName = json['examName']; - examinationTypeName = json['examinationTypeName']; - examinationType = json['examinationType']; - remarks = json['remarks']; - isNew = json['isNew']; - createdBy = json['createdBy']; - createdOn = json['createdOn']; - createdByName = json['createdByName']; - editedBy = json['editedBy']; - editedOn = json['editedOn']; - editedByName = json['editedByName']; - } + ListHisProgNotePhysicalExaminationVM.fromJson(Map json) { + episodeId = json['episodeId']; + appointmentNo = json['appointmentNo']; + admissionNo = json['AdmissionNo']; - Map toJson() { - final Map data = new Map(); - data['episodeId'] = this.episodeId; - data['appointmentNo'] = this.appointmentNo; - data['examType'] = this.examType; - data['examId'] = this.examId; - data['patientMRN'] = this.patientMRN; - data['isNormal'] = this.isNormal; - data['isAbnormal'] = this.isAbnormal; - data['notExamined'] = this.notExamined; - data['examName'] = this.examName; - data['examinationTypeName'] = this.examinationTypeName; - data['examinationType'] = this.examinationType; - data['remarks'] = this.remarks; - data['isNew'] = this.isNew; - data['createdBy'] = this.createdBy; - data['createdOn'] = this.createdOn; - data['createdByName'] = this.createdByName; - data['editedBy'] = this.editedBy; - data['editedOn'] = this.editedOn; - data['editedByName'] = this.editedByName; - return data; - } + examType = json['examType']; + examId = json['examId']; + patientMRN = json['patientMRN']; + isNormal = json['isNormal']; + isAbnormal = json['isAbnormal']; + notExamined = json['notExamined']; + examName = json['examName']; + examinationTypeName = json['examinationTypeName']; + examinationType = json['examinationType']; + remarks = json['remarks']; + isNew = json['isNew']; + createdBy = json['createdBy']; + createdOn = json['createdOn']; + createdByName = json['createdByName']; + editedBy = json['editedBy']; + editedOn = json['editedOn']; + editedByName = json['editedByName']; } + + Map toJson() { + final Map data = new Map(); + data['episodeId'] = this.episodeId; + data['appointmentNo'] = this.appointmentNo; + data['admissionNo'] = this.admissionNo; + data['examType'] = this.examType; + data['examId'] = this.examId; + data['patientMRN'] = this.patientMRN; + data['isNormal'] = this.isNormal; + data['isAbnormal'] = this.isAbnormal; + data['notExamined'] = this.notExamined; + data['examName'] = this.examName; + data['examinationTypeName'] = this.examinationTypeName; + data['examinationType'] = this.examinationType; + data['remarks'] = this.remarks; + data['isNew'] = this.isNew; + data['createdBy'] = this.createdBy; + data['createdOn'] = this.createdOn; + data['createdByName'] = this.createdByName; + data['editedBy'] = this.editedBy; + data['editedOn'] = this.editedOn; + data['editedByName'] = this.editedByName; + return data; + } +} diff --git a/lib/models/SOAP/selected_items/my_selected_allergy.dart b/lib/models/SOAP/selected_items/my_selected_allergy.dart new file mode 100644 index 00000000..512a4f64 --- /dev/null +++ b/lib/models/SOAP/selected_items/my_selected_allergy.dart @@ -0,0 +1,23 @@ +import 'package:doctor_app_flutter/models/SOAP/master_key_model.dart'; + +class MySelectedAllergy { + MasterKeyModel selectedAllergySeverity; + MasterKeyModel selectedAllergy; + String remark; + bool isChecked; + bool isExpanded; + bool isLocal; + int createdBy; + bool hasValidationError; + + MySelectedAllergy( + {this.selectedAllergySeverity, + this.selectedAllergy, + this.remark, + this.isChecked, + this.isExpanded = true, + this.isLocal = true, + this.createdBy, + this.hasValidationError = false}); + +} diff --git a/lib/models/SOAP/selected_items/my_selected_assement.dart b/lib/models/SOAP/selected_items/my_selected_assement.dart new file mode 100644 index 00000000..01572e6d --- /dev/null +++ b/lib/models/SOAP/selected_items/my_selected_assement.dart @@ -0,0 +1,24 @@ +import 'package:doctor_app_flutter/models/SOAP/master_key_model.dart'; + +class MySelectedAssessment { + MasterKeyModel selectedICD; + MasterKeyModel selectedDiagnosisCondition; + MasterKeyModel selectedDiagnosisType; + String remark; + int appointmentId; + int createdBy; + String createdOn; + int doctorID; + String doctorName; + String icdCode10ID; + + MySelectedAssessment( + {this.selectedICD, + this.selectedDiagnosisCondition, + this.selectedDiagnosisType, + this.remark, this.appointmentId, this.createdBy, + this.createdOn, + this.doctorID, + this.doctorName, + this.icdCode10ID}); +} diff --git a/lib/models/SOAP/selected_items/my_selected_examination.dart b/lib/models/SOAP/selected_items/my_selected_examination.dart new file mode 100644 index 00000000..75f67ae2 --- /dev/null +++ b/lib/models/SOAP/selected_items/my_selected_examination.dart @@ -0,0 +1,27 @@ +import 'package:doctor_app_flutter/models/SOAP/master_key_model.dart'; + +class MySelectedExamination { + MasterKeyModel selectedExamination; + String remark; + bool isNormal; + bool isAbnormal; + bool notExamined; + bool isNew; + bool isLocal; + int createdBy; + String createdOn; + String editedOn; + + MySelectedExamination({ + this.selectedExamination, + this.remark, + this.isNormal = false, + this.isAbnormal = false, + this.notExamined = true, + this.isNew = true, + this.isLocal = true, + this.createdBy, + this.createdOn, + this.editedOn, + }); +} diff --git a/lib/models/SOAP/selected_items/my_selected_history.dart b/lib/models/SOAP/selected_items/my_selected_history.dart new file mode 100644 index 00000000..3769c418 --- /dev/null +++ b/lib/models/SOAP/selected_items/my_selected_history.dart @@ -0,0 +1,11 @@ +import 'package:doctor_app_flutter/models/SOAP/master_key_model.dart'; + +class MySelectedHistory { + MasterKeyModel selectedHistory; + String remark; + bool isChecked; + bool isLocal; + + MySelectedHistory( + {this.selectedHistory, this.remark, this.isChecked, this.isLocal = true}); +} diff --git a/lib/models/patient/patiant_info_model.dart b/lib/models/patient/patiant_info_model.dart index 83a70b01..df966f03 100644 --- a/lib/models/patient/patiant_info_model.dart +++ b/lib/models/patient/patiant_info_model.dart @@ -79,95 +79,93 @@ class PatiantInformtion { int vcId; String voipToken; - PatiantInformtion({this.patientDetails, - this.projectId, - this.clinicId, - this.doctorId, - this.patientId, - this.doctorName, - this.doctorNameN, - this.firstName, - this.middleName, - this.lastName, - this.firstNameN, - this.middleNameN, - this.lastNameN, - this.gender, - this.dateofBirth, - this.nationalityId, - this.mobileNumber, - this.emailAddress, - this.patientIdentificationNo, - this.patientType, - this.admissionNo, - this.admissionDate, - this.createdOn, - this.roomId, - this.bedId, - this.nursingStationId, - this.description, - this.clinicDescription, - this.clinicDescriptionN, - this.nationalityName, - this.nationalityNameN, - this.age, - this.genderDescription, - this.nursingStationName, - this.appointmentDate, - this.startTime, - this.appointmentNo, - this.arrivalTime, - this.arrivalTimeD, - this.callStatus, - this.callStatusDisc, - this.callTypeID, - this.clientRequestID, - this.clinicName, - this.consoltationEnd, - this.consultationNotes, - this.appointmentType, - this.appointmentTypeId, - this.arrivedOn, - this.clinicGroupId, - this.companyName, - this.dischargeStatus, - this.doctorDetails, - this.endTime, - this.episodeNo, - this.fallRiskScore, - this.genderInt, - this.isSigned, - this.medicationOrders, - this.nationality, - this.patientMRN, - this.visitType, - this.fullName, - this.fullNameN, - this.nationalityFlagURL, - this.patientStatusType, - this.patientStatus, - this.visitTypeId, - this.startTimes, - this.dischargeDate, - this.status, - this.vcId, - this.voipToken, - this.admissionDateWithDateTimeForm, + PatiantInformtion( + {this.patientDetails, + this.projectId, + this.clinicId, + this.doctorId, + this.patientId, + this.doctorName, + this.doctorNameN, + this.firstName, + this.middleName, + this.lastName, + this.firstNameN, + this.middleNameN, + this.lastNameN, + this.gender, + this.dateofBirth, + this.nationalityId, + this.mobileNumber, + this.emailAddress, + this.patientIdentificationNo, + this.patientType, + this.admissionNo, + this.admissionDate, + this.createdOn, + this.roomId, + this.bedId, + this.nursingStationId, + this.description, + this.clinicDescription, + this.clinicDescriptionN, + this.nationalityName, + this.nationalityNameN, + this.age, + this.genderDescription, + this.nursingStationName, + this.appointmentDate, + this.startTime, + this.appointmentNo, + this.arrivalTime, + this.arrivalTimeD, + this.callStatus, + this.callStatusDisc, + this.callTypeID, + this.clientRequestID, + this.clinicName, + this.consoltationEnd, + this.consultationNotes, + this.appointmentType, + this.appointmentTypeId, + this.arrivedOn, + this.clinicGroupId, + this.companyName, + this.dischargeStatus, + this.doctorDetails, + this.endTime, + this.episodeNo, + this.fallRiskScore, + this.genderInt, + this.isSigned, + this.medicationOrders, + this.nationality, + this.patientMRN, + this.visitType, + this.fullName, + this.fullNameN, + this.nationalityFlagURL, + this.patientStatusType, + this.patientStatus, + this.visitTypeId, + this.startTimes, + this.dischargeDate, + this.status, + this.vcId, + this.voipToken, + this.admissionDateWithDateTimeForm, this.appointmentDateWithDateTimeForm}); - PatiantInformtion.fromJson(Map json) { { - patientDetails = json['patientDetails'] != null - ? new PatiantInformtion.fromJson(json['patientDetails']) - : null; + patientDetails = json['patientDetails'] != null ? new PatiantInformtion.fromJson(json['patientDetails']) : null; projectId = json["ProjectID"] ?? json["projectID"]; clinicId = json["ClinicID"] ?? json["clinicID"]; doctorId = json["DoctorID"] ?? json["doctorID"]; patientId = json["PatientID"] != null ? json["PatientID"] is String - ? int.parse(json["PatientID"]) - : json["PatientID"] + ? int.parse(json["PatientID"]) + : json["PatientID"] : json["patientID"] ?? json['patientMRN'] ?? json['PatientMRN']; doctorName = json["DoctorName"] ?? json["doctorName"]; doctorNameN = json["DoctorNameN"] ?? json["doctorNameN"]; @@ -179,18 +177,16 @@ class PatiantInformtion { lastNameN = json["LastNameN"] ?? json["lastNameN"]; gender = json["Gender"] != null ? json["Gender"] is String - ? int.parse(json["Gender"]) - : json["Gender"] + ? int.parse(json["Gender"]) + : json["Gender"] : json["gender"]; fullName = json["fullName"] ?? json["fullName"] ?? json["PatientName"]; - fullNameN = - json["fullNameN"] ?? json["fullNameN"] ?? json["PatientName"]; + fullNameN = json["fullNameN"] ?? json["fullNameN"] ?? json["PatientName"]; dateofBirth = json["DateofBirth"] ?? json["dob"] ?? json['DateOfBirth']; nationalityId = json["NationalityID"] ?? json["nationalityID"]; mobileNumber = json["MobileNumber"] ?? json["mobileNumber"]; emailAddress = json["EmailAddress"] ?? json["emailAddress"]; - patientIdentificationNo = - json["PatientIdentificationNo"] ?? json["patientIdentificationNo"]; + patientIdentificationNo = json["PatientIdentificationNo"] ?? json["patientIdentificationNo"]; //TODO make 7 dynamic when the backend retrun it in patient arrival patientType = json["PatientType"] ?? json["patientType"] ?? 1; admissionNo = json["AdmissionNo"] ?? json["admissionNo"]; @@ -200,16 +196,10 @@ class PatiantInformtion { bedId = json["BedID"] ?? json["bedID"]; nursingStationId = json["NursingStationID"] ?? json["nursingStationID"]; description = json["Description"] ?? json["description"]; - clinicDescription = - json["ClinicDescription"] ?? json["clinicDescription"]; - clinicDescriptionN = - json["ClinicDescriptionN"] ?? json["clinicDescriptionN"]; - nationalityName = json["NationalityName"] ?? - json["nationalityName"] ?? - json['NationalityName']; - nationalityNameN = json["NationalityNameN"] ?? - json["nationalityNameN"] ?? - json['NationalityNameN']; + clinicDescription = json["ClinicDescription"] ?? json["clinicDescription"]; + clinicDescriptionN = json["ClinicDescriptionN"] ?? json["clinicDescriptionN"]; + nationalityName = json["NationalityName"] ?? json["nationalityName"] ?? json['NationalityName']; + nationalityNameN = json["NationalityNameN"] ?? json["nationalityNameN"] ?? json['NationalityNameN']; age = json["Age"] ?? json["age"]; genderDescription = json["GenderDescription"]; nursingStationName = json["NursingStationName"]; @@ -217,8 +207,7 @@ class PatiantInformtion { startTime = json["startTime"] ?? json['StartTime']; appointmentNo = json['appointmentNo'] ?? json['AppointmentNo']; appointmentType = json['appointmentType']; - appointmentTypeId = - json['appointmentTypeId'] ?? json['appointmentTypeid']; + appointmentTypeId = json['appointmentTypeId'] ?? json['appointmentTypeid']; arrivedOn = json['ArrivedOn'] ?? json['arrivedOn'] ?? json['ArrivedOn']; clinicGroupId = json['clinicGroupId']; companyName = json['companyName']; @@ -234,16 +223,15 @@ class PatiantInformtion { json['PatientMRN'] ?? (json["PatientID"] != null ? int?.parse(json["PatientID"].toString()) - : json["patientID"] != null ? int?.parse( - json["patientID"].toString()) : json["patientId"] != null ? int - ?.parse(json["patientId"].toString()) : ''); + : json["patientID"] != null + ? int?.parse(json["patientID"].toString()) + : json["patientId"] != null + ? int?.parse(json["patientId"].toString()) + : ''); visitType = json['visitType'] ?? json['visitType'] ?? json['visitType']; - nationalityFlagURL = - json['NationalityFlagURL'] ?? json['NationalityFlagURL']; - patientStatusType = - json['patientStatusType'] ?? json['PatientStatusType']; - visitTypeId = - json['visitTypeId'] ?? json['visitTypeId'] ?? json['visitTypeid']; + nationalityFlagURL = json['NationalityFlagURL'] ?? json['NationalityFlagURL']; + patientStatusType = json['patientStatusType'] ?? json['PatientStatusType']; + visitTypeId = json['visitTypeId'] ?? json['visitTypeId'] ?? json['visitTypeid']; startTimes = json['StartTime'] ?? json['StartTime']; dischargeDate = json['DischargeDate']; status = json['Status']; @@ -262,16 +250,15 @@ class PatiantInformtion { voipToken = json['VoipToken']; admissionDateWithDateTimeForm = json["AdmissionDate"] != null ? AppDateUtils.convertStringToDate(json["AdmissionDate"]) - : json["admissionDate"] != null ? AppDateUtils.convertStringToDate( - json["admissionDate"]) : null; + : json["admissionDate"] != null + ? AppDateUtils.convertStringToDate(json["admissionDate"]) + : null; appointmentDateWithDateTimeForm = - json["AppointmentDate"] != null ? AppDateUtils.convertStringToDate( - json["AppointmentDate"]) : null; + json["AppointmentDate"] != null ? AppDateUtils.convertStringToDate(json["AppointmentDate"]) : null; } } - Map toJson() { final Map data = new Map(); @@ -315,9 +302,9 @@ class PatiantInformtion { data["Gender"] = this.gender; data["gender"] = this.gender; - data['Age'] = this.age; - data['AppointmentDate'] = this.appointmentDate.isNotEmpty?this.appointmentDate:null; + data['AppointmentDate'] = this.appointmentDate.isNotEmpty ? this.appointmentDate : null; + data['AppointmentNo'] = this.appointmentNo; data['ArrivalTime'] = this.arrivalTime; data['ArrivalTimeD'] = this.arrivalTimeD; @@ -343,4 +330,4 @@ class PatiantInformtion { data['DateOfBirth'] = this.dateofBirth; return data; } -} \ No newline at end of file +} diff --git a/lib/screens/auth/verification_methods_screen.dart b/lib/screens/auth/verification_methods_screen.dart index a765ee70..379d3cb6 100644 --- a/lib/screens/auth/verification_methods_screen.dart +++ b/lib/screens/auth/verification_methods_screen.dart @@ -71,321 +71,323 @@ class _VerificationMethodsScreenState extends State { margin: EdgeInsetsDirectional.fromSTEB(30, 0, 30, 0), height: SizeConfig.realScreenHeight * .95, width: SizeConfig.realScreenWidth, - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - // mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - SizedBox( - height: 80, - ), - if(authenticationViewModel.isFromLogin) - InkWell( - onTap: (){ - authenticationViewModel.setUnverified(false,isFromLogin: false); - authenticationViewModel.setAppStatus(APP_STATUS.UNAUTHENTICATED); - }, - child: Icon(Icons.arrow_back_ios,color: Color(0xFF2B353E),) - - ), - Container( - - child: Column( - children: [ - SizedBox( - height: 20, - ), - authenticationViewModel.user != null && isMoreOption == false - ? Column( - mainAxisAlignment: - MainAxisAlignment.spaceEvenly, - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - - AppText( - TranslationBase.of(context).welcomeBack, - fontSize:12, - fontWeight: FontWeight.w700, - color: Color(0xFF2B353E), - ), - AppText( - Helpers.capitalize(authenticationViewModel.user.doctorName), - fontSize: 24, - color: Color(0xFF2B353E), - fontWeight: FontWeight.bold, - ), - SizedBox( - height: 20, - ), - AppText( - TranslationBase.of(context).accountInfo , - fontSize: 16, - color: Color(0xFF2E303A), - fontWeight: FontWeight.w600, - ), - SizedBox( - height: 20, - ), - Container( - padding: EdgeInsets.all(15), - decoration: BoxDecoration( - color: Colors.white, - borderRadius: BorderRadius.all( - Radius.circular(10), - ), - border: Border.all( - color: HexColor('#707070'), - width: 0.1), - ), - child: Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - Column( - children: [ - - Text( - TranslationBase.of(context) - .lastLoginAt, - overflow: - TextOverflow.ellipsis, - style: TextStyle( - fontFamily: 'Poppins', - fontSize: 16, - color: Color(0xFF2E303A), - fontWeight: FontWeight.w700,), - - ), - Row( - children: [ - AppText( - TranslationBase - .of(context) - .verifyWith, - fontSize: 14, - color: Color(0xFF575757), - fontWeight: FontWeight.w600, - ), - AppText( - authenticationViewModel.getType( - authenticationViewModel.user - .logInTypeID, - context), - fontSize: 14, - color: Color(0xFF2B353E), - - fontWeight: FontWeight.w700, - ), - ], - ) - ], - crossAxisAlignment: CrossAxisAlignment.start,), - Column(children: [ - AppText( - authenticationViewModel.user.editedOn != - null - ? AppDateUtils.getDayMonthYearDateFormatted( - AppDateUtils.convertStringToDate( - authenticationViewModel.user - .editedOn)) - : authenticationViewModel.user.createdOn != - null - ? AppDateUtils.getDayMonthYearDateFormatted( - AppDateUtils.convertStringToDate(authenticationViewModel.user - .createdOn)) - : '--', - textAlign: - TextAlign.right, - fontSize: 13, - color: Color(0xFF2E303A), - fontWeight: FontWeight.w700, - ), - AppText( - authenticationViewModel.user.editedOn != - null - ? AppDateUtils.getHour( - AppDateUtils.convertStringToDate( - authenticationViewModel.user - .editedOn)) - : authenticationViewModel.user.createdOn != - null - ? AppDateUtils.getHour( - AppDateUtils.convertStringToDate(authenticationViewModel.user - .createdOn)) - : '--', - textAlign: - TextAlign.right, - fontSize: 14, - fontWeight: FontWeight.w600, - color: Color(0xFF575757), - ) - ], - crossAxisAlignment: CrossAxisAlignment.start, + child: SingleChildScrollView( + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + // mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + SizedBox( + height: 80, + ), + if(authenticationViewModel.isFromLogin) + InkWell( + onTap: (){ + authenticationViewModel.setUnverified(false,isFromLogin: false); + authenticationViewModel.setAppStatus(APP_STATUS.UNAUTHENTICATED); + }, + child: Icon(Icons.arrow_back_ios,color: Color(0xFF2B353E),) - ) - ], - ), - ), - SizedBox( - height: 20, - ), - Row( - children: [ - AppText( - "Please Verify", - fontSize: 16, - color: Color(0xFF2B353E), - - fontWeight: FontWeight.w700, - ), - ], - ) - ], - ) - : Column( + ), + Container( + + child: Column( + children: [ + SizedBox( + height: 20, + ), + authenticationViewModel.user != null && isMoreOption == false + ? Column( mainAxisAlignment: MainAxisAlignment.spaceEvenly, crossAxisAlignment: CrossAxisAlignment.start, children: [ - this.onlySMSBox == false - ? Container( - margin: EdgeInsets.only(bottom: 20, top: 30), - child: AppText( - TranslationBase.of(context) - .verifyLoginWith, - fontSize: 18, - color: Color(0xFF2E303A), + + AppText( + TranslationBase.of(context).welcomeBack, + fontSize:12, + fontWeight: FontWeight.w700, + color: Color(0xFF2B353E), + ), + AppText( + Helpers.capitalize(authenticationViewModel.user.doctorName), + fontSize: 24, + color: Color(0xFF2B353E), fontWeight: FontWeight.bold, - textAlign: TextAlign.left, ), - ) - : AppText( - TranslationBase.of(context) - .verifyFingerprint2, - fontSize: - SizeConfig.textMultiplier * 2.5, - textAlign: TextAlign.start, + SizedBox( + height: 20, + ), + AppText( + TranslationBase.of(context).accountInfo , + fontSize: 16, + color: Color(0xFF2E303A), + fontWeight: FontWeight.w600, + ), + SizedBox( + height: 20, + ), + Container( + padding: EdgeInsets.all(15), + decoration: BoxDecoration( + color: Colors.white, + borderRadius: BorderRadius.all( + Radius.circular(10), + ), + border: Border.all( + color: HexColor('#707070'), + width: 0.1), + ), + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Column( + children: [ + + Text( + TranslationBase.of(context) + .lastLoginAt, + overflow: + TextOverflow.ellipsis, + style: TextStyle( + fontFamily: 'Poppins', + fontSize: 16, + color: Color(0xFF2E303A), + fontWeight: FontWeight.w700,), + + ), + Row( + children: [ + AppText( + TranslationBase + .of(context) + .verifyWith, + fontSize: 14, + color: Color(0xFF575757), + fontWeight: FontWeight.w600, + ), + AppText( + authenticationViewModel.getType( + authenticationViewModel.user + .logInTypeID, + context), + fontSize: 14, + color: Color(0xFF2B353E), + + fontWeight: FontWeight.w700, + ), + ], + ) + ], + crossAxisAlignment: CrossAxisAlignment.start,), + Column(children: [ + AppText( + authenticationViewModel.user.editedOn != + null + ? AppDateUtils.getDayMonthYearDateFormatted( + AppDateUtils.convertStringToDate( + authenticationViewModel.user + .editedOn)) + : authenticationViewModel.user.createdOn != + null + ? AppDateUtils.getDayMonthYearDateFormatted( + AppDateUtils.convertStringToDate(authenticationViewModel.user + .createdOn)) + : '--', + textAlign: + TextAlign.right, + fontSize: 13, + color: Color(0xFF2E303A), + fontWeight: FontWeight.w700, + ), + AppText( + authenticationViewModel.user.editedOn != + null + ? AppDateUtils.getHour( + AppDateUtils.convertStringToDate( + authenticationViewModel.user + .editedOn)) + : authenticationViewModel.user.createdOn != + null + ? AppDateUtils.getHour( + AppDateUtils.convertStringToDate(authenticationViewModel.user + .createdOn)) + : '--', + textAlign: + TextAlign.right, + fontSize: 14, + fontWeight: FontWeight.w600, + color: Color(0xFF575757), + ) + ], + crossAxisAlignment: CrossAxisAlignment.start, + + ) + ], + ), + ), + SizedBox( + height: 20, ), - ]), - authenticationViewModel.user != null && isMoreOption == false - ? Column( - mainAxisAlignment: MainAxisAlignment.start, - crossAxisAlignment: CrossAxisAlignment.start, - children: [ Row( + children: [ + AppText( + "Please Verify", + fontSize: 16, + color: Color(0xFF2B353E), + + fontWeight: FontWeight.w700, + ), + ], + ) + ], + ) + : Column( + mainAxisAlignment: + MainAxisAlignment.spaceEvenly, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + this.onlySMSBox == false + ? Container( + margin: EdgeInsets.only(bottom: 20, top: 30), + child: AppText( + TranslationBase.of(context) + .verifyLoginWith, + fontSize: 18, + color: Color(0xFF2E303A), + fontWeight: FontWeight.bold, + textAlign: TextAlign.left, + ), + ) + : AppText( + TranslationBase.of(context) + .verifyFingerprint2, + fontSize: + SizeConfig.textMultiplier * 2.5, + textAlign: TextAlign.start, + ), + ]), + authenticationViewModel.user != null && isMoreOption == false + ? Column( + mainAxisAlignment: MainAxisAlignment.start, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Row( + mainAxisAlignment: + MainAxisAlignment.center, + children: [ + Expanded( + child: InkWell( + onTap: () => + { + // TODO check this logic it seem it will create bug to us + authenticateUser( + AuthMethodTypes + .Fingerprint, true) + }, + child: VerificationMethodsList( + authenticationViewModel:authenticationViewModel, + authMethodType: SelectedAuthMethodTypesService + .getMethodsTypeService( + authenticationViewModel.user + .logInTypeID), + authenticateUser: + (AuthMethodTypes + authMethodType, + isActive) => + authenticateUser( + authMethodType, + isActive), + )), + ), + Expanded( + child: VerificationMethodsList( + authenticationViewModel:authenticationViewModel, + authMethodType: + AuthMethodTypes.MoreOptions, + onShowMore: () { + setState(() { + isMoreOption = true; + }); + }, + )) + ]), + ]) + : Column( + mainAxisAlignment: MainAxisAlignment.start, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + onlySMSBox == false + ? Row( mainAxisAlignment: MainAxisAlignment.center, children: [ Expanded( - child: InkWell( - onTap: () => - { - // TODO check this logic it seem it will create bug to us - authenticateUser( - AuthMethodTypes - .Fingerprint, true) - }, - child: VerificationMethodsList( - authenticationViewModel:authenticationViewModel, - authMethodType: SelectedAuthMethodTypesService - .getMethodsTypeService( - authenticationViewModel.user - .logInTypeID), - authenticateUser: - (AuthMethodTypes - authMethodType, - isActive) => - authenticateUser( - authMethodType, - isActive), - )), - ), + child: VerificationMethodsList( + authenticationViewModel:authenticationViewModel, + authMethodType: + AuthMethodTypes.Fingerprint, + authenticateUser: + (AuthMethodTypes + authMethodType, + isActive) => + authenticateUser( + authMethodType, + isActive), + )), Expanded( child: VerificationMethodsList( authenticationViewModel:authenticationViewModel, authMethodType: - AuthMethodTypes.MoreOptions, - onShowMore: () { - setState(() { - isMoreOption = true; - }); - }, + AuthMethodTypes.FaceID, + authenticateUser: + (AuthMethodTypes + authMethodType, + isActive) => + authenticateUser( + authMethodType, + isActive), )) - ]), - ]) - : Column( - mainAxisAlignment: MainAxisAlignment.start, - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - onlySMSBox == false - ? Row( - mainAxisAlignment: - MainAxisAlignment.center, - children: [ - Expanded( - child: VerificationMethodsList( - authenticationViewModel:authenticationViewModel, - authMethodType: - AuthMethodTypes.Fingerprint, - authenticateUser: - (AuthMethodTypes - authMethodType, - isActive) => - authenticateUser( - authMethodType, - isActive), - )), - Expanded( - child: VerificationMethodsList( - authenticationViewModel:authenticationViewModel, - authMethodType: - AuthMethodTypes.FaceID, - authenticateUser: - (AuthMethodTypes - authMethodType, - isActive) => - authenticateUser( - authMethodType, - isActive), - )) - ], - ) - : SizedBox(), - Row( - mainAxisAlignment: - MainAxisAlignment.center, - children: [ - Expanded( - child: VerificationMethodsList( - authenticationViewModel:authenticationViewModel, - authMethodType: AuthMethodTypes - .SMS, - authenticateUser: - ( - AuthMethodTypes authMethodType, - isActive) => - authenticateUser( - authMethodType, isActive), - )), - Expanded( - child: VerificationMethodsList( - authenticationViewModel:authenticationViewModel, - authMethodType: - AuthMethodTypes.WhatsApp, - authenticateUser: - ( - AuthMethodTypes authMethodType, - isActive) => - authenticateUser( - authMethodType, isActive), - )) - ], - ), - ]), + ], + ) + : SizedBox(), + Row( + mainAxisAlignment: + MainAxisAlignment.center, + children: [ + Expanded( + child: VerificationMethodsList( + authenticationViewModel:authenticationViewModel, + authMethodType: AuthMethodTypes + .SMS, + authenticateUser: + ( + AuthMethodTypes authMethodType, + isActive) => + authenticateUser( + authMethodType, isActive), + )), + Expanded( + child: VerificationMethodsList( + authenticationViewModel:authenticationViewModel, + authMethodType: + AuthMethodTypes.WhatsApp, + authenticateUser: + ( + AuthMethodTypes authMethodType, + isActive) => + authenticateUser( + authMethodType, isActive), + )) + ], + ), + ]), - // ) - ], + // ) + ], + ), ), - ), - ], + ], + ), ), ), ), 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 a8b4e65b..bcf2a371 100644 --- a/lib/screens/patients/profile/profile_screen/patient_profile_screen.dart +++ b/lib/screens/patients/profile/profile_screen/patient_profile_screen.dart @@ -198,7 +198,7 @@ class _PatientProfileScreenState extends State with Single ), ], ), - if (isFromLiveCare + if (isInpatient?true:isFromLiveCare ? patient.episodeNo != null : patient.patientStatusType != null && patient.patientStatusType == 43) BaseView( @@ -253,7 +253,7 @@ class _PatientProfileScreenState extends State with Single AppButton( title: "${TranslationBase.of(context).update}\n${TranslationBase.of(context).episode}", - color: isFromLiveCare + color: isFromLiveCare || isInpatient ? Colors.red.shade700 : patient.patientStatusType == 43 ? Colors.red.shade700 @@ -277,7 +277,7 @@ class _PatientProfileScreenState extends State with Single if ((isFromLiveCare && patient.appointmentNo != null && patient.appointmentNo != 0) || - patient.patientStatusType == 43) { + patient.patientStatusType == 43 ||isInpatient ) { Navigator.of(context) .pushNamed(UPDATE_EPISODE, arguments: {'patient': patient}); } 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 e14eb6f2..ed2a2d74 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 @@ -1,16 +1,18 @@ import 'package:autocomplete_textfield/autocomplete_textfield.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'; import 'package:doctor_app_flutter/core/enum/viewstate.dart'; import 'package:doctor_app_flutter/core/viewModel/SOAP_view_model.dart'; import 'package:doctor_app_flutter/core/viewModel/project_view_model.dart'; import 'package:doctor_app_flutter/models/SOAP/PatchAssessmentReqModel.dart'; import 'package:doctor_app_flutter/models/SOAP/master_key_model.dart'; -import 'package:doctor_app_flutter/models/SOAP/my_selected_assement.dart'; import 'package:doctor_app_flutter/models/SOAP/post_assessment_request_model.dart'; +import 'package:doctor_app_flutter/models/SOAP/selected_items/my_selected_assement.dart'; import 'package:doctor_app_flutter/models/doctor/doctor_profile_model.dart'; import 'package:doctor_app_flutter/models/patient/patiant_info_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_dialog_button.dart'; import 'package:doctor_app_flutter/screens/patients/profile/soap_update/shared_soap_widgets/bottom_sheet_title.dart'; import 'package:doctor_app_flutter/util/helpers.dart'; import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; @@ -152,6 +154,8 @@ 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, isTextFieldHasSuffix: false, @@ -223,7 +227,8 @@ class _AddAssessmentDetailsState extends State { ), ) : AppTextFieldCustom( - onClick: model.listOfICD10 != null + height: Helpers.getTextFieldHeight(), + onClick: model.listOfICD10 != null ? () { setState(() { widget.mySelectedAssessment @@ -234,7 +239,7 @@ class _AddAssessmentDetailsState extends State { : null, hintText: TranslationBase.of(context) .nameOrICD, - maxLines: 2, + maxLines: 1, minLines: 1, controller: icdNameController, enabled: true, @@ -246,10 +251,38 @@ class _AddAssessmentDetailsState extends State { )), )), ), + + 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( @@ -287,7 +320,7 @@ class _AddAssessmentDetailsState extends State { } : null, hintText: TranslationBase.of(context).condition, - maxLines: 2, + maxLines: 1, minLines: 1, controller: conditionController, isTextFieldHasSuffix: true, @@ -304,6 +337,8 @@ class _AddAssessmentDetailsState extends State { height: 10, ), AppTextFieldCustom( + height: Helpers.getTextFieldHeight(), + onClick: model.listOfDiagnosisType != null ? () { MasterKeyDailog dialog = MasterKeyDailog( @@ -333,7 +368,7 @@ class _AddAssessmentDetailsState extends State { } : null, hintText: TranslationBase.of(context).dType, - maxLines: 2, + maxLines: 1, minLines: 1, enabled: false, isTextFieldHasSuffix: true, @@ -364,7 +399,8 @@ class _AddAssessmentDetailsState extends State { ), ), SizedBox( - height: 10, + height: SizeConfig.heightMultiplier * (SizeConfig.isHeightVeryShort ?20:SizeConfig.isHeightShort?15:10), + ), ])), ), @@ -372,63 +408,34 @@ class _AddAssessmentDetailsState extends State { ), ), ), - bottomSheet: model.state == ViewState.Busy?Container(height: 0,):Container( - decoration: BoxDecoration( - color: Colors.white, - borderRadius: BorderRadius.all( - Radius.circular(0.0), - ), - border: Border.all(color: HexColor('#707070'), width: 0), - ), - height: MediaQuery.of(context).size.height * 0.1, - width: double.infinity, - child: Column( - children: [ - SizedBox( - height: 10, - ), - Container( - child: FractionallySizedBox( - widthFactor: .80, - child: Center( - child: AppButton( - fontWeight: FontWeight.w700, - color: Colors.green, - title: (widget.isUpdate - ? 'Update Assessment Details' - : 'Add Assessment Details'), - loading: model.state == ViewState.BusyLocal, - onPressed: () async { - setState(() { - isFormSubmitted = true; - }); - widget.mySelectedAssessment.remark = - remarkController.text; - widget.mySelectedAssessment.appointmentId = - int.parse(appointmentIdController.text); - if (widget.mySelectedAssessment - .selectedDiagnosisCondition != - null && - widget.mySelectedAssessment - .selectedDiagnosisType != - null && - widget.mySelectedAssessment.selectedICD != null) { - await submitAssessment( - isUpdate: widget.isUpdate, - model: model, - mySelectedAssessment: - widget.mySelectedAssessment); - } - }, - ), - ), - ), - ), - SizedBox( - height: 5, - ), - ], - ), + bottomSheet: model.state == ViewState.Busy?Container(height: 0,): + + BottomSheetDialogButton( + label: (widget.isUpdate + ? 'Update Assessment Details' + : 'Add Assessment Details'), + onTap: () async { + setState(() { + isFormSubmitted = true; + }); + widget.mySelectedAssessment.remark = + remarkController.text; + widget.mySelectedAssessment.appointmentId = + int.parse(appointmentIdController.text); + if (widget.mySelectedAssessment + .selectedDiagnosisCondition != + null && + widget.mySelectedAssessment + .selectedDiagnosisType != + null && + widget.mySelectedAssessment.selectedICD != null) { + await submitAssessment( + isUpdate: widget.isUpdate, + model: model, + mySelectedAssessment: + widget.mySelectedAssessment); + } + }, ), ), ), diff --git a/lib/screens/patients/profile/soap_update/assessment/assessment_call_back.dart b/lib/screens/patients/profile/soap_update/assessment/assessment_call_back.dart new file mode 100644 index 00000000..331b2d15 --- /dev/null +++ b/lib/screens/patients/profile/soap_update/assessment/assessment_call_back.dart @@ -0,0 +1,3 @@ +abstract class AssessmentCallBack{ + nextFunction(model); +} \ No newline at end of file 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 f8da93f5..439cb61a 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 @@ -1,3 +1,4 @@ +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'; import 'package:doctor_app_flutter/core/viewModel/SOAP_view_model.dart'; @@ -5,9 +6,11 @@ import 'package:doctor_app_flutter/core/viewModel/project_view_model.dart'; import 'package:doctor_app_flutter/icons_app/doctor_app_icons.dart'; import 'package:doctor_app_flutter/models/SOAP/GetAssessmentReqModel.dart'; import 'package:doctor_app_flutter/models/SOAP/master_key_model.dart'; -import 'package:doctor_app_flutter/models/SOAP/my_selected_assement.dart'; +import 'package:doctor_app_flutter/models/SOAP/selected_items/my_selected_assement.dart'; import 'package:doctor_app_flutter/models/patient/patiant_info_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/remark_text.dart'; +import 'package:doctor_app_flutter/screens/patients/profile/soap_update/soap_utils.dart'; import 'package:doctor_app_flutter/util/date-utils.dart'; import 'package:doctor_app_flutter/util/helpers.dart'; import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; @@ -22,39 +25,46 @@ import '../shared_soap_widgets/SOAP_open_items.dart'; import '../shared_soap_widgets/SOAP_step_header.dart'; import '../shared_soap_widgets/expandable_SOAP_widget.dart'; import 'add_assessment_details.dart'; +import 'assessment_call_back.dart'; // ignore: must_be_immutable class UpdateAssessmentPage extends StatefulWidget { final Function changePageViewIndex; final PatiantInformtion patientInfo; final Function changeLoadingState; - final int currentIndex; + final int currentIndex; + UpdateAssessmentPage( {Key key, this.changePageViewIndex, this.patientInfo, - this.changeLoadingState, this.currentIndex}); + this.changeLoadingState, + this.currentIndex}); @override _UpdateAssessmentPageState createState() => _UpdateAssessmentPageState(); } -class _UpdateAssessmentPageState extends State { +class _UpdateAssessmentPageState extends State + implements AssessmentCallBack { bool isAssessmentExpand = false; List mySelectedAssessmentList = List(); + @override Widget build(BuildContext context) { ProjectViewModel projectViewModel = Provider.of(context); return BaseView( onModelReady: (model) async { + model.setAssessmentCallBack(this); mySelectedAssessmentList.clear(); GetAssessmentReqModel getAssessmentReqModel = GetAssessmentReqModel( patientMRN: widget.patientInfo.patientMRN, episodeID: widget.patientInfo.episodeNo.toString(), editedBy: '', doctorID: '', - appointmentNo: int.parse(widget.patientInfo.appointmentNo.toString())); + appointmentNo: + int.parse(widget.patientInfo.appointmentNo.toString())); await model.getPatientAssessment(getAssessmentReqModel); if (model.patientAssessmentList.isNotEmpty) { if (model.listOfDiagnosisCondition.length == 0) { @@ -83,11 +93,11 @@ class _UpdateAssessmentPageState extends State { diagnosisType != null && diagnosisCondition != null) { MySelectedAssessment temMySelectedAssessment = - MySelectedAssessment( - appointmentId: element.appointmentNo, + SoapUtils.generateMySelectedAssessment( + appointmentNo: element.appointmentNo, remark: element.remarks, - selectedDiagnosisType: diagnosisType, - selectedDiagnosisCondition: diagnosisCondition, + diagnosisType: diagnosisType, + diagnosisCondition: diagnosisCondition, selectedICD: selectedICD, doctorID: element.doctorID, doctorName: element.doctorName, @@ -104,27 +114,24 @@ class _UpdateAssessmentPageState extends State { }, builder: (_, model, w) => AppScaffold( isShowAppBar: false, - backgroundColor: Theme - .of(context) - .scaffoldBackgroundColor, + backgroundColor: Theme.of(context).scaffoldBackgroundColor, body: SingleChildScrollView( physics: ScrollPhysics(), child: Container( - - color: Theme - .of(context) - .scaffoldBackgroundColor, + color: Theme.of(context).scaffoldBackgroundColor, child: Center( child: FractionallySizedBox( widthFactor: 0.9, child: Column( mainAxisAlignment: MainAxisAlignment.start, children: [ - SOAPStepHeader(currentIndex: widget.currentIndex, changePageViewIndex:widget.changePageViewIndex), - + SOAPStepHeader( + currentIndex: widget.currentIndex, + changePageViewIndex: widget.changePageViewIndex, + patientInfo: widget.patientInfo, + ), ExpandableSOAPWidget( - headerTitle: TranslationBase.of(context).assessment - , + headerTitle: TranslationBase.of(context).assessment, onTap: () { setState(() { isAssessmentExpand = !isAssessmentExpand; @@ -136,49 +143,53 @@ class _UpdateAssessmentPageState extends State { ), Column( children: [ - - SOAPOpenItems(label: "${TranslationBase.of(context).addAssessment}",onTap: () { - openAssessmentDialog(context, - isUpdate: false, model: model); - },), - + SOAPOpenItems( + label: + "${TranslationBase.of(context).addAssessment}", + onTap: () { + openAssessmentDialog(context, + isUpdate: false, model: model); + }, + ), SizedBox( height: 20, ), Column( - children: mySelectedAssessmentList - .map((assessment) { + children: + mySelectedAssessmentList.map((assessment) { return Container( margin: EdgeInsets.only( - left: 5, right: 5, top: 15), + 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: 12, + fontSize: SizeConfig + .getTextMultiplierBasedOnWidth() * + 3.6, color: Color(0xFF2E303A), fontFamily: 'Poppins', - fontWeight: FontWeight.w600), + fontWeight: FontWeight.w600, + letterSpacing: -0.4), children: [ new TextSpan( text: "ICD : ".toUpperCase(), ), new TextSpan( - text: assessment - .selectedICD.code - .trim() - .toUpperCase() ?? - "", - ), + text: assessment + .selectedICD.code + .trim() + .toUpperCase() ?? + ""), ], ), ), @@ -190,11 +201,14 @@ class _UpdateAssessmentPageState extends State { child: RichText( text: new TextSpan( style: new TextStyle( - fontSize: 16, - color: Color(0xFF2E303A), - fontFamily: 'Poppins', - fontWeight: - FontWeight.w600), + fontSize: SizeConfig + .getTextMultiplierBasedOnWidth() * + 5, + color: Color(0xFF2E303A), + fontFamily: 'Poppins', + fontWeight: FontWeight.w600, + letterSpacing: -0.64, + ), children: [ new TextSpan( text: assessment @@ -208,27 +222,35 @@ class _UpdateAssessmentPageState extends State { RichText( text: new TextSpan( style: new TextStyle( - fontSize: 12, - color: Color(0xFF2E303A), - fontFamily: 'Poppins', - fontWeight: FontWeight.w600), + fontSize: SizeConfig + .getTextMultiplierBasedOnWidth() * + 3.5, + color: Color(0xFF2E303A), + fontFamily: 'Poppins', + fontWeight: FontWeight.w600, + ), children: [ new TextSpan( text: TranslationBase.of( context) .appointmentNo, style: new TextStyle( + fontSize: SizeConfig + .getTextMultiplierBasedOnWidth() * + 3, + letterSpacing: -0.4, color: Color(0xFF575757), ), ), new TextSpan( - text: assessment - .appointmentId.toString() - - ?? + text: assessment.appointmentId + .toString() ?? "", style: new TextStyle( - fontSize: 14, + fontSize: SizeConfig + .getTextMultiplierBasedOnWidth() * + 3.6, + letterSpacing: -0.48, color: Color(0xFF2B353E), ), ), @@ -238,7 +260,9 @@ class _UpdateAssessmentPageState extends State { RichText( text: new TextSpan( style: new TextStyle( - fontSize: 12, + fontSize: SizeConfig + .getTextMultiplierBasedOnWidth() * + 3, color: Color(0xFF2E303A), fontFamily: 'Poppins', fontWeight: FontWeight.w600), @@ -249,6 +273,7 @@ class _UpdateAssessmentPageState extends State { .condition + " : ", style: new TextStyle( + letterSpacing: -0.4, color: Color(0xFF575757), ), ), @@ -262,7 +287,10 @@ class _UpdateAssessmentPageState extends State { .selectedDiagnosisCondition .nameEn, style: new TextStyle( - fontSize: 14, + fontSize: SizeConfig + .getTextMultiplierBasedOnWidth() * + 3.6, + letterSpacing: -0.48, color: Color(0xFF2B353E), ), ), @@ -272,7 +300,9 @@ class _UpdateAssessmentPageState extends State { RichText( text: new TextSpan( style: new TextStyle( - fontSize: 12, + fontSize: SizeConfig + .getTextMultiplierBasedOnWidth() * + 3, color: Color(0xFF2E303A), fontFamily: 'Poppins', fontWeight: FontWeight.w600), @@ -283,6 +313,7 @@ class _UpdateAssessmentPageState extends State { .dType + ' : ', style: new TextStyle( + letterSpacing: -0.4, color: Color(0xFF575757), ), ), @@ -296,7 +327,10 @@ class _UpdateAssessmentPageState extends State { .selectedDiagnosisType .nameEn, style: new TextStyle( - fontSize: 14, + fontSize: SizeConfig + .getTextMultiplierBasedOnWidth() * + 3.6, + letterSpacing: -0.48, color: Color(0xFF2B353E), ), ), @@ -307,7 +341,9 @@ class _UpdateAssessmentPageState extends State { RichText( text: new TextSpan( style: new TextStyle( - fontSize: 12, + fontSize: SizeConfig + .getTextMultiplierBasedOnWidth() * + 3.6, color: Color(0xFF2E303A), fontFamily: 'Poppins', fontWeight: @@ -316,9 +352,13 @@ class _UpdateAssessmentPageState extends State { new TextSpan( text: TranslationBase.of( context) - .doc + + .doctor + ' : ', style: new TextStyle( + fontSize: SizeConfig + .getTextMultiplierBasedOnWidth() * + 3, + letterSpacing: -0.4, color: Color(0xFF575757), ), ), @@ -327,7 +367,10 @@ class _UpdateAssessmentPageState extends State { assessment.doctorName ?? '', style: new TextStyle( - fontSize: 14, + fontSize: SizeConfig + .getTextMultiplierBasedOnWidth() * + 3.6, + letterSpacing: -0.48, color: Color(0xFF2B353E), ), ), @@ -337,42 +380,32 @@ class _UpdateAssessmentPageState extends State { SizedBox( height: 6, ), - Row( mainAxisAlignment: MainAxisAlignment.start, - crossAxisAlignment: CrossAxisAlignment.start, + crossAxisAlignment: + CrossAxisAlignment.start, children: [ SizedBox( height: 6, ), AppText( - (assessment.remark != null && - assessment.remark != - '') - ? TranslationBase.of( - context) - .remarks + - " : " - : '', - - fontSize: 12, - color: Color(0xFF2E303A), - fontFamily: 'Poppins', - fontWeight: - FontWeight.w600 - ), - Container( - width: MediaQuery.of(context) - .size - .width * - 0.38, - child: AppText( - assessment.remark ?? "", - fontSize: 11, - color: Color(0xFF2B353E), - fontWeight: FontWeight.w700, - ), + (assessment.remark != null && + assessment.remark != + '') + ? TranslationBase.of( + context) + .remarks + + " : " + : '', + fontSize: SizeConfig + .getTextMultiplierBasedOnWidth() * + 3, + color: Color(0xFF2E303A), + fontFamily: 'Poppins', + fontWeight: FontWeight.w600), + RemarkText( + remark: assessment.remark ?? "", ), ], ), @@ -380,36 +413,42 @@ class _UpdateAssessmentPageState extends State { ), Column( crossAxisAlignment: - CrossAxisAlignment.end, + CrossAxisAlignment.end, children: [ Row( children: [ Column( + crossAxisAlignment: + CrossAxisAlignment.end, children: [ AppText( assessment.createdOn != null ? AppDateUtils - .getDayMonthYearDateFormatted( - DateTime.parse( - assessment - .createdOn)) + .getDayMonthYearDateFormatted( + DateTime.parse( + assessment + .createdOn)) : AppDateUtils - .getDayMonthYearDateFormatted( - DateTime.now()), - fontWeight: FontWeight - .w600, - fontSize: 14, - ), AppText( + .getDayMonthYearDateFormatted( + DateTime.now()), + fontWeight: FontWeight.w600, + fontSize: SizeConfig + .getTextMultiplierBasedOnWidth() * + 3.6, + ), + AppText( assessment.createdOn != null ? AppDateUtils.getHour( - DateTime.parse( - assessment - .createdOn)) + DateTime.parse( + assessment + .createdOn)) : AppDateUtils.getHour( - DateTime.now()), - fontWeight: FontWeight - .w600, - fontSize: 14, + DateTime.now()), + fontWeight: FontWeight.w600, + color: Color(0xFF575757), + fontSize: SizeConfig + .getTextMultiplierBasedOnWidth() * + 3.6, ), ], ), @@ -417,8 +456,8 @@ class _UpdateAssessmentPageState extends State { ), SizedBox( height: MediaQuery.of(context) - .size - .height * + .size + .height * 0.05, ), InkWell( @@ -429,7 +468,9 @@ class _UpdateAssessmentPageState extends State { model: model); }, child: Icon( - DoctorApp.edit, size: 18,), + DoctorApp.edit, + size: 18, + ), ) ], ), @@ -441,7 +482,7 @@ class _UpdateAssessmentPageState extends State { ], ) ]), - isExpanded: isAssessmentExpand, + isExpanded: isAssessmentExpand, ), SizedBox( height: 130, @@ -452,77 +493,6 @@ class _UpdateAssessmentPageState extends State { ), ), ), - bottomSheet:Container( - decoration: BoxDecoration( - color: Colors.white, - borderRadius: BorderRadius.all( - Radius.circular(0.0), - ), - border: Border.all( - color: HexColor('#707070'), - width: 0), - ), - height: 80, - width: double.infinity, - child: Column( - children: [ - SizedBox( - height: 10, - ), - Container(child: - FractionallySizedBox( - widthFactor: .80, - child: Center( - child: Row( - children: [ - Expanded( - child: AppButton( - title: TranslationBase - .of(context) - .previous, - color: Colors.grey[300], - fontColor: Colors.black, - fontWeight: FontWeight.w600, - disabled: model.state == ViewState.BusyLocal, - onPressed: () async { - widget.changePageViewIndex(1); - }, - ) - , - ), - SizedBox(width: 5,), - Expanded( - child: AppButton( - title: TranslationBase - .of(context) - .next, - fontWeight: FontWeight.w600, - color: Colors.red[700], - disabled: model.state == ViewState.BusyLocal, - onPressed: () async { - if (mySelectedAssessmentList.isEmpty) { - Helpers.showErrorToast( - TranslationBase - .of(context) - .assessmentErrorMsg); - } else { - widget.changeLoadingState(true); - widget.changePageViewIndex(3); - - } - }, - ), - ), - ], - ), - ), - ),), - SizedBox( - height: 5, - ), - ], - ),) - ), ); } @@ -530,8 +500,8 @@ class _UpdateAssessmentPageState extends State { openAssessmentDialog(BuildContext context, {MySelectedAssessment assessment, bool isUpdate, SOAPViewModel model}) { if (assessment == null) { - assessment = MySelectedAssessment( - remark: '', appointmentId: widget.patientInfo.appointmentNo); + assessment = SoapUtils.generateMySelectedAssessment( + remark: '', appointmentNo: widget.patientInfo.appointmentNo); } showModalBottomSheet( backgroundColor: Colors.white, @@ -546,11 +516,20 @@ class _UpdateAssessmentPageState extends State { addSelectedAssessment: (MySelectedAssessment mySelectedAssessment, bool isUpdate) async { setState(() { - if(!isUpdate) - mySelectedAssessmentList.add(mySelectedAssessment); + if (!isUpdate) + mySelectedAssessmentList.add(mySelectedAssessment); }); }); }); } -} + @override + nextFunction(model) { + if (mySelectedAssessmentList.isEmpty) { + Helpers.showErrorToast(TranslationBase.of(context).assessmentErrorMsg); + } else { + widget.changeLoadingState(true); + widget.changePageViewIndex(3); + } + } +} diff --git a/lib/screens/patients/profile/soap_update/objective/add_examination_page.dart b/lib/screens/patients/profile/soap_update/objective/add_examination_page.dart index 87af6ec2..5ce4250a 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,9 +1,11 @@ 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'; import 'package:doctor_app_flutter/core/viewModel/SOAP_view_model.dart'; import 'package:doctor_app_flutter/models/SOAP/master_key_model.dart'; -import 'package:doctor_app_flutter/models/SOAP/my_selected_examination.dart'; +import 'package:doctor_app_flutter/models/SOAP/selected_items/my_selected_examination.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_dialog_button.dart'; import 'package:doctor_app_flutter/screens/patients/profile/soap_update/shared_soap_widgets/bottom_sheet_title.dart'; import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; import 'package:doctor_app_flutter/widgets/shared/app_scaffold_widget.dart'; @@ -16,7 +18,7 @@ import 'examinations_list_search_widget.dart'; class AddExaminationPage extends StatefulWidget { final List mySelectedExamination; - final Function addSelectedExamination; + final Function (List)addSelectedExamination; final Function(MasterKeyModel) removeExamination; AddExaminationPage( @@ -29,6 +31,14 @@ class AddExaminationPage extends StatefulWidget { } class _AddExaminationPageState extends State { + List mySelectedExaminationLocal; + + @override + initState() { + super.initState(); + mySelectedExaminationLocal = [...widget.mySelectedExamination]; + } + @override Widget build(BuildContext context) { return BaseView( @@ -71,14 +81,15 @@ class _AddExaminationPageState extends State { masterList: model.physicalExaminationList, isServiceSelected: (master) => isServiceSelected(master), - removeExamination: (history) { + removeExamination: (selectedExamination) { setState(() { - widget.removeExamination(history); + mySelectedExaminationLocal.remove(selectedExamination); }); }, - addHistory: (selectedExamination) { - widget.mySelectedExamination - .add(selectedExamination); + addExamination: (selectedExamination) { + + mySelectedExaminationLocal + .insert(0, selectedExamination); // setState(() {}); }, ), @@ -91,48 +102,21 @@ class _AddExaminationPageState extends State { ), ], ), - bottomSheet: Container( - decoration: BoxDecoration( - color: Colors.white, - borderRadius: BorderRadius.all( - Radius.circular(0.0), - ), - border: Border.all(color: HexColor('#707070'), width: 0), - ), - height: MediaQuery.of(context).size.height * 0.1, - width: double.infinity, - child: Column( - children: [ - SizedBox( - height: 10, + bottomSheet: model.state != ViewState.Idle + ? Container( + height: 0, + ) + : BottomSheetDialogButton( + label: "${TranslationBase.of(context).addExamination}", + onTap: () { + widget.addSelectedExamination(mySelectedExaminationLocal); + }, ), - Container( - child: FractionallySizedBox( - widthFactor: .80, - child: Center( - child: AppButton( - title: - "${TranslationBase.of(context).addExamination}", - padding: 10, - color: Color(0xFF359846), - onPressed: () { - widget.addSelectedExamination(); - }, - ), - ), - ), - ), - SizedBox( - height: 5, - ), - ], - ), - ), )); } isServiceSelected(MasterKeyModel masterKey) { - Iterable exam = widget.mySelectedExamination.where( + Iterable exam = mySelectedExaminationLocal.where( (element) => masterKey.id == element.selectedExamination.id && masterKey.typeId == element.selectedExamination.typeId); 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 f0dc25cf..c9202e52 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 @@ -2,7 +2,7 @@ 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/master_key_model.dart'; -import 'package:doctor_app_flutter/models/SOAP/my_selected_examination.dart'; +import 'package:doctor_app_flutter/models/SOAP/selected_items/my_selected_examination.dart'; import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart'; import 'package:doctor_app_flutter/widgets/shared/expandable-widget-header-body.dart'; @@ -14,7 +14,7 @@ import 'package:provider/provider.dart'; // ignore: must_be_immutable class AddExaminationWidget extends StatefulWidget { MasterKeyModel item; - final Function(MasterKeyModel) removeExamination; + final Function(MySelectedExamination) removeExamination; final Function(MySelectedExamination) addExamination; final bool Function(MasterKeyModel) isServiceSelected; bool isExpand; @@ -36,7 +36,7 @@ class AddExaminationWidget extends StatefulWidget { } class _AddExaminationWidgetState extends State { - int status = 3; + int status = 1; TextEditingController remarksController = TextEditingController(); MySelectedExamination examination = MySelectedExamination(); @@ -65,38 +65,32 @@ class _AddExaminationWidgetState extends State { headerWidget: Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ - Expanded( - child: CheckboxListTile( - title: AppText( - projectViewModel.isArabic - ? widget.item.nameAr != null && widget.item.nameAr != "" - ? widget.item.nameAr - : widget.item.nameEn - : widget.item.nameEn, - fontWeight: FontWeight.normal, - fontFamily: 'Poppins', - fontSize: SizeConfig.textMultiplier * 2.0, - ), - value: widget.isServiceSelected(widget.item), - activeColor: HexColor("#D02127"), - onChanged: (newValue) { - setState(() { - if (widget.isServiceSelected(widget.item)) { - if (examination.isLocal) - widget.removeExamination(widget.item); - widget.expandClick(); - } else { - examination.isNormal = status == 1; - examination.isAbnormal = status == 2; - examination.notExamined = status == 3; - examination.remark = remarksController.text; - widget.addExamination(examination); - widget.expandClick(); - } - }); - }, - controlAffinity: ListTileControlAffinity.leading, - contentPadding: EdgeInsets.all(0), + InkWell( + onTap: (){ + onExamTap(); + }, + child: Row( + children: [ + Checkbox( + value:widget.isServiceSelected(widget.item), + activeColor: Colors.red[800], + onChanged: (bool newValue) { + onExamTap(); + }), + Container( + child: AppText( + projectViewModel.isArabic + ? widget.item.nameAr != null && widget.item.nameAr != "" + ? widget.item.nameAr + : widget.item.nameEn + : widget.item.nameEn, + + color: Color(0xFF575757), + fontSize: SizeConfig.getTextMultiplierBasedOnWidth()*(SizeConfig.isWidthLarge?3:3.8), + letterSpacing: -0.56, + ), + ), + ], ), ), Container( @@ -271,6 +265,23 @@ class _AddExaminationWidgetState extends State { ); } + onExamTap(){ + setState(() { + 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(); + } + }); + } + MySelectedExamination getSelectedExam(MasterKeyModel masterKey) { Iterable exam = widget.mySelectedExamination.where( (element) => 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 84a4c740..384aff90 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,9 +1,13 @@ 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/my_selected_examination.dart'; +import 'package:doctor_app_flutter/models/SOAP/selected_items/my_selected_examination.dart'; +import 'package:doctor_app_flutter/screens/patients/profile/soap_update/shared_soap_widgets/remark_text.dart'; +import 'package:doctor_app_flutter/screens/patients/profile/soap_update/shared_soap_widgets/remove_button.dart'; import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart'; import 'package:flutter/material.dart'; +import 'package:font_awesome_flutter/font_awesome_flutter.dart'; +import 'package:hexcolor/hexcolor.dart'; import 'package:provider/provider.dart'; class ExaminationItemCard extends StatelessWidget { @@ -42,32 +46,38 @@ class ExaminationItemCard extends StatelessWidget { )), ], ), - AppText( - !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 - : Colors.green.shade800, - fontSize: SizeConfig.textMultiplier * 1.8, + Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + AppText( + !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 + : Colors.green.shade800, + fontSize: SizeConfig.textMultiplier * 1.8, + ), + if (!examination.notExamined) + RemoveButton( + label: examination.isLocal + ? TranslationBase.of(context).remove + : TranslationBase.of(context).notExamined, + onTap: removeExamination, + ), + ], ), SizedBox( height: 4, ), - if(examination.remark.isNotEmpty) - AppText( - examination.remark, - fontWeight: FontWeight.normal, - fontFamily: 'Poppins', - color: Color(0xFF575757), - fontSize: SizeConfig.textMultiplier * 1.8, - ), + if (examination.remark.isNotEmpty) + RemarkText(remark: examination.remark), ], ), ); diff --git a/lib/screens/patients/profile/soap_update/objective/examinations_list_search_widget.dart b/lib/screens/patients/profile/soap_update/objective/examinations_list_search_widget.dart index c67102ee..c041b545 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 @@ -1,5 +1,6 @@ import 'package:doctor_app_flutter/models/SOAP/master_key_model.dart'; -import 'package:doctor_app_flutter/models/SOAP/my_selected_examination.dart'; +import 'package:doctor_app_flutter/models/SOAP/selected_items/my_selected_examination.dart'; +import 'package:doctor_app_flutter/util/helpers.dart'; import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; import 'package:doctor_app_flutter/widgets/shared/divider_with_spaces_around.dart'; import 'package:doctor_app_flutter/widgets/shared/text_fields/app-textfield-custom.dart'; @@ -8,15 +9,15 @@ import 'package:flutter/material.dart'; import 'add_examination_widget.dart'; class ExaminationsListSearchWidget extends StatefulWidget { - final Function(MasterKeyModel) removeExamination; - final Function(MySelectedExamination) addHistory; + final Function(MySelectedExamination) removeExamination; + final Function(MySelectedExamination) addExamination; final bool Function(MasterKeyModel) isServiceSelected; final List masterList; final List mySelectedExamination; ExaminationsListSearchWidget( {this.removeExamination, - this.addHistory, + this.addExamination, this.isServiceSelected, this.masterList, this.mySelectedExamination}); @@ -42,10 +43,11 @@ class _ExaminationsListSearchWidgetState return Column( children: [ AppTextFieldCustom( - height: MediaQuery.of(context).size.height * 0.080, + height: Helpers.getTextFieldHeight(), hintText: TranslationBase.of(context).searchExamination, isTextFieldHasSuffix: true, hasBorder: false, + controller: filteredSearchController, onChanged: (value) { filterSearchResults(value); @@ -62,7 +64,7 @@ class _ExaminationsListSearchWidgetState ...items.mapIndexed((index, item) { return AddExaminationWidget( item: item, - addExamination: widget.addHistory, + addExamination: widget.addExamination, removeExamination: widget.removeExamination, mySelectedExamination: widget.mySelectedExamination, isServiceSelected: widget.isServiceSelected, diff --git a/lib/screens/patients/profile/soap_update/objective/objective_call_back.dart b/lib/screens/patients/profile/soap_update/objective/objective_call_back.dart new file mode 100644 index 00000000..466f344e --- /dev/null +++ b/lib/screens/patients/profile/soap_update/objective/objective_call_back.dart @@ -0,0 +1,3 @@ +abstract class ObjectiveCallBack{ + nextFunction(model); +} \ No newline at end of file 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 dbd3b080..576c52c3 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,14 +1,16 @@ 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'; import 'package:doctor_app_flutter/core/enum/viewstate.dart'; import 'package:doctor_app_flutter/core/viewModel/SOAP_view_model.dart'; import 'package:doctor_app_flutter/models/SOAP/GetPhysicalExamReqModel.dart'; import 'package:doctor_app_flutter/models/SOAP/master_key_model.dart'; -import 'package:doctor_app_flutter/models/SOAP/my_selected_examination.dart'; +import 'package:doctor_app_flutter/models/SOAP/selected_items/my_selected_examination.dart'; import 'package:doctor_app_flutter/models/SOAP/post_physical_exam_request_model.dart'; import 'package:doctor_app_flutter/models/doctor/doctor_profile_model.dart'; import 'package:doctor_app_flutter/models/patient/patiant_info_model.dart'; import 'package:doctor_app_flutter/screens/base/base_view.dart'; +import 'package:doctor_app_flutter/screens/patients/profile/soap_update/soap_utils.dart'; import 'package:doctor_app_flutter/util/helpers.dart'; import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; import 'package:doctor_app_flutter/widgets/shared/app_scaffold_widget.dart'; @@ -23,6 +25,7 @@ import '../shared_soap_widgets/SOAP_step_header.dart'; import '../shared_soap_widgets/expandable_SOAP_widget.dart'; import 'add_examination_page.dart'; import 'examination_item_card.dart'; +import 'objective_call_back.dart'; class UpdateObjectivePage extends StatefulWidget { final Function changePageViewIndex; @@ -41,7 +44,8 @@ class UpdateObjectivePage extends StatefulWidget { _UpdateObjectivePageState createState() => _UpdateObjectivePageState(); } -class _UpdateObjectivePageState extends State { +class _UpdateObjectivePageState extends State + implements ObjectiveCallBack { bool isSysExaminationExpand = false; List mySelectedExamination = List(); @@ -62,15 +66,10 @@ class _UpdateObjectivePageState extends State { Widget build(BuildContext context) { return BaseView( onModelReady: (model) async { + model.setObjectiveCallBack(this); mySelectedExamination.clear(); - GetPhysicalExamReqModel getPhysicalExamReqModel = - GetPhysicalExamReqModel( - patientMRN: widget.patientInfo.patientMRN, - episodeID: widget.patientInfo.episodeNo.toString(), - appointmentNo: - int.parse(widget.patientInfo.appointmentNo.toString())); - - await model.getPatientPhysicalExam(getPhysicalExamReqModel); + model.isAddExamInProgress = true; + await model.getPatientPhysicalExam(widget.patientInfo); if (model.patientPhysicalExamList.isNotEmpty) { if (model.physicalExaminationList.length == 0) { await model.getMasterLookup(MasterKeysService.PhysicalExamination); @@ -80,8 +79,9 @@ class _UpdateObjectivePageState extends State { masterKeys: MasterKeysService.PhysicalExamination, id: element.examId, ); - MySelectedExamination tempEam = MySelectedExamination( - selectedExamination: examMaster, + MySelectedExamination tempEam = + SoapUtils.generateMySelectedExamination( + examination: examMaster, remark: element.remarks, isNormal: element.isNormal, createdBy: element.createdBy, @@ -95,174 +95,201 @@ class _UpdateObjectivePageState extends State { mySelectedExamination.add(tempEam); }); } - widget.changeLoadingState(false); }, builder: (_, model, w) => AppScaffold( - isShowAppBar: false, - backgroundColor: Theme.of(context).scaffoldBackgroundColor, - body: SingleChildScrollView( - child: Center( - child: FractionallySizedBox( - widthFactor: 0.9, - child: Column( - mainAxisAlignment: MainAxisAlignment.start, - children: [ - SOAPStepHeader( - currentIndex: widget.currentIndex, - changePageViewIndex: widget.changePageViewIndex), - ExpandableSOAPWidget( - headerTitle: - TranslationBase.of(context).physicalSystemExamination, - onTap: () { - setState(() { - isSysExaminationExpand = !isSysExaminationExpand; - }); - }, - child: Column( - children: [ - SOAPOpenItems( - label: - "${TranslationBase.of(context).addExamination}", - onTap: () { - openExaminationList(context); - }, - ), - Column( - children: mySelectedExamination.map((examination) { - return ExaminationItemCard(examination, () { - removeExamination( - examination.selectedExamination); - }); - }).toList(), - ) - ], - ), - isExpanded: isSysExaminationExpand, - ), - SizedBox( - height: MediaQuery.of(context).size.height * 0.12, - ) - ], - ), - ), - ), - ), - bottomSheet: Container( - decoration: BoxDecoration( - color: Colors.white, - borderRadius: BorderRadius.all( - Radius.circular(0.0), - ), - border: Border.all(color: HexColor('#707070'), width: 0), - ), - height: 80, - width: double.infinity, - child: Column( - children: [ - SizedBox( - height: 10, - ), - Container( - child: FractionallySizedBox( - widthFactor: .80, - child: Center( - child: Row( - children: [ - Expanded( - child: AppButton( - title: TranslationBase.of(context).previous, - color: Colors.grey[300], - fontColor: Colors.black, - fontWeight: FontWeight.w600, - onPressed: () { - widget.changePageViewIndex(0); - }, - ), - ), - SizedBox( - width: 5, + isShowAppBar: false, + backgroundColor: Theme.of(context).scaffoldBackgroundColor, + body: SingleChildScrollView( + physics: ScrollPhysics(), + child: Center( + child: FractionallySizedBox( + widthFactor: 0.9, + child: Column( + mainAxisAlignment: MainAxisAlignment.start, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + SOAPStepHeader( + currentIndex: widget.currentIndex, + changePageViewIndex: widget.changePageViewIndex, + patientInfo: widget.patientInfo, + ), + ExpandableSOAPWidget( + headerTitle: + TranslationBase.of(context).physicalSystemExamination, + onTap: () { + setState(() { + isSysExaminationExpand = !isSysExaminationExpand; + }); + }, + child: Column( + children: [ + SOAPOpenItems( + label: + "${TranslationBase.of(context).addExamination}", + onTap: () { + openExaminationList(context); + }, + ), + if (mySelectedExamination.isNotEmpty && + mySelectedExamination.first.isLocal) + Row( + children: [ + AppText( + "New", + fontWeight: FontWeight.w600, + fontFamily: 'Poppins', + color: Color(0xFFCC9B14), + ), + ], ), - Expanded( - child: AppButton( - title: TranslationBase.of(context).next, - fontWeight: FontWeight.w600, - color: Colors.red[700], - disabled: model.state == ViewState.BusyLocal, - onPressed: () async { - await submitUpdateObjectivePage(model); - }, - ), + Column( + children: mySelectedExamination + .sublist( + 0, + model.getFirstIndexForOldExamination( + mySelectedExamination) == + -1 + ? 0 + : model.getFirstIndexForOldExamination( + mySelectedExamination)) + .map((examination) { + return ExaminationItemCard(examination, () { + removeExamination( + examination.selectedExamination); + }); + }).toList(), + ), + if (mySelectedExamination.isNotEmpty && + model.getFirstIndexForOldExamination( + mySelectedExamination) > + -1) + Row( + children: [ + AppText( + "Verified", + fontWeight: FontWeight.w600, + fontFamily: 'Poppins', + color: Colors.green, + ), + ], ), - ], - ), + Column( + children: mySelectedExamination + .sublist(model.getFirstIndexForOldExamination( + mySelectedExamination) == + -1 + ? 0 + : model.getFirstIndexForOldExamination( + mySelectedExamination)) + .map((examination) { + return ExaminationItemCard(examination, () { + removeExamination( + examination.selectedExamination); + }); + }).toList(), + ) + ], ), + isExpanded: isSysExaminationExpand, ), - ), - SizedBox( - height: 5, - ), - ], + SizedBox( + height: SizeConfig.heightMultiplier * + (SizeConfig.isHeightVeryShort ? 14 : 12), + ) + ], + ), ), - )), + ), + ), + ), ); } submitUpdateObjectivePage(SOAPViewModel model) async { if (mySelectedExamination.isNotEmpty) { - widget.changeLoadingState(true); - Map profile = await sharedPref.getObj(DOCTOR_PROFILE); + if(!model.isAddExamInProgress && widget.patientInfo.admissionNo != null && + widget.patientInfo.admissionNo.isNotEmpty) { + Navigator.of(context).pop(); + }else{ + widget.changeLoadingState(true); + Map profile = await sharedPref.getObj(DOCTOR_PROFILE); - DoctorProfileModel doctorProfile = DoctorProfileModel.fromJson(profile); - PostPhysicalExamRequestModel postPhysicalExamRequestModel = - new PostPhysicalExamRequestModel(); - mySelectedExamination.forEach((exam) { - if (postPhysicalExamRequestModel.listHisProgNotePhysicalExaminationVM == - null) - postPhysicalExamRequestModel.listHisProgNotePhysicalExaminationVM = - []; + DoctorProfileModel doctorProfile = DoctorProfileModel.fromJson(profile); + PostPhysicalExamRequestModel postPhysicalExamRequestModel = + new PostPhysicalExamRequestModel(); + mySelectedExamination.forEach((exam) { + if (postPhysicalExamRequestModel.listHisProgNotePhysicalExaminationVM == + null) + postPhysicalExamRequestModel.listHisProgNotePhysicalExaminationVM = + []; + ListHisProgNotePhysicalExaminationVM + listHisProgNotePhysicalExaminationVM = + ListHisProgNotePhysicalExaminationVM( + patientMRN: widget.patientInfo.patientMRN, + episodeId: widget.patientInfo.episodeNo == null?0: widget.patientInfo.episodeNo, + appointmentNo: widget.patientInfo.appointmentNo == null?0:widget.patientInfo.appointmentNo, + remarks: exam.remark ?? '', + createdBy: exam.createdBy ?? doctorProfile.doctorID, + createdOn: exam.createdOn ?? DateTime.now().toIso8601String(), + editedBy: doctorProfile.doctorID, + editedOn: DateTime.now().toIso8601String(), + examId: exam.selectedExamination.id, + examType: exam.selectedExamination.typeId, + isAbnormal: exam.isAbnormal, + isNormal: exam.isNormal, + notExamined: exam.notExamined, + examinationType: exam.isNormal + ? 1 + : exam.isAbnormal + ? 2 + : 3, + examinationTypeName: exam.isNormal + ? "Normal" + : exam.isAbnormal + ? 'AbNormal' + : "Not Examined", + isNew: exam.isNew, + ); + if (widget.patientInfo.admissionNo != null && + widget.patientInfo.admissionNo.isNotEmpty) { + listHisProgNotePhysicalExaminationVM.admissionNo = + int.parse(widget.patientInfo.admissionNo); + } else { + listHisProgNotePhysicalExaminationVM.admissionNo = 0; + } + postPhysicalExamRequestModel.listHisProgNotePhysicalExaminationVM + .add(listHisProgNotePhysicalExaminationVM); + }); - postPhysicalExamRequestModel.listHisProgNotePhysicalExaminationVM - .add(ListHisProgNotePhysicalExaminationVM( - patientMRN: widget.patientInfo.patientMRN, - episodeId: widget.patientInfo.episodeNo, - appointmentNo: widget.patientInfo.appointmentNo, - remarks: exam.remark ?? '', - createdBy: exam.createdBy ?? doctorProfile.doctorID, - createdOn: exam.createdOn ?? DateTime.now().toIso8601String(), - editedBy: doctorProfile.doctorID, - editedOn: DateTime.now().toIso8601String(), - examId: exam.selectedExamination.id, - examType: exam.selectedExamination.typeId, - isAbnormal: exam.isAbnormal, - isNormal: exam.isNormal, - notExamined: exam.notExamined, - examinationType: exam.isNormal - ? 1 - : exam.isAbnormal - ? 2 - : 3, - examinationTypeName: exam.isNormal - ? "Normal" - : exam.isAbnormal - ? 'AbNormal' - : "Not Examined", - isNew: exam.isNew)); - }); + if (model.patientPhysicalExamList.isEmpty) { + await model.postPhysicalExam(postPhysicalExamRequestModel); + } else { + await model.patchPhysicalExam(postPhysicalExamRequestModel); + } - if (model.patientPhysicalExamList.isEmpty) { - await model.postPhysicalExam(postPhysicalExamRequestModel); - } else { - await model.patchPhysicalExam(postPhysicalExamRequestModel); - } + if (model.state == ViewState.ErrorLocal) { + widget.changeLoadingState(false); + Helpers.showErrorToast(model.error); + if(widget.patientInfo.admissionNo != null && + widget.patientInfo.admissionNo.isNotEmpty) { + // Navigator.of(context).pop(); + model.isAddExamInProgress = false; + } + } else { + if(widget.patientInfo.admissionNo != null && + widget.patientInfo.admissionNo.isNotEmpty) { + // Navigator.of(context).pop(); + widget.changeLoadingState(false); + model.isAddExamInProgress = false; + } else { + widget.changeLoadingState(true); + widget.changePageViewIndex(2); + } - if (model.state == ViewState.ErrorLocal) { - widget.changeLoadingState(false); - Helpers.showErrorToast(model.error); - } else { - widget.changeLoadingState(true); - widget.changePageViewIndex(2); + } } + } else { Helpers.showErrorToast(TranslationBase.of(context).examinationErrorMsg); } @@ -274,10 +301,17 @@ class _UpdateObjectivePageState extends State { masterKey.id == element.selectedExamination.id && masterKey.typeId == element.selectedExamination.typeId); - if (history.length > 0) + if (history.length > 0) { setState(() { - mySelectedExamination.remove(history.first); + if (history.first.isLocal) { + mySelectedExamination.remove(history.first); + } else { + history.first.notExamined = true; + history.first.isNormal = false; + history.first.isAbnormal = false; + } }); + } } openExaminationList(BuildContext context) { @@ -286,69 +320,48 @@ class _UpdateObjectivePageState extends State { FadePage( page: AddExaminationPage( mySelectedExamination: mySelectedExamination, - addSelectedExamination: () { + addSelectedExamination: + (List mySelectedExaminationLocal) { setState(() { - Navigator.of(context).pop(); + { + mySelectedExaminationLocal.forEach((element) { + if ((mySelectedExamination.singleWhere( + (it) => + it.selectedExamination.id == + element.selectedExamination.id, + orElse: () => null)) == + null) { + mySelectedExamination.insert(0,element); + } + }); + + /// remove items. + List removedList = []; + mySelectedExamination.forEach((element) { + if ((mySelectedExaminationLocal.singleWhere( + (it) => + it.selectedExamination.id == + element.selectedExamination.id, + orElse: () => null)) == + null) { + removedList.add(element); + } + }); + + removedList.forEach((element) { + removeExamination(element.selectedExamination); + }); + Navigator.of(context).pop(); + } }); }, removeExamination: (masterKey) => removeExamination(masterKey)), ), ); } -} - -class AddExaminationDailog extends StatefulWidget { - final List mySelectedExamination; - final Function addSelectedExamination; - final Function(MasterKeyModel) removeExamination; - const AddExaminationDailog( - {Key key, - this.mySelectedExamination, - this.addSelectedExamination, - this.removeExamination}) - : super(key: key); - - @override - _AddExaminationDailogState createState() => _AddExaminationDailogState(); -} - -class _AddExaminationDailogState extends State { @override - Widget build(BuildContext context) { - return FractionallySizedBox( - heightFactor: 0.7, - child: BaseView( - onModelReady: (model) async { - if (model.physicalExaminationList.length == 0) { - await model - .getMasterLookup(MasterKeysService.PhysicalExamination); - } - }, - builder: (_, model, w) => AppScaffold( - baseViewModel: model, - isShowAppBar: false, - body: Center( - child: Container( - child: FractionallySizedBox( - widthFactor: 0.9, - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - SizedBox( - height: 16, - ), - AppText( - TranslationBase.of(context).physicalSystemExamination, - fontWeight: FontWeight.bold, - fontSize: 16, - ), - SizedBox( - height: 16, - ), - ]), - ))), - )), - ); + nextFunction(model) async { + await submitUpdateObjectivePage(model); } } diff --git a/lib/screens/patients/profile/soap_update/plan/plan_call_back.dart b/lib/screens/patients/profile/soap_update/plan/plan_call_back.dart new file mode 100644 index 00000000..14fef483 --- /dev/null +++ b/lib/screens/patients/profile/soap_update/plan/plan_call_back.dart @@ -0,0 +1,3 @@ +abstract class PlanCallBack{ + nextFunction(model); +} \ No newline at end of file diff --git a/lib/screens/patients/profile/soap_update/plan/update_plan_page.dart b/lib/screens/patients/profile/soap_update/plan/update_plan_page.dart index 4622bc94..d32634b2 100644 --- a/lib/screens/patients/profile/soap_update/plan/update_plan_page.dart +++ b/lib/screens/patients/profile/soap_update/plan/update_plan_page.dart @@ -1,6 +1,8 @@ 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/viewstate.dart'; import 'package:doctor_app_flutter/core/viewModel/SOAP_view_model.dart'; +import 'package:doctor_app_flutter/core/viewModel/base_view_model.dart'; import 'package:doctor_app_flutter/icons_app/doctor_app_icons.dart'; import 'package:doctor_app_flutter/models/SOAP/GetGetProgressNoteReqModel.dart'; import 'package:doctor_app_flutter/models/SOAP/GetGetProgressNoteResModel.dart'; @@ -8,6 +10,7 @@ import 'package:doctor_app_flutter/models/SOAP/post_progress_note_request_model. import 'package:doctor_app_flutter/models/doctor/doctor_profile_model.dart'; import 'package:doctor_app_flutter/models/patient/patiant_info_model.dart'; import 'package:doctor_app_flutter/screens/base/base_view.dart'; +import 'package:doctor_app_flutter/screens/patients/profile/soap_update/plan/plan_call_back.dart'; import 'package:doctor_app_flutter/util/date-utils.dart'; import 'package:doctor_app_flutter/util/helpers.dart'; import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; @@ -25,6 +28,8 @@ class UpdatePlanPage extends StatefulWidget { final Function changePageViewIndex; final PatiantInformtion patientInfo; final Function changeLoadingState; + final Function changeStateFun; + final SOAPViewModel sOAPViewModel; final int currentIndex; @@ -33,13 +38,16 @@ class UpdatePlanPage extends StatefulWidget { this.changePageViewIndex, this.patientInfo, this.changeLoadingState, - this.currentIndex}); + this.currentIndex, + this.sOAPViewModel, + this.changeStateFun}); @override _UpdatePlanPageState createState() => _UpdatePlanPageState(); } -class _UpdatePlanPageState extends State { +class _UpdatePlanPageState extends State + implements PlanCallBack { bool isAddProgress = true; bool isProgressExpanded = true; GetPatientProgressNoteResModel patientProgressNote = @@ -71,317 +79,280 @@ class _UpdatePlanPageState extends State { } } - - getPatientProgressNote(model, {bool isAddProgress = false}) async { + getPatientProgressNote(SOAPViewModel model, + {bool isAddProgress = false}) async { GetGetProgressNoteReqModel getGetProgressNoteReqModel = - GetGetProgressNoteReqModel( - appointmentNo: - int.parse(widget.patientInfo.appointmentNo.toString()), - patientMRN: widget.patientInfo.patientMRN, - episodeID: widget.patientInfo.episodeNo.toString(), - editedBy: '', - doctorID: ''); - await model.getPatientProgressNote(getGetProgressNoteReqModel); + GetGetProgressNoteReqModel( + appointmentNo: + int.parse(widget.patientInfo.appointmentNo.toString()), + patientMRN: widget.patientInfo.patientMRN, + episodeID: widget.patientInfo.episodeNo.toString(), + editedBy: '', + doctorID: ''); + await widget.sOAPViewModel + .getPatientProgressNote(getGetProgressNoteReqModel); - if (model.patientProgressNoteList.isNotEmpty) { + ///TODO set progressNote in model; + if (widget.sOAPViewModel.patientProgressNoteList.isNotEmpty) { progressNoteController.text = Helpers.parseHtmlString( - model.patientProgressNoteList[0].planNote); + widget.sOAPViewModel.patientProgressNoteList[0].planNote); patientProgressNote.planNote = progressNoteController.text; + patientProgressNote.createdByName = - model.patientProgressNoteList[0].createdByName; + widget.sOAPViewModel.patientProgressNoteList[0].createdByName; patientProgressNote.createdOn = - model.patientProgressNoteList[0].createdOn; + widget.sOAPViewModel.patientProgressNoteList[0].createdOn; patientProgressNote.editedOn = - model.patientProgressNoteList[0].editedOn; + widget.sOAPViewModel.patientProgressNoteList[0].editedOn; patientProgressNote.editedByName = - model.patientProgressNoteList[0].editedByName; + widget.sOAPViewModel.patientProgressNoteList[0].editedByName; patientProgressNote.appointmentNo = - model.patientProgressNoteList[0].appointmentNo; - setState(() { - isAddProgress = isAddProgress; - }); + widget.sOAPViewModel.patientProgressNoteList[0].appointmentNo; + setState(() { + isAddProgress = isAddProgress; + widget.sOAPViewModel.isAddProgress = isAddProgress; + widget.sOAPViewModel.progressNoteText = progressNoteController.text; + }); } } @override Widget build(BuildContext context) { return BaseView( - onModelReady: (model) async { - GetGetProgressNoteReqModel getGetProgressNoteReqModel = - GetGetProgressNoteReqModel( - appointmentNo: - int.parse(widget.patientInfo.appointmentNo.toString()), - patientMRN: widget.patientInfo.patientMRN, - episodeID: widget.patientInfo.episodeNo.toString(), - editedBy: '', - doctorID: ''); - await model.getPatientProgressNote(getGetProgressNoteReqModel); + onModelReady: (model) async { + widget.sOAPViewModel.setPlanCallBack(this); + GetGetProgressNoteReqModel getGetProgressNoteReqModel = + GetGetProgressNoteReqModel( + appointmentNo: + int.parse(widget.patientInfo.appointmentNo.toString()), + patientMRN: widget.patientInfo.patientMRN, + episodeID: widget.patientInfo.episodeNo.toString(), + editedBy: '', + doctorID: ''); + await widget.sOAPViewModel + .getPatientProgressNote(getGetProgressNoteReqModel); - if (model.patientProgressNoteList.isNotEmpty) { - progressNoteController.text = Helpers.parseHtmlString( - model.patientProgressNoteList[0].planNote); - patientProgressNote.planNote = progressNoteController.text; - patientProgressNote.createdByName = - model.patientProgressNoteList[0].createdByName; - patientProgressNote.createdOn = - model.patientProgressNoteList[0].createdOn; - patientProgressNote.editedOn = - model.patientProgressNoteList[0].editedOn; - patientProgressNote.editedByName = - model.patientProgressNoteList[0].editedByName; - patientProgressNote.appointmentNo = - model.patientProgressNoteList[0].appointmentNo; + if (widget.sOAPViewModel.patientProgressNoteList.isNotEmpty) { + progressNoteController.text = Helpers.parseHtmlString( + widget.sOAPViewModel.patientProgressNoteList[0].planNote); + patientProgressNote.planNote = progressNoteController.text; + patientProgressNote.createdByName = + widget.sOAPViewModel.patientProgressNoteList[0].createdByName; + patientProgressNote.createdOn = + widget.sOAPViewModel.patientProgressNoteList[0].createdOn; + patientProgressNote.editedOn = + widget.sOAPViewModel.patientProgressNoteList[0].editedOn; + patientProgressNote.editedByName = + widget.sOAPViewModel.patientProgressNoteList[0].editedByName; + patientProgressNote.appointmentNo = + widget.sOAPViewModel.patientProgressNoteList[0].appointmentNo; + widget.sOAPViewModel.progressNoteText = progressNoteController.text; - setState(() { - isAddProgress = false; - }); - } - widget.changeLoadingState(false); - }, - builder: (_, model, w) => AppScaffold( - backgroundColor: Theme.of(context).scaffoldBackgroundColor, - isShowAppBar: false, - body: SingleChildScrollView( - physics: ScrollPhysics(), - child: Center( - child: FractionallySizedBox( - widthFactor: 0.90, - child: Column( - children: [ - SOAPStepHeader( - currentIndex: widget.currentIndex, - changePageViewIndex: widget.changePageViewIndex), - SizedBox( - height: 10, - ), - ExpandableSOAPWidget( - headerTitle: TranslationBase.of(context).progressNote, - onTap: () { - setState(() { - isProgressExpanded = !isProgressExpanded; - }); - }, - child: Column( - mainAxisAlignment: MainAxisAlignment.start, - children: [ - Column( - crossAxisAlignment: CrossAxisAlignment.start, + setState(() { + isAddProgress = false; + widget.sOAPViewModel.isAddProgress = false; + }); + } + widget.changeLoadingState(false); + }, + builder: (_, model, w) => AppScaffold( + backgroundColor: Theme.of(context).scaffoldBackgroundColor, + isShowAppBar: false, + body: SingleChildScrollView( + physics: ScrollPhysics(), + child: Center( + child: FractionallySizedBox( + widthFactor: 0.90, + child: Column( + children: [ + SOAPStepHeader( + currentIndex: widget.currentIndex, + changePageViewIndex: widget.changePageViewIndex, + patientInfo: widget.patientInfo, + ), + SizedBox( + height: 10, + ), + ExpandableSOAPWidget( + headerTitle: TranslationBase.of(context).progressNote, + onTap: () { + setState(() { + isProgressExpanded = !isProgressExpanded; + }); + }, + child: Column( + mainAxisAlignment: MainAxisAlignment.start, children: [ - if (isAddProgress) - Container( - margin: EdgeInsets.only( - left: 10, right: 10, top: 15), - child: AppTextFieldCustom( - hintText: TranslationBase.of(context) - .progressNote, - controller: progressNoteController, - minLines: 2, - maxLines: 4, - inputType: TextInputType.multiline, - onChanged: (value) { - setState(() { - patientProgressNote.planNote = value; - }); - }, - ), - ), - SizedBox( - height: 9, - ), - if (patientProgressNote.planNote != null && - !isAddProgress) - Container( - margin: EdgeInsets.only( - left: 5, - right: 5, + Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + if (isAddProgress) + Container( + margin: EdgeInsets.only( + left: 10, right: 10, top: 15), + child: AppTextFieldCustom( + hintText: TranslationBase.of(context) + .progressNote, + controller: progressNoteController, + minLines: 2, + maxLines: 4, + inputType: TextInputType.multiline, + onChanged: (value) { + setState(() { + patientProgressNote.planNote = + value; + model.progressNoteText = value; + widget.changeStateFun(); + }); + }, + ), + ), + SizedBox( + height: 9, ), - child: Column( - crossAxisAlignment: - CrossAxisAlignment.start, - children: [ - Row( - mainAxisAlignment: - MainAxisAlignment.spaceBetween, + if (patientProgressNote.planNote != null && + !isAddProgress) + Container( + margin: EdgeInsets.only( + left: 5, + right: 5, + ), + child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ Row( + mainAxisAlignment: + MainAxisAlignment.spaceBetween, + crossAxisAlignment: + CrossAxisAlignment.start, children: [ - AppText( - 'Appointment No: ', - fontSize: 12, + Row( + children: [ + AppText( + 'Appointment No: ', + fontSize: SizeConfig + .getTextMultiplierBasedOnWidth() * + 3, + letterSpacing: -0.4, + color: Color(0xFF575757), + ), + AppText( + patientProgressNote + .appointmentNo != + null + ? patientProgressNote + .appointmentNo + .toString() + : '', + fontWeight: FontWeight.w600, + letterSpacing: -0.48, + color: Color(0xFF2B353E), + fontSize: SizeConfig + .getTextMultiplierBasedOnWidth() * + 3.6, + ), + ], ), AppText( - patientProgressNote - .appointmentNo != + patientProgressNote.createdOn != null - ? patientProgressNote - .appointmentNo - .toString() - : '', + ? AppDateUtils + .getDayMonthYearDateFormatted( + DateTime.parse( + patientProgressNote + .createdOn)) + : AppDateUtils + .getDayMonthYearDateFormatted( + DateTime.now()), fontWeight: FontWeight.w600, - fontSize: 14, - ), + fontSize: SizeConfig + .getTextMultiplierBasedOnWidth() * + 3.6, + ) ], ), - AppText( - patientProgressNote.createdOn != - null - ? AppDateUtils - .getDayMonthYearDateFormatted( + Row( + mainAxisAlignment: + MainAxisAlignment.end, + crossAxisAlignment: + CrossAxisAlignment.start, + children: [ + // Row( + // children: [ + // AppText( + // 'Condition: ', + // fontSize: 12, + // ), + // AppText( + // patientProgressNote.mName ?? + // '', + // fontWeight: FontWeight.w600), + // ], + // ), + AppText( + patientProgressNote.createdOn != + null + ? AppDateUtils.getHour( DateTime.parse( patientProgressNote .createdOn)) - : AppDateUtils - .getDayMonthYearDateFormatted( + : AppDateUtils.getHour( DateTime.now()), - fontWeight: FontWeight.w600, - fontSize: 14, - ) - ], - ), - Row( - mainAxisAlignment: - MainAxisAlignment.end, - crossAxisAlignment: - CrossAxisAlignment.start, - children: [ - // Row( - // children: [ - // AppText( - // 'Condition: ', - // fontSize: 12, - // ), - // AppText( - // patientProgressNote.mName ?? - // '', - // fontWeight: FontWeight.w600), - // ], - // ), - AppText( - patientProgressNote.createdOn != - null - ? AppDateUtils.getHour( - DateTime.parse( - patientProgressNote - .createdOn)) - : AppDateUtils.getHour( - DateTime.now()), - fontWeight: FontWeight.w600, - fontSize: 14, - ) - ], - ), - SizedBox( - height: 8, - ), - Row( - mainAxisAlignment: - MainAxisAlignment.start, - children: [ - Expanded( - child: AppText( - progressNoteController.text, - fontSize: 10, - ), + fontWeight: FontWeight.w600, + color: Color(0xFF575757), + fontSize: SizeConfig + .getTextMultiplierBasedOnWidth() * + 3.6, + ) + ], + ), + SizedBox( + height: 8, + ), + Row( + mainAxisAlignment: + MainAxisAlignment.start, + children: [ + Expanded( + child: AppText( + progressNoteController.text, + fontSize: 10, + ), + ), + InkWell( + onTap: () { + setState(() { + isAddProgress = true; + widget.sOAPViewModel + .isAddProgress = true; + }); + }, + child: Icon( + DoctorApp.edit, + size: 18, + )) + ], ), - InkWell( - onTap: () { - setState(() { - isAddProgress = true; - }); - }, - child: Icon( - DoctorApp.edit, - size: 18, - )) ], ), - ], - ), - ) + ) + ], + ), ], ), - ], - ), - isExpanded: isProgressExpanded, - ), - ], - ), - ), - ), - ), - bottomSheet: Container( - decoration: BoxDecoration( - color: Colors.white, - borderRadius: BorderRadius.all( - Radius.circular(0.0), - ), - border: Border.all(color: HexColor('#707070'), width: 0), - ), - height: 80, - width: double.infinity, - child: Column( - children: [ - SizedBox( - height: 10, - ), - Container( - child: FractionallySizedBox( - widthFactor: .80, - child: Center( - child: Row( - children: [ - Expanded( - child: AppButton( - title: TranslationBase.of(context).previous, - color: Colors.grey[300], - fontColor: Colors.black, - fontWeight: FontWeight.w600, - disabled: model.state == ViewState.BusyLocal, - onPressed: () async { - widget.changePageViewIndex(2); - }, - ), - ), - SizedBox( - width: 5, - ), - Expanded( - child: AppButton( - title: isAddProgress - ? TranslationBase.of(context).next - : TranslationBase.of(context).finish, - fontWeight: FontWeight.w600, - color: Colors.red[700], - disabled: progressNoteController.text.isEmpty, - onPressed: () async { - if (progressNoteController.text.isNotEmpty) { - if (isAddProgress) { - submitPlan(model); - } else { - Navigator.of(context).pop(); - } - } else { - Helpers.showErrorToast( - TranslationBase.of(context) - .progressNoteErrorMsg); - } - }, - ), - ), - ], - ), + isExpanded: isProgressExpanded, + ), + SizedBox( + height: SizeConfig.heightMultiplier * + (SizeConfig.isHeightVeryShort ? 20 : 10), + ), + ], ), ), ), - SizedBox( - height: 5, - ), - ], - ), - )), - ); + ), + )); } submitPlan(SOAPViewModel model) async { @@ -396,45 +367,48 @@ class _UpdatePlanPageState extends State { doctorID: '', editedBy: ''); - if (model.patientProgressNoteList.isEmpty) { - await model.postProgressNote(postProgressNoteRequestModel); + if (widget.sOAPViewModel.patientProgressNoteList.isEmpty) { + await widget.sOAPViewModel + .postProgressNote(postProgressNoteRequestModel); } else { Map profile = await sharedPref.getObj(DOCTOR_PROFILE); DoctorProfileModel doctorProfile = DoctorProfileModel.fromJson(profile); postProgressNoteRequestModel.editedBy = doctorProfile.doctorID; - await model.patchProgressNote(postProgressNoteRequestModel); + await widget.sOAPViewModel + .patchProgressNote(postProgressNoteRequestModel); } - if (model.state == ViewState.ErrorLocal) { - Helpers.showErrorToast(model.error); + if (widget.sOAPViewModel.state == ViewState.ErrorLocal) { + Helpers.showErrorToast(widget.sOAPViewModel.error); } else { - GetGetProgressNoteReqModel getGetProgressNoteReqModel = - GetGetProgressNoteReqModel( - appointmentNo: - int.parse(widget.patientInfo.appointmentNo.toString()), - patientMRN: widget.patientInfo.patientMRN, - episodeID: widget.patientInfo.episodeNo.toString(), - editedBy: '', - doctorID: ''); - await model.getPatientProgressNote(getGetProgressNoteReqModel); - if (model.patientProgressNoteList.isNotEmpty) { + GetGetProgressNoteReqModel( + appointmentNo: + int.parse(widget.patientInfo.appointmentNo.toString()), + patientMRN: widget.patientInfo.patientMRN, + episodeID: widget.patientInfo.episodeNo.toString(), + editedBy: '', + doctorID: ''); + await widget.sOAPViewModel + .getPatientProgressNote(getGetProgressNoteReqModel); + if (widget.sOAPViewModel.patientProgressNoteList.isNotEmpty) { progressNoteController.text = Helpers.parseHtmlString( - model.patientProgressNoteList[0].planNote); + widget.sOAPViewModel.patientProgressNoteList[0].planNote); patientProgressNote.planNote = progressNoteController.text; patientProgressNote.createdByName = - model.patientProgressNoteList[0].createdByName; + widget.sOAPViewModel.patientProgressNoteList[0].createdByName; patientProgressNote.createdOn = - model.patientProgressNoteList[0].createdOn; + widget.sOAPViewModel.patientProgressNoteList[0].createdOn; patientProgressNote.editedOn = - model.patientProgressNoteList[0].editedOn; + widget.sOAPViewModel.patientProgressNoteList[0].editedOn; patientProgressNote.editedByName = - model.patientProgressNoteList[0].editedByName; + widget.sOAPViewModel.patientProgressNoteList[0].editedByName; patientProgressNote.appointmentNo = - model.patientProgressNoteList[0].appointmentNo; + widget.sOAPViewModel.patientProgressNoteList[0].appointmentNo; setState(() { isAddProgress = false; + widget.sOAPViewModel.isAddProgress = false; }); } } @@ -443,4 +417,17 @@ class _UpdatePlanPageState extends State { Helpers.showErrorToast(TranslationBase.of(context).progressNoteErrorMsg); } } + + @override + nextFunction(model) { + if (progressNoteController.text.isNotEmpty) { + if (isAddProgress) { + submitPlan(model); + } else { + Navigator.of(context).pop(); + } + } else { + Helpers.showErrorToast(TranslationBase.of(context).progressNoteErrorMsg); + } + } } diff --git a/lib/screens/patients/profile/soap_update/shared_soap_widgets/SOAP_open_items.dart b/lib/screens/patients/profile/soap_update/shared_soap_widgets/SOAP_open_items.dart index 31a501ce..6449913c 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 @@ -1,3 +1,4 @@ +import 'package:doctor_app_flutter/config/size_config.dart'; import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart'; import 'package:flutter/material.dart'; @@ -35,20 +36,24 @@ class SOAPOpenItems extends StatelessWidget { children: [ AppText( "$label", - fontSize:15, - color: Colors.black, - fontWeight: FontWeight.w600, + fontSize:SizeConfig.getTextMultiplierBasedOnWidth()*4.5, + fontWeight: FontWeight.w700, + color: Color(0xFF2E303A), + letterSpacing:-0.44 , ), AppText( "${TranslationBase.of(context).searchHere}", - fontSize:13, - color: Colors.grey.shade700, + fontSize:SizeConfig.getTextMultiplierBasedOnWidth()*3.5, + fontWeight: FontWeight.w500, + color: Color(0xFF575757), + letterSpacing:-0.56 , ), ], )), Icon( Icons.add_box_rounded, - size: 25, + size: 28, + color: Color(0xFF2E303A), ) ], ), diff --git a/lib/screens/patients/profile/soap_update/shared_soap_widgets/SOAP_step_header.dart b/lib/screens/patients/profile/soap_update/shared_soap_widgets/SOAP_step_header.dart index 85614b6d..51afcd1f 100644 --- a/lib/screens/patients/profile/soap_update/shared_soap_widgets/SOAP_step_header.dart +++ b/lib/screens/patients/profile/soap_update/shared_soap_widgets/SOAP_step_header.dart @@ -1,4 +1,6 @@ -import 'package:doctor_app_flutter/screens/patients/profile/soap_update/shared_soap_widgets/steps_widget.dart'; +import 'package:doctor_app_flutter/config/size_config.dart'; +import 'package:doctor_app_flutter/models/patient/patiant_info_model.dart'; +import 'package:doctor_app_flutter/screens/patients/profile/soap_update/shared_soap_widgets/steper/steps_widget.dart'; import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart'; import 'package:flutter/material.dart'; @@ -6,11 +8,12 @@ import 'package:flutter/material.dart'; class SOAPStepHeader extends StatelessWidget { const SOAPStepHeader({ Key key, - this.currentIndex, this.changePageViewIndex, + this.currentIndex, this.changePageViewIndex, this.patientInfo, }) : super(key: key); final int currentIndex; final Function changePageViewIndex; + final PatiantInformtion patientInfo; @override Widget build(BuildContext context) { @@ -18,25 +21,32 @@ class SOAPStepHeader extends StatelessWidget { mainAxisAlignment: MainAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start, children: [ - SizedBox(height: 15,), + SizedBox(height: SizeConfig.isHeightVeryShort?30: 15,), AppText( TranslationBase.of(context).createNew, - fontSize: 14, - fontWeight: FontWeight.w500, + fontSize: SizeConfig.getTextMultiplierBasedOnWidth() * (SizeConfig.isWidthLarge? 3: 4), + fontWeight: FontWeight.w700, + letterSpacing:-0.72, + color: Color(0xFF2E303A), + ), AppText(TranslationBase.of(context).episode, - fontSize: 26, + fontSize:SizeConfig.getTextMultiplierBasedOnWidth() * (SizeConfig.isWidthLarge? 6: 8), fontWeight: FontWeight.bold, + letterSpacing:-1.44, + color: Color(0xFF2E303A), ), Container( color: Theme.of(context).scaffoldBackgroundColor, child: StepsWidget( index: currentIndex, changeCurrentTab: changePageViewIndex, + patientInfo: patientInfo, ), ), SizedBox( - height: 30, + height:SizeConfig.heightMultiplier * + (SizeConfig.isHeightVeryShort ? 1 : 2), ), ], ); diff --git a/lib/screens/patients/profile/soap_update/shared_soap_widgets/bottom_sheet_dialog_button.dart b/lib/screens/patients/profile/soap_update/shared_soap_widgets/bottom_sheet_dialog_button.dart new file mode 100644 index 00000000..835dd225 --- /dev/null +++ b/lib/screens/patients/profile/soap_update/shared_soap_widgets/bottom_sheet_dialog_button.dart @@ -0,0 +1,52 @@ +import 'package:doctor_app_flutter/config/size_config.dart'; +import 'package:doctor_app_flutter/widgets/shared/buttons/app_buttons_widget.dart'; +import 'package:flutter/material.dart'; +import 'package:hexcolor/hexcolor.dart'; + +class BottomSheetDialogButton extends StatelessWidget { + final Function onTap; + final String label; + + double headerHeight = SizeConfig.heightMultiplier * 12; + + BottomSheetDialogButton({Key key, this.onTap, this.label}) : super(key: key); + + @override + Widget build(BuildContext context) { + return Container( + decoration: BoxDecoration( + color: Colors.white, + borderRadius: BorderRadius.all( + Radius.circular(0.0), + ), + border: Border.all(color: HexColor('#EFEFEF'), width: 1), + ), + height: headerHeight, + width: double.infinity, + child: Column( + children: [ + Container( + margin: EdgeInsets.only( + top: headerHeight * (SizeConfig.isWidthLarge ? 0.3 : 0.2)), + child: FractionallySizedBox( + widthFactor: .80, + child: Center( + child: AppButton( + height: SizeConfig.heightMultiplier * + (SizeConfig.isHeightVeryShort ? 8 : 6), + title: label, + padding: 10, + color: Color(0xFF359846), + onPressed: onTap, + ), + ), + ), + ), + SizedBox( + height: 5, + ), + ], + ), + ); + } +} 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 d8110844..d6c19372 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 @@ -1,63 +1,67 @@ +import 'package:doctor_app_flutter/config/size_config.dart'; import 'package:doctor_app_flutter/icons_app/doctor_app_icons.dart'; import 'package:flutter/material.dart'; class BottomSheetTitle extends StatelessWidget with PreferredSizeWidget { - const BottomSheetTitle({ + BottomSheetTitle({ Key key, this.title, }) : super(key: key); final String title; + double headerHeight = SizeConfig.heightMultiplier*15; @override Widget build(BuildContext context) { return Container( - padding: EdgeInsets.only( - left: 0, right: 5, bottom: 5, top: 5), + // padding: EdgeInsets.only( + // left: 0, right: 5, bottom: 5, top: 5), decoration: BoxDecoration( color: Colors.white, ), - height: 115, - child: Container( - padding: EdgeInsets.only( - left: 10, right: 10), - margin: EdgeInsets.only(top: 60), - child: Column( - children: [ - Row( - mainAxisAlignment: - MainAxisAlignment.spaceBetween, - children: [ - RichText( - text: TextSpan( - style: TextStyle( - fontSize:20, - color: Colors.black), - children: [ - new TextSpan( + height: headerHeight, + child: Center( + child: Container( + padding: EdgeInsets.only( + left: 10, right: 10), + margin: EdgeInsets.only(top: headerHeight *0.5), + child: Column( + children: [ + Row( + mainAxisAlignment: + MainAxisAlignment.spaceBetween, + children: [ + RichText( + text: TextSpan( + style: TextStyle( + fontSize:20, + color: Colors.black), + children: [ + new TextSpan( - text: title, - style: TextStyle( - color: Color(0xFF2B353E), - fontWeight: FontWeight.bold, - fontFamily: 'Poppins', - fontSize: 22)), - ], + text: title, + style: TextStyle( + color: Color(0xFF2B353E), + fontWeight: FontWeight.bold, + fontFamily: 'Poppins', + fontSize: SizeConfig.getTextMultiplierBasedOnWidth()*6)), + ], + ), ), - ), - InkWell( - onTap: () { - Navigator.pop(context); - }, - child: Icon(DoctorApp.close_1, - size:20, - color: Color(0xFF2B353E))) - ], - ), - ], + InkWell( + onTap: () { + Navigator.pop(context); + }, + child: Icon(DoctorApp.close_1, + size:SizeConfig.getTextMultiplierBasedOnWidth()*5, + color: Color(0xFF2B353E))) + ], + ), + ], + ), ), ), ); } @override - Size get preferredSize => Size(double.maxFinite,115); + Size get preferredSize => Size(double.maxFinite,headerHeight); } 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 d4666428..c1b2d443 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 @@ -1,3 +1,4 @@ +import 'package:doctor_app_flutter/config/size_config.dart'; import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart'; import 'package:doctor_app_flutter/widgets/shared/expandable-widget-header-body.dart'; import 'package:eva_icons_flutter/eva_icons_flutter.dart'; @@ -19,7 +20,7 @@ class ExpandableSOAPWidget extends StatelessWidget { @override Widget build(BuildContext context) { return Container( - padding: EdgeInsets.symmetric(vertical: 20, horizontal: 10), + padding: EdgeInsets.symmetric(vertical: SizeConfig.isHeightVeryShort ?10:20, horizontal: 10), decoration: BoxDecoration( color: Colors.white, borderRadius: BorderRadius.all( @@ -41,12 +42,14 @@ class ExpandableSOAPWidget extends StatelessWidget { children: [ AppText(headerTitle, variant: isExpanded ? "bodyText" : '', - fontSize: 15, - color: Colors.black), + fontSize: SizeConfig.getTextMultiplierBasedOnWidth()*(SizeConfig.isHeightVeryShort?4.8: SizeConfig.isWidthLarge?4: 5), + letterSpacing:-0.64, + fontWeight: FontWeight.w700, + color: Color(0xFF2E303A),), if(isRequired) Icon( FontAwesomeIcons.asterisk, - size: 12, + size: SizeConfig.getTextMultiplierBasedOnWidth()*2.5, ) ], ), diff --git a/lib/screens/patients/profile/soap_update/shared_soap_widgets/remark_text.dart b/lib/screens/patients/profile/soap_update/shared_soap_widgets/remark_text.dart new file mode 100644 index 00000000..91ef6954 --- /dev/null +++ b/lib/screens/patients/profile/soap_update/shared_soap_widgets/remark_text.dart @@ -0,0 +1,24 @@ + +import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart'; +import 'package:flutter/material.dart'; + +class RemarkText extends StatelessWidget { + final String remark; + const RemarkText({ + Key key, this.remark, + }) : super(key: key); + + @override + Widget build(BuildContext context) { + return Container( + width: MediaQuery.of(context).size.width * 0.55, + child: AppText( + remark ?? '', + color: Color(0xFF575757), + fontSize: 10, + fontWeight: FontWeight.w700, + letterSpacing: -0.4, + ), + ); + } +} \ No newline at end of file diff --git a/lib/screens/patients/profile/soap_update/shared_soap_widgets/remove_button.dart b/lib/screens/patients/profile/soap_update/shared_soap_widgets/remove_button.dart new file mode 100644 index 00000000..1e5231c9 --- /dev/null +++ b/lib/screens/patients/profile/soap_update/shared_soap_widgets/remove_button.dart @@ -0,0 +1,39 @@ + +import 'package:doctor_app_flutter/config/size_config.dart'; +import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; +import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart'; +import 'package:flutter/material.dart'; +import 'package:font_awesome_flutter/font_awesome_flutter.dart'; +import 'package:hexcolor/hexcolor.dart'; + +class RemoveButton extends StatelessWidget { + final Function onTap; + final String label; + + const RemoveButton({Key key, this.onTap, this.label}) : super(key: key); + + @override + Widget build(BuildContext context) { + return InkWell( + child: Row( + children: [ + Container( + child: AppText( + label??TranslationBase.of(context).remove, + fontSize: SizeConfig.getTextMultiplierBasedOnWidth() *3.5, + fontWeight: FontWeight.w700, + color: HexColor("#D02127"), + letterSpacing:-0.48, + ), + ), + Icon( + FontAwesomeIcons.times, + color: HexColor("#D02127"), + size: SizeConfig.getTextMultiplierBasedOnWidth() *4, + ), + ], + ), + onTap: onTap, + ); + } +} diff --git a/lib/screens/patients/profile/soap_update/shared_soap_widgets/steper/Step_details_widget.dart b/lib/screens/patients/profile/soap_update/shared_soap_widgets/steper/Step_details_widget.dart new file mode 100644 index 00000000..fb1bdcc9 --- /dev/null +++ b/lib/screens/patients/profile/soap_update/shared_soap_widgets/steper/Step_details_widget.dart @@ -0,0 +1,22 @@ +import 'package:doctor_app_flutter/config/size_config.dart'; +import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart'; +import 'package:flutter/material.dart'; + +class StepDetailsWidget extends StatelessWidget { + final String stepLabel; + final double marginLeft; + + const StepDetailsWidget({ + Key key, this.stepLabel, this.marginLeft = 0, + }) : super(key: key); + + @override + Widget build(BuildContext context) { + return AppText( + stepLabel, + fontWeight: FontWeight.bold, + marginLeft: marginLeft, + fontSize:SizeConfig.getTextMultiplierBasedOnWidth() * 3.5 //12, + ); + } +} \ No newline at end of file diff --git a/lib/screens/patients/profile/soap_update/shared_soap_widgets/steper/status_Label.dart b/lib/screens/patients/profile/soap_update/shared_soap_widgets/steper/status_Label.dart new file mode 100644 index 00000000..10562d53 --- /dev/null +++ b/lib/screens/patients/profile/soap_update/shared_soap_widgets/steper/status_Label.dart @@ -0,0 +1,52 @@ +import 'package:doctor_app_flutter/config/size_config.dart'; +import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; +import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart'; +import 'package:flutter/material.dart'; +import 'package:hexcolor/hexcolor.dart'; + +class StatusLabel extends StatelessWidget { + const StatusLabel({ + Key key, + this.stepId, + this.selectedStepId, + }) : super(key: key); + + final int stepId; + final int selectedStepId; + + @override + Widget build(BuildContext context) { + return Container( + width: SizeConfig.getTextMultiplierBasedOnWidth() * 18.5, + padding: EdgeInsets.symmetric(horizontal: 2, vertical: 3), + decoration: BoxDecoration( + color: stepId == selectedStepId + ? Color(0xFFF1E9D3) + : stepId < selectedStepId + ? Color(0xFFD8E8DB) + : Color(0xFFCCCCCC), + borderRadius: BorderRadius.all( + Radius.circular(5.0), + ), + border: Border.all(color: HexColor('#707070'), width: 0.30), + ), + child: Center( + child: AppText( + stepId == selectedStepId + ? TranslationBase.of(context).inProgress + : stepId < selectedStepId + ? TranslationBase.of(context).completed + : TranslationBase.of(context).locked, + fontWeight: FontWeight.bold, + textAlign: TextAlign.center, + fontSize: SizeConfig.getTextMultiplierBasedOnWidth() * 2.7, + color: stepId == selectedStepId + ? Color(0xFFCC9B14) + : stepId < selectedStepId + ? Color(0xFF359846) + : Color(0xFF969696), + ), + ), + ); + } +} \ No newline at end of file diff --git a/lib/screens/patients/profile/soap_update/shared_soap_widgets/steper/steps_widget.dart b/lib/screens/patients/profile/soap_update/shared_soap_widgets/steper/steps_widget.dart new file mode 100644 index 00000000..e1c97d75 --- /dev/null +++ b/lib/screens/patients/profile/soap_update/shared_soap_widgets/steper/steps_widget.dart @@ -0,0 +1,511 @@ +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/patient/patiant_info_model.dart'; +import 'package:doctor_app_flutter/screens/patients/profile/soap_update/shared_soap_widgets/steper/status_Label.dart'; +import 'package:flutter/cupertino.dart'; +import 'package:flutter/material.dart'; +import 'package:font_awesome_flutter/font_awesome_flutter.dart'; +import 'package:provider/provider.dart'; + +import 'Step_details_widget.dart'; + +class StepsWidget extends StatelessWidget { + final int index; + final Function changeCurrentTab; + final double height; + final PatiantInformtion patientInfo; + + StepsWidget( + {Key key, + this.index, + this.changeCurrentTab, + this.height = 0.0, + this.patientInfo}); + + @override + Widget build(BuildContext context) { + ProjectViewModel projectViewModel = Provider.of(context); + double circleHeight = (SizeConfig.isHeightVeryShort + ? 30 + : SizeConfig.isHeightShort + ? 38 + : 38); + double circleTop = (SizeConfig.isHeightVeryShort + ? 12 + : SizeConfig.isHeightShort + ? 10 + : 10); + double containerHeight = + SizeConfig.heightMultiplier * (SizeConfig.isHeightVeryShort ? 16 : 15); + + return !projectViewModel.isArabic + ? Stack( + children: [ + Container( + height: height == 0 ? containerHeight : height, + width: MediaQuery.of(context).size.width * 0.9, + color: Colors.transparent, + ), + Positioned( + top: 30, + child: Center( + child: Container( + width: MediaQuery.of(context).size.width * + (patientInfo.admissionNo == null || + patientInfo.admissionNo.isEmpty + ? 0.9 + : 0.85), + child: Divider( + color: Colors.grey, + height: 0.75, + thickness: 0.75, + ), + ), + ), + ), + Positioned( + top: circleTop, + left: 0, + child: InkWell( + onTap: () => changeCurrentTab(0), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Container( + width: circleHeight, + height: circleHeight, + decoration: BoxDecoration( + border: index == 0 + ? Border.all(color: Color(0xFFCC9B14), width: 2) + : index > 0 + ? null + : Border.all( + color: Colors.black, width: 0.75), + shape: BoxShape.circle, + color: index == 0 + ? Color(0xFFCC9B14) + : index > 0 + ? Color(0xFF359846) + : Color(0xFFCCCCCC), + ), + child: Center( + child: Icon( + FontAwesomeIcons.check, + size: 20, + color: Colors.white, + )), + ), + SizedBox(height: 5), + Column( + mainAxisAlignment: MainAxisAlignment.start, + children: [ + StepDetailsWidget( + stepLabel: "Subjective", + ), + StatusLabel( + selectedStepId: index, + stepId: 0, + ), + ], + ), + ], + ), + ), + ), + Positioned( + top: circleTop, + left: patientInfo.admissionNo == null || + patientInfo.admissionNo.isEmpty + ? MediaQuery.of(context).size.width * 0.25 + : MediaQuery.of(context).size.width * 0.71, + child: InkWell( + onTap: () => index >= 1 ? changeCurrentTab(1) : null, + child: Column( + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + Container( + width: circleHeight, + height: circleHeight, + decoration: BoxDecoration( + border: index == 1 + ? Border.all(color: Color(0xFFCC9B14), width: 2) + : index > 2 + ? null + : Border.all( + color: Color(0xFFCCCCCC), width: 0.75), + shape: BoxShape.circle, + color: index == 1 + ? Color(0xFFCC9B14) + : index > 1 + ? Color(0xFF359846) + : Color(0xFFCCCCCC), + ), + child: Center( + child: Icon( + FontAwesomeIcons.check, + size: 20, + color: Colors.white, + )), + ), + SizedBox( + height: 5, + ), + Column( + mainAxisAlignment: MainAxisAlignment.start, + children: [ + StepDetailsWidget( + stepLabel: "Objective", + ), + StatusLabel( + selectedStepId: index, + stepId: 1, + ), + ], + ), + ], + ), + ), + ), + if (patientInfo.admissionNo == null || + patientInfo.admissionNo.isEmpty) + Positioned( + top: circleTop, + left: MediaQuery.of(context).size.width * 0.47, + child: InkWell( + onTap: () { + if (index >= 3) changeCurrentTab(2); + }, + child: Column( + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + Container( + width: circleHeight, + height: circleHeight, + decoration: BoxDecoration( + border: index == 2 + ? Border.all(color: Color(0xFFCC9B14), width: 2) + : index > 2 + ? null + : Border.all( + color: Color(0xFFCCCCCC), width: 0.75), + shape: BoxShape.circle, + color: index == 2 + ? Color(0xFFCC9B14) + : index > 2 + ? Color(0xFF359846) + : Color(0xFFCCCCCC), + ), + child: Center( + child: Icon( + FontAwesomeIcons.check, + size: 20, + color: Colors.white, + )), + ), + SizedBox( + height: 5, + ), + Column( + mainAxisAlignment: MainAxisAlignment.start, + children: [ + StepDetailsWidget( + stepLabel: "Assessment", + ), + StatusLabel( + selectedStepId: index, + stepId: 2, + ), + ], + ), + ], + ), + ), + ), + if (patientInfo.admissionNo == null || + patientInfo.admissionNo.isEmpty) + Positioned( + top: circleTop, + right: 0, + child: InkWell( + onTap: () => index >= 3 ? changeCurrentTab(4) : null, + child: Column( + crossAxisAlignment: CrossAxisAlignment.end, + children: [ + Container( + width: circleHeight, + height: circleHeight, + decoration: BoxDecoration( + border: index == 3 + ? Border.all(color: Color(0xFFCC9B14), width: 2) + : index > 3 + ? null + : Border.all( + color: Color(0xFFCCCCCC), width: 0.75), + shape: BoxShape.circle, + color: index == 3 + ? Color(0xFFCC9B14) + : index > 3 + ? Color(0xFF359846) + : Color(0xFFCCCCCC), + ), + child: Center( + child: Icon( + FontAwesomeIcons.check, + size: 20, + color: Colors.white, + )), + ), + SizedBox( + height: 5, + ), + Column( + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + StepDetailsWidget( + stepLabel: "Plan", + marginLeft: 30, + ), + StatusLabel( + selectedStepId: index, + stepId: 3, + ), + ], + ), + ], + ), + ), + ), + ], + ) + : Stack( + children: [ + Container( + height: height == 0 ? 100 : height, + width: MediaQuery.of(context).size.width * 0.9, + color: Colors.transparent, + ), + Positioned( + top: 30, + child: Center( + child: Container( + width: MediaQuery.of(context).size.width * (patientInfo.admissionNo == null || + patientInfo.admissionNo.isEmpty?0.9:0.85), + child: Divider( + color: Colors.grey, + height: 0.75, + thickness: 0.75, + ), + ), + ), + ), + Positioned( + top: circleTop, + right: 0, + child: InkWell( + onTap: () => changeCurrentTab(0), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Container( + width: circleHeight, + height: circleHeight, + decoration: BoxDecoration( + border: index == 0 + ? Border.all(color: Color(0xFFCC9B14), width: 2) + : index > 0 + ? null + : Border.all( + color: Colors.black, width: 0.75), + shape: BoxShape.circle, + color: index == 0 + ? Color(0xFFCC9B14) + : index > 0 + ? Color(0xFF359846) + : Color(0xFFCCCCCC), + ), + child: Center( + child: Icon( + FontAwesomeIcons.check, + size: 20, + color: Colors.white, + )), + ), + SizedBox(height: 3), + Column( + children: [ + StepDetailsWidget( + stepLabel: "شخصي", + ), + StatusLabel( + selectedStepId: index, + stepId: 0, + ), + ], + ), + ], + ), + ), + ), + Positioned( + top: circleTop, + right: MediaQuery.of(context).size.width * (patientInfo.admissionNo == null || + patientInfo.admissionNo.isEmpty?0.25:0.71), + child: InkWell( + onTap: () => index >= 2 ? changeCurrentTab(1) : null, + child: Column( + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + Container( + width: circleHeight, + height: circleHeight, + decoration: BoxDecoration( + border: index == 1 + ? Border.all(color: Color(0xFFCC9B14), width: 2) + : index > 2 + ? null + : Border.all( + color: Color(0xFFCCCCCC), width: 0.75), + shape: BoxShape.circle, + color: index == 1 + ? Color(0xFFCC9B14) + : index > 1 + ? Color(0xFF359846) + : Color(0xFFCCCCCC), + ), + child: Center( + child: Icon( + FontAwesomeIcons.check, + size: 20, + color: Colors.white, + )), + ), + SizedBox(height: 5), + Column( + children: [ + StepDetailsWidget( + stepLabel: "هدف", + ), + StatusLabel( + selectedStepId: index, + stepId: 1, + ), + ], + ), + ], + ), + ), + ), + if (patientInfo.admissionNo == null || + patientInfo.admissionNo.isEmpty) + Positioned( + top: circleTop, + right: MediaQuery.of(context).size.width * 0.50, + child: InkWell( + onTap: () => index >= 3 ? changeCurrentTab(2) : null, + child: Column( + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + Container( + width: circleHeight, + height: circleHeight, + decoration: BoxDecoration( + border: index == 2 + ? Border.all(color: Color(0xFFCC9B14), width: 2) + : index > 2 + ? null + : Border.all( + color: Color(0xFFCCCCCC), width: 0.75), + shape: BoxShape.circle, + color: index == 2 + ? Color(0xFFCC9B14) + : index > 2 + ? Color(0xFFCC9B14) + : Color(0xFFCCCCCC), + ), + child: Center( + child: Icon( + FontAwesomeIcons.check, + size: 20, + color: Colors.white, + )), + ), + SizedBox( + height: 5, + ), + Padding( + padding: const EdgeInsets.only(right: 2), + child: Column( + children: [ + StepDetailsWidget( + stepLabel: "تقدير", + ), + StatusLabel( + selectedStepId: index, + stepId: 2, + ), + ], + ), + ), + ], + ), + ), + ), + if (patientInfo.admissionNo == null || + patientInfo.admissionNo.isEmpty) + Positioned( + top: circleTop, + left: 0, + child: InkWell( + onTap: () => index >= 3 ? changeCurrentTab(4) : null, + child: Column( + crossAxisAlignment: CrossAxisAlignment.end, + children: [ + Container( + width: circleHeight, + height: circleHeight, + decoration: BoxDecoration( + border: index == 3 + ? Border.all(color: Color(0xFFCC9B14), width: 2) + : index > 3 + ? null + : Border.all( + color: Color(0xFFCCCCCC), width: 0.75), + shape: BoxShape.circle, + color: index == 3 + ? Color(0xFFCC9B14) + : index > 3 + ? Color(0xFFCC9B14) + : Color(0xFFCCCCCC), + ), + child: Center( + child: Icon( + FontAwesomeIcons.check, + size: 20, + color: Colors.white, + )), + ), + SizedBox( + height: 5, + ), + Container( + margin: EdgeInsets.only(right: index == 3 ? 15 : 0), + child: Column( + children: [ + StepDetailsWidget( + stepLabel: "خطة", + ), + StatusLabel( + selectedStepId: index, + stepId: 3, + ), + ], + ), + ), + ], + ), + ), + ), + ], + ); + } +} diff --git a/lib/screens/patients/profile/soap_update/shared_soap_widgets/steps_widget.dart b/lib/screens/patients/profile/soap_update/shared_soap_widgets/steps_widget.dart deleted file mode 100644 index e79c24a7..00000000 --- a/lib/screens/patients/profile/soap_update/shared_soap_widgets/steps_widget.dart +++ /dev/null @@ -1,554 +0,0 @@ -import 'package:doctor_app_flutter/core/viewModel/project_view_model.dart'; -import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart'; -import 'package:flutter/cupertino.dart'; -import 'package:flutter/material.dart'; -import 'package:font_awesome_flutter/font_awesome_flutter.dart'; -import 'package:hexcolor/hexcolor.dart'; -import 'package:provider/provider.dart'; - -class StepsWidget extends StatelessWidget { - final int index; - final Function changeCurrentTab; - final double height; - - StepsWidget({Key key, this.index, this.changeCurrentTab, this.height = 0.0}); - - @override - Widget build(BuildContext context) { - ProjectViewModel projectViewModel = Provider.of(context); - return !projectViewModel.isArabic - ? Stack( - children: [ - Container( - height: height == 0 ? 100 : height, - width: MediaQuery.of(context).size.width * 0.9, - color: Colors.transparent, - ), - Positioned( - top: 30 - , - child: Center( - child: Container( - width: MediaQuery - .of(context) - .size - .width * 0.9, - child: Divider( - color: Colors.grey, - height: 0.75, - thickness: 0.75, - ), - ), - ),), - Positioned( - top: 10, - left: 0, - child: InkWell( - onTap: () => changeCurrentTab(0), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Container( - width: 38, - height: 38, - decoration: BoxDecoration( - border: index == 0 - ? Border.all(color: Color(0xFFCC9B14), width: 2) - : index > 0 - ? null - : Border.all( - color: Colors.black, width: 0.75), - shape: BoxShape.circle, - color: index == 0 - ? Color(0xFFCC9B14) - : index > 0 - ? Color(0xFF359846) - : Color(0xFFCCCCCC), - ), - child: Center( - child: Icon( - FontAwesomeIcons.check, - size: 20, - color: Colors.white, - )), - ), - SizedBox(height: 5), - Column( - mainAxisAlignment: MainAxisAlignment.start, - children: [ - AppText( - "Subjective", - fontWeight: FontWeight.bold, - fontSize: 12, - ), - StatusLabel( - selectedStepId: index, - stepId: 0, - ), - ], - ), - ], - ), - ), - ), - Positioned( - top: 10, - left: MediaQuery - .of(context) - .size - .width * 0.25, - child: InkWell( - onTap: () => index >= 1 ? changeCurrentTab(1) : null, - child: Column( - crossAxisAlignment: CrossAxisAlignment.center, - children: [ - Container( - width: 38, - height: 38, - decoration: BoxDecoration( - border: index == 1 - ? Border.all(color: Color(0xFFCC9B14), width: 2) - : index > 2 - ? null - : Border.all( - color: Color(0xFFCCCCCC), width: 0.75), - shape: BoxShape.circle, - color: index == 1 - ? Color(0xFFCC9B14) - : index > 1 - ? Color(0xFF359846) - : Color(0xFFCCCCCC), - ), - child: Center( - child: Icon( - FontAwesomeIcons.check, - size: 20, - color: Colors.white, - )), - ), - SizedBox( - height: 5, - ), - Column( - mainAxisAlignment: MainAxisAlignment.start, - children: [ - AppText( - "Objective", - fontWeight: FontWeight.bold, - fontSize: 12, - ), - StatusLabel( - selectedStepId: index, - stepId: 1, - ), - ], - ), - ], - ), - ), - ), - Positioned( - top: 10, - left: MediaQuery - .of(context) - .size - .width * 0.50, - child: InkWell( - onTap: () { - if (index >= 3) changeCurrentTab(2); - }, - child: Column( - crossAxisAlignment: CrossAxisAlignment.center, - children: [ - Container( - width: 38, - height: 38, - decoration: BoxDecoration( - border: index == 2 - ? Border.all(color: Color(0xFFCC9B14), width: 2) - : index > 2 - ? null - : Border.all( - color: Color(0xFFCCCCCC), width: 0.75), - shape: BoxShape.circle, - color: index == 2 - ? Color(0xFFCC9B14) - : index > 2 - ? Color(0xFF359846) - : Color(0xFFCCCCCC), - ), - child: Center( - child: Icon( - FontAwesomeIcons.check, - size: 20, - color: Colors.white, - )), - ), - SizedBox( - height: 5, - ), - Column( - mainAxisAlignment: MainAxisAlignment.start, - children: [ - AppText( - "Assessment", - fontWeight: FontWeight.bold, - fontSize: 12, - ), - StatusLabel( - selectedStepId: index, - stepId: 2, - ), - ], - ), - ], - ), - ), - ), - Positioned( - top: 10, - right: 0, - child: InkWell( - onTap: () => index >= 3 ? changeCurrentTab(4) : null, - child: Column( - crossAxisAlignment: CrossAxisAlignment.end, - children: [ - Container( - width: 38, - height: 38, - decoration: BoxDecoration( - border: index == 3 - ? Border.all(color: Color(0xFFCC9B14), width: 2) - : index > 3 - ? null - : Border.all( - color: Color(0xFFCCCCCC), width: 0.75), - shape: BoxShape.circle, - color: index == 3 - ? Color(0xFFCC9B14) - : index > 3 - ? Color(0xFF359846) - : Color(0xFFCCCCCC), - ), - child: Center( - child: Icon( - FontAwesomeIcons.check, - size: 20, - color: Colors.white, - )), - ), - SizedBox( - height: 5, - ), - Column( - crossAxisAlignment: CrossAxisAlignment.center, - children: [ - AppText( - "Plan", - fontWeight: FontWeight.bold, - fontSize: 12, - textAlign: TextAlign.end, - marginLeft: 25, - ), - StatusLabel( - selectedStepId: index, - stepId: 3, - ), - ], - ), - ], - ), - ), - ), - ], - ) - : Stack( - children: [ - Container( - height: height == 0 ? 100 : height, - width: MediaQuery.of(context).size.width * 0.9, - color: Colors.transparent, - ), - Positioned( - top: 30 - , - child: Center( - child: Container( - width: MediaQuery - .of(context) - .size - .width * 0.9, - child: Divider( - color: Colors.grey, - height: 0.75, - thickness: 0.75, - ), - ), - ),), - Positioned( - top: 10, - right: 0, - child: InkWell( - onTap: () => changeCurrentTab(0), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Container( - width: 38, - height: 38, - decoration: BoxDecoration( - border: index == 0 - ? Border.all(color: Color(0xFFCC9B14), width: 2) - : index > 0 - ? null - : Border.all( - color: Colors.black, width: 0.75), - shape: BoxShape.circle, - color: index == 0 - ? Color(0xFFCC9B14) - : index > 0 - ? Color(0xFF359846) - : Color(0xFFCCCCCC), - ), - child: Center( - child: Icon( - FontAwesomeIcons.check, - size: 20, - color: Colors.white, - )), - ), - SizedBox(height: 3), - Column( - children: [ - AppText( - "شخصي", - fontWeight: FontWeight.bold, - fontSize: 16, - ), - StatusLabel( - selectedStepId: index, - stepId: 0, - ), - ], - ), - ], - ), - ), - ), - Positioned( - top: 10, - right: MediaQuery - .of(context) - .size - .width * 0.28, - child: InkWell( - onTap: () => index >= 2 ? changeCurrentTab(1) : null, - child: Column( - crossAxisAlignment: CrossAxisAlignment.center, - children: [ - Container( - width: 38, - height: 38, - decoration: BoxDecoration( - border: index == 1 - ? Border.all(color: Color(0xFFCC9B14), width: 2) - : index > 2 - ? null - : Border.all( - color: Color(0xFFCCCCCC), width: 0.75), - shape: BoxShape.circle, - color: index == 1 - ? Color(0xFFCC9B14) - : index > 1 - ? Color(0xFF359846) - : Color(0xFFCCCCCC), - ), - child: Center( - child: Icon( - FontAwesomeIcons.check, - size: 20, - color: Colors.white, - )), - ), - SizedBox(height: 5), - Column( - children: [ - AppText( - "هدف", - fontWeight: FontWeight.bold, - fontSize: 14, - ), - StatusLabel( - selectedStepId: index, - stepId: 1, - ), - ], - ), - ], - ), - ), - ), - Positioned( - top: 10, - right: MediaQuery - .of(context) - .size - .width * 0.52, - child: InkWell( - onTap: () => index >= 3 ? changeCurrentTab(2) : null, - child: Column( - crossAxisAlignment: CrossAxisAlignment.center, - children: [ - Container( - width: 38, - height: 38, - decoration: BoxDecoration( - border: index == 2 - ? Border.all(color: Color(0xFFCC9B14), width: 2) - : index > 2 - ? null - : Border.all( - color: Color(0xFFCCCCCC), width: 0.75), - shape: BoxShape.circle, - color: index == 2 - ? Color(0xFFCC9B14) - : index > 2 - ? Color(0xFFCC9B14) - : Color(0xFFCCCCCC), - ), - child: Center( - child: Icon( - FontAwesomeIcons.check, - size: 20, - color: Colors.white, - )), - ), - SizedBox( - height: 5, - ), - Padding( - padding: const EdgeInsets.only(right: 2), - child: Column( - children: [ - AppText( - "تقدير", - fontWeight: FontWeight.bold, - fontSize: 14, - ), - StatusLabel( - selectedStepId: index, - stepId: 2, - ), - ], - ), - ), - ], - ), - ), - ), - Positioned( - top: 10, - left: 0, - child: InkWell( - onTap: () => index >= 3 ? changeCurrentTab(4) : null, - child: Column( - crossAxisAlignment: CrossAxisAlignment.end, - children: [ - Container( - width: 38, - height: 38, - decoration: BoxDecoration( - border: index == 3 - ? Border.all(color: Color(0xFFCC9B14), width: 2) - : index > 3 - ? null - : Border.all( - color: Color(0xFFCCCCCC), width: 0.75), - shape: BoxShape.circle, - color: index == 3 - ? Color(0xFFCC9B14) - : index > 3 - ? Color(0xFFCC9B14) - : Color(0xFFCCCCCC), - ), - child: Center( - child: Icon( - FontAwesomeIcons.check, - size: 20, - color: Colors.white, - )), - ), - SizedBox( - height: 5, - ), - Container( - margin: EdgeInsets.only(right: index == 3 ? 15 : 0), - child: Column( - children: [ - AppText( - "خطة", - fontWeight: FontWeight.bold, - fontSize: 14, - ), - StatusLabel( - selectedStepId: index, - stepId: 3, - ), - ], - ), - ), - ], - ), - ), - ), - ], - ); - } -} - -class StatusLabel extends StatelessWidget { - const StatusLabel({ - Key key, - this.stepId, - this.selectedStepId, - }) : super(key: key); - - final int stepId; - final int selectedStepId; - - @override - Widget build(BuildContext context) { - return Container( - width: 65, - padding: EdgeInsets.symmetric(horizontal: 2, vertical: 3), - decoration: BoxDecoration( - color: stepId == selectedStepId - ? Color(0xFFF1E9D3) - : stepId < selectedStepId - ? Color(0xFFD8E8DB) - : Color(0xFFCCCCCC), - borderRadius: BorderRadius.all( - Radius.circular(5.0), - ), - border: Border.all(color: HexColor('#707070'), width: 0.30), - ), - child: Center( - child: AppText( - stepId == selectedStepId - ? "inProgress" - : stepId < selectedStepId - ? "Completed" - : "Locked", - fontWeight: FontWeight.bold, - textAlign: TextAlign.center, - fontSize: 10, - color: stepId == selectedStepId - ? Color(0xFFCC9B14) - : stepId < selectedStepId - ? Color(0xFF359846) - : Color(0xFF969696), - ), - ), - ); - } -} diff --git a/lib/screens/patients/profile/soap_update/soap_utils.dart b/lib/screens/patients/profile/soap_update/soap_utils.dart new file mode 100644 index 00000000..6c5d4f02 --- /dev/null +++ b/lib/screens/patients/profile/soap_update/soap_utils.dart @@ -0,0 +1,88 @@ +import 'package:doctor_app_flutter/models/SOAP/selected_items/my_selected_allergy.dart'; +import 'package:doctor_app_flutter/models/SOAP/selected_items/my_selected_assement.dart'; +import 'package:doctor_app_flutter/models/SOAP/selected_items/my_selected_examination.dart'; +import 'package:doctor_app_flutter/models/SOAP/selected_items/my_selected_history.dart'; + +class SoapUtils { + static MySelectedHistory generateMySelectedHistory( + {history, isChecked = false, remark, isLocal = true}) { + MySelectedHistory mySelectedHistory = MySelectedHistory( + selectedHistory: history, + isChecked: isChecked, + remark: remark, + isLocal: isLocal); + return mySelectedHistory; + } + + static MySelectedAllergy generateMySelectedAllergy( + {allergy, + allergySeverity, + isChecked = false, + remark, + isLocal = true, + int createdBy, + bool isExpanded = false}) { + MySelectedAllergy mySelectedAllergy = MySelectedAllergy( + selectedAllergy: allergy, + selectedAllergySeverity: allergySeverity, + isChecked: isChecked, + remark: remark, + isLocal: isLocal, + createdBy: createdBy, + isExpanded: isExpanded); + return mySelectedAllergy; + } + + static MySelectedExamination generateMySelectedExamination( + {examination, + allergySeverity, + isChecked = false, + remark, + isLocal = true, + isNormal, + createdBy, + createdOn, + editedOn, + notExamined, + isNew, + isAbnormal}) { + MySelectedExamination mySelectedExamination = MySelectedExamination( + selectedExamination: examination, + remark: remark, + isNormal: isNormal, + createdBy: createdBy, + createdOn: createdOn, + editedOn: editedOn, + notExamined: notExamined, + isNew: isNew, + isLocal: isLocal, + isAbnormal: isAbnormal, + ); + return mySelectedExamination; + } + + static MySelectedAssessment generateMySelectedAssessment( + {appointmentNo, + remark, + diagnosisType, + diagnosisCondition, + selectedICD, + doctorID, + doctorName, + createdBy, + createdOn, + icdCode10ID}) { + MySelectedAssessment mySelectedAssessment = MySelectedAssessment( + appointmentId: appointmentNo, + remark: remark, + selectedDiagnosisType: diagnosisType, + selectedDiagnosisCondition: diagnosisCondition, + selectedICD: selectedICD, + doctorID: doctorID, + doctorName: doctorName, + createdBy: createdBy, + createdOn: createdOn, + icdCode10ID: icdCode10ID); + return mySelectedAssessment; + } +} diff --git a/lib/screens/patients/profile/soap_update/subjective/allergies/add_allergies.dart b/lib/screens/patients/profile/soap_update/subjective/allergies/add_allergies.dart index 4cf20318..8c68a61e 100644 --- a/lib/screens/patients/profile/soap_update/subjective/allergies/add_allergies.dart +++ b/lib/screens/patients/profile/soap_update/subjective/allergies/add_allergies.dart @@ -3,8 +3,9 @@ import 'package:doctor_app_flutter/core/enum/master_lookup_key.dart'; import 'package:doctor_app_flutter/core/enum/viewstate.dart'; import 'package:doctor_app_flutter/core/viewModel/SOAP_view_model.dart'; import 'package:doctor_app_flutter/models/SOAP/master_key_model.dart'; -import 'package:doctor_app_flutter/models/SOAP/my_selected_allergy.dart'; +import 'package:doctor_app_flutter/models/SOAP/selected_items/my_selected_allergy.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_dialog_button.dart'; import 'package:doctor_app_flutter/util/helpers.dart'; import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; import 'package:doctor_app_flutter/widgets/shared/app_scaffold_widget.dart'; @@ -44,32 +45,6 @@ class _AddAllergiesState extends State { GlobalKey key = new GlobalKey>(); bool isFormSubmitted = false; - InputDecoration textFieldSelectorDecoration( - String hintText, String selectedText, bool isDropDown, - {IconData icon}) { - return InputDecoration( - contentPadding: EdgeInsets.symmetric(vertical: 10, horizontal: 10), - focusedBorder: OutlineInputBorder( - borderSide: BorderSide(color: Colors.grey, width: 1.0), - borderRadius: BorderRadius.circular(8), - ), - enabledBorder: OutlineInputBorder( - borderSide: BorderSide(color: Colors.grey, width: 1.0), - borderRadius: BorderRadius.circular(8), - ), - disabledBorder: OutlineInputBorder( - borderSide: BorderSide(color: Colors.grey, width: 1.0), - borderRadius: BorderRadius.circular(8), - ), - hintText: selectedText != null ? selectedText : hintText, - suffixIcon: isDropDown ? Icon(icon ?? Icons.arrow_drop_down) : null, - hintStyle: TextStyle( - fontSize: 10, - color: Theme.of(context).hintColor, - fontWeight: FontWeight.w700), - ); - } - @override Widget build(BuildContext context) { return FractionallySizedBox( @@ -120,7 +95,6 @@ class _AddAllergiesState extends State { addAllergyLocally(mySelectedAllergy); }, addSelectedAllergy: () { - setState(() { widget .addAllergiesFun(myAllergiesListLocal); @@ -142,47 +116,17 @@ class _AddAllergiesState extends State { ]), ), ), - bottomSheet: model.state == ViewState.Busy + bottomSheet: model.state != ViewState.Idle ? Container( height: 0, ) - : Container( - decoration: BoxDecoration( - color: Colors.white, - borderRadius: BorderRadius.all( - Radius.circular(0.0), - ), - border: Border.all(color: HexColor('#707070'), width: 0), - ), - height: MediaQuery.of(context).size.height * 0.1, - width: double.infinity, - child: Column( - children: [ - SizedBox( - height: 10, - ), - Container( - child: FractionallySizedBox( - widthFactor: .80, - child: Center( - child: AppButton( - title: TranslationBase.of(context).addAllergies, - padding: 10, - color: Color(0xFF359846), - onPressed: () { - setState(() { - widget.addAllergiesFun(myAllergiesListLocal); - }); - }, - ), - ), - ), - ), - SizedBox( - height: 5, - ), - ], - ), + : BottomSheetDialogButton( + label: TranslationBase.of(context).addAllergies, + onTap: () { + setState(() { + widget.addAllergiesFun(myAllergiesListLocal); + }); + }, ), ), ), @@ -244,3 +188,4 @@ class _AddAllergiesState extends State { } } } + diff --git a/lib/screens/patients/profile/soap_update/subjective/allergies/allergies_item.dart b/lib/screens/patients/profile/soap_update/subjective/allergies/allergies_item.dart index 55e36342..130e730d 100644 --- a/lib/screens/patients/profile/soap_update/subjective/allergies/allergies_item.dart +++ b/lib/screens/patients/profile/soap_update/subjective/allergies/allergies_item.dart @@ -1,7 +1,9 @@ +import 'package:doctor_app_flutter/config/size_config.dart'; import 'package:doctor_app_flutter/core/viewModel/SOAP_view_model.dart'; import 'package:doctor_app_flutter/core/viewModel/project_view_model.dart'; import 'package:doctor_app_flutter/models/SOAP/master_key_model.dart'; -import 'package:doctor_app_flutter/models/SOAP/my_selected_allergy.dart'; +import 'package:doctor_app_flutter/models/SOAP/selected_items/my_selected_allergy.dart'; +import 'package:doctor_app_flutter/util/helpers.dart'; import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart'; import 'package:doctor_app_flutter/widgets/shared/dialogs/master_key_dailog.dart'; @@ -12,6 +14,8 @@ import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:provider/provider.dart'; +import '../../soap_utils.dart'; + class AddAllergiesItem extends StatefulWidget { final SOAPViewModel model; final Function(MasterKeyModel) removeAllergy; @@ -71,41 +75,40 @@ class _AddAllergiesItemState extends State { onTapItem(); }), InkWell( - onTap:onTapItem, - child: Padding( - padding: - const EdgeInsets.symmetric(horizontal: 10, vertical: 0), - child: Container( - child: AppText( - projectViewModel.isArabic - ? widget.item.nameAr != "" - ? widget.item.nameAr - : widget.item.nameEn - : widget.item.nameEn, - color: Color(0xFF575757), - fontSize: 16, - fontWeight: FontWeight.w600, - ), - width: MediaQuery.of(context).size.width * 0.55, + onTap: onTapItem, + child: Container( + child: AppText( + projectViewModel.isArabic + ? widget.item.nameAr != "" + ? widget.item.nameAr + : widget.item.nameEn + : widget.item.nameEn, + color: Color(0xFF575757), + fontSize: SizeConfig.getTextMultiplierBasedOnWidth() * (SizeConfig.isWidthLarge?3:3.8), + letterSpacing: -0.56, ), + width: MediaQuery.of(context).size.width * 0.55, ), ), ], ), InkWell( - onTap: () { - if (mySelectedAllergy != null) { - setState(() { - mySelectedAllergy.isExpanded = - mySelectedAllergy.isExpanded ? false : true; - }); - } - }, - child: Icon((mySelectedAllergy != null - ? mySelectedAllergy.isExpanded - : false) + onTap: () { + if (mySelectedAllergy != null) { + setState(() { + mySelectedAllergy.isExpanded = + mySelectedAllergy.isExpanded ? false : true; + }); + } + }, + child: Icon( + (mySelectedAllergy != null ? mySelectedAllergy.isExpanded : false) ? EvaIcons.arrowIosUpwardOutline - : EvaIcons.arrowIosDownwardOutline)) + : EvaIcons.arrowIosDownwardOutline, + color: Color(0xFF575757), + size: 20, + ), + ) ], ), bodyWidget: Center( @@ -139,14 +142,15 @@ class _AddAllergiesItemState extends State { } : null, isTextFieldHasSuffix: true, - hintText: TranslationBase.of(context).selectSeverity, + hintText: TranslationBase.of(context).selectSeverity + "*", enabled: false, - maxLines: 2, - minLines: 2, + maxLines: 1, + minLines: 1, + height: Helpers.getTextFieldHeight(), validationError: mySelectedAllergy != null && mySelectedAllergy.selectedAllergySeverity == null && mySelectedAllergy.hasValidationError - ? TranslationBase.of(context).emptyMessage + ? TranslationBase.of(context).severityValidationError : null, controller: severityController, ), @@ -159,11 +163,10 @@ class _AddAllergiesItemState extends State { maxLines: 25, minLines: 3, hasBorder: true, - onChanged: (value){ + onChanged: (value) { mySelectedAllergy.remark = value; }, inputType: TextInputType.multiline, - ), SizedBox( height: 10, @@ -178,18 +181,18 @@ class _AddAllergiesItemState extends State { ); } - onTapItem(){ + onTapItem() { setState(() { if (widget.isServiceSelected(widget.item)) { widget.removeAllergy(widget.item); } else { MySelectedAllergy mySelectedAllergy = - new MySelectedAllergy( - selectedAllergy: widget.item, - selectedAllergySeverity: _selectedAllergySeverity, - remark: null, - isChecked: true, - isExpanded: true); + SoapUtils.generateMySelectedAllergy( + allergy: widget.item, + allergySeverity: _selectedAllergySeverity, + remark: null, + isChecked: true, + isExpanded: true); widget.addAllergy(mySelectedAllergy); } }); diff --git a/lib/screens/patients/profile/soap_update/subjective/allergies/master_key_checkbox_search_allergies_widget.dart b/lib/screens/patients/profile/soap_update/subjective/allergies/master_key_checkbox_search_allergies_widget.dart index 8644c9a9..8819f04a 100644 --- a/lib/screens/patients/profile/soap_update/subjective/allergies/master_key_checkbox_search_allergies_widget.dart +++ b/lib/screens/patients/profile/soap_update/subjective/allergies/master_key_checkbox_search_allergies_widget.dart @@ -1,6 +1,7 @@ import 'package:doctor_app_flutter/core/viewModel/SOAP_view_model.dart'; import 'package:doctor_app_flutter/models/SOAP/master_key_model.dart'; -import 'package:doctor_app_flutter/models/SOAP/my_selected_allergy.dart'; +import 'package:doctor_app_flutter/models/SOAP/selected_items/my_selected_allergy.dart'; +import 'package:doctor_app_flutter/util/helpers.dart'; import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; import 'package:doctor_app_flutter/widgets/shared/divider_with_spaces_around.dart'; import 'package:doctor_app_flutter/widgets/shared/text_fields/app-textfield-custom.dart'; @@ -43,7 +44,7 @@ class MasterKeyCheckboxSearchAllergiesWidget extends StatefulWidget { class _MasterKeyCheckboxSearchAllergiesWidgetState extends State { List items = List(); - + TextEditingController filteredSearchController = TextEditingController(); @override void initState() { @@ -58,7 +59,7 @@ class _MasterKeyCheckboxSearchAllergiesWidgetState children: [ Expanded( child: Container( - height: MediaQuery.of(context).size.height * 0.70, + height: Helpers.getTextFieldHeight(), child: Center( child: Container( decoration: BoxDecoration( @@ -67,13 +68,11 @@ class _MasterKeyCheckboxSearchAllergiesWidgetState child: Column( children: [ AppTextFieldCustom( - // height: - // MediaQuery.of(context).size.height * 0.070, hintText: TranslationBase.of(context).selectAllergy, isTextFieldHasSuffix: true, hasBorder: false, - // controller: filteredSearchController, + controller: filteredSearchController, onChanged: (value) { filterSearchResults(value); }, 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 4be953a7..c8a519c3 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 @@ -1,12 +1,13 @@ +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/my_selected_allergy.dart'; +import 'package:doctor_app_flutter/models/SOAP/selected_items/my_selected_allergy.dart'; +import 'package:doctor_app_flutter/screens/patients/profile/soap_update/shared_soap_widgets/remark_text.dart'; +import 'package:doctor_app_flutter/screens/patients/profile/soap_update/shared_soap_widgets/remove_button.dart'; import 'package:doctor_app_flutter/util/helpers.dart'; import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart'; import 'package:doctor_app_flutter/widgets/shared/divider_with_spaces_around.dart'; import 'package:flutter/material.dart'; -import 'package:font_awesome_flutter/font_awesome_flutter.dart'; -import 'package:hexcolor/hexcolor.dart'; import 'package:provider/provider.dart'; import '../../shared_soap_widgets/SOAP_open_items.dart'; @@ -14,7 +15,7 @@ import 'add_allergies.dart'; // ignore: must_be_immutable class UpdateAllergiesWidget extends StatefulWidget { - List myAllergiesList; + List myAllergiesList; UpdateAllergiesWidget({Key key, this.myAllergiesList}); @@ -27,28 +28,28 @@ class _UpdateAllergiesWidgetState extends State { Widget build(BuildContext context) { ProjectViewModel projectViewModel = Provider.of(context); changeAllState() { - setState(() { - - }); + setState(() {}); } return Column( children: [ - SOAPOpenItems(label: "${TranslationBase.of(context).addAllergies}",onTap: () { - openAllergiesList(context, changeAllState, removeAllergy); - },), + SOAPOpenItems( + label: "${TranslationBase.of(context).addAllergies}", + onTap: () { + openAllergiesList(context, changeAllState, removeAllergy); + }, + ), SizedBox( height: 20, ), Container( - margin: - EdgeInsets.only(left: 15, right: 15, top: 15), + 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: [ + return Column( + crossAxisAlignment: CrossAxisAlignment.start, + mainAxisAlignment: MainAxisAlignment.start, + children: [ Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ @@ -61,53 +62,41 @@ class _UpdateAllergiesWidgetState extends State { 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)), + 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.selectedAllergySeverity - .nameEn - .toUpperCase(), - textDecoration: selectedAllergy.isChecked - ? null - : TextDecoration.lineThrough, - color: Color(0xFFCC9B14)), + projectViewModel.isArabic + ? selectedAllergy + .selectedAllergySeverity.nameAr + : selectedAllergy + .selectedAllergySeverity.nameEn + .toUpperCase(), + 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, + width: MediaQuery.of(context).size.width * 0.5, ), - if (selectedAllergy.isChecked) - InkWell( - child: Row( - children: [Container( - child: AppText( - TranslationBase - .of(context) - .remove, - fontSize: 15, - variant: "bodyText", - color: HexColor("#B8382C"),), - ), - Icon( - FontAwesomeIcons.times, - color: HexColor("#B8382C"), - size: 20, - ), - ], - ), + RemoveButton( onTap: () => removeAllergy(selectedAllergy), ) ], @@ -116,14 +105,7 @@ class _UpdateAllergiesWidgetState extends State { padding: const EdgeInsets.symmetric(vertical: 8), child: Row( children: [ - Container( - width: MediaQuery.of(context).size.width * 0.55, - child: AppText( - selectedAllergy.remark ?? '', - fontSize: 10, - color: Colors.grey, - ), - ), + RemarkText(remark: selectedAllergy.remark,), ], ), ), @@ -143,15 +125,17 @@ 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) { + if (allergy.first.isLocal) { setState(() { widget.myAllergiesList.remove(allergy.first); }); @@ -162,7 +146,8 @@ class _UpdateAllergiesWidgetState extends State { } } - openAllergiesList(BuildContext context, Function changeParentState, removeAllergy) { + openAllergiesList( + BuildContext context, Function changeParentState, removeAllergy) { showModalBottomSheet( backgroundColor: Colors.white, isScrollControlled: true, @@ -170,7 +155,7 @@ class _UpdateAllergiesWidgetState extends State { context: context, builder: (context) { return AddAllergies( - myAllergiesList: widget.myAllergiesList, + myAllergiesList: widget.myAllergiesList, addAllergiesFun: (List mySelectedAllergy) { bool isAllDataFilled = true; mySelectedAllergy.forEach((element) { @@ -181,19 +166,28 @@ class _UpdateAllergiesWidgetState extends State { }); if (isAllDataFilled) { mySelectedAllergy.forEach((element) { - if ((widget.myAllergiesList.singleWhere((it) => it.selectedAllergy.id == element.selectedAllergy.id, - orElse: () => null)) == null) { + if ((widget.myAllergiesList.singleWhere( + (it) => + it.selectedAllergy.id == + element.selectedAllergy.id, + orElse: () => null)) == + null) { widget.myAllergiesList.add(element); } }); /// remove items. - List removedList= []; + List removedList = []; widget.myAllergiesList.forEach((element) { - if ((mySelectedAllergy.singleWhere((it) => it.selectedAllergy.id == element.selectedAllergy.id, - orElse: () => null)) == null) { + if ((mySelectedAllergy.singleWhere( + (it) => + it.selectedAllergy.id == + element.selectedAllergy.id, + orElse: () => null)) == + null) { removedList.add(element); - }}); + } + }); removedList.forEach((element) { removeAllergy(element); @@ -201,18 +195,12 @@ 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/history/add_history_dialog.dart b/lib/screens/patients/profile/soap_update/subjective/history/add_history_dialog.dart index bd2f8502..f663d92e 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 @@ -2,8 +2,10 @@ import 'package:doctor_app_flutter/core/enum/master_lookup_key.dart'; import 'package:doctor_app_flutter/core/enum/viewstate.dart'; import 'package:doctor_app_flutter/core/viewModel/SOAP_view_model.dart'; import 'package:doctor_app_flutter/models/SOAP/master_key_model.dart'; -import 'package:doctor_app_flutter/models/SOAP/my_selected_history.dart'; +import 'package:doctor_app_flutter/models/SOAP/selected_items/my_selected_history.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_dialog_button.dart'; +import 'package:doctor_app_flutter/screens/patients/profile/soap_update/soap_utils.dart'; import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; import 'package:doctor_app_flutter/widgets/shared/app_scaffold_widget.dart'; import 'package:doctor_app_flutter/widgets/shared/buttons/app_buttons_widget.dart'; @@ -58,8 +60,8 @@ class _AddHistoryDialogState extends State { builder: (_, model, w) => AppScaffold( baseViewModel: model, isShowAppBar: true, - appBar: BottomSheetTitle( - title: TranslationBase.of(context).addHistory), + appBar: + BottomSheetTitle(title: TranslationBase.of(context).addHistory), body: Center( child: Container( child: Column( @@ -161,46 +163,15 @@ class _AddHistoryDialogState extends State { ], )), ), - bottomSheet: model.state == ViewState.Busy + bottomSheet: model.state != ViewState.Idle ? Container( height: 0, ) - : Container( - decoration: BoxDecoration( - color: Colors.white, - borderRadius: BorderRadius.all( - Radius.circular(0.0), - ), - border: Border.all(color: HexColor('#707070'), width: 0), - ), - height: MediaQuery.of(context).size.height * 0.1, - width: double.infinity, - child: Column( - children: [ - SizedBox( - height: 10, - ), - Container( - child: FractionallySizedBox( - widthFactor: .80, - child: Center( - child: AppButton( - title: TranslationBase.of(context) - .addSelectedHistories, - padding: 10, - color: Color(0xFF359846), - onPressed: () { - widget.addSelectedHistories(); - }, - ), - ), - ), - ), - SizedBox( - height: 5, - ), - ], - ), + : BottomSheetDialogButton( + label: TranslationBase.of(context).addSelectedHistories, + onTap: () { + widget.addSelectedHistories(); + }, ), ), )); @@ -215,10 +186,12 @@ class _AddHistoryDialogState extends State { if (myhistory.isEmpty) { setState(() { - MySelectedHistory mySelectedHistory = MySelectedHistory( - remark: history.remarks ?? "", - selectedHistory: history, - isChecked: true); + MySelectedHistory mySelectedHistory = + SoapUtils.generateMySelectedHistory( + remark: history.remarks ?? "", + history: history, + isChecked: true); + widget.myHistoryList.add(mySelectedHistory); }); } else { 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 ac6ec2c5..305b0c65 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 @@ -1,4 +1,5 @@ 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:flutter/material.dart'; import 'package:hexcolor/hexcolor.dart'; @@ -67,8 +68,7 @@ class _PriorityBarState extends State { : item, textAlign: TextAlign.center, style: TextStyle( - fontSize: 14, - + fontSize: SizeConfig.getTextMultiplierBasedOnWidth()*3.5, color: Colors.black, fontWeight: FontWeight.bold, ), 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 3b431a69..33e7fcd1 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 @@ -1,6 +1,8 @@ +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/master_key_model.dart'; -import 'package:doctor_app_flutter/models/SOAP/my_selected_history.dart'; +import 'package:doctor_app_flutter/models/SOAP/selected_items/my_selected_history.dart'; +import 'package:doctor_app_flutter/screens/patients/profile/soap_update/shared_soap_widgets/remove_button.dart'; import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart'; import 'package:flutter/material.dart'; @@ -40,17 +42,17 @@ class _UpdateHistoryWidgetState extends State ProjectViewModel projectViewModel = Provider.of(context); return Column( children: [ - - SOAPOpenItems(label: "${TranslationBase.of(context).addHistory}",onTap: () { - openHistoryList(context); - - },), + SOAPOpenItems( + label: "${TranslationBase.of(context).addHistory}", + onTap: () { + openHistoryList(context); + }, + ), SizedBox( height: 20, ), Container( - margin: - EdgeInsets.only(left: 15, right: 15, top: 15), + margin: EdgeInsets.only(left: 15, right: 15, top: 15), child: Column( children: widget.myHistoryList.map((myHistory) { return Column( @@ -60,42 +62,21 @@ class _UpdateHistoryWidgetState extends State children: [ Container( child: AppText( - projectViewModel.isArabic - ? myHistory.selectedHistory.nameAr - : myHistory.selectedHistory.nameEn, - fontSize: 15, - textDecoration: myHistory.isChecked - ? null - : TextDecoration.lineThrough, - color: Colors.black), - width: MediaQuery - .of(context) - .size - .width * 0.5, + projectViewModel.isArabic + ? 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, + ), + width: MediaQuery.of(context).size.width * 0.5, ), if (myHistory.isChecked) - InkWell( - child: Row( - children: [ - Container( - child: AppText( - TranslationBase - .of(context) - .remove, - fontSize: 15, - variant: "bodyText", - textDecoration: myHistory.isChecked - ? null - : TextDecoration.lineThrough, - color: HexColor("#B8382C"),), - ), - Icon( - FontAwesomeIcons.times, - color: HexColor("#B8382C"), - size: 17, - ), - ], - ), + RemoveButton( onTap: () => removeHistory(myHistory.selectedHistory), ) ], @@ -114,17 +95,15 @@ 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.first.isLocal) { + if (history.first.isLocal) { setState(() { widget.myHistoryList.remove(history.first); }); @@ -133,9 +112,7 @@ class _UpdateHistoryWidgetState extends State history[0].isChecked = false; }); } - } - } openHistoryList(BuildContext context) { @@ -162,6 +139,3 @@ class _UpdateHistoryWidgetState extends State }); } } - - - 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 11e4fa72..67c1df55 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 @@ -1,5 +1,6 @@ // ignore: must_be_immutable import 'package:autocomplete_textfield/autocomplete_textfield.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'; import 'package:doctor_app_flutter/core/model/search_drug/get_medication_response_model.dart'; @@ -7,6 +8,8 @@ import 'package:doctor_app_flutter/core/viewModel/SOAP_view_model.dart'; import 'package:doctor_app_flutter/core/viewModel/project_view_model.dart'; import 'package:doctor_app_flutter/models/SOAP/master_key_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_dialog_button.dart'; +import 'package:doctor_app_flutter/util/helpers.dart'; import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; import 'package:doctor_app_flutter/widgets/shared/app_scaffold_widget.dart'; import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart'; @@ -46,397 +49,448 @@ class _AddMedicationState extends State { GetMedicationResponseModel _selectedMedication; GlobalKey key = - new GlobalKey>(); + new GlobalKey>(); bool isFormSubmitted = false; @override Widget build(BuildContext context) { ProjectViewModel projectViewModel = Provider.of(context); - final screenSize = MediaQuery.of(context).size; return FractionallySizedBox( child: BaseView( - onModelReady: (model) async { - if (model.medicationStrengthList.length == 0) { - await model.getMasterLookup( - MasterKeysService.MedicationStrength, - ); - } - if (model.medicationFrequencyList.length == 0) { - await model.getMasterLookup(MasterKeysService.MedicationFrequency); - } - if (model.medicationDoseTimeList.length == 0) { - await model.getMasterLookup(MasterKeysService.MedicationDoseTime); - } - if (model.medicationRouteList.length == 0) { - await model.getMasterLookup(MasterKeysService.MedicationRoute); - } - if (model.allMedicationList.length == 0) - await model.getMedicationList(); - }, - builder: (_, model, w) => AppScaffold( - baseViewModel: model, - isShowAppBar: true, - appBar: BottomSheetTitle( - title: TranslationBase.of(context).addMedication, - ), - body: Center( - child: Container( - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - SizedBox( - height: 10, - ), - SizedBox( - height: 16, - ), - Expanded( - child: Center( + onModelReady: (model) async { + if (model.medicationStrengthList.length == 0) { + await model.getMasterLookup( + MasterKeysService.MedicationStrength, + ); + } + if (model.medicationFrequencyList.length == 0) { + await model.getMasterLookup( + MasterKeysService.MedicationFrequency); + } + if (model.medicationDoseTimeList.length == 0) { + await model.getMasterLookup(MasterKeysService.MedicationDoseTime); + } + if (model.medicationRouteList.length == 0) { + await model.getMasterLookup(MasterKeysService.MedicationRoute); + } + if (model.allMedicationList.length == 0) + await model.getMedicationList(); + }, + builder: (_, model, w) => + AppScaffold( + baseViewModel: model, + isShowAppBar: true, + appBar: BottomSheetTitle( + title: TranslationBase + .of(context) + .addMedication, + ), + body: Center( + child: Container( + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + SizedBox( + height: 10, + ), + Expanded( child: FractionallySizedBox( - widthFactor: 0.9, + widthFactor: 0.9, + child: SingleChildScrollView( child: Column( - children: [ - SizedBox( - height: 16, - ), - SizedBox( - height: 16, - ), - Container( - // height: screenSize.height * 0.070, - child: InkWell( - onTap: model.allMedicationList != null - ? () { - setState(() { - _selectedMedication = null; - }); - } - : null, - child: _selectedMedication == null - ? CustomAutoCompleteTextField( - isShowError: isFormSubmitted && - _selectedMedication == null, - child: AutoCompleteTextField< - GetMedicationResponseModel>( - decoration: TextFieldsUtils - .textFieldSelectorDecoration( - TranslationBase.of( - context) - .searchMedicineNameHere, - null, - true, - suffixIcon: Icons.search), - itemSubmitted: (item) => setState( - () => _selectedMedication = - item), - key: key, - suggestions: - model.allMedicationList, - itemBuilder: (context, - suggestion) => - new Padding( - child: AppText(suggestion - .description + - '/' + - suggestion - .genericName), - padding: - EdgeInsets.all(8.0)), - itemSorter: (a, b) => 1, - itemFilter: (suggestion, input) => - suggestion.genericName.toLowerCase().startsWith( - input.toLowerCase()) || - suggestion.description - .toLowerCase() - .startsWith(input - .toLowerCase()) || - suggestion.keywords - .toLowerCase() - .startsWith( - input.toLowerCase()), - ), - ) - : AppTextFieldCustom( - hintText: _selectedMedication != - null - ? _selectedMedication - .description + - (' (${_selectedMedication.genericName} )') - : TranslationBase.of(context) - .searchMedicineNameHere, - minLines: 2, - maxLines: 2, - isTextFieldHasSuffix: true, - suffixIcon: IconButton( - icon: Icon( - Icons.search, - color: Colors.grey.shade600, - )), - enabled: false, - ), - ), + children: [ + SizedBox( + height: SizeConfig.heightMultiplier * ( + SizeConfig.isHeightVeryShort ?2:SizeConfig.isHeightShort? + 2:2), + ), + Container( + // height: screenSize.height * 0.070, + child: InkWell( + onTap: model.allMedicationList != null + ? () { + setState(() { + _selectedMedication = null; + }); + } + : null, + child: _selectedMedication == null + ? CustomAutoCompleteTextField( + isShowError: isFormSubmitted && + _selectedMedication == null, + child: AutoCompleteTextField< + GetMedicationResponseModel>( + decoration: TextFieldsUtils + .textFieldSelectorDecoration( + TranslationBase + .of( + context) + .searchMedicineNameHere, + null, + true, + suffixIcon: + Icons.search), + itemSubmitted: (item) => + setState(() => + _selectedMedication = + item), + key: key, + suggestions: + model.allMedicationList, + itemBuilder: (context, + suggestion) => + new Padding( + child: AppText(suggestion + .description + + '/' + + suggestion + .genericName), + padding: + EdgeInsets.all( + 8.0)), + itemSorter: (a, b) => 1, + itemFilter: (suggestion, + input) => + suggestion.genericName.toLowerCase() + .startsWith(input.toLowerCase()) || + suggestion.description + .toLowerCase() + .startsWith(input + .toLowerCase()) || + suggestion.keywords + .toLowerCase() + .startsWith(input + .toLowerCase()), ), - SizedBox( - height: 5, - ), - AppTextFieldCustom( - enabled: false, - onClick: model.medicationDoseTimeList != null - ? () { - MasterKeyDailog dialog = - MasterKeyDailog( - list: model.medicationDoseTimeList, - okText: - TranslationBase.of(context).ok, - selectedValue: _selectedMedicationDose, - okFunction: (selectedValue) { - setState(() { - _selectedMedicationDose = - selectedValue; + ) + : AppTextFieldCustom( + height: Helpers.getTextFieldHeight(), + hintText: _selectedMedication != + null + ? _selectedMedication + .description + + (' (${_selectedMedication.genericName} )') + : TranslationBase + .of( + context) + .searchMedicineNameHere, + minLines: 1, + maxLines: 1, + isTextFieldHasSuffix: true, + suffixIcon: IconButton( + icon: Icon( + Icons.search, + color: Colors.grey.shade600, + )), + enabled: false, + ), + ), + ), - doseController - .text = projectViewModel - .isArabic - ? _selectedMedicationDose - .nameAr - : _selectedMedicationDose - .nameEn; - }); - }, - ); - showDialog( - barrierDismissible: false, - context: context, - builder: (BuildContext context) { - return dialog; - }, - ); - } - : null, - hintText: - TranslationBase.of(context).doseTime, - maxLines: 2, - minLines: 2, - isTextFieldHasSuffix: true, - controller: doseController, - validationError: isFormSubmitted && - _selectedMedicationDose == null - ? TranslationBase.of(context).emptyMessage - : null, - ), - SizedBox( - height: 5, + if(_selectedMedication != null) + Column( + children: [ + SizedBox( + height: 3, + ), + Container( + width: MediaQuery + .of(context) + .size + .width * 0.7, + child: AppText( + _selectedMedication.description + + (' (${_selectedMedication.genericName} )'), + color: Color(0xFF575757), + fontSize: 10, + fontWeight: FontWeight.w700, + letterSpacing: -0.4, ), - AppTextFieldCustom( - enabled: false, - isTextFieldHasSuffix: true, - onClick: model.medicationStrengthList != null - ? () { - MasterKeyDailog dialog = - MasterKeyDailog( - list: model.medicationStrengthList, - okText: - TranslationBase.of(context).ok, - selectedValue: _selectedMedicationStrength, - okFunction: (selectedValue) { - setState(() { - _selectedMedicationStrength = - selectedValue; + ), + ], + ), + SizedBox( + height: 5, + ), + AppTextFieldCustom( + height: Helpers.getTextFieldHeight(), + enabled: false, + onClick: model.medicationDoseTimeList != + null + ? () { + MasterKeyDailog dialog = + MasterKeyDailog( + list: model + .medicationDoseTimeList, + okText: + TranslationBase + .of(context) + .ok, + selectedValue: + _selectedMedicationDose, + okFunction: (selectedValue) { + setState(() { + _selectedMedicationDose = + selectedValue; - strengthController - .text = projectViewModel - .isArabic - ? _selectedMedicationStrength - .nameAr - : _selectedMedicationStrength - .nameEn; - }); - }, - ); - showDialog( - barrierDismissible: false, - context: context, - builder: (BuildContext context) { - return dialog; - }, - ); - } - : null, - hintText: - TranslationBase.of(context).strength, - maxLines: 2, - minLines: 2, - controller: strengthController, - validationError: isFormSubmitted && - _selectedMedicationStrength == null - ? TranslationBase.of(context).emptyMessage - : null, - ), - SizedBox( - height: 5, - ), - SizedBox( - height: 5, - ), - AppTextFieldCustom( - enabled: false, - isTextFieldHasSuffix: true, - onClick: model.medicationRouteList != null - ? () { - MasterKeyDailog dialog = - MasterKeyDailog( - list: model.medicationRouteList, - selectedValue: _selectedMedicationRoute, - okText: - TranslationBase.of(context).ok, - okFunction: (selectedValue) { - setState(() { - _selectedMedicationRoute = - selectedValue; + doseController + .text = projectViewModel + .isArabic + ? _selectedMedicationDose + .nameAr + : _selectedMedicationDose + .nameEn; + }); + }, + ); + showDialog( + barrierDismissible: false, + context: context, + builder: + (BuildContext context) { + return dialog; + }, + ); + } + : null, + hintText: + TranslationBase + .of(context) + .doseTime, + maxLines: 1, + minLines: 1, + isTextFieldHasSuffix: true, + controller: doseController, + validationError: isFormSubmitted && + _selectedMedicationDose == null + ? TranslationBase + .of(context) + .emptyMessage + : null, + ), + SizedBox( + height: 5, + ), + AppTextFieldCustom( + height: Helpers.getTextFieldHeight(), + enabled: false, + isTextFieldHasSuffix: true, + onClick: model.medicationStrengthList != + null + ? () { + MasterKeyDailog dialog = + MasterKeyDailog( + list: model + .medicationStrengthList, + okText: + TranslationBase + .of(context) + .ok, + selectedValue: + _selectedMedicationStrength, + okFunction: (selectedValue) { + setState(() { + _selectedMedicationStrength = + selectedValue; - routeController - .text = projectViewModel - .isArabic - ? _selectedMedicationRoute - .nameAr - : _selectedMedicationRoute - .nameEn; - }); - }, - ); - showDialog( - barrierDismissible: false, - context: context, - builder: (BuildContext context) { - return dialog; - }, - ); - } - : null, - hintText: TranslationBase.of(context).route, - maxLines: 2, - minLines: 2, - controller: routeController, - validationError: isFormSubmitted && - _selectedMedicationRoute == null - ? TranslationBase.of(context).emptyMessage - : null, - ), - SizedBox( - height: 5, - ), - SizedBox( - height: 5, - ), - AppTextFieldCustom( - onClick: model.medicationFrequencyList != null - ? () { - MasterKeyDailog dialog = - MasterKeyDailog( - list: model.medicationFrequencyList, - okText: - TranslationBase.of(context).ok, - selectedValue: _selectedMedicationFrequency, - okFunction: (selectedValue) { - setState(() { - _selectedMedicationFrequency = - selectedValue; + strengthController + .text = projectViewModel + .isArabic + ? _selectedMedicationStrength + .nameAr + : _selectedMedicationStrength + .nameEn; + }); + }, + ); + showDialog( + barrierDismissible: false, + context: context, + builder: + (BuildContext context) { + return dialog; + }, + ); + } + : null, + hintText: + TranslationBase + .of(context) + .strength, + maxLines: 1, + minLines: 1, + controller: strengthController, + validationError: isFormSubmitted && + _selectedMedicationStrength == + null + ? TranslationBase + .of(context) + .emptyMessage + : null, + ), + SizedBox( + height: 5, + ), + SizedBox( + height: 5, + ), + AppTextFieldCustom( + height: Helpers.getTextFieldHeight(), + enabled: false, + isTextFieldHasSuffix: true, + onClick: model.medicationRouteList != null + ? () { + MasterKeyDailog dialog = + MasterKeyDailog( + list: model.medicationRouteList, + selectedValue: + _selectedMedicationRoute, + okText: + TranslationBase + .of(context) + .ok, + okFunction: (selectedValue) { + setState(() { + _selectedMedicationRoute = + selectedValue; - frequencyController - .text = projectViewModel - .isArabic - ? _selectedMedicationFrequency - .nameAr - : _selectedMedicationFrequency - .nameEn; - }); - }, - ); - showDialog( - barrierDismissible: false, - context: context, - builder: (BuildContext context) { - return dialog; - }, - ); - } - : null, - hintText: - TranslationBase.of(context).frequency, - enabled: false, - maxLines: 2, - minLines: 2, - isTextFieldHasSuffix: true, - controller: frequencyController, - validationError: isFormSubmitted && - _selectedMedicationFrequency == null - ? TranslationBase.of(context).emptyMessage - : null, - ), - SizedBox( - height: 5, - ), - SizedBox( - height: 30, - ), - ], - )), - ), - ), - ]), - ), - ), - bottomSheet:model.state == ViewState.Busy?Container(height: 0,): Container( - decoration: BoxDecoration( - color: Colors.white, - borderRadius: BorderRadius.all( - Radius.circular(10.0), - ), - border: Border.all(color: HexColor('#707070'), width: 0.30), - ), - height: MediaQuery.of(context).size.height * 0.1, - width: double.infinity, - child: Column( - children: [ - SizedBox( - height: 10, - ), - Container( - child: FractionallySizedBox( - widthFactor: .80, - child: Center( - child: AppButton( - title: TranslationBase.of(context) - .addMedication - .toUpperCase(), - color: Color(0xFF359846), - onPressed: () { - setState(() { - isFormSubmitted = true; - }); - if (_selectedMedication != null && - _selectedMedicationDose != null && - _selectedMedicationStrength != null && - _selectedMedicationRoute != null && - _selectedMedicationFrequency != null) { - widget.medicationController.text = widget - .medicationController.text + - '${_selectedMedication.description} (${TranslationBase.of(context).doseTime} ) ${doseController.text} (${TranslationBase.of(context).strength}) ${strengthController.text} (${TranslationBase.of(context).route}) ${routeController.text} (${TranslationBase.of(context).frequency}) ${frequencyController.text} \n \n'; - Navigator.of(context).pop(); + routeController + .text = projectViewModel + .isArabic + ? _selectedMedicationRoute + .nameAr + : _selectedMedicationRoute + .nameEn; + }); + }, + ); + showDialog( + barrierDismissible: false, + context: context, + builder: + (BuildContext context) { + return dialog; + }, + ); } - }, + : null, + hintText: + TranslationBase + .of(context) + .route, + maxLines: 1, + minLines: 1, + controller: routeController, + validationError: isFormSubmitted && + _selectedMedicationRoute == null + ? TranslationBase + .of(context) + .emptyMessage + : null, + ), + SizedBox( + height: 5, + ), + SizedBox( + height: 5, + ), + AppTextFieldCustom( + height: Helpers.getTextFieldHeight(), + onClick: model.medicationFrequencyList != + null + ? () { + MasterKeyDailog dialog = + MasterKeyDailog( + list: model + .medicationFrequencyList, + okText: + TranslationBase + .of(context) + .ok, + selectedValue: + _selectedMedicationFrequency, + okFunction: (selectedValue) { + setState(() { + _selectedMedicationFrequency = + selectedValue; + + frequencyController + .text = projectViewModel + .isArabic + ? _selectedMedicationFrequency + .nameAr + : _selectedMedicationFrequency + .nameEn; + }); + }, + ); + showDialog( + barrierDismissible: false, + context: context, + builder: + (BuildContext context) { + return dialog; + }, + ); + } + : null, + hintText: + TranslationBase + .of(context) + .frequency, + enabled: false, + maxLines: 1, + minLines: 1, + isTextFieldHasSuffix: true, + controller: frequencyController, + validationError: isFormSubmitted && + _selectedMedicationFrequency == + null + ? TranslationBase + .of(context) + .emptyMessage + : null, + ), + SizedBox( + height: SizeConfig.heightMultiplier * + (SizeConfig.isHeightVeryShort ? 20 : SizeConfig + .isHeightShort ? 15 : 10), + ), + + ], ), - ), - ), - ), - SizedBox( - height: 5, - ), - ], - ), - ), - ), - ), + )), + ), + ]), + ), + ), + bottomSheet: model.state != ViewState.Idle + ? Container( + height: 0, + ) + : BottomSheetDialogButton( + label: + TranslationBase.of(context).addMedication, + onTap: () { + setState(() { + isFormSubmitted = true; + }); + if (_selectedMedication != null && + _selectedMedicationDose != null && + _selectedMedicationStrength != null && + _selectedMedicationRoute != null && + _selectedMedicationFrequency != null) { + widget.medicationController.text = widget + .medicationController.text + + '${_selectedMedication.description} (${TranslationBase.of(context).doseTime} ) ${doseController.text} (${TranslationBase.of(context).strength}) ${strengthController.text} (${TranslationBase.of(context).route}) ${routeController.text} (${TranslationBase.of(context).frequency}) ${frequencyController.text} \n \n'; + Navigator.of(context).pop(); + } + }, + ) + ) + , + ) + , ); } } diff --git a/lib/screens/patients/profile/soap_update/subjective/medication/update_medication_widget.dart b/lib/screens/patients/profile/soap_update/subjective/medication/update_medication_widget.dart index 7372e7ee..c6427511 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 @@ -1,4 +1,4 @@ -import 'package:doctor_app_flutter/models/SOAP/my_selected_allergy.dart'; +import 'package:doctor_app_flutter/models/SOAP/selected_items/my_selected_allergy.dart'; import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; import 'package:flutter/material.dart'; diff --git a/lib/screens/patients/profile/soap_update/subjective/subjective_call_back.dart b/lib/screens/patients/profile/soap_update/subjective/subjective_call_back.dart new file mode 100644 index 00000000..e8d0e11f --- /dev/null +++ b/lib/screens/patients/profile/soap_update/subjective/subjective_call_back.dart @@ -0,0 +1,3 @@ +abstract class SubjectiveCallBack{ + Function nextFunction(model); +} \ No newline at end of file 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 7a48a786..bf3e0988 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 @@ -1,4 +1,5 @@ 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'; import 'package:doctor_app_flutter/core/enum/viewstate.dart'; import 'package:doctor_app_flutter/core/viewModel/SOAP_view_model.dart'; @@ -6,14 +7,16 @@ import 'package:doctor_app_flutter/models/SOAP/ChiefComplaint/GetChiefComplaintR import 'package:doctor_app_flutter/models/SOAP/GeneralGetReqForSOAP.dart'; import 'package:doctor_app_flutter/models/SOAP/GetHistoryReqModel.dart'; import 'package:doctor_app_flutter/models/SOAP/master_key_model.dart'; -import 'package:doctor_app_flutter/models/SOAP/my_selected_allergy.dart'; -import 'package:doctor_app_flutter/models/SOAP/my_selected_history.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/SOAP/post_allergy_request_model.dart'; import 'package:doctor_app_flutter/models/SOAP/post_chief_complaint_request_model.dart'; import 'package:doctor_app_flutter/models/SOAP/post_histories_request_model.dart'; import 'package:doctor_app_flutter/models/doctor/doctor_profile_model.dart'; import 'package:doctor_app_flutter/models/patient/patiant_info_model.dart'; import 'package:doctor_app_flutter/screens/base/base_view.dart'; +import 'package:doctor_app_flutter/screens/patients/profile/soap_update/soap_utils.dart'; +import 'package:doctor_app_flutter/screens/patients/profile/soap_update/subjective/subjective_call_back.dart'; import 'package:doctor_app_flutter/util/helpers.dart'; import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; import 'package:doctor_app_flutter/widgets/shared/app_scaffold_widget.dart'; @@ -34,32 +37,30 @@ class UpdateSubjectivePage extends StatefulWidget { final int currentIndex; UpdateSubjectivePage( - {Key key, - this.changePageViewIndex, - this.patientInfo, - this.changeLoadingState, - this.currentIndex}); + {Key key, this.changePageViewIndex, this.patientInfo, this.changeLoadingState, this.currentIndex}); @override _UpdateSubjectivePageState createState() => _UpdateSubjectivePageState(); } -class _UpdateSubjectivePageState extends State { +class _UpdateSubjectivePageState extends State implements SubjectiveCallBack { bool isChiefExpand = false; bool isHistoryExpand = false; bool isAllergiesExpand = false; TextEditingController illnessController = TextEditingController(); TextEditingController complaintsController = TextEditingController(); TextEditingController medicationController = TextEditingController(); - String complaintsControllerError = ''; - String medicationControllerError = ''; - String illnessControllerError = ''; + final formKey = GlobalKey(); - List myAllergiesList=List(); - List myHistoryList=List(); + List myAllergiesList = List(); + List myHistoryList = List(); getHistory(SOAPViewModel model) async { widget.changeLoadingState(true); + + model.complaintsControllerError = ''; + model.medicationControllerError = ''; + model.illnessControllerError = ''; GetHistoryReqModel getHistoryReqModel = GetHistoryReqModel( patientMRN: widget.patientInfo.patientMRN, episodeID: widget.patientInfo.episodeNo.toString(), @@ -91,8 +92,8 @@ class _UpdateSubjectivePageState extends State { ); if (history != null) { MySelectedHistory mySelectedHistory = - MySelectedHistory(selectedHistory: history, isChecked: element.isChecked, remark: element.remarks,isLocal: false); - + SoapUtils.generateMySelectedHistory( + history: history, isChecked: element.isChecked, remark: element.remarks, isLocal: false); myHistoryList.add(mySelectedHistory); } } @@ -103,8 +104,8 @@ class _UpdateSubjectivePageState extends State { ); if (history != null) { MySelectedHistory mySelectedHistory = - MySelectedHistory(selectedHistory: history, isChecked: element.isChecked, remark: element.remarks,isLocal: false); - + SoapUtils.generateMySelectedHistory( + history: history, isChecked: element.isChecked, remark: element.remarks, isLocal: false); myHistoryList.add(mySelectedHistory); } } @@ -115,8 +116,8 @@ class _UpdateSubjectivePageState extends State { ); if (history != null) { MySelectedHistory mySelectedHistory = - MySelectedHistory(selectedHistory: history, isChecked: element.isChecked, remark: element.remarks,isLocal: false); - + SoapUtils.generateMySelectedHistory( + history: history, isChecked: element.isChecked, remark: element.remarks, isLocal: false); myHistoryList.add(mySelectedHistory); } } @@ -127,8 +128,8 @@ class _UpdateSubjectivePageState extends State { ); if (history != null) { MySelectedHistory mySelectedHistory = - MySelectedHistory(selectedHistory: history, isChecked: element.isChecked, remark: element.remarks,isLocal: false); - + SoapUtils.generateMySelectedHistory( + history: history, isChecked: element.isChecked, remark: element.remarks, isLocal: false); myHistoryList.add(mySelectedHistory); } } @@ -162,13 +163,14 @@ class _UpdateSubjectivePageState extends State { ); } - MySelectedAllergy mySelectedAllergy = MySelectedAllergy( - selectedAllergy: selectedAllergy, + MySelectedAllergy mySelectedAllergy = SoapUtils.generateMySelectedAllergy( + allergy: selectedAllergy, isChecked: element.isChecked, createdBy: element.createdBy, remark: element.remarks, - isLocal : false, - selectedAllergySeverity: selectedAllergySeverity); + isLocal: false, + allergySeverity: selectedAllergySeverity); + if (selectedAllergy != null && selectedAllergySeverity != null) myAllergiesList.add(mySelectedAllergy); }); } @@ -180,10 +182,13 @@ class _UpdateSubjectivePageState extends State { onModelReady: (model) async { myAllergiesList.clear(); myHistoryList.clear(); - + model.setSubjectiveCallBack(this); GetChiefComplaintReqModel getChiefComplaintReqModel = GetChiefComplaintReqModel( + admissionNo: widget.patientInfo.admissionNo != null ? int.parse(widget.patientInfo.admissionNo) : null, patientMRN: widget.patientInfo.patientMRN, - appointmentNo: int.parse(widget.patientInfo.appointmentNo.toString()), + appointmentNo: widget.patientInfo.appointmentNo != null + ? int.parse(widget.patientInfo.appointmentNo.toString()) + : null, episodeId: widget.patientInfo.episodeNo, episodeID: widget.patientInfo.episodeNo, doctorID: ''); @@ -196,9 +201,11 @@ class _UpdateSubjectivePageState extends State { ? model.patientChiefComplaintList[0].currentMedication + '\n \n' : model.patientChiefComplaintList[0].currentMedication; } + if (widget.patientInfo.admissionNo == null) { + await getHistory(model); - await getHistory(model); - await getAllergies(model); + await getAllergies(model); + } widget.changeLoadingState(false); }, @@ -214,7 +221,11 @@ class _UpdateSubjectivePageState extends State { mainAxisAlignment: MainAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start, children: [ - SOAPStepHeader(currentIndex: widget.currentIndex, changePageViewIndex: widget.changePageViewIndex), + SOAPStepHeader( + currentIndex: widget.currentIndex, + changePageViewIndex: widget.changePageViewIndex, + patientInfo: widget.patientInfo, + ), ExpandableSOAPWidget( headerTitle: TranslationBase.of(context).chiefComplaints, onTap: () { @@ -227,112 +238,77 @@ class _UpdateSubjectivePageState extends State { complaintsController: complaintsController, illnessController: illnessController, medicationController: medicationController, - complaintsControllerError: complaintsControllerError, - illnessControllerError: illnessControllerError, - medicationControllerError: medicationControllerError, + complaintsControllerError: + model.complaintsControllerError, + illnessControllerError: model.illnessControllerError, + medicationControllerError: + model.medicationControllerError, ), isExpanded: isChiefExpand, ), SizedBox( - height: 30, + height: SizeConfig.heightMultiplier * (SizeConfig.isHeightVeryShort ? 4 : 2), ), - ExpandableSOAPWidget( - headerTitle: TranslationBase.of(context).histories, - isRequired: false, - onTap: () { - setState(() { - isHistoryExpand = !isHistoryExpand; - }); - }, - child: Column( - children: [UpdateHistoryWidget(myHistoryList: myHistoryList)], + 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, ), - isExpanded: isHistoryExpand, - ), SizedBox( - height: 30, + height: SizeConfig.heightMultiplier * (SizeConfig.isHeightVeryShort ? 4 : 2), ), - ExpandableSOAPWidget( - headerTitle: TranslationBase.of(context).allergiesSoap, - isRequired: false, - onTap: () { - setState(() { - isAllergiesExpand = !isAllergiesExpand; - }); - }, - child: Column( - children: [ - UpdateAllergiesWidget( - myAllergiesList: myAllergiesList, - ), - SizedBox( - height: 30, - ), - ], + 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, ), - isExpanded: isAllergiesExpand, - ), SizedBox( - height: MediaQuery.of(context).size.height * 0.16, + height: SizeConfig.heightMultiplier * (SizeConfig.isHeightVeryShort ? 20 : 10), ), ], ), ), ), ), - bottomSheet: Container( - decoration: BoxDecoration( - color: Colors.white, - borderRadius: BorderRadius.all( - Radius.circular(0.0), - ), - border: Border.all(color: HexColor('#707070'), width: 0), - ), - height: 80, - width: double.infinity, - child: Column( - children: [ - SizedBox( - height: 10, - ), - Container( - child: FractionallySizedBox( - widthFactor: .80, - child: Center( - child: AppButton( - title: TranslationBase.of(context).next, - fontWeight: FontWeight.w600, - color: Colors.red[700], - // loading: model.state == ViewState.BusyLocal, - onPressed: () async { - addSubjectiveInfo( - model: model, myAllergiesList: myAllergiesList, myHistoryList: myHistoryList); - }, - ), - ), - ), - ), - SizedBox( - height: 5, - ), - ], - ), - ), ), ); } addSubjectiveInfo( {SOAPViewModel model, List myAllergiesList, List myHistoryList}) async { - if(FocusScope.of(context).hasFocus) - FocusScope.of(context).unfocus(); + if (FocusScope.of(context).hasFocus) FocusScope.of(context).unfocus(); widget.changeLoadingState(true); formKey.currentState.save(); formKey.currentState.validate(); - complaintsControllerError = ''; - medicationControllerError = ''; - illnessControllerError = ''; + model.complaintsControllerError = ''; + model.medicationControllerError = ''; + model.illnessControllerError = ''; if (complaintsController.text.isNotEmpty && illnessController.text.isNotEmpty && complaintsController.text.length > 25) { @@ -358,48 +334,57 @@ class _UpdateSubjectivePageState extends State { } else { setState(() { if (complaintsController.text.isEmpty) { - complaintsControllerError = TranslationBase.of(context).emptyMessage; + model.complaintsControllerError = + TranslationBase.of(context).emptyMessage; } else if (complaintsController.text.length < 25) { - complaintsControllerError = TranslationBase.of(context).chiefComplaintLength; + model.complaintsControllerError = + TranslationBase.of(context).chiefComplaintLength; } if (illnessController.text.isEmpty) { - illnessControllerError = TranslationBase.of(context).emptyMessage; + model.illnessControllerError = + TranslationBase.of(context).emptyMessage; } if (medicationController.text.isEmpty) { - medicationControllerError = TranslationBase.of(context).emptyMessage; + model.medicationControllerError = + TranslationBase.of(context).emptyMessage; } }); widget.changeLoadingState(false); - Helpers.showErrorToast(TranslationBase.of(context).chiefComplaintErrorMsg); + Helpers.showErrorToast( + TranslationBase.of(context).chiefComplaintErrorMsg); } } - postAllergy({List myAllergiesList, SOAPViewModel model}) async { - PostAllergyRequestModel postAllergyRequestModel = new PostAllergyRequestModel(); + postAllergy( + {List myAllergiesList, SOAPViewModel model}) async { + PostAllergyRequestModel postAllergyRequestModel = + new PostAllergyRequestModel(); Map profile = await sharedPref.getObj(DOCTOR_PROFILE); DoctorProfileModel doctorProfile = DoctorProfileModel.fromJson(profile); myAllergiesList.forEach((allergy) { - if (postAllergyRequestModel.listHisProgNotePatientAllergyDiseaseVM == null) + if (postAllergyRequestModel.listHisProgNotePatientAllergyDiseaseVM == + null) postAllergyRequestModel.listHisProgNotePatientAllergyDiseaseVM = []; - postAllergyRequestModel.listHisProgNotePatientAllergyDiseaseVM.add(ListHisProgNotePatientAllergyDiseaseVM( - allergyDiseaseId: allergy.selectedAllergy.id, - allergyDiseaseType: allergy.selectedAllergy.typeId, - patientMRN: widget.patientInfo.patientMRN, - episodeId: widget.patientInfo.episodeNo, - appointmentNo: widget.patientInfo.appointmentNo, - severity: allergy.selectedAllergySeverity.id, - remarks: allergy.remark, - createdBy: allergy.createdBy ?? doctorProfile.doctorID, - createdOn: DateTime.now().toIso8601String(), - editedBy: doctorProfile.doctorID, - editedOn: DateTime.now().toIso8601String(), - isChecked: allergy.isChecked, - isUpdatedByNurse: false)); + postAllergyRequestModel.listHisProgNotePatientAllergyDiseaseVM.add( + ListHisProgNotePatientAllergyDiseaseVM( + allergyDiseaseId: allergy.selectedAllergy.id, + allergyDiseaseType: allergy.selectedAllergy.typeId, + patientMRN: widget.patientInfo.patientMRN, + episodeId: widget.patientInfo.episodeNo, + appointmentNo: widget.patientInfo.appointmentNo, + severity: allergy.selectedAllergySeverity.id, + remarks: allergy.remark, + createdBy: allergy.createdBy ?? doctorProfile.doctorID, + createdOn: DateTime.now().toIso8601String(), + editedBy: doctorProfile.doctorID, + editedOn: DateTime.now().toIso8601String(), + isChecked: allergy.isChecked, + isUpdatedByNurse: false)); }); if (model.patientAllergiesList.isEmpty) { await model.postAllergy(postAllergyRequestModel); @@ -423,10 +408,13 @@ class _UpdateSubjectivePageState extends State { } } - postHistories({List myHistoryList, SOAPViewModel model}) async { - PostHistoriesRequestModel postHistoriesRequestModel = new PostHistoriesRequestModel(doctorID: ''); + postHistories( + {List myHistoryList, SOAPViewModel model}) async { + PostHistoriesRequestModel postHistoriesRequestModel = + new PostHistoriesRequestModel(doctorID: ''); myHistoryList.forEach((history) { - if (postHistoriesRequestModel.listMedicalHistoryVM == null) postHistoriesRequestModel.listMedicalHistoryVM = []; + if (postHistoriesRequestModel.listMedicalHistoryVM == null) + postHistoriesRequestModel.listMedicalHistoryVM = []; postHistoriesRequestModel.listMedicalHistoryVM.add(ListMedicalHistoryVM( patientMRN: widget.patientInfo.patientMRN, episodeId: widget.patientInfo.episodeNo, @@ -453,9 +441,10 @@ class _UpdateSubjectivePageState extends State { formKey.currentState.save(); if (formKey.currentState.validate()) { PostChiefComplaintRequestModel postChiefComplaintRequestModel = new PostChiefComplaintRequestModel( + admissionNo: widget.patientInfo.admissionNo != null ? int.parse(widget.patientInfo.admissionNo) : null, patientMRN: widget.patientInfo.patientMRN, - episodeID: widget.patientInfo.episodeNo, - appointmentNo: widget.patientInfo.appointmentNo, + episodeID: widget.patientInfo.episodeNo ?? 0, + appointmentNo: widget.patientInfo.appointmentNo ?? 0, chiefComplaint: complaintsController.text, currentMedication: medicationController.text, hopi: illnessController.text, @@ -467,8 +456,14 @@ class _UpdateSubjectivePageState extends State { postChiefComplaintRequestModel.editedBy = ''; await model.postChiefComplaint(postChiefComplaintRequestModel); } else { + postChiefComplaintRequestModel.editedBy = ''; await model.patchChiefComplaint(postChiefComplaintRequestModel); } } } + + @override + Function 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 e9d6d16d..07c8caf7 100644 --- a/lib/screens/patients/profile/soap_update/update_soap_index.dart +++ b/lib/screens/patients/profile/soap_update/update_soap_index.dart @@ -1,16 +1,21 @@ +import 'package:doctor_app_flutter/config/size_config.dart'; +import 'package:doctor_app_flutter/core/enum/viewstate.dart'; +import 'package:doctor_app_flutter/core/viewModel/SOAP_view_model.dart'; import 'package:doctor_app_flutter/core/viewModel/doctor_replay_view_model.dart'; import 'package:doctor_app_flutter/models/SOAP/GetGetProgressNoteResModel.dart'; -import 'package:doctor_app_flutter/models/SOAP/my_selected_allergy.dart'; -import 'package:doctor_app_flutter/models/SOAP/my_selected_assement.dart'; -import 'package:doctor_app_flutter/models/SOAP/my_selected_examination.dart'; -import 'package:doctor_app_flutter/models/SOAP/my_selected_history.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_examination.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/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'; import 'package:doctor_app_flutter/widgets/patients/profile/patient-profile-app-bar.dart'; import 'package:doctor_app_flutter/widgets/shared/app_scaffold_widget.dart'; +import 'package:doctor_app_flutter/widgets/shared/buttons/app_buttons_widget.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; +import 'package:hexcolor/hexcolor.dart'; import 'assessment/update_assessment_page.dart'; import 'objective/update_objective_page.dart'; @@ -32,10 +37,8 @@ class _UpdateSoapIndexState extends State List myAllergiesList = List(); List myHistoryList = List(); - - changePageViewIndex(pageIndex,{isChangeState = true}) { - if (pageIndex != _currentIndex && isChangeState) - changeLoadingState(true); + changePageViewIndex(pageIndex, {isChangeState = true}) { + if (pageIndex != _currentIndex && isChangeState) changeLoadingState(true); _controller.jumpToPage(pageIndex); setState(() { _currentIndex = pageIndex; @@ -57,15 +60,21 @@ class _UpdateSoapIndexState extends State }); } + void changeStateFun(){ + setState(() { + + }); + } @override Widget build(BuildContext context) { final routeArgs = ModalRoute.of(context).settings.arguments as Map; PatiantInformtion patient = routeArgs['patient']; - return AppScaffold( - isLoading: _isLoading, - isShowAppBar: false, - body: SingleChildScrollView( - child: SingleChildScrollView( + return BaseView( + builder: (_,model,w)=>AppScaffold( + isLoading: _isLoading, + isShowAppBar: true, + appBar: PatientProfileAppBar(patient), + body: SingleChildScrollView( child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ @@ -77,13 +86,6 @@ class _UpdateSoapIndexState extends State mainAxisAlignment: MainAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start, children: [ - PatientProfileAppBar(patient), - Container( - width: double.infinity, - height: 1, - color: Color(0xffCCCCCC), - ), - Container( color: Theme.of(context).scaffoldBackgroundColor, height: MediaQuery.of(context).size.height * 0.73, @@ -116,6 +118,8 @@ class _UpdateSoapIndexState extends State changePageViewIndex: changePageViewIndex, currentIndex: _currentIndex, patientInfo: patient, + sOAPViewModel: model, + changeStateFun: changeStateFun, changeLoadingState: changeLoadingState) ], ), @@ -126,7 +130,186 @@ class _UpdateSoapIndexState extends State ], ), ), + bottomSheet:_isLoading?Container(height: 0,): Container( + decoration: BoxDecoration( + color: Colors.white, + borderRadius: BorderRadius.all( + Radius.circular(0.0), + ), + border: Border.all(color: HexColor('#707070'), width: 0), + ), + height: SizeConfig.heightMultiplier * + (SizeConfig.isHeightVeryShort ? 12 : 10), + width: double.infinity, + child: Column( + children: [ + SizedBox( + height: 10, + ), + Container( + child: FractionallySizedBox( + widthFactor: .80, + child: getBottomSheet(model, patient) + ), + ), + SizedBox( + height: 5, + ), + ], + ), + ), + ), ); } + + Widget getBottomSheet(SOAPViewModel model, PatiantInformtion patient) { + switch (_currentIndex) { + case 0: + { + return Center( + child: AppButton( + title: TranslationBase.of(context).next, + fontWeight: FontWeight.w600, + height: SizeConfig.heightMultiplier * + (SizeConfig.isHeightVeryShort ? 8 : 6), + padding: 10, + color: Colors.red[700], + onPressed: () async { + model.nextOnSubjectPage(model); + }, + ), + ); + } + break; + case 1: + { + return Center( + child: Row( + children: [ + Expanded( + child: AppButton( + title: TranslationBase.of(context).previous, + color: Colors.grey[300], + height: SizeConfig.heightMultiplier * + (SizeConfig.isHeightVeryShort ? 8 : 6), + padding: 10, + fontColor: Colors.black, + fontWeight: FontWeight.w600, + onPressed: () { + changePageViewIndex(0); + }, + ), + ), + SizedBox( + width: 5, + ), + Expanded( + child: AppButton( + title: patient.admissionNo != null && + patient.admissionNo.isNotEmpty && !model.isAddExamInProgress?TranslationBase.of(context).finish: TranslationBase.of(context).next, + fontWeight: FontWeight.w600, + color: Colors.red[700], + height: SizeConfig.heightMultiplier * + (SizeConfig.isHeightVeryShort ? 8 : 6), + padding: 10, + disabled: model.state == ViewState.BusyLocal, + onPressed: () async { + await model.nextOnObjectivePage(model); + }, + ), + ), + ], + ), + ); + } + break; + case 2: + { + return Center( + child: Row( + children: [ + Expanded( + child: AppButton( + title: TranslationBase.of(context).previous, + color: Colors.grey[300], + fontColor: Colors.black, + height: SizeConfig.heightMultiplier * + (SizeConfig.isHeightVeryShort ? 8 : 6), + padding: 10, + fontWeight: FontWeight.w600, + disabled: model.state == ViewState.BusyLocal, + onPressed: () async { + changePageViewIndex(1); + }, + ), + ), + SizedBox( + width: 5, + ), + Expanded( + child: AppButton( + title: TranslationBase.of(context).next, + fontWeight: FontWeight.w600, + color: Colors.red[700], + height: SizeConfig.heightMultiplier * + (SizeConfig.isHeightVeryShort ? 8 : 6), + padding: 10, + disabled: model.state == ViewState.BusyLocal, + onPressed: () async { + model.nextOnAssessmentPage(model); + }, + ), + ), + ], + ), + ); + } + break; + case 3: + { + return Center( + child: Row( + children: [ + Expanded( + child: AppButton( + height: SizeConfig.heightMultiplier * + (SizeConfig.isHeightVeryShort ? 8 : 6), + padding: 10, + title: TranslationBase.of(context).previous, + color: Colors.grey[300], + fontColor: Colors.black, + fontWeight: FontWeight.w600, + disabled: model.state == ViewState.BusyLocal, + onPressed: () async { + changePageViewIndex(2); + }, + ), + ), + SizedBox( + width: 5, + ), + Expanded( + child: AppButton( + height: SizeConfig.heightMultiplier * + (SizeConfig.isHeightVeryShort ? 8 : 6), + padding: 10, + title: model.isAddProgress + ? TranslationBase.of(context).next + : TranslationBase.of(context).finish, + fontWeight: FontWeight.w600, + color: Colors.red[700], + disabled: model.progressNoteText.isEmpty, + onPressed: () async { + model.nextOnPlanPage(model); + }, + ), + ), + ], + ), + ); + } + break; + } + } } diff --git a/lib/util/helpers.dart b/lib/util/helpers.dart index 7232f0c9..f8f0fbd3 100644 --- a/lib/util/helpers.dart +++ b/lib/util/helpers.dart @@ -277,4 +277,7 @@ class Helpers { String twoDigitSeconds = twoDigits(duration.inSeconds.remainder(60)); return "$twoDigitMinutes:$twoDigitSeconds"; } + static double getTextFieldHeight(){ + return SizeConfig.heightMultiplier * (SizeConfig.isHeightVeryShort ?10:SizeConfig.isHeightShort?8:6); + } } diff --git a/lib/util/translations_delegate_base.dart b/lib/util/translations_delegate_base.dart index e30a006a..2e8d10c9 100644 --- a/lib/util/translations_delegate_base.dart +++ b/lib/util/translations_delegate_base.dart @@ -1233,6 +1233,9 @@ class TranslationBase { localizedValues['typeHereToReply'][locale.languageCode]; String get searchHere => localizedValues['searchHere'][locale.languageCode]; String get remove => localizedValues['remove'][locale.languageCode]; + String get inProgress => localizedValues['inProgress'][locale.languageCode]; + String get completed => localizedValues['Completed'][locale.languageCode]; + String get locked => localizedValues['Locked'][locale.languageCode]; String get step => localizedValues['step'][locale.languageCode]; String get fieldRequired => @@ -1366,6 +1369,7 @@ class TranslationBase { String get addPrescription => localizedValues['addPrescription'][locale.languageCode]; String get edit => localizedValues['edit'][locale.languageCode]; String get summeryReply => localizedValues['summeryReply'][locale.languageCode]; + String get severityValidationError => localizedValues['severityValidationError'][locale.languageCode]; } class TranslationBaseDelegate extends LocalizationsDelegate { diff --git a/lib/widgets/patients/profile/patient-profile-app-bar.dart b/lib/widgets/patients/profile/patient-profile-app-bar.dart index 2a0fa072..9916ae3e 100644 --- a/lib/widgets/patients/profile/patient-profile-app-bar.dart +++ b/lib/widgets/patients/profile/patient-profile-app-bar.dart @@ -75,21 +75,17 @@ class PatientProfileAppBar extends StatelessWidget ), decoration: BoxDecoration( color: Colors.white, + border: Border( bottom: BorderSide(color:Color(0xFFEFEFEF))) + ), - // height: height == 0 - // ? isInpatient - // ? 215 - // : isAppointmentHeader - // ? 325 - // : 200 - // : height, child: Container( padding: EdgeInsets.only(left: 10, right: 10, bottom: 10), - margin: EdgeInsets.only(top: 50), + + margin: EdgeInsets.only(top: SizeConfig.isHeightVeryShort?30: 50), child: Column( children: [ Container( - padding: EdgeInsets.only(left: 12.0), + padding: EdgeInsets.only(left: SizeConfig.isHeightVeryShort?0: 12.0), child: Row(children: [ IconButton( icon: Icon(Icons.arrow_back_ios), @@ -138,10 +134,10 @@ class PatientProfileAppBar extends StatelessWidget ), Row(children: [ Padding( - padding: EdgeInsets.only(left: 12.0), + padding: EdgeInsets.only(left: SizeConfig.isHeightVeryShort?0: 12.0), child: Container( - width: 60, - height: 60, + width: SizeConfig.getTextMultiplierBasedOnWidth()*20, + height: SizeConfig.getTextMultiplierBasedOnWidth()*20, child: Image.asset( gender == 1 ? 'assets/images/male_avatar.png' @@ -170,14 +166,14 @@ class PatientProfileAppBar extends StatelessWidget color: Colors.green, fontWeight: FontWeight.bold, fontFamily: 'Poppins', - fontSize: 12, + fontSize: SizeConfig.getTextMultiplierBasedOnWidth() *3.5, ) : AppText( TranslationBase.of(context).notArrived, color: Colors.red[800], fontWeight: FontWeight.bold, fontFamily: 'Poppins', - fontSize: 12, + fontSize: SizeConfig.getTextMultiplierBasedOnWidth() *3.5, ), patient.startTime != null ? AppText( @@ -185,7 +181,7 @@ class PatientProfileAppBar extends StatelessWidget ? patient.startTime : '', fontWeight: FontWeight.w700, - fontSize: 12, + fontSize: SizeConfig.getTextMultiplierBasedOnWidth() *3.5, color: Color(0xFF2E303A)) : SizedBox() ], @@ -207,7 +203,7 @@ class PatientProfileAppBar extends StatelessWidget .fileNumber, style: TextStyle( - fontSize: 10, + fontSize: SizeConfig.getTextMultiplierBasedOnWidth() *3, fontFamily: 'Poppins', color: Color(0xFF575757), fontWeight: FontWeight.w600, @@ -218,7 +214,7 @@ class PatientProfileAppBar extends StatelessWidget style: TextStyle( fontWeight: FontWeight.w700, fontFamily: 'Poppins', - fontSize: 12, color: Color(0xFF2E303A),)), + fontSize: SizeConfig.getTextMultiplierBasedOnWidth() *3.5, color: Color(0xFF2E303A),)), ], ), ), @@ -227,7 +223,7 @@ class PatientProfileAppBar extends StatelessWidget AppText( patient.nationalityName ?? patient.nationality?? patient.nationalityId ?? '', fontWeight: FontWeight.bold, - fontSize: 12, + fontSize: SizeConfig.getTextMultiplierBasedOnWidth() *3.5, ), patient.nationalityFlagURL != null ? ClipRRect( @@ -260,7 +256,7 @@ class PatientProfileAppBar extends StatelessWidget text: TranslationBase .of(context) .age + " : ", - style: TextStyle(fontSize: 10, fontWeight: FontWeight.w600,color: Color(0xFF575757),)), + style: TextStyle(fontSize: SizeConfig.getTextMultiplierBasedOnWidth() *3, fontWeight: FontWeight.w600,color: Color(0xFF575757),)), new TextSpan( text: "${AppDateUtils.getAgeByBirthday( @@ -271,7 +267,7 @@ class PatientProfileAppBar extends StatelessWidget isServerFormat: !isFromLiveCare)}", style: TextStyle( fontWeight: FontWeight.w700, - fontSize: 12, + fontSize: SizeConfig.getTextMultiplierBasedOnWidth() *3.5, color: Color(0xFF2E303A),)), ], ), @@ -285,7 +281,7 @@ class PatientProfileAppBar extends StatelessWidget AppText( TranslationBase.of(context).appointmentDate + " : ", - fontSize: 10, + fontSize: SizeConfig.getTextMultiplierBasedOnWidth() *3, color: Color(0xFF575757), fontWeight: FontWeight.w600, fontFamily: 'Poppins', @@ -300,7 +296,7 @@ class PatientProfileAppBar extends StatelessWidget patient.appointmentDate)) , fontWeight: FontWeight.w700, - fontSize: 12, + fontSize: SizeConfig.getTextMultiplierBasedOnWidth() *3.5, color: Color(0xFF2E303A), ), SizedBox( @@ -319,7 +315,7 @@ class PatientProfileAppBar extends StatelessWidget children: [ new TextSpan( text: "Result Date: ", - style: TextStyle( fontSize: 10, + style: TextStyle( fontSize: SizeConfig.getTextMultiplierBasedOnWidth() *3, color: Color(0xFF575757), fontWeight: FontWeight.w600, fontFamily: 'Poppins',)), @@ -341,7 +337,7 @@ class PatientProfileAppBar extends StatelessWidget child: RichText( text: new TextSpan( style: new TextStyle( - fontSize: 10, fontWeight: FontWeight.w600,color: Color(0xFF575757), + fontSize: SizeConfig.getTextMultiplierBasedOnWidth() *3, fontWeight: FontWeight.w600,color: Color(0xFF575757), fontFamily: 'Poppins', ), children: [ @@ -363,7 +359,7 @@ class PatientProfileAppBar extends StatelessWidget .toString())))}", style: TextStyle( fontWeight: FontWeight.w700, - fontSize: 12, + fontSize: SizeConfig.getTextMultiplierBasedOnWidth() *3.5, color: Color(0xFF2E303A),)), ]))), if (patient.admissionDate != null) @@ -371,7 +367,7 @@ class PatientProfileAppBar extends StatelessWidget children: [ AppText( "${TranslationBase.of(context).numOfDays}: ", - fontSize: 10, fontWeight: FontWeight.w600,color: Color(0xFF575757) + fontSize: SizeConfig.getTextMultiplierBasedOnWidth() *3, fontWeight: FontWeight.w600,color: Color(0xFF575757) ), if(isDischargedPatient && patient.dischargeDate != null) @@ -384,7 +380,7 @@ class PatientProfileAppBar extends StatelessWidget patient.admissionDate)) .inDays + 1}", fontWeight: FontWeight.w700, - fontSize: 12, + fontSize: SizeConfig.getTextMultiplierBasedOnWidth() *3.5, color: Color(0xFF2E303A), ) else @@ -396,7 +392,7 @@ class PatientProfileAppBar extends StatelessWidget patient.admissionDate)) .inDays + 1}", fontWeight: FontWeight.w700, - fontSize: 12, + fontSize: SizeConfig.getTextMultiplierBasedOnWidth() *3.5, color: Color(0xFF2E303A),), ], ), @@ -457,7 +453,7 @@ class PatientProfileAppBar extends StatelessWidget .dr}$doctorName', color: Color(0xFF2E303A), fontWeight: FontWeight.w700, - fontSize: 12, + fontSize: SizeConfig.getTextMultiplierBasedOnWidth() *3.5, ), if (orderNo != null && !isPrescriptions) @@ -465,7 +461,7 @@ class PatientProfileAppBar extends StatelessWidget children: [ AppText('Order No: ', - fontSize: 10, fontWeight: FontWeight.w600,color: Color(0xFF575757),), + fontSize: SizeConfig.getTextMultiplierBasedOnWidth() *3, fontWeight: FontWeight.w600,color: Color(0xFF575757),), AppText(orderNo ?? '', fontSize: 12) ], @@ -475,7 +471,7 @@ class PatientProfileAppBar extends StatelessWidget Row( children: [ AppText('Invoice: ', - fontSize: 10, fontWeight: FontWeight.w600,color: Color(0xFF575757),), + fontSize: SizeConfig.getTextMultiplierBasedOnWidth() *3, fontWeight: FontWeight.w600,color: Color(0xFF575757),), AppText(invoiceNO ?? "", fontSize: 12) ], @@ -484,7 +480,7 @@ class PatientProfileAppBar extends StatelessWidget Row( children: [ AppText('Branch: ', - fontSize: 10, fontWeight: FontWeight.w600,color: Color(0xFF575757),), + fontSize: SizeConfig.getTextMultiplierBasedOnWidth() *3, fontWeight: FontWeight.w600,color: Color(0xFF575757),), AppText(branch ?? '', fontSize: 12) ], @@ -494,7 +490,7 @@ class PatientProfileAppBar extends StatelessWidget Row( children: [ AppText('Clinic: ', - fontSize: 10, fontWeight: FontWeight.w600,color: Color(0xFF575757),), + fontSize: SizeConfig.getTextMultiplierBasedOnWidth() *3, fontWeight: FontWeight.w600,color: Color(0xFF575757),), AppText(clinic ?? '', fontSize: 12) ], @@ -504,7 +500,7 @@ class PatientProfileAppBar extends StatelessWidget Row( children: [ AppText('Episode: ', - fontSize: 10, fontWeight: FontWeight.w600,color: Color(0xFF575757),), + fontSize: SizeConfig.getTextMultiplierBasedOnWidth() *3, fontWeight: FontWeight.w600,color: Color(0xFF575757),), AppText(episode ?? '', fontSize: 12) ], @@ -514,7 +510,7 @@ class PatientProfileAppBar extends StatelessWidget Row( children: [ AppText('Visit Date: ', - fontSize: 10, fontWeight: FontWeight.w600,color: Color(0xFF575757),), + fontSize: SizeConfig.getTextMultiplierBasedOnWidth() *3, fontWeight: FontWeight.w600,color: Color(0xFF575757),), AppText(visitDate ?? '', fontSize: 12) ], @@ -527,7 +523,7 @@ class PatientProfileAppBar extends StatelessWidget !isPrescriptions ? 'Result Date:' : 'Prescriptions Date ', - fontSize: 10, fontWeight: FontWeight.w600,color: Color(0xFF575757), + fontSize: SizeConfig.getTextMultiplierBasedOnWidth() *3, fontWeight: FontWeight.w600,color: Color(0xFF575757), ), AppText( '${AppDateUtils @@ -535,7 +531,7 @@ class PatientProfileAppBar extends StatelessWidget appointmentDate, isArabic: projectViewModel .isArabic)}', - fontSize: 12, + fontSize: SizeConfig.getTextMultiplierBasedOnWidth() *3.5, ) ], ) @@ -556,6 +552,6 @@ class PatientProfileAppBar extends StatelessWidget @override Size get preferredSize => Size(double.maxFinite, height == 0 - ? isInpatient ? (isFromLabResult?200:170) : isAppointmentHeader ? 290 : 170 + ? isInpatient ? (isFromLabResult?200:190) : isAppointmentHeader ? 290 : SizeConfig.isHeightVeryShort?137:SizeConfig.isHeightShort?190: SizeConfig.heightMultiplier * (SizeConfig.isWidthLarge?25:20) : height); } diff --git a/lib/widgets/shared/app_texts_widget.dart b/lib/widgets/shared/app_texts_widget.dart index 48661a32..4bf89d4e 100644 --- a/lib/widgets/shared/app_texts_widget.dart +++ b/lib/widgets/shared/app_texts_widget.dart @@ -18,6 +18,7 @@ class AppText extends StatefulWidget { final double marginRight; final double marginBottom; final double marginLeft; + final double letterSpacing; final TextAlign textAlign; final bool bold; final bool regular; @@ -55,7 +56,7 @@ class AppText extends StatefulWidget { this.allowExpand = true, this.visibility = true, this.textOverflow, - this.textDecoration, + this.textDecoration, this.letterSpacing, }); @override @@ -132,7 +133,7 @@ class _AppTextState extends State { widget.color != null ? widget.color : Colors.black, fontSize: widget.fontSize ?? _getFontSize(), letterSpacing: - widget.variant == "overline" ? 1.5 : null, + widget.letterSpacing??(widget.variant == "overline" ? 1.5 : null), fontWeight: widget.fontWeight ?? _getFontWeight(), fontFamily: widget.fontFamily ?? 'Poppins', decoration: widget.textDecoration, diff --git a/lib/widgets/shared/buttons/app_buttons_widget.dart b/lib/widgets/shared/buttons/app_buttons_widget.dart index ed3e6e98..acbd27fe 100644 --- a/lib/widgets/shared/buttons/app_buttons_widget.dart +++ b/lib/widgets/shared/buttons/app_buttons_widget.dart @@ -22,6 +22,7 @@ class AppButton extends StatefulWidget { final double radius; final double vPadding; final double hPadding; + final double height; AppButton({ @required this.onPressed, @@ -40,6 +41,7 @@ class AppButton extends StatefulWidget { this.radius = 8.0, this.hasBorder = false, this.borderColor, + this.height, }); _AppButtonState createState() => _AppButtonState(); @@ -50,6 +52,7 @@ class _AppButtonState extends State { Widget build(BuildContext context) { return Container( // height: MediaQuery.of(context).size.height * 0.075, + height: widget.height, child: IgnorePointer( ignoring: widget.loading ||widget.disabled, child: RawMaterialButton( diff --git a/lib/widgets/shared/dialogs/master_key_dailog.dart b/lib/widgets/shared/dialogs/master_key_dailog.dart index 55046c3c..7c12b54a 100644 --- a/lib/widgets/shared/dialogs/master_key_dailog.dart +++ b/lib/widgets/shared/dialogs/master_key_dailog.dart @@ -1,9 +1,12 @@ +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/master_key_model.dart'; import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; import 'package:flutter/material.dart'; import 'package:provider/provider.dart'; +import '../app_texts_widget.dart'; + // ignore: must_be_immutable class MasterKeyDailog extends StatefulWidget { final List list; @@ -33,18 +36,18 @@ class _MasterKeyDailogState extends State { @override Widget build(BuildContext context) { ProjectViewModel projectViewModel = Provider.of(context); - return showAlertDialog(context, projectViewModel); + return showAlertDialog(context, projectViewModel); } showAlertDialog(BuildContext context, ProjectViewModel projectViewModel) { // set up the buttons Widget cancelButton = FlatButton( - child: Text(TranslationBase.of(context).cancel), + child: AppText(TranslationBase.of(context).cancel, color: Colors.grey,fontSize: SizeConfig.getTextMultiplierBasedOnWidth() * (SizeConfig.isWidthLarge?3.5:5),), onPressed: () { Navigator.of(context).pop(); }); Widget continueButton = FlatButton( - child: Text(this.widget.okText), + child: AppText(this.widget.okText, color: Colors.grey,fontSize: SizeConfig.getTextMultiplierBasedOnWidth() * (SizeConfig.isWidthLarge?3.5:5),), onPressed: () { this.widget.okFunction(widget.selectedValue); Navigator.of(context).pop(); @@ -69,23 +72,29 @@ class _MasterKeyDailogState extends State { children: [ ...widget.list .map((item) => RadioListTile( - title: Text( - '${projectViewModel.isArabic?item.nameAr:item.nameEn}' + (widget.isICD ? '/${item.code}' : '')), - groupValue: widget.isICD - ? widget.selectedValue.code.toString() - : widget.selectedValue.id.toString(), - value: widget.isICD ? widget.selectedValue.code.toString() : item - .id.toString(), - activeColor: Colors.blue.shade700, - selected: widget.isICD ? item.code.toString() == - widget.selectedValue.code.toString() : item.id.toString() == - widget.selectedValue.id.toString(), - onChanged: (val) { - setState(() { - widget.selectedValue = item; - }); - }, - )) + title: AppText( + '${projectViewModel.isArabic ? item.nameAr : item.nameEn}' + + (widget.isICD ? '/${item.code}' : ''), + + ), + groupValue: widget.isICD + ? widget.selectedValue.code.toString() + : widget.selectedValue.id.toString(), + value: widget.isICD + ? widget.selectedValue.code.toString() + : item.id.toString(), + activeColor: Colors.blue.shade700, + selected: widget.isICD + ? item.code.toString() == + widget.selectedValue.code.toString() + : item.id.toString() == + widget.selectedValue.id.toString(), + onChanged: (val) { + setState(() { + widget.selectedValue = item; + }); + }, + )) .toList() ], ), diff --git a/lib/widgets/shared/master_key_checkbox_search_widget.dart b/lib/widgets/shared/master_key_checkbox_search_widget.dart index 3a0a1525..c61913a4 100644 --- a/lib/widgets/shared/master_key_checkbox_search_widget.dart +++ b/lib/widgets/shared/master_key_checkbox_search_widget.dart @@ -1,6 +1,8 @@ +import 'package:doctor_app_flutter/config/size_config.dart'; import 'package:doctor_app_flutter/core/viewModel/SOAP_view_model.dart'; import 'package:doctor_app_flutter/core/viewModel/project_view_model.dart'; import 'package:doctor_app_flutter/models/SOAP/master_key_model.dart'; +import 'package:doctor_app_flutter/util/helpers.dart'; import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; import 'package:doctor_app_flutter/widgets/shared/divider_with_spaces_around.dart'; import 'package:flutter/cupertino.dart'; @@ -40,6 +42,8 @@ class MasterKeyCheckboxSearchWidget extends StatefulWidget { class _MasterKeyCheckboxSearchWidgetState extends State { List items = List(); + TextEditingController filteredSearchController = TextEditingController(); + @override void initState() { @@ -73,11 +77,11 @@ class _MasterKeyCheckboxSearchWidgetState child: ListView( children: [ AppTextFieldCustom( - height: MediaQuery.of(context).size.height * 0.070, + height: Helpers.getTextFieldHeight(),//MediaQuery.of(context).size.height * 0.070, hintText: TranslationBase.of(context).searchHistory, isTextFieldHasSuffix: true, hasBorder: false, - // controller: filteredSearchController, + controller: filteredSearchController, onChanged: (value) { filterSearchResults(value); }, @@ -123,19 +127,16 @@ class _MasterKeyCheckboxSearchWidgetState }); }), Expanded( - child: Padding( - padding: const EdgeInsets.symmetric( - horizontal: 10, vertical: 0), - child: AppText( - projectViewModel.isArabic - ? historyInfo.nameAr != "" - ? historyInfo.nameAr - : historyInfo.nameEn - : historyInfo.nameEn, - color: Color(0xFF575757), - fontSize: 16, - fontWeight: FontWeight.w600, - ), + child: AppText( + projectViewModel.isArabic + ? historyInfo.nameAr != "" + ? historyInfo.nameAr + : historyInfo.nameEn + : historyInfo.nameEn, + + color: Color(0xFF575757), + fontSize: SizeConfig.getTextMultiplierBasedOnWidth()*(SizeConfig.isWidthLarge?3:3.8), + letterSpacing: -0.56, ), ), ], diff --git a/lib/widgets/shared/text_fields/app-textfield-custom.dart b/lib/widgets/shared/text_fields/app-textfield-custom.dart index 05f139a2..91b50400 100644 --- a/lib/widgets/shared/text_fields/app-textfield-custom.dart +++ b/lib/widgets/shared/text_fields/app-textfield-custom.dart @@ -122,7 +122,7 @@ class _AppTextFieldCustomState extends State { widget.hintText, color: Color(0xFF2E303A), fontSize: widget.isPrscription == false - ? SizeConfig.textMultiplier * 1.3 + ? SizeConfig.getHeightMultiplier() * (SizeConfig.isWidthLarge?1.1: 1.3) : 0, fontWeight: FontWeight.w700, ), @@ -158,7 +158,7 @@ class _AppTextFieldCustomState extends State { ? widget.inputFormatters : [], onChanged: (value) { - // setState(() {}); + setState(() {}); if (widget.onChanged != null) { widget.onChanged(value); } diff --git a/pubspec.lock b/pubspec.lock index c90d86d9..491e4c5b 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -657,7 +657,7 @@ packages: name: meta url: "https://pub.dartlang.org" source: hosted - version: "1.3.0-nullsafety.3" + version: "1.3.0-nullsafety.4" mime: dependency: transitive description: @@ -949,7 +949,7 @@ packages: name: stack_trace url: "https://pub.dartlang.org" source: hosted - version: "1.10.0-nullsafety.1" + version: "1.10.0-nullsafety.2" sticky_headers: dependency: "direct main" description: @@ -1147,5 +1147,5 @@ packages: source: hosted version: "2.2.1" sdks: - dart: ">=2.10.0 <2.11.0" + dart: ">=2.10.0 <=2.11.0-213.1.beta" flutter: ">=1.22.0 <2.0.0"