diff --git a/assets/images/new/payment/Apple_Pay.png b/assets/images/new/payment/Apple_Pay.png new file mode 100644 index 00000000..1dc75042 Binary files /dev/null and b/assets/images/new/payment/Apple_Pay.png differ diff --git a/assets/images/new/payment/Mada.png b/assets/images/new/payment/Mada.png new file mode 100644 index 00000000..905a5ba8 Binary files /dev/null and b/assets/images/new/payment/Mada.png differ diff --git a/assets/images/new/payment/Mastercard.png b/assets/images/new/payment/Mastercard.png new file mode 100644 index 00000000..5d8b1fa5 Binary files /dev/null and b/assets/images/new/payment/Mastercard.png differ diff --git a/assets/images/new/payment/installments.png b/assets/images/new/payment/installments.png new file mode 100644 index 00000000..b2b231bf Binary files /dev/null and b/assets/images/new/payment/installments.png differ diff --git a/assets/images/new/payment/visa.png b/assets/images/new/payment/visa.png new file mode 100644 index 00000000..3a6d90dd Binary files /dev/null and b/assets/images/new/payment/visa.png differ diff --git a/lib/config/config.dart b/lib/config/config.dart index 7840b97d..126cb034 100644 --- a/lib/config/config.dart +++ b/lib/config/config.dart @@ -12,8 +12,8 @@ const PACKAGES_PRODUCTS = '/api/products'; const PACKAGES_CUSTOMER = '/api/customers'; 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://uat.hmgwebservices.com/'; +// const BASE_URL = 'https://hmgwebservices.com/'; // Pharmacy UAT URLs // const BASE_PHARMACY_URL = 'https://uat.hmgwebservices.com/epharmacy/api/'; @@ -438,6 +438,11 @@ const PHARMACY_MAKE_REVIEW = 'epharmacy/api/insertreviews'; const BLOOD_DONATION_REGISTER_BLOOD_TYPE = 'Services/PatientVarification.svc/REST/BloodDonation_RegisterBloodType'; const ADD_USER_AGREEMENT_FOR_BLOOD_DONATION = 'Services/PatientVarification.svc/REST/AddUserAgreementForBloodDonation'; + +// CMC RC SERVICES +const GET_ALL_CMC_SERVICES_RC = 'rc/api/cmc/getallcmc'; +const ADD_CMC_ORDER_RC = 'rc/api/cmc/add'; + //Pharmacy wishlist const GET_WISHLIST = "shopping_cart_items/"; const DELETE_WISHLIST = "delete_shopping_cart_item_by_product?customer_id="; diff --git a/lib/config/localized_values.dart b/lib/config/localized_values.dart index 92d7f0b7..139ee7a6 100644 --- a/lib/config/localized_values.dart +++ b/lib/config/localized_values.dart @@ -894,7 +894,7 @@ const Map localizedValues = { "somethingWentWrongTryLater": {"en": "Sorry something went wrong please try again later", "ar": "نعتذر عن خدمتك يرجى المحاولة لاحقا"}, "TotalAmountPayable": {"en": "Total Amount Payable:", "ar": " إجمالي المبلغ المستحق:"}, "iAcceptTermsConditions": {"en": "I Accept the Terms and Conditions", "ar": "أوافق على الشروط والأحكام"}, - "YouCanPayByTheFollowingOptions": {"en": "You can pay by the following Options:", "ar": "يمكنك الدفع عن طريق الخيارات التالية:"}, + "YouCanPayByTheFollowingOptions": {"en": "You can pay by the following options:", "ar": "يمكنك الدفع عن طريق الخيارات التالية:"}, "RRTDDetails": { "en": "The RRT service provides medical service for urgent and stable cases, not life-threatening situations or extremities, and the service includes providing medical care from a complete medical team at home.", @@ -1146,7 +1146,7 @@ const Map localizedValues = { "other": {"en": "Other", "ar": "آخر"}, "measure-unit": {"en": "Measure unit", "ar": "وحدة القياس"}, "measure-time": {"en": "Measure time", "ar": "وقت القياس"}, - "update": {"en": "Update", "ar": "تعديل"}, + "update": {"en": "Update", "ar": "تحديث"}, "bloodD-enter-desc": {"en": "Enter the required information, in order to register for Blood Donation Service", "ar": "أدخل المعلومات المطلوبة ، للتسجيل في خدمة التبرع بالدم"}, "viewTermsConditions": {"en": "To view the terms and conditions", "ar": "لعرض الشروط والأحكام"}, "WalkinAppo": {"en": "Hospital Visit Appointment", "ar": "موعد زيارة للمستشفى"}, @@ -1497,4 +1497,12 @@ const Map localizedValues = { "years": {"en": "Years", "ar": "سنوات"}, "respirationBPM": {"en": "bpm", "ar": "نفس"}, "extremeObese": {"en": "Extreme Obese", "ar": "السمنة المفرطة"}, + "selectLanguage": { "en": "Please select any language:", "ar": ":الرجاء تحديد أي لغة" }, + "recAlert": { "en": "How do you want to receive alerts?", "ar": "كيف تريد تلقي التنبيهات؟" }, + "modesBelow": { "en": "Please select the modes below:", "ar": ":الرجاء تحديد الأوضاع أدناه" }, + "prefferedMode": { "en": "Please select the preferred mode below:", "ar": ":الرجاء تحديد الوضع المفضل أدناه" }, + "permissionsBellow": { "en": "Please allow the permissions below:", "ar": ":الرجاء السماح الأذونات أدناه" }, +"invoiceDetails": { "en": "Invoice Details", "ar": "تفاصيل الفاتورة" }, +"appoDetails": {"en": "Appointment Details", "ar": "تفاصيل الموعد"}, +"appoPaymentConfirm": {"en": "Are you sure you Want to make payment for this appointment?", "ar": "هل أنت متأكد من أنك تريد سداد هذا الموعد؟"}, }; diff --git a/lib/core/model/AlHabibMedicalService/ComprehensiveMedicalCheckup/cmc_insert_pres_order_request_model.dart b/lib/core/model/AlHabibMedicalService/ComprehensiveMedicalCheckup/cmc_insert_pres_order_request_model.dart index 534988a7..8cece1f5 100644 --- a/lib/core/model/AlHabibMedicalService/ComprehensiveMedicalCheckup/cmc_insert_pres_order_request_model.dart +++ b/lib/core/model/AlHabibMedicalService/ComprehensiveMedicalCheckup/cmc_insert_pres_order_request_model.dart @@ -73,20 +73,21 @@ class CMCInsertPresOrderRequestModel { data['LanguageID'] = this.languageID; data['IPAdress'] = this.iPAdress; data['generalid'] = this.generalid; - data['PatientOutSA'] = this.patientOutSA; + data['patientOutSa'] = this.patientOutSA; + data['isOutPatient'] = this.patientOutSA == 0 ? false : true; data['SessionID'] = this.sessionID; data['isDentalAllowedBackend'] = this.isDentalAllowedBackend; data['DeviceTypeID'] = this.deviceTypeID; - data['PatientID'] = this.patientID; + data['patientId'] = this.patientID.toString(); data['TokenID'] = this.tokenID; data['PatientTypeID'] = this.patientTypeID; data['PatientType'] = this.patientType; - data['Latitude'] = this.latitude; - data['Longitude'] = this.longitude; - data['CreatedBy'] = this.createdBy; + data['latitude'] = this.latitude; + data['longitude'] = this.longitude; + // data['CreatedBy'] = this.createdBy; data['OrderServiceID'] = this.orderServiceID; if (this.patientERCMCInsertServicesList != null) { - data['PatientER_CMC_InsertServicesList'] = + data['procedures'] = this.patientERCMCInsertServicesList.map((v) => v.toJson()).toList(); } return data; diff --git a/lib/core/model/AlHabibMedicalService/ComprehensiveMedicalCheckup/get_cmc_service_response_model.dart b/lib/core/model/AlHabibMedicalService/ComprehensiveMedicalCheckup/get_cmc_service_response_model.dart index 5f356e2b..42d2fb99 100644 --- a/lib/core/model/AlHabibMedicalService/ComprehensiveMedicalCheckup/get_cmc_service_response_model.dart +++ b/lib/core/model/AlHabibMedicalService/ComprehensiveMedicalCheckup/get_cmc_service_response_model.dart @@ -1,44 +1,56 @@ class GetCMCServicesResponseModel { - String description; - String descriptionN; - int iD; - bool isActive; + int id; + String serviceID; + int orderServiceID; + String text; + String textN; dynamic price; - int serviceID; - dynamic totalPrice; - dynamic vAT; + dynamic priceVAT; + dynamic priceTotal; + bool isEnabled; + int orderId; + int quantity; GetCMCServicesResponseModel( - {this.description, - this.descriptionN, - this.iD, - this.isActive, - this.price, + {this.id, this.serviceID, - this.totalPrice, - this.vAT}); + this.orderServiceID, + this.text, + this.textN, + this.price, + this.priceVAT, + this.priceTotal, + this.isEnabled, + this.orderId, + this.quantity}); GetCMCServicesResponseModel.fromJson(Map json) { - description = json['Description']; - descriptionN = json['DescriptionN']; - iD = json['ID']; - isActive = json['IsActive']; - price = json['Price']; - serviceID = json['ServiceID']; - totalPrice = json['TotalPrice']; - vAT = json['VAT']; + id = json['id']; + serviceID = json['serviceID']; + orderServiceID = json['orderServiceID']; + text = json['text']; + textN = json['textN']; + price = json['price']; + priceVAT = json['priceVAT']; + priceTotal = json['priceTotal']; + isEnabled = json['isEnabled']; + orderId = json['orderId']; + quantity = json['quantity']; } Map toJson() { final Map data = new Map(); - data['Description'] = this.description; - data['DescriptionN'] = this.descriptionN; - data['ID'] = this.iD; - data['IsActive'] = this.isActive; - data['Price'] = this.price; - data['ServiceID'] = this.serviceID; - data['TotalPrice'] = this.totalPrice; - data['VAT'] = this.vAT; + data['id'] = this.id; + data['serviceID'] = this.serviceID; + data['orderServiceID'] = this.orderServiceID; + data['text'] = this.text; + data['textN'] = this.textN; + data['price'] = this.price; + data['priceVAT'] = this.priceVAT; + data['priceTotal'] = this.priceTotal; + data['isEnabled'] = this.isEnabled; + data['orderId'] = this.orderId; + data['quantity'] = this.quantity; return data; } } diff --git a/lib/core/service/AlHabibMedicalService/cmc_service.dart b/lib/core/service/AlHabibMedicalService/cmc_service.dart index 012e4d90..b79b6fdb 100644 --- a/lib/core/service/AlHabibMedicalService/cmc_service.dart +++ b/lib/core/service/AlHabibMedicalService/cmc_service.dart @@ -23,17 +23,30 @@ class CMCService extends BaseService { bool isOrderUpdated; Future getCMCAllServices() async { - GetCMCServicesRequestModel getCMCServicesRequestModel = new GetCMCServicesRequestModel(genderID: authenticatedUserObject.user.gender, identificationNo: authenticatedUserObject.user.patientIdentificationNo); + GetCMCServicesRequestModel getCMCServicesRequestModel = + new GetCMCServicesRequestModel(genderID: authenticatedUserObject.user.gender, identificationNo: authenticatedUserObject.user.patientIdentificationNo); hasError = false; - await baseAppClient.post(HHC_GET_ALL_CMC_SERVICES, onSuccess: (dynamic response, int statusCode) { + + // RC IMPLEMENTATION + await baseAppClient.post(GET_ALL_CMC_SERVICES_RC + "?patientID=" + user.patientID.toString(), isAllowAny: true, onSuccess: (dynamic response, int statusCode) { cmcAllServicesList.clear(); - response['PatientER_CMC_GetAllServicesList'].forEach((data) { + response.forEach((data) { cmcAllServicesList.add(GetCMCServicesResponseModel.fromJson(data)); }); }, onFailure: (String error, int statusCode) { hasError = true; super.error = error; - }, body: getCMCServicesRequestModel.toJson()); + }, body: {}); + + // await baseAppClient.post(HHC_GET_ALL_CMC_SERVICES, onSuccess: (dynamic response, int statusCode) { + // cmcAllServicesList.clear(); + // response['PatientER_CMC_GetAllServicesList'].forEach((data) { + // cmcAllServicesList.add(GetCMCServicesResponseModel.fromJson(data)); + // }); + // }, onFailure: (String error, int statusCode) { + // hasError = true; + // super.error = error; + // }, body: getCMCServicesRequestModel.toJson()); } Future getCmcAllPresOrders() async { @@ -87,12 +100,25 @@ class CMCService extends BaseService { }, body: updatePresOrderRequestModel.toJson()); } + Future insertCMCOrderRC({CMCInsertPresOrderRequestModel order}) async { + hasError = false; + String reqId = ""; + await baseAppClient.post(ADD_CMC_ORDER_RC, onSuccess: (dynamic response, int statusCode) { + isOrderUpdated = true; + reqId = response['RequestNo'].toString(); + }, onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + }, body: order.toJson()); + return reqId; + } + Future insertPresPresOrder({CMCInsertPresOrderRequestModel order}) async { hasError = false; - String reqId=""; + String reqId = ""; await baseAppClient.post(PATIENT_ER_INSERT_PRES_ORDER, onSuccess: (dynamic response, int statusCode) { isOrderUpdated = true; - reqId=response['RequestNo'].toString(); + reqId = response['RequestNo'].toString(); }, onFailure: (String error, int statusCode) { hasError = true; super.error = error; diff --git a/lib/core/service/AlHabibMedicalService/e_referral_service.dart b/lib/core/service/AlHabibMedicalService/e_referral_service.dart index f00d72ec..b1d716a9 100644 --- a/lib/core/service/AlHabibMedicalService/e_referral_service.dart +++ b/lib/core/service/AlHabibMedicalService/e_referral_service.dart @@ -116,6 +116,9 @@ class EReferralService extends BaseService { SearchEReferralRequestModel searchEReferralRequestModel) async { _allReferral.clear(); hasError = false; + + searchEReferralRequestModel.patientMobileNumber = "966545156035"; + // TODO return this code when the fix the server await baseAppClient.post(GET_E_REFERRALS, onSuccess: (dynamic response, int statusCode) { diff --git a/lib/core/service/client/base_app_client.dart b/lib/core/service/client/base_app_client.dart index b0c0925f..2365d2d1 100644 --- a/lib/core/service/client/base_app_client.dart +++ b/lib/core/service/client/base_app_client.dart @@ -113,6 +113,16 @@ class BaseAppClient { } } + // For RC Services + // if(body.containsKey("patientId")) + // body.remove("PatientID"); + // + // if(body.containsKey("patientOutSa")) + // body.remove("PatientOutSA"); + + // body['PatientID'] = 1018977; + // body['TokenID'] = "@dm!n"; + print("URL : $url"); final jsonBody = json.encode(body); print(jsonBody); @@ -126,60 +136,65 @@ class BaseAppClient { } else { var decoded = utf8.decode(response.bodyBytes); var parsed = json.decode(utf8.decode(response.bodyBytes)); - if (parsed['Response_Message'] != null) { + + if (isAllowAny) { onSuccess(parsed, statusCode); } else { - if (parsed['ErrorType'] == 4) { - navigateToAppUpdate(AppGlobal.context, parsed['ErrorEndUserMessage']); - } - if (parsed['ErrorType'] == 2) { - await logout(); - } - if (isAllowAny) { + if (parsed['Response_Message'] != null) { onSuccess(parsed, statusCode); - } else if (parsed['IsAuthenticated'] == null) { - if (parsed['isSMSSent'] == true) { - onSuccess(parsed, statusCode); - } else if (parsed['MessageStatus'] == 1) { - onSuccess(parsed, statusCode); - } else if (parsed['Result'] == 'OK') { + } else { + if (parsed['ErrorType'] == 4) { + navigateToAppUpdate(AppGlobal.context, parsed['ErrorEndUserMessage']); + } + if (parsed['ErrorType'] == 2) { + await logout(); + } + if (isAllowAny) { onSuccess(parsed, statusCode); - } else { - if (parsed != null) { + } else if (parsed['IsAuthenticated'] == null) { + if (parsed['isSMSSent'] == true) { + onSuccess(parsed, statusCode); + } else if (parsed['MessageStatus'] == 1) { + onSuccess(parsed, statusCode); + } else if (parsed['Result'] == 'OK') { onSuccess(parsed, statusCode); } else { - onFailure(parsed['ErrorEndUserMessage'] ?? parsed['ErrorMessage'], statusCode); - logout(); + if (parsed != null) { + onSuccess(parsed, statusCode); + } else { + onFailure(parsed['ErrorEndUserMessage'] ?? parsed['ErrorMessage'], statusCode); + logout(); + } } - } - } else if (parsed['MessageStatus'] == 1 || parsed['SMSLoginRequired'] == true) { - onSuccess(parsed, statusCode); - } else if (parsed['MessageStatus'] == 2 && parsed['IsAuthenticated']) { - if (parsed['SameClinicApptList'] != null) { + } else if (parsed['MessageStatus'] == 1 || parsed['SMSLoginRequired'] == true) { onSuccess(parsed, statusCode); - } else { - if (parsed['message'] == null && parsed['ErrorEndUserMessage'] == null) { - if (parsed['ErrorSearchMsg'] == null) { - onFailure("Server Error found with no available message", statusCode); + } else if (parsed['MessageStatus'] == 2 && parsed['IsAuthenticated']) { + if (parsed['SameClinicApptList'] != null) { + onSuccess(parsed, statusCode); + } else { + if (parsed['message'] == null && parsed['ErrorEndUserMessage'] == null) { + if (parsed['ErrorSearchMsg'] == null) { + onFailure("Server Error found with no available message", statusCode); + } else { + onFailure(parsed['ErrorSearchMsg'], statusCode); + } } else { - onFailure(parsed['ErrorSearchMsg'], statusCode); + onFailure(parsed['message'] ?? parsed['ErrorEndUserMessage'] ?? parsed['ErrorMessage'], statusCode); } - } else { - onFailure(parsed['message'] ?? parsed['ErrorEndUserMessage'] ?? parsed['ErrorMessage'], statusCode); } } - } - // else if (!parsed['IsAuthenticated']) { - // await logout(); - // } - else { - if (parsed['SameClinicApptList'] != null) { - onSuccess(parsed, statusCode); - } else { - if (parsed['message'] != null) { - onFailure(parsed['message'] ?? parsed['message'], statusCode); + // else if (!parsed['IsAuthenticated']) { + // await logout(); + // } + else { + if (parsed['SameClinicApptList'] != null) { + onSuccess(parsed, statusCode); } else { - onFailure(parsed['ErrorEndUserMessage'] ?? parsed['ErrorMessage'], statusCode); + if (parsed['message'] != null) { + onFailure(parsed['message'] ?? parsed['message'], statusCode); + } else { + onFailure(parsed['ErrorEndUserMessage'] ?? parsed['ErrorMessage'], statusCode); + } } } } diff --git a/lib/core/service/medical/prescriptions_service.dart b/lib/core/service/medical/prescriptions_service.dart index ce91be53..fa2a24c6 100644 --- a/lib/core/service/medical/prescriptions_service.dart +++ b/lib/core/service/medical/prescriptions_service.dart @@ -34,10 +34,10 @@ class PrescriptionsService extends BaseService { } Future getPrescriptionsOrders() async { + prescriptionsOrderList.clear(); Map body = Map(); body['isDentalAllowedBackend'] = false; await baseAppClient.post(GET_PRESCRIPTIONS_ALL_ORDERS, onSuccess: (dynamic response, int statusCode) { - prescriptionsOrderList.clear(); response['PatientER_GetPatientAllPresOrdersList'].forEach((prescriptionsOrder) { prescriptionsOrderList.add(PrescriptionsOrder.fromJson(prescriptionsOrder)); }); diff --git a/lib/core/viewModels/AlHabibMedicalService/H2O_view_model.dart b/lib/core/viewModels/AlHabibMedicalService/H2O_view_model.dart index 219103da..3e980071 100644 --- a/lib/core/viewModels/AlHabibMedicalService/H2O_view_model.dart +++ b/lib/core/viewModels/AlHabibMedicalService/H2O_view_model.dart @@ -9,14 +9,19 @@ import 'package:diplomaticquarterapp/core/model/AlHabibMedicalService/H2O/user_p import 'package:diplomaticquarterapp/core/model/AlHabibMedicalService/H2O/user_progress_for_week_data_model.dart'; import 'package:diplomaticquarterapp/core/service/AlHabibMedicalService/H2O_service.dart'; import 'package:diplomaticquarterapp/core/viewModels/base_view_model.dart'; +import 'package:diplomaticquarterapp/widgets/charts/custom_line_chart.dart'; import '../../../locator.dart'; class H2OViewModel extends BaseViewModel { H2OService _h2OService = locator(); - List userProgressForWeekDataSeries; - List userProgressForMonthDataSeries; + // + // List userProgressForWeekDataSeries; + List userProgressForWeekDataSeries; + List userProgressForMonthDataSeries; + + // List userProgressForMonthDataSeries; UserDetailModel get userDetail => _h2OService.userDetailModel; @@ -71,7 +76,8 @@ class H2OViewModel extends BaseViewModel { error = _h2OService.error; setState(ViewState.Error); } else { - userProgressForWeekDataSeries = createUserProgressForWeekDataSeries(); + // userProgressForWeekDataSeries = createUserProgressForWeekDataSeries(); + userProgressForWeekDataSeries = createUserProgressForWeekDataSeriesNew(); setState(ViewState.Idle); } } @@ -83,7 +89,7 @@ class H2OViewModel extends BaseViewModel { error = _h2OService.error; setState(ViewState.Error); } else { - userProgressForMonthDataSeries = createUserProgressForMonthDataSeries(); + userProgressForMonthDataSeries = createUserProgressForMonthDataSeriesNew(); setState(ViewState.Idle); } } @@ -113,6 +119,23 @@ class H2OViewModel extends BaseViewModel { ]; } + List createUserProgressForWeekDataSeriesNew() { + List list = []; + + _h2OService.userProgressForWeekDataList.forEach((UserProgressForWeekDataModel data) { + list.add(new LineChartModel(data.dayName, data.percentageConsumed)); + }); + return list; + } + + List createUserProgressForMonthDataSeriesNew() { + List list = []; + _h2OService.userProgressForMonthDataList.forEach((UserProgressForMonthDataModel data) { + list.add(new LineChartModel(data.monthName, data.percentageConsumed)); + }); + return list; + } + List> createUserProgressForMonthDataSeries() { List globalData = []; _h2OService.userProgressForMonthDataList.forEach((UserProgressForMonthDataModel data) { diff --git a/lib/core/viewModels/AlHabibMedicalService/cmc_view_model.dart b/lib/core/viewModels/AlHabibMedicalService/cmc_view_model.dart index de007d67..8080ddec 100644 --- a/lib/core/viewModels/AlHabibMedicalService/cmc_view_model.dart +++ b/lib/core/viewModels/AlHabibMedicalService/cmc_view_model.dart @@ -38,9 +38,6 @@ class CMCViewModel extends BaseViewModel { Future getCMCAllServices() async { await _cMCService.getCMCAllServices(); - CMCGetItemsRequestModel cMCGetItemsRequestModel = new CMCGetItemsRequestModel(checkupType: cmcAllServicesList[0].iD); - - await getCheckupItems(cMCGetItemsRequestModel: cMCGetItemsRequestModel, isFirst: true); if (_cMCService.hasError) { error = _cMCService.error; setState(ViewState.Error); @@ -92,7 +89,6 @@ class CMCViewModel extends BaseViewModel { await _cMCService.getOrderDetailByOrderID(getOrderDetailByOrderIDRequestModel); } - //TODO check it in uat Future insertPresPresOrder({CMCInsertPresOrderRequestModel order}) async { setState(ViewState.Busy); order.createdBy = user.patientID; @@ -104,7 +100,20 @@ class CMCViewModel extends BaseViewModel { } else { getCmcAllPresOrders(); } + return requestId; + } + Future insertCMCOrderRC({CMCInsertPresOrderRequestModel order}) async { + setState(ViewState.Busy); + order.createdBy = user.patientID; + order.orderServiceID = OrderService.Comprehensive_Medical_Checkup.getIdOrderService(); + String requestId = await _cMCService.insertCMCOrderRC(order: order); + if (_cMCService.hasError) { + error = _cMCService.error; + setState(ViewState.ErrorLocal); + } else { + getCmcAllPresOrders(); + } return requestId; } diff --git a/lib/core/viewModels/medical/prescriptions_view_model.dart b/lib/core/viewModels/medical/prescriptions_view_model.dart index 38009f45..0c1fafdf 100644 --- a/lib/core/viewModels/medical/prescriptions_view_model.dart +++ b/lib/core/viewModels/medical/prescriptions_view_model.dart @@ -77,14 +77,17 @@ class PrescriptionsViewModel extends BaseViewModel { } getPrescriptionsOrders({bool showLoading = false}) async { - if (showLoading) setState(ViewState.Busy); - await _prescriptionsService.getPrescriptionsOrders(); - if (_prescriptionsService.hasError) { - error = _prescriptionsService.error; - setState(ViewState.ErrorLocal); - } else { - setState(ViewState.Idle); - } + // print(showLoading); + setState(ViewState.Busy); + Future.delayed(new Duration(milliseconds: 300)).then((value) async { + await _prescriptionsService.getPrescriptionsOrders(); + if (_prescriptionsService.hasError) { + error = _prescriptionsService.error; + setState(ViewState.ErrorLocal); + } else { + setState(ViewState.Idle); + } + }); } setFilterType(FilterType filterType) { diff --git a/lib/pages/AlHabibMedicalService/ComprehensiveMedicalCheckup/NewCMC/new_cmc_page.dart b/lib/pages/AlHabibMedicalService/ComprehensiveMedicalCheckup/NewCMC/new_cmc_page.dart index 859580ef..5093729c 100644 --- a/lib/pages/AlHabibMedicalService/ComprehensiveMedicalCheckup/NewCMC/new_cmc_page.dart +++ b/lib/pages/AlHabibMedicalService/ComprehensiveMedicalCheckup/NewCMC/new_cmc_page.dart @@ -46,11 +46,11 @@ class _NewCMCPageState extends State with TickerProviderStateMixin { patientERCMCInsertServicesList = new PatientERCMCInsertServicesList( price: widget.model.cmcAllServicesList[0].price, serviceID: widget.model.cmcAllServicesList[0].serviceID.toString(), - selectedServiceName: widget.model.cmcAllServicesList[0].description, - selectedServiceNameAR: widget.model.cmcAllServicesList[0].descriptionN, + selectedServiceName: widget.model.cmcAllServicesList[0].text, + selectedServiceNameAR: widget.model.cmcAllServicesList[0].textN, recordID: 1, - totalPrice: widget.model.cmcAllServicesList[0].totalPrice, - vAT: widget.model.cmcAllServicesList[0].vAT); + totalPrice: widget.model.cmcAllServicesList[0].priceTotal, + vAT: widget.model.cmcAllServicesList[0].priceVAT); cMCInsertPresOrderRequestModel = new CMCInsertPresOrderRequestModel(patientERCMCInsertServicesList: [patientERCMCInsertServicesList]); } diff --git a/lib/pages/AlHabibMedicalService/ComprehensiveMedicalCheckup/NewCMC/new_cmc_step_one_page.dart b/lib/pages/AlHabibMedicalService/ComprehensiveMedicalCheckup/NewCMC/new_cmc_step_one_page.dart index 32aaa898..5e2b0498 100644 --- a/lib/pages/AlHabibMedicalService/ComprehensiveMedicalCheckup/NewCMC/new_cmc_step_one_page.dart +++ b/lib/pages/AlHabibMedicalService/ComprehensiveMedicalCheckup/NewCMC/new_cmc_step_one_page.dart @@ -63,18 +63,18 @@ class _NewCMCStepOnePageState extends State { return Row( children: [ Radio( - value: widget.model.cmcAllServicesList[index].serviceID, + value: num.tryParse(widget.model.cmcAllServicesList[index].serviceID), activeColor: Colors.red[800], onChanged: (newValue) async { selectedItem = index; PatientERCMCInsertServicesList patientERCMCInsertServicesList = new PatientERCMCInsertServicesList( price: widget.model.cmcAllServicesList[index].price, - serviceID: widget.model.cmcAllServicesList[index].serviceID.toString(), - selectedServiceName: widget.model.cmcAllServicesList[index].description, - selectedServiceNameAR: widget.model.cmcAllServicesList[index].descriptionN, + serviceID: widget.model.cmcAllServicesList[index].serviceID, + selectedServiceName: widget.model.cmcAllServicesList[index].text, + selectedServiceNameAR: widget.model.cmcAllServicesList[index].textN, recordID: 1, - totalPrice: widget.model.cmcAllServicesList[index].totalPrice, - vAT: widget.model.cmcAllServicesList[index].vAT); + totalPrice: widget.model.cmcAllServicesList[index].priceTotal, + vAT: widget.model.cmcAllServicesList[index].priceVAT); setState(() { widget.cMCInsertPresOrderRequestModel.patientERCMCInsertServicesList = [patientERCMCInsertServicesList]; }); @@ -93,7 +93,7 @@ class _NewCMCStepOnePageState extends State { bottom: 20, ), child: Text( - projectViewModel.isArabic ? widget.model.cmcAllServicesList[index].descriptionN : widget.model.cmcAllServicesList[index].description, + projectViewModel.isArabic ? widget.model.cmcAllServicesList[index].textN : widget.model.cmcAllServicesList[index].text, style: TextStyle( fontSize: 14, fontWeight: FontWeight.w600, @@ -135,50 +135,6 @@ class _NewCMCStepOnePageState extends State { ), ], ), - // Card( - // shape: cardRadius(12), - // elevation: 4, - // child: Container( - // width: double.infinity, - // child: Column( - // crossAxisAlignment: CrossAxisAlignment.start, - // children: [ - // Padding( - // padding: const EdgeInsets.only(left: 12, right: 12, top: 12), - // child: Text( - // TranslationBase.of(context).coveredService, - // style: TextStyle( - // fontSize: 14, - // fontWeight: FontWeight.w600, - // letterSpacing: -0.45, - // ), - // ), - // ), - // ListView.separated( - // itemBuilder: (context, index) { - // return Padding( - // padding: const EdgeInsets.all(12.0), - // child: Text( - // widget.model.checkupItems[index].itemName, - // style: TextStyle( - // fontSize: 12, - // fontWeight: FontWeight.w600, - // letterSpacing: -0.45, - // ), - // ), - // ); - // }, - // separatorBuilder: (context, index) { - // return mDivider(Colors.grey); - // }, - // physics: NeverScrollableScrollPhysics(), - // shrinkWrap: true, - // itemCount: widget.model.checkupItems.length, - // ), - // ], - // ), - // ), - // ), ], ), ), @@ -194,13 +150,16 @@ class _NewCMCStepOnePageState extends State { PatientERCMCInsertServicesList patientERCMCInsertServicesList = new PatientERCMCInsertServicesList( price: widget.model.cmcAllServicesList[selectedItem].price, serviceID: widget.model.cmcAllServicesList[selectedItem].serviceID.toString(), - selectedServiceName: widget.model.cmcAllServicesList[selectedItem].description, - selectedServiceNameAR: widget.model.cmcAllServicesList[selectedItem].descriptionN, + selectedServiceName: widget.model.cmcAllServicesList[selectedItem].text, + selectedServiceNameAR: widget.model.cmcAllServicesList[selectedItem].textN, recordID: 1, - totalPrice: widget.model.cmcAllServicesList[selectedItem].totalPrice, - vAT: widget.model.cmcAllServicesList[selectedItem].vAT, + totalPrice: widget.model.cmcAllServicesList[selectedItem].priceTotal, + vAT: widget.model.cmcAllServicesList[selectedItem].priceVAT, ); + widget.cMCInsertPresOrderRequestModel.patientID = projectViewModel.user.patientID; + widget.cMCInsertPresOrderRequestModel.patientOutSA = projectViewModel.user.outSA; + widget.cMCInsertPresOrderRequestModel.patientERCMCInsertServicesList = [patientERCMCInsertServicesList]; await widget.model.getCustomerInfo(); // if (widget.model.state == ViewState.ErrorLocal) { diff --git a/lib/pages/AlHabibMedicalService/ComprehensiveMedicalCheckup/NewCMC/new_cmc_step_three_page.dart b/lib/pages/AlHabibMedicalService/ComprehensiveMedicalCheckup/NewCMC/new_cmc_step_three_page.dart index c314812c..a1b7ccee 100644 --- a/lib/pages/AlHabibMedicalService/ComprehensiveMedicalCheckup/NewCMC/new_cmc_step_three_page.dart +++ b/lib/pages/AlHabibMedicalService/ComprehensiveMedicalCheckup/NewCMC/new_cmc_step_three_page.dart @@ -202,7 +202,7 @@ class _NewCMCStepThreePageState extends State { color: CustomColors.green, onTap: () async { GifLoaderDialogUtils.showMyDialog(context); - String requestId = await widget.model.insertPresPresOrder(order: widget.cmcInsertPresOrderRequestModel); + String requestId = await widget.model.insertCMCOrderRC(order: widget.cmcInsertPresOrderRequestModel); GifLoaderDialogUtils.hideDialog(context); if (widget.model.state != ViewState.ErrorLocal) { //show scuccess dialog diff --git a/lib/pages/AlHabibMedicalService/E-Referral/New_E_Referral/new_e_referral_step_one_page.dart b/lib/pages/AlHabibMedicalService/E-Referral/New_E_Referral/new_e_referral_step_one_page.dart index d653cdc3..d7e2d099 100644 --- a/lib/pages/AlHabibMedicalService/E-Referral/New_E_Referral/new_e_referral_step_one_page.dart +++ b/lib/pages/AlHabibMedicalService/E-Referral/New_E_Referral/new_e_referral_step_one_page.dart @@ -13,6 +13,7 @@ import 'package:diplomaticquarterapp/pages/AlHabibMedicalService/E-Referral/dial import 'package:diplomaticquarterapp/pages/base/base_view.dart'; import 'package:diplomaticquarterapp/pages/medical/balance/new_text_Field.dart'; import 'package:diplomaticquarterapp/uitl/app_shared_preferences.dart'; +import 'package:diplomaticquarterapp/uitl/app_toast.dart'; import 'package:diplomaticquarterapp/uitl/gif_loader_dialog_utils.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:diplomaticquarterapp/widgets/buttons/defaultButton.dart'; @@ -54,43 +55,23 @@ class _NewEReferralStepOnePageState extends State { super.initState(); } + void showSMSDialog(EReferralViewModel model) { + SMSOTP( + context, + 1, + _selectedCountry['code'] + _mobileTextController.text, + (value) { + submit(model, value); + }, + () => { + Navigator.pop(context), + }, + ).displayDialog(context); + } + @override Widget build(BuildContext context) { projectViewModel = Provider.of(context); - void showSMSDialog(EReferralViewModel model) { - SMSOTP( - context, - 1, - _selectedCountry['code'] + _mobileTextController.text, - (value) { - submit(model, value); - }, - () => { - Navigator.pop(context), - }, - ).displayDialog(context); - // showDialog( - // context: context, - // barrierDismissible: false, - // child: EReferralConfirmSMSDialog( - // phoneNumber: _selectedCountry['code'] + _mobileTextController.text, - // onSucces: () { - // Navigator.of(context).pop(); - // widget.changePageViewIndex(1); - // widget.createEReferralRequestModel.requesterName = - // _nameTextController.text; - // widget.createEReferralRequestModel.requesterContactNo = - // _selectedCountry['code'].toString().substring(1) + - // _mobileTextController.text; - // widget.createEReferralRequestModel.requesterRelationship = - // _selectedRelation.iD; - // }), - // ).then((value) { - // print("dialog dismissed"); - // print(value); - // if (value != null && value) {} - // }); - } return BaseView( onModelReady: (model) => model.getRelationTypes(), @@ -205,6 +186,10 @@ class _NewEReferralStepOnePageState extends State { await model.checkActivationCodeForEReferral(checkActivationCodeForEReferralRequestModel); if (model.state == ViewState.ErrorLocal) { GifLoaderDialogUtils.hideDialog(context); + Future.delayed(Duration(seconds: 1), () { + AppToast.showErrorToast(message: model.error); + showSMSDialog(model); + }); } else { GifLoaderDialogUtils.hideDialog(context); Navigator.of(context).pop(); diff --git a/lib/pages/AlHabibMedicalService/E-Referral/referral_details.dart b/lib/pages/AlHabibMedicalService/E-Referral/referral_details.dart index 85ea80e6..1eaf9875 100644 --- a/lib/pages/AlHabibMedicalService/E-Referral/referral_details.dart +++ b/lib/pages/AlHabibMedicalService/E-Referral/referral_details.dart @@ -42,7 +42,7 @@ class _ReferralDetailsState extends State { Container( margin: EdgeInsets.only(bottom: 10.0), child: Text( - TranslationBase.of(context).referralDetails, + TranslationBase.of(context).ereferral, style: TextStyle( letterSpacing: -0.64, color: Colors.black, @@ -116,7 +116,7 @@ class _ReferralDetailsState extends State { ), Expanded( child: _getNormalText( - DateUtil.getMonthDayYearDateFormatted( + DateUtil.getDayMonthYearDateFormatted( DateUtil.convertStringToDateNoTimeZone( widget.referral.referralDate)), isBold: true), diff --git a/lib/pages/AlHabibMedicalService/E-Referral/search_for_referrals_page.dart b/lib/pages/AlHabibMedicalService/E-Referral/search_for_referrals_page.dart index 513eb3b2..356e8eb1 100644 --- a/lib/pages/AlHabibMedicalService/E-Referral/search_for_referrals_page.dart +++ b/lib/pages/AlHabibMedicalService/E-Referral/search_for_referrals_page.dart @@ -172,7 +172,7 @@ class _SearchForReferralsPageState extends State { child: myRichText(TranslationBase.of(context).patientName + ": ", model.allReferral[index].patientName, projectViewModel.isArabic)), myRichText(TranslationBase.of(context).hospital + ": ", model.allReferral[index].preferredBranchName, projectViewModel.isArabic), myRichText(TranslationBase.of(context).referralDate + ": ", - DateUtil.getMonthDayYearDateFormatted(DateUtil.convertStringToDateNoTimeZone(model.allReferral[index].referralDate)), projectViewModel.isArabic), + DateUtil.getDayMonthYearDateFormatted(DateUtil.convertStringToDateNoTimeZone(model.allReferral[index].referralDate)), projectViewModel.isArabic), ], ), Icon(projectViewModel.isArabic ? Icons.arrow_back_ios_outlined : Icons.arrow_forward_outlined), diff --git a/lib/pages/AlHabibMedicalService/all_habib_medical_service_page.dart b/lib/pages/AlHabibMedicalService/all_habib_medical_service_page.dart index b0b14f1d..ce3bde14 100644 --- a/lib/pages/AlHabibMedicalService/all_habib_medical_service_page.dart +++ b/lib/pages/AlHabibMedicalService/all_habib_medical_service_page.dart @@ -244,10 +244,7 @@ class _AllHabibMedicalServiceState extends State { imageLocation: 'assets/images/emergency_service_image.png', title: TranslationBase.of(context).emergencyService, ), - ServicesContainer( - onTap: () => getPharmacyToken(), - imageLocation: 'assets/images/pharmacy_logo.png', - title: TranslationBase.of(context).pharmacy), + ServicesContainer(onTap: () => getPharmacyToken(), imageLocation: 'assets/images/pharmacy_logo.png', title: TranslationBase.of(context).pharmacy), ServicesContainer( onTap: () => Navigator.push( context, @@ -332,9 +329,7 @@ class _AllHabibMedicalServiceState extends State { ServicesContainer( onTap: () => Navigator.push( context, - FadePage( - page: SmartWatchInstructions() - ), + FadePage(page: SmartWatchInstructions()), ), imageLocation: 'assets/images/new-design/smartwatch_icon.png', title: TranslationBase.of(context).smartWatches, diff --git a/lib/pages/AlHabibMedicalService/h2o/h2o_page.dart b/lib/pages/AlHabibMedicalService/h2o/h2o_page.dart index 982b9044..d216cd21 100644 --- a/lib/pages/AlHabibMedicalService/h2o/h2o_page.dart +++ b/lib/pages/AlHabibMedicalService/h2o/h2o_page.dart @@ -4,6 +4,7 @@ import 'package:diplomaticquarterapp/config/config.dart'; import 'package:diplomaticquarterapp/core/model/ImagesInfo.dart'; import 'package:diplomaticquarterapp/core/viewModels/AlHabibMedicalService/H2O_view_model.dart'; import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; +import 'package:diplomaticquarterapp/extensions/string_extensions.dart'; import 'package:diplomaticquarterapp/pages/AlHabibMedicalService/h2o/h20_setting.dart'; import 'package:diplomaticquarterapp/pages/AlHabibMedicalService/h2o/month_page.dart'; import 'package:diplomaticquarterapp/pages/AlHabibMedicalService/h2o/today_page.dart'; @@ -14,7 +15,6 @@ import 'package:diplomaticquarterapp/pages/medical/medical_profile_page_new.dart import 'package:diplomaticquarterapp/routes.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:diplomaticquarterapp/widgets/bottom_navigation/bottom_nav_bar.dart'; -import 'package:diplomaticquarterapp/extensions/string_extensions.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart'; import 'package:flutter/cupertino.dart'; @@ -77,132 +77,70 @@ class _H2OPageState extends State with SingleTickerProviderStateMixin { }, ), ], - body: Scaffold( - // extendBodyBehindAppBar: true, - // appBar: PreferredSize( - // preferredSize: Size.fromHeight(65.0), - // child: Stack( - // children: [ - // Positioned( - // bottom: 1, - // left: 0, - // right: 0, - // child: BackdropFilter( - // filter: ImageFilter.blur(sigmaX: 10, sigmaY: 10), - // child: Container( - // color: Theme.of(context).scaffoldBackgroundColor.withOpacity(0.8), - // height: 70.0, - // ), - // ), - // ), - // Center( - // child: Container( - // height: 60.0, - // alignment: Alignment.center, - // // margin: EdgeInsets.only(top: 10.0), - // // width: MediaQuery.of(context).size.width * 0.9, - // - // child: TabBar( - // isScrollable: false, - // controller: _tabController, - // indicatorWeight: 5.0, - // indicatorSize: TabBarIndicatorSize.tab, - // indicatorColor: Colors.red[800], - // labelColor: Theme.of(context).primaryColor, - // labelPadding: EdgeInsets.only(top: 4.0, left: 10.0, right: 13.0), - // unselectedLabelColor: Colors.grey[800], - // tabs: [ - // Container( - // width: MediaQuery.of(context).size.width * 0.28, - // child: Center( - // child: Texts(TranslationBase.of(context).today), - // ), - // ), - // Container( - // width: MediaQuery.of(context).size.width * 0.28, - // child: Center( - // child: Texts(TranslationBase.of(context).week), - // ), - // ), - // Container( - // width: MediaQuery.of(context).size.width * 0.28, - // child: Center( - // child: Texts(TranslationBase.of(context).month), - // ), - // ), - // ], - // ), - // ), - // ), - // ], - // ), - // ), - // backgroundColor: Colors.white, - body: Column( - children: [ - TabBar( + body: Column( + children: [ + TabBar( + controller: _tabController, + indicatorWeight: 3.0, + indicatorSize: TabBarIndicatorSize.tab, + labelColor: Color(0xff2B353E), + unselectedLabelColor: Color(0xff575757), + labelPadding: EdgeInsets.only(top: 15, bottom: 13, left: 20, right: 20), + labelStyle: TextStyle( + fontFamily: projectViewModel.isArabic ? 'Cairo' : 'Poppins', + fontSize: 16, + fontWeight: FontWeight.w600, + letterSpacing: -0.48, + ), + unselectedLabelStyle: TextStyle( + fontFamily: projectViewModel.isArabic ? 'Cairo' : 'Poppins', + fontSize: 16, + fontWeight: FontWeight.w600, + letterSpacing: -0.48, + ), + tabs: [Text(TranslationBase.of(context).today), Text(TranslationBase.of(context).week), Text(TranslationBase.of(context).month.toLowerCase().capitalizeFirstofEach)], + ), + Expanded( + child: TabBarView( + physics: BouncingScrollPhysics(), controller: _tabController, - indicatorWeight: 3.0, - indicatorSize: TabBarIndicatorSize.tab, - labelColor: Color(0xff2B353E), - unselectedLabelColor: Color(0xff575757), - labelPadding: EdgeInsets.only(top: 15, bottom: 13, left: 20, right: 20), - labelStyle: TextStyle( - fontFamily: projectViewModel.isArabic ? 'Cairo' : 'Poppins', - fontSize: 16, - fontWeight: FontWeight.w600, - letterSpacing: -0.48, - ), - unselectedLabelStyle: TextStyle( - fontFamily: projectViewModel.isArabic ? 'Cairo' : 'Poppins', - fontSize: 16, - fontWeight: FontWeight.w600, - letterSpacing: -0.48, - ), - tabs: [Text(TranslationBase.of(context).today), Text(TranslationBase.of(context).week), Text(TranslationBase.of(context).month.toLowerCase().capitalizeFirstofEach)], + children: [TodayPage(), WeekPage(), MonthPage()], ), - Expanded( - child: TabBarView( - physics: BouncingScrollPhysics(), - controller: _tabController, - children: [TodayPage(), WeekPage(), MonthPage()], - ), - ) - ], - ), - bottomNavigationBar: BottomNavBar( - changeIndex: (index) { - if (index == 0) { - IS_VOICE_COMMAND_CLOSED = false; - } else if (index == 1) { - Navigator.push( - context, - FadePage( - page: AppScaffold( - appBarTitle: TranslationBase.of(context).medicalProfile, - isShowAppBar: true, - showHomeAppBarIcon: false, - appBarIcons: [ - IconButton( - icon: Image.asset("assets/images/new-design/setting_gear_icon.png"), - color: Colors.white, - onPressed: () => Navigator.of(context).pushNamed( - SETTINGS, - ), + ) + ], + ), + bottomNavigationBar: BottomNavBar( + changeIndex: (index) { + if (index == 0) { + IS_VOICE_COMMAND_CLOSED = false; + } else if (index == 1) { + Navigator.push( + context, + FadePage( + page: AppScaffold( + appBarTitle: TranslationBase.of(context).medicalProfile, + isShowAppBar: true, + showHomeAppBarIcon: false, + appBarIcons: [ + IconButton( + icon: Image.asset("assets/images/new-design/setting_gear_icon.png"), + color: Colors.white, + onPressed: () => Navigator.of(context).pushNamed( + SETTINGS, ), - ], - body: MedicalProfilePageNew()))); - } else if (index == 2) { - Navigator.of(context).pushNamedAndRemoveUntil(HOME, (Route route) => false); - } else if (index == 3) { - Navigator.of(context).pushNamed(MY_FAMILIY); - } else if (index == 4) { - Navigator.push(context, FadePage(page: ToDo(isShowAppBar: false))); - } - }, - showHomeIcon: true, - index: 0, - ), + ), + ], + body: MedicalProfilePageNew()))); + } else if (index == 2) { + Navigator.of(context).pushNamedAndRemoveUntil(HOME, (Route route) => false); + } else if (index == 3) { + Navigator.of(context).pushNamed(MY_FAMILIY); + } else if (index == 4) { + Navigator.push(context, FadePage(page: ToDo(isShowAppBar: false))); + } + }, + showHomeIcon: true, + index: 0, ), ), ); diff --git a/lib/pages/AlHabibMedicalService/h2o/month_page.dart b/lib/pages/AlHabibMedicalService/h2o/month_page.dart index 8867fb77..daf91cb9 100644 --- a/lib/pages/AlHabibMedicalService/h2o/month_page.dart +++ b/lib/pages/AlHabibMedicalService/h2o/month_page.dart @@ -6,10 +6,11 @@ import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:diplomaticquarterapp/widgets/charts/app_bar_chart.dart'; import 'package:diplomaticquarterapp/widgets/errors/app_embedded_error.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; -import 'package:diplomaticquarterapp/widgets/progress_indicator/app_circular_progress_Indeicator.dart'; +import 'package:diplomaticquarterapp/uitl/utils_new.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:provider/provider.dart'; +import 'package:diplomaticquarterapp/widgets/charts/custom_line_chart.dart'; class MonthPage extends StatelessWidget { @override @@ -21,37 +22,39 @@ class MonthPage extends StatelessWidget { isShowAppBar: false, appBarTitle: TranslationBase.of(context).h2o, baseViewModel: model, - body: Padding( - padding: EdgeInsets.all(8.0), - child: ListView( - children: [ - Center( - child: Text( - TranslationBase.of(context).waterConsumedInMonth, - textAlign: TextAlign.center, - style: TextStyle(fontSize: 20.0, color: Colors.black87), - ), - ), - SizedBox(height: 16), - Row( - mainAxisAlignment: MainAxisAlignment.center, - children: [ - Container( - height: 10, - width: 40, - color: Colors.blue, + body: SingleChildScrollView( + padding: EdgeInsets.all(21), + physics: BouncingScrollPhysics(), + child: (model.userProgressForMonthDataSeries ?? []).isEmpty + ? getNoDataWidget(context) + : Container( + padding: EdgeInsets.fromLTRB(16, 14, 16, 14), + decoration: BoxDecoration( + color: Colors.white, + borderRadius: BorderRadius.all( + Radius.circular(10.0), + ), + boxShadow: [ + BoxShadow( + color: Color(0xff000000).withOpacity(.05), + blurRadius: 27, + offset: Offset(0, -3), + ), + ], ), - SizedBox(width: 8), - Text( - TranslationBase.of(context).waterConsumedInMonth, - style: TextStyle(fontSize: 12.0), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + mainAxisSize: MainAxisSize.min, + children: [ + Text( + TranslationBase.of(context).waterConsumedInMonth, + style: TextStyle(fontSize: 16.0, color: Color(0xff2E303A), fontWeight: FontWeight.w600, letterSpacing: -0.64), + ), + SizedBox(height: 24), + CustomLineChart(model.userProgressForMonthDataSeries, projectViewModel.isArabic), + ], ), - ], - ), - // SizedBox(height: 8), - AppBarChart(seriesList: model.userProgressForMonthDataSeries, isArabic: projectViewModel.isArabic), - ], - ), + ), ), ), ); diff --git a/lib/pages/AlHabibMedicalService/h2o/week_page.dart b/lib/pages/AlHabibMedicalService/h2o/week_page.dart index 6f4423b2..83529afd 100644 --- a/lib/pages/AlHabibMedicalService/h2o/week_page.dart +++ b/lib/pages/AlHabibMedicalService/h2o/week_page.dart @@ -1,12 +1,10 @@ -import 'package:diplomaticquarterapp/core/enum/viewstate.dart'; import 'package:diplomaticquarterapp/core/viewModels/AlHabibMedicalService/H2O_view_model.dart'; import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; import 'package:diplomaticquarterapp/pages/base/base_view.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; -import 'package:diplomaticquarterapp/widgets/charts/app_bar_chart.dart'; -import 'package:diplomaticquarterapp/widgets/errors/app_embedded_error.dart'; +import 'package:diplomaticquarterapp/uitl/utils_new.dart'; +import 'package:diplomaticquarterapp/widgets/charts/custom_line_chart.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; -import 'package:diplomaticquarterapp/widgets/progress_indicator/app_circular_progress_Indeicator.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:provider/provider.dart'; @@ -21,37 +19,39 @@ class WeekPage extends StatelessWidget { isShowAppBar: false, appBarTitle: TranslationBase.of(context).h2o, baseViewModel: model, - body: Padding( - padding: EdgeInsets.all(8.0), - child: ListView( - children: [ - Center( - child: Text( - TranslationBase.of(context).waterConsumedInWeek, - textAlign: TextAlign.center, - style: TextStyle(fontSize: 20.0, color: Colors.black87), - ), - ), - SizedBox(height: 16), - Row( - mainAxisAlignment: MainAxisAlignment.center, - children: [ - Container( - height: 10, - width: 40, - color: Colors.blue, + body: SingleChildScrollView( + padding: EdgeInsets.all(21), + physics: BouncingScrollPhysics(), + child: (model.userProgressForWeekDataSeries ?? []).isEmpty + ? getNoDataWidget(context) + : Container( + padding: EdgeInsets.fromLTRB(16, 14, 16, 14), + decoration: BoxDecoration( + color: Colors.white, + borderRadius: BorderRadius.all( + Radius.circular(10.0), + ), + boxShadow: [ + BoxShadow( + color: Color(0xff000000).withOpacity(.05), + blurRadius: 27, + offset: Offset(0, -3), + ), + ], ), - SizedBox(width: 8), - Text( - TranslationBase.of(context).waterConsumedInWeek, - style: TextStyle(fontSize: 12.0), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + mainAxisSize: MainAxisSize.min, + children: [ + Text( + TranslationBase.of(context).waterConsumedInWeek, + style: TextStyle(fontSize: 16.0, color: Color(0xff2E303A), fontWeight: FontWeight.w600, letterSpacing: -0.64), + ), + SizedBox(height: 24), + CustomLineChart(model.userProgressForWeekDataSeries, projectViewModel.isArabic), + ], ), - ], - ), - // SizedBox(height: 8), - AppBarChart(seriesList: model.userProgressForWeekDataSeries,isArabic: projectViewModel.isArabic), - ], - ), + ), ), ), ); diff --git a/lib/pages/BookAppointment/BookSuccess.dart b/lib/pages/BookAppointment/BookSuccess.dart index 2c278f5e..84af56d6 100644 --- a/lib/pages/BookAppointment/BookSuccess.dart +++ b/lib/pages/BookAppointment/BookSuccess.dart @@ -175,7 +175,7 @@ class _BookSuccessState extends State { ), height: 45.0, child: RaisedButton( - color: new Color(0xFF60686b), + color: CustomColors.green, textColor: Colors.white, disabledTextColor: Colors.white, disabledColor: new Color(0xFFbcc2c4), @@ -365,10 +365,11 @@ class _BookSuccessState extends State { ), ], ), - Container( - margin: EdgeInsets.fromLTRB(50.0, 20.0, 50.0, 20.0), - child: Image.asset("assets/images/new-design/payment-method.png"), - ), + // Container( + // margin: EdgeInsets.fromLTRB(50.0, 20.0, 50.0, 20.0), + // child: Image.asset("assets/images/new-design/payment-method.png"), + // ), + Container(margin: EdgeInsets.fromLTRB(20.0, 5.0, 20.0, 5.0), child: getPaymentMethods()), ], ); } @@ -447,10 +448,7 @@ class _BookSuccessState extends State { fontSize: 12.0, letterSpacing: -0.36, )), - Container( - margin: EdgeInsets.fromLTRB(50.0, 20.0, 50.0, 20.0), - child: Image.asset("assets/images/new-design/payment-method.png"), - ), + Container(margin: EdgeInsets.fromLTRB(20.0, 5.0, 20.0, 5.0), child: getPaymentMethods()), Text( TranslationBase.of(context).payNowBookSuccesstext2, overflow: TextOverflow.clip, diff --git a/lib/pages/Covid-DriveThru/covid-payment-details.dart b/lib/pages/Covid-DriveThru/covid-payment-details.dart index 81ba1285..f31aa53e 100644 --- a/lib/pages/Covid-DriveThru/covid-payment-details.dart +++ b/lib/pages/Covid-DriveThru/covid-payment-details.dart @@ -262,10 +262,7 @@ class _CovidPaymentDetailsState extends State { letterSpacing: -0.46, ), ), - Container( - margin: EdgeInsets.only(top: 12, bottom: 12), - child: Image.asset("assets/images/new-design/payment_options_invoice_confirmation.png", width: 300), - ), + Container(margin: EdgeInsets.fromLTRB(20.0, 5.0, 20.0, 5.0), child: getPaymentMethods()), ], ), ), diff --git a/lib/pages/Covid-DriveThru/covid-payment-summary.dart b/lib/pages/Covid-DriveThru/covid-payment-summary.dart index c47c8d36..c5bcb23b 100644 --- a/lib/pages/Covid-DriveThru/covid-payment-summary.dart +++ b/lib/pages/Covid-DriveThru/covid-payment-summary.dart @@ -13,6 +13,7 @@ import 'package:diplomaticquarterapp/uitl/gif_loader_dialog_utils.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:diplomaticquarterapp/uitl/utils.dart'; import 'package:diplomaticquarterapp/uitl/utils_new.dart'; +import 'package:diplomaticquarterapp/widgets/buttons/defaultButton.dart'; import 'package:diplomaticquarterapp/widgets/buttons/secondary_button.dart'; import 'package:diplomaticquarterapp/widgets/dragable_sheet.dart'; import 'package:diplomaticquarterapp/widgets/in_app_browser/InAppBrowser.dart'; @@ -95,9 +96,9 @@ class _CovidPaymentSummaryState extends State { decoration: containerColorRadiusBorderWidth(CustomColors.accentColor, 200, Colors.white, 4), ), Container( - height: 60.0, + height: 100.0, padding: EdgeInsets.all(7.0), - child: widget.selectedPaymentMethod == "ApplePay" ? SvgPicture.asset(getImagePath(widget.selectedPaymentMethod)) : Image.asset(getImagePath(widget.selectedPaymentMethod)), + child: Image.asset(getImagePath(widget.selectedPaymentMethod), width: 100, height: 100), ), mFlex(1), InkWell( @@ -154,17 +155,16 @@ class _CovidPaymentSummaryState extends State { ), ), bottomSheet: Container( - color: Colors.white, - height: MediaQuery.of(context).size.height * 0.1, + color: Theme.of(context).scaffoldBackgroundColor, + margin: EdgeInsets.only(bottom: 5.0), width: double.infinity, padding: EdgeInsets.all(12), - child: SecondaryButton( - textColor: Colors.white, - color: CustomColors.green, - label: TranslationBase.of(context).confirm.toUpperCase(), - onTap: () { + child: DefaultButton( + TranslationBase.of(context).confirm.toUpperCase(), + () { startPaymentProcess(projectViewModel.user); }, + color: CustomColors.green, ), ), ); @@ -335,25 +335,25 @@ class _CovidPaymentSummaryState extends State { String getImagePath(String paymentMethod) { switch (paymentMethod) { case "MADA": - return 'assets/images/new-design/mada.png'; - break; - case "SADAD": - return 'assets/images/new-design/sadad.png'; + return 'assets/images/new/payment/Mada.png'; break; + // case "SADAD": + // return 'assets/images/new-design/sadad.png'; + // break; case "VISA": - return 'assets/images/new-design/visa.png'; + return 'assets/images/new/payment/visa.png'; break; case "MASTERCARD": - return 'assets/images/new-design/mastercard.png'; + return 'assets/images/new/payment/Mastercard.png'; break; case "Installment": - return 'assets/images/new-design/installment.png'; + return 'assets/images/new/payment/installments.png'; break; case "ApplePay": - return 'assets/images/new-design/applepay.svg'; + return 'assets/images/new/payment/Apple_Pay.png'; break; } - return 'assets/images/new-design/mada.png'; + return 'assets/images/new/payment/Mada.png'; } } diff --git a/lib/pages/MyAppointments/SchedulePage.dart b/lib/pages/MyAppointments/SchedulePage.dart index 2287cff5..92fbeedf 100644 --- a/lib/pages/MyAppointments/SchedulePage.dart +++ b/lib/pages/MyAppointments/SchedulePage.dart @@ -1,33 +1,30 @@ +import 'package:diplomaticquarterapp/core/enum/viewstate.dart'; +import 'package:diplomaticquarterapp/core/viewModels/medical/medical_view_model.dart'; +import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; +import 'package:diplomaticquarterapp/models/Appointments/AppoimentAllHistoryResultList.dart'; import 'package:diplomaticquarterapp/models/Appointments/DoctorListResponse.dart'; -import 'package:diplomaticquarterapp/pages/MyAppointments/AppointmentDetails.dart'; - import 'package:diplomaticquarterapp/pages/MyAppointments/models/DoctorScheduleResponse.dart'; import 'package:diplomaticquarterapp/pages/MyAppointments/widgets/indicator.dart'; -import 'package:diplomaticquarterapp/services/appointment_services/GetDoctorsList.dart'; -import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; -import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; -import 'package:diplomaticquarterapp/uitl/date_uitl.dart'; -import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart'; -import 'package:flutter/material.dart'; -import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; -import 'package:diplomaticquarterapp/core/viewModels/medical/medical_view_model.dart'; import 'package:diplomaticquarterapp/pages/base/base_view.dart'; +import 'package:diplomaticquarterapp/services/appointment_services/GetDoctorsList.dart'; import 'package:diplomaticquarterapp/uitl/app_shared_preferences.dart'; -import 'package:diplomaticquarterapp/config/shared_pref_kay.dart'; -import 'package:diplomaticquarterapp/models/Appointments/AppoimentAllHistoryResultList.dart'; import 'package:diplomaticquarterapp/uitl/app_toast.dart'; import 'package:diplomaticquarterapp/uitl/date_uitl.dart'; -import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; +import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; +import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; +import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; +import 'package:flutter/material.dart'; import 'package:provider/provider.dart'; -import 'package:diplomaticquarterapp/core/enum/viewstate.dart'; class SchedulePage extends StatefulWidget { DoctorList doctorList; AppoitmentAllHistoryResultList appo; + SchedulePage({ this.appo, this.doctorList, }); + @override _SchedulePageState createState() => _SchedulePageState(); } @@ -45,6 +42,7 @@ class _SchedulePageState extends State { bool isPageChange = false; AppSharedPreferences sharedPref = AppSharedPreferences(); + @override void initState() { this.doctorList = widget.doctorList; @@ -56,169 +54,132 @@ class _SchedulePageState extends State { Widget build(BuildContext context) { ProjectViewModel projectViewModel = Provider.of(context); return BaseView( - onModelReady: (model) => model.getDoctorSchedule(doctorList), - allowAny: true, - builder: (_, model, widget) => BaseView( - onModelReady: (model2) => model2.getFreeSlots(doctorList), - allowAny: true, - builder: (_, model2, widget2) { - if (model2.freeSlots.length > 0 && isPageChange == false && model2.state == ViewState.Idle) { - this.freeSlots = model2.freeSlots; - this.doctorScheduleResponse = model.getDoctorScheduleList; + onModelReady: (model) => model.getDoctorSchedule(doctorList), + allowAny: true, + builder: (_, model, widget) => BaseView( + onModelReady: (model2) => model2.getFreeSlots(doctorList), + allowAny: true, + builder: (_, model2, widget2) { + if (model2.freeSlots.length > 0 && isPageChange == false && model2.state == ViewState.Idle) { + this.freeSlots = model2.freeSlots; + this.doctorScheduleResponse = model.getDoctorScheduleList; - this.generateWeeksSchedules(); - } else if (model2.freeSlots.length == 0 && model2.state == ViewState.Idle) { - AppToast.showErrorToast(message: TranslationBase.of(context).emptySchedule); - Navigator.pop(context); - } - return AppScaffold( - appBarTitle: TranslationBase.of(context).schedule, - showNewAppBar: true, - showNewAppBarTitle: true, - isShowAppBar: true, - backgroundColor: Color(0xffF7F7F7), - baseViewModel: model2, - isShowDecPage: false, - body: Column( - children: [ - SizedBox(height: 21), - PageViewIndicator( - isActive: true, - currentPage: this.currentPage, - length: weeks.length, - ), - Expanded( - child: PageView.builder( - controller: _pageController, - itemCount: weeks.length, - onPageChanged: (index) { - setState(() { - isPageChange = true; - this.currentPage = index.toDouble(); - }); - }, - itemBuilder: (context, index) { - return ListView.separated( - itemCount: weeks[index].length, - padding: EdgeInsets.all(21), - separatorBuilder: (context, index) => SizedBox(height: 12), - itemBuilder: (context, index2) { - bool isToday = DateUtil.convertStringToDate(weeks[index][index2]['Date']).toString().substring(0, 10) == DateTime.now().toString().substring(0, 10); - Color toDayColor = isToday ? Color(0xff359846) : Colors.white; - - return InkWell( - onTap: () { - openBookAppointment(weeks[index][index2]); + this.generateWeeksSchedules(); + } else if (model2.freeSlots.length == 0 && model2.state == ViewState.Idle) { + AppToast.showErrorToast(message: TranslationBase.of(context).emptySchedule); + Navigator.pop(context); + } + return AppScaffold( + appBarTitle: TranslationBase.of(context).schedule, + showNewAppBar: true, + showNewAppBarTitle: true, + isShowAppBar: true, + baseViewModel: model2, + isShowDecPage: false, + body: SizedBox( + height: MediaQuery.of(context).size.height, + child: Stack( + children: [ + Container( + margin: EdgeInsets.only(top: 40), + child: PageView.builder( + controller: _pageController, + itemCount: weeks.length, + onPageChanged: (index) { + setState(() { + isPageChange = true; + this.currentPage = index.toDouble(); + }); + }, + itemBuilder: (context, index) { + return Container( + child: ListView.builder( + itemCount: weeks[index].length, + itemBuilder: (context, index2) => InkWell( + onTap: () { + openBookAppointment(weeks[index][index2]); + }, + child: Row( + children: [ + Expanded( + flex: 1, + child: Padding( + padding: projectViewModel.isArabic ? EdgeInsets.only(right: 20) : EdgeInsets.only(left: 20), + child: Row(children: [ + Column( + children: [ + Texts( + weeks[index][index2]['DayName'], + fontSize: 13, + fontWeight: projectViewModel.isArabic ? FontWeight.w600 : FontWeight.w500, + ), + Texts( + getDayMonths( + DateUtil.convertStringToDate( + weeks[index][index2]['Date'], + ), + ), + fontWeight: FontWeight.bold, + fontSize: 18, + ) + ], + ) + ])), + ), + Expanded( + flex: 3, + child: ClipRRect( + borderRadius: const BorderRadius.all(Radius.circular(20.0)), + child: Container( + padding: EdgeInsets.only(left: 10, right: 10, top: 15, bottom: 20), + margin: EdgeInsets.only(left: 20, right: 20, top: 7, bottom: 7), + decoration: BoxDecoration(boxShadow: [ + DateUtil.convertStringToDate(weeks[index][index2]['Date']).toString().substring(0, 10) == DateTime.now().toString().substring(0, 10) + ? BoxShadow(color: Colors.green, offset: Offset(projectViewModel.isArabic ? 5 : -5, 0)) + : BoxShadow( + color: Colors.grey[100], + blurRadius: 5, + spreadRadius: 4, + offset: Offset(0, 10), + ), + ], borderRadius: const BorderRadius.all(Radius.circular(10.0)), color: Colors.white), + child: Column(crossAxisAlignment: CrossAxisAlignment.start, children: [ + DateUtil.convertStringToDate(weeks[index][index2]['Date']).toString().substring(0, 10) == DateTime.now().toString().substring(0, 10) + ? Texts( + TranslationBase.of(context).today, + color: Colors.green, + fontWeight: FontWeight.w600, + fontSize: 12, + marginTop: 0, + ) + : SizedBox(), + Row( + children: [ + Expanded( + child: Text( + weeks[index][index2]['WorkingHours'], + style: TextStyle( + fontWeight: FontWeight.w600, + ), + ), + ), + Icon(Icons.arrow_forward, size: 16.0), + ], + ) + ]))), + ), + ], + )))); }, - child: Row( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Expanded( - flex: 1, - child: Column( - mainAxisSize: MainAxisSize.min, - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Text( - weeks[index][index2]['DayName'], - style: TextStyle( - fontSize: 13, - fontWeight: FontWeight.w600, - color: Color(0xff2E303A), - letterSpacing: -0.52, - ), - ), - Text( - getDayMonths(DateUtil.convertStringToDate(weeks[index][index2]['Date'])), - style: TextStyle( - fontSize: 18, - fontWeight: FontWeight.w700, - color: Color(0xff2E303A), - letterSpacing: -0.72, - ), - ), - ], - ), - ), - Expanded( - flex: 3, - child: Container( - decoration: BoxDecoration( - color: toDayColor, - borderRadius: BorderRadius.all( - Radius.circular(10.0), - ), - boxShadow: [ - BoxShadow( - color: Color(0xff000000).withOpacity(.05), - blurRadius: 27, - offset: Offset(0, -3), - ), - ], - ), - child: Container( - margin: EdgeInsets.only(left: projectViewModel.isArabic ? 0 : 6, right: projectViewModel.isArabic ? 6 : 0), - padding: EdgeInsets.symmetric(vertical: 14, horizontal: 12), - decoration: BoxDecoration( - color: Colors.white, - border: Border.all(color: Colors.white, width: 1), - borderRadius: BorderRadius.only( - bottomRight: projectViewModel.isArabic ? Radius.circular(0) : Radius.circular(10.0), - topRight: projectViewModel.isArabic ? Radius.circular(0) : Radius.circular(10.0), - bottomLeft: projectViewModel.isArabic ? Radius.circular(10.0) : Radius.circular(0), - topLeft: projectViewModel.isArabic ? Radius.circular(10.0) : Radius.circular(0), - ), - ), - child: Row( - crossAxisAlignment: CrossAxisAlignment.center, - children: [ - Expanded( - child: Column(crossAxisAlignment: CrossAxisAlignment.start, children: [ - if (isToday) - Text( - TranslationBase.of(context).today, - style: TextStyle( - fontSize: 12, - fontWeight: FontWeight.w600, - color: toDayColor, - letterSpacing: -0.48, - ), - ), - Row( - children: [ - Expanded( - child: Text( - weeks[index][index2]['WorkingHours'], - style: TextStyle( - fontSize: 13, - fontWeight: FontWeight.w600, - color: Color(0xff2E303A), - letterSpacing: -0.56, - ), - ), - ), - ], - ) - ]), - ), - Icon(Icons.arrow_forward, color: Color(0xff2B353E)), - ], - ), - ), - ), - ), - ], - ), - ); - }); - }, - ), - ), - ], - ), - ); - }), - ); + )), + PageViewIndicator( + isActive: true, + currentPage: this.currentPage, + length: weeks.length, + ) + ], + ))); + })); } generateWeeksSchedules() { @@ -284,3 +245,289 @@ class _SchedulePageState extends State { // ); } } + +// import 'package:diplomaticquarterapp/models/Appointments/DoctorListResponse.dart'; +// import 'package:diplomaticquarterapp/pages/MyAppointments/AppointmentDetails.dart'; +// +// import 'package:diplomaticquarterapp/pages/MyAppointments/models/DoctorScheduleResponse.dart'; +// import 'package:diplomaticquarterapp/pages/MyAppointments/widgets/indicator.dart'; +// import 'package:diplomaticquarterapp/services/appointment_services/GetDoctorsList.dart'; +// import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; +// import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; +// import 'package:diplomaticquarterapp/uitl/date_uitl.dart'; +// import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart'; +// import 'package:flutter/material.dart'; +// import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; +// import 'package:diplomaticquarterapp/core/viewModels/medical/medical_view_model.dart'; +// import 'package:diplomaticquarterapp/pages/base/base_view.dart'; +// import 'package:diplomaticquarterapp/uitl/app_shared_preferences.dart'; +// import 'package:diplomaticquarterapp/config/shared_pref_kay.dart'; +// import 'package:diplomaticquarterapp/models/Appointments/AppoimentAllHistoryResultList.dart'; +// import 'package:diplomaticquarterapp/uitl/app_toast.dart'; +// import 'package:diplomaticquarterapp/uitl/date_uitl.dart'; +// import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; +// import 'package:provider/provider.dart'; +// import 'package:diplomaticquarterapp/core/enum/viewstate.dart'; +// +// class SchedulePage extends StatefulWidget { +// DoctorList doctorList; +// AppoitmentAllHistoryResultList appo; +// SchedulePage({ +// this.appo, +// this.doctorList, +// }); +// @override +// _SchedulePageState createState() => _SchedulePageState(); +// } +// +// class _SchedulePageState extends State { +// DoctorsListService service; +// PageController _pageController = PageController(); +// double currentPage = 0; +// int selectedindex = 0; +// List weeks = []; +// List doctorScheduleResponse = []; +// int weekMS = 604800 * 1000; +// DoctorList doctorList; +// List freeSlots = []; +// bool isPageChange = false; +// +// AppSharedPreferences sharedPref = AppSharedPreferences(); +// @override +// void initState() { +// this.doctorList = widget.doctorList; +// +// super.initState(); +// } +// +// @override +// Widget build(BuildContext context) { +// ProjectViewModel projectViewModel = Provider.of(context); +// return BaseView( +// onModelReady: (model) => model.getDoctorSchedule(doctorList), +// allowAny: true, +// builder: (_, model, widget) => BaseView( +// onModelReady: (model2) => model2.getFreeSlots(doctorList), +// allowAny: true, +// builder: (_, model2, widget2) { +// if (model2.freeSlots.length > 0 && isPageChange == false && model2.state == ViewState.Idle) { +// this.freeSlots = model2.freeSlots; +// this.doctorScheduleResponse = model.getDoctorScheduleList; +// +// this.generateWeeksSchedules(); +// } else if (model2.freeSlots.length == 0 && model2.state == ViewState.Idle) { +// AppToast.showErrorToast(message: TranslationBase.of(context).emptySchedule); +// Navigator.pop(context); +// } +// return AppScaffold( +// appBarTitle: TranslationBase.of(context).schedule, +// showNewAppBar: true, +// showNewAppBarTitle: true, +// isShowAppBar: true, +// backgroundColor: Color(0xffF7F7F7), +// baseViewModel: model2, +// isShowDecPage: false, +// body: Column( +// children: [ +// SizedBox(height: 21), +// PageViewIndicator( +// isActive: true, +// currentPage: this.currentPage, +// length: weeks.length, +// ), +// Expanded( +// child: PageView.builder( +// controller: _pageController, +// itemCount: weeks.length, +// onPageChanged: (index) { +// setState(() { +// isPageChange = true; +// this.currentPage = index.toDouble(); +// }); +// }, +// itemBuilder: (context, index) { +// return ListView.separated( +// itemCount: weeks[index].length, +// padding: EdgeInsets.all(21), +// separatorBuilder: (context, index) => SizedBox(height: 12), +// itemBuilder: (context, index2) { +// bool isToday = DateUtil.convertStringToDate(weeks[index][index2]['Date']).toString().substring(0, 10) == DateTime.now().toString().substring(0, 10); +// Color toDayColor = isToday ? Color(0xff359846) : Colors.white; +// return InkWell( +// onTap: () { +// openBookAppointment(weeks[index][index2]); +// }, +// child: Row( +// crossAxisAlignment: CrossAxisAlignment.start, +// children: [ +// Expanded( +// flex: 1, +// child: Column( +// mainAxisSize: MainAxisSize.min, +// crossAxisAlignment: CrossAxisAlignment.start, +// children: [ +// Text( +// weeks[index][index2]['DayName'], +// style: TextStyle( +// fontSize: 13, +// fontWeight: FontWeight.w600, +// color: Color(0xff2E303A), +// letterSpacing: -0.52, +// ), +// ), +// Text( +// getDayMonths(DateUtil.convertStringToDate(weeks[index][index2]['Date'])), +// style: TextStyle( +// fontSize: 18, +// fontWeight: FontWeight.w700, +// color: Color(0xff2E303A), +// letterSpacing: -0.72, +// ), +// ), +// ], +// ), +// ), +// Expanded( +// flex: 3, +// child: Container( +// decoration: BoxDecoration( +// color: toDayColor, +// borderRadius: BorderRadius.all( +// Radius.circular(10.0), +// ), +// boxShadow: [ +// BoxShadow( +// color: Color(0xff000000).withOpacity(.05), +// blurRadius: 27, +// offset: Offset(0, -3), +// ), +// ], +// ), +// child: Container( +// margin: EdgeInsets.only(left: projectViewModel.isArabic ? 0 : 6, right: projectViewModel.isArabic ? 6 : 0), +// padding: EdgeInsets.symmetric(vertical: 14, horizontal: 12), +// decoration: BoxDecoration( +// color: Colors.white, +// border: Border.all(color: Colors.white, width: 1), +// borderRadius: BorderRadius.only( +// bottomRight: projectViewModel.isArabic ? Radius.circular(0) : Radius.circular(10.0), +// topRight: projectViewModel.isArabic ? Radius.circular(0) : Radius.circular(10.0), +// bottomLeft: projectViewModel.isArabic ? Radius.circular(10.0) : Radius.circular(0), +// topLeft: projectViewModel.isArabic ? Radius.circular(10.0) : Radius.circular(0), +// ), +// ), +// child: Row( +// crossAxisAlignment: CrossAxisAlignment.center, +// children: [ +// Expanded( +// child: Column(crossAxisAlignment: CrossAxisAlignment.start, children: [ +// if (isToday) +// Text( +// TranslationBase.of(context).today, +// style: TextStyle( +// fontSize: 12, +// fontWeight: FontWeight.w600, +// color: toDayColor, +// letterSpacing: -0.48, +// ), +// ), +// Row( +// children: [ +// Expanded( +// child: Text( +// weeks[index][index2]['WorkingHours'], +// style: TextStyle( +// fontSize: 13, +// fontWeight: FontWeight.w600, +// color: Color(0xff2E303A), +// letterSpacing: -0.56, +// ), +// ), +// ), +// ], +// ) +// ]), +// ), +// Icon(Icons.arrow_forward, color: Color(0xff2B353E)), +// ], +// ), +// ), +// ), +// ), +// ], +// ), +// ); +// }); +// }, +// ), +// ), +// ], +// ), +// ); +// }), +// ); +// } +// +// generateWeeksSchedules() { +// this.weeks.clear(); +// for (var i = 0; i < 8; i++) { +// var weekSchedule = generateNewWeekSchedule(i); +// this.markWeekFreeDays(weekSchedule); +// this.weeks.add(weekSchedule); +// } +// //print(this.weeks); +// } +// +// markWeekFreeDays(schedule) { +// for (var workDay in schedule) { +// workDay['fullDay'] = !this.hasFreeSlot(workDay['Date']); +// } +// } +// +// generateNewWeekSchedule(weekIndex) { +// var weekMSOffset = weekIndex * weekMS; +// +// var newWeekSchedule = []; +// for (var workDay in this.doctorScheduleResponse) { +// Map newWorkDay = Map(); +// newWorkDay['Date'] = DateUtil.convertDateMSToJsonDate(DateUtil.convertStringToDate(workDay.date).millisecondsSinceEpoch + weekMSOffset); +// newWorkDay['DayName'] = workDay.dayName; +// newWorkDay['WorkingHours'] = workDay.workingHours; +// newWeekSchedule.add(newWorkDay); +// } +// return newWeekSchedule; +// } +// +// hasFreeSlot(String jsonDate) { +// var date = DateUtil.convertStringToDate(jsonDate); +// var scheduleDay = date; +// for (var event in this.freeSlots) { +// var date = DateUtil.convertStringToDate(event); +// var nDate = DateTime(date.year, date.month, date.day); +// +// if (nDate.millisecondsSinceEpoch == scheduleDay.millisecondsSinceEpoch) { +// return true; +// } +// } +// return false; +// } +// +// String getDayMonths(DateTime dateTime) { +// String dateFormat = '${dateTime.day} ${DateUtil.getMonth(dateTime.month).toString().substring(0, 3)}'; +// return dateFormat; +// } +// +// openBookAppointment(selectedDate) { +// //sharedPref.setObject(DOCTOR_SCHEDULE_DATE_SEL, selectedDate); +// Navigator.of(context).pop(selectedDate); +// // Navigator.push( +// // context, +// // FadePage( +// // page: AppointmentDetails( +// // appo: widget.appo, +// // doctorSchedule: selectedDate, +// // ), +// // ), +// // ); +// } +// } diff --git a/lib/pages/ToDoList/ToDo.dart b/lib/pages/ToDoList/ToDo.dart index a143fa15..1a0ec103 100644 --- a/lib/pages/ToDoList/ToDo.dart +++ b/lib/pages/ToDoList/ToDo.dart @@ -57,6 +57,8 @@ class _ToDoState extends State { ToDoCountProviderModel toDoProvider; CountdownTimerController controller; + ProjectViewModel projectViewModel; + @override void initState() { widget.patientShareResponse = new PatientShareResponse(); @@ -73,7 +75,7 @@ class _ToDoState extends State { @override Widget build(BuildContext context) { toDoProvider = Provider.of(context); - ProjectViewModel projectViewModel = Provider.of(context); + projectViewModel = Provider.of(context); return AppScaffold( appBarTitle: TranslationBase.of(context).todoList, imagesInfo: imagesInfo, @@ -169,12 +171,12 @@ class _ToDoState extends State { crossAxisAlignment: CrossAxisAlignment.start, children: [ Text(widget.appoList[index].doctorTitle + " " + widget.appoList[index].doctorNameObj, - style: TextStyle(fontSize: 14.0, color: Colors.black, fontWeight: FontWeight.bold, letterSpacing: 1.0)), + style: TextStyle(fontSize: 14.0, color: Colors.black, fontWeight: FontWeight.bold, letterSpacing: -0.64)), if (getDoctorSpeciality(widget.appoList[index].doctorSpeciality) != "null\n") Container( margin: EdgeInsets.only(top: 3.0, bottom: 3.0), child: Text(getDoctorSpeciality(widget.appoList[index].doctorSpeciality).trim(), - style: TextStyle(fontSize: 12.0, color: Colors.grey[600], letterSpacing: 1.0)), + style: TextStyle(fontSize: 12.0, color: Colors.grey[600], letterSpacing: -0.64)), ), Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, @@ -267,7 +269,7 @@ class _ToDoState extends State { color: Color(0xff20bc44), ), height: 30.0, - padding: EdgeInsets.only(right: 15), + padding: EdgeInsets.only(right: 10, left: 10), margin: EdgeInsets.symmetric(horizontal: 20), transform: Matrix4.translationValues(0.0, -8.0, 0.0), child: Row( @@ -319,11 +321,11 @@ class _ToDoState extends State { break; case 15: - return widget.languageID == 'ar' ? "assets/images/new-design/pay_online_button_arabic_disabled.png" : "assets/images/new-design/pay_online_button_disabled.png"; + return projectViewModel.isArabic ? "assets/images/new-design/pay_online_button_arabic_disabled.png" : "assets/images/new-design/pay_online_button_disabled.png"; break; case 20: - return widget.languageID == 'ar' ? "assets/images/new-design/pay_online_button_arabic.png" : "assets/images/new-design/pay_online_button.png"; + return projectViewModel.isArabic ? "assets/images/new-design/pay_online_button_arabic.png" : "assets/images/new-design/pay_online_button.png"; break; case 30: diff --git a/lib/pages/ToDoList/payment_method_select.dart b/lib/pages/ToDoList/payment_method_select.dart index f2a96651..3e7678cc 100644 --- a/lib/pages/ToDoList/payment_method_select.dart +++ b/lib/pages/ToDoList/payment_method_select.dart @@ -60,7 +60,7 @@ class _PaymentMethodState extends State { height: 60.0, width: 60, padding: EdgeInsets.all(7.0), - child: Image.asset("assets/images/new-design/mada.png"), + child: Image.asset("assets/images/new/payment/Mada.png"), ), mWidth(12), Text( @@ -96,7 +96,7 @@ class _PaymentMethodState extends State { height: 60.0, padding: EdgeInsets.all(7.0), width: 60, - child: Image.asset("assets/images/new-design/visa.png"), + child: Image.asset("assets/images/new/payment/visa.png"), ), mWidth(12), Text( @@ -132,7 +132,7 @@ class _PaymentMethodState extends State { height: 60.0, padding: EdgeInsets.all(7.0), width: 60, - child: Image.asset("assets/images/new-design/mastercard.png"), + child: Image.asset("assets/images/new/payment/Mastercard.png"), ), mWidth(12), Text( @@ -168,7 +168,7 @@ class _PaymentMethodState extends State { height: 60.0, padding: EdgeInsets.all(7.0), width: 60, - child: Image.asset("assets/images/new-design/installment.png"), + child: Image.asset("assets/images/new/payment/installments.png"), ), mWidth(12), Text( @@ -205,7 +205,7 @@ class _PaymentMethodState extends State { height: 60.0, padding: EdgeInsets.all(7.0), width: 60, - child: SvgPicture.asset("assets/images/new-design/applepay.svg"), + child: Image.asset("assets/images/new/payment/Apple_Pay.png"), ), mWidth(12), Text( diff --git a/lib/pages/ToDoList/widgets/paymentDialog.dart b/lib/pages/ToDoList/widgets/paymentDialog.dart index 7c461815..c46535b3 100644 --- a/lib/pages/ToDoList/widgets/paymentDialog.dart +++ b/lib/pages/ToDoList/widgets/paymentDialog.dart @@ -1,7 +1,9 @@ import 'package:diplomaticquarterapp/models/Appointments/AppoimentAllHistoryResultList.dart'; import 'package:diplomaticquarterapp/models/Appointments/PatientShareResposne.dart'; +import 'package:diplomaticquarterapp/theme/colors.dart'; import 'package:diplomaticquarterapp/uitl/date_uitl.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; +import 'package:diplomaticquarterapp/uitl/utils_new.dart'; import 'package:flutter/material.dart'; class PaymentDialog extends StatefulWidget { @@ -21,159 +23,106 @@ class _PaymentDialogState extends State { Widget build(BuildContext context) { return Container( child: Dialog( - shape: - RoundedRectangleBorder(borderRadius: BorderRadius.circular(12.0)), + shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(12.0)), child: Container( height: 550.0, width: 450.0, - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - mainAxisSize: MainAxisSize.max, - children: [ - Container( - margin: EdgeInsets.fromLTRB(20.0, 20.0, 20.0, 5.0), - child: Text("Invoice Detail", - style: TextStyle( - fontSize: 25.0, - fontWeight: FontWeight.bold, - fontFamily: "Open-Sans-Bold")), - ), - Divider( - color: Colors.grey, - ), - Container( - margin: EdgeInsets.fromLTRB(20.0, 5.0, 20.0, 5.0), - child: Text("Appointment Details", - style: TextStyle( - fontSize: 15.0, - fontWeight: FontWeight.bold, - fontFamily: "Open-Sans-Bold")), - ), - Container( - margin: EdgeInsets.fromLTRB(20.0, 5.0, 20.0, 5.0), - child: Text( - widget.appo.doctorTitle + " " + widget.appo.doctorNameObj, - style: TextStyle( - color: Colors.grey[700], - fontSize: 15.0, - fontWeight: FontWeight.bold, - fontFamily: "Open-Sans-Bold")), - ), - Container( - margin: EdgeInsets.fromLTRB(20.0, 5.0, 20.0, 5.0), - child: Text(getDate(widget.appo.appointmentDate), - style: getTextStyle()), - ), - Container( - margin: EdgeInsets.fromLTRB(20.0, 5.0, 20.0, 5.0), - child: Text(widget.appo.projectName, style: getTextStyle()), - ), - Divider( - color: Colors.grey, - ), - Container( - margin: EdgeInsets.fromLTRB(20.0, 0.0, 20.0, 5.0), - child: Table( - children: [ - TableRow(children: [ - TableCell( - child: _getNormalText( - TranslationBase.of(context).patientShareToDo)), - TableCell( - child: _getNormalText(widget - .patientShareResponse.patientShare - .toString())), - ]), - TableRow(children: [ - TableCell( - child: _getNormalText( - TranslationBase.of(context).patientTaxToDo)), - TableCell( - child: _getNormalText(widget - .patientShareResponse.patientTaxAmount - .toString())), - ]), - TableRow(children: [ - TableCell( - child: _getNormalText(TranslationBase.of(context) - .patientShareTotalToDo)), - TableCell( - child: _getNormalText(widget - .patientShareResponse.patientShareWithTax - .toString())), - ]), - ], - ), - ), - Container( - alignment: Alignment.center, - margin: EdgeInsets.fromLTRB(20.0, 20.0, 20.0, 5.0), - child: Text("You can pay by following options: ", - textAlign: TextAlign.center, - style: TextStyle( - fontSize: 16.0, - fontWeight: FontWeight.bold, - fontFamily: "Open-Sans")), - ), - Container( - alignment: Alignment.center, - margin: EdgeInsets.fromLTRB(20.0, 10.0, 20.0, 5.0), - child: Image.asset( - "assets/images/new-design/payment_options_invoice_confirmation.png", - width: 300), - ), - Container( - alignment: Alignment.center, - margin: EdgeInsets.fromLTRB(20.0, 10.0, 20.0, 15.0), - child: Text( - "Are You Sure You Want To Make payment for this Appointment?", - textAlign: TextAlign.center, - style: TextStyle( - fontSize: 14.0, - color: Colors.red[700], - fontFamily: "Open-Sans")), - ), - Divider( - color: Colors.grey, - ), - Container( - alignment: Alignment.center, - height: 40.0, - child: Flex( - direction: Axis.horizontal, - children: [ - Expanded( - child: InkWell( - onTap: () { - Navigator.pop(context, null); - }, - child: Container( - child: Text("Cancel", - textAlign: TextAlign.center, - style: TextStyle( - fontSize: 18.0, color: Colors.red[700])), - ), - ), + child: Column(crossAxisAlignment: CrossAxisAlignment.start, mainAxisSize: MainAxisSize.max, children: [ + Container( + margin: EdgeInsets.fromLTRB(20.0, 20.0, 20.0, 5.0), + child: Text(TranslationBase.of(context).invoiceDetails, style: TextStyle(fontSize: 25.0, fontWeight: FontWeight.bold)), + ), + Divider( + color: Colors.grey, + ), + Container( + margin: EdgeInsets.fromLTRB(20.0, 5.0, 20.0, 5.0), + child: Text(TranslationBase.of(context).appoDetails, style: TextStyle(fontSize: 15.0, fontWeight: FontWeight.bold)), + ), + Container( + margin: EdgeInsets.fromLTRB(20.0, 5.0, 20.0, 5.0), + child: Text(widget.appo.doctorTitle + " " + widget.appo.doctorNameObj, style: TextStyle(color: Colors.grey[700], fontSize: 15.0, fontWeight: FontWeight.bold)), + ), + Container( + margin: EdgeInsets.fromLTRB(20.0, 5.0, 20.0, 5.0), + child: Text(getDate(widget.appo.appointmentDate), style: getTextStyle()), + ), + Container( + margin: EdgeInsets.fromLTRB(20.0, 5.0, 20.0, 5.0), + child: Text(widget.appo.projectName, style: getTextStyle()), + ), + Divider( + color: Colors.grey, + ), + Container( + margin: EdgeInsets.fromLTRB(20.0, 0.0, 20.0, 5.0), + child: Table( + children: [ + TableRow(children: [ + TableCell(child: _getNormalText(TranslationBase.of(context).patientShareToDo)), + TableCell(child: _getNormalText(widget.patientShareResponse.patientShare.toString())), + ]), + TableRow(children: [ + TableCell(child: _getNormalText(TranslationBase.of(context).patientTaxToDo)), + TableCell(child: _getNormalText(widget.patientShareResponse.patientTaxAmount.toString())), + ]), + TableRow(children: [ + TableCell(child: _getNormalText(TranslationBase.of(context).patientShareTotalToDo)), + TableCell(child: _getNormalText(widget.patientShareResponse.patientShareWithTax.toString())), + ]), + ], + ), + ), + Divider( + color: Colors.grey, + ), + Container( + margin: EdgeInsets.fromLTRB(20.0, 10.0, 20.0, 5.0), + child: Text(TranslationBase.of(context).YouCanPayByTheFollowingOptions, style: TextStyle(fontSize: 14.0, fontWeight: FontWeight.bold)), + ), + Container(margin: EdgeInsets.fromLTRB(20.0, 5.0, 20.0, 5.0), child: getPaymentMethods()), + Container( + margin: EdgeInsets.fromLTRB(20.0, 5.0, 20.0, 15.0), + child: Text(TranslationBase.of(context).appoPaymentConfirm, style: TextStyle(fontSize: 14.0, color: CustomColors.accentColor)), + ), + Divider( + color: Colors.grey, + ), + Container( + alignment: Alignment.center, + height: 40.0, + child: Flex( + direction: Axis.horizontal, + children: [ + Expanded( + child: InkWell( + onTap: () { + Navigator.pop(context, null); + }, + child: Container( + child: Text(TranslationBase.of(context).cancel, textAlign: TextAlign.center, style: TextStyle(fontSize: 18.0, color: CustomColors.accentColor)), ), - Expanded( - child: InkWell( - onTap: () { - Navigator.pop(context, widget.patientShareResponse); + ), + ), + Expanded( + child: InkWell( + onTap: () { + Navigator.pop(context, widget.patientShareResponse); // widget.onPaymentMethodSelected(); - }, - child: Container( - child: Text("Ok", - textAlign: TextAlign.center, - style: TextStyle( - fontSize: 18.0, - )), - ), - ), + }, + child: Container( + child: Text(TranslationBase.of(context).ok, + textAlign: TextAlign.center, + style: TextStyle( + fontSize: 18.0, + )), ), - ], + ), ), - ), - ]), + ], + ), + ), + ]), ), ), ); @@ -182,19 +131,12 @@ class _PaymentDialogState extends State { _getNormalText(text) { return Container( margin: EdgeInsets.only(top: 10.0, right: 10.0), - child: Text(text, - textAlign: TextAlign.end, - style: TextStyle( - fontSize: 15, - fontFamily: 'Open-Sans', - letterSpacing: 0.5, - color: Colors.grey[700])), + child: Text(text, style: TextStyle(fontSize: 13, letterSpacing: 0.5, color: Colors.grey[700])), ); } TextStyle getTextStyle() { - return TextStyle( - color: Colors.grey[700], fontSize: 15.0, fontFamily: "Open-Sans-Bold"); + return TextStyle(color: Colors.grey[700], fontSize: 13.0); } // Future navigateToPaymentMethod(context) async { diff --git a/lib/pages/landing/landing_page.dart b/lib/pages/landing/landing_page.dart index ceadc7e4..13cc2dce 100644 --- a/lib/pages/landing/landing_page.dart +++ b/lib/pages/landing/landing_page.dart @@ -102,13 +102,18 @@ class _LandingPageState extends State with WidgetsBindingObserver { LocationUtils locationUtils; Future onWillPop() { - DateTime now = DateTime.now(); - if (currentBackPressTime == null || now.difference(currentBackPressTime) > Duration(seconds: 2)) { - currentBackPressTime = now; - AppToast.showToast(message: TranslationBase.of(context).pressAgain); + if (currentTab != 0) { + changeCurrentTab(0); return Future.value(false); + } else { + DateTime now = DateTime.now(); + if (currentBackPressTime == null || now.difference(currentBackPressTime) > Duration(seconds: 2)) { + currentBackPressTime = now; + AppToast.showToast(message: TranslationBase.of(context).pressAgain); + return Future.value(false); + } + return Future.value(true); } - return Future.value(true); } changeCurrentTab(int tab) { @@ -610,21 +615,28 @@ class _LandingPageState extends State with WidgetsBindingObserver { changeCurrentTab(1); }, ), - MedicalProfilePageNew(onTap: (){ - changeCurrentTab(0); - },), - Search(onBackClick: (){ - changeCurrentTab(0); - },), + MedicalProfilePageNew( + onTap: () { + changeCurrentTab(0); + }, + ), + Search( + onBackClick: () { + changeCurrentTab(0); + }, + ), MyFamily( isAppbarVisible: false, onBackClick: () { changeCurrentTab(0); }, ), - ToDo(isShowAppBar: true,onBackClick: (){ - changeCurrentTab(0); - },), + ToDo( + isShowAppBar: true, + onBackClick: () { + changeCurrentTab(0); + }, + ), ], // Please do not remove the BookingOptions from this array ), RobotIcon() diff --git a/lib/pages/livecare/widgets/LiveCarePaymentDialog.dart b/lib/pages/livecare/widgets/LiveCarePaymentDialog.dart index 30c273ae..a8950e5d 100644 --- a/lib/pages/livecare/widgets/LiveCarePaymentDialog.dart +++ b/lib/pages/livecare/widgets/LiveCarePaymentDialog.dart @@ -2,6 +2,7 @@ import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; import 'package:diplomaticquarterapp/models/LiveCare/ERAppointmentFeesResponse.dart'; import 'package:diplomaticquarterapp/uitl/app_toast.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; +import 'package:diplomaticquarterapp/uitl/utils_new.dart'; import 'package:flutter/material.dart'; import 'package:provider/provider.dart'; @@ -38,7 +39,7 @@ class _LiveCarePaymentDialogState extends State { child: Container( height: 600.0, margin: EdgeInsets.all(20.0), - width: 450.0, + width: 500.0, child: SingleChildScrollView( child: Column( crossAxisAlignment: CrossAxisAlignment.start, @@ -81,10 +82,8 @@ class _LiveCarePaymentDialogState extends State { ], ), Container( - alignment: Alignment.center, margin: EdgeInsets.only(bottom: 10.0, top: 10.0), child: Text(widget.clinicName, - textAlign: TextAlign.center, style: TextStyle(fontSize: 22.0, fontWeight: FontWeight.bold)), ), @@ -194,21 +193,13 @@ class _LiveCarePaymentDialogState extends State { color: Colors.grey[400], ), Container( - alignment: Alignment.center, margin: EdgeInsets.only(top: 10.0), child: new Text( TranslationBase.of(context).upComingPayOption, - textAlign: TextAlign.center, style: new TextStyle(fontSize: 14.0), ), ), - Container( - alignment: Alignment.center, - margin: EdgeInsets.fromLTRB(20.0, 10.0, 20.0, 5.0), - child: Image.asset( - "assets/images/new-design/payment_options_invoice_confirmation.png", - width: 300), - ), + Container(margin: EdgeInsets.fromLTRB(10.0, 5.0, 10.0, 5.0), child: getPaymentMethods()), Divider( thickness: 1.0, color: Colors.grey[400], @@ -272,10 +263,9 @@ class _LiveCarePaymentDialogState extends State { return Container( margin: EdgeInsets.only(top: 10.0, right: 10.0), child: Text(text, - textAlign: TextAlign.end, + textAlign: TextAlign.start, style: TextStyle( fontSize: 14, - // fontFamily: projectViewModel.isArabic ? 'Cairo' : 'Poppins', letterSpacing: 0.5, color: Colors.black)), ); @@ -285,10 +275,9 @@ class _LiveCarePaymentDialogState extends State { return Container( margin: EdgeInsets.only(top: 10.0, right: 10.0, bottom: 10.0), child: Text(text, - textAlign: TextAlign.end, + textAlign: TextAlign.start, style: TextStyle( fontSize: 14, - // fontFamily: projectViewModel.isArabic ? 'Cairo' : 'Poppins', letterSpacing: 0.5, fontWeight: FontWeight.bold, color: Colors.black)), diff --git a/lib/pages/livecare/widgets/clinic_list.dart b/lib/pages/livecare/widgets/clinic_list.dart index 87dd7d2b..3e2ba0cf 100644 --- a/lib/pages/livecare/widgets/clinic_list.dart +++ b/lib/pages/livecare/widgets/clinic_list.dart @@ -21,6 +21,7 @@ import 'package:diplomaticquarterapp/uitl/app_toast.dart'; import 'package:diplomaticquarterapp/uitl/gif_loader_dialog_utils.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:diplomaticquarterapp/uitl/utils.dart'; +import 'package:diplomaticquarterapp/uitl/utils_new.dart'; import 'package:diplomaticquarterapp/widgets/buttons/defaultButton.dart'; import 'package:diplomaticquarterapp/widgets/dialogs/confirm_dialog.dart'; import 'package:diplomaticquarterapp/widgets/in_app_browser/InAppBrowser.dart'; @@ -439,7 +440,7 @@ class _clinic_listState extends State { isDataLoaded ? Container( height: MediaQuery.of(context).size.height * 0.7, - child: Column( + child: liveCareScheduleClinicsListResponse.clinicsHaveScheduleList.length > 0 ? Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ ListView.builder( @@ -465,7 +466,7 @@ class _clinic_listState extends State { height: 10.0, ), ], - ), + ): getNoDataWidget(context), ) : Container(), isDataLoaded diff --git a/lib/pages/medical/balance/advance_payment_page.dart b/lib/pages/medical/balance/advance_payment_page.dart index 9e587b7f..338aff23 100644 --- a/lib/pages/medical/balance/advance_payment_page.dart +++ b/lib/pages/medical/balance/advance_payment_page.dart @@ -67,70 +67,38 @@ class _AdvancePaymentPageState extends State { return BaseView( onModelReady: (model) => model.getHospitals(), builder: (_, model, w) => AppScaffold( - isShowAppBar: true, - imagesInfo: imagesInfo, - appBarTitle: TranslationBase.of(context).advancePayment, - description: TranslationBase.of(context).infoAdvancePayment, - showNewAppBarTitle: true, - showNewAppBar: true, - backgroundColor: CustomColors.appBackgroudGreyColor, - body: SingleChildScrollView( - physics: ScrollPhysics(), - child: Container( - margin: EdgeInsets.all(12), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Text( - TranslationBase.of(context).advancePaymentLabel, - textAlign: TextAlign.center, - style: TextStyle( - fontSize: 14, - fontWeight: FontWeight.w600, - letterSpacing: -0.46, - ), - ), - SizedBox( - height: 12, - ), - InkWell( - onTap: () => confirmSelectBeneficiaryDialog(model), - child: Container( - padding: EdgeInsets.all(8), - width: double.infinity, - height: 65, - decoration: BoxDecoration(borderRadius: BorderRadius.circular(12), color: Colors.white), - child: Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - Text( - getBeneficiaryType(), - style: TextStyle( - fontSize: 14, - fontWeight: FontWeight.w600, - letterSpacing: -0.46, - ), - ), - Icon(Icons.arrow_drop_down) - ], + isShowAppBar: true, + imagesInfo: imagesInfo, + appBarTitle: TranslationBase.of(context).advancePayment, + description: TranslationBase.of(context).infoAdvancePayment, + showNewAppBarTitle: true, + showNewAppBar: true, + backgroundColor: CustomColors.appBackgroudGreyColor, + body: Column( + children: [ + Expanded( + child: SingleChildScrollView( + padding: EdgeInsets.all(21), + physics: BouncingScrollPhysics(), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + mainAxisSize: MainAxisSize.min, + children: [ + Text( + TranslationBase.of(context).advancePaymentLabel, + style: TextStyle( + fontSize: 14, + fontWeight: FontWeight.w600, + letterSpacing: -0.46, ), ), - ), - if (beneficiaryType == BeneficiaryType.MyFamilyFiles) SizedBox( height: 12, ), - if (beneficiaryType == BeneficiaryType.MyFamilyFiles) InkWell( - onTap: () { - GifLoaderDialogUtils.showMyDialog(context); - model.getFamilyFiles().then((value) { - GifLoaderDialogUtils.hideDialog(context); - confirmSelectFamilyDialog(model.getAllSharedRecordsByStatusResponse.getAllSharedRecordsByStatusList); - }); - }, + onTap: () => confirmSelectBeneficiaryDialog(model), child: Container( - padding: EdgeInsets.all(12), + padding: EdgeInsets.all(8), width: double.infinity, height: 65, decoration: BoxDecoration(borderRadius: BorderRadius.circular(12), color: Colors.white), @@ -138,42 +106,102 @@ class _AdvancePaymentPageState extends State { mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ Text( - getFamilyMembersName(), + getBeneficiaryType(), style: TextStyle( fontSize: 14, fontWeight: FontWeight.w600, letterSpacing: -0.46, ), ), - Icon(Icons.arrow_drop_down), + Icon(Icons.arrow_drop_down) ], ), ), ), - SizedBox( - height: 12, - ), - NewTextFields( - hintText: TranslationBase.of(context).fileNumber, - controller: _fileTextController, - readOnly: beneficiaryType == BeneficiaryType.OtherAccount ? false : true, - ), - if (beneficiaryType == BeneficiaryType.OtherAccount) + if (beneficiaryType == BeneficiaryType.MyFamilyFiles) + SizedBox( + height: 12, + ), + if (beneficiaryType == BeneficiaryType.MyFamilyFiles) + InkWell( + onTap: () { + GifLoaderDialogUtils.showMyDialog(context); + model.getFamilyFiles().then((value) { + GifLoaderDialogUtils.hideDialog(context); + confirmSelectFamilyDialog(model.getAllSharedRecordsByStatusResponse.getAllSharedRecordsByStatusList); + }); + }, + child: Container( + padding: EdgeInsets.all(12), + width: double.infinity, + height: 65, + decoration: BoxDecoration(borderRadius: BorderRadius.circular(12), color: Colors.white), + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Text( + getFamilyMembersName(), + style: TextStyle( + fontSize: 14, + fontWeight: FontWeight.w600, + letterSpacing: -0.46, + ), + ), + Icon(Icons.arrow_drop_down), + ], + ), + ), + ), + SizedBox( + height: 12, + ), + NewTextFields( + hintText: TranslationBase.of(context).fileNumber, + controller: _fileTextController, + readOnly: beneficiaryType == BeneficiaryType.OtherAccount ? false : true, + ), + if (beneficiaryType == BeneficiaryType.OtherAccount) + SizedBox( + height: 12, + ), + if (beneficiaryType == BeneficiaryType.OtherAccount) + InkWell( + onTap: () { + if (_fileTextController.text.isNotEmpty) { + GifLoaderDialogUtils.showMyDialog(context); + model.getPatientInfoByPatientID(id: _fileTextController.text).then((value) { + GifLoaderDialogUtils.hideDialog(context); + confirmSelectPatientDialog(model.patientInfoList); + }); + } else + AppToast.showErrorToast(message: 'Please Enter The File Number'); + }, + child: Container( + padding: EdgeInsets.all(12), + width: double.infinity, + height: 65, + decoration: BoxDecoration(borderRadius: BorderRadius.circular(12), color: Colors.white), + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Text( + getPatientName(), + style: TextStyle( + fontSize: 14, + fontWeight: FontWeight.w600, + letterSpacing: -0.46, + ), + ), + Icon(Icons.arrow_drop_down), + ], + ), + ), + ), SizedBox( height: 12, ), - if (beneficiaryType == BeneficiaryType.OtherAccount) InkWell( - onTap: () { - if (_fileTextController.text.isNotEmpty) { - GifLoaderDialogUtils.showMyDialog(context); - model.getPatientInfoByPatientID(id: _fileTextController.text).then((value) { - GifLoaderDialogUtils.hideDialog(context); - confirmSelectPatientDialog(model.patientInfoList); - }); - } else - AppToast.showErrorToast(message: 'Please Enter The File Number'); - }, + onTap: () => confirmSelectHospitalDialog(model.hospitals), child: Container( padding: EdgeInsets.all(12), width: double.infinity, @@ -183,7 +211,7 @@ class _AdvancePaymentPageState extends State { mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ Text( - getPatientName(), + getHospitalName(), style: TextStyle( fontSize: 14, fontWeight: FontWeight.w600, @@ -195,132 +223,114 @@ class _AdvancePaymentPageState extends State { ), ), ), - SizedBox( - height: 12, - ), - InkWell( - onTap: () => confirmSelectHospitalDialog(model.hospitals), - child: Container( - padding: EdgeInsets.all(12), - width: double.infinity, - height: 65, - decoration: BoxDecoration(borderRadius: BorderRadius.circular(12), color: Colors.white), - child: Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - Text( - getHospitalName(), - style: TextStyle( - fontSize: 14, - fontWeight: FontWeight.w600, - letterSpacing: -0.46, - ), - ), - Icon(Icons.arrow_drop_down), - ], - ), + SizedBox( + height: 12, ), - ), - SizedBox( - height: 12, - ), - NewTextFields( - hintText: TranslationBase.of(context).amount, - keyboardType: TextInputType.numberWithOptions(signed: false, decimal: true), - onChanged: (value) { - setState(() { - amount = value; - }); - }, - ), - SizedBox( - height: 12, - ), - if (model.user != null) NewTextFields( - hintText: TranslationBase.of(context).depositorEmail, - initialValue: model.user.emailAddress, + hintText: TranslationBase.of(context).amount, + keyboardType: TextInputType.numberWithOptions(signed: false, decimal: true), onChanged: (value) { - email = value; + setState(() { + amount = value; + }); }, ), - SizedBox( - height: 12, - ), - NewTextFields( - hintText: TranslationBase.of(context).notes, - controller: _notesTextController, - ), - SizedBox( - height: MediaQuery.of(context).size.height * 0.15, - ) - ], + SizedBox( + height: 12, + ), + if (model.user != null) + NewTextFields( + hintText: TranslationBase.of(context).depositorEmail, + initialValue: model.user.emailAddress, + onChanged: (value) { + email = value; + }, + ), + SizedBox( + height: 12, + ), + NewTextFields( + hintText: TranslationBase.of(context).notes, + controller: _notesTextController, + ), + SizedBox( + height: MediaQuery.of(context).size.height * 0.15, + ) + ], + ), ), ), - ), - bottomSheet: Container( - width: double.infinity, - color: Theme.of(context).scaffoldBackgroundColor, - padding: EdgeInsets.all(12), - child: DefaultButton( - TranslationBase.of(context).submit, - (amount.isEmpty || _fileTextController.text.isEmpty || _selectedHospital == null) ? null : - () { - var mobileNum; - var patientName; + Container( + color: Colors.white, + padding: EdgeInsets.only(top: 16, bottom: 16, right: 21, left: 21), + child: DefaultButton( + TranslationBase.of(context).submit, + (amount.isEmpty || _fileTextController.text.isEmpty || _selectedHospital == null) + ? null + : () { + var mobileNum; + var patientName; - if (beneficiaryType == BeneficiaryType.MyFamilyFiles) { - mobileNum = selectedPatientFamily.mobileNumber; - patientName = selectedPatientFamily.patientName; - } - - if (beneficiaryType == BeneficiaryType.MyAccount) { - mobileNum = model.user.mobileNumber; - patientName = model.user.firstName; - } + if (beneficiaryType == BeneficiaryType.MyFamilyFiles) { + mobileNum = selectedPatientFamily.mobileNumber; + patientName = selectedPatientFamily.patientName; + } - if (beneficiaryType == BeneficiaryType.OtherAccount) { - mobileNum = _selectedPatientInfo.mobileNumber; - patientName = _selectedPatientInfo.fullName; - } + if (beneficiaryType == BeneficiaryType.MyAccount) { + mobileNum = model.user.mobileNumber; + patientName = model.user.firstName; + } - advanceModel.fileNumber = _fileTextController.text; - advanceModel.hospitalsModel = _selectedHospital; - advanceModel.note = _notesTextController.text; - advanceModel.email = email ?? model.user.emailAddress; - advanceModel.amount = amount; - advanceModel.mobileNumber = mobileNum; - advanceModel.patientName = patientName; - GifLoaderDialogUtils.showMyDialog(context); - model.getPatientInfoByPatientIDAndMobileNumber(advanceModel).then((value) { - GifLoaderDialogUtils.hideDialog(context); - if (model.state != ViewState.Error && model.state != ViewState.ErrorLocal) { - Utils.hideKeyboard(context); - Navigator.push(context, FadePage(page: PaymentMethod( - onSelectedMethod: (String metohd) { - setState(() {}); + if (beneficiaryType == BeneficiaryType.OtherAccount) { + mobileNum = _selectedPatientInfo.mobileNumber; + patientName = _selectedPatientInfo.fullName; } - ))).then( - (value) { - Navigator.push( - context, - FadePage( - page: ConfirmPaymentPage( - advanceModel: advanceModel, - selectedPaymentMethod: value, - patientInfoAndMobileNumber: model.patientInfoAndMobileNumber, - authenticatedUser: authUser, - ), - ), - ); + + advanceModel.fileNumber = _fileTextController.text; + advanceModel.hospitalsModel = _selectedHospital; + advanceModel.note = _notesTextController.text; + advanceModel.email = email ?? model.user.emailAddress; + advanceModel.amount = amount; + advanceModel.mobileNumber = mobileNum; + advanceModel.patientName = patientName; + GifLoaderDialogUtils.showMyDialog(context); + model.getPatientInfoByPatientIDAndMobileNumber(advanceModel).then((value) { + GifLoaderDialogUtils.hideDialog(context); + if (model.state != ViewState.Error && model.state != ViewState.ErrorLocal) { + Utils.hideKeyboard(context); + Navigator.push( + context, + FadePage( + page: PaymentMethod(onSelectedMethod: (String metohd) { + setState(() {}); + }), + ), + ).then( + (value) { + Navigator.push( + context, + FadePage( + page: ConfirmPaymentPage( + advanceModel: advanceModel, + selectedPaymentMethod: value, + patientInfoAndMobileNumber: model.patientInfoAndMobileNumber, + authenticatedUser: authUser, + ), + ), + ); + }, + ); + } + }); }, - ); - } - }); - }, - disabledColor: Colors.grey, + color: Color(0xffD02127), + textColor: Colors.white, + disabledColor: Color(0xffEAEAEA), + ), ), - )), + ], + ), + ), ); } diff --git a/lib/pages/medical/prescriptions/PrescriptionOrderOverveiw.dart b/lib/pages/medical/prescriptions/PrescriptionOrderOverveiw.dart index e081e32b..fd4f8b26 100644 --- a/lib/pages/medical/prescriptions/PrescriptionOrderOverveiw.dart +++ b/lib/pages/medical/prescriptions/PrescriptionOrderOverveiw.dart @@ -10,7 +10,6 @@ import 'package:diplomaticquarterapp/uitl/gif_loader_dialog_utils.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:diplomaticquarterapp/uitl/utils_new.dart'; import 'package:diplomaticquarterapp/widgets/buttons/secondary_button.dart'; -import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; import 'package:diplomaticquarterapp/widgets/dialogs/ConfirmWithMessageDialog.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; import 'package:flutter/cupertino.dart'; @@ -77,9 +76,11 @@ class PrescriptionOrderOverview extends StatelessWidget { child: Padding( padding: const EdgeInsets.all(8.0), child: Center( - child: Text(prescriptionReportList[index].itemDescription.isNotEmpty - ? prescriptionReportList[index].itemDescription - : prescriptionReportList[index].itemDescriptionN)), + child: Text( + prescriptionReportList[index].itemDescription.isNotEmpty + ? prescriptionReportList[index].itemDescription + : prescriptionReportList[index].itemDescriptionN, + style: TextStyle(fontFamily: prescriptionReportList[index].itemDescription.isNotEmpty ? 'Poppins' : 'Cairo'))), )), ], ), @@ -130,7 +131,16 @@ class PrescriptionOrderOverview extends StatelessWidget { child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ - Text(prescriptionReportEnhList[index].itemDescription), + Text( + (prescriptionReportList[index].itemDescription.isNotEmpty + ? prescriptionReportList[index].itemDescription + : prescriptionReportList[index].itemDescriptionN ?? ''), + style: TextStyle( + fontFamily: prescriptionReportList[index].itemDescription.isNotEmpty ? 'Poppins' : 'Cairo', + letterSpacing: -0.64, + color: Color(0xff2E303A), + fontSize: 16.0, + fontWeight: FontWeight.w600)), ], ), ), diff --git a/lib/pages/medical/vital_sign/vital_sign_item.dart b/lib/pages/medical/vital_sign/vital_sign_item.dart index 37cbbf27..1549db39 100644 --- a/lib/pages/medical/vital_sign/vital_sign_item.dart +++ b/lib/pages/medical/vital_sign/vital_sign_item.dart @@ -42,6 +42,7 @@ class VitalSignItem extends StatelessWidget { maxLines: 1, style: TextStyle( fontSize: 15, + color: Color(0xff2B353E), letterSpacing: -0.45, fontWeight: FontWeight.bold, ), @@ -64,7 +65,7 @@ class VitalSignItem extends StatelessWidget { height: MediaQuery.of(context).size.width / 16, child: SvgPicture.asset( vitalSign.icon, - color: Colors.black, + color: Color(0xff2E303A), ), ), ], diff --git a/lib/pages/medical/vital_sign/vital_sing_chart_and_detials.dart b/lib/pages/medical/vital_sign/vital_sing_chart_and_detials.dart index ea29909b..e98bcb72 100644 --- a/lib/pages/medical/vital_sign/vital_sing_chart_and_detials.dart +++ b/lib/pages/medical/vital_sign/vital_sing_chart_and_detials.dart @@ -6,6 +6,7 @@ import 'package:diplomaticquarterapp/uitl/utils.dart'; import 'package:diplomaticquarterapp/uitl/utils_new.dart'; import 'package:diplomaticquarterapp/widgets/charts/app_time_series_chart.dart'; import 'package:diplomaticquarterapp/widgets/charts/show_chart.dart'; +import 'package:diplomaticquarterapp/widgets/charts/sync_fu_chart.dart'; import 'package:flutter/material.dart'; import 'package:provider/provider.dart'; @@ -49,15 +50,19 @@ class _VitalSingChartAndDetialsState extends State { return SingleChildScrollView( child: Column( children: [ - Card( - shape: cardRadius(12), - elevation: 1, - margin: EdgeInsets.only(left: 16, top: 16, right: 16, bottom: 8), - child: ShowChart( - title: widget.name, - timeSeries: timeSeriesData, - indexes: timeSeriesData.length ~/ 5.5, - horizontalInterval: 8, + Container( + height: 400, + child: Card( + shape: cardRadius(12), + elevation: 1, + margin: EdgeInsets.only(left: 16, top: 16, right: 16, bottom: 8), + child: ShowChart( + title: widget.name, + timeSeries: timeSeriesData, + indexes: timeSeriesData.length ~/ 5.5, + horizontalInterval: 8, + ), + // child: SyncFuChart(), ), ), Card( diff --git a/lib/pages/settings/general_setting.dart b/lib/pages/settings/general_setting.dart index 049b9821..adbebfca 100644 --- a/lib/pages/settings/general_setting.dart +++ b/lib/pages/settings/general_setting.dart @@ -1,9 +1,11 @@ import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; import 'package:diplomaticquarterapp/services/permission/permission_service.dart'; +import 'package:diplomaticquarterapp/theme/colors.dart'; import 'package:diplomaticquarterapp/theme/theme_notifier.dart'; import 'package:diplomaticquarterapp/theme/theme_value.dart'; import 'package:diplomaticquarterapp/uitl/app_shared_preferences.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; +import 'package:diplomaticquarterapp/uitl/utils_new.dart'; import 'package:diplomaticquarterapp/widgets/text/app_texts_widget.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; @@ -16,8 +18,7 @@ class GeneralSettings extends StatefulWidget { _GeneralSettings createState() => _GeneralSettings(); } -class _GeneralSettings extends State - with TickerProviderStateMixin { +class _GeneralSettings extends State with TickerProviderStateMixin { var themeNotifier; int blindValue = 0; bool vibration = false; @@ -28,6 +29,7 @@ class _GeneralSettings extends State var permission = new PermissionService(); LocationPermission locationPermission; var mediaQueryData; + @override void initState() { this.getValues(); @@ -38,196 +40,243 @@ class _GeneralSettings extends State mediaQueryData = MediaQuery.of(context); themeNotifier = Provider.of(context); return Container( - child: ListView(scrollDirection: Axis.vertical, children: [ - Container( - color: Theme.of(context).scaffoldBackgroundColor, - padding: EdgeInsets.all(10), - child: AppText( - TranslationBase.of(context).modes, - fontWeight: FontWeight.bold, - ), - ), - Container( - color: Theme.of(context).scaffoldBackgroundColor, - padding: EdgeInsets.all(10), - child: Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - AppText(TranslationBase.of(context).vibration), - Switch( - value: vibration, - onChanged: (value) { - setState(() { - vibration = value; - }); - setVibration(value); - }, - activeTrackColor: Colors.lightGreenAccent, - activeColor: Colors.green, - ) - ], - )), - Container( - color: Theme.of(context).scaffoldBackgroundColor, - padding: EdgeInsets.all(10), - child: Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - AppText(TranslationBase.of(context).accessibility), - Switch( - value: accsibility, - onChanged: (value) { - setState(() { - accsibility = value; - }); - }, - activeTrackColor: Colors.lightGreenAccent, - activeColor: Colors.green, - ) - ], - )), - Container( - color: Theme.of(context).scaffoldBackgroundColor, - padding: EdgeInsets.all(10), - child: AppText( - TranslationBase.of(context).blindMode, - fontWeight: FontWeight.bold, - ), - ), - new Container( - color: Theme.of(context).scaffoldBackgroundColor, - padding: EdgeInsets.all(8.0), - child: new Column( - mainAxisAlignment: MainAxisAlignment.center, - children: [ - new Column( - mainAxisAlignment: MainAxisAlignment.center, - children: [ - Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - new Text( - TranslationBase.of(context).offTheme, - style: new TextStyle(fontSize: 16.0), - ), - Radio( - value: 0, - groupValue: blindValue, - onChanged: (value) { - setState(() => {this.blindValue = value}); - setTheme(value); - }, - ), - ], + child: SingleChildScrollView( + child: Padding( + padding: const EdgeInsets.all(21.0), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + + Text( + TranslationBase.of(context).alert, + style: TextStyle( + fontSize: 16, + fontWeight: FontWeight.w600, + letterSpacing: -0.64, + ), + ), + Text( + TranslationBase.of(context).modesBelow, + style: TextStyle( + fontSize: 12, + fontWeight: FontWeight.w600, + letterSpacing: -0.48, + ), + ), + Row( + children: [ + Checkbox( + value: vibration, + onChanged: (value) { + setState(() { + vibration = value; + }); + }, + activeColor: CustomColors.accentColor, + ), + Text( + TranslationBase.of(context).prefferedMode, + style: TextStyle( + fontSize: 12, + letterSpacing: -0.48, ), - Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - new Text( - TranslationBase.of(context).invertTheme, - style: new TextStyle( - fontSize: 16.0, - ), - ), - new Radio( - value: 1, - groupValue: blindValue, - onChanged: (value) { - setState(() => {this.blindValue = value}); - setTheme(value); - }, - ) - ], + ), + ], + ), + Row( + children: [ + Checkbox( + value: accsibility, + onChanged: (value) { + setState(() { + accsibility = value; + }); + }, + activeColor: CustomColors.accentColor, + ), + Text( + TranslationBase.of(context).accessibility, + style: TextStyle( + fontSize: 12, + letterSpacing: -0.48, ), - Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - new Text( - TranslationBase.of(context).dimTheme, - style: new TextStyle(fontSize: 16.0), + ), + ], + ), + mHeight(16), + mHeight(12), + Text( + TranslationBase.of(context).blindMode, + style: TextStyle( + fontSize: 16, + fontWeight: FontWeight.w600, + letterSpacing: -0.64, + ), + ), + Text( + TranslationBase.of(context).prefferedMode, + style: TextStyle( + fontSize: 12, + fontWeight: FontWeight.w600, + letterSpacing: -0.48, + ), + ), + Column( + children: [ + Row( + children: [ + new Radio( + value: 0, + groupValue: blindValue, + onChanged: (value) { + setState(() { + blindValue = value; + setTheme(value); + }); + }, + ), + Text( + TranslationBase.of(context).offTheme, + style: TextStyle( + fontSize: 12, + letterSpacing: -0.48, ), - new Radio( - value: 2, - groupValue: blindValue, - onChanged: (value) { - setState(() => {this.blindValue = value}); + ), + ], + ), + Row( + children: [ + Radio( + value: 1, + groupValue: blindValue, + onChanged: (value) { + setState(() { + blindValue = value; setTheme(value); - }, + }); + }, + ), + Text( + TranslationBase.of(context).invertTheme, + style: TextStyle( + fontSize: 12, + letterSpacing: -0.48, ), - ], - ), - Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - new Text( - TranslationBase.of(context).bwTheme, - style: new TextStyle(fontSize: 16.0), + ), + ], + ), + Row( + children: [ + Radio( + value: 2, + groupValue: blindValue, + onChanged: (value) { + setState(() { + blindValue = value; + setTheme(value); + }); + }, + ), + Text( + TranslationBase.of(context).dimTheme, + style: TextStyle( + fontSize: 12, + letterSpacing: -0.48, ), - new Radio( - value: 3, - groupValue: blindValue, - onChanged: (value) { - setState(() => {this.blindValue = value}); - + ), + ], + ), + Row( + children: [ + Radio( + value: 1, + groupValue: blindValue, + onChanged: (value) { + setState(() { + blindValue = value; setTheme(value); - }, + }); + }, + ), + Text( + TranslationBase.of(context).bwTheme, + style: TextStyle( + fontSize: 12, + letterSpacing: -0.48, ), - ], + ), + ], + ), + ], + ), + mHeight(12), + mHeight(12), + Text( + TranslationBase.of(context).permissions, + style: TextStyle( + fontSize: 16, + fontWeight: FontWeight.w600, + letterSpacing: -0.64, + ), + ), + Text( + TranslationBase.of(context).permissionsBellow, + style: TextStyle( + fontSize: 12, + fontWeight: FontWeight.w600, + letterSpacing: -0.48, + ), + ), + Row( + children: [ + Checkbox( + value: camera, + onChanged: (value) { + setState(() { + camera = value; + }); + this.permission.openSettings(); + }, + activeColor: CustomColors.accentColor, + ), + Text( + TranslationBase.of(context).cameraPermission, + style: TextStyle( + fontSize: 12, + letterSpacing: -0.48, + ), + ), + ], + ), + Row( + children: [ + Checkbox( + value: location, + onChanged: (value) { + if (value == true) { + Navigator.pop(context); + this.setLocationPermission(); + } else { + Geolocator.openLocationSettings(); + } + }, + activeColor: CustomColors.accentColor, + ), + Text( + TranslationBase.of(context).locationPermission, + style: TextStyle( + fontSize: 12, + letterSpacing: -0.48, ), - ], - ) - ])), - Container( - color: Theme.of(context).scaffoldBackgroundColor, - padding: EdgeInsets.all(10), - child: AppText( - TranslationBase.of(context).permissions, - fontWeight: FontWeight.bold, + ), + ], + ), + mHeight(16), + ], + ), ), ), - Container( - color: Theme.of(context).scaffoldBackgroundColor, - padding: EdgeInsets.all(10), - child: Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - AppText(TranslationBase.of(context).cameraPermission), - Switch( - value: camera, - onChanged: (value) { - setState(() { - camera = value; - }); - this.permission.openSettings(); - }, - activeTrackColor: Colors.lightGreenAccent, - activeColor: Colors.green, - ) - ], - )), - Container( - color: Theme.of(context).scaffoldBackgroundColor, - padding: EdgeInsets.all(10), - child: Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - AppText(TranslationBase.of(context).locationPermission), - Switch( - value: location, - onChanged: (value) { - if (value == true) { - Navigator.pop(context); - this.setLocationPermission(); - } else { - Geolocator.openLocationSettings(); - } - }, - activeTrackColor: Colors.lightGreenAccent, - activeColor: Colors.green, - ) - ], - )) - ])); + ); } setLocationPermission() async { @@ -292,11 +341,8 @@ class _GeneralSettings extends State getValues() async { if (permission.isThemeEnabled() != null) { - blindValue = - permission.isThemeEnabled() == null ? 0 : permission.isThemeEnabled(); - vibration = permission.isVibrationEnabled() == null - ? false - : permission.isVibrationEnabled(); + blindValue = permission.isThemeEnabled() == null ? 0 : permission.isThemeEnabled(); + vibration = permission.isVibrationEnabled() == null ? false : permission.isVibrationEnabled(); // accsibility = mediaQueryData.accessibleNavigation; //setTheme(blindValue); } @@ -310,19 +356,11 @@ class _GeneralSettings extends State getTheme(value) async { if (value == 1) { - return invertThemes( - fontName: Provider.of(context, listen: false).isArabic ? 'Cairo' : 'Poppins' - ); + return invertThemes(fontName: Provider.of(context, listen: false).isArabic ? 'Cairo' : 'Poppins'); } else if (value == 3) { - return bwThemes( - fontName: Provider.of(context, listen: false).isArabic ? 'Cairo' : 'Poppins' - ); + return bwThemes(fontName: Provider.of(context, listen: false).isArabic ? 'Cairo' : 'Poppins'); } else { - return defaultTheme( - fontName: - Provider.of(context, listen: false).isArabic - ? 'Cairo' - : 'Poppins'); + return defaultTheme(fontName: Provider.of(context, listen: false).isArabic ? 'Cairo' : 'Poppins'); } } } diff --git a/lib/pages/settings/profile_setting.dart b/lib/pages/settings/profile_setting.dart index 838af5f9..f55227d8 100644 --- a/lib/pages/settings/profile_setting.dart +++ b/lib/pages/settings/profile_setting.dart @@ -2,9 +2,11 @@ import 'package:diplomaticquarterapp/core/viewModels/dashboard_view_model.dart'; import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; import 'package:diplomaticquarterapp/pages/base/base_view.dart'; import 'package:diplomaticquarterapp/services/authentication/auth_provider.dart'; +import 'package:diplomaticquarterapp/theme/colors.dart'; import 'package:diplomaticquarterapp/uitl/app_toast.dart'; import 'package:diplomaticquarterapp/uitl/gif_loader_dialog_utils.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; +import 'package:diplomaticquarterapp/uitl/utils_new.dart'; import 'package:diplomaticquarterapp/widgets/buttons/defaultButton.dart'; import 'package:diplomaticquarterapp/widgets/text/app_texts_widget.dart'; import 'package:flutter/cupertino.dart'; @@ -16,8 +18,7 @@ class ProfileSettings extends StatefulWidget { _ProfileSettings createState() => _ProfileSettings(); } -class _ProfileSettings extends State - with TickerProviderStateMixin { +class _ProfileSettings extends State with TickerProviderStateMixin { bool smsAlert = true; bool emailAlert = true; int language = 1; @@ -25,6 +26,7 @@ class _ProfileSettings extends State TextEditingController emergencyContact = new TextEditingController(); TextEditingController emailController = new TextEditingController(); TextEditingController emergencyContactName = new TextEditingController(); + @override void initState() { Future.delayed(new Duration(seconds: 0), () { @@ -37,199 +39,300 @@ class _ProfileSettings extends State Widget build(BuildContext context) { return BaseView( - onModelReady: (model) => {}, - builder: (_, model, wi) => Container( - child: model.user != null - ? ListView(scrollDirection: Axis.vertical, children: [ - Container( - color: Theme.of(context).textTheme.headline2.color, - padding: EdgeInsets.all(15), - child: Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - AppText( - TranslationBase.of(context).fileNo, - color: Colors.black, - ), - AppText( - model.user.patientID.toString(), - color: Colors.black, - ), - ], + onModelReady: (model) => {}, + builder: (_, model, wi) => Container( + child: model.user != null + ? Column( + children: [ + Expanded( + child: SingleChildScrollView( + child: Padding( + padding: const EdgeInsets.all(21.0), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Card( + shape: cardRadius(8), + margin: EdgeInsets.zero, + elevation: 3, + child: Padding( + padding: const EdgeInsets.all(12.0), + child: Row( + mainAxisAlignment: MainAxisAlignment.start, + children: [ + Text( + TranslationBase.of(context).fileNo + ": ", + style: TextStyle( + fontSize: 16, + fontWeight: FontWeight.w600, + letterSpacing: -0.64, + ), + ), + Text( + model.user.patientID.toString(), + style: TextStyle( + fontSize: 16, + fontWeight: FontWeight.w600, + letterSpacing: -0.64, + ), + ), + ], + ), + ), + ), + mHeight(12), + Text( + TranslationBase.of(context).languageSetting, + style: TextStyle( + fontSize: 16, + fontWeight: FontWeight.w600, + letterSpacing: -0.64, + ), + ), + Text( + TranslationBase.of(context).selectLanguage, + style: TextStyle( + fontSize: 12, + fontWeight: FontWeight.w600, + letterSpacing: -0.48, + ), + ), + Row( + children: [ + Expanded( + child: Row( + children: [ + new Radio( + value: 2, + groupValue: language, + onChanged: (value) { + setState(() { + language = value; + }); + }, + ), + Text( + TranslationBase.of(context).english, + style: TextStyle( + fontSize: 12, + letterSpacing: -0.48, + ), + ), + ], + ), + ), + Expanded( + child: Row( + children: [ + Radio( + value: 1, + groupValue: language, + onChanged: (value) { + setState(() { + language = value; + }); + }, + ), + Text( + TranslationBase.of(context).arabic, + style: TextStyle( + fontSize: 12, + letterSpacing: -0.48, + ), + ), + ], + ), + ), + ], + ), + mHeight(12), + Text( + TranslationBase.of(context).alert, + style: TextStyle( + fontSize: 16, + fontWeight: FontWeight.w600, + letterSpacing: -0.64, + ), + ), + Text( + TranslationBase.of(context).recAlert, + style: TextStyle( + fontSize: 12, + fontWeight: FontWeight.w600, + letterSpacing: -0.48, + ), + ), + Row( + children: [ + Checkbox( + value: emailAlert, + onChanged: (value) { + setState(() { + emailAlert = value; + }); + }, + activeColor: CustomColors.accentColor, + ), + Text( + TranslationBase.of(context).emailAlert, + style: TextStyle( + fontSize: 12, + letterSpacing: -0.48, + ), + ), + ], + ), + Row( + children: [ + Checkbox( + value: smsAlert, + onChanged: (value) { + setState(() { + smsAlert = value; + }); + }, + activeColor: CustomColors.accentColor, + ), + Text( + TranslationBase.of(context).smsAlert, + style: TextStyle( + fontSize: 12, + letterSpacing: -0.48, + ), + ), + ], + ), + mHeight(16), + Text( + TranslationBase.of(context).contactInfo, + style: TextStyle( + fontSize: 16, + fontWeight: FontWeight.w600, + letterSpacing: -0.64, + ), + ), + mHeight(12), + inputWidget(TranslationBase.of(context).email, "", emailController), + mHeight(8), + inputWidget(TranslationBase.of(context).emergencyName, "", emergencyContactName), + mHeight(8), + inputWidget(TranslationBase.of(context).emergencyContact, "", emergencyContact), + mHeight(8), + ], + ), ), ), - SizedBox( - height: 1, - width: MediaQuery.of(context).size.width, - child: Container( - color: Colors.grey[300], + ), + Container( + width: double.infinity, + child: Card( + margin: EdgeInsets.zero, + elevation: 20, + child: Padding( + padding: const EdgeInsets.only(left: 16, right: 16, bottom: 16, top: 16), + child: DefaultButton( + TranslationBase.of(context).save, + () { + saveSettings(); + }, + ), ), ), - Padding( - child: AppText( - TranslationBase.of(context).languageSetting, - fontWeight: FontWeight.bold), - padding: EdgeInsets.all(10), + ), + ], + ) + : Center( + child: AppText(TranslationBase.of(context).loginToUseService), + ), + ), + ); + } + + Widget inputWidget(String _labelText, String _hintText, TextEditingController _controller, {String prefix, bool isEnable = true, bool hasSelection = false}) { + return Container( + padding: EdgeInsets.only(left: 16, right: 16, bottom: 15, top: 15), + alignment: Alignment.center, + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(15), + color: Colors.white, + border: Border.all( + color: Color(0xffefefef), + width: 1, + ), + ), + child: InkWell( + onTap: hasSelection ? () {} : null, + child: Row( + children: [ + Expanded( + child: Column( + mainAxisSize: MainAxisSize.min, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + _labelText, + style: TextStyle( + fontSize: 11, + fontWeight: FontWeight.w600, + color: Color(0xff2B353E), + letterSpacing: -0.44, ), - Container( - color: Theme.of(context).textTheme.headline2.color, - padding: EdgeInsets.only( - top: 0, left: 10, right: 10, bottom: 0), - child: Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - AppText(TranslationBase.of(context).english), - new Radio( - value: 2, - groupValue: language, - onChanged: (value) { - setState(() { - language = value; - }); - }, - ) - ], - )), - Container( - color: Theme.of(context).textTheme.headline2.color, - padding: EdgeInsets.only( - top: 0, left: 10, right: 10, bottom: 0), - child: Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - AppText(TranslationBase.of(context).arabic), - new Radio( - value: 1, - groupValue: language, - onChanged: (value) { - setState(() { - language = value; - }); - }, - ) - ], - )), - Padding( - child: AppText(TranslationBase.of(context).alert), - padding: EdgeInsets.all(10), + ), + TextField( + enabled: isEnable, + scrollPadding: EdgeInsets.zero, + keyboardType: TextInputType.number, + controller: _controller, + // onChanged: (value) => {validateForm()}, + style: TextStyle( + fontSize: 14, + height: 21 / 14, + fontWeight: FontWeight.w400, + color: Color(0xff2B353E), + letterSpacing: -0.44, ), - Container( - color: Theme.of(context).textTheme.headline2.color, - padding: EdgeInsets.only( - top: 0, left: 10, right: 10, bottom: 0), - child: Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - AppText(TranslationBase.of(context).emailAlert), - Switch( - value: emailAlert, - onChanged: (value) { - setState(() { - emailAlert = value; - }); - }, - activeTrackColor: Colors.lightGreenAccent, - activeColor: Colors.green, - ) - ], - )), - Container( - color: Theme.of(context).textTheme.headline2.color, - padding: EdgeInsets.only( - top: 0, left: 10, right: 10, bottom: 0), - child: Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - AppText(TranslationBase.of(context).smsAlert), - Switch( - value: smsAlert, - onChanged: (value) { - setState(() { - smsAlert = value; - }); - }, - activeTrackColor: Colors.lightGreenAccent, - activeColor: Colors.green, - ) - ], - )), - Padding( - child: AppText(TranslationBase.of(context).contactInfo), - padding: EdgeInsets.all(10), - ), - Container( - color: Theme.of(context).textTheme.headline2.color, - padding: EdgeInsets.only( - top: 0, left: 10, right: 10, bottom: 0), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - AppText(TranslationBase.of(context).email), - TextField( - controller: emailController, - decoration: InputDecoration( - suffixIcon: Icon(Icons.edit), - )) - ], - )), - Container( - color: Theme.of(context).textTheme.headline2.color, - padding: EdgeInsets.only( - top: 0, left: 10, right: 10, bottom: 0), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - AppText(TranslationBase.of(context).emergencyName), - TextField( - controller: emergencyContactName, - decoration: InputDecoration( - suffixIcon: Icon(Icons.edit), - )) - ], - )), - Container( - color: Theme.of(context).textTheme.headline2.color, - padding: EdgeInsets.only( - top: 0, left: 10, right: 10, bottom: 0), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - AppText( - TranslationBase.of(context).emergencyContact), - TextField( - controller: emergencyContact, - decoration: InputDecoration( - suffixIcon: Icon(Icons.edit), + decoration: InputDecoration( + isDense: true, + hintText: _hintText, + hintStyle: TextStyle( + fontSize: 14, + height: 21 / 14, + fontWeight: FontWeight.w400, + color: Color(0xff575757), + letterSpacing: -0.56, + ), + prefixIconConstraints: BoxConstraints(minWidth: 50), + prefixIcon: prefix == null + ? null + : Text( + "+" + prefix, + style: TextStyle( + fontSize: 14, + height: 21 / 14, + fontWeight: FontWeight.w500, + color: Color(0xff2E303A), + letterSpacing: -0.56, ), - ) - ], - )), - Container( - padding: EdgeInsets.all(10), - child: Row( - children: [ - Expanded( - child: DefaultButton( - TranslationBase.of(context).save, - () { - saveSettings(); - }, - )), - ], - )) - ]) - : Center( - child: - AppText(TranslationBase.of(context).loginToUseService), - ))); + ), + contentPadding: EdgeInsets.zero, + border: InputBorder.none, + focusedBorder: InputBorder.none, + enabledBorder: InputBorder.none, + ), + ), + ], + ), + ), + if (hasSelection) Icon(Icons.keyboard_arrow_down_outlined), + ], + ), + ), + ); } getSettings(context) { GifLoaderDialogUtils.showMyDialog(context); - authService.getSettings().then((result) => { - GifLoaderDialogUtils.hideDialog(context), - setValue(result["PateintInfoForUpdateList"][0]) - }); + authService.getSettings().then((result) => {GifLoaderDialogUtils.hideDialog(context), setValue(result["PateintInfoForUpdateList"][0])}); } setValue(value) { @@ -252,10 +355,6 @@ class _ProfileSettings extends State request["IsEmailAlertRequired"] = this.emailAlert; request["IsSMSAlertRequired"] = this.smsAlert; request["PreferredLanguage"] = this.language.toString(); - authService.saveSettings(request).then((result) => { - AppToast.showSuccessToast( - message: TranslationBase.of(context).profileUpdate), - GifLoaderDialogUtils.hideDialog(context) - }); + authService.saveSettings(request).then((result) => {AppToast.showSuccessToast(message: TranslationBase.of(context).profileUpdate), GifLoaderDialogUtils.hideDialog(context)}); } } diff --git a/lib/pages/settings/settings.dart b/lib/pages/settings/settings.dart index 1282a636..32e4cf66 100644 --- a/lib/pages/settings/settings.dart +++ b/lib/pages/settings/settings.dart @@ -1,7 +1,9 @@ import 'package:diplomaticquarterapp/config/config.dart'; import 'package:diplomaticquarterapp/pages/settings/general_setting.dart'; import 'package:diplomaticquarterapp/pages/settings/profile_setting.dart'; +import 'package:diplomaticquarterapp/theme/colors.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; +import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; import 'package:diplomaticquarterapp/widgets/others/arrow_back.dart'; import 'package:flutter/material.dart'; @@ -9,6 +11,7 @@ class Settings extends StatefulWidget { final int type; Settings({this.type = 0}); + @override _Settings createState() => _Settings(); } @@ -18,8 +21,7 @@ class _Settings extends State with TickerProviderStateMixin { @override void initState() { - _tabController = - new TabController(length: 2, vsync: this, initialIndex: widget.type); + _tabController = new TabController(length: 2, vsync: this, initialIndex: widget.type); if (widget.type == 1) { _tabController.animateTo(1); @@ -31,45 +33,45 @@ class _Settings extends State with TickerProviderStateMixin { @override Widget build(BuildContext context) { AppGlobal.context = context; - return Scaffold( - appBar: AppBar( - actions: [ - IconButton( - icon: Icon(Icons.info, color: Colors.white), - onPressed: () { - //openInfoPage() - }, - ) - ], - bottom: TabBar( - // isScrollable: true, + return AppScaffold( + isShowAppBar: false, + isShowDecPage: false, + showNewAppBarTitle: true, + showNewAppBar: true, + appBarTitle: TranslationBase.of(context).settings, + backgroundColor: Color(0xFFF7F7F7), + body: Column( + children: [ + TabBar( + // isScrollable: true, - indicatorWeight: 5.0, - //indicatorSize: TabBarIndicatorSize.label, - // indicatorSize: TabBarIndicatorSize.tab, + indicatorWeight: 3.0, + //indicatorSize: TabBarIndicatorSize.label, + // indicatorSize: TabBarIndicatorSize.tab, - indicatorColor: Theme.of(context).primaryColor, - // labelColor: Theme.of(context).primaryColor, - tabs: [ - Tab(text: TranslationBase.of(context).general), - Tab( - text: TranslationBase.of(context).profile, - ) - ], - controller: _tabController, - ), - title: Text(TranslationBase.of(context).settings, - style: TextStyle(color: Colors.white)), - leading: Builder( - builder: (BuildContext context) { - return ArrowBack(); - }, - ), + indicatorColor: CustomColors.accentColor, + labelColor: Colors.black, + unselectedLabelColor: CustomColors.grey, + // labelColor: Theme.of(context).primaryColor, + tabs: [ + Tab(text: TranslationBase.of(context).general), + Tab( + text: TranslationBase.of(context).profile, + ) + ], + controller: _tabController, + ), + Expanded( + child: TabBarView( + physics: NeverScrollableScrollPhysics(), + children: [ + GeneralSettings(), + ProfileSettings(), + ], + controller: _tabController), + ), + ], ), - body: TabBarView( - physics: NeverScrollableScrollPhysics(), - children: [GeneralSettings(), ProfileSettings()], - controller: _tabController), ); } } diff --git a/lib/uitl/translations_delegate_base.dart b/lib/uitl/translations_delegate_base.dart index 0a3177e0..98ac31f9 100644 --- a/lib/uitl/translations_delegate_base.dart +++ b/lib/uitl/translations_delegate_base.dart @@ -2361,6 +2361,19 @@ class TranslationBase { String get selectSlot => localizedValues["selectSlot"][locale.languageCode]; + String get selectLanguage => localizedValues["selectLanguage"][locale.languageCode]; + + String get recAlert => localizedValues["recAlert"][locale.languageCode]; + + String get modesBelow => localizedValues["modesBelow"][locale.languageCode]; + String get prefferedMode => localizedValues["prefferedMode"][locale.languageCode]; + String get permissionsBellow => localizedValues["permissionsBellow"][locale.languageCode]; + String get invoiceDetails => localizedValues["invoiceDetails"][locale.languageCode]; + + String get appoDetails => localizedValues["appoDetails"][locale.languageCode]; + + String get appoPaymentConfirm => localizedValues["appoPaymentConfirm"][locale.languageCode]; + } class TranslationBaseDelegate extends LocalizationsDelegate { diff --git a/lib/uitl/utils_new.dart b/lib/uitl/utils_new.dart index 0bbad901..e9d70a1f 100644 --- a/lib/uitl/utils_new.dart +++ b/lib/uitl/utils_new.dart @@ -26,6 +26,22 @@ Color getColorFromHex(String hexColor) { return Color(int.parse(hexColor, radix: 16)); } +Widget getPaymentMethods() { + return Container( + child: Row( + mainAxisSize: MainAxisSize.max, + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Image.asset("assets/images/new/payment/Mada.png", width: 50, height: 50), + Image.asset("assets/images/new/payment/visa.png", width: 50, height: 50), + Image.asset("assets/images/new/payment/Mastercard.png", width: 50, height: 50), + Image.asset("assets/images/new/payment/Apple_Pay.png", width: 50, height: 50), + Image.asset("assets/images/new/payment/installments.png", width: 50, height: 50), + ], + ), + ); +} + Widget getNoDataWidget(BuildContext context) { return Container( child: Center( diff --git a/lib/widgets/charts/custom_line_chart.dart b/lib/widgets/charts/custom_line_chart.dart new file mode 100644 index 00000000..cfd1e718 --- /dev/null +++ b/lib/widgets/charts/custom_line_chart.dart @@ -0,0 +1,148 @@ +import 'dart:math' as math; + +import 'package:fl_chart/fl_chart.dart'; +import 'package:flutter/material.dart'; + +class LineChartModel { + int value; + String title; + + LineChartModel(this.title, this.value); +} + +class CustomLineChart extends StatefulWidget { + final List list; + final bool isArabic; + CustomLineChart(this.list, this.isArabic); + + @override + _CustomLineChartState createState() => _CustomLineChartState(); +} + +class _CustomLineChartState extends State { + bool showAvg = false; + + final List myList = [ + LineChartModel("", 0), + LineChartModel("", 0), + // LineChartModel("", 0), + ]; + + List list = []; + + @override + void initState() { + super.initState(); + if (widget.list.isEmpty) { + list = myList; + } else { + list = widget.list; + } + } + + @override + Widget build(BuildContext context) { + return Stack( + children: [ + AspectRatio( + aspectRatio: 1.0, + child: LineChart( + mainData(), + ), + ), + SizedBox( + width: 60, + height: 34, + child: TextButton( + onPressed: () { + setState(() { + showAvg = !showAvg; + }); + }, + child: Text( + '', + style: TextStyle(fontSize: 12, color: showAvg ? Colors.white.withOpacity(0.5) : Colors.white), + ), + ), + ), + ], + ); + } + + LineChartData mainData() { + SideTitles right = SideTitles( + showTitles: true, + margin: 0, + reservedSize: 8, + getTitles: (value) { + return ''; + }, + ); + SideTitles left = SideTitles( + showTitles: true, + interval: 1, + getTextStyles: (value) => const TextStyle(color: Color(0xff2E303A), fontWeight: FontWeight.w600, fontSize: 12, letterSpacing: 0), + getTitles: (value) { + if (widget.list.isEmpty) { + return (value).toInt().toString(); + } + return (value * 20).toInt().toString(); + }, + reservedSize: 22, + margin: 12, + ); + return LineChartData( + lineTouchData: LineTouchData(enabled: false), + gridData: FlGridData( + show: true, + drawVerticalLine: false, + getDrawingHorizontalLine: (value) { + return FlLine( + color: const Color(0xffEFEFEF), + strokeWidth: 1, + ); + }, + ), + titlesData: FlTitlesData( + show: true, + topTitles: SideTitles(showTitles: false), + bottomTitles: SideTitles( + showTitles: true, + reservedSize: 22, + interval: 1, + getTextStyles: (value) => const TextStyle(color: Color(0xff2E303A), fontWeight: FontWeight.w600, fontSize: 12, letterSpacing: 0), + getTitles: (value) { + String _title = list[value.toInt()].title; + return (_title.length > 3 ? (widget.isArabic ? _title : _title.substring(0, 3)) : _title).toUpperCase(); + }, + margin: 12, + ), + rightTitles: widget.isArabic ? left : right, + leftTitles: widget.isArabic ? right : left), + borderData: FlBorderData( + show: true, + border: Border.symmetric( + horizontal: BorderSide(color: const Color(0xffEFEFEF), width: 1), + ), + ), + minX: 0, + maxX: widget.list.isEmpty ? 1 : widget.list.length - 1.0, + minY: widget.list.isEmpty ? -1 : 0, + maxY: widget.list.isEmpty ? 1 : 5, + lineBarsData: [ + LineChartBarData( + spots: [ + for (int i = 0; i < list.length; i++) FlSpot(i + 0.0, (list[i].value / 20) + 0.0), + ], + isCurved: true, + preventCurveOverShooting: true, + barWidth: 2, + isStrokeCapRound: true, + dotData: FlDotData( + show: false, + ), + ), + ], + ); + } +} diff --git a/lib/widgets/charts/sync_fu_chart.dart b/lib/widgets/charts/sync_fu_chart.dart new file mode 100644 index 00000000..3119cc36 --- /dev/null +++ b/lib/widgets/charts/sync_fu_chart.dart @@ -0,0 +1,52 @@ +// import 'package:flutter/material.dart'; +// import 'package:syncfusion_flutter_charts/charts.dart'; +// import 'package:syncfusion_flutter_charts/sparkcharts.dart'; +// +// class SyncFuChart extends StatelessWidget { +// List<_SalesData> data = [ +// _SalesData('Jan', 35), +// _SalesData('Feb', 28), +// _SalesData('Mar', 34), +// _SalesData('Apr', 32), +// _SalesData('May', 40), +// ]; +// +// @override +// Widget build(BuildContext context) { +// return Scaffold( +// body: Column( +// children: [ +// //Initialize the chart widget +// SfCartesianChart( +// +// primaryXAxis: CategoryAxis(), +// primaryYAxis: CategoryAxis(minimum: 28), +// // Chart title +// title: ChartTitle(text: 'Half yearly sales analysis'), +// // Enable legend +// legend: Legend(isVisible: true), +// // Enable tooltip +// tooltipBehavior: TooltipBehavior(enable: true), +// series: >[ +// LineSeries<_SalesData, String>( +// dataSource: data, +// xValueMapper: (_SalesData sales, _) => sales.year, +// yValueMapper: (_SalesData sales, _) => sales.sales, +// name: 'Sales', +// // Enable data label +// dataLabelSettings: DataLabelSettings(isVisible: true), +// ), +// ], +// ), +// ], +// ), +// ); +// } +// } +// +// class _SalesData { +// _SalesData(this.year, this.sales); +// +// final String year; +// final double sales; +// } diff --git a/lib/widgets/others/app_scaffold_widget.dart b/lib/widgets/others/app_scaffold_widget.dart index 5d4e3704..a0f95c1d 100644 --- a/lib/widgets/others/app_scaffold_widget.dart +++ b/lib/widgets/others/app_scaffold_widget.dart @@ -28,6 +28,7 @@ class AppScaffold extends StatelessWidget { final String appBarTitle; final Widget body; final Widget bottomSheet; + final Widget bottomNavigationBar; final bool isLoading; final bool isShowAppBar; final bool showNewAppBar; @@ -70,6 +71,7 @@ class AppScaffold extends StatelessWidget { this.showNewAppBarTitle = false, this.hasAppBarParam, this.bottomSheet, + this.bottomNavigationBar, this.baseViewModel, this.floatingActionButton, this.isPharmacy = false, @@ -118,7 +120,7 @@ class AppScaffold extends StatelessWidget { dropDownList: dropDownList ?? [], dropDownIndexChange: dropDownIndexChange, appBarIcons: appBarIcons, - onTap: onTap, + onTap: onTap, ) : (isShowAppBar ? appBar = AppBarWidget( @@ -151,6 +153,7 @@ class AppScaffold extends StatelessWidget { ) : buildBodyWidget(context), ), + bottomNavigationBar: bottomNavigationBar, floatingActionButton: floatingActionButton, ); } @@ -174,8 +177,7 @@ class NewAppBarWidget extends StatelessWidget with PreferredSizeWidget { final List appBarIcons; Function onTap; - NewAppBarWidget( - {Key key, this.showTitle = false, this.showDropDown = false, this.title = "", this.dropDownList, this.appBarIcons, this.dropdownIndexValue, this.dropDownIndexChange, this.onTap}) + NewAppBarWidget({Key key, this.showTitle = false, this.showDropDown = false, this.title = "", this.dropDownList, this.appBarIcons, this.dropdownIndexValue, this.dropDownIndexChange, this.onTap}) : super(key: key); @override diff --git a/pubspec.yaml b/pubspec.yaml index c5541181..90de021b 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -104,6 +104,7 @@ dependencies: # Calendar # table_calendar: ^2.3.0 syncfusion_flutter_calendar: ^18.4.49 +# syncfusion_flutter_charts: any # SVG Images flutter_svg: ^0.18.0 @@ -244,6 +245,7 @@ flutter: - assets/images/new/bottom_nav/ - assets/images/new/services/ - assets/images/new/appointment-rating/ + - assets/images/new/payment/ fonts: - family: WorkSans