diff --git a/Runner 2021-01-01 21-59-41/DiplomaticQuarter.ipa b/Runner 2021-01-01 21-59-41/DiplomaticQuarter.ipa deleted file mode 100644 index ca720a76..00000000 Binary files a/Runner 2021-01-01 21-59-41/DiplomaticQuarter.ipa and /dev/null differ diff --git a/assets/images/new-design/tamara.png b/assets/images/new-design/tamara.png new file mode 100644 index 00000000..ab58e3ac Binary files /dev/null and b/assets/images/new-design/tamara.png differ diff --git a/lib/config/config.dart b/lib/config/config.dart index 65f602c5..49b33063 100644 --- a/lib/config/config.dart +++ b/lib/config/config.dart @@ -15,8 +15,8 @@ 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://hmgwebservices.com/'; +// const BASE_URL = 'https://uat.hmgwebservices.com/'; +const BASE_URL = 'https://hmgwebservices.com/'; // Pharmacy UAT URLs const BASE_PHARMACY_URL = 'https://uat.hmgwebservices.com/epharmacy/api/'; @@ -325,6 +325,7 @@ const GET_COVID_DRIVETHRU_PROCEDURES_LIST = 'Services/Doctors.svc/REST/COVID19_G ///Smartwatch Integration Services const GET_PATIENT_LAST_RECORD = 'Services/Patients.svc/REST/Med_GetPatientLastRecord'; +const INSERT_PATIENT_HEALTH_DATA = 'Services/Patients.svc/REST/Med_InsertTransactions'; ///My Trackers const GET_DIABETIC_RESULT_AVERAGE = 'Services/Patients.svc/REST/Patient_GetDiabeticResultAverage'; diff --git a/lib/config/localized_values.dart b/lib/config/localized_values.dart index 1e347bf8..7823bf57 100644 --- a/lib/config/localized_values.dart +++ b/lib/config/localized_values.dart @@ -1618,9 +1618,11 @@ const Map localizedValues = { "android-instructions-2": { "en": "Make sure that you have installed your watch related apps from Google PlayStore.", "ar": "تأكد من أنك قمت بتثبيت التطبيقات المتعلقة بالساعات من Google PlayStore." }, "android-instructions-3": { "en": "Make sure that your Smart Watch is connected with the WearOS app & your watch apps.", "ar": "تأكد من أن ساعتك الذكية متصلة بتطبيق WearOS وتطبيقات ساعتك." }, "android-instructions-4": { "en": "Make sure that your smart watch apps are linked/associated with Google Fit App.", "ar": "تأكد من أن تطبيقات ساعتك الذكية مرتبطة / مرتبطة بتطبيق Google Fit." }, "android-instructions-5": { "en": "Make sure that data like heart rate, steps, distance etc. are being shown on your watch app & on Google Fit app & both are in sync.", "ar": "تأكد من عرض بيانات مثل معدل ضربات القلب والخطوات والمسافة وما إلى ذلك على تطبيق الساعة وعلى تطبيق Google Fit وكلاهما في حالة مزامنة." }, + "tamaraInstPlan" : { "en": "Select the tamara installment plan", "ar": "حدد خطة تقسيط تمارة" }, "onlineTag": {"en": "Online", "ar": "متصل"}, "offlineTag": {"en": "Offline", "ar": "غير متصل"}, "viewDocList": {"en": "View List of Doctors", "ar": "عرض قائمة الأطباء"}, "bodyFatTitle": {"en": "Body Fat", "ar": " الدهون في الجسم"}, "cholesTitle": {"en": "Blood Cholesterol", "ar": " الكولسترول في الدم"}, + "laserClinic": {"en": "Laser Clinic", "ar": "عيادة الليزر"}, }; diff --git a/lib/core/model/feedback/COC_items.dart b/lib/core/model/feedback/COC_items.dart index 2748ca50..4139fc59 100644 --- a/lib/core/model/feedback/COC_items.dart +++ b/lib/core/model/feedback/COC_items.dart @@ -26,6 +26,7 @@ class COCItem { String status; String statusAr; dynamic statusEn; + int statusId; COCItem({ this.appointment, @@ -55,6 +56,7 @@ class COCItem { this.status, this.statusAr, this.statusEn, + this.statusId, }); COCItem.fromJson(Map json) { @@ -85,6 +87,7 @@ class COCItem { status = json['Status']; statusAr = json['StatusAr']; statusEn = json['StatusEn']; + statusId = json['StatusId']; } Map toJson() { diff --git a/lib/core/service/PrescriptionDeliveryService.dart b/lib/core/service/PrescriptionDeliveryService.dart index 104b390d..1d849755 100644 --- a/lib/core/service/PrescriptionDeliveryService.dart +++ b/lib/core/service/PrescriptionDeliveryService.dart @@ -25,9 +25,9 @@ class PrescriptionDeliveryService extends BaseService { Map body = Map(); body['latitude'] = latitude; body['longitude'] = longitude; - body['AppointmentNo'] = appointmentNo; - body['CreatedBy'] = createdBy; - body['DischargeID'] = dischargeID; + body['AppointmentNo'] = appointmentNo.toString(); + // body['CreatedBy'] = createdBy; + body['DischargeID'] = dischargeID.toString(); await baseAppClient.post(ADD_PRESCRIPTION_ORDER_RC, onSuccess: (dynamic response, int statusCode) { var asd = ""; }, onFailure: (String error, int statusCode) { diff --git a/lib/core/service/medical/prescriptions_service.dart b/lib/core/service/medical/prescriptions_service.dart index fa2a24c6..48c4f1bf 100644 --- a/lib/core/service/medical/prescriptions_service.dart +++ b/lib/core/service/medical/prescriptions_service.dart @@ -1,5 +1,6 @@ import 'package:diplomaticquarterapp/config/config.dart'; import 'package:diplomaticquarterapp/config/shared_pref_kay.dart'; +import 'package:diplomaticquarterapp/core/model/AlHabibMedicalService/ComprehensiveMedicalCheckup/GetCMCAllOrdersResponseModel.dart'; import 'package:diplomaticquarterapp/core/model/prescriptions/Prescriptions.dart'; import 'package:diplomaticquarterapp/core/model/prescriptions/perscription_pharmacy.dart'; import 'package:diplomaticquarterapp/core/model/prescriptions/prescription_report.dart'; @@ -16,8 +17,9 @@ import 'package:flutter/cupertino.dart'; class PrescriptionsService extends BaseService { List prescriptionsList = List(); List prescriptionReportListINP = List(); - List prescriptionsOrderList = List(); + List prescriptionsOrderList = List(); var isMedDeliveryAllowed; + Future getPrescriptions() async { hasError = false; Map body = Map(); @@ -36,10 +38,24 @@ class PrescriptionsService extends BaseService { Future getPrescriptionsOrders() async { prescriptionsOrderList.clear(); Map body = Map(); - body['isDentalAllowedBackend'] = false; + // body['isDentalAllowedBackend'] = false; await baseAppClient.post(GET_PRESCRIPTIONS_ALL_ORDERS, onSuccess: (dynamic response, int statusCode) { response['PatientER_GetPatientAllPresOrdersList'].forEach((prescriptionsOrder) { - prescriptionsOrderList.add(PrescriptionsOrder.fromJson(prescriptionsOrder)); + // prescriptionsOrderList.add(PrescriptionsOrder.fromJson(prescriptionsOrder)); + }); + }, onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + }, body: body); + } + + Future getPrescriptionsOrdersRC() async { + prescriptionsOrderList.clear(); + Map body = Map(); + // body['isDentalAllowedBackend'] = false; + await baseAppClient.post(GET_ALL_PRESCRIPTION_ORDERS_RC, onSuccess: (dynamic response, int statusCode) { + response['response'].forEach((prescriptionsOrder) { + prescriptionsOrderList.add(GetCMCAllOrdersResponseModel.fromJson(prescriptionsOrder)); }); }, onFailure: (String error, int statusCode) { hasError = true; diff --git a/lib/core/service/packages_offers/PackagesOffersServices.dart b/lib/core/service/packages_offers/PackagesOffersServices.dart index 17abdc05..d05bc274 100644 --- a/lib/core/service/packages_offers/PackagesOffersServices.dart +++ b/lib/core/service/packages_offers/PackagesOffersServices.dart @@ -147,6 +147,18 @@ class OffersAndPackagesServices extends BaseService { var finished = 0; var totalCalls = 3; + + completedAll(){ + + finished++; + if(completion != null && finished == totalCalls) { + _hideLoading(context, showLoading); + completion(); + } + } + + _showLoading(context, showLoading); + final auth_token = await baseAppClient.generatePackagesToken(); if(auth_token == null){ throw 'Something went wrong while authentication, Please try again letter'; @@ -162,18 +174,6 @@ class OffersAndPackagesServices extends BaseService { } } - - completedAll(){ - - finished++; - if(completion != null && finished == totalCalls) { - _hideLoading(context, showLoading); - completion(); - } - } - - _showLoading(context, showLoading); - // Performing Parallel Request on same time // # 1 getBestSellers(request: OffersProductsRequestModel(), context: context, showLoading: false).then((value){ @@ -283,7 +283,7 @@ class OffersAndPackagesServices extends BaseService { var jsonResponse = json.decode(stringResponse); var jsonCartItem = jsonResponse["shopping_carts"][0]; response = ResponseModel(status: true, data: PackagesCartItemsResponseModel.fromJson(jsonCartItem), error: null); - cartItemCount = response.data.quantity.toString(); + cartItemCount = (jsonResponse['count'] ?? 0).toString(); }, onFailure: (String error, int statusCode){ _hideLoading(context, showLoading); @@ -334,19 +334,18 @@ class OffersAndPackagesServices extends BaseService { // -------------------- // Place Order // -------------------- - Future placeOrder({@required Map paymentParams, @required BuildContext context, bool showLoading = true}) async{ + Future placeOrder({@required Map paymentParams, @required BuildContext context, bool showLoading = true}) async{ Future errorThrow; - var jsonBody = { - "order": { - "customer_id" : customer.id, - "billing_address": { - "email": patientUser.emailAddress, - "phone_number": patientUser.mobileNumber - }, - } + Map jsonBody = { + "customer_id" : customer.id, + "billing_address": { + "email": patientUser.emailAddress, + "phone_number": patientUser.mobileNumber + }, }; jsonBody.addAll(paymentParams); + jsonBody = {'order' : jsonBody}; int order_id; _showLoading(context, showLoading); diff --git a/lib/core/service/parmacyModule/order-preview-service.dart b/lib/core/service/parmacyModule/order-preview-service.dart index 0364d64f..0fc6f79a 100644 --- a/lib/core/service/parmacyModule/order-preview-service.dart +++ b/lib/core/service/parmacyModule/order-preview-service.dart @@ -144,12 +144,12 @@ class OrderPreviewService extends BaseService { return Future.value(localRes); } - Future getLacumAccountInformation() async { + Future getLacumAccountInformation(String identificationNo) async { hasError = false; super.error = ""; Map body = Map(); - body['IdentificationNo'] = user.patientIdentificationNo; + body['IdentificationNo'] = identificationNo; try { await baseAppClient.post(GET_LACUM_ACCOUNT_INFORMATION, @@ -164,12 +164,12 @@ class OrderPreviewService extends BaseService { } } - Future getLacumGroupInformation() async { + Future getLacumGroupInformation(String identificationNo) async { hasError = false; super.error = ""; Map body = Map(); - body['IdentificationNo'] = user.patientIdentificationNo; + body['IdentificationNo'] = identificationNo; body['AccountNumber'] = "${lacumInformation.yahalaAccountNo}"; try { diff --git a/lib/core/viewModels/PharmacyPagesViewModel.dart b/lib/core/viewModels/PharmacyPagesViewModel.dart new file mode 100644 index 00000000..41c43066 --- /dev/null +++ b/lib/core/viewModels/PharmacyPagesViewModel.dart @@ -0,0 +1,17 @@ +import 'package:flutter/cupertino.dart'; + +class PharmacyPagesViewModel with ChangeNotifier { + int currentTab = 0; + PageController pageController; + + PharmacyPagesViewModel() { + pageController = PageController(keepPage: true); + } + changeCurrentTab(int tab) { + if (pageController.hasClients) { + currentTab = tab; + pageController.jumpToPage(tab); + notifyListeners(); + } + } +} diff --git a/lib/core/viewModels/medical/prescriptions_view_model.dart b/lib/core/viewModels/medical/prescriptions_view_model.dart index 03018878..be6153bd 100644 --- a/lib/core/viewModels/medical/prescriptions_view_model.dart +++ b/lib/core/viewModels/medical/prescriptions_view_model.dart @@ -1,3 +1,4 @@ +import 'package:diplomaticquarterapp/core/model/AlHabibMedicalService/ComprehensiveMedicalCheckup/GetCMCAllOrdersResponseModel.dart'; import 'package:diplomaticquarterapp/core/model/prescriptions/perscription_pharmacy.dart'; import 'package:diplomaticquarterapp/core/model/prescriptions/prescription_report.dart'; import 'package:diplomaticquarterapp/core/model/prescriptions/prescription_report_enh.dart'; @@ -26,7 +27,7 @@ class PrescriptionsViewModel extends BaseViewModel { List get prescriptionsList => _prescriptionsService.prescriptionsList; - List get prescriptionsHistory => _prescriptionsService.prescriptionsOrderList; + List get prescriptionsHistory => _prescriptionsService.prescriptionsOrderList; List get pharmacyPrescriptionsList => _prescriptionsService.pharmacyPrescriptionsList; @@ -79,7 +80,8 @@ class PrescriptionsViewModel extends BaseViewModel { getPrescriptionsOrders({bool showLoading = false}) async { setState(ViewState.Busy); Future.delayed(new Duration(milliseconds: 300)).then((value) async { - await _prescriptionsService.getPrescriptionsOrders(); + // await _prescriptionsService.getPrescriptionsOrders(); + await _prescriptionsService.getPrescriptionsOrdersRC(); if (_prescriptionsService.hasError) { error = _prescriptionsService.error; setState(ViewState.ErrorLocal); diff --git a/lib/core/viewModels/pharmacyModule/OrderPreviewViewModel.dart b/lib/core/viewModels/pharmacyModule/OrderPreviewViewModel.dart index e64ab20c..d3f09119 100644 --- a/lib/core/viewModels/pharmacyModule/OrderPreviewViewModel.dart +++ b/lib/core/viewModels/pharmacyModule/OrderPreviewViewModel.dart @@ -31,6 +31,11 @@ class OrderPreviewViewModel extends BaseViewModel { PaymentCheckoutData paymentCheckoutData = PaymentCheckoutData(); double totalAdditionalShippingCharge = 0; + setShoppingCartResponse(ShoppingCartResponse cart){ + cartResponse = cart; + notifyListeners(); + } + Future getOrderPreviewData() async { setState(ViewState.Busy); await _orderService.getAddresses(); @@ -156,25 +161,25 @@ class OrderPreviewViewModel extends BaseViewModel { return _orderService.getPaymentOptionName(paymentOption); } - getInformationsByAddress() async { - await getLacumAccountInformation(); + getInformationsByAddress(String identificationNo) async { await getShippingOption(); + await getLacumAccountInformation(identificationNo); } - getLacumAccountInformation() async { + getLacumAccountInformation(String identificationNo) async { setState(ViewState.Busy); - await _orderService.getLacumAccountInformation(); + await _orderService.getLacumAccountInformation(identificationNo); if (_orderService.hasError) { error = _orderService.error; setState(ViewState.Error); } else { - getLacumGroupData(); + getLacumGroupData(identificationNo); } } - Future getLacumGroupData() async { + Future getLacumGroupData(String identificationNo) async { setState(ViewState.Busy); - await _orderService.getLacumGroupInformation(); + await _orderService.getLacumGroupInformation(identificationNo); paymentCheckoutData.lacumInformation = _orderService.lacumGroupInformation; paymentCheckoutData.usedLakumPoints = paymentCheckoutData .lacumInformation.lakumInquiryInformationObjVersion.pointsBalanceAmount; diff --git a/lib/core/viewModels/pharmacyModule/product_detail_view_model.dart b/lib/core/viewModels/pharmacyModule/product_detail_view_model.dart index 828aa8e4..98596ee0 100644 --- a/lib/core/viewModels/pharmacyModule/product_detail_view_model.dart +++ b/lib/core/viewModels/pharmacyModule/product_detail_view_model.dart @@ -1,13 +1,17 @@ import 'package:diplomaticquarterapp/core/enum/viewstate.dart'; import 'package:diplomaticquarterapp/core/viewModels/base_view_model.dart'; +import 'package:diplomaticquarterapp/core/viewModels/pharmacyModule/OrderPreviewViewModel.dart'; import 'package:diplomaticquarterapp/models/pharmacy/Wishlist.dart'; import 'package:diplomaticquarterapp/models/pharmacy/locationModel.dart'; import 'package:diplomaticquarterapp/models/pharmacy/productDetailModel.dart'; +import 'package:diplomaticquarterapp/services/pharmacy_services/product_detail_service.dart'; import 'package:diplomaticquarterapp/models/pharmacy/specification.dart'; import 'package:diplomaticquarterapp/uitl/gif_loader_dialog_utils.dart'; import 'package:diplomaticquarterapp/uitl/navigation_service.dart'; - -import 'package:diplomaticquarterapp/services/pharmacy_services/product_detail_service.dart'; +import 'package:diplomaticquarterapp/core/model/pharmacies/ShoppingCart.dart'; +import 'package:diplomaticquarterapp/core/model/pharmacies/ShoppingCartResponse.dart'; +import 'package:flutter/material.dart'; +import 'package:provider/provider.dart'; import '../../../locator.dart'; @@ -61,12 +65,39 @@ class ProductDetailViewModel extends BaseViewModel{ Future addToCartData(quantity, itemID) async { hasError = false; setState(ViewState.BusyLocal); - await _productDetailService.addToCart(quantity, itemID); + var resp = await _productDetailService.addToCart(quantity, itemID); + ShoppingCartResponse object = _handleGetShoppingCartResponse(resp); if (_productDetailService.hasError) { error = _productDetailService.error; setState(ViewState.ErrorLocal); - } else + } else { setState(ViewState.Idle); + Provider.of(locator().navigatorKey.currentContext, listen: false) + .setShoppingCartResponse( object); + } + } + + ShoppingCartResponse _handleGetShoppingCartResponse(Map res) { + ShoppingCartResponse cartResponse = ShoppingCartResponse(); + + if (res == null) { + error = "response is null"; + setState(ViewState.Error); + return null; + } + print(res); + cartResponse.itemCount = res["item_count"]; + cartResponse.quantityCount = res["quantity_count"]; + cartResponse.subtotal = res["subtotal"]; + cartResponse.subtotalWithVat = res["subtotal_with_vat"]; + cartResponse.subtotalVatAmount = res["subtotal_vat_amount"]; + cartResponse.subtotalVatRate = res["subtotal_vat_rate"]; + cartResponse.shoppingCarts = List(); + res["shopping_carts"].forEach((item) { + ShoppingCart shoppingCart = ShoppingCart.fromJson(item); + cartResponse.shoppingCarts.add(shoppingCart); + }); + return cartResponse; } Future addToWishlistData(itemID) async { diff --git a/lib/main.dart b/lib/main.dart index 99b7cefe..0dd18a2d 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -1,5 +1,4 @@ -import 'dart:io'; - +import 'package:diplomaticquarterapp/core/viewModels/PharmacyPagesViewModel.dart'; import 'package:diplomaticquarterapp/core/viewModels/dashboard_view_model.dart'; import 'package:diplomaticquarterapp/models/Appointments/toDoCountProviderModel.dart'; import 'package:diplomaticquarterapp/routes.dart'; @@ -84,6 +83,9 @@ class _MyApp extends State { SizeConfig().init(constraints, orientation); return MultiProvider( providers: [ + ChangeNotifierProvider( + create: (context) => PharmacyPagesViewModel(), + ), ChangeNotifierProvider( create: (context) => ProjectViewModel(), ), diff --git a/lib/models/SmartWatch/HealthData.dart b/lib/models/SmartWatch/HealthData.dart index f01c3bf8..d681f764 100644 --- a/lib/models/SmartWatch/HealthData.dart +++ b/lib/models/SmartWatch/HealthData.dart @@ -1,8 +1,37 @@ class healthData { int MedCategoryID; int MedSubCategoryID; - String Value; - String Notes; String MachineDate; + double Value; int TransactionsListID; -} + String Notes; + + healthData({ + this.MedCategoryID, + this.MedSubCategoryID, + this.MachineDate, + this.Value, + this.TransactionsListID, + this.Notes, + }); + + healthData.fromJson(Map json) { + MedCategoryID = json['MedCategoryID']; + MedSubCategoryID = json['MedSubCategoryID']; + MachineDate = json['MachineDate']; + Value = json['Value']; + TransactionsListID = json['TransactionsListID']; + Notes = json['Notes']; + } + + Map toJson() { + final Map data = new Map(); + data['MedCategoryID'] = this.MedCategoryID; + data['MedSubCategoryID'] = this.MedSubCategoryID; + data['MachineDate'] = this.MachineDate; + data['Value'] = this.Value; + data['TransactionsListID'] = this.TransactionsListID; + data['Notes'] = this.Notes; + return data; + } +} \ No newline at end of file diff --git a/lib/pages/AlHabibMedicalService/all_habib_medical_service_page2.dart b/lib/pages/AlHabibMedicalService/all_habib_medical_service_page2.dart index ac4c11e1..37bc5fe6 100644 --- a/lib/pages/AlHabibMedicalService/all_habib_medical_service_page2.dart +++ b/lib/pages/AlHabibMedicalService/all_habib_medical_service_page2.dart @@ -223,8 +223,6 @@ class _AllHabibMedicalSevicePage2State extends State var data = await this.sharedPref.getObject(WEATHER); if (data == null) { var d = await _weatherService.getWeatherData(); - - print(d); weatherNum = d.temperature; setState(() { weather = d != null ? d.temperature.toString() + '\u2103' : '--'; diff --git a/lib/pages/AlHabibMedicalService/h2o/h2o_index_page.dart b/lib/pages/AlHabibMedicalService/h2o/h2o_index_page.dart index e6e05ee6..df8d3cc8 100644 --- a/lib/pages/AlHabibMedicalService/h2o/h2o_index_page.dart +++ b/lib/pages/AlHabibMedicalService/h2o/h2o_index_page.dart @@ -6,7 +6,6 @@ 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:hexcolor/hexcolor.dart'; class H2OPageIndexPage extends StatelessWidget { @override @@ -23,7 +22,7 @@ class H2OPageIndexPage extends StatelessWidget { "Water Tracker:", fontWeight: FontWeight.normal, fontSize: 25, - color: HexColor("#60686b"), + color: Color(0xFF60686b), ), SizedBox( height: 12, diff --git a/lib/pages/AlHabibMedicalService/h2o/month_page.dart b/lib/pages/AlHabibMedicalService/h2o/month_page.dart index daf91cb9..642f4826 100644 --- a/lib/pages/AlHabibMedicalService/h2o/month_page.dart +++ b/lib/pages/AlHabibMedicalService/h2o/month_page.dart @@ -3,8 +3,6 @@ import 'package:diplomaticquarterapp/core/viewModels/AlHabibMedicalService/H2O_v import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; import 'package:diplomaticquarterapp/pages/base/base_view.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; -import 'package:diplomaticquarterapp/widgets/charts/app_bar_chart.dart'; -import 'package:diplomaticquarterapp/widgets/errors/app_embedded_error.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; import 'package:diplomaticquarterapp/uitl/utils_new.dart'; import 'package:flutter/cupertino.dart'; diff --git a/lib/pages/AlHabibMedicalService/h2o/today_page.dart b/lib/pages/AlHabibMedicalService/h2o/today_page.dart index accd6887..984d0680 100644 --- a/lib/pages/AlHabibMedicalService/h2o/today_page.dart +++ b/lib/pages/AlHabibMedicalService/h2o/today_page.dart @@ -11,8 +11,6 @@ import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; -import 'package:hexcolor/hexcolor.dart'; -import 'package:percent_indicator/circular_percent_indicator.dart'; import 'package:shared_preferences/shared_preferences.dart'; import 'package:wave/config.dart'; import 'package:wave/wave.dart'; diff --git a/lib/pages/AlHabibMedicalService/health-weather/health-weather-indicator.dart b/lib/pages/AlHabibMedicalService/health-weather/health-weather-indicator.dart index d85db81f..bbd73d64 100644 --- a/lib/pages/AlHabibMedicalService/health-weather/health-weather-indicator.dart +++ b/lib/pages/AlHabibMedicalService/health-weather/health-weather-indicator.dart @@ -27,6 +27,8 @@ class _HospitalsPageState extends State { LocationUtils locationUtils; var weather = '--'; + ProjectViewModel projectViewModel; + @override void initState() { locationUtils = new LocationUtils(isShowConfirmDialog: true, context: context); @@ -37,7 +39,7 @@ class _HospitalsPageState extends State { @override Widget build(BuildContext context) { - ProjectViewModel projectViewModel = Provider.of(context); + projectViewModel = Provider.of(context); return BaseView( onModelReady: (model) => model.getWeatherData(), allowAny: true, @@ -131,7 +133,7 @@ class _HospitalsPageState extends State { padding: EdgeInsets.all(15), child: Column( children: mode.weatherIndicatorData.map((data) { - return WeatherSlider(data); + return WeatherSlider(data, projectViewModel); }).toList())) ])) : Center(child: AppCircularProgressIndicator())), diff --git a/lib/pages/Blood/blood_donation.dart b/lib/pages/Blood/blood_donation.dart index 8fb12f33..e0c6bfe7 100644 --- a/lib/pages/Blood/blood_donation.dart +++ b/lib/pages/Blood/blood_donation.dart @@ -2,8 +2,6 @@ import 'package:diplomaticquarterapp/core/enum/viewstate.dart'; import 'package:diplomaticquarterapp/core/model/ImagesInfo.dart'; import 'package:diplomaticquarterapp/core/model/blooddonation/blood_groub_details.dart'; import 'package:diplomaticquarterapp/core/model/blooddonation/get_all_cities.dart'; - -//import 'package:diplomaticquarterapp/core/model/hospitals/hospitals_model.dart'; import 'package:diplomaticquarterapp/core/model/my_balance/AdvanceModel.dart'; import 'package:diplomaticquarterapp/core/model/my_balance/patient_info.dart'; import 'package:diplomaticquarterapp/core/viewModels/medical/my_balance_view_model.dart'; @@ -20,10 +18,10 @@ import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:diplomaticquarterapp/widgets/buttons/defaultButton.dart'; import 'package:diplomaticquarterapp/widgets/dialogs/radio_selection_dialog.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; +import 'package:diplomaticquarterapp/widgets/show_zoom_image_dialog.dart'; import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; -import 'package:giffy_dialog/giffy_dialog.dart'; import 'package:provider/provider.dart'; enum BeneficiaryType { MyAccount, MyFamilyFiles, OtherAccount, NON } @@ -74,14 +72,38 @@ class _BloodDonationPageState extends State { super.initState(); } + int getSelectedCityID(MyBalanceViewModel model) { + int cityID = 1; + + model.CitiesModelList.forEach((element) { + if (element.description == model.bloodModelList[0].city) { + cityID = element.iD; + } + }); + + return cityID; + } + @override Widget build(BuildContext context) { projectProvider = Provider.of(context); return BaseView( onModelReady: (model) { - model.getCities(); - model.getBlood(); + model.getCities().then((value) { + model.getBlood().then((value) { + if (model.bloodModelList.length > 0) { + CitiesModel citiesModel = new CitiesModel(); + citiesModel.iD = getSelectedCityID(model); + _selectedHospitalIndex = (citiesModel.iD - 1); + citiesModel.description = model.CitiesModelList[_selectedHospitalIndex].description; + citiesModel.descriptionN = model.CitiesModelList[_selectedHospitalIndex].descriptionN; + _selectedHospital = citiesModel; + } else { + _selectedHospital = model.CitiesModelList[0]; + } + }); + }); }, builder: (_, model, w) => AppScaffold( isShowAppBar: true, @@ -89,6 +111,7 @@ class _BloodDonationPageState extends State { backgroundColor: Color(0xffF7F7F7), showNewAppBarTitle: true, baseViewModel: model, + isShowDecPage: true, imagesInfo: imagesInfo, description: TranslationBase.of(context).bloodDonationInfo, appBarTitle: TranslationBase.of(context).bloodD, @@ -106,31 +129,32 @@ class _BloodDonationPageState extends State { style: TextStyle(fontSize: 16, fontWeight: FontWeight.w600, color: Color(0xff2E303A), letterSpacing: -0.64), ), SizedBox(height: 12), - CommonDropDownView( - TranslationBase.of(context).city, - model.bloodModelList.isNotEmpty - ? model.bloodModelList[0].city - : projectProvider.isArabic - ? model.CitiesModelList[_selectedHospitalIndex].descriptionN - : model.CitiesModelList[_selectedHospitalIndex].description, () { - List list = [ - for (int i = 0; i < model.CitiesModelList.length; i++) - RadioSelectionDialogModel(projectProvider.isArabic ? model.CitiesModelList[i].descriptionN : model.CitiesModelList[i].description, i), - ]; + if (projectProvider.isLogin && model.state != ViewState.Busy) + CommonDropDownView( + TranslationBase.of(context).city, + // (model.bloodModelList.isNotEmpty && model.CitiesModelList.isNotEmpty) + // ? model.bloodModelList[0].city + // : + projectProvider.isArabic ? _selectedHospital.descriptionN : _selectedHospital.description, () { + List list = [ + for (int i = 0; i < model.CitiesModelList.length; i++) + RadioSelectionDialogModel(projectProvider.isArabic ? model.CitiesModelList[i].descriptionN : model.CitiesModelList[i].description, i), + ]; - showDialog( - context: context, - child: RadioSelectionDialog( - listData: list, - selectedIndex: _selectedHospitalIndex, - isScrollable: true, - onValueSelected: (index) { - _selectedHospitalIndex = index; - _selectedHospital = model.CitiesModelList[index]; - }, - ), - ); - }).withBorderedContainer, + showDialog( + context: context, + child: RadioSelectionDialog( + listData: list, + selectedIndex: _selectedHospitalIndex, + isScrollable: true, + onValueSelected: (index) { + _selectedHospitalIndex = index; + _selectedHospital = model.CitiesModelList[index]; + setState(() {}); + }, + ), + ); + }).withBorderedContainer, SizedBox(height: 12), CommonDropDownView(TranslationBase.of(context).gender, _selectedGenderIndex == 1 ? TranslationBase.of(context).male : TranslationBase.of(context).female, () { List list = [ @@ -226,19 +250,7 @@ class _BloodDonationPageState extends State { width: 350, child: InkWell( onTap: () { - showDialog( - context: context, - builder: (_) => AssetGiffyDialog( - title: Text( - "", - style: TextStyle(fontSize: 22.0, fontWeight: FontWeight.w600), - ), - image: Image.asset('assets/images/BloodChrt_EN.png'), - buttonCancelText: Text(TranslationBase.of(context).cancel), - buttonCancelColor: Colors.grey, - onlyCancelButton: true, - ), - ); + showZoomImageDialog(context, 'assets/images/BloodChrt_EN.png', isNetworkImage: false); }, child: Container(width: 250, height: 200, child: Image.asset('assets/images/BloodChrt_EN.png'), color: Colors.white), ), @@ -261,7 +273,7 @@ class _BloodDonationPageState extends State { AppToast.showErrorToast(message: TranslationBase.of(context).selectCity); return; } - bloodDetails.city = projectProvider.isArabic ? _selectedHospital.descriptionN : _selectedHospital.description; + bloodDetails.city = _selectedHospital.description; bloodDetails.cityCode = _selectedHospital.iD.toString(); bloodDetails.gender = _selectedGenderIndex; bloodDetails.bloodGroup = getBlood(_selectedBloodTypeIndex); diff --git a/lib/pages/BookAppointment/LaserBooking.dart b/lib/pages/BookAppointment/LaserBooking.dart new file mode 100644 index 00000000..942e5e18 --- /dev/null +++ b/lib/pages/BookAppointment/LaserBooking.dart @@ -0,0 +1,15 @@ +import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; +import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; +import 'package:flutter/material.dart'; + +class LaserBooking extends StatefulWidget { + @override + _LaserBookingState createState() => _LaserBookingState(); +} + +class _LaserBookingState extends State { + @override + Widget build(BuildContext context) { + return AppScaffold(isShowDecPage: false, isShowAppBar: true, showNewAppBarTitle: true, showNewAppBar: true, appBarTitle: TranslationBase.of(context).laserClinic, body: Container()); + } +} diff --git a/lib/pages/BookAppointment/components/SearchByClinic.dart b/lib/pages/BookAppointment/components/SearchByClinic.dart index 147cb9f9..9c28310e 100644 --- a/lib/pages/BookAppointment/components/SearchByClinic.dart +++ b/lib/pages/BookAppointment/components/SearchByClinic.dart @@ -8,6 +8,7 @@ import 'package:diplomaticquarterapp/models/Appointments/SearchInfoModel.dart'; import 'package:diplomaticquarterapp/models/Authentication/authenticated_user.dart'; import 'package:diplomaticquarterapp/models/Clinics/ClinicListResponse.dart'; import 'package:diplomaticquarterapp/pages/BookAppointment/DentalComplaints.dart'; +import 'package:diplomaticquarterapp/pages/BookAppointment/LaserBooking.dart'; import 'package:diplomaticquarterapp/pages/BookAppointment/SearchResults.dart'; import 'package:diplomaticquarterapp/pages/livecare/livecare_home.dart'; import 'package:diplomaticquarterapp/services/appointment_services/GetDoctorsList.dart'; @@ -176,9 +177,10 @@ class _SearchByClinicState extends State { ), ], ), - - Container(child: inputWidget("Age", "", ageController),margin: EdgeInsets.only(left: 20, right: 20),), - + Container( + child: inputWidget("Age", "", ageController), + margin: EdgeInsets.only(left: 20, right: 20), + ), ], ), Padding( @@ -421,15 +423,15 @@ class _SearchByClinicState extends State { prefixIcon: prefix == null ? null : Text( - "+" + prefix, - style: TextStyle( - fontSize: 14, - height: 21 / 14, - fontWeight: FontWeight.w500, - color: Color(0xff2E303A), - letterSpacing: -0.56, - ), - ), + "+" + prefix, + style: TextStyle( + fontSize: 14, + height: 21 / 14, + fontWeight: FontWeight.w500, + color: Color(0xff2E303A), + letterSpacing: -0.56, + ), + ), contentPadding: EdgeInsets.zero, border: InputBorder.none, focusedBorder: InputBorder.none, @@ -446,7 +448,6 @@ class _SearchByClinicState extends State { ); } - void openDropdown(GlobalKey key) { GestureDetector detector; void searchForGestureDetector(BuildContext element) { @@ -537,6 +538,9 @@ class _SearchByClinicState extends State { searchInfo.date = DateTime.now(); navigateToDentalComplaints(context, searchInfo); + } else if (dropdownValue.split("-")[0] == "253") { + navigateToLaserClinic(context); + // callDoctorsSearchAPI(); } else if (dropdownValue.split("-")[1] == "true" // && authProvider.isLogin && // authUser.patientType == 1 @@ -625,6 +629,19 @@ class _SearchByClinicState extends State { }); } + Future navigateToLaserClinic(BuildContext context) async { + Navigator.push( + context, + FadePage( + page: LaserBooking(), + ), + ).then((value) { + setState(() { + dropdownValue = null; + }); + }); + } + Future navigateToSearchResults(context, List docList, List patientDoctorAppointmentListHospital) async { isProjectLoaded = false; Navigator.push(context, FadePage(page: SearchResults(isLiveCareAppointment: false, doctorsList: docList, patientDoctorAppointmentListHospital: patientDoctorAppointmentListHospital))) diff --git a/lib/pages/ContactUs/findus/hospitrals_page.dart b/lib/pages/ContactUs/findus/hospitrals_page.dart index 87516e52..106ecb0d 100644 --- a/lib/pages/ContactUs/findus/hospitrals_page.dart +++ b/lib/pages/ContactUs/findus/hospitrals_page.dart @@ -1,10 +1,7 @@ import 'package:diplomaticquarterapp/core/model/contactus/get_hmg_locations.dart'; -import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:diplomaticquarterapp/widgets/hospital_location.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; -import 'package:giffy_dialog/giffy_dialog.dart'; -import 'package:maps_launcher/maps_launcher.dart'; import 'package:url_launcher/url_launcher.dart'; class HospitalsPage extends StatefulWidget { diff --git a/lib/pages/ErService/NearestEr.dart b/lib/pages/ErService/NearestEr.dart index 845a8fe7..3aad729f 100644 --- a/lib/pages/ErService/NearestEr.dart +++ b/lib/pages/ErService/NearestEr.dart @@ -10,7 +10,6 @@ import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import '../../uitl/translations_delegate_base.dart'; -import 'widgets/card_position.dart'; class NearestEr extends StatefulWidget { static const String _url = "assets/images/"; diff --git a/lib/pages/ErService/widgets/card_common.dart b/lib/pages/ErService/widgets/card_common.dart deleted file mode 100644 index 409fdf21..00000000 --- a/lib/pages/ErService/widgets/card_common.dart +++ /dev/null @@ -1,61 +0,0 @@ -import 'package:flutter/material.dart'; - -class CardCommonEr extends StatelessWidget { - final image; - final text; - final subText; - final bool locked; - - final Function onTap; - const CardCommonEr({ - this.locked = false, - @required this.image, - @required this.text, - @required this.subText, - @required this.onTap, - }); - - @override - Widget build(BuildContext context) { - return GestureDetector( - onTap: locked ? null : onTap, - child: Opacity( - opacity: locked ? 0.25 : 1.0, - child: Stack( - children: [ - Container( - width: double.infinity, - padding: EdgeInsets.only(left: 20, right: 20, bottom: 15, top: 28), - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(15), - color: Colors.white, - border: Border.all( - color: Color(0xffefefef), - width: 1, - ), - ), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - Image.asset(this.image, width: 42.0, height: 42.0), - Text( - text + "${subText.isEmpty ? "" : "\n$subText"}", - style: TextStyle(fontSize: 16, fontWeight: FontWeight.w600, color: Color(0xff2B353E), letterSpacing: -0.48, height: 20 / 16), - ), - ], - ), - ), - if (locked) Align(alignment: Alignment.center, child: lock()) - ], - ), - ), - ); - } - - Widget lock() { - return Container( - child: Icon(Icons.lock_rounded, size: 80), - ); - } -} diff --git a/lib/pages/ErService/widgets/card_position.dart b/lib/pages/ErService/widgets/card_position.dart deleted file mode 100644 index fc0ca9e4..00000000 --- a/lib/pages/ErService/widgets/card_position.dart +++ /dev/null @@ -1,106 +0,0 @@ -//import 'package:diplomaticquarterapp/pages/BookAppointment/Search.dart'; -import 'package:diplomaticquarterapp/config/size_config.dart'; -import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; -import 'package:flutter/material.dart'; -import 'package:giffy_dialog/giffy_dialog.dart'; -import 'package:maps_launcher/maps_launcher.dart'; -import 'package:url_launcher/url_launcher.dart'; - -class CardPosition extends StatelessWidget { - final image; - final text; - final subText; - final type; - final telephone; - final networkImage; - final latitude; - final longitude; - final projectname; - final cardSize; - final String waitingTime; - - const CardPosition({ - @required this.image, - @required this.text, - @required this.subText, - @required this.type, - @required this.telephone, - @required this.networkImage, - @required this.latitude, - @required this.longitude, - @required this.projectname, - @required this.cardSize, - @required this.waitingTime, - }); - - @override - Widget build(BuildContext context) { - return GestureDetector( - onTap: () { - navigateToSearch(context, this.type, this.telephone, this.networkImage, this.latitude, this.longitude, this.projectname); - }, - child: Container( - // width:MediaQuery.of(context).size.width * 0.47,//165, - margin: EdgeInsets.fromLTRB(8.0, 8.0, 8.0, 8.0), - decoration: BoxDecoration(boxShadow: [BoxShadow(color: Colors.grey[400], blurRadius: 2.0, spreadRadius: 0.0)], borderRadius: BorderRadius.circular(10), color: Colors.white), - child: Column( - crossAxisAlignment: CrossAxisAlignment.center, - children: [ - Container( - height: cardSize * 0.2 - 8, - margin: EdgeInsets.fromLTRB(8.0, 8.0, 8.0, 0.0), - child: Text(this.text, overflow: TextOverflow.clip, style: TextStyle(color: Colors.black, letterSpacing: 1.0, fontSize: 2 * SizeConfig.textMultiplier)), - ), - Container( - height: cardSize * 0.5 - 8, - alignment: Alignment.center, - margin: EdgeInsets.fromLTRB(0.0, 0.0, 8.0, 8.0), - child: Image.asset(this.image, width: 60.0, height: cardSize * 0.4), - ), - Container( - margin: EdgeInsets.fromLTRB(8.0, 0.0, 8.0, 0.0), - height: cardSize * 0.2 - 8, - child: Text(this.subText, overflow: TextOverflow.clip, style: TextStyle(color: Color(0xFFc5272d), letterSpacing: 1.0, fontSize: 15.0)), - ), - ], - ), - ), - ); - } - - Future navigateToSearch(context, type, telephone, networkImage, latitude, longitude, projectname) async { - var localize = TranslationBase.of(context); - showDialog( - context: context, - builder: (_) => AssetGiffyDialog( - entryAnimation: EntryAnimation.BOTTOM, - image: Image.network( - networkImage, - fit: BoxFit.cover, - ), - title: Text( - projectname, - style: TextStyle(fontSize: 22.0, fontWeight: FontWeight.w600), - ), - description: Text( - "${localize.averageWaitingTime}\n\n$waitingTime ${localize.minute}", - textAlign: TextAlign.center, - ), - buttonOkText: Text( - "LOCATION", - style: TextStyle(color: Colors.white), - ), - buttonOkColor: Colors.grey, - buttonCancelText: Text( - 'CAll', - style: TextStyle(color: Colors.white), - ), - buttonCancelColor: Colors.grey, - onOkButtonPressed: () { - MapsLauncher.launchCoordinates(double.parse(latitude), double.parse(longitude), projectname); - }, - onCancelButtonPressed: () { - launch("tel://" + telephone); - })); - } -} diff --git a/lib/pages/MyAppointments/widgets/AppointmentActions.dart b/lib/pages/MyAppointments/widgets/AppointmentActions.dart index 224f3db8..acfe444f 100644 --- a/lib/pages/MyAppointments/widgets/AppointmentActions.dart +++ b/lib/pages/MyAppointments/widgets/AppointmentActions.dart @@ -408,6 +408,7 @@ class _AppointmentActionsState extends State { prescriptions.actualDoctorRate = widget.appo.actualDoctorRate; prescriptions.noOfPatientsRate = widget.appo.noOfPatientsRate; prescriptions.isInOutPatient = widget.appo.isInOutPatient; + prescriptions.doctorID = widget.appo.doctorID; navigateToMedicinePrescriptionReport(prescriptions); } diff --git a/lib/pages/feedback/status_feedback_page.dart b/lib/pages/feedback/status_feedback_page.dart index 5040b200..15e3e3dd 100644 --- a/lib/pages/feedback/status_feedback_page.dart +++ b/lib/pages/feedback/status_feedback_page.dart @@ -4,6 +4,7 @@ import 'package:diplomaticquarterapp/core/viewModels/feedback/feedback_view_mode import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; import 'package:diplomaticquarterapp/pages/base/base_view.dart'; import 'package:diplomaticquarterapp/pages/feedback/feedback-detail.dart'; +import 'package:diplomaticquarterapp/theme/colors.dart'; import 'package:diplomaticquarterapp/uitl/app_toast.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:diplomaticquarterapp/uitl/utils_new.dart'; @@ -28,10 +29,10 @@ class _StatusFeedbackPageState extends State { TextEditingController complainNumberController = TextEditingController(); StatusType statusType = StatusType.ComplaintNumber; int selectedStatusIndex = 3; - + ProjectViewModel projectViewModel; @override Widget build(BuildContext context) { - ProjectViewModel projectViewModel = Provider.of(context); + projectViewModel = Provider.of(context); return BaseView( allowAny: true, onModelReady: (model) { @@ -202,38 +203,67 @@ class _StatusFeedbackPageState extends State { shrinkWrap: isLogin ? false : true, physics: isLogin ? null : NeverScrollableScrollPhysics(), itemBuilder: (context, index) => InkWell( - onTap: () {}, + onTap: () { + // sss + }, child: Container( - decoration: cardRadius(12), - margin: EdgeInsets.all(10), - child: Padding( - padding: const EdgeInsets.all(12.0), - child: Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Text(isArabic ? cOCItemList[index].statusAr : cOCItemList[index].status, style: TextStyle(fontSize: 14.0, letterSpacing: -0.56, fontWeight: FontWeight.bold)), - Container( - margin: EdgeInsets.only(top: 5.0), - child: Text(cOCItemList[index].formType.toString(), - style: TextStyle(fontSize: 14, fontWeight: FontWeight.w600, fontFamily: isArabic ? 'Cairo' : 'Poppins', color: Color(0xff2B353E), letterSpacing: -0.48, height: 18 / 12))), - MyRichText(TranslationBase.of(context).number + ": ", cOCItemList[index].itemID.toString(), isArabic), - Text(cOCItemList[index].cOCTitle, - style: TextStyle(fontSize: 14, fontWeight: FontWeight.w600, fontFamily: isArabic ? 'Cairo' : 'Poppins', color: Color(0xff2B353E), letterSpacing: -0.48, height: 18 / 12)), - ], - ), - Column( - crossAxisAlignment: CrossAxisAlignment.end, - children: [ - Text(cOCItemList[index].date.split(" ")[0], - style: TextStyle(fontSize: 12, fontWeight: FontWeight.w600, fontFamily: isArabic ? 'Cairo' : 'Poppins', color: Color(0xff2B353E), letterSpacing: -0.48)), - Text(cOCItemList[index].date.split(" ")[1].substring(0, 4), - style: TextStyle(fontSize: 12, fontWeight: FontWeight.w600, fontFamily: isArabic ? 'Cairo' : 'Poppins', color: Color(0xff2B353E), letterSpacing: -0.48)), - ], - ), - ], + margin: EdgeInsets.only(top: 12), + decoration: BoxDecoration( + color: (cOCItemList[index].statusId==7||cOCItemList[index].statusId==8)?CustomColors.accentColor:(cOCItemList[index].statusId==10||cOCItemList[index].statusId==6||cOCItemList[index].statusId==9)?CustomColors.green:CustomColors.orange, + borderRadius: BorderRadius.all( + Radius.circular(10.0), + ), + boxShadow: [ + BoxShadow( + color: Color(0xff000000).withOpacity(.05), + blurRadius: 27, + offset: Offset(0, -3), + ), + ], + ), + + child: Container( + margin: EdgeInsets.only(left: projectViewModel.isArabic ? 0 : 6, right: projectViewModel.isArabic ? 6 : 0), + padding: EdgeInsets.symmetric(vertical: 14, horizontal: 12), + decoration: BoxDecoration( + color: Colors.white, + border: Border.all(color: Colors.white, width: 1), + borderRadius: BorderRadius.only( + bottomRight: projectViewModel.isArabic ? Radius.circular(0) : Radius.circular(10.0), + topRight: projectViewModel.isArabic ? Radius.circular(0) : Radius.circular(10.0), + bottomLeft: projectViewModel.isArabic ? Radius.circular(10.0) : Radius.circular(0), + topLeft: projectViewModel.isArabic ? Radius.circular(10.0) : Radius.circular(0), + ), + ), + child: Padding( + padding: const EdgeInsets.all(12.0), + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text(isArabic ? cOCItemList[index].statusAr : cOCItemList[index].status, style: TextStyle(fontSize: 14.0, letterSpacing: -0.56, fontWeight: FontWeight.bold)), + Container( + margin: EdgeInsets.only(top: 5.0), + child: Text(cOCItemList[index].formType.toString(), + style: TextStyle(fontSize: 14, fontWeight: FontWeight.w600, fontFamily: isArabic ? 'Cairo' : 'Poppins', color: Color(0xff2B353E), letterSpacing: -0.48, height: 18 / 12))), + MyRichText(TranslationBase.of(context).number + ": ", cOCItemList[index].itemID.toString(), isArabic), + Text(cOCItemList[index].cOCTitle, + style: TextStyle(fontSize: 14, fontWeight: FontWeight.w600, fontFamily: isArabic ? 'Cairo' : 'Poppins', color: Color(0xff2B353E), letterSpacing: -0.48, height: 18 / 12)), + ], + ), + Column( + crossAxisAlignment: CrossAxisAlignment.end, + children: [ + Text(cOCItemList[index].date.split(" ")[0], + style: TextStyle(fontSize: 12, fontWeight: FontWeight.w600, fontFamily: isArabic ? 'Cairo' : 'Poppins', color: Color(0xff2B353E), letterSpacing: -0.48)), + Text(cOCItemList[index].date.split(" ")[1].substring(0, 4), + style: TextStyle(fontSize: 12, fontWeight: FontWeight.w600, fontFamily: isArabic ? 'Cairo' : 'Poppins', color: Color(0xff2B353E), letterSpacing: -0.48)), + ], + ), + ], + ), ), ), ), diff --git a/lib/pages/final_products_page.dart b/lib/pages/final_products_page.dart index 65adf282..51f8c8db 100644 --- a/lib/pages/final_products_page.dart +++ b/lib/pages/final_products_page.dart @@ -4,17 +4,17 @@ import 'package:diplomaticquarterapp/core/viewModels/pharmacyModule/product_deta import 'package:diplomaticquarterapp/core/viewModels/pharmacy_categorise_view_model.dart'; import 'package:diplomaticquarterapp/locator.dart'; import 'package:diplomaticquarterapp/pages/pharmacies/screens/cart-page/cart-order-page.dart'; +import 'package:diplomaticquarterapp/pages/pharmacies/screens/product-details/product-detail.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/pages/pharmacies/screens/product-details/product-detail.dart'; import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; import 'package:diplomaticquarterapp/widgets/others/StarRating.dart'; -import 'package:diplomaticquarterapp/widgets/others/app_scaffold_pharmacy_widget.dart'; +import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; import 'package:diplomaticquarterapp/widgets/others/network_base_view.dart'; import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart'; import 'package:flutter/material.dart'; -import 'package:flutter/src/widgets/image.dart' as flutterImage; + import 'base/base_view.dart'; dynamic languageID; @@ -22,8 +22,7 @@ dynamic languageID; class FinalProductsPage extends StatefulWidget { final String id; final int productType; // 1 : default, 2 : manufacturer , 3 : recently viewed - AuthenticatedUserObject authenticatedUserObject = - locator(); + AuthenticatedUserObject authenticatedUserObject = locator(); FinalProductsPage({this.id, this.productType = 1}); @@ -33,7 +32,9 @@ class FinalProductsPage extends StatefulWidget { class _FinalProductsPageState extends State { String id; + _FinalProductsPageState({this.id}); + String categoriseName = "Personal Care"; String appBarTitle = ""; bool styleOne = true; @@ -77,11 +78,10 @@ class _FinalProductsPageState extends State { } }, allowAny: true, - builder: (BuildContext context, PharmacyCategoriseViewModel model, - Widget child) => - PharmacyAppScaffold( + builder: (BuildContext context, PharmacyCategoriseViewModel model, Widget child) => AppScaffold( + isPharmacy: true, appBarTitle: appBarTitle, - isBottomBar: false, + isBottomBar: true, isShowAppBar: true, backgroundColor: Colors.white, isShowDecPage: false, @@ -91,16 +91,13 @@ class _FinalProductsPageState extends State { child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ -//Expanded widget heree if nassery - Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ Padding( padding: EdgeInsets.all(8.0), child: Texts( - "$appBarTitle " + - TranslationBase.of(context).products, + "$appBarTitle " + TranslationBase.of(context).products, fontWeight: FontWeight.w600, ), ), @@ -154,29 +151,21 @@ class _FinalProductsPageState extends State { ? Expanded( child: model.finalProducts.length > 0 ? Container( - height: MediaQuery.of(context).size.height * - 3.90, + height: MediaQuery.of(context).size.height * 3.90, child: GridView.builder( - gridDelegate: - SliverGridDelegateWithFixedCrossAxisCount( + gridDelegate: SliverGridDelegateWithFixedCrossAxisCount( crossAxisCount: 2, crossAxisSpacing: 0.5, mainAxisSpacing: 2.0, childAspectRatio: 1.0, ), itemCount: model.finalProducts.length, - itemBuilder: - (BuildContext context, int index) { + itemBuilder: (BuildContext context, int index) { return NetworkBaseView( baseViewModel: model, child: InkWell( child: Card( - color: - model.finalProducts[index] - .discountName != - null - ? Color(0xffFFFF00) - : Colors.white, + color: model.finalProducts[index].discountName != null ? Color(0xffFFFF00) : Colors.white, elevation: 0, shape: Border( right: BorderSide( @@ -198,226 +187,84 @@ class _FinalProductsPageState extends State { ), margin: EdgeInsets.symmetric( horizontal: 8, - vertical: 1, -// vertical: 2, + vertical: 4, ), child: Container( decoration: BoxDecoration( - borderRadius: - BorderRadius.only( - topLeft: Radius.circular( - 110.0), + borderRadius: BorderRadius.only( + topLeft: Radius.circular(110.0), ), color: Colors.white, ), - padding: EdgeInsets.symmetric( - horizontal: 4, - ), + padding: EdgeInsets.symmetric(horizontal: 0), width: MediaQuery.of(context).size.width / 3, -// width: MediaQuery.of(context) -// .size -// .width / -// 1, -// height: MediaQuery.of(context) -// .size -// .width / -// 1, child: Column( - crossAxisAlignment: - CrossAxisAlignment - .start, + crossAxisAlignment: CrossAxisAlignment.start, children: [ Stack( children: [ Container( - margin: EdgeInsets - .fromLTRB(0, 1, - 0, 0), - alignment: Alignment - .center, - child: - Image.network( - model - .finalProducts[ - index] - .images - .isNotEmpty - ? model - .finalProducts[ - index] - .images[0] - .thumb + 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: 70, + height: 80, ), ), -// Container( -// width: model -// .finalProducts[ -// index] -// .rxMessage != -// null -// ? MediaQuery.of( -// context) -// .size -// .width / -// 2.8 -// : 0, -// padding: -// EdgeInsets.all( -// 4), -// decoration: -// BoxDecoration( -// color: Color( -// 0xffb23838), -// borderRadius: BorderRadius.only( -// topLeft: Radius -// .circular( -// 6)), -// ), -// child: model -// .finalProducts[ -// index] -// .rxMessage != -// null -// ? Texts( -// languageID == -// 'ar' -// ? model -// .finalProducts[ -// index] -// .rxMessagen -// : model -// .finalProducts[index] -// .rxMessage, -// color: Colors -// .white, -// regular: -// true, -// fontSize: -// 10, -// fontWeight: -// FontWeight -// .w600, -// ) -// : Texts(""), -// ), - ], - ), - Container( - margin: EdgeInsets - .symmetric( - horizontal: 0, - vertical: 2, - ), - width: model - .finalProducts[ - index] - .rxMessage != - null - ? MediaQuery.of( - context) - .size - .width / - 2.0 - : 0, - padding: - EdgeInsets.fromLTRB(8,4,8,4), - decoration: - BoxDecoration( - color: Color( - 0xffb23838), -// borderRadius: BorderRadius.only( -// topLeft: Radius -// .circular( -// 6)), + Container( + width: model.finalProducts[index].rxMessage != null ? MediaQuery.of(context).size.width / 2.8 : 0, + padding: EdgeInsets.all(4), + decoration: BoxDecoration( + color: Color(0xffb23838), + borderRadius: BorderRadius.only(topLeft: Radius.circular(6)), ), - child: model - .finalProducts[ - index] - .rxMessage != - null + child: model.finalProducts[index].rxMessage != null ? Texts( - languageID == - 'ar' - ? model - .finalProducts[ - index] - .rxMessagen - : model - .finalProducts[index] - .rxMessage, - color: Colors - .white, - regular: - true, - fontSize: - 10, - fontWeight: - FontWeight - .w600, + languageID == 'ar' ? model.finalProducts[index].rxMessagen : model.finalProducts[index].rxMessage, + color: Colors.white, + regular: true, + fontSize: 10, + fontWeight: FontWeight.w600, ) : Texts(""), ), + ], + ), Container( - margin: EdgeInsets - .symmetric( + margin: EdgeInsets.symmetric( horizontal: 6, vertical: 0, ), child: Column( - crossAxisAlignment: - CrossAxisAlignment - .start, + crossAxisAlignment: CrossAxisAlignment.start, children: [ - if (model - .finalProducts[ - index] - .discountName != - null) + if (model.finalProducts[index].discountName != null) Container( - width: double - .infinity, + width: double.infinity, height: 13.0, - decoration: - BoxDecoration( - color: Color( - 0xff5AB145), + decoration: BoxDecoration( + color: Color(0xff5AB145), ), child: Center( child: Texts( - model - .finalProducts[ - index] - .discountName, - regular: - true, - color: Colors - .white, - fontSize: - 10.4, + model.finalProducts[index].discountName, + regular: true, + color: Colors.white, + fontSize: 10.4, ), ), ), Texts( - model - .finalProducts[ - index] - .name, + model.finalProducts[index].name, regular: true, fontSize: 12, - fontWeight: - FontWeight - .w400, + fontWeight: FontWeight.w400, ), Padding( - padding: - const EdgeInsets - .only( - top: 4, - bottom: - 4), + padding: const EdgeInsets.only(top: 4, bottom: 4), child: Texts( "SAR ${model.finalProducts[index].price}", bold: true, @@ -427,20 +274,15 @@ class _FinalProductsPageState extends State { Row( children: [ StarRating( - totalAverage: model.finalProducts[index].approvedRatingSum > - 0 - ? (model.finalProducts[index].approvedRatingSum.toDouble() / model.finalProducts[index].approvedRatingSum.toDouble()) - .toDouble() + totalAverage: model.finalProducts[index].approvedRatingSum > 0 + ? (model.finalProducts[index].approvedRatingSum.toDouble() / model.finalProducts[index].approvedRatingSum.toDouble()).toDouble() : 0, - forceStars: - true), + forceStars: true), Texts( "(${model.finalProducts[index].approvedTotalReviews})", regular: true, fontSize: 10, - fontWeight: - FontWeight - .w400, + fontWeight: FontWeight.w400, ) ], ), @@ -455,9 +297,7 @@ class _FinalProductsPageState extends State { Navigator.push( context, FadePage( - page: ProductDetailPage( - model.finalProducts[ - index]), + page: ProductDetailPage(model.finalProducts[index]), )), }, )); @@ -466,10 +306,8 @@ class _FinalProductsPageState extends State { ) : Container( child: Column( - mainAxisAlignment: - MainAxisAlignment.center, - crossAxisAlignment: - CrossAxisAlignment.center, + mainAxisAlignment: MainAxisAlignment.center, + crossAxisAlignment: CrossAxisAlignment.center, children: [ Align( alignment: Alignment.center, @@ -493,285 +331,143 @@ class _FinalProductsPageState extends State { : Expanded( child: model.finalProducts.length > 0 ? Container( - height: MediaQuery.of(context).size.height * - 5.0, + height: MediaQuery.of(context).size.height * 5.0, child: ListView.builder( itemCount: model.finalProducts.length, - itemBuilder: - (BuildContext context, int index) { + itemBuilder: (BuildContext context, int index) { return InkWell( child: Card( - child: Padding( - padding: const EdgeInsets.all(4.0), - child: Row( - children: [ - Stack( - children: [ - Column( - children: [ - Container( - decoration: - BoxDecoration(), - child: Padding( - padding: - EdgeInsets - .only( - left: 2.0, - top: 2.0, - right: 2.0, - ), + child: Row( + children: [ + 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( -// 8, 0, 8, 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 - .contain, - height: 70, - ), + ), + Container( + margin: EdgeInsets.fromLTRB(0, 0, 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.contain, + height: 80, ), - ], - ), -// Column( -// children: [ -// Container( -// width: model -// .finalProducts[ -// 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: Texts( -// model -// .finalProducts[ -// index] -// .rxMessage != -// null -// ? model -// .finalProducts[ -// index] -// .rxMessage -// : "", -// color: -// Colors.white, -// regular: true, -// fontSize: 10, -// fontWeight: -// FontWeight -// .w600, -// ), -// ), -// ], -// ), - - - - ], - ), - Container( - height: 130.0, - margin: - EdgeInsets.symmetric( - horizontal: 0, - vertical: 6, + ), + ], ), - child: Column( - mainAxisAlignment: - MainAxisAlignment - .spaceAround, - crossAxisAlignment: - CrossAxisAlignment - .start, + Column( children: [ - Container( - margin: EdgeInsets - .symmetric( - horizontal: 4, - vertical: 0, - ), - width: model - .finalProducts[ - index] - .rxMessage != - null - ? MediaQuery.of( - context) - .size - .width / - 2.0 - : 0, - padding: - EdgeInsets.all( - 4), - decoration: - BoxDecoration( - color: Color( - 0xffb23838), -// borderRadius: BorderRadius.only( -// topLeft: Radius -// .circular( -// 6)), + width: model.finalProducts[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 - .finalProducts[ - index] - .rxMessage != - null - ? Texts( - languageID == - 'ar' - ? model - .finalProducts[ - index] - .rxMessagen - : model - .finalProducts[index] - .rxMessage, - color: Colors - .white, - regular: - true, - fontSize: - 10, - fontWeight: - FontWeight - .w600, - ) - : Texts(""), - ), - SizedBox( - height: 4.0, - ), - Container( - width: MediaQuery.of( - context) - .size - .width * - 0.65, child: Texts( - model - .finalProducts[ - index] - .name, + model.finalProducts[index].rxMessage != null ? model.finalProducts[index].rxMessage : "", + color: Colors.white, regular: true, - fontSize: 13.2, - fontWeight: - FontWeight.w500, - maxLines: 5, + fontSize: 10, + fontWeight: FontWeight.w600, ), ), - SizedBox( - height: 8.0, - ), - Padding( - padding: - const EdgeInsets - .only( - top: 4, - bottom: 4), - child: Texts( - "SAR ${model.finalProducts[index].price}", - bold: true, - fontSize: 14, - ), - ), - Row( - children: [ - StarRating( - totalAverage: model - .finalProducts[ - index] - .approvedRatingSum > - 0 - ? (model.finalProducts[index].approvedRatingSum.toDouble() / - model.finalProducts[index].approvedRatingSum - .toDouble()) - .toDouble() - : 0, - forceStars: - true), - Texts( - "(${model.finalProducts[index].approvedTotalReviews})", - regular: true, - fontSize: 10, - fontWeight: - FontWeight - .w400, - ) - ], - ), ], ), + ], + ), + Container( + height: 100.0, + margin: EdgeInsets.symmetric( + horizontal: 6, + vertical: 0, ), - - widget.authenticatedUserObject.isLogin - ? Container( - child: IconButton( - icon: Icon(Icons.shopping_cart, - size: 18, - color: Colors.blue,), - onPressed: () async { - if(model.finalProducts[index].rxMessage == null){ - GifLoaderDialogUtils.showMyDialog(context); - await addToCartFunction(1, model.finalProducts[index].id); - GifLoaderDialogUtils.hideDialog(context); - Navigator.push( - context, - FadePage(page: CartOrderPage())); - } - else{ - AppToast.showErrorToast(message: TranslationBase.of(context).needPrescription); - } + child: Column( + mainAxisAlignment: MainAxisAlignment.spaceAround, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + SizedBox( + height: 4.0, + ), + Container( + width: MediaQuery.of(context).size.width * 0.65, + child: Texts( + model.finalProducts[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.finalProducts[index].price}", + bold: true, + fontSize: 14, + ), + ), + Row( + children: [ + StarRating( + totalAverage: model.finalProducts[index].approvedRatingSum > 0 + ? (model.finalProducts[index].approvedRatingSum.toDouble() / model.finalProducts[index].approvedRatingSum.toDouble()).toDouble() + : 0, + forceStars: true), + Texts( + "(${model.finalProducts[index].approvedTotalReviews})", + regular: true, + fontSize: 10, + fontWeight: FontWeight.w400, + ) + ], + ), + ], + ), + ), + widget.authenticatedUserObject.isLogin + ? Container( + child: IconButton( + icon: Icon( + Icons.shopping_cart, + size: 18, + color: Colors.blue, + ), + onPressed: () async { + if (model.finalProducts[index].rxMessage == null) { + GifLoaderDialogUtils.showMyDialog(context); + await addToCartFunction(1, model.finalProducts[index].id); + GifLoaderDialogUtils.hideDialog(context); + Navigator.push(context, FadePage(page: CartOrderPage())); + } else { + AppToast.showErrorToast(message: TranslationBase.of(context).needPrescription); + } // - } - - ), - ):Container(), - ], - ), + }), + ) + : Container(), + ], ), ), onTap: () => { Navigator.push( context, FadePage( - page: ProductDetailPage( - model.finalProducts[ - index]), + page: ProductDetailPage(model.finalProducts[index]), )), }, ); @@ -779,10 +475,8 @@ class _FinalProductsPageState extends State { ) : Container( child: Column( - mainAxisAlignment: - MainAxisAlignment.center, - crossAxisAlignment: - CrossAxisAlignment.center, + mainAxisAlignment: MainAxisAlignment.center, + crossAxisAlignment: CrossAxisAlignment.center, children: [ Align( alignment: Alignment.center, diff --git a/lib/pages/landing/home_page.dart b/lib/pages/landing/home_page.dart index 0882f361..f3af7c74 100644 --- a/lib/pages/landing/home_page.dart +++ b/lib/pages/landing/home_page.dart @@ -23,7 +23,6 @@ import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:flutter_svg/flutter_svg.dart'; -import 'package:hexcolor/hexcolor.dart'; import 'package:provider/provider.dart'; import 'landing_page_pharmcy.dart'; @@ -196,7 +195,7 @@ class _HomePageState extends State { width: double.infinity, height: 125, decoration: BoxDecoration( - color: HexColor('#A59E9E'), + color: Color(0xFFA59E9E), shape: BoxShape.rectangle, border: Border.all(color: Colors.transparent, width: 0.5), borderRadius: BorderRadius.all(Radius.circular(9)), @@ -231,7 +230,7 @@ class _HomePageState extends State { width: 90, height: 30, decoration: BoxDecoration( - color: HexColor('#D81A2E'), + color: Color(0xFFD81A2E), shape: BoxShape.rectangle, border: Border.all(color: Colors.transparent, width: 0.5), borderRadius: BorderRadius.all(Radius.circular(0)), @@ -255,7 +254,7 @@ class _HomePageState extends State { width: double.infinity, height: projectViewModel.isArabic ? 160 : 130, decoration: BoxDecoration( - color: HexColor('#A59E9E'), + color: Color(0xFFA59E9E), shape: BoxShape.rectangle, border: Border.all(color: Colors.transparent, width: 0.5), borderRadius: BorderRadius.all(Radius.circular(9)), @@ -341,7 +340,7 @@ class _HomePageState extends State { width: 90, height: 30, decoration: BoxDecoration( - color: HexColor('#D81A2E'), + color: Color(0xFFD81A2E), shape: BoxShape.rectangle, border: Border.all(color: Colors.transparent, width: 0.5), borderRadius: BorderRadius.all( @@ -593,7 +592,7 @@ class _HomePageState extends State { )), ), height: MediaQuery.of(context).size.width * 0.4, - color: HexColor("#747C80"), + color: Color(0xFF747C80), imageName: 'emergency_service_image.png', ), ], @@ -826,7 +825,6 @@ class _HomePageState extends State { } else { GifLoaderDialogUtils.showMyDialog(context); await pharmacyModuleViewModel.generatePharmacyToken().then((value) async { - await pharmacyModuleViewModel.verifyCustomer().then((value) { GifLoaderDialogUtils.hideDialog(context); Navigator.push(context, FadePage(page: LandingPagePharmacy())); @@ -868,7 +866,7 @@ class DashboardItem extends StatelessWidget { color: !hasBorder ? color != null ? color - : HexColor('#050705').withOpacity(opacity) + : Color(0xFF050705).withOpacity(opacity) : Colors.white, borderRadius: BorderRadius.circular(6.0), border: hasBorder ? Border.all(width: 1.0, color: const Color(0xffcccccc)) : Border.all(width: 0.0, color: Colors.transparent), diff --git a/lib/pages/landing/landing_page.dart b/lib/pages/landing/landing_page.dart index 7f4d8621..cb26c8b7 100644 --- a/lib/pages/landing/landing_page.dart +++ b/lib/pages/landing/landing_page.dart @@ -29,7 +29,6 @@ import 'package:diplomaticquarterapp/uitl/location_util.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:diplomaticquarterapp/widgets/bottom_navigation/bottom_nav_bar.dart'; import 'package:diplomaticquarterapp/widgets/buttons/floatingActionButton.dart'; -import 'package:diplomaticquarterapp/widgets/dialogs/confirm_dialog.dart'; import 'package:diplomaticquarterapp/widgets/drawer/app_drawer_widget.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; import 'package:diplomaticquarterapp/widgets/others/not_auh_page.dart'; @@ -242,15 +241,14 @@ class _LandingPageState extends State with WidgetsBindingObserver { pageController = PageController(keepPage: true); _firebaseMessaging.setAutoInitEnabled(true); - // signalRUtil = new SignalRUtil(hubName: "http://192.168.8.101:5001/chatHub", context: context); - // signalRUtil = new SignalRUtil(hubName: "https://api.cssynapses.com/chatsocket", context: context); + signalRUtil = new SignalRUtil(hubName: "https://VCallApi.hmg.com/WebRTCHub?source=mobile&username=2001273", context: context); locationUtils = new LocationUtils(isShowConfirmDialog: false, context: context); WidgetsBinding.instance.addPostFrameCallback((_) { if (projectViewModel.isLogin && !projectViewModel.isLoginChild) { familyFileProvider.getSharedRecordByStatus(); } - // signalRUtil.startSignalRConnection(); + if (!signalRUtil.getConnectionState()) signalRUtil.startSignalRConnection(); }); // HMG (Guest/Internet) Wifi Access [Zohaib Kambrani] //for now commented to reduce this call will enable it when needed @@ -507,91 +505,93 @@ class _LandingPageState extends State with WidgetsBindingObserver { model = Provider.of(context); // currentTab == 0 ? 45 : 0.0 return Scaffold( - appBar: currentTab == 0 ? PreferredSize( - preferredSize: Size.fromHeight(currentTab == 0 ? 45 : 0.0), - child: AppBar( - elevation: 0, - backgroundColor: CustomColors.backgroudGreyColor, - textTheme: TextTheme( - headline6: TextStyle(color: Theme.of(context).textTheme.headline1.color, fontWeight: FontWeight.bold), - ), - title: Text( - getText(currentTab).toUpperCase(), - style: TextStyle( - fontWeight: FontWeight.bold, - color: currentTab == 0 ? CustomColors.backgroudGreyColor : Theme.of(context).textTheme.headline1.color, - fontFamily: projectViewModel.isArabic ? 'Cairo' : 'Poppins'), - // bold: true, - ), - leading: Builder( - builder: (BuildContext context) { - return new Stack( - children: [ - currentTab == 0 - ? IconButton( - icon: SvgPicture.asset("assets/images/new/menu.svg"), - color: Theme.of(context).textTheme.headline1.color, - onPressed: () => Scaffold.of(context).openDrawer(), - ) - : IconButton( - icon: Icon(Icons.arrow_back), - onPressed: () { - setState(() { - currentTab = 0; - }); - - pageController.jumpToPage(0); - }, - ), - projectViewModel.isLogin && model.notificationsCount != null && !projectViewModel.isLoginChild - ? new Positioned( - right: projectViewModel.isArabic ? 35 : 0, - top: 5, - child: new Container( - padding: EdgeInsets.all(4), - decoration: new BoxDecoration( - color: CustomColors.accentColor, - borderRadius: BorderRadius.circular(20), - ), - constraints: BoxConstraints( - minWidth: 20, - minHeight: 20, - ), - child: new Text( - model.notificationsCount.toString(), - style: new TextStyle( - color: Colors.white, - fontSize: projectViewModel.isArabic ? 8 : 9, + appBar: currentTab == 0 + ? PreferredSize( + preferredSize: Size.fromHeight(currentTab == 0 ? 45 : 0.0), + child: AppBar( + elevation: 0, + backgroundColor: CustomColors.backgroudGreyColor, + textTheme: TextTheme( + headline6: TextStyle(color: Theme.of(context).textTheme.headline1.color, fontWeight: FontWeight.bold), + ), + title: Text( + getText(currentTab).toUpperCase(), + style: TextStyle( + fontWeight: FontWeight.bold, + color: currentTab == 0 ? CustomColors.backgroudGreyColor : Theme.of(context).textTheme.headline1.color, + fontFamily: projectViewModel.isArabic ? 'Cairo' : 'Poppins'), + // bold: true, + ), + leading: Builder( + builder: (BuildContext context) { + return new Stack( + children: [ + currentTab == 0 + ? IconButton( + icon: SvgPicture.asset("assets/images/new/menu.svg"), + color: Theme.of(context).textTheme.headline1.color, + onPressed: () => Scaffold.of(context).openDrawer(), + ) + : IconButton( + icon: Icon(Icons.arrow_back), + onPressed: () { + setState(() { + currentTab = 0; + }); + + pageController.jumpToPage(0); + }, ), - textAlign: TextAlign.center, - ), - ), - ) - : SizedBox() + projectViewModel.isLogin && model.notificationsCount != null && !projectViewModel.isLoginChild + ? new Positioned( + right: projectViewModel.isArabic ? 35 : 0, + top: 5, + child: new Container( + padding: EdgeInsets.all(4), + decoration: new BoxDecoration( + color: CustomColors.accentColor, + borderRadius: BorderRadius.circular(20), + ), + constraints: BoxConstraints( + minWidth: 20, + minHeight: 20, + ), + child: new Text( + model.notificationsCount.toString(), + style: new TextStyle( + color: Colors.white, + fontSize: projectViewModel.isArabic ? 8 : 9, + ), + textAlign: TextAlign.center, + ), + ), + ) + : SizedBox() + ], + ); + }, + ), + actions: [ + // IconButton( + // //iconSize: 70, + // icon: Icon( + // projectViewModel.isLogin ? Icons.settings : Icons.login, + // color: Theme.of(context).textTheme.headline1.color, + // ), + // onPressed: () { + // if (projectViewModel.isLogin) + // Navigator.of(context).pushNamed( + // SETTINGS, + // ); + // else + // login(); + // }, //do something, + // ) ], - ); - }, - ), - actions: [ - // IconButton( - // //iconSize: 70, - // icon: Icon( - // projectViewModel.isLogin ? Icons.settings : Icons.login, - // color: Theme.of(context).textTheme.headline1.color, - // ), - // onPressed: () { - // if (projectViewModel.isLogin) - // Navigator.of(context).pushNamed( - // SETTINGS, - // ); - // else - // login(); - // }, //do something, - // ) - ], - centerTitle: true, - ), - ) : null, + centerTitle: true, + ), + ) + : null, drawer: SafeArea(child: AppDrawer()), extendBody: false, body: WillPopScope( diff --git a/lib/pages/landing/landing_page_pharmcy.dart b/lib/pages/landing/landing_page_pharmcy.dart index 2e251f3b..9e650966 100644 --- a/lib/pages/landing/landing_page_pharmcy.dart +++ b/lib/pages/landing/landing_page_pharmcy.dart @@ -3,6 +3,7 @@ import 'package:diplomaticquarterapp/config/config.dart'; import 'package:diplomaticquarterapp/core/model/pharmacies/PharmacyProduct.dart'; import 'package:diplomaticquarterapp/core/service/client/base_app_client.dart'; import 'package:diplomaticquarterapp/core/service/parmacyModule/parmacy_module_service.dart'; +import 'package:diplomaticquarterapp/core/viewModels/PharmacyPagesViewModel.dart'; import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; import 'package:diplomaticquarterapp/pages/pharmacies/screens/cart-page/cart-order-page.dart'; import 'package:diplomaticquarterapp/pages/pharmacies/screens/pharmacy_module_page.dart'; @@ -14,36 +15,46 @@ 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/data_display/text.dart'; +import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; import 'package:diplomaticquarterapp/widgets/pharmacy/bottom_nav_pharmacy_bar.dart'; import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart'; import 'package:flutter/material.dart'; +import 'package:provider/provider.dart'; import '../../locator.dart'; class LandingPagePharmacy extends StatefulWidget { + final int currentTab; + + const LandingPagePharmacy({Key key, this.currentTab = 0}) : super(key: key); @override _LandingPagePharmacyState createState() => _LandingPagePharmacyState(); } class _LandingPagePharmacyState extends State { + ProjectViewModel projectProvider; int currentTab = 0; PageController pageController; - ProjectViewModel projectProvider; - - _changeCurrentTab(int tab) { - setState(() { - currentTab = tab; - pageController.jumpToPage(tab); - }); - } void initState() { super.initState(); locator().manufacturerList = []; locator().bestSellerProducts = []; locator().lastVisitedProducts = []; + pageController = + PageController(keepPage: true, initialPage: widget.currentTab); + setState(() { + currentTab = widget.currentTab; + }); + } - pageController = PageController(keepPage: true); + changeCurrentTab(int tab) { + if (pageController.hasClients) { + setState(() { + currentTab = tab; + pageController.jumpToPage(tab); + }); + } } @override @@ -52,75 +63,13 @@ class _LandingPagePharmacyState extends State { onWillPop: () async { return false; }, - child: Scaffold( - appBar: currentTab != 4 && currentTab != 3 - ? AppBar( - backgroundColor: Color(0xff5AB145), - elevation: 0, - title: Container( - height: MediaQuery.of(context).size.height * 0.056, - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(5.0), - color: Colors.white, - ), - child: InkWell( - child: Padding( - padding: EdgeInsets.all(5.0), - child: Row( - //crossAxisAlignment: CrossAxisAlignment.center, - mainAxisAlignment: MainAxisAlignment.start, - children: [ - Icon(Icons.search, size: 25.0), - SizedBox( - width: 15.0, - ), - Texts( - TranslationBase.of(context).searchProductHere, - fontSize: 13, - ) - ], - ), - ), - onTap: () { - Navigator.push( - context, - FadePage(page: SearchProductsPage()), - ); - }, - ), - ), - leading: Builder( - builder: (BuildContext context) { - return InkWell( - onTap: () { - setState(() { - currentTab = 0; - pageController.jumpToPage(0); - }); - }, - child: Container( - height: 2.0, - width: 10.0, - child: Image.asset( - 'assets/images/pharmacy_logo.png', - ), - ), - ); - }, - ), - actions: [ - IconButton( - // iconSize: 70, - icon: Image.asset( - 'assets/images/new-design/qr-code.png', - ), - onPressed: _scanQrAndGetProduct //do something, - ) - ], - centerTitle: true, - ) - : null, + child: AppScaffold( + isBottomBar: true, extendBody: false, + isShowDecPage: false, + isMainPharmacyPages: true, + currentTab: currentTab, + changeCurrentTab: changeCurrentTab, body: PageView( physics: NeverScrollableScrollPhysics(), controller: pageController, @@ -128,13 +77,9 @@ class _LandingPagePharmacyState extends State { PharmacyPage(), PharmacyCategorisePage(), PharmacyProfilePage(), - CartOrderPage(changeTab: _changeCurrentTab), + CartOrderPage(changeTab: changeCurrentTab), ], ), - bottomNavigationBar: BottomNavPharmacyBar( - changeIndex: _changeCurrentTab, - index: currentTab, - ), ), ); } diff --git a/lib/pages/login/login.dart b/lib/pages/login/login.dart index 38e180e2..49c8d0d6 100644 --- a/lib/pages/login/login.dart +++ b/lib/pages/login/login.dart @@ -8,6 +8,7 @@ import 'package:diplomaticquarterapp/locator.dart'; import 'package:diplomaticquarterapp/models/Appointments/toDoCountProviderModel.dart'; import 'package:diplomaticquarterapp/models/Authentication/check_activation_code_response.dart'; import 'package:diplomaticquarterapp/models/Authentication/check_paitent_authentication_req.dart'; +import 'package:diplomaticquarterapp/models/Authentication/checkpatient_for_registration.dart'; import 'package:diplomaticquarterapp/pages/landing/landing_page.dart'; import 'package:diplomaticquarterapp/pages/login/confirm-login.dart'; import 'package:diplomaticquarterapp/pages/login/login-type.dart'; @@ -39,7 +40,7 @@ class _Login extends State { final util = Utils(); final nationalIDorFile = TextEditingController(); final mobileNumberController = TextEditingController(); - final int loginType = LoginType.loginType; + int loginType = LoginType.loginType; String mobileNo; String countryCode = '966'; bool isButtonDisabled = true; @@ -61,10 +62,12 @@ class _Login extends State { // getDeviceToken(); super.initState(); - if (BASE_URL.contains("uat.")) { - nationalIDorFile.text = "2001273"; - mobileNumberController.text = mobileNo = "0555416043"; - }/* else { + // if (BASE_URL.contains("uat.")) { + // nationalIDorFile.text = "2001273"; + // mobileNumberController.text = mobileNo = "0555416043"; + // } + getRegisterData(); + /* else { nationalIDorFile.text = "3376044"; mobileNumberController.text = mobileNo = "0555416575"; }*/ @@ -107,7 +110,11 @@ class _Login extends State { style: TextStyle(fontSize: 16, fontWeight: FontWeight.w600, color: Color(0xff2B353E), letterSpacing: -0.64, height: 23 / 16), ), SizedBox(height: 20), - PhoneNumberSelectorWidget(onNumberChange: (value) => {mobileNo = value, validateForm()}, onCountryChange: (value) => countryCode = value), + PhoneNumberSelectorWidget( + onNumberChange: (value) => {mobileNo = value, validateForm()}, + onCountryChange: (value) => countryCode = value, + mobileNo: this.mobileNo, + ), SizedBox(height: 12), Directionality( textDirection: TextDirection.ltr, @@ -375,9 +382,17 @@ class _Login extends State { projectViewModel.platformBridge().registerHmgGeofences(); } -// showLoader(bool isTrue) { -// setState(() { -// isLoading = isTrue; -// }); -// } + getRegisterData() async { + var registerData = await sharedPref.getObject(REGISTER_DATA_FOR_LOGIIN); + await sharedPref.remove(REGISTER_DATA_FOR_LOGIIN); + + if (registerData != null) { + setState(() { + this.nationalIDorFile.text = registerData['PatientIdentificationID'].toString(); + this.isButtonDisabled = false; + this.loginType = 1; + this.mobileNo = registerData['PatientMobileNumber'].toString(); + }); + } + } } diff --git a/lib/pages/login/register.dart b/lib/pages/login/register.dart index b93e4e55..11ed7c79 100644 --- a/lib/pages/login/register.dart +++ b/lib/pages/login/register.dart @@ -5,6 +5,7 @@ import 'package:diplomaticquarterapp/models/Authentication/check_user_status_req import 'package:diplomaticquarterapp/models/Authentication/checkpatient_for_registration.dart'; import 'package:diplomaticquarterapp/pages/login/confirm-login.dart'; import 'package:diplomaticquarterapp/pages/login/login-type.dart'; +import 'package:diplomaticquarterapp/pages/login/login.dart'; import 'package:diplomaticquarterapp/services/authentication/auth_provider.dart'; import 'package:diplomaticquarterapp/uitl/app_shared_preferences.dart'; import 'package:diplomaticquarterapp/uitl/app_toast.dart'; @@ -19,11 +20,12 @@ 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:intl/intl.dart' as intl; import 'package:flutter_datetime_picker/flutter_datetime_picker.dart'; +import 'package:intl/intl.dart' as intl; class Register extends StatefulWidget { final Function changePageViewIndex; + const Register({Key key, this.changePageViewIndex}) : super(key: key); @override @@ -326,15 +328,18 @@ class _Register extends State { var nRequest = request.toJson(); nRequest['LogInTokenID'] = response['LogInTokenID']; if (response['hasFile'] == true) { - // AppToast.showErrorToast(message: response['ErrorEndUserMessage']); - AlertDialogBox( - context: context, - confirmMessage: response['ErrorEndUserMessage'], - okText: TranslationBase.of(context).ok, - okFunction: () { - AlertDialogBox.closeAlertDialog(context); - Navigator.of(context).pop(); - }).showAlertDialog(context); + ConfirmDialog dialog = new ConfirmDialog( + context: context, + confirmMessage: response['ErrorEndUserMessage'], + okText: TranslationBase.of(context).ok, + cancelText: TranslationBase.of(context).cancel, + okFunction: () { + AlertDialogBox.closeAlertDialog(context); + sharedPref.setObject(REGISTER_DATA_FOR_LOGIIN, nRequest); + Navigator.of(context).push(FadePage(page: Login())); + }, + cancelFunction: () {}) + .showAlertDialog(context); } else { nRequest['forRegister'] = true; nRequest['isRegister'] = true; diff --git a/lib/pages/login/welcome.dart b/lib/pages/login/welcome.dart index 26b6421c..8688fec3 100644 --- a/lib/pages/login/welcome.dart +++ b/lib/pages/login/welcome.dart @@ -1,5 +1,6 @@ import 'package:diplomaticquarterapp/pages/login/login-type.dart'; import 'package:diplomaticquarterapp/pages/login/register.dart'; +import 'package:diplomaticquarterapp/pages/login/register_new.dart'; import 'package:diplomaticquarterapp/theme/colors.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:diplomaticquarterapp/widgets/buttons/defaultButton.dart'; @@ -78,7 +79,7 @@ class _WelcomeLogin extends State { child: DefaultButton( TranslationBase.of(context).no, () => { - Navigator.of(context).push(FadePage(page: Register())), + Navigator.of(context).push(FadePage(page: RegisterNew())), }, color: CustomColors.accentColor, textColor: Colors.white, diff --git a/lib/pages/medical/prescriptions/PrescriptionOrderOverveiw.dart b/lib/pages/medical/prescriptions/PrescriptionOrderOverveiw.dart index 986fb848..719b2196 100644 --- a/lib/pages/medical/prescriptions/PrescriptionOrderOverveiw.dart +++ b/lib/pages/medical/prescriptions/PrescriptionOrderOverveiw.dart @@ -9,9 +9,10 @@ import 'package:diplomaticquarterapp/theme/colors.dart'; import 'package:diplomaticquarterapp/uitl/gif_loader_dialog_utils.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:diplomaticquarterapp/uitl/utils_new.dart'; -import 'package:diplomaticquarterapp/widgets/buttons/secondary_button.dart'; +import 'package:diplomaticquarterapp/widgets/buttons/defaultButton.dart'; import 'package:diplomaticquarterapp/widgets/dialogs/ConfirmWithMessageDialog.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; +import 'package:diplomaticquarterapp/widgets/show_zoom_image_dialog.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; @@ -101,23 +102,43 @@ class PrescriptionOrderOverview extends StatelessWidget { prescriptionReportEnhList.length, (index) => Container( margin: EdgeInsets.all(0.0), - decoration: cardRadius(0), + // decoration: cardRadius(0), child: Row( children: [ - Container( - margin: EdgeInsets.only(bottom: 10.0), - decoration: BoxDecoration( - border: Border.all(width: 1.0, color: Color(0xffEBEBEB)), - borderRadius: BorderRadius.all(Radius.circular(30.0)), - ), - child: ClipRRect( - borderRadius: BorderRadius.all(Radius.circular(30)), - child: Image.network( - prescriptionReportEnhList[index].imageSRCUrl, - fit: BoxFit.cover, - width: 48, - height: 48, - ), + InkWell( + onTap: () { + showZoomImageDialog(context, prescriptionReportEnhList[index].imageSRCUrl); + }, + child: Stack( + alignment: Alignment.center, + children: [ + Container( + margin: EdgeInsets.only(bottom: 10.0), + decoration: BoxDecoration( + border: Border.all(width: 1.0, color: Color(0xffEBEBEB)), + borderRadius: BorderRadius.all(Radius.circular(30.0)), + ), + child: ClipRRect( + borderRadius: BorderRadius.all(Radius.circular(30)), + child: Image.network( + prescriptionReportEnhList[index].imageSRCUrl, + fit: BoxFit.cover, + width: 48, + height: 48, + ), + ), + ), + Container( + margin: EdgeInsets.only(bottom: 10.0), + child: Icon( + Icons.search, + size: 18, + color: Colors.white, + ), + padding: EdgeInsets.all(3), + decoration: containerRadius(Colors.black.withOpacity(0.3), 200), + ) + ], ), ), SizedBox(width: 14), @@ -153,15 +174,14 @@ class PrescriptionOrderOverview extends StatelessWidget { ), ), Container( - decoration: cardRadius(0), + // decoration: cardRadius(0), margin: EdgeInsets.zero, child: Container( width: double.infinity, margin: EdgeInsets.all(12), - child: SecondaryButton( - label: TranslationBase.of(context).submit.toUpperCase(), - color: CustomColors.accentColor, - onTap: () async { + child: DefaultButton( + TranslationBase.of(context).submit.toUpperCase(), + () async { showDialog( context: context, child: ConfirmWithMessageDialog( diff --git a/lib/pages/medical/prescriptions/prescription_details_page.dart b/lib/pages/medical/prescriptions/prescription_details_page.dart index 3fbc2baf..5a47ec3b 100644 --- a/lib/pages/medical/prescriptions/prescription_details_page.dart +++ b/lib/pages/medical/prescriptions/prescription_details_page.dart @@ -23,6 +23,7 @@ import 'package:provider/provider.dart'; class PrescriptionDetailsPage extends StatelessWidget { final PrescriptionReport prescriptionReport; final Prescriptions prescriptions; + PrescriptionDetailsPage({Key key, this.prescriptionReport, this.prescriptions}); @override @@ -111,14 +112,18 @@ class PrescriptionDetailsPage extends StatelessWidget { decoration: cardRadius(2000), ), Container( - child: Icon(Icons.search,size: 18,color: Colors.white,), + child: Icon( + Icons.search, + size: 18, + color: Colors.white, + ), padding: EdgeInsets.all(6), decoration: containerRadius(Colors.black.withOpacity(0.3), 200), ) ], ), - onTap: (){ - showZoomImageDialog(context, prescriptionReport.imageSRCUrl); + onTap: () { + showZoomImageDialog(context, prescriptionReport.imageSRCUrl); }, ), SizedBox(width: 12), diff --git a/lib/pages/medical/prescriptions/prescription_items_page.dart b/lib/pages/medical/prescriptions/prescription_items_page.dart index 4611eed1..0e627a95 100644 --- a/lib/pages/medical/prescriptions/prescription_items_page.dart +++ b/lib/pages/medical/prescriptions/prescription_items_page.dart @@ -62,107 +62,135 @@ class PrescriptionItemsPage extends StatelessWidget { prescriptions.noOfPatientsRate, model.user.emailAddress, ), - isNeedToShowButton: projectViewModel.havePrivilege(13), + isNeedToShowButton: (model.prescriptionReportListINP.length > 0 || model.prescriptionReportEnhList.length > 0) ? projectViewModel.havePrivilege(13) : false, showConfirmMessageDialog: false, onTap: () { showConfirmMessage(context, model); }, ), if (!prescriptions.isInOutPatient) - ListView.separated( - itemBuilder: (context, index) { - return InkWell( - onTap: () { - Navigator.push( - context, - FadePage( - page: PrescriptionDetailsPageINP( - prescriptionReport: model.prescriptionReportListINP[index], - ), - ), - ); - }, - child: Container( - width: double.infinity, - child: Container( - margin: EdgeInsets.only(left: 16, right: 16, top: index == 0 ? 16 : 4, bottom: 4), - decoration: cardRadius(12), - child: Padding( - padding: EdgeInsets.only(top: 12, bottom: 20, left: projectViewModel.isArabic ? 12 : 20, right: projectViewModel.isArabic ? 20 : 12), - child: Row( - children: [ - Flexible( - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Text( - model.prescriptionReportListINP[index].itemDescription.isNotEmpty - ? model.prescriptionReportListINP[index].itemDescription - : model.prescriptionReportListINP[index].itemDescriptionN ?? '', - style: TextStyle( - fontSize: 16, - letterSpacing: -0.64, - fontWeight: FontWeight.w600, - ), - ), - mHeight(10), - Row( + model.prescriptionReportListINP.length > 0 + ? ListView.separated( + itemBuilder: (context, index) { + return InkWell( + onTap: () { + Navigator.push( + context, + FadePage( + page: PrescriptionDetailsPageINP( + prescriptionReport: model.prescriptionReportListINP[index], + ), + ), + ); + }, + child: Container( + width: double.infinity, + child: Container( + margin: EdgeInsets.only(left: 16, right: 16, top: index == 0 ? 16 : 4, bottom: 4), + decoration: cardRadius(12), + child: Padding( + padding: EdgeInsets.only(top: 12, bottom: 20, left: projectViewModel.isArabic ? 12 : 20, right: projectViewModel.isArabic ? 20 : 12), + child: Row( + children: [ + Flexible( + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, children: [ - InkWell( - child: Stack( - alignment: Alignment.center, - children: [ - Container( - child: Image.network( - model.prescriptionReportListINP[index].imageSRCUrl, - fit: BoxFit.cover, - width: 60, - height: 60, - ), - margin: EdgeInsets.zero, - clipBehavior: Clip.antiAlias, - decoration: cardRadius(2000), - ), - Container( - child: Icon(Icons.search,size: 18,color: Colors.white,), - padding: EdgeInsets.all(6), - decoration: containerRadius(Colors.black.withOpacity(0.3), 200), - ) - ], + Text( + model.prescriptionReportListINP[index].itemDescription.isNotEmpty + ? model.prescriptionReportListINP[index].itemDescription + : model.prescriptionReportListINP[index].itemDescriptionN ?? '', + style: TextStyle( + fontSize: 16, + letterSpacing: -0.64, + fontWeight: FontWeight.w600, ), - onTap: (){ - showZoomImageDialog(context, model.prescriptionReportListINP[index].imageSRCUrl,); - }, ), - mWidth(12), - Column( - crossAxisAlignment: CrossAxisAlignment.start, + mHeight(10), + Row( children: [ - Row( - children: [ - Text( - TranslationBase.of(context).route + ": ", - style: TextStyle( - color: Colors.grey, - fontSize: 10, - letterSpacing: -0.4, - fontWeight: FontWeight.w600, + InkWell( + child: Stack( + alignment: Alignment.center, + children: [ + Container( + child: Image.network( + model.prescriptionReportListINP[index].imageSRCUrl, + fit: BoxFit.cover, + width: 60, + height: 60, + ), + margin: EdgeInsets.zero, + clipBehavior: Clip.antiAlias, + decoration: cardRadius(2000), ), - ), - Text( - model.prescriptionReportListINP[index].route, - style: TextStyle( - fontSize: 12, - letterSpacing: -0.48, - fontWeight: FontWeight.w600, - ), - ), - ], + Container( + child: Icon( + Icons.search, + size: 18, + color: Colors.white, + ), + padding: EdgeInsets.all(6), + decoration: containerRadius(Colors.black.withOpacity(0.3), 200), + ) + ], + ), + onTap: () { + showZoomImageDialog( + context, + model.prescriptionReportListINP[index].imageSRCUrl, + ); + }, ), - Row( + mWidth(12), + Column( + crossAxisAlignment: CrossAxisAlignment.start, children: [ + Row( + children: [ + Text( + TranslationBase.of(context).route + ": ", + style: TextStyle( + color: Colors.grey, + fontSize: 10, + letterSpacing: -0.4, + fontWeight: FontWeight.w600, + ), + ), + Text( + model.prescriptionReportListINP[index].route, + style: TextStyle( + fontSize: 12, + letterSpacing: -0.48, + fontWeight: FontWeight.w600, + ), + ), + ], + ), + Row( + children: [ + Text( + TranslationBase.of(context).dailyDoses + ": ", + style: TextStyle( + color: Colors.grey, + fontSize: 10, + letterSpacing: -0.4, + fontWeight: FontWeight.w600, + ), + ), + Text( + model.prescriptionReportListINP[index].doseDailyQuantity.toString(), + style: TextStyle( + fontSize: 12, + letterSpacing: -0.48, + fontWeight: FontWeight.w600, + ), + ), + ], + ), + mHeight(12), Text( - TranslationBase.of(context).dailyDoses + ": ", + model.prescriptionReportListINP[index].remarks, style: TextStyle( color: Colors.grey, fontSize: 10, @@ -170,184 +198,180 @@ class PrescriptionItemsPage extends StatelessWidget { fontWeight: FontWeight.w600, ), ), - Text( - model.prescriptionReportListINP[index].doseDailyQuantity.toString(), - style: TextStyle( - fontSize: 12, - letterSpacing: -0.48, - fontWeight: FontWeight.w600, - ), - ), ], - ), - mHeight(12), - Text( - model.prescriptionReportListINP[index].remarks, - style: TextStyle( - color: Colors.grey, - fontSize: 10, - letterSpacing: -0.4, - fontWeight: FontWeight.w600, - ), - ), + ) ], - ) + ), ], ), - ], - ), - ), - Icon( - Icons.arrow_forward, - size: 16, + ), + Icon( + Icons.arrow_forward, + size: 16, + ), + ], ), - ], - ), - ), - ), - ), - ); - }, - separatorBuilder: (context, index) { - return mHeight(8); - }, - physics: NeverScrollableScrollPhysics(), - shrinkWrap: true, - itemCount: model.prescriptionReportListINP.length) - else - ListView.separated( - padding: EdgeInsets.all(21), - itemBuilder: (context, index) { - return InkWell( - onTap: () { - PrescriptionReport prescriptionReport = PrescriptionReport( - imageSRCUrl: model.prescriptionReportEnhList[index].imageSRCUrl, - itemDescription: model.prescriptionReportEnhList[index].itemDescription, - itemDescriptionN: model.prescriptionReportEnhList[index].itemDescription, - routeN: model.prescriptionReportEnhList[index].route, - frequency: model.prescriptionReportEnhList[index].frequency, - frequencyN: model.prescriptionReportEnhList[index].frequency, - doseDailyQuantity: model.prescriptionReportEnhList[index].doseDailyQuantity, - days: model.prescriptionReportEnhList[index].days, - itemID: model.prescriptionReportEnhList[index].itemID, - remarks: model.prescriptionReportEnhList[index].remarks); - Navigator.push( - context, - FadePage( - page: PrescriptionDetailsPage( - prescriptionReport: prescriptionReport, - prescriptions: prescriptions, + ), ), ), ); }, - child: Container( - decoration: BoxDecoration( - color: Colors.white, - borderRadius: BorderRadius.all( - Radius.circular(10.0), - ), - boxShadow: [ - BoxShadow( - color: Color(0xff000000).withOpacity(.05), - blurRadius: 27, - offset: Offset(0, -3), + separatorBuilder: (context, index) { + return mHeight(8); + }, + physics: NeverScrollableScrollPhysics(), + shrinkWrap: true, + itemCount: model.prescriptionReportListINP.length) + : Padding( + padding: const EdgeInsets.only(top: 150.0), + child: getNoDataWidget(context), + ) + else + model.prescriptionReportEnhList.length > 0 + ? ListView.separated( + padding: EdgeInsets.all(21), + itemBuilder: (context, index) { + return InkWell( + onTap: () { + PrescriptionReport prescriptionReport = PrescriptionReport( + imageSRCUrl: model.prescriptionReportEnhList[index].imageSRCUrl, + itemDescription: model.prescriptionReportEnhList[index].itemDescription, + itemDescriptionN: model.prescriptionReportEnhList[index].itemDescription, + routeN: model.prescriptionReportEnhList[index].route, + frequency: model.prescriptionReportEnhList[index].frequency, + frequencyN: model.prescriptionReportEnhList[index].frequency, + doseDailyQuantity: model.prescriptionReportEnhList[index].doseDailyQuantity, + days: model.prescriptionReportEnhList[index].days, + itemID: model.prescriptionReportEnhList[index].itemID, + remarks: model.prescriptionReportEnhList[index].remarks); + Navigator.push( + context, + FadePage( + page: PrescriptionDetailsPage( + prescriptionReport: prescriptionReport, + prescriptions: prescriptions, + ), + ), + ); + }, + child: Container( + decoration: BoxDecoration( + color: Colors.white, + borderRadius: BorderRadius.all( + Radius.circular(10.0), + ), + boxShadow: [ + BoxShadow( + color: Color(0xff000000).withOpacity(.05), + blurRadius: 27, + offset: Offset(0, -3), + ), + ], ), - ], - ), - child: Padding( - padding: EdgeInsets.only(top: 12, bottom: 20, left: projectViewModel.isArabic ? 12 : 20, right: projectViewModel.isArabic ? 20 : 12), - child: Row( - children: [ - Flexible( - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Text( - (model.prescriptionReportEnhList[index].itemDescription.isNotEmpty - ? model.prescriptionReportEnhList[index].itemDescription - : model.prescriptionReportEnhList[index].itemDescriptionN ?? '') - .toLowerCase() - .capitalizeFirstofEach, - style: TextStyle( - fontSize: 16, - color: Color(0xff2E303A), - letterSpacing: -0.64, - fontWeight: FontWeight.w600, - ), - ), - mHeight(10), - Row( + child: Padding( + padding: EdgeInsets.only(top: 12, bottom: 20, left: projectViewModel.isArabic ? 12 : 20, right: projectViewModel.isArabic ? 20 : 12), + child: Row( + children: [ + Flexible( + child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ - InkWell( - child: Stack( - alignment: Alignment.center, - children: [ - Container( - child: Image.network( - model.prescriptionReportEnhList[index].imageSRCUrl, - fit: BoxFit.cover, - width: 60, - height: 60, - ), - margin: EdgeInsets.zero, - clipBehavior: Clip.antiAlias, - decoration: cardRadius(2000), - ), - Container( - child: Icon(Icons.search,size: 18,color: Colors.white,), - padding: EdgeInsets.all(6), - decoration: containerRadius(Colors.black.withOpacity(0.3), 200), - ) - ], + Text( + (model.prescriptionReportEnhList[index].itemDescription.isNotEmpty + ? model.prescriptionReportEnhList[index].itemDescription + : model.prescriptionReportEnhList[index].itemDescriptionN ?? '') + .toLowerCase() + .capitalizeFirstofEach, + style: TextStyle( + fontSize: 16, + color: Color(0xff2E303A), + letterSpacing: -0.64, + fontWeight: FontWeight.w600, ), - onTap: (){ - showZoomImageDialog(context, model.prescriptionReportEnhList[index].imageSRCUrl,); - }, ), - mWidth(12), - Expanded( - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - MyRichText(TranslationBase.of(context).route + ": ", model.prescriptionReportEnhList[index].route, projectViewModel.isArabic), - MyRichText(TranslationBase.of(context).dailyDoses + ": ", model.prescriptionReportEnhList[index].doseDailyQuantity.toString(), - projectViewModel.isArabic), - mHeight(9), - Text( - model.prescriptionReportEnhList[index].remarks, - style: TextStyle( - color: Color(0xff575757), - fontSize: 12, - letterSpacing: -0.4, - fontWeight: FontWeight.w600, - ), + mHeight(10), + Row( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + InkWell( + child: Stack( + alignment: Alignment.center, + children: [ + Container( + child: Image.network( + model.prescriptionReportEnhList[index].imageSRCUrl, + fit: BoxFit.cover, + width: 60, + height: 60, + ), + margin: EdgeInsets.zero, + clipBehavior: Clip.antiAlias, + decoration: cardRadius(2000), + ), + Container( + child: Icon( + Icons.search, + size: 18, + color: Colors.white, + ), + padding: EdgeInsets.all(6), + decoration: containerRadius(Colors.black.withOpacity(0.3), 200), + ) + ], ), - ], - ), - ) + onTap: () { + showZoomImageDialog( + context, + model.prescriptionReportEnhList[index].imageSRCUrl, + ); + }, + ), + mWidth(12), + Expanded( + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + MyRichText(TranslationBase.of(context).route + ": ", model.prescriptionReportEnhList[index].route, projectViewModel.isArabic), + MyRichText(TranslationBase.of(context).dailyDoses + ": ", model.prescriptionReportEnhList[index].doseDailyQuantity.toString(), + projectViewModel.isArabic), + mHeight(9), + Text( + model.prescriptionReportEnhList[index].remarks, + style: TextStyle( + color: Color(0xff575757), + fontSize: 12, + letterSpacing: -0.4, + fontWeight: FontWeight.w600, + ), + ), + ], + ), + ) + ], + ), ], ), - ], - ), - ), - Icon( - Icons.arrow_forward, - size: 16, + ), + Icon( + Icons.arrow_forward, + size: 16, + ), + ], ), - ], + ), ), - ), - ), - ); - }, - separatorBuilder: (context, index) { - return mHeight(12); - }, - shrinkWrap: true, - physics: NeverScrollableScrollPhysics(), - itemCount: model.prescriptionReportEnhList.length), + ); + }, + separatorBuilder: (context, index) { + return mHeight(12); + }, + shrinkWrap: true, + physics: NeverScrollableScrollPhysics(), + itemCount: model.prescriptionReportEnhList.length) + : Padding( + padding: const EdgeInsets.only(top: 150.0), + child: getNoDataWidget(context), + ), ], ), ), diff --git a/lib/pages/medical/prescriptions/prescriptions_history_page.dart b/lib/pages/medical/prescriptions/prescriptions_history_page.dart index 1da0adb6..adce13bb 100644 --- a/lib/pages/medical/prescriptions/prescriptions_history_page.dart +++ b/lib/pages/medical/prescriptions/prescriptions_history_page.dart @@ -1,12 +1,11 @@ +import 'package:diplomaticquarterapp/core/enum/viewstate.dart'; import 'package:diplomaticquarterapp/core/viewModels/medical/prescriptions_view_model.dart'; import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; -import 'package:diplomaticquarterapp/pages/medical/prescriptions/prescriptions_history_details_page.dart'; +import 'package:diplomaticquarterapp/pages/base/base_view.dart'; import 'package:diplomaticquarterapp/uitl/date_uitl.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:diplomaticquarterapp/uitl/utils_new.dart'; -import 'package:diplomaticquarterapp/pages/base/base_view.dart'; 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'; @@ -25,126 +24,130 @@ class PrescriptionsHistoryPage extends StatelessWidget { onModelReady: (model) => model.getPrescriptionsOrders(showLoading: true), builder: (_, model, widget) => AppScaffold( baseViewModel: prescriptionsViewModel, - body: ListView.separated( - physics: BouncingScrollPhysics(), - padding: EdgeInsets.all(21), - separatorBuilder: (context, index) { - return SizedBox(height: 12); - }, - itemBuilder: (context, index) { - int status = prescriptionsViewModel.prescriptionsHistory[index].status; - String _statusDisp = projectViewModel.isArabic ? prescriptionsViewModel.prescriptionsHistory[index].descriptionN : prescriptionsViewModel.prescriptionsHistory[index].description; - Color _color; - if (status == 1) { - //pending - _color = Color(0xffCC9B14); - } else if (status == 2) { - //processing - _color = Color(0xff2E303A); - } else if (status == 3) { - //completed - _color = Color(0xff359846); - } else if (status == 4) { - //cancel // Rejected - _color = Color(0xffD02127); - } + body: model.state != ViewState.Busy + ? prescriptionsViewModel.prescriptionsHistory.length > 0 + ? ListView.separated( + physics: BouncingScrollPhysics(), + padding: EdgeInsets.all(21), + separatorBuilder: (context, index) { + return SizedBox(height: 12); + }, + itemBuilder: (context, index) { + int status = prescriptionsViewModel.prescriptionsHistory[index].statusId; + String _statusDisp = prescriptionsViewModel.prescriptionsHistory[index].statusText; + Color _color; + if (status == 1) { + //pending + _color = Color(0xffCC9B14); + } else if (status == 2) { + //processing + _color = Color(0xff2E303A); + } else if (status == 3) { + //completed + _color = Color(0xff359846); + } else if (status == 4 || status == 6 || status == 7) { + //cancel // Rejected + _color = Color(0xffD02127); + } - return InkWell( - onTap: () async { - final result = await Navigator.push( - context, - FadePage( - page: PrescriptionsHistoryDetailsPage( - prescriptionsOrder: prescriptionsViewModel.prescriptionsHistory[index], - ), - ), - ); - if (result != null) { - showOrderLog(); - } - }, - child: Container( - height: 65, - decoration: BoxDecoration( - color: Colors.white, - borderRadius: BorderRadius.all( - Radius.circular(10.0), - ), - boxShadow: [ - BoxShadow( - color: Color(0xff000000).withOpacity(.05), - blurRadius: 27, - offset: Offset(0, -3), - ), - ], - ), - child: Row( - mainAxisSize: MainAxisSize.min, - children: [ - Container( - width: 6, - decoration: BoxDecoration( - color: _color, - borderRadius: BorderRadius.only( - topLeft: projectViewModel.isArabic ? Radius.circular(0.0) : Radius.circular(10.0), - bottomLeft: projectViewModel.isArabic ? Radius.circular(0.0) : Radius.circular(10.0), - topRight: projectViewModel.isArabic ? Radius.circular(10.0) : Radius.circular(0.0), - bottomRight: projectViewModel.isArabic ? Radius.circular(10.0) : Radius.circular(0.0), - ), - ), - ), - Expanded( - child: Padding( - padding: EdgeInsets.only(left: projectViewModel.isArabic ? 6 : 12, right: projectViewModel.isArabic ? 12 : 6), - child: Row( - crossAxisAlignment: CrossAxisAlignment.start, - mainAxisSize: MainAxisSize.min, - children: [ - Expanded( - child: Column( - mainAxisSize: MainAxisSize.min, - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Text( - _statusDisp, - style: TextStyle(fontSize: 12, fontWeight: FontWeight.w600, color: _color, letterSpacing: -0.4, height: 16 / 10), - ), - Text( - '${TranslationBase.of(context).orderNo}. ${prescriptionsViewModel.prescriptionsHistory[index].iD}', - style: TextStyle(fontSize: 16, fontWeight: FontWeight.w600, color: Color(0xff2E303A), letterSpacing: -0.64, height: 25 / 16), - ), - ], - ), + return InkWell( + onTap: () async { + // final result = await Navigator.push( + // context, + // FadePage( + // page: PrescriptionsHistoryDetailsPage( + // prescriptionsOrder: prescriptionsViewModel.prescriptionsHistory[index], + // ), + // ), + // ); + // if (result != null) { + // showOrderLog(); + // } + }, + child: Container( + height: 65, + decoration: BoxDecoration( + color: Colors.white, + borderRadius: BorderRadius.all( + Radius.circular(10.0), ), - Column( - mainAxisSize: MainAxisSize.min, - crossAxisAlignment: CrossAxisAlignment.end, - children: [ - Text( - DateUtil.getDayMonthYearDateFormatted(prescriptionsViewModel.prescriptionsHistory[index].createdOn), - style: TextStyle(fontSize: 12, fontWeight: FontWeight.w600, color: Color(0xff2B353E), letterSpacing: -0.4, height: 16 / 10), + boxShadow: [ + BoxShadow( + color: Color(0xff000000).withOpacity(.05), + blurRadius: 27, + offset: Offset(0, -3), + ), + ], + ), + child: Row( + mainAxisSize: MainAxisSize.min, + children: [ + Container( + width: 6, + decoration: BoxDecoration( + color: _color, + borderRadius: BorderRadius.only( + topLeft: projectViewModel.isArabic ? Radius.circular(0.0) : Radius.circular(10.0), + bottomLeft: projectViewModel.isArabic ? Radius.circular(0.0) : Radius.circular(10.0), + topRight: projectViewModel.isArabic ? Radius.circular(10.0) : Radius.circular(0.0), + bottomRight: projectViewModel.isArabic ? Radius.circular(10.0) : Radius.circular(0.0), + ), ), - Text( - DateUtil.formatDateToTimeLang(prescriptionsViewModel.prescriptionsHistory[index].createdOn, false), - style: TextStyle(fontSize: 12, fontWeight: FontWeight.w600, color: Color(0xff575757), letterSpacing: -0.4, height: 16 / 10), + ), + Expanded( + child: Padding( + padding: EdgeInsets.only(left: projectViewModel.isArabic ? 6 : 12, right: projectViewModel.isArabic ? 12 : 6), + child: Row( + crossAxisAlignment: CrossAxisAlignment.start, + mainAxisSize: MainAxisSize.min, + children: [ + Expanded( + child: Column( + mainAxisSize: MainAxisSize.min, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + _statusDisp, + style: TextStyle(fontSize: 12, fontWeight: FontWeight.w600, color: _color, letterSpacing: -0.4, height: 16 / 10), + ), + Text( + '${TranslationBase.of(context).orderNo}. ${prescriptionsViewModel.prescriptionsHistory[index].iD}', + style: TextStyle(fontSize: 16, fontWeight: FontWeight.w600, color: Color(0xff2E303A), letterSpacing: -0.64, height: 25 / 16), + ), + ], + ), + ), + Column( + mainAxisSize: MainAxisSize.min, + crossAxisAlignment: CrossAxisAlignment.end, + children: [ + Text( + DateUtil.getDayMonthYearDateFormatted(DateTime.tryParse(prescriptionsViewModel.prescriptionsHistory[index].created)), + style: TextStyle(fontSize: 12, fontWeight: FontWeight.w600, color: Color(0xff2B353E), letterSpacing: -0.4, height: 16 / 10), + ), + Text( + DateUtil.formatDateToTimeLang(DateTime.tryParse(prescriptionsViewModel.prescriptionsHistory[index].created), false), + style: TextStyle(fontSize: 12, fontWeight: FontWeight.w600, color: Color(0xff575757), letterSpacing: -0.4, height: 16 / 10), + ), + ], + ) + ], + ), ), - ], - ) - ], - ), - ), - ), - Icon( - Icons.arrow_forward, - size: 16, - ), - mWidth(6), - ], - ), - )); - }, - itemCount: prescriptionsViewModel.prescriptionsHistory.length, - ), + ), + Icon( + Icons.arrow_forward, + size: 16, + ), + mWidth(6), + ], + ), + )); + }, + itemCount: prescriptionsViewModel.prescriptionsHistory.length, + ) + : getNoDataWidget(context) + : Container(), )); } } diff --git a/lib/pages/medical/prescriptions/prescriptions_home_page.dart b/lib/pages/medical/prescriptions/prescriptions_home_page.dart index 26c8dc22..d5efa38b 100644 --- a/lib/pages/medical/prescriptions/prescriptions_home_page.dart +++ b/lib/pages/medical/prescriptions/prescriptions_home_page.dart @@ -90,7 +90,7 @@ class _HomePrescriptionsPageState extends State with Sing prescriptionsViewModel: model, showOrderLog: () async { _tabController.animateTo(2); - await model.getPrescriptionsOrders(showLoading: true); + // await model.getPrescriptionsOrders(showLoading: true); setState(() {}); }, ), @@ -99,7 +99,7 @@ class _HomePrescriptionsPageState extends State with Sing prescriptionsViewModel: model, showOrderLog: () async { _tabController.animateTo(2); - await model.getPrescriptionsOrders(showLoading: true); + // await model.getPrescriptionsOrders(showLoading: true); setState(() {}); }, ), diff --git a/lib/pages/medical/smart_watch_health_data/health_data_list.dart b/lib/pages/medical/smart_watch_health_data/health_data_list.dart index f43a6e63..80a12cca 100644 --- a/lib/pages/medical/smart_watch_health_data/health_data_list.dart +++ b/lib/pages/medical/smart_watch_health_data/health_data_list.dart @@ -1,8 +1,8 @@ import 'package:diplomaticquarterapp/pages/medical/smart_watch_health_data/Steps/stepsTracker.dart'; import 'package:diplomaticquarterapp/pages/medical/smart_watch_health_data/distance/distanceTracker.dart'; import 'package:diplomaticquarterapp/pages/medical/smart_watch_health_data/heartrate/heartrateTracker.dart'; +import 'package:diplomaticquarterapp/pages/medical/smart_watch_health_data/syncHealthData.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; -import 'package:diplomaticquarterapp/widgets/buttons/defaultButton.dart'; import 'package:diplomaticquarterapp/widgets/data_display/medical/medical_profile_item.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart'; @@ -64,20 +64,10 @@ class _HealthDataListState extends State { ), ), ), - bottomSheet: Container( - color: Colors.white, - child: Padding( - padding: const EdgeInsets.all(20.0), - child: DefaultButton(TranslationBase.of(context).syncHealthData, () { - print("ReadLast"); - // readLast(); - }), - ), - ), + bottomSheet: syncHealthDataButton(), ); } - List myOptionsList(BuildContext context) { List medical = List(); @@ -123,7 +113,6 @@ class _HealthDataListState extends State { return medical; } - // void readLast() async { // print("ReadLast"); // final result = await FitKit.readLast(DataType.DISTANCE); diff --git a/lib/pages/medical/smart_watch_health_data/syncHealthData.dart b/lib/pages/medical/smart_watch_health_data/syncHealthData.dart new file mode 100644 index 00000000..47be3c5f --- /dev/null +++ b/lib/pages/medical/smart_watch_health_data/syncHealthData.dart @@ -0,0 +1,274 @@ +import 'package:collection/collection.dart'; +import 'package:diplomaticquarterapp/models/SmartWatch/HealthData.dart'; +import 'package:diplomaticquarterapp/services/smartwatch_integration/SmartWatchIntegrationService.dart'; +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:diplomaticquarterapp/widgets/dialogs/alert_dialog.dart'; +import 'package:fit_kit/fit_kit.dart'; +import 'package:flutter/material.dart'; +import 'package:intl/intl.dart'; + +class syncHealthDataButton extends StatefulWidget { + double marginTop; + + double hight; + + double minWidth; + + syncHealthDataButton({this.marginTop, this.hight, this.minWidth}); + + @override + _syncHealthDataButtonState createState() => _syncHealthDataButtonState(); +} + +class _syncHealthDataButtonState extends State { + List dataTypes = List(); + + List Med_InsertTransactionsInputsList = new List(); + List Med_InsertTransactionsInputsList2 = new List(); + + List sleepDataList = new List(); + + List healthDataList = new List(); + + int TransactionsListID = 1; + + int MedCategoryID = 0; + + @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(); + } + + @override + Widget build(BuildContext context) { + return Container( + color: Colors.white, + child: Padding( + padding: const EdgeInsets.all(20.0), + child: DefaultButton(TranslationBase.of(context).syncHealthData, () { + print("ReadAll"); + readAll(); + }), + ), + ); + } + + void readAll() async { + TransactionsListID = 1; + var MedSubCategoryID = 0; + double value = 0.0; + + 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: 1000500, + ); + + if (type == DataType.DISTANCE) { + MedCategoryID = 7; + } else if (type == DataType.STEP_COUNT) { + MedCategoryID = 6; + } else if (type == DataType.HEART_RATE) { + MedCategoryID = 3; + } + + 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++, Notes: "")); + }); + } + } + 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; + List data = []; + TransactionsListID = 1; + + DateTime date; + sleepDataList.clear(); + + Med_InsertTransactionsInputsList.forEach((result) { + data.add(result.toJson()); + }); + + Med_InsertTransactionsInputsList2.clear(); + + var newMap = groupBy(data, (obj) => DateUtil.convertStringToDate(obj['MachineDate']).toString().substring(0, 10)); + + newMap.forEach((key, value) { + totalSteps = 0.0; + totalDistance = 0.0; + totalHeartRate = 0.0; + avgTotalHeartRate = 0.0; + counter = 0; + + date = DateTime.parse(key); + + 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']; + } else if (element['MedCategoryID'] == 4) { + print("sleeeeep"); + sleepDataList.add(new healthData( + MedCategoryID: 4, + MedSubCategoryID: element['MedSubCategoryID'], + MachineDate: DateUtil.convertDateToString(date), + Value: element['Value'], + TransactionsListID: TransactionsListID++, + Notes: "")); + + Med_InsertTransactionsInputsList2.add(new healthData( + MedCategoryID: 4, + MedSubCategoryID: element['MedSubCategoryID'], + MachineDate: DateUtil.convertDateToString(date), + Value: element['Value'], + TransactionsListID: TransactionsListID++, + Notes: "")); + } + // else if(element['MedCategoryID'] == 8){ + // + // totalCalories += element['Value'] ; + // } + }); + + if (counter == 0) { + counter = 1; + } + if (totalHeartRate == 0) { + avgTotalHeartRate = 0; + } else { + avgTotalHeartRate = totalHeartRate / counter; + } + + Med_InsertTransactionsInputsList2.add( + new healthData(MedCategoryID: 6, MedSubCategoryID: 0, MachineDate: DateUtil.convertDateToString(date), Value: totalSteps, TransactionsListID: TransactionsListID++, Notes: "")); + Med_InsertTransactionsInputsList2.add( + new healthData(MedCategoryID: 7, MedSubCategoryID: 0, MachineDate: DateUtil.convertDateToString(date), Value: totalDistance, TransactionsListID: TransactionsListID++, Notes: "")); + Med_InsertTransactionsInputsList2.add( + new healthData(MedCategoryID: 3, MedSubCategoryID: 0, MachineDate: DateUtil.convertDateToString(date), Value: avgTotalHeartRate, TransactionsListID: TransactionsListID++, Notes: "")); + + // Med_InsertTransactionsInputsList2.add(new healthData(MedCategoryID: 8 , MedSubCategoryID: 0 , MachineDate: DateUtil.convertDateToStringWithBackSlash(date) , Value: totalCalories , TransactionsListID: TransactionsListID++ , Notes: "")); + }); + + GifLoaderDialogUtils.hideDialog(context); + + AlertDialogBox dialog = new AlertDialogBox( + context: context, + confirmMessage: TranslationBase.of(context).alreadySynced, + okText: TranslationBase.of(context).ok, + okFunction: () => { + AlertDialogBox.closeAlertDialog(context), + }, + ); + + dialog.showAlertDialog(context); + } + + addInsertTransactionsInputsList() { + if (Med_InsertTransactionsInputsList2.isNotEmpty) { + SmartWatchIntegrationService service = new SmartWatchIntegrationService(); + service.insertPatientHealthData(Med_InsertTransactionsInputsList2, context).then((res) { + print(res); + }).catchError((err) { + print(err); + }); + } else { + return; + } + } +} diff --git a/lib/pages/packages_offers/ClinicOfferAndPackagesPage.dart b/lib/pages/packages_offers/ClinicOfferAndPackagesPage.dart index d522d81e..97daf27f 100644 --- a/lib/pages/packages_offers/ClinicOfferAndPackagesPage.dart +++ b/lib/pages/packages_offers/ClinicOfferAndPackagesPage.dart @@ -40,7 +40,7 @@ class _ClinicPackagesPageState extends State with AfterLayo 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){ - appScaffold.appBar.badgeUpdater(viewModel.service.cartItemCount); + // appScaffold.appBar.badgeUpdater(viewModel.service.cartItemCount); }).catchError((error) { utils.Utils.showErrorToast(error); }); @@ -50,7 +50,7 @@ class _ClinicPackagesPageState extends State with AfterLayo @override void afterFirstLayout(BuildContext context) async{ - appScaffold.appBar.badgeUpdater(viewModel.service.cartItemCount); + // appScaffold.appBar.badgeUpdater(viewModel.service.cartItemCount); } @override diff --git a/lib/pages/packages_offers/OfferAndPackagesCartPage.dart b/lib/pages/packages_offers/OfferAndPackagesCartPage.dart index 53b4895c..d1219541 100644 --- a/lib/pages/packages_offers/OfferAndPackagesCartPage.dart +++ b/lib/pages/packages_offers/OfferAndPackagesCartPage.dart @@ -87,7 +87,7 @@ class _PackagesCartPageState extends State 'Failed to place order, please try again later'); } }).catchError((error) { - utils.Utils.showErrorToast(error); + utils.Utils.showErrorToast(error.toString()); }); } @@ -217,7 +217,7 @@ class _PackagesCartPageState extends State {@required int orderId, @required bool withStatus, dynamic data}) async { viewModel.service.getOrderById(orderId, context: context).then((value) { var heading = withStatus ? "Success" : "Failed"; - var title = "Your order has been placed successfully"; + var title = withStatus ? "Your order has been placed successfully" : "Failed to place your order"; var subTitle = "Order# ${value.data.customOrderNumber}"; Navigator.of(context).pushReplacement(MaterialPageRoute( builder: (context) => PackageOrderCompletedPage( @@ -231,7 +231,7 @@ class _PackagesCartPageState extends State // /* Payment Footer Widgets */ // --------------------------- String _selectedPaymentMethod; -Map _selectedPaymentParams; +Map _selectedPaymentParams; Widget _paymentOptions(BuildContext context, Function(String) onSelected, {PackagesViewModel viewModel}) { double height = 30; @@ -258,7 +258,7 @@ Widget _paymentOptions(BuildContext context, Function(String) onSelected, {Packa Future selectTamaraPaymentOption() async{ final tamara_options = await viewModel.service.getTamaraOptions(context: context, showLoading: true); - final selected = await SingleSelectionDialog(tamara_options, title: 'Select the tamara installment plan').show(context); + final selected = await SingleSelectionDialog(tamara_options, icon: Image.asset('assets/images/new-design/tamara.png'), title: TranslationBase.of(context).tamaraInstPlan).show(context); return selected.name; } @@ -271,13 +271,16 @@ Widget _paymentOptions(BuildContext context, Function(String) onSelected, {Packa mainAxisAlignment: MainAxisAlignment.center, children: [ InkWell( - child: buttonContent(_selectedPaymentMethod == "tamara", 'mada.png'), + child: buttonContent(_selectedPaymentMethod == "tamara", 'tamara.png'), onTap: () async{ final tamara_option = await selectTamaraPaymentOption(); _selectedPaymentParams = {"channel" : "Web", "payment_method_system_name" : "Payments.Tamara", "payment_option" : tamara_option}; onSelected("tamara"); }, ), + SizedBox( + width: 5, + ), InkWell( child: buttonContent(_selectedPaymentMethod == "mada", 'mada.png'), onTap: () { @@ -305,17 +308,17 @@ Widget _paymentOptions(BuildContext context, Function(String) onSelected, {Packa onSelected("mastercard"); }, ), - SizedBox( - width: 5, - ), - InkWell( - child: buttonContent( - _selectedPaymentMethod == "installment", 'installment.png'), - onTap: () { - _selectedPaymentParams = {"payment_method_system_name" : "Payments.PayFort", "payment_option" : "INSTALLMENT"}; - onSelected("installment"); - }, - ), + // SizedBox( + // width: 5, + // ), + // InkWell( + // child: buttonContent( + // _selectedPaymentMethod == "installment", 'installment.png'), + // onTap: () { + // _selectedPaymentParams = {"payment_method_system_name" : "Payments.PayFort", "payment_option" : "INSTALLMENT"}; + // onSelected("installment"); + // }, + // ), ], ), ), diff --git a/lib/pages/packages_offers/OfferAndPackagesPage.dart b/lib/pages/packages_offers/OfferAndPackagesPage.dart index 4005f835..056e23e1 100644 --- a/lib/pages/packages_offers/OfferAndPackagesPage.dart +++ b/lib/pages/packages_offers/OfferAndPackagesPage.dart @@ -96,9 +96,9 @@ class _PackagesHomePageState extends State with AfterLayoutMix 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){ - appScaffold.appBar.badgeUpdater(viewModel.service.cartItemCount); + // appScaffold.appBar.badgeUpdater(viewModel.service.cartItemCount); }).catchError((error) { - utils.Utils.showErrorToast(error); + utils.Utils.showErrorToast(error.toString()); }); } } diff --git a/lib/pages/parent_categorise_page.dart b/lib/pages/parent_categorise_page.dart index b63319f5..31bf7243 100644 --- a/lib/pages/parent_categorise_page.dart +++ b/lib/pages/parent_categorise_page.dart @@ -16,6 +16,7 @@ import 'package:diplomaticquarterapp/widgets/buttons/button.dart'; import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; import 'package:diplomaticquarterapp/widgets/others/StarRating.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_pharmacy_widget.dart'; +import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; import 'package:diplomaticquarterapp/widgets/others/entity_checkbox_list.dart'; import 'package:diplomaticquarterapp/widgets/others/network_base_view.dart'; import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart'; @@ -26,13 +27,12 @@ import 'package:provider/provider.dart'; import 'package:diplomaticquarterapp/pages/sub_categories_modalsheet.dart'; import 'base/base_view.dart'; - class ParentCategorisePage extends StatefulWidget { String id; String titleName; AuthenticatedUserObject authenticatedUserObject = - locator(); + locator(); ParentCategorisePage({this.id, this.titleName}); @@ -46,9 +46,11 @@ class _ParentCategorisePageState extends State { String titleName; final dynamic productID; - - - _ParentCategorisePageState({this.id, this.titleName, this.productID,}); + _ParentCategorisePageState({ + this.id, + this.titleName, + this.productID, + }); Map values = {'huusam': false, 'ali': false, 'noor': false}; bool checkedBrands = false; @@ -75,9 +77,10 @@ class _ParentCategorisePageState extends State { allowAny: true, builder: (BuildContext context, PharmacyCategoriseViewModel model, Widget child) => - PharmacyAppScaffold( + AppScaffold( + isPharmacy: true, appBarTitle: titleName, - isBottomBar: false, + isBottomBar: true, isShowAppBar: true, backgroundColor: Colors.white, isShowDecPage: false, @@ -139,8 +142,7 @@ class _ParentCategorisePageState extends State { page: SubCategoriseModalsheet( // id: model.categorise[0].id, // titleName: model.categorise[0].name, - ) - ), + )), ); // showModalBottomSheet( // isScrollControlled: true, @@ -348,13 +350,13 @@ class _ParentCategorisePageState extends State { width: 10.0, ), Texts( - - TranslationBase.of(context).refine, + TranslationBase.of( + context) + .refine, // 'Refine', fontWeight: FontWeight.w600, - ), SizedBox( width: 250.0, @@ -362,7 +364,9 @@ class _ParentCategorisePageState extends State { InkWell( child: Texts( // 'Close', - TranslationBase.of(context).closeIt, + TranslationBase.of( + context) + .closeIt, color: Colors.red, fontWeight: FontWeight.w600, @@ -383,10 +387,10 @@ class _ParentCategorisePageState extends State { Column( children: [ ExpansionTile( - - title: Texts( TranslationBase.of( - context) - .categorise), + title: Texts( + TranslationBase.of( + context) + .categorise), children: [ ProcedureListWidget( model: model, @@ -424,9 +428,10 @@ class _ParentCategorisePageState extends State { color: Colors.black12, ), ExpansionTile( - title: Texts( TranslationBase.of( - context) - .brands), + title: Texts( + TranslationBase.of( + context) + .brands), children: [ ProcedureListWidget( model: model, @@ -465,9 +470,10 @@ class _ParentCategorisePageState extends State { color: Colors.black12, ), ExpansionTile( - title: Texts( TranslationBase.of( - context) - .price), + title: Texts( + TranslationBase.of( + context) + .price), children: [ Container( color: Color( @@ -558,14 +564,11 @@ class _ParentCategorisePageState extends State { Container( width: 100, child: Button( - - label: TranslationBase.of( - context) + label: TranslationBase.of( + context) .reset, - backgroundColor: Colors.red, - - - + backgroundColor: + Colors.red, ), ), SizedBox( @@ -629,13 +632,12 @@ class _ParentCategorisePageState extends State { Navigator.pop( context); }, - - label: TranslationBase.of( - context) + label: TranslationBase.of( + context) .apply, - backgroundColor: Colors.green, - - + backgroundColor: + Colors + .green, ), ), ], @@ -1131,7 +1133,8 @@ class _ParentCategorisePageState extends State { padding: const EdgeInsets .only( - top: 4, bottom: 4), + top: 4, + bottom: 4), child: Texts( "SAR ${model.parentProducts[index].price}", bold: true, @@ -1167,30 +1170,50 @@ class _ParentCategorisePageState extends State { ], ), ), - - widget.authenticatedUserObject.isLogin ? - Container( - child: IconButton( - icon: Icon(Icons.shopping_cart, - size: 18, - color: Colors.blue,), - onPressed: () async { - if(model.parentProducts[index].rxMessage == null){ - GifLoaderDialogUtils.showMyDialog(context); - await addToCartFunction(1, model.parentProducts[index].id); - GifLoaderDialogUtils.hideDialog(context); - Navigator.push( - context, - FadePage(page: CartOrderPage())); - } - else{ - AppToast.showErrorToast(message: TranslationBase.of(context).needPrescription); - } - - } - - ), - ): Container(), + widget.authenticatedUserObject + .isLogin + ? Container( + child: IconButton( + icon: Icon( + Icons + .shopping_cart, + size: 18, + color: + Colors.blue, + ), + onPressed: + () async { + if (model + .parentProducts[ + index] + .rxMessage == + null) { + GifLoaderDialogUtils + .showMyDialog( + context); + await addToCartFunction( + 1, + model + .parentProducts[ + index] + .id); + GifLoaderDialogUtils + .hideDialog( + context); + Navigator.push( + context, + FadePage( + page: + CartOrderPage())); + } else { + AppToast.showErrorToast( + message: TranslationBase.of( + context) + .needPrescription); + } + }), + ) + : Container(), ], ), ), @@ -1238,8 +1261,6 @@ class _ParentCategorisePageState extends State { ), ), )); - - } addToCartFunction(quantity, itemID) async { @@ -1264,7 +1285,4 @@ class _ParentCategorisePageState extends State { } return false; } - - - } diff --git a/lib/pages/pharmacies/product-brands.dart b/lib/pages/pharmacies/product-brands.dart index 29146381..7b6c6fd6 100644 --- a/lib/pages/pharmacies/product-brands.dart +++ b/lib/pages/pharmacies/product-brands.dart @@ -33,105 +33,119 @@ class _ProductBrandsPageState extends State { isShowAppBar: true, isPharmacy: true, isShowDecPage: false, - body: Container( - child: Column( - children: [ - Container( - color: Colors.white, - alignment: - languageID == 'ar' ? Alignment.topRight : Alignment.topLeft, - padding: languageID == 'ar' - ? EdgeInsets.only(right: 10.0, top: 10.0) - : EdgeInsets.only(left: 10.0, top: 10.0), - child: Text( - TranslationBase.of(context).topBrands, - style: TextStyle( - fontWeight: FontWeight.bold, + body: SingleChildScrollView( + child: Container( + child: Column( + children: [ + Container( + color: Colors.white, + alignment: languageID == 'ar' + ? Alignment.topRight + : Alignment.topLeft, + padding: languageID == 'ar' + ? EdgeInsets.only(right: 10.0, top: 10.0) + : EdgeInsets.only(left: 10.0, top: 10.0), + child: Text( + TranslationBase.of(context).topBrands, + style: TextStyle( + fontWeight: FontWeight.bold, + ), ), ), - ), - Container( - height: 220, - width: double.infinity, - color: Colors.white, - child: topBrand(context), - ), - SizedBox( - height: 10, - ), - Container( - height: MediaQuery.of(context).size.height * 0.076, - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(5.0), + Container( + height: 220, + width: double.infinity, color: Colors.white, + child: topBrand(context), ), - child: InkWell( - child: Padding( - padding: EdgeInsets.all(8.0), - child: Row( - //crossAxisAlignment: CrossAxisAlignment.center, - mainAxisAlignment: MainAxisAlignment.start, - children: [ - Icon(Icons.search, size: 25.0), - SizedBox( - width: 15.0, - ), - Texts( - TranslationBase.of(context).searchProductHere, - fontSize: 13, - ) - ], - ), + SizedBox( + height: 10, + ), + Container( + height: MediaQuery.of(context).size.height * 0.076, + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(5.0), + color: Colors.white, ), - onTap: () { - Navigator.push( - context, - FadePage(page: SearchBrandsPage()), - ); - }, + child: topBrand(context), ), - ), - SizedBox( - height: 10, - ), - Container( - height: 250, - width: double.infinity, - color: Colors.white, - child: ListView.builder( - itemCount: model.brandsListList.length, - itemBuilder: (BuildContext context, int index) { - return InkWell( - child: Container( - margin: EdgeInsets.only(top: 50, left: 10), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - mainAxisAlignment: MainAxisAlignment.start, - children: [ - languageID == 'ar' - ? Text(model.brandsListList[index].namen) - : Text(model.brandsListList[index].name), - SizedBox( - height: 3, - ), - Divider(height: 1, color: Colors.grey) - ], + SizedBox( + height: 10, + ), + Container( + height: MediaQuery.of(context).size.height * 0.056, + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(5.0), + color: Colors.white, + ), + child: InkWell( + child: Padding( + padding: EdgeInsets.all(8.0), + child: Row( + //crossAxisAlignment: CrossAxisAlignment.center, + mainAxisAlignment: MainAxisAlignment.start, + children: [ + Icon(Icons.search, size: 25.0), + SizedBox( + width: 15.0, ), - ), - onTap: () { - Navigator.push( - context, - MaterialPageRoute( - builder: (context) => FinalProductsPage( - id: model.brandsListList[index].id - .toString(), - )), - ); - }, + Texts( + TranslationBase.of(context).searchProductHere, + fontSize: 13, + ) + ], + ), + ), + onTap: () { + Navigator.push( + context, + FadePage(page: SearchBrandsPage()), ); - }), - ), - ], + }, + ), + ), + SizedBox( + height: 10, + ), + Container( + height: 250, + width: double.infinity, + color: Colors.white, + child: ListView.builder( + itemCount: model.brandsListList.length, + itemBuilder: (BuildContext context, int index) { + return InkWell( + child: Container( + margin: EdgeInsets.only(top: 50, left: 10), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + mainAxisAlignment: MainAxisAlignment.start, + children: [ + languageID == 'ar' + ? Text(model.brandsListList[index].namen) + : Text(model.brandsListList[index].name), + SizedBox( + height: 3, + ), + Divider(height: 1, color: Colors.grey) + ], + ), + ), + onTap: () { + Navigator.push( + context, + MaterialPageRoute( + builder: (context) => FinalProductsPage( + id: model.brandsListList[index].id + .toString(), + )), + ); + }, + ); + }), + ), + ], + ), ), ), ), 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 79165766..6bfe4fbc 100644 --- a/lib/pages/pharmacies/screens/cart-page/cart-order-page.dart +++ b/lib/pages/pharmacies/screens/cart-page/cart-order-page.dart @@ -55,8 +55,10 @@ class _CartOrderPageState extends State { appBarTitle: TranslationBase.of(context).shoppingCart, isShowAppBar: true, isPharmacy: true, + //isBottomBar: true, showHomeAppBarIcon: false, - isShowDecPage: true, + isShowDecPage: false, + isMainPharmacyPages: true, baseViewModel: model, backgroundColor: Colors.white, body: !(model.cartResponse.shoppingCarts == null || @@ -103,8 +105,8 @@ class _CartOrderPageState extends State { .shoppingCarts[index]) .then((value) { if (model.state != ViewState.Error) { - appScaffold.appBar.badgeUpdater( - '${value.quantityCount ?? 0}'); + // appScaffold.appBar.badgeUpdater( + // '${value.quantityCount ?? 0}'); } if (model.state == ViewState.ErrorLocal) { @@ -117,8 +119,8 @@ class _CartOrderPageState extends State { .shoppingCarts[index]) .then((value) { if (model.state != ViewState.Error) { - appScaffold.appBar.badgeUpdater( - '${value.quantityCount ?? 0}'); + // appScaffold.appBar.badgeUpdater( + // '${value.quantityCount ?? 0}'); } }); })) 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 25c02dd0..4f5ab14e 100644 --- a/lib/pages/pharmacies/screens/cart-page/cart-order-preview.dart +++ b/lib/pages/pharmacies/screens/cart-page/cart-order-preview.dart @@ -63,11 +63,11 @@ class _OrderPreviewPageState extends State { color: Color(0xFFF1F1F1), child: Column( children: [ - SelectAddressWidget(model, widget.addresses), + SelectAddressWidget(model, widget.addresses,changeMainState), SizedBox( height: 10, ), - SelectPaymentOptionWidget(model), + SelectPaymentOptionWidget(model, changeMainState), SizedBox( height: 10, ), @@ -235,4 +235,9 @@ class _OrderPreviewPageState extends State { ), ); } + changeMainState(){ + setState(() { + + }); + } } 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 44ebd882..389b4331 100644 --- a/lib/pages/pharmacies/screens/cart-page/payment_bottom_widget.dart +++ b/lib/pages/pharmacies/screens/cart-page/payment_bottom_widget.dart @@ -89,7 +89,7 @@ class PaymentBottomWidget extends StatelessWidget { message: "Order has been placed successfully!!"); openPayment( - model.orderListModel[0], model.user); + model.orderListModel[0], model.authenticatedUserObject.user); } else { AppToast.showErrorToast(message: model.error); } diff --git a/lib/pages/pharmacies/screens/cart-page/select_address_widget.dart b/lib/pages/pharmacies/screens/cart-page/select_address_widget.dart index bf958a36..ab55002f 100644 --- a/lib/pages/pharmacies/screens/cart-page/select_address_widget.dart +++ b/lib/pages/pharmacies/screens/cart-page/select_address_widget.dart @@ -2,6 +2,7 @@ import 'package:diplomaticquarterapp/core/enum/viewstate.dart'; import 'package:diplomaticquarterapp/core/model/pharmacies/Addresses.dart'; import 'package:diplomaticquarterapp/core/model/pharmacies/order_detail.dart'; import 'package:diplomaticquarterapp/core/model/pharmacies/payment-checkout-data.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/order_model_view_model.dart'; import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; @@ -25,39 +26,35 @@ import 'package:provider/provider.dart'; class SelectAddressWidget extends StatefulWidget { final OrderPreviewViewModel model; final List addresses; + final Function changeMainState; - SelectAddressWidget(this.model, this.addresses); + SelectAddressWidget(this.model, this.addresses, this.changeMainState); @override _SelectAddressWidgetState createState() => _SelectAddressWidgetState(); } class _SelectAddressWidgetState extends State { - Addresses address; + AddressInfo address; - _navigateToAddressPage() { + _navigateToAddressPage(String identificationNo) { Navigator.push(context, FadePage(page: PharmacyAddressesPage())) .then((result) { if (result != null) { address = result; - widget.model.paymentCheckoutData.address = address; - widget.model.getInformationsByAddress(); + widget.model.paymentCheckoutData.address = + Addresses.fromJson(address.toJson()); + widget.model.getInformationsByAddress(identificationNo); + widget.changeMainState(); } - - /* setState(() { - if (result != null) { - address = result; - widget.model.paymentCheckoutData.address = address; - widget.model.getInformationsByAddress(); - } - })*/ }); } @override void initState() { if (widget.model.paymentCheckoutData.address != null) { - address = widget.model.paymentCheckoutData.address; + address = AddressInfo.fromJson( + widget.model.paymentCheckoutData.address.toJson()); } super.initState(); } @@ -69,7 +66,7 @@ class _SelectAddressWidgetState extends State { color: Colors.white, child: address == null ? InkWell( - onTap: () => {_navigateToAddressPage()}, + onTap: () => {_navigateToAddressPage(model.user.patientIdentificationNo)}, child: Container( margin: EdgeInsets.symmetric(vertical: 12, horizontal: 12), child: Row( @@ -128,7 +125,7 @@ class _SelectAddressWidgetState extends State { ), ), InkWell( - onTap: () => {_navigateToAddressPage()}, + onTap: () => {_navigateToAddressPage(model.authenticatedUserObject.user.patientIdentificationNo)}, child: Texts( TranslationBase.of(context).changeAddress, fontSize: 12, diff --git a/lib/pages/pharmacies/screens/cart-page/select_payment_option_widget.dart b/lib/pages/pharmacies/screens/cart-page/select_payment_option_widget.dart index 6e506458..825e2577 100644 --- a/lib/pages/pharmacies/screens/cart-page/select_payment_option_widget.dart +++ b/lib/pages/pharmacies/screens/cart-page/select_payment_option_widget.dart @@ -8,8 +8,9 @@ import 'package:flutter/material.dart'; class SelectPaymentOptionWidget extends StatefulWidget { final OrderPreviewViewModel model; + final Function changeMainState; - SelectPaymentOptionWidget(this.model); + SelectPaymentOptionWidget(this.model, this.changeMainState); @override _SelectPaymentOptionWidgetState createState() => _SelectPaymentOptionWidgetState(); @@ -19,14 +20,17 @@ class _SelectPaymentOptionWidgetState extends State { PaymentOption paymentOption; _navigateToPaymentOption() { - Navigator.push(context, FadePage(page: PaymentMethodSelectPage())).then((result) => { - setState(() { - if (result != null) { - paymentOption = result; - widget.model.paymentCheckoutData.paymentOption = paymentOption; - } - }) - }); + Navigator.push(context, FadePage(page: PaymentMethodSelectPage())) + .then((result) => { + setState(() { + if (result != null) { + paymentOption = result; + widget.model.paymentCheckoutData.paymentOption = + paymentOption; + } + widget.changeMainState(); + }) + }); } @override diff --git a/lib/pages/pharmacies/screens/lacum-registration-page.dart b/lib/pages/pharmacies/screens/lacum-registration-page.dart index c40771b8..dc309c00 100644 --- a/lib/pages/pharmacies/screens/lacum-registration-page.dart +++ b/lib/pages/pharmacies/screens/lacum-registration-page.dart @@ -48,18 +48,18 @@ class _LakumRegistrationPageState extends State { return BaseView( builder: (_, model, wi) => AppScaffold( - appBarTitle: - "${TranslationBase.of(context).register} ${TranslationBase.of(context).lakum}", + appBarTitle: "${TranslationBase.of(context).register} ${TranslationBase.of(context).lakum}", isShowAppBar: true, isShowDecPage: false, + isPharmacy: true, + showPharmacyCart: false, backgroundColor: Colors.white, baseViewModel: model, body: Container( width: double.infinity, child: SingleChildScrollView( child: SizedBox( - height: - mediaQuery.size.height - 60 - mediaQuery.padding.top, + height: mediaQuery.size.height - 60 - mediaQuery.padding.top, child: Column( crossAxisAlignment: CrossAxisAlignment.stretch, mainAxisAlignment: MainAxisAlignment.spaceBetween, @@ -130,35 +130,26 @@ class _LakumRegistrationPageState extends State { height: 10, ), Texts( - TranslationBase.of(context) - .prefferedLanguage, + TranslationBase.of(context).prefferedLanguage, fontSize: 13, fontWeight: FontWeight.normal, color: Color(0xff8a8a8a), ), InkWell( onTap: () { - RadioGroupDialog dialog = - new RadioGroupDialog( - context: context, - title: TranslationBase.of(context) - .prefferedLanguage, - okText: - TranslationBase.of(context) - .confirm, - cancelText: - TranslationBase.of(context) - .cancel_nocaps, - list: languages, - okFunction: (selectedValue) { - setState(() { - selectedLanguage = - selectedValue; - }); - print( - "selectedLanguage = ${selectedValue.name}"); - }, - cancelFunction: () => {}); + RadioGroupDialog dialog = new RadioGroupDialog( + context: context, + title: TranslationBase.of(context).prefferedLanguage, + okText: TranslationBase.of(context).confirm, + cancelText: TranslationBase.of(context).cancel_nocaps, + list: languages, + okFunction: (selectedValue) { + setState(() { + selectedLanguage = selectedValue; + }); + print("selectedLanguage = ${selectedValue.name}"); + }, + cancelFunction: () => {}); showDialog( barrierDismissible: false, context: context, @@ -170,11 +161,8 @@ class _LakumRegistrationPageState extends State { child: TextField( enabled: false, decoration: InputDecoration( - suffixIcon: - Icon(Icons.arrow_drop_down), - hintText: selectedLanguage == null - ? "${TranslationBase.of(context).prefferedLanguage}" - : "${selectedLanguage.name}", + suffixIcon: Icon(Icons.arrow_drop_down), + hintText: selectedLanguage == null ? "${TranslationBase.of(context).prefferedLanguage}" : "${selectedLanguage.name}", hintStyle: TextStyle( fontSize: 16, color: Colors.black, @@ -192,12 +180,10 @@ class _LakumRegistrationPageState extends State { ), Container( color: Colors.green, - margin: EdgeInsets.all(8), + margin: EdgeInsets.all(40), child: BorderedButton( TranslationBase.of(context).register, - backgroundColor: canSubmit - ? Color(0xff339933) - : Color(0xff99cc99), + backgroundColor: canSubmit ? Color(0xff339933) : Color(0xff99cc99), textColor: Colors.white, fontSize: 16, hPadding: 8, @@ -208,18 +194,13 @@ class _LakumRegistrationPageState extends State { context, FadePage( page: LakumTermsConditions( - widget - .patientIdentificationNo, - _firstNameController.text, - _lastNameController.text, - _mobileNumberController - .text, - selectedLanguage.id))) - .then((status) => { - if (status == 200) - {Navigator.pop(context, "")} - // back to previous page - }); + widget.patientIdentificationNo, _firstNameController.text, _lastNameController.text, _mobileNumberController.text, selectedLanguage.id))) + .then( + (status) => { + if (status == 200) {Navigator.pop(context, "")} + // back to previous page + }, + ); } : null, ), diff --git a/lib/pages/pharmacies/screens/lakum-main-page.dart b/lib/pages/pharmacies/screens/lakum-main-page.dart index c688f319..18981cc9 100644 --- a/lib/pages/pharmacies/screens/lakum-main-page.dart +++ b/lib/pages/pharmacies/screens/lakum-main-page.dart @@ -1,6 +1,8 @@ import 'package:diplomaticquarterapp/core/model/pharmacies/PointsAmountPerYear.dart'; import 'package:diplomaticquarterapp/core/viewModels/pharmacyModule/lacum-viewmodel.dart'; +import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; import 'package:diplomaticquarterapp/pages/base/base_view.dart'; +import 'package:diplomaticquarterapp/pages/pharmacies/screens/lacum-registration-page.dart'; import 'package:diplomaticquarterapp/pages/pharmacies/screens/lacum-setting-page.dart'; import 'package:diplomaticquarterapp/pages/pharmacies/screens/lacum-transfer-page.dart'; import 'package:diplomaticquarterapp/pages/pharmacies/screens/lakum-points-year-page.dart'; @@ -11,278 +13,323 @@ import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart'; import 'package:flutter/material.dart'; +import 'package:provider/provider.dart'; import 'lacum-activitaion-vida-page.dart'; class LakumMainPage extends StatelessWidget { + ProjectViewModel projectViewModel; + @override Widget build(BuildContext context) { final mediaQuery = MediaQuery.of(context); + projectViewModel = Provider.of(context); return BaseView( - onModelReady: (model) => model.getLacumData(), - builder: (_, model, wi) => AppScaffold( - appBarTitle: TranslationBase.of(context).lakum, - isShowAppBar: true, - isPharmacy: true, - isShowDecPage: false, - backgroundColor: Colors.white, - baseViewModel: model, - appBarIcons: _buildAppBarICons(context, model), - // preferredSize: mediaQuery.size.height * 0.20, - body: Container( - width: double.infinity, - child: SingleChildScrollView( - child: (model.lacumGroupInformation != null && + onModelReady: (model) => model.getLacumData(), + builder: (_, model, wi) => AppScaffold( + appBarTitle: TranslationBase.of(context).lakum, + isShowAppBar: true, + isPharmacy: true, + isShowDecPage: false, + backgroundColor: Colors.white, + baseViewModel: model, + appBarIcons: _buildAppBarICons(context, model), + // preferredSize: mediaQuery.size.height * 0.20, + body: Container( + width: double.infinity, + child: SingleChildScrollView( + child: (model.lacumGroupInformation != null && + model.lacumGroupInformation + .lakumInquiryInformationObjVersion != + null) + ? Column( + children: [ + Stack( + children: [ + Container( + height: mediaQuery.size.height * 0.15, + color: Colors.green, + ), + Column( + children: [ + SizedBox( + height: mediaQuery.size.height * 0.02, + ), + Container( + width: mediaQuery.size.width * 1, + child: LakumBannerWidget( + model, mediaQuery, true)), + ], + ) + ], + ), + SizedBox( + width: 8, + ), + LacumPointsWidget( + mediaQuery, + 2, + TranslationBase.of(context).gained, + model + .lacumGroupInformation + .lakumInquiryInformationObjVersion + .pointsBalanceAmount, model.lacumGroupInformation - .lakumInquiryInformationObjVersion != - null) - ? Column( - children: [ - Stack( - children: [ - Container( - height: mediaQuery.size.height * 0.15, - color: Colors.green, - ), - Column( - children: [ - SizedBox( - height: mediaQuery.size.height * 0.02, - ), - Container( - width: mediaQuery.size.width * 1, - child: LakumBannerWidget( - model, mediaQuery, true)), - ], - ) - ], - ), - SizedBox( - height: 20, - ), - LakumHomeButtons(mediaQuery, model), + .lakumInquiryInformationObjVersion.gainedPoints, + model + .lacumGroupInformation + .lakumInquiryInformationObjVersion + .gainedPointsAmountPerYear), + SizedBox( + height: 20, + ), + Container( + height: 125, + margin: EdgeInsets.symmetric(horizontal: 16), + child: ListView( + scrollDirection: Axis.horizontal, + children: [ + LacumPointsWidget( + mediaQuery, + 1, + TranslationBase.of(context).balance, + model + .lacumGroupInformation + .lakumInquiryInformationObjVersion + .pointsBalanceAmount, + model + .lacumGroupInformation + .lakumInquiryInformationObjVersion + .pointsBalance, + null), SizedBox( - height: 20, - ), - Container( - height: 125, - margin: EdgeInsets.symmetric(horizontal: 16), - child: ListView( - scrollDirection: Axis.horizontal, - children: [ - LacumPointsWidget( - mediaQuery, - 1, - TranslationBase.of(context).balance, - model - .lacumGroupInformation - .lakumInquiryInformationObjVersion - .pointsBalanceAmount, - model - .lacumGroupInformation - .lakumInquiryInformationObjVersion - .pointsBalance, - null), - SizedBox( - width: 8, - ), - LacumPointsWidget( - mediaQuery, - 2, - TranslationBase.of(context).gained, - model - .lacumGroupInformation - .lakumInquiryInformationObjVersion - .pointsBalanceAmount, - model - .lacumGroupInformation - .lakumInquiryInformationObjVersion - .gainedPoints, - model - .lacumGroupInformation - .lakumInquiryInformationObjVersion - .gainedPointsAmountPerYear), - SizedBox( - width: 8, - ), - LacumPointsWidget( - mediaQuery, - 3, - TranslationBase.of(context).consumed, - model - .lacumGroupInformation - .lakumInquiryInformationObjVersion - .consumedPointsAmount != - null - ? int.parse(model - .lacumGroupInformation - .lakumInquiryInformationObjVersion - .consumedPointsAmount) - : 0, - model - .lacumGroupInformation - .lakumInquiryInformationObjVersion - .consumedPoints, - model - .lacumGroupInformation - .lakumInquiryInformationObjVersion - .consumedPointsAmountPerYear), - SizedBox( - width: 8, - ), - LacumPointsWidget( - mediaQuery, - 4, - TranslationBase.of(context).transferred, - 0, - model - .lacumGroupInformation - .lakumInquiryInformationObjVersion - .transferPoints, - model - .lacumGroupInformation - .lakumInquiryInformationObjVersion - .transferPointsAmountPerYear), - ], - ), + width: 8, ), + LacumPointsWidget( + mediaQuery, + 2, + TranslationBase.of(context).gained, + model + .lacumGroupInformation + .lakumInquiryInformationObjVersion + .pointsBalanceAmount, + model + .lacumGroupInformation + .lakumInquiryInformationObjVersion + .gainedPoints, + model + .lacumGroupInformation + .lakumInquiryInformationObjVersion + .gainedPointsAmountPerYear), SizedBox( - height: 20, + width: 8, ), + LacumPointsWidget( + mediaQuery, + 3, + TranslationBase.of(context).consumed, + model + .lacumGroupInformation + .lakumInquiryInformationObjVersion + .consumedPointsAmount != + null + ? int.parse(model + .lacumGroupInformation + .lakumInquiryInformationObjVersion + .consumedPointsAmount) + : 0, + model + .lacumGroupInformation + .lakumInquiryInformationObjVersion + .consumedPoints, + model + .lacumGroupInformation + .lakumInquiryInformationObjVersion + .consumedPointsAmountPerYear), SizedBox( - height: 8, - width: double.infinity, - child: Container( - color: Color(0xffefefef), - ), + width: 8, ), - Container( - margin: EdgeInsets.symmetric( - vertical: 16, horizontal: 8), - child: Row( - mainAxisAlignment: - MainAxisAlignment.spaceBetween, - children: [ - Row( - children: [ - Image.asset( - "assets/images/pharmacy_module/lakum/expired_icon.png", - fit: BoxFit.fill, - width: 25, - height: 25, - ), - Padding( - padding: - EdgeInsets.symmetric(horizontal: 8), - child: Texts(TranslationBase.of(context).Expired, + LacumPointsWidget( + mediaQuery, + 4, + TranslationBase.of(context).transferred, + 0, + model + .lacumGroupInformation + .lakumInquiryInformationObjVersion + .transferPoints, + model + .lacumGroupInformation + .lakumInquiryInformationObjVersion + .transferPointsAmountPerYear), + ], + ), + ), + LacumPointsWidget( + mediaQuery, + 3, + TranslationBase.of(context).consumed, + model + .lacumGroupInformation + .lakumInquiryInformationObjVersion + .consumedPointsAmount != + null + ? int.parse(model + .lacumGroupInformation + .lakumInquiryInformationObjVersion + .consumedPointsAmount) + : 0, + model.lacumGroupInformation + .lakumInquiryInformationObjVersion.consumedPoints, + model + .lacumGroupInformation + .lakumInquiryInformationObjVersion + .consumedPointsAmountPerYear), + SizedBox( + width: 8, + ), + SizedBox( + height: 8, + width: double.infinity, + child: Container( + color: Color(0xffefefef), + ), + ), + Container( + margin: + EdgeInsets.symmetric(vertical: 16, horizontal: 8), + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Row( + children: [ + Image.asset( + "assets/images/pharmacy_module/lakum/expired_icon.png", + fit: BoxFit.fill, + width: 25, + height: 25, + ), + Padding( + padding: EdgeInsets.symmetric(horizontal: 8), + child: Texts( + TranslationBase.of(context).Expired, // "Expired", - fontSize: 14, - ), - ) - ], - ), - Texts( - "${model.lacumGroupInformation.lakumInquiryInformationObjVersion.expiredPoints}${TranslationBase.of(context).lakumPoint} " , - fontWeight: FontWeight.bold, fontSize: 14, ), - ], - ), + ) + ], ), - SizedBox( - height: 2, - width: double.infinity, - child: Container( - color: Color(0xffefefef), - ), + Texts( + "${model.lacumGroupInformation.lakumInquiryInformationObjVersion.expiredPoints}${TranslationBase.of(context).lakumPoint} ", + fontWeight: FontWeight.bold, + fontSize: 14, ), - Container( - margin: EdgeInsets.symmetric( - vertical: 16, horizontal: 8), - child: Row( - mainAxisAlignment: - MainAxisAlignment.spaceBetween, - children: [ - Row( - children: [ - Image.asset( - "assets/images/pharmacy_module/lakum/waiting_gained_icon.png", - fit: BoxFit.fill, - width: 20, - height: 25, - ), - Padding( - padding: - EdgeInsets.symmetric(horizontal: 8), - child: Texts(TranslationBase.of(context).Waitinggained, + ], + ), + ), + // Texts( + // "${model.lacumGroupInformation.lakumInquiryInformationObjVersion.expiredPoints} Points", + // fontWeight: FontWeight.bold, + // fontSize: 14, + // ), + Container( + margin: + EdgeInsets.symmetric(vertical: 16, horizontal: 8), + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Row( + children: [ + Image.asset( + "assets/images/pharmacy_module/lakum/waiting_gained_icon.png", + fit: BoxFit.fill, + width: 20, + height: 25, + ), + Padding( + padding: + EdgeInsets.symmetric(horizontal: 8), + child: Texts( + TranslationBase.of(context) + .Waitinggained, // "Waiting gained", - fontSize: 14, - ), - ) - ], - ), - Texts( - "${model.lacumGroupInformation.lakumInquiryInformationObjVersion.waitingPoints} ${TranslationBase.of(context).lakumPoint}", - fontWeight: FontWeight.bold, - fontSize: 14, - ), - ], - ), - ), - SizedBox( - height: 2, - width: double.infinity, - child: Container( - color: Color(0xffefefef), - ), - ), - Container( - margin: EdgeInsets.symmetric( - vertical: 16, horizontal: 8), - child: Row( - mainAxisAlignment: - MainAxisAlignment.spaceBetween, - children: [ - Row( - children: [ - Image.asset( - "assets/images/pharmacy_module/lakum/will_be_expired_icon.png", - fit: BoxFit.fill, - width: 25, - height: 25, + fontSize: 14, ), - Padding( - padding: - EdgeInsets.symmetric(horizontal: 8), - child: Texts(TranslationBase.of(context).WillBeExpired, + ) + ], + ), + Texts( + "${model.lacumGroupInformation.lakumInquiryInformationObjVersion.waitingPoints} ${TranslationBase.of(context).lakumPoint}", + fontWeight: FontWeight.bold, + fontSize: 14, + ), + ])), + // Texts( + // "${model.lacumGroupInformation.lakumInquiryInformationObjVersion.waitingPoints} Points", + // fontWeight: FontWeight.bold, + // fontSize: 14, + // ), + Container( + margin: + EdgeInsets.symmetric(vertical: 16, horizontal: 8), + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Row( + children: [ + Image.asset( + "assets/images/pharmacy_module/lakum/will_be_expired_icon.png", + fit: BoxFit.fill, + width: 25, + height: 25, + ), + Padding( + padding: EdgeInsets.symmetric(horizontal: 8), + child: Texts( + TranslationBase.of(context).WillBeExpired, // "Will Be Expired", - fontSize: 14, - ), - ) - ], - ), - Texts( - "${model.lacumGroupInformation.lakumInquiryInformationObjVersion.pointsWillBeExpired} ${TranslationBase.of(context).lakumPoint}", - fontWeight: FontWeight.bold, fontSize: 14, ), - ], - ), + ) + ], ), - SizedBox( - height: 2, - width: double.infinity, - child: Container( - color: Color(0xffefefef), - ), + Texts( + "${model.lacumGroupInformation.lakumInquiryInformationObjVersion.pointsWillBeExpired} ${TranslationBase.of(context).lakumPoint}", + fontWeight: FontWeight.bold, + fontSize: 14, ), ], - ) - : Container(), - ), - ), - )); + ), + // Texts( + // "${model.lacumGroupInformation.lakumInquiryInformationObjVersion.pointsWillBeExpired} Points", + // fontWeight: FontWeight.bold, + // fontSize: 14, + // ), + ), + + SizedBox( + height: 2, + width: double.infinity, + child: Container( + color: Color(0xffefefef), + ), + ), + ], + ) + : Container(), + ), + ), + ), + ); + } + + navigateToLakumRegister(BuildContext context) { + Navigator.pushReplacement( + context, + FadePage( + page: LakumRegistrationPage( + projectViewModel.user.patientIdentificationNo))); } } @@ -443,8 +490,7 @@ class LacumPointsWidget extends StatelessWidget { FadePage(page: LakumPointsYearPage(pointsAmountPerYear))); } else { AppToast.showErrorToast( - message: TranslationBase.of(context) - .lakumMsg); + message: TranslationBase.of(context).lakumMsg); // show snackBar No Details Points are there } } @@ -497,7 +543,8 @@ class LacumPointsWidget extends StatelessWidget { child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ - Texts(TranslationBase.of(context).RIYAL, + Texts( + TranslationBase.of(context).RIYAL, // "RIYAL", fontSize: 13, fontWeight: FontWeight.bold, @@ -528,7 +575,8 @@ class LacumPointsWidget extends StatelessWidget { child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ - Texts(TranslationBase.of(context).point, + Texts( + TranslationBase.of(context).point, // "POINT", fontSize: 12, fontWeight: FontWeight.bold, diff --git a/lib/pages/pharmacies/screens/pharmacy_module_page.dart b/lib/pages/pharmacies/screens/pharmacy_module_page.dart index 7656922a..4da64235 100644 --- a/lib/pages/pharmacies/screens/pharmacy_module_page.dart +++ b/lib/pages/pharmacies/screens/pharmacy_module_page.dart @@ -42,21 +42,24 @@ class _PharmacyPageState extends State { allowAny: true, builder: (_, model, wi) => AppScaffold( title: "", - isShowAppBar: false, isShowDecPage: false, baseViewModel: model, + isMainPharmacyPages: true, + isPharmacy: true, + isShowPharmacyAppbar: true, backgroundColor: Colors.white, body: Container( width: double.infinity, child: SingleChildScrollView( child: Column( + //crossAxisAlignment: CrossAxisAlignment.start, children: [ BannerPager(model), + // GridViewButtons(model), PrescriptionsWidget(), -// ShopByBrandWidget(), + ShopByBrandWidget(), RecentlyViewedWidget(), BestSellerWidget(), - ShopByBrandWidget(), ], ), ), 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 977e3e39..bf45c539 100644 --- a/lib/pages/pharmacies/screens/product-details/footor/footer-widget.dart +++ b/lib/pages/pharmacies/screens/product-details/footor/footer-widget.dart @@ -7,7 +7,6 @@ import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:diplomaticquarterapp/widgets/buttons/secondary_button.dart'; import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart'; import 'package:flutter/material.dart'; -import 'package:hexcolor/hexcolor.dart'; import '../../../../../locator.dart'; import '../../../../../routes.dart'; @@ -45,7 +44,7 @@ class _FooterWidgetState extends State { borderRadius: BorderRadius.all( Radius.circular(0.0), ), - border: Border.all(color: HexColor('#707070'), width: 0), + border: Border.all(color: Color(0xFF707070), width: 0), ), width: double.infinity, height: quantityUI, diff --git a/lib/pages/pharmacies/screens/product-details/product-detail.dart b/lib/pages/pharmacies/screens/product-details/product-detail.dart index cb38ca4f..e34a5dbc 100644 --- a/lib/pages/pharmacies/screens/product-details/product-detail.dart +++ b/lib/pages/pharmacies/screens/product-details/product-detail.dart @@ -1,10 +1,7 @@ import 'package:diplomaticquarterapp/config/shared_pref_kay.dart'; -import 'package:diplomaticquarterapp/config/size_config.dart'; import 'package:diplomaticquarterapp/core/model/pharmacies/PharmacyProduct.dart'; import 'package:diplomaticquarterapp/core/viewModels/pharmacyModule/product_detail_view_model.dart'; import 'package:diplomaticquarterapp/pages/base/base_view.dart'; -import 'package:diplomaticquarterapp/pages/pharmacies/compare-list.dart'; -import 'package:diplomaticquarterapp/pages/pharmacies/screens/cart-page/cart-order-page.dart'; import 'package:diplomaticquarterapp/pages/pharmacies/screens/product-details/product-name-and-price.dart'; import 'package:diplomaticquarterapp/pages/pharmacies/screens/product-details/recommended_products.dart'; import 'package:diplomaticquarterapp/pages/pharmacies/screens/product-details/reviews_info.dart'; @@ -14,7 +11,6 @@ import 'package:diplomaticquarterapp/uitl/gif_loader_dialog_utils.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; -import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart'; import 'package:flutter/material.dart'; import 'availability_info.dart'; @@ -106,8 +102,8 @@ class __ProductDetailPageState extends State { deleteFromWishlistFunction: () async { await deleteFromWishlistFunction(itemID: itemID, model: model); }, - isInWishList:isInWishList, - addToCartFunction:addToCartFunction , + isInWishList: isInWishList, + addToCartFunction: addToCartFunction, ), body: SingleChildScrollView( child: Column( @@ -125,8 +121,7 @@ class __ProductDetailPageState extends State { fit: BoxFit.contain, ), ), - if (widget.product.discountDescription != null) - DiscountDescription(product: widget.product) + if (widget.product.discountDescription != null) DiscountDescription(product: widget.product) ], ), ), @@ -144,15 +139,11 @@ class __ProductDetailPageState extends State { setState(() {}); }, deleteFromWishlistFunction: (item) { - deleteFromWishlistFunction( - itemID: item, model: model); + deleteFromWishlistFunction(itemID: item, model: model); setState(() {}); }, notifyMeWhenAvailable: (context, itemId) { - notifyMeWhenAvailable( - itemId: itemId, - customerId: customerId, - model: model); + notifyMeWhenAvailable(itemId: itemId, customerId: customerId, model: model); }, isInWishList: isInWishList, ), @@ -167,8 +158,7 @@ class __ProductDetailPageState extends State { crossAxisAlignment: CrossAxisAlignment.start, children: [ Container( - padding: EdgeInsets.symmetric( - vertical: 15, horizontal: 10), + padding: EdgeInsets.symmetric(vertical: 15, horizontal: 10), child: Texts( TranslationBase.of(context).specification, fontSize: 15, @@ -205,16 +195,12 @@ class __ProductDetailPageState extends State { }, child: Text( TranslationBase.of(context).details, - style: TextStyle( - fontSize: 16, - fontWeight: FontWeight.bold), + style: TextStyle(fontSize: 16, fontWeight: FontWeight.bold), ), color: Colors.white, ), CustomDivider( - color: isDetails - ? Colors.green - : Colors.transparent, + color: isDetails ? Colors.green : Colors.transparent, ) ], ), @@ -225,14 +211,10 @@ class __ProductDetailPageState extends State { children: [ FlatButton( onPressed: () async { - if (widget.product.approvedTotalReviews > - 0) { - GifLoaderDialogUtils.showMyDialog( - context); - await model.getProductReviewsData( - widget.product.id); - GifLoaderDialogUtils.hideDialog( - context); + if (widget.product.approvedTotalReviews > 0) { + GifLoaderDialogUtils.showMyDialog(context); + await model.getProductReviewsData(widget.product.id); + GifLoaderDialogUtils.hideDialog(context); } else { model.clearReview(); } @@ -244,16 +226,12 @@ class __ProductDetailPageState extends State { }, child: Text( TranslationBase.of(context).reviews, - style: TextStyle( - fontSize: 16, - fontWeight: FontWeight.bold), + style: TextStyle(fontSize: 16, fontWeight: FontWeight.bold), ), color: Colors.white, ), CustomDivider( - color: isReviews - ? Colors.green - : Colors.transparent, + color: isReviews ? Colors.green : Colors.transparent, ), ], ), @@ -264,8 +242,7 @@ class __ProductDetailPageState extends State { children: [ FlatButton( onPressed: () async { - GifLoaderDialogUtils.showMyDialog( - context); + GifLoaderDialogUtils.showMyDialog(context); await model.getProductLocationData(); GifLoaderDialogUtils.hideDialog(context); @@ -277,16 +254,12 @@ class __ProductDetailPageState extends State { }, child: Text( TranslationBase.of(context).availability, - style: TextStyle( - fontSize: 16, - fontWeight: FontWeight.bold), + style: TextStyle(fontSize: 16, fontWeight: FontWeight.bold), ), color: Colors.white, ), CustomDivider( - color: isAvailability - ? Colors.green - : Colors.transparent, + color: isAvailability ? Colors.green : Colors.transparent, ), ], ), @@ -315,12 +288,16 @@ class __ProductDetailPageState extends State { SizedBox( height: 10, ), - RecommendedProducts(product: widget.product,productDetailViewModel: model, + RecommendedProducts( + product: widget.product, + productDetailViewModel: model, addToWishlistFunction: (itemID) async { - await addToWishlistFunction(itemID: itemID, model: model); - }, deleteFromWishlistFunction: (itemID) async { + await addToWishlistFunction(itemID: itemID, model: model); + }, + deleteFromWishlistFunction: (itemID) async { await deleteFromWishlistFunction(itemID: itemID, model: model); - },) + }, + ) ], ), ), @@ -339,6 +316,10 @@ class __ProductDetailPageState extends State { )); } + addToShoppingCartFunction({quantity, itemID, ProductDetailViewModel model}) async { + await model.addToCartData(quantity, itemID); + } + addToWishlistFunction({itemID, ProductDetailViewModel model}) async { isInWishList = true; await model.addToWishlistData(itemID); @@ -350,31 +331,18 @@ class __ProductDetailPageState extends State { await model.deleteWishlistData(itemID); setState(() {}); } - addToCartFunction( - {quantity, - itemID, - ProductDetailViewModel model}) async { - GifLoaderDialogUtils.showMyDialog(context); - await model.addToCartData(quantity, itemID); - GifLoaderDialogUtils.hideDialog(context); - } - addToShoppingCartFunction( - {quantity, - itemID, - ProductDetailViewModel model}) async { + addToCartFunction({ + quantity, + itemID, + ProductDetailViewModel model, + }) async { GifLoaderDialogUtils.showMyDialog(context); await model.addToCartData(quantity, itemID); GifLoaderDialogUtils.hideDialog(context); - Navigator.push( - context, - FadePage(page: CartOrderPage())); } } - - -notifyMeWhenAvailable( - {itemId, customerId, ProductDetailViewModel model}) async { +notifyMeWhenAvailable({itemId, customerId, ProductDetailViewModel model}) async { await model.notifyMe(customerId, itemId); } diff --git a/lib/pages/pharmacies/screens/product-details/shared/product_details_app_bar.dart b/lib/pages/pharmacies/screens/product-details/shared/product_details_app_bar.dart index 25be1775..1626e24f 100644 --- a/lib/pages/pharmacies/screens/product-details/shared/product_details_app_bar.dart +++ b/lib/pages/pharmacies/screens/product-details/shared/product_details_app_bar.dart @@ -25,9 +25,19 @@ class ProductAppBar extends StatelessWidget with PreferredSizeWidget { final bool isInWishList; final Function addToCartFunction; - ProductAppBar({Key key, this.product, this.model, this.addToWishlistFunction, this.quantity, this.deleteFromWishlistFunction, this.isInWishList, this.addToCartFunction}) : super(key: key); + ProductAppBar( + {Key key, + this.product, + this.model, + this.addToWishlistFunction, + this.quantity, + this.deleteFromWishlistFunction, + this.isInWishList, + this.addToCartFunction}) + : super(key: key); - AuthenticatedUserObject authenticatedUserObject = locator(); + AuthenticatedUserObject authenticatedUserObject = + locator(); @override Widget build(BuildContext context) { @@ -69,7 +79,11 @@ class ProductAppBar extends StatelessWidget with PreferredSizeWidget { MaterialPageRoute(builder: (context) => CartOrderPage()), ); }), - if (Provider.of(context, listen: false).cartResponse.quantityCount != 0) + if (Provider.of(context, + listen: false) + .cartResponse + .quantityCount != + 0) Positioned( top: 0, right: -1.0, @@ -79,10 +93,14 @@ class ProductAppBar extends StatelessWidget with PreferredSizeWidget { borderRadius: BorderRadius.circular(15), ), padding: EdgeInsets.only(left: 5, right: 4.5), - height: 19, + height: 18, child: Center( child: Texts( - orderPreviewViewModel.cartResponse.quantityCount.toString(), + Provider.of(context, + listen: false) + .cartResponse + .quantityCount + .toString(), style: "caption", medium: true, color: Colors.white, @@ -130,7 +148,11 @@ class ProductAppBar extends StatelessWidget with PreferredSizeWidget { onTap: () async { if (quantity > 0) { { - await addToCartFunction(quantity: quantity, itemID: itemID, model: model); + await addToCartFunction( + quantity: quantity, + itemID: itemID, + model: model, + context: context); Navigator.of(context).pop(); } @@ -144,7 +166,9 @@ class ProductAppBar extends StatelessWidget with PreferredSizeWidget { color: !isInWishList ? Colors.white : Colors.red[800], ), title: Text( - isInWishList ? TranslationBase.of(context).removeFromWishlist : TranslationBase.of(context).addToWishlist, + isInWishList + ? TranslationBase.of(context).removeFromWishlist + : TranslationBase.of(context).addToWishlist, ), onTap: () async { if (isInWishList) @@ -159,7 +183,8 @@ class ProductAppBar extends StatelessWidget with PreferredSizeWidget { TranslationBase.of(context).compare, ), onTap: () { - Provider.of(context, listen: false).addItem(specificationData); + Provider.of(context, listen: false) + .addItem(specificationData); Navigator.of(context).pop(); }, ), diff --git a/lib/pages/pharmacies/search_brands_page.dart b/lib/pages/pharmacies/search_brands_page.dart index 5794ac55..db9dbcb6 100644 --- a/lib/pages/pharmacies/search_brands_page.dart +++ b/lib/pages/pharmacies/search_brands_page.dart @@ -120,22 +120,23 @@ class _SearchBrandsPageState extends State { itemCount: model.searchList.length, itemBuilder: (BuildContext ctx, index) { return Padding( - padding:EdgeInsets.all(8.0), + padding: EdgeInsets.all(8.0), child: Column( crossAxisAlignment: CrossAxisAlignment.start, mainAxisAlignment: MainAxisAlignment.start, children: [ - Padding( - padding: const EdgeInsets.all(8.0), - child: Container( - child: Text( - model.searchList[index].name, - style: TextStyle(fontSize: 20), + Padding( + padding: const EdgeInsets.all(8.0), + child: Container( + child: Text( + model.searchList[index].name, + style: TextStyle(fontSize: 20), + ), ), ), - ), - Divider(height: 1, color: Colors.grey) - ],), + Divider(height: 1, color: Colors.grey) + ], + ), ); }, ), diff --git a/lib/pages/pharmacies/widgets/home/PrescriptionsWidget.dart b/lib/pages/pharmacies/widgets/home/PrescriptionsWidget.dart index 261f4e99..fabab916 100644 --- a/lib/pages/pharmacies/widgets/home/PrescriptionsWidget.dart +++ b/lib/pages/pharmacies/widgets/home/PrescriptionsWidget.dart @@ -36,7 +36,7 @@ class PrescriptionsWidget extends StatelessWidget { ViewAllHomeWidget(TranslationBase.of(context).myPrescription, HomePrescriptionsPage()), Container( margin: EdgeInsets.only(right: 10.0, left: 10.0), - height: MediaQuery.of(context).size.height * 0.28, + height: MediaQuery.of(context).size.height * 0.18, child: ListView.builder( scrollDirection: Axis.horizontal, shrinkWrap: true, diff --git a/lib/pages/pharmacy/profile/profile.dart b/lib/pages/pharmacy/profile/profile.dart index a82a74eb..f4534a01 100644 --- a/lib/pages/pharmacy/profile/profile.dart +++ b/lib/pages/pharmacy/profile/profile.dart @@ -9,6 +9,7 @@ import 'package:diplomaticquarterapp/pages/login/welcome.dart'; import 'package:diplomaticquarterapp/pages/medical/prescriptions/prescriptions_home_page.dart'; import 'package:diplomaticquarterapp/pages/pharmacies/compare.dart'; import 'package:diplomaticquarterapp/pages/pharmacies/my_reviews.dart'; +import 'package:diplomaticquarterapp/pages/pharmacies/screens/lacum-activitaion-vida-page.dart'; import 'package:diplomaticquarterapp/pages/pharmacies/screens/lakum-main-page.dart'; import 'package:diplomaticquarterapp/pages/pharmacies/screens/lakum-terms-conditions-page.dart'; import 'package:diplomaticquarterapp/pages/pharmacies/screens/pharmacy-terms-conditions-page.dart'; @@ -93,12 +94,15 @@ class _ProfilePageState extends State { }, builder: (_, model, wi) => AppScaffold( appBarTitle: TranslationBase.of(context).myAccount, - isShowAppBar: false, - isShowDecPage: false, + isShowAppBar: true, + isShowDecPage: true, isPharmacy: true, + + //isBottomBar: true, + isMainPharmacyPages: true, body: user != null ? Container( - color: Colors.white, + color: Colors.white, child: SingleChildScrollView( child: Column( children: [ @@ -123,12 +127,8 @@ class _ProfilePageState extends State { Column(children: [ Row(children: [ Text( - TranslationBase.of(context) - .welcome, - style: TextStyle( - fontSize: 14.0, - fontWeight: FontWeight.bold, - color: Colors.grey), + TranslationBase.of(context).welcome, + style: TextStyle(fontSize: 14.0, fontWeight: FontWeight.bold, color: Colors.grey), ), ]), SizedBox( @@ -136,16 +136,8 @@ class _ProfilePageState extends State { ), Row(children: [ Text( - languageID == "ar" - ? user.firstNameN.toString() + - " " + - user.lastNameN.toString() - : user.firstName.toString() + - " " + - user.lastName.toString(), - style: TextStyle( - fontSize: 14.0, - fontWeight: FontWeight.bold), + languageID == "ar" ? user.firstNameN.toString() + " " + user.lastNameN.toString() : user.firstName.toString() + " " + user.lastName.toString(), + style: TextStyle(fontSize: 14.0, fontWeight: FontWeight.bold), ), ]), ]), @@ -172,15 +164,10 @@ class _ProfilePageState extends State { child: InkWell( onTap: () { if (customerId == null) { - AppToast.showErrorToast( - message: "Customer not found"); + AppToast.showErrorToast(message: "Customer not found"); return; } - Navigator.push( - context, - FadePage( - page: OrderPage( - customerID: customerId))); + Navigator.push(context, FadePage(page: OrderPage(customerID: customerId))); }, child: Column( children: [ @@ -207,8 +194,10 @@ class _ProfilePageState extends State { Expanded( child: InkWell( onTap: () { - Navigator.push(context, - FadePage(page: LakumMainPage())); + if (customerId == null || customerId == '') + Navigator.push(context, FadePage(page: LakumActivationVidaPage())); + else + Navigator.push(context, FadePage(page: LakumMainPage())); }, child: Column( children: [ @@ -233,8 +222,7 @@ class _ProfilePageState extends State { Expanded( child: InkWell( onTap: () { - Navigator.push( - context, + Navigator.push(context, FadePage(page: WishlistPage())); }, child: Column( diff --git a/lib/pages/pharmacy_categorise.dart b/lib/pages/pharmacy_categorise.dart index b71c28ce..8a965b6e 100644 --- a/lib/pages/pharmacy_categorise.dart +++ b/lib/pages/pharmacy_categorise.dart @@ -35,6 +35,10 @@ class _PharmacyCategorisePageState extends State { Widget child) => AppScaffold( isShowDecPage: false, + isShowAppBar: false, + isMainPharmacyPages: true, + isPharmacy: true, + isShowPharmacyAppbar: true, baseViewModel: model, body: Column( children: [ diff --git a/lib/pages/symptom-checker/select-gender.dart b/lib/pages/symptom-checker/select-gender.dart index aae64bb6..c0ca1712 100644 --- a/lib/pages/symptom-checker/select-gender.dart +++ b/lib/pages/symptom-checker/select-gender.dart @@ -5,7 +5,7 @@ import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; import 'package:diplomaticquarterapp/widgets/text/app_texts_widget.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; -import 'package:flutter_xlider/flutter_xlider.dart'; +// import 'package:flutter_xlider/flutter_xlider.dart'; class SelectGender extends StatefulWidget { @override @@ -82,18 +82,18 @@ class _SelectGender extends State { SizedBox( height: 30, ), - FlutterSlider( - values: [slider], - max: 90, - min: 14, - onDragCompleted: (handlerIndex, lowerValue, upperValue) { - print(lowerValue); - print(upperValue); - setState(() { - slider = upperValue; - }); - }, - ), + // FlutterSlider( + // values: [slider], + // max: 90, + // min: 14, + // onDragCompleted: (handlerIndex, lowerValue, upperValue) { + // print(lowerValue); + // print(upperValue); + // setState(() { + // slider = upperValue; + // }); + // }, + // ), ], ), Expanded( diff --git a/lib/services/pharmacy_services/product_detail_service.dart b/lib/services/pharmacy_services/product_detail_service.dart index 31a06fea..47673eab 100644 --- a/lib/services/pharmacy_services/product_detail_service.dart +++ b/lib/services/pharmacy_services/product_detail_service.dart @@ -2,10 +2,14 @@ import 'package:diplomaticquarterapp/config/config.dart'; import 'package:diplomaticquarterapp/config/shared_pref_kay.dart'; import 'package:diplomaticquarterapp/core/service/base_service.dart'; import 'package:diplomaticquarterapp/models/pharmacy/Wishlist.dart'; +import 'package:diplomaticquarterapp/models/pharmacy/addToCartModel.dart'; import 'package:diplomaticquarterapp/models/pharmacy/locationModel.dart'; import 'package:diplomaticquarterapp/models/pharmacy/productDetailModel.dart'; +import 'package:diplomaticquarterapp/config/shared_pref_kay.dart'; +import 'package:diplomaticquarterapp/uitl/app_toast.dart'; import 'package:diplomaticquarterapp/models/pharmacy/specification.dart'; import 'package:diplomaticquarterapp/uitl/utils.dart'; +import 'package:diplomaticquarterapp/core/model/pharmacies/ShoppingCart.dart'; import 'package:diplomaticquarterapp/uitl/app_toast.dart'; class ProductDetailService extends BaseService { @@ -73,7 +77,7 @@ class ProductDetailService extends BaseService { }, body: request); } - Future addToCart(quantity, itemID) async { + Future addToCart(quantity, itemID) async { var customerId = await sharedPref.getString(PHARMACY_CUSTOMER_ID); hasError = false; Map request; @@ -88,9 +92,8 @@ class ProductDetailService extends BaseService { "language_id": 1 } }; - - - + dynamic localRes; + await baseAppClient.pharmacyPost(GET_SHOPPING_CART, isExternal: false, onSuccess: (dynamic response, int statusCode) { _addToCartModel.clear(); @@ -98,11 +101,14 @@ class ProductDetailService extends BaseService { _addToCartModel.add(Wishlist.fromJson(item)); }); AppToast.showSuccessToast(message: 'You have added a product to the cart'); + localRes = response; }, onFailure: (String error, int statusCode) { hasError = true; super.error = error; AppToast.showErrorToast(message: error??Utils.generateContactAdminMessage()); }, body: request); + + return Future.value(localRes); } Future notifyMe(customerId, itemID) async { @@ -142,7 +148,7 @@ class ProductDetailService extends BaseService { Future getWishlistItems() async { var customerId = await sharedPref.getString(PHARMACY_CUSTOMER_ID); hasError = false; - await baseAppClient.getPharmacy(GET_WISHLIST.toString()+customerId.toString()+"?shopping_cart_type=2", + await baseAppClient.getPharmacy(GET_WISHLIST+customerId+"?shopping_cart_type=2", onSuccess: (dynamic response, int statusCode) { _wishListProducts.clear(); response['shopping_carts'].forEach((item) { diff --git a/lib/services/smartwatch_integration/SmartWatchIntegrationService.dart b/lib/services/smartwatch_integration/SmartWatchIntegrationService.dart index 3bfe62e3..459c0e83 100644 --- a/lib/services/smartwatch_integration/SmartWatchIntegrationService.dart +++ b/lib/services/smartwatch_integration/SmartWatchIntegrationService.dart @@ -3,6 +3,7 @@ import 'package:diplomaticquarterapp/config/shared_pref_kay.dart'; import 'package:diplomaticquarterapp/core/service/base_service.dart'; import 'package:diplomaticquarterapp/models/Authentication/authenticated_user.dart'; import 'package:diplomaticquarterapp/models/Request.dart'; +import 'package:diplomaticquarterapp/models/SmartWatch/HealthData.dart'; import 'package:diplomaticquarterapp/services/authentication/auth_provider.dart'; import 'package:diplomaticquarterapp/uitl/app_shared_preferences.dart'; import 'package:flutter/material.dart'; @@ -18,8 +19,7 @@ class SmartWatchIntegrationService extends BaseService { Map request; if (await this.sharedPref.getObject(USER_PROFILE) != null) { - var data = AuthenticatedUser.fromJson( - await this.sharedPref.getObject(USER_PROFILE)); + var data = AuthenticatedUser.fromJson(await this.sharedPref.getObject(USER_PROFILE)); authUser = data; } @@ -42,13 +42,29 @@ class SmartWatchIntegrationService extends BaseService { dynamic localRes; - await baseAppClient.post(GET_PATIENT_LAST_RECORD, - onSuccess: (response, statusCode) async { - localRes = response; - }, onFailure: (String error, int statusCode) { - throw error; - }, body: request); + await baseAppClient.post(GET_PATIENT_LAST_RECORD, onSuccess: (response, statusCode) async { + localRes = response; + }, onFailure: (String error, int statusCode) { + throw error; + }, body: request); return Future.value(localRes); + } + Future insertPatientHealthData(List healthData, BuildContext context) async { + Map request; + if (await this.sharedPref.getObject(USER_PROFILE) != null) { + var data = AuthenticatedUser.fromJson(await this.sharedPref.getObject(USER_PROFILE)); + authUser = data; + } + request = { + "Med_InsertTransactionsInputsList": healthData, + }; + dynamic localRes; + await baseAppClient.post(INSERT_PATIENT_HEALTH_DATA, onSuccess: (response, statusCode) async { + localRes = response; + }, onFailure: (String error, int statusCode) { + throw error; + }, body: request); + return Future.value(localRes); } } diff --git a/lib/theme/theme_value.dart b/lib/theme/theme_value.dart index 96392b4a..1c01d990 100644 --- a/lib/theme/theme_value.dart +++ b/lib/theme/theme_value.dart @@ -2,7 +2,6 @@ import 'dart:ui'; import 'package:diplomaticquarterapp/Constants.dart'; import 'package:flutter/material.dart'; -import 'package:hexcolor/hexcolor.dart'; /// ---- Default Theme ---- /// @@ -40,7 +39,7 @@ defaultTheme({fontName}) { buttonColor: Colors.black, toggleableActiveColor: secondaryColor, indicatorColor: secondaryColor, - bottomSheetTheme: BottomSheetThemeData(backgroundColor: HexColor('#E0E0E0')), + bottomSheetTheme: BottomSheetThemeData(backgroundColor: Color(0xFFE0E0E0)), cursorColor: Colors.grey, primaryTextTheme: TextTheme(bodyText2: TextStyle(color: Colors.white)), iconTheme: IconThemeData(), @@ -92,7 +91,7 @@ invertThemes({fontName}) { buttonColor: Colors.black, toggleableActiveColor: secondaryColor, indicatorColor: secondaryColor, - bottomSheetTheme: BottomSheetThemeData(backgroundColor: HexColor('#E0E0E0')), + bottomSheetTheme: BottomSheetThemeData(backgroundColor: Color(0xFFE0E0E0)), cursorColor: Colors.black, iconTheme: IconThemeData(), appBarTheme: AppBarTheme( @@ -147,7 +146,7 @@ bwThemes({fontName}) { primaryColor: Color(0xfffffff4), toggleableActiveColor: secondaryColor, indicatorColor: secondaryColor, - bottomSheetTheme: BottomSheetThemeData(backgroundColor: HexColor('#E0E0E0')), + bottomSheetTheme: BottomSheetThemeData(backgroundColor: Color(0xFFE0E0E0)), cursorColor: Colors.black, iconTheme: IconThemeData(), appBarTheme: AppBarTheme( diff --git a/lib/uitl/SignalRUtil.dart b/lib/uitl/SignalRUtil.dart index 52f34cf7..a1a411e0 100644 --- a/lib/uitl/SignalRUtil.dart +++ b/lib/uitl/SignalRUtil.dart @@ -29,6 +29,10 @@ class SignalRUtil { }); } + void closeSignalRConnection() { + connectionBuilder.stop(); + } + void handleIncomingMessage(List message) { print(message.toString()); } @@ -38,7 +42,7 @@ class SignalRUtil { } bool getConnectionState() { - if (connectionBuilder.state == HubConnectionState.connected) return true; - if (connectionBuilder.state == HubConnectionState.connected) return true; + if (connectionBuilder.state == HubConnectionState.connected || connectionBuilder.state == HubConnectionState.connecting) return true; + if (connectionBuilder.state == HubConnectionState.disconnected || connectionBuilder.state == HubConnectionState.disconnecting) return false; } } diff --git a/lib/uitl/translations_delegate_base.dart b/lib/uitl/translations_delegate_base.dart index 32fa6f66..8db305d7 100644 --- a/lib/uitl/translations_delegate_base.dart +++ b/lib/uitl/translations_delegate_base.dart @@ -2594,6 +2594,8 @@ class TranslationBase { String get androidInstructions4 => localizedValues["android-instructions-4"][locale.languageCode]; + String get tamaraInstPlan => localizedValues["tamaraInstPlan"][locale.languageCode]; + String get onlineTag => localizedValues["onlineTag"][locale.languageCode]; String get offlineTag => localizedValues["offlineTag"][locale.languageCode]; @@ -2604,6 +2606,8 @@ class TranslationBase { String get cholesTitle => localizedValues["cholesTitle"][locale.languageCode]; + String get laserClinic => localizedValues["laserClinic"][locale.languageCode]; + } class TranslationBaseDelegate extends LocalizationsDelegate { diff --git a/lib/uitl/utils_new.dart b/lib/uitl/utils_new.dart index 70bd7df0..832a92b1 100644 --- a/lib/uitl/utils_new.dart +++ b/lib/uitl/utils_new.dart @@ -570,10 +570,6 @@ 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 endDate = DateTime(now.year, now.month, now.day, endHour, endMint); - print(startDate.toString()); - print(endDate.toString()); - print(now); - print("------------"); if (startDate.isBefore(now) && endDate.isAfter(now)) return true; else diff --git a/lib/widgets/avatar/large_avatar.dart b/lib/widgets/avatar/large_avatar.dart index 64b72f2b..131a2820 100644 --- a/lib/widgets/avatar/large_avatar.dart +++ b/lib/widgets/avatar/large_avatar.dart @@ -14,11 +14,12 @@ import '../show_zoom_image_dialog.dart'; /// [height] the avatar height /// [onTap] on tap function class LargeAvatar extends StatelessWidget { - LargeAvatar({Key key, @required this.name, this.url, this.disableProfileView: false, this.radius = 70.0, this.width = 70, this.height = 60, this.onTap}) : super(key: key); + LargeAvatar({Key key, @required this.name, this.url, this.disableProfileView: false, this.radius = 70.0, this.width = 70, this.height = 60, this.onTap, this.isAppointmentAvatar: false}) : super(key: key); final String name; final String url; final bool disableProfileView; + final bool isAppointmentAvatar; final double radius; final double width; final double height; @@ -38,7 +39,7 @@ class LargeAvatar extends StatelessWidget { width: width, height: height, ), - if (!disableProfileView) + if (!disableProfileView && !isAppointmentAvatar) Container( child: Icon(Icons.search,size: 18,color: Colors.white,), padding: EdgeInsets.all(6), @@ -62,7 +63,7 @@ class LargeAvatar extends StatelessWidget { return InkWell( onTap: disableProfileView ? null - : () { + : isAppointmentAvatar ? onTap : () { print("ssssss " + url.trim()); showZoomImageDialog(context, url.trim() ?? ""); }, diff --git a/lib/widgets/bottom_navigation/bottom_nav_bar.dart b/lib/widgets/bottom_navigation/bottom_nav_bar.dart index 23fbaccd..9f9c7c0c 100644 --- a/lib/widgets/bottom_navigation/bottom_nav_bar.dart +++ b/lib/widgets/bottom_navigation/bottom_nav_bar.dart @@ -5,7 +5,6 @@ import 'package:diplomaticquarterapp/pages/ToDoList/ToDo.dart'; import 'package:diplomaticquarterapp/services/robo_search/event_provider.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart'; -import 'package:eva_icons_flutter/eva_icons_flutter.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:provider/provider.dart'; @@ -97,8 +96,8 @@ class _BottomNavBarState extends State { // ), if (/*widget.index == 0 && */ projectViewModel.havePrivilege(34)) BottomNavigationItem( - icon: EvaIcons.calendar, - activeIcon: EvaIcons.calendar, + icon: Icons.calendar_today_sharp, + activeIcon: Icons.calendar_today_sharp, changeIndex: _changeIndex, index: widget.index, currentIndex: 4, diff --git a/lib/widgets/bottom_options/BottomSheet.dart b/lib/widgets/bottom_options/BottomSheet.dart index f0016fc5..a9e9c4c1 100644 --- a/lib/widgets/bottom_options/BottomSheet.dart +++ b/lib/widgets/bottom_options/BottomSheet.dart @@ -3,7 +3,7 @@ import 'dart:io'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; -import 'package:feather_icons_flutter/feather_icons_flutter.dart'; +// import 'package:feather_icons_flutter/feather_icons_flutter.dart'; import 'package:flutter/material.dart'; import 'package:image_picker/image_picker.dart'; @@ -20,10 +20,10 @@ class ImageOptions { ), _BottomSheetItem( title: TranslationBase.of(context).gallery, - icon: FeatherIcons.image, + icon: Icons.image, onTap: () async { File _image = - await ImagePicker.pickImage(source: ImageSource.gallery, imageQuality: 50); + await ImagePicker.pickImage(source: ImageSource.gallery, imageQuality: 20); String fileName = _image.path; final bytes = File(fileName).readAsBytesSync(); String base64Encode = base64.encode(bytes); @@ -34,10 +34,10 @@ class ImageOptions { ), _BottomSheetItem( title: TranslationBase.of(context).camera, - icon: FeatherIcons.camera, + icon: Icons.camera_alt, onTap: () async { File _image = - await ImagePicker.pickImage(source: ImageSource.camera, imageQuality: 50); + await ImagePicker.pickImage(source: ImageSource.camera, imageQuality: 20); String fileName = _image.path; final bytes = File(fileName).readAsBytesSync(); String base64Encode = base64.encode(bytes); diff --git a/lib/widgets/charts/app_bar_chart.dart b/lib/widgets/charts/app_bar_chart.dart deleted file mode 100644 index 19362f32..00000000 --- a/lib/widgets/charts/app_bar_chart.dart +++ /dev/null @@ -1,53 +0,0 @@ -import 'package:charts_flutter/flutter.dart' as charts; -import 'package:flutter/material.dart'; - -class AppBarChart extends StatelessWidget { - const AppBarChart({ - Key key, - @required this.isArabic, - @required this.seriesList, - }) : super(key: key); - - final List seriesList; - final bool isArabic; - - @override - Widget build(BuildContext context) { - return Container( - height: 400, - //margin: EdgeInsets.only(top: 60), - child: charts.BarChart( - seriesList, - // animate: animate, - domainAxis: charts.OrdinalAxisSpec( - renderSpec: charts.GridlineRendererSpec( - labelAnchor: isArabic ? charts.TickLabelAnchor.before : charts.TickLabelAnchor.after, - labelRotation: -30, - labelOffsetFromAxisPx: 30, - labelOffsetFromTickPx: 15, - labelJustification: charts.TickLabelJustification.inside, - ), - ), - - /// Customize the primary measure axis using a small tick renderer. - /// Use String instead of num for ordinal domain axis - /// (typically bar charts). - primaryMeasureAxis: new charts.NumericAxisSpec( - renderSpec: new charts.GridlineRendererSpec( - // Display the measure axis labels below the gridline. - // - // 'Before' & 'after' follow the axis value direction. - // Vertical axes draw 'before' below & 'after' above the tick. - // Horizontal axes draw 'before' left & 'after' right the tick. - labelAnchor: charts.TickLabelAnchor.before, - - // Left justify the text in the axis. - // - // Note: outside means that the secondary measure axis would right - // justify. - labelJustification: charts.TickLabelJustification.outside, - )), - ), - ); - } -} diff --git a/lib/widgets/charts/app_line_chart.dart b/lib/widgets/charts/app_line_chart.dart deleted file mode 100644 index 1a29b1e6..00000000 --- a/lib/widgets/charts/app_line_chart.dart +++ /dev/null @@ -1,44 +0,0 @@ -import 'package:charts_flutter/flutter.dart' as charts; -import 'package:flutter/material.dart'; - -/// chart line -/// [seriesList] charts series -/// [chartTitle] the charts title -/// [animate] enable and disable animate on create chart -/// [includeArea] chart include Area -/// [stacked] stacked chart over the design -class AppLineChart extends StatelessWidget { - final List seriesList; - final String chartTitle; - final bool animate; - final bool includeArea; - final bool stacked; - - AppLineChart( - {Key key, - @required this.seriesList, - this.chartTitle, - this.animate = true, - this.includeArea = false, - this.stacked = true}); - - @override - Widget build(BuildContext context) { - return Container( - child: Column( - children: [ - Text( - chartTitle, - style: TextStyle(fontSize: 24.0, fontWeight: FontWeight.bold), - ), - Expanded( - child: charts.LineChart(seriesList, - defaultRenderer: charts.LineRendererConfig( - includeArea: false, stacked: true), - animate: animate), - ), - ], - ), - ); - } -} diff --git a/lib/widgets/data_display/list/custom_Item.dart b/lib/widgets/data_display/list/custom_Item.dart index c11af999..d5123e8d 100644 --- a/lib/widgets/data_display/list/custom_Item.dart +++ b/lib/widgets/data_display/list/custom_Item.dart @@ -1,4 +1,3 @@ -import 'package:eva_icons_flutter/eva_icons_flutter.dart'; import 'package:flutter/material.dart'; /// Custom Item widget @@ -32,7 +31,7 @@ class CustomItem extends StatelessWidget { this.disabled: false, this.onTap, this.startIconColor, - this.endIcon = EvaIcons.chevronRight, + this.endIcon = Icons.chevron_right_sharp, this.padding, this.child, this.endIconColor, diff --git a/lib/widgets/data_display/medical/time_line_new_widget.dart b/lib/widgets/data_display/medical/time_line_new_widget.dart index 3851f329..4d38de2e 100644 --- a/lib/widgets/data_display/medical/time_line_new_widget.dart +++ b/lib/widgets/data_display/medical/time_line_new_widget.dart @@ -35,6 +35,7 @@ class _TimeLineViewState extends State { List dateObjs = []; DateObj selectedDateObj = null; final authService = new auth.AuthProvider(); + @override void initState() { super.initState(); @@ -347,14 +348,15 @@ class TimelineNewWidget extends StatelessWidget { FadePage( page: AppointmentDetails( appo: appoitmentAllHistoryResul, - parentIndex: 2, + parentIndex: 2, ))); }, name: appoitmentAllHistoryResul.doctorNameObj, - disableProfileView: true, + disableProfileView: false, url: appoitmentAllHistoryResul.doctorImageURL, width: 30, height: 30, + isAppointmentAvatar: true, ), mHeight(6), Text( diff --git a/lib/widgets/dialogs/radio_selection_dialog.dart b/lib/widgets/dialogs/radio_selection_dialog.dart index 4cbfdcc4..7175d6dc 100644 --- a/lib/widgets/dialogs/radio_selection_dialog.dart +++ b/lib/widgets/dialogs/radio_selection_dialog.dart @@ -110,7 +110,7 @@ class RadioSelectionDialogState extends State { Expanded( child: DefaultButton( TranslationBase.of(context).save, - () { + (){ Navigator.pop(context); widget.onValueSelected(selectedIndex); }, diff --git a/lib/widgets/input/date_picker/date_picker.dart b/lib/widgets/input/date_picker/date_picker.dart index f9532052..f3e2406c 100644 --- a/lib/widgets/input/date_picker/date_picker.dart +++ b/lib/widgets/input/date_picker/date_picker.dart @@ -1,7 +1,6 @@ import 'dart:async'; import 'dart:math' as math; -import 'package:eva_icons_flutter/eva_icons_flutter.dart'; import 'package:flutter/gestures.dart' show DragStartBehavior; import 'package:flutter/material.dart'; import 'package:flutter/rendering.dart'; @@ -862,7 +861,7 @@ class _MonthPickerState extends State disabledColor: Theme.of(context).disabledColor.withOpacity(0.2), color: Theme.of(context).disabledColor, - icon: const Icon(EvaIcons.chevronLeft), + icon: const Icon(Icons.chevron_left_sharp), tooltip: _isDisplayingFirstMonth ? null : '${localizations.previousMonthTooltip} ${localizations.formatMonthYear(_previousMonthDate)}', @@ -886,7 +885,7 @@ class _MonthPickerState extends State disabledColor: Theme.of(context).disabledColor.withOpacity(0.2), color: Theme.of(context).disabledColor, - icon: const Icon(EvaIcons.chevronRight), + icon: const Icon(Icons.chevron_right_sharp), tooltip: _isDisplayingLastMonth ? null : '${localizations.nextMonthTooltip} ${localizations.formatMonthYear(_nextMonthDate)}', diff --git a/lib/widgets/input/text_field.dart b/lib/widgets/input/text_field.dart index 55ebbc3d..9bb899cb 100644 --- a/lib/widgets/input/text_field.dart +++ b/lib/widgets/input/text_field.dart @@ -1,4 +1,3 @@ -import 'package:eva_icons_flutter/eva_icons_flutter.dart'; import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; @@ -156,7 +155,7 @@ class _TextFieldsState extends State { ); }, child: Icon( - EvaIcons.eye, + Icons.remove_red_eye_sharp, size: 24.0, color: Color.fromRGBO(78, 62, 253, 1.0), ), @@ -167,7 +166,7 @@ class _TextFieldsState extends State { view = true; }); }, - child: Icon(EvaIcons.eyeOff, + child: Icon(Icons.remove_red_eye_sharp, size: 24.0, color: Colors.grey[500]), ), ); diff --git a/lib/widgets/mobile-no/mobile_no.dart b/lib/widgets/mobile-no/mobile_no.dart index f4cd18fe..18836cf7 100644 --- a/lib/widgets/mobile-no/mobile_no.dart +++ b/lib/widgets/mobile-no/mobile_no.dart @@ -11,11 +11,8 @@ import '../../Constants.dart'; class PhoneNumberSelectorWidget extends StatefulWidget { final Function onNumberChange; final Function onCountryChange; - PhoneNumberSelectorWidget({ - Key key, - this.onNumberChange, - this.onCountryChange, - }) : super(key: key); + final String mobileNo; + PhoneNumberSelectorWidget({Key key, this.onNumberChange, this.onCountryChange, this.mobileNo}) : super(key: key); @override _PhoneNumberSelectorWidgetState createState() { @@ -31,6 +28,7 @@ class _PhoneNumberSelectorWidgetState extends State { @override void initState() { for (var element in countriesData) counties.add(Countries.fromJson(element)); + super.initState(); } @@ -53,7 +51,7 @@ class _PhoneNumberSelectorWidgetState extends State { children: [ inputWidget(TranslationBase.of(context).country, countryName, isEnable: false, hasSelection: true), SizedBox(height: 12), - Directionality(textDirection: TextDirection.ltr, child: inputWidget(TranslationBase.of(context).phoneNumber, "5xxxxxxxx", prefix: countryCode)), + Directionality(textDirection: TextDirection.ltr, child: inputWidget(TranslationBase.of(context).phoneNumber, widget.mobileNo ?? "5xxxxxxxx", prefix: countryCode)), ], ); } @@ -252,7 +250,8 @@ class _MobileNo extends State { Expanded( flex: 4, child: Container( - margin: widget.margin != null ? EdgeInsets.all(widget.margin) : EdgeInsets.only(top: widget.marginTop, right: widget.marginRight, bottom: widget.marginBottom, left: widget.marginLeft), + margin: + widget.margin != null ? EdgeInsets.all(widget.margin) : EdgeInsets.only(top: widget.marginTop, right: widget.marginRight, bottom: widget.marginBottom, left: widget.marginLeft), child: TextField( controller: widget.controller, keyboardType: TextInputType.number, diff --git a/lib/widgets/offers_packages/offers_packages.dart b/lib/widgets/offers_packages/offers_packages.dart index 2b255ccb..aed4f699 100644 --- a/lib/widgets/offers_packages/offers_packages.dart +++ b/lib/widgets/offers_packages/offers_packages.dart @@ -10,7 +10,6 @@ import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; import 'package:diplomaticquarterapp/widgets/loadings/ShimmerLoading.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; -import 'package:hexcolor/hexcolor.dart'; class OffersAndPackagesWidget extends StatefulWidget { final List models; @@ -168,7 +167,7 @@ class _OfferPackagesItemWidgetState extends State { alignment: Alignment.bottomLeft, child: MaterialButton( height: 30, - color: HexColor('#D81A2E'), + color: Color(0xFFD81A2E), onPressed: () => widget.model.action.onClick(model.item), child: Texts( TranslationBase.of(context).view, diff --git a/lib/widgets/others/StarRating.dart b/lib/widgets/others/StarRating.dart index 74bdbfe3..54ad3162 100644 --- a/lib/widgets/others/StarRating.dart +++ b/lib/widgets/others/StarRating.dart @@ -1,5 +1,4 @@ import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; -import 'package:eva_icons_flutter/eva_icons_flutter.dart'; import 'package:flutter/material.dart'; class StarRating extends StatelessWidget { @@ -23,7 +22,7 @@ class StarRating extends StatelessWidget { Padding( padding: EdgeInsets.only(right: 1.0), child: Icon( - (index+1) <= (totalAverage ?? 0) ? EvaIcons.star : EvaIcons.starOutline, + (index+1) <= (totalAverage ?? 0) ? Icons.star : Icons.star_border_outlined, size: size, color: (index+1) <= (totalAverage ?? 0) ? Color.fromRGBO(255, 186, 0, 1.0) : Theme.of(context).hintColor ), diff --git a/lib/widgets/others/app_scaffold_widget.dart b/lib/widgets/others/app_scaffold_widget.dart index c93ac267..d071d4d2 100644 --- a/lib/widgets/others/app_scaffold_widget.dart +++ b/lib/widgets/others/app_scaffold_widget.dart @@ -1,17 +1,30 @@ import 'package:auto_size_text/auto_size_text.dart'; import 'package:badges/badges.dart'; +import 'package:barcode_scan_fix/barcode_scan.dart'; import 'package:diplomaticquarterapp/config/config.dart'; import 'package:diplomaticquarterapp/core/model/ImagesInfo.dart'; +import 'package:diplomaticquarterapp/core/model/pharmacies/PharmacyProduct.dart'; import 'package:diplomaticquarterapp/core/service/AuthenticatedUserObject.dart'; +import 'package:diplomaticquarterapp/core/service/client/base_app_client.dart'; +import 'package:diplomaticquarterapp/core/viewModels/PharmacyPagesViewModel.dart'; import 'package:diplomaticquarterapp/core/viewModels/base_view_model.dart'; import 'package:diplomaticquarterapp/core/viewModels/pharmacyModule/OrderPreviewViewModel.dart'; import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; 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/services/robo_search/event_provider.dart'; import 'package:diplomaticquarterapp/theme/colors.dart'; +import 'package:diplomaticquarterapp/uitl/app_toast.dart'; +import 'package:diplomaticquarterapp/uitl/gif_loader_dialog_utils.dart'; +import 'package:diplomaticquarterapp/uitl/navigation_service.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:diplomaticquarterapp/uitl/utils_new.dart'; +import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; +import 'package:diplomaticquarterapp/widgets/pharmacy/bottom_nav_pharmacy_bar.dart'; import 'package:diplomaticquarterapp/widgets/progress_indicator/app_loader_widget.dart'; +import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart'; import 'package:flutter/material.dart'; import 'package:font_awesome_flutter/font_awesome_flutter.dart'; import 'package:provider/provider.dart'; @@ -25,7 +38,7 @@ import 'not_auh_page.dart'; VoidCallback _onCartClick; -class AppScaffold extends StatelessWidget { +class AppScaffold extends StatefulWidget { final String appBarTitle; final Widget body; final Widget bottomSheet; @@ -60,12 +73,18 @@ class AppScaffold extends StatelessWidget { List dropDownList; final Function(int) dropDownIndexChange; Function onTap; - - AuthenticatedUserObject authenticatedUserObject = locator(); - - AppBarWidget appBar; + final bool isMainPharmacyPages; + final bool extendBody; + final ValueChanged changeCurrentTab; + final int currentTab; + final bool isShowPharmacyAppbar; final Widget customAppBar; + AppScaffold setOnAppBarCartClick(VoidCallback onClick) { + _onCartClick = onClick; + return this; + } + AppScaffold( {@required this.body, this.appBarTitle = '', @@ -73,6 +92,8 @@ class AppScaffold extends StatelessWidget { this.isShowAppBar = false, this.showNewAppBar = false, this.showNewAppBarTitle = false, + this.isMainPharmacyPages = false, + this.extendBody = false, this.hasAppBarParam, this.bottomSheet, this.bottomNavigationBar, @@ -85,7 +106,7 @@ class AppScaffold extends StatelessWidget { this.title, this.description, this.isShowDecPage = true, - this.isBottomBar, + this.isBottomBar = false, this.backgroundColor, this.preferredSize = 0.0, this.appBarIcons, @@ -102,78 +123,200 @@ class AppScaffold extends StatelessWidget { appBar, this.customAppBar, this.isLocalLoader = false, - this.backButtonTab}); + this.backButtonTab, + this.changeCurrentTab, + this.currentTab, + this.isShowPharmacyAppbar = false}); - AppScaffold setOnAppBarCartClick(VoidCallback onClick) { - _onCartClick = onClick; - return this; + @override + _AppScaffoldState createState() => _AppScaffoldState(); +} + +class _AppScaffoldState extends State { + AuthenticatedUserObject authenticatedUserObject = locator(); + AppBarWidget appBar; + + @override + void initState() { + // TODO: implement initState + super.initState(); + } + + AppBar pharmacyAppbar() { + return AppBar( + backgroundColor: Color(0xff5AB145), + elevation: 0, + title: Container( + height: MediaQuery.of(context).size.height * 0.056, + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(5.0), + color: Colors.white, + ), + child: InkWell( + child: Padding( + padding: EdgeInsets.all(5.0), + child: Row( + //crossAxisAlignment: CrossAxisAlignment.center, + mainAxisAlignment: MainAxisAlignment.start, + children: [ + Icon(Icons.search, size: 25.0), + SizedBox( + width: 15.0, + ), + Texts( + TranslationBase.of(context).searchProductHere, + fontSize: 13, + ) + ], + ), + ), + onTap: () { + Navigator.push( + context, + FadePage(page: SearchProductsPage()), + ); + }, + ), + ), + leading: Builder( + builder: (BuildContext context) { + return InkWell( + onTap: () { + Provider.of(context, listen: false).changeCurrentTab(0); + }, + child: Container( + height: 2.0, + width: 10.0, + child: Image.asset( + 'assets/images/pharmacy_logo.png', + ), + ), + ); + }, + ), + actions: [ + IconButton( + // iconSize: 70, + icon: Image.asset( + 'assets/images/new-design/qr-code.png', + ), + onPressed: _scanQrAndGetProduct //do something, + ) + ], + centerTitle: true, + ); } @override Widget build(BuildContext context) { AppGlobal.context = context; + PharmacyPagesViewModel pagesViewModel = Provider.of(context); - bool isUserNotLogin = (!Provider.of(context, listen: false).isLogin && isShowDecPage); + bool isUserNotLogin = (!Provider.of(context, listen: false).isLogin && widget.isShowDecPage); return Scaffold( - backgroundColor: backgroundColor ?? CustomColors.appBackgroudGrey2Color, + backgroundColor: widget.backgroundColor ?? CustomColors.appBackgroudGrey2Color, + + // appBar: widget.isShowPharmacyAppbar + // ? pharmacyAppbar() + // : widget.isShowAppBar + // ? widget.customAppBar != null + // ? widget.customAppBar + appBar: isUserNotLogin ? null - : (showNewAppBar - ? NewAppBarWidget( - title: appBarTitle, - showTitle: showNewAppBarTitle, - showDropDown: showDropDown, - dropdownIndexValue: dropdownIndexValue, - dropDownList: dropDownList ?? [], - dropDownIndexChange: dropDownIndexChange, - appBarIcons: appBarIcons, - onTap: onTap, - ) - : (isShowAppBar - ? customAppBar != null - ? customAppBar - : appBar = AppBarWidget( - appBarTitle: appBarTitle, - appBarIcons: appBarIcons, - showHomeAppBarIcon: showHomeAppBarIcon, - isPharmacy: isPharmacy, - showPharmacyCart: showPharmacyCart, - isOfferPackages: isOfferPackages, - showOfferPackagesCart: showOfferPackagesCart, - isShowDecPage: isShowDecPage, - backButtonTab: backButtonTab, - ) - : null)), - bottomSheet: bottomSheet, + : widget.isShowPharmacyAppbar + ? pharmacyAppbar() + : (widget.showNewAppBar + ? NewAppBarWidget( + title: widget.appBarTitle, + showTitle: widget.showNewAppBarTitle, + showDropDown: widget.showDropDown, + dropdownIndexValue: widget.dropdownIndexValue, + dropDownList: widget.dropDownList ?? [], + dropDownIndexChange: widget.dropDownIndexChange, + appBarIcons: widget.appBarIcons, + onTap: widget.onTap, + ) + : (widget.isShowAppBar + ? widget.customAppBar != null + ? widget.customAppBar + : appBar = AppBarWidget( + appBarTitle: widget.appBarTitle, + appBarIcons: widget.appBarIcons, + showHomeAppBarIcon: widget.showHomeAppBarIcon, + isPharmacy: widget.isPharmacy, + showPharmacyCart: widget.showPharmacyCart, + isOfferPackages: widget.isOfferPackages, + showOfferPackagesCart: widget.showOfferPackagesCart, + isShowDecPage: widget.isShowDecPage, + backButtonTab: widget.backButtonTab, + ) + : null)), + bottomSheet: widget.bottomSheet, body: SafeArea( top: true, bottom: true, child: isUserNotLogin ? NotAutPage( - title: title ?? appBarTitle, - description: description, - infoList: infoList, - imagesInfo: imagesInfo, - icon: icon, + title: widget.title ?? widget.appBarTitle, + description: widget.description, + infoList: widget.infoList, + imagesInfo: widget.imagesInfo, + icon: widget.icon, ) - : baseViewModel != null + : widget.baseViewModel != null ? NetworkBaseView( child: buildBodyWidget(context), - baseViewModel: baseViewModel, + baseViewModel: widget.baseViewModel, ) : buildBodyWidget(context), ), - bottomNavigationBar: bottomNavigationBar, - floatingActionButton: floatingActionButton, + bottomNavigationBar: widget.isBottomBar + ? BottomNavPharmacyBar( + changeIndex: changeCurrentTab, + index: widget.currentTab, + ) + : null, + floatingActionButton: widget.floatingActionButton, ); } + void changeCurrentTab(int value) { + if (widget.isMainPharmacyPages) { + widget.changeCurrentTab(value); + } else { + Navigator.pushAndRemoveUntil( + locator().navigatorKey.currentContext, MaterialPageRoute(builder: (context) => LandingPagePharmacy(currentTab: value)), (Route r) => false); + } + } + + void _scanQrAndGetProduct() async { + try { + String result = await BarcodeScanner.scan(); + try { + String barcode = result; + GifLoaderDialogUtils.showMyDialog(context); + 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); + Navigator.push(context, FadePage(page: ProductDetailPage(product))); + }, onFailure: (String error, int statusCode) { + GifLoaderDialogUtils.hideDialog(context); + AppToast.showErrorToast(message: "Product not found"); + }); + } catch (apiEx) { + AppToast.showErrorToast(message: "Something went wrong, please try again"); + } + } catch (barcodeEx) {} + } + buildAppLoaderWidget(bool isLoading) { return isLoading ? AppLoaderWidget() : Container(); } buildBodyWidget(context) { - return Stack(children: [body, isHelp == true ? RobotIcon() : Container()]); + return Stack(children: [widget.body, widget.isHelp == true ? RobotIcon() : Container()]); } } @@ -206,7 +349,6 @@ class NewAppBarWidget extends StatelessWidget with PreferredSizeWidget { // centerTitle: false, title: Row( children: [ - if (showTitle) Expanded( child: Text( @@ -256,17 +398,19 @@ class NewAppBarWidget extends StatelessWidget with PreferredSizeWidget { ], ), actions: [ - if (appBarIcons != null) ...appBarIcons else - IconButton( - onPressed: () { - Navigator.pushAndRemoveUntil( - context, - MaterialPageRoute(builder: (context) => LandingPage()), - (Route route) => false, - ); - }, - icon: Icon(Icons.home), - ), + if (appBarIcons != null) + ...appBarIcons + else + IconButton( + onPressed: () { + Navigator.pushAndRemoveUntil( + context, + MaterialPageRoute(builder: (context) => LandingPage()), + (Route route) => false, + ); + }, + icon: Icon(Icons.home), + ), ], ); } diff --git a/lib/widgets/others/close_back.dart b/lib/widgets/others/close_back.dart index 75fe05e8..804e1d00 100644 --- a/lib/widgets/others/close_back.dart +++ b/lib/widgets/others/close_back.dart @@ -1,4 +1,3 @@ -import 'package:eva_icons_flutter/eva_icons_flutter.dart'; import 'package:flutter/material.dart'; class CloseBack extends StatelessWidget{ @@ -16,7 +15,7 @@ class CloseBack extends StatelessWidget{ onTap: Feedback.wrapForTap(() { onTap!=null ? onTap() : Navigator.pop(context); }, context), - child: Icon(EvaIcons.close, color: Colors.white), + child: Icon(Icons.close, color: Colors.white), ); } } \ No newline at end of file diff --git a/lib/widgets/pharmacy/bottom_nav_pharmacy_bar.dart b/lib/widgets/pharmacy/bottom_nav_pharmacy_bar.dart index d1490d74..105d7503 100644 --- a/lib/widgets/pharmacy/bottom_nav_pharmacy_bar.dart +++ b/lib/widgets/pharmacy/bottom_nav_pharmacy_bar.dart @@ -1,7 +1,5 @@ import 'package:diplomaticquarterapp/d_q_icons_icons.dart'; -import 'package:diplomaticquarterapp/pages/landing/home_page.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; -import 'package:eva_icons_flutter/eva_icons_flutter.dart'; import 'package:flutter/material.dart'; import 'bottom_nav_pharmacy_home_item.dart'; @@ -9,9 +7,9 @@ import 'bottom_nav_pharmacy_item.dart'; class BottomNavPharmacyBar extends StatefulWidget { final ValueChanged changeIndex; - final int index; - BottomNavPharmacyBar({Key key, this.changeIndex, this.index}) - : super(key: key); + + BottomNavPharmacyBar({Key key, this.changeIndex, this.index}) : super(key: key); + int index = 0; @override _BottomNavPharmacyBarState createState() => _BottomNavPharmacyBarState(); @@ -35,8 +33,8 @@ class _BottomNavPharmacyBarState extends State { mainAxisAlignment: MainAxisAlignment.spaceAround, children: [ BottomNavHomeItem( - icon: EvaIcons.image, - activeIcon: EvaIcons.image, + icon: Icons.image, + activeIcon: Icons.image, changeIndex: _changeIndex, index: widget.index, currentIndex: 0, @@ -50,14 +48,7 @@ class _BottomNavPharmacyBarState extends State { currentIndex: 1, title: TranslationBase.of(context).categorise, ), - BottomNavPharmacyItem( - icon: EvaIcons.home, - activeIcon: EvaIcons.home, - changeIndex: _changeIndex, - index: widget.index, - currentIndex: 0, - isHome: true, - title: TranslationBase.of(context).home), + BottomNavPharmacyItem(icon: Icons.home, activeIcon: Icons.home, changeIndex: _changeIndex, index: widget.index, currentIndex: 0, isHome: true, title: TranslationBase.of(context).home), BottomNavPharmacyItem( icon: DQIcons.user_menu_icon, activeIcon: DQIcons.user_menu_icon, @@ -67,12 +58,7 @@ class _BottomNavPharmacyBarState extends State { title: TranslationBase.of(context).myAccount, ), BottomNavPharmacyItem( - icon: DQIcons.cart_menu_icon, - activeIcon: DQIcons.cart_menu_icon, - changeIndex: _changeIndex, - index: widget.index, - currentIndex: 3, - title: TranslationBase.of(context).cart) + icon: DQIcons.cart_menu_icon, activeIcon: DQIcons.cart_menu_icon, changeIndex: _changeIndex, index: widget.index, currentIndex: 3, title: TranslationBase.of(context).cart) ], ), ), diff --git a/lib/widgets/pharmacy/bottom_nav_pharmacy_home_item.dart b/lib/widgets/pharmacy/bottom_nav_pharmacy_home_item.dart index 4c5b9d96..28217b8b 100644 --- a/lib/widgets/pharmacy/bottom_nav_pharmacy_home_item.dart +++ b/lib/widgets/pharmacy/bottom_nav_pharmacy_home_item.dart @@ -9,7 +9,7 @@ class BottomNavHomeItem extends StatelessWidget { final Image image; final String title; - final ValueChanged changeIndex; + final Function changeIndex; final int index; final int currentIndex; final Function onTap; @@ -62,7 +62,6 @@ class BottomNavHomeItem extends StatelessWidget { 'assets/images/habib-logo.png', ), height: 22.0, - ), SizedBox( height: 5, diff --git a/lib/widgets/pharmacy/product_tile.dart b/lib/widgets/pharmacy/product_tile.dart index af1e75ec..3b89c49c 100644 --- a/lib/widgets/pharmacy/product_tile.dart +++ b/lib/widgets/pharmacy/product_tile.dart @@ -163,7 +163,7 @@ class productTile extends StatelessWidget { ), onPressed: () async { GifLoaderDialogUtils.showMyDialog(context); - await addToCartFunction(1, productID); + await addToCartFunction(1, productID, context); GifLoaderDialogUtils.hideDialog(context); Navigator.push( context, @@ -292,7 +292,7 @@ class productTile extends StatelessWidget { // await x.deletWishlistData(itemID); // } - addToCartFunction(quantity, itemID) async { + addToCartFunction(quantity, itemID, BuildContext context) async { ProductDetailViewModel x = new ProductDetailViewModel(); await x.addToCartData(quantity, itemID); } diff --git a/lib/widgets/show_zoom_image_dialog.dart b/lib/widgets/show_zoom_image_dialog.dart index 2340c259..0864404c 100644 --- a/lib/widgets/show_zoom_image_dialog.dart +++ b/lib/widgets/show_zoom_image_dialog.dart @@ -1,24 +1,24 @@ import 'package:cached_network_image/cached_network_image.dart'; import 'package:diplomaticquarterapp/uitl/utils_new.dart'; import 'package:flutter/material.dart'; -import 'package:progress_hud_v2/generated/i18n.dart'; -showZoomImageDialog(BuildContext context, String url) { +showZoomImageDialog(BuildContext context, String url, {bool isNetworkImage = true}) { showDialog( context: context, builder: (BuildContext context) => Dialog( shape: RoundedRectangleBorder( borderRadius: BorderRadius.circular(12.0), ), //this right here - child: ShowZoomImage(url), + child: ShowZoomImage(url, isNetworkImage), ), ); } class ShowZoomImage extends StatelessWidget { String url; + bool isNetworkImage = true; - ShowZoomImage(this.url); + ShowZoomImage(this.url, this.isNetworkImage); @override Widget build(BuildContext context) { @@ -35,11 +35,17 @@ class ShowZoomImage extends StatelessWidget { Navigator.pop(context); }, ), - CachedNetworkImage( - imageUrl: url, - height: MediaQuery.of(context).size.width / 1.4, - width: double.infinity, - ), + isNetworkImage + ? CachedNetworkImage( + imageUrl: url, + height: MediaQuery.of(context).size.width / 1.4, + width: double.infinity, + ) + : Image.asset( + url, + height: MediaQuery.of(context).size.width / 1.4, + width: double.infinity, + ), mHeight(12), ], ), diff --git a/lib/widgets/single_selection_dialog.dart b/lib/widgets/single_selection_dialog.dart index b8466b65..155f6394 100644 --- a/lib/widgets/single_selection_dialog.dart +++ b/lib/widgets/single_selection_dialog.dart @@ -13,8 +13,9 @@ import 'package:permission_handler/permission_handler.dart'; class SingleSelectionDialog extends StatefulWidget { final List items; final String title; + final Widget icon; - SingleSelectionDialog(this.items, {Widget icon, @required this.title}); + SingleSelectionDialog(this.items, {@required this.icon, @required this.title}); Future show(BuildContext context) async { return showDialog( @@ -32,6 +33,7 @@ class SingleSelectionDialog extends StatefulWidget { @override _SingleSelectionDialogState createState() => _SingleSelectionDialogState(); + } class _SingleSelectionDialogState extends State { @@ -51,11 +53,12 @@ class _SingleSelectionDialogState extends State { mainAxisAlignment: MainAxisAlignment.spaceBetween, crossAxisAlignment: CrossAxisAlignment.start, children: [ - Icon( - Icons.notifications_active, - color: Color(0xff2B353E), - size: 50, + + SizedBox( + height: 40, + child: widget.icon, ), + IconButton( icon: Icon(Icons.clear), color: Color(0xff2B353E), @@ -95,33 +98,33 @@ class _SingleSelectionDialogState extends State { } Widget optionList(List options){ - return ListView( - shrinkWrap: true, - children: List.generate(options.length, (index){ - - final opt = options[index]; - return Row( - children: [ - Radio( - value: index, - groupValue: i, - onChanged: (int value) { - setState(() { - i = value; - }); - }, - ), - Text( - opt.toString(), - style: TextStyle( - fontSize: 12, - fontWeight: FontWeight.w600, - letterSpacing: -0.48, + return ListView.builder( + shrinkWrap: true, + itemCount: options.length, + itemBuilder: (ctx,idx){ + final opt = options[idx]; + return Row( + children: [ + Radio( + value: idx, + groupValue: i, + onChanged: (int value) { + setState(() { + i = value; + }); + }, ), - ), - ], - ); - }), + Text( + opt.toString(), + style: TextStyle( + fontSize: 12, + fontWeight: FontWeight.w600, + letterSpacing: -0.48, + ), + ), + ], + ); + } ); } } diff --git a/lib/widgets/weather_slider/weather_slider.dart b/lib/widgets/weather_slider/weather_slider.dart index fe82cf49..0e784a05 100644 --- a/lib/widgets/weather_slider/weather_slider.dart +++ b/lib/widgets/weather_slider/weather_slider.dart @@ -1,47 +1,29 @@ import 'package:diplomaticquarterapp/core/model/weahter/weather_model.dart'; +import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; import 'package:diplomaticquarterapp/widgets/text/app_texts_widget.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; class WeatherSlider extends StatelessWidget { - // final width; - // final LinearGradient color; final GetCityInfoList data; - WeatherSlider(this.data); - LinearGradient red = LinearGradient( - colors: [ - Colors.redAccent[100], - Colors.redAccent - ]); - LinearGradient green = LinearGradient( - colors: [ - Colors.greenAccent[100], - Colors.greenAccent - ]); - LinearGradient grey = LinearGradient( - colors: [ - Colors.grey[100], - Colors.grey - ]); - LinearGradient orange = LinearGradient( - colors: [ - Colors.orangeAccent[100], - Colors.orange - ]); - LinearGradient yellow = LinearGradient( - colors: [ - Colors.yellow[100], - Colors.yellow[600] - ]); + + final ProjectViewModel projectViewModel; + + WeatherSlider(this.data, this.projectViewModel); + + LinearGradient red = LinearGradient(colors: [Colors.redAccent[100], Colors.redAccent]); + LinearGradient green = LinearGradient(colors: [Colors.greenAccent[100], Colors.greenAccent]); + LinearGradient grey = LinearGradient(colors: [Colors.grey[100], Colors.grey]); + LinearGradient orange = LinearGradient(colors: [Colors.orangeAccent[100], Colors.orange]); + LinearGradient yellow = LinearGradient(colors: [Colors.yellow[100], Colors.yellow[600]]); + @override Widget build(BuildContext context) { // TODO: implement build return Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ - Padding( - padding: EdgeInsets.only(top:10), - child: AppText(data.name)), + Padding(padding: EdgeInsets.only(top: 10), child: AppText(data.name)), AppText( data.category, fontSize: 24, @@ -51,11 +33,8 @@ class WeatherSlider extends StatelessWidget { child: Stack( children: [ Container( - margin: EdgeInsets.only(bottom:10), - decoration: BoxDecoration( - gradient: LinearGradient( - colors: [Colors.grey[100], Colors.grey[400]]), - borderRadius: BorderRadius.circular(10)), + margin: EdgeInsets.only(bottom: 10), + decoration: BoxDecoration(gradient: LinearGradient(colors: [Colors.grey[100], Colors.grey[400]]), borderRadius: BorderRadius.circular(10)), height: 15, width: MediaQuery.of(context).size.width, child: SizedBox(), @@ -64,110 +43,200 @@ class WeatherSlider extends StatelessWidget { top: 0, child: Container( decoration: BoxDecoration( - gradient: data.colorName =='red' ? red : data.colorName =='orange' ? orange : data.colorName =='green' ? green : data.colorName == 'yellow' ? yellow : grey, + gradient: data.colorName == 'red' + ? red + : data.colorName == 'orange' + ? orange + : data.colorName == 'green' + ? green + : data.colorName == 'yellow' + ? yellow + : grey, borderRadius: BorderRadius.circular(10)), height: 15, width: (MediaQuery.of(context).size.width * (double.parse(data.value) / 10)), padding: EdgeInsets.all(15), child: SizedBox(), )), - Positioned(child: Container( - height: 0, - width:0, - decoration: ShapeDecoration( - color:data.colorName =='red' ? Colors.redAccent : data.colorName =='orange' ? Colors.orangeAccent : data.colorName =='green' ? Colors.greenAccent : data.colorName == 'yellow' ? Colors.yellowAccent : Colors.grey, - shape: MessageBorder(), - - )),top:25, left: (MediaQuery.of(context).size.width * (double.parse(data.value) / 10)),) - + projectViewModel.isArabic + ? Positioned( + child: Container( + height: 0, + width: 0, + decoration: ShapeDecoration( + color: data.colorName == 'red' + ? Colors.redAccent + : data.colorName == 'orange' + ? Colors.orangeAccent + : data.colorName == 'green' + ? Colors.greenAccent + : data.colorName == 'yellow' + ? Colors.yellowAccent + : Colors.grey, + shape: MessageBorder(), + )), + top: 25, + right: (MediaQuery.of(context).size.width * (double.parse(data.value) / 10)), + ) + : Positioned( + child: Container( + height: 0, + width: 0, + decoration: ShapeDecoration( + color: data.colorName == 'red' + ? Colors.redAccent + : data.colorName == 'orange' + ? Colors.orangeAccent + : data.colorName == 'green' + ? Colors.greenAccent + : data.colorName == 'yellow' + ? Colors.yellowAccent + : Colors.grey, + shape: MessageBorder(), + )), + top: 25, + left: (MediaQuery.of(context).size.width * (double.parse(data.value) / 10)), + ) ], ), - ), Padding( - padding: EdgeInsets.only(top:10), - child: data.isValuesReversed == false ? Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - AppText( - data.categoriesNames.category1, - fontSize: 12, - color: data.categoriesNames.category1== data.category && data.colorName=='red' ? Colors.redAccent : data.categoriesNames.category1== data.category && data.colorName=='orange' ? Colors.orangeAccent : data.categoriesNames.category1== data.category && data.colorName=='green' ? Colors.greenAccent : data.categoriesNames.category1== data.category && data.colorName=='yellow' ? Colors.yellow[900] : Colors.black - ), - AppText( - data.categoriesNames.category2, - fontSize: 12, - color: data.categoriesNames.category2== data.category && data.colorName=='red' ? Colors.redAccent : data.categoriesNames.category2== data.category && data.colorName=='orange' ? Colors.orangeAccent : data.categoriesNames.category2== data.category && data.colorName=='green' ? Colors.greenAccent : data.categoriesNames.category2== data.category && data.colorName=='yellow' ? Colors.yellow[900] : Colors.black - - ), - AppText( - data.categoriesNames.category3, - fontSize: 12, - color: data.categoriesNames.category3== data.category && data.colorName=='red' ? Colors.redAccent : data.categoriesNames.category3== data.category && data.colorName=='orange' ? Colors.orangeAccent : data.categoriesNames.category3== data.category && data.colorName=='green' ? Colors.greenAccent : data.categoriesNames.category3== data.category && data.colorName=='yellow' ? Colors.yellow[900] : Colors.black - - ), - AppText( - data.categoriesNames.category4, - fontSize: 12, - color: data.categoriesNames.category4== data.category && data.colorName=='red' ? Colors.redAccent : data.categoriesNames.category4== data.category && data.colorName=='orange' ? Colors.orangeAccent : data.categoriesNames.category4== data.category && data.colorName=='green' ? Colors.greenAccent : data.categoriesNames.category4== data.category && data.colorName=='yellow' ? Colors.yellow[900] : Colors.black - - ), - AppText( - data.categoriesNames.category5, - fontSize: 12, - color: data.categoriesNames.category5== data.category && data.colorName=='red' ? Colors.redAccent : data.categoriesNames.category5== data.category && data.colorName=='orange' ? Colors.orangeAccent : data.categoriesNames.category5== data.category && data.colorName=='green' ? Colors.greenAccent : data.categoriesNames.category5== data.category && data.colorName=='yellow' ? Colors.yellow[900] : Colors.black - - ), - ], - ) : Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - AppText( - data.categoriesNames.category5, - fontSize: 12, - color: data.categoriesNames.category5== data.category && data.colorName=='red' ? Colors.redAccent : data.categoriesNames.category5== data.category && data.colorName=='orange' ? Colors.orangeAccent : data.categoriesNames.category5== data.category && data.colorName=='green' ? Colors.greenAccent : data.categoriesNames.category5== data.category && data.colorName=='yellow' ? Colors.yellow[900] : Colors.black - ), - AppText( - data.categoriesNames.category4, - fontSize: 12, - color: data.categoriesNames.category4== data.category && data.colorName=='red' ? Colors.redAccent : data.categoriesNames.category4== data.category && data.colorName=='orange' ? Colors.orangeAccent : data.categoriesNames.category4== data.category && data.colorName=='green' ? Colors.greenAccent : data.categoriesNames.category4== data.category && data.colorName=='yellow' ? Colors.yellow[900] : Colors.black - - ), - AppText( - data.categoriesNames.category3, - fontSize: 12, - color: data.categoriesNames.category3== data.category && data.colorName=='red' ? Colors.redAccent : data.categoriesNames.category3== data.category && data.colorName=='orange' ? Colors.orangeAccent : data.categoriesNames.category3== data.category && data.colorName=='green' ? Colors.greenAccent : data.categoriesNames.category3== data.category && data.colorName=='yellow' ? Colors.yellow[900] : Colors.black - - ), - AppText( - data.categoriesNames.category2, - fontSize: 12, - color: data.categoriesNames.category2== data.category && data.colorName=='red' ? Colors.redAccent : data.categoriesNames.category2== data.category && data.colorName=='orange' ? Colors.orangeAccent : data.categoriesNames.category2== data.category && data.colorName=='green' ? Colors.greenAccent : data.categoriesNames.category2== data.category && data.colorName=='yellow' ? Colors.yellow[900] : Colors.black - - ), - AppText( - data.categoriesNames.category1, - fontSize: 12, - color: data.categoriesNames.category1== data.category && data.colorName=='red' ? Colors.redAccent : data.categoriesNames.category1== data.category && data.colorName=='orange' ? Colors.orangeAccent : data.categoriesNames.category1== data.category && data.colorName=='green' ? Colors.greenAccent : data.categoriesNames.category1== data.category && data.colorName=='yellow' ? Colors.yellow[900] : Colors.black - - ), - ], - )), - Padding( - padding: EdgeInsets.all(15), - child:Divider()) + padding: EdgeInsets.only(top: 10), + child: data.isValuesReversed == false + ? Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + AppText(data.categoriesNames.category1, + fontSize: 12, + color: data.categoriesNames.category1 == data.category && data.colorName == 'red' + ? Colors.redAccent + : data.categoriesNames.category1 == data.category && data.colorName == 'orange' + ? Colors.orangeAccent + : data.categoriesNames.category1 == data.category && data.colorName == 'green' + ? Colors.greenAccent + : data.categoriesNames.category1 == data.category && data.colorName == 'yellow' + ? Colors.yellow[900] + : Colors.black), + AppText(data.categoriesNames.category2, + fontSize: 12, + color: data.categoriesNames.category2 == data.category && data.colorName == 'red' + ? Colors.redAccent + : data.categoriesNames.category2 == data.category && data.colorName == 'orange' + ? Colors.orangeAccent + : data.categoriesNames.category2 == data.category && data.colorName == 'green' + ? Colors.greenAccent + : data.categoriesNames.category2 == data.category && data.colorName == 'yellow' + ? Colors.yellow[900] + : Colors.black), + AppText(data.categoriesNames.category3, + fontSize: 12, + color: data.categoriesNames.category3 == data.category && data.colorName == 'red' + ? Colors.redAccent + : data.categoriesNames.category3 == data.category && data.colorName == 'orange' + ? Colors.orangeAccent + : data.categoriesNames.category3 == data.category && data.colorName == 'green' + ? Colors.greenAccent + : data.categoriesNames.category3 == data.category && data.colorName == 'yellow' + ? Colors.yellow[900] + : Colors.black), + AppText(data.categoriesNames.category4, + fontSize: 12, + color: data.categoriesNames.category4 == data.category && data.colorName == 'red' + ? Colors.redAccent + : data.categoriesNames.category4 == data.category && data.colorName == 'orange' + ? Colors.orangeAccent + : data.categoriesNames.category4 == data.category && data.colorName == 'green' + ? Colors.greenAccent + : data.categoriesNames.category4 == data.category && data.colorName == 'yellow' + ? Colors.yellow[900] + : Colors.black), + AppText(data.categoriesNames.category5, + fontSize: 12, + color: data.categoriesNames.category5 == data.category && data.colorName == 'red' + ? Colors.redAccent + : data.categoriesNames.category5 == data.category && data.colorName == 'orange' + ? Colors.orangeAccent + : data.categoriesNames.category5 == data.category && data.colorName == 'green' + ? Colors.greenAccent + : data.categoriesNames.category5 == data.category && data.colorName == 'yellow' + ? Colors.yellow[900] + : Colors.black), + ], + ) + : Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + AppText(data.categoriesNames.category5, + fontSize: 12, + color: data.categoriesNames.category5 == data.category && data.colorName == 'red' + ? Colors.redAccent + : data.categoriesNames.category5 == data.category && data.colorName == 'orange' + ? Colors.orangeAccent + : data.categoriesNames.category5 == data.category && data.colorName == 'green' + ? Colors.greenAccent + : data.categoriesNames.category5 == data.category && data.colorName == 'yellow' + ? Colors.yellow[900] + : Colors.black), + AppText(data.categoriesNames.category4, + fontSize: 12, + color: data.categoriesNames.category4 == data.category && data.colorName == 'red' + ? Colors.redAccent + : data.categoriesNames.category4 == data.category && data.colorName == 'orange' + ? Colors.orangeAccent + : data.categoriesNames.category4 == data.category && data.colorName == 'green' + ? Colors.greenAccent + : data.categoriesNames.category4 == data.category && data.colorName == 'yellow' + ? Colors.yellow[900] + : Colors.black), + AppText(data.categoriesNames.category3, + fontSize: 12, + color: data.categoriesNames.category3 == data.category && data.colorName == 'red' + ? Colors.redAccent + : data.categoriesNames.category3 == data.category && data.colorName == 'orange' + ? Colors.orangeAccent + : data.categoriesNames.category3 == data.category && data.colorName == 'green' + ? Colors.greenAccent + : data.categoriesNames.category3 == data.category && data.colorName == 'yellow' + ? Colors.yellow[900] + : Colors.black), + AppText(data.categoriesNames.category2, + fontSize: 12, + color: data.categoriesNames.category2 == data.category && data.colorName == 'red' + ? Colors.redAccent + : data.categoriesNames.category2 == data.category && data.colorName == 'orange' + ? Colors.orangeAccent + : data.categoriesNames.category2 == data.category && data.colorName == 'green' + ? Colors.greenAccent + : data.categoriesNames.category2 == data.category && data.colorName == 'yellow' + ? Colors.yellow[900] + : Colors.black), + AppText(data.categoriesNames.category1, + fontSize: 12, + color: data.categoriesNames.category1 == data.category && data.colorName == 'red' + ? Colors.redAccent + : data.categoriesNames.category1 == data.category && data.colorName == 'orange' + ? Colors.orangeAccent + : data.categoriesNames.category1 == data.category && data.colorName == 'green' + ? Colors.greenAccent + : data.categoriesNames.category1 == data.category && data.colorName == 'yellow' + ? Colors.yellow[900] + : Colors.black), + ], + )), + Padding(padding: EdgeInsets.all(15), child: Divider()) ], ); - } } + class MessageBorder extends ShapeBorder { final bool usePadding; final bool reverse; - MessageBorder({this.usePadding = true, this.reverse =false}); + + MessageBorder({this.usePadding = true, this.reverse = false}); @override - EdgeInsetsGeometry get dimensions => EdgeInsets.only(bottom: usePadding? 0 : 0); + EdgeInsetsGeometry get dimensions => EdgeInsets.only(bottom: usePadding ? 0 : 0); @override Path getInnerPath(Rect rect, {TextDirection textDirection}) => null; @@ -175,17 +244,16 @@ class MessageBorder extends ShapeBorder { @override Path getOuterPath(Rect rect, {TextDirection textDirection}) { rect = Rect.fromPoints(rect.bottomRight, rect.bottomLeft - Offset(0, 0)); - if(!reverse) { + if (!reverse) { return Path() - ..addRRect( - RRect.fromRectAndRadius(rect, Radius.circular(rect.height / 2))) + ..addRRect(RRect.fromRectAndRadius(rect, Radius.circular(rect.height / 2))) ..moveTo(rect.topCenter.dx - 10, rect.topCenter.dy) - ..relativeLineTo(10, -10)..relativeLineTo(10, 10) + ..relativeLineTo(10, -10) + ..relativeLineTo(10, 10) ..close(); - }else{ + } else { return Path() - ..addRRect( - RRect.fromRectAndRadius(rect, Radius.circular(rect.height / 2))) + ..addRRect(RRect.fromRectAndRadius(rect, Radius.circular(rect.height / 2))) ..moveTo(rect.topCenter.dx, rect.topCenter.dy) ..relativeLineTo(10, 20) ..relativeLineTo(20, -20) @@ -198,4 +266,4 @@ class MessageBorder extends ShapeBorder { @override ShapeBorder scale(double t) => this; -} \ No newline at end of file +} diff --git a/pubspec.yaml b/pubspec.yaml index 49700d97..3bdadc73 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -11,13 +11,12 @@ dependencies: flutter: sdk: flutter - # Localizations flutter_localizations: sdk: flutter intl: ^0.16.0 # web view - webview_flutter: ^0.3.24 + webview_flutter: ^1.0.7 # http client http: ^0.12.1 connectivity: ^0.4.9+3 @@ -30,6 +29,8 @@ dependencies: #Dependency Injection get_it: ^4.0.2 + #Google Fit & Apple HealthKit + fit_kit: ^1.1.2 #chart fl_chart: ^0.12.3 @@ -37,11 +38,9 @@ dependencies: # Permissions permission_handler: ^5.0.0+hotfix.3 device_info: ^0.4.2+4 -#popub - giffy_dialog: ^1.8.0 # Flutter Html View - flutter_html: 1.0.2 + flutter_html: ^1.2.0 # Native flutter_device_type: ^0.2.0 @@ -54,45 +53,38 @@ dependencies: firebase_messaging: ^7.0.3 firebase_analytics: ^6.3.0 cloud_firestore: ^0.14.3 - android_intent: ^0.3.7+7 # Progress bar progress_hud_v2: ^2.0.0 percent_indicator: ^2.1.5 # Icons - feather_icons_flutter: any - eva_icons_flutter: any font_awesome_flutter: any - cupertino_icons: ^0.1.3 + cupertino_icons: ^1.0.0 # Image Attachments image_picker: ^0.6.7+1 - image_cropper: ^1.2.1 #GIF image flutter_gifimage: ^1.0.1 photo_view: any -# flutter_webrtc: any + # flutter_webrtc: any # UI Reqs - dotted_border: 1.0.5 expandable: ^4.1.4 - hexcolor: ^1.0.1 # Notification Banner - dropdown_banner: ^1.4.0 - flutter_xlider: ^3.4.0 -# flutter_local_notifications: + # dropdown_banner: ^1.4.0 + # flutter_xlider: ^3.4.0 + # flutter_local_notifications: # charts charts_flutter: ^0.9.0 - google_maps_flutter: ^1.0.3 huawei_map: ^5.0.3+303 # Qr code Scanner TODO fix it -# barcode_scanner: ^1.0.1 + # barcode_scanner: ^1.0.1 flutter_polyline_points: ^0.1.0 location: ^2.3.5 # Qr code Scanner @@ -102,15 +94,10 @@ dependencies: rating_bar: ^0.2.0 # Calendar -# table_calendar: ^2.3.0 syncfusion_flutter_calendar: ^18.4.49 -# syncfusion_flutter_charts: any # SVG Images - flutter_svg: ^0.18.0 - - # Location Helper - map_launcher: ^0.8.1 + flutter_svg: ^0.19.0 #Calendar Events manage_calendar_events: ^1.0.2 @@ -127,15 +114,6 @@ dependencies: #hijri hijri: ^2.0.3 - #Email Sender - flutter_email_sender: ^3.0.1 - - #Popup_window - popup_box: ^0.1.0 - - #Numbers - number_inc_dec: ^0.6.6 - #datetime_picker flutter_datetime_picker: ^1.4.0 # Carousel @@ -159,19 +137,17 @@ dependencies: flutter_webrtc: ^0.5.9 screen: ^0.0.5 + #google maps places google_maps_place_picker: ^1.0.0 - typewriter: ^0.0.3 -#countdown timer for Upcoming List - # flutter_countdown_timer: ^1.4.0 #countdown timer for Upcoming List flutter_countdown_timer: ^1.6.0 + #Dependencies for video call implementation native_device_orientation: ^0.3.0 enum_to_string: ^1.0.9 -# recase: ^3.0.0 - wakelock: ^0.1.4 + wakelock: ^0.2.1+1 after_layout: ^1.0.7 twilio_programmable_video: ^0.6.2 cached_network_image: ^2.4.1 @@ -192,7 +168,7 @@ dependencies: in_app_review: ^1.0.4 badges: ^1.1.4 -# open_settings: ^2.0.1 + # Dep by Zohaib shimmer: ^1.1.2 carousel_slider: ^2.3.1