diff --git a/assets/images/lang.png b/assets/images/lang.png new file mode 100644 index 00000000..34af3d9a Binary files /dev/null and b/assets/images/lang.png differ diff --git a/lib/config/config.dart b/lib/config/config.dart index 1ea16a37..f87b7628 100644 --- a/lib/config/config.dart +++ b/lib/config/config.dart @@ -14,7 +14,7 @@ const PACKAGES_SHOPPING_CART = '/api/shopping_cart_items'; const PACKAGES_ORDERS = '/api/orders'; const BASE_URL = 'https://uat.hmgwebservices.com/'; -// const BASE_URL = 'https://hmgwebservices.com/'; +//const BASE_URL = 'https://hmgwebservices.com/'; // Pharmacy UAT URLs const BASE_PHARMACY_URL = 'https://uat.hmgwebservices.com/epharmacy/api/'; @@ -33,7 +33,8 @@ const GET_GEO_ZONES = 'Services/Patients.svc/REST/GeoF_GetAllPoints'; const LOG_GEO_ZONES = 'Services/Patients.svc/REST/GeoF_InsertPatientFileInfo'; // Delivery Driver -const DRIVER_LOCATION = 'Services/Patients.svc/REST/PatientER_GetDriverLocation'; +const DRIVER_LOCATION = + 'Services/Patients.svc/REST/PatientER_GetDriverLocation'; //weather const WEATHER_INDICATOR = 'Services/Weather.svc/REST/GetCityInfo'; @@ -220,9 +221,11 @@ const GET_PATIENT_SHARE = const GET_PATIENT_APPOINTMENT_HISTORY = "Services/Doctors.svc/REST/PateintHasAppoimentHistory"; -const SEND_REPORT_EYE_EMAIL = "Services/Notifications.svc/REST/SendGlassesPrescriptionEmail"; +const SEND_REPORT_EYE_EMAIL = + "Services/Notifications.svc/REST/SendGlassesPrescriptionEmail"; -const SEND_CONTACT_LENS_PRESCRIPTION_EMAIL = "Services/Notifications.svc/REST/SendContactLensPrescriptionEmail"; +const SEND_CONTACT_LENS_PRESCRIPTION_EMAIL = + "Services/Notifications.svc/REST/SendContactLensPrescriptionEmail"; //URL to get patient appointment curfew history const GET_PATIENT_APPOINTMENT_CURFEW_HISTORY = @@ -509,7 +512,7 @@ const LAKUM_GET_USER_TERMS_AND_CONDITIONS = "Services/ERP.svc/REST/GetUserTermsAndConditionsForEPharmcy"; const PRESCRIPTION = 'Services/Patients.svc/REST/GetPrescriptionApptList'; const GET_RECOMMENDED_PRODUCT = 'alsoProduct/'; -const GET_MOST_VIEWED_PRODUCTS ="mostview?"; +const GET_MOST_VIEWED_PRODUCTS = "mostview?"; const GET_NEW_PRODUCTS = "newproducts?"; // Home Health Care diff --git a/lib/config/localized_values.dart b/lib/config/localized_values.dart index 2987e621a..a703d5db 100644 --- a/lib/config/localized_values.dart +++ b/lib/config/localized_values.dart @@ -186,10 +186,7 @@ const Map localizedValues = { "fileNo": {"en": "File Number", "ar": "رقم الملف"}, "fileno": {"en": "File No", "ar": "رقم الملف"}, "forgotFileNo": {"en": "Forgot file Number?", "ar": "نسيت رقم الملف الطبي؟"}, - "forgotFileNoTitle": { - "en": "Forgot medical file Number", - "ar": "نسيت رقم الملف" - }, + "forgotFileNoTitle": {"en": "Forgot medical file", "ar": "نسيت رقم الملف"}, "enter-national-id": { "en": "Please enter mobile number and identification number", diff --git a/lib/core/service/client/base_app_client.dart b/lib/core/service/client/base_app_client.dart index 8e410819..f12ef3da 100644 --- a/lib/core/service/client/base_app_client.dart +++ b/lib/core/service/client/base_app_client.dart @@ -87,7 +87,7 @@ class BaseAppClient { : IS_DENTAL_ALLOWED_BACKEND; } - body['DeviceTypeID'] = Platform.isAndroid ? 1: 2; + body['DeviceTypeID'] = Platform.isAndroid ? 1 : 2; if (!body.containsKey('IsPublicRequest')) { body['PatientType'] = body.containsKey('PatientType') @@ -117,7 +117,8 @@ class BaseAppClient { 'Accept': 'application/json', 'Authorization': pharmacyToken, 'Mobilenumber': user != null - ? Utils.getPhoneNumberWithoutZero(user['MobileNumber'].toString()) + ? Utils.getPhoneNumberWithoutZero( + user['MobileNumber'].toString()) : "", 'Statictoken': 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9', 'Username': user['PatientID'].toString(), @@ -278,8 +279,7 @@ class BaseAppClient { : IS_DENTAL_ALLOWED_BACKEND; } - - body['DeviceTypeID'] = Platform.isAndroid ? 1: 2; + body['DeviceTypeID'] = Platform.isAndroid ? 1 : 2; if (!body.containsKey('IsPublicRequest')) { body['PatientType'] = body.containsKey('PatientType') @@ -507,10 +507,12 @@ class BaseAppClient { } } - simplePost(String fullUrl, - { Map body, - Function(dynamic response, int statusCode) onSuccess, - Function(String error, int statusCode) onFailure,}) async { + simplePost( + String fullUrl, { + Map body, + Function(dynamic response, int statusCode) onSuccess, + Function(String error, int statusCode) onFailure, + }) async { String url = fullUrl; print("URL Query String: $url"); @@ -539,9 +541,8 @@ class BaseAppClient { simpleGet(String fullUrl, {Function(dynamic response, int statusCode) onSuccess, - Function(String error, int statusCode) onFailure, - Map queryParams}) async { - + Function(String error, int statusCode) onFailure, + Map queryParams}) async { String url = fullUrl; print("URL Query String: $url"); @@ -574,12 +575,10 @@ class BaseAppClient { } } - simplePut(String fullUrl, - { Map body, - Function(dynamic response, int statusCode) onSuccess, - Function(String error, int statusCode) onFailure}) async { - + {Map body, + Function(dynamic response, int statusCode) onSuccess, + Function(String error, int statusCode) onFailure}) async { String url = fullUrl; print("URL Query String: $url"); @@ -608,9 +607,8 @@ class BaseAppClient { simpleDelete(String fullUrl, {Function(dynamic response, int statusCode) onSuccess, - Function(String error, int statusCode) onFailure, - Map queryParams}) async { - + Function(String error, int statusCode) onFailure, + Map queryParams}) async { String url = fullUrl; print("URL Query String: $url"); @@ -733,7 +731,7 @@ class BaseAppClient { : IS_DENTAL_ALLOWED_BACKEND; } - body['DeviceTypeID'] = Platform.isAndroid ? 1: 2; + body['DeviceTypeID'] = Platform.isAndroid ? 1 : 2; if (!body.containsKey('IsPublicRequest')) { body['PatientType'] = body.containsKey('PatientType') diff --git a/lib/models/mobile_number.dart b/lib/models/mobile_number.dart new file mode 100644 index 00000000..89797fab --- /dev/null +++ b/lib/models/mobile_number.dart @@ -0,0 +1,1087 @@ +// final List countries = [ +// new Countries( +// name: "Saudi Arabia", name_ar: "المملكة العربية السعودية", code: '966'), +// new Countries( +// name: "United Arab Emirates", +// name_ar: "الإمارات العربية المتحدة", +// code: '971'), +// ]; + +// class Countries { +// final String name; +// final String name_ar; +// final String code; + +// Countries({this.name, this.name_ar, this.code}); +// } + +class Countries { + String name; + String nameAr; + String code; + String countryCode; + + Countries({this.name, this.nameAr, this.code, this.countryCode}); + + Countries.fromJson(Map json) { + name = json['name']; + nameAr = json['name_ar']; + code = json['code']; + countryCode = json['countryCode']; + } + + Map toJson() { + final Map data = new Map(); + data['name'] = this.name; + data['name_ar'] = this.nameAr; + data['code'] = this.code; + data['countryCode'] = this.countryCode; + return data; + } +} + +List> countriesData = [ + { + "name": "Saudi Arabia", + "name_ar": "المملكة العربية السعودية", + "code": "+966", + "countryCode": "SA", + "pattern": "5xxxxxxxx", + "maxLength": 9 + }, + { + "name": "United Arab Emirates", + "name_ar": "الإمارات العربية المتحدة", + "code": "+971", + "countryCode": "AE", + "pattern": "5xxxxxxxx", + "maxLength": 9 + }, + { + "name": "Bahrain", + "name_ar": "البحرين", + "code": "+973", + "countryCode": "BH", + "maxLength": 8 + }, + {"name": "Kuwait", "name_ar": "الكويت", "code": "+965", "countryCode": "KW"}, + { + "name": "Afghanistan", + "name_ar": "أفغانستان", + "code": "+93", + "countryCode": "AF" + }, + { + "name": "Aland Islands", + "name_ar": "جزر آلاند", + "code": "+358", + "countryCode": "AX" + }, + { + "name": "Albania", + "name_ar": "ألبانيا", + "code": "+355", + "countryCode": "AL" + }, + { + "name": "Algeria", + "name_ar": "الجزائر", + "code": "+213", + "countryCode": "DZ" + }, + { + "name": "AmericanSamoa", + "name_ar": "ساموا الأمريكية", + "code": "+1 684", + "countryCode": "AS" + }, + {"name": "Andorra", "name_ar": "أندورا", "code": "+376", "countryCode": "AD"}, + {"name": "Angola", "name_ar": "أنغولا", "code": "+244", "countryCode": "AO"}, + { + "name": "Anguilla", + "name_ar": "أنغيلا", + "code": "+1 264", + "countryCode": "AI" + }, + { + "name": "Antarctica", + "name_ar": "القارة القطبية الجنوبية", + "code": "+672", + "countryCode": "AQ" + }, + { + "name": "Antigua and Barbuda", + "name_ar": "أنتيغوا وبربودا", + "code": "+1268", + "countryCode": "AG" + }, + { + "name": "Argentina", + "name_ar": "الأرجنتين", + "code": "+54", + "countryCode": "AR" + }, + { + "name": "Armenia", + "name_ar": "أرمينيا", + "code": "+374", + "countryCode": "AM" + }, + {"name": "Aruba", "name_ar": "أروبا", "code": "+297", "countryCode": "AW"}, + { + "name": "Australia", + "name_ar": "أستراليا", + "code": "+61", + "countryCode": "AU" + }, + {"name": "Austria", "name_ar": "النمسا", "code": "+43", "countryCode": "AT"}, + { + "name": "Azerbaijan", + "name_ar": "أذربيجان", + "code": "+994", + "countryCode": "AZ" + }, + { + "name": "Bahamas", + "name_ar": "الباهاما", + "code": "+1 242", + "countryCode": "BS" + }, + { + "name": "Bangladesh", + "name_ar": "بنغلاديش", + "code": "+880", + "countryCode": "BD" + }, + { + "name": "Barbados", + "name_ar": "بربادوس", + "code": "+1 246", + "countryCode": "BB" + }, + { + "name": "Belarus", + "name_ar": "روسيا البيضاء", + "code": "+375", + "countryCode": "BY" + }, + {"name": "Belgium", "name_ar": "بلجيكا", "code": "+32", "countryCode": "BE"}, + {"name": "Belize", "name_ar": "بليز", "code": "+501", "countryCode": "BZ"}, + {"name": "Benin", "name_ar": "بنين", "code": "+229", "countryCode": "BJ"}, + { + "name": "Bermuda", + "name_ar": "برمودا", + "code": "+1 441", + "countryCode": "BM" + }, + {"name": "Bhutan", "name_ar": "بوتان", "code": "+975", "countryCode": "BT"}, + { + "name": "Bolivia, Plurinational State of", + "name_ar": "دولة بوليفيا المتعددة القوميات", + "code": "+591", + "countryCode": "BO" + }, + { + "name": "Bosnia and Herzegovina", + "name_ar": "البوسنة والهرسك", + "code": "+387", + "countryCode": "BA" + }, + { + "name": "Botswana", + "name_ar": "بوتسوانا", + "code": "+267", + "countryCode": "BW" + }, + {"name": "Brazil", "name_ar": "البرازيل", "code": "+55", "countryCode": "BR"}, + { + "name": "British Indian Ocean Territory", + "name_ar": "إقليم المحيط البريطاني الهندي", + "code": "+246", + "countryCode": "IO" + }, + { + "name": "Brunei Darussalam", + "name_ar": "بروناي دار السلام", + "code": "+673", + "countryCode": "BN" + }, + { + "name": "Bulgaria", + "name_ar": "بلغاريا", + "code": "+359", + "countryCode": "BG" + }, + { + "name": "Burkina Faso", + "name_ar": "بوركينا فاسو", + "code": "+226", + "countryCode": "BF" + }, + { + "name": "Burundi", + "name_ar": "بوروندي", + "code": "+257", + "countryCode": "BI" + }, + { + "name": "Cambodia", + "name_ar": "كمبوديا", + "code": "+855", + "countryCode": "KH" + }, + { + "name": "Cameroon", + "name_ar": "الكاميرون", + "code": "+237", + "countryCode": "CM" + }, + {"name": "Canada", "name_ar": "كندا", "code": "+1", "countryCode": "CA"}, + { + "name": "Cape Verde", + "name_ar": "الرأس الأخضر", + "code": "+238", + "countryCode": "CV" + }, + { + "name": "Cayman Islands", + "name_ar": "جزر كايمان", + "code": "+345", + "countryCode": "KY" + }, + { + "name": "Central African Republic", + "name_ar": "جمهورية افريقيا الوسطى", + "code": "+236", + "countryCode": "CF" + }, + {"name": "Chad", "name_ar": "تشاد", "code": "+235", "countryCode": "TD"}, + {"name": "Chile", "name_ar": "تشيلي", "code": "+56", "countryCode": "CL"}, + {"name": "China", "name_ar": "الصين", "code": "+86", "countryCode": "CN"}, + { + "name": "Christmas Island", + "name_ar": "جزيرة الكريسماس", + "code": "+61", + "countryCode": "CX" + }, + { + "name": "Cocos (Keeling) Islands", + "name_ar": "جزر كوكوس كيلينغ", + "code": "+61", + "countryCode": "CC" + }, + { + "name": "Colombia", + "name_ar": "كولومبيا", + "code": "+57", + "countryCode": "CO" + }, + { + "name": "Comoros", + "name_ar": "جزر القمر", + "code": "+269", + "countryCode": "KM" + }, + {"name": "Congo", "name_ar": "الكونغو", "code": "+242", "countryCode": "CG"}, + { + "name": "Congo, The Democratic Republic of the Congo", + "name_ar": "الكونغو ، جمهورية الكونغو الديمقراطية", + "code": "+243", + "countryCode": "CD" + }, + { + "name": "Cook Islands", + "name_ar": "جزر كوك", + "code": "+682", + "countryCode": "CK" + }, + { + "name": "Costa Rica", + "name_ar": "كوستا ريكا", + "code": "+506", + "countryCode": "CR" + }, + { + "name": "Cote d'Ivoire", + "name_ar": "ساحل العاج", + "code": "+225", + "countryCode": "CI" + }, + { + "name": "Croatia", + "name_ar": "كرواتيا", + "code": "+385", + "countryCode": "HR" + }, + {"name": "Cuba", "name_ar": "كوبا", "code": "+53", "countryCode": "CU"}, + {"name": "Cyprus", "name_ar": "قبرص", "code": "+357", "countryCode": "CY"}, + { + "name": "Czech Republic", + "name_ar": "جمهورية التشيك", + "code": "+420", + "countryCode": "CZ" + }, + { + "name": "Denmark", + "name_ar": "الدنمارك", + "code": "+45", + "countryCode": "DK" + }, + { + "name": "Djibouti", + "name_ar": "جيبوتي", + "code": "+253", + "countryCode": "DJ" + }, + { + "name": "Dominica", + "name_ar": "دومينيكا", + "code": "+1 767", + "countryCode": "DM" + }, + { + "name": "Dominican Republic", + "name_ar": "جمهورية الدومنيكان", + "code": "+1 849", + "countryCode": "DO" + }, + { + "name": "Ecuador", + "name_ar": "الإكوادور", + "code": "+593", + "countryCode": "EC" + }, + {"name": "Egypt", "name_ar": "مصر", "code": "+20", "countryCode": "EG"}, + { + "name": "El Salvador", + "name_ar": "السلفادور", + "code": "+503", + "countryCode": "SV" + }, + { + "name": "Equatorial Guinea", + "name_ar": "غينيا الإستوائية", + "code": "+240", + "countryCode": "GQ" + }, + { + "name": "Eritrea", + "name_ar": "إريتريا", + "code": "+291", + "countryCode": "ER" + }, + { + "name": "Estonia", + "name_ar": "استونيا", + "code": "+372", + "countryCode": "EE" + }, + { + "name": "Ethiopia", + "name_ar": "أثيوبيا", + "code": "+251", + "countryCode": "ET" + }, + { + "name": "Falkland Islands (Malvinas)", + "name_ar": "جزر فوكلاند مالفيناس", + "code": "+500", + "countryCode": "FK" + }, + { + "name": "Faroe Islands", + "name_ar": "جزر صناعية", + "code": "+298", + "countryCode": "FO" + }, + {"name": "Fiji", "name_ar": "فيجي", "code": "+679", "countryCode": "FJ"}, + {"name": "Finland", "name_ar": "فنلندا", "code": "+358", "countryCode": "FI"}, + {"name": "France", "name_ar": "فرنسا", "code": "+33", "countryCode": "FR"}, + { + "name": "French Guiana", + "name_ar": "غيانا الفرنسية", + "code": "+594", + "countryCode": "GF" + }, + { + "name": "French Polynesia", + "name_ar": "بولينيزيا الفرنسية", + "code": "+689", + "countryCode": "PF" + }, + {"name": "Gabon", "name_ar": "الغابون", "code": "+241", "countryCode": "GA"}, + {"name": "Gambia", "name_ar": "غامبيا", "code": "+220", "countryCode": "GM"}, + {"name": "Georgia", "name_ar": "جورجيا", "code": "+995", "countryCode": "GE"}, + {"name": "Germany", "name_ar": "ألمانيا", "code": "+49", "countryCode": "DE"}, + {"name": "Ghana", "name_ar": "غانا", "code": "+233", "countryCode": "GH"}, + { + "name": "Gibraltar", + "name_ar": "جبل طارق", + "code": "+350", + "countryCode": "GI" + }, + {"name": "Greece", "name_ar": "اليونان", "code": "+30", "countryCode": "GR"}, + { + "name": "Greenland", + "name_ar": "الأرض الخضراء", + "code": "+299", + "countryCode": "GL" + }, + { + "name": "Grenada", + "name_ar": "غرينادا", + "code": "+1 473", + "countryCode": "GD" + }, + { + "name": "Guadeloupe", + "name_ar": "جوادلوب", + "code": "+590", + "countryCode": "GP" + }, + {"name": "Guam", "name_ar": "غوام", "code": "+1 671", "countryCode": "GU"}, + { + "name": "Guatemala", + "name_ar": "غواتيمالا", + "code": "+502", + "countryCode": "GT" + }, + {"name": "Guernsey", "name_ar": "غيرنسي", "code": "+44", "countryCode": "GG"}, + {"name": "Guinea", "name_ar": "غينيا", "code": "+224", "countryCode": "GN"}, + { + "name": "Guinea-Bissau", + "name_ar": "غينيا بيساو", + "code": "+245", + "countryCode": "GW" + }, + {"name": "Guyana", "name_ar": "غيانا", "code": "+595", "countryCode": "GY"}, + {"name": "Haiti", "name_ar": "هايتي", "code": "+509", "countryCode": "HT"}, + { + "name": "Holy See (Vatican City State)", + "name_ar": "الكرسي الرسولي دولة الفاتيكان", + "code": "+379", + "countryCode": "VA" + }, + { + "name": "Honduras", + "name_ar": "هندوراس", + "code": "+504", + "countryCode": "HN" + }, + { + "name": "Hong Kong", + "name_ar": "هونج كونج", + "code": "+852", + "countryCode": "HK" + }, + {"name": "Hungary", "name_ar": "اليونان", "code": "+36", "countryCode": "HU"}, + { + "name": "Iceland", + "name_ar": "أيسلندا", + "code": "+354", + "countryCode": "IS" + }, + {"name": "India", "name_ar": "الهند", "code": "+91", "countryCode": "IN"}, + { + "name": "Indonesia", + "name_ar": "أندونيسيا", + "code": "+62", + "countryCode": "ID" + }, + { + "name": "Iran, Islamic Republic of Persian Gulf", + "name_ar": "جمهورية إيران الإسلامية الخليج الفارسي", + "code": "+98", + "countryCode": "IR" + }, + {"name": "Iraq", "name_ar": "العراق", "code": "+964", "countryCode": "IQ"}, + { + "name": "Ireland", + "name_ar": "أيرلندا", + "code": "+353", + "countryCode": "IE" + }, + { + "name": "Isle of Man", + "name_ar": "جزيرة آيل أوف مان", + "code": "+44", + "countryCode": "IM" + }, + {"name": "Israel", "name_ar": "إسرائيل", "code": "+972", "countryCode": "IL"}, + {"name": "Italy", "name_ar": "إيطاليا", "code": "+39", "countryCode": "IT"}, + { + "name": "Jamaica", + "name_ar": "جامايكا", + "code": "+1 876", + "countryCode": "JM" + }, + {"name": "Japan", "name_ar": "اليابان", "code": "+81", "countryCode": "JP"}, + {"name": "Jersey", "name_ar": "جيرسي", "code": "+44", "countryCode": "JE"}, + {"name": "Jordan", "name_ar": "الأردن", "code": "+962", "countryCode": "JO"}, + { + "name": "Kazakhstan", + "name_ar": "كازاخستان", + "code": "+77", + "countryCode": "KZ" + }, + {"name": "Kenya", "name_ar": "كينيا", "code": "+254", "countryCode": "KE"}, + { + "name": "Kiribati", + "name_ar": "كيريباس", + "code": "+686", + "countryCode": "KI" + }, + { + "name": "Korea, Democratic People's Republic of Korea", + "name_ar": "جمهورية كوريا الديمقراطية الشعبية", + "code": "+850", + "countryCode": "KP" + }, + { + "name": "Korea, Republic of South Korea", + "name_ar": "جمهورية كوريا الديمقراطية الشعبية", + "code": "+82", + "countryCode": "KR" + }, + { + "name": "Kyrgyzstan", + "name_ar": "قرغيزستان", + "code": "+996", + "countryCode": "KG" + }, + {"name": "Laos", "name_ar": "لاوس", "code": "+856", "countryCode": "LA"}, + {"name": "Latvia", "name_ar": "لاتفيا", "code": "+371", "countryCode": "LV"}, + {"name": "Lebanon", "name_ar": "لبنان", "code": "+961", "countryCode": "LB"}, + {"name": "Lesotho", "name_ar": "ليسوتو", "code": "+266", "countryCode": "LS"}, + { + "name": "Liberia", + "name_ar": "ليبيريا", + "code": "+231", + "countryCode": "LR" + }, + { + "name": "Libyan Arab Jamahiriya", + "name_ar": "الجماهيرية العربية الليبية", + "code": "+218", + "countryCode": "LY" + }, + { + "name": "Liechtenstein", + "name_ar": "ليختنشتاين", + "code": "+423", + "countryCode": "LI" + }, + { + "name": "Lithuania", + "name_ar": "ليتوانيا", + "code": "+370", + "countryCode": "LT" + }, + { + "name": "Luxembourg", + "name_ar": "لوكسمبورغ", + "code": "+352", + "countryCode": "LU" + }, + {"name": "Macao", "name_ar": "ماكاو", "code": "+853", "countryCode": "MO"}, + { + "name": "Macedonia", + "name_ar": "مقدونيا", + "code": "+389", + "countryCode": "MK" + }, + { + "name": "Madagascar", + "name_ar": "مدغشقر", + "code": "+261", + "countryCode": "MG" + }, + {"name": "Malawi", "name_ar": "مالاوي", "code": "+265", "countryCode": "MW"}, + { + "name": "Malaysia", + "name_ar": "ماليزيا", + "code": "+60", + "countryCode": "MY" + }, + { + "name": "Maldives", + "name_ar": "جزر المالديف", + "code": "+960", + "countryCode": "MV" + }, + {"name": "Mali", "name_ar": "مالي", "code": "+223", "countryCode": "ML"}, + {"name": "Malta", "name_ar": "مالطا", "code": "+356", "countryCode": "MT"}, + { + "name": "Marshall Islands", + "name_ar": "جزر مارشال", + "code": "+692", + "countryCode": "MH" + }, + { + "name": "Martinique", + "name_ar": "مارتينيك", + "code": "+596", + "countryCode": "MQ" + }, + { + "name": "Mauritania", + "name_ar": "موريتانيا", + "code": "+222", + "countryCode": "MR" + }, + { + "name": "Mauritius", + "name_ar": "موريشيوس", + "code": "+230", + "countryCode": "MU" + }, + {"name": "Mayotte", "name_ar": "مايوت", "code": "+262", "countryCode": "YT"}, + {"name": "Mexico", "name_ar": "المكسيك", "code": "+52", "countryCode": "MX"}, + { + "name": "Micronesia, Federated States of Micronesia", + "name_ar": "ميكرونيزيا ، ولايات ميكرونيزيا الموحدة", + "code": "+691", + "countryCode": "FM" + }, + { + "name": "Moldova", + "name_ar": "مولدوفا", + "code": "+373", + "countryCode": "MD" + }, + {"name": "Monaco", "name_ar": "موناكو", "code": "+377", "countryCode": "MC"}, + { + "name": "Mongolia", + "name_ar": "منغوليا", + "code": "+976", + "countryCode": "MN" + }, + { + "name": "Montenegro", + "name_ar": "الجبل الأسود", + "code": "+382", + "countryCode": "ME" + }, + { + "name": "Montserrat", + "name_ar": "مونتسيرات", + "code": "+1664", + "countryCode": "MS" + }, + {"name": "Morocco", "name_ar": "المغرب", "code": "+212", "countryCode": "MA"}, + { + "name": "Mozambique", + "name_ar": "موزمبيق", + "code": "+258", + "countryCode": "MZ" + }, + {"name": "Myanmar", "name_ar": "ميانمار", "code": "+95", "countryCode": "MM"}, + { + "name": "Namibia", + "name_ar": "ناميبيا", + "code": "+264", + "countryCode": "NA" + }, + {"name": "Nauru", "name_ar": "ناورو", "code": "+674", "countryCode": "NR"}, + {"name": "Nepal", "name_ar": "نيبال", "code": "+977", "countryCode": "NP"}, + { + "name": "Netherlands", + "name_ar": "هولندا", + "code": "+31", + "countryCode": "NL" + }, + { + "name": "Netherlands Antilles", + "name_ar": "جزر الأنتيل الهولندية", + "code": "+599", + "countryCode": "AN" + }, + { + "name": "New Caledonia", + "name_ar": "كاليدونيا الجديدة", + "code": "+687", + "countryCode": "NC" + }, + { + "name": "New Zealand", + "name_ar": "نيوزيلندا", + "code": "+64", + "countryCode": "NZ" + }, + { + "name": "Nicaragua", + "name_ar": "نيكاراغوا", + "code": "+505", + "countryCode": "NI" + }, + {"name": "Niger", "name_ar": "النيجر", "code": "+227", "countryCode": "NE"}, + { + "name": "Nigeria", + "name_ar": "نيجيريا", + "code": "+234", + "countryCode": "NG" + }, + {"name": "Niue", "name_ar": "نيوي", "code": "+683", "countryCode": "NU"}, + { + "name": "Norfolk Island", + "name_ar": "جزيرة نورفولك", + "code": "+672", + "countryCode": "NF" + }, + { + "name": "Northern Mariana Islands", + "name_ar": "جزر مريانا الشمالية", + "code": "+1 670", + "countryCode": "MP" + }, + {"name": "Norway", "name_ar": "النرويج", "code": "+47", "countryCode": "NO"}, + { + "name": "Oman", + "name_ar": "سلطنة عمان", + "code": "+968", + "countryCode": "OM" + }, + { + "name": "Pakistan", + "name_ar": "باكستان", + "code": "+92", + "countryCode": "PK" + }, + {"name": "Palau", "name_ar": "بالاو", "code": "+680", "countryCode": "PW"}, + { + "name": "Palestinian Territory, Occupied", + "name_ar": "الأراضي الفلسطينية المحتلة", + "code": "+970", + "countryCode": "PS" + }, + {"name": "Panama", "name_ar": "بناما", "code": "+507", "countryCode": "PA"}, + { + "name": "Papua New Guinea", + "name_ar": "بابوا غينيا الجديدة", + "code": "+675", + "countryCode": "PG" + }, + { + "name": "Paraguay", + "name_ar": "باراغواي", + "code": "+595", + "countryCode": "PY" + }, + {"name": "Peru", "name_ar": "بيرو", "code": "+51", "countryCode": "PE"}, + { + "name": "Philippines", + "name_ar": "الفلبين", + "code": "+63", + "countryCode": "PH" + }, + { + "name": "Pitcairn", + "name_ar": "بيتكيرن", + "code": "+872", + "countryCode": "PN" + }, + {"name": "Poland", "name_ar": "بولندا", "code": "+48", "countryCode": "PL"}, + { + "name": "Portugal", + "name_ar": "البرتغال", + "code": "+351", + "countryCode": "PT" + }, + { + "name": "Puerto Rico", + "name_ar": "بورتوريكو", + "code": "+1 939", + "countryCode": "PR" + }, + {"name": "Qatar", "name_ar": "دولة قطر", "code": "+974", "countryCode": "QA"}, + {"name": "Romania", "name_ar": "رومانيا", "code": "+40", "countryCode": "RO"}, + {"name": "Russia", "name_ar": "روسيا", "code": "+7", "countryCode": "RU"}, + {"name": "Rwanda", "name_ar": "رواندا", "code": "+250", "countryCode": "RW"}, + { + "name": "Reunion", + "name_ar": "جمع شمل", + "code": "+262", + "countryCode": "RE" + }, + { + "name": "Saint Barthelemy", + "name_ar": "سانت بارتيليمي", + "code": "+590", + "countryCode": "BL" + }, + { + "name": "Saint Helena, Ascension and Tristan Da Cunha", + "name_ar": "سانت هيلانة ، أسنشن وتريستان دا كونها", + "code": "+290", + "countryCode": "SH" + }, + { + "name": "Saint Kitts and Nevis", + "name_ar": "سانت كيتس ونيفيس", + "code": "+1 869", + "countryCode": "KN" + }, + { + "name": "Saint Lucia", + "name_ar": "القديسة لوسيا", + "code": "+1 758", + "countryCode": "LC" + }, + { + "name": "Saint Martin", + "name_ar": "القديس مارتن", + "code": "+590", + "countryCode": "MF" + }, + { + "name": "Saint Pierre and Miquelon", + "name_ar": "سانت بيير وميكلون", + "code": "+508", + "countryCode": "PM" + }, + { + "name": "Saint Vincent and the Grenadines", + "name_ar": "سانت فنسنت وجزر غرينادين", + "code": "+1 784", + "countryCode": "VC" + }, + {"name": "Samoa", "name_ar": "ساموا", "code": "+685", "countryCode": "WS"}, + { + "name": "San Marino", + "name_ar": "سان مارينو", + "code": "+378", + "countryCode": "SM" + }, + { + "name": "Sao Tome and Principe", + "name_ar": "ساو تومي وبرينسيبي", + "code": "+239", + "countryCode": "ST" + }, + { + "name": "Senegal", + "name_ar": "السنغال", + "code": "+221", + "countryCode": "SN" + }, + {"name": "Serbia", "name_ar": "صربيا", "code": "+381", "countryCode": "RS"}, + { + "name": "Seychelles", + "name_ar": "سيشيل", + "code": "+248", + "countryCode": "SC" + }, + { + "name": "Sierra Leone", + "name_ar": "سيرا ليون", + "code": "+232", + "countryCode": "SL" + }, + { + "name": "Singapore", + "name_ar": "سنغافورة", + "code": "+65", + "countryCode": "SG" + }, + { + "name": "Slovakia", + "name_ar": "سلوفاكيا", + "code": "+421", + "countryCode": "SK" + }, + { + "name": "Slovenia", + "name_ar": "سلوفينيا", + "code": "+386", + "countryCode": "SI" + }, + { + "name": "Solomon Islands", + "name_ar": "جزر سليمان", + "code": "+677", + "countryCode": "SB" + }, + { + "name": "Somalia", + "name_ar": "الصومال", + "code": "+252", + "countryCode": "SO" + }, + { + "name": "South Africa", + "name_ar": "جنوب أفريقيا", + "code": "+27", + "countryCode": "ZA" + }, + { + "name": "South Georgia and the South Sandwich Islands", + "name_ar": "جورجيا الجنوبية وجزر ساندويتش الجنوبية", + "code": "+500", + "countryCode": "GS" + }, + {"name": "Spain", "name_ar": "إسبانيا", "code": "+34", "countryCode": "ES"}, + { + "name": "Sri Lanka", + "name_ar": "سيريلانكا", + "code": "+94", + "countryCode": "LK" + }, + {"name": "Sudan", "name_ar": "سودان", "code": "+249", "countryCode": "SD"}, + { + "name": "Suriname", + "name_ar": "سورينام", + "code": "+597", + "countryCode": "SR" + }, + { + "name": "Svalbard and Jan Mayen", + "name_ar": "سفالبارد وجان ماين", + "code": "+47", + "countryCode": "SJ" + }, + { + "name": "Swaziland", + "name_ar": "سوازيلاند", + "code": "+268", + "countryCode": "SZ" + }, + {"name": "Sweden", "name_ar": "السويد", "code": "+46", "countryCode": "SE"}, + { + "name": "Switzerland", + "name_ar": "سويسرا", + "code": "+41", + "countryCode": "CH" + }, + { + "name": "Syrian Arab Republic", + "name_ar": "الجمهورية العربية السورية", + "code": "+963", + "countryCode": "SY" + }, + {"name": "Taiwan", "name_ar": "تايوان", "code": "+886", "countryCode": "TW"}, + { + "name": "Tajikistan", + "name_ar": "طاجيكستان", + "code": "+992", + "countryCode": "TJ" + }, + { + "name": "Tanzania, United Republic of Tanzania", + "name_ar": "تنزانيا ، جمهورية تنزانيا المتحدة", + "code": "+255", + "countryCode": "TZ" + }, + { + "name": "Thailand", + "name_ar": "تايلاند", + "code": "+66", + "countryCode": "TH" + }, + { + "name": "Timor-Leste", + "name_ar": "تيمور الشرقية", + "code": "+670", + "countryCode": "TL" + }, + {"name": "Togo", "name_ar": "ليذهب", "code": "+228", "countryCode": "TG"}, + { + "name": "Tokelau", + "name_ar": "توكيلاو", + "code": "+690", + "countryCode": "TK" + }, + {"name": "Tonga", "name_ar": "تونغا", "code": "+676", "countryCode": "TO"}, + { + "name": "Trinidad and Tobago", + "name_ar": "ترينداد وتوباغو", + "code": "+1 868", + "countryCode": "TT" + }, + {"name": "Tunisia", "name_ar": "تونس", "code": "+216", "countryCode": "TN"}, + {"name": "Turkey", "name_ar": "ديك رومي", "code": "+90", "countryCode": "TR"}, + { + "name": "Turkmenistan", + "name_ar": "تركمانستان", + "code": "+993", + "countryCode": "TM" + }, + { + "name": "Turks and Caicos Islands", + "name_ar": "جزر تركس وكايكوس", + "code": "+1 649", + "countryCode": "TC" + }, + {"name": "Tuvalu", "name_ar": "توفالو", "code": "+688", "countryCode": "TV"}, + {"name": "Uganda", "name_ar": "أوغندا", "code": "+256", "countryCode": "UG"}, + { + "name": "Ukraine", + "name_ar": "أوكرانيا", + "code": "+380", + "countryCode": "UA" + }, + { + "name": "United Kingdom", + "name_ar": "المملكة المتحدة", + "code": "+44", + "countryCode": "GB" + }, + { + "name": "United States", + "name_ar": "الولايات المتحدة الامريكانية", + "code": "+1", + "countryCode": "US" + }, + { + "name": "Uruguay", + "name_ar": "أوروغواي", + "code": "+598", + "countryCode": "UY" + }, + { + "name": "Uzbekistan", + "name_ar": "أوزبكستان", + "code": "+998", + "countryCode": "UZ" + }, + { + "name": "Vanuatu", + "name_ar": "فانواتو", + "code": "+678", + "countryCode": "VU" + }, + { + "name": "Venezuela, Bolivarian Republic of Venezuela", + "name_ar": "فنزويلا ، جمهورية فنزويلا البوليفارية", + "code": "+58", + "countryCode": "VE" + }, + {"name": "Vietnam", "name_ar": "فيتنام", "code": "+84", "countryCode": "VN"}, + { + "name": "Virgin Islands, British", + "name_ar": "جزر العذراء البريطانية", + "code": "+1 284", + "countryCode": "VG" + }, + { + "name": "Virgin Islands, U.S.", + "name_ar": "جزر فيرجن ، الولايات المتحدة", + "code": "+1 340", + "countryCode": "VI" + }, + { + "name": "Wallis and Futuna", + "name_ar": "واليس وفوتونا", + "code": "+681", + "countryCode": "WF" + }, + {"name": "Yemen", "name_ar": "اليمن", "code": "+967", "countryCode": "YE"}, + {"name": "Zambia", "name_ar": "زامبيا", "code": "+260", "countryCode": "ZM"}, + { + "name": "Zimbabwe", + "name_ar": "زيمبابوي", + "code": "+263", + "countryCode": "ZW" + } +]; +// }); +// List countryList =[]; diff --git a/lib/pages/feedback/send_feedback_page.dart b/lib/pages/feedback/send_feedback_page.dart index 189b4761..8ebdabd8 100644 --- a/lib/pages/feedback/send_feedback_page.dart +++ b/lib/pages/feedback/send_feedback_page.dart @@ -1,6 +1,8 @@ +import 'package:diplomaticquarterapp/config/config.dart'; import 'package:diplomaticquarterapp/core/enum/viewstate.dart'; import 'package:diplomaticquarterapp/core/viewModels/feedback/feedback_view_model.dart'; import 'package:diplomaticquarterapp/pages/base/base_view.dart'; +import 'package:diplomaticquarterapp/services/robo_search/event_provider.dart'; import 'package:diplomaticquarterapp/uitl/app_toast.dart'; import 'package:diplomaticquarterapp/uitl/date_uitl.dart'; import 'package:diplomaticquarterapp/uitl/gif_loader_dialog_utils.dart'; @@ -13,12 +15,15 @@ import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; import 'package:diplomaticquarterapp/widgets/input/text_field.dart'; import 'package:diplomaticquarterapp/widgets/others/StarRating.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; +import 'package:diplomaticquarterapp/widgets/others/floating_button_search.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:font_awesome_flutter/font_awesome_flutter.dart'; +import 'package:speech_to_text/speech_recognition_error.dart'; import 'dart:convert'; import 'dart:io'; import 'appointment_history.dart'; +import 'package:speech_to_text/speech_to_text.dart' as stt; class SendFeedbackPage extends StatefulWidget { @override @@ -35,8 +40,10 @@ class _SendFeedbackPageState extends State { String message; final formKey = GlobalKey(); MessageType messageType = MessageType.NON; - - + var _currentLocaleId; + stt.SpeechToText speech = stt.SpeechToText(); + var reconizedWord; + var event = RobotProvider(); String getSelected(BuildContext context) { switch (messageType) { case MessageType.ComplaintOnAnAppointment: @@ -61,13 +68,10 @@ class _SendFeedbackPageState extends State { return TranslationBase.of(context).notClassified; } - - setMessageType(MessageType messageType) { - setState(() { - this.messageType = messageType; - }); - + setState(() { + this.messageType = messageType; + }); } @override @@ -116,7 +120,7 @@ class _SendFeedbackPageState extends State { getSelected(context), variant: 'bodyText', ), - margin: EdgeInsets.only(left: 10,right: 10), + margin: EdgeInsets.only(left: 10, right: 10), ), Icon( Icons.arrow_drop_down, @@ -127,8 +131,8 @@ class _SendFeedbackPageState extends State { ), ), ), - if (appointHistory != null && messageType == - MessageType.ComplaintOnAnAppointment) + if (appointHistory != null && + messageType == MessageType.ComplaintOnAnAppointment) InkWell( onTap: () { setState(() { @@ -203,10 +207,13 @@ class _SendFeedbackPageState extends State { ), ), ), - if (messageType == MessageType.ComplaintOnAnAppointment && model.appointHistoryList.length != 0 && + if (messageType == MessageType.ComplaintOnAnAppointment && + model.appointHistoryList.length != 0 && isShowListAppointHistory) Container( - height: model.appointHistoryList.length>2?MediaQuery.of(context).size.height * 0.25:MediaQuery.of(context).size.height * 0.15, + height: model.appointHistoryList.length > 2 + ? MediaQuery.of(context).size.height * 0.25 + : MediaQuery.of(context).size.height * 0.15, child: ListView.builder( itemCount: model.appointHistoryList.length, itemBuilder: (context, index) => InkWell( @@ -336,6 +343,10 @@ class _SendFeedbackPageState extends State { maxLines: 25, minLines: 13, controller: messageController, + suffixIcon: Icons.mic, + onSuffixTap: () { + openSpeechReco(); + }, validator: (value) { if (value.isEmpty) return TranslationBase.of(context).emptyMessage; @@ -345,11 +356,12 @@ class _SendFeedbackPageState extends State { ), InkWell( onTap: () { - ImageOptions.showImageOptions(context, (String image,File file) { + ImageOptions.showImageOptions(context, + (String image, File file) { setState(() { images.add(image); }); - } ); + }); }, child: Container( margin: EdgeInsets.only(left: 10, right: 10, top: 15), @@ -427,18 +439,21 @@ class _SendFeedbackPageState extends State { child: SecondaryButton( label: TranslationBase.of(context).send, textColor: Colors.white, - disabled: (titleController.text.toString().isEmpty || messageController.text.toString().isEmpty|| messageType == MessageType.NON), + disabled: (titleController.text.toString().isEmpty || + messageController.text.toString().isEmpty || + messageType == MessageType.NON), onTap: () { final form = formKey.currentState; - if (form.validate()) - if (messageType != MessageType.NON){ - GifLoaderDialogUtils.showMyDialog(context); - model.sendCOCItem( + if (form.validate()) if (messageType != MessageType.NON) { + GifLoaderDialogUtils.showMyDialog(context); + model + .sendCOCItem( title: titleController.text, attachment: images.length > 0 ? images[0] : "", details: messageController.text, cOCTypeName: getCOCName(), - appointHistory:messageType == MessageType.ComplaintOnAnAppointment + appointHistory: messageType == + MessageType.ComplaintOnAnAppointment ? appointHistory : null) .then((value) { @@ -456,9 +471,10 @@ class _SendFeedbackPageState extends State { AppToast.showErrorToast(message: model.error); GifLoaderDialogUtils.hideDialog(context); } - });} - else { - AppToast.showErrorToast(message: TranslationBase.of(context).selectPart); + }); + } else { + AppToast.showErrorToast( + message: TranslationBase.of(context).selectPart); } }, ), @@ -513,28 +529,64 @@ class _SendFeedbackPageState extends State { }, )); } + + openSpeechReco() async { + new RoboSearch(context: context).showAlertDialog(context); + _currentLocaleId = + TranslationBase.of(AppGlobal.context).locale.languageCode; + bool available = await speech.initialize( + onStatus: statusListener, onError: errorListener); + if (available) { + speech.listen( + onResult: resultListener, + // listenMode: ListenMode.confirmation, + localeId: _currentLocaleId == 'en' ? 'en-US' : 'ar-SA', + ); + } else { + print("The user has denied the use of speech recognition."); + } + } + + void errorListener(SpeechRecognitionError error) {} + + void statusListener(String status) { + reconizedWord = status == 'listening' ? 'Lisening...' : 'Sorry....'; + } + + void resultListener(result) { + reconizedWord = result.recognizedWords; + event.setValue({"searchText": reconizedWord}); + + if (result.finalResult == true) { + setState(() { + RoboSearch.closeAlertDialog(context); + messageController.text = reconizedWord; + }); + } + } } class FeedbackTypeDialog extends StatefulWidget { final Function(MessageType) onValueSelected; final MessageType messageTypeDialog; - const FeedbackTypeDialog({Key key, this.onValueSelected, this.messageTypeDialog=MessageType.NON}) : super(key: key); + const FeedbackTypeDialog( + {Key key, this.onValueSelected, this.messageTypeDialog = MessageType.NON}) + : super(key: key); @override State createState() => new FeedbackTypeDialogState(); } class FeedbackTypeDialogState extends State { - - MessageType messageTypeDialog = MessageType.NON; setMessageDialogType(MessageType messageType) { - setState(() { - messageTypeDialog = messageType; - }); + setState(() { + messageTypeDialog = messageType; + }); } + @override void initState() { messageTypeDialog = widget.messageTypeDialog; @@ -562,10 +614,10 @@ class FeedbackTypeDialogState extends State { Expanded( flex: 1, child: InkWell( - onTap: () => setMessageDialogType( - MessageType.NON), + onTap: () => setMessageDialogType(MessageType.NON), child: ListTile( - title: Texts(TranslationBase.of(context).notClassified), + title: + Texts(TranslationBase.of(context).notClassified), leading: Radio( value: MessageType.NON, groupValue: messageTypeDialog, @@ -589,7 +641,8 @@ class FeedbackTypeDialogState extends State { onTap: () => setMessageDialogType( MessageType.ComplaintOnAnAppointment), child: ListTile( - title: Texts(TranslationBase.of(context).complainAppo), + title: + Texts(TranslationBase.of(context).complainAppo), leading: Radio( value: MessageType.ComplaintOnAnAppointment, groupValue: messageTypeDialog, @@ -613,7 +666,8 @@ class FeedbackTypeDialogState extends State { onTap: () => setMessageDialogType( MessageType.ComplaintWithoutAppointment), child: ListTile( - title: Texts(TranslationBase.of(context).complainWithoutAppo), + title: Texts( + TranslationBase.of(context).complainWithoutAppo), leading: Radio( value: MessageType.ComplaintWithoutAppointment, groupValue: messageTypeDialog, @@ -634,8 +688,7 @@ class FeedbackTypeDialogState extends State { Expanded( flex: 1, child: InkWell( - onTap: () => - setMessageDialogType(MessageType.Question), + onTap: () => setMessageDialogType(MessageType.Question), child: ListTile( title: Texts(TranslationBase.of(context).question), leading: Radio( @@ -690,7 +743,8 @@ class FeedbackTypeDialogState extends State { value: MessageType.Suggestion, groupValue: messageTypeDialog, activeColor: Theme.of(context).primaryColor, - onChanged: (MessageType value) => setMessageDialogType(value), + onChanged: (MessageType value) => + setMessageDialogType(value), ), ), ), @@ -745,7 +799,7 @@ class FeedbackTypeDialogState extends State { padding: const EdgeInsets.all(8.0), child: Center( child: Texts( - TranslationBase.of(context).ok, + TranslationBase.of(context).ok, fontWeight: FontWeight.w400, )), ), diff --git a/lib/pages/landing/home_page.dart b/lib/pages/landing/home_page.dart index ef38ae9c..d1b8d4f3 100644 --- a/lib/pages/landing/home_page.dart +++ b/lib/pages/landing/home_page.dart @@ -358,7 +358,7 @@ class _HomePageState extends State { height: 5, ), Texts( - '${DateUtil.getMonthDayYearDateFormatted(model.user.dateofBirthDataTime)} ,${model.user.genderDescription} ${model.user.ageDesc}', + '${DateUtil.getMonthDayYearDateFormatted(model.user.dateofBirthDataTime)} ,${model.user.gender == 1 ? TranslationBase.of(context).male : TranslationBase.of(context).female} ${model.user.age.toString() + "y"}', color: Colors.grey[100], fontWeight: FontWeight.normal, fontSize: 14, @@ -387,9 +387,10 @@ class _HomePageState extends State { child: Center( child: Texts( TranslationBase.of(context) - .viewMore, + .myMedicalFile, color: Colors.white, fontSize: 12, + textAlign: TextAlign.center, ), ), ), @@ -461,23 +462,27 @@ class _HomePageState extends State { ], ), Padding( - padding: const EdgeInsets.only(bottom: 15, right: 15, left: 15), + padding: + const EdgeInsets.only(bottom: 15, right: 15, left: 15), child: InkWell( - onTap: (){ - Navigator.of(context).push(MaterialPageRoute(builder: (context) => PackagesHomePage())); + onTap: () { + Navigator.of(context).push(MaterialPageRoute( + builder: (context) => PackagesHomePage())); }, child: Container( decoration: BoxDecoration( - borderRadius: BorderRadius.circular(10), - color: Color(0xffB8382C), + borderRadius: BorderRadius.circular(10), + color: Color(0xffB8382C), ), child: Padding( padding: const EdgeInsets.all(8), child: Row( children: [ Texts( - TranslationBase.of(context).offerAndPackages, - color: Colors.white, fontSize: 20, fontWeight: FontWeight.normal, + TranslationBase.of(context).offerAndPackages, + color: Colors.white, + fontSize: 20, + fontWeight: FontWeight.normal, ), Spacer(), Image.asset("assets/images/offer_icon.png"), @@ -833,7 +838,7 @@ class _HomePageState extends State { } getPharmacyToken(DashboardViewModel model) async { - if(!model.isLogin) { + if (!model.isLogin) { Navigator.push(context, FadePage(page: LandingPagePharmacy())); } else { GifLoaderDialogUtils.showMyDialog(context); diff --git a/lib/pages/landing/landing_page.dart b/lib/pages/landing/landing_page.dart index c99930aa..c55b685b 100644 --- a/lib/pages/landing/landing_page.dart +++ b/lib/pages/landing/landing_page.dart @@ -543,7 +543,7 @@ class _LandingPageState extends State with WidgetsBindingObserver { children: [ HomePage( goToMyProfile: () { - _changeCurrentTab(0); + _changeCurrentTab(1); }, ), MedicalProfilePage(), diff --git a/lib/pages/login/confirm-login.dart b/lib/pages/login/confirm-login.dart index 1952de64..2ef8d0a2 100644 --- a/lib/pages/login/confirm-login.dart +++ b/lib/pages/login/confirm-login.dart @@ -31,6 +31,7 @@ import 'package:flutter/cupertino.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 'package:smart_progress_bar/smart_progress_bar.dart'; @@ -383,10 +384,21 @@ class _ConfirmLogin extends State { loginWithFingurePrintFace(type, isActive) async { if (isActive == 1) { // this.startBiometricLoginIfAvailable(); - authenticated = await auth.authenticateWithBiometrics( - localizedReason: 'Scan your fingerprint to authenticate', - useErrorDialogs: true, - stickyAuth: true); + 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) { + AppToast.showErrorToast(message: e.toString()); + } if (authenticated == true) { if (user != null && (user.logInType == 2 || user.logInType == 3)) { @@ -530,6 +542,7 @@ class _ConfirmLogin extends State { userData = result.list, // sharedPref.setString( // BLOOD_TYPE, result['PatientBloodType']), + authenticatedUserObject.user = result.list, sharedPref.setObject(MAIN_USER, result.list), sharedPref.setObject(USER_PROFILE, result.list), loginTokenID = result.logInTokenID, diff --git a/lib/pages/login/forgot-password.dart b/lib/pages/login/forgot-password.dart index cb2604b1..0bc93081 100644 --- a/lib/pages/login/forgot-password.dart +++ b/lib/pages/login/forgot-password.dart @@ -21,7 +21,7 @@ class _ForgotPassword extends State { String selectedType = 'Saudi Arabia'; String countryCode = '966'; final TextEditingController nationalIDorFile = null; - String mobileNo; + String mobileNo = ""; var con; @override Widget build(BuildContext context) { @@ -53,9 +53,15 @@ class _ForgotPassword extends State { mainAxisAlignment: MainAxisAlignment.center, children: [], ), - MobileNo( - onNumberChange: (value) => {mobileNo = value}, - onCountryChange: (value) => countryCode = value), + MobileNo(onNumberChange: (value) { + setState(() { + mobileNo = value; + }); + }, onCountryChange: (value) { + setState(() { + countryCode = value; + }); + }), ], ), ), @@ -73,6 +79,10 @@ class _ForgotPassword extends State { sendPatientIDBySMS(); // print(mobileNo.text); }, + color: mobileNo.length >= 9 == true + ? Colors.grey[900] + : Colors.grey, + textColor: Colors.white, )), ], ), @@ -85,7 +95,7 @@ class _ForgotPassword extends State { sendPatientIDBySMS() { GifLoaderDialogUtils.showMyDialog(context); final authService = new AuthProvider(); - authService.sendPatientIDSMS(mobileNo, context).then((res) { + authService.sendPatientIDSMS(mobileNo, countryCode, context).then((res) { GifLoaderDialogUtils.hideDialog(context); if (res['MessageStatus'] == 1) { this.startSMSService(mobileNo, res['LogInTokenID']); diff --git a/lib/pages/login/login.dart b/lib/pages/login/login.dart index 8d655f76..927e98de 100644 --- a/lib/pages/login/login.dart +++ b/lib/pages/login/login.dart @@ -265,6 +265,7 @@ class _Login extends State { authenticatedUserObject.isLogin = true; appointmentRateViewModel.isLogin = true; projectViewModel.isLogin = true; + authenticatedUserObject.user = result.list; projectViewModel.user = authenticatedUserObject.user; await pharmacyModuleViewModel.generatePharmacyToken().then((value) async { diff --git a/lib/services/authentication/auth_provider.dart b/lib/services/authentication/auth_provider.dart index bd2006f8..43fdc456 100644 --- a/lib/services/authentication/auth_provider.dart +++ b/lib/services/authentication/auth_provider.dart @@ -376,26 +376,16 @@ class AuthProvider with ChangeNotifier { } } - Future sendPatientIDSMS(mobileNo, context) async { + Future sendPatientIDSMS(mobileNo, zipCode, context) async { Map request; - // var languageID = - // await sharedPref.getStringWithDefaultValue(APP_LANGUAGE, 'ar'); + Request req = appGlobal.getPublicRequest(); request = { - // "LanguageID": languageID == 'ar' ? 1 : 2, - // "IPAdress": "10.20.10.20", - // "VersionID": req.VersionID, - // "Channel": req.Channel, - // "generalid": 'Cs2020@2016\$2958', - // "PatientOutSA": 0, - // "PatientID": 0, - // "TokenID": "", + "PatientOutSA": zipCode == '+966' ? 0 : 1, "PatientMobileNumber": mobileNo, "SearchType": 2, - // "ZipCode": "966", - // "PatientIdentificationID": "", + "ZipCode": zipCode, "DeviceTypeID": req.DeviceTypeID, - // "SessionID": null }; dynamic localRes; diff --git a/lib/widgets/drawer/app_drawer_widget.dart b/lib/widgets/drawer/app_drawer_widget.dart index c4a7d8d0..5192e0f0 100644 --- a/lib/widgets/drawer/app_drawer_widget.dart +++ b/lib/widgets/drawer/app_drawer_widget.dart @@ -160,8 +160,13 @@ class _AppDrawerState extends State { children: [ InkWell( child: DrawerItem( - TranslationBase.of(context).arabicChange, - Icons.translate), + TranslationBase.of(context).arabicChange, + Padding( + child: + Image.asset('assets/images/lang.png'), + padding: EdgeInsets.all(3)), + isImageIcon: true, + ), onTap: () { sharedPref.setBool(IS_ROBOT_INIT, null); if (projectProvider.isArabic) { @@ -304,7 +309,7 @@ class _AppDrawerState extends State { padding: EdgeInsets.only(left: 5, right: 5), child: Column(crossAxisAlignment: CrossAxisAlignment.start, children: [ AppText(result.patientName, color: result.responseID == user.patientID ? Color(0xFF40ACC9) : Colors.black), - AppText(TranslationBase.of(context).fileno + ": " + result.iD.toString(), color: result.responseID == user.patientID ? Color(0xFF40ACC9) : Colors.black), + AppText(TranslationBase.of(context).fileno + ": " + result.patientID.toString(), color: result.responseID == user.patientID ? Color(0xFF40ACC9) : Colors.black), ]))), ], ))) diff --git a/lib/widgets/drawer/drawer_item_widget.dart b/lib/widgets/drawer/drawer_item_widget.dart index bca885b0..beb6ef4a 100644 --- a/lib/widgets/drawer/drawer_item_widget.dart +++ b/lib/widgets/drawer/drawer_item_widget.dart @@ -9,19 +9,21 @@ import 'package:flutter/material.dart'; class DrawerItem extends StatefulWidget { final String title; final String subTitle; - final IconData icon; + final icon; final Color textColor; final Color iconColor; final bool bottomLine; final bool sideArrow; final Widget count; + final bool isImageIcon; DrawerItem(this.title, this.icon, {this.textColor, this.iconColor, this.subTitle = '', this.bottomLine = true, this.count, - this.sideArrow = false}); + this.sideArrow = false, + this.isImageIcon = false}); @override _DrawerItemState createState() => _DrawerItemState(); @@ -47,13 +49,15 @@ class _DrawerItemState extends State { children: [ Expanded( flex: 1, - child: Icon( - widget.icon, - color: widget.iconColor == null - ? Theme.of(context).textTheme.bodyText1.color - : widget.iconColor, - size: SizeConfig.imageSizeMultiplier * 5, - )), + child: widget.isImageIcon == true + ? widget.icon + : Icon( + widget.icon, + color: widget.iconColor == null + ? Theme.of(context).textTheme.bodyText1.color + : widget.iconColor, + size: SizeConfig.imageSizeMultiplier * 5, + )), Expanded( flex: 7, child: Column( diff --git a/lib/widgets/mobile-no/mobile_no.dart b/lib/widgets/mobile-no/mobile_no.dart index d088586b..6e89f529 100644 --- a/lib/widgets/mobile-no/mobile_no.dart +++ b/lib/widgets/mobile-no/mobile_no.dart @@ -1,24 +1,14 @@ import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; +import 'package:diplomaticquarterapp/models/mobile_number.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:provider/provider.dart'; import '../../Constants.dart'; -// OWNER : Ibrahim albitar -// DATE : 12-04-2020 -// DESCRIPTION : Customization for Texts in app - class MobileNo extends StatefulWidget { final bool disabled; - // final String data; - final List countries = [ - new Countries( name: "Saudi Arabia", - name_ar:"المملكة العربية السعودية", code: '966' ), - new Countries(name: "United Arab Emirates", - name_ar:"الإمارات العربية المتحدة", code: '971'), - ]; final double margin; final double marginTop; final double marginRight; @@ -44,9 +34,18 @@ class MobileNo extends StatefulWidget { } class _MobileNo extends State { - var _selectedType = '966'; - String countryCode = '966'; + var _selectedType = '+966'; + String countryCode = '+966'; + List counties = []; ProjectViewModel projectProvider; + @override + void initState() { + countriesData.forEach((element) { + this.counties.add(Countries.fromJson(element)); + }); + super.initState(); + } + @override Widget build(BuildContext context) { projectProvider = Provider.of(context); @@ -83,11 +82,13 @@ class _MobileNo extends State { _selectedType = value; }) }, - items: widget.countries - .map>((Countries value) { + items: counties.map>( + (Countries value) { return DropdownMenuItem( value: value.code, - child: Text(projectProvider.isArabic == true ? value.name_ar : value.name), + child: Text(projectProvider.isArabic == true + ? value.nameAr + : value.name), ); }).toList())))), ), @@ -124,13 +125,19 @@ class _MobileNo extends State { left: widget.marginLeft), child: TextField( controller: widget.controller, - keyboardType: TextInputType.phone, + keyboardType: TextInputType.number, + maxLength: 10, + + // maxLengthEnforced: true, // onChanged: (value) { // widget.controller.text = countryCode; // }, onChanged: (value) => widget.onNumberChange(value), + decoration: InputDecoration( - border: InputBorder.none, hintText: '5xxxxxxxx'), + counterText: "", + border: InputBorder.none, + hintText: '5xxxxxxxx'), ), ), ) @@ -140,10 +147,10 @@ class _MobileNo extends State { } } -class Countries { - final String name; - final String name_ar; - final String code; +// class Countries { +// final String name; +// final String name_ar; +// final String code; - Countries({this.name, this.name_ar, this.code}); -} +// Countries({this.name, this.name_ar, this.code}); +// }