diff --git a/assets/fonts/DoctorApp.ttf b/assets/fonts/DoctorApp.ttf index aa108809..4ef2028b 100644 Binary files a/assets/fonts/DoctorApp.ttf and b/assets/fonts/DoctorApp.ttf differ diff --git a/ios/Podfile.lock b/ios/Podfile.lock index 878a1850..1cf7499c 100644 --- a/ios/Podfile.lock +++ b/ios/Podfile.lock @@ -58,6 +58,8 @@ PODS: - Flutter (1.0.0) - flutter_flexible_toast (0.0.1): - Flutter + - flutter_inappwebview (0.0.1): + - Flutter - flutter_plugin_android_lifecycle (0.0.1): - Flutter - GoogleDataTransport (7.5.1): @@ -151,6 +153,7 @@ DEPENDENCIES: - firebase_messaging (from `.symlinks/plugins/firebase_messaging/ios`) - Flutter (from `Flutter`) - flutter_flexible_toast (from `.symlinks/plugins/flutter_flexible_toast/ios`) + - flutter_inappwebview (from `.symlinks/plugins/flutter_inappwebview/ios`) - flutter_plugin_android_lifecycle (from `.symlinks/plugins/flutter_plugin_android_lifecycle/ios`) - hexcolor (from `.symlinks/plugins/hexcolor/ios`) - imei_plugin (from `.symlinks/plugins/imei_plugin/ios`) @@ -218,6 +221,8 @@ EXTERNAL SOURCES: :path: Flutter flutter_flexible_toast: :path: ".symlinks/plugins/flutter_flexible_toast/ios" + flutter_inappwebview: + :path: ".symlinks/plugins/flutter_inappwebview/ios" flutter_plugin_android_lifecycle: :path: ".symlinks/plugins/flutter_plugin_android_lifecycle/ios" hexcolor: @@ -285,6 +290,7 @@ SPEC CHECKSUMS: FirebaseMessaging: 5eca4ef173de76253352511aafef774caa1cba2a Flutter: 0e3d915762c693b495b44d77113d4970485de6ec flutter_flexible_toast: 0547e740cae0c33bb7c51bcd931233f4584e1143 + flutter_inappwebview: 69dfbac46157b336ffbec19ca6dfd4638c7bf189 flutter_plugin_android_lifecycle: dc0b544e129eebb77a6bfb1239d4d1c673a60a35 GoogleDataTransport: f56af7caa4ed338dc8e138a5d7c5973e66440833 GoogleUtilities: 7f2f5a07f888cdb145101d6042bc4422f57e70b3 @@ -322,4 +328,4 @@ SPEC CHECKSUMS: PODFILE CHECKSUM: 649616dc336b3659ac6b2b25159d8e488e042b69 -COCOAPODS: 1.10.1 +COCOAPODS: 1.10.0.rc.1 diff --git a/lib/client/base_app_client.dart b/lib/client/base_app_client.dart index 0f2cf68c..7336db13 100644 --- a/lib/client/base_app_client.dart +++ b/lib/client/base_app_client.dart @@ -3,12 +3,14 @@ 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/viewModel/authentication_view_model.dart'; import 'package:doctor_app_flutter/models/doctor/doctor_profile_model.dart'; import 'package:doctor_app_flutter/models/patient/patiant_info_model.dart'; import 'package:doctor_app_flutter/util/dr_app_shared_pref.dart'; import 'package:doctor_app_flutter/util/helpers.dart'; import 'package:flutter/cupertino.dart'; import 'package:http/http.dart' as http; +import 'package:provider/provider.dart'; DrAppSharedPreferances sharedPref = new DrAppSharedPreferances(); Helpers helpers = new Helpers(); @@ -21,6 +23,8 @@ class BaseAppClient { Function(String error, int statusCode) onFailure, bool isAllowAny = false}) async { String url = BASE_URL + endPoint; + + bool callLog= true; try { Map profile = await sharedPref.getObj(DOCTOR_PROFILE); String token = await sharedPref.getString(TOKEN); @@ -34,6 +38,7 @@ class BaseAppClient { if (body['ProjectID'] == null) { body['ProjectID'] = doctorProfile?.projectID; } + if (body['ClinicID'] == null) body['ClinicID'] = doctorProfile?.clinicID; } @@ -43,7 +48,7 @@ class BaseAppClient { if (body['EditedBy'] == '') { body.remove("EditedBy"); } - body['TokenID'] = "@dm!n" ?? ''; + body['TokenID'] = token ?? ''; String lang = await sharedPref.getString(APP_Language); if (lang != null && lang == 'ar') body['LanguageID'] = 1; @@ -67,10 +72,10 @@ class BaseAppClient { await sharedPref.getString(VIDA_REFRESH_TOKEN_ID); } - int projectID = await sharedPref.getInt(PROJECT_ID); - if (projectID == 2 || projectID == 3) - body['PatientOutSA'] = true; - else + //int projectID = await sharedPref.getInt(PROJECT_ID); + //if (projectID == 2 || projectID == 3) + // body['PatientOutSA'] = true; + //else body['PatientOutSA'] = false; body['DeviceTypeID'] = Platform.isAndroid ? 1 : 2; @@ -99,7 +104,7 @@ class BaseAppClient { if (body['OTP_SendType'] != null) { onFailure(getError(parsed), statusCode); } else if (!isAllowAny) { - await Helpers.logout(); + await Provider.of(AppGlobal.CONTEX, listen: false).logout(); Helpers.showErrorToast('Your session expired Please login again'); } if (isAllowAny) { @@ -140,13 +145,11 @@ class BaseAppClient { String token = await sharedPref.getString(TOKEN); var languageID = await sharedPref.getStringWithDefaultValue(APP_Language, 'en'); - if (body.containsKey('SetupID')) { - body['SetupID'] = body.containsKey('SetupID') - ? body['SetupID'] != null - ? body['SetupID'] - : SETUP_ID - : SETUP_ID; - } + body['SetupID'] = body.containsKey('SetupID') + ? body['SetupID'] != null + ? body['SetupID'] + : SETUP_ID + : SETUP_ID; body['VersionID'] = VERSION_ID; body['Channel'] = CHANNEL; @@ -187,7 +190,7 @@ class BaseAppClient { : PATIENT_TYPE_ID : PATIENT_TYPE_ID; - body['TokenID'] = token; + body['TokenID'] = body.containsKey('TokenID') ? body['TokenID'] : token; body['PatientID'] = body['PatientID'] != null ? body['PatientID'] : patient.patientId ?? patient.patientMRN; diff --git a/lib/config/config.dart b/lib/config/config.dart index 2410617c..0e8106bc 100644 --- a/lib/config/config.dart +++ b/lib/config/config.dart @@ -4,8 +4,8 @@ const MAX_SMALL_SCREEN = 660; const ONLY_NUMBERS = "[0-9]"; const ONLY_LETTERS = "[a-zA-Z &'\"]"; const ONLY_DATE = "[0-9/]"; -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 = @@ -283,6 +283,12 @@ const GET_SICK_LEAVE_PATIENT = "Services/Patients.svc/REST/GetPatientSickLeave"; const GET_MY_OUT_PATIENT = "Services/DoctorApplication.svc/REST/GetMyOutPatient"; + +const PATIENT_MEDICAL_REPORT_GET_LIST = "Services/Patients.svc/REST/DAPP_ListMedicalReport"; +const PATIENT_MEDICAL_REPORT_GET_TEMPLATE = "Services/Patients.svc/REST/DAPP_GetTemplateByID"; +const PATIENT_MEDICAL_REPORT_INSERT = "Services/Patients.svc/REST/DAPP_InsertMedicalReport"; +const PATIENT_MEDICAL_REPORT_VERIFIED = "Services/Patients.svc/REST/DAPP_VerifiedMedicalReport"; + const GET_PROCEDURE_TEMPLETE = 'Services/Doctors.svc/REST/DAPP_ProcedureTemplateGet'; @@ -332,9 +338,6 @@ var SERVICES_PATIANT_HEADER_AR = [ "المريض المحول مني", "المريض الواصل" ]; -//****************** - -// Colors ////// by : ibrahim var DEVICE_TOKEN = ""; const PRIMARY_COLOR = 0xff515B5D; diff --git a/lib/config/localized_values.dart b/lib/config/localized_values.dart index f86c4a02..dcc4aa1f 100644 --- a/lib/config/localized_values.dart +++ b/lib/config/localized_values.dart @@ -31,8 +31,10 @@ const Map> localizedValues = { }, 'outPatients': {'en': 'Out Patient', 'ar': 'المريض الخارجي'}, 'myOutPatient': {'en': 'My OutPatients', 'ar': 'المريض الخارجي'}, + 'myOutPatient_2lines': {'en': 'My\nOutPatients', 'ar': 'المريض\nالخارجي'}, 'searchPatient': {'en': 'Search Patients', 'ar': 'البحث عن مريض'}, + 'searchPatientDashBoard': {'en': 'Search\nPatients', 'ar': 'البحث\nعن مريض'}, 'searchAbout': {'en': 'Search', 'ar': 'البحث عن'}, 'patient': {'en': 'Patient', 'ar': ' مريض'}, 'patients': {'en': "Patient's", 'ar': ' مريض'}, @@ -48,11 +50,12 @@ const Map> localizedValues = { 'service': {'en': 'Service', 'ar': 'خدمة'}, 'referral': {'en': 'Referral', 'ar': 'الإحالة'}, 'inPatient': {'en': 'InPatients', 'ar': 'مرضاي'}, + 'myInPatient': {'en': 'My\nInPatients', 'ar': 'مرضاي\nالداخليين'}, 'inPatientLabel': {'en': 'InPatients', 'ar': 'المريض الداخلي'}, 'inPatientAll': {'en': 'All InPatients', 'ar': 'كل المرضى'}, 'operations': {'en': 'Operations', 'ar': 'عمليات'}, 'patientServices': {'en': 'Patient Services', 'ar': 'خدمات المرضى'}, - 'searchMedicine': {'en': 'Search Medicines', 'ar': 'بحث عن الدواء'}, + 'searchMedicineDashboard': {'en': 'Search\nMedicines', 'ar': 'بحث\nعن الدواء'}, 'myReferralPatient': {'en': 'My Referral Patient', 'ar': 'مرضى الاحالة'}, 'referPatient': {'en': 'Referral Patient', 'ar': 'إحالة مريض'}, 'myReferral': {'en': 'My Referral', 'ar': 'إحالة'}, @@ -578,10 +581,11 @@ const Map> localizedValues = { "ar": "الرجاء اختيار احدى الخيارات التالية للتحقق من البيانات" }, "register-user": {"en": "Register", "ar": "تسجيل"}, - "verify-with-fingerprint": {"en": "Verify through Fingerprint", "ar": "بصمة"}, - "verify-with-faceid": {"en": "Verify through Face ID", "ar": "معرف الوجه"}, - "verify-with-sms": {"en": "Verify through SMS", "ar": "الرسائل القصيرة"}, - "verify-with-whatsapp": {"en": "Verify through WhatsApp", "ar": " الواتس اب"}, + "verify-with-fingerprint": {"en": "Fingerprint", "ar": "بصمة"}, + "verify-with-faceid": {"en": "Face ID", "ar": "معرف الوجه"}, + "verify-with-sms": {"en": " SMS", "ar": "الرسائل القصيرة"}, + "verify-with-whatsapp": {"en": "WhatsApp", "ar": " الواتس اب"}, + "verify-with": {"en": "Verify through ", "ar": " الواتس اب"}, "last-login": { "en": "Last login details:", "ar": "تفاصيل تسجيل الدخول الأخير:" @@ -760,6 +764,7 @@ const Map> localizedValues = { 'no-clinic': {'en': "No Clinic", 'ar': "لا عيادة"}, 'otherStatistic': {'en': "Other Statistics", 'ar': "إحصائيات أخرى"}, 'ptientsreferral': {'en': "Patient's Referrals", 'ar': "إحالات المريض"}, + 'myPatientsReferral': {'en': "Patient's\nReferrals", 'ar': "إحالات\nالمريض"}, 'arrivalpatient': {'en': "Arrival Patients", 'ar': "المرضى القادمون"}, 'searchmedicinepatient': { 'en': "Search patient or Medicines", @@ -976,4 +981,19 @@ const Map> localizedValues = { "medicalReportAdd": {"en": "Add Medical Report", "ar": "إضافة تقرير طبي"}, "medicalReportVerify": {"en": "Verify Medical Report", "ar": "تحقق من التقرير الطبي"}, "comments": {"en": "Comments", "ar": "تعليقات"}, + "initiateCall ": {"en": "Initiate Call ", "ar": "بدء الاتصال"}, + "transferTo": {"en": "Transfer To ", "ar": "حول إلى"}, + "admin": {"en": "Admin", "ar": "مشرف"}, + "instructions": {"en": "Instructions", "ar": "تعليمات"}, + "sendLC": {"en": "Send", "ar": "تعليمات"}, + "endLC": {"en": "End", "ar": "انهاء"}, + "consultation": {"en": "Consultation", "ar": "استشارة"}, + "resume": {"en": "Resume", "ar": "استأنف"}, + "theCall": {"en": "The Call", "ar": "الاتصال"}, + "createNewMedicalReport": {"en": "Create New Medical Report", "ar": "إنشاء تقرير طبي جديد"}, + "historyPhysicalFinding": {"en": "History and Physical Finding", "ar": "التاريخ والاكتشاف المادي"}, + "laboratoryPhysicalData": {"en": "Laboratory and Physical Data", "ar": "المعامل والبيانات الفيزيائية"}, + "impressionRecommendation": {"en": "Impression and Recommendation", "ar": "الانطباع والتوصية"}, + "onHold": {"en": "'On Hold'", "ar": "قيد الانتظار"}, + "verified": {"en": "'Verified'", "ar": "Verified"}, }; diff --git a/lib/core/enum/auth_method_types.dart b/lib/core/enum/auth_method_types.dart new file mode 100644 index 00000000..82577eeb --- /dev/null +++ b/lib/core/enum/auth_method_types.dart @@ -0,0 +1,46 @@ +enum AuthMethodTypes { SMS, WhatsApp, Fingerprint,FaceID,MoreOptions } +extension SelectedAuthMethodTypesService on AuthMethodTypes { + // ignore: missing_return + int getTypeIdService() { + switch (this) { + case AuthMethodTypes.SMS: + return 1; + break; + case AuthMethodTypes.WhatsApp: + return 2; + break; + case AuthMethodTypes.Fingerprint: + return 3; + break; + case AuthMethodTypes.FaceID: + return 4; + break; + case AuthMethodTypes.MoreOptions: + return 5; + break; + + } + } + + // ignore: missing_return + static getMethodsTypeService( int typeId) { + switch (typeId) { + case 1: + return AuthMethodTypes.SMS; + break; + case 2: + return AuthMethodTypes.WhatsApp; + break; + case 3: + return AuthMethodTypes.Fingerprint; + break; + case 4: + return AuthMethodTypes.FaceID; + break; + case 5: + return AuthMethodTypes.MoreOptions; + break; + + } + } +} \ No newline at end of file diff --git a/lib/models/auth/activation_Code_req_model.dart b/lib/core/model/auth/activation_Code_req_model.dart similarity index 100% rename from lib/models/auth/activation_Code_req_model.dart rename to lib/core/model/auth/activation_Code_req_model.dart diff --git a/lib/models/auth/send_activation_code_model2.dart b/lib/core/model/auth/activation_code_for_verification_screen_model.dart similarity index 91% rename from lib/models/auth/send_activation_code_model2.dart rename to lib/core/model/auth/activation_code_for_verification_screen_model.dart index 68a90c85..28cc58db 100644 --- a/lib/models/auth/send_activation_code_model2.dart +++ b/lib/core/model/auth/activation_code_for_verification_screen_model.dart @@ -1,4 +1,4 @@ -class ActivationCodeModel2 { +class ActivationCodeForVerificationScreenModel { int oTPSendType; String mobileNumber; String zipCode; @@ -12,7 +12,7 @@ class ActivationCodeModel2 { String vidaAuthTokenID; String vidaRefreshTokenID; String iMEI; - ActivationCodeModel2( + ActivationCodeForVerificationScreenModel( {this.oTPSendType, this.mobileNumber, this.zipCode, @@ -27,7 +27,7 @@ class ActivationCodeModel2 { this.vidaRefreshTokenID, this.iMEI}); - ActivationCodeModel2.fromJson(Map json) { + ActivationCodeForVerificationScreenModel.fromJson(Map json) { oTPSendType = json['OTP_SendType']; mobileNumber = json['MobileNumber']; zipCode = json['ZipCode']; diff --git a/lib/core/model/auth/check_activation_code_for_doctor_app_response_model.dart b/lib/core/model/auth/check_activation_code_for_doctor_app_response_model.dart new file mode 100644 index 00000000..c5ff29e6 --- /dev/null +++ b/lib/core/model/auth/check_activation_code_for_doctor_app_response_model.dart @@ -0,0 +1,192 @@ +import 'package:doctor_app_flutter/models/doctor/doctor_profile_model.dart'; + +class CheckActivationCodeForDoctorAppResponseModel { + String authenticationTokenID; + List listDoctorsClinic; + List listDoctorProfile; + MemberInformation memberInformation; + + CheckActivationCodeForDoctorAppResponseModel( + {this.authenticationTokenID, + this.listDoctorsClinic, + this.memberInformation}); + + CheckActivationCodeForDoctorAppResponseModel.fromJson( + Map json) { + authenticationTokenID = json['AuthenticationTokenID']; + if (json['List_DoctorsClinic'] != null) { + listDoctorsClinic = new List(); + json['List_DoctorsClinic'].forEach((v) { + listDoctorsClinic.add(new ListDoctorsClinic.fromJson(v)); + }); + } + + if (json['List_DoctorProfile'] != null) { + listDoctorProfile = new List(); + json['List_DoctorProfile'].forEach((v) { + listDoctorProfile.add(new DoctorProfileModel.fromJson(v)); + }); + } + + memberInformation = json['memberInformation'] != null + ? new MemberInformation.fromJson(json['memberInformation']) + : null; + } + + Map toJson() { + final Map data = new Map(); + data['AuthenticationTokenID'] = this.authenticationTokenID; + if (this.listDoctorsClinic != null) { + data['List_DoctorsClinic'] = + this.listDoctorsClinic.map((v) => v.toJson()).toList(); + } + + if (this.listDoctorProfile != null) { + data['List_DoctorProfile'] = + this.listDoctorProfile.map((v) => v.toJson()).toList(); + } + if (this.memberInformation != null) { + data['memberInformation'] = this.memberInformation.toJson(); + } + return data; + } +} + +class ListDoctorsClinic { + Null setupID; + int projectID; + int doctorID; + int clinicID; + bool isActive; + String clinicName; + + ListDoctorsClinic({this.setupID, + this.projectID, + this.doctorID, + this.clinicID, + this.isActive, + this.clinicName}); + + ListDoctorsClinic.fromJson(Map json) { + setupID = json['SetupID']; + projectID = json['ProjectID']; + doctorID = json['DoctorID']; + clinicID = json['ClinicID']; + isActive = json['IsActive']; + clinicName = json['ClinicName']; + } + + Map toJson() { + final Map data = new Map(); + data['SetupID'] = this.setupID; + data['ProjectID'] = this.projectID; + data['DoctorID'] = this.doctorID; + data['ClinicID'] = this.clinicID; + data['IsActive'] = this.isActive; + data['ClinicName'] = this.clinicName; + return data; + } +} + +class MemberInformation { + List clinics; + int doctorId; + String email; + int employeeId; + int memberId; + Null memberName; + Null memberNameArabic; + String preferredLanguage; + List roles; + + MemberInformation({this.clinics, + this.doctorId, + this.email, + this.employeeId, + this.memberId, + this.memberName, + this.memberNameArabic, + this.preferredLanguage, + this.roles}); + + MemberInformation.fromJson(Map json) { + if (json['clinics'] != null) { + clinics = new List(); + json['clinics'].forEach((v) { + clinics.add(new Clinics.fromJson(v)); + }); + } + doctorId = json['doctorId']; + email = json['email']; + employeeId = json['employeeId']; + memberId = json['memberId']; + memberName = json['memberName']; + memberNameArabic = json['memberNameArabic']; + preferredLanguage = json['preferredLanguage']; + if (json['roles'] != null) { + roles = new List(); + json['roles'].forEach((v) { + roles.add(new Roles.fromJson(v)); + }); + } + } + + Map toJson() { + final Map data = new Map(); + if (this.clinics != null) { + data['clinics'] = this.clinics.map((v) => v.toJson()).toList(); + } + data['doctorId'] = this.doctorId; + data['email'] = this.email; + data['employeeId'] = this.employeeId; + data['memberId'] = this.memberId; + data['memberName'] = this.memberName; + data['memberNameArabic'] = this.memberNameArabic; + data['preferredLanguage'] = this.preferredLanguage; + if (this.roles != null) { + data['roles'] = this.roles.map((v) => v.toJson()).toList(); + } + return data; + } +} + +class Clinics { + bool defaultClinic; + int id; + String name; + + Clinics({this.defaultClinic, this.id, this.name}); + + Clinics.fromJson(Map json) { + defaultClinic = json['defaultClinic']; + id = json['id']; + name = json['name']; + } + + Map toJson() { + final Map data = new Map(); + data['defaultClinic'] = this.defaultClinic; + data['id'] = this.id; + data['name'] = this.name; + return data; + } +} + +class Roles { + String name; + int roleId; + + Roles({this.name, this.roleId}); + + Roles.fromJson(Map json) { + name = json['name']; + roleId = json['roleId']; + } + + Map toJson() { + final Map data = new Map(); + data['name'] = this.name; + data['roleId'] = this.roleId; + return data; + } +} diff --git a/lib/models/auth/check_activation_code_request_model.dart b/lib/core/model/auth/check_activation_code_request_model.dart similarity index 100% rename from lib/models/auth/check_activation_code_request_model.dart rename to lib/core/model/auth/check_activation_code_request_model.dart diff --git a/lib/core/model/auth/new_login_information_response_model.dart b/lib/core/model/auth/new_login_information_response_model.dart new file mode 100644 index 00000000..117060e4 --- /dev/null +++ b/lib/core/model/auth/new_login_information_response_model.dart @@ -0,0 +1,113 @@ +class NewLoginInformationModel { + int doctorID; + List listMemberInformation; + String logInTokenID; + String mobileNumber; + Null sELECTDeviceIMEIbyIMEIList; + int userID; + String zipCode; + bool isActiveCode; + bool isSMSSent; + + NewLoginInformationModel( + {this.doctorID, + this.listMemberInformation, + this.logInTokenID, + this.mobileNumber, + this.sELECTDeviceIMEIbyIMEIList, + this.userID, + this.zipCode, + this.isActiveCode, + this.isSMSSent}); + + NewLoginInformationModel.fromJson(Map json) { + doctorID = json['DoctorID']; + if (json['List_MemberInformation'] != null) { + listMemberInformation = new List(); + json['List_MemberInformation'].forEach((v) { + listMemberInformation.add(new ListMemberInformation.fromJson(v)); + }); + } + logInTokenID = json['LogInTokenID']; + mobileNumber = json['MobileNumber']; + sELECTDeviceIMEIbyIMEIList = json['SELECTDeviceIMEIbyIMEI_List']; + userID = json['UserID']; + zipCode = json['ZipCode']; + isActiveCode = json['isActiveCode']; + isSMSSent = json['isSMSSent']; + } + + Map toJson() { + final Map data = new Map(); + data['DoctorID'] = this.doctorID; + if (this.listMemberInformation != null) { + data['List_MemberInformation'] = + this.listMemberInformation.map((v) => v.toJson()).toList(); + } + data['LogInTokenID'] = this.logInTokenID; + data['MobileNumber'] = this.mobileNumber; + data['SELECTDeviceIMEIbyIMEI_List'] = this.sELECTDeviceIMEIbyIMEIList; + data['UserID'] = this.userID; + data['ZipCode'] = this.zipCode; + data['isActiveCode'] = this.isActiveCode; + data['isSMSSent'] = this.isSMSSent; + return data; + } +} + +class ListMemberInformation { + Null setupID; + int memberID; + String memberName; + Null memberNameN; + String preferredLang; + String pIN; + String saltHash; + int referenceID; + int employeeID; + int roleID; + int projectid; + + ListMemberInformation( + {this.setupID, + this.memberID, + this.memberName, + this.memberNameN, + this.preferredLang, + this.pIN, + this.saltHash, + this.referenceID, + this.employeeID, + this.roleID, + this.projectid}); + + ListMemberInformation.fromJson(Map json) { + setupID = json['SetupID']; + memberID = json['MemberID']; + memberName = json['MemberName']; + memberNameN = json['MemberNameN']; + preferredLang = json['PreferredLang']; + pIN = json['PIN']; + saltHash = json['SaltHash']; + referenceID = json['ReferenceID']; + employeeID = json['EmployeeID']; + roleID = json['RoleID']; + projectid = json['projectid']; + } + + Map toJson() { + final Map data = new Map(); + data['SetupID'] = this.setupID; + data['MemberID'] = this.memberID; + data['MemberName'] = this.memberName; + data['MemberNameN'] = this.memberNameN; + data['PreferredLang'] = this.preferredLang; + data['PIN'] = this.pIN; + data['SaltHash'] = this.saltHash; + data['ReferenceID'] = this.referenceID; + data['EmployeeID'] = this.employeeID; + data['RoleID'] = this.roleID; + data['projectid'] = this.projectid; + return data; + } +} diff --git a/lib/core/model/auth/send_activation_code_for_doctor_app_response_model.dart b/lib/core/model/auth/send_activation_code_for_doctor_app_response_model.dart new file mode 100644 index 00000000..ceaf4c65 --- /dev/null +++ b/lib/core/model/auth/send_activation_code_for_doctor_app_response_model.dart @@ -0,0 +1,29 @@ +class SendActivationCodeForDoctorAppResponseModel { + String logInTokenID; + String verificationCode; + String vidaAuthTokenID; + String vidaRefreshTokenID; + + SendActivationCodeForDoctorAppResponseModel( + {this.logInTokenID, + this.verificationCode, + this.vidaAuthTokenID, + this.vidaRefreshTokenID}); + + SendActivationCodeForDoctorAppResponseModel.fromJson( + Map json) { + logInTokenID = json['LogInTokenID']; + verificationCode = json['VerificationCode']; + vidaAuthTokenID = json['VidaAuthTokenID']; + vidaRefreshTokenID = json['VidaRefreshTokenID']; + } + + Map toJson() { + final Map data = new Map(); + data['LogInTokenID'] = this.logInTokenID; + data['VerificationCode'] = this.verificationCode; + data['VidaAuthTokenID'] = this.vidaAuthTokenID; + data['VidaRefreshTokenID'] = this.vidaRefreshTokenID; + return data; + } +} diff --git a/lib/core/model/hospitals/get_hospitals_request_model.dart b/lib/core/model/hospitals/get_hospitals_request_model.dart new file mode 100644 index 00000000..8a5f1bc1 --- /dev/null +++ b/lib/core/model/hospitals/get_hospitals_request_model.dart @@ -0,0 +1,48 @@ +class GetHospitalsRequestModel { + int languageID; + String stamp; + String iPAdress; + double versionID; + int channel; + String tokenID; + String sessionID; + bool isLoginForDoctorApp; + String memberID; + + GetHospitalsRequestModel( + {this.languageID, + this.stamp, + this.iPAdress, + this.versionID, + this.channel, + this.tokenID, + this.sessionID, + this.isLoginForDoctorApp, + this.memberID}); + + GetHospitalsRequestModel.fromJson(Map json) { + languageID = json['LanguageID']; + stamp = json['stamp']; + iPAdress = json['IPAdress']; + versionID = json['VersionID']; + channel = json['Channel']; + tokenID = json['TokenID']; + sessionID = json['SessionID']; + isLoginForDoctorApp = json['IsLoginForDoctorApp']; + memberID = json['MemberID']; + } + + Map toJson() { + final Map data = new Map(); + data['LanguageID'] = this.languageID; + data['stamp'] = this.stamp; + data['IPAdress'] = this.iPAdress; + data['VersionID'] = this.versionID; + data['Channel'] = this.channel; + data['TokenID'] = this.tokenID; + data['SessionID'] = this.sessionID; + data['IsLoginForDoctorApp'] = this.isLoginForDoctorApp; + data['MemberID'] = this.memberID; + return data; + } +} diff --git a/lib/core/model/hospitals/get_hospitals_response_model.dart b/lib/core/model/hospitals/get_hospitals_response_model.dart new file mode 100644 index 00000000..edbc3fe5 --- /dev/null +++ b/lib/core/model/hospitals/get_hospitals_response_model.dart @@ -0,0 +1,22 @@ +class GetHospitalsResponseModel { + String facilityGroupId; + int facilityId; + String facilityName; + + GetHospitalsResponseModel( + {this.facilityGroupId, this.facilityId, this.facilityName}); + + GetHospitalsResponseModel.fromJson(Map json) { + facilityGroupId = json['facilityGroupId']; + facilityId = json['facilityId']; + facilityName = json['facilityName']; + } + + Map toJson() { + final Map data = new Map(); + data['facilityGroupId'] = this.facilityGroupId; + data['facilityId'] = this.facilityId; + data['facilityName'] = this.facilityName; + return data; + } +} diff --git a/lib/core/service/authentication_service.dart b/lib/core/service/authentication_service.dart new file mode 100644 index 00000000..49e89881 --- /dev/null +++ b/lib/core/service/authentication_service.dart @@ -0,0 +1,164 @@ +import 'package:doctor_app_flutter/config/config.dart'; +import 'package:doctor_app_flutter/core/model/auth/activation_Code_req_model.dart'; +import 'package:doctor_app_flutter/core/model/auth/activation_code_for_verification_screen_model.dart'; +import 'package:doctor_app_flutter/core/model/auth/check_activation_code_for_doctor_app_response_model.dart'; +import 'package:doctor_app_flutter/core/model/auth/check_activation_code_request_model.dart'; +import 'package:doctor_app_flutter/core/model/auth/imei_details.dart'; +import 'package:doctor_app_flutter/core/model/auth/insert_imei_model.dart'; +import 'package:doctor_app_flutter/core/model/auth/new_login_information_response_model.dart'; +import 'package:doctor_app_flutter/core/model/auth/send_activation_code_for_doctor_app_response_model.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/doctor/profile_req_Model.dart'; +import 'package:doctor_app_flutter/models/doctor/user_model.dart'; + +class AuthenticationService extends BaseService { + List _imeiDetails = []; + List get dashboardItemsList => _imeiDetails; + NewLoginInformationModel _loginInfo = NewLoginInformationModel(); + NewLoginInformationModel get loginInfo => _loginInfo; + SendActivationCodeForDoctorAppResponseModel _activationCodeVerificationScreenRes = SendActivationCodeForDoctorAppResponseModel(); + + SendActivationCodeForDoctorAppResponseModel get activationCodeVerificationScreenRes => _activationCodeVerificationScreenRes; + + SendActivationCodeForDoctorAppResponseModel _activationCodeForDoctorAppRes = SendActivationCodeForDoctorAppResponseModel(); + + SendActivationCodeForDoctorAppResponseModel get activationCodeForDoctorAppRes => _activationCodeForDoctorAppRes; + CheckActivationCodeForDoctorAppResponseModel _checkActivationCodeForDoctorAppRes = CheckActivationCodeForDoctorAppResponseModel(); + + CheckActivationCodeForDoctorAppResponseModel get checkActivationCodeForDoctorAppRes => _checkActivationCodeForDoctorAppRes; + Map _insertDeviceImeiRes = {}; + + List _doctorProfilesList = []; + List get doctorProfilesList => _doctorProfilesList; + + + + + Future selectDeviceImei(imei) async { + try { + await baseAppClient.post(SELECT_DEVICE_IMEI, + onSuccess: (dynamic response, int statusCode) { + _imeiDetails = []; + response['List_DoctorDeviceDetails'].forEach((v) { + _imeiDetails.add(GetIMEIDetailsModel.fromJson(v)); + }); + }, onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + }, body: {"IMEI": imei, "TokenID": "@dm!n"}); + } catch (error) { + hasError = true; + super.error = error; + } + } + + Future login(UserModel userInfo) async { + hasError = false; + _loginInfo = NewLoginInformationModel(); + try { + await baseAppClient.post(LOGIN_URL, + onSuccess: (dynamic response, int statusCode) { + _loginInfo = NewLoginInformationModel.fromJson(response); + }, onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + }, body: userInfo.toJson()); + } catch (error) { + hasError = true; + super.error = error; + } + + } + + Future sendActivationCodeVerificationScreen(ActivationCodeForVerificationScreenModel activationCodeModel) async { + hasError = false; + _activationCodeVerificationScreenRes = SendActivationCodeForDoctorAppResponseModel(); + try { + await baseAppClient.post(SEND_ACTIVATION_CODE_FOR_VERIFICATION_SCREEN, + onSuccess: (dynamic response, int statusCode) { + _activationCodeVerificationScreenRes = SendActivationCodeForDoctorAppResponseModel.fromJson(response); + }, onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + }, body: activationCodeModel.toJson()); + } catch (error) { + hasError = true; + super.error = error; + } + + } + + Future sendActivationCodeForDoctorApp(ActivationCodeModel activationCodeModel)async { + hasError = false; + _activationCodeForDoctorAppRes = SendActivationCodeForDoctorAppResponseModel(); + try { + await baseAppClient.post(SEND_ACTIVATION_CODE_FOR_DOCTOR_APP, + onSuccess: (dynamic response, int statusCode) { + _activationCodeForDoctorAppRes = SendActivationCodeForDoctorAppResponseModel.fromJson(response); + }, onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + }, body: activationCodeModel.toJson()); + } catch (error) { + hasError = true; + super.error = error; + } + } + + Future checkActivationCodeForDoctorApp(CheckActivationCodeRequestModel checkActivationCodeRequestModel)async { + hasError = false; + _checkActivationCodeForDoctorAppRes = CheckActivationCodeForDoctorAppResponseModel(); + try { + await baseAppClient.post(CHECK_ACTIVATION_CODE_FOR_DOCTOR_APP, + onSuccess: (dynamic response, int statusCode) { + _checkActivationCodeForDoctorAppRes = CheckActivationCodeForDoctorAppResponseModel.fromJson(response); + }, onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + }, body: checkActivationCodeRequestModel.toJson()); + } catch (error) { + hasError = true; + super.error = error; + } + + } + + + Future insertDeviceImei(InsertIMEIDetailsModel insertIMEIDetailsModel)async { + hasError = false; + // insertIMEIDetailsModel.tokenID = "@dm!n"; + _insertDeviceImeiRes = {}; + try { + await baseAppClient.post(INSERT_DEVICE_IMEI, + onSuccess: (dynamic response, int statusCode) { + _insertDeviceImeiRes = response; + }, onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + }, body: insertIMEIDetailsModel.toJson()); + } catch (error) { + hasError = true; + super.error = error; + } + } + + Future getDoctorProfileBasedOnClinic(ProfileReqModel profileReqModel)async { + hasError = false; + try { + await baseAppClient.post(GET_DOC_PROFILES, + onSuccess: (dynamic response, int statusCode) { + _doctorProfilesList.clear(); + response['DoctorProfileList'].forEach((v) { + _doctorProfilesList.add(DoctorProfileModel.fromJson(v)); + }); + }, onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + }, body: profileReqModel.toJson()); + } catch (error) { + hasError = true; + super.error = error; + } + } +} diff --git a/lib/core/service/home/auth_service.dart b/lib/core/service/home/auth_service.dart deleted file mode 100644 index b5435a59..00000000 --- a/lib/core/service/home/auth_service.dart +++ /dev/null @@ -1,62 +0,0 @@ -import 'package:doctor_app_flutter/config/config.dart'; -import 'package:doctor_app_flutter/core/model/auth/imei_details.dart'; -import 'package:doctor_app_flutter/core/service/base/base_service.dart'; -import 'package:doctor_app_flutter/models/doctor/user_model.dart'; - -class AuthService extends BaseService { - List _imeiDetails = []; - List get dashboardItemsList => _imeiDetails; - Map _loginInfo = {}; - Map get loginInfo => _loginInfo; - Future selectDeviceImei(imei) async { - try { - // dynamic localRes; - await baseAppClient.post(SELECT_DEVICE_IMEI, - onSuccess: (dynamic response, int statusCode) { - _imeiDetails = []; - response['List_DoctorDeviceDetails'].forEach((v) { - _imeiDetails.add(GetIMEIDetailsModel.fromJson(v)); - }); - }, onFailure: (String error, int statusCode) { - hasError = true; - super.error = error; - }, body: {"IMEI": imei, "TokenID": "@dm!n"}); - //return Future.value(localRes); - } catch (error) { - hasError = true; - super.error = error; - } - } - - Future login(UserModel userInfo) async { - hasError = false; - _loginInfo = {}; - try { - await baseAppClient.post(LOGIN_URL, - onSuccess: (dynamic response, int statusCode) { - _loginInfo = response; - }, onFailure: (String error, int statusCode) { - hasError = true; - super.error = error; - }, body: userInfo.toJson()); - } catch (error) { - hasError = true; - super.error = error; - } - - // await baseAppClient.post(SELECT_DEVICE_IMEI, - // onSuccess: (dynamic response, int statusCode) { - // _imeiDetails = []; - // response['List_DoctorDeviceDetails'].forEach((v) { - // _imeiDetails.add(GetIMEIDetailsModel.fromJson(v)); - // }); - // }, onFailure: (String error, int statusCode) { - // hasError = true; - // super.error = error; - // }, body: {}); - // } catch (error) { - // hasError = true; - // super.error = error; - // } - } -} diff --git a/lib/core/service/hospitals/hospitals_service.dart b/lib/core/service/hospitals/hospitals_service.dart new file mode 100644 index 00000000..f8a7579d --- /dev/null +++ b/lib/core/service/hospitals/hospitals_service.dart @@ -0,0 +1,27 @@ +import 'package:doctor_app_flutter/config/config.dart'; +import 'package:doctor_app_flutter/core/model/hospitals/get_hospitals_request_model.dart'; +import 'package:doctor_app_flutter/core/model/hospitals/get_hospitals_response_model.dart'; +import 'package:doctor_app_flutter/core/service/base/base_service.dart'; + +class HospitalsService extends BaseService { + +List hospitals =List(); + + Future getHospitals(GetHospitalsRequestModel getHospitalsRequestModel) async { + hasError = false; + await baseAppClient.post( + GET_PROJECTS, + onSuccess: (dynamic response, int statusCode) { + hospitals.clear(); + response['ProjectInfo'].forEach((hospital) { + hospitals.add(GetHospitalsResponseModel.fromJson(hospital)); + }); + }, + onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + }, + body: getHospitalsRequestModel.toJson(), + ); + } +} diff --git a/lib/core/service/patient_medical_file/lab_order/labs_service.dart b/lib/core/service/patient_medical_file/lab_order/labs_service.dart index 4eee522a..d7fc3aab 100644 --- a/lib/core/service/patient_medical_file/lab_order/labs_service.dart +++ b/lib/core/service/patient_medical_file/lab_order/labs_service.dart @@ -105,7 +105,7 @@ class LabsService extends BaseService { await baseAppClient.postPatient(url, patient: patient, onSuccess: (dynamic response, int statusCode) { - patientLabSpecialResult.clear(); + // patientLabSpecialResult.clear(); labResultList.clear(); if (isInpatient) { diff --git a/lib/core/service/patient_medical_file/medical_report/PatientMedicalReportService.dart b/lib/core/service/patient_medical_file/medical_report/PatientMedicalReportService.dart new file mode 100644 index 00000000..760c7dd5 --- /dev/null +++ b/lib/core/service/patient_medical_file/medical_report/PatientMedicalReportService.dart @@ -0,0 +1,89 @@ +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/patient/MedicalReport/MedicalReportTemplate.dart'; +import 'package:doctor_app_flutter/models/patient/MedicalReport/MeidcalReportModel.dart'; +import 'package:doctor_app_flutter/models/patient/patiant_info_model.dart'; + +class PatientMedicalReportService extends BaseService { + List medicalReportList = []; + List medicalReportTemplate = []; + + Future getMedicalReportList(PatiantInformtion patient) async { + hasError = false; + Map body = Map(); + // body['TokenID'] = "@dm!n"; + body['SetupID'] = "91877"; + body['AdmissionNo'] = patient.admissionNo; + + await baseAppClient.postPatient(PATIENT_MEDICAL_REPORT_GET_LIST, + onSuccess: (dynamic response, int statusCode) { + + medicalReportList.clear(); + if (response['DAPP_ListMedicalReportList'] != null) { + response['DAPP_ListMedicalReportList'].forEach((v) { + medicalReportList.add(MedicalReportModel.fromJson(v)); + }); + } + }, onFailure: (String error, int statusCode) { + hasError = true; + super.error = error.toString(); + }, body: body, patient: patient); + } + + Future getMedicalReportTemplate() async { + hasError = false; + Map body = Map(); + body['TokenID'] = "@dm!n"; + body['SetupID'] = "91877"; + body['TemplateID'] = 43; + + await baseAppClient.post(PATIENT_MEDICAL_REPORT_GET_TEMPLATE, + onSuccess: (dynamic response, int statusCode) { + + medicalReportTemplate.clear(); + if (response['DAPP_GetTemplateByIDList'] != null) { + response['DAPP_GetTemplateByIDList'].forEach((v) { + medicalReportTemplate.add(MedicalReportTemplate.fromJson(v)); + }); + } + }, onFailure: (String error, int statusCode) { + hasError = true; + super.error = error.toString(); + }, body: body); + } + + Future insertMedicalReport(PatiantInformtion patient, String htmlText) async { + hasError = false; + Map body = Map(); + // body['TokenID'] = "@dm!n"; + body['SetupID'] = "91877"; + body['AdmissionNo'] = patient.admissionNo; + body['MedicalReportHTML'] = htmlText; + + await baseAppClient.postPatient(PATIENT_MEDICAL_REPORT_INSERT, + onSuccess: (dynamic response, int statusCode) { + + }, onFailure: (String error, int statusCode) { + hasError = true; + super.error = error.toString(); + }, body: body, patient: patient); + } + + Future verifyMedicalReport(PatiantInformtion patient, MedicalReportModel medicalReport) async { + hasError = false; + Map body = Map(); + body['TokenID'] = "@dm!n"; + body['SetupID'] = "91877"; + body['AdmissionNo'] = patient.admissionNo; + body['InvoiceNo'] = medicalReport.invoiceNo; + body['LineItemNo'] = medicalReport.lineItemNo; + + await baseAppClient.postPatient(PATIENT_MEDICAL_REPORT_VERIFIED, + onSuccess: (dynamic response, int statusCode) { + + }, onFailure: (String error, int statusCode) { + hasError = true; + super.error = error.toString(); + }, body: body, patient: patient); + } +} diff --git a/lib/core/viewModel/PatientMedicalReportViewModel.dart b/lib/core/viewModel/PatientMedicalReportViewModel.dart new file mode 100644 index 00000000..999a0530 --- /dev/null +++ b/lib/core/viewModel/PatientMedicalReportViewModel.dart @@ -0,0 +1,58 @@ +import 'package:doctor_app_flutter/core/enum/viewstate.dart'; +import 'package:doctor_app_flutter/core/service/patient_medical_file/medical_report/PatientMedicalReportService.dart'; +import 'package:doctor_app_flutter/core/viewModel/base_view_model.dart'; +import 'package:doctor_app_flutter/models/patient/MedicalReport/MedicalReportTemplate.dart'; +import 'package:doctor_app_flutter/models/patient/MedicalReport/MeidcalReportModel.dart'; +import 'package:doctor_app_flutter/models/patient/patiant_info_model.dart'; + +import '../../locator.dart'; + +class PatientMedicalReportViewModel extends BaseViewModel { + PatientMedicalReportService _service = locator(); + + List get medicalReportList => _service.medicalReportList; + + List get medicalReportTemplate => + _service.medicalReportTemplate; + + Future getMedicalReportList(PatiantInformtion patient) async { + setState(ViewState.Busy); + await _service.getMedicalReportList(patient); + if (_service.hasError) { + error = _service.error; + setState(ViewState.ErrorLocal); // ViewState.Error + } else + setState(ViewState.Idle); + } + + Future getMedicalReportTemplate() async { + setState(ViewState.Busy); + await _service.getMedicalReportTemplate(); + if (_service.hasError) { + error = _service.error; + setState(ViewState.Error); + } else + setState(ViewState.Idle); + } + + Future insertMedicalReport(PatiantInformtion patient, String htmlText) async { + setState(ViewState.Busy); + await _service.insertMedicalReport(patient, htmlText); + if (_service.hasError) { + error = _service.error; + setState(ViewState.ErrorLocal); + } else + setState(ViewState.Idle); + } + + Future verifyMedicalReport( + PatiantInformtion patient, MedicalReportModel medicalReport) async { + setState(ViewState.Busy); + await _service.verifyMedicalReport(patient, medicalReport); + if (_service.hasError) { + error = _service.error; + setState(ViewState.ErrorLocal); + } else + setState(ViewState.Idle); + } +} diff --git a/lib/core/viewModel/auth_view_model.dart b/lib/core/viewModel/auth_view_model.dart deleted file mode 100644 index bb4fd305..00000000 --- a/lib/core/viewModel/auth_view_model.dart +++ /dev/null @@ -1,233 +0,0 @@ -import 'package:doctor_app_flutter/client/base_app_client.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/auth/imei_details.dart'; -import 'package:doctor_app_flutter/core/model/auth/insert_imei_model.dart'; -import 'package:doctor_app_flutter/core/viewModel/base_view_model.dart'; -import 'package:doctor_app_flutter/models/auth/activation_Code_req_model.dart'; -import 'package:doctor_app_flutter/models/auth/check_activation_code_request_model.dart'; -import 'package:doctor_app_flutter/models/auth/send_activation_code_model2.dart'; -import 'package:doctor_app_flutter/models/doctor/clinic_model.dart'; -import 'package:doctor_app_flutter/models/doctor/doctor_profile_model.dart'; - -import '../../models/doctor/user_model.dart'; - -enum APP_STATUS { LOADING, UNAUTHENTICATED, AUTHENTICATED } - -class AuthViewModel extends BaseViewModel { - List doctorsClinicList = []; - - String selectedClinicName; - bool isLogin = false; - bool isLoading = true; - DoctorProfileModel doctorProfile; - BaseAppClient baseAppClient = BaseAppClient(); - setDoctorProfile(DoctorProfileModel profileModel) { - doctorProfile = profileModel; - notifyListeners(); - } - - AuthViewModel() { - getUserAuthentication(); - } - - getUserAuthentication() async { - Map profile = await sharedPref.getObj(DOCTOR_PROFILE); - if (profile != null) { - doctorProfile = new DoctorProfileModel.fromJson(profile); - isLoading = false; - isLogin = true; - } else { - isLoading = false; - isLogin = false; - } - notifyListeners(); - } - - APP_STATUS get stutas { - if (isLoading) { - return APP_STATUS.LOADING; - } else { - if (this.isLogin) { - return APP_STATUS.AUTHENTICATED; - } else { - return APP_STATUS.UNAUTHENTICATED; - } - } - } - - Future login(UserModel userInfo) async { - try { - dynamic localRes; - - await baseAppClient.post(LOGIN_URL, - onSuccess: (dynamic response, int statusCode) { - localRes = response; - }, onFailure: (String error, int statusCode) { - throw error; - }, body: userInfo.toJson()); - - return Future.value(localRes); - } catch (error) { - print(error); - throw error; - } - } - - Future insertDeviceImei(request) async { - var loggedIn = await sharedPref.getObj(LOGGED_IN_USER); - var user = await sharedPref.getObj(LAST_LOGIN_USER); - if (user != null) { - user = GetIMEIDetailsModel.fromJson(user); - } - request['IMEI'] = DEVICE_TOKEN; - request['LogInTypeID'] = await sharedPref.getInt(OTP_TYPE); - request['BioMetricEnabled'] = true; - request['MobileNo'] = - loggedIn != null ? loggedIn['MobileNumber'] : user.mobile; - InsertIMEIDetailsModel nRequest = InsertIMEIDetailsModel.fromJson(request); - nRequest.genderDescription = request['Gender_Description']; - nRequest.genderDescriptionN = request['Gender_DescriptionN']; - nRequest.genderDescriptionN = request['Gender_DescriptionN']; - nRequest.titleDescription = request['Title_Description']; - nRequest.titleDescriptionN = request['Title_DescriptionN']; - nRequest.projectID = await sharedPref.getInt(PROJECT_ID); - nRequest.doctorID = loggedIn != null - ? loggedIn['List_MemberInformation'][0]['MemberID'] - : user.doctorID; - nRequest.outSA = loggedIn != null ? loggedIn['PatientOutSA'] : user.outSA; - nRequest.vidaAuthTokenID = await sharedPref.getString(VIDA_AUTH_TOKEN_ID); - nRequest.vidaRefreshTokenID = - await sharedPref.getString(VIDA_REFRESH_TOKEN_ID); - nRequest.password = await sharedPref.getString(PASSWORD); - try { - var localRes; - await baseAppClient.post(INSERT_DEVICE_IMEI, - onSuccess: (dynamic response, int statusCode) { - localRes = response; - }, onFailure: (String error, int statusCode) {}, body: nRequest.toJson()); - return Future.value(localRes); - } catch (error) { - throw error; - } - } - - Future sendActivationCodeByOtpNotificationType(activationCodeModel) async { - try { - var localRes; - await baseAppClient.post(SEND_ACTIVATION_CODE_BY_OTP_NOTIFICATION_TYPE, - onSuccess: (dynamic response, int statusCode) { - localRes = response; - }, onFailure: (String error, int statusCode) { - throw error; - }, body: activationCodeModel); - return Future.value(localRes); - } catch (error) { - print(error); - throw error; - } - } - - Future sendActivationCodeForDoctorApp( - ActivationCodeModel activationCodeModel) async { - try { - var localRes; - await baseAppClient.post(SEND_ACTIVATION_CODE_FOR_DOCTOR_APP, - onSuccess: (dynamic response, int statusCode) { - localRes = response; - }, onFailure: (String error, int statusCode) { - throw error; - }, body: activationCodeModel.toJson()); - return Future.value(localRes); - } catch (error) { - print(error); - throw error; - } - } - - Future memberCheckActivationCodeNew(activationCodeModel) async { - try { - dynamic localRes; - await baseAppClient.post(MEMBER_CHECK_ACTIVATION_CODE_NEW, - onSuccess: (dynamic response, int statusCode) { - localRes = response; - selectedClinicName = - ClinicModel.fromJson(response['List_DoctorsClinic'][0]).clinicName; - - response['List_DoctorsClinic'].forEach((v) { - doctorsClinicList.add(new ClinicModel.fromJson(v)); - }); - }, onFailure: (String error, int statusCode) { - throw error; - }, body: activationCodeModel); - return Future.value(localRes); - } catch (error) { - print(error); - throw error; - } - } - - Future checkActivationCodeForDoctorApp( - CheckActivationCodeRequestModel checkActivationCodeRequestModel) async { - try { - dynamic localRes; - await baseAppClient.post(CHECK_ACTIVATION_CODE_FOR_DOCTOR_APP, - onSuccess: (dynamic response, int statusCode) { - localRes = response; - selectedClinicName = - ClinicModel.fromJson(response['List_DoctorsClinic'][0]).clinicName; - - response['List_DoctorsClinic'].forEach((v) { - doctorsClinicList.add(new ClinicModel.fromJson(v)); - }); - }, onFailure: (String error, int statusCode) { - throw error; - }, body: checkActivationCodeRequestModel.toJson()); - return Future.value(localRes); - } catch (error) { - print(error); - throw error; - } - } - - Future getDocProfiles(docInfo, - {bool allowChangeProfile = true}) async { - try { - dynamic localRes; - await baseAppClient.post(GET_DOC_PROFILES, - onSuccess: (dynamic response, int statusCode) { - localRes = response; - if (allowChangeProfile) { - doctorProfile = - DoctorProfileModel.fromJson(response['DoctorProfileList'][0]); - selectedClinicName = - response['DoctorProfileList'][0]['ClinicDescription']; - } - }, onFailure: (String error, int statusCode) { - throw error; - }, body: docInfo); - notifyListeners(); - return Future.value(localRes); - } catch (error) { - print(error); - throw error; - } - } - - Future sendActivationCodeVerificationScreen( - ActivationCodeModel2 activationCodeModel) async { - try { - var localRes; - await baseAppClient.post(SEND_ACTIVATION_CODE_FOR_VERIFICATION_SCREEN, - onSuccess: (dynamic response, int statusCode) { - localRes = response; - }, onFailure: (String error, int statusCode) { - throw error; - }, body: activationCodeModel.toJson()); - return Future.value(localRes); - } catch (error) { - print(error); - throw error; - } - } -} diff --git a/lib/core/viewModel/authentication_view_model.dart b/lib/core/viewModel/authentication_view_model.dart new file mode 100644 index 00000000..232d9619 --- /dev/null +++ b/lib/core/viewModel/authentication_view_model.dart @@ -0,0 +1,441 @@ +import 'dart:io'; + +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'; +import 'package:doctor_app_flutter/core/model/auth/activation_Code_req_model.dart'; +import 'package:doctor_app_flutter/core/model/auth/activation_code_for_verification_screen_model.dart'; +import 'package:doctor_app_flutter/core/model/auth/check_activation_code_for_doctor_app_response_model.dart'; +import 'package:doctor_app_flutter/core/model/auth/check_activation_code_request_model.dart'; +import 'package:doctor_app_flutter/core/model/auth/imei_details.dart'; +import 'package:doctor_app_flutter/core/model/auth/insert_imei_model.dart'; +import 'package:doctor_app_flutter/core/model/auth/new_login_information_response_model.dart'; +import 'package:doctor_app_flutter/core/model/auth/send_activation_code_for_doctor_app_response_model.dart'; +import 'package:doctor_app_flutter/core/model/hospitals/get_hospitals_request_model.dart'; +import 'package:doctor_app_flutter/core/model/hospitals/get_hospitals_response_model.dart'; +import 'package:doctor_app_flutter/core/service/authentication_service.dart'; +import 'package:doctor_app_flutter/core/service/hospitals/hospitals_service.dart'; +import 'package:doctor_app_flutter/core/viewModel/base_view_model.dart'; +import 'package:doctor_app_flutter/core/viewModel/project_view_model.dart'; +import 'package:doctor_app_flutter/locator.dart'; +import 'package:doctor_app_flutter/models/doctor/clinic_model.dart'; +import 'package:doctor_app_flutter/models/doctor/doctor_profile_model.dart'; +import 'package:doctor_app_flutter/models/doctor/profile_req_Model.dart'; +import 'package:doctor_app_flutter/models/doctor/user_model.dart'; +import 'package:doctor_app_flutter/root_page.dart'; +import 'package:doctor_app_flutter/screens/auth/login_screen.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'; +import 'package:provider/provider.dart'; + +enum APP_STATUS { LOADING, UNAUTHENTICATED, AUTHENTICATED, UNVERIFIED } + +class AuthenticationViewModel extends BaseViewModel { + AuthenticationService _authService = locator(); + HospitalsService _hospitalsService = locator(); + + List get imeiDetails => _authService.dashboardItemsList; + + List get hospitals => _hospitalsService.hospitals; + + NewLoginInformationModel get loginInfo => _authService.loginInfo; + + List get doctorProfilesList => _authService.doctorProfilesList; + + SendActivationCodeForDoctorAppResponseModel + get activationCodeVerificationScreenRes => + _authService.activationCodeVerificationScreenRes; + + SendActivationCodeForDoctorAppResponseModel + get activationCodeForDoctorAppRes => + _authService.activationCodeForDoctorAppRes; + + CheckActivationCodeForDoctorAppResponseModel + get checkActivationCodeForDoctorAppRes => + _authService.checkActivationCodeForDoctorAppRes; + + NewLoginInformationModel loggedUser; + GetIMEIDetailsModel user; + + UserModel userInfo = UserModel(); + final LocalAuthentication auth = LocalAuthentication(); + List _availableBiometrics; + final FirebaseMessaging _firebaseMessaging = FirebaseMessaging(); + + bool isLogin = false; + bool unverified = false; + bool isFromLogin = false; + APP_STATUS app_status = APP_STATUS.LOADING; + + AuthenticationViewModel({bool checkDeviceInfo = false}) { + getDeviceInfoFromFirebase(); + getDoctorProfile(); + } + + /// select Device IMEI + Future selectDeviceImei(imei) async { + setState(ViewState.Busy); + await _authService.selectDeviceImei(imei); + if (_authService.hasError) { + error = _authService.error; + setState(ViewState.Error); + } else + setState(ViewState.Idle); + } + + /// Insert Device IMEI + Future insertDeviceImei() async { + var loggedIn = await sharedPref.getObj(LOGGED_IN_USER); + var user = await sharedPref.getObj(LAST_LOGIN_USER); + if (user != null) { + user = GetIMEIDetailsModel.fromJson(user); + } + + var profileInfo = await sharedPref.getObj(DOCTOR_PROFILE); + + profileInfo['IMEI'] = DEVICE_TOKEN; + profileInfo['LogInTypeID'] = await sharedPref.getInt(OTP_TYPE); + profileInfo['BioMetricEnabled'] = true; + profileInfo['MobileNo'] = + loggedIn != null ? loggedIn['MobileNumber'] : user.mobile; + InsertIMEIDetailsModel insertIMEIDetailsModel = InsertIMEIDetailsModel.fromJson(profileInfo); + insertIMEIDetailsModel.genderDescription = profileInfo['Gender_Description']; + insertIMEIDetailsModel.genderDescriptionN = profileInfo['Gender_DescriptionN']; + insertIMEIDetailsModel.genderDescriptionN = profileInfo['Gender_DescriptionN']; + insertIMEIDetailsModel.titleDescription = profileInfo['Title_Description']; + insertIMEIDetailsModel.titleDescriptionN = profileInfo['Title_DescriptionN']; + insertIMEIDetailsModel.projectID = await sharedPref.getInt(PROJECT_ID); + insertIMEIDetailsModel.doctorID = loggedIn != null + ? loggedIn['List_MemberInformation'][0]['MemberID'] + : user.doctorID; + insertIMEIDetailsModel.outSA = loggedIn != null ? loggedIn['PatientOutSA'] : user.outSA; + insertIMEIDetailsModel.vidaAuthTokenID = await sharedPref.getString(VIDA_AUTH_TOKEN_ID); + insertIMEIDetailsModel.vidaRefreshTokenID = + await sharedPref.getString(VIDA_REFRESH_TOKEN_ID); + insertIMEIDetailsModel.password = await sharedPref.getString(PASSWORD); + + await _authService.insertDeviceImei(insertIMEIDetailsModel); + if (_authService.hasError) { + error = _authService.error; + setState(ViewState.ErrorLocal); + } else + setState(ViewState.Idle); + } + + + /// first step login + Future login(UserModel userInfo) async { + setState(ViewState.BusyLocal); + await _authService.login(userInfo); + if (_authService.hasError) { + error = _authService.error; + setState(ViewState.ErrorLocal); + } else { + sharedPref.setInt(PROJECT_ID, userInfo.projectID); + loggedUser = loginInfo; + saveObjToString(LOGGED_IN_USER, loginInfo); + sharedPref.remove(LAST_LOGIN_USER); + sharedPref.setString(TOKEN, loginInfo.logInTokenID); + setState(ViewState.Idle); + } + } + + /// send activation code for for msg methods + Future sendActivationCodeVerificationScreen( AuthMethodTypes authMethodType) async { + setState(ViewState.BusyLocal); + ActivationCodeForVerificationScreenModel activationCodeModel = + ActivationCodeForVerificationScreenModel( + iMEI: user.iMEI, + facilityId: user.projectID, + memberID: user.doctorID, + zipCode: user.outSA == true ? '971' : '966', + mobileNumber: user.mobile, + oTPSendType: authMethodType.getTypeIdService(), + isMobileFingerPrint: 1, + vidaAuthTokenID: user.vidaAuthTokenID, + vidaRefreshTokenID: user.vidaRefreshTokenID); + await _authService.sendActivationCodeVerificationScreen(activationCodeModel); + if (_authService.hasError) { + error = _authService.error; + setState(ViewState.ErrorLocal); + } else + setState(ViewState.Idle); + } + + /// send activation code for silent login + Future sendActivationCodeForDoctorApp({AuthMethodTypes authMethodType, String password }) async { + setState(ViewState.BusyLocal); + int projectID = await sharedPref.getInt(PROJECT_ID); + ActivationCodeModel activationCodeModel = ActivationCodeModel( + facilityId: projectID, + memberID: loggedUser.listMemberInformation[0].memberID, + zipCode: loggedUser.zipCode, + mobileNumber: loggedUser.mobileNumber, + otpSendType: authMethodType.getTypeIdService().toString(), + password: password); + await _authService.sendActivationCodeForDoctorApp(activationCodeModel); + if (_authService.hasError) { + error = _authService.error; + setState(ViewState.ErrorLocal); + } else + setState(ViewState.Idle); + } + + + /// check activation code for sms and whats app + Future checkActivationCodeForDoctorApp({String activationCode}) async { + setState(ViewState.BusyLocal); + CheckActivationCodeRequestModel checkActivationCodeForDoctorApp = + new CheckActivationCodeRequestModel( + zipCode: + loggedUser != null ? loggedUser.zipCode :user.zipCode, + mobileNumber: + loggedUser != null ? loggedUser.mobileNumber : user.mobile, + projectID: await sharedPref.getInt(PROJECT_ID) != null + ? await sharedPref.getInt(PROJECT_ID) + : user.projectID, + logInTokenID: await sharedPref.getString(LOGIN_TOKEN_ID), + activationCode: activationCode ?? '0000', + oTPSendType: await sharedPref.getInt(OTP_TYPE), + generalid: "Cs2020@2016\$2958"); + await _authService.checkActivationCodeForDoctorApp(checkActivationCodeForDoctorApp); + if (_authService.hasError) { + error = _authService.error; + setState(ViewState.ErrorLocal); + } else { + setState(ViewState.Idle); + } + } + + /// get list of Hospitals + Future getHospitalsList(memberID) async { + GetHospitalsRequestModel getHospitalsRequestModel =GetHospitalsRequestModel(); + getHospitalsRequestModel.memberID = memberID; + await _hospitalsService.getHospitals(getHospitalsRequestModel); + if (_hospitalsService.hasError) { + error = _hospitalsService.error; + setState(ViewState.Error); + } else + setState(ViewState.Idle); + } + + + /// get type name based on id. + getType(type, context) { + switch (type) { + case 1: + return TranslationBase + .of(context) + .verifySMS; + break; + case 3: + return TranslationBase + .of(context) + .verifyFingerprint; + break; + case 4: + return TranslationBase + .of(context) + .verifyFaceID; + break; + case 2: + return TranslationBase.of(context).verifyWhatsApp; + break; + default: + return TranslationBase.of(context).verifySMS; + break; + } + } + + /// add  token to shared preferences in case of send activation code is success + setDataAfterSendActivationSuccess(SendActivationCodeForDoctorAppResponseModel sendActivationCodeForDoctorAppResponseModel) { + print("VerificationCode : " + + sendActivationCodeForDoctorAppResponseModel.verificationCode); + sharedPref.setString(VIDA_AUTH_TOKEN_ID, + sendActivationCodeForDoctorAppResponseModel.vidaAuthTokenID); + sharedPref.setString(VIDA_REFRESH_TOKEN_ID, + sendActivationCodeForDoctorAppResponseModel.vidaRefreshTokenID); + sharedPref.setString(LOGIN_TOKEN_ID, + sendActivationCodeForDoctorAppResponseModel.logInTokenID); + } + + saveObjToString(String key, value) async { + sharedPref.setObj(key, value); + } + + /// ask user to add his biometric + showIOSAuthMessages() async { + const iosStrings = const IOSAuthMessages( + cancelButton: 'cancel', + goToSettingsButton: 'settings', + goToSettingsDescription: 'Please set up your Touch ID.', + lockOut: 'Please Enable Your Touch ID'); + + try { + await auth.authenticateWithBiometrics( + localizedReason: 'Scan your fingerprint to authenticate', + useErrorDialogs: true, + stickyAuth: true, + iOSAuthStrings: iosStrings); + } on PlatformException catch (e) { + DrAppToastMsg.showErrorToast(e.toString()); + } + } + + /// add profile to base view model super class + localSetDoctorProfile(DoctorProfileModel profile) { + super.setDoctorProfile(profile); + } + + /// get doctor profile based on clinic model + Future getDoctorProfileBasedOnClinic(ClinicModel clinicInfo) async { + ProfileReqModel docInfo = new ProfileReqModel( + doctorID: clinicInfo.doctorID, + clinicID: clinicInfo.clinicID, + license: true, + projectID: clinicInfo.projectID, + tokenID: '', + languageID: 2); + await _authService.getDoctorProfileBasedOnClinic(docInfo); + if (_authService.hasError) { + error = _authService.error; + setState(ViewState.ErrorLocal); + } else { + localSetDoctorProfile(doctorProfilesList.first); + setState(ViewState.Idle); + } + } + + /// add some logic in case of check activation code is success + onCheckActivationCodeSuccess() async { + sharedPref.setString( + TOKEN, + checkActivationCodeForDoctorAppRes.authenticationTokenID); + if (checkActivationCodeForDoctorAppRes.listDoctorProfile != null && + checkActivationCodeForDoctorAppRes.listDoctorProfile + .isNotEmpty) { + localSetDoctorProfile( + checkActivationCodeForDoctorAppRes.listDoctorProfile[0]); + } else { + sharedPref.setObj( + CLINIC_NAME, + checkActivationCodeForDoctorAppRes.listDoctorsClinic); + ClinicModel clinic = ClinicModel.fromJson( + checkActivationCodeForDoctorAppRes.listDoctorsClinic[0] + .toJson()); + await getDoctorProfileBasedOnClinic(clinic); + } + } + + /// check specific biometric if it available or not + Future checkIfBiometricAvailable(BiometricType biometricType) async { + bool isAvailable = false; + await _getAvailableBiometrics(); + if (_availableBiometrics != null) { + for (var i = 0; i < _availableBiometrics.length; i++) { + if (biometricType == _availableBiometrics[i]) isAvailable = true; + } + } + return isAvailable; + } + + /// get all available biometric on the device for local Auth service + Future _getAvailableBiometrics() async { + try { + _availableBiometrics = await auth.getAvailableBiometrics(); + } on PlatformException catch (e) { + print(e); + } + } + + /// call firebase service to check if the user already login in before or not + getDeviceInfoFromFirebase() async { + _firebaseMessaging.setAutoInitEnabled(true); + if (Platform.isIOS) { + _firebaseMessaging.requestNotificationPermissions(); + } + setState(ViewState.Busy); + var token = await _firebaseMessaging.getToken(); + if (DEVICE_TOKEN == "") { + DEVICE_TOKEN = token; + + await _authService.selectDeviceImei(DEVICE_TOKEN); + if (_authService.hasError) { + error = _authService.error; + setState(ViewState.ErrorLocal); + } else { + if (_authService.dashboardItemsList.length > 0) { + user =_authService.dashboardItemsList[0]; + sharedPref.setObj( + LAST_LOGIN_USER, _authService.dashboardItemsList[0]); + this.unverified = true; + } + setState(ViewState.Idle); + } + } else { + setState(ViewState.Idle); + } + } + + /// determine the status of the app + APP_STATUS get status { + if (state == ViewState.Busy) { + app_status = APP_STATUS.LOADING; + } else { + if(this.doctorProfile !=null) + app_status = APP_STATUS.AUTHENTICATED; + else if (this.unverified) { + app_status = APP_STATUS.UNVERIFIED; + } else if (this.isLogin) { + app_status = APP_STATUS.AUTHENTICATED; + } else { + app_status = APP_STATUS.UNAUTHENTICATED; + } + } + return app_status; + } + setAppStatus(APP_STATUS status){ + this.app_status = status; + notifyListeners(); + } + + setUnverified(bool unverified,{bool isFromLogin = false}){ + this.unverified = unverified; + this.isFromLogin = isFromLogin; + notifyListeners(); + } + + /// 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; + Navigator.pushAndRemoveUntil( + AppGlobal.CONTEX, + FadePage( + page: RootPage(), + ), + (r) => false); + } + + deleteUser(){ + user = null; + unverified = false; + isLogin = false; + // notifyListeners(); + } + +} diff --git a/lib/core/viewModel/base_view_model.dart b/lib/core/viewModel/base_view_model.dart index 43e83c9b..9d4fe36d 100644 --- a/lib/core/viewModel/base_view_model.dart +++ b/lib/core/viewModel/base_view_model.dart @@ -45,5 +45,10 @@ class BaseViewModel extends ChangeNotifier { } else { return doctorProfile; } -} + } + + setDoctorProfile(DoctorProfileModel doctorProfile)async { + await sharedPref.setObj(DOCTOR_PROFILE, doctorProfile); + this.doctorProfile = doctorProfile; + } } diff --git a/lib/core/viewModel/dashboard_view_model.dart b/lib/core/viewModel/dashboard_view_model.dart index 1205699b..a1f83293 100644 --- a/lib/core/viewModel/dashboard_view_model.dart +++ b/lib/core/viewModel/dashboard_view_model.dart @@ -1,11 +1,44 @@ +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/viewModel/project_view_model.dart'; +import 'package:doctor_app_flutter/models/dashboard/dashboard_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'; import '../../locator.dart'; +import 'authentication_view_model.dart'; import 'base_view_model.dart'; class DashboardViewModel extends BaseViewModel { + + final FirebaseMessaging _firebaseMessaging = FirebaseMessaging(); DashboardService _dashboardService = locator(); - get dashboardItemsList => _dashboardService.dashboardItemsList; + + List get dashboardItemsList => + _dashboardService.dashboardItemsList; + + Future setFirebaseNotification(ProjectViewModel projectsProvider, AuthenticationViewModel authProvider) async{ + setState(ViewState.Busy); + await projectsProvider.getDoctorClinicsList(); + + // _firebaseMessaging.setAutoInitEnabled(true); + _firebaseMessaging.requestNotificationPermissions( + const IosNotificationSettings( + sound: true, badge: true, alert: true, provisional: true)); + _firebaseMessaging.onIosSettingsRegistered + .listen((IosNotificationSettings settings) { + print("Settings registered: $settings"); + }); + + _firebaseMessaging.getToken().then((String token) async { + if (token != '') { + DEVICE_TOKEN = token; + authProvider.insertDeviceImei(); + } + }); + } Future getDashboard() async { setState(ViewState.Busy); @@ -16,4 +49,21 @@ class DashboardViewModel extends BaseViewModel { } else setState(ViewState.Idle); } + + Future changeClinic(int clinicId, AuthenticationViewModel authProvider) async { + setState(ViewState.BusyLocal); + await getDoctorProfile(); + ClinicModel clinicModel = ClinicModel(doctorID:doctorProfile.doctorID,clinicID: clinicId, projectID: doctorProfile.projectID,); + await authProvider.getDoctorProfileBasedOnClinic(clinicModel); + if(authProvider.state == ViewState.ErrorLocal) { + error = authProvider.error; + } + } + + getPatientCount(DashboardModel inPatientCount) { + int value = 0; + inPatientCount.summaryoptions.forEach((result) => {value += result.value}); + + return value.toString(); + } } diff --git a/lib/core/viewModel/hospital_view_model.dart b/lib/core/viewModel/hospital_view_model.dart deleted file mode 100644 index a49b85e5..00000000 --- a/lib/core/viewModel/hospital_view_model.dart +++ /dev/null @@ -1,32 +0,0 @@ -import 'package:doctor_app_flutter/client/base_app_client.dart'; -import 'package:doctor_app_flutter/config/config.dart'; -import 'package:flutter/cupertino.dart'; - -// TODO change it when change login -class HospitalViewModel with ChangeNotifier { - BaseAppClient baseAppClient = BaseAppClient(); - - Future getProjectsList(memberID) async { - const url = GET_PROJECTS; - // TODO create model or remove it if no info need - var info = { - "LanguageID": 1, - "stamp": "2020-02-26T13:51:44.111Z", - "IPAdress": "11.11.11.11", - "VersionID": 5.8, - "Channel": 9, - "TokenID": "", - "SessionID": "i1UJwCTSqt", - "IsLoginForDoctorApp": true, - "MemberID": memberID - }; - dynamic localRes; - - await baseAppClient.post(url, onSuccess: (response, statusCode) async { - localRes = response; - }, onFailure: (String error, int statusCode) { - throw error; - }, body: info); - return Future.value(localRes); - } -} diff --git a/lib/core/viewModel/hospitals_view_model.dart b/lib/core/viewModel/hospitals_view_model.dart new file mode 100644 index 00000000..c0ce1bc4 --- /dev/null +++ b/lib/core/viewModel/hospitals_view_model.dart @@ -0,0 +1,27 @@ +import 'package:doctor_app_flutter/client/base_app_client.dart'; +import 'package:doctor_app_flutter/config/config.dart'; +import 'package:doctor_app_flutter/core/enum/viewstate.dart'; +import 'package:doctor_app_flutter/core/model/hospitals/get_hospitals_request_model.dart'; +import 'package:doctor_app_flutter/core/service/hospitals/hospitals_service.dart'; +import 'package:flutter/cupertino.dart'; + +import '../../locator.dart'; +import 'base_view_model.dart'; + + +class HospitalViewModel extends BaseViewModel { + HospitalsService _hospitalsService = locator(); + // List get imeiDetails => _authService.dashboardItemsList; + // get loginInfo => _authService.loginInfo; + Future getHospitalsList(memberID) async { + GetHospitalsRequestModel getHospitalsRequestModel =GetHospitalsRequestModel(); + getHospitalsRequestModel.memberID = memberID; + setState(ViewState.Busy); + await _hospitalsService.getHospitals(getHospitalsRequestModel); + if (_hospitalsService.hasError) { + error = _hospitalsService.error; + setState(ViewState.Error); + } else + setState(ViewState.Idle); + } +} diff --git a/lib/core/viewModel/imei_view_model.dart b/lib/core/viewModel/imei_view_model.dart deleted file mode 100644 index f8c45762..00000000 --- a/lib/core/viewModel/imei_view_model.dart +++ /dev/null @@ -1,33 +0,0 @@ -import 'package:doctor_app_flutter/core/enum/viewstate.dart'; -import 'package:doctor_app_flutter/core/model/auth/imei_details.dart'; -import 'package:doctor_app_flutter/core/service/home/auth_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/doctor/user_model.dart'; -import 'package:doctor_app_flutter/util/helpers.dart'; - -class IMEIViewModel extends BaseViewModel { - AuthService _authService = locator(); - List get imeiDetails => _authService.dashboardItemsList; - get loginInfo => _authService.loginInfo; - Future selectDeviceImei(imei) async { - setState(ViewState.Busy); - await _authService.selectDeviceImei(imei); - if (_authService.hasError) { - error = _authService.error; - setState(ViewState.Error); - } else - setState(ViewState.Idle); - } - - Future login(UserModel userInfo) async { - setState(ViewState.Busy); - await _authService.login(userInfo); - if (_authService.hasError) { - error = _authService.error; - Helpers.showErrorToast(error); - setState(ViewState.ErrorLocal); - } else - setState(ViewState.Idle); - } -} diff --git a/lib/core/viewModel/procedure_View_model.dart b/lib/core/viewModel/procedure_View_model.dart index bf790335..4f9a7cf6 100644 --- a/lib/core/viewModel/procedure_View_model.dart +++ b/lib/core/viewModel/procedure_View_model.dart @@ -289,41 +289,6 @@ class ProcedureViewModel extends BaseViewModel { } } - getPatientLabResult( - {PatientLabOrders patientLabOrder, PatiantInformtion patient}) async { - setState(ViewState.Busy); - await _labsService.getPatientLabResult( - patientLabOrder: patientLabOrder, patient: patient); - if (_labsService.hasError) { - error = _labsService.error; - setState(ViewState.Error); - } else { - _labsService.labResultList.forEach((element) { - List patientLabOrdersClinic = labResultLists - .where( - (elementClinic) => elementClinic.filterName == element.testCode) - .toList(); - - if (patientLabOrdersClinic.length != 0) { - var value = - labResultLists[labResultLists.indexOf(patientLabOrdersClinic[0])] - .patientLabResultList - .where((e) => - e.sampleCollectedOn == element.sampleCollectedOn && - e.resultValue == element.resultValue) - .toList(); - if (value.isEmpty) - labResultLists[labResultLists.indexOf(patientLabOrdersClinic[0])] - .patientLabResultList - .add(element); - } else { - labResultLists - .add(LabResultList(filterName: element.testCode, lab: element)); - } - }); - setState(ViewState.Idle); - } - } getPatientLabOrdersResults( {PatientLabOrders patientLabOrder, diff --git a/lib/core/viewModel/project_view_model.dart b/lib/core/viewModel/project_view_model.dart index 97974a04..f464df0e 100644 --- a/lib/core/viewModel/project_view_model.dart +++ b/lib/core/viewModel/project_view_model.dart @@ -4,15 +4,15 @@ import 'package:connectivity/connectivity.dart'; import 'package:doctor_app_flutter/client/base_app_client.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/viewModel/auth_view_model.dart'; import 'package:doctor_app_flutter/models/doctor/clinic_model.dart'; import 'package:doctor_app_flutter/models/doctor/doctor_profile_model.dart'; -import 'package:doctor_app_flutter/models/doctor/profile_req_Model.dart'; import 'package:doctor_app_flutter/util/dr_app_shared_pref.dart'; import 'package:doctor_app_flutter/util/helpers.dart'; import 'package:flutter/cupertino.dart'; import 'package:provider/provider.dart'; +import 'authentication_view_model.dart'; + Helpers helpers = Helpers(); class ProjectViewModel with ChangeNotifier { @@ -24,7 +24,6 @@ class ProjectViewModel with ChangeNotifier { List doctorClinicsList = []; bool isLoading = false; bool isError = false; - bool isLogin = false; String error = ''; BaseAppClient baseAppClient = BaseAppClient(); @@ -116,19 +115,9 @@ class ProjectViewModel with ChangeNotifier { void getProfile() async { Map profile = await sharedPref.getObj(DOCTOR_PROFILE); DoctorProfileModel doctorProfile = new DoctorProfileModel.fromJson(profile); - ProfileReqModel docInfo = new ProfileReqModel( - doctorID: doctorProfile.doctorID, - clinicID: doctorProfile.clinicID, - license: true, - projectID: doctorProfile.projectID, - ); - - Provider.of(AppGlobal.CONTEX, listen: false) - .getDocProfiles(docInfo.toJson()) - .then((res) async { - sharedPref.setObj(DOCTOR_PROFILE, res['DoctorProfileList'][0]); - }).catchError((err) { - print(err); - }); + ClinicModel clinicModel = ClinicModel(doctorID:doctorProfile.doctorID,clinicID: doctorProfile.clinicID, projectID: doctorProfile.projectID,); + + await Provider.of(AppGlobal.CONTEX, listen: false) + .getDoctorProfileBasedOnClinic(clinicModel); } } diff --git a/lib/icons_app/config.json b/lib/icons_app/config.json index a5f1b893..20885d74 100644 --- a/lib/icons_app/config.json +++ b/lib/icons_app/config.json @@ -2513,9 +2513,9 @@ { "uid": "fbbe1c278b442a4840b03064fe4a2ea4", "css": "respiration-rate-1", - "code": 59499, + "code": 59510, "src": "custom_icons", - "selected": false, + "selected": true, "svg": { "path": "M989.3 410.2C907.2 230.7 805.1 123.6 716.1 123.6A91.6 91.6 0 0 0 667.3 137C595.3 181.3 592 319.6 591.9 334.9 591.9 339.7 590.8 377.9 590 431.1L560.9 420.4V20.1A20.3 20.3 0 0 0 540.6-0.2H499.9A20.3 20.3 0 0 0 479.6 20.1V420.4L450.5 431.1C449.7 378 448.7 339.9 448.6 335.3 448.6 319.6 445.2 181.3 373.2 137A91.6 91.6 0 0 0 324.4 123.6C235.5 123.6 133.3 230.8 51.2 410.3-57.1 647.8 39 972 43.2 985.6A20.1 20.1 0 0 0 67.1 999.3 1776.9 1776.9 0 0 0 243.4 946.2C369.2 900.2 434.5 855.1 442.6 808.2A2836.5 2836.5 0 0 0 451.6 473.7L506.5 453.4H534.7L589.6 473.7A2835.8 2835.8 0 0 0 598.6 808.2C606.7 855.1 671.8 900.2 797.8 946.2A1778.4 1778.4 0 0 0 974.1 999.5 20.1 20.1 0 0 0 998 985.7C1001.8 972 1097.9 647.8 989.3 410.2ZM393.1 500.5L249.7 574.6V634.8L260.7 668.2 288.1 694.8A20.3 20.3 0 0 1 260.1 723.7L230.5 695.2 197 732.2A20.3 20.3 0 0 1 167.2 705.1L209.4 658.4V595.3L130.2 636.3A20.3 20.3 0 1 1 111.7 600.5L129.3 591.4 97.8 566.3A20.3 20.3 0 0 1 122.9 534.8L168.5 571.2 278.8 514.3 184.4 442.5A20.3 20.3 0 0 1 208.8 410.4L239.3 433.5 241.9 410.2A20.3 20.3 0 0 1 281.9 414.6L276.5 461.8 318.5 493.7 374.5 464.8A20.3 20.3 0 1 1 393 500.5ZM942.9 566.3L911.4 591.4 929 600.5A20.3 20.3 0 1 1 910.5 636.3L831.4 595.3V658.2L873.7 705A20.3 20.3 0 0 1 843.8 732.1L810.3 695.1 780.8 723.6A20.3 20.3 0 0 1 752.7 694.7L780.1 668.1 791.1 634.7V574.5L647.7 500.4A20.3 20.3 0 1 1 666.2 464.6L722.2 493.6 764.2 461.7 759 414.5A20.3 20.3 0 1 1 799 410L801.6 433.4 832.1 410.2A20.3 20.3 0 0 1 856.5 442.3L761.9 514 872.2 570.9 917.9 534.5A20.3 20.3 0 0 1 943 566Z", "width": 1041 @@ -2523,6 +2523,146 @@ "search": [ "respiration-rate" ] + }, + { + "uid": "002f9ea7269e8e2ca9a28d0e87f09a2c", + "css": "end-call", + "code": 59604, + "src": "custom_icons", + "selected": true, + "svg": { + "path": "M282.4 546.3L133.8 620.6A13.6 13.6 0 0 1 118.2 618L77 576.8A108.8 108.8 0 0 1 77 423 598.3 598.3 0 0 1 923.2 423.2 108.6 108.6 0 0 1 923.2 576.8L882 618A13.6 13.6 0 0 1 866.4 620.6L717.6 546.3A13.6 13.6 0 0 1 710.4 531.5L727.1 448.2A13.8 13.8 0 0 0 719.3 432.9 565.7 565.7 0 0 0 280.8 432.9 13.8 13.8 0 0 0 273 448.3L289.6 531.4A13.6 13.6 0 0 1 282.3 546.2Z", + "width": 1000 + }, + "search": [ + "end-call" + ] + }, + { + "uid": "ace119a586c0a290d5da68f59038e160", + "css": "end-consultaion", + "code": 59605, + "src": "custom_icons", + "selected": true, + "svg": { + "path": "M664.4 0H92.6A92.7 92.7 0 0 0 0 92.6V907.4A92.7 92.7 0 0 0 92.6 1000H664.3A92.7 92.7 0 0 0 756.9 907.4V92.6A92.7 92.7 0 0 0 664.4 0ZM118.7 167.8L176.4 68.5A20.8 20.8 0 1 1 212.4 89.3L173 157.2H587.9L556.4 87.4A20.8 20.8 0 1 1 594.4 70.1L639.1 169.5A20.8 20.8 0 0 1 620.1 198.9H136.8A20.8 20.8 0 0 1 118.7 167.8ZM644.6 608.6H492.4A20.8 20.8 0 0 1 472.7 594.7L458.3 554.1 423.7 813.6A20.8 20.8 0 0 1 403.7 831.6H403.1A20.8 20.8 0 0 1 382.7 814.7L312.5 452.1 266.5 606.1A20.8 20.8 0 0 1 246.6 621H112.3A20.8 20.8 0 1 1 112.3 579.5H231.1L296.8 358.9A20.8 20.8 0 0 1 337.2 360.9L399.1 681.8 428.4 463.2A20.8 20.8 0 0 1 446.8 445.3 21.3 21.3 0 0 1 468.7 459.1L507 567.1H644.5A20.8 20.8 0 1 1 644.5 608.6Z", + "width": 757 + }, + "search": [ + "end-consultaion" + ] + }, + { + "uid": "62a5ade64a871b2006d088b4e107506f", + "css": "folder-open", + "code": 59606, + "src": "custom_icons", + "selected": true, + "svg": { + "path": "M1130.2 347.1A103.3 103.3 0 0 0 1027.1 244.8H565.1L102.7 246.1A103.3 103.3 0 0 0 0 349.8 17.1 17.1 0 0 0 0 352.4L89.8 898.2A103.3 103.3 0 0 0 192.8 999.9H1117.6A103.3 103.3 0 0 0 1220.7 896.8 17.1 17.1 0 0 0 1220.7 894.2ZM1269.1 113.6H814.5L724.6 6.1A16.8 16.8 0 0 0 711.3 0H344.3A103.3 103.3 0 0 0 241.2 101.7L225.3 197.9H259.5L1027.4 197.9A151.5 151.5 0 0 1 1178.1 342.7L1239.5 715.6 1254.8 807.5A102.5 102.5 0 0 0 1263.6 767.2L1371.6 220.2A16.8 16.8 0 0 0 1371.6 216.9 103.3 103.3 0 0 0 1269.1 113.6Z", + "width": 1372 + }, + "search": [ + "folder-open" + ] + }, + { + "uid": "f696b8dc00777a69a4e1e52df2955ec4", + "css": "folder", + "code": 59607, + "src": "custom_icons", + "selected": true, + "svg": { + "path": "M1029 245.6H572.9L482 137.6A15.5 15.5 0 0 0 469.6 132H101.5A102.3 102.3 0 0 0 0 234.4V897.8A102.3 102.3 0 0 0 102.2 1000H1029A102.3 102.3 0 0 0 1131.2 897.8V347.7A102.3 102.3 0 0 0 1029 245.6ZM1163 113.4H706.6L615.9 5.6A15.5 15.5 0 0 0 603.5 0H235.5A102.2 102.2 0 0 0 134.5 88H470.1A59.4 59.4 0 0 1 515.7 109.2L593.2 201.2H1029A146.5 146.5 0 0 1 1175.1 347.8V867A102.2 102.2 0 0 0 1264.6 765.7V215.4A102.3 102.3 0 0 0 1163 113.4Z", + "width": 1265 + }, + "search": [ + "folder" + ] + }, + { + "uid": "e794f7865351585b57f62ec43bba8aff", + "css": "link-in", + "code": 59608, + "src": "custom_icons", + "selected": true, + "svg": { + "path": "M333.3 750L916.6 750A83.6 83.6 0 0 0 999.9 666.6V83.3A83.6 83.6 0 0 0 916.6 0L333.3 0A83.6 83.6 0 0 0 250 83.3V666.6A83.6 83.6 0 0 0 333.3 750ZM479.1 375V476.6L789.1 166.6 833.2 210.9 523.8 520.7 625.3 520.7V583.3H458.1A41.6 41.6 0 0 1 416.5 541.6V374.9ZM416.7 833.4V916.7H83.3V583.4H166.6V500H41.7A41.8 41.8 0 0 0 0 541.7V958.4A41.9 41.9 0 0 0 41.7 1000.1H458.3A41.9 41.9 0 0 0 500 958.4V833.4Z", + "width": 1000 + }, + "search": [ + "link-in" + ] + }, + { + "uid": "8cbd9cb0e30a60dbfcd1425cb5dbc06d", + "css": "link-out", + "code": 59609, + "src": "custom_icons", + "selected": true, + "svg": { + "path": "M916.7 0H333.5A83.4 83.4 0 0 0 250 83.4V666.8A83.4 83.4 0 0 0 333.5 750.2H916.8A83.4 83.4 0 0 0 1000.2 666.8V83.4A83.4 83.4 0 0 0 916.7 0ZM770.8 375V273.3L460.8 583.3 416.7 539 726.7 229.1 625.1 229.1V166.7H791.7A41.6 41.6 0 0 1 833.4 208.3L833.4 375.2ZM416.7 833.3V916.8H83.4V583.4H166.9V500H41.6A41.8 41.8 0 0 0 0 541.6V958.3A41.8 41.8 0 0 0 41.6 1000H458.4A41.8 41.8 0 0 0 500 958.3V833.3Z", + "width": 1000 + }, + "search": [ + "link-out" + ] + }, + { + "uid": "ed96dd3085af227cc96170408b84c816", + "css": "mute-microphone", + "code": 59610, + "src": "custom_icons", + "selected": true, + "svg": { + "path": "M584.7 579.6V448.4L305.8 727.3A178.5 178.5 0 0 0 584.7 579.6ZM693 472.9H657.5A20.7 20.7 0 0 0 636.8 493.6V566.3A230.7 230.7 0 0 1 276.1 756.9L221.8 811.2A302.3 302.3 0 0 0 367.6 871.6V923.1H208.8A20.7 20.7 0 0 0 188.1 943.8V979.4A20.7 20.7 0 0 0 208.8 1000H603.3A20.7 20.7 0 0 0 624 979.4V943.8A20.7 20.7 0 0 0 603.3 923.1H444.5V871.6A312.1 312.1 0 0 0 713.8 566.4V493.7A20.7 20.7 0 0 0 693 472.9ZM795.4 79.6A56.9 56.9 0 0 0 715 79.6L584.7 209.9V178.6A178.6 178.6 0 0 0 227.4 178.6V567.1L180.4 614.2A230 230 0 0 1 175.2 566.3V493.6A20.7 20.7 0 0 0 154.5 472.9H119A20.7 20.7 0 0 0 98.3 493.6V566.3A298.4 298.4 0 0 0 119.3 675.3L16.7 777.9A56.9 56.9 0 0 0 97.1 858.4L795.4 160.1A56.9 56.9 0 0 0 795.4 79.6Z", + "width": 812 + }, + "search": [ + "mute-microphone" + ] + }, + { + "uid": "7c8fce018306529b3c40386a8e946374", + "css": "no-video", + "code": 59611, + "src": "custom_icons", + "selected": true, + "svg": { + "path": "M69.3 676.7L620.8 125.2H204A135.1 135.1 0 0 0 69.3 260.4ZM1179.1 184.9A135.9 135.9 0 0 0 1052.4 172.5L926.1 225.1A129.2 129.2 0 0 0 904.5 180.5L982.5 102.6A59.9 59.9 0 1 0 897.7 17.9L17.4 898.1A59.5 59.5 0 0 0 17.6 982.4 59.8 59.8 0 0 0 102.3 982.4L210 874.9H796.2A134.6 134.6 0 0 0 926.1 775L1052.4 827.4A134.4 134.4 0 0 0 1179.1 815 134.9 134.9 0 0 0 1239.1 702.7V297.4A134.9 134.9 0 0 0 1179.1 184.9ZM1119.1 702.7A13.7 13.7 0 0 1 1112.3 715 14.6 14.6 0 0 1 1098.4 716.6L930.9 647.5V352.6L1098.2 283.5A14.6 14.6 0 0 1 1112.1 285 13.7 13.7 0 0 1 1119 297.4Z", + "width": 1239 + }, + "search": [ + "no-video" + ] + }, + { + "uid": "7be786f4ac20cbacd06a26d712accfff", + "css": "send-instruction", + "code": 59612, + "src": "custom_icons", + "selected": true, + "svg": { + "path": "M436.7 0A436.7 436.7 0 0 0 226.4 819.5L221.3 1000 427.3 873C430.4 873 433.5 873.5 436.7 873.5A436.7 436.7 0 0 0 436.7 0ZM492.4 691.3H380.4V331H492.4ZM435.7 286.9A54.7 54.7 0 0 1 377.5 231 54.7 54.7 0 0 1 436.4 174.2 56.5 56.5 0 1 1 435.6 287Z", + "width": 873 + }, + "search": [ + "send-instruction" + ] + }, + { + "uid": "926041acc7150e19895e12f7bba3d07a", + "css": "transfer-to-admin", + "code": 59613, + "src": "custom_icons", + "selected": true, + "svg": { + "path": "M202.7 517.8L148.9 463.9A52.2 52.2 0 0 1 148.9 390.3L414.1 125 342.5 53.3A31.2 31.2 0 0 1 364.6 0H635.4A31.3 31.3 0 0 1 666.7 31.2V302.1A31.2 31.2 0 0 1 613.3 324.2L541.7 252.5 276.4 517.7A52.2 52.2 0 0 1 202.8 517.7ZM302.1 1000H31.2A31.3 31.3 0 0 1 0 968.8V697.9A31.2 31.2 0 0 1 53.3 675.8L125 747.5 390.3 482.2A52.2 52.2 0 0 1 463.9 482.2L517.8 536.1A52.2 52.2 0 0 1 517.8 609.7L252.5 875 324.1 946.7A31.2 31.2 0 0 1 302 1000Z", + "width": 667 + }, + "search": [ + "transfer-to-admin" + ] } ] } \ No newline at end of file diff --git a/lib/icons_app/doctor_app_icons.dart b/lib/icons_app/doctor_app_icons.dart index 5e5ce23a..a73be2e3 100644 --- a/lib/icons_app/doctor_app_icons.dart +++ b/lib/icons_app/doctor_app_icons.dart @@ -11,374 +11,209 @@ /// fonts: /// - asset: fonts/DoctorApp.ttf /// -/// +/// /// * MFG Labs, Copyright (C) 2012 by Daniel Bruce /// Author: MFG Labs /// License: SIL (http://scripts.sil.org/OFL) /// Homepage: http://www.mfglabs.com/ /// import 'package:flutter/widgets.dart'; +import 'package:flutter/widgets.dart'; class DoctorApp { DoctorApp._(); - static const _kFontFam = 'DoctorApp'; - static const String _kFontPkg = null; + static const _kFontFam = 'DoctorApp'; + static const String _kFontPkg = null; - static const IconData female_icon = - IconData(0xe800, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData male = - IconData(0xe801, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData reject_icon = - IconData(0xe802, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData home_icon_active = - IconData(0xe803, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData menu_icon = - IconData(0xe804, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData menu_icon_active = - IconData(0xe805, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData message_icon = - IconData(0xe806, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData message_icon_active = - IconData(0xe807, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData scdedule_icon_active = - IconData(0xe808, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData schedule_icon = - IconData(0xe809, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData discharge_patient = - IconData(0xe80a, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData approved_icon = - IconData(0xe80b, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData pending_icon = - IconData(0xe80c, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData in_patient_white = - IconData(0xe80d, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData lab_results = - IconData(0xe80e, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData home_icon = - IconData(0xe80f, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData referral_1 = - IconData(0xe810, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData progress_notes = - IconData(0xe811, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData home_icon_1 = - IconData(0xe812, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData operations = - IconData(0xe813, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData out_patient = - IconData(0xe814, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData patient = - IconData(0xe815, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData qr_code = - IconData(0xe816, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData radiology = - IconData(0xe817, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData referral = - IconData(0xe818, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData male_2 = - IconData(0xe819, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData search_patient = - IconData(0xe81a, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData female_1 = - IconData(0xe81b, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData home_icon_active_1 = - IconData(0xe81c, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData menu_icon_1 = - IconData(0xe81d, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData mail = - IconData(0xe81e, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData medicine_search = - IconData(0xe81f, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData qr_code_1 = - IconData(0xe820, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData search_1 = - IconData(0xe821, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData referred = - IconData(0xe822, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData send = - IconData(0xe823, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData sync_icon = - IconData(0xe824, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData drawer_icon = - IconData(0xe825, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData view = - IconData(0xe826, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData warning = - IconData(0xe827, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData add = - IconData(0xe828, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData close = - IconData(0xe829, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData back = - IconData(0xe82a, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData health_summary = - IconData(0xe82b, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData powered_by_cs = - IconData(0xe82c, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData qr_code_2 = - IconData(0xe82d, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData ecg = - IconData(0xe82e, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData create_episode = - IconData(0xe82f, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData booked = - IconData(0xe830, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData admission_req = - IconData(0xe831, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData walkin = - IconData(0xe832, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData reschedule_ = - IconData(0xe833, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData edit = - IconData(0xe834, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData lab_results2 = - IconData(0xe835, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData leaves = - IconData(0xe836, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData logout = - IconData(0xe837, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData obese_bmi = - IconData(0xe838, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData livecare = - IconData(0xe839, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData health_bmi = - IconData(0xe83a, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData health_bmi_r = - IconData(0xe83b, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData modify_episode = - IconData(0xe83c, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData height = - IconData(0xe83d, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData obese_bmi_r = - IconData(0xe83e, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData ovrweight_bmi = - IconData(0xe83f, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData order_prescription = - IconData(0xe840, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData order_procedures = - IconData(0xe841, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData ovrweight_bmi_r = - IconData(0xe842, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData respiration_rate = - IconData(0xe843, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData patient_sick_leave = - IconData(0xe844, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData progress_notes_1 = - IconData(0xe845, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData temperature = - IconData(0xe846, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData underweight_bmi = - IconData(0xe847, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData radiology_1 = - IconData(0xe848, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData search_patient_1 = - IconData(0xe849, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData referral_bg = - IconData(0xe84a, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData search = - IconData(0xe84b, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData search_bg = - IconData(0xe84c, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData arrival_patients = - IconData(0xe84d, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData arrival_patients_bg = - IconData(0xe84e, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData refer_patient = - IconData(0xe84f, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData underweight_bmi_r = - IconData(0xe850, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData weight = - IconData(0xe851, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData blood_pressure = - IconData(0xe852, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData vital_signs = - IconData(0xe853, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData ucaf = - IconData(0xe854, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData filter = - IconData(0xe855, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData male_1 = - IconData(0xe856, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData female = - IconData(0xe857, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData external_link = - IconData(0xe858, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData verify_face_2 = - IconData(0xe859, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData verify_sms_2 = - IconData(0xe85a, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData home = - IconData(0xe85b, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData verify_finger_2 = - IconData(0xe85c, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData dr_reply_active = - IconData(0xe85d, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData dr_reply = - IconData(0xe85e, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData schedule_active = - IconData(0xe85f, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData schedule = - IconData(0xe860, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData qr_reader_active = - IconData(0xe861, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData qr_reader = - IconData(0xe862, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData home_active = - IconData(0xe863, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData arrow_forward = - IconData(0xe864, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData heart_rate = - IconData(0xe865, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData menu_icon_active_1 = - IconData(0xe866, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData message_icon_1 = - IconData(0xe867, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData message_icon_active_1 = - IconData(0xe868, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData scdedule_icon_active_1 = - IconData(0xe869, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData ovrweight_bmi_r_1 = - IconData(0xe86a, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData underweight_bmi_1 = - IconData(0xe86b, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData temperature_1 = - IconData(0xe86c, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData underweight_bmi_r_1 = - IconData(0xe86d, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData weight_1 = - IconData(0xe86e, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData blood_pressure_1 = - IconData(0xe86f, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData health_bmi_r_1 = - IconData(0xe870, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData health_bmi_1 = - IconData(0xe871, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData heart_rate_1 = - IconData(0xe872, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData height_1 = - IconData(0xe873, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData obese_bmi_1 = - IconData(0xe874, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData ovrweight_bmi_1 = - IconData(0xe875, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData qr_code_3 = - IconData(0xe877, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData reschedule__1 = - IconData(0xe878, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData logout_1 = - IconData(0xe879, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData livecare_1 = - IconData(0xe87a, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData modify_episode_1 = - IconData(0xe87b, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData order_prescription_1 = - IconData(0xe87c, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData order_procedures_1 = - IconData(0xe87d, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData patient_sick_leave_1 = - IconData(0xe87e, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData progress_notes_2 = - IconData(0xe87f, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData radiology_2 = - IconData(0xe880, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData refer_patient_1 = - IconData(0xe881, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData ucaf_1 = - IconData(0xe882, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData vital_signs_1 = - IconData(0xe883, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData walkin_1 = - IconData(0xe884, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData admission_req_1 = - IconData(0xe885, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData booked_1 = - IconData(0xe886, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData create_episode_1 = - IconData(0xe887, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData ecg_1 = - IconData(0xe888, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData health_summary_1 = - IconData(0xe889, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData lab_results_1 = - IconData(0xe88a, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData female_2 = - IconData(0xe88b, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData filter_1 = - IconData(0xe88c, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData male_3 = - IconData(0xe88d, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData search_2 = - IconData(0xe88e, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData send_1 = - IconData(0xe88f, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData view_1 = - IconData(0xe890, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData warning_1 = - IconData(0xe891, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData add_1 = - IconData(0xe892, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData arrow_forward_1 = - IconData(0xe893, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData back_1 = - IconData(0xe894, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData close_1 = - IconData(0xe895, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData edit_1 = - IconData(0xe896, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData external_link_1 = - IconData(0xe897, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData verify_finger_1 = - IconData(0xe898, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData verify_sms_1 = - IconData(0xe899, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData verify_face_1 = - IconData(0xe89a, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData qr_reader_1 = - IconData(0xe89b, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData qr_reader_active_1 = - IconData(0xe89c, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData schedule_1 = - IconData(0xe89d, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData schedule_active_1 = - IconData(0xe89e, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData dr_reply_1 = - IconData(0xe89f, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData dr_reply_active_1 = - IconData(0xe8a0, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData home_1 = - IconData(0xe8a1, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData home_active_1 = - IconData(0xe8a2, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData verify_face = - IconData(0xe8a3, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData verify_finger = - IconData(0xe8a4, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData verify_whtsapp = - IconData(0xe8a5, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData verify_sms = - IconData(0xe8a6, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData obese_bmi_r_1 = - IconData(0xe8a9, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData inpatient = - IconData(0xe959, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData discharge = - IconData(0xe95a, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData order_sheets = - IconData(0xe95b, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData call = - IconData(0xe95c, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData medical_report = - IconData(0xe95d, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData painscale = - IconData(0xe95e, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData oxygenation = - IconData(0xe95f, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData speechtotext = - IconData(0xe960, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData search_medicines = - IconData(0xe964, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData discharge_patients = - IconData(0xe965, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData referral_discharge = - IconData(0xe966, fontFamily: _kFontFam, fontPackage: _kFontPkg); + static const IconData female_icon = IconData(0xe800, fontFamily: _kFontFam, fontPackage: _kFontPkg); + static const IconData male = IconData(0xe801, fontFamily: _kFontFam, fontPackage: _kFontPkg); + static const IconData reject_icon = IconData(0xe802, fontFamily: _kFontFam, fontPackage: _kFontPkg); + static const IconData home_icon_active = IconData(0xe803, fontFamily: _kFontFam, fontPackage: _kFontPkg); + static const IconData menu_icon = IconData(0xe804, fontFamily: _kFontFam, fontPackage: _kFontPkg); + static const IconData menu_icon_active = IconData(0xe805, fontFamily: _kFontFam, fontPackage: _kFontPkg); + static const IconData message_icon = IconData(0xe806, fontFamily: _kFontFam, fontPackage: _kFontPkg); + static const IconData message_icon_active = IconData(0xe807, fontFamily: _kFontFam, fontPackage: _kFontPkg); + static const IconData scdedule_icon_active = IconData(0xe808, fontFamily: _kFontFam, fontPackage: _kFontPkg); + static const IconData schedule_icon = IconData(0xe809, fontFamily: _kFontFam, fontPackage: _kFontPkg); + static const IconData discharge_patient = IconData(0xe80a, fontFamily: _kFontFam, fontPackage: _kFontPkg); + static const IconData approved_icon = IconData(0xe80b, fontFamily: _kFontFam, fontPackage: _kFontPkg); + static const IconData pending_icon = IconData(0xe80c, fontFamily: _kFontFam, fontPackage: _kFontPkg); + static const IconData in_patient_white = IconData(0xe80d, fontFamily: _kFontFam, fontPackage: _kFontPkg); + static const IconData lab_results = IconData(0xe80e, fontFamily: _kFontFam, fontPackage: _kFontPkg); + static const IconData home_icon = IconData(0xe80f, fontFamily: _kFontFam, fontPackage: _kFontPkg); + static const IconData referral_1 = IconData(0xe810, fontFamily: _kFontFam, fontPackage: _kFontPkg); + static const IconData progress_notes = IconData(0xe811, fontFamily: _kFontFam, fontPackage: _kFontPkg); + static const IconData home_icon_1 = IconData(0xe812, fontFamily: _kFontFam, fontPackage: _kFontPkg); + static const IconData operations = IconData(0xe813, fontFamily: _kFontFam, fontPackage: _kFontPkg); + static const IconData out_patient = IconData(0xe814, fontFamily: _kFontFam, fontPackage: _kFontPkg); + static const IconData patient = IconData(0xe815, fontFamily: _kFontFam, fontPackage: _kFontPkg); + static const IconData qr_code = IconData(0xe816, fontFamily: _kFontFam, fontPackage: _kFontPkg); + static const IconData radiology = IconData(0xe817, fontFamily: _kFontFam, fontPackage: _kFontPkg); + static const IconData referral = IconData(0xe818, fontFamily: _kFontFam, fontPackage: _kFontPkg); + static const IconData male_2 = IconData(0xe819, fontFamily: _kFontFam, fontPackage: _kFontPkg); + static const IconData search_patient = IconData(0xe81a, fontFamily: _kFontFam, fontPackage: _kFontPkg); + static const IconData female_1 = IconData(0xe81b, fontFamily: _kFontFam, fontPackage: _kFontPkg); + static const IconData home_icon_active_1 = IconData(0xe81c, fontFamily: _kFontFam, fontPackage: _kFontPkg); + static const IconData menu_icon_1 = IconData(0xe81d, fontFamily: _kFontFam, fontPackage: _kFontPkg); + static const IconData mail = IconData(0xe81e, fontFamily: _kFontFam, fontPackage: _kFontPkg); + static const IconData medicine_search = IconData(0xe81f, fontFamily: _kFontFam, fontPackage: _kFontPkg); + static const IconData qr_code_1 = IconData(0xe820, fontFamily: _kFontFam, fontPackage: _kFontPkg); + static const IconData search_1 = IconData(0xe821, fontFamily: _kFontFam, fontPackage: _kFontPkg); + static const IconData referred = IconData(0xe822, fontFamily: _kFontFam, fontPackage: _kFontPkg); + static const IconData send = IconData(0xe823, fontFamily: _kFontFam, fontPackage: _kFontPkg); + static const IconData sync_icon = IconData(0xe824, fontFamily: _kFontFam, fontPackage: _kFontPkg); + static const IconData drawer_icon = IconData(0xe825, fontFamily: _kFontFam, fontPackage: _kFontPkg); + static const IconData view = IconData(0xe826, fontFamily: _kFontFam, fontPackage: _kFontPkg); + static const IconData warning = IconData(0xe827, fontFamily: _kFontFam, fontPackage: _kFontPkg); + static const IconData add = IconData(0xe828, fontFamily: _kFontFam, fontPackage: _kFontPkg); + static const IconData close = IconData(0xe829, fontFamily: _kFontFam, fontPackage: _kFontPkg); + static const IconData back = IconData(0xe82a, fontFamily: _kFontFam, fontPackage: _kFontPkg); + static const IconData health_summary = IconData(0xe82b, fontFamily: _kFontFam, fontPackage: _kFontPkg); + static const IconData powered_by_cs = IconData(0xe82c, fontFamily: _kFontFam, fontPackage: _kFontPkg); + static const IconData qr_code_2 = IconData(0xe82d, fontFamily: _kFontFam, fontPackage: _kFontPkg); + static const IconData ecg = IconData(0xe82e, fontFamily: _kFontFam, fontPackage: _kFontPkg); + static const IconData create_episode = IconData(0xe82f, fontFamily: _kFontFam, fontPackage: _kFontPkg); + static const IconData booked = IconData(0xe830, fontFamily: _kFontFam, fontPackage: _kFontPkg); + static const IconData admission_req = IconData(0xe831, fontFamily: _kFontFam, fontPackage: _kFontPkg); + static const IconData walkin = IconData(0xe832, fontFamily: _kFontFam, fontPackage: _kFontPkg); + static const IconData reschedule_ = IconData(0xe833, fontFamily: _kFontFam, fontPackage: _kFontPkg); + static const IconData edit = IconData(0xe834, fontFamily: _kFontFam, fontPackage: _kFontPkg); + static const IconData leaves = IconData(0xe836, fontFamily: _kFontFam, fontPackage: _kFontPkg); + static const IconData logout = IconData(0xe837, fontFamily: _kFontFam, fontPackage: _kFontPkg); + static const IconData obese_bmi = IconData(0xe838, fontFamily: _kFontFam, fontPackage: _kFontPkg); + static const IconData livecare = IconData(0xe839, fontFamily: _kFontFam, fontPackage: _kFontPkg); + static const IconData health_bmi = IconData(0xe83a, fontFamily: _kFontFam, fontPackage: _kFontPkg); + static const IconData health_bmi_r = IconData(0xe83b, fontFamily: _kFontFam, fontPackage: _kFontPkg); + static const IconData modify_episode = IconData(0xe83c, fontFamily: _kFontFam, fontPackage: _kFontPkg); + static const IconData height = IconData(0xe83d, fontFamily: _kFontFam, fontPackage: _kFontPkg); + static const IconData obese_bmi_r = IconData(0xe83e, fontFamily: _kFontFam, fontPackage: _kFontPkg); + static const IconData ovrweight_bmi = IconData(0xe83f, fontFamily: _kFontFam, fontPackage: _kFontPkg); + static const IconData order_prescription = IconData(0xe840, fontFamily: _kFontFam, fontPackage: _kFontPkg); + static const IconData order_procedures = IconData(0xe841, fontFamily: _kFontFam, fontPackage: _kFontPkg); + static const IconData ovrweight_bmi_r = IconData(0xe842, fontFamily: _kFontFam, fontPackage: _kFontPkg); + static const IconData respiration_rate = IconData(0xe843, fontFamily: _kFontFam, fontPackage: _kFontPkg); + static const IconData patient_sick_leave = IconData(0xe844, fontFamily: _kFontFam, fontPackage: _kFontPkg); + static const IconData progress_notes_1 = IconData(0xe845, fontFamily: _kFontFam, fontPackage: _kFontPkg); + static const IconData temperature = IconData(0xe846, fontFamily: _kFontFam, fontPackage: _kFontPkg); + static const IconData underweight_bmi = IconData(0xe847, fontFamily: _kFontFam, fontPackage: _kFontPkg); + static const IconData radiology_1 = IconData(0xe848, fontFamily: _kFontFam, fontPackage: _kFontPkg); + static const IconData search_patient_1 = IconData(0xe849, fontFamily: _kFontFam, fontPackage: _kFontPkg); + static const IconData referral_bg = IconData(0xe84a, fontFamily: _kFontFam, fontPackage: _kFontPkg); + static const IconData search = IconData(0xe84b, fontFamily: _kFontFam, fontPackage: _kFontPkg); + static const IconData search_bg = IconData(0xe84c, fontFamily: _kFontFam, fontPackage: _kFontPkg); + static const IconData arrival_patients = IconData(0xe84d, fontFamily: _kFontFam, fontPackage: _kFontPkg); + static const IconData arrival_patients_bg = IconData(0xe84e, fontFamily: _kFontFam, fontPackage: _kFontPkg); + static const IconData refer_patient = IconData(0xe84f, fontFamily: _kFontFam, fontPackage: _kFontPkg); + static const IconData underweight_bmi_r = IconData(0xe850, fontFamily: _kFontFam, fontPackage: _kFontPkg); + static const IconData weight = IconData(0xe851, fontFamily: _kFontFam, fontPackage: _kFontPkg); + static const IconData blood_pressure = IconData(0xe852, fontFamily: _kFontFam, fontPackage: _kFontPkg); + static const IconData vital_signs = IconData(0xe853, fontFamily: _kFontFam, fontPackage: _kFontPkg); + static const IconData ucaf = IconData(0xe854, fontFamily: _kFontFam, fontPackage: _kFontPkg); + static const IconData filter = IconData(0xe855, fontFamily: _kFontFam, fontPackage: _kFontPkg); + static const IconData male_1 = IconData(0xe856, fontFamily: _kFontFam, fontPackage: _kFontPkg); + static const IconData female = IconData(0xe857, fontFamily: _kFontFam, fontPackage: _kFontPkg); + static const IconData external_link = IconData(0xe858, fontFamily: _kFontFam, fontPackage: _kFontPkg); + static const IconData verify_face_2 = IconData(0xe859, fontFamily: _kFontFam, fontPackage: _kFontPkg); + static const IconData verify_sms_2 = IconData(0xe85a, fontFamily: _kFontFam, fontPackage: _kFontPkg); + static const IconData home = IconData(0xe85b, fontFamily: _kFontFam, fontPackage: _kFontPkg); + static const IconData verify_finger_2 = IconData(0xe85c, fontFamily: _kFontFam, fontPackage: _kFontPkg); + static const IconData dr_reply_active = IconData(0xe85d, fontFamily: _kFontFam, fontPackage: _kFontPkg); + static const IconData dr_reply = IconData(0xe85e, fontFamily: _kFontFam, fontPackage: _kFontPkg); + static const IconData schedule_active = IconData(0xe85f, fontFamily: _kFontFam, fontPackage: _kFontPkg); + static const IconData schedule = IconData(0xe860, fontFamily: _kFontFam, fontPackage: _kFontPkg); + static const IconData qr_reader_active = IconData(0xe861, fontFamily: _kFontFam, fontPackage: _kFontPkg); + static const IconData qr_reader = IconData(0xe862, fontFamily: _kFontFam, fontPackage: _kFontPkg); + static const IconData home_active = IconData(0xe863, fontFamily: _kFontFam, fontPackage: _kFontPkg); + static const IconData arrow_forward = IconData(0xe864, fontFamily: _kFontFam, fontPackage: _kFontPkg); + static const IconData heart_rate = IconData(0xe865, fontFamily: _kFontFam, fontPackage: _kFontPkg); + static const IconData menu_icon_active_1 = IconData(0xe866, fontFamily: _kFontFam, fontPackage: _kFontPkg); + static const IconData message_icon_1 = IconData(0xe867, fontFamily: _kFontFam, fontPackage: _kFontPkg); + static const IconData message_icon_active_1 = IconData(0xe868, fontFamily: _kFontFam, fontPackage: _kFontPkg); + static const IconData scdedule_icon_active_1 = IconData(0xe869, fontFamily: _kFontFam, fontPackage: _kFontPkg); + static const IconData ovrweight_bmi_r_1 = IconData(0xe86a, fontFamily: _kFontFam, fontPackage: _kFontPkg); + static const IconData underweight_bmi_1 = IconData(0xe86b, fontFamily: _kFontFam, fontPackage: _kFontPkg); + static const IconData temperature_1 = IconData(0xe86c, fontFamily: _kFontFam, fontPackage: _kFontPkg); + static const IconData underweight_bmi_r_1 = IconData(0xe86d, fontFamily: _kFontFam, fontPackage: _kFontPkg); + static const IconData weight_1 = IconData(0xe86e, fontFamily: _kFontFam, fontPackage: _kFontPkg); + static const IconData blood_pressure_1 = IconData(0xe86f, fontFamily: _kFontFam, fontPackage: _kFontPkg); + static const IconData health_bmi_r_1 = IconData(0xe870, fontFamily: _kFontFam, fontPackage: _kFontPkg); + static const IconData health_bmi_1 = IconData(0xe871, fontFamily: _kFontFam, fontPackage: _kFontPkg); + static const IconData heart_rate_1 = IconData(0xe872, fontFamily: _kFontFam, fontPackage: _kFontPkg); + static const IconData height_1 = IconData(0xe873, fontFamily: _kFontFam, fontPackage: _kFontPkg); + static const IconData obese_bmi_1 = IconData(0xe874, fontFamily: _kFontFam, fontPackage: _kFontPkg); + static const IconData ovrweight_bmi_1 = IconData(0xe875, fontFamily: _kFontFam, fontPackage: _kFontPkg); + static const IconData respiration_rate_1 = IconData(0xe876, fontFamily: _kFontFam, fontPackage: _kFontPkg); + static const IconData qr_code_3 = IconData(0xe877, fontFamily: _kFontFam, fontPackage: _kFontPkg); + static const IconData reschedule__1 = IconData(0xe878, fontFamily: _kFontFam, fontPackage: _kFontPkg); + static const IconData logout_1 = IconData(0xe879, fontFamily: _kFontFam, fontPackage: _kFontPkg); + static const IconData livecare_1 = IconData(0xe87a, fontFamily: _kFontFam, fontPackage: _kFontPkg); + static const IconData modify_episode_1 = IconData(0xe87b, fontFamily: _kFontFam, fontPackage: _kFontPkg); + static const IconData order_prescription_1 = IconData(0xe87c, fontFamily: _kFontFam, fontPackage: _kFontPkg); + static const IconData order_procedures_1 = IconData(0xe87d, fontFamily: _kFontFam, fontPackage: _kFontPkg); + static const IconData patient_sick_leave_1 = IconData(0xe87e, fontFamily: _kFontFam, fontPackage: _kFontPkg); + static const IconData progress_notes_2 = IconData(0xe87f, fontFamily: _kFontFam, fontPackage: _kFontPkg); + static const IconData radiology_2 = IconData(0xe880, fontFamily: _kFontFam, fontPackage: _kFontPkg); + static const IconData refer_patient_1 = IconData(0xe881, fontFamily: _kFontFam, fontPackage: _kFontPkg); + static const IconData ucaf_1 = IconData(0xe882, fontFamily: _kFontFam, fontPackage: _kFontPkg); + static const IconData vital_signs_1 = IconData(0xe883, fontFamily: _kFontFam, fontPackage: _kFontPkg); + static const IconData walkin_1 = IconData(0xe884, fontFamily: _kFontFam, fontPackage: _kFontPkg); + static const IconData admission_req_1 = IconData(0xe885, fontFamily: _kFontFam, fontPackage: _kFontPkg); + static const IconData booked_1 = IconData(0xe886, fontFamily: _kFontFam, fontPackage: _kFontPkg); + static const IconData create_episode_1 = IconData(0xe887, fontFamily: _kFontFam, fontPackage: _kFontPkg); + static const IconData ecg_1 = IconData(0xe888, fontFamily: _kFontFam, fontPackage: _kFontPkg); + static const IconData health_summary_1 = IconData(0xe889, fontFamily: _kFontFam, fontPackage: _kFontPkg); + static const IconData lab_results_1 = IconData(0xe88a, fontFamily: _kFontFam, fontPackage: _kFontPkg); + static const IconData female_2 = IconData(0xe88b, fontFamily: _kFontFam, fontPackage: _kFontPkg); + static const IconData filter_1 = IconData(0xe88c, fontFamily: _kFontFam, fontPackage: _kFontPkg); + static const IconData male_3 = IconData(0xe88d, fontFamily: _kFontFam, fontPackage: _kFontPkg); + static const IconData search_2 = IconData(0xe88e, fontFamily: _kFontFam, fontPackage: _kFontPkg); + static const IconData send_1 = IconData(0xe88f, fontFamily: _kFontFam, fontPackage: _kFontPkg); + static const IconData view_1 = IconData(0xe890, fontFamily: _kFontFam, fontPackage: _kFontPkg); + static const IconData warning_1 = IconData(0xe891, fontFamily: _kFontFam, fontPackage: _kFontPkg); + static const IconData add_1 = IconData(0xe892, fontFamily: _kFontFam, fontPackage: _kFontPkg); + static const IconData arrow_forward_1 = IconData(0xe893, fontFamily: _kFontFam, fontPackage: _kFontPkg); + static const IconData back_1 = IconData(0xe894, fontFamily: _kFontFam, fontPackage: _kFontPkg); + static const IconData close_1 = IconData(0xe895, fontFamily: _kFontFam, fontPackage: _kFontPkg); + static const IconData edit_1 = IconData(0xe896, fontFamily: _kFontFam, fontPackage: _kFontPkg); + static const IconData external_link_1 = IconData(0xe897, fontFamily: _kFontFam, fontPackage: _kFontPkg); + static const IconData verify_finger_1 = IconData(0xe898, fontFamily: _kFontFam, fontPackage: _kFontPkg); + static const IconData verify_sms_1 = IconData(0xe899, fontFamily: _kFontFam, fontPackage: _kFontPkg); + static const IconData verify_face_1 = IconData(0xe89a, fontFamily: _kFontFam, fontPackage: _kFontPkg); + static const IconData qr_reader_1 = IconData(0xe89b, fontFamily: _kFontFam, fontPackage: _kFontPkg); + static const IconData qr_reader_active_1 = IconData(0xe89c, fontFamily: _kFontFam, fontPackage: _kFontPkg); + static const IconData schedule_1 = IconData(0xe89d, fontFamily: _kFontFam, fontPackage: _kFontPkg); + static const IconData schedule_active_1 = IconData(0xe89e, fontFamily: _kFontFam, fontPackage: _kFontPkg); + static const IconData dr_reply_1 = IconData(0xe89f, fontFamily: _kFontFam, fontPackage: _kFontPkg); + static const IconData dr_reply_active_1 = IconData(0xe8a0, fontFamily: _kFontFam, fontPackage: _kFontPkg); + static const IconData home_1 = IconData(0xe8a1, fontFamily: _kFontFam, fontPackage: _kFontPkg); + static const IconData home_active_1 = IconData(0xe8a2, fontFamily: _kFontFam, fontPackage: _kFontPkg); + static const IconData verify_face = IconData(0xe8a3, fontFamily: _kFontFam, fontPackage: _kFontPkg); + static const IconData verify_finger = IconData(0xe8a4, fontFamily: _kFontFam, fontPackage: _kFontPkg); + static const IconData verify_whtsapp = IconData(0xe8a5, fontFamily: _kFontFam, fontPackage: _kFontPkg); + static const IconData verify_sms = IconData(0xe8a6, fontFamily: _kFontFam, fontPackage: _kFontPkg); + /// static const IconData 124 = IconData(0xe8a7, fontFamily: _kFontFam, fontPackage: _kFontPkg); + ///static const IconData 123 = IconData(0xe8a8, fontFamily: _kFontFam, fontPackage: _kFontPkg); + static const IconData obese_bmi_r_1 = IconData(0xe8a9, fontFamily: _kFontFam, fontPackage: _kFontPkg); + static const IconData end_call = IconData(0xe8d4, fontFamily: _kFontFam, fontPackage: _kFontPkg); + static const IconData end_consultaion = IconData(0xe8d5, fontFamily: _kFontFam, fontPackage: _kFontPkg); + static const IconData folder_open = IconData(0xe8d6, fontFamily: _kFontFam, fontPackage: _kFontPkg); + static const IconData folder = IconData(0xe8d7, fontFamily: _kFontFam, fontPackage: _kFontPkg); + static const IconData link_in = IconData(0xe8d8, fontFamily: _kFontFam, fontPackage: _kFontPkg); + static const IconData link_out = IconData(0xe8d9, fontFamily: _kFontFam, fontPackage: _kFontPkg); + static const IconData mute_microphone = IconData(0xe8da, fontFamily: _kFontFam, fontPackage: _kFontPkg); + static const IconData no_video = IconData(0xe8db, fontFamily: _kFontFam, fontPackage: _kFontPkg); + static const IconData send_instruction = IconData(0xe8dc, fontFamily: _kFontFam, fontPackage: _kFontPkg); + static const IconData transfer_to_admin = IconData(0xe8dd, fontFamily: _kFontFam, fontPackage: _kFontPkg); + static const IconData inpatient = IconData(0xe959, fontFamily: _kFontFam, fontPackage: _kFontPkg); + static const IconData discharge = IconData(0xe95a, fontFamily: _kFontFam, fontPackage: _kFontPkg); + static const IconData order_sheets = IconData(0xe95b, fontFamily: _kFontFam, fontPackage: _kFontPkg); + static const IconData call = IconData(0xe95c, fontFamily: _kFontFam, fontPackage: _kFontPkg); + static const IconData medical_report = IconData(0xe95d, fontFamily: _kFontFam, fontPackage: _kFontPkg); + static const IconData painscale = IconData(0xe95e, fontFamily: _kFontFam, fontPackage: _kFontPkg); + static const IconData oxygenation = IconData(0xe95f, fontFamily: _kFontFam, fontPackage: _kFontPkg); + static const IconData speechtotext = IconData(0xe960, fontFamily: _kFontFam, fontPackage: _kFontPkg); + static const IconData search_medicines = IconData(0xe964, fontFamily: _kFontFam, fontPackage: _kFontPkg); + static const IconData discharge_patients = IconData(0xe965, fontFamily: _kFontFam, fontPackage: _kFontPkg); + static const IconData referral_discharge = IconData(0xe966, fontFamily: _kFontFam, fontPackage: _kFontPkg); } diff --git a/lib/landing_page.dart b/lib/landing_page.dart index 0e1e2c48..cd7a8171 100644 --- a/lib/landing_page.dart +++ b/lib/landing_page.dart @@ -62,9 +62,7 @@ class _LandingPageState extends State { physics: NeverScrollableScrollPhysics(), controller: pageController, children: [ - ShowCaseWidget( - builder: Builder(builder: (context) => HomeScreen()), - ), + HomeScreen(), MyScheduleScreen(), QrReaderScreen(), DoctorReplyScreen( diff --git a/lib/locator.dart b/lib/locator.dart index 321b3ffa..db71c654 100644 --- a/lib/locator.dart +++ b/lib/locator.dart @@ -1,5 +1,6 @@ +import 'package:doctor_app_flutter/core/service/authentication_service.dart'; import 'package:doctor_app_flutter/core/viewModel/dashboard_view_model.dart'; -import 'package:doctor_app_flutter/core/viewModel/imei_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'; @@ -7,7 +8,6 @@ import 'package:doctor_app_flutter/core/viewModel/procedure_View_model.dart'; import 'package:doctor_app_flutter/core/viewModel/sick_leave_view_model.dart'; import 'package:get_it/get_it.dart'; -import 'core/service/home/auth_service.dart'; import 'core/service/home/dasboard_service.dart'; import 'core/service/patient/DischargedPatientService.dart'; import 'core/service/patient/patient_service.dart'; @@ -15,12 +15,14 @@ import 'core/service/patient_medical_file/insurance/InsuranceCardService.dart'; import 'core/service/patient/MyReferralPatientService.dart'; import 'core/service/patient/PatientMuseService.dart'; import 'core/service/patient/ReferralService.dart'; +import 'core/service/patient_medical_file/medical_report/PatientMedicalReportService.dart'; import 'core/service/patient_medical_file/medical_report/medical_file_service.dart'; import 'core/service/patient_medical_file/prescription/prescription_service.dart'; import 'core/service/patient_medical_file/procedure/procedure_service.dart'; import 'core/service/patient_medical_file/sick_leave/sickleave_service.dart'; import 'core/service/patient_medical_file/soap/SOAP_service.dart'; import 'core/service/home/doctor_reply_service.dart'; +import 'core/service/hospitals/hospitals_service.dart'; import 'core/service/patient_medical_file/lab_order/labs_service.dart'; import 'core/service/patient_medical_file/prescription/medicine_service.dart'; import 'core/service/patient_medical_file/admission_request/patient-admission-request-service.dart'; @@ -36,6 +38,7 @@ import 'core/service/patient/referred_patient_service.dart'; import 'core/service/home/schedule_service.dart'; import 'core/viewModel/DischargedPatientViewModel.dart'; import 'core/viewModel/InsuranceViewModel.dart'; +import 'core/viewModel/PatientMedicalReportViewModel.dart'; import 'core/viewModel/PatientMuseViewModel.dart'; import 'core/viewModel/PatientSearchViewModel.dart'; import 'core/viewModel/SOAP_view_model.dart'; @@ -73,7 +76,7 @@ void setupLocator() { locator.registerLazySingleton(() => MedicalFileService()); locator.registerLazySingleton(() => AdmissionRequestService()); locator.registerLazySingleton(() => UcafService()); - locator.registerLazySingleton(() => AuthService()); + locator.registerLazySingleton(() => AuthenticationService()); locator.registerLazySingleton(() => PatientMuseService()); locator.registerLazySingleton(() => LabsService()); locator.registerLazySingleton(() => InsuranceCardService()); @@ -84,10 +87,11 @@ void setupLocator() { locator.registerLazySingleton(() => DischargedPatientService()); locator.registerLazySingleton(() => PatientInPatientService()); locator.registerLazySingleton(() => OutPatientService()); + locator.registerLazySingleton(() => HospitalsService()); + locator.registerLazySingleton(() => PatientMedicalReportService()); /// View Model locator.registerFactory(() => DoctorReplayViewModel()); - locator.registerFactory(() => IMEIViewModel()); locator.registerFactory(() => ScheduleViewModel()); locator.registerFactory(() => ReferralPatientViewModel()); locator.registerFactory(() => ReferredPatientViewModel()); @@ -110,4 +114,6 @@ void setupLocator() { locator.registerFactory(() => PrescriptionsViewModel()); locator.registerFactory(() => DischargedPatientViewModel()); locator.registerFactory(() => PatientSearchViewModel()); + locator.registerFactory(() => HospitalViewModel()); + locator.registerFactory(() => PatientMedicalReportViewModel()); } diff --git a/lib/main.dart b/lib/main.dart index 4e140920..a95378e5 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -11,8 +11,7 @@ import 'package:provider/provider.dart'; import './config/size_config.dart'; import './routes.dart'; import 'config/config.dart'; -import 'core/viewModel/auth_view_model.dart'; -import 'core/viewModel/hospital_view_model.dart'; +import 'core/viewModel/authentication_view_model.dart'; import 'locator.dart'; void main() async { @@ -23,7 +22,6 @@ void main() async { } class MyApp extends StatelessWidget { - // This widget is the root of your application. @override Widget build(BuildContext context) { AppGlobal.CONTEX = context; @@ -33,10 +31,8 @@ class MyApp extends StatelessWidget { SizeConfig().init(constraints, orientation); return MultiProvider( providers: [ - ChangeNotifierProvider( - create: (context) => AuthViewModel()), - ChangeNotifierProvider( - create: (context) => HospitalViewModel()), + ChangeNotifierProvider( + create: (context) => AuthenticationViewModel()), ChangeNotifierProvider( create: (context) => ProjectViewModel(), ), diff --git a/lib/models/patient/MedicalReport/MedicalReportTemplate.dart b/lib/models/patient/MedicalReport/MedicalReportTemplate.dart new file mode 100644 index 00000000..f00e84a0 --- /dev/null +++ b/lib/models/patient/MedicalReport/MedicalReportTemplate.dart @@ -0,0 +1,60 @@ +class MedicalReportTemplate { + String setupID; + int projectID; + int templateID; + String procedureID; + int reportType; + String templateName; + String templateNameN; + String templateText; + String templateTextN; + bool isActive; + String templateTextHtml; + String templateTextNHtml; + + MedicalReportTemplate( + {this.setupID, + this.projectID, + this.templateID, + this.procedureID, + this.reportType, + this.templateName, + this.templateNameN, + this.templateText, + this.templateTextN, + this.isActive, + this.templateTextHtml, + this.templateTextNHtml}); + + MedicalReportTemplate.fromJson(Map json) { + setupID = json['SetupID']; + projectID = json['ProjectID']; + templateID = json['TemplateID']; + procedureID = json['ProcedureID']; + reportType = json['ReportType']; + templateName = json['TemplateName']; + templateNameN = json['TemplateNameN']; + templateText = json['TemplateText']; + templateTextN = json['TemplateTextN']; + isActive = json['IsActive']; + templateTextHtml = json['TemplateTextHtml']; + templateTextNHtml = json['TemplateTextNHtml']; + } + + Map toJson() { + final Map data = new Map(); + data['SetupID'] = this.setupID; + data['ProjectID'] = this.projectID; + data['TemplateID'] = this.templateID; + data['ProcedureID'] = this.procedureID; + data['ReportType'] = this.reportType; + data['TemplateName'] = this.templateName; + data['TemplateNameN'] = this.templateNameN; + data['TemplateText'] = this.templateText; + data['TemplateTextN'] = this.templateTextN; + data['IsActive'] = this.isActive; + data['TemplateTextHtml'] = this.templateTextHtml; + data['TemplateTextNHtml'] = this.templateTextNHtml; + return data; + } +} diff --git a/lib/models/patient/MedicalReport/MeidcalReportModel.dart b/lib/models/patient/MedicalReport/MeidcalReportModel.dart new file mode 100644 index 00000000..450b93f6 --- /dev/null +++ b/lib/models/patient/MedicalReport/MeidcalReportModel.dart @@ -0,0 +1,60 @@ +class MedicalReportModel { + String reportData; + String setupID; + int projectID; + int patientID; + String invoiceNo; + int status; + String verifiedOn; + int verifiedBy; + String editedOn; + int editedBy; + int lineItemNo; + String reportDataHtml; + + MedicalReportModel( + {this.reportData, + this.setupID, + this.projectID, + this.patientID, + this.invoiceNo, + this.status, + this.verifiedOn, + this.verifiedBy, + this.editedOn, + this.editedBy, + this.lineItemNo, + this.reportDataHtml}); + + MedicalReportModel.fromJson(Map json) { + reportData = json['ReportData']; + setupID = json['SetupID']; + projectID = json['ProjectID']; + patientID = json['PatientID']; + invoiceNo = json['InvoiceNo']; + status = json['Status']; + verifiedOn = json['VerifiedOn']; + verifiedBy = json['VerifiedBy']; + editedOn = json['EditedOn']; + editedBy = json['EditedBy']; + lineItemNo = json['LineItemNo']; + reportDataHtml = json['ReportDataHtml']; + } + + Map toJson() { + final Map data = new Map(); + data['ReportData'] = this.reportData; + data['SetupID'] = this.setupID; + data['ProjectID'] = this.projectID; + data['PatientID'] = this.patientID; + data['InvoiceNo'] = this.invoiceNo; + data['Status'] = this.status; + data['VerifiedOn'] = this.verifiedOn; + data['VerifiedBy'] = this.verifiedBy; + data['EditedOn'] = this.editedOn; + data['EditedBy'] = this.editedBy; + data['LineItemNo'] = this.lineItemNo; + data['ReportDataHtml'] = this.reportDataHtml; + return data; + } +} diff --git a/lib/root_page.dart b/lib/root_page.dart index 3bd24a81..35a3fa44 100644 --- a/lib/root_page.dart +++ b/lib/root_page.dart @@ -1,27 +1,31 @@ -import 'package:doctor_app_flutter/core/viewModel/auth_view_model.dart'; +import 'package:doctor_app_flutter/locator.dart'; import 'package:doctor_app_flutter/screens/auth/login_screen.dart'; +import 'package:doctor_app_flutter/screens/auth/verification_methods_screen.dart'; +import 'package:doctor_app_flutter/widgets/shared/app_loader_widget.dart'; import 'package:doctor_app_flutter/widgets/shared/dr_app_circular_progress_Indeicator.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:provider/provider.dart'; +import 'core/viewModel/authentication_view_model.dart'; import 'landing_page.dart'; class RootPage extends StatelessWidget { @override Widget build(BuildContext context) { - AuthViewModel authProvider = Provider.of(context); + AuthenticationViewModel authenticationViewModel = Provider.of(context); Widget buildRoot() { - switch (authProvider.stutas) { + switch (authenticationViewModel.status) { case APP_STATUS.LOADING: return Scaffold( - body: Center( - child: DrAppCircularProgressIndeicator(), - ), + body: AppLoaderWidget(), ); break; + case APP_STATUS.UNVERIFIED: + return VerificationMethodsScreen(password: null,); + break; case APP_STATUS.UNAUTHENTICATED: - return Loginsreen(); + return LoginScreen(); break; case APP_STATUS.AUTHENTICATED: return LandingPage(); diff --git a/lib/routes.dart b/lib/routes.dart index 2684cd82..33aa5636 100644 --- a/lib/routes.dart +++ b/lib/routes.dart @@ -5,6 +5,9 @@ import 'package:doctor_app_flutter/screens/patients/insurance_approval_screen_pa import 'package:doctor_app_flutter/screens/patients/profile/UCAF/UCAF-detail-screen.dart'; import 'package:doctor_app_flutter/screens/patients/profile/UCAF/UCAF-input-screen.dart'; import 'package:doctor_app_flutter/screens/patients/profile/lab_result/labs_home_page.dart'; +import 'package:doctor_app_flutter/screens/patients/profile/medical_report/AddVerifyMedicalReport.dart'; +import 'package:doctor_app_flutter/screens/patients/profile/medical_report/MedicalReportDetailPage.dart'; +import 'package:doctor_app_flutter/screens/patients/profile/medical_report/MedicalReportPage.dart'; import 'package:doctor_app_flutter/screens/patients/profile/note/progress_note_screen.dart'; import 'package:doctor_app_flutter/screens/patients/profile/prescriptions/in_patient_prescription_details_screen.dart'; import 'package:doctor_app_flutter/screens/patients/profile/radiology/radiology_home_page.dart'; @@ -14,9 +17,9 @@ import 'package:doctor_app_flutter/screens/prescription/prescriptions_page.dart' import 'package:doctor_app_flutter/screens/procedures/procedure_screen.dart'; import 'package:doctor_app_flutter/screens/sick-leave/add-sickleave.dart'; import 'package:doctor_app_flutter/screens/sick-leave/show-sickleave.dart'; +import 'package:doctor_app_flutter/screens/auth/verification_methods_screen.dart'; import './screens/auth/login_screen.dart'; -import './screens/auth/verification_methods_screen.dart'; import 'screens/patients/profile/profile_screen/patient_profile_screen.dart'; import './screens/patients/profile/vital_sign/vital_sign_details_screen.dart'; import 'landing_page.dart'; @@ -51,6 +54,9 @@ const String UPDATE_EPISODE = 'patients/update-episode'; const String PATIENT_ADMISSION_REQUEST = 'patients/admission-request'; const String PATIENT_ADMISSION_REQUEST_2 = 'patients/admission-request-second'; const String PATIENT_ADMISSION_REQUEST_3 = 'patients/admission-request-third'; +const String PATIENT_MEDICAL_REPORT = 'patients/medical-report'; +const String PATIENT_MEDICAL_REPORT_INSERT = 'patients/medical-report-insert'; +const String PATIENT_MEDICAL_REPORT_DETAIL = 'patients/medical-report-detail'; const String PATIENT_UCAF_REQUEST = 'patients/ucaf'; const String PATIENT_UCAF_DETAIL = 'patients/ucaf/detail'; const String PATIENT_ECG = 'patients/ecg'; @@ -64,7 +70,7 @@ const String RADIOLOGY_PATIENT = 'radiology-patient'; var routes = { ROOT: (_) => RootPage(), HOME: (_) => LandingPage(), - LOGIN: (_) => Loginsreen(), + LOGIN: (_) => LoginScreen(), VERIFICATION_METHODS: (_) => VerificationMethodsScreen(), PATIENTS_PROFILE: (_) => PatientProfileScreen(), LAB_RESULT: (_) => LabsHomePage(), @@ -79,6 +85,9 @@ var routes = { PATIENT_ADMISSION_REQUEST: (_) => AdmissionRequestFirstScreen(), PATIENT_ADMISSION_REQUEST_2: (_) => AdmissionRequestSecondScreen(), PATIENT_ADMISSION_REQUEST_3: (_) => AdmissionRequestThirdScreen(), + PATIENT_MEDICAL_REPORT: (_) => MedicalReportPage(), + PATIENT_MEDICAL_REPORT_INSERT: (_) => AddVerifyMedicalReport(), + PATIENT_MEDICAL_REPORT_DETAIL: (_) => MedicalReportDetailPage(), CREATE_EPISODE: (_) => UpdateSoapIndex( isUpdate: true, ), diff --git a/lib/screens/auth/change_password_screen.dart b/lib/screens/auth/change_password_screen.dart deleted file mode 100644 index 1a502b68..00000000 --- a/lib/screens/auth/change_password_screen.dart +++ /dev/null @@ -1,29 +0,0 @@ -import 'package:doctor_app_flutter/lookups/auth_lookup.dart'; -import 'package:doctor_app_flutter/widgets/auth/auth_header.dart'; -import 'package:doctor_app_flutter/widgets/shared/app_scaffold_widget.dart'; -import 'package:flutter/material.dart'; - -import '../../widgets/auth/change_password.dart'; - -class ChangePasswordScreen extends StatelessWidget { - @override - Widget build(BuildContext context) { - - return AppScaffold( - isShowAppBar: false, - body: SafeArea( - child: ListView(children: [ - Container( - margin: EdgeInsetsDirectional.fromSTEB(30, 0, 0, 0), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - AuthHeader(loginType.changePassword), - ChangePassword(), - ], - ), - ), - ]), - )); - } -} diff --git a/lib/screens/auth/login_screen.dart b/lib/screens/auth/login_screen.dart index 77d35bfd..9563b29c 100644 --- a/lib/screens/auth/login_screen.dart +++ b/lib/screens/auth/login_screen.dart @@ -1,132 +1,300 @@ -import 'dart:async'; -import 'dart:io'; - -import 'package:doctor_app_flutter/config/config.dart'; -import 'package:doctor_app_flutter/config/shared_pref_kay.dart'; -import 'package:doctor_app_flutter/core/service/home/auth_service.dart'; -import 'package:doctor_app_flutter/core/viewModel/imei_view_model.dart'; -import 'package:doctor_app_flutter/core/viewModel/project_view_model.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/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/screens/base/base_view.dart'; -import 'package:doctor_app_flutter/widgets/shared/app_loader_widget.dart'; -import 'package:firebase_messaging/firebase_messaging.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 'package:shared_preferences/shared_preferences.dart'; -import '../../lookups/auth_lookup.dart'; -import '../../util/dr_app_shared_pref.dart'; -import '../../widgets/auth/auth_header.dart'; -import '../../widgets/auth/login_form.dart'; import '../../widgets/shared/app_scaffold_widget.dart'; -DrAppSharedPreferances sharedPref = new DrAppSharedPreferances(); -class Loginsreen extends StatefulWidget { +class LoginScreen extends StatefulWidget { @override - _LoginsreenState createState() => _LoginsreenState(); + _LoginScreenState createState() => _LoginScreenState(); } -class _LoginsreenState extends State { - Future _prefs = SharedPreferences.getInstance(); - +class _LoginScreenState extends State { String platformImei; - // Future platformImeiFuture; - final FirebaseMessaging _firebaseMessaging = FirebaseMessaging(); - bool _isLoading = true; - ProjectViewModel projectViewModel; - AuthService authService = AuthService(); + bool allowCallApi = true; + + //TODO change AppTextFormField to AppTextFormFieldCustom + final loginFormKey = GlobalKey(); + var projectIdController = TextEditingController(); + var userIdController = TextEditingController(); + var passwordController = TextEditingController(); + List projectsList = []; + FocusNode focusPass = FocusNode(); + FocusNode focusProject = FocusNode(); + AuthenticationViewModel authenticationViewModel; + @override - void initState() { - super.initState(); + Widget build(BuildContext context) { + authenticationViewModel = Provider.of(context); + return AppScaffold( + isShowAppBar: false, + backgroundColor: HexColor('#F8F8F8'), + body: SafeArea( + child: ListView(children: [ + 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( - _firebaseMessaging.setAutoInitEnabled(true); - if (Platform.isIOS) { - _firebaseMessaging.requestNotificationPermissions(); - } + 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() + ]), + ), + ], + ), + ) + ], + ) + ])) + ]), + ), + bottomSheet: Container( + + height: 90, + width: double.infinity, + child: Center( + child: FractionallySizedBox( + widthFactor: 0.9, + child: Column( + mainAxisAlignment: MainAxisAlignment.end, + children: [ + AppButton( + title: TranslationBase + .of(context) + .login, + color: Color(0xFFD02127), + fontWeight: FontWeight.w700, + disabled: authenticationViewModel.userInfo + .userID == null || + authenticationViewModel.userInfo + .password == + null, + onPressed: () { + login(context); + }, + ), + + SizedBox(height: 25,) + ], + ), + ), + ),), + ); + } + + SizedBox buildSizedBox() { + return SizedBox( + height: 20, + ); + } - _firebaseMessaging.getToken().then((String token) async { - if (DEVICE_TOKEN == "" && projectViewModel.isLogin == false) { - DEVICE_TOKEN = token; - changeLoadingStata(true); - authService.selectDeviceImei(DEVICE_TOKEN).then((value) { - print(authService.dashboardItemsList); - - if (authService.dashboardItemsList.length > 0) { - sharedPref.setObj( - LAST_LOGIN_USER, authService.dashboardItemsList[0]); - Navigator.of(context).pushReplacement(MaterialPageRoute( - builder: (BuildContext context) => VerificationMethodsScreen( - password: null, - ))); - } else { - changeLoadingStata(false); - } - //changeLoadingStata(false); - }); + login(context,) async { + if (loginFormKey.currentState.validate()) { + loginFormKey.currentState.save(); + GifLoaderDialogUtils.showMyDialog(context); + await authenticationViewModel.login(authenticationViewModel.userInfo); + if (authenticationViewModel.state == ViewState.ErrorLocal) { + GifLoaderDialogUtils.hideDialog(context); + Helpers.showErrorToast(authenticationViewModel.error); } else { - changeLoadingStata(false); + GifLoaderDialogUtils.hideDialog(context); + authenticationViewModel.setUnverified(true,isFromLogin: true); + // Navigator.of(context).pushReplacement( + // MaterialPageRoute( + // builder: (BuildContext context) => + // VerificationMethodsScreen( + // password: authenticationViewModel.userInfo.password, + // isFromLogin: true, + // ), + // ), + // ); } - - // else if (projectViewModel.isLogin) { - // getNotificationCount(token); - // } - }).catchError((err) { - print(err); - }); + } } -/* - *@author: Elham Rababah - *@Date:19/4/2020 - *@param: isLoading - *@return: - *@desc: Change Isloading attribute in order to show or hide loader - */ - void changeLoadingStata(isLoading) { + onSelectProject(index) { setState(() { - _isLoading = isLoading; + authenticationViewModel.userInfo.projectID = projectsList[index].facilityId; + projectIdController.text = projectsList[index].facilityName; }); - } - @override - Widget build(BuildContext context) { - projectViewModel = Provider.of(context); - - return BaseView( - onModelReady: (model) => {}, - builder: (_, model, w) => AppScaffold( - baseViewModel: model, - isShowAppBar: false, - backgroundColor: HexColor('#F8F8F8'), - body: SafeArea( - child: (_isLoading == false) - ? ListView(children: [ - Container( - margin: - EdgeInsetsDirectional.fromSTEB(30, 0, 30, 30), - alignment: Alignment.topLeft, - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Column( - crossAxisAlignment: - CrossAxisAlignment.start, - children: [ - AuthHeader(loginType.knownUser), - SizedBox( - height: 40, - ), - LoginForm( - model: model, - ), - ], - ) - ])) - ]) - : Center(child: AppLoaderWidget()), - ), - )); + primaryFocus.unfocus(); + } + String memberID =""; + getProjects(memberID)async { + if (memberID != null && memberID != '') { + if (this.memberID !=memberID) { + this.memberID = memberID; + await authenticationViewModel.getHospitalsList(memberID); + if(authenticationViewModel.state == ViewState.Idle) { + projectsList = authenticationViewModel.hospitals; + setState(() { + 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 0ad71b76..8257ebf0 100644 --- a/lib/screens/auth/verification_methods_screen.dart +++ b/lib/screens/auth/verification_methods_screen.dart @@ -1,66 +1,574 @@ +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'; +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/util/date-utils.dart'; +import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; +import 'package:doctor_app_flutter/widgets/auth/sms-popup.dart'; +import 'package:doctor_app_flutter/widgets/shared/app_loader_widget.dart'; import 'package:doctor_app_flutter/widgets/shared/app_scaffold_widget.dart'; +import 'package:doctor_app_flutter/widgets/shared/app_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'; -import '../../widgets/auth/verification_methods.dart'; +DrAppSharedPreferances sharedPref = new DrAppSharedPreferances(); +Helpers helpers = Helpers(); -/* - *@author: Elham Rababah - *@Date:4/7/2020 - *@param: - *@return: - *@desc: Verification Methods screen - */ class VerificationMethodsScreen extends StatefulWidget { - const VerificationMethodsScreen({Key key, this.password}) : super(key: key); - @override - _VerificationMethodsScreenState createState() => - _VerificationMethodsScreenState(); final password; + + + VerificationMethodsScreen({this.password, }); + + @override + _VerificationMethodsScreenState createState() => _VerificationMethodsScreenState(); } class _VerificationMethodsScreenState extends State { - bool _isLoading = false; - - /* - *@author: Elham Rababah - *@Date:19/4/2020 - *@param: isLoading - *@return: - *@desc: Change Isloading attribute in order to show or hide loader - */ - void changeLoadingStata(isLoading) { - setState(() { - _isLoading = isLoading; - }); - } + + ProjectViewModel projectsProvider; + bool isMoreOption = false; + bool onlySMSBox = false; + AuthMethodTypes fingerPrintBefore; + AuthMethodTypes selectedOption; + AuthenticationViewModel authenticationViewModel; @override Widget build(BuildContext context) { + projectsProvider = Provider.of(context); + authenticationViewModel = Provider.of(context); + return AppScaffold( - isLoading: _isLoading, - isShowAppBar: false, - isHomeIcon: false, - backgroundColor: HexColor('#F8F8F8'), - body: ListView(children: [ - Container( - margin: EdgeInsetsDirectional.fromSTEB(30, 0, 30, 0), + isShowAppBar: false, + backgroundColor: Theme.of(context).scaffoldBackgroundColor, + // baseViewModel: model, + 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( + children: [ + SizedBox( + height: 20, + ), + authenticationViewModel.user != null && isMoreOption == false + ? Column( + mainAxisAlignment: + MainAxisAlignment.spaceEvenly, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + + AppText( + TranslationBase.of(context).welcomeBack, + fontSize:12, + fontWeight: FontWeight.w700, + color: Color(0xFF2B353E), + ), + AppText( + Helpers.capitalize(authenticationViewModel.user.doctorName), + fontSize: 24, + color: Color(0xFF2B353E), + fontWeight: FontWeight.bold, + ), + SizedBox( + height: 20, + ), + AppText( + TranslationBase.of(context).accountInfo , + fontSize: 16, + color: Color(0xFF2E303A), + fontWeight: FontWeight.w600, + ), + SizedBox( + height: 20, + ), + Container( + padding: EdgeInsets.all(15), + decoration: BoxDecoration( + color: Colors.white, + borderRadius: BorderRadius.all( + Radius.circular(10), + ), + border: Border.all( + color: HexColor('#707070'), + width: 0.1), + ), + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Column( + children: [ + + Text( + TranslationBase.of(context) + .lastLoginAt, + overflow: + TextOverflow.ellipsis, + style: TextStyle( + fontFamily: 'Poppins', + fontSize: 16, + color: Color(0xFF2E303A), + fontWeight: FontWeight.w700,), + + ), + Row( + children: [ + AppText( + TranslationBase + .of(context) + .verifyWith, + fontSize: 14, + color: Color(0xFF575757), + fontWeight: FontWeight.w600, + ), + AppText( + authenticationViewModel.getType( + authenticationViewModel.user + .logInTypeID, + context), + fontSize: 14, + color: Color(0xFF2B353E), + + fontWeight: FontWeight.w700, + ), + ], + ) + ], + crossAxisAlignment: CrossAxisAlignment.start,), + Column(children: [ + AppText( + authenticationViewModel.user.editedOn != + null + ? AppDateUtils.getDayMonthYearDateFormatted( + AppDateUtils.convertStringToDate( + authenticationViewModel.user + .editedOn)) + : authenticationViewModel.user.createdOn != + null + ? AppDateUtils.getDayMonthYearDateFormatted( + AppDateUtils.convertStringToDate(authenticationViewModel.user + .createdOn)) + : '--', + textAlign: + TextAlign.right, + fontSize: 13, + color: Color(0xFF2E303A), + fontWeight: FontWeight.w700, + ), + AppText( + authenticationViewModel.user.editedOn != + null + ? AppDateUtils.getHour( + AppDateUtils.convertStringToDate( + authenticationViewModel.user + .editedOn)) + : authenticationViewModel.user.createdOn != + null + ? AppDateUtils.getHour( + AppDateUtils.convertStringToDate(authenticationViewModel.user + .createdOn)) + : '--', + textAlign: + TextAlign.right, + fontSize: 14, + fontWeight: FontWeight.w600, + color: Color(0xFF575757), + ) + ], + crossAxisAlignment: CrossAxisAlignment.start, + + ) + ], + ), + ), + SizedBox( + height: 20, + ), + Row( + children: [ + AppText( + "Please Verify", + fontSize: 16, + color: Color(0xFF2B353E), + + fontWeight: FontWeight.w700, + ), + ], + ) + ], + ) + : Column( + mainAxisAlignment: + MainAxisAlignment.spaceEvenly, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + this.onlySMSBox == false + ? Container( + margin: EdgeInsets.only(bottom: 20, top: 30), + child: AppText( + TranslationBase.of(context) + .verifyLoginWith, + fontSize: 18, + color: Color(0xFF2E303A), + fontWeight: FontWeight.bold, + textAlign: TextAlign.left, + ), + ) + : AppText( + TranslationBase.of(context) + .verifyFingerprint2, + fontSize: + SizeConfig.textMultiplier * 2.5, + textAlign: TextAlign.start, + ), + ]), + authenticationViewModel.user != null && isMoreOption == false + ? Column( + mainAxisAlignment: MainAxisAlignment.start, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Row( + mainAxisAlignment: + MainAxisAlignment.center, + children: [ + Expanded( + child: InkWell( + onTap: () => + { + // TODO check this logic it seem it will create bug to us + authenticateUser( + AuthMethodTypes + .Fingerprint, true) + }, + child: VerificationMethodsList( + authenticationViewModel:authenticationViewModel, + authMethodType: SelectedAuthMethodTypesService + .getMethodsTypeService( + authenticationViewModel.user + .logInTypeID), + authenticateUser: + (AuthMethodTypes + authMethodType, + isActive) => + authenticateUser( + authMethodType, + isActive), + )), + ), + Expanded( + child: VerificationMethodsList( + authenticationViewModel:authenticationViewModel, + authMethodType: + AuthMethodTypes.MoreOptions, + onShowMore: () { + setState(() { + isMoreOption = true; + }); + }, + )) + ]), + ]) + : Column( + mainAxisAlignment: MainAxisAlignment.start, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + onlySMSBox == false + ? Row( + mainAxisAlignment: + MainAxisAlignment.center, + children: [ + Expanded( + child: 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, + width: double.infinity, + child: Center( + child: FractionallySizedBox( + widthFactor: 0.9, child: Column( - crossAxisAlignment: CrossAxisAlignment.start, + mainAxisAlignment: MainAxisAlignment.end, children: [ - // AuthHeader(loginType.verificationMethods), - SizedBox( - height: 50, - ), - VerificationMethods( - password: widget.password, - changeLoadingStata: changeLoadingStata, + SecondaryButton( + label: TranslationBase + .of(context) + .useAnotherAccount, + color: Color(0xFFD02127), + //fontWeight: FontWeight.w700, + onTap: () { + authenticationViewModel.deleteUser(); + authenticationViewModel.setAppStatus(APP_STATUS.UNAUTHENTICATED); + // Navigator.pushAndRemoveUntil( + // AppGlobal.CONTEX, + // FadePage( + // page: RootPage(), + // ), + // (r) => false); + // Navigator.of(context).pushNamed(LOGIN); + }, ), + + SizedBox(height: 25,) ], ), ), - ])); + ),), + ); } + + sendActivationCodeByOtpNotificationType( + AuthMethodTypes authMethodType) async { + if (authMethodType == AuthMethodTypes.SMS || + authMethodType == AuthMethodTypes.WhatsApp) { + GifLoaderDialogUtils.showMyDialog(context); + + + await authenticationViewModel.sendActivationCodeForDoctorApp(authMethodType:authMethodType, password: authenticationViewModel.userInfo.password ); + if (authenticationViewModel.state == ViewState.ErrorLocal) { + Helpers.showErrorToast(authenticationViewModel.error); + GifLoaderDialogUtils.hideDialog(context); + } else { + authenticationViewModel.setDataAfterSendActivationSuccess(authenticationViewModel.activationCodeForDoctorAppRes); + sharedPref.setString(PASSWORD, authenticationViewModel.userInfo.password); + GifLoaderDialogUtils.hideDialog(context); + this.startSMSService(authMethodType); + } + } else { + // TODO route to this page with parameters to inicate we should present 2 option + if (Platform.isAndroid && authMethodType == AuthMethodTypes.Fingerprint) { + Helpers.showErrorToast('Your device not support this feature'); + } else {} + } + } + + sendActivationCodeVerificationScreen(AuthMethodTypes authMethodType) async { + GifLoaderDialogUtils.showMyDialog(context); + await authenticationViewModel + .sendActivationCodeVerificationScreen(authMethodType); + + if (authenticationViewModel.state == ViewState.ErrorLocal) { + GifLoaderDialogUtils.hideDialog(context); + Helpers.showErrorToast(authenticationViewModel.error); + } else { + authenticationViewModel.setDataAfterSendActivationSuccess(authenticationViewModel.activationCodeVerificationScreenRes); + if (authMethodType == AuthMethodTypes.SMS || + authMethodType == AuthMethodTypes.WhatsApp) { + GifLoaderDialogUtils.hideDialog(context); + this.startSMSService(authMethodType); + } else { + checkActivationCode(); + } + } + } + + authenticateUser(AuthMethodTypes authMethodType, isActive) { + if (authMethodType == AuthMethodTypes.Fingerprint || + authMethodType == AuthMethodTypes.FaceID) { + fingerPrintBefore = authMethodType; + } + this.selectedOption = + fingerPrintBefore != null ? fingerPrintBefore : authMethodType; + + switch (authMethodType) { + case AuthMethodTypes.SMS: + sendActivationCode(authMethodType); + break; + case AuthMethodTypes.WhatsApp: + sendActivationCode(authMethodType); + break; + case AuthMethodTypes.Fingerprint: + this.loginWithFingerPrintOrFaceID( + AuthMethodTypes.Fingerprint, isActive); + break; + case AuthMethodTypes.FaceID: + this.loginWithFingerPrintOrFaceID(AuthMethodTypes.FaceID, isActive); + break; + default: + break; + } + sharedPref.setInt(OTP_TYPE, selectedOption.getTypeIdService()); + } + + sendActivationCode(AuthMethodTypes authMethodType) async { + if (authenticationViewModel.user != null) { + sendActivationCodeVerificationScreen(authMethodType); + } else { + sendActivationCodeByOtpNotificationType(authMethodType); + } + } + + startSMSService(AuthMethodTypes type) { + new SMSOTP( + context, + type, + authenticationViewModel.loggedUser != null ? authenticationViewModel.loggedUser.mobileNumber : authenticationViewModel.user.mobile, + (value) { + showDialog( + context: context, + builder: (BuildContext context) { + return AppLoaderWidget(); + }); + + this.checkActivationCode(value: value); + }, + () => + { + print('Faild..'), + }, + ).displayDialog(context); + } + loginWithFingerPrintOrFaceID(AuthMethodTypes authMethodTypes, + isActive) async { + if (isActive) { + await authenticationViewModel.showIOSAuthMessages(); + if (!mounted) return; + if (authenticationViewModel.user != null && + (SelectedAuthMethodTypesService.getMethodsTypeService( + authenticationViewModel.user.logInTypeID) == + AuthMethodTypes.Fingerprint || + SelectedAuthMethodTypesService.getMethodsTypeService( + authenticationViewModel.user.logInTypeID) == AuthMethodTypes.FaceID)) { + this.sendActivationCode(authMethodTypes); + } else { + setState(() { + this.onlySMSBox = true; + }); + } + } + } + + checkActivationCode({value}) async { + await authenticationViewModel.checkActivationCodeForDoctorApp(activationCode: value); + if (authenticationViewModel.state == ViewState.ErrorLocal) { + Navigator.pop(context); + Helpers.showErrorToast(authenticationViewModel.error); + } else { + await authenticationViewModel.onCheckActivationCodeSuccess(); + navigateToLandingPage(); + } + } + + navigateToLandingPage() { + if (authenticationViewModel.state == ViewState.ErrorLocal) { + Helpers.showErrorToast(authenticationViewModel.error); + } else { + Navigator.pushAndRemoveUntil( + context, + FadePage( + page: LandingPage(), + ), (r) => false); + } + } + + + } diff --git a/lib/screens/home/dashboard_slider-item-widget.dart b/lib/screens/home/dashboard_slider-item-widget.dart new file mode 100644 index 00000000..4b7c4f46 --- /dev/null +++ b/lib/screens/home/dashboard_slider-item-widget.dart @@ -0,0 +1,37 @@ +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:flutter/material.dart'; + +class DashboardSliderItemWidget extends StatelessWidget { + final DashboardModel item; + + DashboardSliderItemWidget(this.item); + + @override + Widget build(BuildContext context) { + return Column( + children: [ + Row( + mainAxisAlignment: MainAxisAlignment.start, + children: [ + AppText( + item.kPIName, + fontSize: SizeConfig.textMultiplier * 2.2, + fontWeight: FontWeight.bold, + ), + ], + ), + new Container( + height: 110, + child: ListView( + scrollDirection: Axis.horizontal, + children: + List.generate(item.summaryoptions.length, (int index) { + return GetActivityButton(item.summaryoptions[index]); + }))) + ], + ); + } +} diff --git a/lib/screens/home/dashboard_swipe_widget.dart b/lib/screens/home/dashboard_swipe_widget.dart new file mode 100644 index 00000000..de5cc05f --- /dev/null +++ b/lib/screens/home/dashboard_swipe_widget.dart @@ -0,0 +1,261 @@ +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; + +class DashboardSwipeWidget extends StatefulWidget { + final List dashboardItemList; + final DashboardViewModel model; + final Function(int) sliderChange; + + DashboardSwipeWidget(this.dashboardItemList, this.model, this.sliderChange); + + @override + _DashboardSwipeWidgetState createState() => _DashboardSwipeWidgetState(); +} + +class _DashboardSwipeWidgetState extends State { + int sliderActiveIndex = 0; + + @override + Widget build(BuildContext context) { + return Container( + height: MediaQuery.of(context).size.height * 0.35, + // height: 230, + child: Swiper( + onIndexChanged: (index) { + if (mounted) { + setState(() { + sliderActiveIndex = index; + widget.sliderChange(index); + }); + } + }, + itemBuilder: (BuildContext context, int index) { + return getSwipeWidget(widget.dashboardItemList, index); + }, + 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), + ], + ), + ), + ), + ), + ) + ], + ); + }), + viewportFraction: 0.9, + // scale: 0.9, + // control: new SwiperControl(), + ), + ); + } + + Widget getSwipeWidget(List dashboardItemList, int index) { + 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]))); + if (index == 0) + 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[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 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 fef7dd5b..503bbe60 100644 --- a/lib/screens/home/home_page_card.dart +++ b/lib/screens/home/home_page_card.dart @@ -26,8 +26,8 @@ class HomePageCard extends StatelessWidget { child: Container( width: 120, height: MediaQuery.of(context).orientation == Orientation.portrait - ? 130 - : 250, + ? 100 + : 200, margin: this.margin, decoration: BoxDecoration( color: !hasBorder @@ -41,16 +41,14 @@ class HomePageCard extends StatelessWidget { : Border.all(width: 0.0, color: Colors.transparent), image: imageName != null ? DecorationImage( - image: AssetImage('assets/images/dashboard/${imageName}'), + image: AssetImage('assets/images/dashboard/$imageName'), fit: BoxFit.cover, colorFilter: new ColorFilter.mode( Colors.black.withOpacity(0.2), BlendMode.dstIn), ) : null, ), - child: Center( - child: child, - ), + child: child, ), ); } diff --git a/lib/screens/home/home_patient_card.dart b/lib/screens/home/home_patient_card.dart new file mode 100644 index 00000000..bdaac7a7 --- /dev/null +++ b/lib/screens/home/home_patient_card.dart @@ -0,0 +1,84 @@ +import 'package:doctor_app_flutter/config/size_config.dart'; +import 'package:doctor_app_flutter/screens/home/home_page_card.dart'; +import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart'; +import 'package:flutter/material.dart'; + +class HomePatientCard extends StatelessWidget { + final Color backgroundColor; + final IconData cardIcon; + final Color backgroundIconColor; + final String text; + final Color textColor; + final Function onTap; + + HomePatientCard({ + @required this.backgroundColor, + @required this.backgroundIconColor, + @required this.cardIcon, + @required this.text, + @required this.textColor, + @required this.onTap, + }); + + @override + Widget build(BuildContext context) { + return HomePageCard( + color: backgroundColor, + margin: EdgeInsets.all(4), + child: Container( + padding: EdgeInsets.all(8), + child: Column( + mainAxisAlignment: MainAxisAlignment.center, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Expanded( + child: Stack( + children: [ + Positioned( + bottom: 0.1, + right: 0.5, + width: 23.0, + height: 25.0, + child: Icon( + cardIcon, + size: 60, + color: backgroundIconColor, + ), + ), + Container( + child: Column( + mainAxisAlignment: MainAxisAlignment.end, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Icon( + cardIcon, + size: 30, + color: textColor, + ), + SizedBox( + height: 4, + ), + ], + ), + ), + ], + ), + ), + Expanded( + child: Container( + child: AppText( + text, + color: textColor, + textAlign: TextAlign.start, + fontSize: SizeConfig.textMultiplier * 1.6, + ), + ), + ), + ], + ), + ), + hasBorder: false, + onTap: onTap, + ); + } +} diff --git a/lib/screens/home/home_screen.dart b/lib/screens/home/home_screen.dart index 99eeef91..7ba6ea0a 100644 --- a/lib/screens/home/home_screen.dart +++ b/lib/screens/home/home_screen.dart @@ -1,55 +1,40 @@ -import 'package:charts_flutter/flutter.dart' as charts; import 'package:doctor_app_flutter/config/config.dart'; -import 'package:doctor_app_flutter/config/shared_pref_kay.dart'; -import 'package:doctor_app_flutter/config/size_config.dart'; -import 'package:doctor_app_flutter/core/enum/patient_type.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/auth_view_model.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/hospital_view_model.dart'; import 'package:doctor_app_flutter/core/viewModel/project_view_model.dart'; import 'package:doctor_app_flutter/icons_app/doctor_app_icons.dart'; import 'package:doctor_app_flutter/models/dashboard/dashboard_model.dart'; +import 'package:doctor_app_flutter/models/doctor/clinic_model.dart'; import 'package:doctor_app_flutter/models/doctor/doctor_profile_model.dart'; -import 'package:doctor_app_flutter/models/doctor/profile_req_Model.dart'; import 'package:doctor_app_flutter/models/patient/patient_model.dart'; import 'package:doctor_app_flutter/screens/base/base_view.dart'; +import 'package:doctor_app_flutter/screens/home/dashboard_slider-item-widget.dart'; +import 'package:doctor_app_flutter/screens/home/dashboard_swipe_widget.dart'; +import 'package:doctor_app_flutter/screens/home/home_patient_card.dart'; import 'package:doctor_app_flutter/screens/medicine/medicine_search_screen.dart'; -import 'package:doctor_app_flutter/screens/patients/DischargedPatientPage.dart'; import 'package:doctor_app_flutter/screens/patients/PatientsInPatientScreen.dart'; -import 'package:doctor_app_flutter/screens/patients/ReferralDischargedPatientPage.dart'; import 'package:doctor_app_flutter/screens/patients/out_patient/out_patient_screen.dart'; import 'package:doctor_app_flutter/screens/patients/patient_search/patient_search_screen.dart'; -import 'package:doctor_app_flutter/screens/patients/patient_search/patient_search_result_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_shared_pref.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/dashboard/activity_button.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/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:firebase_messaging/firebase_messaging.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; -import 'package:flutter_swiper/flutter_swiper.dart'; import 'package:provider/provider.dart'; import 'package:sticky_headers/sticky_headers/widget.dart'; import '../../widgets/shared/app_texts_widget.dart'; -import '../../widgets/shared/rounded_container_widget.dart'; import 'home_page_card.dart'; -DrAppSharedPreferances sharedPref = new DrAppSharedPreferances(); -Helpers helpers = Helpers(); - class HomeScreen extends StatefulWidget { HomeScreen({Key key, this.title}) : super(key: key); @@ -61,65 +46,33 @@ class HomeScreen extends StatefulWidget { } class _HomeScreenState extends State { - final FirebaseMessaging _firebaseMessaging = FirebaseMessaging(); - HospitalViewModel hospitalProvider; - AuthViewModel authProvider; bool isLoading = false; ProjectViewModel projectsProvider; var _isInit = true; DoctorProfileModel profile; bool isExpanded = false; bool isInpatient = false; - var clinicName = []; int sliderActiveIndex = 0; var clinicId; - var _patientSearchFormValues; - - void didChangeDependencies() async { - super.didChangeDependencies(); - if (_isInit) { - projectsProvider = Provider.of(context); - projectsProvider.getDoctorClinicsList(); - - // _firebaseMessaging.setAutoInitEnabled(true); - _firebaseMessaging.requestNotificationPermissions( - const IosNotificationSettings( - sound: true, badge: true, alert: true, provisional: true)); - _firebaseMessaging.onIosSettingsRegistered - .listen((IosNotificationSettings settings) { - print("Settings registered: $settings"); - }); - clinicName = await sharedPref.getObj(CLINIC_NAME); - print(clinicName); - _firebaseMessaging.getToken().then((String token) async { - if (token != '') { - DEVICE_TOKEN = token; - var request = await sharedPref.getObj(DOCTOR_PROFILE); - authProvider.insertDeviceImei(request).then((value) { - // print(value); - changeIsLoading(false); - }); - } - }); - } - _isInit = false; - } + AuthenticationViewModel authenticationViewModel; - BuildContext myContext; @override Widget build(BuildContext context) { - myContext = context; - hospitalProvider = Provider.of(context); - authProvider = Provider.of(context); - projectsProvider = Provider.of(context); - FocusScopeNode currentFocus = FocusScope.of(context); + ProjectViewModel projectsProvider = Provider.of(context); + authenticationViewModel = Provider.of(context); + FocusScopeNode currentFocus = FocusScope.of(context); if (!currentFocus.hasPrimaryFocus) { currentFocus.unfocus(); } return BaseView( - onModelReady: (model) => model.getDashboard(), + onModelReady: (model) async { + await model.setFirebaseNotification( + projectsProvider, authenticationViewModel); + await model.getDashboard(); + await model.getDoctorProfile(isGetProfile: true); + }, builder: (_, model, w) => AppScaffold( baseViewModel: model, isShowAppBar: false, @@ -144,7 +97,6 @@ class _HomeScreenState extends State { children: [ Container( width: MediaQuery.of(context).size.width * .6, - // // height: 100, child: projectsProvider.doctorClinicsList.length > 0 ? Stack( @@ -170,36 +122,49 @@ class _HomeScreenState extends State { mainAxisAlignment: MainAxisAlignment.end, 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: new Text( - projectsProvider - .doctorClinicsList - .length - .toString(), - style: new TextStyle( - color: Colors.white, - fontSize: - projectsProvider - .isArabic - ? 10 - : 11, - ), - textAlign: - TextAlign.center, - ), + 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, @@ -211,10 +176,19 @@ class _HomeScreenState extends State { ); }).toList(); }, - onChanged: (newValue) { + onChanged: (newValue) async { clinicId = newValue; - changeClinic( - newValue, context, model); + GifLoaderDialogUtils.showMyDialog( + context); + await model.changeClinic(newValue, + authenticationViewModel); + GifLoaderDialogUtils.hideDialog( + context); + if (model.state == + ViewState.ErrorLocal) { + DrAppToastMsg.showErrorToast( + model.error); + } }, items: projectsProvider .doctorClinicsList @@ -235,70 +209,24 @@ class _HomeScreenState extends State { ), ], ), - isClilic: true, + isClinic: true, height: 50, ), ]) ])), content: Column( children: [ - Container( - height: MediaQuery.of(context).size.height * 0.35, - child: model.dashboardItemsList.length > 0 - ? new Swiper( - onIndexChanged: (index) { - if (mounted) { - setState(() { - sliderActiveIndex = index; - }); - } - }, - itemBuilder: (BuildContext context, int index) { - return getSwipeWidget(model)[index]; - }, - 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), - ], - ))))) - ]); - }), - viewportFraction: 0.9, - // scale: 0.9, - // control: new SwiperControl(), - ) - : SizedBox()), + model.dashboardItemsList.length > 0 + ? DashboardSwipeWidget( + model.dashboardItemsList, + model, + (sliderIndex) { + setState(() { + sliderActiveIndex = sliderIndex; + }); + }, + ) + : SizedBox(), model.dashboardItemsList.length > 0 ? FractionallySizedBox( widthFactor: 0.90, @@ -310,111 +238,13 @@ class _HomeScreenState extends State { height: 10, ), sliderActiveIndex == 1 - ? Column( - children: [ - Row( - mainAxisAlignment: - MainAxisAlignment.start, - children: [ - AppText( - model.dashboardItemsList[3] - .kPIName, - fontSize: - SizeConfig.textMultiplier * - 2.2, - fontWeight: FontWeight.bold, - ), - ], - ), - new Container( - height: 130, - child: new ListView( - scrollDirection: - Axis.horizontal, - children: new List.generate( - model - .dashboardItemsList[3] - .summaryoptions - .length, (int index) { - return GetActivityButton(model - .dashboardItemsList[3] - .summaryoptions[index]); - }))) - ], - ) + ? DashboardSliderItemWidget( + model.dashboardItemsList[3]) : sliderActiveIndex == 0 - ? Column( - children: [ - Row( - mainAxisAlignment: - MainAxisAlignment.start, - children: [ - AppText( - model.dashboardItemsList[6] - .kPIName, - fontSize: SizeConfig - .textMultiplier * - 2.2, - fontWeight: FontWeight.bold, - ), - ], - ), - new Container( - height: 130, - child: new ListView( - scrollDirection: Axis - .horizontal, - children: new List - .generate( - model - .dashboardItemsList[ - 6] - .summaryoptions - .length, - (int index) { - return GetActivityButton(model - .dashboardItemsList[ - 6] - .summaryoptions[index]); - }))) - ], - ) - : Column( - children: [ - Row( - mainAxisAlignment: - MainAxisAlignment.start, - children: [ - AppText( - model.dashboardItemsList[4] - .kPIName, - fontSize: SizeConfig - .textMultiplier * - 2.2, - fontWeight: FontWeight.bold, - ), - ], - ), - new Container( - height: 130, - child: new ListView( - scrollDirection: Axis - .horizontal, - children: new List - .generate( - model - .dashboardItemsList[ - 4] - .summaryoptions - .length, - (int index) { - return GetActivityButton(model - .dashboardItemsList[ - 4] - .summaryoptions[index]); - }))) - ], - ), + ? DashboardSliderItemWidget( + model.dashboardItemsList[6]) + : DashboardSliderItemWidget( + model.dashboardItemsList[4]), ]))) : SizedBox(), FractionallySizedBox( @@ -429,91 +259,44 @@ class _HomeScreenState extends State { margin: EdgeInsets.only(top: 10), child: Column( mainAxisAlignment: MainAxisAlignment.start, + crossAxisAlignment: CrossAxisAlignment.start, children: [ SizedBox( height: 10, ), - Row( - children: [ - Container( - width: 150, - child: Column( - mainAxisAlignment: MainAxisAlignment.center, - crossAxisAlignment: - CrossAxisAlignment.start, - children: [ - Text( - TranslationBase.of(context).patients, - style: TextStyle( - fontSize: 12, - height: .5, - fontWeight: FontWeight.bold, - fontFamily: 'Poppins'), - ), - Text( - TranslationBase.of(context).services, - style: TextStyle( - fontSize: 22, - fontWeight: FontWeight.bold, - fontFamily: 'Poppins'), - ), - ], - )), + 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, ), - new Container( - height: 130, - child: new ListView( + Container( + height: 120, + child: ListView( scrollDirection: Axis.horizontal, children: [ - HomePageCard( - color: Color(0xffD02127), - margin: EdgeInsets.all(5), - child: Column( - mainAxisAlignment: - MainAxisAlignment.center, - crossAxisAlignment: - CrossAxisAlignment.start, - children: [ - Padding( - padding: EdgeInsets.only( - top: 10, left: 10, right: 0), - child: Stack( - children: [ - Positioned( - bottom: 0.1, - right: 0.5, - width: 23.0, - height: 25.0, - child: Icon( - DoctorApp.inpatient, - size: 65, - color: Colors.white12, - ), - ), - Icon( - DoctorApp.inpatient, - size: 32, - color: Colors.white, - ), - ], - )), - Container( - padding: EdgeInsets.all(10), - child: AppText( - "My\n" + - TranslationBase.of(context) - .inPatient, - color: Colors.white, - textAlign: TextAlign.start, - fontSize: 15, - )) - ], - ), - hasBorder: false, + HomePatientCard( + backgroundColor: Color(0xffD02127), + backgroundIconColor: Colors.white12, + cardIcon: DoctorApp.inpatient, + textColor: Colors.white, + text: TranslationBase.of(context) + .myInPatient, onTap: () { Navigator.push( context, @@ -523,51 +306,13 @@ class _HomeScreenState extends State { ); }, ), - HomePageCard( - color: Colors.grey[300], - margin: EdgeInsets.all(5), - child: Column( - mainAxisAlignment: - MainAxisAlignment.center, - crossAxisAlignment: - CrossAxisAlignment.start, - children: [ - Padding( - padding: EdgeInsets.only( - top: 10, left: 10, right: 0), - child: Stack( - children: [ - Positioned( - bottom: 0.1, - right: 0.5, - width: 23.0, - height: 25.0, - child: Icon( - DoctorApp - .arrival_patients, - size: 65, - color: Colors.white38, - ), - ), - Icon( - DoctorApp.arrival_patients, - size: 35, - color: Colors.black, - ), - ], - )), - Container( - padding: EdgeInsets.all(10), - child: AppText( - TranslationBase.of(context) - .myOutPatient, - color: Colors.black, - textAlign: TextAlign.start, - fontSize: 15, - )) - ], - ), - hasBorder: false, + HomePatientCard( + backgroundColor: Colors.grey[300], + backgroundIconColor: Colors.white38, + cardIcon: DoctorApp.arrival_patients, + textColor: Colors.black, + text: TranslationBase.of(context) + .myOutPatient_2lines, onTap: () { String date = AppDateUtils.convertDateToFormat( @@ -585,112 +330,37 @@ class _HomeScreenState extends State { PatientSearchRequestModel( from: date, to: date, - doctorID: authProvider - .doctorProfile - .doctorID)), + doctorID: + authenticationViewModel + .doctorProfile + .doctorID)), )); }, ), - HomePageCard( - color: Color(0xff2B353E), - margin: EdgeInsets.all(5), - child: Column( - mainAxisAlignment: - MainAxisAlignment.center, - crossAxisAlignment: - CrossAxisAlignment.start, - children: [ - Padding( - padding: EdgeInsets.only( - top: 10, left: 10, right: 0), - child: Stack( - children: [ - Positioned( - bottom: 0.1, - right: 0.5, - width: 23.0, - height: 25.0, - child: Icon( - DoctorApp.referral_1, - size: 65, - color: Colors.white10 - .withOpacity(0.1), - ), - ), - Icon( - DoctorApp.referral_1, - size: 35, - color: Colors.white, - ), - ], - )), - Container( - padding: EdgeInsets.all(10), - child: AppText( - TranslationBase.of(context) - .patientsreferral, - color: Colors.white, - textAlign: TextAlign.start, - fontSize: 15, - )) - ], - ), - hasBorder: false, + HomePatientCard( + backgroundColor: Color(0xff2B353E), + backgroundIconColor: Colors.white10, + cardIcon: DoctorApp.referral_1, + textColor: Colors.white, + text: TranslationBase.of(context) + .myPatientsReferral, onTap: () { Navigator.push( context, MaterialPageRoute( builder: (context) => PatientReferralScreen(), - // MyReferredPatient(), ), ); }, ), - HomePageCard( - color: Color(0xffD02127), - margin: EdgeInsets.all(5), - child: Column( - mainAxisAlignment: - MainAxisAlignment.center, - crossAxisAlignment: - CrossAxisAlignment.start, - children: [ - Padding( - padding: EdgeInsets.only( - top: 10, left: 10, right: 0), - child: Stack( - children: [ - Positioned( - bottom: 0.1, - right: 0.5, - width: 23.0, - height: 25.0, - child: Icon( - DoctorApp.search, - size: 65, - color: Colors.white10, - ), - ), - Icon( - DoctorApp.search, - size: 35, - color: Colors.white, - ), - ], - )), - Container( - padding: EdgeInsets.all(10), - child: AppText( - TranslationBase.of(context) - .searchPatient, - color: Colors.white, - textAlign: TextAlign.start, - fontSize: 13, - )) - ], - ), - hasBorder: false, + HomePatientCard( + backgroundColor: Color(0xffD02127), + backgroundIconColor: Colors.white10, + cardIcon: DoctorApp.search, + textColor: Colors.white, + text: TranslationBase.of(context) + .searchPatientDashBoard, onTap: () { Navigator.push( context, @@ -700,51 +370,13 @@ class _HomeScreenState extends State { )); }, ), - HomePageCard( - color: Color(0xffC9C9C9), - margin: EdgeInsets.all(5), - child: Column( - mainAxisAlignment: - MainAxisAlignment.center, - crossAxisAlignment: - CrossAxisAlignment.start, - children: [ - Padding( - padding: EdgeInsets.only( - top: 10, left: 10, right: 0), - child: Stack( - children: [ - Positioned( - bottom: 0.1, - right: 0.5, - width: 23.0, - height: 25.0, - child: Icon( - DoctorApp - .search_medicines, - color: Colors.black12, - size: 65, - ), - ), - Icon( - DoctorApp.search_medicines, - size: 40, - color: Color(0xff2B353E), - ), - ], - )), - Container( - padding: EdgeInsets.all(10), - child: AppText( - TranslationBase.of(context) - .searchMedicine, - color: Color(0xff2B353E), - textAlign: TextAlign.start, - fontSize: 13, - )) - ], - ), - hasBorder: false, + HomePatientCard( + backgroundColor: Color(0xffC9C9C9), + backgroundIconColor: Colors.black12, + cardIcon: DoctorApp.search_medicines, + textColor: Color(0xff2B353E), + text: TranslationBase.of(context) + .searchMedicineDashboard, onTap: () { Navigator.push( context, @@ -753,17 +385,8 @@ class _HomeScreenState extends State { MedicineSearchScreen(), )); }, - ) + ), ])), - Row( - // mainAxisAlignment: MainAxisAlignment.spaceAround, - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - SizedBox( - width: 8, - ), - ], - ), SizedBox( height: 20, ), @@ -779,214 +402,4 @@ class _HomeScreenState extends State { ), ); } - - static List> _createReferralData(model) { - final data = [ - new GaugeSegment( - model.dashboardItemsList[2].summaryoptions[0].kPIParameter, - getValue(model.dashboardItemsList[1].summaryoptions[0].value), - charts.MaterialPalette.black), - new GaugeSegment( - model.dashboardItemsList[2].summaryoptions[1].kPIParameter, - getValue(model.dashboardItemsList[1].summaryoptions[1].value), - charts.MaterialPalette.gray.shadeDefault), - new GaugeSegment( - model.dashboardItemsList[2].summaryoptions[2].kPIParameter, - getValue(model.dashboardItemsList[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; - } - - changeClinic(clinicId, BuildContext context, model) async { - // Navigator.pop(context); - changeIsLoading(true); - Map profile = await sharedPref.getObj(DOCTOR_PROFILE); - DoctorProfileModel doctorProfile = new DoctorProfileModel.fromJson(profile); - ProfileReqModel docInfo = new ProfileReqModel( - doctorID: doctorProfile.doctorID, - clinicID: clinicId, - license: true, - projectID: doctorProfile.projectID, - tokenID: '', - languageID: 2); - authProvider.getDocProfiles(docInfo.toJson()).then((res) async { - changeIsLoading(false); - sharedPref.setObj(DOCTOR_PROFILE, res['DoctorProfileList'][0]); - }).catchError((err) { - changeIsLoading(false); - Helpers.showErrorToast(err); - }); - } - - changeIsLoading(bool val) { - setState(() { - this.isLoading = val; - }); - } - - getPatientCount(DashboardModel inPatientCount) { - int value = 0; - inPatientCount.summaryoptions.forEach((result) => {value += result.value}); - - return value.toString(); - } - - List getSwipeWidget(model) { - return [ - RoundedContainer( - height: MediaQuery.of(context).size.height * 0.35, - margin: EdgeInsets.only(top: 15, bottom: 15, left: 10, right: 10), - child: Padding( - padding: const EdgeInsets.all(5.0), - child: GetOutPatientStack(model.dashboardItemsList[1]))), - RoundedContainer( - height: MediaQuery.of(context).size.height * 0.35, - margin: EdgeInsets.only(top: 15, bottom: 15, left: 10, right: 10), - child: Padding( - padding: const EdgeInsets.all(5.0), - child: GetOutPatientStack(model.dashboardItemsList[0]))), - RoundedContainer( - height: MediaQuery.of(context).size.height * 0.35, - 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: [ - Expanded( - flex: 1, - child: Padding( - padding: EdgeInsets.all(8), - child: Column( - mainAxisAlignment: - MainAxisAlignment.center, - crossAxisAlignment: - CrossAxisAlignment.start, - children: [ - Text( - TranslationBase.of(context) - .patients, - style: TextStyle( - fontSize: 12, - height: .5, - fontWeight: FontWeight.bold, - fontFamily: 'Poppins'), - ), - Text( - TranslationBase.of(context) - .referral, - style: TextStyle( - fontSize: 22, - fontWeight: FontWeight.bold, - fontFamily: 'Poppins'), - ), - ], - ))), - Expanded( - flex: 2, - child: Column( - mainAxisAlignment: MainAxisAlignment.start, - crossAxisAlignment: - CrossAxisAlignment.start, - children: [ - RowCounts( - model.dashboardItemsList[2] - .summaryoptions[0].kPIParameter, - model.dashboardItemsList[2] - .summaryoptions[0].value, - Colors.black), - RowCounts( - model.dashboardItemsList[2] - .summaryoptions[1].kPIParameter, - model.dashboardItemsList[2] - .summaryoptions[1].value, - Colors.grey), - RowCounts( - model.dashboardItemsList[2] - .summaryoptions[2].kPIParameter, - model.dashboardItemsList[2] - .summaryoptions[2].value, - Colors.red), - ], - ), - ) - ], - ))), - Expanded( - flex: 3, - child: Stack(children: [ - Container( - child: GaugeChart(_createReferralData(model))), - Positioned( - child: Column( - crossAxisAlignment: CrossAxisAlignment.center, - children: [ - AppText( - getPatientCount(model.dashboardItemsList[2]) - .toString(), - fontSize: 30, - fontWeight: FontWeight.bold, - ) - ], - ), - top: MediaQuery.of(context).size.height * 0.12, - left: 0, - right: 0) - ]), - ), - ], - )), - ])), - ]; - } - - getRequestHeader(isInpatient) { - _patientSearchFormValues = PatientModel( - FirstName: "0", - MiddleName: "0", - LastName: "0", - PatientMobileNumber: "0", - PatientIdentificationID: "0", - PatientID: 0, - From: isInpatient == true - ? '0' - : AppDateUtils.convertDateToFormat(DateTime.now(), 'yyyy-MM-dd') - .toString(), - To: isInpatient == true - ? '0' - : AppDateUtils.convertDateToFormat(DateTime.now(), 'yyyy-MM-dd') - .toString(), - LanguageID: 2, - stamp: "2020-03-02T13:56:39.170Z", - IPAdress: "11.11.11.11", - VersionID: 1.2, - Channel: 9, - TokenID: "2Fi7HoIHB0eDyekVa6tCJg==", - SessionID: "5G0yXn0Jnq", - IsLoginForDoctorApp: true, - PatientOutSA: false); - } } diff --git a/lib/screens/live_care/end_call_screen.dart b/lib/screens/live_care/end_call_screen.dart new file mode 100644 index 00000000..b4a7c415 --- /dev/null +++ b/lib/screens/live_care/end_call_screen.dart @@ -0,0 +1,186 @@ +import 'package:doctor_app_flutter/icons_app/doctor_app_icons.dart'; +import 'package:doctor_app_flutter/models/patient/patiant_info_model.dart'; +import 'package:doctor_app_flutter/screens/patients/profile/profile_screen/PatientProfileCardModel.dart'; +import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; +import 'package:doctor_app_flutter/widgets/patients/profile/PatientProfileButton.dart'; +import 'package:doctor_app_flutter/widgets/patients/profile/patient-profile-header-new-design-app-bar.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:flutter/material.dart'; +import 'package:flutter_staggered_grid_view/flutter_staggered_grid_view.dart'; +import 'package:hexcolor/hexcolor.dart'; + +import '../../routes.dart'; + +class EndCallScreen extends StatefulWidget { + final PatiantInformtion patient; + + const EndCallScreen({Key key, this.patient}) : super(key: key); + + @override + _EndCallScreenState createState() => _EndCallScreenState(); +} + +class _EndCallScreenState extends State { + bool isInpatient = false; + + bool isDischargedPatient = false; + bool isSearchAndOut = false; + String patientType; + String arrivalType; + String from; + String to; + + @override + Widget build(BuildContext context) { + final List cardsList = [ + PatientProfileCardModel(TranslationBase.of(context).resume, + TranslationBase.of(context).theCall, '', 'patient/vital_signs.png', + isInPatient: isInpatient, onTap: () {}, isDartIcon: true, + dartIcon: DoctorApp.call), + PatientProfileCardModel( + TranslationBase.of(context).endLC, + TranslationBase.of(context).consultation, + '', + 'patient/vital_signs.png', + isInPatient: isInpatient, + onTap: () {}, + isDartIcon: true, + dartIcon: DoctorApp.end_consultaion + ), + PatientProfileCardModel( + TranslationBase.of(context).sendLC, + TranslationBase.of(context).instruction, + "", + 'patient/health_summary.png', + onTap: () {}, + isInPatient: isInpatient, + isDartIcon: true, + dartIcon: DoctorApp.send_instruction + ), + PatientProfileCardModel( + TranslationBase.of(context).transferTo, + TranslationBase.of(context).admin, + '', + 'patient/health_summary.png', + onTap: () {}, + isInPatient: isInpatient, + + isDartIcon: true, + dartIcon: DoctorApp.transfer_to_admin + ), + ]; + + return AppScaffold( + appBarTitle: TranslationBase.of(context).patientProfile, + backgroundColor: Theme.of(context).scaffoldBackgroundColor, + isShowAppBar: true, + appBar: PatientProfileHeaderNewDesignAppBar( + widget.patient, arrivalType ?? '7', '1', + isInpatient: isInpatient, + height: (widget.patient.patientStatusType != null && + widget.patient.patientStatusType == 43) + ? 210 + : isDischargedPatient + ? 240 + : 0, + isDischargedPatient: isDischargedPatient), + body: Container( + height: !isSearchAndOut + ? isDischargedPatient + ? MediaQuery.of(context).size.height * 0.64 + : MediaQuery.of(context).size.height * 0.65 + : MediaQuery.of(context).size.height * 0.69, + child: ListView( + children: [ + Padding( + padding: const EdgeInsets.symmetric( + vertical: 15.0, horizontal: 15), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + AppText( + TranslationBase.of(context).patient, + fontSize: 14, + fontWeight: FontWeight.w500, + ), + AppText(TranslationBase.of(context).endcall, + fontSize: 26, + fontWeight: FontWeight.bold, + ), + SizedBox(height: 10,), + StaggeredGridView.countBuilder( + shrinkWrap: true, + physics: NeverScrollableScrollPhysics(), + crossAxisSpacing: 10, + mainAxisSpacing: 10, + crossAxisCount: 3, + itemCount: cardsList.length, + staggeredTileBuilder: (int index) => StaggeredTile.fit(1), + itemBuilder: (BuildContext context, int index) => + PatientProfileButton( + patient: widget.patient, + patientType: patientType, + arrivalType: arrivalType, + from: from, + to: to, + nameLine1: cardsList[index].nameLine1, + nameLine2: cardsList[index].nameLine2, + route: cardsList[index].route, + icon: cardsList[index].icon, + isInPatient: cardsList[index].isInPatient, + isDischargedPatient: cardsList[index].isDischargedPatient, + isDisable: cardsList[index].isDisable, + onTap: cardsList[index].onTap, + isLoading: cardsList[index].isLoading, + isDartIcon: cardsList[index].isDartIcon, + dartIcon: cardsList[index].dartIcon, + ), + ), + ], + ), + ), + SizedBox( + height: MediaQuery.of(context).size.height * 0.05, + ) + ], + ), + ), + bottomSheet: Container( + decoration: BoxDecoration( + color: Colors.white, + borderRadius: BorderRadius.all( + Radius.circular(0.0), + ), + border: Border.all(color: HexColor('#707070'), width: 0), + ), + height: MediaQuery.of(context).size.height * 0.1, + width: double.infinity, + child: Column( + children: [ + SizedBox( + height: 10, + ), + Container( + child: FractionallySizedBox( + widthFactor: .80, + child: Center( + child: AppButton( + fontWeight: FontWeight.w700, + color: Colors.red[600], + title: "Close", //TranslationBase.of(context).close, + onPressed: () async {}, + ), + ), + ), + ), + SizedBox( + height: 5, + ), + ], + ), + ), + ); + } +} diff --git a/lib/screens/medicine/medicine_search_screen.dart b/lib/screens/medicine/medicine_search_screen.dart index 41ccd59e..eeea51c5 100644 --- a/lib/screens/medicine/medicine_search_screen.dart +++ b/lib/screens/medicine/medicine_search_screen.dart @@ -29,9 +29,9 @@ import '../../util/extenstions.dart'; DrAppSharedPreferances sharedPref = DrAppSharedPreferances(); class MedicineSearchScreen extends StatefulWidget with DrAppToastMsg { - MedicineSearchScreen({this.changeLoadingStata}); + MedicineSearchScreen({this.changeLoadingState}); - final Function changeLoadingStata; + final Function changeLoadingState; @override _MedicineSearchState createState() => _MedicineSearchState(); diff --git a/lib/screens/patients/out_patient/out_patient_screen.dart b/lib/screens/patients/out_patient/out_patient_screen.dart index c8b547b7..30400c65 100644 --- a/lib/screens/patients/out_patient/out_patient_screen.dart +++ b/lib/screens/patients/out_patient/out_patient_screen.dart @@ -6,7 +6,7 @@ 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/auth_view_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/icons_app/doctor_app_icons.dart'; import 'package:doctor_app_flutter/models/patient/patient_model.dart'; @@ -63,9 +63,9 @@ class OutPatientsScreen extends StatefulWidget { class _OutPatientsScreenState extends State { int clinicId; - AuthViewModel authProvider; + AuthenticationViewModel authenticationViewModel; - List _times = []; //['All', 'Today', 'Tomorrow', 'Next Week']; + List _times = []; int _activeLocation = 1; String patientType; @@ -82,7 +82,7 @@ class _OutPatientsScreenState extends State { @override Widget build(BuildContext context) { - authProvider = Provider.of(context); + authenticationViewModel = Provider.of(context); _times = [ TranslationBase.of(context).previous, TranslationBase.of(context).today, diff --git a/lib/screens/patients/patient_search/patient_search_result_screen.dart b/lib/screens/patients/patient_search/patient_search_result_screen.dart index 3395ead8..02bde8d0 100644 --- a/lib/screens/patients/patient_search/patient_search_result_screen.dart +++ b/lib/screens/patients/patient_search/patient_search_result_screen.dart @@ -2,7 +2,7 @@ import 'package:doctor_app_flutter/config/size_config.dart'; import 'package:doctor_app_flutter/core/enum/patient_type.dart'; import 'package:doctor_app_flutter/core/model/patient_muse/PatientSearchRequestModel.dart'; import 'package:doctor_app_flutter/core/viewModel/PatientSearchViewModel.dart'; -import 'package:doctor_app_flutter/core/viewModel/auth_view_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/icons_app/doctor_app_icons.dart'; import 'package:doctor_app_flutter/models/patient/patient_model.dart'; @@ -48,7 +48,7 @@ class PatientsSearchResultScreen extends StatefulWidget { class _PatientsSearchResultScreenState extends State { int clinicId; - AuthViewModel authProvider; + AuthenticationViewModel authenticationViewModel; String patientType; String patientTypeTitle; @@ -62,7 +62,7 @@ class _PatientsSearchResultScreenState @override Widget build(BuildContext context) { - authProvider = Provider.of(context); + authenticationViewModel = Provider.of(context); return BaseView( onModelReady: (model) async { if (!widget.isSearchWithKeyInfo && diff --git a/lib/screens/patients/patient_search/patient_search_screen.dart b/lib/screens/patients/patient_search/patient_search_screen.dart index b6f9cae8..2275cc09 100644 --- a/lib/screens/patients/patient_search/patient_search_screen.dart +++ b/lib/screens/patients/patient_search/patient_search_screen.dart @@ -2,7 +2,7 @@ import 'package:doctor_app_flutter/config/config.dart'; import 'package:doctor_app_flutter/core/enum/patient_type.dart'; import 'package:doctor_app_flutter/core/model/patient_muse/PatientSearchRequestModel.dart'; import 'package:doctor_app_flutter/core/viewModel/PatientSearchViewModel.dart'; -import 'package:doctor_app_flutter/core/viewModel/auth_view_model.dart'; +import 'package:doctor_app_flutter/core/viewModel/authentication_view_model.dart'; import 'package:doctor_app_flutter/screens/base/base_view.dart'; import 'package:doctor_app_flutter/screens/patients/patient_search/patient_search_result_screen.dart'; import 'package:doctor_app_flutter/screens/patients/profile/soap_update/shared_soap_widgets/bottom_sheet_title.dart'; @@ -29,11 +29,11 @@ class _PatientSearchScreenState extends State { TextEditingController middleNameInfoController = TextEditingController(); TextEditingController lastNameFileInfoController = TextEditingController(); PatientType selectedPatientType = PatientType.inPatient; - AuthViewModel authProvider; + AuthenticationViewModel authenticationViewModel; @override Widget build(BuildContext context) { - authProvider = Provider.of(context); + authenticationViewModel = Provider.of(context); return BaseView( onModelReady: (model) async {}, builder: (_, model, w) => AppScaffold( @@ -148,7 +148,7 @@ class _PatientSearchScreenState extends State { }); PatientSearchRequestModel patientSearchRequestModel = PatientSearchRequestModel( - doctorID: authProvider.doctorProfile.doctorID); + doctorID: authenticationViewModel.doctorProfile.doctorID); if (showOther) { patientSearchRequestModel.firstName = firstNameInfoController.text.trim().isEmpty diff --git a/lib/screens/patients/profile/admission-request/admission-request_second-screen.dart b/lib/screens/patients/profile/admission-request/admission-request_second-screen.dart index 8627d224..bea487f7 100644 --- a/lib/screens/patients/profile/admission-request/admission-request_second-screen.dart +++ b/lib/screens/patients/profile/admission-request/admission-request_second-screen.dart @@ -477,7 +477,7 @@ class _AdmissionRequestSecondScreenState Expanded( child: AppButton( title: TranslationBase.of(context).previous, - color: HexColor("#EAEAEA"), + color: Color(0xffEAEAEA), fontColor: Colors.black, onPressed: () { Navigator.pop(context); 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 1c5104f8..e54a3782 100644 --- a/lib/screens/patients/profile/lab_result/laboratory_result_page.dart +++ b/lib/screens/patients/profile/lab_result/laboratory_result_page.dart @@ -52,7 +52,8 @@ class _LaboratoryResultPageState extends State { invoiceNO: widget.patientLabOrders.invoiceNo, ), baseViewModel: model, - body: Scaffold( + body: AppScaffold( + isShowAppBar: false, body: SingleChildScrollView( child: Column( children: [ diff --git a/lib/screens/patients/profile/lab_result/laboratory_result_widget.dart b/lib/screens/patients/profile/lab_result/laboratory_result_widget.dart index 810f025f..bc6fcbcb 100644 --- a/lib/screens/patients/profile/lab_result/laboratory_result_widget.dart +++ b/lib/screens/patients/profile/lab_result/laboratory_result_widget.dart @@ -9,6 +9,7 @@ import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart'; import 'package:doctor_app_flutter/widgets/shared/network_base_view.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; +import 'package:flutter_html/flutter_html.dart'; import 'package:provider/provider.dart'; class LaboratoryResultWidget extends StatefulWidget { @@ -37,6 +38,7 @@ class LaboratoryResultWidget extends StatefulWidget { class _LaboratoryResultWidgetState extends State { bool _isShowMoreGeneral = true; + bool _isShowMore = true; ProjectViewModel projectViewModel; @override @@ -141,9 +143,76 @@ class _LaboratoryResultWidgetState extends State { ], ), ), - SizedBox( - height: 10, + SizedBox(height: 15,), + if(widget.details!=null && widget.details.isNotEmpty) + Column( + children: [ + InkWell( + onTap: () { + setState(() { + _isShowMore = !_isShowMore; + }); + }, + child: Container( + padding: EdgeInsets.all(10.0), + margin: EdgeInsets.only(left: 5, right: 5), + decoration: BoxDecoration( + shape: BoxShape.rectangle, + color: Colors.white, + borderRadius: BorderRadius.all( + Radius.circular(5.0), + )), + child: Row( + children: [ + Expanded( + child: Container( + margin: EdgeInsets.only( + left: 10, right: 10), + child: AppText( + TranslationBase.of(context) + .specialResult, + bold: true, + ))), + Container( + width: 25, + height: 25, + child: Icon( + _isShowMore + ? Icons.keyboard_arrow_up + : Icons.keyboard_arrow_down, + color: Colors.grey[800], + size: 22, + ), + ) + ], + ), + ), + ), + if (_isShowMore) + AnimatedContainer( + padding: EdgeInsets.all(10.0), + margin: EdgeInsets.only(left: 5, right: 5), + decoration: BoxDecoration( + shape: BoxShape.rectangle, + color: Colors.white, + borderRadius: BorderRadius.only( + bottomLeft: Radius.circular(5.0), + bottomRight: Radius.circular(5.0), + )), + duration: Duration(milliseconds: 7000), + child: Container( + width: double.infinity, + child: Html( + data: widget.details ?? TranslationBase.of(context).noDataAvailable, + )), + ), + SizedBox( + height: 10, + ), + ], ), + + ], ), ], diff --git a/lib/screens/patients/profile/lab_result/labs_home_page.dart b/lib/screens/patients/profile/lab_result/labs_home_page.dart index f60e875a..5c65ceb4 100644 --- a/lib/screens/patients/profile/lab_result/labs_home_page.dart +++ b/lib/screens/patients/profile/lab_result/labs_home_page.dart @@ -199,7 +199,7 @@ class _LabsHomePageState extends State { clinic: model .patientLabOrdersList[index].clinicDescription, appointmentDate: - model.patientLabOrdersList[index].orderDate, + model.patientLabOrdersList[index].orderDate.add(Duration(days: 1)), orderNo: model.patientLabOrdersList[index].orderNo, isShowTime: false, ), diff --git a/lib/screens/patients/profile/medical_report/AddVerifyMedicalReport.dart b/lib/screens/patients/profile/medical_report/AddVerifyMedicalReport.dart index 1b33aecb..a350544b 100644 --- a/lib/screens/patients/profile/medical_report/AddVerifyMedicalReport.dart +++ b/lib/screens/patients/profile/medical_report/AddVerifyMedicalReport.dart @@ -1,12 +1,16 @@ import 'package:doctor_app_flutter/config/config.dart'; +import 'package:doctor_app_flutter/core/enum/viewstate.dart'; import 'package:doctor_app_flutter/core/provider/robot_provider.dart'; -import 'package:doctor_app_flutter/core/viewModel/base_view_model.dart'; +import 'package:doctor_app_flutter/core/viewModel/PatientMedicalReportViewModel.dart'; import 'package:doctor_app_flutter/core/viewModel/project_view_model.dart'; import 'package:doctor_app_flutter/icons_app/doctor_app_icons.dart'; +import 'package:doctor_app_flutter/models/patient/patiant_info_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/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/speech-text-popup.dart'; import 'package:doctor_app_flutter/widgets/shared/text_fields/app-textfield-custom.dart'; import 'package:flutter/material.dart'; @@ -14,23 +18,28 @@ import 'package:permission_handler/permission_handler.dart'; import 'package:provider/provider.dart'; import 'package:speech_to_text/speech_recognition_error.dart'; import 'package:speech_to_text/speech_to_text.dart' as stt; +import 'package:doctor_app_flutter/models/patient/MedicalReport/MeidcalReportModel.dart'; class AddVerifyMedicalReport extends StatefulWidget { - final MedicalReportStatus status; - - AddVerifyMedicalReport(this.status); - @override _AddVerifyMedicalReportState createState() => _AddVerifyMedicalReportState(); } class _AddVerifyMedicalReportState extends State { - stt.SpeechToText speech = stt.SpeechToText(); - var reconizedWord; + stt.SpeechToText speechHistoryFinding = stt.SpeechToText(); + stt.SpeechToText speechLaboratoryData = stt.SpeechToText(); + stt.SpeechToText speechRecommendation = stt.SpeechToText(); + var recognizedWord1; + var recognizedWord2; + var recognizedWord3; var event = RobotProvider(); - TextEditingController commentController = TextEditingController(); + TextEditingController historyFindingController = TextEditingController(); + TextEditingController laboratoryDataController = TextEditingController(); + TextEditingController recommendationController = TextEditingController(); String commentsError; + String comments2Error; + String comments3Error; @override void initState() { @@ -38,7 +47,15 @@ class _AddVerifyMedicalReportState extends State { event.controller.stream.listen((p) { if (p['startPopUp'] == 'true') { if (this.mounted) { - initSpeechState().then((value) => {onVoiceText()}); + initSpeechState().then((value) { + onVoiceText(); + }); + initSpeechState2().then((value) { + onVoiceText2(); + }); + initSpeechState3().then((value) { + onVoiceText3(); + }); } } }); @@ -48,79 +65,229 @@ class _AddVerifyMedicalReportState extends State { @override Widget build(BuildContext context) { ProjectViewModel projectViewModel = Provider.of(context); + final routeArgs = ModalRoute.of(context).settings.arguments as Map; + PatiantInformtion patient = routeArgs['patient']; + MedicalReportStatus status = routeArgs['status']; + MedicalReportModel medicalReport = routeArgs.containsKey("medicalReport") + ? routeArgs['medicalReport'] + : null; + + // model.medicalReportTemplate[0].templateTextHtml - return BaseView( + return BaseView( + onModelReady: (model) => model.getMedicalReportTemplate(), builder: (_, model, w) => AppScaffold( baseViewModel: model, isShowAppBar: true, - appBarTitle: widget.status == MedicalReportStatus.ADD + appBarTitle: status == MedicalReportStatus.ADD ? TranslationBase.of(context).medicalReportAdd : TranslationBase.of(context).medicalReportVerify, backgroundColor: Theme.of(context).scaffoldBackgroundColor, body: Column( children: [ Expanded( - child: SingleChildScrollView( - child: Container( - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Stack( - children: [ - AppTextFieldCustom( - hintText: TranslationBase.of(context) - .sickLeaveComments, - controller: commentController, - maxLines: 30, - minLines: 20, - hasBorder: true, - validationError: commentsError, - ), - Positioned( - top: -2, - //MediaQuery.of(context).size.height * 0, - right: projectViewModel.isArabic - ? MediaQuery.of(context).size.width * - 0.75 - : 15, - child: Column( + child: Container( + margin: EdgeInsets.all(16), + child: Column( + children: [ + Expanded( + child: SingleChildScrollView( + child: Container( + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Stack( + children: [ + AppTextFieldCustom( + hintText: TranslationBase.of(context) + .historyPhysicalFinding, + controller: historyFindingController, + maxLines: 15, + minLines: 10, + hasBorder: true, + validationError: commentsError, + ), + Positioned( + top: -2, + //MediaQuery.of(context).size.height * 0, + right: projectViewModel.isArabic + ? MediaQuery.of(context) + .size + .width * + 0.75 + : 15, + child: Column( + children: [ + IconButton( + icon: Icon( + DoctorApp.speechtotext, + color: Colors.black, + size: 35), + onPressed: () { + initSpeechState().then( + (value) => + {onVoiceText()}); + }, + ), + ], + )), + ], + ), + Stack( + children: [ + AppTextFieldCustom( + hintText: TranslationBase.of(context) + .laboratoryPhysicalData, + controller: laboratoryDataController, + maxLines: 15, + minLines: 10, + hasBorder: true, + validationError: comments2Error, + ), + Positioned( + top: -2, + //MediaQuery.of(context).size.height * 0, + right: projectViewModel.isArabic + ? MediaQuery.of(context) + .size + .width * + 0.75 + : 15, + child: Column( + children: [ + IconButton( + icon: Icon( + DoctorApp.speechtotext, + color: Colors.black, + size: 35), + onPressed: () { + initSpeechState2().then( + (value) => + {onVoiceText2()}); + }, + ), + ], + )), + ], + ), + Stack( children: [ - IconButton( - icon: Icon(DoctorApp.speechtotext, - color: Colors.black, size: 35), - onPressed: () { - initSpeechState().then( - (value) => {onVoiceText()}); - }, + AppTextFieldCustom( + hintText: TranslationBase.of(context) + .impressionRecommendation, + controller: recommendationController, + maxLines: 15, + minLines: 10, + hasBorder: true, + validationError: comments3Error, ), + Positioned( + top: -2, + //MediaQuery.of(context).size.height * 0, + right: projectViewModel.isArabic + ? MediaQuery.of(context) + .size + .width * + 0.75 + : 15, + child: Column( + children: [ + IconButton( + icon: Icon( + DoctorApp.speechtotext, + color: Colors.black, + size: 35), + onPressed: () { + initSpeechState3().then( + (value) => + {onVoiceText3()}); + }, + ), + ], + )), ], - )), - ], + ), + ], + ), + ), ), - ], - ), + ), + ], ), ), ), Container( - margin: EdgeInsets.all(16.0), - child: AppButton( - title: widget.status == MedicalReportStatus.ADD - ? TranslationBase.of(context).medicalReportAdd - : TranslationBase.of(context).medicalReportVerify, - color: Color(0xff359846), - // disabled: progressNoteController.text.isEmpty, - fontWeight: FontWeight.w700, - onPressed: () { - setState(() { - if (commentController.text == "") { - commentsError = - TranslationBase.of(context).fieldRequired; - } else { - commentsError = null; - } - }); - }, + padding: EdgeInsets.all(16.0), + color: Colors.white, + child: Row( + children: [ + Expanded( + child: AppButton( + title: status == MedicalReportStatus.ADD + ? TranslationBase.of(context).save + : TranslationBase.of(context).save, + color: Color(0xffEAEAEA), + fontColor: Colors.black, + // disabled: progressNoteController.text.isEmpty, + fontWeight: FontWeight.w700, + onPressed: () async { + setState(() { + if (historyFindingController.text == "") { + commentsError = + TranslationBase.of(context).fieldRequired; + } else { + commentsError = null; + } + if (laboratoryDataController.text == "") { + comments2Error = + TranslationBase.of(context).fieldRequired; + } else { + comments2Error = null; + } + if (recommendationController.text == "") { + comments3Error = + TranslationBase.of(context).fieldRequired; + } else { + comments3Error = null; + } + }); + if (historyFindingController.text != "" && + laboratoryDataController.text != "" && + recommendationController.text != "") { + GifLoaderDialogUtils.showMyDialog(context); + model.insertMedicalReport(patient, + "${historyFindingController.text}\n${laboratoryDataController.text}\n${recommendationController.text}"); + GifLoaderDialogUtils.hideDialog(context); + if (model.state == ViewState.ErrorLocal) { + DrAppToastMsg.showErrorToast(model.error); + } + } + }, + ), + ), + SizedBox( + width: 8, + ), + if (medicalReport != null) + Expanded( + child: AppButton( + title: status == MedicalReportStatus.ADD + ? TranslationBase.of(context).add + : TranslationBase.of(context).verify, + color: Color(0xff359846), + fontWeight: FontWeight.w700, + onPressed: () async { + GifLoaderDialogUtils.showMyDialog(context); + await model.verifyMedicalReport( + patient, medicalReport); + GifLoaderDialogUtils.hideDialog(context); + if (model.state == ViewState.ErrorLocal) { + DrAppToastMsg.showErrorToast(model.error); + } + }, + ), + ), + ], ), ), ], @@ -131,10 +298,10 @@ class _AddVerifyMedicalReportState extends State { onVoiceText() async { new SpeechToText(context: context).showAlertDialog(context); var lang = TranslationBase.of(AppGlobal.CONTEX).locale.languageCode; - bool available = await speech.initialize( + bool available = await speechHistoryFinding.initialize( onStatus: statusListener, onError: errorListener); if (available) { - speech.listen( + speechHistoryFinding.listen( onResult: resultListener, listenMode: stt.ListenMode.confirmation, localeId: lang == 'en' ? 'en-US' : 'ar-SA', @@ -144,6 +311,38 @@ class _AddVerifyMedicalReportState extends State { } } + onVoiceText2() async { + new SpeechToText(context: context).showAlertDialog(context); + var lang = TranslationBase.of(AppGlobal.CONTEX).locale.languageCode; + bool available = await speechLaboratoryData.initialize( + onStatus: statusListener, onError: errorListener); + if (available) { + speechLaboratoryData.listen( + onResult: resultListener2, + listenMode: stt.ListenMode.confirmation, + localeId: lang == 'en' ? 'en-US' : 'ar-SA', + ); + } else { + print("The user has denied the use of speech recognition."); + } + } + + onVoiceText3() async { + new SpeechToText(context: context).showAlertDialog(context); + var lang = TranslationBase.of(AppGlobal.CONTEX).locale.languageCode; + bool available = await speechRecommendation.initialize( + onStatus: statusListener, onError: errorListener); + if (available) { + speechRecommendation.listen( + onResult: resultListener3, + listenMode: stt.ListenMode.confirmation, + localeId: lang == 'en' ? 'en-US' : 'ar-SA', + ); + } else { + print("The user has denied the use of speech recognition."); + } + } + void errorListener(SpeechRecognitionError error) { event.setValue({"searchText": 'null'}); //SpeechToText.closeAlertDialog(context); @@ -151,7 +350,9 @@ class _AddVerifyMedicalReportState extends State { } void statusListener(String status) { - reconizedWord = status == 'listening' ? 'Lisening...' : 'Sorry....'; + recognizedWord1 = status == 'listening' ? 'Lisening...' : 'Sorry....'; + recognizedWord2 = status == 'listening' ? 'Lisening...' : 'Sorry....'; + recognizedWord3 = status == 'listening' ? 'Lisening...' : 'Sorry....'; } void requestPermissions() async { @@ -161,14 +362,44 @@ class _AddVerifyMedicalReportState extends State { } void resultListener(result) { - reconizedWord = result.recognizedWords; - event.setValue({"searchText": reconizedWord}); + recognizedWord1 = result.recognizedWords; + event.setValue({"searchText": recognizedWord1}); + + if (result.finalResult == true) { + setState(() { + SpeechToText.closeAlertDialog(context); + speechHistoryFinding.stop(); + historyFindingController.text += recognizedWord1 + '\n'; + }); + } else { + print(result.finalResult); + } + } + + void resultListener2(result) { + recognizedWord2 = result.recognizedWords; + event.setValue({"searchText": recognizedWord2}); + + if (result.finalResult == true) { + setState(() { + SpeechToText.closeAlertDialog(context); + speechLaboratoryData.stop(); + laboratoryDataController.text += recognizedWord2 + '\n'; + }); + } else { + print(result.finalResult); + } + } + + void resultListener3(result) { + recognizedWord3 = result.recognizedWords; + event.setValue({"searchText": recognizedWord3}); if (result.finalResult == true) { setState(() { SpeechToText.closeAlertDialog(context); - speech.stop(); - commentController.text += reconizedWord + '\n'; + speechRecommendation.stop(); + recommendationController.text += recognizedWord3 + '\n'; }); } else { print(result.finalResult); @@ -176,7 +407,21 @@ class _AddVerifyMedicalReportState extends State { } Future initSpeechState() async { - bool hasSpeech = await speech.initialize( + bool hasSpeech = await speechHistoryFinding.initialize( + onError: errorListener, onStatus: statusListener); + print(hasSpeech); + if (!mounted) return; + } + + Future initSpeechState2() async { + bool hasSpeech = await speechLaboratoryData.initialize( + onError: errorListener, onStatus: statusListener); + print(hasSpeech); + if (!mounted) return; + } + + Future initSpeechState3() async { + bool hasSpeech = await speechRecommendation.initialize( onError: errorListener, onStatus: statusListener); print(hasSpeech); if (!mounted) return; diff --git a/lib/screens/patients/profile/medical_report/MedicalReportDetailPage.dart b/lib/screens/patients/profile/medical_report/MedicalReportDetailPage.dart index 76ce2951..1233fe98 100644 --- a/lib/screens/patients/profile/medical_report/MedicalReportDetailPage.dart +++ b/lib/screens/patients/profile/medical_report/MedicalReportDetailPage.dart @@ -1,6 +1,7 @@ import 'package:doctor_app_flutter/config/size_config.dart'; import 'package:doctor_app_flutter/core/viewModel/base_view_model.dart'; import 'package:doctor_app_flutter/core/viewModel/project_view_model.dart'; +import 'package:doctor_app_flutter/models/patient/MedicalReport/MeidcalReportModel.dart'; import 'package:doctor_app_flutter/models/patient/patiant_info_model.dart'; import 'package:doctor_app_flutter/screens/base/base_view.dart'; import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; @@ -9,6 +10,7 @@ import 'package:doctor_app_flutter/widgets/patients/profile/patient-profile-head import 'package:doctor_app_flutter/widgets/shared/app_scaffold_widget.dart'; import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart'; import 'package:flutter/material.dart'; +import 'package:flutter_html/flutter_html.dart'; import 'package:provider/provider.dart'; class MedicalReportDetailPage extends StatelessWidget { @@ -19,6 +21,7 @@ class MedicalReportDetailPage extends StatelessWidget { PatiantInformtion patient = routeArgs['patient']; String patientType = routeArgs['patientType']; String arrivalType = routeArgs['arrivalType']; + MedicalReportModel medicalReport = routeArgs['medicalReport']; return BaseView( builder: (_, model, w) => AppScaffold( @@ -69,87 +72,8 @@ class MedicalReportDetailPage extends StatelessWidget { ), ), ), - child: Column( - children: [ - AppText( - TranslationBase.of(context).chiefComplaints, - fontWeight: FontWeight.w700, - fontSize: 2.4 * SizeConfig.textMultiplier, - color: Color(0XFF2E303A), - ), - AppText( - "chief complaints data", - fontWeight: FontWeight.w600, - fontSize: 1.8 * SizeConfig.textMultiplier, - color: Color(0XFF2E303A), - ), - SizedBox( - height: 8, - ), - Row( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Container( - width: 30, - height: 30, - margin: EdgeInsets.only( - left: projectViewModel.isArabic ? 10 : 85, - right: projectViewModel.isArabic ? 85 : 10, - top: 5), - decoration: BoxDecoration( - shape: BoxShape.rectangle, - border: Border( - bottom: BorderSide( - color: Colors.grey[400], width: 2.5), - left: BorderSide( - color: Colors.grey[400], width: 2.5), - )), - ), - Expanded( - child: Container( - margin: EdgeInsets.only(top: 10), - child: Row( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Container( - child: LargeAvatar( - name: "doctorName", - url: "doctor avatar", - ), - width: 25, - height: 25, - margin: EdgeInsets.only(top: 10), - ), - Expanded( - flex: 4, - child: Container( - margin: EdgeInsets.all(10), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - AppText( - '${TranslationBase.of(context).dr}. replace with doctor name', - fontWeight: FontWeight.w800, - fontSize: 1.7 * SizeConfig.textMultiplier, - color: Colors.black, - ), - AppText( - 'replace clinic Description', - fontWeight: FontWeight.w700, - fontSize: 1.4 * SizeConfig.textMultiplier, - color: Color(0XFF2E303A), - ), - ], - ), - ), - ), - ], - ), - ), - ), - ], - ), - ], + child: Html( + data: medicalReport.reportDataHtml ), ), ], diff --git a/lib/screens/patients/profile/medical_report/MedicalReportPage.dart b/lib/screens/patients/profile/medical_report/MedicalReportPage.dart index f31c754e..d986500e 100644 --- a/lib/screens/patients/profile/medical_report/MedicalReportPage.dart +++ b/lib/screens/patients/profile/medical_report/MedicalReportPage.dart @@ -1,8 +1,187 @@ +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/PatientMedicalReportViewModel.dart'; +import 'package:doctor_app_flutter/core/viewModel/project_view_model.dart'; +import 'package:doctor_app_flutter/icons_app/doctor_app_icons.dart'; +import 'package:doctor_app_flutter/models/patient/patiant_info_model.dart'; +import 'package:doctor_app_flutter/screens/base/base_view.dart'; +import 'package:doctor_app_flutter/util/date-utils.dart'; +import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; +import 'package:doctor_app_flutter/widgets/patients/profile/add-order/addNewOrder.dart'; +import 'package:doctor_app_flutter/widgets/patients/profile/large_avatar.dart'; +import 'package:doctor_app_flutter/widgets/patients/profile/patient-profile-header-new-design-app-bar.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/card_with_bg_widget.dart'; +import 'package:doctor_app_flutter/widgets/shared/errors/error_message.dart'; +import 'package:eva_icons_flutter/eva_icons_flutter.dart'; import 'package:flutter/cupertino.dart'; +import 'package:flutter/material.dart'; +import 'package:provider/provider.dart'; + +import '../../../../routes.dart'; +import 'AddVerifyMedicalReport.dart'; class MedicalReportPage extends StatelessWidget { @override Widget build(BuildContext context) { - return Container(); + final routeArgs = ModalRoute.of(context).settings.arguments as Map; + PatiantInformtion patient = routeArgs['patient']; + String patientType = routeArgs['patientType']; + String arrivalType = routeArgs['arrivalType']; + ProjectViewModel projectViewModel = Provider.of(context); + + return BaseView( + onModelReady: (model) => model.getMedicalReportList(patient), + builder: (_, model, w) => AppScaffold( + baseViewModel: model, + isShowAppBar: true, + appBar: PatientProfileHeaderNewDesignAppBar( + patient, + patientType, + arrivalType, + ), + body: SingleChildScrollView( + physics: BouncingScrollPhysics(), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Container( + margin: EdgeInsets.all(16.0), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + AppText( + "${TranslationBase.of(context).medical}", + fontSize: SizeConfig.textMultiplier * 1.6, + fontWeight: FontWeight.w700, + color: Color(0xFF2E303A), + ), + AppText( + TranslationBase.of(context).report, + fontSize: SizeConfig.textMultiplier * 3, + fontWeight: FontWeight.bold, + color: Color(0xFF2E303A), + ) + ], + ), + ), + AddNewOrder( + onTap: () { + Navigator.of(context) + .pushNamed(PATIENT_MEDICAL_REPORT_INSERT, arguments: { + 'patient': patient, + 'patientType': patientType, + 'arrivalType': arrivalType, + 'type': MedicalReportStatus.ADD + }); + }, + label: TranslationBase.of(context).createNewMedicalReport, + ), + if (model.state == ViewState.ErrorLocal) + Container( + child: ErrorMessage(error: model.error), + ), + if (model.state != ViewState.ErrorLocal) + ...List.generate( + model.medicalReportList.length, + (index) => CardWithBgWidget( + hasBorder: false, + bgColor: model.medicalReportList[index].status == 0 + ? Colors.red[700] + : Colors.green[700], + widget: Column( + children: [ + Row( + children: [ + Expanded( + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + AppText( + model.medicalReportList[index].status == 0 + ? TranslationBase.of(context).onHold + : TranslationBase.of(context).verified, + color: Colors.red, + ), + AppText( + "Jammal" ?? "", + fontSize: 15, + bold: true, + ), + ], + )), + Expanded( + child: Column( + crossAxisAlignment: CrossAxisAlignment.end, + children: [ + AppText( + '${AppDateUtils.getDayMonthYearDateFormatted(DateTime.now(), isArabic: projectViewModel.isArabic)}', + color: Colors.black, + fontWeight: FontWeight.w600, + fontSize: 14, + ), + AppText( + '${AppDateUtils.getHour(DateTime.now())}', + fontWeight: FontWeight.w600, + color: Colors.grey[700], + fontSize: 14, + ), + ], + ), + ), + ], + ), + Row( + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + Container( + child: LargeAvatar( + name: "Jammal", + url: null, + ), + width: 55, + height: 55, + ), + Expanded(child: AppText("")), + InkWell( + onTap: () { + if (model.medicalReportList[index].status == + 0) { + Navigator.of(context) + .pushNamed(PATIENT_MEDICAL_REPORT_INSERT, arguments: { + 'patient': patient, + 'patientType': patientType, + 'arrivalType': arrivalType, + 'type': MedicalReportStatus.ADD, + 'medicalReport' : model.medicalReportList[index] + }); + } else { + Navigator.of(context) + .pushNamed(PATIENT_MEDICAL_REPORT_DETAIL, arguments: { + 'patient': patient, + 'patientType': patientType, + 'arrivalType': arrivalType, + 'medicalReport' : model.medicalReportList[index] + }); + } + }, + child: Icon( + model.medicalReportList[index].status == 0 + ? EvaIcons.eye + : DoctorApp.edit_1, + ), + ) + ], + ), + ], + ), + ), + ), + ], + ), + ), + ), + ); } } diff --git a/lib/screens/patients/profile/note/progress_note_screen.dart b/lib/screens/patients/profile/note/progress_note_screen.dart index 668e5a44..be912a60 100644 --- a/lib/screens/patients/profile/note/progress_note_screen.dart +++ b/lib/screens/patients/profile/note/progress_note_screen.dart @@ -1,6 +1,6 @@ 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/viewModel/auth_view_model.dart'; +import 'package:doctor_app_flutter/core/viewModel/authentication_view_model.dart'; import 'package:doctor_app_flutter/core/viewModel/patient_view_model.dart'; import 'package:doctor_app_flutter/core/viewModel/project_view_model.dart'; import 'package:doctor_app_flutter/icons_app/doctor_app_icons.dart'; @@ -39,10 +39,8 @@ class ProgressNoteScreen extends StatefulWidget { class _ProgressNoteState extends State { List notesList; var filteredNotesList; - final _controller = TextEditingController(); - var _isInit = true; bool isDischargedPatient = false; - AuthViewModel authProvider; + AuthenticationViewModel authenticationViewModel; ProjectViewModel projectViewModel; getProgressNoteList(BuildContext context, PatientViewModel model, @@ -71,7 +69,7 @@ class _ProgressNoteState extends State { @override Widget build(BuildContext context) { - authProvider = Provider.of(context); + authenticationViewModel = Provider.of(context); projectViewModel = Provider.of(context); final routeArgs = ModalRoute .of(context) @@ -141,7 +139,7 @@ class _ProgressNoteState extends State { bgColor: model.patientProgressNoteList[index] .status == 1 && - authProvider.doctorProfile.doctorID != + authenticationViewModel.doctorProfile.doctorID != model .patientProgressNoteList[ index] @@ -167,7 +165,7 @@ class _ProgressNoteState extends State { index] .status == 1 && - authProvider + authenticationViewModel .doctorProfile.doctorID != model .patientProgressNoteList[ @@ -213,7 +211,7 @@ class _ProgressNoteState extends State { index] .status != 4 && - authProvider + authenticationViewModel .doctorProfile.doctorID == model .patientProgressNoteList[ diff --git a/lib/screens/patients/profile/profile_screen/PatientProfileCardModel.dart b/lib/screens/patients/profile/profile_screen/PatientProfileCardModel.dart index 3b566d81..eb9a3eaa 100644 --- a/lib/screens/patients/profile/profile_screen/PatientProfileCardModel.dart +++ b/lib/screens/patients/profile/profile_screen/PatientProfileCardModel.dart @@ -1,3 +1,5 @@ +import 'package:flutter/material.dart'; + class PatientProfileCardModel { final String nameLine1; final String nameLine2; @@ -9,6 +11,8 @@ class PatientProfileCardModel { final Function onTap; final bool isDischargedPatient; final bool isSelectInpatient; + final bool isDartIcon; + final IconData dartIcon; PatientProfileCardModel( this.nameLine1, @@ -21,5 +25,6 @@ class PatientProfileCardModel { this.onTap, this.isDischargedPatient = false, this.isSelectInpatient = false, + this.isDartIcon = false,this.dartIcon }); } diff --git a/lib/screens/patients/profile/profile_screen/patient_profile_screen.dart b/lib/screens/patients/profile/profile_screen/patient_profile_screen.dart index aa2b5276..7a0305e4 100644 --- a/lib/screens/patients/profile/profile_screen/patient_profile_screen.dart +++ b/lib/screens/patients/profile/profile_screen/patient_profile_screen.dart @@ -1,20 +1,19 @@ -import 'package:doctor_app_flutter/config/size_config.dart'; import 'package:doctor_app_flutter/core/viewModel/SOAP_view_model.dart'; import 'package:doctor_app_flutter/core/viewModel/patient_view_model.dart'; import 'package:doctor_app_flutter/models/SOAP/PostEpisodeReqModel.dart'; import 'package:doctor_app_flutter/models/patient/patiant_info_model.dart'; import 'package:doctor_app_flutter/screens/base/base_view.dart'; +import 'package:doctor_app_flutter/screens/live_care/end_call_screen.dart'; import 'package:doctor_app_flutter/screens/patients/profile/profile_screen/profile_gird_for_InPatient.dart'; import 'package:doctor_app_flutter/screens/patients/profile/profile_screen/profile_gird_for_other.dart'; import 'package:doctor_app_flutter/screens/patients/profile/profile_screen/profile_gird_for_search.dart'; import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; import 'package:doctor_app_flutter/widgets/patients/profile/patient-profile-header-new-design-app-bar.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/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:hexcolor/hexcolor.dart'; import '../../../../routes.dart'; @@ -28,6 +27,7 @@ class _PatientProfileScreenState extends State PatiantInformtion patient; bool isFromSearch = false; + bool isFromLiveCare = false; bool isInpatient = false; @@ -73,6 +73,9 @@ class _PatientProfileScreenState extends State if (routeArgs.containsKey("isSearchAndOut")) { isSearchAndOut = routeArgs['isSearchAndOut']; } + if(routeArgs.containsKey("isFromLiveCare")) { + isFromLiveCare = routeArgs['isFromLiveCare']; + } if (isInpatient) _activeTab = 0; else @@ -94,7 +97,6 @@ class _PatientProfileScreenState extends State Column( children: [ PatientProfileHeaderNewDesignAppBar( - patient, arrivalType ?? '0', patientType, @@ -146,9 +148,13 @@ class _PatientProfileScreenState extends State to: to, ), ), - ], + SizedBox( + height: MediaQuery.of(context).size.height * 0.05, + ) + ], ), ), + ], ), if (patient.patientStatusType != null && @@ -237,62 +243,57 @@ class _PatientProfileScreenState extends State }), ], ), - )), + )), ], ), ], ), - )); - } - - Widget tabsBar(BuildContext context, Size screenSize) { - List _tabs = [ - "Inpatient Info".toUpperCase(), - "Outpatient Info".toUpperCase(), - ]; - - return Container( - height: screenSize.height * 0.070, - decoration: TextFieldsUtils.containerBorderDecoration( - Color(0Xffffffff), Color(0xFFCCCCCC), - borderRadius: 4, borderWidth: 0), - child: Row( - mainAxisSize: MainAxisSize.max, - crossAxisAlignment: CrossAxisAlignment.center, - children: _tabs.map((item) { - bool _isActive = _tabs[_activeTab] == item ? true : false; - - return Expanded( - child: InkWell( - onTap: () async { - setState(() { - _activeTab = _tabs.indexOf(item); - }); - }, - child: Center( - child: Container( - height: screenSize.height * 0.070, - decoration: TextFieldsUtils.containerBorderDecoration( - _isActive - ? Color(0xFFD02127 /*B8382B*/) - : Color(0xFFEAEAEA), - _isActive ? Color(0xFFD02127) : Color(0xFFEAEAEA), - borderRadius: 4, - borderWidth: 0), - child: Center( - child: AppText( - item, - fontSize: SizeConfig.textMultiplier * 1.8, - color: _isActive ? Colors.white : Color(0xFF2B353E), - fontWeight: FontWeight.w700, + bottomSheet: isFromLiveCare ? Container( + decoration: BoxDecoration( + color: Colors.white, + borderRadius: BorderRadius.all( + Radius.circular(0.0), + ), + border: Border.all(color: HexColor('#707070'), width: 0), + ), + height: MediaQuery + .of(context) + .size + .height * 0.1, + width: double.infinity, + child: Column( + children: [ + SizedBox( + height: 10, + ), + Container( + child: FractionallySizedBox( + widthFactor: .80, + child: Center( + child: AppButton( + fontWeight: FontWeight.w700, + color: Colors.green[600], + title: TranslationBase + .of(context) + .initiateCall, + onPressed: () async { + Navigator.push(context, MaterialPageRoute( + builder: (BuildContext context) => + EndCallScreen(patient:patient))); + }, + ), ), ), ), - ), + SizedBox( + height: 5, + ), + ], ), - ); - }).toList(), - ), + ) : null, + ), + + ); } } diff --git a/lib/screens/patients/profile/profile_screen/profile_gird_for_InPatient.dart b/lib/screens/patients/profile/profile_screen/profile_gird_for_InPatient.dart index 1df7d236..49fa8012 100644 --- a/lib/screens/patients/profile/profile_screen/profile_gird_for_InPatient.dart +++ b/lib/screens/patients/profile/profile_screen/profile_gird_for_InPatient.dart @@ -88,10 +88,10 @@ class ProfileGridForInPatient extends StatelessWidget { PatientProfileCardModel( TranslationBase.of(context).medical, TranslationBase.of(context).report, - HEALTH_SUMMARY, + PATIENT_MEDICAL_REPORT, 'patient/health_summary.png', isInPatient: isInpatient, - isDisable: true), + isDisable: false), PatientProfileCardModel( TranslationBase.of(context).referral, TranslationBase.of(context).patient, diff --git a/lib/screens/patients/profile/referral/my-referral-detail-screen.dart b/lib/screens/patients/profile/referral/my-referral-detail-screen.dart index 2adef799..447a3739 100644 --- a/lib/screens/patients/profile/referral/my-referral-detail-screen.dart +++ b/lib/screens/patients/profile/referral/my-referral-detail-screen.dart @@ -1,6 +1,5 @@ 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/auth_view_model.dart'; import 'package:doctor_app_flutter/core/viewModel/patient-referral-viewmodel.dart'; import 'package:doctor_app_flutter/icons_app/doctor_app_icons.dart'; import 'package:doctor_app_flutter/models/patient/my_referral/PendingReferral.dart'; @@ -15,16 +14,13 @@ 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:flutter/material.dart'; import 'package:hexcolor/hexcolor.dart'; -import 'package:provider/provider.dart'; +// ignore: must_be_immutable class MyReferralDetailScreen extends StatelessWidget { PendingReferral pendingReferral; @override Widget build(BuildContext context) { - final gridHeight = (MediaQuery.of(context).size.width * 0.3) * 1.8; - - AuthViewModel authProvider = Provider.of(context); final routeArgs = ModalRoute.of(context).settings.arguments as Map; pendingReferral = routeArgs['referral']; diff --git a/lib/screens/patients/profile/referral/my-referral-patient-screen.dart b/lib/screens/patients/profile/referral/my-referral-patient-screen.dart index b2953cca..fe6fd2db 100644 --- a/lib/screens/patients/profile/referral/my-referral-patient-screen.dart +++ b/lib/screens/patients/profile/referral/my-referral-patient-screen.dart @@ -1,4 +1,3 @@ -import 'package:doctor_app_flutter/core/viewModel/auth_view_model.dart'; import 'package:doctor_app_flutter/core/viewModel/patient-referral-viewmodel.dart'; import 'package:doctor_app_flutter/screens/base/base_view.dart'; import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; @@ -7,15 +6,12 @@ import 'package:doctor_app_flutter/widgets/shared/app_scaffold_widget.dart'; import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart'; import 'package:flutter/material.dart'; import 'package:font_awesome_flutter/font_awesome_flutter.dart'; -import 'package:provider/provider.dart'; import '../../../../routes.dart'; class MyReferralPatientScreen extends StatelessWidget { - // previous design page is: MyReferralPatient @override Widget build(BuildContext context) { - AuthViewModel authProvider = Provider.of(context); return BaseView( onModelReady: (model) => model.getPendingReferralPatients(), diff --git a/lib/screens/patients/profile/soap_update/assessment/add_assessment_details.dart b/lib/screens/patients/profile/soap_update/assessment/add_assessment_details.dart index 47d639ad..a30842f8 100644 --- a/lib/screens/patients/profile/soap_update/assessment/add_assessment_details.dart +++ b/lib/screens/patients/profile/soap_update/assessment/add_assessment_details.dart @@ -3,7 +3,6 @@ import 'package:doctor_app_flutter/config/shared_pref_kay.dart'; import 'package:doctor_app_flutter/core/enum/master_lookup_key.dart'; import 'package:doctor_app_flutter/core/enum/viewstate.dart'; import 'package:doctor_app_flutter/core/viewModel/SOAP_view_model.dart'; -// import 'package:doctor_app_flutter/core/viewModel/auth_view_model.dart'; import 'package:doctor_app_flutter/core/viewModel/project_view_model.dart'; import 'package:doctor_app_flutter/models/SOAP/PatchAssessmentReqModel.dart'; import 'package:doctor_app_flutter/models/SOAP/master_key_model.dart'; diff --git a/lib/screens/prescription/prescription_item_in_patient_page.dart b/lib/screens/prescription/prescription_item_in_patient_page.dart index 4828608a..b6d27af6 100644 --- a/lib/screens/prescription/prescription_item_in_patient_page.dart +++ b/lib/screens/prescription/prescription_item_in_patient_page.dart @@ -50,160 +50,6 @@ class PrescriptionItemsInPatientPage extends StatelessWidget { child: Container( child: Column( children: [ - // if (!prescriptions.isInOutPatient) - // ...List.generate( - // model.prescriptionReportList.length, - // (index) => Container( - // decoration: BoxDecoration( - // borderRadius: BorderRadius.circular(12), - // color: Colors.white, - // ), - // margin: EdgeInsets.all(12), - // child: Padding( - // padding: const EdgeInsets.all(8.0), - // child: Column( - // crossAxisAlignment: CrossAxisAlignment.start, - // children: [ - // Container( - // margin: - // EdgeInsets.only(left: 18, right: 18), - // child: AppText( - // model.prescriptionReportList[index] - // .itemDescription.isNotEmpty - // ? model - // .prescriptionReportList[index] - // .itemDescription - // : model - // .prescriptionReportList[index] - // .itemDescriptionN, - // bold: true, - // )), - // SizedBox( - // height: 12, - // ), - // Row( - // children: [ - // SizedBox( - // width: 18, - // ), - // Container( - // decoration: BoxDecoration( - // shape: BoxShape.circle, - // border: Border.all( - // width: 0.5, - // color: Colors.grey)), - // height: 55, - // width: 55, - // child: InkWell( - // onTap: () { - // showDialog( - // context: context, - // child: ShowImageDialog( - // imageUrl: model - // .prescriptionReportEnhList[ - // index] - // .imageSRCUrl, - // )); - // }, - // child: Padding( - // padding: const EdgeInsets.all(8.0), - // child: Image.network( - // model - // .prescriptionReportList[index] - // .imageSRCUrl, - // fit: BoxFit.cover, - // ), - // ), - // ), - // ), - // SizedBox( - // width: 10, - // ), - // Expanded( - // child: Column( - // crossAxisAlignment: - // CrossAxisAlignment.start, - // children: [ - // Row( - // children: [ - // AppText( - // TranslationBase.of(context) - // .route, - // color: Colors.grey, - // ), - // Expanded( - // child: AppText(" " + - // model - // .prescriptionReportList[ - // index] - // .routeN)), - // ], - // ), - // Row( - // children: [ - // AppText( - // TranslationBase.of(context) - // .frequency, - // color: Colors.grey, - // ), - // AppText(" " + - // model - // .prescriptionReportList[ - // index] - // .frequencyN ?? - // ''), - // ], - // ), - // Row( - // children: [ - // AppText( - // TranslationBase.of(context) - // .dailyDoses, - // color: Colors.grey, - // ), - // AppText(" " + - // model - // .prescriptionReportList[ - // index] - // .doseDailyQuantity ?? - // ''), - // ], - // ), - // Row( - // children: [ - // AppText( - // TranslationBase.of(context) - // .duration, - // color: Colors.grey, - // ), - // AppText(" " + - // model - // .prescriptionReportList[ - // index] - // .days - // .toString() ?? - // ''), - // ], - // ), - // SizedBox( - // height: 12, - // ), - // AppText(model - // .prescriptionReportList[ - // index] - // .remarks ?? - // ''), - // ], - // ), - // ) - // ], - // ) - // ], - // ), - // ), - // )) - // else - Container( decoration: BoxDecoration( borderRadius: BorderRadius.circular(12), @@ -233,34 +79,6 @@ class PrescriptionItemsInPatientPage extends StatelessWidget { SizedBox( width: 18, ), - // Container( - // decoration: BoxDecoration( - // shape: BoxShape.circle, - // border: Border.all( - // width: 0.5, color: Colors.grey)), - // height: 55, - // width: 55, - // child: InkWell( - // onTap: () { - // showDialog( - // context: context, - // // child: ShowImageDialog( - // // imageUrl: model - // // .inPatientPrescription[index] - // // .imageSRCUrl, - // // ), - // ); - // }, - // child: Padding( - // padding: const EdgeInsets.all(8.0), - // // child: Image.network( - // // model.prescriptionReportEnhList[index] - // // .imageSRCUrl, - // // fit: BoxFit.cover, - // // ), - // ), - // ), - // ), SizedBox( width: 10, ), diff --git a/lib/screens/prescription/prescription_items_page.dart b/lib/screens/prescription/prescription_items_page.dart index 8051beae..a68f6f56 100644 --- a/lib/screens/prescription/prescription_items_page.dart +++ b/lib/screens/prescription/prescription_items_page.dart @@ -8,6 +8,7 @@ import 'package:doctor_app_flutter/widgets/patients/profile/patient_profile_head 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/dialogs/ShowImageDialog.dart'; +import 'package:eva_icons_flutter/eva_icons_flutter.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; @@ -169,13 +170,21 @@ class PrescriptionItemsPage extends StatelessWidget { ) ); }, - child: Padding( - padding: const EdgeInsets.all(8.0), - child: Image.network( - model.prescriptionReportEnhList[index].imageSRCUrl, - fit: BoxFit.cover, + child: Stack( + children: [ + Padding( + padding: const EdgeInsets.all(8.0), + child: Image.network( + model.prescriptionReportEnhList[index].imageSRCUrl, + fit: BoxFit.cover, - ), + ), + ), + Positioned( + top: 10, + right: 10, + child: Icon(EvaIcons.search,color: Colors.grey,size: 35,)) + ], ), ), ), diff --git a/lib/util/helpers.dart b/lib/util/helpers.dart index 3e410c86..53f81ef2 100644 --- a/lib/util/helpers.dart +++ b/lib/util/helpers.dart @@ -1,6 +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'; @@ -22,7 +24,7 @@ class Helpers { static int cupertinoPickerIndex = 0; get currentLanguage => null; - static showCupertinoPicker(context, items, decKey, onSelectFun) { + static showCupertinoPicker(context, List items, decKey, onSelectFun, AuthenticationViewModel model) { showModalBottomSheet( isDismissible: false, context: context, @@ -63,7 +65,7 @@ class Helpers { height: SizeConfig.realScreenHeight * 0.3, color: Color(0xfff7f7f7), child: - buildPickerItems(context, items, decKey, onSelectFun)) + buildPickerItems(context, items, decKey, onSelectFun, model)) ], ), ); @@ -73,14 +75,14 @@ class Helpers { static TextStyle textStyle(context) => TextStyle(color: Theme.of(context).primaryColor); - static buildPickerItems(context, List items, decKey, onSelectFun) { + static buildPickerItems(context, List items, decKey, onSelectFun, model) { return CupertinoPicker( magnification: 1.5, scrollController: FixedExtentScrollController(initialItem: cupertinoPickerIndex), children: items.map((item) { return Text( - '${item["$decKey"]}', + '${item.facilityName}', style: TextStyle(fontSize: SizeConfig.textMultiplier * 2), ); }).toList(), @@ -130,6 +132,7 @@ class Helpers { } static generateContactAdminMsg([err = null]) { + //TODO: Add translation String localMsg = 'Something wrong happened, please contact the admin'; if (err != null) { localMsg = localMsg + '\n \n' + err.toString(); @@ -141,20 +144,6 @@ class Helpers { await sharedPref.clear(); } - static logout() async { - DEVICE_TOKEN = ""; - String lang = await sharedPref.getString(APP_Language); - await clearSharedPref(); - sharedPref.setString(APP_Language, lang); - ProjectViewModel().isLogin = false; - Navigator.pushAndRemoveUntil( - AppGlobal.CONTEX, - FadePage( - page: Loginsreen(), - ), - (r) => false); - } - navigateToUpdatePage(String message, String androidLink, iosLink) { Navigator.pushAndRemoveUntil( AppGlobal.CONTEX, diff --git a/lib/util/translations_delegate_base.dart b/lib/util/translations_delegate_base.dart index c95fbd2f..ac805956 100644 --- a/lib/util/translations_delegate_base.dart +++ b/lib/util/translations_delegate_base.dart @@ -68,8 +68,8 @@ class TranslationBase { String get outPatients => localizedValues['outPatients'][locale.languageCode]; - String get searchPatient => - localizedValues['searchPatient'][locale.languageCode]; + String get searchPatient => localizedValues['searchPatient'][locale.languageCode]; + String get searchPatientDashBoard => localizedValues['searchPatientDashBoard'][locale.languageCode]; String get searchPatientName => localizedValues['searchPatient-name'][locale.languageCode]; @@ -100,6 +100,7 @@ class TranslationBase { String get referral => localizedValues['referral'][locale.languageCode]; String get inPatient => localizedValues['inPatient'][locale.languageCode]; + String get myInPatient => localizedValues['myInPatient'][locale.languageCode]; String get inPatientLabel => localizedValues['inPatientLabel'][locale.languageCode]; @@ -111,8 +112,8 @@ class TranslationBase { String get patientServices => localizedValues['patientServices'][locale.languageCode]; - String get searchMedicine => - localizedValues['searchMedicine'][locale.languageCode]; + String get searchMedicine => localizedValues['searchMedicine'][locale.languageCode]; + String get searchMedicineDashboard => localizedValues['searchMedicineDashboard'][locale.languageCode]; String get myReferralPatient => localizedValues['myReferralPatient'][locale.languageCode]; @@ -398,8 +399,8 @@ class TranslationBase { String get outPatient => localizedValues['outPatients'][locale.languageCode]; - String get myOutPatient => - localizedValues['myOutPatient'][locale.languageCode]; + String get myOutPatient => localizedValues['myOutPatient'][locale.languageCode]; + String get myOutPatient_2lines => localizedValues['myOutPatient_2lines'][locale.languageCode]; String get logout => localizedValues['logout'][locale.languageCode]; @@ -940,6 +941,8 @@ class TranslationBase { String get verifySMS => localizedValues['verify-with-sms'][locale.languageCode]; + String get verifyWith => + localizedValues['verify-with'][locale.languageCode]; String get verifyWhatsApp => localizedValues['verify-with-whatsapp'][locale.languageCode]; @@ -1159,6 +1162,8 @@ class TranslationBase { String get patientsreferral => localizedValues['ptientsreferral'][locale.languageCode]; + String get myPatientsReferral => + localizedValues['myPatientsReferral'][locale.languageCode]; String get arrivalpatient => localizedValues['arrivalpatient'][locale.languageCode]; String get searchmedicinepatient => @@ -1331,6 +1336,21 @@ class TranslationBase { String get medicalReportAdd => localizedValues['medicalReportAdd'][locale.languageCode]; String get medicalReportVerify => localizedValues['medicalReportVerify'][locale.languageCode]; String get comments => localizedValues['comments'][locale.languageCode]; + String get initiateCall => localizedValues['initiateCall '][locale.languageCode]; + String get transferTo => localizedValues['transferTo'][locale.languageCode]; + String get admin => localizedValues['admin'][locale.languageCode]; + String get instructions => localizedValues['instructions'][locale.languageCode]; + String get sendLC => localizedValues['sendLC'][locale.languageCode]; + String get endLC => localizedValues['endLC'][locale.languageCode]; + String get consultation => localizedValues['consultation'][locale.languageCode]; + String get resume => localizedValues['resume'][locale.languageCode]; + String get theCall => localizedValues['theCall'][locale.languageCode]; + String get createNewMedicalReport => localizedValues['createNewMedicalReport'][locale.languageCode]; + String get historyPhysicalFinding => localizedValues['historyPhysicalFinding'][locale.languageCode]; + String get laboratoryPhysicalData => localizedValues['laboratoryPhysicalData'][locale.languageCode]; + String get impressionRecommendation => localizedValues['impressionRecommendation'][locale.languageCode]; + String get onHold => localizedValues['onHold'][locale.languageCode]; + String get verified => localizedValues['verified'][locale.languageCode]; } class TranslationBaseDelegate extends LocalizationsDelegate { diff --git a/lib/widgets/auth/auth_header.dart b/lib/widgets/auth/auth_header.dart deleted file mode 100644 index f84e9425..00000000 --- a/lib/widgets/auth/auth_header.dart +++ /dev/null @@ -1,198 +0,0 @@ -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:flutter/rendering.dart'; -import 'package:hexcolor/hexcolor.dart'; - -import '../../config/size_config.dart'; -import '../../lookups/auth_lookup.dart'; - -class AuthHeader extends StatelessWidget { - var userType; - AuthHeader(this.userType); - - @override - Widget build(BuildContext context) { - var screen = Container( - margin: SizeConfig.isMobile - ? null - : EdgeInsetsDirectional.fromSTEB(SizeConfig.realScreenWidth * 0.30, - SizeConfig.realScreenWidth * 0.1, 0, 0), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - // Container( - // margin: SizeConfig.isMobile - // ? EdgeInsetsDirectional.fromSTEB( - // 0, SizeConfig.realScreenHeight * 0.03, 0, 0) - // : EdgeInsetsDirectional.fromSTEB( - // SizeConfig.realScreenWidth * 0.13, 0, 0, 0), - // child: buildImageLogo(), - // ), - SizedBox( - height: 30, - ), - //buildTextUnderLogo(context), - ], - ), - Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: SizeConfig.isMobile - ? [ - SizedBox( - height: 10, - ), - buildWelText(context), - buildDrSulText(context), - ] - : [ - SizedBox( - height: 10, - ), - Row( - mainAxisAlignment: MainAxisAlignment.start, - children: [ - buildWelText(context), - buildDrSulText(context), - ], - ), - ], - ), - buildDrAppContainer(context) - ], - )); - return screen; - } - - Image buildImageLogo() { - String img = 'assets/images/dr_app_logo.png'; - return Image.asset( - img, - fit: BoxFit.cover, - height: SizeConfig.isMobile ? null : SizeConfig.realScreenWidth * 0.09, - ); - } - - Widget buildTextUnderLogo(context) { - Widget finalWid; - double textFontSize = - SizeConfig.isMobile ? 30 : SizeConfig.textMultiplier * 3; - EdgeInsetsDirectional containerMargin; - if (userType == loginType.knownUser || userType == loginType.unknownUser) { - finalWid = Text( - TranslationBase.of(context).login, - style: TextStyle(fontSize: textFontSize, fontWeight: FontWeight.w800), - ); - } else { - String text1; - String text2; - if (userType == loginType.changePassword) { - text1 = 'Change '; - text2 = 'Password!'; - } - if (userType == loginType.verifyPassword) { - text1 = TranslationBase.of(context).verify1; - text2 = TranslationBase.of(context).yourAccount; - } - if (userType == loginType.verificationMethods) { - text1 = TranslationBase.of(context).choose; - text2 = TranslationBase.of(context).verification; - } - List childrens = [ - Text( - text1, - style: TextStyle(fontSize: textFontSize, fontWeight: FontWeight.w800), - ), - Text( - text2, - style: TextStyle( - color: HexColor('#B8382C'), - fontSize: textFontSize, - fontWeight: FontWeight.w800), - ) - ]; - - if (!SizeConfig.isMobile) { - finalWid = Row( - crossAxisAlignment: CrossAxisAlignment.start, - children: childrens, - ); - } else { - finalWid = Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: childrens, - ); - } - } - if (!SizeConfig.isMobile) { - double start = SizeConfig.realScreenWidth * 0.13; - if (loginType.verifyPassword == userType || - loginType.changePassword == userType || - userType == loginType.verificationMethods) { - start = 0; - } - containerMargin = EdgeInsetsDirectional.fromSTEB(start, 0, 0, 0); - } - - return Container(margin: containerMargin, child: finalWid); - } - - Container buildDrAppContainer(BuildContext context) { - if (userType == loginType.changePassword || - userType == loginType.verifyPassword || - userType == loginType.verificationMethods) { - return Container(); - } - return Container( - // margin: SizeConfig.isMobile - // ? null - // : EdgeInsetsDirectional.fromSTEB( - // SizeConfig.realScreenWidth * 0.13, 0, 0, 0), - child: Text( - "Doctor App", - style: TextStyle( - fontSize: - SizeConfig.isMobile ? 16 : SizeConfig.realScreenWidth * 0.030, - fontWeight: FontWeight.w800, - color: HexColor('#B8382C')), - ), - ); - } - - Text buildDrSulText(BuildContext context) { - if (userType == loginType.changePassword || - userType == loginType.verifyPassword || - userType == loginType.verificationMethods) { - return Text(''); - } - return Text( - TranslationBase.of(context).drSulaimanAlHabib, - style: TextStyle( - fontWeight: FontWeight.w800, - fontSize: - SizeConfig.isMobile ? 24 : SizeConfig.realScreenWidth * 0.029, - fontFamily: 'Poppins'), - ); - } - - Widget buildWelText(BuildContext context) { - String text = TranslationBase.of(context).welcomeTo; - if (userType == loginType.unknownUser) { - text = TranslationBase.of(context).welcomeBackTo; - } - if (userType == loginType.changePassword || - userType == loginType.verifyPassword || - userType == loginType.verificationMethods) { - return Text(''); - } - return AppText( - text, - // style: TextStyle( - fontSize: 16, - fontWeight: FontWeight.w600, - ); - } -} diff --git a/lib/widgets/auth/change_password.dart b/lib/widgets/auth/change_password.dart deleted file mode 100644 index 3eb9b975..00000000 --- a/lib/widgets/auth/change_password.dart +++ /dev/null @@ -1,159 +0,0 @@ -import 'package:doctor_app_flutter/config/size_config.dart'; -import 'package:flutter/material.dart'; -import 'package:hexcolor/hexcolor.dart'; - -class ChangePassword extends StatelessWidget { - final changePassFormKey = GlobalKey(); - var changePassFormValues = { - 'currentPass': null, - 'newPass': null, - 'repeatedPass': null - }; - - @override - Widget build(BuildContext context) { - return Form( - key: changePassFormKey, - child: Container( - width: SizeConfig.realScreenWidth * 0.90, - child: - Column(crossAxisAlignment: CrossAxisAlignment.start, children: < - Widget>[ - buildSizedBox(), - TextFormField( - keyboardType: TextInputType.number, - decoration: InputDecoration( - // ts/images/password_icon.png - prefixIcon: Image.asset('assets/images/password_icon.png'), - hintText: 'Current Password', - hintStyle: - TextStyle(fontSize: 2 * SizeConfig.textMultiplier), - enabledBorder: OutlineInputBorder( - borderRadius: BorderRadius.all(Radius.circular(20)), - borderSide: BorderSide(color: HexColor('#CCCCCC')), - ), - focusedBorder: OutlineInputBorder( - borderRadius: BorderRadius.all(Radius.circular(10.0)), - borderSide: - BorderSide(color: Theme.of(context).primaryColor), - ) - //BorderRadius.all(Radius.circular(20)); - ), - validator: (value) { - if (value.isEmpty) { - return 'Please enter your Current Password'; - } - return null; - }, - onSaved: (value) { - // changePassFormValues. = value; - }, - ), - buildSizedBox(40), - // buildSizedBox(), - Text( - "New Password", - style: TextStyle( - fontSize: 2.8 * SizeConfig.textMultiplier, - fontWeight: FontWeight.w800), - ), - buildSizedBox(10.0), - // Text() - TextFormField( - keyboardType: TextInputType.number, - decoration: InputDecoration( - // ts/images/password_icon.png - prefixIcon: Image.asset('assets/images/password_icon.png'), - hintText: 'New Password', - hintStyle: - TextStyle(fontSize: 2 * SizeConfig.textMultiplier), - enabledBorder: OutlineInputBorder( - borderRadius: BorderRadius.all(Radius.circular(20)), - borderSide: BorderSide(color: HexColor('#CCCCCC')), - ), - focusedBorder: OutlineInputBorder( - borderRadius: BorderRadius.all(Radius.circular(10.0)), - borderSide: - BorderSide(color: Theme.of(context).primaryColor), - ) - //BorderRadius.all(Radius.circular(20)); - ), - validator: (value) { - if (value.isEmpty) { - return 'Please enter your New Password'; - } - return null; - }, - onSaved: (value) { - // userInfo.UserID = value; - }, - ), - buildSizedBox(), - TextFormField( - keyboardType: TextInputType.number, - decoration: InputDecoration( - prefixIcon: Image.asset('assets/images/password_icon.png'), - hintText: 'Repeat Password', - hintStyle: - TextStyle(fontSize: 2 * SizeConfig.textMultiplier), - enabledBorder: OutlineInputBorder( - borderRadius: BorderRadius.all(Radius.circular(20)), - borderSide: BorderSide(color: HexColor('#CCCCCC')), - ), - focusedBorder: OutlineInputBorder( - borderRadius: BorderRadius.all(Radius.circular(10.0)), - borderSide: - BorderSide(color: Theme.of(context).primaryColor), - ) - //BorderRadius.all(Radius.circular(20)); - ), - validator: (value) { - if (value.isEmpty) { - return 'Please enter your Repeat Password'; - } - return null; - }, - onSaved: (value) { - // userInfo.UserID = value; - }, - ), - buildSizedBox(), - RaisedButton( - onPressed:changePass, - elevation: 0.0, - child: Container( - width: double.infinity, - height: 50, - child: Center( - child: Text( - 'Change Password' - .toUpperCase(), - // textAlign: TextAlign.center, - style: TextStyle( - color: Colors.white, - fontSize: 2.5 * SizeConfig.textMultiplier), - ), - ), - ), - shape: RoundedRectangleBorder( - borderRadius: BorderRadius.circular(10), - side: BorderSide(width: 0.5, color: HexColor('#CCCCCC'))), - ), - SizedBox( - height: 10, - ), - ]))); - } - - SizedBox buildSizedBox([double height = 20]) { - return SizedBox( - height: height, - ); - } - changePass(){ - if(changePassFormKey.currentState.validate()){ - changePassFormKey.currentState.save(); - // call Api - } - } -} diff --git a/lib/widgets/auth/known_user_login.dart b/lib/widgets/auth/known_user_login.dart deleted file mode 100644 index cbf3c71a..00000000 --- a/lib/widgets/auth/known_user_login.dart +++ /dev/null @@ -1,328 +0,0 @@ -import 'package:doctor_app_flutter/config/shared_pref_kay.dart'; -import 'package:flutter/material.dart'; -import 'package:flutter/services.dart'; -import 'package:hexcolor/hexcolor.dart'; -import 'package:local_auth/error_codes.dart' as auth_error; -import 'package:local_auth/local_auth.dart'; -import 'package:provider/provider.dart'; -import 'package:shared_preferences/shared_preferences.dart'; - -import '../../config/size_config.dart'; -import '../../core/viewModel/auth_view_model.dart'; -import '../../routes.dart'; -import '../../util/dr_app_shared_pref.dart'; -import '../../util/dr_app_toast_msg.dart'; -import '../../widgets/shared/dr_app_circular_progress_Indeicator.dart'; - -DrAppSharedPreferances sharedPref = new DrAppSharedPreferances(); - -class KnownUserLogin extends StatefulWidget { - @override - _KnownUserLoginState createState() => _KnownUserLoginState(); -} - -class _KnownUserLoginState extends State { - Future _prefs = SharedPreferences.getInstance(); - final LocalAuthentication auth = LocalAuthentication(); - - String _authorized = "not Authorized"; - bool _isAuthenticating = false; - Future _loggedUserFuture; - var _loggedUser; - int _loginType = 1; - String _platformImei; - Future _loginTypeFuture; - - Map _loginTypeMap = { - 1: { - "name": "SMS", - 'imageUrl': 'assets/images/verification_sms_lg_icon.png', - }, - 2: { - "name": "FingerPrint", - 'imageUrl': 'assets/images/verification_fingerprint_lg_icon.png' - }, - 3: { - "name": "Face", - 'imageUrl': 'assets/images/verification_faceid_lg_icon.png' - }, - 4: { - "name": "WhatsApp", - 'imageUrl': 'assets/images/verification_whatsapp_lg_icon.png' - } - }; - - Future getSharedPref() async { - sharedPref.getObj(LOGGED_IN_USER).then((userInfo) { - _loggedUser = userInfo; - }); - sharedPref.getString('platformImei').then((imei) { - _platformImei = imei; - }); - } - - @override - void initState() { - super.initState(); - _loggedUserFuture = getSharedPref(); - } - - @override - Widget build(BuildContext context) { - AuthViewModel authProv = Provider.of(context); - // var imeiModel = {'IMEI': _platformImei}; - // _loginTypeFuture = authProv.selectDeviceImei(imeiModel); - return FutureBuilder( - future: Future.wait([_loggedUserFuture, _loginTypeFuture]), - builder: (BuildContext context, AsyncSnapshot snapshot) { - _loginTypeFuture.then((res) { - _loginType = - 2; //res['SELECTDeviceIMEIbyIMEI_List'][0]['LogInType']; - }).catchError((err) { - print('${err}'); - DrAppToastMsg.showErrorToast(err); - }); - switch (snapshot.connectionState) { - case ConnectionState.waiting: - return DrAppCircularProgressIndeicator(); - default: - if (snapshot.hasError) { - DrAppToastMsg.showErrorToast('Error: ${snapshot.error}'); - return Text('Error: ${snapshot.error}'); - } else { - return Column( - mainAxisAlignment: MainAxisAlignment.start, - children: [ - Stack(children: [ - Container( - decoration: BoxDecoration( - border: Border.all( - color: HexColor('#CCCCCC'), - ), - borderRadius: BorderRadius.circular(50)), - margin: const EdgeInsets.fromLTRB(0, 20.0, 30, 0), - child: Row( - // mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - Container( - height: 100, - width: 100, - decoration: new BoxDecoration( - // color: Colors.green, // border color - shape: BoxShape.circle, - border: - Border.all(color: HexColor('#CCCCCC'))), - child: CircleAvatar( - child: Image.asset( - 'assets/images/dr_avatar.png', - fit: BoxFit.cover, - ), - )), - Container( - margin: EdgeInsets.symmetric( - vertical: 3, horizontal: 15), - child: Column( - // mainAxisAlignment: MainAxisAlignment.start, - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Text( - _loggedUser['List_MemberInformation'][0] - ['MemberName'], - style: TextStyle( - color: HexColor('515A5D'), - fontSize: - 2.5 * SizeConfig.textMultiplier, - fontWeight: FontWeight.w800), - ), - Text( - 'ENT Spec', - style: TextStyle( - color: HexColor('515A5D'), - fontSize: - 1.5 * SizeConfig.textMultiplier), - ) - ], - ), - ) - ], - ), - ), - Positioned( - top: 7, - right: 70, - child: Image.asset( - 'assets/images/close_icon.png', - fit: BoxFit.cover, - )) - ]), - buildVerificationTypeImageContainer(), - buildButtonsContainer(context) - ], - ); - } - } - }); - } - - Container buildVerificationTypeImageContainer() { - print('${_loginTypeMap[_loginType]}'); - return Container( - height: 200, - width: 200, - child: Center( - child: Image.asset( - _loginTypeMap[_loginType]['imageUrl'], - fit: BoxFit.cover, - ), - )); - } - - // - Container buildButtonsContainer(BuildContext context) { - return Container( - margin: EdgeInsetsDirectional.fromSTEB(0, 0, 30, 0), - width: double.infinity, - child: Column( - children: [ - RaisedButton( - onPressed: _authenticate, - elevation: 0.0, - child: Container( - width: double.infinity, - height: 50, - child: Center( - child: Text( - "Verify using ${_loginTypeMap[_loginType]['name']}" - .toUpperCase(), - // textAlign: TextAlign.center, - style: TextStyle( - color: Colors.white, - fontSize: 2.5 * SizeConfig.textMultiplier), - ), - ), - ), - shape: RoundedRectangleBorder( - borderRadius: BorderRadius.circular(10), - side: BorderSide(width: 0.5, color: HexColor('#CCCCCC'))), - ), - SizedBox( - height: 10, - ), - Container( - width: double.infinity, - height: 50, - child: FlatButton( - onPressed: () { - navigateToMoreOption(); - }, - shape: RoundedRectangleBorder( - borderRadius: BorderRadius.circular(10), - side: BorderSide( - width: 1, color: Theme.of(context).primaryColor)), - child: Text( - "More verification Options".toUpperCase(), - style: TextStyle( - color: Theme.of(context).primaryColor, - fontSize: 2.5 * SizeConfig.textMultiplier), - )), - ), - SizedBox( - height: 20, - ), - ], - ), - ); - } - - navigateToMoreOption() { - Navigator.of(context).pushNamed(VERIFICATION_METHODS); - } - - _authenticate() { - if (_loginType == 1) { - _authenticateBySMS(); - } - if (_loginType == 2) { - _authenticateByFingerPrint(); - } - if (_loginType == 3) { - _authenticateByFace(); - } - if (_loginType == 4) { - _authenticateByWhatsApp(); - } - } - - Future _authenticateByFingerPrint() async { - _getAvailableBiometrics(); - bool authenticated = false; - try { - setState(() { - _isAuthenticating = true; - _authorized = 'Authenticating'; - }); - authenticated = await auth.authenticateWithBiometrics( - localizedReason: 'Scan your fingerprint to authenticate', - useErrorDialogs: true, - stickyAuth: false); - setState(() { - _isAuthenticating = false; - _authorized = 'Authenticating'; - }); - } on PlatformException catch (e) { - print(e); - } - if (!mounted) return; - - final String message = authenticated ? 'Authorized' : 'Not Authorized'; - if (message == 'Authorized') { - navigateToHome(); - } - setState(() { - print('_authorized' + _authorized); - _authorized = message; - print('_authorized' + _authorized); - }); - } - - Future _authenticateBySMS() { - print('_authenticateBySMS'); - } - - Future _authenticateByFace() { - print('_authenticateByFace'); - } - - Future _authenticateByWhatsApp() { - print('_authenticateByWhatsApp'); - } - - Future _getAvailableBiometrics() async { - List availableBiometrics; - try { - availableBiometrics = await auth.getAvailableBiometrics(); - } on PlatformException catch (e) { - print(e); - if (e.code == auth_error.notAvailable) { - showErorrMsg("Auth Methods Not Available"); - } else if (e.code == auth_error.passcodeNotSet) { - showErorrMsg("Auth Methods Not passcodeNotSet"); - } else if (e.code == auth_error.permanentlyLockedOut) { - showErorrMsg("Auth Methods Not permanentlyLockedOut"); - } - } - if (!mounted) return; - - setState(() { - print('availableBiometrics $availableBiometrics'); - }); - } - - navigateToHome() { - Navigator.of(context).pushReplacementNamed(HOME); - } - - showErorrMsg(localMsg) { - DrAppToastMsg.showErrorToast(localMsg); - } -} diff --git a/lib/widgets/auth/login_form.dart b/lib/widgets/auth/login_form.dart deleted file mode 100644 index a2c200cb..00000000 --- a/lib/widgets/auth/login_form.dart +++ /dev/null @@ -1,312 +0,0 @@ -import 'package:doctor_app_flutter/config/config.dart'; -import 'package:doctor_app_flutter/core/viewModel/imei_view_model.dart'; -import 'package:doctor_app_flutter/screens/auth/verification_methods_screen.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/text_fields/app_text_form_field.dart'; -import 'package:flutter/cupertino.dart'; -import 'package:flutter/material.dart'; -import 'package:flutter/rendering.dart'; -import 'package:flutter/services.dart'; -import 'package:hexcolor/hexcolor.dart'; -import 'package:provider/provider.dart'; - -import '../../config/shared_pref_kay.dart'; -import '../../config/size_config.dart'; -import '../../core/viewModel/hospital_view_model.dart'; -import '../../models/doctor/user_model.dart'; -import '../../util/dr_app_shared_pref.dart'; -import '../../util/dr_app_toast_msg.dart'; -import '../../util/helpers.dart'; - -DrAppSharedPreferances sharedPref = DrAppSharedPreferances(); -DrAppToastMsg toastMsg = DrAppToastMsg(); -Helpers helpers = Helpers(); - -class LoginForm extends StatefulWidget with DrAppToastMsg { - LoginForm({this.model}); - - final IMEIViewModel model; - - @override - _LoginFormState createState() => _LoginFormState(); -} - -class _LoginFormState extends State { - final loginFormKey = GlobalKey(); - var projectIdController = TextEditingController(); - var projectsList = []; - FocusNode focusPass = FocusNode(); - FocusNode focusProject = FocusNode(); - HospitalViewModel projectsProv; - var userInfo = UserModel(); - @override - void initState() { - super.initState(); - } - - @override - Widget build(BuildContext context) { - projectsProv = Provider.of(context); - return 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(), - Padding( - child: AppText( - TranslationBase.of(context).enterCredentials, - fontSize: 18, - fontWeight: FontWeight.bold, - ), - padding: EdgeInsets.only(top: 10, bottom: 10)), - Container( - decoration: BoxDecoration( - borderRadius: BorderRadius.all(Radius.circular(6.0)), - border: Border.all( - width: 1.0, - color: HexColor("#CCCCCC"), - ), - color: Colors.white), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Padding( - padding: EdgeInsets.only(left: 10, top: 10), - child: AppText( - TranslationBase.of(context).enterId, - fontWeight: FontWeight.w800, - fontSize: 14, - )), - AppTextFormField( - labelText: '', - borderColor: Colors.white, - // keyboardType: TextInputType.number, - textInputAction: TextInputAction.next, - - validator: (value) { - if (value != null && value.isEmpty) { - return TranslationBase.of(context) - .pleaseEnterYourID; - } - return null; - }, - onSaved: (value) { - if (value != null) userInfo.userID = value.trim(); - }, - onChanged: (value) { - if (value != null) userInfo.userID = value.trim(); - }, - onFieldSubmitted: (_) { - focusPass.nextFocus(); - }, - ) - ])), - buildSizedBox(), - Container( - decoration: BoxDecoration( - borderRadius: BorderRadius.all(Radius.circular(6.0)), - border: Border.all( - width: 1.0, - color: HexColor("#CCCCCC"), - ), - color: Colors.white), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Padding( - padding: EdgeInsets.only(left: 10, top: 10), - child: AppText( - TranslationBase.of(context).enterPassword, - fontWeight: FontWeight.w800, - fontSize: 14, - )), - AppTextFormField( - focusNode: focusPass, - obscureText: true, - borderColor: Colors.white, - textInputAction: TextInputAction.next, - validator: (value) { - if (value != null && value.isEmpty) { - return TranslationBase.of(context) - .pleaseEnterPassword; - } - return null; - }, - onSaved: (value) { - userInfo.password = value; - }, - onFieldSubmitted: (_) { - focusPass.nextFocus(); - Helpers.showCupertinoPicker(context, projectsList, - 'facilityName', onSelectProject); - }, - onTap: () { - this.getProjects(userInfo.userID); - }, - ) - ])), - buildSizedBox(), - projectsList.length > 0 - ? Container( - decoration: BoxDecoration( - borderRadius: BorderRadius.all(Radius.circular(6.0)), - border: Border.all( - width: 1.0, - color: HexColor("#CCCCCC"), - ), - color: Colors.white), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Padding( - padding: EdgeInsets.only(left: 10, top: 10), - child: AppText( - TranslationBase.of(context).selectYourProject, - fontWeight: FontWeight.w600, - )), - AppTextFormField( - focusNode: focusProject, - controller: projectIdController, - borderColor: Colors.white, - suffixIcon: Icons.arrow_drop_down, - onTap: () { - Helpers.showCupertinoPicker( - context, - projectsList, - 'facilityName', - onSelectProject); - }, - validator: (value) { - if (value != null && value.isEmpty) { - return TranslationBase.of(context) - .pleaseEnterYourProject; - } - return null; - }) - ])) - : Container( - decoration: BoxDecoration( - borderRadius: BorderRadius.all(Radius.circular(6.0)), - border: Border.all( - width: 1.0, - color: HexColor("#CCCCCC"), - ), - color: Colors.white), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Padding( - padding: EdgeInsets.only(left: 10, top: 10), - child: AppText( - TranslationBase.of(context).selectYourProject, - fontWeight: FontWeight.w800, - fontSize: 14, - )), - AppTextFormField( - readOnly: true, - borderColor: Colors.white, - prefix: IconButton( - icon: Icon(Icons.arrow_drop_down), - iconSize: 30, - padding: EdgeInsets.only(bottom: 30), - ), - ) - ])), - ]), - ), - Row( - mainAxisAlignment: MainAxisAlignment.end, - children: [ - Expanded( - child: AppButton( - title: TranslationBase.of(context).login, - color: HexColor('#D02127'), - fontWeight: FontWeight.bold, - onPressed: () { - login(context, this.widget.model); - }, - )), - ], - ) - ], - ), - ); - //)); - } - - SizedBox buildSizedBox() { - return SizedBox( - height: 20, - ); - } - - login( - context, - model, - ) { - if (loginFormKey.currentState.validate()) { - loginFormKey.currentState.save(); - sharedPref.setInt(PROJECT_ID, userInfo.projectID); - model.login(userInfo).then((res) { - if (model.loginInfo['MessageStatus'] == 1) { - saveObjToString(LOGGED_IN_USER, model.loginInfo); - sharedPref.remove(LAST_LOGIN_USER); - sharedPref.setString(TOKEN, model.loginInfo['LogInTokenID']); - Navigator.of(AppGlobal.CONTEX).pushReplacement(MaterialPageRoute( - builder: (BuildContext context) => VerificationMethodsScreen( - password: userInfo.password, - ))); - } - }); - } - } - - Future setSharedPref(key, value) async { - sharedPref.setString(key, value).then((success) { - print("sharedPref.setString" + success.toString()); - }); - } - - getProjectsList(memberID) { - projectsProv.getProjectsList(memberID).then((res) { - if (res['MessageStatus'] == 1) { - projectsList = res['ProjectInfo']; - setState(() { - userInfo.projectID = projectsList[0]["facilityId"]; - projectIdController.text = projectsList[0]['facilityName']; - }); - } else { - print(res); - } - }); - } - - saveObjToString(String key, value) async { - sharedPref.setObj(key, value); - } - - onSelectProject(index) { - setState(() { - userInfo.projectID = projectsList[index]["facilityId"]; - projectIdController.text = projectsList[index]['facilityName']; - }); - - primaryFocus.unfocus(); - } - - getProjects(value) { - if (value != null && value != '') { - if (projectsList.length == 0) { - getProjectsList(value); - } - } - } -} diff --git a/lib/widgets/auth/method_type_card.dart b/lib/widgets/auth/method_type_card.dart new file mode 100644 index 00000000..6d091756 --- /dev/null +++ b/lib/widgets/auth/method_type_card.dart @@ -0,0 +1,62 @@ +import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart'; +import 'package:flutter/material.dart'; +import 'package:hexcolor/hexcolor.dart'; + +class MethodTypeCard extends StatelessWidget { + const MethodTypeCard({ + Key key, + this.assetPath, + this.onTap, + this.label, this.height = 20, + }) : super(key: key); + final String assetPath; + final Function onTap; + final String label; + final double height; + + @override + Widget build(BuildContext context) { + return InkWell( + onTap: onTap, + child: Container( + margin: EdgeInsets.all(10), + decoration: BoxDecoration( + color: Colors.white, + borderRadius: BorderRadius.all( + Radius.circular(10), + ), + border: Border.all( + color: HexColor('#707070'), + width: 0.1), + ), + height: 170, + child: Padding( + padding: EdgeInsets.fromLTRB(20, 15, 20, 15), + child: Column( + mainAxisAlignment: MainAxisAlignment.center, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Row( + children: [ + Image.asset( + assetPath, + height: 60, + width: 60, + ), + ], + ), + SizedBox( + height:height , + ), + AppText( + label, + fontSize: 14, + color: Color(0xFF2E303A), + fontWeight: FontWeight.bold, + ) + ], + ), + )), + ); + } +} diff --git a/lib/widgets/auth/show_timer_text.dart b/lib/widgets/auth/show_timer_text.dart deleted file mode 100644 index a418e1b5..00000000 --- a/lib/widgets/auth/show_timer_text.dart +++ /dev/null @@ -1,105 +0,0 @@ -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/viewModel/auth_view_model.dart'; -import 'package:doctor_app_flutter/routes.dart'; -import 'package:doctor_app_flutter/util/helpers.dart'; -import 'package:flutter/material.dart'; -import 'package:hexcolor/hexcolor.dart'; -import 'package:provider/provider.dart'; -Helpers helpers = Helpers(); - -class ShowTimerText extends StatefulWidget { - ShowTimerText({Key key, this.model}); - final model; - - @override - _ShowTimerTextState createState() => _ShowTimerTextState(); -} - -class _ShowTimerTextState extends State { - String timerText = (TIMER_MIN - 1).toString() + ':59'; - int min = TIMER_MIN - 1; - int sec = 59; - Timer _timer; - - AuthViewModel authProv; - - resendCode() { - min = TIMER_MIN - 1; - sec = 59; - _timer = Timer.periodic(Duration(seconds: 1), (Timer timer) { - if (min <= 0 && sec <= 0) { - timer.cancel(); - } else { - setState(() { - sec = sec - 1; - if (sec == 0 && min == 0) { - Navigator.of(context).pushNamed(LOGIN); - - min = 0; - sec = 0; - } else if (sec == 0) { - min = min - 1; - sec = 59; - } - timerText = min.toString() + ':' + sec.toString(); - }); - } - }); - } - - @override - void initState() { - super.initState(); - resendCode(); - } - - @override - void dispose() { - _timer.cancel(); - super.dispose(); - } - - @override - Widget build(BuildContext context) { - authProv = Provider.of(context); - return Center( - child: Row( - mainAxisAlignment: MainAxisAlignment.center, - children: [ - InkWell( - onTap: min != 0 || sec != 0 - ? null - : () { - resendActivatioinCode(); - }, - child: Text( - timerText, - style: TextStyle( - fontSize: 3.0 * SizeConfig.textMultiplier, - color: HexColor('#B8382C'), - fontWeight: FontWeight.bold), - ), - ), - ], - ), - ); - } - - resendActivatioinCode() { - authProv - .sendActivationCodeByOtpNotificationType(widget.model) - .then((res) => { - // print('$value') - if (res['MessageStatus'] == 1) - {resendCode()} - else - {Helpers.showErrorToast(res['ErrorEndUserMessage'])} - }) - .catchError((err) { - Helpers.showErrorToast(); - }); - } -} diff --git a/lib/widgets/otp/sms-popup.dart b/lib/widgets/auth/sms-popup.dart similarity index 92% rename from lib/widgets/otp/sms-popup.dart rename to lib/widgets/auth/sms-popup.dart index 0c34e67d..0c374e58 100644 --- a/lib/widgets/otp/sms-popup.dart +++ b/lib/widgets/auth/sms-popup.dart @@ -1,15 +1,16 @@ 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'; 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 type; + final AuthMethodTypes type; final mobileNo; final Function onSuccess; final Function onFailure; @@ -17,12 +18,6 @@ class SMSOTP { int remainingTime = 600; - Future timer; - - static BuildContext _context; - - static bool _loading; - SMSOTP( this.context, this.type, @@ -60,9 +55,6 @@ class SMSOTP { projectProvider = Provider.of(context); return AlertDialog( contentPadding: EdgeInsets.fromLTRB(24.0, 0.0, 0.0, 24.0), - - // shape: RoundedRectangleBorder( - // borderRadius: BorderRadius.all(Radius.circular(10.0))), content: StatefulBuilder(builder: (context, setState) { if (displayTime == '') { startTimer(setState); @@ -81,7 +73,7 @@ class SMSOTP { child: Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ - type == 1 + type == AuthMethodTypes.SMS ? Padding( child: Icon( DoctorApp.verify_sms_1, @@ -287,8 +279,6 @@ class SMSOTP { InputDecoration buildInputDecoration(BuildContext context) { return InputDecoration( counterText: " ", - // ts/images/password_icon.png - // contentPadding: EdgeInsets.only(top: 20, bottom: 20), enabledBorder: OutlineInputBorder( borderRadius: BorderRadius.all(Radius.circular(10)), borderSide: BorderSide(color: Colors.grey[300]), @@ -308,6 +298,7 @@ class SMSOTP { ); } + // ignore: missing_return String validateCodeDigit(value) { if (value.isEmpty) { return ' '; @@ -318,13 +309,14 @@ class SMSOTP { } } - checkValue() { - //print(verifyAccountFormValue); + checkValue() async { if (verifyAccountForm.currentState.validate()) { onSuccess(digit1.text.toString() + digit2.text.toString() + digit3.text.toString() + digit4.text.toString()); + this.isClosed = true; + } } @@ -349,42 +341,14 @@ class SMSOTP { displayTime = this.getSecondsAsDigitalClock(this.remainingTime); }); - timer = Future.delayed(Duration(seconds: 1), () { + Future.delayed(Duration(seconds: 1), () { if (this.remainingTime > 0) { - if (isClosed == false) startTimer(setState); + if (isClosed == false) { + startTimer(setState); + } } else { Navigator.pop(context); } }); } - - static void showLoadingDialog(BuildContext context, bool _loading) async { - _context = context; - - if (_loading == false) { - Navigator.of(context).pop(); - return; - } - _loading = true; - await showDialog( - context: _context, - barrierDismissible: false, - builder: (BuildContext context) { - return SimpleDialog( - elevation: 0.0, - backgroundColor: Colors.transparent, - children: [ - Center( - child: CircularProgressIndicator( - valueColor: AlwaysStoppedAnimation(Colors.black), - ), - ) - ], - ); - }); - } - - static void hideSMSBox(context) { - Navigator.pop(context); - } } diff --git a/lib/widgets/auth/verfiy_account.dart b/lib/widgets/auth/verfiy_account.dart deleted file mode 100644 index 1574d3d4..00000000 --- a/lib/widgets/auth/verfiy_account.dart +++ /dev/null @@ -1,386 +0,0 @@ -import 'dart:async'; - -import 'package:doctor_app_flutter/config/shared_pref_kay.dart'; -import 'package:doctor_app_flutter/models/auth/check_activation_code_request_model.dart'; -import 'package:doctor_app_flutter/models/doctor/clinic_model.dart'; -import 'package:doctor_app_flutter/models/doctor/doctor_profile_model.dart'; -import 'package:doctor_app_flutter/models/doctor/profile_req_Model.dart'; -import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; -import 'package:doctor_app_flutter/widgets/auth/show_timer_text.dart'; -import 'package:flutter/material.dart'; -import 'package:hexcolor/hexcolor.dart'; -import 'package:provider/provider.dart'; - -import '../../config/size_config.dart'; -import '../../core/viewModel/auth_view_model.dart'; -import '../../routes.dart'; -import '../../util/dr_app_shared_pref.dart'; -import '../../util/dr_app_toast_msg.dart'; -import '../../util/helpers.dart'; -import '../../widgets/shared/dr_app_circular_progress_Indeicator.dart'; - -DrAppSharedPreferances sharedPref = new DrAppSharedPreferances(); -Helpers helpers = Helpers(); - -class VerifyAccount extends StatefulWidget { - VerifyAccount({this.changeLoadingStata}); - - final Function changeLoadingStata; - - @override - _VerifyAccountState createState() => _VerifyAccountState(); -} - -class _VerifyAccountState extends State { - final verifyAccountForm = GlobalKey(); - Map verifyAccountFormValue = { - 'digit1': null, - 'digit2': null, - 'digit3': null, - 'digit4': null, - }; - Future _loggedUserFuture; - var _loggedUser; - AuthViewModel authProv; - bool _isInit = true; - var model; - TextEditingController digit1 = TextEditingController(text: ""); - TextEditingController digit2 = TextEditingController(text: ""); - TextEditingController digit3 = TextEditingController(text: ""); - TextEditingController digit4 = TextEditingController(text: ""); - - @override - void initState() { - super.initState(); - _loggedUserFuture = getSharedPref(); - } - - Future getSharedPref() async { - sharedPref.getObj(LOGGED_IN_USER).then((userInfo) { - _loggedUser = userInfo; - }); - } - - @override - void didChangeDependencies() { - super.didChangeDependencies(); - if (_isInit) { - authProv = Provider.of(context); - final routeArgs = ModalRoute.of(context).settings.arguments as Map; - model = routeArgs['model']; - } - _isInit = false; - } - - @override - Widget build(BuildContext context) { - authProv = Provider.of(context); - final focusD1 = FocusNode(); - final focusD2 = FocusNode(); - final focusD3 = FocusNode(); - final focusD4 = FocusNode(); - return FutureBuilder( - future: Future.wait([_loggedUserFuture]), - builder: (BuildContext context, AsyncSnapshot snapshot) { - switch (snapshot.connectionState) { - case ConnectionState.waiting: - return DrAppCircularProgressIndeicator(); - default: - if (snapshot.hasError) { - DrAppToastMsg.showErrorToast('Error: ${snapshot.error}'); - return Text('Error: ${snapshot.error}'); - } else { - return Form( - key: verifyAccountForm, - child: Container( - width: SizeConfig.realScreenWidth * 0.95, - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - buildSizedBox(30), - Row( - mainAxisAlignment: - MainAxisAlignment.spaceAround, - children: [ - Container( - width: SizeConfig.realScreenWidth * 0.20, - child: TextFormField( - textInputAction: TextInputAction.next, - style: buildTextStyle(), - autofocus: true, - maxLength: 1, - controller: digit1, - textAlign: TextAlign.center, - keyboardType: TextInputType.number, - decoration: buildInputDecoration(context), - onSaved: (val) { - verifyAccountFormValue['digit1'] = val; - }, - validator: validateCodeDigit, - onFieldSubmitted: (_) { - FocusScope.of(context) - .requestFocus(focusD2); - }, - onChanged: (val) { - if (val.length == 1) { - FocusScope.of(context) - .requestFocus(focusD2); - } - }, - ), - ), - Container( - width: SizeConfig.realScreenWidth * 0.20, - child: TextFormField( - focusNode: focusD2, - controller: digit2, - textInputAction: TextInputAction.next, - maxLength: 1, - textAlign: TextAlign.center, - style: buildTextStyle(), - keyboardType: TextInputType.number, - decoration: - buildInputDecoration(context), - onSaved: (val) { - verifyAccountFormValue['digit2'] = - val; - }, - onFieldSubmitted: (_) { - FocusScope.of(context) - .requestFocus(focusD3); - }, - onChanged: (val) { - if (val.length == 1) { - FocusScope.of(context) - .requestFocus(focusD3); - } - }, - validator: validateCodeDigit), - ), - Container( - width: SizeConfig.realScreenWidth * 0.20, - child: TextFormField( - focusNode: focusD3, - controller: digit3, - textInputAction: TextInputAction.next, - maxLength: 1, - textAlign: TextAlign.center, - style: buildTextStyle(), - keyboardType: TextInputType.number, - decoration: - buildInputDecoration(context), - onSaved: (val) { - verifyAccountFormValue['digit3'] = - val; - }, - onFieldSubmitted: (_) { - FocusScope.of(context) - .requestFocus(focusD4); - }, - onChanged: (val) { - if (val.length == 1) { - FocusScope.of(context) - .requestFocus(focusD4); - } - }, - validator: validateCodeDigit)), - Container( - width: SizeConfig.realScreenWidth * 0.20, - child: TextFormField( - focusNode: focusD4, - controller: digit4, - maxLength: 1, - textAlign: TextAlign.center, - style: buildTextStyle(), - keyboardType: TextInputType.number, - decoration: - buildInputDecoration(context), - onSaved: (val) { - verifyAccountFormValue['digit4'] = - val; - }, - validator: validateCodeDigit)) - ], - ), - buildSizedBox(20), - buildText(), - buildSizedBox(40), - RaisedButton( - onPressed: () { - verifyAccount( - authProv, widget.changeLoadingStata); - }, - elevation: 0.0, - child: Container( - width: double.infinity, - height: 50, - child: Center( - child: Text( - TranslationBase.of(context).verify, - style: TextStyle( - color: Colors.white, - fontSize: - 3 * SizeConfig.textMultiplier), - ), - ), - ), - shape: RoundedRectangleBorder( - borderRadius: BorderRadius.circular(10), - side: BorderSide( - width: 0.5, - color: HexColor('#CCCCCC'))), - ), - buildSizedBox(20), - ShowTimerText(model: model), - buildSizedBox(10), - ]))); - } - } - }); - } - - TextStyle buildTextStyle() { - return TextStyle( - fontSize: SizeConfig.textMultiplier * 3, - ); - } - - String validateCodeDigit(value) { - if (value.isEmpty) { - return 'Please enter your Password'; - } - - return null; - } - - InputDecoration buildInputDecoration(BuildContext context) { - return InputDecoration( - contentPadding: EdgeInsets.only(top: 30, bottom: 30), - enabledBorder: OutlineInputBorder( - borderRadius: BorderRadius.all(Radius.circular(10)), - borderSide: BorderSide(color: Colors.black), - ), - focusedBorder: OutlineInputBorder( - borderRadius: BorderRadius.all(Radius.circular(10.0)), - borderSide: BorderSide(color: Theme.of(context).primaryColor), - ), - errorBorder: OutlineInputBorder( - borderRadius: BorderRadius.all(Radius.circular(10.0)), - borderSide: BorderSide(color: Theme.of(context).errorColor), - ), - focusedErrorBorder: OutlineInputBorder( - borderRadius: BorderRadius.all(Radius.circular(10.0)), - borderSide: BorderSide(color: Theme.of(context).errorColor), - ), - ); - } - - RichText buildText() { - String medthodName; - switch (model['OTP_SendType']) { - case 1: - medthodName = TranslationBase.of(context).smsBy; - break; - case 2: - medthodName = TranslationBase.of(context).whatsAppBy; - break; - default: - } - var text = RichText( - text: new TextSpan( - style: new TextStyle( - fontSize: 3.0 * SizeConfig.textMultiplier, color: Colors.black), - children: [ - new TextSpan(text: TranslationBase.of(context).youWillReceiveA), - new TextSpan( - text: TranslationBase.of(context).loginCode, - style: TextStyle(fontWeight: FontWeight.w700)), - new TextSpan(text: ' ${medthodName},'), - TextSpan(text: TranslationBase.of(context).pleaseEnterTheCode) - ])); - return text; - } - - SizedBox buildSizedBox([double height = 20]) { - return SizedBox( - height: height, - ); - } - - verifyAccount(AuthViewModel authProv, Function changeLoadingStata) async { - if (verifyAccountForm.currentState.validate()) { - changeLoadingStata(true); - - verifyAccountForm.currentState.save(); - final activationCode = verifyAccountFormValue['digit1'] + - verifyAccountFormValue['digit2'] + - verifyAccountFormValue['digit3'] + - verifyAccountFormValue['digit4']; - - CheckActivationCodeRequestModel checkActivationCodeForDoctorApp = - new CheckActivationCodeRequestModel( - zipCode: _loggedUser['ZipCode'], - mobileNumber: _loggedUser['MobileNumber'], - projectID: await sharedPref.getInt(PROJECT_ID), - logInTokenID: await sharedPref.getString(LOGIN_TOKEN_ID), - activationCode: activationCode, - generalid: "Cs2020@2016\$2958"); - - authProv - .checkActivationCodeForDoctorApp(checkActivationCodeForDoctorApp) - .then((res) async { - if (res['MessageStatus'] == 1) { - sharedPref.setString(TOKEN, res['AuthenticationTokenID']); - if (res['List_DoctorProfile'] != null) { - loginProcessCompleted( - res['List_DoctorProfile'][0], changeLoadingStata); - } else { - ClinicModel clinic = - ClinicModel.fromJson(res['List_DoctorsClinic'][0]); - getDocProfiles(clinic, changeLoadingStata); - } - } else { - changeLoadingStata(false); - Helpers.showErrorToast(res['ErrorEndUserMessage']); - } - }).catchError((err) { - changeLoadingStata(false); - Helpers.showErrorToast(err); - }); - } - } - - loginProcessCompleted( - Map profile, Function changeLoadingStata) { - var doctor = DoctorProfileModel.fromJson(profile); - authProv.setDoctorProfile(doctor); - sharedPref.setObj(DOCTOR_PROFILE, profile); - this.getDashboard(doctor, changeLoadingStata); - } - - getDashboard(doctor, Function changeLoadingStata) { - changeLoadingStata(false); - Navigator.of(context).pushReplacementNamed(HOME); - } - - getDocProfiles(ClinicModel clinicInfo, Function changeLoadingStata) { - ProfileReqModel docInfo = new ProfileReqModel( - doctorID: clinicInfo.doctorID, - clinicID: clinicInfo.clinicID, - license: true, - projectID: clinicInfo.projectID, - tokenID: '', - languageID: 2); - authProv.getDocProfiles(docInfo.toJson()).then((res) { - if (res['MessageStatus'] == 1) { - loginProcessCompleted(res['DoctorProfileList'][0], changeLoadingStata); - } else { - changeLoadingStata(false); - Helpers.showErrorToast(res['ErrorEndUserMessage']); - } - }).catchError((err) { - changeLoadingStata(false); - Helpers.showErrorToast(err); - }); - } -} diff --git a/lib/widgets/auth/verification_methods.dart b/lib/widgets/auth/verification_methods.dart deleted file mode 100644 index 2d8c4199..00000000 --- a/lib/widgets/auth/verification_methods.dart +++ /dev/null @@ -1,869 +0,0 @@ -import 'dart:io' show Platform; - -import 'package:doctor_app_flutter/config/shared_pref_kay.dart'; -import 'package:doctor_app_flutter/core/model/auth/imei_details.dart'; -import 'package:doctor_app_flutter/core/viewModel/project_view_model.dart'; -import 'package:doctor_app_flutter/models/auth/activation_Code_req_model.dart'; -import 'package:doctor_app_flutter/models/auth/check_activation_code_request_model.dart'; -import 'package:doctor_app_flutter/models/auth/send_activation_code_model2.dart'; -import 'package:doctor_app_flutter/models/doctor/clinic_model.dart'; -import 'package:doctor_app_flutter/models/doctor/doctor_profile_model.dart'; -import 'package:doctor_app_flutter/models/doctor/profile_req_Model.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/otp/sms-popup.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/transitions/fade_page.dart'; -import 'package:flutter/material.dart'; -import 'package:flutter/services.dart'; -import 'package:intl/intl.dart'; -import 'package:local_auth/auth_strings.dart'; -import 'package:local_auth/local_auth.dart'; -import 'package:provider/provider.dart'; - -import '../../config/size_config.dart'; -import '../../core/viewModel/auth_view_model.dart'; -import '../../landing_page.dart'; -import '../../routes.dart'; -import '../../util/dr_app_shared_pref.dart'; -import '../../util/helpers.dart'; -import '../../widgets/shared/dr_app_circular_progress_Indeicator.dart'; - -DrAppSharedPreferances sharedPref = new DrAppSharedPreferances(); -Helpers helpers = Helpers(); - -/* - *@author: Elham Rababah - *@Date:4/7/2020 - *@param: - *@return: - *@desc: Verification Methods widget - */ -class VerificationMethods extends StatefulWidget { - VerificationMethods({this.changeLoadingStata, this.password}); - - final password; - final Function changeLoadingStata; - - @override - _VerificationMethodsState createState() => _VerificationMethodsState(); -} - -class _VerificationMethodsState extends State { - MainAxisAlignment spaceBetweenMethods = MainAxisAlignment.spaceBetween; - Future _loggedUserFuture; - var _loggedUser; - var verificationMethod; - GetIMEIDetailsModel user; - final LocalAuthentication auth = LocalAuthentication(); - var _availableBiometrics; - ProjectViewModel projectsProvider; - var isMoreOption = false; - var onlySMSBox = false; - static BuildContext _context; - var loginTokenID; - - bool authenticated; - - var fingrePrintBefore; - - var selectedOption; - - @override - void initState() { - super.initState(); - _loggedUserFuture = getSharedPref(); - _getAvailableBiometrics(); - } - - Future getSharedPref() async { - sharedPref.getObj(LOGGED_IN_USER).then((userInfo) { - _loggedUser = userInfo; - }); - sharedPref.getObj(LAST_LOGIN_USER).then((lastLogin) { - if (lastLogin != null) { - user = GetIMEIDetailsModel.fromJson(lastLogin); - } - }); - - print(user); - } - - @override - void didChangeDependencies() { - super.didChangeDependencies(); - final routeArgs = ModalRoute.of(context).settings.arguments as Map; - verificationMethod = - routeArgs != null ? routeArgs['verificationMethod'] : null; - } - - @override - Widget build(BuildContext context) { - AuthViewModel authProv = Provider.of(context); - projectsProvider = Provider.of(context); - return FutureBuilder( - future: Future.wait([_loggedUserFuture]), - builder: (BuildContext context, AsyncSnapshot snapshot) { - switch (snapshot.connectionState) { - case ConnectionState.waiting: - return DrAppCircularProgressIndeicator(); - default: - if (snapshot.hasError) { - Helpers.showErrorToast('Error: ${snapshot.error}'); - return Text('Error: ${snapshot.error}'); - } else { - return SingleChildScrollView( - child: Container( - height: SizeConfig.realScreenHeight * .9, - width: SizeConfig.realScreenWidth, - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - Container( - child: Column( - children: [ - user != null && isMoreOption == false - ? Column( - mainAxisAlignment: - MainAxisAlignment.spaceEvenly, - crossAxisAlignment: - CrossAxisAlignment.start, - children: [ - AppText(TranslationBase.of(context) - .welcomeBack), - AppText( - Helpers.capitalize(user.doctorName), - fontSize: - SizeConfig.textMultiplier * 3.5, - fontWeight: FontWeight.bold, - ), - SizedBox( - height: 20, - ), - AppText( - TranslationBase.of(context).accountInfo, - fontSize: - SizeConfig.textMultiplier * 2.5, - fontWeight: FontWeight.w600, - ), - SizedBox( - height: 20, - ), - Card( - color: Colors.white, - child: Row( - children: [ - Flexible( - flex: 3, - child: ListTile( - title: Text( - TranslationBase.of( - context) - .lastLoginAt, - overflow: TextOverflow - .ellipsis, - style: TextStyle( - fontFamily: - 'Poppins', - fontWeight: - FontWeight.w800, - fontSize: 14), - ), - subtitle: AppText( - getType( - user.logInTypeID, - context), - fontSize: 14, - ))), - Flexible( - flex: 2, - child: ListTile( - title: AppText( - user.editedOn != null - ? getDate(AppDateUtils - .convertStringToDate( - user - .editedOn)) - : user.createdOn != - null - ? getDate(AppDateUtils - .convertStringToDate( - user.createdOn)) - : '--', - textAlign: - TextAlign.right, - fontSize: 14, - fontWeight: - FontWeight.w800, - ), - subtitle: AppText( - user.editedOn != null - ? getTime(AppDateUtils - .convertStringToDate( - user - .editedOn)) - : user.createdOn != - null - ? getTime(AppDateUtils - .convertStringToDate( - user.createdOn)) - : '--', - textAlign: - TextAlign.right, - fontSize: 14, - ), - )) - ], - )), - ], - ) - : Column( - mainAxisAlignment: - MainAxisAlignment.spaceEvenly, - crossAxisAlignment: - CrossAxisAlignment.start, - children: [ - this.onlySMSBox == false - ? AppText( - TranslationBase.of(context) - .verifyLoginWith, - fontSize: - SizeConfig.textMultiplier * - 3.5, - textAlign: TextAlign.left, - ) - : AppText( - TranslationBase.of(context) - .verifyFingerprint2, - fontSize: - SizeConfig.textMultiplier * - 2.5, - textAlign: TextAlign.start, - ), - ]), - user != null && isMoreOption == false - ? Column( - mainAxisAlignment: MainAxisAlignment.start, - crossAxisAlignment: - CrossAxisAlignment.start, - children: [ - Row( - mainAxisAlignment: - MainAxisAlignment.center, - children: [ - // Expanded( - // child: - // getButton(3, authProv)), - // Expanded( - // child: getButton(4, authProv)) - Expanded( - child: InkWell( - onTap: () => { - authenticateUser(3, - true, authProv) - }, - child: getButton( - user.logInTypeID, - authProv))), - Expanded( - child: getButton(5, authProv)) - ]), - ]) - : Column( - mainAxisAlignment: MainAxisAlignment.start, - crossAxisAlignment: - CrossAxisAlignment.start, - children: [ - onlySMSBox == false - ? Row( - mainAxisAlignment: - MainAxisAlignment.center, - children: [ - Expanded( - child: getButton( - 3, authProv)), - Expanded( - child: getButton( - 4, authProv)) - ], - ) - : SizedBox(), - Row( - mainAxisAlignment: - MainAxisAlignment.center, - children: [ - Expanded( - child: getButton(1, authProv)), - Expanded( - child: getButton(2, authProv)) - ], - ), - ]), - - // ) - ], - ), - ), - Column( - mainAxisAlignment: MainAxisAlignment.end, - children: [ - user != null - ? Row( - children: [ - Expanded( - child: AppButton( - title: TranslationBase.of(context) - .useAnotherAccount, - color: Colors.red[700], - onPressed: () { - Navigator.of(context).pushNamed(LOGIN); - }, - )), - ], - ) - : SizedBox(), - ], - ), - ], - ), - )); - } - } - }); - } - - bool hideSilentMethods() { - return verificationMethod == 4 || verificationMethod == 3 ? true : false; - } - - sendActivationCodeByOtpNotificationType( - oTPSendType, AuthViewModel authProv) async { - // TODO : build enum for verfication method - if (oTPSendType == 1 || oTPSendType == 2) { - widget.changeLoadingStata(true); - int projectID = await sharedPref.getInt(PROJECT_ID); - ActivationCodeModel activationCodeModel = ActivationCodeModel( - facilityId: projectID, - memberID: _loggedUser['List_MemberInformation'][0]['MemberID'], - zipCode: _loggedUser['ZipCode'], - mobileNumber: _loggedUser['MobileNumber'], - otpSendType: oTPSendType.toString(), - password: widget.password); - - try { - authProv - .sendActivationCodeForDoctorApp(activationCodeModel) - .then((res) { - if (res['MessageStatus'] == 1) { - print("VerificationCode : " + res["VerificationCode"]); - sharedPref.setString(VIDA_AUTH_TOKEN_ID, res["VidaAuthTokenID"]); - sharedPref.setString( - VIDA_REFRESH_TOKEN_ID, res["VidaRefreshTokenID"]); - sharedPref.setString(LOGIN_TOKEN_ID, res["LogInTokenID"]); - sharedPref.setString(PASSWORD, widget.password); - this.startSMSService(oTPSendType, authProv); - } else { - print(res['ErrorEndUserMessage']); - Helpers.showErrorToast(res['ErrorEndUserMessage']); - } - }).catchError((err) { - print('$err'); - widget.changeLoadingStata(false); - - Helpers.showErrorToast(); - }); - } catch (e) {} - } else { - // TODO route to this page with parameters to inicate we should present 2 option - if (Platform.isAndroid && oTPSendType == 3) { - Helpers.showErrorToast('Your device not support this feature'); - } else { - // Navigator.of(context).push(MaterialPageRoute( - // builder: (BuildContext context) => - // VerificationMethodsScreen(password: widget.password,))); - - // Navigator.of(context).pushNamed(VERIFICATION_METHODS, - // arguments: {'verificationMethod': oTPSendType}); - } - } - } - - sendActivationCodeVerificationScreen( - oTPSendType, AuthViewModel authProv) async { - // TODO : build enum for verfication method - //if (oTPSendType == 1 || oTPSendType == 2) { - widget.changeLoadingStata(true); - ActivationCodeModel2 activationCodeModel = ActivationCodeModel2( - iMEI: user.iMEI, - facilityId: user.projectID, - memberID: user.doctorID, - zipCode: user.outSA == true ? '971' : '966', - mobileNumber: user.mobile, - oTPSendType: oTPSendType, - isMobileFingerPrint: 1, - vidaAuthTokenID: user.vidaAuthTokenID, - vidaRefreshTokenID: user.vidaRefreshTokenID); - - try { - authProv - .sendActivationCodeVerificationScreen(activationCodeModel) - .then((res) { - if (res['MessageStatus'] == 1) { - print("VerificationCode : " + res["VerificationCode"]); - sharedPref.setString(VIDA_AUTH_TOKEN_ID, res["VidaAuthTokenID"]); - sharedPref.setString( - VIDA_REFRESH_TOKEN_ID, res["VidaRefreshTokenID"]); - sharedPref.setString(LOGIN_TOKEN_ID, res["LogInTokenID"]); - if (oTPSendType == 1 || oTPSendType == 2) { - widget.changeLoadingStata(false); - this.startSMSService(oTPSendType, authProv); - } else { - checkActivationCode(authProv); - } - } else { - print(res['ErrorEndUserMessage']); - Helpers.showErrorToast(res['ErrorEndUserMessage']); - } - }).catchError((err) { - print('$err'); - widget.changeLoadingStata(false); - - Helpers.showErrorToast(); - }); - } catch (e) {} - // } - // else { - // checkActivationCode(authProv); - // } - } - - Widget getButton(flag, authProv) { - switch (flag) { - case 2: - return InkWell( - onTap: () => {authenticateUser(2, true, authProv)}, - child: Container( - margin: EdgeInsets.all(10), - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(10), - color: Colors.white, - ), - child: Padding( - padding: EdgeInsets.fromLTRB(20, 15, 20, 15), - child: Column( - mainAxisAlignment: MainAxisAlignment.center, - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Row( - children: [ - Image.asset( - 'assets/images/verify-whtsapp.png', - height: 60, - width: 60, - ), - ], - ), - SizedBox( - height: 20, - ), - AppText( - TranslationBase.of(context).verifyWhatsApp, - fontSize: 14, - fontWeight: FontWeight.w600, - ) - ], - ), - ))); - break; - case 1: - return InkWell( - onTap: () => {authenticateUser(1, true, authProv)}, - child: Container( - margin: EdgeInsets.all(10), - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(10), - color: Colors.white, - ), - child: Padding( - padding: EdgeInsets.fromLTRB(20, 15, 20, 15), - child: Column( - mainAxisAlignment: MainAxisAlignment.center, - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Image.asset( - 'assets/images/verify-sms.png', - height: 60, - width: 60, - ), - projectsProvider.isArabic - ? SizedBox( - height: 20, - ) - : SizedBox( - height: 20, - ), - AppText( - TranslationBase.of(context).verifySMS, - fontSize: 14, - fontWeight: FontWeight.w600, - ) - ], - ), - ))); - break; - case 3: - return InkWell( - onTap: () => { - if (checkIfBiometricAvailable(BiometricType.fingerprint)) - {authenticateUser(3, true, authProv)} - }, - child: Container( - margin: EdgeInsets.all(10), - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(10), - color: Colors.white, - ), - child: Padding( - padding: EdgeInsets.fromLTRB(20, 15, 20, 15), - child: Column( - mainAxisAlignment: MainAxisAlignment.center, - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Image.asset( - 'assets/images/verification_fingerprint_icon.png', - height: 60, - width: 60, - ), - SizedBox( - height: 20, - ), - AppText( - TranslationBase.of(context).verifyFingerprint, - fontSize: 14, - fontWeight: FontWeight.w600, - ) - ], - ), - ))); - break; - case 4: - return InkWell( - onTap: () { - if (checkIfBiometricAvailable(BiometricType.face)) { - authenticateUser(4, true, authProv); - } - }, - child: - // RoundedContainer( - // backgroundColor: checkIfBiometricAvailable(BiometricType.face) - // ? Colors.white - // : Colors.white.withOpacity(.7), - // borderColor: Colors.grey, - // showBorder: false, - Container( - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(10), - color: Colors.white, - ), - margin: EdgeInsets.all(10), - child: Padding( - padding: EdgeInsets.fromLTRB(20, 15, 20, 15), - child: Column( - mainAxisAlignment: MainAxisAlignment.center, - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Image.asset( - 'assets/images/verification_faceid_icon.png', - height: 60, - width: 60, - ), - SizedBox( - height: 20, - ), - AppText( - TranslationBase.of(context).verifyFaceID, - fontSize: 14, - fontWeight: FontWeight.w600, - ) - ], - ), - ))); - break; - - default: - return InkWell( - onTap: () => { - setState(() { - isMoreOption = true; - }) - }, - child: Container( - // backgroundColor: Colors.white, - // borderColor: Colors.grey, - // showBorder: false, - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(10), - color: Colors.white, - ), - child: Padding( - padding: EdgeInsets.fromLTRB(20, 15, 20, 15), - child: Column( - mainAxisAlignment: MainAxisAlignment.center, - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Image.asset( - 'assets/images/login/more_icon.png', - height: 60, - width: 60, - ), - projectsProvider.isArabic - ? SizedBox( - height: 20, - ) - : SizedBox( - height: 10, - ), - AppText( - TranslationBase.of(context).moreVerification, - fontSize: 14, - fontWeight: FontWeight.w600, - // textAlign: TextAlign.center, - ) - ], - ), - ))); - } - } - - getType(type, context) { - switch (type) { - case 1: - return TranslationBase.of(context).verifySMS; - break; - case 3: - return TranslationBase.of(context).verifyFingerprint; - break; - case 4: - return TranslationBase.of(context).verifyFaceID; - break; - case 2: - return TranslationBase.of(context).verifyWhatsApp; - break; - default: - return TranslationBase.of(context).verifySMS; - break; - } - } - - bool checkIfBiometricAvailable(BiometricType biometricType) { - bool isAvailable = false; - if (_availableBiometrics != null) { - for (var i = 0; i < _availableBiometrics.length; i++) { - if (biometricType == _availableBiometrics[i]) isAvailable = true; - } - } - return isAvailable; - } - - formatDate(date) { - return DateFormat('MMM dd, yyy, kk:mm').format(date); - } - - authenticateUser(type, isActive, authProv) { - //GifLoaderDialogUtils.showMyDialog(context); - if (type == 3 || type == 4) { - fingrePrintBefore = type; - } - this.selectedOption = fingrePrintBefore != null ? fingrePrintBefore : type; - - switch (type) { - case 1: - this.loginWithSMS(1, isActive, authProv); - break; - case 2: - this.loginWithSMS(2, isActive, authProv); - - break; - case 3: - this.loginWithFingurePrintFace(3, isActive, authProv); - break; - case 4: - this.loginWithFingurePrintFace(4, isActive, authProv); - break; - default: - break; - } - sharedPref.setInt(OTP_TYPE, selectedOption); - // sharedPref.setInt(LAST_LOGIN), - } - - loginWithSMS(type, isActive, authProv) { - this.sendActivationCode(type, authProv); - } - - Future _getAvailableBiometrics() async { - var availableBiometrics; - try { - availableBiometrics = await auth.getAvailableBiometrics(); - } on PlatformException catch (e) { - print(e); - } - if (!mounted) return; - - setState(() { - _availableBiometrics = availableBiometrics; - }); - } - - sendActivationCode(type, authProv) async { - if (user != null) { - sendActivationCodeVerificationScreen(type, authProv); - } else { - sendActivationCodeByOtpNotificationType(type, authProv); - } - } - - startSMSService(type, authProv) { - new SMSOTP( - context, - type, - _loggedUser != null ? _loggedUser['MobileNumber'] : user.mobile, - (value) { - showDialog( - context: context, - builder: (BuildContext context) { - return Center( - child: CircularProgressIndicator(), - ); - }); - - this.checkActivationCode(authProv, value: value); - }, - () => { - widget.changeLoadingStata(false), - print('Faild..'), - }, - ).displayDialog(context); - } - - loginWithFingurePrintFace(type, isActive, authProv) async { - if (isActive) { - // this.startBiometricLoginIfAvailable(); - - const iosStrings = const IOSAuthMessages( - cancelButton: 'cancel', - goToSettingsButton: 'settings', - goToSettingsDescription: 'Please set up your Touch ID.', - lockOut: 'Please reenable your Touch ID'); - - try { - authenticated = await auth.authenticateWithBiometrics( - localizedReason: 'Scan your fingerprint to authenticate', - useErrorDialogs: true, - stickyAuth: true, - iOSAuthStrings: iosStrings); - } on PlatformException catch (e) { - DrAppToastMsg.showErrorToast(e); - } - if (!mounted) return; - if (user != null && (user.logInTypeID == 3 || user.logInTypeID == 4)) { - this.sendActivationCode(type, authProv); - // this.checkActivationCode(authProv); - } else { - setState(() { - this.onlySMSBox = true; - }); - } - } - } - - checkActivationCode(AuthViewModel authProv, {value}) async { - CheckActivationCodeRequestModel checkActivationCodeForDoctorApp = - new CheckActivationCodeRequestModel( - zipCode: - _loggedUser != null ? _loggedUser['ZipCode'] : user.zipCode, - mobileNumber: - _loggedUser != null ? _loggedUser['MobileNumber'] : user.mobile, - projectID: await sharedPref.getInt(PROJECT_ID) != null - ? await sharedPref.getInt(PROJECT_ID) - : user.projectID, - logInTokenID: await sharedPref.getString(LOGIN_TOKEN_ID), - activationCode: value ?? '0000', - oTPSendType: await sharedPref.getInt(OTP_TYPE), - generalid: "Cs2020@2016\$2958"); - - authProv - .checkActivationCodeForDoctorApp(checkActivationCodeForDoctorApp) - .then((res) async { - widget.changeLoadingStata(false); - if (res['MessageStatus'] == 1) { - sharedPref.setString(TOKEN, res['AuthenticationTokenID']); - if (res['List_DoctorProfile'] != null) { - loginProcessCompleted(res['List_DoctorProfile'][0], authProv); - sharedPref.setObj(CLINIC_NAME, res['List_DoctorsClinic']); - } else { - sharedPref.setObj(CLINIC_NAME, res['List_DoctorsClinic']); - ClinicModel clinic = - ClinicModel.fromJson(res['List_DoctorsClinic'][0]); - getDocProfiles(clinic, authProv); - } - } else { - Navigator.pop(context); - Helpers.showErrorToast(res['ErrorEndUserMessage']); - } - }).catchError((err) { - Navigator.pop(context); - Helpers.showErrorToast(err); - }); - } - - loginProcessCompleted(Map profile, authProv) { - var doctor = DoctorProfileModel.fromJson(profile); - authProv.setDoctorProfile(doctor); - sharedPref.setObj(DOCTOR_PROFILE, profile); - projectsProvider.isLogin = true; - - Navigator.pushAndRemoveUntil( - context, - FadePage( - page: LandingPage(), - ), - (r) => false); - } - - getDocProfiles(ClinicModel clinicInfo, authProv) { - ProfileReqModel docInfo = new ProfileReqModel( - doctorID: clinicInfo.doctorID, - clinicID: clinicInfo.clinicID, - license: true, - projectID: clinicInfo.projectID, - tokenID: '', - languageID: 2); - authProv.getDocProfiles(docInfo.toJson()).then((res) { - if (res['MessageStatus'] == 1) { - loginProcessCompleted(res['DoctorProfileList'][0], authProv); - } else { - // changeLoadingStata(false); - Helpers.showErrorToast(res['ErrorEndUserMessage']); - } - }).catchError((err) { - // changeLoadingStata(false); - Helpers.showErrorToast(err); - }); - } - - getDate(DateTime date) { - final DateFormat formatter = DateFormat('dd MMM yyyy'); - - return formatter.format(date); - } - - getTime(DateTime date) { - final DateFormat formatter = DateFormat('HH:mm a'); - - return formatter.format(date); - } -} diff --git a/lib/widgets/auth/verification_methods_list.dart b/lib/widgets/auth/verification_methods_list.dart new file mode 100644 index 00000000..27dbe8bf --- /dev/null +++ b/lib/widgets/auth/verification_methods_list.dart @@ -0,0 +1,96 @@ +import 'package:doctor_app_flutter/core/enum/auth_method_types.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/util/translations_delegate_base.dart'; +import 'package:doctor_app_flutter/widgets/auth/method_type_card.dart'; +import 'package:flutter/material.dart'; +import 'package:local_auth/local_auth.dart'; +import 'package:provider/provider.dart'; + +class VerificationMethodsList extends StatefulWidget { + final AuthMethodTypes authMethodType; + final Function(AuthMethodTypes type, bool isActive) authenticateUser; + final Function onShowMore; + final AuthenticationViewModel authenticationViewModel; + + const VerificationMethodsList( + {Key key, + this.authMethodType, + this.authenticateUser, + this.onShowMore, + this.authenticationViewModel}) + : super(key: key); + + @override + _VerificationMethodsListState createState() => + _VerificationMethodsListState(); +} + +class _VerificationMethodsListState extends State { + final LocalAuthentication auth = LocalAuthentication(); + ProjectViewModel projectsProvider; + + @override + Widget build(BuildContext context) { + projectsProvider = Provider.of(context); + + switch (widget.authMethodType) { + case AuthMethodTypes.WhatsApp: + return MethodTypeCard( + assetPath: 'assets/images/verify-whtsapp.png', + onTap: () => + {widget.authenticateUser(AuthMethodTypes.WhatsApp, true)}, + label: TranslationBase + .of(context) + .verifyWith+ TranslationBase.of(context).verifyWhatsApp, + ); + break; + case AuthMethodTypes.SMS: + return MethodTypeCard( + assetPath: "assets/images/verify-sms.png", + onTap: () => {widget.authenticateUser(AuthMethodTypes.SMS, true)}, + label:TranslationBase + .of(context) + .verifyWith+ TranslationBase.of(context).verifySMS, + ); + break; + case AuthMethodTypes.Fingerprint: + return MethodTypeCard( + assetPath: 'assets/images/verification_fingerprint_icon.png', + onTap: () async { + if (await widget.authenticationViewModel + .checkIfBiometricAvailable(BiometricType.fingerprint)) { + + widget.authenticateUser(AuthMethodTypes.Fingerprint, true); + } + }, + label: TranslationBase + .of(context) + .verifyWith+TranslationBase.of(context).verifyFingerprint, + ); + break; + case AuthMethodTypes.FaceID: + return MethodTypeCard( + assetPath: 'assets/images/verification_faceid_icon.png', + onTap: () async { + if (await widget.authenticationViewModel + .checkIfBiometricAvailable(BiometricType.face)) { + widget.authenticateUser(AuthMethodTypes.FaceID, true); + } + }, + label: TranslationBase + .of(context) + .verifyWith+TranslationBase.of(context).verifyFaceID, + ); + break; + + default: + return MethodTypeCard( + assetPath: 'assets/images/login/more_icon.png', + onTap: widget.onShowMore, + label: TranslationBase.of(context).moreVerification, + height: 0, + ); + } + } +} diff --git a/lib/widgets/dashboard/activity_button.dart b/lib/widgets/dashboard/activity_button.dart index 8258a1df..ff9db962 100644 --- a/lib/widgets/dashboard/activity_button.dart +++ b/lib/widgets/dashboard/activity_button.dart @@ -3,36 +3,41 @@ import 'package:flutter/material.dart'; class GetActivityButton extends StatelessWidget { final value; + GetActivityButton(this.value); + @override Widget build(BuildContext context) { return Container( - width: 120, + width: MediaQuery.of(context).size.height * 0.125, padding: EdgeInsets.all(5), margin: EdgeInsets.all(5), - height: 120, decoration: BoxDecoration( color: Colors.white, - borderRadius: BorderRadius.circular(20), + borderRadius: BorderRadius.circular(15), ), - child: Column( - crossAxisAlignment: CrossAxisAlignment.center, - mainAxisAlignment: MainAxisAlignment.center, - children: [ - Padding( - padding: EdgeInsets.all(10), - child: AppText(value.value.toString(), - fontSize: 32, fontWeight: FontWeight.bold)), - Expanded( - child: AppText( + 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: 12, - textAlign: TextAlign.center, - fontWeight: FontWeight.w600, + fontSize: 10, + color: Color(0xFF2B353E), + textAlign: TextAlign.start, + fontWeight: FontWeight.w700, ), - ), - ], + ], + ), ), ); } diff --git a/lib/widgets/dashboard/out_patient_stack.dart b/lib/widgets/dashboard/out_patient_stack.dart index d5da97c6..fe05d69d 100644 --- a/lib/widgets/dashboard/out_patient_stack.dart +++ b/lib/widgets/dashboard/out_patient_stack.dart @@ -4,7 +4,9 @@ import 'package:flutter/material.dart'; class GetOutPatientStack extends StatelessWidget { final value; + GetOutPatientStack(this.value); + @override Widget build(BuildContext context) { value.summaryoptions @@ -12,57 +14,86 @@ class GetOutPatientStack extends StatelessWidget { var list = new List(); value.summaryoptions.forEach((result) => - {list.add(getStack(result, value.summaryoptions.first.value))}); + {list.add(getStack(result, value.summaryoptions.first.value,context))}); return Column( crossAxisAlignment: CrossAxisAlignment.start, mainAxisAlignment: MainAxisAlignment.spaceEvenly, children: [ - AppText( - value.kPIName, - medium: true, + Container( + height: 30, + child: AppText( + value.kPIName, + medium: true, + fontSize: 14, + ), ), Row(mainAxisAlignment: MainAxisAlignment.spaceEvenly, children: list) ], ); } - getStack(Summaryoptions value, max) { - return Stack(children: [ - Container( - height: 150, - margin: EdgeInsets.all(5), - width: 40, - child: SizedBox(), + getStack(Summaryoptions value, max,context) { + return Expanded( + child: Container( + margin: EdgeInsets.symmetric(horizontal: 2), decoration: BoxDecoration( - borderRadius: BorderRadius.circular(10), color: Colors.red[50]), - ), - Positioned( - bottom: 0, - child: Container( + gradient: LinearGradient( + begin: Alignment.topLeft, + end: Alignment( + 0.0, 1.0), // 10% of the width, so there are ten blinds. + colors: [Color(0x8FF5F6FA), Colors.red[50]], // red to yellow + tileMode: TileMode.mirror, // repeats the gradient over the canvas + ), + borderRadius: BorderRadius.circular(8), + // color: Colors.red[50], + ), + child: Stack(children: [ + Positioned( + bottom: 0, + left: 0, + right: 0, + child: Container( child: SizedBox(), - margin: EdgeInsets.all(5), padding: EdgeInsets.all(10), - height: max != 0 ? (150 * value.value) / max : 0, - width: 40, + height: max != 0 ? ((MediaQuery.of(context).size.height * 0.24 )* value.value) / max : 0, decoration: BoxDecoration( - borderRadius: BorderRadius.circular(10), - color: Colors.red[300]))), - Container( - height: 150, - margin: EdgeInsets.only(left: 5, top: 5), - padding: EdgeInsets.all(10), - child: RotatedBox( - quarterTurns: 1, - child: Center( - child: Align( - child: AppText( - value.kPIParameter + ' (' + value.value.toString() + ') ', - fontSize: 10, - textAlign: TextAlign.center, - fontWeight: FontWeight.bold, - )), + borderRadius: BorderRadius.circular(8), + color: Color(0x63D02127), + ), ), - )) - ]); + ), + Container( + height: (MediaQuery.of(context).size.height * 0.24 ), + margin: EdgeInsets.only(left: 5, top: 5), + padding: EdgeInsets.all(10), + child: RotatedBox( + quarterTurns: 3, + child: Center( + child: Align( + child: FittedBox( + child: Row( + children: [ + AppText( + value.kPIParameter, + fontSize: 10, + textAlign: TextAlign.center, + color: Color(0xFF2B353E), + fontWeight: FontWeight.w700, + ), + AppText( + ' (' + value.value.toString() + ') ', + fontSize: 12, + textAlign: TextAlign.center, + color: Color(0xFF2B353E), + fontWeight: FontWeight.bold, + ), + ], + ), + )), + ), + )) + ]), + ), + ); } } diff --git a/lib/widgets/dashboard/row_count.dart b/lib/widgets/dashboard/row_count.dart index c56613da..a22932f4 100644 --- a/lib/widgets/dashboard/row_count.dart +++ b/lib/widgets/dashboard/row_count.dart @@ -8,31 +8,38 @@ class RowCounts extends StatelessWidget { RowCounts(this.name, this.count, this.c); @override Widget build(BuildContext context) { - return Row( - children: [ - dot(c), - Padding( - padding: EdgeInsets.only(top: 5, bottom: 5), + return Container( + padding: EdgeInsets.only(top: 5, bottom: 5), + child: Row( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + dot(c), + Expanded( child: Row( crossAxisAlignment: CrossAxisAlignment.start, + mainAxisAlignment: MainAxisAlignment.start, children: [ - AppText( - name, - color: Colors.black, - textAlign: TextAlign.center, - fontSize: 12, - textOverflow: TextOverflow.ellipsis, + Expanded( + child: AppText( + name, + color: Colors.black, + textAlign: TextAlign.start, // from TextAlign.center + fontSize: 11, + textOverflow: TextOverflow.ellipsis, + ), ), AppText( ' (' + count.toString() + ')', color: Colors.black, textAlign: TextAlign.center, - fontSize: 14, + fontSize: 12, fontWeight: FontWeight.bold, ) ], - )), - ], + ), + ), + ], + ), ); } diff --git a/lib/widgets/patients/profile/PatientProfileButton.dart b/lib/widgets/patients/profile/PatientProfileButton.dart index 2cf9a5ca..c5580568 100644 --- a/lib/widgets/patients/profile/PatientProfileButton.dart +++ b/lib/widgets/patients/profile/PatientProfileButton.dart @@ -24,6 +24,8 @@ class PatientProfileButton extends StatelessWidget { final Function onTap; final bool isDischargedPatient; final bool isSelectInpatient; + final bool isDartIcon; + final IconData dartIcon; PatientProfileButton({ Key key, @@ -42,6 +44,8 @@ class PatientProfileButton extends StatelessWidget { this.isInPatient = false, this.isDischargedPatient = false, this.isSelectInpatient = false, + this.isDartIcon = false, + this.dartIcon, }) : super(key: key); @override @@ -66,7 +70,9 @@ class PatientProfileButton extends StatelessWidget { mainAxisAlignment: MainAxisAlignment.start, children: [ Container( - child: new Image.asset( + child: isDartIcon ? Icon( + dartIcon, size: 30, color: Color(0xFF333C45),) : new Image + .asset( url + icon, width: 30, height: 30, diff --git a/lib/widgets/patients/profile/patient_profile_header_with_appointment_card_app_bar.dart b/lib/widgets/patients/profile/patient_profile_header_with_appointment_card_app_bar.dart index 2e47b211..9093566b 100644 --- a/lib/widgets/patients/profile/patient_profile_header_with_appointment_card_app_bar.dart +++ b/lib/widgets/patients/profile/patient_profile_header_with_appointment_card_app_bar.dart @@ -103,7 +103,7 @@ class PatientProfileHeaderWhitAppointmentAppBar extends StatelessWidget margin: EdgeInsets.symmetric(horizontal: 4), child: InkWell( onTap: () { - launch("tel://" + patient.mobileNumber); + launch("tel://" + patient?.mobileNumber??""); }, child: Icon( Icons.phone, @@ -235,7 +235,7 @@ class PatientProfileHeaderWhitAppointmentAppBar extends StatelessWidget style: TextStyle( fontSize: 12, fontFamily: 'Poppins')), new TextSpan( - text: patient.patientId.toString(), + text: patient?.patientId?.toString() ?? "", style: TextStyle( fontWeight: FontWeight.w700, fontFamily: 'Poppins', @@ -256,7 +256,7 @@ class PatientProfileHeaderWhitAppointmentAppBar extends StatelessWidget ? ClipRRect( borderRadius: BorderRadius.circular(20.0), child: Image.network( - patient.nationalityFlagURL, + patient?.nationalityFlagURL??"", height: 25, width: 30, errorBuilder: (BuildContext context, @@ -355,7 +355,7 @@ class PatientProfileHeaderWhitAppointmentAppBar extends StatelessWidget AppText('Invoice: ', color: Colors.grey[800], fontSize: 12), - AppText(invoiceNO, fontSize: 12) + AppText(invoiceNO??"", fontSize: 12) ], ), if (branch != null) @@ -449,22 +449,7 @@ class PatientProfileHeaderWhitAppointmentAppBar extends StatelessWidget return newDate.toString(); } - isToday(date) { - DateTime tempDate = new DateFormat("yyyy-MM-dd").parse(date); - return DateFormat("yyyy-MM-dd").format(tempDate) == - DateFormat("yyyy-MM-dd").format(DateTime.now()); - } - myBoxDecoration() { - return BoxDecoration( - border: Border( - top: BorderSide( - color: Colors.green, - width: 5, - ), - ), - borderRadius: BorderRadius.circular(10)); - } @override Size get preferredSize => Size(double.maxFinite, 310); diff --git a/lib/widgets/patients/profile/profile-welcome-widget.dart b/lib/widgets/patients/profile/profile-welcome-widget.dart index 10586552..53228bc2 100644 --- a/lib/widgets/patients/profile/profile-welcome-widget.dart +++ b/lib/widgets/patients/profile/profile-welcome-widget.dart @@ -1,17 +1,17 @@ -import 'package:doctor_app_flutter/core/viewModel/auth_view_model.dart'; +import 'package:doctor_app_flutter/core/viewModel/authentication_view_model.dart'; import 'package:flutter/material.dart'; import 'package:provider/provider.dart'; class ProfileWelcomeWidget extends StatelessWidget { final Widget clinicWidget; final double height; - final bool isClilic; + final bool isClinic; ProfileWelcomeWidget(this.clinicWidget, - {this.height = 150, this.isClilic = false}); + {this.height = 150, this.isClinic = false}); @override Widget build(BuildContext context) { - AuthViewModel authProvider = Provider.of(context); + AuthenticationViewModel authenticationViewModel = Provider.of(context); return Container( height: height, @@ -23,39 +23,17 @@ class ProfileWelcomeWidget extends StatelessWidget { mainAxisAlignment: MainAxisAlignment.end, crossAxisAlignment: CrossAxisAlignment.start, children: [ - this.isClilic == true ? clinicWidget : SizedBox(), - // Column( - // crossAxisAlignment: CrossAxisAlignment.start, - // mainAxisAlignment: MainAxisAlignment.start, - // children: [ - // Row( - // children: [ - // AppText( - // TranslationBase.of(context).welcome, - // fontSize: SizeConfig.textMultiplier * 1.7, - // color: Colors.black, - // ) - // ], - // ), - // Row( - // mainAxisAlignment: MainAxisAlignment.end, - // children: [ - // AppText( - // // TranslationBase.of(context).dr + - // ' ${authProvider.doctorProfile.doctorName}', - // fontWeight: FontWeight.bold, - // fontSize: SizeConfig.textMultiplier * 2.5, - // color: Colors.black, - // ), + this.isClinic == true ? clinicWidget : SizedBox(), SizedBox( width: 20, ), + if(authenticationViewModel.doctorProfile!=null) CircleAvatar( // radius: (52) child: ClipRRect( borderRadius: BorderRadius.circular(20), child: Image.network( - authProvider.doctorProfile.doctorImageURL, + authenticationViewModel.doctorProfile.doctorImageURL, fit: BoxFit.fill, width: 75, height: 75, @@ -63,23 +41,10 @@ class ProfileWelcomeWidget extends StatelessWidget { ), backgroundColor: Colors.transparent, ), - // ], - // ), SizedBox( height: 20, ), - /// ], - // ), - // Expanded( - // child: Column( - // mainAxisAlignment: MainAxisAlignment.start, - // crossAxisAlignment: CrossAxisAlignment.end, - // children: [ - - // ], - // ), - // ), ], )), ); diff --git a/lib/widgets/shared/app_drawer_widget.dart b/lib/widgets/shared/app_drawer_widget.dart index ebb49e6f..64791b26 100644 --- a/lib/widgets/shared/app_drawer_widget.dart +++ b/lib/widgets/shared/app_drawer_widget.dart @@ -1,9 +1,10 @@ -import 'package:doctor_app_flutter/core/viewModel/auth_view_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/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'; @@ -28,7 +29,7 @@ class _AppDrawerState extends State { @override Widget build(BuildContext context) { - AuthViewModel authProvider = Provider.of(context); + AuthenticationViewModel authenticationViewModel = Provider.of(context); projectsProvider = Provider.of(context); return RoundedContainer( child: Container( @@ -69,7 +70,7 @@ class _AppDrawerState extends State { mainAxisAlignment: MainAxisAlignment.spaceBetween, ), SizedBox(height: 5), - if (authProvider.doctorProfile != null) + if (authenticationViewModel.doctorProfile != null) InkWell( onTap: () { // TODO: return it back when its needed @@ -85,7 +86,7 @@ class _AppDrawerState extends State { padding: EdgeInsets.only(top: 10), child: AppText( TranslationBase.of(context).dr + - authProvider.doctorProfile?.doctorName, + authenticationViewModel.doctorProfile?.doctorName, fontWeight: FontWeight.bold, color: Color(0xFF2E303A), fontFamily: 'Poppins', @@ -95,7 +96,7 @@ class _AppDrawerState extends State { Padding( padding: EdgeInsets.only(top: 0), child: AppText( - authProvider.doctorProfile?.clinicDescription, + authenticationViewModel.doctorProfile?.clinicDescription, fontWeight: FontWeight.w600, color: Color(0xFF2E303A), fontSize: 15, @@ -172,8 +173,8 @@ class _AppDrawerState extends State { ), onTap: () async { Navigator.pop(context); - await Helpers.logout(); - projectsProvider.isLogin = false; + GifLoaderDialogUtils.showMyDialog(context); + await authenticationViewModel.logout(isFromLogin: false); }, ), ], diff --git a/lib/widgets/shared/app_loader_widget.dart b/lib/widgets/shared/app_loader_widget.dart index 7b1f1718..ef614209 100644 --- a/lib/widgets/shared/app_loader_widget.dart +++ b/lib/widgets/shared/app_loader_widget.dart @@ -3,13 +3,6 @@ import 'package:progress_hud_v2/progress_hud.dart'; import 'loader/gif_loader_container.dart'; -/* - *@author: Elham Rababah - *@Date:19/4/2020 - *@param: - *@return: Positioned - *@desc: AppLoaderWidget to create loader - */ class AppLoaderWidget extends StatefulWidget { AppLoaderWidget({Key key, this.title, this.containerColor}) : super(key: key); @@ -21,25 +14,7 @@ class AppLoaderWidget extends StatefulWidget { } class _AppLoaderWidgetState extends State { - ProgressHUD _progressHUD; - @override - void initState() { - super.initState(); -/* - *@author: Elham Rababah - *@Date:19/4/2020 - *@param: - *@return: - *@desc: create loader the desing - */ - _progressHUD = new ProgressHUD( - backgroundColor: widget.containerColor == null ? Colors.black12 : widget.containerColor, - color: Colors.black, - // containerColor: Colors.blue, - borderRadius: 5.0, - // text: 'Loading...', - ); - } + @override Widget build(BuildContext context) { diff --git a/lib/widgets/shared/app_texts_widget.dart b/lib/widgets/shared/app_texts_widget.dart index 74acff8a..48661a32 100644 --- a/lib/widgets/shared/app_texts_widget.dart +++ b/lib/widgets/shared/app_texts_widget.dart @@ -9,6 +9,7 @@ class AppText extends StatefulWidget { final Color color; final FontWeight fontWeight; final double fontSize; + final double fontHeight; final String fontFamily; final int maxLength; final bool italic; @@ -35,6 +36,7 @@ class AppText extends StatefulWidget { this.fontWeight, this.variant, this.fontSize, + this.fontHeight, this.fontFamily = 'Poppins', this.italic = false, this.maxLength = 60, @@ -121,20 +123,20 @@ class _AppTextState extends State { style: widget.style != null ? _getFontStyle().copyWith( fontStyle: widget.italic ? FontStyle.italic : null, - color: widget.color , + color: widget.color, fontWeight: widget.fontWeight ?? _getFontWeight(), - ) + height: widget.fontHeight) : TextStyle( fontStyle: widget.italic ? FontStyle.italic : null, - color: widget.color != null - ? widget.color - : Colors.black, + 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), + decoration: widget.textDecoration, + height: widget.fontHeight), ), if (widget.readMore && text.length > widget.maxLength && hidden) Positioned( diff --git a/lib/widgets/shared/rounded_container_widget.dart b/lib/widgets/shared/rounded_container_widget.dart index e86c85aa..8364bb79 100644 --- a/lib/widgets/shared/rounded_container_widget.dart +++ b/lib/widgets/shared/rounded_container_widget.dart @@ -1,9 +1,5 @@ import 'package:flutter/material.dart'; -// OWNER : Ibrahim albitar -// DATE : 05-04-2020 -// DESCRIPTION : Custom widget for rounded container and custom decoration - class RoundedContainer extends StatefulWidget { final double width; final double height; @@ -13,6 +9,9 @@ class RoundedContainer extends StatefulWidget { final double elevation; final bool showBorder; final Color borderColor; + final double shadowWidth; + final double shadowSpreadRadius; + final double shadowDy; final bool customCornerRaduis; final double topLeft; final double bottomRight; @@ -31,6 +30,9 @@ class RoundedContainer extends StatefulWidget { this.elevation = 1, this.showBorder = false, this.borderColor = Colors.red, + this.shadowWidth = 0.1, + this.shadowSpreadRadius = 10, + this.shadowDy = 5, this.customCornerRaduis = false, this.topLeft = 0, this.topRight = 0, @@ -63,10 +65,10 @@ class _RoundedContainerState extends State { : BorderRadius.circular(widget.raduis), boxShadow: [ BoxShadow( - color: Colors.grey.withOpacity(0.1), - spreadRadius: 10, + color: Colors.grey.withOpacity(widget.shadowWidth), + spreadRadius: widget.shadowSpreadRadius, blurRadius: 5, - offset: Offset(0, 5), // changes position of shadow + offset: Offset(0, widget.shadowDy), // changes position of shadow ), ]) : null, diff --git a/lib/widgets/shared/text_fields/app-textfield-custom.dart b/lib/widgets/shared/text_fields/app-textfield-custom.dart index ded2568d..7e13f411 100644 --- a/lib/widgets/shared/text_fields/app-textfield-custom.dart +++ b/lib/widgets/shared/text_fields/app-textfield-custom.dart @@ -26,6 +26,7 @@ class AppTextFieldCustom extends StatefulWidget { final Function(String) onChanged; final String validationError; final bool isPrscription; + final bool isSecure; AppTextFieldCustom({ this.height = 0, @@ -45,6 +46,7 @@ class AppTextFieldCustom extends StatefulWidget { this.onChanged, this.validationError, this.isPrscription = false, + this.isSecure = false, }); @override @@ -132,6 +134,7 @@ class _AppTextFieldCustomState extends State { widget.onChanged(value); } }, + obscureText: widget.isSecure ), ) : AppText( diff --git a/lib/widgets/shared/text_fields/html_rich_editor.dart b/lib/widgets/shared/text_fields/html_rich_editor.dart new file mode 100644 index 00000000..1d87685b --- /dev/null +++ b/lib/widgets/shared/text_fields/html_rich_editor.dart @@ -0,0 +1,174 @@ +import 'package:doctor_app_flutter/config/config.dart'; +import 'package:doctor_app_flutter/core/provider/robot_provider.dart'; +import 'package:doctor_app_flutter/core/viewModel/project_view_model.dart'; +import 'package:doctor_app_flutter/icons_app/doctor_app_icons.dart'; +import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; +import 'package:flutter/material.dart'; +import 'package:html_editor_enhanced/html_editor.dart'; +import 'package:permission_handler/permission_handler.dart'; +import 'package:provider/provider.dart'; +import 'package:speech_to_text/speech_recognition_error.dart'; +import 'package:speech_to_text/speech_to_text.dart' as stt; +import '../speech-text-popup.dart'; + +class HtmlRichEditor extends StatefulWidget { + HtmlRichEditor({ + key, + this.hint = "Your text here...", + this.initialText, + this.height = 400, + this.decoration, + this.darkMode = false, + this.showBottomToolbar = false, + this.toolbar, + }) : super(key: key); + final String hint; + final String initialText; + final double height; + final BoxDecoration decoration; + final bool darkMode; + final bool showBottomToolbar; + final List toolbar; + + + @override + _HtmlRichEditorState createState() => _HtmlRichEditorState(); +} + +class _HtmlRichEditorState extends State { + ProjectViewModel projectViewModel; + stt.SpeechToText speech = stt.SpeechToText(); + var recognizedWord; + var event = RobotProvider(); + + + @override + void initState() { + requestPermissions(); + event.controller.stream.listen((p) { + if (p['startPopUp'] == 'true') { + if (this.mounted) { + initSpeechState().then((value) => {onVoiceText()}); + } + } + }); + super.initState(); + } + + + + @override + Widget build(BuildContext context) { + projectViewModel = Provider.of(context); + + return Stack( + children: [ + HtmlEditor( + hint: widget.hint, + height: widget.height, + initialText: widget.initialText, + showBottomToolbar: widget.showBottomToolbar, + darkMode: widget.darkMode, + decoration: widget.decoration ?? + BoxDecoration( + color: Colors.transparent, + borderRadius: BorderRadius.all( + Radius.circular(30.0), + ), + border: Border.all(color: Colors.grey[200], width: 0.5), + ), + toolbar: widget.toolbar ?? + const [ + // Style(), + Font(buttons: [ + FontButtons.bold, + FontButtons.underline, + FontButtons.clear + ]), + // ColorBar(buttons: [ColorButtons.color]), + Paragraph(buttons: [ + ParagraphButtons.ul, + ParagraphButtons.ol, + ParagraphButtons.paragraph + ]), + // Insert(buttons: [InsertButtons.link, InsertButtons.picture, InsertButtons.video, InsertButtons.table]), + // Misc(buttons: [MiscButtons.fullscreen, MiscButtons.codeview, MiscButtons.help]) + ], + ), + Positioned( + top: + 50, //MediaQuery.of(context).size.height * 0, + right: projectViewModel.isArabic + ? MediaQuery.of(context).size.width * 0.75 + : 15, + child: Column( + children: [ + IconButton( + icon: Icon(DoctorApp.speechtotext, + color: Colors.black, size: 35), + onPressed: () { + initSpeechState() + .then((value) => {onVoiceText()}); + }, + ), + ], + )) + ], + ); + } + + + onVoiceText() async { + new SpeechToText(context: context).showAlertDialog(context); + var lang = TranslationBase.of(AppGlobal.CONTEX).locale.languageCode; + bool available = await speech.initialize( + onStatus: statusListener, onError: errorListener); + if (available) { + speech.listen( + onResult: resultListener, + listenMode: stt.ListenMode.confirmation, + localeId: lang == 'en' ? 'en-US' : 'ar-SA', + ); + } else { + print("The user has denied the use of speech recognition."); + } + } + + void errorListener(SpeechRecognitionError error) { + event.setValue({"searchText": 'null'}); + //SpeechToText.closeAlertDialog(context); + print(error); + } + + void statusListener(String status) { + recognizedWord = status == 'listening' ? 'Lisening...' : 'Sorry....'; + } + + void requestPermissions() async { + Map statuses = await [ + Permission.microphone, + ].request(); + } + + void resultListener(result)async { + recognizedWord = result.recognizedWords; + event.setValue({"searchText": recognizedWord}); + String txt = await HtmlEditor.getText(); + if (result.finalResult == true) { + setState(() { + SpeechToText.closeAlertDialog(context); + speech.stop(); + HtmlEditor.setText(txt+recognizedWord); + }); + } else { + print(result.finalResult); + } + } + + Future initSpeechState() async { + bool hasSpeech = await speech.initialize( + onError: errorListener, onStatus: statusListener); + print(hasSpeech); + if (!mounted) return; + } +} diff --git a/pubspec.lock b/pubspec.lock index 1a572a0a..613c2753 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -426,6 +426,13 @@ packages: url: "https://pub.dartlang.org" source: hosted version: "1.0.2" + flutter_inappwebview: + dependency: transitive + description: + name: flutter_inappwebview + url: "https://pub.dartlang.org" + source: hosted + version: "4.0.0+4" flutter_localizations: dependency: "direct main" description: flutter @@ -518,6 +525,13 @@ packages: url: "https://pub.dartlang.org" source: hosted version: "0.14.0+4" + html_editor_enhanced: + dependency: "direct main" + description: + name: html_editor_enhanced + url: "https://pub.dartlang.org" + source: hosted + version: "1.3.0" http: dependency: "direct main" description: @@ -1013,6 +1027,13 @@ packages: url: "https://pub.dartlang.org" source: hosted version: "0.0.1+3" + uuid: + dependency: transitive + description: + name: uuid + url: "https://pub.dartlang.org" + source: hosted + version: "2.2.2" vector_math: dependency: transitive description: diff --git a/pubspec.yaml b/pubspec.yaml index 29c3f7b1..a5026871 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -90,6 +90,11 @@ dependencies: speech_to_text: path: speech_to_text + + + #Html Editor Enhanced + html_editor_enhanced: ^1.3.0 + dev_dependencies: flutter_test: sdk: flutter diff --git a/speech_to_text/example/pubspec.lock b/speech_to_text/example/pubspec.lock index e0e9b753..6809f75f 100644 --- a/speech_to_text/example/pubspec.lock +++ b/speech_to_text/example/pubspec.lock @@ -1,69 +1,48 @@ # Generated by pub # See https://dart.dev/tools/pub/glossary#lockfile packages: - archive: - dependency: transitive - description: - name: archive - url: "https://pub.dartlang.org" - source: hosted - version: "2.0.13" - args: - dependency: transitive - description: - name: args - url: "https://pub.dartlang.org" - source: hosted - version: "1.6.0" async: dependency: transitive description: name: async url: "https://pub.dartlang.org" source: hosted - version: "2.4.1" + version: "2.5.0-nullsafety.1" boolean_selector: dependency: transitive description: name: boolean_selector url: "https://pub.dartlang.org" source: hosted - version: "2.0.0" + version: "2.1.0-nullsafety.1" + characters: + dependency: transitive + description: + name: characters + url: "https://pub.dartlang.org" + source: hosted + version: "1.1.0-nullsafety.3" charcode: dependency: transitive description: name: charcode url: "https://pub.dartlang.org" source: hosted - version: "1.1.3" + version: "1.2.0-nullsafety.1" clock: dependency: transitive description: name: clock url: "https://pub.dartlang.org" source: hosted - version: "1.0.1" + version: "1.1.0-nullsafety.1" collection: dependency: transitive description: name: collection url: "https://pub.dartlang.org" source: hosted - version: "1.14.12" - convert: - dependency: transitive - description: - name: convert - url: "https://pub.dartlang.org" - source: hosted - version: "2.1.1" - crypto: - dependency: transitive - description: - name: crypto - url: "https://pub.dartlang.org" - source: hosted - version: "2.1.4" + version: "1.15.0-nullsafety.3" cupertino_icons: dependency: "direct main" description: @@ -71,6 +50,13 @@ packages: url: "https://pub.dartlang.org" source: hosted version: "0.1.3" + fake_async: + dependency: transitive + description: + name: fake_async + url: "https://pub.dartlang.org" + source: hosted + version: "1.2.0-nullsafety.1" flutter: dependency: "direct main" description: flutter @@ -81,13 +67,6 @@ packages: description: flutter source: sdk version: "0.0.0" - image: - dependency: transitive - description: - name: image - url: "https://pub.dartlang.org" - source: hosted - version: "2.1.12" json_annotation: dependency: transitive description: @@ -101,14 +80,14 @@ packages: name: matcher url: "https://pub.dartlang.org" source: hosted - version: "0.12.6" + version: "0.12.10-nullsafety.1" meta: dependency: transitive description: name: meta url: "https://pub.dartlang.org" source: hosted - version: "1.1.8" + version: "1.3.0-nullsafety.3" nested: dependency: transitive description: @@ -122,7 +101,7 @@ packages: name: path url: "https://pub.dartlang.org" source: hosted - version: "1.6.4" + version: "1.8.0-nullsafety.1" permission_handler: dependency: "direct main" description: @@ -137,13 +116,6 @@ packages: url: "https://pub.dartlang.org" source: hosted version: "2.0.1" - petitparser: - dependency: transitive - description: - name: petitparser - url: "https://pub.dartlang.org" - source: hosted - version: "2.4.0" plugin_platform_interface: dependency: transitive description: @@ -158,13 +130,6 @@ packages: url: "https://pub.dartlang.org" source: hosted version: "4.3.1" - quiver: - dependency: transitive - description: - name: quiver - url: "https://pub.dartlang.org" - source: hosted - version: "2.1.3" sky_engine: dependency: transitive description: flutter @@ -176,7 +141,7 @@ packages: name: source_span url: "https://pub.dartlang.org" source: hosted - version: "1.7.0" + version: "1.8.0-nullsafety.2" speech_to_text: dependency: "direct dev" description: @@ -190,56 +155,49 @@ packages: name: stack_trace url: "https://pub.dartlang.org" source: hosted - version: "1.9.3" + version: "1.10.0-nullsafety.1" stream_channel: dependency: transitive description: name: stream_channel url: "https://pub.dartlang.org" source: hosted - version: "2.0.0" + version: "2.1.0-nullsafety.1" string_scanner: dependency: transitive description: name: string_scanner url: "https://pub.dartlang.org" source: hosted - version: "1.0.5" + version: "1.1.0-nullsafety.1" term_glyph: dependency: transitive description: name: term_glyph url: "https://pub.dartlang.org" source: hosted - version: "1.1.0" + version: "1.2.0-nullsafety.1" test_api: dependency: transitive description: name: test_api url: "https://pub.dartlang.org" source: hosted - version: "0.2.15" + version: "0.2.19-nullsafety.2" typed_data: dependency: transitive description: name: typed_data url: "https://pub.dartlang.org" source: hosted - version: "1.1.6" + version: "1.3.0-nullsafety.3" vector_math: dependency: transitive description: name: vector_math url: "https://pub.dartlang.org" source: hosted - version: "2.0.8" - xml: - dependency: transitive - description: - name: xml - url: "https://pub.dartlang.org" - source: hosted - version: "3.6.1" + version: "2.1.0-nullsafety.3" sdks: - dart: ">=2.7.0 <3.0.0" + dart: ">=2.10.0-110 <2.11.0" flutter: ">=1.16.0 <2.0.0" diff --git a/speech_to_text/pubspec.lock b/speech_to_text/pubspec.lock index 7877604f..efc63cc7 100644 --- a/speech_to_text/pubspec.lock +++ b/speech_to_text/pubspec.lock @@ -15,13 +15,6 @@ packages: url: "https://pub.dartlang.org" source: hosted version: "0.39.13" - archive: - dependency: transitive - description: - name: archive - url: "https://pub.dartlang.org" - source: hosted - version: "2.0.13" args: dependency: transitive description: @@ -35,14 +28,14 @@ packages: name: async url: "https://pub.dartlang.org" source: hosted - version: "2.4.1" + version: "2.5.0-nullsafety.1" boolean_selector: dependency: transitive description: name: boolean_selector url: "https://pub.dartlang.org" source: hosted - version: "2.0.0" + version: "2.1.0-nullsafety.1" build: dependency: transitive description: @@ -99,13 +92,20 @@ packages: url: "https://pub.dartlang.org" source: hosted version: "7.1.0" + characters: + dependency: transitive + description: + name: characters + url: "https://pub.dartlang.org" + source: hosted + version: "1.1.0-nullsafety.3" charcode: dependency: transitive description: name: charcode url: "https://pub.dartlang.org" source: hosted - version: "1.1.3" + version: "1.2.0-nullsafety.1" checked_yaml: dependency: transitive description: @@ -119,7 +119,7 @@ packages: name: clock url: "https://pub.dartlang.org" source: hosted - version: "1.0.1" + version: "1.1.0-nullsafety.1" code_builder: dependency: transitive description: @@ -133,7 +133,7 @@ packages: name: collection url: "https://pub.dartlang.org" source: hosted - version: "1.14.12" + version: "1.15.0-nullsafety.3" convert: dependency: transitive description: @@ -168,7 +168,7 @@ packages: name: fake_async url: "https://pub.dartlang.org" source: hosted - version: "1.1.0" + version: "1.2.0-nullsafety.1" fixnum: dependency: transitive description: @@ -221,13 +221,6 @@ packages: url: "https://pub.dartlang.org" source: hosted version: "3.1.4" - image: - dependency: transitive - description: - name: image - url: "https://pub.dartlang.org" - source: hosted - version: "2.1.12" io: dependency: transitive description: @@ -269,14 +262,14 @@ packages: name: matcher url: "https://pub.dartlang.org" source: hosted - version: "0.12.6" + version: "0.12.10-nullsafety.1" meta: dependency: transitive description: name: meta url: "https://pub.dartlang.org" source: hosted - version: "1.1.8" + version: "1.3.0-nullsafety.3" mime: dependency: transitive description: @@ -311,7 +304,7 @@ packages: name: path url: "https://pub.dartlang.org" source: hosted - version: "1.6.4" + version: "1.8.0-nullsafety.1" pedantic: dependency: transitive description: @@ -319,13 +312,6 @@ packages: url: "https://pub.dartlang.org" source: hosted version: "1.9.0" - petitparser: - dependency: transitive - description: - name: petitparser - url: "https://pub.dartlang.org" - source: hosted - version: "2.4.0" pool: dependency: transitive description: @@ -386,21 +372,21 @@ packages: name: source_span url: "https://pub.dartlang.org" source: hosted - version: "1.7.0" + version: "1.8.0-nullsafety.2" stack_trace: dependency: transitive description: name: stack_trace url: "https://pub.dartlang.org" source: hosted - version: "1.9.3" + version: "1.10.0-nullsafety.1" stream_channel: dependency: transitive description: name: stream_channel url: "https://pub.dartlang.org" source: hosted - version: "2.0.0" + version: "2.1.0-nullsafety.1" stream_transform: dependency: transitive description: @@ -414,21 +400,21 @@ packages: name: string_scanner url: "https://pub.dartlang.org" source: hosted - version: "1.0.5" + version: "1.1.0-nullsafety.1" term_glyph: dependency: transitive description: name: term_glyph url: "https://pub.dartlang.org" source: hosted - version: "1.1.0" + version: "1.2.0-nullsafety.1" test_api: dependency: transitive description: name: test_api url: "https://pub.dartlang.org" source: hosted - version: "0.2.15" + version: "0.2.19-nullsafety.2" timing: dependency: transitive description: @@ -442,14 +428,14 @@ packages: name: typed_data url: "https://pub.dartlang.org" source: hosted - version: "1.1.6" + version: "1.3.0-nullsafety.3" vector_math: dependency: transitive description: name: vector_math url: "https://pub.dartlang.org" source: hosted - version: "2.0.8" + version: "2.1.0-nullsafety.3" watcher: dependency: transitive description: @@ -464,13 +450,6 @@ packages: url: "https://pub.dartlang.org" source: hosted version: "1.1.0" - xml: - dependency: transitive - description: - name: xml - url: "https://pub.dartlang.org" - source: hosted - version: "3.6.1" yaml: dependency: transitive description: @@ -479,5 +458,5 @@ packages: source: hosted version: "2.2.1" sdks: - dart: ">=2.7.0 <3.0.0" + dart: ">=2.10.0-110 <2.11.0" flutter: ">=1.10.0"