diff --git a/lib/config/config.dart b/lib/config/config.dart index 492d7ada..8241b36c 100644 --- a/lib/config/config.dart +++ b/lib/config/config.dart @@ -5,8 +5,8 @@ const ONLY_NUMBERS = "[0-9]"; const ONLY_LETTERS = "[a-zA-Z &'\"]"; const ONLY_DATE = "[0-9/]"; const BASE_URL_LIVE_CARE = 'https://livecare.hmg.com/'; -// const BASE_URL = 'https://hmgwebservices.com/'; -const BASE_URL = 'https://uat.hmgwebservices.com/'; +const BASE_URL = 'https://hmgwebservices.com/'; +// const BASE_URL = 'https://uat.hmgwebservices.com/'; const PHARMACY_ITEMS_URL = "Services/Lists.svc/REST/GetPharmcyItems_Region_enh"; const PHARMACY_LIST_URL = "Services/Patients.svc/REST/GetPharmcyList"; const PATIENT_PROGRESS_NOTE_URL = "Services/DoctorApplication.svc/REST/GetProgressNoteForInPatient"; @@ -225,6 +225,8 @@ const DOCTOR_CHECK_HAS_LIVE_CARE = "Services/DoctorApplication.svc/REST/CheckDoc const LIVE_CARE_IS_LOGIN = "LiveCareApi/DoctorApp/UseIsLogin"; const ADD_REFERRED_REMARKS_NEW = "Services/DoctorApplication.svc/REST/AddReferredDoctorRemarks_New"; +const GET_SPECIAL_CLINICAL_CARE_LIST = "Services/DoctorApplication.svc/REST/GetSpecialClinicalCareList"; +const GET_SPECIAL_CLINICAL_CARE_MAPPING_LIST = "Services/DoctorApplication.svc/REST/GetSpecialClinicalCareMappingList"; var selectedPatientType = 1; diff --git a/lib/config/localized_values.dart b/lib/config/localized_values.dart index 4d0436aa..270907be 100644 --- a/lib/config/localized_values.dart +++ b/lib/config/localized_values.dart @@ -568,7 +568,7 @@ const Map> localizedValues = { 'ar': "ليس هناك شكوى رئيس" }, "more-verify": { - "en": "More Verification Options", + "en": "More Verification \n Options", "ar": "المزيد من خيارات التحقق" }, "welcome-back": {"en": "Welcome back!", "ar": "مرحبا بعودتك!"}, diff --git a/lib/config/size_config.dart b/lib/config/size_config.dart index 6b996b3f..e37e39ac 100644 --- a/lib/config/size_config.dart +++ b/lib/config/size_config.dart @@ -17,29 +17,43 @@ 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) { isMobilePortrait = true; } - // textMultiplier = _blockHeight; - // imageSizeMultiplier = _blockWidth; screenHeight = realScreenHeight; screenWidth = realScreenWidth; } else { isPortrait = false; isMobilePortrait = false; - // textMultiplier = _blockWidth; - // imageSizeMultiplier = _blockHeight; screenHeight = realScreenWidth; screenWidth = realScreenHeight; } @@ -60,4 +74,29 @@ class SizeConfig { 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/model/patient_muse/PatientSearchRequestModel.dart b/lib/core/model/patient_muse/PatientSearchRequestModel.dart index 437c5885..2918a393 100644 --- a/lib/core/model/patient_muse/PatientSearchRequestModel.dart +++ b/lib/core/model/patient_muse/PatientSearchRequestModel.dart @@ -11,20 +11,24 @@ class PatientSearchRequestModel { int searchType; String mobileNo; String identificationNo; + int nursingStationID; + int clinicID; PatientSearchRequestModel( - {this.doctorID =0, - this.firstName ="0", - this.middleName ="0", - this.lastName ="0", - this.patientMobileNumber ="0", - this.patientIdentificationID ="0", - this.patientID =0, - this.searchType =1, - this.mobileNo="", - this.identificationNo="0", - this.from ="0", - this.to ="0"}); + {this.doctorID = 0, + this.firstName = "0", + this.middleName = "0", + this.lastName = "0", + this.patientMobileNumber = "0", + this.patientIdentificationID = "0", + this.patientID = 0, + this.searchType = 1, + this.mobileNo = "", + this.identificationNo = "0", + this.from = "0", + this.to = "0", + this.clinicID, + this.nursingStationID = 0}); PatientSearchRequestModel.fromJson(Map json) { doctorID = json['DoctorID']; @@ -39,6 +43,8 @@ class PatientSearchRequestModel { searchType = json['SearchType']; mobileNo = json['MobileNo']; identificationNo = json['IdentificationNo']; + nursingStationID = json['NursingStationID']; + clinicID = json['ClinicID']; } Map toJson() { @@ -55,6 +61,8 @@ class PatientSearchRequestModel { data['SearchType'] = this.searchType; data['MobileNo'] = this.mobileNo; data['IdentificationNo'] = this.identificationNo; + data['NursingStationID'] = this.nursingStationID; + data['ClinicID'] = this.clinicID; return data; } } diff --git a/lib/core/service/home/dasboard_service.dart b/lib/core/service/home/dasboard_service.dart index b35d24f2..ad3ec887 100644 --- a/lib/core/service/home/dasboard_service.dart +++ b/lib/core/service/home/dasboard_service.dart @@ -1,10 +1,12 @@ import 'package:doctor_app_flutter/config/config.dart'; import 'package:doctor_app_flutter/core/service/base/base_service.dart'; import 'package:doctor_app_flutter/models/dashboard/dashboard_model.dart'; +import 'package:doctor_app_flutter/models/dashboard/get_special_clinical_care_List_Respose_Model.dart'; class DashboardService extends BaseService { List _dashboardItemsList = []; List get dashboardItemsList => _dashboardItemsList; + bool hasVirtualClinic = false; String sServiceID; @@ -24,8 +26,6 @@ class DashboardService extends BaseService { super.error = error; }, body: { - // "VidaAuthTokenID": - // "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIyODA0IiwianRpIjoiZDYxZmM5MTQtZWFhYy00YjQ4LTgyMmEtMmE3OTNlZDMzZGYwIiwiZW1haWwiOiJNb2hhbWVkLlJlc3dhbkBjbG91ZHNvbHV0aW9uLXNhLmNvbSIsImlkIjoiMjgwNCIsIk5hbWUiOiJNVUhBTU1BRCBBWkFNIiwiRW1wbG95ZWVJZCI6IjE0ODUiLCJGYWNpbGl0eUdyb3VwSWQiOiIwMTAyNjYiLCJGYWNpbGl0eUlkIjoiMTUiLCJQaGFyYW1jeUZhY2lsaXR5SWQiOiI1NSIsIklTX1BIQVJNQUNZX0NPTk5FQ1RFRCI6IlRydWUiLCJEb2N0b3JJZCI6IjE0ODUiLCJTRVNTSU9OSUQiOiIyMTU3NTgwOCIsIkNsaW5pY0lkIjoiMyIsInJvbGUiOlsiU0VDVVJJVFkgQURNSU5JU1RSQVRPUlMiLCJTRVRVUCBBRE1JTklTVFJBVE9SUyIsIkNFTydTIiwiRVhFQ1VUSVZFIERJUkVDVE9SUyIsIk1BTkFHRVJTIiwiU1VQRVJWSVNPUlMiLCJDTElFTlQgU0VSVklDRVMgQ09PUkRJTkFUT1JTIiwiQ0xJRU5UIFNFUlZJQ0VTIFNVUEVSVklTT1JTIiwiQ0xJRU5UIFNFUlZJQ0VTIE1BTkdFUlMiLCJIRUFEIE5VUlNFUyIsIkRPQ1RPUlMiLCJDSElFRiBPRiBNRURJQ0FMIFNUQUZGUyIsIkJJTy1NRURJQ0FMIFRFQ0hOSUNJQU5TIiwiQklPLU1FRElDQUwgRU5HSU5FRVJTIiwiQklPLU1FRElDQUwgREVQQVJUTUVOVCBIRUFEUyIsIklUIEhFTFAgREVTSyIsIkFETUlOSVNUUkFUT1JTIiwiTEFCIEFETUlOSVNUUkFUT1IiLCJMQUIgVEVDSE5JQ0lBTiIsIkJVU0lORVNTIE9GRklDRSBTVEFGRiIsIkZJTkFOQ0UgQUNDT1VOVEFOVFMiLCJQSEFSTUFDWSBTVEFGRiIsIkFDQ09VTlRTIFNUQUZGIiwiTEFCIFJFQ0VQVElPTklTVCIsIkVSIE5VUlNFIiwiSU5QQVRJRU5UIEJJTExJTkcgU1VQRVJWSVNPUiIsIkxEUi1PUiBOVVJTRVMiLCJBRE1JU1NJT04gU1RBRkYiLCJIRUxQIERFU0sgQURNSU4iLCJBUFBST1ZBTCBTVEFGRiIsIklOUEFUSUVOVCBCSUxMSU5HIENPT1JESU5BVE9SIiwiQklMTElORyBTVEFGRiIsIkNPTlNFTlQgIiwiQ29uc2VudCAtIERlbnRhbCIsIldFQkVNUiJdLCJuYmYiOjE2MDgwMjg0NzQsImV4cCI6MTYwODg5MjQ3NCwiaWF0IjoxNjA4MDI4NDc0fQ.8OJcy6vUuPnNTi_qSjip8YCrFdaRLtJKbNKXcMtnQxk" }, ); } @@ -48,4 +48,5 @@ class DashboardService extends BaseService { }, ); } + } diff --git a/lib/core/service/home/scan_qr_service.dart b/lib/core/service/home/scan_qr_service.dart new file mode 100644 index 00000000..bc6c8820 --- /dev/null +++ b/lib/core/service/home/scan_qr_service.dart @@ -0,0 +1,41 @@ +import 'package:doctor_app_flutter/config/config.dart'; +import 'package:doctor_app_flutter/core/model/patient_muse/PatientSearchRequestModel.dart'; +import 'package:doctor_app_flutter/core/service/base/base_service.dart'; +import 'package:doctor_app_flutter/models/patient/patiant_info_model.dart'; + +class ScanQrService extends BaseService { + List myInPatientList = List(); + List inPatientList = List(); + + Future getInPatient(PatientSearchRequestModel requestModel, bool isMyInpatient) async { + hasError = false; + await getDoctorProfile(); + + if (isMyInpatient) { + requestModel.doctorID = doctorProfile.doctorID; + } else { + requestModel.doctorID = 0; + } + + await baseAppClient.post( + GET_PATIENT_IN_PATIENT_LIST, + onSuccess: (dynamic response, int statusCode) { + inPatientList.clear(); + myInPatientList.clear(); + + response['List_MyInPatient'].forEach((v) { + PatiantInformtion patient = PatiantInformtion.fromJson(v); + inPatientList.add(patient); + if (patient.doctorId == doctorProfile.doctorID) { + myInPatientList.add(patient); + } + }); + }, + onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + }, + body: requestModel.toJson(), + ); + } +} diff --git a/lib/core/service/patient/patient_service.dart b/lib/core/service/patient/patient_service.dart index e15cc8d1..25e9481b 100644 --- a/lib/core/service/patient/patient_service.dart +++ b/lib/core/service/patient/patient_service.dart @@ -4,6 +4,7 @@ import 'package:doctor_app_flutter/config/shared_pref_kay.dart'; import 'package:doctor_app_flutter/core/model/note/CreateNoteModel.dart'; import 'package:doctor_app_flutter/core/model/note/note_model.dart'; import 'package:doctor_app_flutter/core/model/note/update_note_model.dart'; +import 'package:doctor_app_flutter/core/model/patient_muse/PatientSearchRequestModel.dart'; import 'package:doctor_app_flutter/core/service/base/base_service.dart'; import 'package:doctor_app_flutter/models/doctor/doctor_profile_model.dart'; import 'package:doctor_app_flutter/models/patient/get_clinic_by_project_id_request.dart'; @@ -12,6 +13,7 @@ import 'package:doctor_app_flutter/models/patient/get_list_stp_referral_frequenc import 'package:doctor_app_flutter/models/patient/lab_orders/lab_orders_res_model.dart'; import 'package:doctor_app_flutter/models/patient/lab_result/lab_result.dart'; import 'package:doctor_app_flutter/models/patient/lab_result/lab_result_req_model.dart'; +import 'package:doctor_app_flutter/models/patient/patiant_info_model.dart'; import 'package:doctor_app_flutter/models/patient/prescription/prescription_report.dart'; import 'package:doctor_app_flutter/models/patient/prescription/prescription_report_for_in_patient.dart'; import 'package:doctor_app_flutter/models/patient/prescription/prescription_res_model.dart'; @@ -22,20 +24,19 @@ import 'package:doctor_app_flutter/models/patient/vital_sign/vital_sign_res_mode class PatientService extends BaseService { List _patientVitalSignList = []; List patientVitalSignOrderdSubList = []; + List inPatientList = List(); + List myInPatientList = List(); List get patientVitalSignList => _patientVitalSignList; List _patientLabResultOrdersList = []; - List get patientLabResultOrdersList => - _patientLabResultOrdersList; + List get patientLabResultOrdersList => _patientLabResultOrdersList; - List get patientPrescriptionsList => - _patientPrescriptionsList; + List get patientPrescriptionsList => _patientPrescriptionsList; List _patientPrescriptionsList = []; - List get prescriptionReportForInPatientList => - _prescriptionReportForInPatientList; + List get prescriptionReportForInPatientList => _prescriptionReportForInPatientList; List _prescriptionReportForInPatientList = []; List _patientRadiologyList = []; @@ -79,12 +80,9 @@ class PatientService extends BaseService { get referalFrequancyList => _referalFrequancyList; - DoctorsByClinicIdRequest _doctorsByClinicIdRequest = - DoctorsByClinicIdRequest(); - STPReferralFrequencyRequest _referralFrequencyRequest = - STPReferralFrequencyRequest(); - ClinicByProjectIdRequest _clinicByProjectIdRequest = - ClinicByProjectIdRequest(); + DoctorsByClinicIdRequest _doctorsByClinicIdRequest = DoctorsByClinicIdRequest(); + STPReferralFrequencyRequest _referralFrequencyRequest = STPReferralFrequencyRequest(); + ClinicByProjectIdRequest _clinicByProjectIdRequest = ClinicByProjectIdRequest(); ReferToDoctorRequest _referToDoctorRequest; Future getPatientList(patient, patientType, {isView}) async { @@ -138,6 +136,38 @@ class PatientService extends BaseService { return Future.value(localRes); } + Future getInPatient(PatientSearchRequestModel requestModel, bool isMyInpatient) async { + hasError = false; + await getDoctorProfile(); + + if (isMyInpatient) { + requestModel.doctorID = doctorProfile.doctorID; + } else { + requestModel.doctorID = 0; + } + + await baseAppClient.post( + GET_PATIENT_IN_PATIENT_LIST, + onSuccess: (dynamic response, int statusCode) { + inPatientList.clear(); + myInPatientList.clear(); + + response['List_MyInPatient'].forEach((v) { + PatiantInformtion patient = PatiantInformtion.fromJson(v); + inPatientList.add(patient); + if (patient.doctorId == doctorProfile.doctorID) { + myInPatientList.add(patient); + } + }); + }, + onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + }, + body: requestModel.toJson(), + ); + } + Future getLabResultOrders(patient) async { hasError = false; await baseAppClient.post( @@ -181,8 +211,7 @@ class PatientService extends BaseService { onSuccess: (dynamic response, int statusCode) { _prescriptionReportForInPatientList = []; response['List_PrescriptionReportForInPatient'].forEach((v) { - prescriptionReportForInPatientList - .add(PrescriptionReportForInPatient.fromJson(v)); + prescriptionReportForInPatientList.add(PrescriptionReportForInPatient.fromJson(v)); }); }, onFailure: (String error, int statusCode) { diff --git a/lib/core/service/special_clinics/special_clinic_service.dart b/lib/core/service/special_clinics/special_clinic_service.dart new file mode 100644 index 00000000..49237331 --- /dev/null +++ b/lib/core/service/special_clinics/special_clinic_service.dart @@ -0,0 +1,57 @@ +import 'package:doctor_app_flutter/config/config.dart'; +import 'package:doctor_app_flutter/core/service/base/base_service.dart'; +import 'package:doctor_app_flutter/models/dashboard/dashboard_model.dart'; +import 'package:doctor_app_flutter/models/dashboard/get_special_clinical_care_List_Respose_Model.dart'; +import 'package:doctor_app_flutter/models/dashboard/get_special_clinical_care_mapping_List_Respose_Model.dart'; + +class SpecialClinicsService extends BaseService { + + + List _specialClinicalCareList = []; + List get specialClinicalCareList => _specialClinicalCareList; + + List _specialClinicalCareMappingList = []; + List get specialClinicalCareMappingList => _specialClinicalCareMappingList; + Future getSpecialClinicalCareList() async { + hasError = false; + await baseAppClient.post( + GET_SPECIAL_CLINICAL_CARE_LIST, + onSuccess: (dynamic response, int statusCode) { + + _specialClinicalCareList.clear(); + response['List_SpecialClinicalCareList'].forEach((v) { + _specialClinicalCareList.add(GetSpecialClinicalCareListResponseModel.fromJson(v)); + });}, + onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + }, + body: { + }, + ); + } + + + Future getSpecialClinicalCareMappingList(int clinicId) async { + hasError = false; + await baseAppClient.post( + GET_SPECIAL_CLINICAL_CARE_MAPPING_LIST, + onSuccess: (dynamic response, int statusCode) { + + _specialClinicalCareMappingList.clear(); + response['List_SpecialClinicalCareMappingList'].forEach((v) { + _specialClinicalCareMappingList.add(GetSpecialClinicalCareMappingListResponseModel.fromJson(v)); + });}, + onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + }, + body: { + "ClinicID": clinicId, + "DoctorID":0, + "EditedBy":0 + }, + ); + } + +} diff --git a/lib/core/viewModel/PatientSearchViewModel.dart b/lib/core/viewModel/PatientSearchViewModel.dart index a0cd68d9..e0ee8948 100644 --- a/lib/core/viewModel/PatientSearchViewModel.dart +++ b/lib/core/viewModel/PatientSearchViewModel.dart @@ -4,6 +4,8 @@ import 'package:doctor_app_flutter/core/enum/viewstate.dart'; import 'package:doctor_app_flutter/core/model/patient_muse/PatientSearchRequestModel.dart'; import 'package:doctor_app_flutter/core/service/patient/out_patient_service.dart'; import 'package:doctor_app_flutter/core/service/patient/patientInPatientService.dart'; +import 'package:doctor_app_flutter/core/service/special_clinics/special_clinic_service.dart'; +import 'package:doctor_app_flutter/models/dashboard/get_special_clinical_care_mapping_List_Respose_Model.dart'; import 'package:doctor_app_flutter/models/patient/patiant_info_model.dart'; import 'package:doctor_app_flutter/util/date-utils.dart'; @@ -12,8 +14,10 @@ import 'base_view_model.dart'; class PatientSearchViewModel extends BaseViewModel { OutPatientService _outPatientService = locator(); + SpecialClinicsService _specialClinicsService = locator(); List get patientList => _outPatientService.patientList; + List get specialClinicalCareMappingList => _specialClinicsService.specialClinicalCareMappingList; List filterData = []; @@ -143,15 +147,22 @@ class PatientSearchViewModel extends BaseViewModel { List filteredInPatientItems = List(); Future getInPatientList(PatientSearchRequestModel requestModel, - {bool isMyInpatient = false}) async { + {bool isMyInpatient = false, bool isLocalBusy = false}) async { await getDoctorProfile(); - setState(ViewState.Busy); - + if(isLocalBusy) { + setState(ViewState.BusyLocal); + } else{ + setState(ViewState.Busy); + } if (inPatientList.length == 0) await _inPatientService.getInPatientList(requestModel, false); if (_inPatientService.hasError) { error = _inPatientService.error; + if(isLocalBusy) { + setState(ViewState.ErrorLocal); + } else{ setState(ViewState.Error); + } } else { // setDefaultInPatientList(); setState(ViewState.Idle); @@ -166,6 +177,9 @@ class PatientSearchViewModel extends BaseViewModel { setState(ViewState.Idle); } + + + void clearPatientList() { _inPatientService.inPatientList = []; _inPatientService.myInPatientList = []; @@ -195,4 +209,25 @@ class PatientSearchViewModel extends BaseViewModel { notifyListeners(); } } + + + getSpecialClinicalCareMappingList(clinicId, + {bool isLocalBusy = false}) async { + if (isLocalBusy) { + setState(ViewState.BusyLocal); + } else { + setState(ViewState.Busy); + } + await _specialClinicsService.getSpecialClinicalCareMappingList(clinicId); + if (_specialClinicsService.hasError) { + error = _specialClinicsService.error; + if (isLocalBusy) { + setState(ViewState.ErrorLocal); + } else { + setState(ViewState.Error); + } + } else { + setState(ViewState.Idle); + } + } } diff --git a/lib/core/viewModel/authentication_view_model.dart b/lib/core/viewModel/authentication_view_model.dart index 58df9331..e35de690 100644 --- a/lib/core/viewModel/authentication_view_model.dart +++ b/lib/core/viewModel/authentication_view_model.dart @@ -26,9 +26,7 @@ import 'package:doctor_app_flutter/root_page.dart'; import 'package:doctor_app_flutter/util/dr_app_toast_msg.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/transitions/fade_page.dart'; import 'package:firebase_messaging/firebase_messaging.dart'; -import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; import 'package:local_auth/auth_strings.dart'; import 'package:local_auth/local_auth.dart'; @@ -299,8 +297,7 @@ class AuthenticationViewModel extends BaseViewModel { clinicID: clinicInfo.clinicID, license: true, projectID: clinicInfo.projectID, - tokenID: '', - languageID: 2);//TODO change the lan + tokenID: '',);//TODO change the lan await _authService.getDoctorProfileBasedOnClinic(docInfo); if (_authService.hasError) { error = _authService.error; @@ -418,17 +415,17 @@ class AuthenticationViewModel extends BaseViewModel { /// logout function logout({bool isFromLogin = false}) async { - DEVICE_TOKEN = ""; - String lang = await sharedPref.getString(APP_Language); - await Helpers.clearSharedPref(); - doctorProfile = null; - sharedPref.setString(APP_Language, lang); - deleteUser(); - await getDeviceInfoFromFirebase(); - this.isFromLogin = isFromLogin; - app_status = APP_STATUS.UNAUTHENTICATED; - setState(ViewState.Idle); + String lang = await sharedPref.getString(APP_Language); + + await Helpers.clearSharedPref(); + doctorProfile = null; + sharedPref.setString(APP_Language, lang); + deleteUser(); + await getDeviceInfoFromFirebase(); + this.isFromLogin = isFromLogin; + app_status = APP_STATUS.UNAUTHENTICATED; + setState(ViewState.Idle); } deleteUser(){ diff --git a/lib/core/viewModel/dashboard_view_model.dart b/lib/core/viewModel/dashboard_view_model.dart index bbbef0b6..f35a4a2a 100644 --- a/lib/core/viewModel/dashboard_view_model.dart +++ b/lib/core/viewModel/dashboard_view_model.dart @@ -2,8 +2,10 @@ import 'package:doctor_app_flutter/config/config.dart'; import 'package:doctor_app_flutter/config/shared_pref_kay.dart'; import 'package:doctor_app_flutter/core/enum/viewstate.dart'; import 'package:doctor_app_flutter/core/service/home/dasboard_service.dart'; +import 'package:doctor_app_flutter/core/service/special_clinics/special_clinic_service.dart'; import 'package:doctor_app_flutter/core/viewModel/project_view_model.dart'; import 'package:doctor_app_flutter/models/dashboard/dashboard_model.dart'; +import 'package:doctor_app_flutter/models/dashboard/get_special_clinical_care_List_Respose_Model.dart'; import 'package:doctor_app_flutter/models/doctor/clinic_model.dart'; import 'package:doctor_app_flutter/models/doctor/profile_req_Model.dart'; import 'package:firebase_messaging/firebase_messaging.dart'; @@ -14,6 +16,7 @@ import 'base_view_model.dart'; class DashboardViewModel extends BaseViewModel { final FirebaseMessaging _firebaseMessaging = FirebaseMessaging(); DashboardService _dashboardService = locator(); + SpecialClinicsService _specialClinicsService = locator(); List get dashboardItemsList => _dashboardService.dashboardItemsList; @@ -22,6 +25,9 @@ class DashboardViewModel extends BaseViewModel { String get sServiceID => _dashboardService.sServiceID; + List get specialClinicalCareList => _specialClinicsService.specialClinicalCareList; + + Future setFirebaseNotification(ProjectViewModel projectsProvider, AuthenticationViewModel authProvider) async { setState(ViewState.Busy); @@ -64,6 +70,16 @@ class DashboardViewModel extends BaseViewModel { setState(ViewState.Idle); } + Future getSpecialClinicalCareList() async { + setState(ViewState.Busy); + await _specialClinicsService.getSpecialClinicalCareList(); + if (_specialClinicsService.hasError) { + error = _specialClinicsService.error; + setState(ViewState.Error); + } else + setState(ViewState.Idle); + } + Future changeClinic( int clinicId, AuthenticationViewModel authProvider) async { setState(ViewState.BusyLocal); @@ -85,4 +101,17 @@ class DashboardViewModel extends BaseViewModel { return value.toString(); } + + + GetSpecialClinicalCareListResponseModel getSpecialClinic(clinicId){ + GetSpecialClinicalCareListResponseModel special ; + specialClinicalCareList.forEach((element) { + if(element.clinicID == 1){ + special = element; + } + }); + + return special; + + } } diff --git a/lib/core/viewModel/patient_view_model.dart b/lib/core/viewModel/patient_view_model.dart index de40afde..5bc6250f 100644 --- a/lib/core/viewModel/patient_view_model.dart +++ b/lib/core/viewModel/patient_view_model.dart @@ -2,9 +2,11 @@ import 'package:doctor_app_flutter/core/enum/viewstate.dart'; import 'package:doctor_app_flutter/core/model/note/CreateNoteModel.dart'; import 'package:doctor_app_flutter/core/model/note/note_model.dart'; import 'package:doctor_app_flutter/core/model/note/update_note_model.dart'; +import 'package:doctor_app_flutter/core/model/patient_muse/PatientSearchRequestModel.dart'; import 'package:doctor_app_flutter/core/service/patient/patient_service.dart'; import 'package:doctor_app_flutter/models/patient/lab_orders/lab_orders_res_model.dart'; import 'package:doctor_app_flutter/models/patient/lab_result/lab_result.dart'; +import 'package:doctor_app_flutter/models/patient/patiant_info_model.dart'; import 'package:doctor_app_flutter/models/patient/prescription/prescription_report.dart'; import 'package:doctor_app_flutter/models/patient/prescription/prescription_report_for_in_patient.dart'; import 'package:doctor_app_flutter/models/patient/prescription/prescription_res_model.dart'; @@ -17,51 +19,43 @@ import 'base_view_model.dart'; class PatientViewModel extends BaseViewModel { PatientService _patientService = locator(); - List get patientVitalSignList => - _patientService.patientVitalSignList; + List get inPatientList => _patientService.inPatientList; - List get patientVitalSignOrderdSubList => - _patientService.patientVitalSignOrderdSubList; + List get patientVitalSignList => _patientService.patientVitalSignList; - List get patientLabResultOrdersList => - _patientService.patientLabResultOrdersList; + List get patientVitalSignOrderdSubList => _patientService.patientVitalSignOrderdSubList; - List get patientPrescriptionsList => - _patientService.patientPrescriptionsList; + List get patientLabResultOrdersList => _patientService.patientLabResultOrdersList; + + List get patientPrescriptionsList => _patientService.patientPrescriptionsList; List get prescriptionReportForInPatientList => _patientService.prescriptionReportForInPatientList; - List get prescriptionReport => - _patientService.prescriptionReport; + List get prescriptionReport => _patientService.prescriptionReport; - List get patientRadiologyList => - _patientService.patientRadiologyList; + List get patientRadiologyList => _patientService.patientRadiologyList; List get labResultList => _patientService.labResultList; get insuranceApporvalsList => _patientService.insuranceApporvalsList; - List get patientProgressNoteList => - _patientService.patientProgressNoteList; + List get patientProgressNoteList => _patientService.patientProgressNoteList; List get clinicsList => _patientService.clinicsList; List get doctorsList => _patientService.doctorsList; - List get referralFrequencyList => - _patientService.referalFrequancyList; + List get referralFrequencyList => _patientService.referalFrequancyList; - Future getPatientList(patient, patientType, - {bool isBusyLocal = false, isView}) async { + Future getPatientList(patient, patientType, {bool isBusyLocal = false, isView}) async { var localRes; if (isBusyLocal) { setState(ViewState.BusyLocal); } else { setState(ViewState.Busy); } - localRes = await _patientService.getPatientList(patient, patientType, - isView: isView); + localRes = await _patientService.getPatientList(patient, patientType, isView: isView); if (_patientService.hasError) { error = _patientService.error; @@ -210,16 +204,12 @@ class PatientViewModel extends BaseViewModel { } List getDoctorNameList() { - var doctorNamelist = _patientService.doctorsList - .map((value) => value['DoctorName'].toString()) - .toList(); + var doctorNamelist = _patientService.doctorsList.map((value) => value['DoctorName'].toString()).toList(); return doctorNamelist; } List getClinicNameList() { - var clinicsNameslist = _patientService.clinicsList - .map((value) => value['ClinicDescription'].toString()) - .toList(); + var clinicsNameslist = _patientService.clinicsList.map((value) => value['ClinicDescription'].toString()).toList(); return clinicsNameslist; } @@ -234,9 +224,8 @@ class PatientViewModel extends BaseViewModel { } List getReferralNamesList() { - var referralNamesList = _patientService.referalFrequancyList - .map((value) => value['Description'].toString()) - .toList(); + var referralNamesList = + _patientService.referalFrequancyList.map((value) => value['Description'].toString()).toList(); return referralNamesList; } @@ -281,4 +270,18 @@ class PatientViewModel extends BaseViewModel { } else setState(ViewState.Idle); } + + Future getInPatientList(PatientSearchRequestModel requestModel, {bool isMyInpatient = false}) async { + await getDoctorProfile(); + setState(ViewState.Busy); + + await _patientService.getInPatient(requestModel, false); + if (_patientService.hasError) { + error = _patientService.error; + setState(ViewState.ErrorLocal); + } else { + // setDefaultInPatientList(); + setState(ViewState.Idle); + } + } } diff --git a/lib/core/viewModel/scan_qr_view_model.dart b/lib/core/viewModel/scan_qr_view_model.dart new file mode 100644 index 00000000..ff934f79 --- /dev/null +++ b/lib/core/viewModel/scan_qr_view_model.dart @@ -0,0 +1,26 @@ +import 'package:doctor_app_flutter/core/enum/viewstate.dart'; +import 'package:doctor_app_flutter/core/model/patient_muse/PatientSearchRequestModel.dart'; +import 'package:doctor_app_flutter/core/service/home/scan_qr_service.dart'; +import 'package:doctor_app_flutter/core/viewModel/base_view_model.dart'; +import 'package:doctor_app_flutter/locator.dart'; +import 'package:doctor_app_flutter/models/patient/patiant_info_model.dart'; + +class ScanQrViewModel extends BaseViewModel { + ScanQrService _scanQrService = locator(); + List get inPatientList => _scanQrService.inPatientList; + + Future getInPatientList(PatientSearchRequestModel requestModel, {bool isMyInpatient = false}) async { + await getDoctorProfile(); + setState(ViewState.Busy); + + await _scanQrService.getInPatient(requestModel, false); + if (_scanQrService.hasError) { + error = _scanQrService.error; + + setState(ViewState.ErrorLocal); + } else { + // setDefaultInPatientList(); + setState(ViewState.Idle); + } + } +} diff --git a/lib/locator.dart b/lib/locator.dart index 1c491b54..1e4bcb4c 100644 --- a/lib/locator.dart +++ b/lib/locator.dart @@ -1,10 +1,12 @@ import 'package:doctor_app_flutter/core/service/authentication_service.dart'; +import 'package:doctor_app_flutter/core/service/home/scan_qr_service.dart'; import 'package:doctor_app_flutter/core/viewModel/dashboard_view_model.dart'; import 'package:doctor_app_flutter/core/viewModel/hospitals_view_model.dart'; import 'package:doctor_app_flutter/core/viewModel/medical_file_view_model.dart'; import 'package:doctor_app_flutter/core/viewModel/patient_view_model.dart'; import 'package:doctor_app_flutter/core/viewModel/prescription_view_model.dart'; import 'package:doctor_app_flutter/core/viewModel/procedure_View_model.dart'; +import 'package:doctor_app_flutter/core/viewModel/scan_qr_view_model.dart'; import 'package:doctor_app_flutter/core/viewModel/sick_leave_view_model.dart'; import 'package:get_it/get_it.dart'; @@ -37,6 +39,7 @@ import 'core/service/patient_medical_file/sick_leave/sickleave_service.dart'; import 'core/service/patient_medical_file/soap/SOAP_service.dart'; import 'core/service/patient_medical_file/ucaf/patient-ucaf-service.dart'; import 'core/service/patient_medical_file/vital_sign/patient-vital-signs-service.dart'; +import 'core/service/special_clinics/special_clinic_service.dart'; import 'core/viewModel/DischargedPatientViewModel.dart'; import 'core/viewModel/InsuranceViewModel.dart'; import 'core/viewModel/LiveCarePatientViewModel.dart'; @@ -91,6 +94,8 @@ void setupLocator() { locator.registerLazySingleton(() => PatientMedicalReportService()); locator.registerLazySingleton(() => LiveCarePatientServices()); locator.registerLazySingleton(() => NavigationService()); + locator.registerLazySingleton(() => ScanQrService()); + locator.registerLazySingleton(() => SpecialClinicsService()); /// View Model locator.registerFactory(() => DoctorReplayViewModel()); @@ -118,4 +123,5 @@ void setupLocator() { locator.registerFactory(() => HospitalViewModel()); locator.registerFactory(() => LiveCarePatientViewModel()); locator.registerFactory(() => PatientMedicalReportViewModel()); + locator.registerFactory(() => ScanQrViewModel()); } diff --git a/lib/models/dashboard/get_special_clinical_care_List_Respose_Model.dart b/lib/models/dashboard/get_special_clinical_care_List_Respose_Model.dart new file mode 100644 index 00000000..ec19abb0 --- /dev/null +++ b/lib/models/dashboard/get_special_clinical_care_List_Respose_Model.dart @@ -0,0 +1,32 @@ +class GetSpecialClinicalCareListResponseModel { + int projectID; + int clinicID; + String clinicDescription; + String clinicDescriptionN; + bool isActive; + + GetSpecialClinicalCareListResponseModel( + {this.projectID, + this.clinicID, + this.clinicDescription, + this.clinicDescriptionN, + this.isActive}); + + GetSpecialClinicalCareListResponseModel.fromJson(Map json) { + projectID = json['ProjectID']; + clinicID = json['ClinicID']; + clinicDescription = json['ClinicDescription']; + clinicDescriptionN = json['ClinicDescriptionN']; + isActive = json['IsActive']; + } + + Map toJson() { + final Map data = new Map(); + data['ProjectID'] = this.projectID; + data['ClinicID'] = this.clinicID; + data['ClinicDescription'] = this.clinicDescription; + data['ClinicDescriptionN'] = this.clinicDescriptionN; + data['IsActive'] = this.isActive; + return data; + } +} diff --git a/lib/models/dashboard/get_special_clinical_care_mapping_List_Respose_Model.dart b/lib/models/dashboard/get_special_clinical_care_mapping_List_Respose_Model.dart new file mode 100644 index 00000000..287f40f1 --- /dev/null +++ b/lib/models/dashboard/get_special_clinical_care_mapping_List_Respose_Model.dart @@ -0,0 +1,37 @@ +class GetSpecialClinicalCareMappingListResponseModel { + int mappingProjectID; + int clinicID; + int nursingStationID; + bool isActive; + int projectID; + String description; + + GetSpecialClinicalCareMappingListResponseModel( + {this.mappingProjectID, + this.clinicID, + this.nursingStationID, + this.isActive, + this.projectID, + this.description}); + + GetSpecialClinicalCareMappingListResponseModel.fromJson( + Map json) { + mappingProjectID = json['MappingProjectID']; + clinicID = json['ClinicID']; + nursingStationID = json['NursingStationID']; + isActive = json['IsActive']; + projectID = json['ProjectID']; + description = json['Description']; + } + + Map toJson() { + final Map data = new Map(); + data['MappingProjectID'] = this.mappingProjectID; + data['ClinicID'] = this.clinicID; + data['NursingStationID'] = this.nursingStationID; + data['IsActive'] = this.isActive; + data['ProjectID'] = this.projectID; + data['Description'] = this.description; + return data; + } +} diff --git a/lib/root_page.dart b/lib/root_page.dart index 35a3fa44..c87eb373 100644 --- a/lib/root_page.dart +++ b/lib/root_page.dart @@ -13,8 +13,11 @@ import 'landing_page.dart'; class RootPage extends StatelessWidget { @override Widget build(BuildContext context) { + + AuthenticationViewModel authenticationViewModel = Provider.of(context); Widget buildRoot() { + switch (authenticationViewModel.status) { case APP_STATUS.LOADING: return Scaffold( diff --git a/lib/screens/auth/login_screen.dart b/lib/screens/auth/login_screen.dart index 9563b29c..909bdb0b 100644 --- a/lib/screens/auth/login_screen.dart +++ b/lib/screens/auth/login_screen.dart @@ -2,21 +2,17 @@ import 'package:doctor_app_flutter/config/size_config.dart'; import 'package:doctor_app_flutter/core/enum/viewstate.dart'; import 'package:doctor_app_flutter/core/model/hospitals/get_hospitals_response_model.dart'; import 'package:doctor_app_flutter/core/viewModel/authentication_view_model.dart'; -import 'package:doctor_app_flutter/screens/auth/verification_methods_screen.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/buttons/app_buttons_widget.dart'; import 'package:doctor_app_flutter/widgets/shared/loader/gif_loader_dialog_utils.dart'; import 'package:doctor_app_flutter/widgets/shared/text_fields/app-textfield-custom.dart'; -import 'package:doctor_app_flutter/widgets/shared/text_fields/app_text_form_field.dart'; import 'package:flutter/material.dart'; import 'package:hexcolor/hexcolor.dart'; import 'package:provider/provider.dart'; import '../../widgets/shared/app_scaffold_widget.dart'; - class LoginScreen extends StatefulWidget { @override _LoginScreenState createState() => _LoginScreenState(); @@ -26,7 +22,6 @@ class _LoginScreenState extends State { String platformImei; bool allowCallApi = true; - //TODO change AppTextFormField to AppTextFormFieldCustom final loginFormKey = GlobalKey(); var projectIdController = TextEditingController(); var userIdController = TextEditingController(); @@ -39,217 +34,164 @@ class _LoginScreenState extends State { @override Widget build(BuildContext context) { authenticationViewModel = Provider.of(context); + double textFieldHeight = SizeConfig.heightMultiplier * (SizeConfig.isHeightVeryShort ?10:SizeConfig.isHeightShort?8:6); return AppScaffold( isShowAppBar: false, backgroundColor: HexColor('#F8F8F8'), - body: SafeArea( - child: ListView(children: [ - Container( + body: SingleChildScrollView( + child: SafeArea( + child: Container( margin: EdgeInsetsDirectional.fromSTEB(30, 0, 30, 30), alignment: Alignment.topLeft, child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - //TODO Use App Text rather than text - Container( - - child: Column( - crossAxisAlignment: CrossAxisAlignment - .start, - children: [ - Column( - crossAxisAlignment: CrossAxisAlignment - .start, - children: [ - SizedBox( - height: 30, - ), - ], - ), - Column( - crossAxisAlignment: CrossAxisAlignment - .start, children: [ - SizedBox( - height: 10, - ), - Text( - TranslationBase - .of(context) - .welcomeTo, - style: TextStyle( - fontSize: 16, - fontWeight: FontWeight - .w600, - fontFamily: 'Poppins'), - ), - Text( - TranslationBase - .of(context) - .drSulaimanAlHabib, - style: TextStyle( - color:Color(0xFF2B353E), - fontWeight: FontWeight - .bold, - fontSize: SizeConfig - .isMobile - ? 24 - : SizeConfig - .realScreenWidth * - 0.029, - fontFamily: 'Poppins'), - ), - - Text( - "Doctor App", - style: TextStyle( - fontSize: - SizeConfig.isMobile - ? 16 - : SizeConfig - .realScreenWidth * - 0.030, - fontWeight: FontWeight - .w600, - color: Color(0xFFD02127)), - ), - ]), - ], - )), - SizedBox( - height: 40, - ), - Form( - key: loginFormKey, - child: Column( - mainAxisAlignment: MainAxisAlignment - .spaceBetween, - children: [ - Container( - width: SizeConfig - .realScreenWidth * 0.90, - height: SizeConfig - .realScreenHeight * 0.65, - child: - Column( - crossAxisAlignment: CrossAxisAlignment - .start, children: [ - - buildSizedBox(), - AppTextFieldCustom( - hintText: TranslationBase.of(context).enterId, - hasBorder: true, - controller: userIdController, - onChanged: (value){ - if (value != null) - setState(() { - authenticationViewModel.userInfo - .userID = - value - .trim(); - }); - }, - ), - buildSizedBox(), - AppTextFieldCustom( - hintText: TranslationBase.of(context).enterPassword, - hasBorder: true, - isSecure: true, - controller: passwordController, - onChanged: (value){ - if (value != null) - setState(() { - authenticationViewModel.userInfo - .password = - value - .trim(); - }); - // if(allowCallApi) { - this.getProjects( - authenticationViewModel.userInfo - .userID); - // setState(() { - // allowCallApi = false; - // }); - // } - }, - onClick: (){ - - }, - ), - buildSizedBox(), - AppTextFieldCustom( - hintText: TranslationBase.of(context).selectYourProject, - hasBorder: true, - controller: projectIdController, - isTextFieldHasSuffix: true, - enabled: false, - onClick: (){ - Helpers - .showCupertinoPicker( - context, - projectsList, - 'facilityName', - onSelectProject, - authenticationViewModel); - }, - - - ), - buildSizedBox() - ]), - ), - ], + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + //TODO Use App Text rather than text + Container( + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + SizedBox( + height: 10, + ), + Text( + TranslationBase.of(context).welcomeTo, + style: TextStyle( + fontSize: SizeConfig + .getTextMultiplierBasedOnWidth() * + 4, + fontWeight: FontWeight.w600, + fontFamily: 'Poppins'), + ), + Text( + TranslationBase.of(context).drSulaimanAlHabib, + style: TextStyle( + color: Color(0xFF2B353E), + fontWeight: FontWeight.bold, + fontSize: SizeConfig + .getTextMultiplierBasedOnWidth() * + 6, + fontFamily: 'Poppins'), + ), + Text( + "Doctor App", + style: TextStyle( + fontSize: SizeConfig + .getTextMultiplierBasedOnWidth() * + 4, + fontWeight: FontWeight.w600, + color: Color(0xFFD02127)), + ), + ])), + SizedBox( + height: 40, + ), + Form( + key: loginFormKey, + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + buildSizedBox(), + AppTextFieldCustom( + height: textFieldHeight, + hintText: TranslationBase.of(context).enterId, + hasBorder: true, + controller: userIdController, + onChanged: (value) { + if (value != null) + setState(() { + authenticationViewModel.userInfo.userID = + value.trim(); + }); + }, + ), + buildSizedBox(), + AppTextFieldCustom( + height: textFieldHeight, + hintText: TranslationBase.of(context).enterPassword, + hasBorder: true, + isSecure: true, + controller: passwordController, + onChanged: (value) { + if (value != null) + setState(() { + authenticationViewModel.userInfo.password = + value.trim(); + }); + this.getProjects( + authenticationViewModel.userInfo.userID); + }, + onClick: () {}, + ), + buildSizedBox(), + AppTextFieldCustom( + height: textFieldHeight, + hintText: + TranslationBase.of(context).selectYourProject, + hasBorder: true, + controller: projectIdController, + isTextFieldHasSuffix: true, + enabled: false, + onClick: projectsList.isEmpty== null ? null:() { + Helpers.showCupertinoPicker( + context, + projectsList, + 'facilityName', + onSelectProject, + authenticationViewModel); + }, ), - ) - ], - ) - ])) - ]), + buildSizedBox(), + ]), + ), + SizedBox( + height: 40, + ), + ], + )), + ), ), bottomSheet: Container( - - height: 90, + // color: Colors.green, + height: SizeConfig.heightMultiplier * 10, width: double.infinity, child: Center( child: FractionallySizedBox( widthFactor: 0.9, child: Column( - mainAxisAlignment: MainAxisAlignment.end, + mainAxisAlignment: MainAxisAlignment.center, children: [ AppButton( - title: TranslationBase - .of(context) - .login, + height: SizeConfig.heightMultiplier * + (SizeConfig.isHeightVeryShort ? 8 : 6), + hPadding: 1, + title: TranslationBase.of(context).login, color: Color(0xFFD02127), fontWeight: FontWeight.w700, - disabled: authenticationViewModel.userInfo - .userID == null || - authenticationViewModel.userInfo - .password == - null, + disabled: authenticationViewModel.userInfo.userID == null || + authenticationViewModel.userInfo.password == null, onPressed: () { login(context); }, ), - SizedBox(height: 25,) ], ), ), - ),), + ), + ), ); } SizedBox buildSizedBox() { return SizedBox( - height: 20, + height: SizeConfig.heightMultiplier * 2, ); } - login(context,) async { + login( + context, + ) async { if (loginFormKey.currentState.validate()) { loginFormKey.currentState.save(); GifLoaderDialogUtils.showMyDialog(context); @@ -259,38 +201,32 @@ class _LoginScreenState extends State { Helpers.showErrorToast(authenticationViewModel.error); } else { GifLoaderDialogUtils.hideDialog(context); - authenticationViewModel.setUnverified(true,isFromLogin: true); - // Navigator.of(context).pushReplacement( - // MaterialPageRoute( - // builder: (BuildContext context) => - // VerificationMethodsScreen( - // password: authenticationViewModel.userInfo.password, - // isFromLogin: true, - // ), - // ), - // ); + authenticationViewModel.setUnverified(true, isFromLogin: true); } } } onSelectProject(index) { setState(() { - authenticationViewModel.userInfo.projectID = projectsList[index].facilityId; + authenticationViewModel.userInfo.projectID = + projectsList[index].facilityId; projectIdController.text = projectsList[index].facilityName; }); primaryFocus.unfocus(); } - String memberID =""; - getProjects(memberID)async { + + String memberID = ""; + getProjects(memberID) async { if (memberID != null && memberID != '') { - if (this.memberID !=memberID) { + if (this.memberID != memberID) { this.memberID = memberID; await authenticationViewModel.getHospitalsList(memberID); - if(authenticationViewModel.state == ViewState.Idle) { + if (authenticationViewModel.state == ViewState.Idle) { projectsList = authenticationViewModel.hospitals; setState(() { - authenticationViewModel.userInfo.projectID = projectsList[0].facilityId; + authenticationViewModel.userInfo.projectID = + projectsList[0].facilityId; projectIdController.text = projectsList[0].facilityName; }); } diff --git a/lib/screens/auth/verification_methods_screen.dart b/lib/screens/auth/verification_methods_screen.dart index 69d4a47a..f3d201b3 100644 --- a/lib/screens/auth/verification_methods_screen.dart +++ b/lib/screens/auth/verification_methods_screen.dart @@ -1,6 +1,5 @@ import 'dart:io' show Platform; -import 'package:doctor_app_flutter/config/config.dart'; import 'package:doctor_app_flutter/config/shared_pref_kay.dart'; import 'package:doctor_app_flutter/core/enum/auth_method_types.dart'; import 'package:doctor_app_flutter/core/enum/viewstate.dart'; @@ -13,21 +12,15 @@ import 'package:doctor_app_flutter/widgets/shared/app_loader_widget.dart'; import 'package:doctor_app_flutter/widgets/shared/app_scaffold_widget.dart'; import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart'; import 'package:doctor_app_flutter/widgets/shared/buttons/app_buttons_widget.dart'; -import 'package:doctor_app_flutter/widgets/shared/buttons/secondary_button.dart'; import 'package:doctor_app_flutter/widgets/shared/loader/gif_loader_dialog_utils.dart'; -import 'package:doctor_app_flutter/widgets/transitions/fade_page.dart'; import 'package:flutter/material.dart'; import 'package:hexcolor/hexcolor.dart'; import 'package:provider/provider.dart'; import '../../config/size_config.dart'; -import '../../landing_page.dart'; -import '../../root_page.dart'; -import '../../routes.dart'; import '../../util/dr_app_shared_pref.dart'; import '../../util/helpers.dart'; import '../../widgets/auth/verification_methods_list.dart'; -import 'login_screen.dart'; DrAppSharedPreferances sharedPref = new DrAppSharedPreferances(); Helpers helpers = Helpers(); @@ -67,264 +60,260 @@ class _VerificationMethodsScreenState extends State { body: SingleChildScrollView( child: Center( child: FractionallySizedBox( - child: Container( - 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( + widthFactor: 0.9, + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + SizedBox( + height: SizeConfig.heightMultiplier * (SizeConfig.isHeightVeryShort?6:4), + ), + if(authenticationViewModel.isFromLogin) + InkWell( + onTap: (){ + authenticationViewModel.setUnverified(false,isFromLogin: false); + authenticationViewModel.setAppStatus(APP_STATUS.UNAUTHENTICATED); + }, + child: Icon(Icons.arrow_back_ios,color: Color(0xFF2B353E),) + + ), + Column( + children: [ + SizedBox( + height: SizeConfig.heightMultiplier*(SizeConfig.isHeightVeryShort?3:4), + ), + authenticationViewModel.user != null && isMoreOption == false + ? Column( + mainAxisAlignment: + MainAxisAlignment.spaceEvenly, + crossAxisAlignment: CrossAxisAlignment.start, children: [ + + AppText( + TranslationBase.of(context).welcomeBack, + fontSize:SizeConfig.getTextMultiplierBasedOnWidth()*4, + fontWeight: FontWeight.w700, + color: Color(0xFF2B353E), + ), + AppText( + Helpers.capitalize(authenticationViewModel.user.doctorName), + fontSize: SizeConfig.getTextMultiplierBasedOnWidth()*6, + color: Color(0xFF2B353E), + fontWeight: FontWeight.bold, + ), SizedBox( - height: 20, + height: SizeConfig.heightMultiplier*4, ), - 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, + AppText( + TranslationBase.of(context).accountInfo , + fontSize: SizeConfig.getTextMultiplierBasedOnWidth()*5, + color: Color(0xFF2E303A), + fontWeight: FontWeight.w600, + ), + SizedBox( + height: SizeConfig.heightMultiplier*4 + ), + Container( + padding: EdgeInsets.all(15), + decoration: BoxDecoration( + color: Colors.white, + borderRadius: BorderRadius.all( + Radius.circular(10), ), - 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,), - + border: Border.all( + color: HexColor('#707070'), + width: 0.1), + ), + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Container( + width: SizeConfig.realScreenWidth * .5, + padding: EdgeInsets.all(0), + child: Column( + mainAxisAlignment: MainAxisAlignment.start, + children: [ + Text( + TranslationBase.of(context) + .lastLoginAt, + overflow: TextOverflow.ellipsis, + style: TextStyle( + fontFamily: 'Poppins', + fontSize: SizeConfig + .getTextMultiplierBasedOnWidth() * + 4.5, + color: Color(0xFF2E303A), + fontWeight: FontWeight.w700, + ), + ), + Container( + width: MediaQuery.of(context) + .size + .width * + 0.55, + child: RichText( + text: TextSpan( + text: TranslationBase.of(context).verifyWith, + style: TextStyle( + color: Color(0xFF2B353E), + fontWeight: FontWeight.w600, + fontSize: SizeConfig + .getTextMultiplierBasedOnWidth() * + 4.5, + fontFamily: 'Poppins', + ), + children: [ + TextSpan( + text: authenticationViewModel + .getType( + authenticationViewModel + .user + .logInTypeID, + context), + style: TextStyle( + color: + Color(0xFF2B353E), + fontSize: SizeConfig + .getTextMultiplierBasedOnWidth() * + 4.5, + fontFamily: 'Poppins', + fontWeight: + FontWeight.w700, + ), + ) + ]), + ), + ), + ], + crossAxisAlignment: + CrossAxisAlignment.start, + ), ), - Row( + Column( + mainAxisAlignment: MainAxisAlignment.start, + 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, - ), - Row( - children: [ - AppText( - "Please Verify", - fontSize: 16, - color: Color(0xFF2B353E), - + 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: SizeConfig.getTextMultiplierBasedOnWidth() *4.5, + 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: SizeConfig.getTextMultiplierBasedOnWidth() *4.5, + fontWeight: FontWeight.w600, + color: Color(0xFF575757), + ) ], - ) + crossAxisAlignment: CrossAxisAlignment.start, + + ) + ], + ), + ), + SizedBox( + height: SizeConfig.heightMultiplier*3, + ), + + Row( + children: [ + + //todo add translation + AppText( + "Please Verify", + fontSize: SizeConfig.getTextMultiplierBasedOnWidth() * 5, + 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( + ), + SizedBox( + height: SizeConfig.heightMultiplier*2, + ), + ], + ) + : 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: SizeConfig.getTextMultiplierBasedOnWidth()* 4 , + color: Color(0xFF2E303A), + fontWeight: FontWeight.bold, + textAlign: TextAlign.left, + ), + ) + : AppText( + TranslationBase.of(context) + .verifyFingerprint2, + fontSize: + SizeConfig.getTextMultiplierBasedOnWidth()* 4, + 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: - AuthMethodTypes.Fingerprint, + authMethodType: SelectedAuthMethodTypesService + .getMethodsTypeService( + authenticationViewModel.user + .logInTypeID), authenticateUser: (AuthMethodTypes authMethodType, @@ -333,93 +322,124 @@ class _VerificationMethodsScreenState extends State { 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), - )) - ], - ), - ]), - - // ) - ], - ), - ), - ], - ), + ), + 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: 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), + )) + ], + ), + ]), + + // ) + ], + ), + ], ), ), ), ), bottomSheet: authenticationViewModel.user == null ? SizedBox(height: 0,) : Container( - height: 90, + // color: Colors.green, + height: SizeConfig.heightMultiplier * 10 , width: double.infinity, child: Center( child: FractionallySizedBox( widthFactor: 0.9, child: Column( - mainAxisAlignment: MainAxisAlignment.end, + mainAxisAlignment: MainAxisAlignment.center, children: [ - SecondaryButton( - label: TranslationBase + AppButton( + title: TranslationBase .of(context) .useAnotherAccount, color: Color(0xFFD02127), - //fontWeight: FontWeight.w700, - onTap: () { + + fontWeight: FontWeight.w700, + height: SizeConfig.heightMultiplier * (SizeConfig.isHeightVeryShort? 8 : 6), + hPadding: 1, + + onPressed: () { authenticationViewModel.deleteUser(); authenticationViewModel.setAppStatus(APP_STATUS.UNAUTHENTICATED); - // Navigator.pushAndRemoveUntil( - // AppGlobal.CONTEX, - // FadePage( - // page: RootPage(), - // ), - // (r) => false); - // Navigator.of(context).pushNamed(LOGIN); }, ), - SizedBox(height: 25,) ], ), ), diff --git a/lib/screens/home/dashboard_referral_patient.dart b/lib/screens/home/dashboard_referral_patient.dart new file mode 100644 index 00000000..0b9e6765 --- /dev/null +++ b/lib/screens/home/dashboard_referral_patient.dart @@ -0,0 +1,195 @@ + +import 'package:charts_flutter/flutter.dart' as charts; +import 'package:doctor_app_flutter/config/size_config.dart'; +import 'package:doctor_app_flutter/core/viewModel/dashboard_view_model.dart'; +import 'package:doctor_app_flutter/models/dashboard/dashboard_model.dart'; +import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; +import 'package:doctor_app_flutter/widgets/dashboard/guage_chart.dart'; +import 'package:doctor_app_flutter/widgets/dashboard/row_count.dart'; +import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart'; +import 'package:doctor_app_flutter/widgets/shared/rounded_container_widget.dart'; +import 'package:flutter/material.dart'; + +import 'label.dart'; + +class DashboardReferralPatient extends StatelessWidget { + final List dashboardItemList; + final double height; + final DashboardViewModel model; + + const DashboardReferralPatient({Key key, this.dashboardItemList, this.height, this.model}) : super(key: key); + @override + Widget build(BuildContext context) { + return RoundedContainer( + raduis: 16, + showBorder: false, + borderColor: Colors.white, + shadowWidth: 0.2, + shadowSpreadRadius: 3, + shadowDy: 1, + margin: EdgeInsets.only(top: 15, bottom: 15, left: 10, right: 10), + child: + Column( + crossAxisAlignment: CrossAxisAlignment.start, + mainAxisAlignment: MainAxisAlignment.start, + + children: [ + Expanded( + flex: 1, + child: Row( + crossAxisAlignment: CrossAxisAlignment.start, + + children: [ + Expanded( + flex: 4, + child: Padding( + padding: const EdgeInsets.all(5.0), + child: Column( + mainAxisAlignment: MainAxisAlignment.start, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Padding( + padding: EdgeInsets.all(8), + child: Column( + mainAxisAlignment: + MainAxisAlignment.center, + crossAxisAlignment: + CrossAxisAlignment.start, + children: [ + SizedBox( + height: SizeConfig + .getHeightMultiplier( + height: height) * + (SizeConfig.isHeightVeryShort + ? 3 + : SizeConfig.isHeightShort + ? 2 + : 2) + ), + Label(firstLine: TranslationBase + .of(context) + .patients, + secondLine: TranslationBase + .of(context) + .referral, + color: Color(0xFF2B353E), + secondLineFontSize: SizeConfig + .getHeightMultiplier( + height: height) * + (SizeConfig.isHeightVeryShort + ? 5 + : SizeConfig.isHeightShort + ? 7 + : 12),), + + SizedBox( + height: SizeConfig + .getHeightMultiplier( + height: height) * + (SizeConfig.isHeightVeryShort + ? 5 + : SizeConfig.isHeightShort + ? 10 + : 5) + ) + ], + ),), + Expanded( + flex: 1, + child: Column( + mainAxisAlignment: MainAxisAlignment.start, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + RowCounts( + dashboardItemList[2] + .summaryoptions[0] + .kPIParameter, + dashboardItemList[2] + .summaryoptions[0] + .value, + Colors.black, height: height,), + RowCounts( + dashboardItemList[2] + .summaryoptions[1] + .kPIParameter, + dashboardItemList[2] + .summaryoptions[1] + .value, + Colors.grey, height: height,), + RowCounts( + + dashboardItemList[2] + .summaryoptions[2] + .kPIParameter, + dashboardItemList[2] + .summaryoptions[2] + .value, + Colors.red, height: height,), + ], + ), + ) + ], + )), + ), + Expanded( + flex: 3, + child: Stack(children: [ + Container( + padding:EdgeInsets.all(0), + + child: GaugeChart( + _createReferralData(dashboardItemList))), + Positioned( + child: Column( + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + AppText( + model + .getPatientCount(dashboardItemList[2]) + .toString(), + fontSize: SizeConfig.textMultiplier * 3.0, + fontWeight: FontWeight.bold, + ) + ], + ), + top: height * (SizeConfig.isHeightVeryShort?0.35:0.40), + left: 0, + right: 0) + ]), + ), + ], + )), + ])); + } + static List> _createReferralData(List dashboardItemList) { + final data = [ + new GaugeSegment( + dashboardItemList[2].summaryoptions[0].kPIParameter, + getValue(dashboardItemList[1].summaryoptions[0].value), + charts.MaterialPalette.black), + new GaugeSegment( + dashboardItemList[2].summaryoptions[1].kPIParameter, + getValue(dashboardItemList[1].summaryoptions[1].value), + charts.MaterialPalette.gray.shadeDefault), + new GaugeSegment( + dashboardItemList[2].summaryoptions[2].kPIParameter, + getValue(dashboardItemList[1].summaryoptions[2].value), + charts.MaterialPalette.red.shadeDefault), + ]; + + return [ + new charts.Series( + id: 'Segments', + domainFn: (GaugeSegment segment, _) => segment.segment, + measureFn: (GaugeSegment segment, _) => segment.size, + data: data, + colorFn: (GaugeSegment segment, _) => segment.color, + ) + ]; + } + + static int getValue(value) { + return value == 0 ? 1 : value; + } + +} \ No newline at end of file diff --git a/lib/screens/home/dashboard_slider-item-widget.dart b/lib/screens/home/dashboard_slider-item-widget.dart index 4b7c4f46..d49b2bb4 100644 --- a/lib/screens/home/dashboard_slider-item-widget.dart +++ b/lib/screens/home/dashboard_slider-item-widget.dart @@ -1,9 +1,11 @@ import 'package:doctor_app_flutter/config/size_config.dart'; import 'package:doctor_app_flutter/models/dashboard/dashboard_model.dart'; -import 'package:doctor_app_flutter/widgets/dashboard/activity_button.dart'; -import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart'; +import 'package:doctor_app_flutter/util/helpers.dart'; +import 'package:doctor_app_flutter/widgets/dashboard/activity_card.dart'; import 'package:flutter/material.dart'; +import 'label.dart'; + class DashboardSliderItemWidget extends StatelessWidget { final DashboardModel item; @@ -13,23 +15,23 @@ class DashboardSliderItemWidget extends StatelessWidget { Widget build(BuildContext context) { return Column( children: [ - Row( + Row( mainAxisAlignment: MainAxisAlignment.start, children: [ - AppText( - item.kPIName, - fontSize: SizeConfig.textMultiplier * 2.2, - fontWeight: FontWeight.bold, - ), + Label(firstLine:Helpers.getLabelFromKPI(item.kPIName) ,secondLine:Helpers.getNameFromKPI(item.kPIName), ), + ], ), - new Container( - height: 110, + + + + new Container( + height: SizeConfig.heightMultiplier* (SizeConfig.isHeightVeryShort?16:SizeConfig.isHeightShort?14:SizeConfig.isHeightLarge?15:13), child: ListView( scrollDirection: Axis.horizontal, children: List.generate(item.summaryoptions.length, (int index) { - return GetActivityButton(item.summaryoptions[index]); + return GetActivityCard(item.summaryoptions[index]); }))) ], ); diff --git a/lib/screens/home/dashboard_swipe_widget.dart b/lib/screens/home/dashboard_swipe_widget.dart index de5cc05f..8d90885f 100644 --- a/lib/screens/home/dashboard_swipe_widget.dart +++ b/lib/screens/home/dashboard_swipe_widget.dart @@ -1,16 +1,13 @@ import 'package:doctor_app_flutter/config/size_config.dart'; import 'package:doctor_app_flutter/core/viewModel/dashboard_view_model.dart'; import 'package:doctor_app_flutter/models/dashboard/dashboard_model.dart'; -import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; -import 'package:doctor_app_flutter/widgets/dashboard/guage_chart.dart'; import 'package:doctor_app_flutter/widgets/dashboard/out_patient_stack.dart'; -import 'package:doctor_app_flutter/widgets/dashboard/row_count.dart'; import 'package:doctor_app_flutter/widgets/dashboard/swiper_rounded_pagination.dart'; -import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart'; import 'package:doctor_app_flutter/widgets/shared/rounded_container_widget.dart'; import 'package:flutter/material.dart'; import 'package:flutter_swiper/flutter_swiper.dart'; -import 'package:charts_flutter/flutter.dart' as charts; + +import 'dashboard_referral_patient.dart'; class DashboardSwipeWidget extends StatefulWidget { final List dashboardItemList; @@ -28,8 +25,10 @@ class _DashboardSwipeWidgetState extends State { @override Widget build(BuildContext context) { + double height = SizeConfig.heightMultiplier * + (SizeConfig.isHeightVeryShort ? 40 : SizeConfig.isHeightLarge?33:31); return Container( - height: MediaQuery.of(context).size.height * 0.35, + height: height, // height: 230, child: Swiper( onIndexChanged: (index) { @@ -41,42 +40,41 @@ class _DashboardSwipeWidgetState extends State { } }, itemBuilder: (BuildContext context, int index) { - return getSwipeWidget(widget.dashboardItemList, index); + return getSwipeWidget(widget.dashboardItemList, index, height); }, itemCount: 3, - // itemHeight: 300, pagination: new SwiperCustomPagination( builder: (BuildContext context, SwiperPluginConfig config) { - return new Stack( - alignment: Alignment.bottomCenter, - children: [ - Positioned( - bottom: 0, - child: Center( - child: InkWell( - onTap: () {}, - child: Container( - child: Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - config.activeIndex == 0 - ? SwiperRoundedPagination(true) - : SwiperRoundedPagination(false), - config.activeIndex == 1 - ? SwiperRoundedPagination(true) - : SwiperRoundedPagination(false), - config.activeIndex == 2 - ? SwiperRoundedPagination(true) - : SwiperRoundedPagination(false), - ], + return new Stack( + alignment: Alignment.bottomCenter, + children: [ + Positioned( + bottom: 0, + child: Center( + child: InkWell( + onTap: () {}, + child: Container( + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + config.activeIndex == 0 + ? SwiperRoundedPagination(true) + : SwiperRoundedPagination(false), + config.activeIndex == 1 + ? SwiperRoundedPagination(true) + : SwiperRoundedPagination(false), + config.activeIndex == 2 + ? SwiperRoundedPagination(true) + : SwiperRoundedPagination(false), + ], + ), + ), ), ), - ), - ), - ) - ], - ); - }), + ) + ], + ); + }), viewportFraction: 0.9, // scale: 0.9, // control: new SwiperControl(), @@ -84,23 +82,27 @@ class _DashboardSwipeWidgetState extends State { ); } - Widget getSwipeWidget(List dashboardItemList, int index) { + Widget getSwipeWidget(List dashboardItemList, int index, double height) { if (index == 1) return RoundedContainer( - raduis: 16, - showBorder: true, - borderColor: Colors.white, - shadowWidth: 0.2, - shadowSpreadRadius: 3, - shadowDy: 1, - margin: EdgeInsets.only(top: 15, bottom: 15, left: 10, right: 10), - child: Padding( - padding: const EdgeInsets.all(5.0), - child: GetOutPatientStack(dashboardItemList[1]))); + raduis: 16, + showBorder: false, + borderColor: Colors.white, + shadowWidth: 0.2, + shadowSpreadRadius: 3, + shadowDy: 1, + margin: EdgeInsets.only(top: 15, bottom: 15, left: 10, right: 10), + child: Padding( + padding: const EdgeInsets.all(5.0), + child: GetOutPatientStack( + dashboardItemList[1], + ), + ), + ); if (index == 0) return RoundedContainer( raduis: 16, - showBorder: true, + showBorder: false, borderColor: Colors.white, shadowWidth: 0.2, shadowSpreadRadius: 3, @@ -110,152 +112,12 @@ class _DashboardSwipeWidgetState extends State { padding: const EdgeInsets.all(5.0), child: GetOutPatientStack(dashboardItemList[0]))); if (index == 2) - return RoundedContainer( - raduis: 16, - showBorder: true, - borderColor: Colors.white, - shadowWidth: 0.2, - shadowSpreadRadius: 3, - shadowDy: 1, - margin: EdgeInsets.only(top: 15, bottom: 15, left: 10, right: 10), - child: - Column(crossAxisAlignment: CrossAxisAlignment.start, children: [ - Expanded( - flex: 1, - child: Row( - children: [ - Expanded( - flex: 4, - child: Padding( - padding: const EdgeInsets.all(5.0), - child: Column( - mainAxisAlignment: MainAxisAlignment.start, - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Padding( - padding: EdgeInsets.all(8), - child: Column( - mainAxisAlignment: - MainAxisAlignment.center, - crossAxisAlignment: - CrossAxisAlignment.start, - children: [ - AppText( - TranslationBase.of(context) - .patients, - fontSize: 12, - fontWeight: FontWeight.bold, - fontHeight: 0.5, - ), - AppText( - TranslationBase.of(context) - .referral, - fontSize: 22, - fontWeight: FontWeight.bold, - ), - ], - )), - Expanded( - flex: 1, - child: Column( - mainAxisAlignment: MainAxisAlignment.start, - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Expanded( - child: RowCounts( - dashboardItemList[2] - .summaryoptions[0] - .kPIParameter, - dashboardItemList[2] - .summaryoptions[0] - .value, - Colors.black), - ), - Expanded( - child: RowCounts( - dashboardItemList[2] - .summaryoptions[1] - .kPIParameter, - dashboardItemList[2] - .summaryoptions[1] - .value, - Colors.grey), - ), - Expanded( - child: RowCounts( - dashboardItemList[2] - .summaryoptions[2] - .kPIParameter, - dashboardItemList[2] - .summaryoptions[2] - .value, - Colors.red), - ), - ], - ), - ) - ], - )), - ), - Expanded( - flex: 3, - child: Stack(children: [ - Container( - child: GaugeChart( - _createReferralData(widget.dashboardItemList))), - Positioned( - child: Column( - crossAxisAlignment: CrossAxisAlignment.center, - children: [ - AppText( - widget.model - .getPatientCount(dashboardItemList[2]) - .toString(), - fontSize: SizeConfig.textMultiplier * 3.0, - fontWeight: FontWeight.bold, - ) - ], - ), - top: MediaQuery.of(context).size.height * 0.13, - left: 0, - right: 0) - ]), - ), - ], - )), - ])); + return DashboardReferralPatient(dashboardItemList: widget.dashboardItemList,height: height,model: widget.model,); return Container(); } - static List> _createReferralData( - List dashboardItemList) { - final data = [ - new GaugeSegment( - dashboardItemList[2].summaryoptions[0].kPIParameter, - getValue(dashboardItemList[1].summaryoptions[0].value), - charts.MaterialPalette.black), - new GaugeSegment( - dashboardItemList[2].summaryoptions[1].kPIParameter, - getValue(dashboardItemList[1].summaryoptions[1].value), - charts.MaterialPalette.gray.shadeDefault), - new GaugeSegment( - dashboardItemList[2].summaryoptions[2].kPIParameter, - getValue(dashboardItemList[1].summaryoptions[2].value), - charts.MaterialPalette.red.shadeDefault), - ]; - return [ - new charts.Series( - id: 'Segments', - domainFn: (GaugeSegment segment, _) => segment.segment, - measureFn: (GaugeSegment segment, _) => segment.size, - data: data, - colorFn: (GaugeSegment segment, _) => segment.color, - ) - ]; - } - static int getValue(value) { - return value == 0 ? 1 : value; - } } + + diff --git a/lib/screens/home/home_page_card.dart b/lib/screens/home/home_page_card.dart index 503bbe60..903bdafd 100644 --- a/lib/screens/home/home_page_card.dart +++ b/lib/screens/home/home_page_card.dart @@ -10,7 +10,7 @@ class HomePageCard extends StatelessWidget { Key key, this.color, this.opacity = 0.4, - this.margin}) + this.margin, this.width}) : super(key: key); final bool hasBorder; final String imageName; @@ -18,18 +18,16 @@ class HomePageCard extends StatelessWidget { final Function onTap; final Color color; final double opacity; + final double width; final EdgeInsets margin; @override Widget build(BuildContext context) { return InkWell( onTap: onTap, child: Container( - width: 120, - height: MediaQuery.of(context).orientation == Orientation.portrait - ? 100 - : 200, + width: width, margin: this.margin, - decoration: BoxDecoration( + decoration: BoxDecoration( color: !hasBorder ? color != null ? color diff --git a/lib/screens/home/home_patient_card.dart b/lib/screens/home/home_patient_card.dart index b388a7e2..4e806c26 100644 --- a/lib/screens/home/home_patient_card.dart +++ b/lib/screens/home/home_patient_card.dart @@ -24,9 +24,12 @@ class HomePatientCard extends StatelessWidget { @override Widget build(BuildContext context) { + double width = SizeConfig.heightMultiplier* + (SizeConfig.isHeightVeryShort ? 16 : SizeConfig.isHeightLarge?15:13); return HomePageCard( color: backgroundColor, - margin: EdgeInsets.all(4), + width: width, + margin: EdgeInsets.all(SizeConfig.widthMultiplier *1.121), child: Container( padding: EdgeInsets.all(8), child: Column( @@ -36,13 +39,15 @@ class HomePatientCard extends StatelessWidget { Expanded( child: Stack( children: [ - Container( - margin: EdgeInsets.only(top: 18, left: 10), - color:Colors.transparent, - + Positioned( + top: SizeConfig.isHeightVeryShort ? 8 : 8, + left: SizeConfig.isHeightVeryShort ? 5 : 10, + width: SizeConfig.getWidthMultiplier(width: width) * 10, + height: SizeConfig.getWidthMultiplier(width: width) * 15, child: Icon( cardIcon, - size: iconSize * 2, + size: SizeConfig.getWidthMultiplier(width: width) * + (SizeConfig.isHeightVeryShort ? 45 : 60), color: backgroundIconColor, ), ), @@ -53,7 +58,8 @@ class HomePatientCard extends StatelessWidget { children: [ Icon( cardIcon, - size: iconSize, + size: + SizeConfig.getWidthMultiplier(width: width) * 22, color: textColor, ), SizedBox( @@ -71,7 +77,9 @@ class HomePatientCard extends StatelessWidget { text, color: textColor, textAlign: TextAlign.start, - fontSize: SizeConfig.textMultiplier * 1.6, + fontSize: + SizeConfig.getTextMultiplierBasedOnWidth(width: width) * + (SizeConfig.isHeightVeryShort ? 11 : 10), ), ), ), diff --git a/lib/screens/home/home_screen.dart b/lib/screens/home/home_screen.dart index 82add64c..56a9e559 100644 --- a/lib/screens/home/home_screen.dart +++ b/lib/screens/home/home_screen.dart @@ -1,4 +1,4 @@ -import 'package:doctor_app_flutter/core/enum/viewstate.dart'; +import 'package:doctor_app_flutter/config/size_config.dart'; import 'package:doctor_app_flutter/core/model/patient_muse/PatientSearchRequestModel.dart'; import 'package:doctor_app_flutter/core/viewModel/authentication_view_model.dart'; import 'package:doctor_app_flutter/core/viewModel/dashboard_view_model.dart'; @@ -16,19 +16,15 @@ import 'package:doctor_app_flutter/screens/patients/out_patient/out_patient_scre import 'package:doctor_app_flutter/screens/patients/patient_search/patient_search_screen.dart'; import 'package:doctor_app_flutter/screens/patients/profile/referral/patient_referral_screen.dart'; import 'package:doctor_app_flutter/util/date-utils.dart'; -import 'package:doctor_app_flutter/util/dr_app_toast_msg.dart'; import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; -import 'package:doctor_app_flutter/widgets/patients/profile/profile-welcome-widget.dart'; import 'package:doctor_app_flutter/widgets/shared/app_scaffold_widget.dart'; -import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart'; -import 'package:doctor_app_flutter/widgets/shared/loader/gif_loader_dialog_utils.dart'; import 'package:doctor_app_flutter/widgets/transitions/fade_page.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:provider/provider.dart'; -import 'package:sticky_headers/sticky_headers/widget.dart'; -import '../../widgets/shared/app_texts_widget.dart'; +import 'home_screen_header.dart'; +import 'label.dart'; class HomeScreen extends StatefulWidget { HomeScreen({Key key, this.title}) : super(key: key); @@ -43,14 +39,15 @@ class HomeScreen extends StatefulWidget { class _HomeScreenState extends State { bool isLoading = false; ProjectViewModel projectsProvider; - var _isInit = true; DoctorProfileModel profile; bool isExpanded = false; bool isInpatient = false; int sliderActiveIndex = 0; - var clinicId; + String clinicId; AuthenticationViewModel authenticationViewModel; int colorIndex = 0; + final GlobalKey scaffoldKey = new GlobalKey(); + @override Widget build(BuildContext context) { @@ -63,249 +60,122 @@ class _HomeScreenState extends State { } return BaseView( + onModelReady: (model) async { await model.setFirebaseNotification( projectsProvider, authenticationViewModel); await model.getDashboard(); await model.getDoctorProfile(isGetProfile: true); await model.checkDoctorHasLiveCare(); + await model.getSpecialClinicalCareList(); }, builder: (_, model, w) => AppScaffold( baseViewModel: model, - isShowAppBar: false, + isShowAppBar: true, + appBar: HomeScreenHeader( + model: model, + onOpenDrawer: (){ + Scaffold.of(context).openDrawer(); + }, + ), body: ListView(children: [ Column(children: [ - StickyHeader( - header: Container( - color: Colors.grey[100], - padding: EdgeInsets.only(top: 10), - child: Stack(children: [ - IconButton( - icon: Image.asset('assets/images/menu.png', - height: 50, width: 50), - iconSize: 18, - color: Colors.black, - onPressed: () => Scaffold.of(context).openDrawer(), - ), - Column(children: [ - ProfileWelcomeWidget( - Row( - mainAxisAlignment: MainAxisAlignment.start, - children: [ - Container( - width: MediaQuery.of(context).size.width * .6, - child: projectsProvider.doctorClinicsList.length > - 0 - ? Stack( - children: [ - DropdownButtonHideUnderline( - child: DropdownButton( - dropdownColor: Colors.white, - iconEnabledColor: Colors.black, - isExpanded: true, - value: clinicId == null - ? projectsProvider - .doctorClinicsList[0].clinicID - : clinicId, - iconSize: 25, - elevation: 16, - selectedItemBuilder: - (BuildContext context) { - return projectsProvider - .doctorClinicsList - .map((item) { - return Row( - mainAxisSize: MainAxisSize.max, - mainAxisAlignment: - MainAxisAlignment.end, - children: [ - Column( - mainAxisAlignment: - MainAxisAlignment - .center, - children: [ - Container( - padding: - EdgeInsets.all(2), - margin: - EdgeInsets.all(2), - decoration: - new BoxDecoration( - color: - Colors.red[800], - borderRadius: - BorderRadius - .circular( - 20), - ), - constraints: - BoxConstraints( - minWidth: 20, - minHeight: 20, - ), - child: Center( - child: AppText( - projectsProvider - .doctorClinicsList - .length - .toString(), - color: - Colors.white, - fontSize: - projectsProvider - .isArabic - ? 10 - : 11, - textAlign: - TextAlign - .center, - ), - )), - ], - ), - AppText(item.clinicName, - fontSize: 12, - color: Colors.black, - fontWeight: - FontWeight.bold, - textAlign: TextAlign.end), - ], - ); - }).toList(); - }, - onChanged: (newValue) async { - clinicId = newValue; - GifLoaderDialogUtils.showMyDialog( - context); - await model.changeClinic(newValue, - authenticationViewModel); - GifLoaderDialogUtils.hideDialog( - context); - if (model.state == - ViewState.ErrorLocal) { - DrAppToastMsg.showErrorToast( - model.error); - } - }, - items: projectsProvider - .doctorClinicsList - .map((item) { - return DropdownMenuItem( - child: AppText( - item.clinicName, - textAlign: TextAlign.left, - ), - value: item.clinicID, - ); - }).toList(), - )), - ], - ) - : AppText( - TranslationBase.of(context).noClinic), - ), - ], - ), - isClinic: true, - height: 50, - ), - ]) - ])), - content: Column( - children: [ - model.dashboardItemsList.length > 0 - ? DashboardSwipeWidget( - model.dashboardItemsList, - model, - (sliderIndex) { - setState(() { - sliderActiveIndex = sliderIndex; - }); - }, - ) - : SizedBox(), - model.dashboardItemsList.length > 0 - ? FractionallySizedBox( - widthFactor: 0.90, - child: Container( - child: Column( - mainAxisAlignment: MainAxisAlignment.start, - children: [ - SizedBox( - height: 10, - ), - sliderActiveIndex == 1 - ? DashboardSliderItemWidget( - model.dashboardItemsList[4]) - : sliderActiveIndex == 0 - ? DashboardSliderItemWidget( - model.dashboardItemsList[3]) - : DashboardSliderItemWidget( - model.dashboardItemsList[6]), - ]))) - : SizedBox(), - FractionallySizedBox( - // widthFactor: 0.90, + // SizedBox( + // height: SizeConfig.heightMultiplier * 1.4, + // ), + model.dashboardItemsList.length > 0 + ? DashboardSwipeWidget( + model.dashboardItemsList, + model, + (sliderIndex) { + setState(() { + sliderActiveIndex = sliderIndex; + }); + }, + ) + : SizedBox(), + + // SizedBox( + // height: SizeConfig.heightMultiplier * 1.4, + // ), + model.dashboardItemsList.length > 0 + ? FractionallySizedBox( + widthFactor: 0.94, child: Container( - decoration: BoxDecoration( - color: Colors.white, - borderRadius: BorderRadius.only( - topRight: Radius.circular(50), - )), - padding: EdgeInsets.only(left: 20, top: 10, right: 20), - margin: EdgeInsets.only(top: 10), child: Column( mainAxisAlignment: MainAxisAlignment.start, - crossAxisAlignment: CrossAxisAlignment.start, children: [ SizedBox( - height: 10, - ), - Container( - child: Column( - mainAxisAlignment: MainAxisAlignment.center, - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - AppText( - TranslationBase.of(context).patients, - fontSize: 12, - fontWeight: FontWeight.bold, - fontHeight: .5, - ), - AppText( - TranslationBase.of(context).services, - fontSize: 22, - fontWeight: FontWeight.bold, - ), - ], - )), - SizedBox( - height: 10, - ), - Container( - height: 120, - child: ListView( - scrollDirection: Axis.horizontal, - children: [ - ...homePatientsCardsWidget(model), - ])), - SizedBox( - height: 20, + height: SizeConfig.heightMultiplier * 3, ), + sliderActiveIndex == 1 + ? DashboardSliderItemWidget( + model.dashboardItemsList[4]) + : sliderActiveIndex == 0 + ? DashboardSliderItemWidget( + model.dashboardItemsList[3]) + : DashboardSliderItemWidget( + model.dashboardItemsList[6]), + ], + ), + ), + ) + : SizedBox(), + SizedBox( + height: SizeConfig.heightMultiplier * 1.4, + ), + FractionallySizedBox( + // widthFactor: 0.90, + child: Container( + decoration: BoxDecoration( + color: Colors.white, + borderRadius: BorderRadius.only( + topRight: Radius.circular(70), + )), + padding: EdgeInsets.only(left: SizeConfig.widthMultiplier * 3.1, top: 10, right: SizeConfig.widthMultiplier * 3.1), + margin: EdgeInsets.only(top: 10), + child: Column( + mainAxisAlignment: MainAxisAlignment.start, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + SizedBox( + height: SizeConfig.heightMultiplier * 1, + ), + Container( + child: Label( + firstLine: TranslationBase.of(context).patients, + secondLine: TranslationBase.of(context).services, + )), + SizedBox( + height: SizeConfig.heightMultiplier * .6, + ), + Container( + height: SizeConfig.heightMultiplier * + (SizeConfig.isHeightVeryShort + ? 16 + : SizeConfig.isHeightShort + ? 14 + : SizeConfig.isHeightLarge?15:13), + child: ListView( + scrollDirection: Axis.horizontal, + children: [ + ...homePatientsCardsWidget(model, projectsProvider), ], ), ), - ), - ], + SizedBox(height: SizeConfig.heightMultiplier* (SizeConfig.isHeightVeryShort?3:SizeConfig.isHeightShort?4:2)) + + ], + ), ), - ) + ), ]), ]), ), ); } - List homePatientsCardsWidget(DashboardViewModel model) { + List homePatientsCardsWidget(DashboardViewModel model,projectsProvider) { colorIndex = 0; List backgroundColors = List(3); @@ -318,7 +188,7 @@ class _HomeScreenState extends State { backgroundIconColors[2] = Colors.white10; List textColors = List(3); textColors[0] = Colors.white; - textColors[1] = Colors.black; + textColors[1] = Color(0xFF353E47); textColors[2] = Colors.white; List patientCards = List(); @@ -354,7 +224,8 @@ class _HomeScreenState extends State { Navigator.push( context, FadePage( - page: PatientInPatientScreen(), + page: PatientInPatientScreen(specialClinic: model.getSpecialClinic(clinicId??projectsProvider + .doctorClinicsList[0].clinicID),), ), ); }, @@ -455,3 +326,6 @@ class _HomeScreenState extends State { } } } + + + diff --git a/lib/screens/home/home_screen_header.dart b/lib/screens/home/home_screen_header.dart new file mode 100644 index 00000000..7284b659 --- /dev/null +++ b/lib/screens/home/home_screen_header.dart @@ -0,0 +1,219 @@ +// ignore: must_be_immutable +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/authentication_view_model.dart'; +import 'package:doctor_app_flutter/core/viewModel/dashboard_view_model.dart'; +import 'package:doctor_app_flutter/core/viewModel/project_view_model.dart'; +import 'package:doctor_app_flutter/util/dr_app_toast_msg.dart'; +import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; +import 'package:doctor_app_flutter/widgets/patients/profile/profile-welcome-widget.dart'; +import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart'; +import 'package:doctor_app_flutter/widgets/shared/loader/gif_loader_dialog_utils.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'; + +// ignore: must_be_immutable +class HomeScreenHeader extends StatefulWidget with PreferredSizeWidget { + + final DashboardViewModel model; + final Function onOpenDrawer; + + double height = SizeConfig.heightMultiplier * + (SizeConfig.isHeightVeryShort ? 10 : 6); + + HomeScreenHeader({Key key, this.model, this.onOpenDrawer}) : super(key: key); + + @override + _HomeScreenHeaderState createState() => _HomeScreenHeaderState(); + + @override + Size get preferredSize => Size(double.maxFinite,height); +} + +class _HomeScreenHeaderState extends State { + ProjectViewModel projectsProvider; + int clinicId; + + + AuthenticationViewModel authenticationViewModel; + + + @override + Widget build(BuildContext context) { + ProjectViewModel projectsProvider = Provider.of(context); + authenticationViewModel = Provider.of(context); + + return widget.model.state == ViewState.Busy + ? Container(color: Colors.grey.withOpacity(0.65)) + : Container( + color: Colors.grey[100], + child: Stack(children: [ + IconButton( + icon: Icon(FontAwesomeIcons.ellipsisH), + iconSize: SizeConfig.heightMultiplier * (SizeConfig.isHeightVeryShort?4: 3), + color: Colors.black, + onPressed: () { + widget.onOpenDrawer(); + }, + ), + Column( + children: [ + ProfileWelcomeWidget( + Row( + mainAxisAlignment: MainAxisAlignment.end, + children: [ + Container( + width: MediaQuery + .of(context) + .size + .width * .6, + child: projectsProvider.doctorClinicsList.length > + 0 + ? Stack( + children: [ + DropdownButtonHideUnderline( + child: DropdownButton( + dropdownColor: Colors.white, + iconEnabledColor: Colors.black, + isExpanded: true, + value: clinicId == null + ? projectsProvider + .doctorClinicsList[0].clinicID + : clinicId, + iconSize: SizeConfig.widthMultiplier * 7, + elevation: 16, + selectedItemBuilder: + (BuildContext context) { + return projectsProvider + .doctorClinicsList + .map((item) { + return Row( + mainAxisSize: MainAxisSize.max, + mainAxisAlignment: + MainAxisAlignment.end, + children: [ + Column( + mainAxisAlignment: + MainAxisAlignment + .center, + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + Container( + padding: + EdgeInsets.all(2), + margin: + EdgeInsets.all(2), + decoration: + new BoxDecoration( + color: + Colors.red[800], + borderRadius: + BorderRadius + .circular( + 20), + ), + constraints: + BoxConstraints( + minWidth: SizeConfig + .getHeightMultiplier( + height: widget.height) * + 35, + minHeight: SizeConfig + .getHeightMultiplier( + height: widget.height) * + 30, + ), + child: Center( + child: AppText( + projectsProvider + .doctorClinicsList + .length + .toString(), + color: + Colors.white, + fontSize: + projectsProvider + .isArabic + ? SizeConfig + .getHeightMultiplier( + height: widget.height) + : SizeConfig + .getHeightMultiplier( + height: widget + .height) * 20, + textAlign: + TextAlign + .center, + ), + )), + ], + ), + AppText(item.clinicName, + fontSize: SizeConfig + .getTextMultiplierBasedOnWidth( + width: MediaQuery + .of(context) + .size + .width * .6) * (SizeConfig.isWidthLarge?4:5), + color: Color(0xFF2B353E), + maxLines: 1, + maxLength: 2, + letterSpacing: -0.96, + textOverflow: TextOverflow + .ellipsis, + fontWeight: + FontWeight.bold, + textAlign: TextAlign.end), + ], + ); + }).toList(); + }, + onChanged: (newValue) async { + setState(() { + clinicId = newValue; + }); + + GifLoaderDialogUtils.showMyDialog( + context); + await widget.model.changeClinic(newValue, + authenticationViewModel); + GifLoaderDialogUtils.hideDialog( + context); + if (widget.model.state == + ViewState.ErrorLocal) { + DrAppToastMsg.showErrorToast( + widget.model.error); + } + }, + items: projectsProvider + .doctorClinicsList + .map((item) { + return DropdownMenuItem( + child: AppText( + item.clinicName, + textAlign: TextAlign.left, + ), + value: item.clinicID, + ); + }).toList(), + )), + ], + ) + : AppText( + TranslationBase + .of(context) + .noClinic), + ), + ], + ), + isClinic: true, + height: widget.height, + ), + ]) + ])); + } + + +} \ No newline at end of file diff --git a/lib/screens/home/label.dart b/lib/screens/home/label.dart new file mode 100644 index 00000000..7e853323 --- /dev/null +++ b/lib/screens/home/label.dart @@ -0,0 +1,45 @@ +// ignore: must_be_immutable + +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'; + +// ignore: must_be_immutable +class Label extends StatelessWidget { + Label({ + Key key, this.firstLine, this.secondLine, this.color= const Color(0xFF2E303A), this.secondLineFontSize, this.firstLineFontSize, + }) : super(key: key); + final String firstLine; + final String secondLine; + Color color; + final double secondLineFontSize; + final double firstLineFontSize; + + @override + Widget build(BuildContext context) { + + return Column( + mainAxisAlignment: MainAxisAlignment.center, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + AppText( + firstLine, + fontSize: firstLineFontSize??SizeConfig.getTextMultiplierBasedOnWidth() *(SizeConfig.isWidthLarge?2:3) , + // fontWeight: FontWeight.bold, + color: color, + fontHeight: .5, + letterSpacing: -0.72, + fontWeight: FontWeight.w600, + ), + AppText( + secondLine, + color: color, + fontSize: secondLineFontSize??SizeConfig.getTextMultiplierBasedOnWidth() * (SizeConfig.isWidthLarge?4:6.40), + fontWeight: FontWeight.bold, + letterSpacing: -1.44, + + ), + ], + ); + } +} \ No newline at end of file diff --git a/lib/screens/patients/InPatientPage.dart b/lib/screens/patients/InPatientPage.dart index e9e2c2d1..ec2a8107 100644 --- a/lib/screens/patients/InPatientPage.dart +++ b/lib/screens/patients/InPatientPage.dart @@ -1,9 +1,12 @@ +import 'package:doctor_app_flutter/core/enum/viewstate.dart'; import 'package:doctor_app_flutter/core/viewModel/PatientSearchViewModel.dart'; import 'package:doctor_app_flutter/screens/base/base_view.dart'; import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; import 'package:doctor_app_flutter/widgets/patients/patient_card/PatientCard.dart'; +import 'package:doctor_app_flutter/widgets/shared/app_loader_widget.dart'; import 'package:doctor_app_flutter/widgets/shared/app_scaffold_widget.dart'; import 'package:doctor_app_flutter/widgets/shared/errors/error_message.dart'; +import 'package:doctor_app_flutter/widgets/shared/loader/gif_loader_container.dart'; import 'package:doctor_app_flutter/widgets/shared/text_fields/app-textfield-custom.dart'; import 'package:flutter/material.dart'; @@ -59,7 +62,7 @@ class _InPatientPageState extends State { model.filterSearchResults(value); }), ), - model.filteredInPatientItems.length > 0 + model.state == ViewState.Idle?model.filteredInPatientItems.length > 0 ? Expanded( child: Container( margin: EdgeInsets.symmetric(horizontal: 16.0), @@ -154,6 +157,13 @@ class _InPatientPageState extends State { error: TranslationBase.of(context).noDataAvailable)), ), + ): Center( + child: Container( + height: 300, + width: 300, + child: Image.asset( + "assets/images/progress-loading-red.gif"), + ), ), ], ), diff --git a/lib/screens/patients/PatientsInPatientScreen.dart b/lib/screens/patients/PatientsInPatientScreen.dart index 60446887..4971b636 100644 --- a/lib/screens/patients/PatientsInPatientScreen.dart +++ b/lib/screens/patients/PatientsInPatientScreen.dart @@ -1,17 +1,27 @@ import 'package:doctor_app_flutter/config/size_config.dart'; +import 'package:doctor_app_flutter/core/enum/viewstate.dart'; import 'package:doctor_app_flutter/core/model/patient_muse/PatientSearchRequestModel.dart'; import 'package:doctor_app_flutter/core/viewModel/PatientSearchViewModel.dart'; +import 'package:doctor_app_flutter/core/viewModel/project_view_model.dart'; +import 'package:doctor_app_flutter/models/dashboard/get_special_clinical_care_List_Respose_Model.dart'; import 'package:doctor_app_flutter/screens/base/base_view.dart'; +import 'package:doctor_app_flutter/util/dr_app_toast_msg.dart'; import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; import 'package:doctor_app_flutter/widgets/shared/app_scaffold_widget.dart'; import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart'; +import 'package:doctor_app_flutter/widgets/shared/loader/gif_loader_dialog_utils.dart'; import 'package:doctor_app_flutter/widgets/shared/text_fields/text_fields_utils.dart'; import 'package:flutter/material.dart'; +import 'package:provider/provider.dart'; import 'DischargedPatientPage.dart'; import 'InPatientPage.dart'; class PatientInPatientScreen extends StatefulWidget { + GetSpecialClinicalCareListResponseModel specialClinic; + + PatientInPatientScreen({Key key, this.specialClinic}); + @override _PatientInPatientScreenState createState() => _PatientInPatientScreenState(); } @@ -21,6 +31,9 @@ class _PatientInPatientScreenState extends State TabController _tabController; int _activeTab = 0; + int selectedMapId; + + @override void initState() { super.initState(); @@ -42,15 +55,27 @@ class _PatientInPatientScreenState extends State @override Widget build(BuildContext context) { - final screenSize = MediaQuery.of(context).size; + final screenSize = MediaQuery + .of(context) + .size; PatientSearchRequestModel requestModel = PatientSearchRequestModel(); + ProjectViewModel projectsProvider = Provider.of(context); + return BaseView( onModelReady: (model) async { model.clearPatientList(); + if (widget.specialClinic != null) { + await model + .getSpecialClinicalCareMappingList(widget.specialClinic.clinicID); + requestModel.nursingStationID = + model.specialClinicalCareMappingList[0].nursingStationID; + requestModel.clinicID = 0; + } model.getInPatientList(requestModel); }, - builder: (_, model, w) => AppScaffold( + builder: (_, model, w) => + AppScaffold( baseViewModel: model, isShowAppBar: false, body: Column( @@ -72,12 +97,125 @@ class _PatientInPatientScreenState extends State ), Expanded( child: AppText( - TranslationBase.of(context).inPatient, + TranslationBase + .of(context) + .inPatient, fontSize: SizeConfig.textMultiplier * 2.8, fontWeight: FontWeight.bold, color: Color(0xFF2B353E), ), ), + if (model.specialClinicalCareMappingList.isNotEmpty && + widget.specialClinic != null && + _activeTab != 2) + Container( + width: MediaQuery.of(context).size.width * .3, + child: DropdownButtonHideUnderline( + child: DropdownButton( + dropdownColor: Colors.white, + iconEnabledColor: Colors.black, + isExpanded: true, + value: selectedMapId == null ? model + .specialClinicalCareMappingList[0] + .nursingStationID : selectedMapId, + iconSize: 25, + elevation: 16, + selectedItemBuilder: + (BuildContext context) { + return model + .specialClinicalCareMappingList + .map((item) { + return Row( + mainAxisSize: MainAxisSize.max, + mainAxisAlignment: + MainAxisAlignment.end, + children: [ + Column( + mainAxisAlignment: + MainAxisAlignment + .center, + children: [ + Container( + padding: + EdgeInsets.all(2), + margin: + EdgeInsets.all(2), + decoration: + new BoxDecoration( + color: + Colors.red[800], + borderRadius: + BorderRadius + .circular( + 20), + ), + constraints: + BoxConstraints( + minWidth: 20, + minHeight: 20, + ), + child: Center( + child: AppText( + model + .specialClinicalCareMappingList + .length + .toString(), + color: + Colors.white, + fontSize: + projectsProvider + .isArabic + ? 10 + : 11, + textAlign: + TextAlign + .center, + ), + )), + ], + ), + AppText(item.description, + fontSize: 12, + color: Colors.black, + fontWeight: + FontWeight.bold, + textAlign: TextAlign.end), + ], + ); + }).toList(); + }, + onChanged: (newValue) async { + setState(() { + selectedMapId = newValue; + }); + model.clearPatientList(); + GifLoaderDialogUtils.showMyDialog( + context); + + PatientSearchRequestModel requestModel = PatientSearchRequestModel( + nursingStationID: selectedMapId, clinicID: 0); + await model.getInPatientList(requestModel, isLocalBusy: true); + GifLoaderDialogUtils.hideDialog( + context); + if (model.state == + ViewState.ErrorLocal) { + DrAppToastMsg.showErrorToast( + model.error); + } + }, + items: model + .specialClinicalCareMappingList + .map((item) { + return DropdownMenuItem( + child: AppText( + item.description, + textAlign: TextAlign.left, + ), + value: item.nursingStationID, + ); + }).toList(), + )), + ) ]), ), ), diff --git a/lib/screens/patients/profile/lab_result/laboratory_result_page.dart b/lib/screens/patients/profile/lab_result/laboratory_result_page.dart index 88f2cea7..0ca6c0fa 100644 --- a/lib/screens/patients/profile/lab_result/laboratory_result_page.dart +++ b/lib/screens/patients/profile/lab_result/laboratory_result_page.dart @@ -39,7 +39,7 @@ class _LaboratoryResultPageState extends State { builder: (_, model, w) => AppScaffold( isShowAppBar: true, patientProfileAppBarModel: PatientProfileAppBarModel( - patient:widget.patient, + patient:widget.patient,isInpatient:widget.isInpatient, isFromLabResult: true, appointmentDate: widget.patientLabOrders.orderDate,), diff --git a/lib/screens/qr_reader/QR_reader_screen.dart b/lib/screens/qr_reader/QR_reader_screen.dart index a411aaa7..c70563f9 100644 --- a/lib/screens/qr_reader/QR_reader_screen.dart +++ b/lib/screens/qr_reader/QR_reader_screen.dart @@ -1,11 +1,9 @@ import 'package:barcode_scan_fix/barcode_scan.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/viewstate.dart'; +import 'package:doctor_app_flutter/core/model/patient_muse/PatientSearchRequestModel.dart'; import 'package:doctor_app_flutter/core/viewModel/patient_view_model.dart'; -import 'package:doctor_app_flutter/models/patient/patiant_info_model.dart'; -import 'package:doctor_app_flutter/models/patient/patient_model.dart'; -import 'package:doctor_app_flutter/models/patient/topten_users_res_model.dart'; -import 'package:doctor_app_flutter/util/dr_app_shared_pref.dart'; +import 'package:doctor_app_flutter/core/viewModel/scan_qr_view_model.dart'; import 'package:doctor_app_flutter/util/dr_app_toast_msg.dart'; import 'package:doctor_app_flutter/util/helpers.dart'; import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; @@ -26,38 +24,9 @@ class QrReaderScreen extends StatefulWidget { } class _QrReaderScreenState extends State { - DrAppSharedPreferances sharedPref = new DrAppSharedPreferances(); - - bool isLoading = false; - bool isError = false; - PatientModel patient = PatientModel( - ProjectID: 15, - ClinicID: 0, - DoctorID: 1485, - FirstName: "0", - MiddleName: "0", - LastName: "0", - PatientMobileNumber: "0", - PatientIdentificationID: "0", - PatientID: 0, - From: "0", - To: "0", - LanguageID: 2, - stamp: "2020-03-02T13:56:39.170Z", - IPAdress: "11.11.11.11", - VersionID: 5.5, - Channel: 9, - TokenID: "@dm!n", - SessionID: "5G0yXn0Jnq", - IsLoginForDoctorApp: true, - PatientOutSA: false); - List patientList = []; - String error = ''; - @override Widget build(BuildContext context) { - return BaseView( - onModelReady: (model) => model.getClinicsList(), + return BaseView( builder: (_, model, w) => AppScaffold( baseViewModel: model, isShowAppBar: false, @@ -95,26 +64,8 @@ class _QrReaderScreenState extends State { onPressed: () { _scanQrAndGetPatient(context, model); }, - loading: isLoading, icon: Image.asset('assets/images/qr_code_white.png'), ), - isError - ? Container( - margin: EdgeInsets.only(top: 8), - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(6.0), - color: Theme.of(context).errorColor.withOpacity(0.06), - ), - padding: EdgeInsets.symmetric(vertical: 8.0, horizontal: 12.0), - child: Row( - children: [ - Expanded( - child: AppText(error ?? TranslationBase.of(context).errorMessage, - color: Theme.of(context).errorColor)), - ], - ), - ) - : Container(), ], ), ), @@ -124,82 +75,32 @@ class _QrReaderScreenState extends State { ); } - _scanQrAndGetPatient(BuildContext context, PatientViewModel model) async { + _scanQrAndGetPatient(BuildContext context, ScanQrViewModel model) async { /// When give qr we will change this method to get data /// var result = await BarcodeScanner.scan(); /// int patientID = get from qr result var result = await BarcodeScanner.scan(); if (result != "") { List listOfParams = result.split(','); - String patientType = "1"; - setState(() { - isLoading = true; - isError = false; - patientList = []; - }); - String token = await sharedPref.getString(TOKEN); -// Map profile = await sharedPref.getObj(DOCTOR_PROFILE); -// DoctorProfileModel doctorProfile = new DoctorProfileModel.fromJson(profile); -// patient.PatientID = 8808; -// patient.TokenID = token; -// patient.setDoctorID = doctorProfile.projectID; -// patient.setClinicID = doctorProfile.clinicID; -// patient.setProjectID = doctorProfile.projectID; -// Provider.of(context, listen: false); - patient.PatientID = 8808; - patient.TokenID = token; - model.getPatientList(patient, "1", isBusyLocal: true).then((response) { - if (response['MessageStatus'] == 1) { - switch (patientType) { - case "0": - if (response['List_MyOutPatient'] != null) { - setState(() { - patientList = ModelResponse.fromJson(response['List_MyOutPatient']).list; - isLoading = false; - }); - Navigator.of(context).pushNamed(PATIENTS_PROFILE, arguments: { - "patient": patientList[0], - }); - } else { - setState(() { - isError = true; - isLoading = false; - }); - DrAppToastMsg.showErrorToast('No patient'); - } - break; - case "1": - if (response['List_MyInPatient'] != null) { - setState(() { - patientList = ModelResponse.fromJson(response['List_MyInPatient']).list; - isLoading = false; - error = ""; - }); - Navigator.of(context).pushNamed(PATIENTS_PROFILE, arguments: { - "patient": patientList[0], - }); - } else { - setState(() { - isError = true; - isLoading = false; - }); - DrAppToastMsg.showErrorToast('No patient'); - break; - } - } + int patientID = 0; + if (listOfParams[1].length != 0) patientID = int.parse(listOfParams[1]); + PatientSearchRequestModel patientSearchRequestModel = PatientSearchRequestModel( + patientID: patientID, + ); + + await model.getInPatientList(patientSearchRequestModel, isMyInpatient: true).then((d) { + if (model.state != ViewState.ErrorLocal) { + if (model.inPatientList.isEmpty) + DrAppToastMsg.showErrorToast('No patient'); + else + Navigator.of(context).pushNamed(PATIENTS_PROFILE, arguments: { + "patient": model.inPatientList[0], + }); } else { - setState(() { - isLoading = false; - isError = true; - }); - DrAppToastMsg.showErrorToast(response['ErrorEndUserMessage'] ?? response['ErrorMessage']); + DrAppToastMsg.showErrorToast(model.error); } }).catchError((error) { - setState(() { - isLoading = false; - }); Helpers.showErrorToast(error.message); - //DrAppToastMsg.showErrorToast(error); }); } } diff --git a/lib/util/helpers.dart b/lib/util/helpers.dart index 634abd02..58b6b77e 100644 --- a/lib/util/helpers.dart +++ b/lib/util/helpers.dart @@ -1,11 +1,8 @@ import 'package:connectivity/connectivity.dart'; import 'package:doctor_app_flutter/config/config.dart'; -import 'package:doctor_app_flutter/config/shared_pref_kay.dart'; import 'package:doctor_app_flutter/core/model/hospitals/get_hospitals_response_model.dart'; import 'package:doctor_app_flutter/core/viewModel/authentication_view_model.dart'; -import 'package:doctor_app_flutter/core/viewModel/project_view_model.dart'; import 'package:doctor_app_flutter/models/doctor/list_doctor_working_hours_table_model.dart'; -import 'package:doctor_app_flutter/screens/auth/login_screen.dart'; import 'package:doctor_app_flutter/util/dr_app_shared_pref.dart'; import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart'; @@ -270,4 +267,19 @@ class Helpers { var htmlRegex = RegExp("<(“[^”]*”|'[^’]*’|[^'”>])*>"); return htmlRegex.hasMatch(text); } + + static getNameFromKPI(String kpi) { + if (kpi.indexOf("(") > -1) + return kpi.substring(0, kpi.indexOf("(")); + else + return kpi; + } + + static getLabelFromKPI(String kpi) { + if (kpi.indexOf("(") > -1 && kpi.indexOf(")")>-1) + return kpi.substring(kpi.indexOf("(") + 1, kpi.indexOf(")")); + else + return ''; + + } } diff --git a/lib/widgets/auth/method_type_card.dart b/lib/widgets/auth/method_type_card.dart index 6d091756..ca32106d 100644 --- a/lib/widgets/auth/method_type_card.dart +++ b/lib/widgets/auth/method_type_card.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:flutter/material.dart'; import 'package:hexcolor/hexcolor.dart'; @@ -16,6 +17,7 @@ class MethodTypeCard extends StatelessWidget { @override Widget build(BuildContext context) { + double cardHeight = SizeConfig.heightMultiplier * (SizeConfig.isHeightVeryShort? 22 : SizeConfig.isHeightLarge?25:20); return InkWell( onTap: onTap, child: Container( @@ -29,30 +31,26 @@ class MethodTypeCard extends StatelessWidget { color: HexColor('#707070'), width: 0.1), ), - height: 170, - child: Padding( - padding: EdgeInsets.fromLTRB(20, 15, 20, 15), + height: cardHeight, + child: Center( child: Column( mainAxisAlignment: MainAxisAlignment.center, crossAxisAlignment: CrossAxisAlignment.start, children: [ - Row( - children: [ - Image.asset( - assetPath, - height: 60, - width: 60, - ), - ], + Image.asset( + assetPath, + width: SizeConfig.widthMultiplier* (12), + height: cardHeight * 0.35, + // height: , ), SizedBox( height:height , ), AppText( label, - fontSize: 14, - color: Color(0xFF2E303A), - fontWeight: FontWeight.bold, + fontSize: SizeConfig.getTextMultiplierBasedOnWidth()* (SizeConfig.isHeightVeryShort?3:3.7), + color: Color(0xFF2B353E), + fontWeight: FontWeight.w700, ) ], ), diff --git a/lib/widgets/auth/sms-popup.dart b/lib/widgets/auth/sms-popup.dart index 0c374e58..fbe6492b 100644 --- a/lib/widgets/auth/sms-popup.dart +++ b/lib/widgets/auth/sms-popup.dart @@ -1,6 +1,5 @@ import 'dart:async'; -import 'package:doctor_app_flutter/config/config.dart'; import 'package:doctor_app_flutter/config/size_config.dart'; import 'package:doctor_app_flutter/core/enum/auth_method_types.dart'; import 'package:doctor_app_flutter/core/viewModel/project_view_model.dart'; @@ -8,7 +7,6 @@ import 'package:doctor_app_flutter/icons_app/doctor_app_icons.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:provider/provider.dart'; class SMSOTP { final AuthMethodTypes type; final mobileNo; @@ -48,231 +46,259 @@ class SMSOTP { String displayTime = ''; bool isClosed = false; displayDialog(BuildContext context) async { + double dialogWidth = MediaQuery.of(context).size.width * 0.90; + double dialogInputWidth = (dialogWidth / 4) - (SizeConfig.isWidthLarge?SizeConfig.getWidthMultiplier(width:dialogWidth )* 4.5: 20); + double dialogHeight = SizeConfig.isHeightVeryShort ?MediaQuery.of(context).size.height * 0.50:MediaQuery.of(context).size.height * 0.40; return showDialog( context: context, - barrierColor: Colors.black.withOpacity(0.7), - builder: (context) { - projectProvider = Provider.of(context); - return AlertDialog( - contentPadding: EdgeInsets.fromLTRB(24.0, 0.0, 0.0, 24.0), - content: StatefulBuilder(builder: (context, setState) { - if (displayTime == '') { - startTimer(setState); - } - return Container( - color: Colors.white, - height: MediaQuery.of(context).size.height * 0.50, - width: MediaQuery.of(context).size.width * 0.84, + + + builder: (ctx) => Center( + child: Container( + color: Colors.white, + height: dialogHeight, + width: dialogWidth, + child: Material( + color: Colors.white, + child: SingleChildScrollView( child: Center( - child: SingleChildScrollView( - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Padding( - padding: EdgeInsets.all(13), - child: Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - type == AuthMethodTypes.SMS - ? Padding( - child: Icon( - DoctorApp.verify_sms_1, - size: 50, - ), - padding: EdgeInsets.only(bottom: 20), - ) - : Padding( - child: Icon( - DoctorApp.verify_whtsapp, - size: 50, - ), - padding: EdgeInsets.only(bottom: 20), - ), - Row( - mainAxisAlignment: MainAxisAlignment.end, - children: [ - Padding( - padding: EdgeInsets.only( - left: 10, right: 10, bottom: 20), - child: IconButton( - icon: Icon(Icons.close), - iconSize: 40, - onPressed: () { - this.isClosed = true; - Navigator.pop(context); - this.onFailure(); - }, - )) - ], - ) - ])), - Padding( - padding: EdgeInsets.only(top: 5, right: 5), - child: AppText( - TranslationBase.of(context).verificationMessage + - ' XXXXXX' + - mobileNo - .toString() - .substring(mobileNo.toString().length - 3), - textAlign: TextAlign.start, - fontWeight: FontWeight.bold, - fontSize: 14, - maxLines: 2, - )), - Form( - key: verifyAccountForm, - child: Padding( - padding: EdgeInsets.only(top: 20), - child: Directionality( - textDirection: TextDirection.ltr, - child: Row( - mainAxisAlignment: MainAxisAlignment.start, + child: Container( + color: Colors.white, + child: StatefulBuilder(builder: (context, setState) { + if (displayTime == '') { + startTimer(setState); + } + + return Center( + child: FractionallySizedBox( + widthFactor: 0.9, + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, children: [ - Container( - width: SizeConfig.realScreenWidth * 0.16, - margin: EdgeInsets.all(5), - child: TextFormField( - textInputAction: TextInputAction.next, - style: buildTextStyle(), - autofocus: true, - maxLength: 1, - controller: digit1, - textAlign: TextAlign.center, - keyboardType: TextInputType.number, - decoration: buildInputDecoration(context), - onSaved: (val) {}, - validator: validateCodeDigit, - onFieldSubmitted: (_) { - FocusScope.of(context) - .requestFocus(focusD2); - }, - onChanged: (val) { - if (val.length == 1) { - FocusScope.of(context) - .requestFocus(focusD2); - verifyAccountFormValue['digit1'] = - val.trim(); - checkValue(); - } - }, + SizedBox(height: SizeConfig.getHeightMultiplier(height:dialogHeight) * 2,), + + Row( + mainAxisAlignment: MainAxisAlignment + .spaceBetween, + children: [ + Icon( + type == AuthMethodTypes.SMS + ? DoctorApp.verify_sms_1 + : DoctorApp.verify_whtsapp, + size: SizeConfig.getHeightMultiplier(height:dialogHeight) * 9, + color: Color(0xFF2B353E), + ), + Row( + mainAxisAlignment: MainAxisAlignment.end, + children: [ + IconButton( + icon: Icon(Icons.close), + color: Color(0xFF2B353E), + iconSize: SizeConfig.getHeightMultiplier(height:dialogHeight) * 15, + onPressed: () { + this.isClosed = true; + Navigator.pop(context); + this.onFailure(); + }, + ) + ], + ) + ]), + SizedBox(height: SizeConfig.getHeightMultiplier(height:dialogHeight) * (SizeConfig.isHeightVeryShort?10:5),), + Padding( + padding: EdgeInsets.only(top: 5, right: 5), + child: AppText( + TranslationBase.of(context).verificationMessage + + ' XXXXXX' + + mobileNo + .toString() + .substring(mobileNo.toString().length - 3), + textAlign: TextAlign.start, + fontWeight: FontWeight.w700, + letterSpacing: -0.48, + color: Color(0xFF2B353E), + fontSize: SizeConfig.getTextMultiplierBasedOnWidth(width: dialogWidth) * 3.5, //14, + maxLines: 2, + )), + Form( + key: verifyAccountForm, + child: Padding( + padding: EdgeInsets.only(top: SizeConfig.getHeightMultiplier(height:dialogHeight) * 2), + child: Directionality( + textDirection: TextDirection.ltr, + child: Row( + mainAxisAlignment: MainAxisAlignment.start, + children: [ + Container( + width: dialogInputWidth, + height: SizeConfig.getHeightMultiplier(height:dialogHeight) * 30, + margin: EdgeInsets.symmetric(vertical: 2,horizontal: 5), + child: TextFormField( + textInputAction: TextInputAction + .next, + style: buildTextStyle(), + autofocus: true, + maxLength: 1, + controller: digit1, + textAlign: TextAlign.center, + keyboardType: TextInputType.number, + decoration: buildInputDecoration( + context), + onSaved: (val) {}, + validator: validateCodeDigit, + onFieldSubmitted: (_) { + FocusScope.of(context) + .requestFocus(focusD2); + }, + onChanged: (val) { + if (val.length == 1) { + FocusScope.of(context) + .requestFocus(focusD2); + verifyAccountFormValue['digit1'] = + val.trim(); + checkValue(); + } + }, + ), + ), + Container( + width: dialogInputWidth, + height: SizeConfig.getHeightMultiplier(height:dialogHeight) * 30, + + margin: EdgeInsets.symmetric(vertical: 2,horizontal: 5), + child: TextFormField( + focusNode: focusD2, + textInputAction: TextInputAction + .next, + maxLength: 1, + controller: digit2, + textAlign: TextAlign.center, + style: buildTextStyle(), + keyboardType: TextInputType + .number, + decoration: buildInputDecoration( + context), + onSaved: (val) {}, + onFieldSubmitted: (_) { + FocusScope.of(context) + .requestFocus(focusD3); + }, + onChanged: (val) { + if (val.length == 1) { + FocusScope.of(context) + .requestFocus(focusD3); + verifyAccountFormValue['digit2'] = + val.trim(); + checkValue(); + } + }, + validator: validateCodeDigit), + ), + Container( + margin: EdgeInsets.symmetric(vertical: 2,horizontal: 5), + width: dialogInputWidth, + height: SizeConfig.getHeightMultiplier(height:dialogHeight) * 30, + child: TextFormField( + focusNode: focusD3, + textInputAction: TextInputAction + .next, + maxLength: 1, + controller: digit3, + textAlign: TextAlign.center, + style: buildTextStyle(), + keyboardType: TextInputType + .number, + decoration: + buildInputDecoration(context), + onSaved: (val) {}, + onFieldSubmitted: (_) { + FocusScope.of(context) + .requestFocus(focusD4); + }, + onChanged: (val) { + if (val.length == 1) { + FocusScope.of(context) + .requestFocus(focusD4); + verifyAccountFormValue['digit3'] = + val.trim(); + checkValue(); + } + }, + validator: validateCodeDigit)), + Container( + margin: EdgeInsets.symmetric(vertical: 2,horizontal: 5), + width: dialogInputWidth, + height: SizeConfig.getHeightMultiplier(height:dialogHeight) * 30, + + child: TextFormField( + focusNode: focusD4, + maxLength: 1, + textAlign: TextAlign.center, + style: buildTextStyle(), + controller: digit4, + keyboardType: TextInputType + .number, + decoration: + buildInputDecoration(context), + onFieldSubmitted: (_) { + FocusScope.of(context) + .requestFocus(focusD4); + }, + onChanged: (val) { + if (val.length == 1) { + verifyAccountFormValue['digit4'] = + val.trim(); + checkValue(); + } + }, + validator: validateCodeDigit)), + ], + )), ), ), - Container( - width: SizeConfig.realScreenWidth * 0.16, - margin: EdgeInsets.all(5), - child: TextFormField( - focusNode: focusD2, - textInputAction: TextInputAction.next, - maxLength: 1, - controller: digit2, - textAlign: TextAlign.center, - style: buildTextStyle(), - keyboardType: TextInputType.number, - decoration: buildInputDecoration(context), - onSaved: (val) {}, - onFieldSubmitted: (_) { - FocusScope.of(context) - .requestFocus(focusD3); - }, - onChanged: (val) { - if (val.length == 1) { - FocusScope.of(context) - .requestFocus(focusD3); - verifyAccountFormValue['digit2'] = - val.trim(); - checkValue(); - } - }, - validator: validateCodeDigit), - ), - Container( - margin: EdgeInsets.all(5), - width: SizeConfig.realScreenWidth * 0.16, - child: TextFormField( - focusNode: focusD3, - textInputAction: TextInputAction.next, - maxLength: 1, - controller: digit3, - textAlign: TextAlign.center, - style: buildTextStyle(), - keyboardType: TextInputType.number, - decoration: - buildInputDecoration(context), - onSaved: (val) {}, - onFieldSubmitted: (_) { - FocusScope.of(context) - .requestFocus(focusD4); - }, - onChanged: (val) { - if (val.length == 1) { - FocusScope.of(context) - .requestFocus(focusD4); - verifyAccountFormValue['digit3'] = - val.trim(); - checkValue(); - } - }, - validator: validateCodeDigit)), - Container( - margin: EdgeInsets.all(5), - width: SizeConfig.realScreenWidth * 0.16, - child: TextFormField( - focusNode: focusD4, - maxLength: 1, - textAlign: TextAlign.center, - style: buildTextStyle(), - controller: digit4, - keyboardType: TextInputType.number, - decoration: - buildInputDecoration(context), - onFieldSubmitted: (_) { - FocusScope.of(context) - .requestFocus(focusD4); - }, - onChanged: (val) { - if (val.length == 1) { - verifyAccountFormValue['digit4'] = - val.trim(); - checkValue(); - } - }, - validator: validateCodeDigit)), + Column( + mainAxisAlignment: MainAxisAlignment.start, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + AppText( + TranslationBase.of(context).validationMessage + + ' ', + + textAlign: TextAlign.start, + fontWeight: FontWeight.w700, + letterSpacing: -0.48, + color: Color(0xFF2B353E), + fontSize: SizeConfig.getTextMultiplierBasedOnWidth(width: dialogWidth) * 3.5, + ), + AppText( + displayTime, + color: Colors.red, + textAlign: TextAlign.start, + fontWeight: FontWeight.bold, + fontSize: SizeConfig.getTextMultiplierBasedOnWidth(width: dialogWidth) * 3.5, + ) + ]) ], - )), - ), - ), - Padding( - padding: const EdgeInsets.all(12.0), - child: Column( - mainAxisAlignment: MainAxisAlignment.start, - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - AppText( - TranslationBase.of(context).validationMessage + - ' ', - fontWeight: FontWeight.w600, - fontSize: 14, ), - AppText( - displayTime, - color: Colors.red, - textAlign: TextAlign.start, - fontWeight: FontWeight.bold, - fontSize: 14, - ) - ]), - ) - ], - ))), - ); - }), - ); - }); + ), + ); + + }) + + + ), + ), + ), + ), + ), + ), + + ); } TextStyle buildTextStyle() { return TextStyle( - fontSize: SizeConfig.textMultiplier * 3, + fontSize: SizeConfig.textMultiplier * 2.5, ); } diff --git a/lib/widgets/auth/verification_methods_list.dart b/lib/widgets/auth/verification_methods_list.dart index 27dbe8bf..0e9fe7b8 100644 --- a/lib/widgets/auth/verification_methods_list.dart +++ b/lib/widgets/auth/verification_methods_list.dart @@ -42,7 +42,7 @@ class _VerificationMethodsListState extends State { {widget.authenticateUser(AuthMethodTypes.WhatsApp, true)}, label: TranslationBase .of(context) - .verifyWith+ TranslationBase.of(context).verifyWhatsApp, + .verifyWith+"\n"+ TranslationBase.of(context).verifyWhatsApp, ); break; case AuthMethodTypes.SMS: @@ -51,7 +51,7 @@ class _VerificationMethodsListState extends State { onTap: () => {widget.authenticateUser(AuthMethodTypes.SMS, true)}, label:TranslationBase .of(context) - .verifyWith+ TranslationBase.of(context).verifySMS, + .verifyWith+ "\n"+ TranslationBase.of(context).verifySMS, ); break; case AuthMethodTypes.Fingerprint: @@ -66,7 +66,7 @@ class _VerificationMethodsListState extends State { }, label: TranslationBase .of(context) - .verifyWith+TranslationBase.of(context).verifyFingerprint, + .verifyWith+"\n"+TranslationBase.of(context).verifyFingerprint, ); break; case AuthMethodTypes.FaceID: @@ -80,7 +80,7 @@ class _VerificationMethodsListState extends State { }, label: TranslationBase .of(context) - .verifyWith+TranslationBase.of(context).verifyFaceID, + .verifyWith+"\n"+TranslationBase.of(context).verifyFaceID, ); break; @@ -89,7 +89,7 @@ class _VerificationMethodsListState extends State { assetPath: 'assets/images/login/more_icon.png', onTap: widget.onShowMore, label: TranslationBase.of(context).moreVerification, - height: 0, + // height: 40, ); } } diff --git a/lib/widgets/dashboard/activity_button.dart b/lib/widgets/dashboard/activity_button.dart deleted file mode 100644 index ff9db962..00000000 --- a/lib/widgets/dashboard/activity_button.dart +++ /dev/null @@ -1,44 +0,0 @@ -import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart'; -import 'package:flutter/material.dart'; - -class GetActivityButton extends StatelessWidget { - final value; - - GetActivityButton(this.value); - - @override - Widget build(BuildContext context) { - return Container( - width: MediaQuery.of(context).size.height * 0.125, - padding: EdgeInsets.all(5), - margin: EdgeInsets.all(5), - decoration: BoxDecoration( - color: Colors.white, - borderRadius: BorderRadius.circular(15), - ), - child: Padding( - padding: const EdgeInsets.fromLTRB(8, 0, 8, 0), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - mainAxisAlignment: MainAxisAlignment.center, - children: [ - AppText( - value.value.toString(), - fontSize: 27, - fontWeight: FontWeight.bold, - color: Color(0xFF2B353E), - ), - AppText( - value.kPIParameter, - textOverflow: TextOverflow.clip, - fontSize: 10, - color: Color(0xFF2B353E), - textAlign: TextAlign.start, - fontWeight: FontWeight.w700, - ), - ], - ), - ), - ); - } -} diff --git a/lib/widgets/dashboard/activity_card.dart b/lib/widgets/dashboard/activity_card.dart new file mode 100644 index 00000000..30e889f8 --- /dev/null +++ b/lib/widgets/dashboard/activity_card.dart @@ -0,0 +1,50 @@ +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 GetActivityCard extends StatelessWidget { + final value; + + GetActivityCard(this.value); + + @override + Widget build(BuildContext context) { + double width = SizeConfig.heightMultiplier* (SizeConfig.isHeightVeryShort?16:SizeConfig.isHeightShort?14:SizeConfig.isHeightLarge?15:13); + return Container( + width: width, + padding: EdgeInsets.symmetric(horizontal: SizeConfig.heightMultiplier * .4, vertical: SizeConfig.heightMultiplier * .2), + margin: EdgeInsets.all(SizeConfig.widthMultiplier *1), + decoration: BoxDecoration( + color: Colors.white, + borderRadius: BorderRadius.circular(15), + ), + child: Padding( + padding: const EdgeInsets.fromLTRB(8,8, 8, 4), + child: Center( + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + mainAxisAlignment: MainAxisAlignment.start, + children: [ + AppText( + value.value.toString(), + fontSize: SizeConfig.getTextMultiplierBasedOnWidth(width: width)* 25, + fontWeight: FontWeight.bold, + color: Color(0xFF2B353E), + letterSpacing: -0.93, + ), + AppText( + value.kPIParameter, + textOverflow: TextOverflow.clip, + fontSize: SizeConfig.getTextMultiplierBasedOnWidth(width: width)* (SizeConfig.isHeightVeryShort?8: SizeConfig.isHeightShort?8: 9), + color: Color(0xFF2B353E), + textAlign: TextAlign.start, + fontWeight: FontWeight.w700, + letterSpacing: -0.33, + ), + ], + ), + ), + ), + ); + } +} diff --git a/lib/widgets/dashboard/out_patient_stack.dart b/lib/widgets/dashboard/out_patient_stack.dart index fe05d69d..941109b7 100644 --- a/lib/widgets/dashboard/out_patient_stack.dart +++ b/lib/widgets/dashboard/out_patient_stack.dart @@ -1,4 +1,7 @@ +import 'package:doctor_app_flutter/config/size_config.dart'; import 'package:doctor_app_flutter/models/dashboard/dashboard_model.dart'; +import 'package:doctor_app_flutter/screens/home/label.dart'; +import 'package:doctor_app_flutter/util/helpers.dart'; import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart'; import 'package:flutter/material.dart'; @@ -9,22 +12,40 @@ class GetOutPatientStack extends StatelessWidget { @override Widget build(BuildContext context) { + double barHeight = + SizeConfig.heightMultiplier * (SizeConfig.isHeightVeryShort ? 20 : SizeConfig.isHeightLarge?20:17); value.summaryoptions .sort((Summaryoptions a, Summaryoptions b) => b.value - a.value); var list = new List(); - value.summaryoptions.forEach((result) => - {list.add(getStack(result, value.summaryoptions.first.value,context))}); + value.summaryoptions.forEach((result) => { + list.add(getStack( + result, value.summaryoptions.first.value, context, barHeight)) + }); return Column( crossAxisAlignment: CrossAxisAlignment.start, mainAxisAlignment: MainAxisAlignment.spaceEvenly, children: [ Container( - height: 30, - child: AppText( - value.kPIName, - medium: true, - fontSize: 14, + padding: EdgeInsets.symmetric(horizontal: 5, vertical: 5), + child: Label( + firstLine: Helpers.getLabelFromKPI(value.kPIName), + secondLine: Helpers.getNameFromKPI(value.kPIName), + color: Color(0xFF2B353E), + firstLineFontSize: + SizeConfig.getHeightMultiplier(height: barHeight) * + (SizeConfig.isHeightVeryShort + ? 10 + : SizeConfig.isHeightShort + ? 10 + : 8.5), + secondLineFontSize: + SizeConfig.getHeightMultiplier(height: barHeight) * + (SizeConfig.isHeightVeryShort + ? 15 + : SizeConfig.isHeightShort + ? 15 + : 14.5), ), ), Row(mainAxisAlignment: MainAxisAlignment.spaceEvenly, children: list) @@ -32,7 +53,7 @@ class GetOutPatientStack extends StatelessWidget { ); } - getStack(Summaryoptions value, max,context) { + getStack(Summaryoptions value, max, context, barHeight) { return Expanded( child: Container( margin: EdgeInsets.symmetric(horizontal: 2), @@ -44,7 +65,7 @@ class GetOutPatientStack extends StatelessWidget { colors: [Color(0x8FF5F6FA), Colors.red[50]], // red to yellow tileMode: TileMode.mirror, // repeats the gradient over the canvas ), - borderRadius: BorderRadius.circular(8), + borderRadius: BorderRadius.circular(4), // color: Colors.red[50], ), child: Stack(children: [ @@ -55,15 +76,15 @@ class GetOutPatientStack extends StatelessWidget { child: Container( child: SizedBox(), padding: EdgeInsets.all(10), - height: max != 0 ? ((MediaQuery.of(context).size.height * 0.24 )* value.value) / max : 0, + height: max != 0 ? ((barHeight )* value.value) / max : 0, decoration: BoxDecoration( - borderRadius: BorderRadius.circular(8), + borderRadius: BorderRadius.circular(4), color: Color(0x63D02127), ), ), ), Container( - height: (MediaQuery.of(context).size.height * 0.24 ), + height: barHeight, margin: EdgeInsets.only(left: 5, top: 5), padding: EdgeInsets.all(10), child: RotatedBox( @@ -75,16 +96,18 @@ class GetOutPatientStack extends StatelessWidget { children: [ AppText( value.kPIParameter, - fontSize: 10, + fontSize: SizeConfig.getTextMultiplierBasedOnWidth() * 2.5, textAlign: TextAlign.center, color: Color(0xFF2B353E), fontWeight: FontWeight.w700, + letterSpacing: -0.3, ), AppText( ' (' + value.value.toString() + ') ', - fontSize: 12, + fontSize: SizeConfig.getTextMultiplierBasedOnWidth() * 2.5, textAlign: TextAlign.center, color: Color(0xFF2B353E), + letterSpacing: -0.3, fontWeight: FontWeight.bold, ), ], @@ -96,4 +119,5 @@ class GetOutPatientStack extends StatelessWidget { ), ); } + } diff --git a/lib/widgets/dashboard/row_count.dart b/lib/widgets/dashboard/row_count.dart index a22932f4..dcadb8be 100644 --- a/lib/widgets/dashboard/row_count.dart +++ b/lib/widgets/dashboard/row_count.dart @@ -1,15 +1,17 @@ +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 RowCounts extends StatelessWidget { final name; final int count; + final double height; final Color c; - RowCounts(this.name, this.count, this.c); + RowCounts(this.name, this.count, this.c, {this.height}); @override Widget build(BuildContext context) { return Container( - padding: EdgeInsets.only(top: 5, bottom: 5), + padding: EdgeInsets.only(top:SizeConfig.getHeightMultiplier(height:height )* 0.2 , bottom: SizeConfig.getHeightMultiplier(height:height )* 0.2), child: Row( crossAxisAlignment: CrossAxisAlignment.start, children: [ @@ -24,7 +26,7 @@ class RowCounts extends StatelessWidget { name, color: Colors.black, textAlign: TextAlign.start, // from TextAlign.center - fontSize: 11, + fontSize: SizeConfig.getTextMultiplierBasedOnWidth() * 2.5, textOverflow: TextOverflow.ellipsis, ), ), @@ -32,7 +34,7 @@ class RowCounts extends StatelessWidget { ' (' + count.toString() + ')', color: Colors.black, textAlign: TextAlign.center, - fontSize: 12, + fontSize: SizeConfig.getTextMultiplierBasedOnWidth() * 3, fontWeight: FontWeight.bold, ) ], @@ -45,8 +47,8 @@ class RowCounts extends StatelessWidget { Widget dot(Color c) { return Container( - padding: EdgeInsets.all(5.0), - margin: EdgeInsets.all(5.0), + padding: EdgeInsets.all(SizeConfig.getHeightMultiplier(height:height )* 2), + margin: EdgeInsets.all(SizeConfig.getHeightMultiplier(height:height )* 1), decoration: BoxDecoration(color: c, shape: BoxShape.circle)); } } diff --git a/lib/widgets/dashboard/swiper_rounded_pagination.dart b/lib/widgets/dashboard/swiper_rounded_pagination.dart index 7e5c2c70..c0360d96 100644 --- a/lib/widgets/dashboard/swiper_rounded_pagination.dart +++ b/lib/widgets/dashboard/swiper_rounded_pagination.dart @@ -1,3 +1,4 @@ +import 'package:doctor_app_flutter/config/size_config.dart'; import 'package:flutter/material.dart'; class SwiperRoundedPagination extends StatelessWidget { @@ -7,15 +8,14 @@ class SwiperRoundedPagination extends StatelessWidget { Widget build(BuildContext context) { return active == true ? Container( - height: 5, - width: 30, - // margin: EdgeInsets.only(10), + height: SizeConfig.heightMultiplier * .6, + width: SizeConfig.widthMultiplier * 6, decoration: BoxDecoration( borderRadius: BorderRadius.circular(5), color: Colors.black), ) : Container( - height: 5, - width: 8, + height: SizeConfig.heightMultiplier * .6, + width: SizeConfig.widthMultiplier * 2, margin: EdgeInsets.all(2), decoration: BoxDecoration( borderRadius: BorderRadius.circular(10), color: Colors.grey)); diff --git a/lib/widgets/patients/profile/patient-profile-app-bar.dart b/lib/widgets/patients/profile/patient-profile-app-bar.dart index 5cfbe59c..4c411476 100644 --- a/lib/widgets/patients/profile/patient-profile-app-bar.dart +++ b/lib/widgets/patients/profile/patient-profile-app-bar.dart @@ -249,7 +249,7 @@ class PatientProfileAppBar extends StatelessWidget if (patientProfileAppBarModel.patient.appointmentDate != null && patientProfileAppBarModel - .patient.appointmentDate.isNotEmpty) + .patient.appointmentDate.isNotEmpty && !isFromLabResult) Row( mainAxisAlignment: MainAxisAlignment.start, children: [ diff --git a/lib/widgets/patients/profile/profile-welcome-widget.dart b/lib/widgets/patients/profile/profile-welcome-widget.dart index 53228bc2..cd712a07 100644 --- a/lib/widgets/patients/profile/profile-welcome-widget.dart +++ b/lib/widgets/patients/profile/profile-welcome-widget.dart @@ -1,3 +1,4 @@ +import 'package:doctor_app_flutter/config/size_config.dart'; import 'package:doctor_app_flutter/core/viewModel/authentication_view_model.dart'; import 'package:flutter/material.dart'; import 'package:provider/provider.dart'; @@ -21,12 +22,9 @@ class ProfileWelcomeWidget extends StatelessWidget { widthFactor: 0.9, child: Row( mainAxisAlignment: MainAxisAlignment.end, - crossAxisAlignment: CrossAxisAlignment.start, + crossAxisAlignment: CrossAxisAlignment.center, children: [ this.isClinic == true ? clinicWidget : SizedBox(), - SizedBox( - width: 20, - ), if(authenticationViewModel.doctorProfile!=null) CircleAvatar( // radius: (52) @@ -35,8 +33,8 @@ class ProfileWelcomeWidget extends StatelessWidget { child: Image.network( authenticationViewModel.doctorProfile.doctorImageURL, fit: BoxFit.fill, - width: 75, - height: 75, + width: SizeConfig.widthMultiplier* 11, + height: SizeConfig.widthMultiplier* 11, ), ), backgroundColor: Colors.transparent, diff --git a/lib/widgets/shared/app_drawer_widget.dart b/lib/widgets/shared/app_drawer_widget.dart index b13a4f10..800bbc19 100644 --- a/lib/widgets/shared/app_drawer_widget.dart +++ b/lib/widgets/shared/app_drawer_widget.dart @@ -4,7 +4,6 @@ import 'package:doctor_app_flutter/icons_app/doctor_app_icons.dart'; import 'package:doctor_app_flutter/screens/reschedule-leaves/add-rescheduleleave.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/loader/gif_loader_dialog_utils.dart'; import 'package:flutter/material.dart'; import 'package:flutter/widgets.dart'; import 'package:provider/provider.dart'; @@ -31,6 +30,7 @@ class _AppDrawerState extends State { Widget build(BuildContext context) { AuthenticationViewModel authenticationViewModel = Provider.of(context); projectsProvider = Provider.of(context); + double drawerWidth = SizeConfig.realScreenWidth * 0.60; return RoundedContainer( child: Container( color: Colors.white, @@ -41,7 +41,6 @@ class _AppDrawerState extends State { child: ListView(padding: EdgeInsets.zero, children: [ Container( margin: EdgeInsets.symmetric(horizontal: 15), - // height: SizeConfig.heightMultiplier * 50, child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ @@ -50,8 +49,11 @@ class _AppDrawerState extends State { Container( child: Image.asset( 'assets/images/dr_app_logo.png', + width: SizeConfig.getWidthMultiplier( + width: drawerWidth) * (SizeConfig.isHeightVeryShort? 25:SizeConfig.isHeightShort?32: 32), + ), - margin: EdgeInsets.only(top: 10, bottom: 10), + margin: EdgeInsets.only(top: SizeConfig.heightMultiplier * (SizeConfig.isHeightVeryShort?1:2), bottom: SizeConfig.heightMultiplier * 0.5), ), Container( child: InkWell( @@ -60,16 +62,16 @@ class _AppDrawerState extends State { }, child: Icon( DoctorApp.close_1, - size: 20, + size: SizeConfig.heightMultiplier * 2, ), ), - margin: EdgeInsets.only(top: 20, bottom: 10), + margin: EdgeInsets.only(top: SizeConfig.heightMultiplier * (SizeConfig.isHeightVeryShort?2:3), bottom: SizeConfig.heightMultiplier * 0.5), ) ], crossAxisAlignment: CrossAxisAlignment.start, mainAxisAlignment: MainAxisAlignment.spaceBetween, ), - SizedBox(height: 5), + SizedBox(height: SizeConfig.heightMultiplier * (SizeConfig.isHeightVeryShort?0.5:1),), if (authenticationViewModel.doctorProfile != null) InkWell( onTap: () { @@ -85,31 +87,42 @@ class _AppDrawerState extends State { Padding( padding: EdgeInsets.only(top: 10), child: AppText( - TranslationBase.of(context).dr + - authenticationViewModel.doctorProfile?.doctorName, + TranslationBase + .of(context) + .dr + + authenticationViewModel.doctorProfile + ?.doctorName, fontWeight: FontWeight.bold, color: Color(0xFF2E303A), fontFamily: 'Poppins', - fontSize: 17, + fontSize: SizeConfig + .getTextMultiplierBasedOnWidth( + width: drawerWidth) * (SizeConfig.isWidthLarge?5: 8), ), ), Padding( padding: EdgeInsets.only(top: 0), child: AppText( - authenticationViewModel.doctorProfile?.clinicDescription, + authenticationViewModel.doctorProfile + ?.clinicDescription, fontWeight: FontWeight.w600, color: Color(0xFF2E303A), - fontSize: 15, + fontSize: SizeConfig + .getTextMultiplierBasedOnWidth( + width: drawerWidth) * (SizeConfig.isWidthLarge?3: 6), fontFamily: 'Poppins', )) ], ), ), - SizedBox(height: 40), + SizedBox(height: SizeConfig.heightMultiplier * (SizeConfig.isHeightVeryShort?4:6),), InkWell( child: DrawerItem( - TranslationBase.of(context).applyOrRescheduleLeave, + TranslationBase + .of(context) + .applyOrRescheduleLeave, icon: DoctorApp.reschedule__1, + drawerWidth: drawerWidth, // subTitle: , ), onTap: () { @@ -122,19 +135,26 @@ class _AppDrawerState extends State { )); }, ), - SizedBox(height: 15), + SizedBox(height: SizeConfig.heightMultiplier *2), InkWell( child: DrawerItem( - TranslationBase.of(context).myQRCode, + TranslationBase + .of(context) + .myQRCode, icon: DoctorApp.qr_code_3, + drawerWidth: drawerWidth, + // subTitle: , ), ), - SizedBox(height: 15), + SizedBox(height: SizeConfig.heightMultiplier *1.5), InkWell( child: Container( - height: 80, - child: Image.asset('assets/images/qr_code.png'), + // height: 80, + child: Image.asset('assets/images/qr_code.png', + width: SizeConfig.getWidthMultiplier( + width: drawerWidth) * (SizeConfig.isHeightVeryShort?25:30), + ), ), onTap: () {}, ), @@ -142,7 +162,7 @@ class _AppDrawerState extends State { ), ), SizedBox( - height: MediaQuery.of(context).size.height * 0.09, + height: SizeConfig.heightMultiplier *(SizeConfig.isHeightVeryShort?8:SizeConfig.isHeightShort?10:16), ), Container( margin: EdgeInsets.symmetric(horizontal: 20), @@ -150,13 +170,19 @@ class _AppDrawerState extends State { children: [ InkWell( child: DrawerItem( + projectsProvider.isArabic - ? TranslationBase.of(context).lanEnglish - : TranslationBase.of(context).lanArabic, + ? TranslationBase + .of(context) + .lanEnglish + : TranslationBase + .of(context) + .lanArabic, // icon: DoctorApp.qr_code, assetLink: projectsProvider.isArabic ? 'assets/images/usa-flag.png' : 'assets/images/saudi-arabia-flag.png', + drawerWidth: drawerWidth, ), onTap: () { if (projectsProvider.isArabic) @@ -165,11 +191,15 @@ class _AppDrawerState extends State { projectsProvider.changeLanguage('ar'); }, ), - SizedBox(height: 10), + SizedBox(height: SizeConfig.heightMultiplier *(SizeConfig.isHeightVeryShort?0.5:1) ), InkWell( child: DrawerItem( - TranslationBase.of(context).logout, + TranslationBase + .of(context) + .logout, icon: DoctorApp.logout_1, + drawerWidth: drawerWidth, + ), onTap: () async { Navigator.pop(context); @@ -186,7 +216,6 @@ class _AppDrawerState extends State { flex: 1, child: Column(children: [ Container( - // This align moves the children to the bottom child: Align( alignment: FractionalOffset.bottomCenter, child: Container( @@ -201,7 +230,9 @@ class _AppDrawerState extends State { style: TextStyle( color: Color(0xFF989898), fontWeight: FontWeight.bold, - fontSize: 14, + fontSize: SizeConfig + .getTextMultiplierBasedOnWidth( + width: drawerWidth) * (SizeConfig.isWidthLarge?4: 6), fontFamily: 'Poppins', ), children: [ @@ -209,24 +240,25 @@ class _AppDrawerState extends State { text: ' Cloud Solutions', style: TextStyle( color: Color(0xFF2E303A), - fontSize: 15, + fontSize: SizeConfig + .getTextMultiplierBasedOnWidth( + width: drawerWidth) * (SizeConfig.isWidthLarge?5: 7), fontFamily: 'Poppins', ), ) ]), ), ), - // Text("Powered by"), Image.asset( 'assets/images/cs_logo_container.png', width: SizeConfig.imageSizeMultiplier * 20, ) ], - )))) + )))) ])) - ])), + ])), ), - width: SizeConfig.realScreenWidth * 0.60, + width: drawerWidth, margin: EdgeInsets.all(0), customCornerRaduis: false, diff --git a/lib/widgets/shared/app_texts_widget.dart b/lib/widgets/shared/app_texts_widget.dart index 48661a32..3f07cc80 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; @@ -56,6 +57,7 @@ class AppText extends StatefulWidget { this.visibility = true, this.textOverflow, this.textDecoration, + this.letterSpacing, }); @override @@ -127,16 +129,15 @@ class _AppTextState extends State { fontWeight: widget.fontWeight ?? _getFontWeight(), height: widget.fontHeight) : TextStyle( - fontStyle: widget.italic ? FontStyle.italic : null, - color: - widget.color != null ? widget.color : Colors.black, - fontSize: widget.fontSize ?? _getFontSize(), - letterSpacing: - widget.variant == "overline" ? 1.5 : null, - fontWeight: widget.fontWeight ?? _getFontWeight(), - fontFamily: widget.fontFamily ?? 'Poppins', - decoration: widget.textDecoration, - height: widget.fontHeight), + fontStyle: widget.italic ? FontStyle.italic : null, + color: + widget.color != null ? widget.color : Colors.black, + fontSize: widget.fontSize ?? _getFontSize(), + letterSpacing: widget.letterSpacing, + fontWeight: widget.fontWeight ?? _getFontWeight(), + fontFamily: widget.fontFamily ?? 'Poppins', + decoration: widget.textDecoration, + height: widget.fontHeight), ), if (widget.readMore && text.length > widget.maxLength && hidden) Positioned( diff --git a/lib/widgets/shared/bottom_navigation_item.dart b/lib/widgets/shared/bottom_navigation_item.dart index e69ff690..aa986a39 100644 --- a/lib/widgets/shared/bottom_navigation_item.dart +++ b/lib/widgets/shared/bottom_navigation_item.dart @@ -1,3 +1,4 @@ +import 'package:doctor_app_flutter/config/size_config.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; @@ -21,7 +22,8 @@ class BottomNavigationItem extends StatelessWidget { Widget build(BuildContext context) { return Expanded( child: SizedBox( - height: 70.0, + height: SizeConfig.heightMultiplier * + (SizeConfig.isHeightVeryShort ? 10 :SizeConfig.isHeightShort ? 8: 8), child: Material( type: MaterialType.transparency, child: InkWell( @@ -32,22 +34,28 @@ class BottomNavigationItem extends StatelessWidget { mainAxisSize: MainAxisSize.min, mainAxisAlignment: MainAxisAlignment.center, children: [ - SizedBox(height: 15,), + SizedBox(height: SizeConfig.getHeightMultiplier(height:SizeConfig.heightMultiplier * + (SizeConfig.isHeightVeryShort ? 12:SizeConfig.isHeightShort ?10 : 9) ) * 10,), Container( + margin: EdgeInsets.only(bottom: 3), child: Icon(currentIndex == index ? activeIcon : icon, color: currentIndex == index ? Color(0xFF333C45) - : Theme.of(context).dividerColor, - size: 22.0), + : Color(0xFF989898), + size: SizeConfig.getHeightMultiplier(height:SizeConfig.heightMultiplier * + (SizeConfig.isHeightVeryShort ? 10:SizeConfig.isHeightShort ?8.5 : 7) ) * 40,), ), - SizedBox(height: 5,), + SizedBox(height: SizeConfig.getHeightMultiplier(height:SizeConfig.heightMultiplier * + (SizeConfig.isHeightVeryShort ? 10 : 6) ) * 0.5,), Expanded( child: Text( name, + textAlign: TextAlign.center, style: TextStyle( + fontSize: SizeConfig.getTextMultiplierBasedOnWidth() * 2, color: currentIndex == index - ? Theme.of(context).primaryColor - : Theme.of(context).dividerColor, + ? Color(0xFF333C45) + : Color(0xFF989898)//#989898, ), ), ), diff --git a/lib/widgets/shared/buttons/app_buttons_widget.dart b/lib/widgets/shared/buttons/app_buttons_widget.dart index ed3e6e98..d2a5b2a0 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, @@ -39,7 +40,7 @@ class AppButton extends StatefulWidget { this.hPadding = 0, this.radius = 8.0, this.hasBorder = false, - this.borderColor, + this.borderColor, this.height, }); _AppButtonState createState() => _AppButtonState(); @@ -49,7 +50,7 @@ class _AppButtonState extends State { @override 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/drawer_item_widget.dart b/lib/widgets/shared/drawer_item_widget.dart index 2b8ce40d..6d381cad 100644 --- a/lib/widgets/shared/drawer_item_widget.dart +++ b/lib/widgets/shared/drawer_item_widget.dart @@ -11,8 +11,9 @@ class DrawerItem extends StatefulWidget { final IconData icon; final Color color; final String assetLink; + final double drawerWidth; - DrawerItem(this.title, {this.icon, this.color, this.subTitle = '', this.assetLink}); + DrawerItem(this.title, {this.icon, this.color, this.subTitle = '', this.assetLink, this.drawerWidth}); @override _DrawerItemState createState() => _DrawerItemState(); @@ -28,15 +29,15 @@ class _DrawerItemState extends State { children: [ if(widget.assetLink!=null) Container( - height: 20, - width: 20, + height: SizeConfig.imageSizeMultiplier * (SizeConfig.isWidthLarge?3: 5), + width: SizeConfig.imageSizeMultiplier * (SizeConfig.isWidthLarge?3: 5), child: Image.asset(widget.assetLink), ), if(widget.assetLink==null) Icon( widget.icon, color: widget.color ?? Colors.black87, - size: SizeConfig.imageSizeMultiplier * 5, + size: SizeConfig.imageSizeMultiplier * (SizeConfig.isWidthLarge?3: 5), ), Expanded( child: Column( @@ -50,7 +51,7 @@ class _DrawerItemState extends State { marginLeft: 5, marginRight: 5, color:widget.color ??Color(0xFF2E303A), - fontSize: 14, + fontSize: SizeConfig.getTextMultiplierBasedOnWidth(width: widget.drawerWidth ) * (SizeConfig.isHeightVeryShort?5:(SizeConfig.isWidthLarge?4: 6)), fontFamily: 'Poppins', fontWeight: FontWeight.w600, ), diff --git a/pubspec.lock b/pubspec.lock index 25596d43..77df9848 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -629,7 +629,7 @@ packages: name: meta url: "https://pub.dartlang.org" source: hosted - version: "1.3.0-nullsafety.4" + version: "1.3.0-nullsafety.3" mime: dependency: transitive description: @@ -921,7 +921,7 @@ packages: name: stack_trace url: "https://pub.dartlang.org" source: hosted - version: "1.10.0-nullsafety.2" + version: "1.10.0-nullsafety.1" sticky_headers: dependency: "direct main" description: @@ -1119,5 +1119,5 @@ packages: source: hosted version: "2.2.1" sdks: - dart: ">=2.10.0 <=2.11.0-213.1.beta" + dart: ">=2.10.0 <2.11.0" flutter: ">=1.22.0 <2.0.0"