diff --git a/assets/images/pharmacy/call.svg b/assets/images/pharmacy/call.svg new file mode 100644 index 00000000..677d4123 --- /dev/null +++ b/assets/images/pharmacy/call.svg @@ -0,0 +1,7 @@ + + + + + + + diff --git a/assets/images/pharmacy/instagram.png b/assets/images/pharmacy/instagram.png new file mode 100644 index 00000000..a03f47bd Binary files /dev/null and b/assets/images/pharmacy/instagram.png differ diff --git a/assets/images/pharmacy/location.svg b/assets/images/pharmacy/location.svg new file mode 100644 index 00000000..a52cc72e --- /dev/null +++ b/assets/images/pharmacy/location.svg @@ -0,0 +1,3 @@ + + + diff --git a/assets/images/pharmacy/whatsapp.svg b/assets/images/pharmacy/whatsapp.svg new file mode 100644 index 00000000..ee18370c --- /dev/null +++ b/assets/images/pharmacy/whatsapp.svg @@ -0,0 +1,3 @@ + + + diff --git a/ios/Runner/Info.plist b/ios/Runner/Info.plist index ec89ac71..e13174af 100644 --- a/ios/Runner/Info.plist +++ b/ios/Runner/Info.plist @@ -94,5 +94,13 @@ io.flutter.embedded_views_preview + LSApplicationQueriesSchemes + + comgooglemaps + baidumap + iosamap + + + diff --git a/lib/config/config.dart b/lib/config/config.dart index dafe7ab9..3ed8d764 100644 --- a/lib/config/config.dart +++ b/lib/config/config.dart @@ -15,7 +15,7 @@ const PACKAGES_CUSTOMER = '/api/customers'; const PACKAGES_SHOPPING_CART = '/api/shopping_cart_items'; const PACKAGES_ORDERS = '/api/orders'; const PACKAGES_TAMARA_OPT = '/api/orders/paymentoptions/tamara'; -const BASE_URL = 'https://uat.hmgwebservices.com/'; + const BASE_URL = 'https://uat.hmgwebservices.com/'; // const BASE_URL = 'https://hmgwebservices.com/'; // Pharmacy UAT URLs @@ -68,7 +68,9 @@ const GET_DOCTOR_RATING_DETAILS = const GET_DOCTOR_RATING = 'Services/Doctors.svc/REST/dr_GetAvgDoctorRating'; ///Prescriptions -const PRESCRIPTIONS = 'Services/Patients.svc/REST/GetPrescriptionApptList'; +// const PRESCRIPTIONS = 'Services/Patients.svc/REST/GetPrescriptionApptList'; +const PRESCRIPTIONS = 'Services/Patients.svc/REST/GetPrescriptionApptList_Async'; + const GET_PRESCRIPTIONS_ALL_ORDERS = 'Services/Patients.svc/REST/PatientER_GetPatientAllPresOrders'; const GET_PRESCRIPTION_REPORT = @@ -255,7 +257,7 @@ const GET_PATIENT_SHARE = //URL to get patient appointment history const GET_PATIENT_APPOINTMENT_HISTORY = - "Services/Doctors.svc/REST/PateintHasAppoimentHistory"; + "Services/Doctors.svc/REST/PateintHasAppoimentHistory_Async"; const DOCTOR_SCHEDULE_URL = 'Services/Doctors.svc/REST/GetDoctorWorkingHoursTable'; @@ -570,7 +572,10 @@ const TRANSFER_YAHALA_LOYALITY_POINTS = "Services/Patients.svc/REST/TransferYaHalaLoyaltyPoints"; const LAKUM_GET_USER_TERMS_AND_CONDITIONS = "Services/ERP.svc/REST/GetUserTermsAndConditionsForEPharmcy"; -const PRESCRIPTION = 'Services/Patients.svc/REST/GetPrescriptionApptList'; + +// const PRESCRIPTION = 'Services/Patients.svc/REST/GetPrescriptionApptList'; +const PRESCRIPTION = 'Services/Patients.svc/REST/GetPrescriptionApptList_Async'; + const GET_RECOMMENDED_PRODUCT = 'alsoProduct/'; const GET_MOST_VIEWED_PRODUCTS = "mostview"; const GET_NEW_PRODUCTS = "newproducts"; diff --git a/lib/config/localized_values.dart b/lib/config/localized_values.dart index babdd9c1..83fedc90 100644 --- a/lib/config/localized_values.dart +++ b/lib/config/localized_values.dart @@ -50,7 +50,8 @@ const Map localizedValues = { 'searchByDocText': {'en': 'Type the name of the doctor to help you find him', 'ar': 'اكتب اسم الطبيب لمساعدتك في العثور عليه'}, 'enterDocName': {'en': 'Enter Doctor name', 'ar': 'أدخل إسم الطبيب'}, 'search': {'en': 'Search', 'ar': 'بحث'}, - 'noResultFound': {'en': 'No Result Found', 'ar': 'لم يتم العثور على نتائج'}, + 'noResultFound': {'en': 'No Result Found', 'ar': 'لم يتم العثور على نتائج '}, + 'noSearchResultFound': {'en': 'No Result Found', 'ar': 'لم يتم العثور على نتائج الرجاء تغيير لغة البحث'}, 'pleaseEnterProductName': {'en': 'Please Enter Product Name', 'ar': 'ادخل اسم المنتج'}, 'bookNow': {'en': 'BOOK NOW', 'ar': 'احجز الآن'}, 'docInfo': {'en': 'Doctor Information', 'ar': 'معلومات الطبيب'}, @@ -277,6 +278,8 @@ const Map localizedValues = { "viewAll": {"en": "View All", 'ar': 'عرض الكل'}, "view": {"en": "View", 'ar': 'عرض'}, "ContactUs": {"en": "Contact Us", 'ar': 'الوصول إلينا'}, + "contactUsLocation": {"en": "P.O.Box: 91877 - Riyadh 11643, King Fahad Road - Olaya - Kingdom of Saudi Arabia", 'ar': 'صندوق بريد: 91877 - الرياض 11643 ، طريق الملك فهد - العليا - المملكة العربية السعودية'}, + "contactUsTime": {"en": "Saturday - Wednesday 8:00 AM - 10 PM, Thursday 8:00 AM- 8:00 PM, Friday 2:00 PM - 8:00 PM", 'ar': " السبت – الأربعاء 08:00 ص – 10:00 م , الخميس 08:00 ص – 08:00 م, الجمعة 02:00 م - 08:00 م"}, "ViewAllWaysReachUs": {"en": "View All Ways Reach Us", 'ar': 'جميع طرق الاتصال بنا'}, "medicalProfile": {"en": "Medical Profile", 'ar': 'الملف الطبي'}, "consultation": {"en": "Consultation", "ar": "استشارة"}, @@ -507,7 +510,11 @@ const Map localizedValues = { "reachUs": {"en": "Reach Us", "ar": "الوصول لنا"}, "ourLocations": {"en": "Our Locations", "ar": "مواقعنا"}, "edit": {"en": "Edit", "ar": "تعديل"}, + "whatsApp": {"en": "Whats App", "ar": " واتس اب"}, + "phone": {"en": "Phone", "ar": " موبايل"}, "delete": {"en": "Delete", "ar": " حذف"}, + "deleteAddress": {"en": "Are you sure want to delete", "ar": " هل انت متأكد تريد حذف هذا العنوان"}, + "deletedAddres": {"en": "Address has been deleted", "ar": " تم حذف العنوان"}, "addAddress": {"en": "ADD A NEW ADDRESS", "ar": " اضافة عنوان جديد"}, "addNewAddress": {"en": "Add New Address", "ar": " اضافة عنوان جديد"}, "order": {"en": "My Order", "ar": " طلباتي"}, @@ -802,7 +809,7 @@ const Map localizedValues = { "HealthTipsBasedOnCurrentWeather": {"en": "Health Tips Based On Current Weather", 'ar': ' نصائح صحية بناءاً على الطقس الحالي '}, "MoreDetails": {"en": "More details", "ar": " المزيد من التفاصيل "}, "SendCopy": {"en": "Send Copy", "ar": "ارسال نسخة"}, - "ResendOrder": {"en": "Refill Order & Delivery", "ar": "إعادة طلب و توصيل"}, + "ResendOrder": {"en": "Re-Order & Delivery", "ar": "إعادة طلب و توصيل"}, "Ports": {"en": "Ports", "ar": "المنافذ"}, "Way": {"en": "Way", "ar": "الطريقة"}, "Average": {"en": "Average", "ar": "متوسط"}, diff --git a/lib/core/model/labs/patient_lab_special_result.dart b/lib/core/model/labs/patient_lab_special_result.dart index 2fbcb832..8e24a04d 100644 --- a/lib/core/model/labs/patient_lab_special_result.dart +++ b/lib/core/model/labs/patient_lab_special_result.dart @@ -3,7 +3,7 @@ class PatientLabSpecialResult { String moduleID; String resultData; String resultDataHTML; - Null resultDataTxt; + dynamic resultDataTxt; PatientLabSpecialResult( {this.invoiceNo, diff --git a/lib/core/model/pharmacies/PointsAmountPerMonth.dart b/lib/core/model/pharmacies/PointsAmountPerMonth.dart index 71cf3498..c5b96bd8 100644 --- a/lib/core/model/pharmacies/PointsAmountPerMonth.dart +++ b/lib/core/model/pharmacies/PointsAmountPerMonth.dart @@ -1,11 +1,11 @@ import 'PointsAmountPerday.dart'; class PointsAmountPerMonth { - double amountPerMonth; - String month; + dynamic amountPerMonth; + dynamic month; int monthNumber; List pointsAmountPerday; - double pointsPerMonth; + dynamic pointsPerMonth; PointsAmountPerMonth( {this.amountPerMonth, diff --git a/lib/core/model/pharmacies/orders_model.dart b/lib/core/model/pharmacies/orders_model.dart index cef20c30..ad2c533a 100644 --- a/lib/core/model/pharmacies/orders_model.dart +++ b/lib/core/model/pharmacies/orders_model.dart @@ -31,6 +31,7 @@ class Orders { String orderStatusn; bool canCancel; bool canRefund; + String orderGuid; dynamic customerId; dynamic orderSubtotalExclTax; dynamic orderShippingExclTax; @@ -47,6 +48,7 @@ class Orders { this.orderStatusn, this.canCancel, this.canRefund, + this.orderGuid, this.customerId, this.orderShippingExclTax, this.orderSubtotalExclTax, @@ -63,6 +65,7 @@ class Orders { orderStatusn = json['order_statusn']; canCancel = json['can_cancel']; canRefund = json['can_refund']; + orderGuid = json['order_guid']; customerId = json['customer_id']; orderSubtotalExclTax= json["order_subtotal_excl_tax"]; orderShippingExclTax= json["order_shipping_excl_tax"]; diff --git a/lib/core/service/client/base_app_client.dart b/lib/core/service/client/base_app_client.dart index ced7eb9c..52def3eb 100644 --- a/lib/core/service/client/base_app_client.dart +++ b/lib/core/service/client/base_app_client.dart @@ -490,6 +490,7 @@ class BaseAppClient { }) async { String url = fullUrl; print("URL Query String: $url"); + print("body: $body"); if (await Utils.checkConnection()) { headers.addAll({'Content-Type': 'application/json', 'Accept': 'application/json'}); @@ -502,6 +503,8 @@ class BaseAppClient { print("statusCode :$statusCode"); if (await handleUnauthorized(statusCode, forUrl: fullUrl)) simplePost(fullUrl, onFailure: onFailure, onSuccess: onSuccess, body: body, headers: headers); + print(response.body.toString()); + if (statusCode < 200 || statusCode >= 400 || json == null) { onFailure('Error While Fetching data', statusCode); } else { diff --git a/lib/core/service/parmacyModule/order-preview-service.dart b/lib/core/service/parmacyModule/order-preview-service.dart index 52892641..b9368180 100644 --- a/lib/core/service/parmacyModule/order-preview-service.dart +++ b/lib/core/service/parmacyModule/order-preview-service.dart @@ -201,7 +201,7 @@ class OrderPreviewService extends BaseService { orderBody['custom_values_xml'] = "PaymentOption:${getPaymentOptionName(paymentCheckoutData.paymentOption)}"; orderBody['shippingOption'] = paymentCheckoutData.shippingOption; orderBody['shipping_address'] = paymentCheckoutData.address; - orderBody['lakum_amount'] = paymentCheckoutData.usedLakumPoints; + // orderBody['lakum_amount'] = paymentCheckoutData.usedLakumPoints; List> itemsList = List(); shoppingCarts.forEach((item) { diff --git a/lib/core/service/pharmacy_categorise_service.dart b/lib/core/service/pharmacy_categorise_service.dart index 280022e0..ef8650c8 100644 --- a/lib/core/service/pharmacy_categorise_service.dart +++ b/lib/core/service/pharmacy_categorise_service.dart @@ -91,8 +91,11 @@ class PharmacyCategoriseService extends BaseService { Future searchProducts({String productName}) async { hasError = false; _searchList.clear(); + // the language ID in pharmacy is different not same in patient app, en == 1 , ar == 2 + var languageID = await sharedPref.getStringWithDefaultValue(APP_LANGUAGE, 'ar'); + var languageId = languageID == 'ar' ? 2 : 1; String endPoint = productName != null - ? GET_SEARCH_PRODUCTS + "$productName" + '&language_id=1' + ? GET_SEARCH_PRODUCTS + "$productName" + '&language_id=' + "$languageId" : GET_SEARCH_PRODUCTS + ""; await baseAppClient.getPharmacy( endPoint, diff --git a/lib/core/viewModels/pharmacyModule/PharmacyAddressesViewModel.dart b/lib/core/viewModels/pharmacyModule/PharmacyAddressesViewModel.dart index 72342b56..dae79ac1 100644 --- a/lib/core/viewModels/pharmacyModule/PharmacyAddressesViewModel.dart +++ b/lib/core/viewModels/pharmacyModule/PharmacyAddressesViewModel.dart @@ -99,9 +99,9 @@ class PharmacyAddressesViewModel extends BaseViewModel { } - Future deleteAddresses(AddressInfo sendingAddress) async { + Future deleteAddresses(AddressInfo address) async { setState(ViewState.Busy); - await _pharmacyAddressService.deleteCustomerAddress(sendingAddress); + await _pharmacyAddressService.deleteCustomerAddress(address); if (_pharmacyAddressService.hasError) { error = _pharmacyAddressService.error; setState(ViewState.Error); diff --git a/lib/core/viewModels/pharmacyModule/order_model_view_model.dart b/lib/core/viewModels/pharmacyModule/order_model_view_model.dart index 7d6979cc..0ea53363 100644 --- a/lib/core/viewModels/pharmacyModule/order_model_view_model.dart +++ b/lib/core/viewModels/pharmacyModule/order_model_view_model.dart @@ -49,9 +49,9 @@ class OrderModelViewModel extends BaseViewModel { } } - Future getOrderDetails(OrderId) async { + Future getOrderDetails(OrderId, orderGUID) async { setState(ViewState.Busy); - await _orderDetailsService.getOrderDetails(OrderId); + await _orderDetailsService.getOrderDetails(OrderId, orderGUID); if (_orderDetailsService.hasError) { error = _orderDetailsService.error; setState(ViewState.Error); diff --git a/lib/models/Appointments/DoctorListResponse.dart b/lib/models/Appointments/DoctorListResponse.dart index 0da1a273..d43dceb3 100644 --- a/lib/models/Appointments/DoctorListResponse.dart +++ b/lib/models/Appointments/DoctorListResponse.dart @@ -9,6 +9,7 @@ class DoctorList { int actualDoctorRate; int clinicRoomNo; dynamic date; + dynamic appointmentDate; dynamic dayName; int doctorID; String doctorImageURL; @@ -53,6 +54,7 @@ class DoctorList { this.actualDoctorRate, this.clinicRoomNo, this.date, + this.appointmentDate, this.dayName, this.doctorID, this.doctorImageURL, @@ -97,6 +99,7 @@ class DoctorList { actualDoctorRate = json['ActualDoctorRate']; clinicRoomNo = json['ClinicRoomNo']; date = json['Date']; + appointmentDate = json['AppointmentDate']; dayName = json['DayName']; doctorID = json['DoctorID']; doctorImageURL = json['DoctorImageURL']; diff --git a/lib/pages/BookAppointment/BookConfirm.dart b/lib/pages/BookAppointment/BookConfirm.dart index a78bde69..63e711e5 100644 --- a/lib/pages/BookAppointment/BookConfirm.dart +++ b/lib/pages/BookAppointment/BookConfirm.dart @@ -90,7 +90,6 @@ class _BookConfirmState extends State { null, widget.doctor.noOfPatientsRate, "", - ), isNeedToShowButton: false, ), @@ -201,10 +200,10 @@ class _BookConfirmState extends State { disabledTextColor: Colors.white, disabledColor: new Color(0xFFbcc2c4), onPressed: () async { - if (!(await this.sharedPref.getBool(IS_LIVECARE_APPOINTMENT)??false)) { - insertAppointment(context, widget.doctor); - } else { + if (await this.sharedPref.getBool(IS_LIVECARE_APPOINTMENT) != null && !await this.sharedPref.getBool(IS_LIVECARE_APPOINTMENT)) { insertLiveCareScheduledAppointment(context, widget.doctor); + } else { + insertAppointment(context, widget.doctor); } }, child: Text(TranslationBase.of(context).bookAppo, style: TextStyle(fontSize: 16.0, letterSpacing: -0.48)), @@ -250,7 +249,7 @@ class _BookConfirmState extends State { GifLoaderDialogUtils.hideDialog(context); if (res['MessageStatus'] == 1) { Future.delayed(new Duration(milliseconds: 1500), () async { - if (!await this.sharedPref.getBool(IS_LIVECARE_APPOINTMENT)) { + if (await this.sharedPref.getBool(IS_LIVECARE_APPOINTMENT) != null && !await this.sharedPref.getBool(IS_LIVECARE_APPOINTMENT)) { insertAppointment(context, widget.doctor); } else { insertLiveCareScheduledAppointment(context, widget.doctor); @@ -377,7 +376,6 @@ class _BookConfirmState extends State { getLiveCareAppointmentPatientShare(context, String appointmentNo, int clinicID, int projectID, DoctorList docObject) { widget.service.getLiveCareAppointmentPatientShare(appointmentNo, clinicID, projectID, context).then((res) { - print(res); widget.patientShareResponse = new PatientShareResponse.fromJson(res); GifLoaderDialogUtils.hideDialog(context); navigateToBookSuccess(context, docObject, widget.patientShareResponse); diff --git a/lib/pages/BookAppointment/components/LiveCareBookAppointment.dart b/lib/pages/BookAppointment/components/LiveCareBookAppointment.dart index ee3e7b4a..7901d7b6 100644 --- a/lib/pages/BookAppointment/components/LiveCareBookAppointment.dart +++ b/lib/pages/BookAppointment/components/LiveCareBookAppointment.dart @@ -24,6 +24,8 @@ class _LiveCareBookAppointmentState extends State { @override Widget build(BuildContext context) { return AppScaffold( + showNewAppBarTitle: true, + showNewAppBar: true, appBarTitle: TranslationBase.of(context).bookAppo, isShowAppBar: true, isShowDecPage: false, diff --git a/lib/pages/BookAppointment/widgets/DoctorView.dart b/lib/pages/BookAppointment/widgets/DoctorView.dart index 1e2e48df..7ebc26ca 100644 --- a/lib/pages/BookAppointment/widgets/DoctorView.dart +++ b/lib/pages/BookAppointment/widgets/DoctorView.dart @@ -7,7 +7,6 @@ import 'package:diplomaticquarterapp/uitl/date_uitl.dart'; import 'package:diplomaticquarterapp/uitl/gif_loader_dialog_utils.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:diplomaticquarterapp/widgets/avatar/large_avatar.dart'; -import 'package:diplomaticquarterapp/widgets/data_display/medical/doctor_card.dart'; import 'package:diplomaticquarterapp/widgets/my_rich_text.dart'; import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart'; import 'package:flutter/material.dart'; @@ -54,9 +53,19 @@ class DoctorView extends StatelessWidget { mainAxisSize: MainAxisSize.min, crossAxisAlignment: CrossAxisAlignment.start, children: [ - Text( - doctor.name, - style: TextStyle(fontSize: 16, fontWeight: FontWeight.w600, color: Color(0xff2E303A), letterSpacing: -0.64, height: 25 / 16), + Row( + children: [ + Expanded( + child: Text( + doctor.name, + style: TextStyle(fontSize: 16, fontWeight: FontWeight.w600, color: Color(0xff2E303A), letterSpacing: -0.64, height: 25 / 16), + ), + ), + Text( + DateUtil.getDayMonthYearDateFormatted(DateUtil.convertStringToDate(doctor.date)), + style: TextStyle(fontSize: 14, fontWeight: FontWeight.w600, color: Color(0xff2B353E), letterSpacing: -0.48, height: 18 / 12), + ), + ], ), if (doctor.doctorTitle != null) SizedBox(height: 6), Row( diff --git a/lib/pages/MyAppointments/widgets/AppointmentActions.dart b/lib/pages/MyAppointments/widgets/AppointmentActions.dart index acfe444f..fcf1b6f0 100644 --- a/lib/pages/MyAppointments/widgets/AppointmentActions.dart +++ b/lib/pages/MyAppointments/widgets/AppointmentActions.dart @@ -5,6 +5,7 @@ import 'package:diplomaticquarterapp/core/viewModels/feedback/feedback_view_mode import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; import 'package:diplomaticquarterapp/models/Appointments/AppoimentAllHistoryResultList.dart'; import 'package:diplomaticquarterapp/models/Appointments/appoDetailsButtons.dart'; +import 'package:diplomaticquarterapp/models/Appointments/toDoCountProviderModel.dart'; import 'package:diplomaticquarterapp/pages/BookAppointment/widgets/reminder_dialog.dart'; import 'package:diplomaticquarterapp/pages/MyAppointments/models/AppointmentType.dart'; import 'package:diplomaticquarterapp/pages/MyAppointments/models/ArrivedButtons.dart'; @@ -14,6 +15,7 @@ import 'package:diplomaticquarterapp/pages/MyAppointments/models/BookedButtonsAl import 'package:diplomaticquarterapp/pages/MyAppointments/models/ConfirmedButtons.dart'; import 'package:diplomaticquarterapp/pages/MyAppointments/models/ConfirmedButtonsAllowCheckIn.dart'; import 'package:diplomaticquarterapp/pages/MyAppointments/widgets/askDocDialog.dart'; +import 'package:diplomaticquarterapp/pages/ToDoList/ToDo.dart'; import 'package:diplomaticquarterapp/pages/feedback/feedback_home_page.dart'; import 'package:diplomaticquarterapp/pages/insurance/insurance_approval_screen.dart'; import 'package:diplomaticquarterapp/pages/medical/labs/laboratory_result_page.dart'; @@ -57,6 +59,7 @@ class _AppointmentActionsState extends State { @override Widget build(BuildContext context) { ProjectViewModel projectViewModel = Provider.of(context); + ToDoCountProviderModel model = Provider.of(context); var size = MediaQuery.of(context).size; final double itemHeight = projectViewModel.isArabic ? ((size.height - kToolbarHeight - 24) * 0.5) / 2 : ((size.height - kToolbarHeight - 24) * 0.45) / 2; final double itemWidth = size.width / 2; @@ -72,7 +75,7 @@ class _AppointmentActionsState extends State { onTap: shouldEnable ? null : () { - _handleButtonClicks(appoButtonsList[index]); + _handleButtonClicks(appoButtonsList[index], model); }, child: MedicalProfileItem( title: appoButtonsList[index].title, @@ -88,7 +91,7 @@ class _AppointmentActionsState extends State { ); } - _handleButtonClicks(AppoDetailsButton) { + _handleButtonClicks(AppoDetailsButton, ToDoCountProviderModel model) { switch (AppoDetailsButton.caller) { case "openReschedule": widget.tabController.animateTo((widget.tabController.index + 1) % 2); @@ -113,7 +116,8 @@ class _AppointmentActionsState extends State { ); break; case "goToTodoList": - Navigator.of(context).pop(); + // Navigator.of(context).pop(); + navigateToToDoPage(context, model); break; case "askDoc": askYourDoc(); @@ -556,6 +560,18 @@ class _AppointmentActionsState extends State { ))); } + navigateToToDoPage(BuildContext context, ToDoCountProviderModel model) { + if (widget.projectViewModel.isLogin) { + if (model.count != 0) { + Navigator.push(context, FadePage(page: ToDo(isShowAppBar: true))); + } else { + AppToast.showErrorToast(message: TranslationBase.of(context).upcomingEmpty); + } + } else { + Navigator.push(context, FadePage(page: ToDo(isShowAppBar: true))); + } + } + rateAppointment() { widget.browser = new MyInAppBrowser(); var url = 'http://hmg.com/SitePages/pso.aspx?p=' + widget.appo.projectID.toString() + '.' + widget.appo.appointmentNo.toString() + '&c=1'; diff --git a/lib/pages/feedback/send_feedback_page.dart b/lib/pages/feedback/send_feedback_page.dart index 8c2d3006..6e879612 100644 --- a/lib/pages/feedback/send_feedback_page.dart +++ b/lib/pages/feedback/send_feedback_page.dart @@ -94,6 +94,13 @@ class _SendFeedbackPageState extends State { this.appointHistory = widget.appointment; }); requestPermissions(); + event.controller.stream.listen((p) { + if (p['isIOSFeedback'] == 'true') { + if (this.mounted) { + this.titleController.value = p['data']; + } + } + }); super.initState(); } @@ -538,9 +545,10 @@ class _SendFeedbackPageState extends State { if (result.finalResult == true) { setState(() { + messageController.text += reconizedWord + '\n'; RoboSearch.closeAlertDialog(context); speech.stop(); - messageController.text = reconizedWord + '\n'; + }); } } diff --git a/lib/pages/final_products_page.dart b/lib/pages/final_products_page.dart index 253d7c08..41fa74f0 100644 --- a/lib/pages/final_products_page.dart +++ b/lib/pages/final_products_page.dart @@ -216,20 +216,37 @@ class _FinalProductsPageState extends State { Container( margin: EdgeInsets.fromLTRB(0, 16, 0, 0), alignment: Alignment.center, - child: Image.network( - model.finalProducts[index].images.isNotEmpty - ? model.finalProducts[index].images[0].thumb - : 'https://upload.wikimedia.org/wikipedia/commons/thumb/6/6c/No_image_3x4.svg/1200px-No_image_3x4.svg.png', - fit: BoxFit.cover, - height: 80, - ), + child: (model.finalProducts[index].images != null && + model.finalProducts[index].images.length > 0) + ? Image.network( + model.finalProducts[index].images[0].src, + fit: BoxFit.cover, + height: 80, + width: 80, + + ) + : Image.asset( + "assets/images/no_image.png", + fit: BoxFit.cover, + height: 80, + width: 80, + ), +// Image.network( +// model.finalProducts[index].images.isNotEmpty +// ? model.finalProducts[index].images[0].thumb +// : 'https://upload.wikimedia.org/wikipedia/commons/thumb/6/6c/No_image_3x4.svg/1200px-No_image_3x4.svg.png', +// fit: BoxFit.cover, +// height: 80, +// ), ), Container( - width: model.finalProducts[index].rxMessage != null ? MediaQuery.of(context).size.width / 2.8 : 0, + width: model.finalProducts[index].rxMessage != null ? double.infinity : 0, + //MediaQuery.of(context).size.width / 2.8 : 0, padding: EdgeInsets.all(4), decoration: BoxDecoration( color: Color(0xffb23838), - borderRadius: BorderRadius.only(topLeft: Radius.circular(6)), + // borderRadius: BorderRadius.only(topLeft: Radius.circular(6) + // ), ), child: model.finalProducts[index].rxMessage != null ? Texts( @@ -374,33 +391,48 @@ class _FinalProductsPageState extends State { ), ), Container( - margin: EdgeInsets.fromLTRB(0, 0, 0, 0), + margin: EdgeInsets.fromLTRB(0, 0, 0, 8), alignment: Alignment.center, - child: Image.network( - model.finalProducts[index].images.isNotEmpty - ? model.finalProducts[index].images[0].thumb - : 'https://upload.wikimedia.org/wikipedia/commons/thumb/6/6c/No_image_3x4.svg/1200px-No_image_3x4.svg.png', - fit: BoxFit.contain, + child:(model.finalProducts[index].images != null && + model.finalProducts[index].images.length > 0) + ? Image.network( + model.finalProducts[index].images[0].src, + fit: BoxFit.cover, height: 80, + width: 80, + + ) + : Image.asset( + "assets/images/no_image.png", + fit: BoxFit.cover, + height: 80, + width: 80, ), +// Image.network( +// model.finalProducts[index].images.isNotEmpty +// ? model.finalProducts[index].images[0].thumb +// : 'https://upload.wikimedia.org/wikipedia/commons/thumb/6/6c/No_image_3x4.svg/1200px-No_image_3x4.svg.png', +// fit: BoxFit.contain, +// height: 80, +// ), ), ], ), Column( children: [ Container( - width: model.finalProducts[index].rxMessage != null ? MediaQuery.of(context).size.width / 5.3 : 0, + width: model.finalProducts[index].rxMessage != null ? MediaQuery.of(context).size.width / 4.3 : 0, padding: EdgeInsets.all(4), decoration: BoxDecoration( color: Color(0xffb23838), - borderRadius: BorderRadius.only(topLeft: Radius.circular(6)), + //borderRadius: BorderRadius.only(topLeft: Radius.circular(5)), ), child:model.finalProducts[index].rxMessage != null ? Texts( projectProvider.isArabic ? model.finalProducts[index].rxMessagen : model.finalProducts[index].rxMessage, color: Colors.white, regular: true, - fontSize: 10, + fontSize: 8, fontWeight: FontWeight.w600, ) : Texts(""), diff --git a/lib/pages/insurance/insurance_approval_detail_screen.dart b/lib/pages/insurance/insurance_approval_detail_screen.dart index fa6d0f5a..c5f84602 100644 --- a/lib/pages/insurance/insurance_approval_detail_screen.dart +++ b/lib/pages/insurance/insurance_approval_detail_screen.dart @@ -77,9 +77,9 @@ class InsuranceApprovalDetail extends StatelessWidget { MyRichText(TranslationBase.of(context).unusedCount, insuranceApprovalModel?.unUsedCount.toString() ?? "", projectViewModel.isArabic), MyRichText(TranslationBase.of(context).companyName, insuranceApprovalModel?.companyName ?? "", projectViewModel.isArabic), SizedBox(height: 6), - MyRichText(TranslationBase.of(context).receiptOn, DateUtil.getDayMonthYearDateFormatted(DateUtil.convertStringToDateTime(insuranceApprovalModel.receiptOn)) ?? "", + MyRichText(TranslationBase.of(context).receiptOn, DateUtil.getDayMonthYearDateFormatted(DateUtil.convertStringToDate(insuranceApprovalModel.receiptOn)) ?? "", projectViewModel.isArabic), - MyRichText(TranslationBase.of(context).expiryOn, DateUtil.getDayMonthYearDateFormatted(DateUtil.convertStringToDateTime(insuranceApprovalModel.expiryDate)) ?? "", + MyRichText(TranslationBase.of(context).expiryOn, DateUtil.getDayMonthYearDateFormatted(DateUtil.convertStringToDate(insuranceApprovalModel.expiryDate)) ?? "", projectViewModel.isArabic), ], ), diff --git a/lib/pages/insurance/insurance_approval_screen.dart b/lib/pages/insurance/insurance_approval_screen.dart index 52ce35c8..bd665046 100644 --- a/lib/pages/insurance/insurance_approval_screen.dart +++ b/lib/pages/insurance/insurance_approval_screen.dart @@ -140,7 +140,7 @@ class _InsuranceApprovalState extends State { crossAxisAlignment: CrossAxisAlignment.start, mainAxisAlignment: MainAxisAlignment.center, children: [ - MyRichText(TranslationBase.of(context).clinic + ":", model.insuranceApproval[index]?.clinicName.toLowerCase().capitalizeFirstofEach ?? "", + MyRichText(TranslationBase.of(context).clinic + ":", model.insuranceApproval[index]?.clinicName != null ? model.insuranceApproval[index]?.clinicName.toLowerCase().capitalizeFirstofEach : "", projectViewModel.isArabic), MyRichText(TranslationBase.of(context).approvalNo, model.insuranceApproval[index]?.approvalNo.toString() ?? "", projectViewModel.isArabic), ], diff --git a/lib/pages/landing/landing_page_pharmcy.dart b/lib/pages/landing/landing_page_pharmcy.dart index d84fc445..42ec25a6 100644 --- a/lib/pages/landing/landing_page_pharmcy.dart +++ b/lib/pages/landing/landing_page_pharmcy.dart @@ -90,7 +90,9 @@ class _LandingPagePharmacyState extends State { try { String barcode = result?.rawContent; GifLoaderDialogUtils.showMyDialog(context); - await BaseAppClient().getPharmacy("$GET_PHARMACY_PRODUCTs_BY_SKU$barcode", onSuccess: (dynamic response, int statusCode) { + await BaseAppClient() + .getPharmacy("$GET_PHARMACY_PRODUCTs_BY_SKU$barcode", + onSuccess: (dynamic response, int statusCode) { print(response); var product = PharmacyProduct.fromJson(response["products"][0]); GifLoaderDialogUtils.hideDialog(context); @@ -100,7 +102,8 @@ class _LandingPagePharmacyState extends State { AppToast.showErrorToast(message: "Product not found"); }); } catch (apiEx) { - AppToast.showErrorToast(message: "Something went wrong, please try again"); + AppToast.showErrorToast( + message: "Something went wrong, please try again"); } } catch (barcodeEx) {} } diff --git a/lib/pages/login/register.dart b/lib/pages/login/register.dart index 11ed7c79..ea8ef803 100644 --- a/lib/pages/login/register.dart +++ b/lib/pages/login/register.dart @@ -389,7 +389,9 @@ class _Register extends State { Navigator.of(context).push(FadePage(page: ConfirmLogin(changePageViewIndex: widget.changePageViewIndex))), } else - {AppToast.showErrorToast(message: result ? result : TranslationBase.of(context).somethingWentWrong)} + { + AppToast.showErrorToast(message: result != null ? result : TranslationBase.of(context).somethingWentWrong), + } }); } } diff --git a/lib/pages/medical/doctor/doctor_home_page.dart b/lib/pages/medical/doctor/doctor_home_page.dart index 28e1c1a9..ebf32924 100644 --- a/lib/pages/medical/doctor/doctor_home_page.dart +++ b/lib/pages/medical/doctor/doctor_home_page.dart @@ -72,6 +72,7 @@ class DoctorHomePage extends StatelessWidget { clinicName: _doctorList.clinicName, actualDoctorRate: _doctorList.actualDoctorRate, doctorID: _doctorList.doctorID, + date: _doctorList.appointmentDate, doctorRate: _doctorList.doctorRate, gender: _doctorList.gender, doctorTitle: _doctorList.doctorTitle, diff --git a/lib/pages/medical/prescriptions/prescriptions_home_page.dart b/lib/pages/medical/prescriptions/prescriptions_home_page.dart index d5efa38b..4cb1e890 100644 --- a/lib/pages/medical/prescriptions/prescriptions_home_page.dart +++ b/lib/pages/medical/prescriptions/prescriptions_home_page.dart @@ -65,12 +65,12 @@ class _HomePrescriptionsPageState extends State with Sing unselectedLabelColor: Color(0xff575757), labelPadding: EdgeInsets.only(top: 15, bottom: 13, left: 20, right: 20), labelStyle: TextStyle( - fontSize: 16, + fontSize: 15, fontWeight: FontWeight.w600, letterSpacing: -0.48, ), unselectedLabelStyle: TextStyle( - fontSize: 16, + fontSize: 15, fontWeight: FontWeight.w600, letterSpacing: -0.48, ), diff --git a/lib/pages/medical/smart_watch_health_data/distance/distanceTracker.dart b/lib/pages/medical/smart_watch_health_data/distance/distanceTracker.dart index cceb8b1e..02e69481 100644 --- a/lib/pages/medical/smart_watch_health_data/distance/distanceTracker.dart +++ b/lib/pages/medical/smart_watch_health_data/distance/distanceTracker.dart @@ -137,8 +137,10 @@ class _DistanceTrackerState extends State with SingleTickerProv }); generateWeekData(); setState(() { - weeklyStatsAvgValue = avgWeeklyStepsValue ~/ weeklyDataLength; - weeklyStatsAvgValue = weeklyStatsAvgValue / 1000; + if (avgWeeklyStepsValue != 0) { + weeklyStatsAvgValue = avgWeeklyStepsValue ~/ weeklyDataLength; + weeklyStatsAvgValue = weeklyStatsAvgValue / 1000; + } isWeeklyDataLoaded = true; }); }).catchError((err) { @@ -165,8 +167,10 @@ class _DistanceTrackerState extends State with SingleTickerProv }); generateMonthData(); setState(() { - monthlyStatsAvgValue = avgMonthlyStepsValue ~/ monthlyDataLength; - monthlyStatsAvgValue = monthlyStatsAvgValue / 1000; + if (avgMonthlyStepsValue != 0) { + monthlyStatsAvgValue = avgMonthlyStepsValue ~/ monthlyDataLength; + monthlyStatsAvgValue = monthlyStatsAvgValue / 1000; + } isMonthlyDataLoaded = true; }); }).catchError((err) { @@ -193,8 +197,10 @@ class _DistanceTrackerState extends State with SingleTickerProv }); generateYearData(); setState(() { - yearlyStatsAvgValue = avgYearlyStepsValue ~/ yearlyDataLength; - yearlyStatsAvgValue = yearlyStatsAvgValue / 1000; + if (avgYearlyStepsValue != 0) { + yearlyStatsAvgValue = avgYearlyStepsValue ~/ yearlyDataLength; + yearlyStatsAvgValue = yearlyStatsAvgValue / 1000; + } isYearlyDataLoaded = true; }); }).catchError((err) { @@ -457,16 +463,16 @@ class _DistanceTrackerState extends State with SingleTickerProv children: [ yearlyStepsList.isEmpty ? Container( - child: Center( - child: Text(TranslationBase.of(context).noDataAvailable), - ), - ) + child: Center( + child: Text(TranslationBase.of(context).noDataAvailable), + ), + ) : Table( - columnWidths: { - 0: FlexColumnWidth(2.5), - }, - children: fullData(context), - ), + columnWidths: { + 0: FlexColumnWidth(2.5), + }, + children: fullData(context), + ), ], ), ) @@ -549,7 +555,7 @@ class _DistanceTrackerState extends State with SingleTickerProv ), ); yearlyStepsList.forEach( - (step) { + (step) { tableRow.add( TableRow( children: [ @@ -559,7 +565,8 @@ class _DistanceTrackerState extends State with SingleTickerProv )} ', isCapitable: false, mProjectViewModel: projectViewModel), - Utils.tableColumnValue(step.valueSum != null ? (step.valueSum / 1000).toString() + " " + TranslationBase.of(context).km_ : "0.0 " + TranslationBase.of(context).km_ , isCapitable: false, mProjectViewModel: projectViewModel), + Utils.tableColumnValue(step.valueSum != null ? (step.valueSum / 1000).toString() + " " + TranslationBase.of(context).km_ : "0.0 " + TranslationBase.of(context).km_, + isCapitable: false, mProjectViewModel: projectViewModel), ], ), ); @@ -567,5 +574,4 @@ class _DistanceTrackerState extends State with SingleTickerProv ); return tableRow; } - } diff --git a/lib/pages/medical/smart_watch_health_data/heartrate/heartrateTracker.dart b/lib/pages/medical/smart_watch_health_data/heartrate/heartrateTracker.dart index 077ed4bf..5d4b8e4a 100644 --- a/lib/pages/medical/smart_watch_health_data/heartrate/heartrateTracker.dart +++ b/lib/pages/medical/smart_watch_health_data/heartrate/heartrateTracker.dart @@ -171,7 +171,9 @@ class _HeartRateTrackerState extends State with SingleTickerPr }); generateMonthData(); setState(() { - monthlyStatsAvgValue = avgMonthlyHearRateValue ~/ monthlyDataLength; + if (avgMonthlyHearRateValue != 0) { + monthlyStatsAvgValue = avgMonthlyHearRateValue ~/ monthlyDataLength; + } isMonthlyDataLoaded = true; }); }).catchError((err) { @@ -198,7 +200,9 @@ class _HeartRateTrackerState extends State with SingleTickerPr }); generateYearData(); setState(() { - yearlyStatsAvgValue = avgYearlyHearRateValue ~/ yearlyDataLength; + if (avgYearlyHearRateValue != 0) { + yearlyStatsAvgValue = avgYearlyHearRateValue ~/ yearlyDataLength; + } isYearlyDataLoaded = true; }); }).catchError((err) { diff --git a/lib/pages/medical/smart_watch_health_data/steps/stepsTracker.dart b/lib/pages/medical/smart_watch_health_data/steps/stepsTracker.dart index 5f63c2ad..3832d799 100644 --- a/lib/pages/medical/smart_watch_health_data/steps/stepsTracker.dart +++ b/lib/pages/medical/smart_watch_health_data/steps/stepsTracker.dart @@ -136,7 +136,9 @@ class _StepsTrackerState extends State with SingleTickerProviderSt }); generateWeekData(); setState(() { - weeklyStatsAvgValue = avgWeeklyStepsValue ~/ weeklyDataLength; + if (avgWeeklyStepsValue != 0) { + weeklyStatsAvgValue = avgWeeklyStepsValue ~/ weeklyDataLength; + } isWeeklyDataLoaded = true; }); }).catchError((err) { @@ -163,7 +165,9 @@ class _StepsTrackerState extends State with SingleTickerProviderSt }); generateMonthData(); setState(() { - monthlyStatsAvgValue = avgMonthlyStepsValue ~/ monthlyDataLength; + if (avgMonthlyStepsValue != 0) { + monthlyStatsAvgValue = avgMonthlyStepsValue ~/ monthlyDataLength; + } isMonthlyDataLoaded = true; }); }).catchError((err) { @@ -190,7 +194,9 @@ class _StepsTrackerState extends State with SingleTickerProviderSt }); generateYearData(); setState(() { - yearlyStatsAvgValue = avgYearlyStepsValue ~/ yearlyDataLength; + if (avgYearlyStepsValue != 0) { + yearlyStatsAvgValue = avgYearlyStepsValue ~/ yearlyDataLength; + } isYearlyDataLoaded = true; }); }).catchError((err) { diff --git a/lib/pages/medical/smart_watch_health_data/syncHealthData.dart b/lib/pages/medical/smart_watch_health_data/syncHealthData.dart index 19d74f20..4fcb08e1 100644 --- a/lib/pages/medical/smart_watch_health_data/syncHealthData.dart +++ b/lib/pages/medical/smart_watch_health_data/syncHealthData.dart @@ -1,3 +1,5 @@ +import 'dart:io'; + import 'package:collection/collection.dart'; import 'package:diplomaticquarterapp/models/SmartWatch/HealthData.dart'; import 'package:diplomaticquarterapp/services/smartwatch_integration/SmartWatchIntegrationService.dart'; @@ -6,9 +8,8 @@ import 'package:diplomaticquarterapp/uitl/date_uitl.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'; -import 'package:fit_kit/fit_kit.dart'; import 'package:flutter/material.dart'; -import 'package:intl/intl.dart'; +import 'package:health/health.dart'; class syncHealthDataButton extends StatefulWidget { syncHealthDataButton(); @@ -18,7 +19,7 @@ class syncHealthDataButton extends StatefulWidget { } class _syncHealthDataButtonState extends State { - List dataTypes = List(); + List _healthDataList = []; List Med_InsertTransactionsInputsList = new List(); List Med_InsertTransactionsInputsList2 = new List(); @@ -33,12 +34,6 @@ class _syncHealthDataButtonState extends State { @override void initState() { - dataTypes.add(DataType.DISTANCE); - dataTypes.add(DataType.STEP_COUNT); - dataTypes.add(DataType.HEART_RATE); - // dataTypes.add(DataType.SLEEP); - // dataTypes.add(DataType.ENERGY); - super.initState(); } @@ -54,98 +49,43 @@ class _syncHealthDataButtonState extends State { GifLoaderDialogUtils.showMyDialog(context); Med_InsertTransactionsInputsList.clear(); - var date; - var differenceInHours; - String strDifferenceInHours; - var differenceInMinutes; - String strDifferenceInMinutes; - var today = DateTime.now(); - var yearNum = DateFormat('y').format(today).toString(); - - var firstDayOfTheYear = DateTime.parse(yearNum + "-" + "01" + "-" + "01"); - - if (await FitKit.requestPermissions(dataTypes)) { - for (DataType type in dataTypes) { - final results = await FitKit.read( - type, - dateFrom: firstDayOfTheYear, - dateTo: DateTime.now(), - limit: 1000, - ); - - if (type == DataType.DISTANCE) { - MedCategoryID = 7; - } else if (type == DataType.STEP_COUNT) { - MedCategoryID = 6; - } else if (type == DataType.HEART_RATE) { - MedCategoryID = 3; - } + DateTime startDate = DateTime.now().subtract(new Duration(days: 30)); - results.forEach((result) { - // print("in forEach"); - date = result.dateTo; - if (result.value.runtimeType.toString() == "int") { - value = double.parse(result.value.toString()); - } else { - value = result.value; - } - - MedSubCategoryID = 0; - - if (MedCategoryID == 4) { - differenceInHours = null; - var sleepDate = result.dateFrom.toString().substring(0, 10); - - DateTime dateFrom = result.dateFrom; - DateTime dateTo = result.dateTo; - - differenceInMinutes = dateTo.difference(dateFrom).inMinutes; - differenceInMinutes > 59 ? differenceInHours = differenceInMinutes / 60 : differenceInMinutes = differenceInMinutes; - - if (differenceInHours != null && differenceInHours != 0) { - differenceInHours = differenceInHours.toInt(); - differenceInMinutes = differenceInMinutes % 60; - - differenceInHours < 10 ? strDifferenceInHours = "0" + differenceInHours.toString() : strDifferenceInHours = differenceInHours.toString(); - } else { - strDifferenceInHours = "00"; - differenceInHours = 00; - } - differenceInMinutes < 10 ? strDifferenceInMinutes = "0" + differenceInMinutes.toString() : strDifferenceInMinutes = differenceInMinutes.toString(); - - sleepDate = DateTime.parse(sleepDate + " " + strDifferenceInHours + ":" + strDifferenceInMinutes + ":" + "00.00").toString(); - String hours = sleepDate.substring(11, sleepDate.indexOf(":")); - print(hours); - - String minutes = sleepDate.substring(sleepDate.indexOf(":") + 1, sleepDate.indexOf(":") + 3); - print(minutes); - - if (value == 0 || value == 109) { - print("in Bed"); - MedSubCategoryID = 1; - value = double.parse(hours + "." + minutes); - print("value"); - print(value); - } else if (value == 1 || value == 110) { - print("Sleep"); - MedSubCategoryID = 2; - value = double.parse(hours + "." + minutes); - print("value"); - print(value); - } - } - date = DateUtil.convertDateToString(date); - Med_InsertTransactionsInputsList.add(healthData(MedCategoryID: MedCategoryID, MedSubCategoryID: MedSubCategoryID, MachineDate: date, Value: value, TransactionsListID: TransactionsListID++)); - }); - } + HealthFactory health = HealthFactory(); + List types = [HealthDataType.STEPS, HealthDataType.HEART_RATE, Platform.isAndroid ? HealthDataType.DISTANCE_DELTA : HealthDataType.DISTANCE_WALKING_RUNNING]; + + await health.requestAuthorization(types); + + try { + List healthData = await health.getHealthDataFromTypes(startDate, DateTime.now(), types); + _healthDataList.addAll(healthData); + } catch (e) { + print("Caught exception in getHealthDataFromTypes: $e"); } + + _healthDataList = HealthFactory.removeDuplicates(_healthDataList); + + _healthDataList.forEach((x) { + if (x.type == HealthDataType.STEPS) { + Med_InsertTransactionsInputsList.add( + healthData(MedCategoryID: 6, MedSubCategoryID: MedSubCategoryID, MachineDate: DateUtil.convertDateToString(x.dateFrom), Value: x.value, TransactionsListID: TransactionsListID++)); + } + if (x.type == HealthDataType.HEART_RATE) { + Med_InsertTransactionsInputsList.add( + healthData(MedCategoryID: 3, MedSubCategoryID: MedSubCategoryID, MachineDate: DateUtil.convertDateToString(x.dateFrom), Value: x.value, TransactionsListID: TransactionsListID++)); + } + if (x.type == HealthDataType.DISTANCE_DELTA || x.type == HealthDataType.DISTANCE_WALKING_RUNNING) { + Med_InsertTransactionsInputsList.add( + healthData(MedCategoryID: 7, MedSubCategoryID: MedSubCategoryID, MachineDate: DateUtil.convertDateToString(x.dateFrom), Value: x.value, TransactionsListID: TransactionsListID++)); + } + }); + getAllHealthDataLists(); } void getAllHealthDataLists() { var totalSteps = 0.0; var totalDistance = 0.0; - // double totalCalories = 0.0 ; double totalHeartRate = 0.0; double avgTotalHeartRate = 0.0; var counter = 0; @@ -175,14 +115,11 @@ class _syncHealthDataButtonState extends State { value.forEach((element) { if (element['MedCategoryID'] == 6) { MedCategoryID = 6; - totalSteps += element['Value']; } else if (element['MedCategoryID'] == 7) { MedCategoryID = 7; - // to convert from meter to km totalDistance += (element['Value'] * 0.001); } else if (element['MedCategoryID'] == 3) { - // print("HeartRate"); MedCategoryID = 3; counter++; totalHeartRate += element['Value']; @@ -194,10 +131,6 @@ class _syncHealthDataButtonState extends State { Med_InsertTransactionsInputsList2.add(new healthData( MedCategoryID: 4, MedSubCategoryID: element['MedSubCategoryID'], MachineDate: DateUtil.convertDateToString(date), Value: element['Value'], TransactionsListID: TransactionsListID++)); } - // else if(element['MedCategoryID'] == 8){ - // - // totalCalories += element['Value'] ; - // } }); if (counter == 0) { diff --git a/lib/pages/packages_offers/ClinicOfferAndPackagesPage.dart b/lib/pages/packages_offers/ClinicOfferAndPackagesPage.dart index 97daf27f..da983d56 100644 --- a/lib/pages/packages_offers/ClinicOfferAndPackagesPage.dart +++ b/lib/pages/packages_offers/ClinicOfferAndPackagesPage.dart @@ -18,28 +18,25 @@ dynamic languageID; class ClinicPackagesPage extends StatefulWidget { List products; + ClinicPackagesPage({@required this.products}); @override _ClinicPackagesPageState createState() => _ClinicPackagesPageState(); - - } -class _ClinicPackagesPageState extends State with AfterLayoutMixin{ +class _ClinicPackagesPageState extends State with AfterLayoutMixin { AppScaffold appScaffold; List get _products => widget.products; PackagesViewModel viewModel; - onProductCartClick(PackagesResponseModel product) async { - if(viewModel.service.customer == null) - viewModel.service.customer = await CreateCustomerDialogPage(context: context).show(); + if (viewModel.service.customer == null) viewModel.service.customer = await CreateCustomerDialogPage(context: context).show(); - if(viewModel.service.customer != null) { + if (viewModel.service.customer != null) { var request = AddProductToCartRequestModel(product_id: product.id, customer_id: viewModel.service.customer.id); - await viewModel.service.addProductToCart(request, context: context).then((response){ + await viewModel.service.addProductToCart(request, context: context).then((response) { // appScaffold.appBar.badgeUpdater(viewModel.service.cartItemCount); }).catchError((error) { utils.Utils.showErrorToast(error); @@ -47,9 +44,8 @@ class _ClinicPackagesPageState extends State with AfterLayo } } - @override - void afterFirstLayout(BuildContext context) async{ + void afterFirstLayout(BuildContext context) async { // appScaffold.appBar.badgeUpdater(viewModel.service.cartItemCount); } @@ -58,13 +54,11 @@ class _ClinicPackagesPageState extends State with AfterLayo super.initState(); } - @override Widget build(BuildContext context) { - return BaseView( allowAny: true, - onModelReady: (model){ + onModelReady: (model) { viewModel = model; }, builder: (_, model, wi) => appScaffold = AppScaffold( @@ -76,22 +70,25 @@ class _ClinicPackagesPageState extends State with AfterLayo isOfferPackages: true, showOfferPackagesCart: true, isShowDecPage: false, + showNewAppBar: true, + showNewAppBarTitle: true, body: Padding( - padding: const EdgeInsets.all(5), + padding: const EdgeInsets.all(12), child: StaggeredGridView.countBuilder( - crossAxisCount:4, + crossAxisCount: 4, itemCount: _products.length, itemBuilder: (BuildContext context, int index) => new Container( color: Colors.transparent, - child: PackagesItemCard( itemContentPadding: 10,itemModel: _products[index], onCartClick: onProductCartClick,) - ), + child: PackagesItemCard( + itemContentPadding: 10, + itemModel: _products[index], + onCartClick: onProductCartClick, + )), staggeredTileBuilder: (int index) => StaggeredTile.fit(2), mainAxisSpacing: 20, crossAxisSpacing: 10, - ) - ), + )), ), ); } - } diff --git a/lib/pages/parent_categorise_page.dart b/lib/pages/parent_categorise_page.dart index 393cbb27..6bdc9080 100644 --- a/lib/pages/parent_categorise_page.dart +++ b/lib/pages/parent_categorise_page.dart @@ -31,12 +31,14 @@ class ParentCategorisePage extends StatefulWidget { String id; String titleName; - AuthenticatedUserObject authenticatedUserObject = locator(); + AuthenticatedUserObject authenticatedUserObject = + locator(); ParentCategorisePage({this.id, this.titleName}); @override - _ParentCategorisePageState createState() => _ParentCategorisePageState(id: id, titleName: titleName); + _ParentCategorisePageState createState() => + _ParentCategorisePageState(id: id, titleName: titleName); } class _ParentCategorisePageState extends State { @@ -75,559 +77,782 @@ class _ParentCategorisePageState extends State { ProjectViewModel projectViewModel = Provider.of(context); ProjectViewModel projectProvider = Provider.of(context); return BaseView( - onModelReady: (model) => model.getCategoriseParent(i: id, pageIndex: pageIndex, isLoading: false, context: context), + onModelReady: (model) => model.getCategoriseParent( + i: id, pageIndex: pageIndex, isLoading: false, context: context), allowAny: true, - builder: (BuildContext context, PharmacyCategoriseViewModel model, Widget child) => AppScaffold( - isPharmacy: true, - appBarTitle: titleName, - isBottomBar: true, - isShowAppBar: true, - backgroundColor: Colors.white, - isShowDecPage: false, - showPharmacyCart: false, - showHomeAppBarIcon: false,baseViewModel: model, - body: SmartRefresher( - enablePullDown: false, - controller: controller, - enablePullUp: true, - onLoading: () async { - setState(() { - ++pageIndex; - }); - await model.getParentProducts(pageIndex: pageIndex, i: id, isLoading: true, context: context); - if (model.state != ViewState.BusyLocal && pageIndex < 5) { - controller.loadComplete(); - } else { - controller.loadFailed(); - } - }, - child: SingleChildScrollView( - child: Container( - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Container( - child: Image.network( - id == '1' - ? 'https://uat.hmgwebservices.com/epharmacy/content/images/thumbs/0089188_personal-care_2.png' - : id == '2' - ? 'https://uat.hmgwebservices.com/epharmacy/content/images/thumbs/0089189_skin-care_2.png' - : id == '3' - ? 'https://uat.hmgwebservices.com/epharmacy/content/images/thumbs/0089190_health-care_2.png' - : id == '4' - ? 'https://uat.hmgwebservices.com/epharmacy/content/images/thumbs/0089191_sexual-health_2.png' - : id == '5' - ? 'https://uat.hmgwebservices.com/epharmacy/content/images/thumbs/0089192_beauty_2.png' - : id == '6' - ? 'https://uat.hmgwebservices.com/epharmacy/content/images/thumbs/0089193_baby-child_2.png' - : id == '7' - ? 'https://uat.hmgwebservices.com/epharmacy/content/images/thumbs/0089194_vitamins-supplements_2.png' - : id == '8' - ? 'https://uat.hmgwebservices.com/epharmacy/content/images/thumbs/0089195_diet-nutrition_2.png' - : id == '9' - ? 'https://uat.hmgwebservices.com/epharmacy/content/images/thumbs/0089196_household_2.png' - : id == '10' - ? 'https://uat.hmgwebservices.com/epharmacy/content/images/thumbs/0089197_home-care-appliances_2.png' - : '', - fit: BoxFit.fill, - height: 160.0, - width: double.infinity), - ), - if (model.categoriseParent.length > 8) - Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - InkWell( - child: Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, + builder: + (BuildContext context, PharmacyCategoriseViewModel model, + Widget child) => + AppScaffold( + isPharmacy: true, + appBarTitle: titleName, + isBottomBar: true, + isShowAppBar: true, + backgroundColor: Colors.white, + isShowDecPage: false, + showPharmacyCart: false, + showHomeAppBarIcon: false, + baseViewModel: model, + body: SmartRefresher( + enablePullDown: false, + controller: controller, + enablePullUp: true, + onLoading: () async { + setState(() { + ++pageIndex; + }); + await model.getParentProducts( + pageIndex: pageIndex, + i: id, + isLoading: true, + context: context); + if (model.state != ViewState.BusyLocal && + pageIndex < 5) { + controller.loadComplete(); + } else { + controller.loadFailed(); + } + }, + child: SingleChildScrollView( + child: Container( + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Container( + child: Image.network( + id == '1' + ? 'https://uat.hmgwebservices.com/epharmacy/content/images/thumbs/0089188_personal-care_2.png' + : id == '2' + ? 'https://uat.hmgwebservices.com/epharmacy/content/images/thumbs/0089189_skin-care_2.png' + : id == '3' + ? 'https://uat.hmgwebservices.com/epharmacy/content/images/thumbs/0089190_health-care_2.png' + : id == '4' + ? 'https://uat.hmgwebservices.com/epharmacy/content/images/thumbs/0089191_sexual-health_2.png' + : id == '5' + ? 'https://uat.hmgwebservices.com/epharmacy/content/images/thumbs/0089192_beauty_2.png' + : id == '6' + ? 'https://uat.hmgwebservices.com/epharmacy/content/images/thumbs/0089193_baby-child_2.png' + : id == '7' + ? 'https://uat.hmgwebservices.com/epharmacy/content/images/thumbs/0089194_vitamins-supplements_2.png' + : id == '8' + ? 'https://uat.hmgwebservices.com/epharmacy/content/images/thumbs/0089195_diet-nutrition_2.png' + : id == '9' + ? 'https://uat.hmgwebservices.com/epharmacy/content/images/thumbs/0089196_household_2.png' + : id == '10' + ? 'https://uat.hmgwebservices.com/epharmacy/content/images/thumbs/0089197_home-care-appliances_2.png' + : '', + fit: BoxFit.fill, + height: 160.0, + width: double.infinity), + ), + if (model.categoriseParent.length > 8) + Column( + crossAxisAlignment: CrossAxisAlignment.start, children: [ - Padding( - padding: EdgeInsets.all(10.0), - child: Container( - child: Texts( - TranslationBase.of(context).viewCategorise, + InkWell( + child: Row( + mainAxisAlignment: + MainAxisAlignment.spaceBetween, + children: [ + Padding( + padding: EdgeInsets.all(10.0), + child: Container( + child: Texts( + TranslationBase.of(context) + .viewCategorise, // 'View All Categories', - fontWeight: FontWeight.w300, + fontWeight: FontWeight.w300, + ), + ), + ), + Icon(Icons.arrow_forward) + ], ), - ), + onTap: () { + Navigator.push( + context, + FadePage( + page: SubCategoriseModalsheet( +// id: model.categorise[0].id, +// titleName: model.categorise[0].name, + )), + ); + }), + Divider( + thickness: 1.0, + color: Colors.grey.shade400, ), - Icon(Icons.arrow_forward) ], ), - onTap: () { - Navigator.push( - context, - FadePage( - page: SubCategoriseModalsheet( -// id: model.categorise[0].id, -// titleName: model.categorise[0].name, - )), - ); - }), - Divider( - thickness: 1.0, - color: Colors.grey.shade400, - ), - ], - ), //Expanded widget heree if nassery - Padding( - padding: EdgeInsets.only(top: 35.0), - child: Container( - height: MediaQuery.of(context).size.height * 0.2, - child: Center( - child: ListView.builder( - scrollDirection: Axis.horizontal, - itemCount: model.categoriseParent.length > 8 ? 8 : model.categoriseParent.length, - itemBuilder: (BuildContext context, int index) { - return Padding( - padding: EdgeInsets.symmetric(horizontal: 8.0), - child: InkWell( - child: Column( - crossAxisAlignment: CrossAxisAlignment.center, - children: [ - Padding( - padding: EdgeInsets.symmetric(horizontal: 13.0), - child: Container( - height: 60.0, - width: 65.0, - decoration: BoxDecoration( - shape: BoxShape.circle, - color: Colors.orange.shade200.withOpacity(0.45), - ), - child: Center( - child: Icon( - Icons.apps_sharp, - size: 32.0, - ), + Padding( + padding: EdgeInsets.only(top: 35.0), + child: Container( + height: + MediaQuery.of(context).size.height * 0.2, + child: Center( + child: ListView.builder( + scrollDirection: Axis.horizontal, + itemCount: + model.categoriseParent.length > 8 + ? 8 + : model.categoriseParent.length, + itemBuilder: + (BuildContext context, int index) { + return Padding( + padding: EdgeInsets.symmetric( + horizontal: 8.0), + child: InkWell( + child: Column( + crossAxisAlignment: + CrossAxisAlignment.center, + children: [ + Padding( + padding: + EdgeInsets.symmetric( + horizontal: 13.0), + child: Container( + height: 60.0, + width: 65.0, + decoration: BoxDecoration( + shape: BoxShape.circle, + color: Colors + .orange.shade200 + .withOpacity(0.45), + ), + child: Center( + child: Icon( + Icons.apps_sharp, + size: 32.0, + ), + ), + ), + ), + Container( + width: + MediaQuery.of(context) + .size + .width * + 0.197, + // height: MediaQuery.of(context) + // .size + // .height * + // 0.08, + child: Center( + child: Texts( + projectViewModel + .isArabic + ? model + .categoriseParent[ + index] + .namen + : model + .categoriseParent[ + index] + .name, + fontSize: 13.4, + fontWeight: + FontWeight.w600, + maxLines: 3, + ), + ), + ), + ], ), + onTap: () { + Navigator.push( + context, + FadePage( + page: SubCategorisePage( + title: projectViewModel + .isArabic + ? model + .categoriseParent[ + index] + .namen + : model + .categoriseParent[ + index] + .name, + id: model + .categoriseParent[index] + .id, + parentId: id, + )), + ); + print(id); + }, ), + ); + }), + ), + ), + ), + + Divider( + thickness: 1.0, + color: Colors.grey.shade400, + ), + Padding( + padding: EdgeInsets.symmetric(horizontal: 8.0), + child: Row( + mainAxisAlignment: + MainAxisAlignment.spaceBetween, + children: [ + InkWell( + child: Row( + children: [ + Icon( + Icons.wrap_text, ), - Container( - width: MediaQuery.of(context).size.width * 0.197, - // height: MediaQuery.of(context) - // .size - // .height * - // 0.08, - child: Center( - child: Texts( - projectViewModel.isArabic ? model.categoriseParent[index].namen : model.categoriseParent[index].name, - fontSize: 13.4, - fontWeight: FontWeight.w600, - maxLines: 3, - ), - ), + SizedBox( + width: 10.0, + ), + Texts( + TranslationBase.of(context).refine, + fontWeight: FontWeight.w600, ), ], ), onTap: () { - Navigator.push( - context, - FadePage( - page: SubCategorisePage( - title: projectViewModel.isArabic ? model.categoriseParent[index].namen : model.categoriseParent[index].name, - id: model.categoriseParent[index].id, - parentId: id, - )), - ); - print(id); - }, - ), - ); - }), - ), - ), - ), - - Divider( - thickness: 1.0, - color: Colors.grey.shade400, - ), - Padding( - padding: EdgeInsets.symmetric(horizontal: 8.0), - child: Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - InkWell( - child: Row( - children: [ - Icon( - Icons.wrap_text, - ), - SizedBox( - width: 10.0, - ), - Texts( - TranslationBase.of(context).refine, - fontWeight: FontWeight.w600, - ), - ], - ), - onTap: () { - showModalBottomSheet( - isScrollControlled: true, - context: context, - builder: (BuildContext context) { - return DraggableScrollableSheet( - initialChildSize: 0.95, - maxChildSize: 0.95, - minChildSize: 0.9, - builder: (BuildContext context, ScrollController scrollController) { - return SingleChildScrollView( - controller: scrollController, - child: Container( - color: Colors.white, - height: MediaQuery.of(context).size.height * 1.95, - child: Column( - children: [ - Padding( - padding: EdgeInsets.all(8.0), - child: Row( - children: [ - Icon( - Icons.wrap_text, - ), - SizedBox( - width: 10.0, - ), - Texts( - TranslationBase.of(context).refine, + showModalBottomSheet( + isScrollControlled: true, + context: context, + builder: (BuildContext context) { + return DraggableScrollableSheet( + initialChildSize: 0.95, + maxChildSize: 0.95, + minChildSize: 0.9, + builder: (BuildContext context, + ScrollController + scrollController) { + return SingleChildScrollView( + controller: + scrollController, + child: Container( + color: Colors.white, + height: + MediaQuery.of(context) + .size + .height * + 1.95, + child: Column( + children: [ + Padding( + padding: + EdgeInsets.all( + 8.0), + child: Row( + children: [ + Icon( + Icons + .wrap_text, + ), + SizedBox( + width: 10.0, + ), + Texts( + TranslationBase.of( + context) + .refine, // 'Refine', - fontWeight: FontWeight.w600, - ), - SizedBox( - width: 250.0, - ), - InkWell( - child: Texts( + fontWeight: + FontWeight + .w600, + ), + SizedBox( + width: 250.0, + ), + InkWell( + child: Texts( // 'Close', - TranslationBase.of(context).closeIt, - color: Colors.red, - fontWeight: FontWeight.w600, - fontSize: 15.0, + TranslationBase.of( + context) + .closeIt, + color: Colors + .red, + fontWeight: + FontWeight + .w600, + fontSize: + 15.0, + ), + onTap: () { + Navigator.pop( + context); + }, + ), + ], + ), ), - onTap: () { - Navigator.pop(context); - }, - ), - ], - ), - ), - Divider( - thickness: 1.0, - color: Colors.black12, - ), - Column( - children: [ - ExpansionTile( - title: Texts(TranslationBase.of(context).categorise), - children: [ - ProcedureListWidget( - model: model, - masterList: model.categoriseParent, - removeHistory: (item) { - setState(() { - entityList.remove(item); - }); - }, - addHistory: (history) { - setState(() { - entityList.add(history); - }); - }, - addSelectedHistories: () { - //TODO build your fun herr - // widget.addSelectedHistories(); - }, - isEntityListSelected: (master) => isEntityListSelected(master), - ) - ], - ), - Divider( - thickness: 1.0, - color: Colors.black12, - ), - ExpansionTile( - title: Texts(TranslationBase.of(context).brands), - children: [ - ProcedureListWidget( - model: model, - masterList: model.brandsList, - removeHistory: (item) { - setState(() { - entityListBrands.remove(item); - }); - }, - addHistory: (history) { - setState(() { - entityListBrands.add(history); - }); - }, - addSelectedHistories: () { - //TODO build your fun herr - // widget.addSelectedHistories(); - }, - isEntityListSelected: (master) => isEntityListSelectedBrands(master), - ) - ], - ), - Divider( - thickness: 1.0, - color: Colors.black12, - ), - ExpansionTile( - title: Texts(TranslationBase.of(context).price), - children: [ - Container( - color: Color(0xffEEEEEE), - child: Row( - mainAxisAlignment: MainAxisAlignment.spaceAround, - children: [ - Column( - mainAxisAlignment: MainAxisAlignment.start, - children: [ - Texts(TranslationBase.of(context).min), - Container( - color: Colors.white, - width: 200, - height: 40, - child: TextFormField( - decoration: InputDecoration( - border: OutlineInputBorder(), + Divider( + thickness: 1.0, + color: + Colors.black12, + ), + Column( + children: [ + ExpansionTile( + title: Texts( + TranslationBase.of( + context) + .categorise), + children: [ + ProcedureListWidget( + model: + model, + masterList: + model + .categoriseParent, + removeHistory: + (item) { + setState( + () { + entityList + .remove(item); + }); + }, + addHistory: + (history) { + setState( + () { + entityList + .add(history); + }); + }, + addSelectedHistories: + () { + //TODO build your fun herr + // widget.addSelectedHistories(); + }, + isEntityListSelected: + (master) => + isEntityListSelected(master), + ) + ], + ), + Divider( + thickness: 1.0, + color: Colors + .black12, + ), + ExpansionTile( + title: Texts( + TranslationBase.of( + context) + .brands), + children: [ + ProcedureListWidget( + model: + model, + masterList: + model + .brandsList, + removeHistory: + (item) { + setState( + () { + entityListBrands + .remove(item); + }); + }, + addHistory: + (history) { + setState( + () { + entityListBrands + .add(history); + }); + }, + addSelectedHistories: + () { + //TODO build your fun herr + // widget.addSelectedHistories(); + }, + isEntityListSelected: + (master) => + isEntityListSelectedBrands(master), + ) + ], + ), + Divider( + thickness: 1.0, + color: Colors + .black12, + ), + ExpansionTile( + title: Texts( + TranslationBase.of( + context) + .price), + children: [ + Container( + color: Color( + 0xffEEEEEE), + child: Row( + mainAxisAlignment: + MainAxisAlignment + .spaceAround, + children: [ + Column( + mainAxisAlignment: + MainAxisAlignment.start, + children: [ + Texts(TranslationBase.of(context).min), + Container( + color: Colors.white, + width: 200, + height: 40, + child: TextFormField( + decoration: InputDecoration( + border: OutlineInputBorder(), + ), + controller: minField, + ), + ), + ], ), - controller: minField, - ), + Column( + mainAxisAlignment: + MainAxisAlignment.start, + children: [ + Texts(TranslationBase.of(context).max), + Container( + color: Colors.white, + width: 200, + height: 40, + child: TextFormField( + decoration: InputDecoration( + border: OutlineInputBorder(), + ), + controller: maxField, + ), + ), + ], + ), + ], ), - ], - ), - Column( - mainAxisAlignment: MainAxisAlignment.start, + ) + ], + ), + Divider( + thickness: 1.0, + color: Colors + .black12, + ), + SizedBox( + height: MediaQuery.of( + context) + .size + .height * + 0.4, + ), + Padding( + padding: + EdgeInsets + .all( + 8.0), + child: Row( + mainAxisAlignment: + MainAxisAlignment + .spaceEvenly, children: [ - Texts(TranslationBase.of(context).max), Container( - color: Colors.white, - width: 200, - height: 40, - child: TextFormField( - decoration: InputDecoration( - border: OutlineInputBorder(), - ), - controller: maxField, + width: + 150, + child: + Button( + label: TranslationBase.of(context) + .reset, + backgroundColor: + Colors.red, + onTap: + () { + setState( + () { + entityList.clear(); + entityListBrands.clear(); + }); + minField + .clear(); + maxField + .clear(); + }, ), ), - ], - ), - ], - ), - ) - ], - ), - Divider( - thickness: 1.0, - color: Colors.black12, - ), - SizedBox( - height: MediaQuery.of(context).size.height * 0.4, - ), - Padding( - padding: EdgeInsets.all(8.0), - child: Row( - mainAxisAlignment: MainAxisAlignment.spaceEvenly, - children: [ - Container( - width: 150, - child: Button( - label: TranslationBase.of(context).reset, - backgroundColor: Colors.red, - ), - ), - SizedBox( - width: 10, - ), - Container( - width: 150, - child: Button( - onTap: () async { - String categoriesId = ""; - for (CategoriseParentModel category in entityList) { - if (categoriesId == "") { - categoriesId = category.id; - } else { - categoriesId = "$categoriesId,${category.id}"; - } - } - String brandIds = ""; - for (CategoriseParentModel brand in entityListBrands) { - if (brandIds == "") { - brandIds = brand.id; - } else { - brandIds = "$brandIds,${brand.id}"; - } - } + SizedBox( + width: 10, + ), + Container( + width: + 150, + child: + Button( + onTap: + () async { + String + categoriesId = + ""; + for (CategoriseParentModel category + in entityList) { + if (categoriesId == + "") { + categoriesId = category.id; + } else { + categoriesId = "$categoriesId,${category.id}"; + } + } + String + brandIds = + ""; + for (CategoriseParentModel brand + in entityListBrands) { + if (brandIds == + "") { + brandIds = brand.id; + } else { + brandIds = "$brandIds,${brand.id}"; + } + } - GifLoaderDialogUtils.showMyDialog(context); + GifLoaderDialogUtils.showMyDialog( + context); - await model.getFilteredProducts( - min: minField.text.isEmpty ? "" : "&price_min=" + minField.text.toString(), max: maxField.text.isEmpty ? "" : "&price_max=" + maxField.text.toString(), categoryId: categoriesId, brandId: brandIds.isEmpty ? "" : "&manufacturerids=" + brandIds); - GifLoaderDialogUtils.hideDialog(context); + await model.getFilteredProducts( + min: minField.text.isEmpty ? "" : "&price_min=" + minField.text.toString(), + max: maxField.text.isEmpty ? "" : "&price_max=" + maxField.text.toString(), + categoryId: categoriesId, + brandId: brandIds.isEmpty ? "" : "&manufacturerids=" + brandIds); + GifLoaderDialogUtils.hideDialog( + context); - Navigator.pop(context); - }, - label: TranslationBase.of(context).apply, - backgroundColor: Colors.green, + Navigator.pop( + context); + }, + label: TranslationBase.of(context) + .apply, + backgroundColor: + Colors.green, + ), + ), + ], + ), ), - ), - ], - ), + ], + ), + ], ), - ], - ), - ], - ), - ), - ); - }); - }, - ); - }, - ), - Row( - children: [ - Container( - height: 44.0, - child: VerticalDivider( - color: Colors.black45, - thickness: 1.0, + ), + ); + }); + }, + ); + }, + ), + Row( + children: [ + Container( + height: 44.0, + child: VerticalDivider( + color: Colors.black45, + thickness: 1.0, //width: 0.3, // indent: 0.0, - ), - ), - Padding( - padding: EdgeInsets.all(8.0), - child: InkWell( - child: styleIcon, - onTap: () { - setState(() { - if (styleOne == true) { - styleOne = false; - styleTwo = true; - styleIcon = Icon( - Icons.auto_awesome_mosaic, - color: CustomColors.green, - size: 29.0, - ); - } else { - styleOne = true; - styleTwo = false; - styleIcon = Icon( - Icons.widgets_sharp, - color: CustomColors.green, - size: 29.0, - ); - } - }); - }, - ), - ), - ], - ), - ], - ), - ), - Divider( - thickness: 1.0, - color: Colors.grey.shade400, - ), - model.parentProducts.isNotEmpty - ? styleOne == true - ? Container( - height: model.parentProducts.length * MediaQuery.of(context).size.height * 0.15, - child: GridView.builder( - physics: NeverScrollableScrollPhysics(), - gridDelegate: SliverGridDelegateWithFixedCrossAxisCount( - crossAxisCount: 2, - crossAxisSpacing: 0.5, - mainAxisSpacing: 2.0, - childAspectRatio: 0.9, - ), - itemCount: model.parentProducts.length, - itemBuilder: (BuildContext context, int index) { - return NetworkBaseView( - baseViewModel: model, + ), + ), + Padding( + padding: EdgeInsets.all(8.0), child: InkWell( - child: Card( - color: model.parentProducts[index].discountName != null ? Color(0xffFFFF00) : Colors.white, - elevation: 0, - shape: Border( - right: BorderSide( - color: Colors.grey.shade300, - width: 1, - ), - left: BorderSide( - color: Colors.grey.shade300, - width: 1, - ), - bottom: BorderSide( - color: Colors.grey.shade300, - width: 1, - ), - top: BorderSide( - color: Colors.grey.shade300, - width: 1, - ), - ), - margin: EdgeInsets.symmetric( - horizontal: 8, - vertical: 4, - ), - child: Container( - decoration: BoxDecoration( - borderRadius: BorderRadius.only( - topLeft: Radius.circular(110.0), - ), - color: Colors.white, - ), - padding: EdgeInsets.symmetric(horizontal: 0), - width: MediaQuery.of(context).size.width / 3, - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Stack( - children: [ - if (model.parentProducts[index].discountName != null) - RotatedBox( - quarterTurns: 4, - child: Container( - decoration: BoxDecoration(), - child: Padding( - padding: EdgeInsets.only( - right: 5.0, - top: 20.0, - bottom: 5.0, - ), - child: Texts( - TranslationBase.of(context).offers.toUpperCase(), - color: Colors.red, - fontSize: 13.0, - fontWeight: FontWeight.w900, - ), - ), - transform: new Matrix4.rotationZ(5.837200), - ), - ), - Container( - margin: EdgeInsets.fromLTRB(0, 16, 0, 0), - alignment: Alignment.center, - child: Image.network( - model.parentProducts[index].images.isNotEmpty - ? model.parentProducts[index].images[0].thumb - : 'https://upload.wikimedia.org/wikipedia/commons/thumb/6/6c/No_image_3x4.svg/1200px-No_image_3x4.svg.png', - fit: BoxFit.cover, - height: 80, + child: styleIcon, + onTap: () { + setState(() { + if (styleOne == true) { + styleOne = false; + styleTwo = true; + styleIcon = Icon( + Icons.auto_awesome_mosaic, + color: CustomColors.green, + size: 29.0, + ); + } else { + styleOne = true; + styleTwo = false; + styleIcon = Icon( + Icons.widgets_sharp, + color: CustomColors.green, + size: 29.0, + ); + } + }); + }, + ), + ), + ], + ), + ], + ), + ), + Divider( + thickness: 1.0, + color: Colors.grey.shade400, + ), + model.parentProducts.isNotEmpty + ? styleOne == true + ? Container( + height: model.parentProducts.length * + MediaQuery.of(context) + .size + .height * + 0.15, + child: GridView.builder( + physics: + NeverScrollableScrollPhysics(), + gridDelegate: + SliverGridDelegateWithFixedCrossAxisCount( + crossAxisCount: 2, + crossAxisSpacing: 0.5, + mainAxisSpacing: 2.0, + childAspectRatio: 0.9, + ), + itemCount: + model.parentProducts.length, + itemBuilder: (BuildContext context, + int index) { + return NetworkBaseView( + baseViewModel: model, + child: InkWell( + child: Card( + color: model + .parentProducts[ + index] + .discountName != + null + ? Color(0xffFFFF00) + : Colors.white, + elevation: 0, + shape: Border( + right: BorderSide( + color: Colors + .grey.shade300, + width: 1, + ), + left: BorderSide( + color: Colors + .grey.shade300, + width: 1, + ), + bottom: BorderSide( + color: Colors + .grey.shade300, + width: 1, + ), + top: BorderSide( + color: Colors + .grey.shade300, + width: 1, + ), + ), + margin: + EdgeInsets.symmetric( + horizontal: 8, + vertical: 4, + ), + child: Container( + decoration: + BoxDecoration( + borderRadius: + BorderRadius.only( + topLeft: + Radius.circular( + 110.0), ), + color: Colors.white, ), + padding: EdgeInsets + .symmetric( + horizontal: 0), + width: MediaQuery.of( + context) + .size + .width / + 3, + child: Column( + crossAxisAlignment: + CrossAxisAlignment + .start, + children: [ + Stack( + children: [ + if (model + .parentProducts[ + index] + .discountName != + null) + RotatedBox( + quarterTurns: + 4, + child: + Container( + decoration: + BoxDecoration(), + child: + Padding( + padding: + EdgeInsets.only( + right: + 5.0, + top: + 20.0, + bottom: + 5.0, + ), + child: + Texts( + TranslationBase.of(context) + .offers + .toUpperCase(), + color: + Colors.red, + fontSize: + 13.0, + fontWeight: + FontWeight.w900, + ), + ), + transform: + new Matrix4.rotationZ( + 5.837200), + ), + ), + Container( + margin: EdgeInsets + .fromLTRB( + 0, + 16, + 0, + 0), + alignment: + Alignment + .center, + child: Image + .network( + model + .parentProducts[ + index] + .images + .isNotEmpty + ? model + .parentProducts[index] + .images[0] + .thumb + : 'https://upload.wikimedia.org/wikipedia/commons/thumb/6/6c/No_image_3x4.svg/1200px-No_image_3x4.svg.png', + fit: BoxFit + .cover, + height: 80, + ), + ), // Container( // width: model.parentProducts[index].rxMessage != // null @@ -677,144 +902,251 @@ class _ParentCategorisePageState extends State { // .w400, // // ), // ), - ], - ), - Container( - margin: EdgeInsets.symmetric( - horizontal: 6, - vertical: 0, - ), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - if (model.parentProducts[index].discountName != null) + ], + ), Container( - width: double.infinity, - height: 13.0, - decoration: BoxDecoration( - color: Color(0xff5AB145), + margin: EdgeInsets + .symmetric( + horizontal: 6, + vertical: 0, ), - child: Center( - child: Texts( - model.parentProducts[index].discountName, - regular: true, - color: Colors.white, - fontSize: 10.4, - ), - ), - ), - Texts( - projectViewModel.isArabic ? model.parentProducts[index].namen : model.parentProducts[index].name, - regular: true, - fontSize: 12, - fontWeight: FontWeight.w700, - ), - Padding( - padding: const EdgeInsets.only(top: 4, bottom: 4), - child: Texts( - "SAR ${model.parentProducts[index].price}", - bold: true, - fontSize: 14, - ), - ), - Row( - children: [ + child: Column( + crossAxisAlignment: + CrossAxisAlignment + .start, + children: [ + if (model + .parentProducts[ + index] + .discountName != + null) + Container( + width: double + .infinity, + height: + 13.0, + decoration: + BoxDecoration( + color: Color( + 0xff5AB145), + ), + child: + Center( + child: + Texts( + model + .parentProducts[index] + .discountName, + regular: + true, + color: + Colors.white, + fontSize: + 10.4, + ), + ), + ), + Texts( + projectViewModel + .isArabic + ? model + .parentProducts[ + index] + .namen + : model + .parentProducts[index] + .name, + regular: + true, + fontSize: + 12, + fontWeight: + FontWeight + .w700, + ), + Padding( + padding: const EdgeInsets + .only( + top: 4, + bottom: + 4), + child: + Texts( + "SAR ${model.parentProducts[index].price}", + bold: + true, + fontSize: + 14, + ), + ), + Row( + children: [ // StarRating( // totalAverage: model.parentProducts[index].approvedRatingSum > 0 // ? (model.parentProducts[index].approvedRatingSum.toDouble() / model.parentProducts[index].approvedRatingSum.toDouble()).toDouble() // : 0, // forceStars: true), - RatingBar.readOnly( - initialRating: model.parentProducts[index].approvedRatingSum.toDouble(), - size: 15.0, - filledColor: Colors.yellow[700], - emptyColor: Colors.grey[500], - isHalfAllowed: true, - halfFilledIcon: Icons.star_half, - filledIcon: Icons.star, - emptyIcon: Icons.star, + RatingBar + .readOnly( + initialRating: model + .parentProducts[index] + .approvedRatingSum + .toDouble(), + size: + 15.0, + filledColor: + Colors.yellow[700], + emptyColor: + Colors.grey[500], + isHalfAllowed: + true, + halfFilledIcon: + Icons.star_half, + filledIcon: + Icons.star, + emptyIcon: + Icons.star, + ), + Texts( + "(${model.parentProducts[index].approvedTotalReviews})", + regular: + true, + fontSize: + 10, + fontWeight: + FontWeight.w400, + ) + ], + ), + ], ), - Texts( - "(${model.parentProducts[index].approvedTotalReviews})", - regular: true, - fontSize: 10, - fontWeight: FontWeight.w400, - ) - ], - ), - ], + ), + ], + ), ), ), - ], - ), - ), - ), - onTap: () => { - Navigator.push( - context, - FadePage( - page: ProductDetailPage(model.parentProducts[index]), - )), + onTap: () => { + Navigator.push( + context, + FadePage( + page: ProductDetailPage( + model.parentProducts[ + index]), + )), + }, + )); }, - )); - }, - ), - ) - : Container( - height: model.parentProducts.length * MediaQuery.of(context).size.height * 0.122, - child: ListView.builder( - physics: NeverScrollableScrollPhysics(), - itemCount: model.parentProducts.length, - itemBuilder: (BuildContext context, int index) { - return InkWell( - child: Card( - child: Row( - children: [ - Stack( - children: [ - Column( + ), + ) + : Container( + height: model.parentProducts.length * + MediaQuery.of(context) + .size + .height * + 0.122, + child: ListView.builder( + physics: + NeverScrollableScrollPhysics(), + itemCount: + model.parentProducts.length, + itemBuilder: + (BuildContext context, + int index) { + return InkWell( + child: Card( + child: Row( children: [ - Container( - decoration: BoxDecoration(), - child: Padding( - padding: EdgeInsets.only( - left: 9.0, - top: 8.0, - right: 10.0, + Stack( + children: [ + Column( + children: [ + Container( + decoration: + BoxDecoration(), + child: + Padding( + padding: + EdgeInsets + .only( + left: 9.0, + top: 8.0, + right: + 10.0, + ), + ), + ), + Container( + margin: EdgeInsets + .fromLTRB( + 0, + 0, + 0, + 0), + alignment: + Alignment + .center, + child: model + .parentProducts[ + index] + .images + .isNotEmpty + ? Image + .network( + model + .parentProducts[index] + .images[0] + .thumb, + fit: BoxFit + .contain, + height: + 70, + ) + : Text(TranslationBase.of( + context) + .noImage), + ), + ], ), - ), - ), - Container( - margin: EdgeInsets.fromLTRB(0, 0, 0, 0), - alignment: Alignment.center, - child: model.parentProducts[index].images.isNotEmpty - ? Image.network( - model.parentProducts[index].images[0].thumb, - fit: BoxFit.contain, - height: 70, - ) - : Text(TranslationBase.of(context).noImage), - ), - ], - ), - Column( - children: [ - Container( - width: model.parentProducts[index].rxMessage != null ? MediaQuery.of(context).size.width / 5.3 : 0, - padding: EdgeInsets.all(4), - decoration: BoxDecoration( - color: Color(0xffb23838), - borderRadius: BorderRadius.only(topLeft: Radius.circular(6)), - ), - child: model.parentProducts[index].rxMessage != null - ? Texts( - projectProvider.isArabic ? model.parentProducts[index].rxMessagen : model.parentProducts[index].rxMessage, - color: Colors.white, - regular: true, - fontSize: 10, - fontWeight: FontWeight.w400, - ) - : Texts(""), + Column( + children: [ + Container( + width: model.parentProducts[index].rxMessage != + null + ? MediaQuery.of(context) + .size + .width / + 5.3 + : 0, + padding: + EdgeInsets + .all( + 4), + decoration: + BoxDecoration( + color: Color( + 0xffb23838), + borderRadius: + BorderRadius.only( + topLeft: + Radius.circular(6)), + ), + child: model.parentProducts[index] + .rxMessage != + null + ? Texts( + projectProvider.isArabic + ? model.parentProducts[index].rxMessagen + : model.parentProducts[index].rxMessage, + color: + Colors.white, + regular: + true, + fontSize: + 10, + fontWeight: + FontWeight.w400, + ) + : Texts(""), // Texts( // model.parentProducts[index].rxMessage != null ? model.parentProducts[index].rxMessage : "", // color: Colors.white, @@ -822,139 +1154,201 @@ class _ParentCategorisePageState extends State { // fontSize: 10, // fontWeight: FontWeight.w400, // ), + ), + ], + ), + ], ), - ], - ), - ], - ), - Container( - margin: EdgeInsets.symmetric( - horizontal: 0, - vertical: 0, - ), - child: Column( - mainAxisAlignment: MainAxisAlignment.spaceAround, - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - SizedBox( - height: 4.0, - ), - Container( - width: MediaQuery.of(context).size.width * 0.635, - child: Texts( - projectViewModel.isArabic ? model.parentProducts[index].namen : model.parentProducts[index].name, - regular: true, - fontSize: 13.2, - fontWeight: FontWeight.w500, - maxLines: 5, - ), - ), - SizedBox( - height: 8.0, - ), - Padding( - padding: const EdgeInsets.only(top: 4, bottom: 4), - child: Texts( - "SAR ${model.parentProducts[index].price}", - bold: true, - fontSize: 14, - ), - ), - Row( - children: [ + Container( + margin: EdgeInsets + .symmetric( + horizontal: 0, + vertical: 0, + ), + child: Column( + mainAxisAlignment: + MainAxisAlignment + .spaceAround, + crossAxisAlignment: + CrossAxisAlignment + .start, + children: [ + SizedBox( + height: 4.0, + ), + Container( + width: MediaQuery.of( + context) + .size + .width * + 0.635, + child: Texts( + projectViewModel + .isArabic + ? model + .parentProducts[ + index] + .namen + : model + .parentProducts[ + index] + .name, + regular: true, + fontSize: + 13.2, + fontWeight: + FontWeight + .w500, + maxLines: 5, + ), + ), + SizedBox( + height: 8.0, + ), + Padding( + padding: + const EdgeInsets + .only( + top: 4, + bottom: + 4), + child: Texts( + "SAR ${model.parentProducts[index].price}", + bold: true, + fontSize: 14, + ), + ), + Row( + children: [ // StarRating( // totalAverage: model.parentProducts[index].approvedRatingSum > 0 // ? (model.parentProducts[index].approvedRatingSum.toDouble() / model.parentProducts[index].approvedRatingSum.toDouble()).toDouble() // : 0, // forceStars: true), - RatingBar.readOnly( - initialRating: model.parentProducts[index].approvedRatingSum.toDouble(), - size: 15.0, - filledColor: Colors.yellow[700], - emptyColor: Colors.grey[500], - isHalfAllowed: true, - halfFilledIcon: Icons.star_half, - filledIcon: Icons.star, - emptyIcon: Icons.star, + RatingBar + .readOnly( + initialRating: model + .parentProducts[ + index] + .approvedRatingSum + .toDouble(), + size: 15.0, + filledColor: + Colors.yellow[ + 700], + emptyColor: + Colors.grey[ + 500], + isHalfAllowed: + true, + halfFilledIcon: + Icons + .star_half, + filledIcon: + Icons + .star, + emptyIcon: + Icons + .star, + ), + Texts( + "(${model.parentProducts[index].approvedTotalReviews})", + regular: + true, + fontSize: + 10, + fontWeight: + FontWeight + .w400, + ) + ], + ), + ], ), - Texts( - "(${model.parentProducts[index].approvedTotalReviews})", - regular: true, - fontSize: 10, - fontWeight: FontWeight.w400, - ) - ], - ), - ], + ), + widget.authenticatedUserObject + .isLogin + ? Container( + child: + IconButton( + icon: + Icon( + Icons + .shopping_cart, + size: + 18, + color: + CustomColors.green, + ), + onPressed: + () async { + if (model.parentProducts[index].isRx == + false) { + GifLoaderDialogUtils.showMyDialog(context); + await addToCartFunction(1, + model.parentProducts[index].id); + GifLoaderDialogUtils.hideDialog(context); + Utils.navigateToCartPage(); + } else { + AppToast.showErrorToast(message: TranslationBase.of(context).needPrescription); + } + }), + ) + : Container(), + ], + ), ), + onTap: () => { + Navigator.push( + context, + FadePage( + page: ProductDetailPage( + model.parentProducts[ + index]), + )), + }, + ); + }), + ) + : Padding( + padding: const EdgeInsets.all(12.0), + child: Container( + child: Center( + child: Column( + mainAxisAlignment: + MainAxisAlignment.center, + children: [ + Padding( + padding: + const EdgeInsets.all(8.0), + child: Image.asset( + 'assets/images/new-design/empty_box.png', + width: 100, + height: 100, + fit: BoxFit.cover, ), - widget.authenticatedUserObject.isLogin - ? Container( - child: IconButton( - icon: Icon( - Icons.shopping_cart, - size: 18, - color: CustomColors.green, - ), - onPressed: () async { - if (model.parentProducts[index].isRx == false) { - GifLoaderDialogUtils.showMyDialog(context); - await addToCartFunction(1, model.parentProducts[index].id); - GifLoaderDialogUtils.hideDialog(context); - Utils.navigateToCartPage(); - } else { - AppToast.showErrorToast(message: TranslationBase.of(context).needPrescription); - } - }), - ) - : Container(), - ], - ), + ), + Padding( + padding: + const EdgeInsets.all(8.0), + child: Text( + TranslationBase.of(context) + .noData, + // 'There is no data', + style: + TextStyle(fontSize: 30), + ), + ) + ], ), - onTap: () => { - Navigator.push( - context, - FadePage( - page: ProductDetailPage(model.parentProducts[index]), - )), - }, - ); - }), - ) - : Padding( - padding: const EdgeInsets.all(12.0), - child: Container( - child: Center( - child: Column( - mainAxisAlignment: MainAxisAlignment.center, - children: [ - Padding( - padding: const EdgeInsets.all(8.0), - child: Image.asset( - 'assets/images/new-design/empty_box.png', - width: 100, - height: 100, - fit: BoxFit.cover, ), ), - Padding( - padding: const EdgeInsets.all(8.0), - child: Text( - TranslationBase.of(context).noData, - // 'There is no data', - style: TextStyle(fontSize: 30), - ), - ) - ], - ), - ), - ), - ) - ], - ), - ), - ), - ))); + ) + ], + ), + ), + ), + ))); } addToCartFunction(quantity, itemID) async { @@ -963,7 +1357,8 @@ class _ParentCategorisePageState extends State { } bool isEntityListSelected(CategoriseParentModel masterKey) { - Iterable history = entityList.where((element) => masterKey.id == element.id); + Iterable history = + entityList.where((element) => masterKey.id == element.id); if (history.length > 0) { return true; } @@ -971,7 +1366,8 @@ class _ParentCategorisePageState extends State { } bool isEntityListSelectedBrands(CategoriseParentModel masterKey) { - Iterable history = entityListBrands.where((element) => masterKey.id == element.id); + Iterable history = + entityListBrands.where((element) => masterKey.id == element.id); if (history.length > 0) { return true; } diff --git a/lib/pages/pharmacies/compare-list.dart b/lib/pages/pharmacies/compare-list.dart index afa5382f..0b1aa73d 100644 --- a/lib/pages/pharmacies/compare-list.dart +++ b/lib/pages/pharmacies/compare-list.dart @@ -16,7 +16,7 @@ class CompareList with ChangeNotifier { ); } else { for (int i = 0; i < _product.length; i++) { - if (_product.length <= 4 && _product[i].id != data.id) { + if (_product.length < 4 && _product[i].id != data.id) { _product.add(data); AppToast.showSuccessToast(message:TranslationBase.of(context).addToCompareMsg // 'You have added a product to the Compare list' diff --git a/lib/pages/pharmacies/compare.dart b/lib/pages/pharmacies/compare.dart index f458304f..34b21001 100644 --- a/lib/pages/pharmacies/compare.dart +++ b/lib/pages/pharmacies/compare.dart @@ -1,4 +1,5 @@ import 'package:diplomaticquarterapp/config/shared_pref_kay.dart'; +import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; import 'package:diplomaticquarterapp/pages/base/base_view.dart'; import 'package:flutter/material.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; @@ -113,6 +114,7 @@ class slideDetail extends StatefulWidget { class _slideDetailState extends State { @override Widget build(BuildContext context) { + ProjectViewModel projectViewModel = Provider.of(context); return ListView.builder( scrollDirection: Axis.horizontal, itemCount: widget.data.length, @@ -122,7 +124,7 @@ class _slideDetailState extends State { mainAxisAlignment: MainAxisAlignment.center, children: [ Container( - height: 750, + height: 760, width: 150, margin: EdgeInsets.symmetric(horizontal: 10.0), decoration: BoxDecoration( @@ -171,10 +173,10 @@ class _slideDetailState extends State { ), Container( margin: EdgeInsets.all(5), - child: Align( + child:Align( alignment: Alignment.topLeft, child: RichText( - text: languageID == "ar"? TextSpan( + text: projectViewModel.isArabic ? TextSpan( text: widget.data[index].namen, style: TextStyle( fontWeight: FontWeight.bold, @@ -193,8 +195,9 @@ class _slideDetailState extends State { ), Container( margin: EdgeInsets.all(5), - child: Align( - alignment: Alignment.topLeft, + child: projectViewModel.isArabic ? + Align( + alignment: Alignment.topRight, child: RichText( text: TextSpan( text: "SAR ${widget.data[index].price.toString()}", @@ -204,8 +207,20 @@ class _slideDetailState extends State { fontWeight: FontWeight.bold), ), ), + ): + Align( + alignment: Alignment.topLeft, + child: RichText( + text: TextSpan( + text: "SAR ${widget.data[index].price.toString()}", + style: TextStyle( + color: Colors.black54, + fontSize: 15, + fontWeight: FontWeight.bold), + ), ), ), + ), Padding( padding: EdgeInsets.only(top: 8.0), child: Container( @@ -216,58 +231,61 @@ class _slideDetailState extends State { ), Container( margin: EdgeInsets.all(5), - child: Align( - alignment: Alignment.topLeft, + child: projectViewModel.isArabic ? + Align( + alignment: Alignment.topRight, child: RichText( - text: languageID == "ar"? TextSpan( + text: TextSpan( text: widget.data[index].specifications != null ? - widget.data[index].specifications[0].nameN : -// "No data", - TranslationBase.of(context).no_data, + widget.data[index].specifications[0].nameN :"", style: TextStyle( fontWeight: FontWeight.bold, color: Colors.black, fontSize: 13), ) - :TextSpan( + ), + ): Align( + alignment: Alignment.topLeft, + child: RichText( + text: TextSpan( text: widget.data[index].specifications != null ? - widget.data[index].specifications[0].name : -// "No data", - TranslationBase.of(context).no_data, + widget.data[index].specifications[0].name :"", style: TextStyle( fontWeight: FontWeight.bold, color: Colors.black, fontSize: 13), - ), + ) ), - ), + ) ), Container( margin: EdgeInsets.all(5), - child: Align( - alignment: Alignment.topLeft, + child: projectViewModel.isArabic ? + Align( + alignment: Alignment.topRight, child: RichText( - text: languageID == "ar"? TextSpan( + text:TextSpan( text: widget.data[index].specifications != null ? - widget.data[index].specifications[0].defaultValuen : -// "No data", - TranslationBase.of(context).no_data, + widget.data[index].specifications[0].defaultValuen:"", style: TextStyle( color: Colors.black54, fontSize: 15, fontWeight: FontWeight.bold), - ):TextSpan( + ) + ), + ):Align( + alignment: Alignment.topLeft, + child: RichText( + text:TextSpan( text: widget.data[index].specifications != null ? - widget.data[index].specifications[0].defaultValue : -// "No data", - TranslationBase.of(context).no_data, + widget.data[index].specifications[0].defaultValue:"", style: TextStyle( color: Colors.black54, fontSize: 15, fontWeight: FontWeight.bold), - ), + ) ), - ), + ) ), Padding( padding: EdgeInsets.only(top: 8.0), @@ -278,58 +296,62 @@ class _slideDetailState extends State { ), ), Container( - margin: EdgeInsets.all(5), - child: Align( - alignment: Alignment.topLeft, - child: RichText( - text: languageID == "ar"? TextSpan( - text: widget.data[index].specifications != null ? - widget.data[index].specifications[1].nameN : -// "No data", - TranslationBase.of(context).no_data, - style: TextStyle( - fontWeight: FontWeight.bold, - color: Colors.black, - fontSize: 13), - ):TextSpan( - text: widget.data[index].specifications != null ? - widget.data[index].specifications[1].name : -// "No data", - TranslationBase.of(context).no_data, - style: TextStyle( - fontWeight: FontWeight.bold, - color: Colors.black, - fontSize: 13), + margin: EdgeInsets.all(5), + child: projectViewModel.isArabic ? + Align( + alignment: Alignment.topRight, + child: RichText( + text: TextSpan( + text: widget.data[index].specifications != null ? + widget.data[index].specifications[1].nameN :"", + style: TextStyle( + fontWeight: FontWeight.bold, + color: Colors.black, + fontSize: 13), + ) ), - ), - ), + ): Align( + alignment: Alignment.topLeft, + child: RichText( + text: TextSpan( + text: widget.data[index].specifications != null ? + widget.data[index].specifications[1].name :"", + style: TextStyle( + fontWeight: FontWeight.bold, + color: Colors.black, + fontSize: 13), + ) + ), + ) ), Container( - margin: EdgeInsets.all(5), - child: Align( - alignment: Alignment.topLeft, - child: RichText( - text: languageID == "ar"? TextSpan( - text: widget.data[index].specifications != null ? - widget.data[index].specifications[1].defaultValuen : -// "No data", - TranslationBase.of(context).no_data, - style: TextStyle( - color: Colors.black54, - fontSize: 15, - fontWeight: FontWeight.bold), - ):TextSpan( - text: widget.data[index].specifications != null ? - widget.data[index].specifications[1].defaultValue : -// "No data", - TranslationBase.of(context).no_data, - style: TextStyle( - color: Colors.black54, - fontSize: 15, - fontWeight: FontWeight.bold), + margin: EdgeInsets.all(5), + child: projectViewModel.isArabic ? + Align( + alignment: Alignment.topRight, + child: RichText( + text:TextSpan( + text: widget.data[index].specifications != null ? + widget.data[index].specifications[1].defaultValuen:"", + style: TextStyle( + color: Colors.black54, + fontSize: 15, + fontWeight: FontWeight.bold), + ) ), - ), - ), + ):Align( + alignment: Alignment.topLeft, + child: RichText( + text:TextSpan( + text: widget.data[index].specifications != null ? + widget.data[index].specifications[1].defaultValue:"", + style: TextStyle( + color: Colors.black54, + fontSize: 15, + fontWeight: FontWeight.bold), + ) + ), + ) ), Padding( padding: EdgeInsets.only(top: 8.0), @@ -340,58 +362,62 @@ class _slideDetailState extends State { ), ), Container( - margin: EdgeInsets.all(5), - child: Align( - alignment: Alignment.topLeft, - child: RichText( - text: languageID == "ar"? TextSpan( - text: widget.data[index].specifications != null ? - widget.data[index].specifications[2].nameN : -// "No data", - TranslationBase.of(context).no_data, - style: TextStyle( - fontWeight: FontWeight.bold, - color: Colors.black, - fontSize: 13), - ):TextSpan( - text: widget.data[index].specifications != null ? - widget.data[index].specifications[2].name : -// "No data", - TranslationBase.of(context).no_data, - style: TextStyle( - fontWeight: FontWeight.bold, - color: Colors.black, - fontSize: 13), + margin: EdgeInsets.all(5), + child: projectViewModel.isArabic ? + Align( + alignment: Alignment.topRight, + child: RichText( + text: TextSpan( + text: widget.data[index].specifications != null ? + widget.data[index].specifications[2].nameN :"", + style: TextStyle( + fontWeight: FontWeight.bold, + color: Colors.black, + fontSize: 13), + ) ), - ), - ), + ): Align( + alignment: Alignment.topLeft, + child: RichText( + text: TextSpan( + text: widget.data[index].specifications != null ? + widget.data[index].specifications[2].name :"", + style: TextStyle( + fontWeight: FontWeight.bold, + color: Colors.black, + fontSize: 13), + ) + ), + ) ), Container( - margin: EdgeInsets.all(5), - child: Align( - alignment: Alignment.topLeft, - child: RichText( - text: languageID == "ar"? TextSpan( - text: widget.data[index].specifications != null ? - widget.data[index].specifications[2].defaultValuen : -// "No data", - TranslationBase.of(context).no_data, - style: TextStyle( - color: Colors.black54, - fontSize: 15, - fontWeight: FontWeight.bold), - ):TextSpan( - text: widget.data[index].specifications != null ? - widget.data[index].specifications[2].defaultValue : -// "No data", - TranslationBase.of(context).no_data, - style: TextStyle( - color: Colors.black54, - fontSize: 15, - fontWeight: FontWeight.bold), + margin: EdgeInsets.all(5), + child: projectViewModel.isArabic ? + Align( + alignment: Alignment.topRight, + child: RichText( + text:TextSpan( + text: widget.data[index].specifications != null ? + widget.data[index].specifications[2].defaultValuen:"", + style: TextStyle( + color: Colors.black54, + fontSize: 15, + fontWeight: FontWeight.bold), + ) ), - ), - ), + ):Align( + alignment: Alignment.topLeft, + child: RichText( + text:TextSpan( + text: widget.data[index].specifications != null ? + widget.data[index].specifications[2].defaultValue:"", + style: TextStyle( + color: Colors.black54, + fontSize: 15, + fontWeight: FontWeight.bold), + ) + ), + ) ), Padding( padding: EdgeInsets.only(top: 8.0), @@ -402,58 +428,62 @@ class _slideDetailState extends State { ), ), Container( - margin: EdgeInsets.all(5), - child: Align( - alignment: Alignment.topLeft, - child: RichText( - text: languageID == "ar"? TextSpan( - text: widget.data[index].specifications != null ? - widget.data[index].specifications[3].nameN : -// "No data", - TranslationBase.of(context).no_data, - style: TextStyle( - fontWeight: FontWeight.bold, - color: Colors.black, - fontSize: 13), - ):TextSpan( - text: widget.data[index].specifications != null ? - widget.data[index].specifications[3].name : -// "No data", - TranslationBase.of(context).no_data, - style: TextStyle( - fontWeight: FontWeight.bold, - color: Colors.black, - fontSize: 13), + margin: EdgeInsets.all(5), + child: projectViewModel.isArabic ? + Align( + alignment: Alignment.topRight, + child: RichText( + text: TextSpan( + text: widget.data[index].specifications != null ? + widget.data[index].specifications[3].nameN :"", + style: TextStyle( + fontWeight: FontWeight.bold, + color: Colors.black, + fontSize: 13), + ) ), - ), - ), + ): Align( + alignment: Alignment.topLeft, + child: RichText( + text: TextSpan( + text: widget.data[index].specifications != null ? + widget.data[index].specifications[3].name :"", + style: TextStyle( + fontWeight: FontWeight.bold, + color: Colors.black, + fontSize: 13), + ) + ), + ) ), Container( - margin: EdgeInsets.all(5), - child: Align( - alignment: Alignment.topLeft, - child: RichText( - text: languageID == "ar"? TextSpan( - text: widget.data[index].specifications != null ? - widget.data[index].specifications[3].defaultValuen : -// "No data", - TranslationBase.of(context).no_data, - style: TextStyle( - color: Colors.black54, - fontSize: 15, - fontWeight: FontWeight.bold), - ):TextSpan( - text: widget.data[index].specifications != null ? - widget.data[index].specifications[3].defaultValue : -// "No data", - TranslationBase.of(context).no_data, - style: TextStyle( - color: Colors.black54, - fontSize: 15, - fontWeight: FontWeight.bold), + margin: EdgeInsets.all(5), + child: projectViewModel.isArabic ? + Align( + alignment: Alignment.topRight, + child: RichText( + text:TextSpan( + text: widget.data[index].specifications != null ? + widget.data[index].specifications[3].defaultValuen:"", + style: TextStyle( + color: Colors.black54, + fontSize: 15, + fontWeight: FontWeight.bold), + ) ), - ), - ), + ):Align( + alignment: Alignment.topLeft, + child: RichText( + text:TextSpan( + text: widget.data[index].specifications != null ? + widget.data[index].specifications[3].defaultValue:"", + style: TextStyle( + color: Colors.black54, + fontSize: 15, + fontWeight: FontWeight.bold), + ) + ), + ) ), Padding( padding: EdgeInsets.only(top: 8.0), @@ -464,58 +494,62 @@ class _slideDetailState extends State { ), ), Container( - margin: EdgeInsets.all(5), - child: Align( - alignment: Alignment.topLeft, - child: RichText( - text: languageID == "ar"? TextSpan( - text: widget.data[index].specifications != null ? - widget.data[index].specifications[4].nameN : -// "No data", - TranslationBase.of(context).no_data, - style: TextStyle( - fontWeight: FontWeight.bold, - color: Colors.black, - fontSize: 13), - ):TextSpan( - text: widget.data[index].specifications != null ? - widget.data[index].specifications[4].name : -// "No data", - TranslationBase.of(context).no_data, - style: TextStyle( - fontWeight: FontWeight.bold, - color: Colors.black, - fontSize: 13), + margin: EdgeInsets.all(5), + child: projectViewModel.isArabic ? + Align( + alignment: Alignment.topRight, + child: RichText( + text: TextSpan( + text: widget.data[index].specifications != null ? + widget.data[index].specifications[4].nameN :"", + style: TextStyle( + fontWeight: FontWeight.bold, + color: Colors.black, + fontSize: 13), + ) ), - ), - ), + ): Align( + alignment: Alignment.topLeft, + child: RichText( + text: TextSpan( + text: widget.data[index].specifications != null ? + widget.data[index].specifications[4].name :"", + style: TextStyle( + fontWeight: FontWeight.bold, + color: Colors.black, + fontSize: 13), + ) + ), + ) ), Container( - margin: EdgeInsets.all(5), - child: Align( - alignment: Alignment.topLeft, - child: RichText( - text: languageID == "ar"? TextSpan( - text: widget.data[index].specifications != null ? - widget.data[index].specifications[4].defaultValuen : -// "No data", - TranslationBase.of(context).no_data, - style: TextStyle( - color: Colors.black54, - fontSize: 15, - fontWeight: FontWeight.bold), - ):TextSpan( - text: widget.data[index].specifications != null ? - widget.data[index].specifications[4].defaultValue : -// "No data", - TranslationBase.of(context).no_data, - style: TextStyle( - color: Colors.black54, - fontSize: 15, - fontWeight: FontWeight.bold), + margin: EdgeInsets.all(5), + child: projectViewModel.isArabic ? + Align( + alignment: Alignment.topRight, + child: RichText( + text:TextSpan( + text: widget.data[index].specifications != null ? + widget.data[index].specifications[4].defaultValuen:"", + style: TextStyle( + color: Colors.black54, + fontSize: 15, + fontWeight: FontWeight.bold), + ) ), - ), - ), + ):Align( + alignment: Alignment.topLeft, + child: RichText( + text:TextSpan( + text: widget.data[index].specifications != null ? + widget.data[index].specifications[4].defaultValue:"", + style: TextStyle( + color: Colors.black54, + fontSize: 15, + fontWeight: FontWeight.bold), + ) + ), + ) ), Padding( padding: EdgeInsets.only(top: 8.0), @@ -526,67 +560,64 @@ class _slideDetailState extends State { ), ), Container( - margin: EdgeInsets.all(5), - child: Align( - alignment: Alignment.topLeft, - child: RichText( - text: languageID == "ar"? TextSpan( - text: widget.data[index].specifications != null ? - widget.data[index].specifications[5].nameN : -// "No data", - TranslationBase.of(context).no_data, - style: TextStyle( - fontWeight: FontWeight.bold, - color: Colors.black, - fontSize: 13), - ):TextSpan( - text: widget.data[index].specifications != null ? - widget.data[index].specifications[5].name : -// "No data", - TranslationBase.of(context).no_data, - style: TextStyle( - fontWeight: FontWeight.bold, - color: Colors.black, - fontSize: 13), + margin: EdgeInsets.all(5), + child: projectViewModel.isArabic ? + Align( + alignment: Alignment.topRight, + child: RichText( + text: TextSpan( + text: widget.data[index].specifications != null ? + widget.data[index].specifications[5].nameN :"", + style: TextStyle( + fontWeight: FontWeight.bold, + color: Colors.black, + fontSize: 13), + ) ), - ), - ), + ): Align( + alignment: Alignment.topLeft, + child: RichText( + text: TextSpan( + text: widget.data[index].specifications != null ? + widget.data[index].specifications[5].name :"", + style: TextStyle( + fontWeight: FontWeight.bold, + color: Colors.black, + fontSize: 13), + ) + ), + ) ), Container( - margin: EdgeInsets.all(5), - child: Align( - alignment: Alignment.topLeft, - child: RichText( - text: languageID == "ar"? TextSpan( - text: widget.data[index].specifications != null ? - widget.data[index].specifications[5].defaultValuen : -// "No data", - TranslationBase.of(context).no_data, - style: TextStyle( - color: Colors.black54, - fontSize: 15, - fontWeight: FontWeight.bold), - ):TextSpan( - text: widget.data[index].specifications != null ? - widget.data[index].specifications[5].defaultValue : -// "No data", - TranslationBase.of(context).no_data, - style: TextStyle( - color: Colors.black54, - fontSize: 15, - fontWeight: FontWeight.bold), + margin: EdgeInsets.all(5), + child: projectViewModel.isArabic ? + Align( + alignment: Alignment.topRight, + child: RichText( + text:TextSpan( + text: widget.data[index].specifications != null ? + widget.data[index].specifications[5].defaultValuen:"", + style: TextStyle( + color: Colors.black54, + fontSize: 15, + fontWeight: FontWeight.bold), + ) ), - ), - ), - ), - Padding( - padding: EdgeInsets.only(top: 8.0), - child: Container( - height: 1.0, - width: 300.0, - color: Colors.grey, - ), + ):Align( + alignment: Alignment.topLeft, + child: RichText( + text:TextSpan( + text: widget.data[index].specifications != null ? + widget.data[index].specifications[5].defaultValue:"", + style: TextStyle( + color: Colors.black54, + fontSize: 15, + fontWeight: FontWeight.bold), + ) + ), + ) ), + ], ), ), diff --git a/lib/pages/pharmacies/screens/cart-page/cart-order-page.dart b/lib/pages/pharmacies/screens/cart-page/cart-order-page.dart index df44c706..7a252bd6 100644 --- a/lib/pages/pharmacies/screens/cart-page/cart-order-page.dart +++ b/lib/pages/pharmacies/screens/cart-page/cart-order-page.dart @@ -412,7 +412,7 @@ class _OrderBottomWidgetState extends State { if (widget.model.isCartItemsOutOfStock()) {AppToast.showErrorToast(message: TranslationBase.of(context).outOfStockMsg)} else - {_navigateToAddressPage(widget.model.user.patientIdentificationNo)} + {_navigateToAddressPage(projectProvider.user.patientIdentificationNo)} } : null, child: new Text( diff --git a/lib/pages/pharmacies/screens/cart-page/cart-order-preview.dart b/lib/pages/pharmacies/screens/cart-page/cart-order-preview.dart index 0110984c..dc8dc0d7 100644 --- a/lib/pages/pharmacies/screens/cart-page/cart-order-preview.dart +++ b/lib/pages/pharmacies/screens/cart-page/cart-order-preview.dart @@ -1,9 +1,12 @@ +import 'dart:ui'; + import 'package:diplomaticquarterapp/core/model/pharmacies/Addresses.dart'; import 'package:diplomaticquarterapp/core/viewModels/pharmacyModule/OrderPreviewViewModel.dart'; import 'package:diplomaticquarterapp/pages/pharmacies/screens/cart-page/payment_bottom_widget.dart'; import 'package:diplomaticquarterapp/pages/pharmacies/screens/cart-page/select_address_widget.dart'; import 'package:diplomaticquarterapp/pages/pharmacies/screens/cart-page/select_payment_option_widget.dart'; import 'package:diplomaticquarterapp/pages/pharmacies/widgets/ProductOrderPreviewItem.dart'; +import 'package:diplomaticquarterapp/theme/colors.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; import 'package:diplomaticquarterapp/widgets/in_app_browser/InAppBrowser.dart'; @@ -17,8 +20,11 @@ class OrderPreviewPage extends StatefulWidget { final List addresses; final OrderPreviewViewModel model; + + OrderPreviewPage({this.addresses, this.model}); + @override _OrderPreviewPageState createState() => _OrderPreviewPageState(); } @@ -26,6 +32,10 @@ class OrderPreviewPage extends StatefulWidget { class _OrderPreviewPageState extends State { MyInAppBrowser browser; bool isLoading = true; + bool isChecked = false; + + + @override void initState() { @@ -40,6 +50,7 @@ class _OrderPreviewPageState extends State { }); } + @override Widget build(BuildContext context) { final mediaQuery = MediaQuery.of(context); @@ -71,16 +82,99 @@ class _OrderPreviewPageState extends State { height: 10, ), widget.model.paymentCheckoutData.lacumInformation != null - ? Container( - child: Column( - children: [ - LakumWidget(widget.model), - SizedBox( - height: 10, + ? AbsorbPointer( + absorbing: true, + child: Stack( + children: [ + Container( + child: Column( + children: [ + // LakumWidget(widget.model), + Container( + color: Colors.white, + padding: EdgeInsets.symmetric(vertical: 12, horizontal: 12), + child: Row( + children: [ + Row( + children: [ + SizedBox( + height: 24.0, + width: 24.0, + child: Checkbox( + activeColor: CustomColors.green, + value: isChecked, + onChanged: (bool value) { + setState(() { + isChecked = value; + print(isChecked); + if (value){ + // isChecked; + PaymentBottomWidget.isChecked = true; + print(value); + }else{ + PaymentBottomWidget.isChecked = false; + } + setState(() { + }); + }); + }, + ), + ), + Padding( + padding: const EdgeInsets.only(left: 8.0, right: 8.0), + child: Text( + TranslationBase.of(context).useLakumPoints + + " (${widget.model.paymentCheckoutData.lacumInformation.lakumInquiryInformationObjVersion.pointsBalance.toString() + " " + TranslationBase.of(context).points})", + style: TextStyle(fontSize: 12.0, fontWeight: FontWeight.w600, letterSpacing: -0.56)), + ), + ], + ), + Expanded( + child: Container( + decoration: BoxDecoration(color: Color(0x99ffffff)), + padding: const EdgeInsets.symmetric(horizontal: 8), + child: Row( + mainAxisAlignment: MainAxisAlignment.end, + children: [ + Container( + decoration: BoxDecoration(color: Color(0x99ffffff)), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Texts( + "${TranslationBase.of(context).availableBalance}", + fontSize: 12, + fontWeight: FontWeight.bold, + ), + Text( + "${TranslationBase.of(context).sar + " " + widget.model.paymentCheckoutData.lacumInformation.lakumInquiryInformationObjVersion.pointsBalanceAmount.toString()}", + style: TextStyle(fontSize: 12.0, fontWeight: FontWeight.w600, letterSpacing: -0.56) + ), + ], + ), + ), + ], + ), + + ), + ), + + ], + ), + ), + SizedBox( + height: 10, + ), + ], + ), ), - ], - ), - ) + Container( + height: MediaQuery.of(context).size.height * .10, + color: Colors.white.withOpacity(0.6), + ) + ], + ), + ) : Container(), Container( color: Colors.white, @@ -190,7 +284,49 @@ class _OrderPreviewPageState extends State { indent: 0, endIndent: 0, ), + isChecked ? Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Texts( + "${TranslationBase.of(context).lakum}", + fontSize: 14, + color: Colors.green, + fontWeight: FontWeight.w500, + ), + Texts( + "- ${TranslationBase.of(context).sar} ${(widget.model.paymentCheckoutData.lacumInformation.lakumInquiryInformationObjVersion.pointsBalanceAmount).toStringAsFixed(2)}", + fontSize: 14, + color: Colors.green, + fontWeight: FontWeight.w500, + ), + ], + ) : Container(), + isChecked ? const Divider( + color: Color(0xFFD6D6D6), + height: 20, + thickness: 1, + indent: 0, + endIndent: 0, + ): Container(), + isChecked ? Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Texts( + TranslationBase.of(context).total, + fontSize: 14, + color: Colors.black, + fontWeight: FontWeight.bold, + ), + Texts( + " ${TranslationBase.of(context).sar}""${(widget.model.cartResponse.totalAmount - widget.model.paymentCheckoutData.lacumInformation.lakumInquiryInformationObjVersion.pointsBalanceAmount).toStringAsFixed(2)}", + fontSize: 14, + color: Colors.black, + fontWeight: FontWeight.bold, + ), + ], + ) + : Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ Texts( @@ -200,7 +336,7 @@ class _OrderPreviewPageState extends State { fontWeight: FontWeight.bold, ), Texts( - "${TranslationBase.of(context).sar} ${(widget.model.cartResponse.totalAmount).toStringAsFixed(2)}", + " ${TranslationBase.of(context).sar} ${(widget.model.cartResponse.totalAmount).toStringAsFixed(2)}", fontSize: 14, color: Colors.black, fontWeight: FontWeight.bold, @@ -228,9 +364,12 @@ class _OrderPreviewPageState extends State { child: PaymentBottomWidget(widget.model), ), ); + } changeMainState() { setState(() {}); } + + } diff --git a/lib/pages/pharmacies/screens/cart-page/lakum_widget.dart b/lib/pages/pharmacies/screens/cart-page/lakum_widget.dart index 5d48fe1f..77c3d587 100644 --- a/lib/pages/pharmacies/screens/cart-page/lakum_widget.dart +++ b/lib/pages/pharmacies/screens/cart-page/lakum_widget.dart @@ -1,5 +1,8 @@ +import 'dart:ui'; + import 'package:diplomaticquarterapp/core/viewModels/pharmacyModule/OrderPreviewViewModel.dart'; import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; +import 'package:diplomaticquarterapp/pages/pharmacies/screens/cart-page/cart-order-preview.dart'; import 'package:diplomaticquarterapp/theme/colors.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; @@ -9,6 +12,7 @@ import 'package:provider/provider.dart'; class LakumWidget extends StatefulWidget { final OrderPreviewViewModel model; + LakumWidget(this.model); @override @@ -41,6 +45,15 @@ class _LakumWidgetState extends State { setState(() { useLakumWidgets = value; print(useLakumWidgets); +// if (value){ +// // isChecked; +// OrderPreviewPage.isChecked = true; +// print(value); +// }else{ +// OrderPreviewPage.isChecked = false; +// } + setState(() { + }); }); }, ), @@ -150,6 +163,25 @@ class _LakumWidgetState extends State { // ), ), ), +// useLakumWidgets ? +// Row( +// mainAxisAlignment: MainAxisAlignment.spaceBetween, +// children: [ +// Texts( +// "${TranslationBase.of(context).lakum}", +// fontSize: 14, +// color: Colors.black, +// fontWeight: FontWeight.w500, +// ), +// Texts( +// "${TranslationBase.of(context).sar} ${(widget.model.paymentCheckoutData.lacumInformation.lakumInquiryInformationObjVersion.pointsBalance).toStringAsFixed(2)}", +// fontSize: 14, +// color: Colors.black, +// fontWeight: FontWeight.w500, +// ), +// ], +// ) +// :Container() ], ), ); diff --git a/lib/pages/pharmacies/screens/cart-page/payment_bottom_widget.dart b/lib/pages/pharmacies/screens/cart-page/payment_bottom_widget.dart index 1931f3fa..00595711 100644 --- a/lib/pages/pharmacies/screens/cart-page/payment_bottom_widget.dart +++ b/lib/pages/pharmacies/screens/cart-page/payment_bottom_widget.dart @@ -16,6 +16,7 @@ import 'package:provider/provider.dart'; class PaymentBottomWidget extends StatelessWidget { final OrderPreviewViewModel model; + static bool isChecked = true; BuildContext context; MyInAppBrowser browser; @@ -42,6 +43,12 @@ class PaymentBottomWidget extends StatelessWidget { margin: EdgeInsets.symmetric(horizontal: 0, vertical: 4), child: Row( children: [ + isChecked ? Texts( + "${TranslationBase.of(context).sar} ${(model.cartResponse.totalAmount - model.paymentCheckoutData.lacumInformation.lakumInquiryInformationObjVersion.pointsBalanceAmount).toStringAsFixed(2)}", + fontSize: 14, + fontWeight: FontWeight.bold, + color: Color(0xff929295), + ): Texts( "${TranslationBase.of(context).sar} ${(model.cartResponse.totalAmount).toStringAsFixed(2)}", fontSize: 14, diff --git a/lib/pages/pharmacies/screens/lacum-transfer-page.dart b/lib/pages/pharmacies/screens/lacum-transfer-page.dart index b3995aca..057b444c 100644 --- a/lib/pages/pharmacies/screens/lacum-transfer-page.dart +++ b/lib/pages/pharmacies/screens/lacum-transfer-page.dart @@ -41,6 +41,9 @@ class _LacumTransferPageState extends State { isShowAppBar: true, isPharmacy: true, isShowDecPage: false, + showHomeAppBarIcon: false, + isBottomBar: true, + showPharmacyCart: false, backgroundColor: Colors.white, baseViewModel: model, body: Container( @@ -105,7 +108,7 @@ class _LacumTransferPageState extends State { CrossAxisAlignment.end, children: [ Texts( - "0", + "${model.lacumGroupInformation.lakumInquiryInformationObjVersion.pointsBalance}", fontSize: 14, fontWeight: FontWeight.bold, color: Colors.white, @@ -165,7 +168,7 @@ class _LacumTransferPageState extends State { CrossAxisAlignment.end, children: [ Texts( - "0", + "${model.lacumGroupInformation.lakumInquiryInformationObjVersion.pointsBalanceAmount}", fontSize: 14, fontWeight: FontWeight.bold, color: Colors.white, diff --git a/lib/pages/pharmacies/screens/lakum-main-page.dart b/lib/pages/pharmacies/screens/lakum-main-page.dart index 20b65c55..db441433 100644 --- a/lib/pages/pharmacies/screens/lakum-main-page.dart +++ b/lib/pages/pharmacies/screens/lakum-main-page.dart @@ -44,6 +44,8 @@ class LakumMainPage extends StatelessWidget { isPharmacy: true, showPharmacyCart: false, isShowDecPage: false, + showHomeAppBarIcon: false, + isBottomBar: true, backgroundColor: Colors.white, baseViewModel: model, appBarIcons: _buildAppBarICons(context, model), @@ -354,12 +356,12 @@ class LakumHomeButtons extends StatelessWidget { children: [ Expanded( child: InkWell( - onTap: () { - print("Account activate click"); - Navigator.push( - context, FadePage(page: LakumActivationVidaPage())) - .then((result) => {model.getLacumGroupData()}); - }, +// onTap: () { +// print("Account activate click"); +// Navigator.push( +// context, FadePage(page: LakumActivationVidaPage())) +// .then((result) => {model.getLacumGroupData()}); +// }, child: Container( padding: EdgeInsets.symmetric(horizontal: 8), decoration: BoxDecoration( diff --git a/lib/pages/pharmacies/screens/lakum-points-year-page.dart b/lib/pages/pharmacies/screens/lakum-points-year-page.dart index df333cdf..ba6e4537 100644 --- a/lib/pages/pharmacies/screens/lakum-points-year-page.dart +++ b/lib/pages/pharmacies/screens/lakum-points-year-page.dart @@ -66,7 +66,7 @@ class _LakumPointsYearPageState extends State { (index) => LakumPointTableRowWidget( false, widget.pointsAmountPerYear[widget.selectedIndexYear] - .pointsAmountPerMonth[index].month, + .pointsAmountPerMonth[index].month.toString(), widget.pointsAmountPerYear[widget.selectedIndexYear] .pointsAmountPerMonth[index].pointsPerMonth, widget.pointsAmountPerYear[widget.selectedIndexYear] diff --git a/lib/pages/pharmacies/screens/pharmacy_module_page.dart b/lib/pages/pharmacies/screens/pharmacy_module_page.dart index 1f90f454..8f500064 100644 --- a/lib/pages/pharmacies/screens/pharmacy_module_page.dart +++ b/lib/pages/pharmacies/screens/pharmacy_module_page.dart @@ -48,7 +48,7 @@ class _PharmacyPageState extends State { isMainPharmacyPages: true, isPharmacy: true, isShowPharmacyAppbar: true, - backgroundColor: Colors.white, + backgroundColor: Color(0xffFEFEFE), body: Container( width: double.infinity, child: SingleChildScrollView( diff --git a/lib/pages/pharmacies/screens/product-details/availability_info.dart b/lib/pages/pharmacies/screens/product-details/availability_info.dart index a5ba0956..209a97bf 100644 --- a/lib/pages/pharmacies/screens/product-details/availability_info.dart +++ b/lib/pages/pharmacies/screens/product-details/availability_info.dart @@ -1,13 +1,16 @@ import 'package:diplomaticquarterapp/core/viewModels/pharmacyModule/product_detail_view_model.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:flutter/material.dart'; -import 'package:maps_launcher/maps_launcher.dart'; +import 'package:flutter_inappwebview/flutter_inappwebview.dart'; +import 'package:map_launcher/map_launcher.dart'; import 'package:url_launcher/url_launcher.dart'; class AvailabilityInfo extends StatelessWidget { final ProductDetailViewModel previousModel; - const AvailabilityInfo({Key key, this.previousModel}) : super(key: key); + final InAppBrowser browser = new InAppBrowser(); + + AvailabilityInfo({Key key, this.previousModel}) : super(key: key); @override Widget build(BuildContext context) { @@ -20,8 +23,8 @@ class AvailabilityInfo extends StatelessWidget { ), ) : Container( - margin: EdgeInsets.only(bottom: 40), - child: ListView.builder( + margin: EdgeInsets.only(bottom: 40), + child: ListView.builder( physics: ScrollPhysics(), scrollDirection: Axis.vertical, shrinkWrap: true, @@ -53,8 +56,12 @@ class AvailabilityInfo extends StatelessWidget { child: IconButton( icon: Icon(Icons.location_on), color: Colors.red, - onPressed: () { - MapsLauncher.launchCoordinates(double.parse(previousModel.productLocationService[index].latitude), double.parse(previousModel.productLocationService[index].longitude), previousModel.productLocationService[index].locationDescription); + onPressed: () async { + await MapLauncher.showMarker( + mapType: MapType.google, + coords: Coords(double.parse(previousModel.productLocationService[index].latitude), double.parse(previousModel.productLocationService[index].longitude)), + title: previousModel.productLocationService[index].locationDescription, + ); }, ), ), @@ -76,7 +83,7 @@ class AvailabilityInfo extends StatelessWidget { ); }, ), - ); + ); } convertCityName(txt) { diff --git a/lib/pages/pharmacies/screens/product-details/footor/footer-widget.dart b/lib/pages/pharmacies/screens/product-details/footor/footer-widget.dart index e0cf8168..b0f6db78 100644 --- a/lib/pages/pharmacies/screens/product-details/footor/footer-widget.dart +++ b/lib/pages/pharmacies/screens/product-details/footor/footer-widget.dart @@ -45,10 +45,21 @@ class FooterWidget extends StatefulWidget { class _FooterWidgetState extends State { double quantityUI = 80; bool showUI = false; + + static final GlobalKey _key = GlobalKey(); AuthenticatedUserObject authenticatedUserObject = locator(); AppSharedPreferences sharedPref = new AppSharedPreferences(); + @override + void initState() { + super.initState(); + if (!isBuyNowDisable() || !isAddToCartDisable()) { + quantityUI = 160; + showUI = true; + } + } + @override Widget build(BuildContext context) { return Container( @@ -57,14 +68,25 @@ class _FooterWidgetState extends State { borderRadius: BorderRadius.all( Radius.circular(0.0), ), - border: Border.all(color: Color(0xFF707070), width: 0), + boxShadow: [ + BoxShadow( + color: Color(0xFFCCCCCC), + spreadRadius: 0, + blurRadius: 4, + offset: Offset(2, 2), // changes position of shadow + ), + ], + // border: Border.all(color: Color(0xFF707070), width: 0), ), width: double.infinity, height: quantityUI, child: Column( children: [ - showUI + !showUI ? Container( + height: 10, + ) + : Container( width: double.infinity, height: 100, color: Colors.white, @@ -81,11 +103,10 @@ class _FooterWidgetState extends State { Padding( padding: const EdgeInsets.all(8.0), child: Texts( - TranslationBase.of(context).productQuantity, + TranslationBase.of(context).productQuantity, fontSize: 15, fontWeight: FontWeight.bold, - color: Color(0xFF575757) - ), + color: Color(0xFF575757)), ), InkWell( child: Icon(Icons.close, color: Colors.black), @@ -119,8 +140,11 @@ class _FooterWidgetState extends State { color: Colors.white, ), child: TextField( - decoration: InputDecoration( - labelText: ' Quantity # '), + key: _key, + keyboardType: TextInputType.number, + textAlign: TextAlign.center, + decoration: + InputDecoration(hintText: ' Quantity # '), onChanged: (text) { if (int.tryParse(text) == null) { text = ''; @@ -144,9 +168,6 @@ class _FooterWidgetState extends State { ], ), ), - ) - : Container( - height: 10, ), Container( height: 58, @@ -219,12 +240,11 @@ class _FooterWidgetState extends State { ), Container( width: MediaQuery.of(context).size.width * 0.35, + margin: EdgeInsets.symmetric(vertical: 4.0), child: SecondaryButton( label: TranslationBase.of(context).addToCart, - disabled: (!widget.isAvailable && widget.quantity > 0) || - widget.quantity > widget.quantityLimit || - widget.item.isRx, - fontSize: 16, + disabled: isAddToCartDisable(), + fontSize: 15, onTap: () async { if (!authenticatedUserObject.isLogin) { login(); @@ -235,8 +255,10 @@ class _FooterWidgetState extends State { model: widget.model); }, fontWeight: FontWeight.w600, - borderColor: Color(0xFF4CAF50).withOpacity(0.7), borderRadius: 6, + disableColor: Color(0xFFD6D6D6), + textColor: + isAddToCartDisable() ? Color(0xFFACACAC) : Colors.white, color: Color(0xFF535353), ), ), @@ -245,12 +267,11 @@ class _FooterWidgetState extends State { ), Container( width: MediaQuery.of(context).size.width * 0.35, + margin: EdgeInsets.symmetric(vertical: 4.0), child: SecondaryButton( label: TranslationBase.of(context).buyNow, - fontSize: 16, - disabled: (!widget.isAvailable && widget.quantity > 0) || - (widget.quantity > widget.quantityLimit) || - widget.item.isRx, + fontSize: 15, + disabled: isBuyNowDisable(), onTap: () async { if (!authenticatedUserObject.isLogin) { login(); @@ -261,15 +282,12 @@ class _FooterWidgetState extends State { model: widget.model); } }, + textColor: + isBuyNowDisable() ? Color(0xFFACACAC) : Colors.white, fontWeight: FontWeight.w600, - borderColor: Colors.grey[800].withOpacity(0.7), borderRadius: 6, - disableColor: Colors.grey[700], - color: !widget.isAvailable && widget.quantity > 0 || - widget.quantity > widget.quantityLimit || - widget.item.isRx - ? Color(0xFF535353).withOpacity(0.7) - : Color(0xFF5AB145), + disableColor: Color(0xFFD6D6D6), + color: Color(0xFF5AB145), ), ), ], @@ -280,6 +298,18 @@ class _FooterWidgetState extends State { ); } + bool isBuyNowDisable() { + return (!widget.isAvailable && widget.quantity > 0) || + (widget.quantity > widget.quantityLimit) || + widget.item.isRx; + } + + bool isAddToCartDisable() { + return (!widget.isAvailable && widget.quantity > 0) || + widget.quantity > widget.quantityLimit || + widget.item.isRx; + } + void setUserValues(value) async { if (value != null) sharedPref.setObject(IMEI_USER_DATA, value); } diff --git a/lib/pages/pharmacies/screens/product-details/product-detail.dart b/lib/pages/pharmacies/screens/product-details/product-detail.dart index 52c1d64d..6799f30e 100644 --- a/lib/pages/pharmacies/screens/product-details/product-detail.dart +++ b/lib/pages/pharmacies/screens/product-details/product-detail.dart @@ -11,7 +11,6 @@ import 'package:diplomaticquarterapp/uitl/app_shared_preferences.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/widgets/data_display/text.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; import 'package:diplomaticquarterapp/widgets/text/app_texts_widget.dart'; import 'package:flutter/material.dart'; @@ -133,27 +132,32 @@ class __ProductDetailPageState extends State { ), ), ), - if(model.isStockAvailable!= null && !model.isStockAvailable) - Container( - height: MediaQuery.of(context).size.height * .40, - color: Colors.white.withOpacity(0.6), - // child: AppText("Out of Stock"), - ), - if(model.isStockAvailable!= null && !model.isStockAvailable) - Positioned( - // bottom: 10, - top: MediaQuery.of(context).size.height *.088, - left: MediaQuery.of(context).size.width *.32, - child: Center( - child: Container( - height: MediaQuery.of(context).size.height * .40, - // color: Colors.white.withOpacity(0.75), - child: RotationTransition( - turns: new AlwaysStoppedAnimation(310 / 360), - child: AppText(TranslationBase.of(context).productOutOfStock ,color:Color(0xFF000000).withOpacity(0.19),fontSize: projectViewModel.isArabic?40: 50, fontWeight: FontWeight.bold ,)), + if (model.isStockAvailable != null && !model.isStockAvailable) + Container( + height: MediaQuery.of(context).size.height * .40, + color: Colors.white.withOpacity(0.6), + // child: AppText("Out of Stock"), + ), + if (model.isStockAvailable != null && !model.isStockAvailable) + Positioned( + // bottom: 10, + top: MediaQuery.of(context).size.height * .088, + left: MediaQuery.of(context).size.width * .32, + child: Center( + child: Container( + height: MediaQuery.of(context).size.height * .40, + // color: Colors.white.withOpacity(0.75), + child: RotationTransition( + turns: new AlwaysStoppedAnimation(310 / 360), + child: AppText( + TranslationBase.of(context).productOutOfStock, + color: Color(0xFF000000).withOpacity(0.19), + fontSize: projectViewModel.isArabic ? 40 : 50, + fontWeight: FontWeight.bold, + )), + ), ), ), - ), ], ), if (widget.product.discountDescription != null) DiscountDescription(product: widget.product) @@ -233,7 +237,7 @@ class __ProductDetailPageState extends State { }, child: Text( TranslationBase.of(context).details, - style: TextStyle( fontWeight: FontWeight.w600, fontSize: 14, letterSpacing:-0.84), + style: TextStyle(fontWeight: FontWeight.w600, fontSize: 14, letterSpacing: -0.84), ), color: Colors.white, ), @@ -264,7 +268,7 @@ class __ProductDetailPageState extends State { }, child: Text( TranslationBase.of(context).reviews, - style: TextStyle( fontWeight: FontWeight.w600, fontSize: 14, letterSpacing:-0.84), + style: TextStyle(fontWeight: FontWeight.w600, fontSize: 14, letterSpacing: -0.84), ), color: Colors.white, ), @@ -279,7 +283,7 @@ class __ProductDetailPageState extends State { Column( children: [ FlatButton( - onPressed: model.isStockAvailable !=null && model.isStockAvailable + onPressed: model.isStockAvailable != null && model.isStockAvailable ? () async { GifLoaderDialogUtils.showMyDialog(context); await model.getProductLocationData(widget.product.sku); @@ -294,7 +298,7 @@ class __ProductDetailPageState extends State { : null, child: Text( TranslationBase.of(context).availability, - style: TextStyle( fontWeight: FontWeight.w600, fontSize: 14, letterSpacing:-0.84), + style: TextStyle(fontWeight: FontWeight.w600, fontSize: 14, letterSpacing: -0.84), ), color: Colors.white, ), diff --git a/lib/pages/pharmacies/screens/product-details/product-name-and-price.dart b/lib/pages/pharmacies/screens/product-details/product-name-and-price.dart index 3a6f5c8d..a71a5a1e 100644 --- a/lib/pages/pharmacies/screens/product-details/product-name-and-price.dart +++ b/lib/pages/pharmacies/screens/product-details/product-name-and-price.dart @@ -126,15 +126,45 @@ class _ProductNameAndPriceState extends State { widget.stockAvailability != null && !widget.isStockAvailable && widget.customerId != null - ? IconButton( - iconSize: 25, - icon: Icon(Icons.notifications_active), - color: new Color(0xff2E303A), - onPressed: () { - widget.notifyMeWhenAvailable( - context, widget.item.id); - }, - ) + ? Container( + child: Row( + children: [ + IconButton( + iconSize: 25, + icon: Icon(Icons.notifications_active), + color: new Color(0xff2E303A), + onPressed: () { + widget.notifyMeWhenAvailable( + context, widget.item.id); + }, + ), + IconButton( + icon: Icon(!widget.isInWishList + ? Icons.favorite_border + : Icons.favorite), + color: !widget.isInWishList + ? Color(0xff2E303A) + : Color(0xffD02127), + onPressed: () async { + { + if (widget.customerId != null) { + if (!widget.isInWishList) { + await widget + .addToWishlistFunction(widget.item.id); + } else { + await widget.deleteFromWishlistFunction( + widget.item.id); + } + } else { + return; + } + setState(() {}); + } + }, + ) + ], + ), + ) : IconButton( icon: Icon(!widget.isInWishList ? Icons.favorite_border diff --git a/lib/pages/pharmacies/screens/product-details/reviews_info.dart b/lib/pages/pharmacies/screens/product-details/reviews_info.dart index c4526790..52efd3e9 100644 --- a/lib/pages/pharmacies/screens/product-details/reviews_info.dart +++ b/lib/pages/pharmacies/screens/product-details/reviews_info.dart @@ -1,7 +1,9 @@ import 'package:diplomaticquarterapp/core/model/pharmacies/PharmacyProduct.dart'; import 'package:diplomaticquarterapp/core/viewModels/pharmacyModule/product_detail_view_model.dart'; +import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:flutter/material.dart'; +import 'package:provider/provider.dart'; import 'package:rating_bar/rating_bar.dart'; class ReviewsInfo extends StatelessWidget { @@ -13,6 +15,7 @@ class ReviewsInfo extends StatelessWidget { @override Widget build(BuildContext context) { + ProjectViewModel projectViewModel = Provider.of(context); return previousModel.productDetailService.length != 0 && previousModel.productDetailService[0].reviews.length != 0 ? ListView.builder( @@ -48,18 +51,36 @@ class ReviewsInfo extends StatelessWidget { ), ), Container( - margin: EdgeInsets.only(left: 210), - child: RatingBar.readOnly( - initialRating: previousModel - .productDetailService[0].reviews[index].rating - .toDouble(), - size: 15.0, - filledColor: Colors.yellow[700], - emptyColor: Colors.grey[500], - isHalfAllowed: true, - halfFilledIcon: Icons.star_half, - filledIcon: Icons.star, - emptyIcon: Icons.star, + // margin: EdgeInsets.only(left: 210), + child: projectViewModel.isArabic? + Align( + alignment: Alignment.topLeft, + child: RatingBar.readOnly( + initialRating: previousModel + .productDetailService[0].reviews[index].rating + .toDouble(), + size: 15.0, + filledColor: Colors.yellow[700], + emptyColor: Colors.grey[500], + isHalfAllowed: true, + halfFilledIcon: Icons.star_half, + filledIcon: Icons.star, + emptyIcon: Icons.star, + ), + ): Align( + alignment: Alignment.topRight, + child: RatingBar.readOnly( + initialRating: previousModel + .productDetailService[0].reviews[index].rating + .toDouble(), + size: 15.0, + filledColor: Colors.yellow[700], + emptyColor: Colors.grey[500], + isHalfAllowed: true, + halfFilledIcon: Icons.star_half, + filledIcon: Icons.star, + emptyIcon: Icons.star, + ), ), ), ], @@ -68,11 +89,14 @@ class ReviewsInfo extends StatelessWidget { SizedBox( height: 10, ), - Container( - child: Text( - previousModel - .productDetailService[0].reviews[index].reviewText, - style: TextStyle(fontSize: 20), + Padding( + padding: const EdgeInsets.all(8.0), + child: Container( + child: Text( + previousModel + .productDetailService[0].reviews[index].reviewText, + style: TextStyle(fontSize: 20), + ), ), ), SizedBox( diff --git a/lib/pages/pharmacies/search_brands_page.dart b/lib/pages/pharmacies/search_brands_page.dart index 7ffe8d26..72dc3907 100644 --- a/lib/pages/pharmacies/search_brands_page.dart +++ b/lib/pages/pharmacies/search_brands_page.dart @@ -54,26 +54,12 @@ class _SearchBrandsPageState extends State { fontSize: 19.0, prefixIcon: Icon(Icons.search), inputAction: TextInputAction.search, - inputFormatters: [ - FilteringTextInputFormatter.allow(RegExp(r'([A-Za-z0-9 a space])') -// ("[\u0621-\u064a-\ ]") - ) - ], - validator: (value) { - RegExp regExp = RegExp(r'([A-Za-z0-9 a space])'); - if (value.isEmpty) { - TranslationBase.of(context).pleaseEnterProductName; - }else if (!regExp.hasMatch(value)){ - AppToast.showErrorToast(message: TranslationBase.of(context).noArabicLetters); - } - return null; - }, onSaved: (value) { //searchMedicine(model, context); }, onSubmit: (value) { searchMedicine(model, context); - msg = TranslationBase.of(context).noResultFound; + msg = TranslationBase.of(context).noSearchResultFound; }, controller: textController, // validator: (value) { diff --git a/lib/pages/pharmacies/widgets/ProductTileItem.dart b/lib/pages/pharmacies/widgets/ProductTileItem.dart index fcdb0ad6..2c0582b7 100644 --- a/lib/pages/pharmacies/widgets/ProductTileItem.dart +++ b/lib/pages/pharmacies/widgets/ProductTileItem.dart @@ -79,12 +79,22 @@ class ProductTileItem extends StatelessWidget { ProjectViewModel projectProvider = Provider.of(context); return InkWell( onTap: () => productOnClick(context), - splashColor: Theme.of(context).primaryColor, child: Container( margin: EdgeInsets.all(7), decoration: BoxDecoration( - border: Border.all(color: Colors.grey.shade300, width: 0.5), - borderRadius: BorderRadius.circular(8)), + border: Border.all(color: Colors.grey.shade300, width: 0.2), + borderRadius: BorderRadius.circular(10), + color: Colors.white, + shape: BoxShape.rectangle, + boxShadow: [ + BoxShadow( + color: Color(0xffF1F1F1), + spreadRadius: 4, + blurRadius: 5.5, + offset: Offset(0, 3), // changes position of shadow + ), + ], + ), padding: EdgeInsets.symmetric(horizontal: 4), width: MediaQuery.of(context).size.width / 2.8, child: Column( @@ -114,135 +124,131 @@ class ProductTileItem extends StatelessWidget { width: double.infinity, height: MediaQuery.of(context).size.width * 0.3, padding: - EdgeInsets.only(left: 20, right: 20, top: 14, bottom: 14), + EdgeInsets.only(left: 10, right: 10, top: 7, bottom: 3.5), color: Colors.white, - child: InkWell( - onTap: () {}, - child: Container( - width: double.infinity, - height: double.infinity, - clipBehavior: Clip.antiAlias, - decoration: containerRadiusWithGradientServices(33, - lightColor: Colors.transparent, - darkColor: Colors.transparent), - child: Stack( - children: [ - Container( - width: double.infinity, - height: double.infinity, - //clipBehavior: Clip.antiAlias, - // decoration: projectProvider.isArabic - // ? containerBottomRightRadiusWithGradientForAr(0, lightColor: Colors.transparent, darkColor: Colors.transparent) - // : containerBottomRightRadiusWithGradient(0, lightColor: Colors.red, darkColor: CustomColors.green), - child: Stack( - children: [ - Container( - margin: EdgeInsets.fromLTRB(0, 0, 0, 0), - alignment: Alignment.center, - child: (item.images != null && - item.images.length > 0) - ? Image.network( - item.images[0].src, - fit: BoxFit.cover, - height: itemHeight / 2, - ) - : Image.asset( - "assets/images/no_image.png", - fit: BoxFit.cover, - height: itemHeight / 2, - ), + child: Container( + width: double.infinity, + height: double.infinity, + clipBehavior: Clip.antiAlias, + decoration: containerRadiusWithGradientServices(0.0, + prescriptionRequired: item.rxMessage != null, + isProduct: true, + isEnglish: !projectProvider.isArabic, + lightColor: Colors.transparent, + darkColor: Colors.transparent), + child: Stack( + children: [ + Stack( + children: [ + Container( + decoration: BoxDecoration( + border: Border.all( + color: Color(0xffF0F0F0), width: 1.0), + borderRadius: BorderRadius.only( + topRight: Radius.circular( + item.rxMessage != null && + projectProvider.isArabic + ? 20 + : 8), + bottomLeft: Radius.circular(8), + bottomRight: Radius.circular(8), + topLeft: Radius.circular(item.rxMessage != null && + !projectProvider.isArabic + ? 20 + : 8), ), - ], - ), - ), - if (item.rxMessage != null) - projectProvider.isArabic - ? Positioned( - right: -16, - top: 2, - child: Transform.rotate( - angle: math.pi / 4, - child: Container( - padding: EdgeInsets.only( - left: 18, right: 18, top: 6, bottom: 3), - color: CustomColors.accentColor, - child: Padding( - padding: EdgeInsets.all(2.0), - child: Text( - "الوصفة\n مطلوبة", - style: TextStyle( - color: Colors.white, - fontSize: 7.5, - height: 0.8, - fontWeight: FontWeight.bold, - letterSpacing: -0.27, - ), - ), - ), + ), + margin: EdgeInsets.fromLTRB(0, 0, 0, 0), + alignment: Alignment.center, + child: (item.images != null && item.images.length > 0) + ? Padding( + padding: EdgeInsets.all(12.0), + child: Image.network( + item.images[0].src, + fit: BoxFit.cover, + height: itemHeight / 2, + ), + ) + : Padding( + padding: EdgeInsets.all(8.0), + child: Image.asset( + "assets/images/no_image.png", + fit: BoxFit.cover, + height: itemHeight / 2, ), ), - ) - : Positioned( - left: -24, - top: 2, - child: Transform.rotate( - angle: -math.pi / 4, - child: Container( - padding: EdgeInsets.only( - left: 18, right: 18, top: 6, bottom: 3), - color: CustomColors.accentColor, + ), + ], + ), + if (item.rxMessage != null) + projectProvider.isArabic + ? Positioned( + right: -16, + top: 2, + child: Transform.rotate( + angle: math.pi / 4, + child: Container( + color: CustomColors.accentColor, + padding: EdgeInsets.only( + left: 18, right: 18, top: 6, bottom: 3), + child: Padding( + padding: EdgeInsets.all(2.0), child: Text( - "\n E-Prescription \n Is required", + "الوصفة\n مطلوبة", style: TextStyle( color: Colors.white, - fontSize: 7.5, - //letterSpacing: -0.27, - height: 1.2, + fontSize: 7.0, + height: 0.8, fontWeight: FontWeight.w600, + letterSpacing: -0.27, ), ), ), ), ), - ], - ), + ) + : Positioned( + left: -24, + top: 2, + child: Transform.rotate( + angle: -math.pi / 4, + child: Container( + padding: EdgeInsets.only( + left: 18, right: 18, top: 6, bottom: 3), + color: CustomColors.accentColor, + child: Text( + "\n E-Prescription \n Is required", + style: TextStyle( + color: Colors.white, + fontSize: 7.0, + //letterSpacing: -0.27, + height: 1.2, + fontWeight: FontWeight.w600, + ), + ), + ), + ), + ), + ], ), ), ), - - // Padding( - // padding: EdgeInsets.fromLTRB(1, 1, 1, 1), - // child: Container( - // width: item.rxMessage != null - // ? MediaQuery.of(context).size.width / 1.0 - // : 0, - // padding: EdgeInsets.fromLTRB(8, 2, 8, 2), - // decoration: BoxDecoration( - // color: Color(0xffb23838), - // ), - // child: item.rxMessage != null - // ? Texts( - // projectProvider.isArabic - // ? item.rxMessagen - // : item.rxMessage, - // color: Colors.white, - // regular: true, - // fontSize: 10, - // fontWeight: FontWeight.w400, - // ) - // : Texts(""), - // ), - // ), - // SizedBox(height: 4,), Padding( - padding: const EdgeInsets.symmetric(horizontal: 4.0), - child: Texts( - projectProvider.isArabic ? item.namen : item.name, - regular: true, - fontSize: 12, - fontWeight: FontWeight.w400, + padding: const EdgeInsets.symmetric(horizontal: 10.0), + child: Container( + height: MediaQuery.of(context).size.height * 0.075, + child: Texts( + projectProvider.isArabic ? item.namen : item.name, + //regular: true, + fontSize: 10, + color: Color(0xff2B353E), + fontWeight: FontWeight.w600, + ), ), ), + SizedBox( + height: 7.0, + ), Expanded( child: Container( margin: EdgeInsets.symmetric( @@ -251,43 +257,48 @@ class ProductTileItem extends StatelessWidget { ), child: Column( crossAxisAlignment: CrossAxisAlignment.start, - mainAxisAlignment: MainAxisAlignment.end, + //mainAxisAlignment: MainAxisAlignment.end, children: [ Padding( - padding: const EdgeInsets.only(top: 2, bottom: 2), + padding: const EdgeInsets.symmetric( + horizontal: 10, vertical: 2), child: Texts( "SAR ${item.price}", - fontWeight: FontWeight.w600, - fontSize: 14, + fontWeight: FontWeight.w700, + fontSize: 11, + color: Color(0xff2B353E), ), ), - Row( - children: [ - // Expanded( - RatingBar.readOnly( - initialRating: item.approvedRatingSum.toDouble(), - size: 15.0, - filledColor: Color(0xffD02127), - emptyColor: Colors.grey[500], - isHalfAllowed: true, - halfFilledIcon: Icons.star_half, - filledIcon: Icons.star, - emptyIcon: Icons.star, - ), - Texts( - "(${item.approvedTotalReviews})", - regular: true, - fontSize: 10, - fontWeight: FontWeight.w400, - ), + Padding( + padding: EdgeInsets.symmetric(horizontal: 5), + child: Row( + children: [ + // Expanded( + RatingBar.readOnly( + initialRating: item.approvedRatingSum.toDouble(), + size: 13.0, + filledColor: Color(0XFFD02127), + emptyColor: Color(0XFFD02127), + isHalfAllowed: true, + halfFilledIcon: Icons.star_half, + filledIcon: Icons.star, + emptyIcon: Icons.star_border, + ), + Texts( + "(${item.approvedTotalReviews})", + regular: true, + fontSize: 10, + fontWeight: FontWeight.w400, + ), - SizedBox( - width: 20.0, - ), - Icon( - Icons.arrow_forward, - size: 18, - ), + SizedBox( + width: 9.0, + ), + Icon( + Icons.arrow_forward, + size: 15, + color: Color(0xff2D2F39), + ), // StarRating( // totalAverage: item.approvedTotalReviews > 0 @@ -296,15 +307,16 @@ class ProductTileItem extends StatelessWidget { // .toDouble() // : 0, // forceStars: true), - // ), - ], + // ), + ], + ), ), ], ), ), ), SizedBox( - height: 5, + height: 1, ), ], ), diff --git a/lib/pages/pharmacies/widgets/home/BannerPager.dart b/lib/pages/pharmacies/widgets/home/BannerPager.dart index 6302f263..bf7ca715 100644 --- a/lib/pages/pharmacies/widgets/home/BannerPager.dart +++ b/lib/pages/pharmacies/widgets/home/BannerPager.dart @@ -4,6 +4,9 @@ import 'package:diplomaticquarterapp/core/viewModels/pharmacyModule/pharmacy_mod import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; import 'package:diplomaticquarterapp/pages/landing/home_page.dart'; import 'package:diplomaticquarterapp/pages/offers_categorise_page.dart'; +import 'package:diplomaticquarterapp/pages/pharmacies/screens/lacum-activitaion-vida-page.dart'; +import 'package:diplomaticquarterapp/pages/pharmacies/screens/lacum-registration-page.dart'; +import 'package:diplomaticquarterapp/pages/pharmacies/screens/lakum-main-page.dart'; import 'package:diplomaticquarterapp/pages/pharmacies/widgets/home/GridViewCard.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:diplomaticquarterapp/uitl/utils.dart'; @@ -50,7 +53,7 @@ class _BannerPagerState extends State { (item, index) { return InkWell( onTap: () { - Navigator.push(context, FadePage(page: OffersCategorisePage())); + bannerNavigator(index); }, child: Container( margin: EdgeInsets.symmetric(horizontal: 1.0), @@ -93,4 +96,28 @@ class _BannerPagerState extends State { ], )); } + + bannerNavigator(index){ + switch(index) { + case 1: { + Navigator.push(context, FadePage(page: OffersCategorisePage())); + } + break; + case 2: { + // Navigator.push(context, FadePage(page: LakumActivationVidaPage())); + Navigator.push(context, FadePage(page: LakumMainPage())); + } + break; + case 5: { + Navigator.push(context, FadePage(page: OffersCategorisePage())); + } + break; + + default: { + + } + break; + } + + } } diff --git a/lib/pages/pharmacies/widgets/home/BestSellerWidget.dart b/lib/pages/pharmacies/widgets/home/BestSellerWidget.dart index 780adba9..2fcab506 100644 --- a/lib/pages/pharmacies/widgets/home/BestSellerWidget.dart +++ b/lib/pages/pharmacies/widgets/home/BestSellerWidget.dart @@ -29,7 +29,7 @@ class BestSellerWidget extends StatelessWidget { )), if (model.state != ViewState.BusyLocal) Container( - height: MediaQuery.of(context).size.height / 3 + 20, + height: MediaQuery.of(context).size.height / 3 + 1, child: ListView.builder( itemBuilder: (ctx, i) => ProductTileItem( model.bestSellerProduct[i], diff --git a/lib/pages/pharmacies/widgets/home/MostViewedWidget.dart b/lib/pages/pharmacies/widgets/home/MostViewedWidget.dart index de34863d..01fea98e 100644 --- a/lib/pages/pharmacies/widgets/home/MostViewedWidget.dart +++ b/lib/pages/pharmacies/widgets/home/MostViewedWidget.dart @@ -31,7 +31,7 @@ class MostViewedWidget extends StatelessWidget { )), if (model.state != ViewState.BusyLocal) Container( - height: MediaQuery.of(context).size.height / 3 + 20, + height: MediaQuery.of(context).size.height / 3 + 1, child: ListView.builder( itemBuilder: (ctx, i) => ProductTileItem( model.mostViewedProducts[i], diff --git a/lib/pages/pharmacies/widgets/home/RecentlyViewedWidget.dart b/lib/pages/pharmacies/widgets/home/RecentlyViewedWidget.dart index 3c2cb710..f03c384d 100644 --- a/lib/pages/pharmacies/widgets/home/RecentlyViewedWidget.dart +++ b/lib/pages/pharmacies/widgets/home/RecentlyViewedWidget.dart @@ -31,7 +31,7 @@ class RecentlyViewedWidget extends StatelessWidget { if (model.state != ViewState.BusyLocal) Container( height: model.lastVisitedProducts.length > 0 - ? MediaQuery.of(context).size.height / 3 + 20 + ? MediaQuery.of(context).size.height / 3 + 1 : 0, child: ListView.builder( itemBuilder: (ctx, i) => ProductTileItem( diff --git a/lib/pages/pharmacies/widgets/home/ViewAllHomeWidget.dart b/lib/pages/pharmacies/widgets/home/ViewAllHomeWidget.dart index 1289e733..2b73a15a 100644 --- a/lib/pages/pharmacies/widgets/home/ViewAllHomeWidget.dart +++ b/lib/pages/pharmacies/widgets/home/ViewAllHomeWidget.dart @@ -18,8 +18,9 @@ class ViewAllHomeWidget extends StatelessWidget { children: [ Texts( title, - bold: true, - fontSize: 16, + color: Color(0xff2E303A), + fontWeight: FontWeight.w700, + fontSize: 19, ), InkWell( onTap: () { diff --git a/lib/pages/pharmacy/order/OrderDetails.dart b/lib/pages/pharmacy/order/OrderDetails.dart index 6b7c957e..5fc7f3b2 100644 --- a/lib/pages/pharmacy/order/OrderDetails.dart +++ b/lib/pages/pharmacy/order/OrderDetails.dart @@ -74,7 +74,7 @@ class _OrderDetailsPageState extends State { this.context = context; return BaseView( onModelReady: (model) { - model.getOrderDetails(widget.orderModel.id).then((value) { + model.getOrderDetails(widget.orderModel.id, widget.orderModel.orderGuid).then((value) { setState(() { isActiveDelivery = (value.orderStatusId == 995 && (value.driverID != null && value.driverID.isNotEmpty)); }); @@ -533,10 +533,6 @@ class _OrderDetailsPageState extends State { model.orderListModel[0].orderStatusId == 10 ? InkWell( onTap: () { - print(widget.orderModel.toString()); - print(model.orderListModel.toString()); - print("calc = ${5.9 * 3}"); - // TODO MOSA openPayment(model.orderListModel[0], model.user); }, child: Container( @@ -672,11 +668,6 @@ class _OrderDetailsPageState extends State { } } - /*** - * - * Online payment methods - */ - openPayment( OrderDetailModel order, AuthenticatedUser authenticatedUser, @@ -715,7 +706,7 @@ class _OrderDetailsPageState extends State { Navigator.pop(context); Navigator.pop(context); } else { - AppToast.showErrorToast(message: "Transaction Failed!\Your transaction is field to some reason please try again or contact to the administration"); + AppToast.showErrorToast(message: "Transaction Failed!\Your transaction is field to some reason please try again or contact to the administration\فشلت العملية حاول مره اخرى"); } } } diff --git a/lib/pages/pharmacy/order/ProductReview.dart b/lib/pages/pharmacy/order/ProductReview.dart index bb680864..04c67079 100644 --- a/lib/pages/pharmacy/order/ProductReview.dart +++ b/lib/pages/pharmacy/order/ProductReview.dart @@ -34,6 +34,8 @@ class _ProductReviewPageState extends State { appBarTitle: TranslationBase.of(context).writeReview, isShowAppBar: true, isPharmacy: true, + showPharmacyCart: false, + showHomeAppBarIcon: false, body: Container( color: Colors.white, child: !finishReview ? SingleChildScrollView( diff --git a/lib/pages/pharmacy/pharmacyAddresses/PharmacyAddresses.dart b/lib/pages/pharmacy/pharmacyAddresses/PharmacyAddresses.dart index 6a423b82..c5edac52 100644 --- a/lib/pages/pharmacy/pharmacyAddresses/PharmacyAddresses.dart +++ b/lib/pages/pharmacy/pharmacyAddresses/PharmacyAddresses.dart @@ -2,6 +2,7 @@ import 'package:diplomaticquarterapp/core/model/pharmacies/Addresses.dart'; import 'package:diplomaticquarterapp/core/service/AlHabibMedicalService/customer_addresses_service.dart'; import 'package:diplomaticquarterapp/core/viewModels/pharmacyModule/OrderPreviewViewModel.dart'; import 'package:diplomaticquarterapp/core/viewModels/pharmacyModule/PharmacyAddressesViewModel.dart'; +import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; import 'package:diplomaticquarterapp/pages/base/base_view.dart'; import 'package:diplomaticquarterapp/pages/pharmacies/screens/payment-method-select-page.dart'; import 'package:diplomaticquarterapp/pages/pharmacy/pharmacyAddresses/AddAddress.dart'; @@ -15,6 +16,7 @@ import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; +import 'package:provider/provider.dart'; ///TODO Elham* split this to tow files class PharmacyAddressesPage extends StatefulWidget { @@ -44,6 +46,7 @@ class _PharmacyAddressesState extends State { Widget build(BuildContext context) { final mediaQuery = MediaQuery.of(context); final height = mediaQuery.size.height - 60 - mediaQuery.padding.top; + ProjectViewModel projectProvider = Provider.of(context); return BaseView( onModelReady: (model) => model.getAddressesList(), @@ -127,7 +130,7 @@ class _PharmacyAddressesState extends State { GifLoaderDialogUtils.showMyDialog(context); - await widget.orderPreviewViewModel.getInformationsByAddress(widget.orderPreviewViewModel.user.patientIdentificationNo); + await widget.orderPreviewViewModel.getInformationsByAddress(projectProvider.user.patientIdentificationNo); if (widget.orderPreviewViewModel.error == "") { await widget.orderPreviewViewModel.getShoppingCart(); GifLoaderDialogUtils.hideDialog(context); @@ -175,7 +178,7 @@ class _PharmacyAddressesState extends State { } } -class AddressItemWidget extends StatelessWidget { +class AddressItemWidget extends StatefulWidget { final PharmacyAddressesViewModel model; final AddressInfo address; final Function selectAddress; @@ -184,6 +187,11 @@ class AddressItemWidget extends StatelessWidget { AddressItemWidget(this.model, this.address, this.selectAddress, this.isSelected, this.onTabEditAddress); + @override + _AddressItemWidgetState createState() => _AddressItemWidgetState(); +} + +class _AddressItemWidgetState extends State { @override Widget build(BuildContext context) { return Container( @@ -199,14 +207,14 @@ class AddressItemWidget extends StatelessWidget { crossAxisAlignment: CrossAxisAlignment.start, children: [ InkWell( - onTap: selectAddress, + onTap: widget.selectAddress, child: Container( margin: EdgeInsets.only(left: 16, right: 16), child: Padding( padding: const EdgeInsets.all(5.0), child: Container( decoration: new BoxDecoration( - color: !isSelected ? Colors.white : Colors.green, + color: !widget.isSelected ? Colors.white : Colors.green, shape: BoxShape.circle, border: Border.all(color: Colors.grey, style: BorderStyle.solid, width: 1.0), ), @@ -214,7 +222,7 @@ class AddressItemWidget extends StatelessWidget { padding: const EdgeInsets.all(0.0), child: Icon( Icons.check, - color: isSelected ? Colors.white : Colors.transparent, + color: widget.isSelected ? Colors.white : Colors.transparent, size: 25, ), ), @@ -234,7 +242,7 @@ class AddressItemWidget extends StatelessWidget { Padding( padding: const EdgeInsets.symmetric(vertical: 0), child: Texts( - "${address.firstName} ${address.lastName}", + "${widget.address.firstName} ${widget.address.lastName}", fontSize: 14, fontWeight: FontWeight.bold, color: Colors.black, @@ -243,7 +251,7 @@ class AddressItemWidget extends StatelessWidget { Padding( padding: const EdgeInsets.symmetric(vertical: 4), child: Texts( - "${address.address1} ${address.address2} ${address.address2},, ${address.city}, ${address.country} ${address.zipPostalCode}", + "${widget.address.address1} ${widget.address.address2} ${widget.address.address2},, ${widget.address.city}, ${widget.address.country} ${widget.address.zipPostalCode}", fontSize: 12, fontWeight: FontWeight.normal, color: Colors.grey.shade500, @@ -260,7 +268,7 @@ class AddressItemWidget extends StatelessWidget { ), ), Texts( - "${address.phoneNumber}", + "${widget.address.phoneNumber}", fontSize: 14, fontWeight: FontWeight.bold, color: Colors.grey, @@ -281,7 +289,7 @@ class AddressItemWidget extends StatelessWidget { borderColor: Colors.transparent, textColor: Color(0x990000FF), handler: () { - onTabEditAddress(address); + widget.onTabEditAddress(widget.address); }, icon: Icon( Icons.edit, @@ -306,19 +314,25 @@ class AddressItemWidget extends StatelessWidget { textColor: Color(0x99FF0000), handler: () { ConfirmDialog dialog = new ConfirmDialog( - context: context, - title: "Are you sure want to delete", - confirmMessage: "${address.address1} ${address.address2}", + // context: context, + title: TranslationBase.of(context).deleteAddress, + //"Are you sure want to delete", + confirmMessage: "${widget.address.address1} ${widget.address.address2}", okText: TranslationBase.of(context).delete, cancelText: TranslationBase.of(context).cancel_nocaps, okFunction: () => { - model.deleteAddresses(address).then((_) { + widget.model.deleteAddresses(widget.address).then((_) { ConfirmDialog.closeAlertDialog(context); - AppToast.showErrorToast(message: "Address has been deleted"); + AppToast.showErrorToast(message: TranslationBase.of(context).deletedAddress, + // "Address has been deleted" + ); }) }, cancelFunction: () => {}); dialog.showAlertDialog(context); + setState(() { + widget.model.deleteAddresses(widget.address); + }); }, icon: Icon( Icons.delete, diff --git a/lib/pages/pharmacy/pharmacyContacts.dart b/lib/pages/pharmacy/pharmacyContacts.dart new file mode 100644 index 00000000..a4ce3a56 --- /dev/null +++ b/lib/pages/pharmacy/pharmacyContacts.dart @@ -0,0 +1,258 @@ +import 'dart:io' show Platform; + +import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; +import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; +import 'package:flutter/material.dart'; +import 'package:flutter_svg/flutter_svg.dart'; +import 'package:maps_launcher/maps_launcher.dart'; +import 'package:url_launcher/url_launcher.dart'; +import 'package:map_launcher/map_launcher.dart'; +import 'dart:io' show Platform; + +class pharmacyContactsPage extends StatefulWidget { + @override + _pharmacyContactsPageState createState() => _pharmacyContactsPageState(); +} + +class _pharmacyContactsPageState extends State { + @override + Widget build(BuildContext context) { + final latitude = "24.704016"; + final longitude = "46.676691"; + final phone = "+966112833400"; + final whatsApp = "+966558434444"; + final whatappURL_android = "whatsapp://send?phone=" + whatsApp; + final whatappURL_ios = "https://wa.me/$whatsApp"; + final locationDescription = "Main Pharmacy OLAYA"; + + return AppScaffold( + appBarTitle: TranslationBase.of(context).contactUs, + isShowAppBar: true, + isShowDecPage: false, + isPharmacy: true, + showPharmacyCart: false, + showHomeAppBarIcon: false, + isMainPharmacyPages: true, + isBottomBar: true, + body: Column( + children: [ + Card( + elevation: 2, + shape: RoundedRectangleBorder( + side: BorderSide(color: Colors.grey[300], width: 2), + borderRadius: BorderRadius.circular(10), + ), + margin: EdgeInsets.symmetric( + horizontal: 8, + vertical: 8, + ), + child: Container( + margin: EdgeInsets.all(10), + padding: EdgeInsets.fromLTRB(5, 15, 5, 15), + decoration: BoxDecoration( + borderRadius: BorderRadius.all( + Radius.circular(15), + ), + ), + child: Column( + children: [ + Padding( + padding: const EdgeInsets.all(8.0), + child: Container( + child: Text(TranslationBase.of(context).contactUsTime, + style: TextStyle( + color: Colors.grey[700], + fontSize: 16, + fontWeight: FontWeight.w600, + letterSpacing: -0.68)), + ), + ), + SizedBox( + height: 35, + ), + Row( + children: [ + InkWell( + onTap: () { + launch("tel://" + phone); + }, + child: SvgPicture.asset( + 'assets/images/pharmacy/call.svg', + width: 20, + height: 20, + ), + ), + SizedBox( + width: 20, + ), + Text(TranslationBase.of(context).phone, + style: TextStyle( + color: Colors.grey[700], + fontSize: 16, + fontWeight: FontWeight.w600, + letterSpacing: -0.68)), + SizedBox( + width: 30, + ), + Text("+966 " + " -11- 2833400", + style: TextStyle( + color: Colors.grey[700], + fontSize: 16, + fontWeight: FontWeight.w600, + letterSpacing: -0.68)), + ], + ), + SizedBox( + height: 30, + ), + Row( + children: [ + InkWell( + onTap: () { + // launch('whatsapp://send?phone='+whatsApp); + openWhatsApp(); + }, + child: SvgPicture.asset( + 'assets/images/pharmacy/whatsapp.svg', + width: 20, + height: 20, + ), + ), + SizedBox( + width: 20, + ), + Text(TranslationBase.of(context).whatsApp, + style: TextStyle( + color: Colors.grey[700], + fontSize: 16, + fontWeight: FontWeight.w600, + letterSpacing: -0.68)), + SizedBox( + width: 30, + ), + Text("+966 " + " 558434444", + style: TextStyle( + color: Colors.grey[700], + fontSize: 16, + fontWeight: FontWeight.w600, + letterSpacing: -0.68)), + ], + ), + SizedBox( + height: 30, + ), + Padding( + padding: const EdgeInsets.all(5.0), + child: Row( + children: [ + InkWell( + onTap: () { + if (Platform.isIOS) { MapLauncher.showMarker( + mapType: MapType.apple, + coords: Coords(double.parse(latitude), + double.parse(longitude)), + title: locationDescription,); + } else { MapLauncher.showMarker( + mapType: MapType.google, + coords: Coords(double.parse(latitude), + double.parse(longitude)), + title: locationDescription, + // description: location.locationName, + ); } + // MapsLauncher.launchCoordinates(double.parse(previousModel.productLocationService[index].latitude), double.parse(previousModel.productLocationService[index].longitude), previousModel.productLocationService[index].locationDescription); + }, +// MapsLauncher.launchCoordinates( +// double.parse(latitude), +// double.parse(longitude)); +// }, + child: SvgPicture.asset( + 'assets/images/pharmacy/location.svg', + width: 20, + height: 20, + ), + ), + SizedBox( + width: 20, + ), + Expanded( + child: Text( + TranslationBase.of(context).contactUsLocation, + style: TextStyle( + color: Colors.grey[700], + fontSize: 16, + fontWeight: FontWeight.w600, + letterSpacing: -0.68)), + ), + ], + ), + ), + SizedBox( + height: 50, + ), + Center( + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceEvenly, + children: [ + IconButton( + icon: new Image.asset( + 'assets/images/new-design/facebook.png'), + tooltip: 'facebook', + iconSize: 48, + onPressed: () { + setState(() { + launch("https://facebook.com/HMG.pharmacy"); + // launch("https://www.facebook.com/DrSulaimanAlHabib?ref=tn_tnmn"); + }); + }, + ), + IconButton( + icon: new Image.asset( + 'assets/images/new-design/twitter.png'), + tooltip: 'Twitter', + iconSize: 48, + onPressed: () { + setState(() { + launch("https://twitter.com/HMG_pharmacy"); + }); + }, + ), + IconButton( + icon: new Image.asset( + 'assets/images/pharmacy/instagram.png'), + tooltip: 'Instagram', + iconSize: 48, + onPressed: () { + setState(() { + launch("https://instagram.com/HMG_pharmacy"); + }); + }, + ), + ]), + ) + ], + ), + ), + ), + ], + ), + ); + } + + openWhatsApp() async { + // bool Platform.isIOS = Theme.of(context).platform == TargetPlatform.iOS; + var whatsapp = "+966558434444"; + var whatsappURL_android = "whatsapp://send?phone=" + whatsapp; + var whatappURL_ios = "https://wa.me/$whatsapp"; + if (Platform.isIOS) { + // for iOS phone only + // if (await canLaunch(whatappURL_ios)) { + await launch(whatappURL_ios, forceSafariVC: false); + // } else {} + } else { + // android + // if (await canLaunch(whatsappURL_android)) { + await launch(whatsappURL_android); + // } else {} + } + } +} diff --git a/lib/pages/pharmacy/profile/profile.dart b/lib/pages/pharmacy/profile/profile.dart index 09522ba6..2c72c14e 100644 --- a/lib/pages/pharmacy/profile/profile.dart +++ b/lib/pages/pharmacy/profile/profile.dart @@ -16,6 +16,7 @@ import 'package:diplomaticquarterapp/pages/pharmacies/screens/pharmacy-terms-con import 'package:diplomaticquarterapp/pages/pharmacies/wishlist.dart'; import 'package:diplomaticquarterapp/pages/pharmacy/order/Order.dart'; import 'package:diplomaticquarterapp/pages/pharmacy/pharmacyAddresses/PharmacyAddresses.dart'; +import 'package:diplomaticquarterapp/pages/pharmacy/pharmacyContacts.dart'; import 'package:diplomaticquarterapp/uitl/app_shared_preferences.dart'; import 'package:diplomaticquarterapp/uitl/app_toast.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; @@ -473,8 +474,8 @@ class _ProfilePageState extends State { SizedBox( width: 10, ), - Text( - TranslationBase.of(context).conditionsHMG, + Text( TranslationBase.of(context).termOfService, + // TranslationBase.of(context).conditionsHMG, style: TextStyle( fontSize: 13.0, ), @@ -548,7 +549,7 @@ class _ProfilePageState extends State { ), InkWell( onTap: () { - Navigator.push(context, FadePage(page: LiveChatPage())); + Navigator.push(context, FadePage(page: pharmacyContactsPage())); }, child: Row( children: [ diff --git a/lib/pages/search_products_page.dart b/lib/pages/search_products_page.dart index 8ec9f014..d40d490f 100644 --- a/lib/pages/search_products_page.dart +++ b/lib/pages/search_products_page.dart @@ -11,12 +11,14 @@ import 'package:diplomaticquarterapp/widgets/input/text_field.dart'; import 'package:diplomaticquarterapp/widgets/others/StarRating.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_pharmacy_widget.dart'; import 'package:diplomaticquarterapp/widgets/others/network_base_view.dart'; +import 'package:diplomaticquarterapp/widgets/text/app_texts_widget.dart'; import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart'; import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; import 'package:provider/provider.dart'; import 'base/base_view.dart'; +import 'package:intl/intl.dart' as international; class SearchProductsPage extends StatefulWidget { @override @@ -27,6 +29,8 @@ class _SearchProductsPageState extends State { final textController = TextEditingController(); final _formKey = GlobalKey(); String msg = ''; + String validText = ""; + bool isTextValid = true; @override Widget build(BuildContext context) { @@ -61,41 +65,27 @@ class _SearchProductsPageState extends State { fontSize: 14.5, prefixIcon: Icon(Icons.search), inputAction: TextInputAction.search, - inputFormatters: [ - FilteringTextInputFormatter.allow( - RegExp(r'([A-Za-z0-9 a space])')) - ], - validator: (value) { - RegExp regExp = RegExp(r'([A-Za-z0-9 a space])'); - if (value.isEmpty) { - TranslationBase.of(context) - .pleaseEnterProductName; - } else if (!regExp.hasMatch(value)) { - AppToast.showErrorToast( - message: TranslationBase.of(context) - .noArabicLetters); - } - return null; - }, onSaved: (value) { //searchMedicine(model, context); }, onSubmit: (value) { searchMedicine(model, context); // msg = 'No Result Found'; - msg = TranslationBase.of(context).noResultFound; + msg = TranslationBase.of(context).noSearchResultFound; }, controller: textController, -// validator: (value) { -// if (value.isEmpty) { -//// return 'please Enter Product Name'; -// return TranslationBase.of(context).pleaseEnterProductName; -// } -// return null; -// }, ), + // SizedBox( + // width: 10.0, + // ), + // if(!isTextValid) + // AppText( TranslationBase.of(context) + // .noArabicLetters, color: Colors.red,), + // ], + // ), ), ), + SizedBox( width: 10.0, ), @@ -223,16 +213,27 @@ class _SearchProductsPageState extends State { Radius.circular( 6)), ), - child: model.searchList[index].rxMessage != null + child: model.searchList[index] + .rxMessage != + null ? Texts( - projectProvider.isArabic - ? model.searchList[index].rxMessagen - : model.searchList[index].rxMessage, - color: Colors.white, - regular: true, - fontSize: 10, - fontWeight: FontWeight.w400, - ): Texts(""), + projectProvider + .isArabic + ? model + .searchList[ + index] + .rxMessagen + : model + .searchList[ + index] + .rxMessage, + color: Colors.white, + regular: true, + fontSize: 10, + fontWeight: + FontWeight.w400, + ) + : Texts(""), // Texts( // model.searchList[index] // .rxMessage != @@ -258,11 +259,16 @@ class _SearchProductsPageState extends State { crossAxisAlignment: CrossAxisAlignment.start, children: [ - Texts(projectProvider.isArabic - ? model.searchList[index].namen - :model.searchList[index].name, + Texts( + projectProvider.isArabic + ? model + .searchList[index] + .namen + : model + .searchList[index] + .name, - // model.searchList[index].name, + // model.searchList[index].name, regular: true, fontSize: 12, fontWeight: FontWeight.w400, @@ -338,6 +344,10 @@ class _SearchProductsPageState extends State { ); } + bool isRTL(String text) { + return international.Bidi.detectRtlDirectionality(text); + } + searchMedicine(PharmacyCategoriseViewModel model, BuildContext context) { Utils.hideKeyboard(context); if (_formKey.currentState.validate()) diff --git a/lib/pages/settings/profile_setting.dart b/lib/pages/settings/profile_setting.dart index 7f1f6a93..efb4ecae 100644 --- a/lib/pages/settings/profile_setting.dart +++ b/lib/pages/settings/profile_setting.dart @@ -280,7 +280,7 @@ class _ProfileSettings extends State with TickerProviderStateMi TextField( enabled: isEnable, scrollPadding: EdgeInsets.zero, - keyboardType: TextInputType.number, + keyboardType: TextInputType.emailAddress, controller: _controller, // onChanged: (value) => {validateForm()}, style: TextStyle( diff --git a/lib/pages/vaccine/my_vaccines_screen.dart b/lib/pages/vaccine/my_vaccines_screen.dart index 5fa74c4f..52096746 100644 --- a/lib/pages/vaccine/my_vaccines_screen.dart +++ b/lib/pages/vaccine/my_vaccines_screen.dart @@ -76,38 +76,20 @@ class _MyVaccinesState extends State { bottomSheet: Container( color: Colors.white, padding: EdgeInsets.only(top: 16, bottom: 16, right: 21, left: 21), - child: Row( - mainAxisSize: MainAxisSize.min, - children: [ - Expanded( - child: DefaultButton( - TranslationBase.of(context).availability, - () { - // Navigator.push(context, FadePage(page: MyVaccinesItemPage())); + child: DefaultButton( + TranslationBase.of(context).sendEmail, + () { + showDialog( + context: context, + builder: (cxt) => ConfirmSendEmailDialog( + email: projectViewModel.user.emailAddress, + onTapSendEmail: () { + model.sendEmail(message: TranslationBase.of(context).emailSentSuccessfully); }, - color: Color(0xffEAEAEA), - textColor: Color(0xff000000), ), - ), - SizedBox(width: 8), - Expanded( - child: DefaultButton( - TranslationBase.of(context).sendEmail, - () { - showDialog( - context: context, - builder: (cxt) => ConfirmSendEmailDialog( - email: projectViewModel.user.emailAddress, - onTapSendEmail: () { - model.sendEmail(message: TranslationBase.of(context).emailSentSuccessfully); - }, - ), - ); - }, - ), - ), - ], - ), + ); + }, + ) ), ), ); diff --git a/lib/services/pharmacy_services/orderDetails_service.dart b/lib/services/pharmacy_services/orderDetails_service.dart index 2f4a1d56..3b03dabc 100644 --- a/lib/services/pharmacy_services/orderDetails_service.dart +++ b/lib/services/pharmacy_services/orderDetails_service.dart @@ -20,10 +20,10 @@ class OrderDetailsService extends BaseService{ List get orderList => _orderList; - Future getOrderDetails(OrderId) async { + Future getOrderDetails(OrderId, orderGUID) async { var customerGUID = await sharedPref.getObject(PHARMACY_CUSTOMER_GUID); hasError = false; - await baseAppClient.getPharmacy(GET_ORDER_DETAILS+OrderId + "/$customerGUID", + await baseAppClient.getPharmacy(GET_ORDER_DETAILS+OrderId + "/$orderGUID", onSuccess: (dynamic response, int statusCode) { _orderList.clear(); response['orders'].forEach((item) { diff --git a/lib/services/pharmacy_services/order_service.dart b/lib/services/pharmacy_services/order_service.dart index 373f2819..ed2391d8 100644 --- a/lib/services/pharmacy_services/order_service.dart +++ b/lib/services/pharmacy_services/order_service.dart @@ -20,7 +20,7 @@ class OrderService extends BaseService { hasError = false; // url =GET_ORDER+"customer=1,fields=id,order_total,order_status,order_statusn,order_status_id,created_on_utc&page=1&limit=200&customer_id=1367368"; // url =GET_ORDER+"customer=1,fields=id,order_total,order_status,order_statusn,order_status_id,created_on_utc&page=$pageId&limit=200&customer_id=$customerId"; - url = GET_ORDER + "customer=1&fields=id,order_total,order_status,order_statusn,order_status_id,created_on_utc,product_count,can_cancel,can_refund&page=$pageId&limit=200&customer_id=$customerId&CustomerguId=$customerGUID"; + url = GET_ORDER + "customer=1&fields=id,order_total,order_status,order_statusn,order_status_id,created_on_utc,product_count,can_cancel,can_refund,order_guid&page=$pageId&limit=200&customer_id=$customerId&CustomerguId=$customerGUID"; print(url); await baseAppClient.getPharmacy(url, onSuccess: (dynamic response, int statusCode) { diff --git a/lib/services/pharmacy_services/wishList_service.dart b/lib/services/pharmacy_services/wishList_service.dart index ce55a40b..ab347307 100644 --- a/lib/services/pharmacy_services/wishList_service.dart +++ b/lib/services/pharmacy_services/wishList_service.dart @@ -4,11 +4,11 @@ import 'package:diplomaticquarterapp/core/service/base_service.dart'; import 'package:diplomaticquarterapp/models/pharmacy/Wishlist.dart'; import 'package:diplomaticquarterapp/uitl/app_shared_preferences.dart'; - class WishListService extends BaseService { AppSharedPreferences sharedPref = AppSharedPreferences(); bool isLogin = false; List _wishListProducts = List(); + List get wishListProducts => _wishListProducts; // Future getWishlist() async { @@ -52,18 +52,17 @@ class WishListService extends BaseService { Future getWishlist() async { //TODO we need to check why the customer id comes null - String customerId = await sharedPref.getString(PHARMACY_CUSTOMER_ID)?? "0"; + String customerId = await sharedPref.getString(PHARMACY_CUSTOMER_ID) ?? "0"; + var customerGUID = await sharedPref.getObject(PHARMACY_CUSTOMER_GUID); hasError = false; - await baseAppClient.getPharmacy(GET_WISHLIST+customerId +"?shopping_cart_type=2", - onSuccess: (dynamic response, int statusCode) { - _wishListProducts.clear(); - response['shopping_carts'].forEach((item) { - _wishListProducts.add(Wishlist.fromJson(item)); - }); - }, onFailure: (String error, int statusCode) { - hasError = true; - super.error = error; - }); + await baseAppClient.getPharmacy(GET_WISHLIST + customerId + "/$customerGUID/" + "?shopping_cart_type=2", onSuccess: (dynamic response, int statusCode) { + _wishListProducts.clear(); + response['shopping_carts'].forEach((item) { + _wishListProducts.add(Wishlist.fromJson(item)); + }); + }, onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + }); } - } diff --git a/lib/uitl/translations_delegate_base.dart b/lib/uitl/translations_delegate_base.dart index 69b45410..5fdcbb01 100644 --- a/lib/uitl/translations_delegate_base.dart +++ b/lib/uitl/translations_delegate_base.dart @@ -71,6 +71,8 @@ class TranslationBase { String get noResultFound => localizedValues['noResultFound'][locale.languageCode]; + String get noSearchResultFound => localizedValues['noSearchResultFound'][locale.languageCode]; + String get pleaseEnterProductName => localizedValues['pleaseEnterProductName'][locale.languageCode]; String get bookNow => localizedValues['bookNow'][locale.languageCode]; @@ -591,6 +593,10 @@ class TranslationBase { String get contactUs => localizedValues['ContactUs'][locale.languageCode]; + String get contactUsLocation => localizedValues['contactUsLocation'][locale.languageCode]; + + String get contactUsTime => localizedValues['contactUsTime'][locale.languageCode]; + String get viewAllWaysReachUs => localizedValues['ViewAllWaysReachUs'][locale.languageCode]; String get medicalProfile => localizedValues['medicalProfile'][locale.languageCode]; @@ -995,10 +1001,18 @@ class TranslationBase { String get edit => localizedValues['edit'][locale.languageCode]; + String get whatsApp => localizedValues['whatsApp'][locale.languageCode]; + + String get phone => localizedValues['phone'][locale.languageCode]; + String get delete => localizedValues['delete'][locale.languageCode]; String get addAddress => localizedValues['addAddress'][locale.languageCode]; + String get deleteAddress => localizedValues['deleteAddress'][locale.languageCode]; + + String get deletedAddress => localizedValues['deletedAddress'][locale.languageCode]; + String get addNewAddress => localizedValues['addNewAddress'][locale.languageCode]; String get order => localizedValues['order'][locale.languageCode]; diff --git a/lib/uitl/utils_new.dart b/lib/uitl/utils_new.dart index 832a92b1..ec71ff24 100644 --- a/lib/uitl/utils_new.dart +++ b/lib/uitl/utils_new.dart @@ -32,11 +32,16 @@ Widget getPaymentMethods() { 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), + 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), ], ), ); @@ -48,10 +53,15 @@ Widget getNoDataWidget(BuildContext context) { child: Column( mainAxisAlignment: MainAxisAlignment.center, children: [ - SvgPicture.asset('assets/images/new/not_found.svg', width: 110.0, height: 110.0), + SvgPicture.asset('assets/images/new/not_found.svg', + width: 110.0, height: 110.0), Container( - margin: EdgeInsets.only(top: 15.0), - child: Text(TranslationBase.of(context).noResultFound, style: TextStyle(fontSize: 14, fontWeight: FontWeight.w600, color: Color(0xFFBABABA)))), + margin: EdgeInsets.only(top: 15.0), + child: Text(TranslationBase.of(context).noResultFound, + style: TextStyle( + fontSize: 14, + fontWeight: FontWeight.w600, + color: Color(0xFFBABABA)))), ], ), ), @@ -79,7 +89,8 @@ spacer() { } Future navigateTo(context, page) async { - return await Navigator.push(context, MaterialPageRoute(builder: (context) => page)); + return await Navigator.push( + context, MaterialPageRoute(builder: (context) => page)); } // Future navigateToReplace(context, page) async { @@ -137,7 +148,11 @@ Widget circularAviator( child: Container( width: s, height: s, - decoration: containerColorRadiusBorderWidth(bcColor == null ? Colors.grey[200] : bcColor, 2000, brColor == null ? Colors.blueGrey[800] : brColor, borderWidth == null ? 2 : borderWidth), + decoration: containerColorRadiusBorderWidth( + bcColor == null ? Colors.grey[200] : bcColor, + 2000, + brColor == null ? Colors.blueGrey[800] : brColor, + borderWidth == null ? 2 : borderWidth), child: Icon( icon == null ? Icons.person : icon, size: s / 1.7, @@ -219,13 +234,14 @@ RoundedRectangleBorder buttonShape() { ); } -Decoration containerRadiusWithGradient(double radius,{Color color1,Color color2}) { +Decoration containerRadiusWithGradient(double radius, + {Color color1, Color color2}) { return BoxDecoration( borderRadius: BorderRadius.circular(radius), gradient: LinearGradient( colors: [ - color1?? Color(0xFFF71787E), - color2?? Color(0xFFF2B353E), + color1 ?? Color(0xFFF71787E), + color2 ?? Color(0xFFF2B353E), ], begin: Alignment.centerLeft, end: Alignment.centerRight, @@ -233,7 +249,8 @@ Decoration containerRadiusWithGradient(double radius,{Color color1,Color color2} ); } -Decoration containerBottomRightRadiusWithGradient(double radius, {Color darkColor, Color lightColor}) { +Decoration containerBottomRightRadiusWithGradient(double radius, + {Color darkColor, Color lightColor}) { return BoxDecoration( borderRadius: BorderRadius.only(bottomRight: Radius.circular(radius)), gradient: LinearGradient( @@ -247,7 +264,8 @@ Decoration containerBottomRightRadiusWithGradient(double radius, {Color darkColo ); } -Decoration containerBottomRightRadiusWithGradientForAr(double radius, {Color darkColor, Color lightColor}) { +Decoration containerBottomRightRadiusWithGradientForAr(double radius, + {Color darkColor, Color lightColor}) { return BoxDecoration( borderRadius: BorderRadius.only(bottomLeft: Radius.circular(radius)), gradient: LinearGradient( @@ -261,9 +279,24 @@ Decoration containerBottomRightRadiusWithGradientForAr(double radius, {Color dar ); } -Decoration containerRadiusWithGradientServices(double radius, {Color darkColor, Color lightColor}) { +Decoration containerRadiusWithGradientServices( + double radius, { + Color darkColor, + Color lightColor, + bool isProduct = false, + bool prescriptionRequired = false, + bool isEnglish = true, +}) { return BoxDecoration( - borderRadius: BorderRadius.all(Radius.circular(radius)), + borderRadius: !isProduct || !prescriptionRequired + ? BorderRadius.all(Radius.circular(radius)) + : isEnglish + ? BorderRadius.only( + topLeft: Radius.circular(26), + ) + : BorderRadius.only( + topRight: Radius.circular(26), + ), gradient: LinearGradient( colors: [ darkColor == null ? Color(0xFF2B353E) : darkColor, @@ -275,7 +308,11 @@ Decoration containerRadiusWithGradientServices(double radius, {Color darkColor, ); } -Decoration containerBottomRightRadiusWithGradientBorder(double radius, {Color darkColor, Color lightColor, Color borderColor = Colors.transparent, double w = 0}) { +Decoration containerBottomRightRadiusWithGradientBorder(double radius, + {Color darkColor, + Color lightColor, + Color borderColor = Colors.transparent, + double w = 0}) { return BoxDecoration( borderRadius: BorderRadius.all(Radius.circular(radius)), border: Border.all( @@ -304,7 +341,8 @@ Decoration containerRadius(Color background, double radius) { ); } -Decoration containerColorRadiusBorder(Color background, double radius, Color color) { +Decoration containerColorRadiusBorder( + Color background, double radius, Color color) { return BoxDecoration( color: background, border: Border.all( @@ -315,7 +353,8 @@ Decoration containerColorRadiusBorder(Color background, double radius, Color col ); } -Decoration containerColorRadiusBorderWidth(Color background, double radius, Color color, double w) { +Decoration containerColorRadiusBorderWidth( + Color background, double radius, Color color, double w) { return BoxDecoration( color: background, border: Border.all( @@ -326,13 +365,14 @@ Decoration containerColorRadiusBorderWidth(Color background, double radius, Colo ); } -Decoration containerColorRadiusBorderWidthCircular(Color background, double radius, Color color, double w) { +Decoration containerColorRadiusBorderWidthCircular( + Color background, double radius, Color color, double w) { return BoxDecoration( color: background, border: Border.all( width: w, // color: color // <--- border width here - ), + ), // borderRadius: BorderRadius.circular(radius), shape: BoxShape.circle, ); @@ -341,29 +381,36 @@ Decoration containerColorRadiusBorderWidthCircular(Color background, double radi Decoration containerColorRadiusRight(Color background, double radius) { return BoxDecoration( color: background, - borderRadius: BorderRadius.only(topRight: Radius.circular(radius), bottomRight: Radius.circular(radius)), + borderRadius: BorderRadius.only( + topRight: Radius.circular(radius), + bottomRight: Radius.circular(radius)), ); } Decoration containerColorRadiusLeft(Color background, double radius) { return BoxDecoration( color: background, - borderRadius: BorderRadius.only(topLeft: Radius.circular(radius), bottomLeft: Radius.circular(radius)), + borderRadius: BorderRadius.only( + topLeft: Radius.circular(radius), bottomLeft: Radius.circular(radius)), ); } -Decoration containerColorRadiusRightBorder(Color background, double radius, double w) { +Decoration containerColorRadiusRightBorder( + Color background, double radius, double w) { return BoxDecoration( color: background, border: Border.all( width: w, // color: Colors.white // <--- border width here ), - borderRadius: BorderRadius.only(topRight: Radius.circular(radius), bottomRight: Radius.circular(radius)), + borderRadius: BorderRadius.only( + topRight: Radius.circular(radius), + bottomRight: Radius.circular(radius)), ); } -Decoration containerColorRadiusRightBorderc(Color background, double radius, double w, Color borderColor) { +Decoration containerColorRadiusRightBorderc( + Color background, double radius, double w, Color borderColor) { return BoxDecoration( color: background, border: Border.all( @@ -394,21 +441,23 @@ Decoration containerColorRadiusBottom(Color color, double radius) { ); } -Decoration containerColorRadiusLeftBorder(Color background, double radius, double w) { +Decoration containerColorRadiusLeftBorder( + Color background, double radius, double w) { return BoxDecoration( color: background, border: Border.all( width: w, // color: Colors.white // <--- border width here ), - borderRadius: BorderRadius.only(topLeft: Radius.circular(radius), bottomLeft: Radius.circular(radius)), + borderRadius: BorderRadius.only( + topLeft: Radius.circular(radius), bottomLeft: Radius.circular(radius)), ); } -BoxDecoration cardRadius(double radius,{Color color,double elevation}) { - return BoxDecoration( +BoxDecoration cardRadius(double radius, {Color color, double elevation}) { + return BoxDecoration( shape: BoxShape.rectangle, - color: color??Colors.white, + color: color ?? Colors.white, borderRadius: BorderRadius.all( Radius.circular(radius), ), @@ -416,7 +465,7 @@ BoxDecoration cardRadius(double radius,{Color color,double elevation}) { BoxShadow( color: Color(0xff000000).withOpacity(.05), //spreadRadius: 5, - blurRadius:elevation?? 27, + blurRadius: elevation ?? 27, offset: Offset(-2, 3), ), ], @@ -433,19 +482,23 @@ ShapeBorder cardRadiusNew(double radius) { ShapeBorder cardRadiusTop(double radius) { return RoundedRectangleBorder( side: BorderSide(color: Colors.transparent, width: 0), - borderRadius: BorderRadius.only(topLeft: Radius.circular(radius), topRight: Radius.circular(radius)), + borderRadius: BorderRadius.only( + topLeft: Radius.circular(radius), topRight: Radius.circular(radius)), ); } ShapeBorder cardRadiusTop2(double radius) { return RoundedRectangleBorder( - borderRadius: BorderRadius.only(topLeft: Radius.circular(radius), topRight: Radius.circular(radius)), + borderRadius: BorderRadius.only( + topLeft: Radius.circular(radius), topRight: Radius.circular(radius)), ); } ShapeBorder cardRadiusBottom(double radius) { return RoundedRectangleBorder( - borderRadius: BorderRadius.only(bottomLeft: Radius.circular(radius), bottomRight: Radius.circular(radius)), + borderRadius: BorderRadius.only( + bottomLeft: Radius.circular(radius), + bottomRight: Radius.circular(radius)), ); } @@ -568,7 +621,8 @@ FontStyle getFontStyle(String fontStyle) { bool timeCalculator(int startHour, int startMint, int endHour, int endMint) { DateTime now = DateTime.now(); - DateTime startDate = DateTime(now.year, now.month, now.day, startHour, startHour); + DateTime startDate = + DateTime(now.year, now.month, now.day, startHour, startHour); DateTime endDate = DateTime(now.year, now.month, now.day, endHour, endMint); if (startDate.isBefore(now) && endDate.isAfter(now)) return true; diff --git a/lib/widgets/buttons/secondary_button.dart b/lib/widgets/buttons/secondary_button.dart index 8f0ae5f1..a5ac63aa 100644 --- a/lib/widgets/buttons/secondary_button.dart +++ b/lib/widgets/buttons/secondary_button.dart @@ -200,9 +200,9 @@ class _SecondaryButtonState extends State width: MediaQuery.of(context).size.width * 2.2, height: MediaQuery.of(context).size.width * 2.2, decoration: BoxDecoration( - shape: BoxShape.circle, + // shape: BoxShape.circle, color: widget.disabled - ? Colors.grey + ? widget.disableColor ?? Colors.grey : widget.color ?? Theme.of(context).buttonColor, ), ), @@ -212,8 +212,8 @@ class _SecondaryButtonState extends State padding: widget.iconOnly ? EdgeInsets.symmetric(vertical: 4.0, horizontal: 5.0) : EdgeInsets.only( - top: widget.small ? 8.0 : 14.0, - bottom: widget.small ? 6.0 : 14.0, + top: widget.small ? 8.0 : 12.0, + bottom: widget.small ? 6.0 : 12.0, left: 18.0, right: 18.0), child: Stack( @@ -246,8 +246,10 @@ class _SecondaryButtonState extends State bottom: widget.small ? 4.0 : 3.0), child: Text( widget.label, + textAlign: TextAlign.center, style: TextStyle( color: widget.textColor, + fontSize: widget.small ? 12.0 : widget.fontSize??14.0, fontWeight: FontWeight.w700, fontFamily: projectViewModel.isArabic diff --git a/lib/widgets/data_display/medical/LabResult/LabResultWidget.dart b/lib/widgets/data_display/medical/LabResult/LabResultWidget.dart index 5f0ac594..f396a2f4 100644 --- a/lib/widgets/data_display/medical/LabResult/LabResultWidget.dart +++ b/lib/widgets/data_display/medical/LabResult/LabResultWidget.dart @@ -187,7 +187,7 @@ class LabResultWidget extends StatelessWidget { ), Utils.tableColumnValue(labResultList[i].resultValue + " " + labResultList[i].uOM, isLast: true), Utils.tableColumnValue(labResultList[i].referanceRange, isLast: true, isCapitable: false), - InkWell( + !checkIfCovidLab(patientLabResultList) ? InkWell( onTap: () { Navigator.push( context, @@ -203,7 +203,7 @@ class LabResultWidget extends StatelessWidget { padding: EdgeInsets.only(left: !projectViewModel.isArabic ? 0 : 12, right: !projectViewModel.isArabic ? 12 : 0), child: Utils.tableColumnValueWithUnderLine(TranslationBase.of(context).viewFlowChart, isLast: true, isCapitable: false), ), - ), + ) : Container(), ], ), ); diff --git a/lib/widgets/hospital_location.dart b/lib/widgets/hospital_location.dart index 8ba7b4bd..0e898ee1 100644 --- a/lib/widgets/hospital_location.dart +++ b/lib/widgets/hospital_location.dart @@ -2,7 +2,7 @@ import 'package:diplomaticquarterapp/core/model/contactus/get_hmg_locations.dart import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:flutter/material.dart'; -import 'package:maps_launcher/maps_launcher.dart'; +import 'package:map_launcher/map_launcher.dart'; import 'package:provider/provider.dart'; import 'package:url_launcher/url_launcher.dart'; @@ -73,9 +73,17 @@ class HospitalLocation extends StatelessWidget { ), Column( children: [ - contactButton(Icons.location_on, TranslationBase.of(context).locationa, () { - MapsLauncher.launchCoordinates(double.parse(location.latitude), double.parse(location.longitude), location.locationName); - }), + contactButton( + Icons.location_on, + TranslationBase.of(context).locationa, + () async { + await MapLauncher.showMarker( + mapType: MapType.google, + coords: Coords(double.parse(location.latitude), double.parse(location.longitude)), + title: location.locationName, + ); + }, + ), SizedBox(height: 10), contactButton(Icons.call, TranslationBase.of(context).callNow, () { launch("tel://" + location.phoneNumber); diff --git a/lib/widgets/in_app_browser/InAppBrowser.dart b/lib/widgets/in_app_browser/InAppBrowser.dart index 4fff16c3..a1fe551f 100644 --- a/lib/widgets/in_app_browser/InAppBrowser.dart +++ b/lib/widgets/in_app_browser/InAppBrowser.dart @@ -28,13 +28,14 @@ var _InAppBrowserOptions = InAppBrowserClassOptions( class MyInAppBrowser extends InAppBrowser { _PAYMENT_TYPE paymentType; - static String SERVICE_URL = 'https://hmgwebservices.com/PayFortWeb/pages/SendPayFortRequest.aspx'; // Payfort Payment Gateway URL UAT + // static String SERVICE_URL = 'https://hmgwebservices.com/PayFortWeb/pages/SendPayFortRequest.aspx'; // Payfort Payment Gateway URL UAT + // static String SERVICE_URL = 'https://hmgwebservices.com/PayFortWeb/pages/SendPayFortRequest.aspx'; // Payfort Payment Gateway URL UAT - // static String SERVICE_URL = 'https://hmgwebservices.com/PayFortWebLive/pages/SendPayFortRequest.aspx'; //Payfort Payment Gateway URL LIVE + static String SERVICE_URL = 'https://hmgwebservices.com/PayFortWebLive/pages/SendPayFortRequest.aspx'; //Payfort Payment Gateway URL LIVE - static String PREAUTH_SERVICE_URL = 'https://hmgwebservices.com/PayFortWeb/pages/SendPayFortRequest.aspx'; // Payfort PreAuth Payment Gateway URL UAT + //static String PREAUTH_SERVICE_URL = 'https://hmgwebservices.com/PayFortWeb/pages/SendPayFortRequest.aspx'; // Payfort PreAuth Payment Gateway URL UAT - // static String PREAUTH_SERVICE_URL = 'https://hmgwebservices.com/PayFortWebLive/pages/SendPayFortRequest.aspx'; //Payfort PreAuth Payment Gateway URL Live Store + static String PREAUTH_SERVICE_URL = 'https://hmgwebservices.com/PayFortWebLive/pages/SendPayFortRequest.aspx'; //Payfort PreAuth Payment Gateway URL Live Store // static String PRESCRIPTION_PAYMENT_WITH_ORDERID = // 'https://uat.hmgwebservices.com/epharmacy/checkout/OpcCompleteRedirectionPaymentClientbyOrder?orderID='; @@ -201,9 +202,14 @@ class MyInAppBrowser extends InAppBrowser { openPharmacyPaymentBrowser(OrderDetailModel order, double amount, String orderDesc, String transactionID, String emailId, String paymentMethod, String patientName, dynamic patientID, AuthenticatedUser authenticatedUser, InAppBrowser browser) { this.browser = browser; + MyChromeSafariBrowser safariBrowser = new MyChromeSafariBrowser(new MyInAppBrowser(), onExitCallback: browser.onExit, onLoadStartCallback: this.browser.onLoadStart, appo: this.appo); getPatientData(); generatePharmacyURL(order, amount, orderDesc, transactionID, emailId, paymentMethod, patientName, patientID, authenticatedUser).then((value) { - this.browser.openUrlRequest(urlRequest: URLRequest(url: Uri.parse(value))); + if (order.customValuesXml.contains("ApplePay")) { + safariBrowser.open(url: value); + } else { + this.browser.openUrlRequest(urlRequest: URLRequest(url: Uri.parse(value))); + } }); } diff --git a/lib/widgets/offers_packages/PackagesOfferCard.dart b/lib/widgets/offers_packages/PackagesOfferCard.dart index 14b1aeb0..3bf66383 100644 --- a/lib/widgets/offers_packages/PackagesOfferCard.dart +++ b/lib/widgets/offers_packages/PackagesOfferCard.dart @@ -47,7 +47,7 @@ class PackagesItemCardState extends State { aspectRatio: 144 / 144, child: ClipRRect( borderRadius: BorderRadius.circular(12.0), - child: Image.network("https://mdlaboratories.com/offersdiscounts/images/thumbs/0000162_dermatology-testing.jpeg", fit: BoxFit.fill, height: 180.0, width: 180.0), + child: Image.network(widget.itemModel.images.isNotEmpty ? widget.itemModel.images[0].src : "https://mdlaboratories.com/offersdiscounts/images/thumbs/0000162_dermatology-testing.jpeg", fit: BoxFit.fill, height: 180.0, width: 180.0), ), ), SizedBox(height: 6), @@ -61,7 +61,7 @@ class PackagesItemCardState extends State { color: Color(0xff2B353E), ), ), - Text("Special discount for all HMG Employees and their first…", + Text(widget.itemModel.shortDescription, maxLines: 2, style: TextStyle( fontSize: 12.0, diff --git a/lib/widgets/others/app_scaffold_widget.dart b/lib/widgets/others/app_scaffold_widget.dart index 26feae87..a39b9d6a 100644 --- a/lib/widgets/others/app_scaffold_widget.dart +++ b/lib/widgets/others/app_scaffold_widget.dart @@ -14,7 +14,6 @@ import 'package:diplomaticquarterapp/pages/landing/landing_page.dart'; import 'package:diplomaticquarterapp/pages/landing/landing_page_pharmcy.dart'; import 'package:diplomaticquarterapp/pages/pharmacies/screens/product-details/product-detail.dart'; import 'package:diplomaticquarterapp/pages/search_products_page.dart'; -import 'package:diplomaticquarterapp/routes.dart'; import 'package:diplomaticquarterapp/services/robo_search/event_provider.dart'; import 'package:diplomaticquarterapp/theme/colors.dart'; import 'package:diplomaticquarterapp/uitl/app_toast.dart'; diff --git a/lib/widgets/others/entity_checkbox_list.dart b/lib/widgets/others/entity_checkbox_list.dart index c03fe029..0a34778f 100644 --- a/lib/widgets/others/entity_checkbox_list.dart +++ b/lib/widgets/others/entity_checkbox_list.dart @@ -93,24 +93,22 @@ class _ProcedureListWidgetState extends State { historyInfo), activeColor: Colors.red[800], onChanged: (bool newValue) { - setState(() { - if (widget.isEntityListSelected( - historyInfo)) { - widget - .removeHistory(historyInfo); - } else { - widget.addHistory(historyInfo); - } - }); + selectOption(historyInfo); + }), Expanded( - child: Padding( - padding: const EdgeInsets.symmetric( - horizontal: 10, vertical: 0), - child: Texts(historyInfo.name, - variant: "bodyText", - bold: true, - color: Colors.black), + child: InkWell( + onTap:(){ + selectOption(historyInfo); + }, + child: Padding( + padding: const EdgeInsets.symmetric( + horizontal: 10, vertical: 0), + child: Texts(historyInfo.name, + variant: "bodyText", + bold: true, + color: Colors.black), + ), ), ), ], @@ -142,6 +140,19 @@ class _ProcedureListWidgetState extends State { ); } + + selectOption(historyInfo){ + setState(() { + if (widget.isEntityListSelected( + historyInfo)) { + widget + .removeHistory(historyInfo); + } else { + widget.addHistory(historyInfo); + } + }); + } + void filterSearchResults(String query) { List dummySearchList = List(); dummySearchList.addAll(widget.masterList); diff --git a/lib/widgets/others/floating_button_search.dart b/lib/widgets/others/floating_button_search.dart index da922323..b26f4f79 100644 --- a/lib/widgets/others/floating_button_search.dart +++ b/lib/widgets/others/floating_button_search.dart @@ -54,9 +54,11 @@ 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'; import 'package:diplomaticquarterapp/widgets/text/app_texts_widget.dart'; import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart'; import 'package:flutter/cupertino.dart'; +import 'package:flutter/foundation.dart' show TargetPlatform; import 'package:flutter/material.dart'; import 'package:flutter_tts/flutter_tts.dart'; import 'package:permission_handler/permission_handler.dart'; @@ -896,17 +898,6 @@ class RoboSearch { }); showAlertDialog(BuildContext context) { - //AlertDialog alert = AlertDialog - // AlertDialog alert = AlertDialog(content: MyStatefulBuilder(dispose: () { - // print('dispose!!!!!!!!!!!!'); - // }) - // isClosed = true; - // streamSubscription.cancel(); - // }, builder: (BuildContext context, StateSetter setState) { - // //print(streamSubscription); - // }), - // ); - // show the dialog showDialog( context: context, @@ -918,7 +909,6 @@ class RoboSearch { ); }, ); - print(dialog); } static closeAlertDialog(BuildContext context) { @@ -946,6 +936,7 @@ class _MyStatefulBuilderState extends State { var searchText; static StreamSubscription streamSubscription; static var isClosed = false; + stt.SpeechToText speech = stt.SpeechToText(); @override void initState() { @@ -1006,6 +997,21 @@ class _MyStatefulBuilderState extends State { event.setValue({'startPopUp': 'true'}); }, )) + : SizedBox(), + searchText != 'null' && searchText != null && Theme.of(context).platform == TargetPlatform.iOS + ? Center( + child: DefaultButton( + TranslationBase.of(context).ok, + () { + RoboSearch.closeAlertDialog(context); + speech.stop(); + // event.setValue({"searchText": { + // 'isIOSFeedback':true, + // + // } + // }); + }, + )) : SizedBox() ]), ))); diff --git a/lib/widgets/pharmacy/product_tile.dart b/lib/widgets/pharmacy/product_tile.dart index 65a77132..5e8c4cf7 100644 --- a/lib/widgets/pharmacy/product_tile.dart +++ b/lib/widgets/pharmacy/product_tile.dart @@ -34,25 +34,24 @@ class productTile extends StatelessWidget { // final VoidCallback deleteWishlistItems; - productTile({ - this.productName, - this.productPrice, - this.productRate, - this.productReviews, - this.qyt, - this.totalPrice, - this.isOrderDetails = false, - this.productImage, - this.showLine = true, - this.img, - this.imgs, - this.status, - this.product, - this.productID, - this.onDelete, - this.approvedTotalReviews, - this.isRx - }); + productTile( + {this.productName, + this.productPrice, + this.productRate, + this.productReviews, + this.qyt, + this.totalPrice, + this.isOrderDetails = false, + this.productImage, + this.showLine = true, + this.img, + this.imgs, + this.status, + this.product, + this.productID, + this.onDelete, + this.approvedTotalReviews, + this.isRx}); @override Widget build(BuildContext context) { @@ -93,46 +92,59 @@ class productTile extends StatelessWidget { children: [ Container( margin: EdgeInsets.all(5), - child: projectViewModel - .isArabic ? Align( - alignment: Alignment.topRight, - child: RichText( - text: TextSpan( - text: productName, - style: TextStyle(color: Colors.black54, fontSize: 15, fontWeight: FontWeight.bold), - ), - ), - ): Align( - alignment: Alignment.topLeft, - child: RichText( - text: TextSpan( - text: productName, - style: TextStyle(color: Colors.black54, fontSize: 15, fontWeight: FontWeight.bold), - ), - ), - ), + child: projectViewModel.isArabic + ? Align( + alignment: Alignment.topRight, + child: RichText( + text: TextSpan( + text: productName, + style: TextStyle( + color: Colors.black54, + fontSize: 15, + fontWeight: FontWeight.bold), + ), + ), + ) + : Align( + alignment: Alignment.topLeft, + child: RichText( + text: TextSpan( + text: productName, + style: TextStyle( + color: Colors.black54, + fontSize: 15, + fontWeight: FontWeight.bold), + ), + ), + ), ), Container( margin: EdgeInsets.all(5), - child: projectViewModel - .isArabic ? Align( - alignment: Alignment.topRight, - child: RichText( - text: TextSpan( - text: 'SAR $productPrice', - style: TextStyle(fontWeight: FontWeight.bold, color: Colors.black, fontSize: 13), - ), - ), - ) - :Align( - alignment: Alignment.topLeft, - child: RichText( - text: TextSpan( - text: 'SAR $productPrice', - style: TextStyle(fontWeight: FontWeight.bold, color: Colors.black, fontSize: 13), - ), - ), - ), + child: projectViewModel.isArabic + ? Align( + alignment: Alignment.topRight, + child: RichText( + text: TextSpan( + text: 'SAR $productPrice', + style: TextStyle( + fontWeight: FontWeight.bold, + color: Colors.black, + fontSize: 13), + ), + ), + ) + : Align( + alignment: Alignment.topLeft, + child: RichText( + text: TextSpan( + text: 'SAR $productPrice', + style: TextStyle( + fontWeight: FontWeight.bold, + color: Colors.black, + fontSize: 13), + ), + ), + ), ), this.isOrderDetails == false ? Row( @@ -156,7 +168,10 @@ class productTile extends StatelessWidget { ), Text( '${approvedTotalReviews} ${TranslationBase.of(context).reviews}', - style: TextStyle(fontWeight: FontWeight.bold, color: Colors.grey, fontSize: 13), + style: TextStyle( + fontWeight: FontWeight.bold, + color: Colors.grey, + fontSize: 13), ), ], ) @@ -188,13 +203,15 @@ class productTile extends StatelessWidget { color: Colors.green, ), onPressed: () async { - if(isRx == false){ - GifLoaderDialogUtils.showMyDialog(context); - await addToCartFunction(1, productID, context); - GifLoaderDialogUtils.hideDialog(context); - Utils.navigateToCartPage();} - else { - AppToast.showErrorToast(message: TranslationBase.of(context).needPrescription); + if (isRx == false) { + GifLoaderDialogUtils.showMyDialog(context); + await addToCartFunction(1, productID, context); + GifLoaderDialogUtils.hideDialog(context); + Utils.navigateToCartPage(); + } else { + AppToast.showErrorToast( + message: TranslationBase.of(context) + .needPrescription); } }, ), @@ -213,8 +230,13 @@ class productTile extends StatelessWidget { margin: EdgeInsets.only(bottom: 5.0), child: RichText( text: TextSpan( - text: TranslationBase.of(context).quantity + "" + '$qyt', - style: TextStyle(fontWeight: FontWeight.bold, color: Colors.grey, fontSize: 13), + text: TranslationBase.of(context).quantity + + "" + + '$qyt', + style: TextStyle( + fontWeight: FontWeight.bold, + color: Colors.grey, + fontSize: 13), ), ), ), @@ -240,7 +262,10 @@ class productTile extends StatelessWidget { RichText( text: TextSpan( text: ' $totalPrice SAR', - style: TextStyle(fontWeight: FontWeight.bold, color: Colors.black, fontSize: 15), + style: TextStyle( + fontWeight: FontWeight.bold, + color: Colors.black, + fontSize: 15), ), ), ], @@ -280,21 +305,33 @@ class productTile extends StatelessWidget { // alignment: Alignment.topLeft, child: RichText( text: TextSpan( - text: '${productReviews} ${TranslationBase.of(context).reviews}', + text: + '${productReviews} ${TranslationBase.of(context).reviews}', // text: '($productReviews reviews)', - style: TextStyle(fontWeight: FontWeight.bold, color: Colors.grey, fontSize: 13), + style: TextStyle( + fontWeight: FontWeight.bold, + color: Colors.grey, + fontSize: 13), ), ), ), ), InkWell( onTap: () { - Navigator.push(context, FadePage(page: ProductReviewPage(product))); + Navigator.push( + context, FadePage(page: ProductReviewPage(product))); }, child: Container( - padding: EdgeInsets.only(left: 13.0, right: 13.0, top: 5.0), + padding: + EdgeInsets.only(left: 13.0, right: 13.0, top: 5.0), height: 30.0, - decoration: BoxDecoration(border: Border.all(color: Colors.orange, style: BorderStyle.solid, width: 1.0), color: Colors.transparent, borderRadius: BorderRadius.circular(5.0)), + decoration: BoxDecoration( + border: Border.all( + color: Colors.orange, + style: BorderStyle.solid, + width: 1.0), + color: Colors.transparent, + borderRadius: BorderRadius.circular(5.0)), child: Text( TranslationBase.of(context).writeReview, style: TextStyle( diff --git a/pubspec.yaml b/pubspec.yaml index 37c19579..ef1b799f 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -30,7 +30,7 @@ dependencies: get_it: ^7.2.0 #Google Fit & Apple HealthKit - fit_kit: ^1.1.2 + health: ^3.0.3 #chart fl_chart: ^0.40.2 @@ -143,7 +143,7 @@ dependencies: #google maps places google_maps_place_picker: ^2.1.0-nullsafety.3 - + map_launcher: ^1.1.3 #countdown timer for Upcoming List flutter_countdown_timer: ^4.1.0