diff --git a/lib/config/localized_values.dart b/lib/config/localized_values.dart index 7823bf57..207a65d7 100644 --- a/lib/config/localized_values.dart +++ b/lib/config/localized_values.dart @@ -1625,4 +1625,5 @@ const Map localizedValues = { "bodyFatTitle": {"en": "Body Fat", "ar": " الدهون في الجسم"}, "cholesTitle": {"en": "Blood Cholesterol", "ar": " الكولسترول في الدم"}, "laserClinic": {"en": "Laser Clinic", "ar": "عيادة الليزر"}, + "noImage": {"en": "No Image", "ar": "لا توجد صورة"}, }; diff --git a/lib/core/model/pharmacies/Prescriptions.dart b/lib/core/model/pharmacies/Prescriptions.dart deleted file mode 100644 index 80caff0a..00000000 --- a/lib/core/model/pharmacies/Prescriptions.dart +++ /dev/null @@ -1,157 +0,0 @@ - - -import 'package:diplomaticquarterapp/uitl/date_uitl.dart'; - -class Prescriptions { - String setupID; - int projectID; - int patientID; - int appointmentNo; - String appointmentDate; - String doctorName; - String clinicDescription; - String name; - int episodeID; - int actualDoctorRate; - int admission; - int clinicID; - String companyName; - String despensedStatus; - DateTime dischargeDate; - int dischargeNo; - int doctorID; - String doctorImageURL; - int doctorRate; - String doctorTitle; - int gender; - String genderDescription; - bool isActiveDoctorProfile; - bool isDoctorAllowVedioCall; - bool isExecludeDoctor; - bool isInOutPatient; - String isInOutPatientDescription; - String isInOutPatientDescriptionN; - bool isInsurancePatient; - String nationalityFlagURL; - int noOfPatientsRate; - String qR; - List speciality; - - Prescriptions( - {this.setupID, - this.projectID, - this.patientID, - this.appointmentNo, - this.appointmentDate, - this.doctorName, - this.clinicDescription, - this.name, - this.episodeID, - this.actualDoctorRate, - this.admission, - this.clinicID, - this.companyName, - this.despensedStatus, - this.dischargeDate, - this.dischargeNo, - this.doctorID, - this.doctorImageURL, - this.doctorRate, - this.doctorTitle, - this.gender, - this.genderDescription, - this.isActiveDoctorProfile, - this.isDoctorAllowVedioCall, - this.isExecludeDoctor, - this.isInOutPatient, - this.isInOutPatientDescription, - this.isInOutPatientDescriptionN, - this.isInsurancePatient, - this.nationalityFlagURL, - this.noOfPatientsRate, - this.qR, - this.speciality}); - - Prescriptions.fromJson(Map json) { - setupID = json['SetupID']; - projectID = json['ProjectID']; - patientID = json['PatientID']; - appointmentNo = json['AppointmentNo']; - appointmentDate = json['AppointmentDate']; - doctorName = json['DoctorName']; - clinicDescription = json['ClinicDescription']; - name = json['Name']; - episodeID = json['EpisodeID']; - actualDoctorRate = json['ActualDoctorRate']; - admission = json['Admission']; - clinicID = json['ClinicID']; - companyName = json['CompanyName']; - despensedStatus = json['Despensed_Status']; - dischargeDate = DateUtil.convertStringToDate(json['DischargeDate']); - dischargeNo = json['DischargeNo']; - doctorID = json['DoctorID']; - doctorImageURL = json['DoctorImageURL']; - doctorRate = json['DoctorRate']; - doctorTitle = json['DoctorTitle']; - gender = json['Gender']; - genderDescription = json['GenderDescription']; - isActiveDoctorProfile = json['IsActiveDoctorProfile']; - isDoctorAllowVedioCall = json['IsDoctorAllowVedioCall']; - isExecludeDoctor = json['IsExecludeDoctor']; - isInOutPatient = json['IsInOutPatient']; - isInOutPatientDescription = json['IsInOutPatientDescription']; - isInOutPatientDescriptionN = json['IsInOutPatientDescriptionN']; - isInsurancePatient = json['IsInsurancePatient']; - nationalityFlagURL = json['NationalityFlagURL']; - noOfPatientsRate = json['NoOfPatientsRate']; - qR = json['QR']; - // speciality = json['Speciality'].cast(); - } - - Map toJson() { - final Map data = new Map(); - data['SetupID'] = this.setupID; - data['ProjectID'] = this.projectID; - data['PatientID'] = this.patientID; - data['AppointmentNo'] = this.appointmentNo; - data['AppointmentDate'] = this.appointmentDate; - data['DoctorName'] = this.doctorName; - data['ClinicDescription'] = this.clinicDescription; - data['Name'] = this.name; - data['EpisodeID'] = this.episodeID; - data['ActualDoctorRate'] = this.actualDoctorRate; - data['Admission'] = this.admission; - data['ClinicID'] = this.clinicID; - data['CompanyName'] = this.companyName; - data['Despensed_Status'] = this.despensedStatus; - data['DischargeDate'] = this.dischargeDate; - data['DischargeNo'] = this.dischargeNo; - data['DoctorID'] = this.doctorID; - data['DoctorImageURL'] = this.doctorImageURL; - data['DoctorRate'] = this.doctorRate; - data['DoctorTitle'] = this.doctorTitle; - data['Gender'] = this.gender; - data['GenderDescription'] = this.genderDescription; - data['IsActiveDoctorProfile'] = this.isActiveDoctorProfile; - data['IsDoctorAllowVedioCall'] = this.isDoctorAllowVedioCall; - data['IsExecludeDoctor'] = this.isExecludeDoctor; - data['IsInOutPatient'] = this.isInOutPatient; - data['IsInOutPatientDescription'] = this.isInOutPatientDescription; - data['IsInOutPatientDescriptionN'] = this.isInOutPatientDescriptionN; - data['IsInsurancePatient'] = this.isInsurancePatient; - data['NationalityFlagURL'] = this.nationalityFlagURL; - data['NoOfPatientsRate'] = this.noOfPatientsRate; - data['QR'] = this.qR; - data['Speciality'] = this.speciality; - return data; - } -} - -//class PrescriptionsList { -// String filterName = ""; -// List prescriptionsList = List(); -// -// PrescriptionsList({this.filterName, Prescriptions prescriptions}) { -// prescriptionsList.add(prescriptions); -// } -//} diff --git a/lib/core/service/parmacyModule/prescription_service.dart b/lib/core/service/parmacyModule/prescription_service.dart index 9011496c..9a77b7bc 100644 --- a/lib/core/service/parmacyModule/prescription_service.dart +++ b/lib/core/service/parmacyModule/prescription_service.dart @@ -1,8 +1,7 @@ import 'package:diplomaticquarterapp/config/config.dart'; -import 'package:diplomaticquarterapp/config/shared_pref_kay.dart'; +import 'package:diplomaticquarterapp/core/model/prescriptions/Prescriptions.dart'; import 'package:diplomaticquarterapp/core/service/base_service.dart'; import 'package:diplomaticquarterapp/uitl/app_shared_preferences.dart'; -import 'package:diplomaticquarterapp/core/model/pharmacies/Prescriptions.dart'; class PrescriptionService extends BaseService { final AppSharedPreferences sharedPref = AppSharedPreferences(); @@ -11,14 +10,14 @@ class PrescriptionService extends BaseService { String errorMsg = ''; List _prescriptionsList = List(); + List get prescriptionsList => _prescriptionsList; Future getPrescription() async { hasError = false; Map body = Map(); body['isDentalAllowedBackend'] = false; - await baseAppClient.post(PRESCRIPTION, - onSuccess: (dynamic response, int statusCode) { + await baseAppClient.post(PRESCRIPTION, onSuccess: (dynamic response, int statusCode) { _prescriptionsList.clear(); response['PatientPrescriptionList'].forEach((prescriptions) { _prescriptionsList.add(Prescriptions.fromJson(prescriptions)); diff --git a/lib/core/viewModels/pharmacyModule/OrderPreviewViewModel.dart b/lib/core/viewModels/pharmacyModule/OrderPreviewViewModel.dart index d3f09119..d498d095 100644 --- a/lib/core/viewModels/pharmacyModule/OrderPreviewViewModel.dart +++ b/lib/core/viewModels/pharmacyModule/OrderPreviewViewModel.dart @@ -8,8 +8,6 @@ import 'package:diplomaticquarterapp/core/model/pharmacies/order_detail.dart'; import 'package:diplomaticquarterapp/core/model/pharmacies/payment-checkout-data.dart'; import 'package:diplomaticquarterapp/core/service/parmacyModule/order-preview-service.dart'; import 'package:diplomaticquarterapp/core/viewModels/pharmacyModule/pharmacy_module_view_model.dart'; -import 'package:diplomaticquarterapp/uitl/gif_loader_dialog_utils.dart'; -import 'package:diplomaticquarterapp/uitl/navigation_service.dart'; import '../../../locator.dart'; import '../base_view_model.dart'; @@ -19,19 +17,17 @@ class OrderPreviewViewModel extends BaseViewModel { List get addresses => _orderService.addresses; - LacumAccountInformation get lacumInformation => - _orderService.lacumInformation; + LacumAccountInformation get lacumInformation => _orderService.lacumInformation; List get orderListModel => _orderService.orderList; - PharmacyModuleViewModel pharmacyModuleViewModel = - locator(); + PharmacyModuleViewModel pharmacyModuleViewModel = locator(); ShoppingCartResponse cartResponse = ShoppingCartResponse(); PaymentCheckoutData paymentCheckoutData = PaymentCheckoutData(); double totalAdditionalShippingCharge = 0; - setShoppingCartResponse(ShoppingCartResponse cart){ + setShoppingCartResponse(ShoppingCartResponse cart) { cartResponse = cart; notifyListeners(); } @@ -71,8 +67,7 @@ class OrderPreviewViewModel extends BaseViewModel { } } - Future changeProductQuantity( - ShoppingCart product) async { + Future changeProductQuantity(ShoppingCart product) async { setState(ViewState.Busy); var resp = await _orderService.changeProductQuantity(product.id, product); var object = _handleGetShoppingCartResponse(resp); @@ -125,11 +120,17 @@ class OrderPreviewViewModel extends BaseViewModel { cartResponse.subtotalVatAmount = res["subtotal_vat_amount"]; cartResponse.subtotalVatRate = res["subtotal_vat_rate"]; cartResponse.shoppingCarts = List(); + + if (paymentCheckoutData.shippingOption != null) { + totalAdditionalShippingCharge = paymentCheckoutData.shippingOption.rate; + cartResponse.subtotalVatAmount += paymentCheckoutData.shippingOption.rateVat; + cartResponse.subtotal += paymentCheckoutData.shippingOption.rate + paymentCheckoutData.shippingOption.rateVat; + } + res["shopping_carts"].forEach((item) { ShoppingCart shoppingCart = ShoppingCart.fromJson(item); cartResponse.shoppingCarts.add(shoppingCart); - totalAdditionalShippingCharge += - shoppingCart.product.additionalShippingCharge; + totalAdditionalShippingCharge += shoppingCart.product.additionalShippingCharge; }); return cartResponse; } @@ -173,7 +174,7 @@ class OrderPreviewViewModel extends BaseViewModel { error = _orderService.error; setState(ViewState.Error); } else { - getLacumGroupData(identificationNo); + if (_orderService.lacumInformation.yahalaAccountNo != 0) getLacumGroupData(identificationNo); } } @@ -181,8 +182,7 @@ class OrderPreviewViewModel extends BaseViewModel { setState(ViewState.Busy); await _orderService.getLacumGroupInformation(identificationNo); paymentCheckoutData.lacumInformation = _orderService.lacumGroupInformation; - paymentCheckoutData.usedLakumPoints = paymentCheckoutData - .lacumInformation.lakumInquiryInformationObjVersion.pointsBalanceAmount; + paymentCheckoutData.usedLakumPoints = paymentCheckoutData.lacumInformation.lakumInquiryInformationObjVersion.pointsBalanceAmount; if (_orderService.hasError) { error = _orderService.error; setState(ViewState.Error); @@ -193,9 +193,7 @@ class OrderPreviewViewModel extends BaseViewModel { getShippingOption() async { setState(ViewState.Busy); - await _orderService - .getShippingOption(paymentCheckoutData.address) - .then((res) { + await _orderService.getShippingOption(paymentCheckoutData.address).then((res) { paymentCheckoutData.shippingOption = ShippingOption.fromJson(res); setState(ViewState.Idle); }); @@ -211,8 +209,7 @@ class OrderPreviewViewModel extends BaseViewModel { setState(ViewState.Busy); await pharmacyModuleViewModel.generatePharmacyToken(); - await _orderService.makeOrder( - paymentCheckoutData, cartResponse.shoppingCarts); + await _orderService.makeOrder(paymentCheckoutData, cartResponse.shoppingCarts); if (_orderService.hasError) { error = _orderService.error; setState(ViewState.ErrorLocal); diff --git a/lib/core/viewModels/pharmacyModule/PrescriptionViewModel.dart b/lib/core/viewModels/pharmacyModule/PrescriptionViewModel.dart index 420ec1fa..ba71781f 100644 --- a/lib/core/viewModels/pharmacyModule/PrescriptionViewModel.dart +++ b/lib/core/viewModels/pharmacyModule/PrescriptionViewModel.dart @@ -1,5 +1,5 @@ import 'package:diplomaticquarterapp/core/enum/viewstate.dart'; -import 'package:diplomaticquarterapp/core/model/pharmacies/Prescriptions.dart'; +import 'package:diplomaticquarterapp/core/model/prescriptions/Prescriptions.dart'; import 'package:diplomaticquarterapp/core/service/parmacyModule/prescription_service.dart'; import 'package:diplomaticquarterapp/core/viewModels/base_view_model.dart'; @@ -14,6 +14,7 @@ class PrescriptionViewModel extends BaseViewModel { getPrescription() async { await getSavedLanguage(); + prescriptionsList.clear(); if(prescriptionsList.isEmpty){ setState(ViewState.Busy); await _prescriptionService.getPrescription(); diff --git a/lib/models/pharmacy/locationModel.dart b/lib/models/pharmacy/locationModel.dart index 36ee7350..02d67a09 100644 --- a/lib/models/pharmacy/locationModel.dart +++ b/lib/models/pharmacy/locationModel.dart @@ -52,7 +52,7 @@ class LocationModel { int barcode; dynamic companybarcode; int cityId; - CityName cityName; + String cityName; int distanceInKilometers; String latitude; int locationType; @@ -78,7 +78,7 @@ class LocationModel { barcode: json["Barcode"], companybarcode: json["Companybarcode"], cityId: json["CityID"], - cityName: cityNameValues.map[json["CityName"]], + cityName: json["CityName"], distanceInKilometers: json["DistanceInKilometers"], latitude: json["Latitude"], locationType: json["LocationType"], @@ -105,7 +105,7 @@ class LocationModel { "Barcode": barcode, "Companybarcode": companybarcode, "CityID": cityId, - "CityName": cityNameValues.reverse[cityName], + "CityName": cityName, "DistanceInKilometers": distanceInKilometers, "Latitude": latitude, "LocationType": locationType, diff --git a/lib/pages/Blood/blood_donation.dart b/lib/pages/Blood/blood_donation.dart index e0c6bfe7..db96a5a1 100644 --- a/lib/pages/Blood/blood_donation.dart +++ b/lib/pages/Blood/blood_donation.dart @@ -38,9 +38,6 @@ class _BloodDonationPageState extends State { TextEditingController _notesTextController = TextEditingController(); BeneficiaryType beneficiaryType = BeneficiaryType.NON; - // Gender gender = Gender.Male; //Gender.NON; - // Blood blood = Blood.Aminus; //Blood.NON; - //HospitalsModel _selectedHospital; CitiesModel _selectedHospital; int _selectedHospitalIndex = 0; @@ -80,7 +77,6 @@ class _BloodDonationPageState extends State { cityID = element.iD; } }); - return cityID; } @@ -90,20 +86,22 @@ class _BloodDonationPageState extends State { return BaseView( onModelReady: (model) { - 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]; - } + if (projectProvider.isLogin) { + 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, @@ -130,12 +128,7 @@ class _BloodDonationPageState extends State { ), SizedBox(height: 12), 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, () { + CommonDropDownView(TranslationBase.of(context).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), diff --git a/lib/pages/final_products_page.dart b/lib/pages/final_products_page.dart index 51f8c8db..5705f726 100644 --- a/lib/pages/final_products_page.dart +++ b/lib/pages/final_products_page.dart @@ -5,6 +5,7 @@ import 'package:diplomaticquarterapp/core/viewModels/pharmacy_categorise_view_mo 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/theme/colors.dart'; import 'package:diplomaticquarterapp/uitl/app_toast.dart'; import 'package:diplomaticquarterapp/uitl/gif_loader_dialog_utils.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; @@ -123,7 +124,7 @@ class _FinalProductsPageState extends State { styleTwo = true; styleIcon = Icon( Icons.auto_awesome_mosaic, - color: Colors.blue, + color: CustomColors.green, size: 29.0, ); } else { @@ -131,7 +132,7 @@ class _FinalProductsPageState extends State { styleTwo = false; styleIcon = Icon( Icons.widgets_sharp, - color: Colors.blue, + color: CustomColors.green, size: 29.0, ); } @@ -401,7 +402,7 @@ class _FinalProductsPageState extends State { height: 4.0, ), Container( - width: MediaQuery.of(context).size.width * 0.65, + width: MediaQuery.of(context).size.width * 0.64, child: Texts( model.finalProducts[index].name, regular: true, @@ -445,7 +446,7 @@ class _FinalProductsPageState extends State { icon: Icon( Icons.shopping_cart, size: 18, - color: Colors.blue, + color: CustomColors.green, ), onPressed: () async { if (model.finalProducts[index].rxMessage == null) { diff --git a/lib/pages/parent_categorise_page.dart b/lib/pages/parent_categorise_page.dart index 31bf7243..ec37cff5 100644 --- a/lib/pages/parent_categorise_page.dart +++ b/lib/pages/parent_categorise_page.dart @@ -1,5 +1,3 @@ -import 'package:diplomaticquarterapp/config/size_config.dart'; -import 'package:diplomaticquarterapp/core/model/pharmacies/PharmacyProduct.dart'; import 'package:diplomaticquarterapp/core/model/pharmacy/categorise_parent_model.dart'; import 'package:diplomaticquarterapp/core/service/AuthenticatedUserObject.dart'; import 'package:diplomaticquarterapp/core/viewModels/pharmacyModule/product_detail_view_model.dart'; @@ -8,37 +6,35 @@ import 'package:diplomaticquarterapp/core/viewModels/project_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/pages/sub_categories_modalsheet.dart'; import 'package:diplomaticquarterapp/pages/sub_categorise_page.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/gif_loader_dialog_utils.dart'; +import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; 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'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; -import 'package:font_awesome_flutter/font_awesome_flutter.dart'; 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(); + AuthenticatedUserObject authenticatedUserObject = locator(); ParentCategorisePage({this.id, this.titleName}); @override - _ParentCategorisePageState createState() => - _ParentCategorisePageState(id: id, titleName: titleName); + _ParentCategorisePageState createState() => _ParentCategorisePageState(id: id, titleName: titleName); } class _ParentCategorisePageState extends State { @@ -75,9 +71,7 @@ class _ParentCategorisePageState extends State { return BaseView( onModelReady: (model) => model.getCategoriseParent(i: id), allowAny: true, - builder: (BuildContext context, PharmacyCategoriseViewModel model, - Widget child) => - AppScaffold( + builder: (BuildContext context, PharmacyCategoriseViewModel model, Widget child) => AppScaffold( isPharmacy: true, appBarTitle: titleName, isBottomBar: true, @@ -129,8 +123,7 @@ class _ParentCategorisePageState extends State { child: InkWell( child: Container( child: Texts( - TranslationBase.of(context) - .viewCategorise, + TranslationBase.of(context).viewCategorise, // 'View All Categories', fontWeight: FontWeight.w300, ), @@ -215,28 +208,22 @@ class _ParentCategorisePageState extends State { child: Center( child: ListView.builder( scrollDirection: Axis.horizontal, - itemCount: model.categoriseParent.length > 8 - ? 8 - : model.categoriseParent.length, + itemCount: model.categoriseParent.length > 8 ? 8 : model.categoriseParent.length, itemBuilder: (BuildContext context, int index) { return Padding( - padding: - EdgeInsets.symmetric(horizontal: 8.0), + padding: EdgeInsets.symmetric(horizontal: 8.0), child: InkWell( child: Column( - crossAxisAlignment: - CrossAxisAlignment.center, + crossAxisAlignment: CrossAxisAlignment.center, children: [ Padding( - padding: EdgeInsets.symmetric( - horizontal: 13.0), + padding: EdgeInsets.symmetric(horizontal: 13.0), child: Container( height: 60.0, width: 65.0, decoration: BoxDecoration( shape: BoxShape.circle, - color: Colors.orange.shade200 - .withOpacity(0.45), + color: Colors.orange.shade200.withOpacity(0.45), ), child: Center( child: Icon( @@ -247,23 +234,14 @@ class _ParentCategorisePageState extends State { ), ), Container( - width: MediaQuery.of(context) - .size - .width * - 0.197, + width: MediaQuery.of(context).size.width * 0.197, // height: MediaQuery.of(context) // .size // .height * // 0.08, child: Center( child: Texts( - projectViewModel.isArabic - ? model - .categoriseParent[index] - .namen - : model - .categoriseParent[index] - .name, + projectViewModel.isArabic ? model.categoriseParent[index].namen : model.categoriseParent[index].name, fontSize: 13.4, fontWeight: FontWeight.w600, maxLines: 3, @@ -277,10 +255,8 @@ class _ParentCategorisePageState extends State { context, FadePage( page: SubCategorisePage( - title: model - .categoriseParent[index].name, - id: model - .categoriseParent[index].id, + title: model.categoriseParent[index].name, + id: model.categoriseParent[index].id, parentId: id, )), ); @@ -326,21 +302,16 @@ class _ParentCategorisePageState extends State { initialChildSize: 0.95, maxChildSize: 0.95, minChildSize: 0.9, - builder: (BuildContext context, - ScrollController scrollController) { + builder: (BuildContext context, ScrollController scrollController) { return SingleChildScrollView( controller: scrollController, child: Container( color: Colors.white, - height: MediaQuery.of(context) - .size - .height * - 1.95, + height: MediaQuery.of(context).size.height * 1.95, child: Column( children: [ Padding( - padding: - EdgeInsets.all(8.0), + padding: EdgeInsets.all(8.0), child: Row( children: [ Icon( @@ -350,13 +321,10 @@ class _ParentCategorisePageState extends State { width: 10.0, ), Texts( - TranslationBase.of( - context) - .refine, + TranslationBase.of(context).refine, // 'Refine', - fontWeight: - FontWeight.w600, + fontWeight: FontWeight.w600, ), SizedBox( width: 250.0, @@ -364,17 +332,13 @@ class _ParentCategorisePageState extends State { InkWell( child: Texts( // 'Close', - TranslationBase.of( - context) - .closeIt, + TranslationBase.of(context).closeIt, color: Colors.red, - fontWeight: - FontWeight.w600, + fontWeight: FontWeight.w600, fontSize: 15.0, ), onTap: () { - Navigator.pop( - context); + Navigator.pop(context); }, ), ], @@ -387,39 +351,26 @@ class _ParentCategorisePageState extends State { Column( children: [ ExpansionTile( - title: Texts( - TranslationBase.of( - context) - .categorise), + title: Texts(TranslationBase.of(context).categorise), children: [ ProcedureListWidget( model: model, - masterList: model - .categoriseParent, - removeHistory: - (item) { + masterList: model.categoriseParent, + removeHistory: (item) { setState(() { - entityList - .remove( - item); + entityList.remove(item); }); }, - addHistory: - (history) { + addHistory: (history) { setState(() { - entityList.add( - history); + entityList.add(history); }); }, - addSelectedHistories: - () { + addSelectedHistories: () { //TODO build your fun herr // widget.addSelectedHistories(); }, - isEntityListSelected: - (master) => - isEntityListSelected( - master), + isEntityListSelected: (master) => isEntityListSelected(master), ) ], ), @@ -428,40 +379,26 @@ class _ParentCategorisePageState extends State { color: Colors.black12, ), ExpansionTile( - title: Texts( - TranslationBase.of( - context) - .brands), + title: Texts(TranslationBase.of(context).brands), children: [ ProcedureListWidget( model: model, - masterList: model - .brandsList, - removeHistory: - (item) { + masterList: model.brandsList, + removeHistory: (item) { setState(() { - entityListBrands - .remove( - item); + entityListBrands.remove(item); }); }, - addHistory: - (history) { + addHistory: (history) { setState(() { - entityListBrands - .add( - history); + entityListBrands.add(history); }); }, - addSelectedHistories: - () { + addSelectedHistories: () { //TODO build your fun herr // widget.addSelectedHistories(); }, - isEntityListSelected: - (master) => - isEntityListSelectedBrands( - master), + isEntityListSelected: (master) => isEntityListSelectedBrands(master), ) ], ), @@ -470,69 +407,43 @@ class _ParentCategorisePageState extends State { color: Colors.black12, ), ExpansionTile( - title: Texts( - TranslationBase.of( - context) - .price), + title: Texts(TranslationBase.of(context).price), children: [ Container( - color: Color( - 0xffEEEEEE), + color: Color(0xffEEEEEE), child: Row( - mainAxisAlignment: - MainAxisAlignment - .spaceAround, + mainAxisAlignment: MainAxisAlignment.spaceAround, children: [ Column( - mainAxisAlignment: - MainAxisAlignment - .start, + mainAxisAlignment: MainAxisAlignment.start, children: [ - Texts( - 'Min'), + Texts('Min'), Container( - color: Colors - .white, - width: - 200, - height: - 40, - child: - TextFormField( - decoration: - InputDecoration( - border: - OutlineInputBorder(), + color: Colors.white, + width: 200, + height: 40, + child: TextFormField( + decoration: InputDecoration( + border: OutlineInputBorder(), ), - controller: - minField, + controller: minField, ), ), ], ), Column( - mainAxisAlignment: - MainAxisAlignment - .start, + mainAxisAlignment: MainAxisAlignment.start, children: [ - Texts( - 'Max'), + Texts('Max'), Container( - color: Colors - .white, - width: - 200, - height: - 40, - child: - TextFormField( - decoration: - InputDecoration( - border: - OutlineInputBorder(), + color: Colors.white, + width: 200, + height: 40, + child: TextFormField( + decoration: InputDecoration( + border: OutlineInputBorder(), ), - controller: - maxField, + controller: maxField, ), ), ], @@ -547,28 +458,18 @@ class _ParentCategorisePageState extends State { color: Colors.black12, ), SizedBox( - height: MediaQuery.of( - context) - .size - .height * - 0.4, + height: MediaQuery.of(context).size.height * 0.4, ), Padding( - padding: - EdgeInsets.all(8.0), + padding: EdgeInsets.all(8.0), child: Row( - mainAxisAlignment: - MainAxisAlignment - .spaceEvenly, + mainAxisAlignment: MainAxisAlignment.spaceEvenly, children: [ Container( width: 100, child: Button( - label: TranslationBase.of( - context) - .reset, - backgroundColor: - Colors.red, + label: TranslationBase.of(context).reset, + backgroundColor: Colors.red, ), ), SizedBox( @@ -577,67 +478,34 @@ class _ParentCategorisePageState extends State { Container( width: 200, child: Button( - onTap: - () async { - String - categoriesId = - ""; - for (CategoriseParentModel category - in entityList) { - if (categoriesId == - "") { - categoriesId = - category - .id; + onTap: () async { + String categoriesId = ""; + for (CategoriseParentModel category in entityList) { + if (categoriesId == "") { + categoriesId = category.id; } else { - categoriesId = - "$categoriesId,${category.id}"; + categoriesId = "$categoriesId,${category.id}"; } } - String - brandIds = - ""; - for (CategoriseParentModel brand - in entityListBrands) { - if (brandIds == - "") { - brandIds = - brand - .id; + String brandIds = ""; + for (CategoriseParentModel brand in entityListBrands) { + if (brandIds == "") { + brandIds = brand.id; } else { - brandIds = - "$brandIds,${brand.id}"; + brandIds = "$brandIds,${brand.id}"; } } - GifLoaderDialogUtils - .showMyDialog( - context); + GifLoaderDialogUtils.showMyDialog(context); await model.getFilteredProducts( - min: minField - .text - .toString(), - max: maxField - .text - .toString(), - categoryId: - categoriesId, - brandId: - brandIds); - GifLoaderDialogUtils - .hideDialog( - context); + min: minField.text.toString(), max: maxField.text.toString(), categoryId: categoriesId, brandId: brandIds); + GifLoaderDialogUtils.hideDialog(context); - Navigator.pop( - context); + Navigator.pop(context); }, - label: TranslationBase.of( - context) - .apply, - backgroundColor: - Colors - .green, + label: TranslationBase.of(context).apply, + backgroundColor: Colors.green, ), ), ], @@ -676,7 +544,7 @@ class _ParentCategorisePageState extends State { styleTwo = true; styleIcon = Icon( Icons.auto_awesome_mosaic, - color: Colors.blue, + color: CustomColors.green, size: 29.0, ); } else { @@ -684,7 +552,7 @@ class _ParentCategorisePageState extends State { styleTwo = false; styleIcon = Icon( Icons.widgets_sharp, - color: Colors.blue, + color: CustomColors.green, size: 29.0, ); } @@ -704,30 +572,22 @@ class _ParentCategorisePageState extends State { model.parentProducts.isNotEmpty ? styleOne == true ? Container( - height: model.parentProducts.length * - MediaQuery.of(context).size.height * - 0.15, + height: model.parentProducts.length * MediaQuery.of(context).size.height * 0.15, child: GridView.builder( physics: NeverScrollableScrollPhysics(), - gridDelegate: - SliverGridDelegateWithFixedCrossAxisCount( + gridDelegate: SliverGridDelegateWithFixedCrossAxisCount( crossAxisCount: 2, crossAxisSpacing: 0.5, mainAxisSpacing: 2.0, childAspectRatio: 0.9, ), itemCount: model.parentProducts.length, - itemBuilder: - (BuildContext context, int index) { + itemBuilder: (BuildContext context, int index) { return NetworkBaseView( baseViewModel: model, child: InkWell( child: Card( - color: model.parentProducts[index] - .discountName != - null - ? Color(0xffFFFF00) - : Colors.white, + color: model.parentProducts[index].discountName != null ? Color(0xffFFFF00) : Colors.white, elevation: 0, shape: Border( right: BorderSide( @@ -753,187 +613,99 @@ class _ParentCategorisePageState extends State { ), 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: 0), - width: MediaQuery.of(context) - .size - .width / - 3, + padding: EdgeInsets.symmetric(horizontal: 0), + width: MediaQuery.of(context).size.width / 3, child: Column( - crossAxisAlignment: - CrossAxisAlignment.start, + crossAxisAlignment: CrossAxisAlignment.start, children: [ Stack( children: [ - if (model - .parentProducts[ - index] - .discountName != - null) + if (model.parentProducts[index].discountName != null) RotatedBox( quarterTurns: 4, child: Container( - decoration: - BoxDecoration(), + decoration: BoxDecoration(), child: Padding( - padding: - EdgeInsets - .only( + padding: EdgeInsets.only( right: 5.0, top: 20.0, bottom: 5.0, ), child: Texts( - 'offer' - .toUpperCase(), - color: Colors - .red, - fontSize: - 13.0, - fontWeight: - FontWeight - .w900, + 'offer'.toUpperCase(), + color: Colors.red, + fontSize: 13.0, + fontWeight: FontWeight.w900, ), ), - transform: new Matrix4 - .rotationZ( - 5.837200), + transform: new Matrix4.rotationZ(5.837200), ), ), Container( - margin: EdgeInsets - .fromLTRB( - 0, 16, 0, 0), - alignment: - Alignment.center, + margin: EdgeInsets.fromLTRB(0, 16, 0, 0), + alignment: Alignment.center, child: Image.network( - model - .parentProducts[ - index] - .images - .isNotEmpty - ? model - .parentProducts[ - index] - .images[0] - .thumb + model.parentProducts[index].images.isNotEmpty + ? model.parentProducts[index].images[0].thumb : 'https://upload.wikimedia.org/wikipedia/commons/thumb/6/6c/No_image_3x4.svg/1200px-No_image_3x4.svg.png', fit: BoxFit.cover, height: 80, ), ), Container( - width: model - .parentProducts[ - index] - .rxMessage != - null - ? MediaQuery.of( - context) - .size - .width / - 5 - : 0, - padding: - EdgeInsets.all(4), - decoration: - BoxDecoration( - color: Color( - 0xffb23838), - borderRadius: - BorderRadius.only( - topLeft: Radius - .circular( - 6)), + width: model.parentProducts[index].rxMessage != null ? MediaQuery.of(context).size.width / 5 : 0, + padding: EdgeInsets.all(4), + decoration: BoxDecoration( + color: Color(0xffb23838), + borderRadius: BorderRadius.only(topLeft: Radius.circular(6)), ), child: Texts( - model - .parentProducts[ - index] - .rxMessage != - null - ? model - .parentProducts[ - index] - .rxMessage - : "", + model.parentProducts[index].rxMessage != null ? model.parentProducts[index].rxMessage : "", color: Colors.white, regular: true, fontSize: 10, - fontWeight: - FontWeight.w400, + fontWeight: FontWeight.w400, ), ), ], ), Container( - margin: - EdgeInsets.symmetric( + margin: EdgeInsets.symmetric( horizontal: 6, vertical: 0, ), child: Column( - crossAxisAlignment: - CrossAxisAlignment - .start, + crossAxisAlignment: CrossAxisAlignment.start, children: [ - if (model - .parentProducts[ - index] - .discountName != - null) + if (model.parentProducts[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 - .parentProducts[ - index] - .discountName, + model.parentProducts[index].discountName, regular: true, - color: Colors - .white, - fontSize: - 10.4, + color: Colors.white, + fontSize: 10.4, ), ), ), Texts( - projectViewModel - .isArabic - ? model - .parentProducts[ - index] - .namen - : model - .parentProducts[ - index] - .name, + projectViewModel.isArabic ? model.parentProducts[index].namen : model.parentProducts[index].name, regular: true, fontSize: 12, - fontWeight: - FontWeight.w700, + fontWeight: FontWeight.w700, ), Padding( - padding: - const EdgeInsets - .only( - top: 4, - bottom: 4), + padding: const EdgeInsets.only(top: 4, bottom: 4), child: Texts( "SAR ${model.parentProducts[index].price}", bold: true, @@ -943,25 +715,15 @@ class _ParentCategorisePageState extends State { Row( children: [ StarRating( - totalAverage: model - .parentProducts[ - index] - .approvedRatingSum > - 0 - ? (model.parentProducts[index].approvedRatingSum.toDouble() / - model.parentProducts[index].approvedRatingSum - .toDouble()) - .toDouble() + totalAverage: model.parentProducts[index].approvedRatingSum > 0 + ? (model.parentProducts[index].approvedRatingSum.toDouble() / model.parentProducts[index].approvedRatingSum.toDouble()).toDouble() : 0, - forceStars: - true), + forceStars: true), Texts( "(${model.parentProducts[index].approvedTotalReviews})", regular: true, fontSize: 10, - fontWeight: - FontWeight - .w400, + fontWeight: FontWeight.w400, ) ], ), @@ -976,9 +738,7 @@ class _ParentCategorisePageState extends State { Navigator.push( context, FadePage( - page: ProductDetailPage( - model.parentProducts[ - index]), + page: ProductDetailPage(model.parentProducts[index]), )), }, )); @@ -986,14 +746,11 @@ class _ParentCategorisePageState extends State { ), ) : Container( - height: model.parentProducts.length * - MediaQuery.of(context).size.height * - 0.122, + height: model.parentProducts.length * MediaQuery.of(context).size.height * 0.122, child: ListView.builder( physics: NeverScrollableScrollPhysics(), itemCount: model.parentProducts.length, - itemBuilder: - (BuildContext context, int index) { + itemBuilder: (BuildContext context, int index) { return InkWell( child: Card( child: Row( @@ -1003,11 +760,9 @@ class _ParentCategorisePageState extends State { Column( children: [ Container( - decoration: - BoxDecoration(), + decoration: BoxDecoration(), child: Padding( - padding: - EdgeInsets.only( + padding: EdgeInsets.only( left: 9.0, top: 8.0, right: 10.0, @@ -1015,71 +770,33 @@ class _ParentCategorisePageState extends State { ), ), Container( - margin: EdgeInsets - .fromLTRB( - 0, 0, 0, 0), - alignment: - Alignment.center, - child: Image.network( - model - .parentProducts[ - index] - .images - .isNotEmpty - ? model - .parentProducts[ - index] - .images[0] - .thumb - : 'https://upload.wikimedia.org/wikipedia/commons/thumb/6/6c/No_image_3x4.svg/1200px-No_image_3x4.svg.png', - fit: BoxFit.contain, - height: 70, - ), + margin: EdgeInsets.fromLTRB(0, 0, 0, 0), + alignment: Alignment.center, + child: model.parentProducts[index].images.isNotEmpty + ? Image.network( + model.parentProducts[index].images[0].thumb, + fit: BoxFit.contain, + height: 70, + ) + : Text(TranslationBase.of(context).noImage), ), ], ), Column( children: [ Container( - width: model - .parentProducts[ - index] - .rxMessage != - null - ? MediaQuery.of( - context) - .size - .width / - 5.3 - : 0, - padding: - EdgeInsets.all(4), - decoration: - BoxDecoration( - color: Color( - 0xffb23838), - borderRadius: - BorderRadius.only( - topLeft: Radius - .circular( - 6)), + width: model.parentProducts[index].rxMessage != null ? MediaQuery.of(context).size.width / 5.3 : 0, + padding: EdgeInsets.all(4), + decoration: BoxDecoration( + color: Color(0xffb23838), + borderRadius: BorderRadius.only(topLeft: Radius.circular(6)), ), child: Texts( - model - .parentProducts[ - index] - .rxMessage != - null - ? model - .parentProducts[ - index] - .rxMessage - : "", + model.parentProducts[index].rxMessage != null ? model.parentProducts[index].rxMessage : "", color: Colors.white, regular: true, fontSize: 10, - fontWeight: - FontWeight.w400, + fontWeight: FontWeight.w400, ), ), ], @@ -1092,37 +809,19 @@ class _ParentCategorisePageState extends State { vertical: 0, ), child: Column( - mainAxisAlignment: - MainAxisAlignment - .spaceAround, - crossAxisAlignment: - CrossAxisAlignment - .start, + mainAxisAlignment: MainAxisAlignment.spaceAround, + crossAxisAlignment: CrossAxisAlignment.start, children: [ SizedBox( height: 4.0, ), Container( - width: MediaQuery.of( - context) - .size - .width * - 0.65, + width: MediaQuery.of(context).size.width * 0.635, child: Texts( - projectViewModel - .isArabic - ? model - .parentProducts[ - index] - .namen - : model - .parentProducts[ - index] - .name, + projectViewModel.isArabic ? model.parentProducts[index].namen : model.parentProducts[index].name, regular: true, fontSize: 13.2, - fontWeight: - FontWeight.w500, + fontWeight: FontWeight.w500, maxLines: 5, ), ), @@ -1130,11 +829,7 @@ class _ParentCategorisePageState extends State { height: 8.0, ), Padding( - padding: - const EdgeInsets - .only( - top: 4, - bottom: 4), + padding: const EdgeInsets.only(top: 4, bottom: 4), child: Texts( "SAR ${model.parentProducts[index].price}", bold: true, @@ -1144,72 +839,37 @@ class _ParentCategorisePageState extends State { Row( children: [ StarRating( - totalAverage: model - .parentProducts[ - index] - .approvedRatingSum > - 0 - ? (model.parentProducts[index].approvedRatingSum - .toDouble() / - model - .parentProducts[index] - .approvedRatingSum - .toDouble()) - .toDouble() + totalAverage: model.parentProducts[index].approvedRatingSum > 0 + ? (model.parentProducts[index].approvedRatingSum.toDouble() / model.parentProducts[index].approvedRatingSum.toDouble()).toDouble() : 0, forceStars: true), Texts( "(${model.parentProducts[index].approvedTotalReviews})", regular: true, fontSize: 10, - fontWeight: - FontWeight.w400, + fontWeight: FontWeight.w400, ) ], ), ], ), ), - widget.authenticatedUserObject - .isLogin + widget.authenticatedUserObject.isLogin ? Container( child: IconButton( icon: Icon( - Icons - .shopping_cart, + Icons.shopping_cart, size: 18, - color: - Colors.blue, + color: CustomColors.green, ), - 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())); + 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); + AppToast.showErrorToast(message: TranslationBase.of(context).needPrescription); } }), ) @@ -1221,8 +881,7 @@ class _ParentCategorisePageState extends State { Navigator.push( context, FadePage( - page: ProductDetailPage(model - .parentProducts[index]), + page: ProductDetailPage(model.parentProducts[index]), )), }, ); @@ -1269,8 +928,7 @@ class _ParentCategorisePageState extends State { } bool isEntityListSelected(CategoriseParentModel masterKey) { - Iterable history = - entityList.where((element) => masterKey.id == element.id); + Iterable history = entityList.where((element) => masterKey.id == element.id); if (history.length > 0) { return true; } @@ -1278,8 +936,7 @@ class _ParentCategorisePageState extends State { } bool isEntityListSelectedBrands(CategoriseParentModel masterKey) { - Iterable history = - entityListBrands.where((element) => masterKey.id == element.id); + Iterable history = entityListBrands.where((element) => masterKey.id == element.id); if (history.length > 0) { return true; } diff --git a/lib/pages/pharmacies/screens/cart-page/cart-order-page.dart b/lib/pages/pharmacies/screens/cart-page/cart-order-page.dart index 6bfe4fbc..69aaa04e 100644 --- a/lib/pages/pharmacies/screens/cart-page/cart-order-page.dart +++ b/lib/pages/pharmacies/screens/cart-page/cart-order-page.dart @@ -55,10 +55,10 @@ class _CartOrderPageState extends State { appBarTitle: TranslationBase.of(context).shoppingCart, isShowAppBar: true, isPharmacy: true, - //isBottomBar: true, showHomeAppBarIcon: false, isShowDecPage: false, isMainPharmacyPages: true, + showPharmacyCart: false, baseViewModel: model, backgroundColor: Colors.white, body: !(model.cartResponse.shoppingCarts == null || 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 4f5ab14e..50cee7c3 100644 --- a/lib/pages/pharmacies/screens/cart-page/cart-order-preview.dart +++ b/lib/pages/pharmacies/screens/cart-page/cart-order-preview.dart @@ -33,9 +33,7 @@ class _OrderPreviewPageState extends State { } void getData() async { - if (isLoading) - await Provider.of(context, listen: false) - .getShoppingCart(); + if (isLoading) await Provider.of(context, listen: false).getShoppingCart(); setState(() { isLoading = false; }); @@ -63,7 +61,7 @@ class _OrderPreviewPageState extends State { color: Color(0xFFF1F1F1), child: Column( children: [ - SelectAddressWidget(model, widget.addresses,changeMainState), + SelectAddressWidget(model, widget.addresses, changeMainState), SizedBox( height: 10, ), @@ -97,11 +95,8 @@ class _OrderPreviewPageState extends State { color: Colors.black, ), ...List.generate( - model.cartResponse.shoppingCarts != null - ? model.cartResponse.shoppingCarts.length - : 0, - (index) => ProductOrderPreviewItem( - model.cartResponse.shoppingCarts[index]), + model.cartResponse.shoppingCarts != null ? model.cartResponse.shoppingCarts.length : 0, + (index) => ProductOrderPreviewItem(model.cartResponse.shoppingCarts[index]), ), ], ), @@ -219,9 +214,7 @@ class _OrderPreviewPageState extends State { : Container(), ), SizedBox( - height: model.cartResponse.shoppingCarts != null - ? height * 0.10 - : 0, + height: model.cartResponse.shoppingCarts != null ? height * 0.10 : 0, ) ], ), @@ -235,9 +228,8 @@ class _OrderPreviewPageState extends State { ), ); } - changeMainState(){ - setState(() { - }); + changeMainState() { + setState(() {}); } } 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 ab55002f..e03a4b35 100644 --- a/lib/pages/pharmacies/screens/cart-page/select_address_widget.dart +++ b/lib/pages/pharmacies/screens/cart-page/select_address_widget.dart @@ -1,24 +1,10 @@ -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'; -import 'package:diplomaticquarterapp/models/Appointments/AppoimentAllHistoryResultList.dart'; -import 'package:diplomaticquarterapp/models/Authentication/authenticated_user.dart'; -import 'package:diplomaticquarterapp/pages/base/base_view.dart'; -import 'package:diplomaticquarterapp/pages/pharmacies/screens/cart-page/payment_bottom_widget.dart'; -import 'package:diplomaticquarterapp/pages/pharmacies/screens/payment-method-select-page.dart'; -import 'package:diplomaticquarterapp/pages/pharmacies/widgets/ProductOrderPreviewItem.dart'; import 'package:diplomaticquarterapp/pages/pharmacy/pharmacyAddresses/PharmacyAddresses.dart'; -import 'package:diplomaticquarterapp/uitl/app_toast.dart'; +import 'package:diplomaticquarterapp/uitl/gif_loader_dialog_utils.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; -import 'package:diplomaticquarterapp/widgets/in_app_browser/InAppBrowser.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:provider/provider.dart'; @@ -38,14 +24,15 @@ class _SelectAddressWidgetState extends State { AddressInfo address; _navigateToAddressPage(String identificationNo) { - Navigator.push(context, FadePage(page: PharmacyAddressesPage())) - .then((result) { + Navigator.push(context, FadePage(page: PharmacyAddressesPage())).then((result) async { if (result != null) { + GifLoaderDialogUtils.showMyDialog(context); address = result; - widget.model.paymentCheckoutData.address = - Addresses.fromJson(address.toJson()); - widget.model.getInformationsByAddress(identificationNo); - widget.changeMainState(); + widget.model.paymentCheckoutData.address = Addresses.fromJson(address.toJson()); + await widget.model.getInformationsByAddress(identificationNo); + await widget.model.getShoppingCart(); + widget.changeMainState(); + GifLoaderDialogUtils.hideDialog(context); } }); } @@ -53,8 +40,7 @@ class _SelectAddressWidgetState extends State { @override void initState() { if (widget.model.paymentCheckoutData.address != null) { - address = AddressInfo.fromJson( - widget.model.paymentCheckoutData.address.toJson()); + address = AddressInfo.fromJson(widget.model.paymentCheckoutData.address.toJson()); } super.initState(); } @@ -79,8 +65,7 @@ class _SelectAddressWidgetState extends State { ), Expanded( child: Container( - padding: - EdgeInsets.symmetric(vertical: 0, horizontal: 6), + padding: EdgeInsets.symmetric(vertical: 0, horizontal: 6), child: Texts( TranslationBase.of(context).selectAddress, fontSize: 14, @@ -114,8 +99,7 @@ class _SelectAddressWidgetState extends State { ), Expanded( child: Container( - padding: EdgeInsets.symmetric( - vertical: 0, horizontal: 6), + padding: EdgeInsets.symmetric(vertical: 0, horizontal: 6), child: Texts( TranslationBase.of(context).shippingAddress, fontSize: 14, @@ -190,8 +174,7 @@ class _SelectAddressWidgetState extends State { fit: BoxFit.scaleDown, ), Container( - padding: - EdgeInsets.symmetric(vertical: 0, horizontal: 6), + padding: EdgeInsets.symmetric(vertical: 0, horizontal: 6), child: Texts( "${TranslationBase.of(context).shipBy}", fontSize: 12, @@ -203,9 +186,7 @@ class _SelectAddressWidgetState extends State { child: Image.asset( model.paymentCheckoutData.shippingOption == null ? "" - : model.paymentCheckoutData.shippingOption - .shippingRateComputationMethodSystemName == - "Shipping.FixedOrByWeight" + : model.paymentCheckoutData.shippingOption.shippingRateComputationMethodSystemName == "Shipping.FixedOrByWeight" ? "assets/images/pharmacy_module/payment/hmg_shipping_logo.png" : "assets/images/pharmacy_module/payment/aramex_shipping_logo.png", fit: BoxFit.contain, diff --git a/lib/pages/pharmacies/screens/lakum-main-page.dart b/lib/pages/pharmacies/screens/lakum-main-page.dart index 18981cc9..1547b929 100644 --- a/lib/pages/pharmacies/screens/lakum-main-page.dart +++ b/lib/pages/pharmacies/screens/lakum-main-page.dart @@ -39,10 +39,7 @@ class LakumMainPage extends StatelessWidget { body: Container( width: double.infinity, child: SingleChildScrollView( - child: (model.lacumGroupInformation != null && - model.lacumGroupInformation - .lakumInquiryInformationObjVersion != - null) + child: (model.lacumGroupInformation != null && model.lacumGroupInformation.lakumInquiryInformationObjVersion != null) ? Column( children: [ Stack( @@ -56,10 +53,7 @@ class LakumMainPage extends StatelessWidget { SizedBox( height: mediaQuery.size.height * 0.02, ), - Container( - width: mediaQuery.size.width * 1, - child: LakumBannerWidget( - model, mediaQuery, true)), + Container(width: mediaQuery.size.width * 1, child: LakumBannerWidget(model, mediaQuery, true)), ], ) ], @@ -67,20 +61,8 @@ class LakumMainPage extends StatelessWidget { SizedBox( width: 8, ), - LacumPointsWidget( - mediaQuery, - 2, - TranslationBase.of(context).gained, - model - .lacumGroupInformation - .lakumInquiryInformationObjVersion - .pointsBalanceAmount, - model.lacumGroupInformation - .lakumInquiryInformationObjVersion.gainedPoints, - model - .lacumGroupInformation - .lakumInquiryInformationObjVersion - .gainedPointsAmountPerYear), + LacumPointsWidget(mediaQuery, 2, TranslationBase.of(context).gained, model.lacumGroupInformation.lakumInquiryInformationObjVersion.pointsBalanceAmount, + model.lacumGroupInformation.lakumInquiryInformationObjVersion.gainedPoints, model.lacumGroupInformation.lakumInquiryInformationObjVersion.gainedPointsAmountPerYear), SizedBox( height: 20, ), @@ -90,38 +72,13 @@ class LakumMainPage extends StatelessWidget { child: ListView( scrollDirection: Axis.horizontal, children: [ - LacumPointsWidget( - mediaQuery, - 1, - TranslationBase.of(context).balance, - model - .lacumGroupInformation - .lakumInquiryInformationObjVersion - .pointsBalanceAmount, - model - .lacumGroupInformation - .lakumInquiryInformationObjVersion - .pointsBalance, - null), + 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), + LacumPointsWidget(mediaQuery, 2, TranslationBase.of(context).gained, model.lacumGroupInformation.lakumInquiryInformationObjVersion.pointsBalanceAmount, + model.lacumGroupInformation.lakumInquiryInformationObjVersion.gainedPoints, model.lacumGroupInformation.lakumInquiryInformationObjVersion.gainedPointsAmountPerYear), SizedBox( width: 8, ), @@ -129,40 +86,16 @@ class LakumMainPage extends StatelessWidget { mediaQuery, 3, TranslationBase.of(context).consumed, - model - .lacumGroupInformation - .lakumInquiryInformationObjVersion - .consumedPointsAmount != - null - ? int.parse(model - .lacumGroupInformation - .lakumInquiryInformationObjVersion - .consumedPointsAmount) + model.lacumGroupInformation.lakumInquiryInformationObjVersion.consumedPointsAmount != null + ? int.parse(model.lacumGroupInformation.lakumInquiryInformationObjVersion.consumedPointsAmount) : 0, - model - .lacumGroupInformation - .lakumInquiryInformationObjVersion - .consumedPoints, - model - .lacumGroupInformation - .lakumInquiryInformationObjVersion - .consumedPointsAmountPerYear), + 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), + LacumPointsWidget(mediaQuery, 4, TranslationBase.of(context).transferred, 0, model.lacumGroupInformation.lakumInquiryInformationObjVersion.transferPoints, + model.lacumGroupInformation.lakumInquiryInformationObjVersion.transferPointsAmountPerYear), ], ), ), @@ -170,22 +103,11 @@ class LakumMainPage extends StatelessWidget { mediaQuery, 3, TranslationBase.of(context).consumed, - model - .lacumGroupInformation - .lakumInquiryInformationObjVersion - .consumedPointsAmount != - null - ? int.parse(model - .lacumGroupInformation - .lakumInquiryInformationObjVersion - .consumedPointsAmount) + model.lacumGroupInformation.lakumInquiryInformationObjVersion.consumedPointsAmount != null + ? int.parse(model.lacumGroupInformation.lakumInquiryInformationObjVersion.consumedPointsAmount) : 0, - model.lacumGroupInformation - .lakumInquiryInformationObjVersion.consumedPoints, - model - .lacumGroupInformation - .lakumInquiryInformationObjVersion - .consumedPointsAmountPerYear), + model.lacumGroupInformation.lakumInquiryInformationObjVersion.consumedPoints, + model.lacumGroupInformation.lakumInquiryInformationObjVersion.consumedPointsAmountPerYear), SizedBox( width: 8, ), @@ -197,8 +119,7 @@ class LakumMainPage extends StatelessWidget { ), ), Container( - margin: - EdgeInsets.symmetric(vertical: 16, horizontal: 8), + margin: EdgeInsets.symmetric(vertical: 16, horizontal: 8), child: Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ @@ -213,7 +134,7 @@ class LakumMainPage extends StatelessWidget { Padding( padding: EdgeInsets.symmetric(horizontal: 8), child: Texts( - TranslationBase.of(context).Expired, + TranslationBase.of(context).expiryDate, // "Expired", fontSize: 14, ), @@ -234,45 +155,39 @@ class LakumMainPage extends StatelessWidget { // fontSize: 14, // ), Container( - margin: - EdgeInsets.symmetric(vertical: 16, horizontal: 8), - child: Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, + margin: EdgeInsets.symmetric(vertical: 16, horizontal: 8), + child: Row(mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ + Row( 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, + 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, + ), + ])), // Texts( // "${model.lacumGroupInformation.lakumInquiryInformationObjVersion.waitingPoints} Points", // fontWeight: FontWeight.bold, // fontSize: 14, // ), Container( - margin: - EdgeInsets.symmetric(vertical: 16, horizontal: 8), + margin: EdgeInsets.symmetric(vertical: 16, horizontal: 8), child: Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ @@ -325,11 +240,7 @@ class LakumMainPage extends StatelessWidget { } navigateToLakumRegister(BuildContext context) { - Navigator.pushReplacement( - context, - FadePage( - page: LakumRegistrationPage( - projectViewModel.user.patientIdentificationNo))); + Navigator.pushReplacement(context, FadePage(page: LakumRegistrationPage(projectViewModel.user.patientIdentificationNo))); } } @@ -339,12 +250,7 @@ List _buildAppBarICons(BuildContext context, LacumViewModel model) { icon: Icon(Icons.settings), color: Colors.white, onPressed: () { - Navigator.push( - context, - FadePage( - page: LakumSettingPage( - model.lacumInformation, model.lacumGroupInformation))) - .then((result) => {model.getLacumGroupData()}); + Navigator.push(context, FadePage(page: LakumSettingPage(model.lacumInformation, model.lacumGroupInformation))).then((result) => {model.getLacumGroupData()}); }, ), ]; @@ -366,9 +272,7 @@ class LakumHomeButtons extends StatelessWidget { child: InkWell( onTap: () { print("Account activate click"); - Navigator.push( - context, FadePage(page: LakumActivationVidaPage())) - .then((result) => {model.getLacumGroupData()}); + Navigator.push(context, FadePage(page: LakumActivationVidaPage())).then((result) => {model.getLacumGroupData()}); }, child: Container( padding: EdgeInsets.symmetric(horizontal: 8), @@ -411,12 +315,7 @@ class LakumHomeButtons extends StatelessWidget { child: InkWell( onTap: () { print("Lacum transfer click"); - Navigator.push( - context, - FadePage( - page: LacumTransferPage(model.lacumInformation, - model.lacumGroupInformation))) - .then((result) => {model.getLacumGroupData()}); + Navigator.push(context, FadePage(page: LacumTransferPage(model.lacumInformation, model.lacumGroupInformation))).then((result) => {model.getLacumGroupData()}); }, child: Container( padding: EdgeInsets.symmetric(horizontal: 8), @@ -467,8 +366,7 @@ class LacumPointsWidget extends StatelessWidget { Color titleColor; final List pointsAmountPerYear; - LacumPointsWidget(this.mediaQuery, this.pointType, this.title, this.riyal, - this.point, this.pointsAmountPerYear) { + LacumPointsWidget(this.mediaQuery, this.pointType, this.title, this.riyal, this.point, this.pointsAmountPerYear) { if (pointType == 1) { titleColor = Color(0xffefefef); } else if (pointType == 2) { @@ -486,11 +384,9 @@ class LacumPointsWidget extends StatelessWidget { onTap: () { if (pointType != 1) { if (pointsAmountPerYear != null && pointsAmountPerYear.length > 0) { - Navigator.push(context, - FadePage(page: LakumPointsYearPage(pointsAmountPerYear))); + Navigator.push(context, FadePage(page: LakumPointsYearPage(pointsAmountPerYear))); } else { - AppToast.showErrorToast( - message: TranslationBase.of(context).lakumMsg); + AppToast.showErrorToast(message: TranslationBase.of(context).lakumMsg); // show snackBar No Details Points are there } } diff --git a/lib/pages/pharmacies/screens/lakum-points-year-page.dart b/lib/pages/pharmacies/screens/lakum-points-year-page.dart index 323f1a91..df333cdf 100644 --- a/lib/pages/pharmacies/screens/lakum-points-year-page.dart +++ b/lib/pages/pharmacies/screens/lakum-points-year-page.dart @@ -173,7 +173,7 @@ class LacumPointsYearWidget extends StatelessWidget { child: Column( crossAxisAlignment: CrossAxisAlignment.center, children: [ - Texts(TranslationBase.of(context).RIYAL, + Texts(TranslationBase.of(context).sar, // "RIYAL", fontSize: 13, fontWeight: FontWeight.bold, diff --git a/lib/pages/pharmacies/screens/pharmacy_module_page.dart b/lib/pages/pharmacies/screens/pharmacy_module_page.dart index 4da64235..0d0716cc 100644 --- a/lib/pages/pharmacies/screens/pharmacy_module_page.dart +++ b/lib/pages/pharmacies/screens/pharmacy_module_page.dart @@ -55,11 +55,11 @@ class _PharmacyPageState extends State { //crossAxisAlignment: CrossAxisAlignment.start, children: [ BannerPager(model), - // GridViewButtons(model), PrescriptionsWidget(), - ShopByBrandWidget(), +// ShopByBrandWidget(), RecentlyViewedWidget(), BestSellerWidget(), + ShopByBrandWidget(), ], ), ), diff --git a/lib/pages/pharmacies/screens/product-details/availability_info.dart b/lib/pages/pharmacies/screens/product-details/availability_info.dart index 9e717de6..13e94c87 100644 --- a/lib/pages/pharmacies/screens/product-details/availability_info.dart +++ b/lib/pages/pharmacies/screens/product-details/availability_info.dart @@ -1,82 +1,73 @@ import 'package:diplomaticquarterapp/core/viewModels/pharmacyModule/product_detail_view_model.dart'; -import 'package:diplomaticquarterapp/pages/base/base_view.dart'; -import 'package:diplomaticquarterapp/pages/pharmacies/screens/product-details/product-detail.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; -import 'package:diplomaticquarterapp/widgets/others/network_base_view.dart'; import 'package:flutter/material.dart'; class AvailabilityInfo extends StatelessWidget { final ProductDetailViewModel previousModel; const AvailabilityInfo({Key key, this.previousModel}) : super(key: key); + @override Widget build(BuildContext context) { return previousModel.productLocationService.length == 0 ? Container( - padding: EdgeInsets.all(15), - alignment: Alignment.center, - child: Text( - TranslationBase.of(context).noLocationAvailable, - ), - ) + padding: EdgeInsets.all(15), + alignment: Alignment.center, + child: Text( + TranslationBase.of(context).noLocationAvailable, + ), + ) : ListView.builder( - physics: ScrollPhysics(), - scrollDirection: Axis.vertical, - shrinkWrap: true, - itemCount: previousModel.productLocationService.length, - itemBuilder: (BuildContext context, int index) { - return Padding( - padding: EdgeInsets.all(8.0), - child: Column( - children: [ - Row( - mainAxisAlignment: MainAxisAlignment.start, - children: [ - Expanded( - flex: 1, - child: Image.network(previousModel - .productLocationService[index].projectImageUrl), - ), - SizedBox( - width: 10, - ), - Expanded( - flex: 4, - child: Text( - previousModel.productLocationService[index] - .locationDescription + - "\n" + - convertCityName( - previousModel.productLocationService[0].cityName - .toString(), + physics: ScrollPhysics(), + scrollDirection: Axis.vertical, + shrinkWrap: true, + itemCount: previousModel.productLocationService.length, + itemBuilder: (BuildContext context, int index) { + return Padding( + padding: EdgeInsets.all(8.0), + child: Column( + children: [ + Row( + mainAxisAlignment: MainAxisAlignment.start, + children: [ + Expanded( + flex: 1, + child: Image.network(previousModel.productLocationService[index].projectImageUrl), + ), + SizedBox( + width: 10, + ), + Expanded( + flex: 4, + child: Text( + previousModel.productLocationService[index].locationDescription + "\n" + previousModel.productLocationService[index].cityName.toString(), + style: TextStyle(fontSize: 12), ), - style: TextStyle(fontSize: 12), - ), - ), - Expanded( - flex: 1, - child: IconButton( - icon: Icon(Icons.location_on), - color: Colors.red, - onPressed: () {}, - ), - ), - Expanded( - flex: 1, - child: IconButton( - icon: Icon(Icons.phone), - color: Colors.red, - onPressed: () {}, + ), + Expanded( + flex: 1, + child: IconButton( + icon: Icon(Icons.location_on), + color: Colors.red, + onPressed: () {}, + ), + ), + Expanded( + flex: 1, + child: IconButton( + icon: Icon(Icons.phone), + color: Colors.red, + onPressed: () {}, + ), + ), + ], ), - ), - ], - ), - Divider(height: 1.2, color: Colors.grey) - ], - ), - ); - }, - ); + Divider(height: 1.2, color: Colors.grey) + ], + ), + ); + }, + ); } convertCityName(txt) { diff --git a/lib/pages/pharmacies/screens/product-details/footor/footer-widget.dart b/lib/pages/pharmacies/screens/product-details/footor/footer-widget.dart index bf45c539..14dab3e5 100644 --- a/lib/pages/pharmacies/screens/product-details/footor/footer-widget.dart +++ b/lib/pages/pharmacies/screens/product-details/footor/footer-widget.dart @@ -206,11 +206,15 @@ class _FooterWidgetState extends State { WELCOME_LOGIN, ); } else { - await widget.addToShoppingCartFunction(quantity: widget.quantity, itemID: widget.item.id, model: widget.model); - Navigator.push( - context, - FadePage(page: CartOrderPage()), - );} + await widget.addToShoppingCartFunction(quantity: widget.quantity, itemID: widget.item.id, model: widget.model); + Navigator.of(context).pushNamed( + CART_ORDER_PAGE, + ); + // Navigator.push( + // context, + // FadePage(page: CartOrderPage()), + // ); + } }, fontWeight: FontWeight.w600, borderColor: Colors.grey[800], @@ -224,7 +228,6 @@ class _FooterWidgetState extends State { ), ], ), - ); } diff --git a/lib/pages/pharmacies/screens/product-details/product-detail.dart b/lib/pages/pharmacies/screens/product-details/product-detail.dart index e34a5dbc..d33e3178 100644 --- a/lib/pages/pharmacies/screens/product-details/product-detail.dart +++ b/lib/pages/pharmacies/screens/product-details/product-detail.dart @@ -317,7 +317,9 @@ class __ProductDetailPageState extends State { } addToShoppingCartFunction({quantity, itemID, ProductDetailViewModel model}) async { + GifLoaderDialogUtils.showMyDialog(context); await model.addToCartData(quantity, itemID); + GifLoaderDialogUtils.hideDialog(context); } addToWishlistFunction({itemID, ProductDetailViewModel model}) async { diff --git a/lib/pages/pharmacies/widgets/home/PrescriptionsWidget.dart b/lib/pages/pharmacies/widgets/home/PrescriptionsWidget.dart index fabab916..61177d1f 100644 --- a/lib/pages/pharmacies/widgets/home/PrescriptionsWidget.dart +++ b/lib/pages/pharmacies/widgets/home/PrescriptionsWidget.dart @@ -3,19 +3,19 @@ import 'package:diplomaticquarterapp/core/viewModels/pharmacyModule/Prescription import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; import 'package:diplomaticquarterapp/locator.dart'; import 'package:diplomaticquarterapp/pages/base/base_view.dart'; +import 'package:diplomaticquarterapp/pages/medical/prescriptions/prescription_items_page.dart'; import 'package:diplomaticquarterapp/pages/medical/prescriptions/prescriptions_home_page.dart'; import 'package:diplomaticquarterapp/pages/pharmacies/widgets/home/ViewAllHomeWidget.dart'; import 'package:diplomaticquarterapp/uitl/date_uitl.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.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:provider/provider.dart'; import 'package:rating_bar/rating_bar.dart'; class PrescriptionsWidget extends StatelessWidget { - - AuthenticatedUserObject authenticatedUserObject = - locator(); + AuthenticatedUserObject authenticatedUserObject = locator(); @override Widget build(BuildContext context) { @@ -36,14 +36,25 @@ 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.18, + height: MediaQuery.of(context).size.height * 0.19, child: ListView.builder( - scrollDirection: Axis.horizontal, - shrinkWrap: true, - physics: ScrollPhysics(), - itemCount: model.prescriptionsList.length, - itemBuilder: (context, index) { - return Container( + scrollDirection: Axis.horizontal, + shrinkWrap: true, + physics: ScrollPhysics(), + itemCount: model.prescriptionsList.length, + itemBuilder: (context, index) { + return InkWell( + onTap: () { + Navigator.push( + context, + FadePage( + page: PrescriptionItemsPage( + prescriptions: model.prescriptionsList[index], + ), + ), + ); + }, + child: Container( padding: EdgeInsets.only(left: 8.0, right: 8.0), margin: EdgeInsets.only(right: 5.0, left: 5.0), decoration: BoxDecoration( @@ -57,29 +68,26 @@ class PrescriptionsWidget extends StatelessWidget { child: Column(crossAxisAlignment: CrossAxisAlignment.start, children: [ Row( children: [ - Column(children: [ - Container( - padding: EdgeInsets.only( - top: 10.0, - left: 10.0, - right: 10.0, - bottom: 10.0, - ), - child: CircleAvatar( - radius: 30, - backgroundColor: Colors.transparent, - child: Image.network( - model.prescriptionsList[index].doctorImageURL, - width: 60, - height: 60, - ), + Container( + padding: EdgeInsets.only( + top: 10.0, + left: 10.0, + right: 10.0, + bottom: 10.0, + ), + child: CircleAvatar( + radius: 30, + backgroundColor: Colors.transparent, + child: Image.network( + model.prescriptionsList[index].doctorImageURL, + width: 50, + height: 50, ), ), - ]), + ), Column( children: [ Container( - margin: EdgeInsets.only(left: 1), padding: EdgeInsets.only(left: 15.0, right: 15.0), decoration: BoxDecoration( border: Border.all( @@ -116,77 +124,71 @@ class PrescriptionsWidget extends StatelessWidget { ), ], ), - Row( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Container( - margin: EdgeInsets.only(left: 5), - child: Row(children: [ - Text( - model.prescriptionsList[index].doctorTitle.toString(), - style: TextStyle( - color: Colors.black, - fontSize: 15.0, - fontWeight: FontWeight.bold, - ), - ), - Text( - model.prescriptionsList[index].doctorName.toString(), - style: TextStyle( - color: Colors.black, - fontSize: 15.0, - fontWeight: FontWeight.bold, - ), - ), - ]), + Container( + margin: EdgeInsets.only(left: 5), + child: Row(children: [ + Text( + model.prescriptionsList[index].doctorTitle.toString(), + style: TextStyle( + color: Colors.black, + fontSize: 15.0, + fontWeight: FontWeight.bold, + ), ), - ], - ), - Row( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Container( - margin: EdgeInsets.only(left: 5), - child: Text( - model.prescriptionsList[index].clinicDescription.toString(), - style: TextStyle( - color: Colors.green, - fontSize: 15.0, -// fontWeight: FontWeight.bold, - ), + Text( + model.prescriptionsList[index].doctorName.toString(), + style: TextStyle( + color: Colors.black, + fontSize: 15.0, + fontWeight: FontWeight.bold, ), ), - ], + ]), ), - Row(crossAxisAlignment: CrossAxisAlignment.start, children: [ + Container( + margin: EdgeInsets.only(left: 5), + child: Text( + model.prescriptionsList[index].clinicDescription.toString(), + style: TextStyle( + color: Colors.green, + fontSize: 15.0, + ), + ), + ), + Row(children: [ Container( margin: EdgeInsets.only(left: 5), - child: Align( - alignment: Alignment.topLeft, - child: RatingBar.readOnly( - initialRating: model.prescriptionsList[index].actualDoctorRate.toDouble(), -// initialRating: productRate, - size: 15.0, - filledColor: Colors.yellow[700], - emptyColor: Colors.grey[500], - isHalfAllowed: true, - halfFilledIcon: Icons.star_half, - filledIcon: Icons.star, - emptyIcon: Icons.star, - ), + child: RatingBar.readOnly( + initialRating: model.prescriptionsList[index].actualDoctorRate.toDouble(), + size: 15.0, + filledColor: Colors.yellow[700], + emptyColor: Colors.grey[500], + isHalfAllowed: true, + halfFilledIcon: Icons.star_half, + filledIcon: Icons.star, + emptyIcon: Icons.star, ), - ) + ), + SizedBox( + width: 130.0, + ), + Container( + child: Icon( + Icons.arrow_forward, + color: Theme.of(context).primaryColor, + )), ]), ]), - ); - }), + ), + ); + }, + ), ), ], ), ), ) - : Container( - ), + : Container(), ); } } diff --git a/lib/pages/pharmacies/widgets/lacum-banner-widget.dart b/lib/pages/pharmacies/widgets/lacum-banner-widget.dart index a15b385d..7d10b886 100644 --- a/lib/pages/pharmacies/widgets/lacum-banner-widget.dart +++ b/lib/pages/pharmacies/widgets/lacum-banner-widget.dart @@ -125,7 +125,7 @@ class _LakumBannerWidgetState extends State { Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ - Texts(TranslationBase.of(context).IDENTIFICATION, + Texts(TranslationBase.of(context).identificationNumber, // "IDENTIFICATION #", fontSize: 14, fontWeight: FontWeight.bold, diff --git a/lib/pages/sub_categorise_page.dart b/lib/pages/sub_categorise_page.dart index 49ebf48d..e5a8b097 100644 --- a/lib/pages/sub_categorise_page.dart +++ b/lib/pages/sub_categorise_page.dart @@ -5,9 +5,10 @@ import 'package:diplomaticquarterapp/core/viewModels/pharmacy_categorise_view_mo 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/theme/colors.dart'; import 'package:diplomaticquarterapp/uitl/app_toast.dart'; -import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:diplomaticquarterapp/uitl/gif_loader_dialog_utils.dart'; +import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:diplomaticquarterapp/widgets/buttons/button.dart'; import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; import 'package:diplomaticquarterapp/widgets/others/StarRating.dart'; @@ -25,14 +26,12 @@ class SubCategorisePage extends StatefulWidget { String title; String parentId; - AuthenticatedUserObject authenticatedUserObject = - locator(); + AuthenticatedUserObject authenticatedUserObject = locator(); SubCategorisePage({this.id, this.parentId, this.title}); @override - _SubCategorisePageState createState() => - _SubCategorisePageState(id: id, title: title, parentId: parentId); + _SubCategorisePageState createState() => _SubCategorisePageState(id: id, title: title, parentId: parentId); } class _SubCategorisePageState extends State { @@ -54,15 +53,14 @@ class _SubCategorisePageState extends State { ); List entityList = List(); List entityListBrands = List(); + @override Widget build(BuildContext context) { TextEditingController minField = TextEditingController(); TextEditingController maxField = TextEditingController(); return BaseView( onModelReady: (model) => model.getSubCategorise(i: id), - builder: (BuildContext context, PharmacyCategoriseViewModel model, - Widget child) => - PharmacyAppScaffold( + builder: (BuildContext context, PharmacyCategoriseViewModel model, Widget child) => PharmacyAppScaffold( appBarTitle: title, isBottomBar: false, isShowAppBar: true, @@ -94,8 +92,7 @@ class _SubCategorisePageState extends State { ? 'https://uat.hmgwebservices.com/epharmacy/content/images/thumbs/0089195_diet-nutrition_2.png' : parentId == '9' ? 'https://uat.hmgwebservices.com/epharmacy/content/images/thumbs/0089196_household_2.png' - : parentId == - '10' + : parentId == '10' ? 'https://uat.hmgwebservices.com/epharmacy/content/images/thumbs/0089197_home-care-appliances_2.png' : '', fit: BoxFit.fill, @@ -107,14 +104,12 @@ class _SubCategorisePageState extends State { children: [ InkWell( child: Row( - mainAxisAlignment: - MainAxisAlignment.spaceBetween, + mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ Padding( padding: EdgeInsets.all(10.0), child: Container( - child: Texts(TranslationBase.of(context) - .viewCategorise), + child: Texts(TranslationBase.of(context).viewCategorise), ), ), Icon(Icons.arrow_forward) @@ -126,30 +121,21 @@ class _SubCategorisePageState extends State { context: context, builder: (BuildContext context) { return Container( - height: - MediaQuery.of(context).size.height * - 0.89, + height: MediaQuery.of(context).size.height * 0.89, color: Colors.white, child: Center( child: ListView.builder( scrollDirection: Axis.vertical, - itemCount: - model.subCategorise.length, - itemBuilder: (BuildContext context, - int index) { + itemCount: model.subCategorise.length, + itemBuilder: (BuildContext context, int index) { return Container( child: Padding( padding: EdgeInsets.all(8.0), child: InkWell( child: Column( - crossAxisAlignment: - CrossAxisAlignment - .start, + crossAxisAlignment: CrossAxisAlignment.start, children: [ - Texts(model - .subCategorise[ - index] - .name), + Texts(model.subCategorise[index].name), Divider( thickness: 0.6, color: Colors.black12, @@ -160,12 +146,8 @@ class _SubCategorisePageState extends State { Navigator.push( context, FadePage( - page: - FinalProductsPage( - id: model - .subCategorise[ - index] - .id, + page: FinalProductsPage( + id: model.subCategorise[index].id, ), ), ); @@ -198,23 +180,19 @@ class _SubCategorisePageState extends State { itemCount: model.subCategorise.length, itemBuilder: (BuildContext context, int index) { return Padding( - padding: - EdgeInsets.symmetric(horizontal: 8.0), + padding: EdgeInsets.symmetric(horizontal: 8.0), child: InkWell( child: Column( - crossAxisAlignment: - CrossAxisAlignment.center, + crossAxisAlignment: CrossAxisAlignment.center, children: [ Padding( - padding: EdgeInsets.symmetric( - horizontal: 13.0), + padding: EdgeInsets.symmetric(horizontal: 13.0), child: Container( height: 60.0, width: 65.0, decoration: BoxDecoration( shape: BoxShape.circle, - color: Colors.orange.shade200 - .withOpacity(0.45), + color: Colors.orange.shade200.withOpacity(0.45), ), child: Center( child: Icon( @@ -225,14 +203,8 @@ class _SubCategorisePageState extends State { ), ), Container( - width: MediaQuery.of(context) - .size - .width * - 0.17, - height: MediaQuery.of(context) - .size - .height * - 0.10, + width: MediaQuery.of(context).size.width * 0.17, + height: MediaQuery.of(context).size.height * 0.10, child: Center( child: Texts( model.subCategorise[index].name, @@ -293,21 +265,16 @@ class _SubCategorisePageState extends State { initialChildSize: 0.95, maxChildSize: 0.95, minChildSize: 0.9, - builder: (BuildContext context, - ScrollController scrollController) { + builder: (BuildContext context, ScrollController scrollController) { return SingleChildScrollView( controller: scrollController, child: Container( color: Colors.white, - height: MediaQuery.of(context) - .size - .height * - 1.95, + height: MediaQuery.of(context).size.height * 1.95, child: Column( children: [ Padding( - padding: - EdgeInsets.all(8.0), + padding: EdgeInsets.all(8.0), child: Row( children: [ Icon( @@ -317,30 +284,23 @@ class _SubCategorisePageState extends State { width: 10.0, ), Texts( - TranslationBase.of( - context) - .refine, + TranslationBase.of(context).refine, // 'Refine', - fontWeight: - FontWeight.w600, + fontWeight: FontWeight.w600, ), SizedBox( width: 250.0, ), InkWell( child: Texts( - TranslationBase.of( - context) - .closeIt, + TranslationBase.of(context).closeIt, // 'Close', color: Colors.red, - fontWeight: - FontWeight.w600, + fontWeight: FontWeight.w600, fontSize: 15.0, ), onTap: () { - Navigator.pop( - context); + Navigator.pop(context); }, ), ], @@ -353,39 +313,26 @@ class _SubCategorisePageState extends State { Column( children: [ ExpansionTile( - title: Texts( - TranslationBase.of( - context) - .categorise), + title: Texts(TranslationBase.of(context).categorise), children: [ ProcedureListWidget( model: model, - masterList: model - .subCategorise, - removeHistory: - (item) { + masterList: model.subCategorise, + removeHistory: (item) { setState(() { - entityList - .remove( - item); + entityList.remove(item); }); }, - addHistory: - (history) { + addHistory: (history) { setState(() { - entityList.add( - history); + entityList.add(history); }); }, - addSelectedHistories: - () { + addSelectedHistories: () { //TODO build your fun herr // widget.addSelectedHistories(); }, - isEntityListSelected: - (master) => - isEntityListSelected( - master), + isEntityListSelected: (master) => isEntityListSelected(master), ) ], ), @@ -394,40 +341,26 @@ class _SubCategorisePageState extends State { color: Colors.black12, ), ExpansionTile( - title: Texts( - TranslationBase.of( - context) - .brands), + title: Texts(TranslationBase.of(context).brands), children: [ ProcedureListWidget( model: model, - masterList: model - .brandsList, - removeHistory: - (item) { + masterList: model.brandsList, + removeHistory: (item) { setState(() { - entityListBrands - .remove( - item); + entityListBrands.remove(item); }); }, - addHistory: - (history) { + addHistory: (history) { setState(() { - entityListBrands - .add( - history); + entityListBrands.add(history); }); }, - addSelectedHistories: - () { + addSelectedHistories: () { //TODO build your fun herr // widget.addSelectedHistories(); }, - isEntityListSelected: - (master) => - isEntityListSelectedBrands( - master), + isEntityListSelected: (master) => isEntityListSelectedBrands(master), ) ], ), @@ -436,69 +369,43 @@ class _SubCategorisePageState extends State { color: Colors.black12, ), ExpansionTile( - title: Texts( - TranslationBase.of( - context) - .price), + title: Texts(TranslationBase.of(context).price), children: [ Container( - color: Color( - 0xffEEEEEE), + color: Color(0xffEEEEEE), child: Row( - mainAxisAlignment: - MainAxisAlignment - .spaceAround, + mainAxisAlignment: MainAxisAlignment.spaceAround, children: [ Column( - mainAxisAlignment: - MainAxisAlignment - .start, + mainAxisAlignment: MainAxisAlignment.start, children: [ - Texts( - 'Min'), + Texts('Min'), Container( - color: Colors - .white, - width: - 200, - height: - 40, - child: - TextFormField( - decoration: - InputDecoration( - border: - OutlineInputBorder(), + color: Colors.white, + width: 200, + height: 40, + child: TextFormField( + decoration: InputDecoration( + border: OutlineInputBorder(), ), - controller: - minField, + controller: minField, ), ), ], ), Column( - mainAxisAlignment: - MainAxisAlignment - .start, + mainAxisAlignment: MainAxisAlignment.start, children: [ - Texts( - 'Max'), + Texts('Max'), Container( - color: Colors - .white, - width: - 200, - height: - 40, - child: - TextFormField( - decoration: - InputDecoration( - border: - OutlineInputBorder(), + color: Colors.white, + width: 200, + height: 40, + child: TextFormField( + decoration: InputDecoration( + border: OutlineInputBorder(), ), - controller: - maxField, + controller: maxField, ), ), ], @@ -513,31 +420,20 @@ class _SubCategorisePageState extends State { color: Colors.black12, ), SizedBox( - height: MediaQuery.of( - context) - .size - .height * - 0.4, + height: MediaQuery.of(context).size.height * 0.4, ), Padding( - padding: - EdgeInsets.all(8.0), + padding: EdgeInsets.all(8.0), child: Row( - mainAxisAlignment: - MainAxisAlignment - .spaceEvenly, + mainAxisAlignment: MainAxisAlignment.spaceEvenly, children: [ Expanded( child: Container( width: 100, child: Button( - label: TranslationBase.of( - context) - .reset, + label: TranslationBase.of(context).reset, // 'Reset', - backgroundColor: - Colors - .red, + backgroundColor: Colors.red, ), ), ), @@ -547,66 +443,33 @@ class _SubCategorisePageState extends State { Container( width: 200, child: Button( - onTap: - () async { - String - categoriesId = - ""; - for (CategoriseParentModel category - in entityList) { - if (categoriesId == - "") { - categoriesId = - category - .id; + onTap: () async { + String categoriesId = ""; + for (CategoriseParentModel category in entityList) { + if (categoriesId == "") { + categoriesId = category.id; } else { - categoriesId = - "$categoriesId,${category.id}"; + categoriesId = "$categoriesId,${category.id}"; } } - String - brandIds = - ""; - for (CategoriseParentModel brand - in entityListBrands) { - if (brandIds == - "") { - brandIds = - brand - .id; + String brandIds = ""; + for (CategoriseParentModel brand in entityListBrands) { + if (brandIds == "") { + brandIds = brand.id; } else { - brandIds = - "$brandIds,${brand.id}"; + brandIds = "$brandIds,${brand.id}"; } } - GifLoaderDialogUtils - .showMyDialog( - context); + GifLoaderDialogUtils.showMyDialog(context); await model.getFilteredSubProducts( - min: minField - .text - .toString(), - max: maxField - .text - .toString(), - categoryId: - categoriesId, - brandId: - brandIds); - GifLoaderDialogUtils - .hideDialog( - context); - Navigator.pop( - context); + min: minField.text.toString(), max: maxField.text.toString(), categoryId: categoriesId, brandId: brandIds); + GifLoaderDialogUtils.hideDialog(context); + Navigator.pop(context); }, - label: TranslationBase.of( - context) - .apply, + label: TranslationBase.of(context).apply, // 'Apply', - backgroundColor: - Colors - .green, + backgroundColor: Colors.green, ), ), ], @@ -645,7 +508,7 @@ class _SubCategorisePageState extends State { styleTwo = true; styleIcon = Icon( Icons.auto_awesome_mosaic, - color: Colors.blue, + color: CustomColors.green, size: 29.0, ); } else { @@ -653,7 +516,7 @@ class _SubCategorisePageState extends State { styleTwo = false; styleIcon = Icon( Icons.widgets_sharp, - color: Colors.blue, + color: CustomColors.green, size: 29.0, ); } @@ -673,30 +536,22 @@ class _SubCategorisePageState extends State { model.subProducts.isNotEmpty ? styleOne == true ? Container( - height: model.subProducts.length * - MediaQuery.of(context).size.height * - 0.15, + height: model.subProducts.length * MediaQuery.of(context).size.height * 0.15, child: GridView.builder( physics: NeverScrollableScrollPhysics(), - gridDelegate: - SliverGridDelegateWithFixedCrossAxisCount( + gridDelegate: SliverGridDelegateWithFixedCrossAxisCount( crossAxisCount: 2, crossAxisSpacing: 0.5, mainAxisSpacing: 2.0, childAspectRatio: 0.9, ), itemCount: model.subProducts.length, - itemBuilder: - (BuildContext context, int index) { + itemBuilder: (BuildContext context, int index) { return NetworkBaseView( baseViewModel: model, child: InkWell( child: Card( - color: model.subProducts[index] - .discountName != - null - ? Color(0xffFFFF00) - : Colors.white, + color: model.subProducts[index].discountName != null ? Color(0xffFFFF00) : Colors.white, elevation: 0, shape: Border( right: BorderSide( @@ -722,118 +577,62 @@ class _SubCategorisePageState extends State { ), 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: 0), - width: MediaQuery.of(context) - .size - .width / - 3, + padding: EdgeInsets.symmetric(horizontal: 0), + width: MediaQuery.of(context).size.width / 3, child: Column( - crossAxisAlignment: - CrossAxisAlignment.start, + crossAxisAlignment: CrossAxisAlignment.start, children: [ Stack( children: [ Container( - margin: EdgeInsets - .fromLTRB( - 0, 16, 0, 0), - alignment: - Alignment.center, + margin: EdgeInsets.fromLTRB(0, 16, 0, 0), + alignment: Alignment.center, child: Image.network( - model - .subProducts[ - index] - .images - .isNotEmpty - ? model - .subProducts[ - index] - .images[0] - .thumb + model.subProducts[index].images.isNotEmpty + ? model.subProducts[index].images[0].thumb : 'https://upload.wikimedia.org/wikipedia/commons/thumb/6/6c/No_image_3x4.svg/1200px-No_image_3x4.svg.png', fit: BoxFit.cover, height: 80, ), ), Container( - width: model - .subProducts[ - index] - .rxMessage != - null - ? MediaQuery.of( - context) - .size - .width / - 5 - : 0, - padding: - EdgeInsets.all(4), - decoration: - BoxDecoration( - color: Color( - 0xffb23838), - borderRadius: - BorderRadius.only( - topLeft: Radius - .circular( - 6)), + width: model.subProducts[index].rxMessage != null ? MediaQuery.of(context).size.width / 5 : 0, + padding: EdgeInsets.all(4), + decoration: BoxDecoration( + color: Color(0xffb23838), + borderRadius: BorderRadius.only(topLeft: Radius.circular(6)), ), child: Texts( - model - .subProducts[ - index] - .rxMessage != - null - ? model - .subProducts[ - index] - .rxMessage - : "", + model.subProducts[index].rxMessage != null ? model.subProducts[index].rxMessage : "", color: Colors.white, regular: true, fontSize: 10, - fontWeight: - FontWeight.w400, + fontWeight: FontWeight.w400, ), ), ], ), Container( - margin: - EdgeInsets.symmetric( + margin: EdgeInsets.symmetric( horizontal: 6, vertical: 0, ), child: Column( - crossAxisAlignment: - CrossAxisAlignment - .start, + crossAxisAlignment: CrossAxisAlignment.start, children: [ Texts( - model - .subProducts[ - index] - .name, + model.subProducts[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.subProducts[index].price}", bold: true, @@ -843,25 +642,15 @@ class _SubCategorisePageState extends State { Row( children: [ StarRating( - totalAverage: model - .subProducts[ - index] - .approvedRatingSum > - 0 - ? (model.subProducts[index].approvedRatingSum.toDouble() / - model.subProducts[index].approvedRatingSum - .toDouble()) - .toDouble() + totalAverage: model.subProducts[index].approvedRatingSum > 0 + ? (model.subProducts[index].approvedRatingSum.toDouble() / model.subProducts[index].approvedRatingSum.toDouble()).toDouble() : 0, - forceStars: - true), + forceStars: true), Texts( "(${model.subProducts[index].approvedTotalReviews})", regular: true, fontSize: 10, - fontWeight: - FontWeight - .w400, + fontWeight: FontWeight.w400, ) ], ), @@ -876,9 +665,7 @@ class _SubCategorisePageState extends State { Navigator.push( context, FadePage( - page: ProductDetailPage( - model.subProducts[ - index]), + page: ProductDetailPage(model.subProducts[index]), )), }, )); @@ -886,14 +673,11 @@ class _SubCategorisePageState extends State { ), ) : Container( - height: model.subProducts.length * - MediaQuery.of(context).size.height * - 0.122, + height: model.subProducts.length * MediaQuery.of(context).size.height * 0.122, child: ListView.builder( physics: NeverScrollableScrollPhysics(), itemCount: model.subProducts.length, - itemBuilder: - (BuildContext context, int index) { + itemBuilder: (BuildContext context, int index) { return InkWell( child: Card( child: Row( @@ -903,11 +687,9 @@ class _SubCategorisePageState extends State { Column( children: [ Container( - decoration: - BoxDecoration(), + decoration: BoxDecoration(), child: Padding( - padding: - EdgeInsets.only( + padding: EdgeInsets.only( left: 9.0, top: 8.0, right: 10.0, @@ -915,71 +697,33 @@ class _SubCategorisePageState extends State { ), ), Container( - margin: EdgeInsets - .fromLTRB( - 0, 0, 0, 0), - alignment: - Alignment.center, - child: Image.network( - model - .subProducts[ - index] - .images - .isNotEmpty - ? model - .subProducts[ - index] - .images[0] - .thumb - : 'https://upload.wikimedia.org/wikipedia/commons/thumb/6/6c/No_image_3x4.svg/1200px-No_image_3x4.svg.png', + margin: EdgeInsets.fromLTRB(0, 0, 0, 0), + alignment: Alignment.center, + child: model.subProducts[index].images.isNotEmpty + ? Image.network( + model.subProducts[index].images[0].thumb, fit: BoxFit.contain, - height: 80, - ), + height: 70, + ) + : Text(TranslationBase.of(context).noImage), ), ], ), Column( children: [ Container( - width: model - .subProducts[ - 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)), + width: model.subProducts[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 - .subProducts[ - index] - .rxMessage != - null - ? model - .subProducts[ - index] - .rxMessage - : "", + model.subProducts[index].rxMessage != null ? model.subProducts[index].rxMessage : "", color: Colors.white, regular: true, fontSize: 10, - fontWeight: - FontWeight.w400, + fontWeight: FontWeight.w400, ), ), ], @@ -993,31 +737,19 @@ class _SubCategorisePageState extends State { vertical: 0, ), child: Column( - mainAxisAlignment: - MainAxisAlignment - .spaceAround, - crossAxisAlignment: - CrossAxisAlignment - .start, + mainAxisAlignment: MainAxisAlignment.spaceAround, + crossAxisAlignment: CrossAxisAlignment.start, children: [ SizedBox( height: 4.0, ), Container( - width: MediaQuery.of( - context) - .size - .width * - 0.65, + width: MediaQuery.of(context).size.width * 0.65, child: Texts( - model - .subProducts[ - index] - .name, + model.subProducts[index].name, regular: true, fontSize: 13.2, - fontWeight: - FontWeight.w500, + fontWeight: FontWeight.w500, maxLines: 5, ), ), @@ -1025,11 +757,7 @@ class _SubCategorisePageState extends State { height: 8.0, ), Padding( - padding: - const EdgeInsets - .only( - top: 4, - bottom: 4), + padding: const EdgeInsets.only(top: 4, bottom: 4), child: Texts( "SAR ${model.subProducts[index].price}", bold: true, @@ -1039,54 +767,41 @@ class _SubCategorisePageState extends State { Row( children: [ StarRating( - totalAverage: model - .subProducts[ - index] - .approvedRatingSum > - 0 - ? (model.subProducts[index].approvedRatingSum - .toDouble() / - model - .subProducts[index] - .approvedRatingSum - .toDouble()) - .toDouble() + totalAverage: model.subProducts[index].approvedRatingSum > 0 + ? (model.subProducts[index].approvedRatingSum.toDouble() / model.subProducts[index].approvedRatingSum.toDouble()).toDouble() : 0, forceStars: true), Texts( "(${model.subProducts[index].approvedTotalReviews})", regular: true, fontSize: 10, - fontWeight: - FontWeight.w400, + fontWeight: FontWeight.w400, ) ], ), ], ), ), - widget.authenticatedUserObject.isLogin? - Container( - child: IconButton( - icon: Icon(Icons.shopping_cart, - size: 18, - color: Colors.blue,), - onPressed: () async { - if(model.subProducts[index].rxMessage == null){ - GifLoaderDialogUtils.showMyDialog(context); - await addToCartFunction(1, model.subProducts[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: CustomColors.green, + ), + onPressed: () async { + if (model.subProducts[index].rxMessage == null) { + GifLoaderDialogUtils.showMyDialog(context); + await addToCartFunction(1, model.subProducts[index].id); + GifLoaderDialogUtils.hideDialog(context); + Navigator.push(context, FadePage(page: CartOrderPage())); + } else { + AppToast.showErrorToast(message: TranslationBase.of(context).needPrescription); + } + }), + ) + : Container(), ], ), ), @@ -1094,8 +809,7 @@ class _SubCategorisePageState extends State { Navigator.push( context, FadePage( - page: ProductDetailPage( - model.subProducts[index]), + page: ProductDetailPage(model.subProducts[index]), )), }, ); @@ -1137,8 +851,7 @@ class _SubCategorisePageState extends State { } bool isEntityListSelected(CategoriseParentModel masterKey) { - Iterable history = - entityList.where((element) => masterKey.id == element.id); + Iterable history = entityList.where((element) => masterKey.id == element.id); if (history.length > 0) { return true; } @@ -1146,13 +859,13 @@ class _SubCategorisePageState extends State { } bool isEntityListSelectedBrands(CategoriseParentModel masterKey) { - Iterable history = - entityListBrands.where((element) => masterKey.id == element.id); + Iterable history = entityListBrands.where((element) => masterKey.id == element.id); if (history.length > 0) { return true; } return false; } + addToCartFunction(quantity, itemID) async { ProductDetailViewModel x = new ProductDetailViewModel(); await x.addToCartData(quantity, itemID); diff --git a/lib/routes.dart b/lib/routes.dart index a8d850e1..72599bb2 100644 --- a/lib/routes.dart +++ b/lib/routes.dart @@ -14,8 +14,8 @@ import 'package:diplomaticquarterapp/pages/login/register-info.dart'; import 'package:diplomaticquarterapp/pages/login/register.dart'; import 'package:diplomaticquarterapp/pages/login/welcome.dart'; import 'package:diplomaticquarterapp/pages/packages_offers/OfferAndPackagesCartPage.dart'; -import 'package:diplomaticquarterapp/pages/packages_offers/OfferAndPackagesPage.dart'; import 'package:diplomaticquarterapp/pages/packages_offers/PackageOrderCompletedPage.dart'; +import 'package:diplomaticquarterapp/pages/pharmacies/screens/cart-page/cart-order-page.dart'; import 'package:diplomaticquarterapp/pages/settings/settings.dart'; import 'package:diplomaticquarterapp/pages/symptom-checker/info.dart'; import 'package:diplomaticquarterapp/pages/symptom-checker/select-gender.dart'; @@ -47,6 +47,7 @@ const String PACKAGES_OFFERS_CART = 'packages-offers-cart'; const String PACKAGES_ORDER_COMPLETED = 'packages-offers-cart'; const String TEST_PAGE = 'test-page'; const String OPENTOK_CALL_PAGE = 'OPENTOK_CALL_PAGE'; +const String CART_ORDER_PAGE = 'cart-order-page'; const String HEALTH_WEATHER = 'health-weather'; const APP_UPDATE = 'app-update'; @@ -74,9 +75,10 @@ var routes = { HEALTH_WEATHER: (_) => HealthWeatherIndicator(), APP_UPDATE: (_) => AppUpdatePage(), SETTINGS: (_) => Settings(), + CART_ORDER_PAGE: (_) => CartOrderPage(), OPENTOK_CALL_PAGE: (_) => OpenTokConnectCallPage( apiKey: '46209962', sessionId: '1_MX40NjIwOTk2Mn5-MTYzNDY0ODM3NDY2Nn5PcnpnNGM0R1Q3ODZ6UXlFQ01lMDF5YWJ-fg', - token: 'T1==cGFydG5lcl9pZD00NjIwOTk2MiZzaWc9Y2ZhZjMzZjA3MWFkMjkxN2JmYjEwZDkxYTRkOTdhN2NmNWE4YjMyYTpzZXNzaW9uX2lkPTFfTVg0ME5qSXdPVGsyTW41LU1UWXpORFkwT0RNM05EWTJObjVQY25wbk5HTTBSMVEzT0RaNlVYbEZRMDFsTURGNVlXSi1mZyZjcmVhdGVfdGltZT0xNjM0NjQ4Mzc1Jm5vbmNlPTAuNzczMzcxNDUxMDgzMjQyMyZyb2xlPW1vZGVyYXRvciZleHBpcmVfdGltZT0xNjM0NzM0Nzc1JmluaXRpYWxfbGF5b3V0X2NsYXNzX2xpc3Q9' - ), + token: + 'T1==cGFydG5lcl9pZD00NjIwOTk2MiZzaWc9Y2ZhZjMzZjA3MWFkMjkxN2JmYjEwZDkxYTRkOTdhN2NmNWE4YjMyYTpzZXNzaW9uX2lkPTFfTVg0ME5qSXdPVGsyTW41LU1UWXpORFkwT0RNM05EWTJObjVQY25wbk5HTTBSMVEzT0RaNlVYbEZRMDFsTURGNVlXSi1mZyZjcmVhdGVfdGltZT0xNjM0NjQ4Mzc1Jm5vbmNlPTAuNzczMzcxNDUxMDgzMjQyMyZyb2xlPW1vZGVyYXRvciZleHBpcmVfdGltZT0xNjM0NzM0Nzc1JmluaXRpYWxfbGF5b3V0X2NsYXNzX2xpc3Q9'), }; diff --git a/lib/uitl/translations_delegate_base.dart b/lib/uitl/translations_delegate_base.dart index 8db305d7..0bdfb6f7 100644 --- a/lib/uitl/translations_delegate_base.dart +++ b/lib/uitl/translations_delegate_base.dart @@ -1421,6 +1421,7 @@ class TranslationBase { String get enablingWifi => localizedValues['enablingWifi'][locale.languageCode]; String get offerAndPackages => localizedValues['offerAndPackages'][locale.languageCode]; + String get offerAndPackagesDetails => localizedValues['offerAndPackagesDetails'][locale.languageCode]; String get invoiceNo => localizedValues['InvoiceNo'][locale.languageCode]; @@ -2608,6 +2609,7 @@ class TranslationBase { String get laserClinic => localizedValues["laserClinic"][locale.languageCode]; + String get noImage => localizedValues["noImage"][locale.languageCode]; } class TranslationBaseDelegate extends LocalizationsDelegate { diff --git a/lib/widgets/others/app_scaffold_widget.dart b/lib/widgets/others/app_scaffold_widget.dart index d071d4d2..8772a60e 100644 --- a/lib/widgets/others/app_scaffold_widget.dart +++ b/lib/widgets/others/app_scaffold_widget.dart @@ -14,6 +14,7 @@ import 'package:diplomaticquarterapp/pages/landing/landing_page.dart'; import 'package:diplomaticquarterapp/pages/landing/landing_page_pharmcy.dart'; import 'package:diplomaticquarterapp/pages/pharmacies/screens/product-details/product-detail.dart'; import 'package:diplomaticquarterapp/pages/search_products_page.dart'; +import 'package:diplomaticquarterapp/routes.dart'; import 'package:diplomaticquarterapp/services/robo_search/event_provider.dart'; import 'package:diplomaticquarterapp/theme/colors.dart'; import 'package:diplomaticquarterapp/uitl/app_toast.dart'; @@ -493,7 +494,8 @@ class AppBarWidgetState extends State { icon: Badge(badgeContent: Text(orderPreviewViewModel.cartResponse.quantityCount.toString()), child: Icon(Icons.shopping_cart)), color: Colors.white, onPressed: () { - Navigator.of(context).popUntil(ModalRoute.withName('/')); + // Navigator.of(context).popUntil(ModalRoute.withName('/')); + Navigator.of(context).popAndPushNamed(CART_ORDER_PAGE); }) : Container(), (widget.isOfferPackages && widget.showOfferPackagesCart) diff --git a/lib/widgets/pharmacy/bottom_nav_pharmacy_item.dart b/lib/widgets/pharmacy/bottom_nav_pharmacy_item.dart index 6e6a5f53..9731f2b1 100644 --- a/lib/widgets/pharmacy/bottom_nav_pharmacy_item.dart +++ b/lib/widgets/pharmacy/bottom_nav_pharmacy_item.dart @@ -96,7 +96,7 @@ class BottomNavPharmacyItem extends StatelessWidget { fontWeight: currentIndex == index ? FontWeight.normal : FontWeight.w400, - fontSize: currentIndex == index ? 13 : 11, + fontSize: currentIndex == index ? 11 : 9, ), ], ),