From ce64da11e47c7a4f3670175e61d8c571ed251f22 Mon Sep 17 00:00:00 2001 From: Fatimah Alshammari Date: Tue, 9 Feb 2021 15:37:27 +0300 Subject: [PATCH 01/11] homepage and product details design --- android/app/proguard-rules.pro | 4 + android/build.gradle | 3 + .../gradle/wrapper/gradle-wrapper.properties | 2 +- lib/config/config.dart | 1 + .../pharmacies/recommendedProduct_model.dart | 881 ++++++++++++++++++ .../parmacyModule/parmacy_module_service.dart | 2 + .../parmacyModule/prescription_service.dart | 46 +- .../pharmacy_module_view_model.dart | 48 +- lib/locator.dart | 3 + lib/pages/pharmacies/product_detail.dart | 95 +- .../screens/pharmacy_module_page.dart | 201 +++- .../screens/recommended-product-page.dart | 165 ++++ lib/pages/pharmacy/profile/profile.dart | 46 +- .../recommendedProduct_service.dart | 39 + pubspec.yaml | 2 +- 15 files changed, 1434 insertions(+), 104 deletions(-) create mode 100644 android/app/proguard-rules.pro create mode 100644 lib/core/model/pharmacies/recommendedProduct_model.dart create mode 100644 lib/pages/pharmacies/screens/recommended-product-page.dart create mode 100644 lib/services/pharmacy_services/recommendedProduct_service.dart diff --git a/android/app/proguard-rules.pro b/android/app/proguard-rules.pro new file mode 100644 index 00000000..4ace459d --- /dev/null +++ b/android/app/proguard-rules.pro @@ -0,0 +1,4 @@ +-keep class tvi.webrtc.** { *; } +-keep class com.twilio.video.** { *; } +-keep class com.twilio.common.** { *; } +-keepattributes InnerClasses \ No newline at end of file diff --git a/android/build.gradle b/android/build.gradle index 433bc8ad..32bda0b1 100644 --- a/android/build.gradle +++ b/android/build.gradle @@ -3,6 +3,9 @@ buildscript { repositories { google() jcenter() +// maven { +// url "https://dl.bintray.com/kotlin/kotlin-eap/" +// } } dependencies { diff --git a/android/gradle/wrapper/gradle-wrapper.properties b/android/gradle/wrapper/gradle-wrapper.properties index c935be88..1f9de82f 100644 --- a/android/gradle/wrapper/gradle-wrapper.properties +++ b/android/gradle/wrapper/gradle-wrapper.properties @@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-6.7.1-all.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-6.8-all.zip diff --git a/lib/config/config.dart b/lib/config/config.dart index c82e401e..c351e988 100644 --- a/lib/config/config.dart +++ b/lib/config/config.dart @@ -360,6 +360,7 @@ const TRANSFER_YAHALA_LOYALITY_POINTS = const LAKUM_GET_USER_TERMS_AND_CONDITIONS = "Services/ERP.svc/REST/GetUserTermsAndConditionsForEPharmcy"; const PRESCRIPTION = 'Services/Patients.svc/REST/GetPrescriptionApptList'; +const GET_RECOMMENDED_PRODUCT = 'alsoProduct/'; // Home Health Care const HHC_GET_ALL_SERVICES = "Services/Patients.svc/REST/PatientER_HHC_GetAllServices"; diff --git a/lib/core/model/pharmacies/recommendedProduct_model.dart b/lib/core/model/pharmacies/recommendedProduct_model.dart new file mode 100644 index 00000000..ce17e2a8 --- /dev/null +++ b/lib/core/model/pharmacies/recommendedProduct_model.dart @@ -0,0 +1,881 @@ +class RecommendedProductModel { + String messageStatus; + List products; + + RecommendedProductModel({this.messageStatus, this.products}); + + RecommendedProductModel.fromJson(Map json) { + messageStatus = json['MessageStatus']; + if (json['products'] != null) { + products = new List(); + json['products'].forEach((v) { + products.add(new Products.fromJson(v)); + }); + } + } + + Map toJson() { + final Map data = new Map(); + data['MessageStatus'] = this.messageStatus; + if (this.products != null) { + data['products'] = this.products.map((v) => v.toJson()).toList(); + } + return data; + } +} + +class Products { + String id; + bool visibleIndividually; + String name; + String namen; + List localizedNames; + String shortDescription; + String shortDescriptionn; + String fullDescription; + String fullDescriptionn; + bool markasNew; + bool showOnHomePage; + Null metaKeywords; + Null metaDescription; + Null metaTitle; + bool allowCustomerReviews; + int approvedRatingSum; + int notApprovedRatingSum; + int approvedTotalReviews; + int notApprovedTotalReviews; + String sku; + bool isRx; + bool prescriptionRequired; + Null rxMessage; + Null rxMessagen; + Null manufacturerPartNumber; + Null gtin; + bool isGiftCard; + bool requireOtherProducts; + bool automaticallyAddRequiredProducts; + bool isDownload; + bool unlimitedDownloads; + int maxNumberOfDownloads; + Null downloadExpirationDays; + bool hasSampleDownload; + bool hasUserAgreement; + bool isRecurring; + int recurringCycleLength; + int recurringTotalCycles; + bool isRental; + int rentalPriceLength; + bool isShipEnabled; + bool isFreeShipping; + bool shipSeparately; + int additionalShippingCharge; + bool isTaxExempt; + bool isTelecommunicationsOrBroadcastingOrElectronicServices; + bool useMultipleWarehouses; + int manageInventoryMethodId; + int stockQuantity; + String stockAvailability; + String stockAvailabilityn; + bool displayStockAvailability; + bool displayStockQuantity; + int minStockQuantity; + int notifyAdminForQuantityBelow; + bool allowBackInStockSubscriptions; + int orderMinimumQuantity; + int orderMaximumQuantity; + Null allowedQuantities; + bool allowAddingOnlyExistingAttributeCombinations; + bool disableBuyButton; + bool disableWishlistButton; + bool availableForPreOrder; + Null preOrderAvailabilityStartDateTimeUtc; + bool callForPrice; + double price; + int oldPrice; + double productCost; + Null specialPrice; + Null specialPriceStartDateTimeUtc; + Null specialPriceEndDateTimeUtc; + bool customerEntersPrice; + int minimumCustomerEnteredPrice; + int maximumCustomerEnteredPrice; + bool basepriceEnabled; + int basepriceAmount; + int basepriceBaseAmount; + bool hasTierPrices; + bool hasDiscountsApplied; + Null discountName; + Null discountNamen; + Null discountDescription; + Null discountDescriptionn; + Null discountPercentage; + String currency; + String currencyn; + double weight; + int length; + int width; + int height; + Null availableStartDateTimeUtc; + Null availableEndDateTimeUtc; + int displayOrder; + bool published; + bool deleted; + String createdOnUtc; + String updatedOnUtc; + String productType; + int parentGroupedProductId; + List roleIds; + List discountIds; + List storeIds; + List manufacturerIds; + List reviews; + List images; + List attributes; + List specifications; + List associatedProductIds; + List tags; + int vendorId; + String seName; + + Products( + {this.id, + this.visibleIndividually, + this.name, + this.namen, + this.localizedNames, + this.shortDescription, + this.shortDescriptionn, + this.fullDescription, + this.fullDescriptionn, + this.markasNew, + this.showOnHomePage, + this.metaKeywords, + this.metaDescription, + this.metaTitle, + this.allowCustomerReviews, + this.approvedRatingSum, + this.notApprovedRatingSum, + this.approvedTotalReviews, + this.notApprovedTotalReviews, + this.sku, + this.isRx, + this.prescriptionRequired, + this.rxMessage, + this.rxMessagen, + this.manufacturerPartNumber, + this.gtin, + this.isGiftCard, + this.requireOtherProducts, + this.automaticallyAddRequiredProducts, + this.isDownload, + this.unlimitedDownloads, + this.maxNumberOfDownloads, + this.downloadExpirationDays, + this.hasSampleDownload, + this.hasUserAgreement, + this.isRecurring, + this.recurringCycleLength, + this.recurringTotalCycles, + this.isRental, + this.rentalPriceLength, + this.isShipEnabled, + this.isFreeShipping, + this.shipSeparately, + this.additionalShippingCharge, + this.isTaxExempt, + this.isTelecommunicationsOrBroadcastingOrElectronicServices, + this.useMultipleWarehouses, + this.manageInventoryMethodId, + this.stockQuantity, + this.stockAvailability, + this.stockAvailabilityn, + this.displayStockAvailability, + this.displayStockQuantity, + this.minStockQuantity, + this.notifyAdminForQuantityBelow, + this.allowBackInStockSubscriptions, + this.orderMinimumQuantity, + this.orderMaximumQuantity, + this.allowedQuantities, + this.allowAddingOnlyExistingAttributeCombinations, + this.disableBuyButton, + this.disableWishlistButton, + this.availableForPreOrder, + this.preOrderAvailabilityStartDateTimeUtc, + this.callForPrice, + this.price, + this.oldPrice, + this.productCost, + this.specialPrice, + this.specialPriceStartDateTimeUtc, + this.specialPriceEndDateTimeUtc, + this.customerEntersPrice, + this.minimumCustomerEnteredPrice, + this.maximumCustomerEnteredPrice, + this.basepriceEnabled, + this.basepriceAmount, + this.basepriceBaseAmount, + this.hasTierPrices, + this.hasDiscountsApplied, + this.discountName, + this.discountNamen, + this.discountDescription, + this.discountDescriptionn, + this.discountPercentage, + this.currency, + this.currencyn, + this.weight, + this.length, + this.width, + this.height, + this.availableStartDateTimeUtc, + this.availableEndDateTimeUtc, + this.displayOrder, + this.published, + this.deleted, + this.createdOnUtc, + this.updatedOnUtc, + this.productType, + this.parentGroupedProductId, + this.roleIds, + this.discountIds, + this.storeIds, + this.manufacturerIds, + this.reviews, + this.images, + this.attributes, + this.specifications, + this.associatedProductIds, + this.tags, + this.vendorId, + this.seName}); + + Products.fromJson(Map json) { + id = json['id']; + visibleIndividually = json['visible_individually']; + name = json['name']; + namen = json['namen']; + if (json['localized_names'] != null) { + localizedNames = new List(); + json['localized_names'].forEach((v) { + localizedNames.add(new LocalizedNames.fromJson(v)); + }); + } + shortDescription = json['short_description']; + shortDescriptionn = json['short_descriptionn']; + fullDescription = json['full_description']; + fullDescriptionn = json['full_descriptionn']; + markasNew = json['markas_new']; + showOnHomePage = json['show_on_home_page']; + metaKeywords = json['meta_keywords']; + metaDescription = json['meta_description']; + metaTitle = json['meta_title']; + allowCustomerReviews = json['allow_customer_reviews']; + approvedRatingSum = json['approved_rating_sum']; + notApprovedRatingSum = json['not_approved_rating_sum']; + approvedTotalReviews = json['approved_total_reviews']; + notApprovedTotalReviews = json['not_approved_total_reviews']; + sku = json['sku']; + isRx = json['is_rx']; + prescriptionRequired = json['prescription_required']; + rxMessage = json['rx_message']; + rxMessagen = json['rx_messagen']; + manufacturerPartNumber = json['manufacturer_part_number']; + gtin = json['gtin']; + isGiftCard = json['is_gift_card']; + requireOtherProducts = json['require_other_products']; + automaticallyAddRequiredProducts = + json['automatically_add_required_products']; + isDownload = json['is_download']; + unlimitedDownloads = json['unlimited_downloads']; + maxNumberOfDownloads = json['max_number_of_downloads']; + downloadExpirationDays = json['download_expiration_days']; + hasSampleDownload = json['has_sample_download']; + hasUserAgreement = json['has_user_agreement']; + isRecurring = json['is_recurring']; + recurringCycleLength = json['recurring_cycle_length']; + recurringTotalCycles = json['recurring_total_cycles']; + isRental = json['is_rental']; + rentalPriceLength = json['rental_price_length']; + isShipEnabled = json['is_ship_enabled']; + isFreeShipping = json['is_free_shipping']; + shipSeparately = json['ship_separately']; + additionalShippingCharge = json['additional_shipping_charge']; + isTaxExempt = json['is_tax_exempt']; + isTelecommunicationsOrBroadcastingOrElectronicServices = + json['is_telecommunications_or_broadcasting_or_electronic_services']; + useMultipleWarehouses = json['use_multiple_warehouses']; + manageInventoryMethodId = json['manage_inventory_method_id']; + stockQuantity = json['stock_quantity']; + stockAvailability = json['stock_availability']; + stockAvailabilityn = json['stock_availabilityn']; + displayStockAvailability = json['display_stock_availability']; + displayStockQuantity = json['display_stock_quantity']; + minStockQuantity = json['min_stock_quantity']; + notifyAdminForQuantityBelow = json['notify_admin_for_quantity_below']; + allowBackInStockSubscriptions = json['allow_back_in_stock_subscriptions']; + orderMinimumQuantity = json['order_minimum_quantity']; + orderMaximumQuantity = json['order_maximum_quantity']; + allowedQuantities = json['allowed_quantities']; + allowAddingOnlyExistingAttributeCombinations = + json['allow_adding_only_existing_attribute_combinations']; + disableBuyButton = json['disable_buy_button']; + disableWishlistButton = json['disable_wishlist_button']; + availableForPreOrder = json['available_for_pre_order']; + preOrderAvailabilityStartDateTimeUtc = + json['pre_order_availability_start_date_time_utc']; + callForPrice = json['call_for_price']; + price = json['price']; + oldPrice = json['old_price']; + productCost = json['product_cost']; + specialPrice = json['special_price']; + specialPriceStartDateTimeUtc = json['special_price_start_date_time_utc']; + specialPriceEndDateTimeUtc = json['special_price_end_date_time_utc']; + customerEntersPrice = json['customer_enters_price']; + minimumCustomerEnteredPrice = json['minimum_customer_entered_price']; + maximumCustomerEnteredPrice = json['maximum_customer_entered_price']; + basepriceEnabled = json['baseprice_enabled']; + basepriceAmount = json['baseprice_amount']; + basepriceBaseAmount = json['baseprice_base_amount']; + hasTierPrices = json['has_tier_prices']; + hasDiscountsApplied = json['has_discounts_applied']; + discountName = json['discount_name']; + discountNamen = json['discount_namen']; + discountDescription = json['discount_description']; + discountDescriptionn = json['discount_Descriptionn']; + discountPercentage = json['discount_percentage']; + currency = json['currency']; + currencyn = json['currencyn']; + weight = json['weight']; + length = json['length']; + width = json['width']; + height = json['height']; + availableStartDateTimeUtc = json['available_start_date_time_utc']; + availableEndDateTimeUtc = json['available_end_date_time_utc']; + displayOrder = json['display_order']; + published = json['published']; + deleted = json['deleted']; + createdOnUtc = json['created_on_utc']; + updatedOnUtc = json['updated_on_utc']; + productType = json['product_type']; + parentGroupedProductId = json['parent_grouped_product_id']; + if (json['role_ids'] != null) { + roleIds = new List(); + json['role_ids'].forEach((v) { + roleIds.add(null); + }); + } + if (json['discount_ids'] != null) { + discountIds = new List(); + json['discount_ids'].forEach((v) { + discountIds.add(null); + }); + } + if (json['store_ids'] != null) { + storeIds = new List(); + json['store_ids'].forEach((v) { + storeIds.add(null); + }); + } + manufacturerIds = json['manufacturer_ids'].cast(); + if (json['reviews'] != null) { + reviews = new List(); + json['reviews'].forEach((v) { + reviews.add(new Reviews.fromJson(v)); + }); + } + if (json['images'] != null) { + images = new List(); + json['images'].forEach((v) { + images.add(new Images.fromJson(v)); + }); + } + if (json['attributes'] != null) { + attributes = new List(); + json['attributes'].forEach((v) { + attributes.add(v); + }); + } + if (json['specifications'] != null) { + specifications = new List(); + json['specifications'].forEach((v) { + specifications.add(new Specifications.fromJson(v)); + }); + } + if (json['associated_product_ids'] != null) { + associatedProductIds = new List(); + json['associated_product_ids'].forEach((v) { + associatedProductIds.add(v); + }); + } + if (json['tags'] != null) { + tags = new List(); + json['tags'].forEach((v) { + tags.add(v); + }); + } + vendorId = json['vendor_id']; + seName = json['se_name']; + } + + Map toJson() { + final Map data = new Map(); + data['id'] = this.id; + data['visible_individually'] = this.visibleIndividually; + data['name'] = this.name; + data['namen'] = this.namen; + if (this.localizedNames != null) { + data['localized_names'] = + this.localizedNames.map((v) => v.toJson()).toList(); + } + data['short_description'] = this.shortDescription; + data['short_descriptionn'] = this.shortDescriptionn; + data['full_description'] = this.fullDescription; + data['full_descriptionn'] = this.fullDescriptionn; + data['markas_new'] = this.markasNew; + data['show_on_home_page'] = this.showOnHomePage; + data['meta_keywords'] = this.metaKeywords; + data['meta_description'] = this.metaDescription; + data['meta_title'] = this.metaTitle; + data['allow_customer_reviews'] = this.allowCustomerReviews; + data['approved_rating_sum'] = this.approvedRatingSum; + data['not_approved_rating_sum'] = this.notApprovedRatingSum; + data['approved_total_reviews'] = this.approvedTotalReviews; + data['not_approved_total_reviews'] = this.notApprovedTotalReviews; + data['sku'] = this.sku; + data['is_rx'] = this.isRx; + data['prescription_required'] = this.prescriptionRequired; + data['rx_message'] = this.rxMessage; + data['rx_messagen'] = this.rxMessagen; + data['manufacturer_part_number'] = this.manufacturerPartNumber; + data['gtin'] = this.gtin; + data['is_gift_card'] = this.isGiftCard; + data['require_other_products'] = this.requireOtherProducts; + data['automatically_add_required_products'] = + this.automaticallyAddRequiredProducts; + data['is_download'] = this.isDownload; + data['unlimited_downloads'] = this.unlimitedDownloads; + data['max_number_of_downloads'] = this.maxNumberOfDownloads; + data['download_expiration_days'] = this.downloadExpirationDays; + data['has_sample_download'] = this.hasSampleDownload; + data['has_user_agreement'] = this.hasUserAgreement; + data['is_recurring'] = this.isRecurring; + data['recurring_cycle_length'] = this.recurringCycleLength; + data['recurring_total_cycles'] = this.recurringTotalCycles; + data['is_rental'] = this.isRental; + data['rental_price_length'] = this.rentalPriceLength; + data['is_ship_enabled'] = this.isShipEnabled; + data['is_free_shipping'] = this.isFreeShipping; + data['ship_separately'] = this.shipSeparately; + data['additional_shipping_charge'] = this.additionalShippingCharge; + data['is_tax_exempt'] = this.isTaxExempt; + data['is_telecommunications_or_broadcasting_or_electronic_services'] = + this.isTelecommunicationsOrBroadcastingOrElectronicServices; + data['use_multiple_warehouses'] = this.useMultipleWarehouses; + data['manage_inventory_method_id'] = this.manageInventoryMethodId; + data['stock_quantity'] = this.stockQuantity; + data['stock_availability'] = this.stockAvailability; + data['stock_availabilityn'] = this.stockAvailabilityn; + data['display_stock_availability'] = this.displayStockAvailability; + data['display_stock_quantity'] = this.displayStockQuantity; + data['min_stock_quantity'] = this.minStockQuantity; + data['notify_admin_for_quantity_below'] = this.notifyAdminForQuantityBelow; + data['allow_back_in_stock_subscriptions'] = + this.allowBackInStockSubscriptions; + data['order_minimum_quantity'] = this.orderMinimumQuantity; + data['order_maximum_quantity'] = this.orderMaximumQuantity; + data['allowed_quantities'] = this.allowedQuantities; + data['allow_adding_only_existing_attribute_combinations'] = + this.allowAddingOnlyExistingAttributeCombinations; + data['disable_buy_button'] = this.disableBuyButton; + data['disable_wishlist_button'] = this.disableWishlistButton; + data['available_for_pre_order'] = this.availableForPreOrder; + data['pre_order_availability_start_date_time_utc'] = + this.preOrderAvailabilityStartDateTimeUtc; + data['call_for_price'] = this.callForPrice; + data['price'] = this.price; + data['old_price'] = this.oldPrice; + data['product_cost'] = this.productCost; + data['special_price'] = this.specialPrice; + data['special_price_start_date_time_utc'] = + this.specialPriceStartDateTimeUtc; + data['special_price_end_date_time_utc'] = this.specialPriceEndDateTimeUtc; + data['customer_enters_price'] = this.customerEntersPrice; + data['minimum_customer_entered_price'] = this.minimumCustomerEnteredPrice; + data['maximum_customer_entered_price'] = this.maximumCustomerEnteredPrice; + data['baseprice_enabled'] = this.basepriceEnabled; + data['baseprice_amount'] = this.basepriceAmount; + data['baseprice_base_amount'] = this.basepriceBaseAmount; + data['has_tier_prices'] = this.hasTierPrices; + data['has_discounts_applied'] = this.hasDiscountsApplied; + data['discount_name'] = this.discountName; + data['discount_namen'] = this.discountNamen; + data['discount_description'] = this.discountDescription; + data['discount_Descriptionn'] = this.discountDescriptionn; + data['discount_percentage'] = this.discountPercentage; + data['currency'] = this.currency; + data['currencyn'] = this.currencyn; + data['weight'] = this.weight; + data['length'] = this.length; + data['width'] = this.width; + data['height'] = this.height; + data['available_start_date_time_utc'] = this.availableStartDateTimeUtc; + data['available_end_date_time_utc'] = this.availableEndDateTimeUtc; + data['display_order'] = this.displayOrder; + data['published'] = this.published; + data['deleted'] = this.deleted; + data['created_on_utc'] = this.createdOnUtc; + data['updated_on_utc'] = this.updatedOnUtc; + data['product_type'] = this.productType; + data['parent_grouped_product_id'] = this.parentGroupedProductId; + if (this.roleIds != null) { + data['role_ids'] = this.roleIds.map((v) => v); + } + if (this.discountIds != null) { + data['discount_ids'] = this.discountIds.map((v) => v); + } + if (this.storeIds != null) { + data['store_ids'] = this.storeIds.map((v) => v); + } + data['manufacturer_ids'] = this.manufacturerIds; + if (this.reviews != null) { + data['reviews'] = this.reviews.map((v) => v.toJson()).toList(); + } + if (this.images != null) { + data['images'] = this.images.map((v) => v.toJson()).toList(); + } + if (this.attributes != null) { + data['attributes'] = this.attributes.map((v) => v); + } + if (this.specifications != null) { + data['specifications'] = + this.specifications.map((v) => v.toJson()).toList(); + } + if (this.associatedProductIds != null) { + data['associated_product_ids'] = + this.associatedProductIds.map((v) => v); + } + if (this.tags != null) { + data['tags'] = this.tags.map((v) => v); + } + data['vendor_id'] = this.vendorId; + data['se_name'] = this.seName; + return data; + } +} + +class LocalizedNames { + int languageId; + String localizedName; + + LocalizedNames({this.languageId, this.localizedName}); + + LocalizedNames.fromJson(Map json) { + languageId = json['language_id']; + localizedName = json['localized_name']; + } + + Map toJson() { + final Map data = new Map(); + data['language_id'] = this.languageId; + data['localized_name'] = this.localizedName; + return data; + } +} + +class Reviews { + int id; + int position; + int reviewId; + int customerId; + int productId; + int storeId; + bool isApproved; + String title; + String reviewText; + Null replyText; + int rating; + int helpfulYesTotal; + int helpfulNoTotal; + String createdOnUtc; + Customer customer; + Null product; + + Reviews( + {this.id, + this.position, + this.reviewId, + this.customerId, + this.productId, + this.storeId, + this.isApproved, + this.title, + this.reviewText, + this.replyText, + this.rating, + this.helpfulYesTotal, + this.helpfulNoTotal, + this.createdOnUtc, + this.customer, + this.product}); + + Reviews.fromJson(Map json) { + id = json['id']; + position = json['position']; + reviewId = json['review_id']; + customerId = json['customer_id']; + productId = json['product_id']; + storeId = json['store_id']; + isApproved = json['is_approved']; + title = json['title']; + reviewText = json['review_text']; + replyText = json['reply_text']; + rating = json['rating']; + helpfulYesTotal = json['helpful_yes_total']; + helpfulNoTotal = json['helpful_no_total']; + createdOnUtc = json['created_on_utc']; + customer = json['customer'] != null + ? new Customer.fromJson(json['customer']) + : null; + product = json['product']; + } + + Map toJson() { + final Map data = new Map(); + data['id'] = this.id; + data['position'] = this.position; + data['review_id'] = this.reviewId; + data['customer_id'] = this.customerId; + data['product_id'] = this.productId; + data['store_id'] = this.storeId; + data['is_approved'] = this.isApproved; + data['title'] = this.title; + data['review_text'] = this.reviewText; + data['reply_text'] = this.replyText; + data['rating'] = this.rating; + data['helpful_yes_total'] = this.helpfulYesTotal; + data['helpful_no_total'] = this.helpfulNoTotal; + data['created_on_utc'] = this.createdOnUtc; + if (this.customer != null) { + data['customer'] = this.customer.toJson(); + } + data['product'] = this.product; + return data; + } +} + +class Customer { + Null fileNumber; + Null iqamaNumber; + int isOutSa; + int patientType; + Null gender; + String birthDate; + Null phone; + Null countryCode; + Null yahalaAccountno; + Null billingAddress; + Null shippingAddress; + List addresses; + String id; + String username; + String email; + Null firstName; + Null lastName; + Null languageId; + Null adminComment; + Null isTaxExempt; + Null hasShoppingCartItems; + Null active; + Null deleted; + Null isSystemAccount; + Null systemName; + Null lastIpAddress; + Null createdOnUtc; + Null lastLoginDateUtc; + Null lastActivityDateUtc; + Null registeredInStoreId; + List roleIds; + + Customer( + {this.fileNumber, + this.iqamaNumber, + this.isOutSa, + this.patientType, + this.gender, + this.birthDate, + this.phone, + this.countryCode, + this.yahalaAccountno, + this.billingAddress, + this.shippingAddress, + this.addresses, + this.id, + this.username, + this.email, + this.firstName, + this.lastName, + this.languageId, + this.adminComment, + this.isTaxExempt, + this.hasShoppingCartItems, + this.active, + this.deleted, + this.isSystemAccount, + this.systemName, + this.lastIpAddress, + this.createdOnUtc, + this.lastLoginDateUtc, + this.lastActivityDateUtc, + this.registeredInStoreId, + this.roleIds}); + + Customer.fromJson(Map json) { + fileNumber = json['file_number']; + iqamaNumber = json['iqama_number']; + isOutSa = json['is_out_sa']; + patientType = json['patient_type']; + gender = json['gender']; + birthDate = json['birth_date']; + phone = json['phone']; + countryCode = json['country_code']; + yahalaAccountno = json['yahala_accountno']; + billingAddress = json['billing_address']; + shippingAddress = json['shipping_address']; + if (json['addresses'] != null) { + addresses = new List(); + json['addresses'].forEach((v) { + addresses.add(v); + }); + } + id = json['id']; + username = json['username']; + email = json['email']; + firstName = json['first_name']; + lastName = json['last_name']; + languageId = json['language_id']; + adminComment = json['admin_comment']; + isTaxExempt = json['is_tax_exempt']; + hasShoppingCartItems = json['has_shopping_cart_items']; + active = json['active']; + deleted = json['deleted']; + isSystemAccount = json['is_system_account']; + systemName = json['system_name']; + lastIpAddress = json['last_ip_address']; + createdOnUtc = json['created_on_utc']; + lastLoginDateUtc = json['last_login_date_utc']; + lastActivityDateUtc = json['last_activity_date_utc']; + registeredInStoreId = json['registered_in_store_id']; + if (json['role_ids'] != null) { + roleIds = new List(); + json['role_ids'].forEach((v) { + roleIds.add(null); + }); + } + } + + Map toJson() { + final Map data = new Map(); + data['file_number'] = this.fileNumber; + data['iqama_number'] = this.iqamaNumber; + data['is_out_sa'] = this.isOutSa; + data['patient_type'] = this.patientType; + data['gender'] = this.gender; + data['birth_date'] = this.birthDate; + data['phone'] = this.phone; + data['country_code'] = this.countryCode; + data['yahala_accountno'] = this.yahalaAccountno; + data['billing_address'] = this.billingAddress; + data['shipping_address'] = this.shippingAddress; + if (this.addresses != null) { + data['addresses'] = this.addresses.map((v) => v); + } + data['id'] = this.id; + data['username'] = this.username; + data['email'] = this.email; + data['first_name'] = this.firstName; + data['last_name'] = this.lastName; + data['language_id'] = this.languageId; + data['admin_comment'] = this.adminComment; + data['is_tax_exempt'] = this.isTaxExempt; + data['has_shopping_cart_items'] = this.hasShoppingCartItems; + data['active'] = this.active; + data['deleted'] = this.deleted; + data['is_system_account'] = this.isSystemAccount; + data['system_name'] = this.systemName; + data['last_ip_address'] = this.lastIpAddress; + data['created_on_utc'] = this.createdOnUtc; + data['last_login_date_utc'] = this.lastLoginDateUtc; + data['last_activity_date_utc'] = this.lastActivityDateUtc; + data['registered_in_store_id'] = this.registeredInStoreId; + if (this.roleIds != null) { + data['role_ids'] = this.roleIds.map((v) => v); + } + return data; + } +} + +class Images { + int id; + int position; + String src; + String thumb; + String attachment; + + Images({this.id, this.position, this.src, this.thumb, this.attachment}); + + Images.fromJson(Map json) { + id = json['id']; + position = json['position']; + src = json['src']; + thumb = json['thumb']; + attachment = json['attachment']; + } + + Map toJson() { + final Map data = new Map(); + data['id'] = this.id; + data['position'] = this.position; + data['src'] = this.src; + data['thumb'] = this.thumb; + data['attachment'] = this.attachment; + return data; + } +} + +class Specifications { + int id; + int displayOrder; + String defaultValue; + String defaultValuen; + String name; + String nameN; + + Specifications( + {this.id, + this.displayOrder, + this.defaultValue, + this.defaultValuen, + this.name, + this.nameN}); + + Specifications.fromJson(Map json) { + id = json['id']; + displayOrder = json['display_order']; + defaultValue = json['default_value']; + defaultValuen = json['default_valuen']; + name = json['name']; + nameN = json['nameN']; + } + + Map toJson() { + final Map data = new Map(); + data['id'] = this.id; + data['display_order'] = this.displayOrder; + data['default_value'] = this.defaultValue; + data['default_valuen'] = this.defaultValuen; + data['name'] = this.name; + data['nameN'] = this.nameN; + return data; + } +} \ No newline at end of file diff --git a/lib/core/service/parmacyModule/parmacy_module_service.dart b/lib/core/service/parmacyModule/parmacy_module_service.dart index 7f0a1050..3a2b8e63 100644 --- a/lib/core/service/parmacyModule/parmacy_module_service.dart +++ b/lib/core/service/parmacyModule/parmacy_module_service.dart @@ -21,6 +21,8 @@ class PharmacyModuleService extends BaseService { + + Future makeVerifyCustomer(dynamic data) async { Map queryParams = {'FileNumber': data['PatientID'].toString()}; hasError = false; diff --git a/lib/core/service/parmacyModule/prescription_service.dart b/lib/core/service/parmacyModule/prescription_service.dart index 7aafc9d3..e1e060a5 100644 --- a/lib/core/service/parmacyModule/prescription_service.dart +++ b/lib/core/service/parmacyModule/prescription_service.dart @@ -17,37 +17,41 @@ class PrescriptionService extends BaseService { List get prescriptionsList => _prescriptionsList; +// Future getPrescription() async { +// hasError = false; +// url = PRESCRIPTION; +// print("Print PRESCRIPTION url" + url); +// await baseAppClient.get(url, +// onSuccess: (dynamic response, int statusCode) { +// _prescriptionsList.clear(); +// response['PatientPrescriptionList'].forEach((item) { +// _prescriptionsList.add(Prescriptions.fromJson(item)); +// }); +// print(_prescriptionsList.length); +// print(response); +// }, onFailure: (String error, int statusCode) { +// hasError = true; +// super.error = error; +// }); +// } Future getPrescription() async { + url = PRESCRIPTION; + print("Print PRESCRIPTION url" + url); hasError = false; - url = PRESCRIPTION; - print("Print PRESCRIPTION url" + url); - await baseAppClient.get(url, + Map body = Map(); + body['isDentalAllowedBackend'] = false; + await baseAppClient.post(PRESCRIPTION, onSuccess: (dynamic response, int statusCode) { _prescriptionsList.clear(); - response['PatientPrescriptionList'].forEach((item) { - _prescriptionsList.add(Prescriptions.fromJson(item)); + response['PatientPrescriptionList'].forEach((prescriptions) { + _prescriptionsList.add(Prescriptions.fromJson(prescriptions)); }); print(_prescriptionsList.length); print(response); }, onFailure: (String error, int statusCode) { hasError = true; super.error = error; - }); + }, body: body); } -// Future getPrescription() async { -// hasError = false; -// Map body = Map(); -// body['isDentalAllowedBackend'] = false; -// await baseAppClient.post(PRESCRIPTION, -// onSuccess: (dynamic response, int statusCode) { -// prescriptionsList.clear(); -// response['PatientPrescriptionList'].forEach((prescriptions) { -// prescriptionsList.add(Prescriptions.fromJson(prescriptions)); -// }); -// }, onFailure: (String error, int statusCode) { -// hasError = true; -// super.error = error; -// }, body: body); -// } } \ No newline at end of file diff --git a/lib/core/viewModels/pharmacyModule/pharmacy_module_view_model.dart b/lib/core/viewModels/pharmacyModule/pharmacy_module_view_model.dart index bee7f654..a067a54d 100644 --- a/lib/core/viewModels/pharmacyModule/pharmacy_module_view_model.dart +++ b/lib/core/viewModels/pharmacyModule/pharmacy_module_view_model.dart @@ -4,11 +4,14 @@ import 'package:diplomaticquarterapp/core/model/pharmacies/Manufacturer.dart'; import 'package:diplomaticquarterapp/core/model/pharmacies/PharmacyImageObject.dart'; import 'package:diplomaticquarterapp/core/model/pharmacies/PharmacyProduct.dart'; import 'package:diplomaticquarterapp/core/model/pharmacies/Prescriptions.dart'; +import 'package:diplomaticquarterapp/core/model/pharmacies/recommendedProduct_model.dart'; +import 'package:diplomaticquarterapp/core/service/medical/prescriptions_service.dart'; //import 'package:diplomaticquarterapp/core/model/prescriptions/perscription_pharmacy.dart'; -//import 'package:diplomaticquarterapp/core/service/medical/prescriptions_service.dart'; import 'package:diplomaticquarterapp/core/service/parmacyModule/parmacy_module_service.dart'; import 'package:diplomaticquarterapp/core/service/parmacyModule/prescription_service.dart'; import 'package:diplomaticquarterapp/core/viewModels/base_view_model.dart'; +import 'package:diplomaticquarterapp/services/pharmacy_services/recommendedProduct_service.dart'; + import '../../../locator.dart'; @@ -17,6 +20,9 @@ class PharmacyModuleViewModel extends BaseViewModel { PrescriptionService _prescriptionService = locator(); + + RecommendedProductService _recommendedProductService = locator(); + List get bannerList => _pharmacyService.bannerItems; List get manufacturerList => _pharmacyService.manufacturerList; @@ -27,9 +33,14 @@ class PharmacyModuleViewModel extends BaseViewModel { List get lastVisitedProducts => _pharmacyService.lastVisitedProducts; + + List get recommendedProduct => + _recommendedProductService.recommendedProductList; + List get prescriptionsList => _prescriptionService.prescriptionsList; + // List get pharmacyPrescriptionsList => PharmacyProduct.pharmacyPrescriptionsList ; Future getPharmacyHomeData() async { @@ -104,15 +115,17 @@ class PharmacyModuleViewModel extends BaseViewModel { } /////////////RecommendedProducts -// _getRecommendedProducts() async { -// await _pharmacyService.getRecommendedProducts(); -// if (_pharmacyService.hasError) { -// error = _pharmacyService.error; -// setState(ViewState.Error); -// } else { -// setState(ViewState.Idle); -// } -// } + getRecommendedProducts(ProductId) async { + print("_____________________________________"); + print(ProductId); + await _recommendedProductService.getRecommendedProducts(ProductId.toString()); + if (_recommendedProductService.hasError) { + error = _recommendedProductService.error; + setState(ViewState.Error); + } else { + setState(ViewState.Idle); + } + } Future checkUserIsActivated() async { if (authenticatedUserObject.isLogin) { @@ -140,4 +153,19 @@ class PharmacyModuleViewModel extends BaseViewModel { } } + + ///////////////////////or +// getPrescriptions() async { +// setState(ViewState.Busy); +// await _prescriptionsService.getPrescriptions(); +// if (_prescriptionsService.hasError) { +// error = _prescriptionsService.error; +// setState(ViewState.Error); +// } else { +// _filterList(); +// await _getPrescriptionsOrders(); +// setState(ViewState.Idle); +// } +// } + } diff --git a/lib/locator.dart b/lib/locator.dart index 5e523456..956f969c 100644 --- a/lib/locator.dart +++ b/lib/locator.dart @@ -5,6 +5,7 @@ import 'package:diplomaticquarterapp/core/viewModels/AlHabibMedicalService/H2O_v import 'package:diplomaticquarterapp/core/viewModels/child_vaccines/user_information_view_model.dart'; import 'package:diplomaticquarterapp/core/viewModels/AlHabibMedicalService/home_health_care_view_model.dart'; import 'package:diplomaticquarterapp/core/viewModels/dashboard_view_model.dart'; +import 'package:diplomaticquarterapp/services/pharmacy_services/recommendedProduct_service.dart'; import 'package:diplomaticquarterapp/services/pharmacy_services/review_service.dart'; import 'package:diplomaticquarterapp/services/pharmacy_services/wishList_service.dart'; import 'package:diplomaticquarterapp/core/viewModels/pharmacyModule/PharmacyAddressesViewModel.dart'; @@ -204,6 +205,8 @@ void setupLocator() { locator.registerLazySingleton(() => TermsConditionService()); locator.registerLazySingleton(() => CancelOrderService()); locator.registerLazySingleton(() => PrescriptionService()); + locator.registerLazySingleton(() => RecommendedProductService()); + locator.registerLazySingleton(() => PrivilegeService()); locator.registerLazySingleton(() => WeatherService()); diff --git a/lib/pages/pharmacies/product_detail.dart b/lib/pages/pharmacies/product_detail.dart index ebb7fe39..06d4b858 100644 --- a/lib/pages/pharmacies/product_detail.dart +++ b/lib/pages/pharmacies/product_detail.dart @@ -277,30 +277,11 @@ class __ProductDetailPageState extends State { ), ), SizedBox( - height: 10, - ), - Container( - child: Text( - languageID == 'ar' - ? widget.product.shortDescriptionn - : widget.product.shortDescription, - style: TextStyle( - fontSize: 16, - fontFamily: 'WorkSans-Regular'), - ), - ), - SizedBox( - height: 10, - ), - Container( - child: Text( - TranslationBase.of(context).howToUse, - style: TextStyle( - fontSize: 17, - color: Colors.grey, - fontWeight: FontWeight.w600), - ), + height: 6, ), + Divider( + height: 1, + color: Colors.grey), SizedBox( height: 10, ), @@ -314,6 +295,37 @@ class __ProductDetailPageState extends State { fontFamily: 'WorkSans-Regular'), ), ), + SizedBox( + height: 10, + ), +// Container( +// child: Text( +// TranslationBase.of(context).howToUse, +// style: TextStyle( +// fontSize: 17, +// color: Colors.grey, +// fontWeight: FontWeight.w600), +// ), +// ), +// SizedBox( +// height: 6, +// ), +// Divider( +// height: 2, +// color: Colors.grey), +// SizedBox( +// height: 10, +// ), +// Container( +// child: Text( +// languageID == 'ar' +// ? widget.product.shortDescriptionn +// : widget.product.shortDescription, +// style: TextStyle( +// fontSize: 16, +// fontFamily: 'WorkSans-Regular'), +// ), +// ), ], ), ) @@ -765,6 +777,43 @@ class __ProductDetailPageState extends State { fontWeight: FontWeight.w600), ), ), + SizedBox( + height: 6, + ), + Divider( + height: 1, + color: Colors.grey), + SizedBox( + height: 10, + ), + Container( + child: Text( + languageID == 'ar' + ? widget.product.shortDescriptionn + : widget.product.shortDescription, + style: TextStyle( + fontSize: 16, + fontFamily: 'WorkSans-Regular'), + ), + ), + SizedBox( + height: 10, + ), + Container( + child: Text( + TranslationBase.of(context).howToUse, + style: TextStyle( + fontSize: 17, + color: Colors.grey, + fontWeight: FontWeight.w600), + ), + ), + SizedBox( + height: 6, + ), + Divider( + height: 2, + color: Colors.grey), SizedBox( height: 10, ), diff --git a/lib/pages/pharmacies/screens/pharmacy_module_page.dart b/lib/pages/pharmacies/screens/pharmacy_module_page.dart index b41c1804..3dfc94c9 100644 --- a/lib/pages/pharmacies/screens/pharmacy_module_page.dart +++ b/lib/pages/pharmacies/screens/pharmacy_module_page.dart @@ -1,34 +1,43 @@ + + +import 'package:diplomaticquarterapp/config/shared_pref_kay.dart'; import 'package:diplomaticquarterapp/config/size_config.dart'; +import 'package:diplomaticquarterapp/core/model/pharmacies/recommendedProduct_model.dart'; import 'package:diplomaticquarterapp/core/viewModels/pharmacyModule/pharmacy_module_view_model.dart'; import 'package:diplomaticquarterapp/pages/base/base_view.dart'; import 'package:diplomaticquarterapp/pages/landing/home_page.dart'; import 'package:diplomaticquarterapp/pages/medical/prescriptions/prescriptions_home_page.dart'; import 'package:diplomaticquarterapp/pages/offers_categorise_page.dart'; -import 'package:diplomaticquarterapp/pages/pharmacies/screens/cart-order-page.dart'; +import 'package:diplomaticquarterapp/pages/pharmacies/product-brands.dart'; +import 'package:diplomaticquarterapp/pages/pharmacies/screens/lacum-activitaion-vida-page.dart'; import 'package:diplomaticquarterapp/pages/pharmacies/screens/lakum-main-page.dart'; +import 'package:diplomaticquarterapp/pages/pharmacies/screens/recommended-product-page.dart'; import 'package:diplomaticquarterapp/pages/pharmacies/widgets/BannerPager.dart'; import 'package:diplomaticquarterapp/pages/pharmacies/widgets/ProductTileItem.dart'; import 'package:diplomaticquarterapp/pages/pharmacies/widgets/manufacturerItem.dart'; import 'package:diplomaticquarterapp/pages/pharmacy/pharmacyAddresses/PharmacyAddresses.dart'; +import 'package:diplomaticquarterapp/uitl/date_uitl.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:diplomaticquarterapp/widgets/buttons/borderedButton.dart'; import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart'; import 'package:flutter/material.dart'; -import 'package:flutter_svg/svg.dart'; import 'package:rating_bar/rating_bar.dart'; -import 'package:diplomaticquarterapp/pages/pharmacies/product-brands.dart'; - -import 'lacum-activitaion-vida-page.dart'; -import 'package:diplomaticquarterapp/widgets/data_display/medical/doctor_card.dart'; -import 'package:diplomaticquarterapp/core/viewModels/medical/prescriptions_view_model.dart'; +dynamic languageID; class PharmacyPage extends StatelessWidget { +// Products productModel ; + + getLanguageID() async { + languageID = await sharedPref.getString(APP_LANGUAGE); + } + List recommendedProductList = []; + var model; @override void initState() { -// print("model prescription " + model.prescriptionsList.length); -// cancelOrderDetail(order) + print("model recommended is " + model.recommendedProduct.length); + } @override @@ -77,10 +86,12 @@ class PharmacyPage extends StatelessWidget { ], ), ), - Container( - padding: EdgeInsets.symmetric(horizontal: 16.0, vertical: 24.0), - height: MediaQuery.of(context).size.height * 0.30, + height: model.prescriptionsList.length > 0 + ? MediaQuery.of(context).size.height * 0.28 + : 0, + padding: EdgeInsets.symmetric(horizontal: 18.0, vertical: 18.0), +// height: MediaQuery.of(context).size.height * 0.28, // width: 200.0, // height: MediaQuery.of(context).size.height / 4 + 20, margin: EdgeInsets.only(left: 10), @@ -93,13 +104,12 @@ class PharmacyPage extends StatelessWidget { shrinkWrap: true, physics: ScrollPhysics(), // physics: NeverScrollableScrollPhysics(), - // itemCount: 4, itemCount: model.prescriptionsList.length, itemBuilder: (context, index) { return Container( // width: 160.0, height: MediaQuery.of(context).size.height * 0.6, - padding: EdgeInsets.only(bottom: 5.0, left: 5.0), + padding: EdgeInsets.only(bottom: 5.0, left: 5.0, right: 8.0), margin: EdgeInsets.only(right: 10.0), decoration: BoxDecoration( border: Border.all( @@ -119,14 +129,18 @@ class PharmacyPage extends StatelessWidget { padding: EdgeInsets.only( top: 10.0, left: 10.0, - right: 3.0, + right: 10.0, bottom: 15.0, ), - child: Image.network( - model.prescriptionsList[index] - .doctorImageURL, - width: 60, - height: 60, + child: CircleAvatar( + radius: 30, + backgroundColor: Colors.transparent, + child: Image.network( + model.prescriptionsList[index] + .doctorImageURL, + width: 60, + height: 60, + ), ), ), ]), @@ -148,10 +162,14 @@ class PharmacyPage extends StatelessWidget { BorderRadius.circular( 30.0)), child: Text( - model.prescriptionsList[index] + languageID == "ar" + ? model.prescriptionsList[index] .isInOutPatientDescription - .toString(), - style: TextStyle( + .toString() + : model.prescriptionsList[index] + .isInOutPatientDescription + .toString(), + style: TextStyle( color: Colors.white, fontSize: 15.0, // fontWeight: FontWeight.bold, @@ -164,9 +182,10 @@ class PharmacyPage extends StatelessWidget { height: 30, ), Text( - model.prescriptionsList[index] - .appointmentDate - .toString(), +// DateUtil.getWeekDayMonthDayYearDateFormatted( + DateUtil.convertStringToDate(model.prescriptionsList[index] + .appointmentDate.toString()).toString().substring(0,10), +// ), style: TextStyle( color: Colors.black, fontSize: 15.0, @@ -235,6 +254,8 @@ class PharmacyPage extends StatelessWidget { child: Align( alignment: Alignment.topLeft, child: RatingBar.readOnly( + initialRating: + model.prescriptionsList[index].actualDoctorRate.toDouble(), // initialRating: productRate, size: 15.0, filledColor: Colors.yellow[700], @@ -250,7 +271,8 @@ class PharmacyPage extends StatelessWidget { ]), ); }) - : Container(), + : Container( + ), ), ), Container( @@ -269,20 +291,118 @@ class PharmacyPage extends StatelessWidget { textColor: Colors.green, vPadding: 6, hPadding: 4, - handler: () {}, + handler: () { + Navigator.push( + context, + MaterialPageRoute( + builder: (context) => + RecommendedProductPage())); + }, ), ], ), ), Container( - height: MediaQuery.of(context).size.height / 4 + 20, - child: ListView.builder( - itemBuilder: (ctx, i) => - ProductTileItem(model.bestSellerProduct[i]), - scrollDirection: Axis.horizontal, - itemCount: model.bestSellerProduct.length, - ), + height: model.recommendedProduct.length > 0 + ? MediaQuery.of(context).size.height * 0.28 + : 0, + padding: EdgeInsets.symmetric(horizontal: 16.0, vertical: 22.0), + margin: EdgeInsets.only(left: 10), + child:BaseView( + onModelReady: (model) => model.getRecommendedProducts(4561 ), + builder: (_, model, wi) => model.recommendedProduct[0].products.length > 0 + ? ListView.builder( +// itemBuilder: (ctx, i) => +// ProductTileItem(model.recommendedProduct[i]), +// scrollDirection: Axis.horizontal, +// itemCount: model.recommendedProduct.length, + scrollDirection: Axis.horizontal, + shrinkWrap: true, + physics: ScrollPhysics(), + // physics: NeverScrollableScrollPhysics(), + itemCount: model.recommendedProduct[0].products.length, + itemBuilder: (context, index) { + return Container( + height: MediaQuery.of(context).size.height * 0.6, + padding: EdgeInsets.only(bottom: 5.0, left: 5.0, right: 8.0), + margin: EdgeInsets.only(right: 10.0), + decoration: BoxDecoration( + border: Border.all( + color: Colors.grey, + style: BorderStyle.solid, + width: 1.0, + ), + color: Colors.white, + borderRadius: BorderRadius.circular(10.0)), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Container( + margin: EdgeInsets.fromLTRB(0, 16, 0, 0), + alignment: Alignment.center, + child: (model.recommendedProduct[0].products[index].images != null && + model.recommendedProduct[0].products[index].images.length > 0) + ? Image.network( + model.recommendedProduct[0].products[index].images[0].src.toString(), +// item.images[0].src, + fit: BoxFit.cover, + height: 80, + ) + : Image.asset( + "assets/images/no_image.png", + fit: BoxFit.cover, + height: 80, + ), + ), + Text( + model.recommendedProduct[0].products[index].shortDescription + .toString(), + style: TextStyle( + color: Colors.green, + fontSize: 15.0, +// fontWeight: FontWeight.bold, + ), + ), + Padding( + padding: const EdgeInsets.only(top: 4, bottom: 4), + child: Texts( + "SAR ${model.recommendedProduct[0].products[index].price}", + bold: true, + fontSize: 14, + ), + ), + Row( + crossAxisAlignment: + CrossAxisAlignment.start, + children: [ +// Container( +// margin: EdgeInsets.only(left: 5), +// child: Align( +// alignment: Alignment.topLeft, +// child: RatingBar.readOnly( +// initialRating: +// model.recommendedProduct[0].products[index].reviews.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, +// ), +// ), +// ), + ]), + ], + ), + ); + } + ): Container( +// child: Text("NO DATA"), + ), ), + ), Container( margin: EdgeInsets.fromLTRB(10, 0, 10, 0), @@ -522,4 +642,15 @@ class GridViewCard extends StatelessWidget { ), ); } + + String getDate(String date) { + DateTime dateObj = DateUtil.convertStringToDate(date); + return DateUtil.getWeekDay(dateObj.weekday) + + ", " + + dateObj.day.toString() + + " " + + DateUtil.getMonth(dateObj.month) + + " " + + dateObj.year.toString(); + } } diff --git a/lib/pages/pharmacies/screens/recommended-product-page.dart b/lib/pages/pharmacies/screens/recommended-product-page.dart new file mode 100644 index 00000000..7d2d4c71 --- /dev/null +++ b/lib/pages/pharmacies/screens/recommended-product-page.dart @@ -0,0 +1,165 @@ + + +import 'package:diplomaticquarterapp/core/viewModels/pharmacyModule/pharmacy_module_view_model.dart'; +import 'package:diplomaticquarterapp/pages/base/base_view.dart'; +import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; +import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; +import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; +import 'package:flutter/material.dart'; +import 'package:rating_bar/rating_bar.dart'; + +class RecommendedProductPage extends StatefulWidget { + @override + _RecommendedProductPageState createState() => _RecommendedProductPageState(); +} + +class _RecommendedProductPageState extends State + with SingleTickerProviderStateMixin{ + @override + void initState() { + super.initState(); + + } + + @override + Widget build(BuildContext context) { + return BaseView( + onModelReady: (model) => model.getRecommendedProducts(4561), + builder: (_,model, wi )=> AppScaffold( + appBarTitle:TranslationBase.of(context).recommended, + baseViewModel: model, + isShowAppBar: true, + isPharmacy:true , + body: Column( + children: [ +// Text( +// "4455" + "Result", +// style: TextStyle( +// color: Colors.black, +// fontSize: 13.0, +// ), +// ), +// SizedBox( +// height: 10, +// ), +// Divider( +// color: Colors.grey[350], +// height: 10, +// thickness: 6, +// indent: 0, +// endIndent: 0, +// ), + GridView.count( + crossAxisCount: 2 , + children: List.generate(30,(index){ + return Container( + child: Card( + color: Colors.blue, + child: Container( + height: model.recommendedProduct.length > 0 + ? MediaQuery.of(context).size.height * 0.28 + : 0, + padding: EdgeInsets.symmetric(horizontal: 16.0, vertical: 18.0), +// margin: EdgeInsets.only(left: 10), + child:BaseView( + onModelReady: (model) => model.getRecommendedProducts(4561 ), + builder: (_, model, wi) => model.recommendedProduct[0].products.length > 0 + ? ListView.builder( +// itemBuilder: (ctx, i) => +// ProductTileItem(model.recommendedProduct[i]), +// scrollDirection: Axis.horizontal, +// itemCount: model.recommendedProduct.length, + scrollDirection: Axis.vertical, + shrinkWrap: true, + physics: ScrollPhysics(), + // physics: NeverScrollableScrollPhysics(), + itemCount: model.recommendedProduct[0].products.length, + itemBuilder: (context, index) { + return Container( + height: MediaQuery.of(context).size.height * 0.6, + padding: EdgeInsets.only(bottom: 5.0, left: 5.0, right: 8.0), + margin: EdgeInsets.only(right: 10.0), + decoration: BoxDecoration( + border: Border.all( + color: Colors.grey, + style: BorderStyle.solid, + width: 1.0,), + color: Colors.white, + borderRadius: BorderRadius.circular(10.0)), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Container( + margin: EdgeInsets.fromLTRB(0, 16, 0, 0), + alignment: Alignment.center, + child: (model.recommendedProduct[0].products[index].images != null && + model.recommendedProduct[0].products[index].images.length > 0) + ? Image.network( + model.recommendedProduct[0].products[index].images[0].src.toString(), +// item.images[0].src, + fit: BoxFit.cover, + height: 80, + ) + : Image.asset( + "assets/images/no_image.png", + fit: BoxFit.cover, + height: 80, + ), + ), + Text( + model.recommendedProduct[0].products[index].shortDescription + .toString(), + style: TextStyle( + color: Colors.green, + fontSize: 15.0, +// fontWeight: FontWeight.bold, + ), + ), + Padding( + padding: const EdgeInsets.only(top: 4, bottom: 4), + child: Texts( + "SAR ${model.recommendedProduct[0].products[index].price}", + bold: true, + fontSize: 14, + ), + ), + Row( + crossAxisAlignment: + CrossAxisAlignment.start, + children: [ +// Container( +// margin: EdgeInsets.only(left: 5), +// child: Align( +// alignment: Alignment.topLeft, +// child: RatingBar.readOnly( +// initialRating: +// model.recommendedProduct[0].products[index].reviews.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, +// ), +// ), +// ), + ]), + ], + ), + ); + } + ): Container( +// child: Text("NO DATA"), + ), + ), + ), + ), + ); + }), + ), + ] ), + ), + ); + }} \ No newline at end of file diff --git a/lib/pages/pharmacy/profile/profile.dart b/lib/pages/pharmacy/profile/profile.dart index fb1e1c2a..dd908643 100644 --- a/lib/pages/pharmacy/profile/profile.dart +++ b/lib/pages/pharmacy/profile/profile.dart @@ -119,22 +119,42 @@ class _ProfilePageState extends State { bottom: 10.0, ), child: LargeAvatar( - name: "profile", + name: user.firstName.toString(), url: '', ), ), - Text( - languageID == "ar" - ? user.firstNameN.toString() + - " " + - user.lastNameN.toString() - : user.firstName.toString() + - " " + - user.lastName.toString(), - style: TextStyle( - fontSize: 14.0, - fontWeight: FontWeight.bold), - ), + Column( + children: [ + Row( + children: [ + Text( + TranslationBase.of(context).welcome, + style: TextStyle( + fontSize: 14.0, + fontWeight: FontWeight.bold, + color: Colors.grey), + ), + ] ), + SizedBox( + height: 10, + ), + Row( + children: [ + Text( + languageID == "ar" + ? user.firstNameN.toString() + + " " + + user.lastNameN.toString() + : user.firstName.toString() + + " " + + user.lastName.toString(), + style: TextStyle( + fontSize: 14.0, + fontWeight: FontWeight.bold), + ), + ] ), + ] ), + ], ), ) diff --git a/lib/services/pharmacy_services/recommendedProduct_service.dart b/lib/services/pharmacy_services/recommendedProduct_service.dart new file mode 100644 index 00000000..32fe0a67 --- /dev/null +++ b/lib/services/pharmacy_services/recommendedProduct_service.dart @@ -0,0 +1,39 @@ +import 'package:diplomaticquarterapp/config/config.dart'; +import 'package:diplomaticquarterapp/config/shared_pref_kay.dart'; +import 'package:diplomaticquarterapp/core/model/pharmacies/recommendedProduct_model.dart'; +import 'package:diplomaticquarterapp/core/service/base_service.dart'; +import 'package:diplomaticquarterapp/models/Authentication/authenticated_user.dart'; +import 'package:diplomaticquarterapp/services/authentication/auth_provider.dart'; +import 'package:diplomaticquarterapp/uitl/app_shared_preferences.dart'; +import 'package:flutter/material.dart'; + + + +class RecommendedProductService extends BaseService{ + AppSharedPreferences sharedPref = AppSharedPreferences(); + AppGlobal appGlobal = new AppGlobal(); + AuthenticatedUser authUser = new AuthenticatedUser(); + AuthProvider authProvider = new AuthProvider(); + + List _recommendedProductList = List(); + List get recommendedProductList => _recommendedProductList; + String url =""; + + Future getRecommendedProducts(ProductId) async { + hasError = false; + url =GET_RECOMMENDED_PRODUCT+ProductId; + print("Recommended Product is"+url); + + await baseAppClient.getPharmacy(url, + onSuccess: (dynamic response, int statusCode) { + _recommendedProductList.clear(); + + response['products'].forEach((item) { + }); + print("print recommended items" + _recommendedProductList.length.toString()); + print(response); + }, onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + }); + }} \ No newline at end of file diff --git a/pubspec.yaml b/pubspec.yaml index 24589cbb..bc8ebf5b 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -157,7 +157,7 @@ dependencies: # recase: ^3.0.0 wakelock: ^0.1.4 after_layout: ^1.0.7 - twilio_programmable_video: ^0.5.0+3 + twilio_programmable_video: ^0.6.3+1 flutter_tts: ^1.2.6 wifi: ^0.1.5 From 292e98361486492d525d299f70a3d1d184fcffbf Mon Sep 17 00:00:00 2001 From: enadhilal Date: Mon, 15 Feb 2021 11:21:17 +0300 Subject: [PATCH 02/11] fixing issues --- lib/config/config.dart | 2 +- .../health-calculator/bariatrics-service.dart | 2 +- .../health-calculator/Bariatrics-viewmodel.dart | 2 +- lib/pages/pharmacies/product-brands.dart | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/config/config.dart b/lib/config/config.dart index 03f09dfc..b910e955 100644 --- a/lib/config/config.dart +++ b/lib/config/config.dart @@ -227,7 +227,7 @@ const GET_PATIENT_HEALTH_STATS = 'Services/Patients.svc/REST/Med_GetTransactions const CHANNEL = 3; const GENERAL_ID = 'Cs2020@2016\$2958'; const IP_ADDRESS = '10.20.10.20'; -const VERSION_ID = 5.8; +const VERSION_ID = 8.8; const SETUP_ID = '91877'; const LANGUAGE = 2; const PATIENT_OUT_SA = 0; diff --git a/lib/core/service/AlHabibMedicalService/health-calculator/bariatrics-service.dart b/lib/core/service/AlHabibMedicalService/health-calculator/bariatrics-service.dart index d0e41321..b59eadac 100644 --- a/lib/core/service/AlHabibMedicalService/health-calculator/bariatrics-service.dart +++ b/lib/core/service/AlHabibMedicalService/health-calculator/bariatrics-service.dart @@ -1,6 +1,6 @@ import 'package:diplomaticquarterapp/config/config.dart'; import 'package:diplomaticquarterapp/config/shared_pref_kay.dart'; -import 'file:///C:/Users/admin/AndroidStudioProjects/diplomatic-quarter/lib/core/model/AlHabibMedicalService/HealthCalculator/ClinicCategory.dart'; +import 'package:diplomaticquarterapp/core/model/AlHabibMedicalService/HealthCalculator/ClinicCategory.dart'; import 'package:diplomaticquarterapp/core/model/AlHabibMedicalService/HealthCalculator/DiseasesByClinic.dart'; import 'package:diplomaticquarterapp/core/service/base_service.dart'; diff --git a/lib/core/viewModels/AlHabibMedicalService/health-calculator/Bariatrics-viewmodel.dart b/lib/core/viewModels/AlHabibMedicalService/health-calculator/Bariatrics-viewmodel.dart index 551245d4..369c668b 100644 --- a/lib/core/viewModels/AlHabibMedicalService/health-calculator/Bariatrics-viewmodel.dart +++ b/lib/core/viewModels/AlHabibMedicalService/health-calculator/Bariatrics-viewmodel.dart @@ -1,6 +1,6 @@ import 'package:diplomaticquarterapp/core/enum/viewstate.dart'; import 'package:diplomaticquarterapp/core/model/AlHabibMedicalService/HealthCalculator/DiseasesByClinic.dart'; -import 'file:///C:/Users/admin/AndroidStudioProjects/diplomatic-quarter/lib/core/model/AlHabibMedicalService/HealthCalculator/ClinicCategory.dart'; +import 'package:diplomaticquarterapp/core/model/AlHabibMedicalService/HealthCalculator/ClinicCategory.dart'; import 'package:diplomaticquarterapp/core/service/AlHabibMedicalService/health-calculator/bariatrics-service.dart'; import 'package:diplomaticquarterapp/core/viewModels/base_view_model.dart'; diff --git a/lib/pages/pharmacies/product-brands.dart b/lib/pages/pharmacies/product-brands.dart index b9e6db95..b2ef5f4e 100644 --- a/lib/pages/pharmacies/product-brands.dart +++ b/lib/pages/pharmacies/product-brands.dart @@ -103,7 +103,7 @@ class _ProductBrandsPageState extends State { height: 10, ), Container( - height: 230, + height: 290, width: double.infinity, color: Colors.white, child: ListView.builder( From ac32ba998cd7e461b983b20b8c4d668a7a8843bb Mon Sep 17 00:00:00 2001 From: Fatimah Alshammari Date: Wed, 24 Feb 2021 09:56:58 +0300 Subject: [PATCH 03/11] fixed order isuee --- assets/images/pharmacy/Redheart.svg | 6 + assets/images/pharmacy/heart-empty.svg | 3 + assets/images/pharmacy/sort.png | Bin 0 -> 212 bytes lib/config/config.dart | 2 +- lib/config/localized_values.dart | 1 + lib/core/model/pharmacies/order_model.dart | 83 +- lib/core/model/pharmacies/orders_model.dart | 15 +- .../pharmacies/recommendedProduct_model.dart | 717 +++--------- .../parmacyModule/prescription_service.dart | 35 +- .../pharmacy_module_view_model.dart | 14 +- lib/pages/pharmacies/product_detail.dart | 61 +- .../screens/pharmacy_module_page.dart | 363 ++++-- .../screens/recommended-product-page.dart | 1035 +++++++++++++++-- lib/pages/pharmacy/order/Order.dart | 1 + lib/pages/pharmacy/order/OrderDetails.dart | 188 +-- .../recommendedProduct_service.dart | 21 +- lib/uitl/translations_delegate_base.dart | 1 + 17 files changed, 1574 insertions(+), 972 deletions(-) create mode 100644 assets/images/pharmacy/Redheart.svg create mode 100644 assets/images/pharmacy/heart-empty.svg create mode 100644 assets/images/pharmacy/sort.png diff --git a/assets/images/pharmacy/Redheart.svg b/assets/images/pharmacy/Redheart.svg new file mode 100644 index 00000000..3bba67fa --- /dev/null +++ b/assets/images/pharmacy/Redheart.svg @@ -0,0 +1,6 @@ + + + + + + diff --git a/assets/images/pharmacy/heart-empty.svg b/assets/images/pharmacy/heart-empty.svg new file mode 100644 index 00000000..a682a44e --- /dev/null +++ b/assets/images/pharmacy/heart-empty.svg @@ -0,0 +1,3 @@ + + + diff --git a/assets/images/pharmacy/sort.png b/assets/images/pharmacy/sort.png new file mode 100644 index 0000000000000000000000000000000000000000..0143d915e43fb9f638c50badb8626474e49c4674 GIT binary patch literal 212 zcmeAS@N?(olHy`uVBq!ia0vp^fIEHA5CZ{AM{NO(# z!l>3&!XJNjL4&H8bpkh=*n$U+IYJgk>>dcns~qZaD7RoRtZMqrA+np{hzoO0V^u@O hU5C~kOw&}t85r!IN!UGizi=L8x~Hq3%Q~loCIGN9Fhc+U literal 0 HcmV?d00001 diff --git a/lib/config/config.dart b/lib/config/config.dart index a4f701de..d7529454 100644 --- a/lib/config/config.dart +++ b/lib/config/config.dart @@ -225,7 +225,7 @@ const GET_PATIENT_HEALTH_STATS = 'Services/Patients.svc/REST/Med_GetTransactions const CHANNEL = 3; const GENERAL_ID = 'Cs2020@2016\$2958'; const IP_ADDRESS = '10.20.10.20'; -const VERSION_ID = 5.8; +const VERSION_ID = 8.8; const SETUP_ID = '91877'; const LANGUAGE = 2; const PATIENT_OUT_SA = 0; diff --git a/lib/config/localized_values.dart b/lib/config/localized_values.dart index 9ba405e7..23308d16 100644 --- a/lib/config/localized_values.dart +++ b/lib/config/localized_values.dart @@ -1115,6 +1115,7 @@ const Map localizedValues = { "calculate": {"en": "calculate", "ar": "حساب"}, "enterReadingValue": {"en": "Enter the reading value", "ar": "ادخل القيمة"}, "result": {"en": "Result", "ar": "النتيجة"}, + "sort": {"en": "Sort", "ar": "فرز"}, "bloodSugarConversion": {"en": "Blood Sugar Conversion", "ar": "السكر في الدم"}, "convertBloodSugarStatement": { "en": "Convert blood sugar/glucose from mmol/l (UK standard) to mg/dlt (US standard) and vice versa.", diff --git a/lib/core/model/pharmacies/order_model.dart b/lib/core/model/pharmacies/order_model.dart index 8872aaf8..0866420c 100644 --- a/lib/core/model/pharmacies/order_model.dart +++ b/lib/core/model/pharmacies/order_model.dart @@ -79,10 +79,10 @@ class OrderModel { dynamic storeId; String orderGuid; bool pickUpInStore; - PaymentMethodSystemName paymentMethodSystemName; - PaymentName paymentName; - PaymentName paymentNamen; - CustomerCurrencyCode customerCurrencyCode; + dynamic paymentMethodSystemName; + dynamic paymentName; + dynamic paymentNamen; + dynamic customerCurrencyCode; dynamic currencyRate; dynamic customerTaxDisplayTypeId; dynamic vatNumber; @@ -102,42 +102,42 @@ class OrderModel { dynamic refundedAmount; dynamic rewardPointsWereAdded; String rxAttachments; - CheckoutAttributeDescription checkoutAttributeDescription; + dynamic checkoutAttributeDescription; dynamic customerLanguageId; dynamic affiliateId; - CustomerIp customerIp; + dynamic customerIp; String authorizationTransactionId; dynamic authorizationTransactionCode; dynamic authorizationTransactionResult; dynamic captureTransactionId; dynamic captureTransactionResult; dynamic subscriptionTransactionId; - DateTime paidDateUtc; - ShippingMethod shippingMethod; - ShippingRateComputationMethodSystemName shippingRateComputationMethodSystemName; + dynamic paidDateUtc; + dynamic shippingMethod; + dynamic shippingRateComputationMethodSystemName; String customValuesXml; bool deleted; - DateTime createdOnUtc; - OrderModelCustomer customer; + dynamic createdOnUtc; + dynamic customer; dynamic customerId; - IngAddress billingAddress; - IngAddress shippingAddress; + dynamic billingAddress; + dynamic shippingAddress; List orderItems; dynamic orderStatusId; - OrderStatus orderStatus; - OrderStatusn orderStatusn; + dynamic orderStatus; + dynamic orderStatusn; dynamic paymentStatusId; - PaymentStatus paymentStatus; - PaymentStatusn paymentStatusn; - ShippingStatus shippingStatus; - ShippingStatusn shippingStatusn; - CustomerTaxDisplayType customerTaxDisplayType; + dynamic paymentStatus; + dynamic paymentStatusn; + dynamic shippingStatus; + dynamic shippingStatusn; + dynamic customerTaxDisplayType; bool canCancel; bool canRefund; dynamic lakumAmount; - DateTime preferDeliveryDate; - PreferDeliveryTime preferDeliveryTime; - PreferDeliveryTimen preferDeliveryTimen; + dynamic preferDeliveryDate; + dynamic preferDeliveryTime; + dynamic preferDeliveryTimen; factory OrderModel.fromJson(Map json) => OrderModel( id: json["id"], @@ -311,7 +311,7 @@ class IngAddress { DateTime createdOnUtc; dynamic province; String latLong; - + LatLng getLocation(){ if(latLong.contains(',')){ var parts = latLong.trim().split(','); @@ -476,10 +476,10 @@ class OrderModelCustomer { }); String id; - Username username; - BillingAddressEmail email; - FirstName firstName; - LastName lastName; + dynamic username; + dynamic email; + dynamic firstName; + dynamic lastName; String languageId; dynamic adminComment; bool isTaxExempt; @@ -488,10 +488,10 @@ class OrderModelCustomer { bool deleted; bool isSystemAccount; dynamic systemName; - LastIpAddress lastIpAddress; - DateTime createdOnUtc; - DateTime lastLoginDateUtc; - DateTime lastActivityDateUtc; + dynamic lastIpAddress; + dynamic createdOnUtc; + dynamic lastLoginDateUtc; + dynamic lastActivityDateUtc; dynamic registeredInStoreId; List roleIds; @@ -577,6 +577,7 @@ final customerTaxDisplayTypeValues = EnumValues({ "ExcludingTax": CustomerTaxDisplayType.EXCLUDING_TAX }); + class OrderItem { OrderItem({ this.quantity, @@ -867,9 +868,9 @@ class Product { dynamic displayOrder; bool published; bool deleted; - DateTime createdOnUtc; - DateTime updatedOnUtc; - ProductType productType; + dynamic createdOnUtc; + dynamic updatedOnUtc; + dynamic productType; dynamic parentGroupedProductId; dynamic roleIds; dynamic discountIds; @@ -1146,14 +1147,14 @@ class Review { dynamic productId; dynamic storeId; bool isApproved; - Title title; - ReviewText reviewText; + dynamic title; + dynamic reviewText; dynamic replyText; dynamic rating; dynamic helpfulYesTotal; dynamic helpfulNoTotal; - DateTime createdOnUtc; - ReviewCustomer customer; + dynamic createdOnUtc; + dynamic customer; dynamic product; factory Review.fromJson(Map json) => Review( @@ -1235,7 +1236,7 @@ class ReviewCustomer { dynamic isOutSa; dynamic patientType; dynamic gender; - DateTime birthDate; + dynamic birthDate; dynamic phone; dynamic countryCode; dynamic yahalaAccountno; @@ -1244,7 +1245,7 @@ class ReviewCustomer { List addresses; String id; String username; - PurpleEmail email; + dynamic email; dynamic firstName; dynamic lastName; dynamic languageId; diff --git a/lib/core/model/pharmacies/orders_model.dart b/lib/core/model/pharmacies/orders_model.dart index a97bda98..0ad94767 100644 --- a/lib/core/model/pharmacies/orders_model.dart +++ b/lib/core/model/pharmacies/orders_model.dart @@ -32,6 +32,10 @@ class Orders { bool canCancel; bool canRefund; dynamic customerId; + double orderSubtotalExclTax; + dynamic orderShippingExclTax; + double orderTax; + Orders( {this.id, @@ -43,7 +47,10 @@ class Orders { this.orderStatusn, this.canCancel, this.canRefund, - this.customerId,}); + this.customerId, + this.orderShippingExclTax, + this.orderSubtotalExclTax, + this.orderTax,}); Orders.fromJson(Map json) { try { @@ -57,6 +64,9 @@ class Orders { canCancel = json['can_cancel']; canRefund = json['can_refund']; customerId = json['customer_id']; + orderSubtotalExclTax= json["order_subtotal_excl_tax"].toDouble(); + orderShippingExclTax= json["order_shipping_excl_tax"]; + orderTax= json["order_tax"].toDouble(); }catch(e){ print(e); } @@ -72,6 +82,9 @@ class Orders { data['order_status_id'] = this.orderStatusId; data['order_status'] = this.orderStatus; data['order_statusn'] = this.orderStatusn; + data ["order_subtotal_excl_tax"] = this.orderSubtotalExclTax; + data ["order_shipping_excl_tax"]= this.orderShippingExclTax; + data ["order_tax"]= this.orderTax; return data; } } diff --git a/lib/core/model/pharmacies/recommendedProduct_model.dart b/lib/core/model/pharmacies/recommendedProduct_model.dart index ce17e2a8..e1e88cd8 100644 --- a/lib/core/model/pharmacies/recommendedProduct_model.dart +++ b/lib/core/model/pharmacies/recommendedProduct_model.dart @@ -1,11 +1,9 @@ class RecommendedProductModel { - String messageStatus; List products; - RecommendedProductModel({this.messageStatus, this.products}); + RecommendedProductModel({this.products}); RecommendedProductModel.fromJson(Map json) { - messageStatus = json['MessageStatus']; if (json['products'] != null) { products = new List(); json['products'].forEach((v) { @@ -16,7 +14,6 @@ class RecommendedProductModel { Map toJson() { final Map data = new Map(); - data['MessageStatus'] = this.messageStatus; if (this.products != null) { data['products'] = this.products.map((v) => v.toJson()).toList(); } @@ -29,238 +26,213 @@ class Products { bool visibleIndividually; String name; String namen; - List localizedNames; String shortDescription; String shortDescriptionn; String fullDescription; String fullDescriptionn; bool markasNew; bool showOnHomePage; - Null metaKeywords; - Null metaDescription; - Null metaTitle; + dynamic metaKeywords; + dynamic metaDescription; + dynamic metaTitle; bool allowCustomerReviews; - int approvedRatingSum; - int notApprovedRatingSum; - int approvedTotalReviews; - int notApprovedTotalReviews; + dynamic approvedRatingSum; + dynamic notApprovedRatingSum; + dynamic approvedTotalReviews; + dynamic notApprovedTotalReviews; String sku; bool isRx; bool prescriptionRequired; - Null rxMessage; - Null rxMessagen; - Null manufacturerPartNumber; - Null gtin; + dynamic rxMessage; + dynamic rxMessagen; + dynamic manufacturerPartNumber; + dynamic gtin; bool isGiftCard; bool requireOtherProducts; bool automaticallyAddRequiredProducts; bool isDownload; bool unlimitedDownloads; - int maxNumberOfDownloads; - Null downloadExpirationDays; + dynamic maxNumberOfDownloads; + dynamic downloadExpirationDays; bool hasSampleDownload; bool hasUserAgreement; bool isRecurring; - int recurringCycleLength; - int recurringTotalCycles; + dynamic recurringCycleLength; + dynamic recurringTotalCycles; bool isRental; - int rentalPriceLength; + dynamic rentalPriceLength; bool isShipEnabled; bool isFreeShipping; bool shipSeparately; - int additionalShippingCharge; + dynamic additionalShippingCharge; bool isTaxExempt; bool isTelecommunicationsOrBroadcastingOrElectronicServices; bool useMultipleWarehouses; - int manageInventoryMethodId; - int stockQuantity; + dynamic manageInventoryMethodId; + dynamic stockQuantity; String stockAvailability; String stockAvailabilityn; bool displayStockAvailability; bool displayStockQuantity; - int minStockQuantity; - int notifyAdminForQuantityBelow; + dynamic minStockQuantity; + dynamic notifyAdminForQuantityBelow; bool allowBackInStockSubscriptions; - int orderMinimumQuantity; - int orderMaximumQuantity; - Null allowedQuantities; + dynamic orderMinimumQuantity; + dynamic orderMaximumQuantity; + dynamic allowedQuantities; bool allowAddingOnlyExistingAttributeCombinations; bool disableBuyButton; bool disableWishlistButton; bool availableForPreOrder; - Null preOrderAvailabilityStartDateTimeUtc; + dynamic preOrderAvailabilityStartDateTimeUtc; bool callForPrice; - double price; - int oldPrice; - double productCost; - Null specialPrice; - Null specialPriceStartDateTimeUtc; - Null specialPriceEndDateTimeUtc; + dynamic price; + dynamic oldPrice; + dynamic productCost; + dynamic specialPrice; + dynamic specialPriceStartDateTimeUtc; + dynamic specialPriceEndDateTimeUtc; bool customerEntersPrice; - int minimumCustomerEnteredPrice; - int maximumCustomerEnteredPrice; + dynamic minimumCustomerEnteredPrice; + dynamic maximumCustomerEnteredPrice; bool basepriceEnabled; - int basepriceAmount; - int basepriceBaseAmount; + dynamic basepriceAmount; + dynamic basepriceBaseAmount; bool hasTierPrices; bool hasDiscountsApplied; - Null discountName; - Null discountNamen; - Null discountDescription; - Null discountDescriptionn; - Null discountPercentage; + dynamic discountName; + dynamic discountNamen; + dynamic discountDescription; + dynamic discountDescriptionn; + dynamic discountPercentage; String currency; String currencyn; double weight; - int length; - int width; - int height; - Null availableStartDateTimeUtc; - Null availableEndDateTimeUtc; - int displayOrder; + dynamic length; + dynamic width; + dynamic height; + dynamic availableStartDateTimeUtc; + dynamic availableEndDateTimeUtc; + dynamic displayOrder; bool published; bool deleted; String createdOnUtc; String updatedOnUtc; String productType; - int parentGroupedProductId; - List roleIds; - List discountIds; - List storeIds; - List manufacturerIds; - List reviews; - List images; - List attributes; - List specifications; - List associatedProductIds; - List tags; - int vendorId; + dynamic parentGroupedProductId; + dynamic vendorId; String seName; + List images; - Products( - {this.id, - this.visibleIndividually, - this.name, - this.namen, - this.localizedNames, - this.shortDescription, - this.shortDescriptionn, - this.fullDescription, - this.fullDescriptionn, - this.markasNew, - this.showOnHomePage, - this.metaKeywords, - this.metaDescription, - this.metaTitle, - this.allowCustomerReviews, - this.approvedRatingSum, - this.notApprovedRatingSum, - this.approvedTotalReviews, - this.notApprovedTotalReviews, - this.sku, - this.isRx, - this.prescriptionRequired, - this.rxMessage, - this.rxMessagen, - this.manufacturerPartNumber, - this.gtin, - this.isGiftCard, - this.requireOtherProducts, - this.automaticallyAddRequiredProducts, - this.isDownload, - this.unlimitedDownloads, - this.maxNumberOfDownloads, - this.downloadExpirationDays, - this.hasSampleDownload, - this.hasUserAgreement, - this.isRecurring, - this.recurringCycleLength, - this.recurringTotalCycles, - this.isRental, - this.rentalPriceLength, - this.isShipEnabled, - this.isFreeShipping, - this.shipSeparately, - this.additionalShippingCharge, - this.isTaxExempt, - this.isTelecommunicationsOrBroadcastingOrElectronicServices, - this.useMultipleWarehouses, - this.manageInventoryMethodId, - this.stockQuantity, - this.stockAvailability, - this.stockAvailabilityn, - this.displayStockAvailability, - this.displayStockQuantity, - this.minStockQuantity, - this.notifyAdminForQuantityBelow, - this.allowBackInStockSubscriptions, - this.orderMinimumQuantity, - this.orderMaximumQuantity, - this.allowedQuantities, - this.allowAddingOnlyExistingAttributeCombinations, - this.disableBuyButton, - this.disableWishlistButton, - this.availableForPreOrder, - this.preOrderAvailabilityStartDateTimeUtc, - this.callForPrice, - this.price, - this.oldPrice, - this.productCost, - this.specialPrice, - this.specialPriceStartDateTimeUtc, - this.specialPriceEndDateTimeUtc, - this.customerEntersPrice, - this.minimumCustomerEnteredPrice, - this.maximumCustomerEnteredPrice, - this.basepriceEnabled, - this.basepriceAmount, - this.basepriceBaseAmount, - this.hasTierPrices, - this.hasDiscountsApplied, - this.discountName, - this.discountNamen, - this.discountDescription, - this.discountDescriptionn, - this.discountPercentage, - this.currency, - this.currencyn, - this.weight, - this.length, - this.width, - this.height, - this.availableStartDateTimeUtc, - this.availableEndDateTimeUtc, - this.displayOrder, - this.published, - this.deleted, - this.createdOnUtc, - this.updatedOnUtc, - this.productType, - this.parentGroupedProductId, - this.roleIds, - this.discountIds, - this.storeIds, - this.manufacturerIds, - this.reviews, - this.images, - this.attributes, - this.specifications, - this.associatedProductIds, - this.tags, - this.vendorId, - this.seName}); + Products({ + this.id, + this.visibleIndividually, + this.name, + this.namen, + this.shortDescription, + this.shortDescriptionn, + this.fullDescription, + this.fullDescriptionn, + this.markasNew, + this.showOnHomePage, + this.metaKeywords, + this.metaDescription, + this.metaTitle, + this.allowCustomerReviews, + this.approvedRatingSum, + this.notApprovedRatingSum, + this.approvedTotalReviews, + this.notApprovedTotalReviews, + this.sku, + this.isRx, + this.prescriptionRequired, + this.rxMessage, + this.rxMessagen, + this.manufacturerPartNumber, + this.gtin, + this.isGiftCard, + this.requireOtherProducts, + this.automaticallyAddRequiredProducts, + this.isDownload, + this.unlimitedDownloads, + this.maxNumberOfDownloads, + this.downloadExpirationDays, + this.hasSampleDownload, + this.hasUserAgreement, + this.isRecurring, + this.recurringCycleLength, + this.recurringTotalCycles, + this.isRental, + this.rentalPriceLength, + this.isShipEnabled, + this.isFreeShipping, + this.shipSeparately, + this.additionalShippingCharge, + this.isTaxExempt, + this.isTelecommunicationsOrBroadcastingOrElectronicServices, + this.useMultipleWarehouses, + this.manageInventoryMethodId, + this.stockQuantity, + this.stockAvailability, + this.stockAvailabilityn, + this.displayStockAvailability, + this.displayStockQuantity, + this.minStockQuantity, + this.notifyAdminForQuantityBelow, + this.allowBackInStockSubscriptions, + this.orderMinimumQuantity, + this.orderMaximumQuantity, + this.allowedQuantities, + this.allowAddingOnlyExistingAttributeCombinations, + this.disableBuyButton, + this.disableWishlistButton, + this.availableForPreOrder, + this.preOrderAvailabilityStartDateTimeUtc, + this.callForPrice, + this.price, + this.oldPrice, + this.productCost, + this.specialPrice, + this.specialPriceStartDateTimeUtc, + this.specialPriceEndDateTimeUtc, + this.customerEntersPrice, + this.minimumCustomerEnteredPrice, + this.maximumCustomerEnteredPrice, + this.basepriceEnabled, + this.basepriceAmount, + this.basepriceBaseAmount, + this.hasTierPrices, + this.hasDiscountsApplied, + this.discountName, + this.discountNamen, + this.discountDescription, + this.discountDescriptionn, + this.discountPercentage, + this.currency, + this.currencyn, + this.weight, + this.length, + this.width, + this.height, + this.availableStartDateTimeUtc, + this.availableEndDateTimeUtc, + this.displayOrder, + this.published, + this.deleted, + this.createdOnUtc, + this.updatedOnUtc, + this.productType, + this.parentGroupedProductId, + this.vendorId, + this.seName, + this.images, + }); Products.fromJson(Map json) { id = json['id']; visibleIndividually = json['visible_individually']; name = json['name']; namen = json['namen']; - if (json['localized_names'] != null) { - localizedNames = new List(); - json['localized_names'].forEach((v) { - localizedNames.add(new LocalizedNames.fromJson(v)); - }); - } shortDescription = json['short_description']; shortDescriptionn = json['short_descriptionn']; fullDescription = json['full_description']; @@ -285,7 +257,7 @@ class Products { isGiftCard = json['is_gift_card']; requireOtherProducts = json['require_other_products']; automaticallyAddRequiredProducts = - json['automatically_add_required_products']; + json['automatically_add_required_products']; isDownload = json['is_download']; unlimitedDownloads = json['unlimited_downloads']; maxNumberOfDownloads = json['max_number_of_downloads']; @@ -303,7 +275,7 @@ class Products { additionalShippingCharge = json['additional_shipping_charge']; isTaxExempt = json['is_tax_exempt']; isTelecommunicationsOrBroadcastingOrElectronicServices = - json['is_telecommunications_or_broadcasting_or_electronic_services']; + json['is_telecommunications_or_broadcasting_or_electronic_services']; useMultipleWarehouses = json['use_multiple_warehouses']; manageInventoryMethodId = json['manage_inventory_method_id']; stockQuantity = json['stock_quantity']; @@ -318,12 +290,12 @@ class Products { orderMaximumQuantity = json['order_maximum_quantity']; allowedQuantities = json['allowed_quantities']; allowAddingOnlyExistingAttributeCombinations = - json['allow_adding_only_existing_attribute_combinations']; + json['allow_adding_only_existing_attribute_combinations']; disableBuyButton = json['disable_buy_button']; disableWishlistButton = json['disable_wishlist_button']; availableForPreOrder = json['available_for_pre_order']; preOrderAvailabilityStartDateTimeUtc = - json['pre_order_availability_start_date_time_utc']; + json['pre_order_availability_start_date_time_utc']; callForPrice = json['call_for_price']; price = json['price']; oldPrice = json['old_price']; @@ -359,63 +331,14 @@ class Products { updatedOnUtc = json['updated_on_utc']; productType = json['product_type']; parentGroupedProductId = json['parent_grouped_product_id']; - if (json['role_ids'] != null) { - roleIds = new List(); - json['role_ids'].forEach((v) { - roleIds.add(null); - }); - } - if (json['discount_ids'] != null) { - discountIds = new List(); - json['discount_ids'].forEach((v) { - discountIds.add(null); - }); - } - if (json['store_ids'] != null) { - storeIds = new List(); - json['store_ids'].forEach((v) { - storeIds.add(null); - }); - } - manufacturerIds = json['manufacturer_ids'].cast(); - if (json['reviews'] != null) { - reviews = new List(); - json['reviews'].forEach((v) { - reviews.add(new Reviews.fromJson(v)); - }); - } + vendorId = json['vendor_id']; + seName = json['se_name']; if (json['images'] != null) { images = new List(); json['images'].forEach((v) { images.add(new Images.fromJson(v)); }); } - if (json['attributes'] != null) { - attributes = new List(); - json['attributes'].forEach((v) { - attributes.add(v); - }); - } - if (json['specifications'] != null) { - specifications = new List(); - json['specifications'].forEach((v) { - specifications.add(new Specifications.fromJson(v)); - }); - } - if (json['associated_product_ids'] != null) { - associatedProductIds = new List(); - json['associated_product_ids'].forEach((v) { - associatedProductIds.add(v); - }); - } - if (json['tags'] != null) { - tags = new List(); - json['tags'].forEach((v) { - tags.add(v); - }); - } - vendorId = json['vendor_id']; - seName = json['se_name']; } Map toJson() { @@ -424,10 +347,6 @@ class Products { data['visible_individually'] = this.visibleIndividually; data['name'] = this.name; data['namen'] = this.namen; - if (this.localizedNames != null) { - data['localized_names'] = - this.localizedNames.map((v) => v.toJson()).toList(); - } data['short_description'] = this.shortDescription; data['short_descriptionn'] = this.shortDescriptionn; data['full_description'] = this.fullDescription; @@ -528,289 +447,12 @@ class Products { data['updated_on_utc'] = this.updatedOnUtc; data['product_type'] = this.productType; data['parent_grouped_product_id'] = this.parentGroupedProductId; - if (this.roleIds != null) { - data['role_ids'] = this.roleIds.map((v) => v); - } - if (this.discountIds != null) { - data['discount_ids'] = this.discountIds.map((v) => v); - } - if (this.storeIds != null) { - data['store_ids'] = this.storeIds.map((v) => v); - } - data['manufacturer_ids'] = this.manufacturerIds; - if (this.reviews != null) { - data['reviews'] = this.reviews.map((v) => v.toJson()).toList(); - } - if (this.images != null) { - data['images'] = this.images.map((v) => v.toJson()).toList(); - } - if (this.attributes != null) { - data['attributes'] = this.attributes.map((v) => v); - } - if (this.specifications != null) { - data['specifications'] = - this.specifications.map((v) => v.toJson()).toList(); - } - if (this.associatedProductIds != null) { - data['associated_product_ids'] = - this.associatedProductIds.map((v) => v); - } - if (this.tags != null) { - data['tags'] = this.tags.map((v) => v); - } data['vendor_id'] = this.vendorId; data['se_name'] = this.seName; - return data; - } -} - -class LocalizedNames { - int languageId; - String localizedName; - - LocalizedNames({this.languageId, this.localizedName}); - - LocalizedNames.fromJson(Map json) { - languageId = json['language_id']; - localizedName = json['localized_name']; - } - - Map toJson() { - final Map data = new Map(); - data['language_id'] = this.languageId; - data['localized_name'] = this.localizedName; - return data; - } -} - -class Reviews { - int id; - int position; - int reviewId; - int customerId; - int productId; - int storeId; - bool isApproved; - String title; - String reviewText; - Null replyText; - int rating; - int helpfulYesTotal; - int helpfulNoTotal; - String createdOnUtc; - Customer customer; - Null product; - - Reviews( - {this.id, - this.position, - this.reviewId, - this.customerId, - this.productId, - this.storeId, - this.isApproved, - this.title, - this.reviewText, - this.replyText, - this.rating, - this.helpfulYesTotal, - this.helpfulNoTotal, - this.createdOnUtc, - this.customer, - this.product}); - - Reviews.fromJson(Map json) { - id = json['id']; - position = json['position']; - reviewId = json['review_id']; - customerId = json['customer_id']; - productId = json['product_id']; - storeId = json['store_id']; - isApproved = json['is_approved']; - title = json['title']; - reviewText = json['review_text']; - replyText = json['reply_text']; - rating = json['rating']; - helpfulYesTotal = json['helpful_yes_total']; - helpfulNoTotal = json['helpful_no_total']; - createdOnUtc = json['created_on_utc']; - customer = json['customer'] != null - ? new Customer.fromJson(json['customer']) - : null; - product = json['product']; - } - - Map toJson() { - final Map data = new Map(); - data['id'] = this.id; - data['position'] = this.position; - data['review_id'] = this.reviewId; - data['customer_id'] = this.customerId; - data['product_id'] = this.productId; - data['store_id'] = this.storeId; - data['is_approved'] = this.isApproved; - data['title'] = this.title; - data['review_text'] = this.reviewText; - data['reply_text'] = this.replyText; - data['rating'] = this.rating; - data['helpful_yes_total'] = this.helpfulYesTotal; - data['helpful_no_total'] = this.helpfulNoTotal; - data['created_on_utc'] = this.createdOnUtc; - if (this.customer != null) { - data['customer'] = this.customer.toJson(); - } - data['product'] = this.product; - return data; - } -} - -class Customer { - Null fileNumber; - Null iqamaNumber; - int isOutSa; - int patientType; - Null gender; - String birthDate; - Null phone; - Null countryCode; - Null yahalaAccountno; - Null billingAddress; - Null shippingAddress; - List addresses; - String id; - String username; - String email; - Null firstName; - Null lastName; - Null languageId; - Null adminComment; - Null isTaxExempt; - Null hasShoppingCartItems; - Null active; - Null deleted; - Null isSystemAccount; - Null systemName; - Null lastIpAddress; - Null createdOnUtc; - Null lastLoginDateUtc; - Null lastActivityDateUtc; - Null registeredInStoreId; - List roleIds; - - Customer( - {this.fileNumber, - this.iqamaNumber, - this.isOutSa, - this.patientType, - this.gender, - this.birthDate, - this.phone, - this.countryCode, - this.yahalaAccountno, - this.billingAddress, - this.shippingAddress, - this.addresses, - this.id, - this.username, - this.email, - this.firstName, - this.lastName, - this.languageId, - this.adminComment, - this.isTaxExempt, - this.hasShoppingCartItems, - this.active, - this.deleted, - this.isSystemAccount, - this.systemName, - this.lastIpAddress, - this.createdOnUtc, - this.lastLoginDateUtc, - this.lastActivityDateUtc, - this.registeredInStoreId, - this.roleIds}); - - Customer.fromJson(Map json) { - fileNumber = json['file_number']; - iqamaNumber = json['iqama_number']; - isOutSa = json['is_out_sa']; - patientType = json['patient_type']; - gender = json['gender']; - birthDate = json['birth_date']; - phone = json['phone']; - countryCode = json['country_code']; - yahalaAccountno = json['yahala_accountno']; - billingAddress = json['billing_address']; - shippingAddress = json['shipping_address']; - if (json['addresses'] != null) { - addresses = new List(); - json['addresses'].forEach((v) { - addresses.add(v); - }); - } - id = json['id']; - username = json['username']; - email = json['email']; - firstName = json['first_name']; - lastName = json['last_name']; - languageId = json['language_id']; - adminComment = json['admin_comment']; - isTaxExempt = json['is_tax_exempt']; - hasShoppingCartItems = json['has_shopping_cart_items']; - active = json['active']; - deleted = json['deleted']; - isSystemAccount = json['is_system_account']; - systemName = json['system_name']; - lastIpAddress = json['last_ip_address']; - createdOnUtc = json['created_on_utc']; - lastLoginDateUtc = json['last_login_date_utc']; - lastActivityDateUtc = json['last_activity_date_utc']; - registeredInStoreId = json['registered_in_store_id']; - if (json['role_ids'] != null) { - roleIds = new List(); - json['role_ids'].forEach((v) { - roleIds.add(null); - }); + if (this.images != null) { + data['images'] = this.images.map((v) => v.toJson()).toList(); } - } - Map toJson() { - final Map data = new Map(); - data['file_number'] = this.fileNumber; - data['iqama_number'] = this.iqamaNumber; - data['is_out_sa'] = this.isOutSa; - data['patient_type'] = this.patientType; - data['gender'] = this.gender; - data['birth_date'] = this.birthDate; - data['phone'] = this.phone; - data['country_code'] = this.countryCode; - data['yahala_accountno'] = this.yahalaAccountno; - data['billing_address'] = this.billingAddress; - data['shipping_address'] = this.shippingAddress; - if (this.addresses != null) { - data['addresses'] = this.addresses.map((v) => v); - } - data['id'] = this.id; - data['username'] = this.username; - data['email'] = this.email; - data['first_name'] = this.firstName; - data['last_name'] = this.lastName; - data['language_id'] = this.languageId; - data['admin_comment'] = this.adminComment; - data['is_tax_exempt'] = this.isTaxExempt; - data['has_shopping_cart_items'] = this.hasShoppingCartItems; - data['active'] = this.active; - data['deleted'] = this.deleted; - data['is_system_account'] = this.isSystemAccount; - data['system_name'] = this.systemName; - data['last_ip_address'] = this.lastIpAddress; - data['created_on_utc'] = this.createdOnUtc; - data['last_login_date_utc'] = this.lastLoginDateUtc; - data['last_activity_date_utc'] = this.lastActivityDateUtc; - data['registered_in_store_id'] = this.registeredInStoreId; - if (this.roleIds != null) { - data['role_ids'] = this.roleIds.map((v) => v); - } return data; } } @@ -842,40 +484,3 @@ class Images { return data; } } - -class Specifications { - int id; - int displayOrder; - String defaultValue; - String defaultValuen; - String name; - String nameN; - - Specifications( - {this.id, - this.displayOrder, - this.defaultValue, - this.defaultValuen, - this.name, - this.nameN}); - - Specifications.fromJson(Map json) { - id = json['id']; - displayOrder = json['display_order']; - defaultValue = json['default_value']; - defaultValuen = json['default_valuen']; - name = json['name']; - nameN = json['nameN']; - } - - Map toJson() { - final Map data = new Map(); - data['id'] = this.id; - data['display_order'] = this.displayOrder; - data['default_value'] = this.defaultValue; - data['default_valuen'] = this.defaultValuen; - data['name'] = this.name; - data['nameN'] = this.nameN; - return data; - } -} \ No newline at end of file diff --git a/lib/core/service/parmacyModule/prescription_service.dart b/lib/core/service/parmacyModule/prescription_service.dart index ce931812..ddeaef20 100644 --- a/lib/core/service/parmacyModule/prescription_service.dart +++ b/lib/core/service/parmacyModule/prescription_service.dart @@ -1,11 +1,9 @@ - import 'package:diplomaticquarterapp/config/config.dart'; import 'package:diplomaticquarterapp/config/shared_pref_kay.dart'; import 'package:diplomaticquarterapp/core/service/base_service.dart'; import 'package:diplomaticquarterapp/uitl/app_shared_preferences.dart'; import 'package:diplomaticquarterapp/core/model/pharmacies/Prescriptions.dart'; - class PrescriptionService extends BaseService { final AppSharedPreferences sharedPref = AppSharedPreferences(); bool isFinished = true; @@ -16,7 +14,6 @@ class PrescriptionService extends BaseService { List _prescriptionsList = List(); List get prescriptionsList => _prescriptionsList; - // Future getPrescription() async { // hasError = false; // url = PRESCRIPTION; @@ -35,29 +32,23 @@ class PrescriptionService extends BaseService { // }); // } Future getPrescription() async { - url = PRESCRIPTION; - print("Print PRESCRIPTION url" + url); + url = PRESCRIPTION; + print("Print PRESCRIPTION url" + url); hasError = false; -<<<<<<< HEAD Map body = Map(); body['isDentalAllowedBackend'] = false; - await baseAppClient.post(PRESCRIPTION, -======= - url = PRESCRIPTION; print("Print PRESCRIPTION url" + url); await baseAppClient.post(url, ->>>>>>> development onSuccess: (dynamic response, int statusCode) { - _prescriptionsList.clear(); - response['PatientPrescriptionList'].forEach((prescriptions) { - _prescriptionsList.add(Prescriptions.fromJson(prescriptions)); - }); - print(_prescriptionsList.length); - print(response); - }, onFailure: (String error, int statusCode) { - hasError = true; - super.error = error; - }, body: body); + _prescriptionsList.clear(); + response['PatientPrescriptionList'].forEach((prescriptions) { + _prescriptionsList.add(Prescriptions.fromJson(prescriptions)); + }); + print(_prescriptionsList.length); + print("response is -------------"+response); + }, onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + }, body: body); } - -} \ No newline at end of file +} diff --git a/lib/core/viewModels/pharmacyModule/pharmacy_module_view_model.dart b/lib/core/viewModels/pharmacyModule/pharmacy_module_view_model.dart index ddb10f4e..b3f581db 100644 --- a/lib/core/viewModels/pharmacyModule/pharmacy_module_view_model.dart +++ b/lib/core/viewModels/pharmacyModule/pharmacy_module_view_model.dart @@ -34,13 +34,13 @@ class PharmacyModuleViewModel extends BaseViewModel { _pharmacyService.lastVisitedProducts; - List get recommendedProduct => - _recommendedProductService.recommendedProductList; + List get recommendedProductList => + _recommendedProductService.recommendedList; List get prescriptionsList => _prescriptionService.prescriptionsList; - + bool hasError = false; // List get pharmacyPrescriptionsList => PharmacyProduct.pharmacyPrescriptionsList ; Future getPharmacyHomeData() async { @@ -136,10 +136,10 @@ class PharmacyModuleViewModel extends BaseViewModel { } /////////////RecommendedProducts - getRecommendedProducts(ProductId) async { - print("_____________________________________"); - print(ProductId); - await _recommendedProductService.getRecommendedProducts(ProductId.toString()); + getRecommendedProducts(productId) async { + hasError = false; + setState(ViewState.Busy); + await _recommendedProductService.getRecommendedProducts(productId.toString()); if (_recommendedProductService.hasError) { error = _recommendedProductService.error; setState(ViewState.Error); diff --git a/lib/pages/pharmacies/product_detail.dart b/lib/pages/pharmacies/product_detail.dart index 73157d85..41daef80 100644 --- a/lib/pages/pharmacies/product_detail.dart +++ b/lib/pages/pharmacies/product_detail.dart @@ -280,45 +280,23 @@ class __ProductDetailPageState extends State { SizedBox( height: 10, ), - Container( - child: Text( - languageID == 'ar' - ? widget.product.shortDescriptionn - : widget.product.shortDescription ?? - "", - style: TextStyle( - fontSize: 16, - fontFamily: 'WorkSans-Regular'), - ), - ), - SizedBox( - height: 10, - ), - Container( - child: Text( - TranslationBase.of(context).howToUse, - style: TextStyle( - fontSize: 17, - color: Colors.grey, - fontWeight: FontWeight.w600), - ), - ), Divider(height: 1, color: Colors.grey), SizedBox( - height: 10, + height: 15, ), Container( child: Text( languageID == 'ar' ? widget.product.fullDescriptionn - : widget.product.fullDescription, + : widget.product.fullDescription ?? + "", style: TextStyle( fontSize: 16, fontFamily: 'WorkSans-Regular'), ), ), SizedBox( - height: 10, + height: 20, ), // Container( // child: Text( @@ -329,6 +307,32 @@ class __ProductDetailPageState extends State { // fontWeight: FontWeight.w600), // ), // ), +// Divider(height: 1, color: Colors.grey), +// SizedBox( +// height: 10, +// ), +// Container( +// child: Text( +// languageID == 'ar' +// ? widget.product.fullDescriptionn +// : widget.product.fullDescription, +// style: TextStyle( +// fontSize: 16, +// fontFamily: 'WorkSans-Regular'), +// ), +// ), +// SizedBox( +// height: 10, +// ), +// Container( +// child: Text( +// TranslationBase.of(context).howToUse, +// style: TextStyle( +// fontSize: 17, +// color: Colors.grey, +// fontWeight: FontWeight.w600), +// ), +// ), // SizedBox( // height: 6, // ), @@ -1894,8 +1898,9 @@ checkWishlist() async { ProductDetailViewModel x = new ProductDetailViewModel(); await x.checkWishlistData(); for (int i = 0; i < x.wishListItems.length; i++) { -// print(itemID); -// print(x.wishListItems[i].product.id); + print("---------Enad----wishlist---------------"); + print(itemID); + print(x.wishListItems[i].product.id); if (itemID == x.wishListItems[i].product.id) { isInWishlit = true; // print('in wishlist'); diff --git a/lib/pages/pharmacies/screens/pharmacy_module_page.dart b/lib/pages/pharmacies/screens/pharmacy_module_page.dart index 3dfc94c9..3f09029a 100644 --- a/lib/pages/pharmacies/screens/pharmacy_module_page.dart +++ b/lib/pages/pharmacies/screens/pharmacy_module_page.dart @@ -1,14 +1,16 @@ - import 'package:diplomaticquarterapp/config/shared_pref_kay.dart'; import 'package:diplomaticquarterapp/config/size_config.dart'; +import 'package:diplomaticquarterapp/core/model/pharmacies/PharmacyProduct.dart'; import 'package:diplomaticquarterapp/core/model/pharmacies/recommendedProduct_model.dart'; import 'package:diplomaticquarterapp/core/viewModels/pharmacyModule/pharmacy_module_view_model.dart'; +import 'package:diplomaticquarterapp/core/viewModels/pharmacyModule/product_detail_view_model.dart'; import 'package:diplomaticquarterapp/pages/base/base_view.dart'; import 'package:diplomaticquarterapp/pages/landing/home_page.dart'; import 'package:diplomaticquarterapp/pages/medical/prescriptions/prescriptions_home_page.dart'; import 'package:diplomaticquarterapp/pages/offers_categorise_page.dart'; import 'package:diplomaticquarterapp/pages/pharmacies/product-brands.dart'; +import 'package:diplomaticquarterapp/pages/pharmacies/product_detail.dart'; import 'package:diplomaticquarterapp/pages/pharmacies/screens/lacum-activitaion-vida-page.dart'; import 'package:diplomaticquarterapp/pages/pharmacies/screens/lakum-main-page.dart'; import 'package:diplomaticquarterapp/pages/pharmacies/screens/recommended-product-page.dart'; @@ -23,21 +25,49 @@ import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart'; import 'package:flutter/material.dart'; +import 'package:flutter_svg/flutter_svg.dart'; import 'package:rating_bar/rating_bar.dart'; +bool isInWishlist = false; +int price = 0; +dynamic itemID; +var product; +var customerId; +var item; dynamic languageID; -class PharmacyPage extends StatelessWidget { -// Products productModel ; +List wishlistData; + +class PharmacyPage extends StatefulWidget { +// final PharmacyProduct product; +// PharmacyPage(this.product); + + + @override + _PharmacyPageState createState() => _PharmacyPageState(); +} + +class _PharmacyPageState extends State { + dynamic wishlistVar; getLanguageID() async { languageID = await sharedPref.getString(APP_LANGUAGE); } + List recommendedProductList = []; - var model; + List wishList = []; + + var model; +// String ProductId="4561"; + //String id ="3608"; + String ProductId=""; + String id =""; @override void initState() { - print("model recommended is " + model.recommendedProduct.length); - + checkWishlist(); + // userInfo(widget.product.id, widget.product); + userInfo(id, product); + print("-------------this--------------"); + print(itemID); } @override @@ -303,102 +333,182 @@ class PharmacyPage extends StatelessWidget { ), ), Container( - height: model.recommendedProduct.length > 0 - ? MediaQuery.of(context).size.height * 0.28 + height: model.recommendedProductList.length > 0 + ? MediaQuery.of(context).size.height * 0.30 : 0, - padding: EdgeInsets.symmetric(horizontal: 16.0, vertical: 22.0), - margin: EdgeInsets.only(left: 10), + margin: EdgeInsets.symmetric( + horizontal: 6, + vertical: 4), +// padding: EdgeInsets.symmetric(horizontal: 5.0, vertical: 22.0), +// margin: EdgeInsets.only(left: 10), child:BaseView( - onModelReady: (model) => model.getRecommendedProducts(4561 ), - builder: (_, model, wi) => model.recommendedProduct[0].products.length > 0 + onModelReady: (model) => model.getRecommendedProducts(ProductId), + builder: (_, model, wi) => model.recommendedProductList.length != null ? ListView.builder( -// itemBuilder: (ctx, i) => -// ProductTileItem(model.recommendedProduct[i]), -// scrollDirection: Axis.horizontal, -// itemCount: model.recommendedProduct.length, scrollDirection: Axis.horizontal, shrinkWrap: true, physics: ScrollPhysics(), // physics: NeverScrollableScrollPhysics(), - itemCount: model.recommendedProduct[0].products.length, + itemCount: model.recommendedProductList.length, itemBuilder: (context, index) { - return Container( - height: MediaQuery.of(context).size.height * 0.6, - padding: EdgeInsets.only(bottom: 5.0, left: 5.0, right: 8.0), - margin: EdgeInsets.only(right: 10.0), - decoration: BoxDecoration( - border: Border.all( - color: Colors.grey, - style: BorderStyle.solid, - width: 1.0, + return + Card( + elevation: 2, + shape: RoundedRectangleBorder( + side: BorderSide(color: Colors.grey[300], width: 2), + borderRadius: BorderRadius.circular(10)), +// + margin: EdgeInsets.symmetric( + horizontal: 8, + vertical: 4, + ), + child: Container( + decoration: BoxDecoration( + borderRadius: BorderRadius.all( + Radius.circular(15), ), - color: Colors.white, - borderRadius: BorderRadius.circular(10.0)), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Container( - margin: EdgeInsets.fromLTRB(0, 16, 0, 0), - alignment: Alignment.center, - child: (model.recommendedProduct[0].products[index].images != null && - model.recommendedProduct[0].products[index].images.length > 0) - ? Image.network( - model.recommendedProduct[0].products[index].images[0].src.toString(), + + ), + padding: EdgeInsets.symmetric(horizontal: 4), + width: MediaQuery.of(context).size.width / 3, +// + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + + Stack( + children:[ + Container( + child: Align( + alignment: Alignment.topRight, + child: //true + itemID.contains(model.recommendedProductList[index].id) + // !isInWishlist + ? IconButton( + icon: Icon(Icons.favorite_border), + color: Colors.grey, + iconSize: 30, + onPressed: () { + setState(() { + addToWishlistFunction(itemID); + }); + }, + ) + : IconButton( + icon: Icon(Icons.favorite), + color: Colors.red, + iconSize: 30, + onPressed: () { + setState(() { + deleteFromWishlistFunction(itemID); + }); + }, + ) +// + ), + ), + Container( + margin: EdgeInsets.fromLTRB(0, 16, 10, 16), + alignment: Alignment.center, +// padding: EdgeInsets.only(left: 25, bottom: 20), + child: (model.recommendedProductList[index].images != null && + model.recommendedProductList[index].images.length > 0) + ? Image.network( + model.recommendedProductList[index].images[0].src.toString(), // item.images[0].src, - fit: BoxFit.cover, - height: 80, - ) - : Image.asset( - "assets/images/no_image.png", - fit: BoxFit.cover, - height: 80, - ), - ), - Text( - model.recommendedProduct[0].products[index].shortDescription - .toString(), - style: TextStyle( - color: Colors.green, - fontSize: 15.0, + fit: BoxFit.cover, + height: 60, + ) + : Image.asset( + "assets/images/no_image.png", + fit: BoxFit.cover, + height: 60, + ), + ), + Container( + width: model.recommendedProductList[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.recommendedProductList[index].rxMessage != null + ? model.recommendedProductList[index].rxMessage : "", + color: Colors.white, + regular: true, + fontSize: 10, + fontWeight: FontWeight.w400, + ), + ), + ] ), + Container( + margin: EdgeInsets.symmetric( + horizontal: 6, + vertical: 0, + ), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + model.recommendedProductList[index].name, + style: TextStyle( + color: Colors.black, + fontSize: 13.0, // fontWeight: FontWeight.bold, + ), + ), + Padding( +// padding: const EdgeInsets.only(top: 15, bottom: 10), + padding: const EdgeInsets.only(top: 10, bottom: 5), + child: Texts( + "SAR ${model.recommendedProductList[index].price}", + bold: true, + fontSize: 14, + ), + ), + ], + ), ), - ), - Padding( - padding: const EdgeInsets.only(top: 4, bottom: 4), - child: Texts( - "SAR ${model.recommendedProduct[0].products[index].price}", - bold: true, - fontSize: 14, - ), - ), - Row( - crossAxisAlignment: - CrossAxisAlignment.start, - children: [ -// Container( + Row( + crossAxisAlignment: + CrossAxisAlignment.start, + children: [ + Container( + padding: EdgeInsets.only(right: 10), // margin: EdgeInsets.only(left: 5), -// child: Align( -// alignment: Alignment.topLeft, -// child: RatingBar.readOnly( -// initialRating: -// model.recommendedProduct[0].products[index].reviews.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: Align( + alignment: Alignment.topLeft, + child: RatingBar.readOnly( + initialRating: + model.recommendedProductList[index].approvedRatingSum.toDouble(), +// initialRating: productRate, + size: 13.0, + filledColor: Colors.yellow[700], + emptyColor: Colors.grey[500], + isHalfAllowed: true, + halfFilledIcon: Icons.star_half, + filledIcon: Icons.star, + emptyIcon: Icons.star, + ), + ), + ), + Texts( + "(${model.recommendedProductList[index].approvedTotalReviews.toString()})", +// bold: true, + fontSize: 12, + ), + ]), + ], + ), ), ); } - ): Container( + ): + Container( // child: Text("NO DATA"), ), ), @@ -509,8 +619,56 @@ class PharmacyPage extends StatelessWidget { ), ); } + + + addToWishlistFunction(itemID) async { + ProductDetailViewModel x = new ProductDetailViewModel(); + isInWishlist = true; + await x.addToWishlistData(itemID); + } + + deleteFromWishlistFunction(itemID) async { + ProductDetailViewModel x = new ProductDetailViewModel(); + isInWishlist = false; + await x.addToWishlistData(itemID); + } + + + + checkWishlist() async { + ProductDetailViewModel x = new ProductDetailViewModel(); + await x.checkWishlistData(); + for (int i = 0; i < x.wishListItems.length; i++) { + // itemID = x.wishListItems[i].id; + print("-------------wishlist---------------"); + print(itemID); +// print(product.id); + print(x.wishListItems[i].productId); + if (itemID == x.wishListItems[i].productId) { + isInWishlist = true; +// print('in wishlist'); + break; + } else { + isInWishlist = false; +// print('not in wishlist'); + } + } + } + + + Future userInfo(id, product) async { + customerId = await sharedPref.getString(PHARMACY_CUSTOMER_ID); + if (customerId != null) { + itemID = id; + product = product; + checkWishlist(); + } + print("customerId:$customerId"); + return customerId; + } } + class GridViewButtons extends StatelessWidget { final PharmacyModuleViewModel model; @@ -643,6 +801,8 @@ class GridViewCard extends StatelessWidget { ); } + + String getDate(String date) { DateTime dateObj = DateUtil.convertStringToDate(date); return DateUtil.getWeekDay(dateObj.weekday) + @@ -654,3 +814,34 @@ class GridViewCard extends StatelessWidget { dateObj.year.toString(); } } + + + + + +class test extends StatefulWidget { + @override + _testState createState() => _testState(); +} + + +class _testState extends State { + @override + Widget build(BuildContext context) { + return Container(); + } +} +//addWishlistData() async { +// ProductDetailViewModel x = new ProductDetailViewModel(); +// await wishlistData.add(x.checkWishlistData()); +// print("-------------testWishlist---------------"); +// +//} + +// checkWishlist() async { +// ProductDetailViewModel x = new ProductDetailViewModel(); +// wishlistVar = await x.checkWishlistData(); +// print("wishlistVar>>>>>>>>>>>>>>>"); +// print(wishlistVar); +// +// } diff --git a/lib/pages/pharmacies/screens/recommended-product-page.dart b/lib/pages/pharmacies/screens/recommended-product-page.dart index 7d2d4c71..df5e08d3 100644 --- a/lib/pages/pharmacies/screens/recommended-product-page.dart +++ b/lib/pages/pharmacies/screens/recommended-product-page.dart @@ -1,12 +1,18 @@ - - +import 'package:diplomaticquarterapp/core/model/pharmacies/recommendedProduct_model.dart'; import 'package:diplomaticquarterapp/core/viewModels/pharmacyModule/pharmacy_module_view_model.dart'; +import 'package:diplomaticquarterapp/core/viewModels/pharmacyModule/product_detail_view_model.dart'; import 'package:diplomaticquarterapp/pages/base/base_view.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; import 'package:flutter/material.dart'; +import 'package:flutter_svg/flutter_svg.dart'; import 'package:rating_bar/rating_bar.dart'; +import 'package:diplomaticquarterapp/config/shared_pref_kay.dart'; + +dynamic languageID; +bool isInWishlist = false; +var itemID; class RecommendedProductPage extends StatefulWidget { @override @@ -14,152 +20,929 @@ class RecommendedProductPage extends StatefulWidget { } class _RecommendedProductPageState extends State - with SingleTickerProviderStateMixin{ + with SingleTickerProviderStateMixin { + List recommendedProductList = []; + String ProductId = "4561"; + bool styleOne = true; + bool styleTwo = false; + Icon styleIcon = Icon( + Icons.widgets_sharp, + color: Colors.blue, + size: 29.0, + ); + + getLanguageID() async { + languageID = await sharedPref.getString(APP_LANGUAGE); + } + @override void initState() { super.initState(); - } @override Widget build(BuildContext context) { + var size = MediaQuery.of(context).size; + final double itemHeight = ((size.height - kToolbarHeight - 24) * 0.80) / 2; + final double itemWidth = size.width / 2; return BaseView( - onModelReady: (model) => model.getRecommendedProducts(4561), - builder: (_,model, wi )=> AppScaffold( - appBarTitle:TranslationBase.of(context).recommended, - baseViewModel: model, - isShowAppBar: true, - isPharmacy:true , - body: Column( - children: [ -// Text( -// "4455" + "Result", -// style: TextStyle( -// color: Colors.black, -// fontSize: 13.0, -// ), -// ), -// SizedBox( -// height: 10, -// ), -// Divider( -// color: Colors.grey[350], -// height: 10, -// thickness: 6, -// indent: 0, -// endIndent: 0, -// ), - GridView.count( - crossAxisCount: 2 , - children: List.generate(30,(index){ - return Container( - child: Card( - color: Colors.blue, - child: Container( - height: model.recommendedProduct.length > 0 - ? MediaQuery.of(context).size.height * 0.28 - : 0, - padding: EdgeInsets.symmetric(horizontal: 16.0, vertical: 18.0), -// margin: EdgeInsets.only(left: 10), - child:BaseView( - onModelReady: (model) => model.getRecommendedProducts(4561 ), - builder: (_, model, wi) => model.recommendedProduct[0].products.length > 0 - ? ListView.builder( -// itemBuilder: (ctx, i) => -// ProductTileItem(model.recommendedProduct[i]), -// scrollDirection: Axis.horizontal, -// itemCount: model.recommendedProduct.length, - scrollDirection: Axis.vertical, - shrinkWrap: true, - physics: ScrollPhysics(), - // physics: NeverScrollableScrollPhysics(), - itemCount: model.recommendedProduct[0].products.length, - itemBuilder: (context, index) { - return Container( - height: MediaQuery.of(context).size.height * 0.6, - padding: EdgeInsets.only(bottom: 5.0, left: 5.0, right: 8.0), - margin: EdgeInsets.only(right: 10.0), - decoration: BoxDecoration( - border: Border.all( - color: Colors.grey, - style: BorderStyle.solid, - width: 1.0,), - color: Colors.white, - borderRadius: BorderRadius.circular(10.0)), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Container( - margin: EdgeInsets.fromLTRB(0, 16, 0, 0), - alignment: Alignment.center, - child: (model.recommendedProduct[0].products[index].images != null && - model.recommendedProduct[0].products[index].images.length > 0) - ? Image.network( - model.recommendedProduct[0].products[index].images[0].src.toString(), + onModelReady: (model) => model.getRecommendedProducts(ProductId), + builder: (_, model, wi) => AppScaffold( + appBarTitle: TranslationBase.of(context).recommended, + baseViewModel: model, + isShowAppBar: true, + isPharmacy: true, + backgroundColor: Colors.white, + body: Column(children: [ + Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Row( + mainAxisAlignment: MainAxisAlignment.start, + children: [ + Container( + padding: EdgeInsets.only( + top: 8, + bottom: 10, + left: 10, + ), + child: Text( + model.recommendedProductList.length.toString(), + style: TextStyle( + color: Colors.black, + fontSize: 14.0, + ), + ), + ), + Container( + padding: EdgeInsets.only(top: 8, bottom: 10, left: 8), + child: Text( + TranslationBase.of(context).result, + style: TextStyle( + color: Colors.black, + fontSize: 14.0, + ), + ), + ), + ], + ), + Row( + mainAxisAlignment: MainAxisAlignment.end, + children: [ + Padding( + padding: const EdgeInsets.symmetric(vertical: 8), + child: SizedBox( + child: Container( + width: 1, + color: Colors.grey, + ), + ), + ), + Container( + child: Image.asset( + 'assets/images/pharmacy/sort.png', + width: 20, + height: 20, +// color: Colors.red, + ), + ), + Container( + child: Text( + TranslationBase.of(context).sort, + style: TextStyle( + color: Colors.black, + fontSize: 14.0, + ), + ), + ), + Padding( + padding: const EdgeInsets.symmetric(vertical: 8), + child: SizedBox( + child: Container( + width: 1, + color: Colors.grey, + ), + ), + ), + Divider( + thickness: 1.0, + color: Colors.black12, + ), + Padding( + padding: EdgeInsets.all(8.0), + child: InkWell( + child: styleIcon, + onTap: () { + setState(() { + if (styleOne == true) { + styleOne = false; + styleTwo = true; + styleIcon = Icon( + Icons.auto_awesome_mosaic, + color: Colors.blue, + size: 29.0, + ); + } else { + styleOne = true; + styleTwo = false; + styleIcon = Icon( + Icons.widgets_sharp, + color: Colors.blue, + size: 29.0, + ); + } + }); + }, + ), + ), + ], + ), + ]), + SizedBox( + height: 2, + ), + Divider( + color: Colors.grey[350], + height: 10, + thickness: 6, + indent: 0, + endIndent: 0, + ), + styleOne == true + ? Container( + margin: EdgeInsets.all(5.0), + child: model.recommendedProductList.length != null + ? CustomScrollView( + primary: false, + shrinkWrap: true, + physics: NeverScrollableScrollPhysics(), + slivers: [ + SliverPadding( + padding: const EdgeInsets.fromLTRB(0, 0, 0, 0), + sliver: SliverGrid.count( + crossAxisCount: 2, + childAspectRatio: (itemWidth / itemHeight), + children: model.recommendedProductList + .map((e) => Card( + elevation: 2, + shape: RoundedRectangleBorder( + side: BorderSide( + color: Colors.grey[300], + width: 2), + borderRadius: + BorderRadius.circular( + 10)), + margin: EdgeInsets.symmetric( + horizontal: 8, + vertical: 4, + ), + child: Container( + decoration: BoxDecoration( + borderRadius: + BorderRadius.all( + Radius.circular(15), + ), + ), + padding: EdgeInsets.symmetric( + horizontal: 4), + width: MediaQuery.of(context) + .size + .width / + 3, +// + child: Column( + crossAxisAlignment: + CrossAxisAlignment + .start, + children: [ + Stack(children: [ + Container( + child: Align( + alignment: + Alignment + .topRight, + child: //true + //wishlistVar[index].id.contains(model.recommendedProductList[index].id) + !isInWishlist + ? IconButton( + icon: + Icon(Icons.favorite_border), + color: + Colors.grey, + iconSize: + 30, + onPressed: + () { + setState(() { + addToWishlistFunction(itemID); + }); + }, + ) + : IconButton( + icon: + Icon(Icons.favorite), + color: + Colors.red, + iconSize: + 30, + onPressed: + () { + setState(() { + deleteFromWishlistFunction(itemID); + }); + }, + ) +// + ), + ), + Container( + margin: EdgeInsets + .fromLTRB(0, 16, + 10, 16), + alignment: + Alignment.center, +// padding: EdgeInsets.only(left: 25, bottom: 20), + child: (e.images != + null && + e.images.length > + 0) + ? Image.network( + e.images[0] + .src + .toString(), // item.images[0].src, - fit: BoxFit.cover, - height: 80, - ) - : Image.asset( - "assets/images/no_image.png", - fit: BoxFit.cover, - height: 80, + fit: BoxFit + .cover, + height: 60, + ) + : Image.asset( + "assets/images/no_image.png", + fit: BoxFit + .cover, + height: 60, + ), + ), + Container( + width: e.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( + e.rxMessage != null + ? e.rxMessage + : "", + color: Colors.white, + regular: true, + fontSize: 10, + fontWeight: + FontWeight.w400, + ), + ), + ]), + Container( + margin: EdgeInsets + .symmetric( + horizontal: 6, + vertical: 0, + ), + child: Column( + crossAxisAlignment: + CrossAxisAlignment + .start, + children: [ + Text( + e.name, + style: TextStyle( + color: Colors + .black, + fontSize: 13.0, +// fontWeight: FontWeight.bold, + ), + ), + Padding( +// padding: const EdgeInsets.only(top: 15, bottom: 10), + padding: + const EdgeInsets + .only( + top: 10, + bottom: + 5), + child: Texts( + "SAR ${e.price}", + bold: true, + fontSize: 14, + ), + ), + ], + ), + ), + Row( + crossAxisAlignment: + CrossAxisAlignment + .start, + children: [ + Container( + padding: EdgeInsets + .only( + right: + 10), +// margin: EdgeInsets.only(left: 5), + child: Align( + alignment: + Alignment + .topLeft, + child: RatingBar + .readOnly( + initialRating: e + .approvedRatingSum + .toDouble(), +// initialRating: productRate, + size: 13.0, + filledColor: + Colors.yellow[ + 700], + emptyColor: + Colors.grey[ + 500], + isHalfAllowed: + true, + halfFilledIcon: + Icons + .star_half, + filledIcon: + Icons + .star, + emptyIcon: + Icons + .star, + ), + ), + ), + Texts( + "(${e.approvedTotalReviews.toString()})", +// bold: true, + fontSize: 12, + ), + ]), + ], + ), + ), + ) +// Column( +// crossAxisAlignment: +// CrossAxisAlignment.start, +// children: [ +// Container( +// child: Align( +// alignment: Alignment.topRight, +// child: !isInWishlist +// ? IconButton( +// icon: Icon(Icons.favorite_border), +// color: Colors.grey, +// iconSize: 30, +// onPressed: () { +// setState(() { +// addToWishlistFunction(itemID); +// }); +// }, +// ) +// : IconButton( +// icon: Icon(Icons.favorite), +// color: Colors.red, +// iconSize: 30, +// onPressed: () { +// setState(() { +// deleteFromWishlistFunction(itemID); +// }); +// }, +// ) +//// +// ),), +// Container( +// padding: EdgeInsets.only( +// left: 25, bottom: 20), +//// margin: EdgeInsets.fromLTRB(0, 16, 0, 0), +//// alignment: Alignment.centerLeft, +// child: (e.images != null && +// e.images.length > 0) +// ? Image.network( +// e.images[0].src +// .toString(), +//// item.images[0].src, +// fit: BoxFit.cover, +// height: 80, +// ) +// : Image.asset( +// "assets/images/no_image.png", +// fit: BoxFit.cover, +// height: 80, +// ), +// ), +// Text( +// e.name, +//// model.recommendedProduct[0].products[index].shortDescription +//// .toString(), +// style: TextStyle( +// color: Colors.black, +// fontSize: 15.0, +//// fontWeight: FontWeight.bold, +// ), +// ), +// Padding( +// padding: const EdgeInsets.only( +// top: 15, bottom: 10), +// child: Texts( +// "SAR ${e.price}", +// bold: true, +// fontSize: 14, +// ), +// ), +// Row( +// crossAxisAlignment: +// CrossAxisAlignment.start, +// children: [ +// Container( +// padding: EdgeInsets.only( +// right: 10), +//// margin: EdgeInsets.only(left: 5), +// child: Align( +// alignment: +// Alignment.topLeft, +// child: RatingBar.readOnly( +// initialRating: e +// .approvedRatingSum +// .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, +// ), +// ), +// ), +// Texts( +// "(${e.approvedTotalReviews.toString()})", +//// bold: true, +// fontSize: 12, +// ), +// ]), +// ], +// ), + ) + .toList(), +// children:[ +// ListView.builder( +// scrollDirection: Axis.vertical, +// shrinkWrap: true, +// physics: ScrollPhysics(), +// itemCount: model.recommendedProductList.length, +// itemBuilder: (context, index) { +// return Container( +// height: 30, +// padding: EdgeInsets.only( left: 15.0, top: 10, right: 10), +// margin: EdgeInsets.only(right: 10.0), +// decoration: BoxDecoration( +// border: Border.all( +// color: Colors.grey, +// style: BorderStyle.solid, +// width: 1.0, +// ), +// color: Colors.white, +// borderRadius: BorderRadius.circular(10.0)), +// child: Column( +// crossAxisAlignment: CrossAxisAlignment.start, +// children: [ +// Container( +// child: Align( +// alignment: Alignment.topRight, +// child:!isInWishlist +// ? InkWell( +// onTap: () { +// }, +// child: SvgPicture.asset( +// 'assets/images/pharmacy/heart-empty.svg', +// width: 20, +// height: 20, +// color: Colors.grey, +// ), +// ) +// : InkWell( +// onTap: () { +// }, +// child: SvgPicture.asset( +// 'assets/images/pharmacy/Redheart.svg', +// width: 20, +// height: 20, +//// color: Colors.red, +// ), +// ) +// ), +// ), +// Container( +// padding: EdgeInsets.only(left: 25, bottom: 20), +//// margin: EdgeInsets.fromLTRB(0, 16, 0, 0), +//// alignment: Alignment.centerLeft, +// child: (model.recommendedProductList[index].images != null && +// model.recommendedProductList[index].images.length > 0) +// ? Image.network( +// model.recommendedProductList[index].images[0].src.toString(), +//// item.images[0].src, +// fit: BoxFit.cover, +// height: 80, +// ) +// : Image.asset( +// "assets/images/no_image.png", +// fit: BoxFit.cover, +// height: 80, +// ), +// ), +// Text( +// model.recommendedProductList[index].name, +//// model.recommendedProduct[0].products[index].shortDescription +//// .toString(), +// style: TextStyle( +// color: Colors.black, +// fontSize: 15.0, +//// fontWeight: FontWeight.bold, +// ), +// ), +// Padding( +// padding: const EdgeInsets.only(top: 15, bottom: 10), +// child: Texts( +// "SAR ${model.recommendedProductList[index].price}", +// bold: true, +// fontSize: 14, +// ), +// ), +// Row( +// crossAxisAlignment: +// CrossAxisAlignment.start, +// children: [ +// Container( +// padding: EdgeInsets.only(right: 10), +//// margin: EdgeInsets.only(left: 5), +// child: Align( +// alignment: Alignment.topLeft, +// child: RatingBar.readOnly( +// initialRating: +// model.recommendedProductList[index].approvedRatingSum.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, +// ), +// ), +// ), +// Texts( +// "(${model.recommendedProductList[index].approvedTotalReviews.toString()})", +//// bold: true, +// fontSize: 12, +// ), +// ]), +// ], +// ), +// ); +// } +// ), +// ] + ), + ), + ]) + : Container(), + ) + : Container( + height: model.recommendedProductList.length > 0 + ? MediaQuery.of(context).size.height * 0.60 + : 0, + child: ListView.builder( + physics: ScrollPhysics(), +// physics: NeverScrollableScrollPhysics(), + itemCount: model.recommendedProductList.length, + itemBuilder: (context, index) { + return Card( + elevation: 2, + shape: RoundedRectangleBorder( + side: + BorderSide(color: Colors.grey[300], width: 2), + borderRadius: BorderRadius.circular(10)), +// + margin: EdgeInsets.symmetric( + horizontal: 8, + vertical: 4, + ), + child: Container( + decoration: BoxDecoration( + borderRadius: BorderRadius.all( + Radius.circular(15), + ), + ), + padding: EdgeInsets.symmetric(horizontal: 5), + width: MediaQuery.of(context).size.width / 3, +// + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Stack(children: [ + Container( + child: Align( + alignment: Alignment.topRight, + child: //true + //wishlistVar[index].id.contains(model.recommendedProductList[index].id) + !isInWishlist + ? IconButton( + icon: Icon( + Icons.favorite_border), + color: Colors.grey, + iconSize: 30, + onPressed: () { + setState(() { + addToWishlistFunction( + itemID); + }); + }, + ) + : IconButton( + icon: Icon(Icons.favorite), + color: Colors.red, + iconSize: 30, + onPressed: () { + setState(() { + deleteFromWishlistFunction( + itemID); + }); + }, + ) +// ), - ), + ), + Container( + margin: EdgeInsets.fromLTRB(0, 16, 10, 16), + alignment: Alignment.center, +// padding: EdgeInsets.only(left: 25, bottom: 20), + child: (model.recommendedProductList[index] + .images != + null && + model.recommendedProductList[index] + .images.length > + 0) + ? Image.network( + model.recommendedProductList[index] + .images[0].src + .toString(), +// item.images[0].src, + fit: BoxFit.cover, + height: 60, + ) + : Image.asset( + "assets/images/no_image.png", + fit: BoxFit.cover, + height: 60, + ), + ), + Container( + width: model.recommendedProductList[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.recommendedProductList[index] + .rxMessage != + null + ? model.recommendedProductList[index] + .rxMessage + : "", + color: Colors.white, + regular: true, + fontSize: 10, + fontWeight: FontWeight.w400, + ), + ), + ]), + Container( + margin: EdgeInsets.symmetric( + horizontal: 6, + vertical: 2, + ), + child: Column( + crossAxisAlignment: + CrossAxisAlignment.start, + children: [ Text( - model.recommendedProduct[0].products[index].shortDescription - .toString(), + model + .recommendedProductList[index].name, style: TextStyle( - color: Colors.green, - fontSize: 15.0, + color: Colors.black, + fontSize: 13.0, // fontWeight: FontWeight.bold, ), ), Padding( - padding: const EdgeInsets.only(top: 4, bottom: 4), +// padding: const EdgeInsets.only(top: 15, bottom: 10), + padding: const EdgeInsets.only( + top: 10, bottom: 5), child: Texts( - "SAR ${model.recommendedProduct[0].products[index].price}", + "SAR ${model.recommendedProductList[index].price}", bold: true, fontSize: 14, ), ), - Row( - crossAxisAlignment: - CrossAxisAlignment.start, - children: [ -// Container( -// margin: EdgeInsets.only(left: 5), -// child: Align( -// alignment: Alignment.topLeft, -// child: RatingBar.readOnly( -// initialRating: -// model.recommendedProduct[0].products[index].reviews.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, -// ), -// ), -// ), - ]), ], ), - ); - } - ): Container( -// child: Text("NO DATA"), + ), + Row( + crossAxisAlignment: + CrossAxisAlignment.start, + children: [ + Container( + padding: EdgeInsets.only( + right: 10, bottom: 10), +// margin: EdgeInsets.only(left: 5), + child: Align( + alignment: Alignment.topLeft, + child: RatingBar.readOnly( + initialRating: model + .recommendedProductList[index] + .approvedRatingSum + .toDouble(), +// initialRating: productRate, + size: 13.0, + filledColor: Colors.yellow[700], + emptyColor: Colors.grey[500], + isHalfAllowed: true, + halfFilledIcon: Icons.star_half, + filledIcon: Icons.star, + emptyIcon: Icons.star, + ), + ), + ), + Texts( + "(${model.recommendedProductList[index].approvedTotalReviews.toString()})", +// bold: true, + fontSize: 12, + ), + ]), + ], + ), ), - ), - ), - ), - ); - }), - ), - ] ), - ), + ); +// Container( +// height: 30, +// padding: EdgeInsets.only( left: 10.0, top: 10, right: 10), +//// margin: EdgeInsets.only(right: 10.0), +// decoration: BoxDecoration( +// border: Border.all( +// color: Colors.grey, +// style: BorderStyle.solid, +// width: 1.0, +// ), +// color: Colors.white, +// borderRadius: BorderRadius.circular(10.0)), +// child: Column( +// crossAxisAlignment: CrossAxisAlignment.start, +// children: [ +// Container( +// child: Align( +// alignment: Alignment.topRight, +// child:!isInWishlist +// ? InkWell( +// onTap: () { +// }, +// child: SvgPicture.asset( +// 'assets/images/pharmacy/heart-empty.svg', +// width: 20, +// height: 20, +// color: Colors.grey, +// ), +// ) +// : InkWell( +// onTap: () { +// }, +// child: SvgPicture.asset( +// 'assets/images/pharmacy/Redheart.svg', +// width: 20, +// height: 20, +//// color: Colors.red, +// ), +// ) +// ), +// ), +// Container( +// padding: EdgeInsets.only(left: 25, bottom: 20), +//// margin: EdgeInsets.fromLTRB(0, 16, 0, 0), +//// alignment: Alignment.centerLeft, +// child: (model.recommendedProductList[index].images != null && +// model.recommendedProductList[index].images.length > 0) +// ? Image.network( +// model.recommendedProductList[index].images[0].src.toString(), +//// item.images[0].src, +// fit: BoxFit.cover, +// height: 80, +// ) +// : Image.asset( +// "assets/images/no_image.png", +// fit: BoxFit.cover, +// height: 80, +// ), +// ), +// Text( +// model.recommendedProductList[index].name, +//// model.recommendedProduct[0].products[index].shortDescription +//// .toString(), +// style: TextStyle( +// color: Colors.black, +// fontSize: 15.0, +//// fontWeight: FontWeight.bold, +// ), +// ), +// Padding( +// padding: const EdgeInsets.only(top: 15, bottom: 10), +// child: Texts( +// "SAR ${model.recommendedProductList[index].price}", +// bold: true, +// fontSize: 14, +// ), +// ), +// Row( +// crossAxisAlignment: +// CrossAxisAlignment.start, +// children: [ +// Container( +// padding: EdgeInsets.only(right: 10), +//// margin: EdgeInsets.only(left: 5), +// child: Align( +// alignment: Alignment.topLeft, +// child: RatingBar.readOnly( +// initialRating: +// model.recommendedProductList[index].approvedRatingSum.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, +// ), +// ), +// ), +// Texts( +// "(${model.recommendedProductList[index].approvedTotalReviews.toString()})", +//// bold: true, +// fontSize: 12, +// ), +// ]), +// ], +// ), +// ); + }), + ), + ]), + ), ); - }} \ No newline at end of file + } +} + +addToWishlistFunction(itemID) async { + ProductDetailViewModel x = new ProductDetailViewModel(); + isInWishlist = true; + await x.addToWishlistData(itemID); +} + +deleteFromWishlistFunction(itemID) async { + ProductDetailViewModel x = new ProductDetailViewModel(); + isInWishlist = false; + await x.addToWishlistData(itemID); +} diff --git a/lib/pages/pharmacy/order/Order.dart b/lib/pages/pharmacy/order/Order.dart index 4ef14389..02f64b83 100644 --- a/lib/pages/pharmacy/order/Order.dart +++ b/lib/pages/pharmacy/order/Order.dart @@ -69,6 +69,7 @@ class _OrderPageState extends State with SingleTickerProviderStateMix TabBar( labelPadding: EdgeInsets.only(left: 3.0, right: 3.0), + labelColor: Colors.black, tabs: [ Tab(text: TranslationBase.of(context).delivered), Tab(text: TranslationBase.of(context).processing), diff --git a/lib/pages/pharmacy/order/OrderDetails.dart b/lib/pages/pharmacy/order/OrderDetails.dart index 670cb951..5e9b26ea 100644 --- a/lib/pages/pharmacy/order/OrderDetails.dart +++ b/lib/pages/pharmacy/order/OrderDetails.dart @@ -48,7 +48,7 @@ class _OrderDetailsPageState extends State { var model; var isCancel = false; var isRefund = false; - var isActiveDelivery = true; + var isActiveDelivery = false; var dataIsCancel; var dataIsRefund; @@ -66,7 +66,13 @@ class _OrderDetailsPageState extends State { @override Widget build(BuildContext context) { return BaseView( - onModelReady: (model) => model.getOrderDetails(widget.orderModel.id), + onModelReady: (model){ + model.getOrderDetails(widget.orderModel.id).then((value){ + setState(() { + isActiveDelivery = (value.orderStatusId == 995 && (value.driverID != null && value.driverID.isNotEmpty)); + }); + }); + }, builder: (_, model, wi) => AppScaffold( appBarTitle: TranslationBase.of(context).orderDetail, isShowAppBar: true, @@ -111,11 +117,9 @@ class _OrderDetailsPageState extends State { borderRadius: BorderRadius.circular(30.0)), child: Text( languageID == "ar" - ? model.orderListModel[0].orderStatusn.toString() - : model.orderListModel[0].orderStatus - .toString() - .substring(12), -// TranslationBase.of(context).delivered, + ? widget.orderModel.orderStatusn.toString() + : widget.orderModel.orderStatus + .toString(), style: TextStyle( color: Colors.white, fontSize: 13.0, @@ -132,12 +136,7 @@ class _OrderDetailsPageState extends State { children: [ Text( model.orderListModel[0].shippingAddress.firstName - .toString() - .substring(10) + - ' ' + - model.orderListModel[0].shippingAddress.lastName - .toString() - .substring(9), + .toString().substring(10) , style: TextStyle( fontSize: 15.0, fontWeight: FontWeight.bold, @@ -152,8 +151,8 @@ class _OrderDetailsPageState extends State { children: [ Text( model.orderListModel[0].shippingAddress.address1 - .toString() - .substring(9), + .toString().substring(9), + // .substring(9), style: TextStyle( fontSize: 10.0, fontWeight: FontWeight.bold, @@ -169,9 +168,9 @@ class _OrderDetailsPageState extends State { children: [ Text( model.orderListModel[0].shippingAddress.address2 - .toString() - .substring(9) + - ' ' + + .toString().substring(9) + // .substring(9) + + + ' ' + model.orderListModel[0].shippingAddress.country .toString() + ' ' + @@ -239,8 +238,8 @@ class _OrderDetailsPageState extends State { Container( child: flutterImage.Image.asset( model.orderListModel[0] - .shippingRateComputationMethodSystemName != - "Shipping.Aramex" + .shippingRateComputationMethodSystemName != + "Shipping.Aramex" ? "assets/images/pharmacy_module/payment/LogoParmacyGreen.png" : "assets/images/pharmacy_module/payment/aramex_shipping_logo.png", fit: BoxFit.contain, @@ -292,8 +291,8 @@ class _OrderDetailsPageState extends State { margin: EdgeInsets.only(bottom: 10.0, top: 10.0), child: Text( model.orderListModel[0].paymentName - .toString() - .substring(12), + .toString().substring(12), + style: TextStyle( fontSize: 13.0, fontWeight: FontWeight.bold, @@ -345,24 +344,24 @@ class _OrderDetailsPageState extends State { productReviews: model.orderListModel[0] .orderItems[index].product.approvedTotalReviews, totalPrice: - "${(model.orderListModel[0].orderItems[index].product.price * model.orderListModel[0].orderItems[index].quantity).toStringAsFixed(2)}", + "${(model.orderListModel[0].orderItems[index].product.price * model.orderListModel[0].orderItems[index].quantity).toStringAsFixed(2)}", qyt: model .orderListModel[0].orderItems[index].quantity .toString(), isOrderDetails: true, imgs: model.orderListModel[0].orderItems[index] - .product.images != - null && - model.orderListModel[0].orderItems[index] - .product.images.length != - 0 + .product.images != + null && + model.orderListModel[0].orderItems[index] + .product.images.length != + 0 ? model.orderListModel[0].orderItems[index] - .product.images[0].src - .toString() + .product.images[0].src + .toString() : null, status: model.orderListModel[0].orderStatusId, product: - model.orderListModel[0].orderItems[index].product, + model.orderListModel[0].orderItems[index].product, ), ); }), @@ -540,81 +539,81 @@ class _OrderDetailsPageState extends State { ), model.orderListModel[0].orderStatusId == 10 ? InkWell( - onTap: () { - model.makeOrder(); - }, - child: Container( + onTap: () { + model.makeOrder(); + }, + child: Container( // margin: EdgeInsets.only(top: 20.0), - height: 50.0, - color: Colors.transparent, - child: Container( - padding: EdgeInsets.only(left: 130.0, right: 130.0), - decoration: BoxDecoration( - border: Border.all( - color: Colors.green, - style: BorderStyle.solid, - width: 4.0), - color: Colors.green, - borderRadius: BorderRadius.circular(5.0)), - child: Center( - child: Text( - TranslationBase.of(context).payOnline, - style: TextStyle( - color: Colors.white, - fontWeight: FontWeight.bold, - ), - ), - ), + height: 50.0, + color: Colors.transparent, + child: Container( + padding: EdgeInsets.only(left: 130.0, right: 130.0), + decoration: BoxDecoration( + border: Border.all( + color: Colors.green, + style: BorderStyle.solid, + width: 4.0), + color: Colors.green, + borderRadius: BorderRadius.circular(5.0)), + child: Center( + child: Text( + TranslationBase.of(context).payOnline, + style: TextStyle( + color: Colors.white, + fontWeight: FontWeight.bold, ), ), - ) + ), + ), + ), + ) : Container(), // getCancelOrder(canCancel, canRefund), isCancel ? InkWell( - onTap: () { - presentConfirmDialog(model, widget.orderModel.id); - // model.orderListModel[0].id//(widget.orderModel.id)); + onTap: () { + presentConfirmDialog(model, widget.orderModel.id); + // model.orderListModel[0].id//(widget.orderModel.id)); // - }, - child: Container( + }, + child: Container( // padding: EdgeInsets.only(left: 13.0, right: 13.0, top: 5.0), - height: 50.0, - color: Colors.transparent, - child: Center( - child: Text( - TranslationBase.of(context).cancelOrder, - style: TextStyle( - color: Colors.red[900], - fontWeight: FontWeight.bold, - decoration: TextDecoration.underline), - ), - ), - ), - ) + height: 50.0, + color: Colors.transparent, + child: Center( + child: Text( + TranslationBase.of(context).cancelOrder, + style: TextStyle( + color: Colors.red[900], + fontWeight: FontWeight.bold, + decoration: TextDecoration.underline), + ), + ), + ), + ) : Container(), isActiveDelivery ? InkWell( - onTap: () { - // Navigator.push( - // context, - // MaterialPageRoute(builder: (context) => TrackDriver(order: widget.orderModel), - // )); - }, - child: Container( - height: 50.0, - color: Colors.transparent, - child: Center( - child: Text( - TranslationBase.of(context).trackDeliveryDriver, - style: TextStyle( - color: Colors.green[900], - fontWeight: FontWeight.normal, - decoration: TextDecoration.none), - ), - ), - ), - ) + onTap: () { + Navigator.push( + context, + MaterialPageRoute(builder: (context) => TrackDriver(order: model.orderListModel.first), + )); + }, + child: Container( + height: 50.0, + color: Colors.transparent, + child: Center( + child: Text( + TranslationBase.of(context).trackDeliveryDriver, + style: TextStyle( + color: Colors.green[900], + fontWeight: FontWeight.normal, + decoration: TextDecoration.none), + ), + ), + ), + ) : Container(), ], ), @@ -702,3 +701,4 @@ class _OrderDetailsPageState extends State { } } } + diff --git a/lib/services/pharmacy_services/recommendedProduct_service.dart b/lib/services/pharmacy_services/recommendedProduct_service.dart index 32fe0a67..ad7222f8 100644 --- a/lib/services/pharmacy_services/recommendedProduct_service.dart +++ b/lib/services/pharmacy_services/recommendedProduct_service.dart @@ -5,7 +5,7 @@ import 'package:diplomaticquarterapp/core/service/base_service.dart'; import 'package:diplomaticquarterapp/models/Authentication/authenticated_user.dart'; import 'package:diplomaticquarterapp/services/authentication/auth_provider.dart'; import 'package:diplomaticquarterapp/uitl/app_shared_preferences.dart'; -import 'package:flutter/material.dart'; + @@ -15,23 +15,24 @@ class RecommendedProductService extends BaseService{ AuthenticatedUser authUser = new AuthenticatedUser(); AuthProvider authProvider = new AuthProvider(); - List _recommendedProductList = List(); - List get recommendedProductList => _recommendedProductList; + List _recommendedProductList = List(); + List get recommendedList => _recommendedProductList; String url =""; - Future getRecommendedProducts(ProductId) async { + Future getRecommendedProducts(productId) async { hasError = false; - url =GET_RECOMMENDED_PRODUCT+ProductId; - print("Recommended Product is"+url); - + url =GET_RECOMMENDED_PRODUCT+productId; await baseAppClient.getPharmacy(url, onSuccess: (dynamic response, int statusCode) { _recommendedProductList.clear(); - response['products'].forEach((item) { + _recommendedProductList.add(Products.fromJson(item)); + print("----------------------------------"); + print("Test data"); + print(_recommendedProductList[0]); + print(item['name']); + print(response); }); - print("print recommended items" + _recommendedProductList.length.toString()); - print(response); }, onFailure: (String error, int statusCode) { hasError = true; super.error = error; diff --git a/lib/uitl/translations_delegate_base.dart b/lib/uitl/translations_delegate_base.dart index c3acb5fd..3a993805 100644 --- a/lib/uitl/translations_delegate_base.dart +++ b/lib/uitl/translations_delegate_base.dart @@ -995,6 +995,7 @@ class TranslationBase { String get convertBloodSugarStatement => localizedValues["convertBloodSugarStatement"][locale.languageCode]; String get convertFrom => localizedValues["convertFrom"][locale.languageCode]; String get result => localizedValues["result"][locale.languageCode]; + String get sort => localizedValues["sort"][locale.languageCode]; String get bloodSugarConversion => localizedValues["bloodSugarConversion"][locale.languageCode]; String get convertCholesterolStatement => localizedValues["convertCholesterolStatement"][locale.languageCode]; String get triglyceridesConvertStatement => localizedValues["triglyceridesConvertStatement"][locale.languageCode]; From 0c6fb6771883b15f3856b0a19fd674576ba92418 Mon Sep 17 00:00:00 2001 From: enadhilal Date: Thu, 25 Feb 2021 15:46:44 +0300 Subject: [PATCH 04/11] fixed issues --- lib/core/service/client/base_app_client.dart | 3 +- .../product_detail_view_model.dart | 2 - lib/pages/landing/landing_page_pharmcy.dart | 2 +- lib/pages/pharmacies/compare.dart | 24 +- lib/pages/pharmacies/product-brands.dart | 17 +- lib/pages/pharmacies/product_detail.dart | 930 ++++++++++-------- lib/pages/pharmacies/wishlist.dart | 6 +- lib/pages/pharmacy/profile/profile.dart | 2 +- .../product_detail_service.dart | 3 +- lib/widgets/pharmacy/product_tile.dart | 4 +- 10 files changed, 583 insertions(+), 410 deletions(-) diff --git a/lib/core/service/client/base_app_client.dart b/lib/core/service/client/base_app_client.dart index 0395a4ba..9b05635b 100644 --- a/lib/core/service/client/base_app_client.dart +++ b/lib/core/service/client/base_app_client.dart @@ -462,7 +462,8 @@ class BaseAppClient { body: json.encode(body), headers: { 'Content-Type': 'application/json', - 'Accept': 'application/json' + 'Accept': 'application/json', + 'Statictoken': 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9', }); final int statusCode = response.statusCode; print("statusCode :$statusCode"); diff --git a/lib/core/viewModels/pharmacyModule/product_detail_view_model.dart b/lib/core/viewModels/pharmacyModule/product_detail_view_model.dart index e3a6255e..030fd4b2 100644 --- a/lib/core/viewModels/pharmacyModule/product_detail_view_model.dart +++ b/lib/core/viewModels/pharmacyModule/product_detail_view_model.dart @@ -27,7 +27,6 @@ class ProductDetailViewModel extends BaseViewModel{ Future getProductReviewsData(productID) async { - print('ENAD REview'); hasError = false; setState(ViewState.Busy); await _productDetailService.getProductReviews(productID); @@ -39,7 +38,6 @@ class ProductDetailViewModel extends BaseViewModel{ } Future getProductLocationData() async { - print('ENAD in model view'); hasError = false; setState(ViewState.Busy); await _productLocationService.getProductAvailabiltyDetail(); diff --git a/lib/pages/landing/landing_page_pharmcy.dart b/lib/pages/landing/landing_page_pharmcy.dart index 3a46f45c..41a66683 100644 --- a/lib/pages/landing/landing_page_pharmcy.dart +++ b/lib/pages/landing/landing_page_pharmcy.dart @@ -159,7 +159,7 @@ class _LandingPagePharmacyState extends State { PharmacyPage(), PharmacyCategorisePage(), // OffersCategorisePage(), - WishlistPage(), + WishlistPage(false), PharmacyProfilePage(), // Container( // child: Text('text'), diff --git a/lib/pages/pharmacies/compare.dart b/lib/pages/pharmacies/compare.dart index d1872187..505533cb 100644 --- a/lib/pages/pharmacies/compare.dart +++ b/lib/pages/pharmacies/compare.dart @@ -196,7 +196,9 @@ class _slideDetailState extends State { alignment: Alignment.topLeft, child: RichText( text: TextSpan( - text: widget.data[index].specifications[0].name, + text: widget.data[index].specifications != null ? + widget.data[index].specifications[0].name : + "No data", style: TextStyle( fontWeight: FontWeight.bold, color: Colors.black, @@ -211,7 +213,9 @@ class _slideDetailState extends State { alignment: Alignment.topLeft, child: RichText( text: TextSpan( - text: widget.data[index].specifications[1].name, + text: widget.data[index].specifications != null ? + widget.data[index].specifications[1].name : + "No data", style: TextStyle( color: Colors.black54, fontSize: 15, @@ -234,7 +238,9 @@ class _slideDetailState extends State { alignment: Alignment.topLeft, child: RichText( text: TextSpan( - text: widget.data[index].specifications[2].name, + text:widget.data[index].specifications != null ? + widget.data[index].specifications[2].name : + "No data", style: TextStyle( fontWeight: FontWeight.bold, color: Colors.black, @@ -249,7 +255,9 @@ class _slideDetailState extends State { alignment: Alignment.topLeft, child: RichText( text: TextSpan( - text: widget.data[index].specifications[3].name, + text: widget.data[index].specifications != null ? + widget.data[index].specifications[3].name : + "No data", style: TextStyle( color: Colors.black54, fontSize: 15, @@ -272,7 +280,9 @@ class _slideDetailState extends State { alignment: Alignment.topLeft, child: RichText( text: TextSpan( - text: widget.data[index].specifications[4].name, + text:widget.data[index].specifications != null ? + widget.data[index].specifications[4].name : + "No data", style: TextStyle( fontWeight: FontWeight.bold, color: Colors.black, @@ -287,7 +297,9 @@ class _slideDetailState extends State { alignment: Alignment.topLeft, child: RichText( text: TextSpan( - text: widget.data[index].specifications[5].name, + text:widget.data[index].specifications != null ? + widget.data[index].specifications[5].name : + "No data", style: TextStyle( color: Colors.black54, fontSize: 15, diff --git a/lib/pages/pharmacies/product-brands.dart b/lib/pages/pharmacies/product-brands.dart index b2ef5f4e..56b67127 100644 --- a/lib/pages/pharmacies/product-brands.dart +++ b/lib/pages/pharmacies/product-brands.dart @@ -1,4 +1,5 @@ import 'package:diplomaticquarterapp/config/config.dart'; +import 'package:diplomaticquarterapp/pages/final_products_page.dart'; import 'package:diplomaticquarterapp/pages/login/register-info.dart'; import 'package:diplomaticquarterapp/pages/pharmacies/search_brands_page.dart'; import 'package:diplomaticquarterapp/pages/search_products_page.dart'; @@ -61,7 +62,7 @@ class _ProductBrandsPageState extends State { height: 220, width: double.infinity, color: Colors.white, - child: topBrand(), + child: topBrand(context), ), SizedBox( height: 10, @@ -125,7 +126,11 @@ class _ProductBrandsPageState extends State { ), ), onTap: (){ - print("ENAD"); + Navigator.push( + context, + MaterialPageRoute( + builder: (context) => FinalProductsPage(id: model.brandsListList[index].id.toString(),)), + ); }, ); }), @@ -139,7 +144,7 @@ class _ProductBrandsPageState extends State { } -topBrand() { +topBrand(BuildContext context) { return BaseView( onModelReady: (model) => model.getTopBrandsData(), builder: (_, model, wi) => GridView.count( @@ -180,7 +185,11 @@ topBrand() { ), ), onTap: (){ - print("ENAD"); + Navigator.push( + context, + MaterialPageRoute( + builder: (context) => FinalProductsPage(id: model.topBrandsListList[index].id.toString(),)), + ); }, ), ], diff --git a/lib/pages/pharmacies/product_detail.dart b/lib/pages/pharmacies/product_detail.dart index 8d9d6d35..6d02b465 100644 --- a/lib/pages/pharmacies/product_detail.dart +++ b/lib/pages/pharmacies/product_detail.dart @@ -3,6 +3,7 @@ import 'package:diplomaticquarterapp/core/model/pharmacies/PharmacyProduct.dart' import 'package:diplomaticquarterapp/core/viewModels/pharmacyModule/product_detail_view_model.dart'; import 'package:diplomaticquarterapp/pages/base/base_view.dart'; import 'package:diplomaticquarterapp/pages/login/welcome.dart'; +import 'package:diplomaticquarterapp/uitl/gif_loader_dialog_utils.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; import 'package:flutter/material.dart'; @@ -18,8 +19,7 @@ int price = 0; var languageID; bool isOverQuantity = false; bool isInWishlit = false; -var itemID; -var product; +String itemID; var customerId; CompareList compareItems = new CompareList(); PharmacyProduct specificationData; @@ -38,15 +38,46 @@ class __ProductDetailPageState extends State { bool isAvailabilty = false; dynamic wishlistItems; + checkWishlist() async { + GifLoaderDialogUtils.showMyDialog(context); + ProductDetailViewModel x = new ProductDetailViewModel(); + await x.checkWishlistData(); + +// isInWishlit = x.wishListItems.map((e) => e.id.toString()).toList().contains(itemID); + + for (int i = 0; i < x.wishListItems.length; i++) { + if (itemID == x.wishListItems[i].product.id) { + isInWishlit = true; + break; + } else { + isInWishlit = false; + } + } + GifLoaderDialogUtils.hideDialog(context); + setState(() {}); + } + void initState() { price = 1; specificationData = widget.product; - setState(() { - customerId = userInfo(widget.product.id, widget.product); - }); + userInfo(); super.initState(); } + void userInfo() async { + print(specificationData); + customerId = await sharedPref.getString(PHARMACY_CUSTOMER_ID); + if (customerId != null) { + itemID = widget.product.id; + checkWishlist(); +// getSpecificationData(itemID); + } + print("customerId:$customerId"); + + setState(() {}); +// getSpecificationData(itemID); + } + Widget build(BuildContext context) { return customerId != null ? DetailPageScafold( @@ -80,12 +111,18 @@ class __ProductDetailPageState extends State { alignment: Alignment.centerRight, child: languageID == 'ar' ? Text( - widget.product.discountDescriptionn, - style: TextStyle(fontWeight: FontWeight.bold, fontSize: 17), + widget.product + .discountDescriptionn, + style: TextStyle( + fontWeight: FontWeight.bold, + fontSize: 17), ) : Text( - widget.product.discountDescription, - style: TextStyle(fontWeight: FontWeight.bold, fontSize: 17), + widget.product + .discountDescription, + style: TextStyle( + fontWeight: FontWeight.bold, + fontSize: 17), ), ), ), @@ -96,7 +133,8 @@ class __ProductDetailPageState extends State { flex: 0, child: Container( child: Image( - image: AssetImage('assets/images/offer.png'), + image: AssetImage( + 'assets/images/offer.png'), ), ), ), @@ -174,7 +212,9 @@ class __ProductDetailPageState extends State { }, child: Text( TranslationBase.of(context).details, - style: TextStyle(fontSize: 16, fontWeight: FontWeight.bold), + style: TextStyle( + fontSize: 16, + fontWeight: FontWeight.bold), ), color: Colors.white, ), @@ -202,7 +242,9 @@ class __ProductDetailPageState extends State { }, child: Text( TranslationBase.of(context).reviews, - style: TextStyle(fontSize: 16, fontWeight: FontWeight.bold), + style: TextStyle( + fontSize: 16, + fontWeight: FontWeight.bold), ), color: Colors.white, ), @@ -230,7 +272,9 @@ class __ProductDetailPageState extends State { }, child: Text( TranslationBase.of(context).availability, - style: TextStyle(fontSize: 16, fontWeight: FontWeight.bold), + style: TextStyle( + fontSize: 16, + fontWeight: FontWeight.bold), ), color: Colors.white, ), @@ -258,7 +302,10 @@ class __ProductDetailPageState extends State { Container( child: Text( TranslationBase.of(context).description, - style: TextStyle(fontSize: 17, color: Colors.grey, fontWeight: FontWeight.w600), + style: TextStyle( + fontSize: 17, + color: Colors.grey, + fontWeight: FontWeight.w600), ), ), SizedBox( @@ -266,8 +313,13 @@ class __ProductDetailPageState extends State { ), Container( child: Text( - languageID == 'ar' ? widget.product.shortDescriptionn : widget.product.shortDescription ?? "", - style: TextStyle(fontSize: 16, fontFamily: 'WorkSans-Regular'), + languageID == 'ar' + ? widget.product.shortDescriptionn + : widget.product.shortDescription ?? + "", + style: TextStyle( + fontSize: 16, + fontFamily: 'WorkSans-Regular'), ), ), SizedBox( @@ -276,7 +328,10 @@ class __ProductDetailPageState extends State { Container( child: Text( TranslationBase.of(context).howToUse, - style: TextStyle(fontSize: 17, color: Colors.grey, fontWeight: FontWeight.w600), + style: TextStyle( + fontSize: 17, + color: Colors.grey, + fontWeight: FontWeight.w600), ), ), SizedBox( @@ -284,8 +339,12 @@ class __ProductDetailPageState extends State { ), Container( child: Text( - languageID == 'ar' ? widget.product.fullDescriptionn : widget.product.fullDescription, - style: TextStyle(fontSize: 16, fontFamily: 'WorkSans-Regular'), + languageID == 'ar' + ? widget.product.fullDescriptionn + : widget.product.fullDescription, + style: TextStyle( + fontSize: 16, + fontFamily: 'WorkSans-Regular'), ), ), ], @@ -293,98 +352,161 @@ class __ProductDetailPageState extends State { ) : isReviews ? BaseView( - onModelReady: (model) => model.getProductReviewsData(widget.product.id), - builder: (_, model, wi) => - model.productDetailService.length != 0 && model.productDetailService[0].reviews.length != 0 - ? ListView.builder( - physics: ScrollPhysics(), - itemCount: model.productDetailService[0].reviews.length, - scrollDirection: Axis.vertical, - shrinkWrap: true, - itemBuilder: (BuildContext context, int index) { - return Padding( - padding: EdgeInsets.all(8.0), - child: Column( - mainAxisAlignment: MainAxisAlignment.start, - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Container( - child: Row( - children: [ - Container( - child: Text( - model.productDetailService[0].reviews[index].customerId.toString(), - style: TextStyle(fontSize: 17, color: Colors.grey, fontWeight: FontWeight.w600), - ), - ), - Container( - margin: EdgeInsets.only(left: 210), - child: RatingBar.readOnly( - initialRating: model.productDetailService[0].reviews[index].rating.toDouble(), - size: 15.0, - filledColor: Colors.yellow[700], - emptyColor: Colors.grey[500], - isHalfAllowed: true, - halfFilledIcon: Icons.star_half, - filledIcon: Icons.star, - emptyIcon: Icons.star, - ), - ), - ], + onModelReady: (model) => + model.getProductReviewsData( + widget.product.id), + builder: (_, model, wi) => model + .productDetailService + .length != + 0 && + model.productDetailService[0] + .reviews.length != + 0 + ? ListView.builder( + physics: ScrollPhysics(), + itemCount: model + .productDetailService[0] + .reviews + .length, + scrollDirection: Axis.vertical, + shrinkWrap: true, + itemBuilder: (BuildContext context, + int index) { + return Padding( + padding: EdgeInsets.all(8.0), + child: Column( + mainAxisAlignment: + MainAxisAlignment.start, + crossAxisAlignment: + CrossAxisAlignment.start, + children: [ + Container( + child: Row( + children: [ + Container( + child: Text( + model + .productDetailService[ + 0] + .reviews[ + index] + .customerId + .toString(), + style: TextStyle( + fontSize: 17, + color: Colors + .grey, + fontWeight: + FontWeight + .w600), + ), ), - ), - SizedBox( - height: 10, - ), - Container( - child: Text( - model.productDetailService[0].reviews[index].reviewText, - style: TextStyle(fontSize: 20), + Container( + margin: + EdgeInsets.only( + left: 210), + child: RatingBar + .readOnly( + initialRating: model + .productDetailService[ + 0] + .reviews[ + index] + .rating + .toDouble(), + size: 15.0, + filledColor: + Colors.yellow[ + 700], + emptyColor: Colors + .grey[500], + isHalfAllowed: + true, + halfFilledIcon: + Icons + .star_half, + filledIcon: + Icons.star, + emptyIcon: + Icons.star, + ), ), - ), - SizedBox( - height: 50, - ), - Divider(height: 1, color: Colors.grey), - ], + ], + ), ), - ); - }, - ) - : Container( - padding: EdgeInsets.all(15), - alignment: Alignment.center, - child: Text('No Reviews Available'), - ), + SizedBox( + height: 10, + ), + Container( + child: Text( + model + .productDetailService[ + 0] + .reviews[index] + .reviewText, + style: TextStyle( + fontSize: 20), + ), + ), + SizedBox( + height: 50, + ), + Divider( + height: 1, + color: Colors.grey), + ], + ), + ); + }, + ) + : Container( + padding: EdgeInsets.all(15), + alignment: Alignment.center, + child: Text('No Reviews Available'), + ), ) : isAvailabilty ? BaseView( - onModelReady: (model) => model.getProductLocationData(), - builder: (_, model, wi) => model.productLocationService.length == 0 + onModelReady: (model) => + model.getProductLocationData(), + builder: (_, model, wi) => model + .productLocationService + .length == 0 ? Container( padding: EdgeInsets.all(15), alignment: Alignment.center, - child: Text('No location Available'), + child: Text( + 'No location Available'), ) : ListView.builder( physics: ScrollPhysics(), scrollDirection: Axis.vertical, shrinkWrap: true, - itemCount: model.productLocationService.length, - itemBuilder: (BuildContext context, int index) { + itemCount: model + .productLocationService + .length, + itemBuilder: + (BuildContext context, + int index) { return Padding( - padding: EdgeInsets.all(8.0), + padding: + EdgeInsets.all(8.0), child: Column( // crossAxisAlignment: CrossAxisAlignment.start, // mainAxisAlignment: MainAxisAlignment.start, children: [ Row( // crossAxisAlignment: CrossAxisAlignment.start, - mainAxisAlignment: MainAxisAlignment.start, + mainAxisAlignment: + MainAxisAlignment + .start, children: [ Expanded( flex: 1, - child: Image.network(model.productLocationService[index].projectImageUrl), + child: Image.network(model + .productLocationService[ + index] + .projectImageUrl), ), SizedBox( width: 10, @@ -392,31 +514,48 @@ class __ProductDetailPageState extends State { Expanded( flex: 4, child: Text( - model.productLocationService[index].locationDescription + + model + .productLocationService[ + index] + .locationDescription + "\n" + - fixingString(model.productLocationService[0].cityName.toString()), - style: TextStyle(fontSize: 12), + fixingString(model + .productLocationService[ + 0] + .cityName + .toString()), + style: TextStyle( + fontSize: + 12), ), ), Expanded( flex: 1, child: IconButton( - icon: Icon(Icons.location_on), - color: Colors.red, - onPressed: () {}, + icon: Icon(Icons + .location_on), + color: + Colors.red, + onPressed: + () {}, ), ), Expanded( flex: 1, child: IconButton( - icon: Icon(Icons.phone), - color: Colors.red, - onPressed: () {}, + icon: Icon(Icons + .phone), + color: + Colors.red, + onPressed: + () {}, ), ), ], ), - Divider(height: 1.2, color: Colors.grey) + Divider( + height: 1.2, + color: Colors.grey) ], ), ); @@ -431,8 +570,12 @@ class __ProductDetailPageState extends State { ], ), ), - bottomSheet: footerWidget(widget.product.stockAvailability != 'Out of stock', widget.product.orderMaximumQuantity, - widget.product.orderMinimumQuantity, widget.product.stockQuantity, widget.product), + bottomSheet: footerWidget( + widget.product.stockAvailability != 'Out of stock', + widget.product.orderMaximumQuantity, + widget.product.orderMinimumQuantity, + widget.product.stockQuantity, + widget.product), ) : AppScaffold( appBarTitle: 'product detail page', @@ -465,12 +608,18 @@ class __ProductDetailPageState extends State { alignment: Alignment.centerRight, child: languageID == 'ar' ? Text( - widget.product.discountDescriptionn, - style: TextStyle(fontWeight: FontWeight.bold, fontSize: 17), + widget.product + .discountDescriptionn, + style: TextStyle( + fontWeight: FontWeight.bold, + fontSize: 17), ) : Text( - widget.product.discountDescription, - style: TextStyle(fontWeight: FontWeight.bold, fontSize: 17), + widget.product + .discountDescription, + style: TextStyle( + fontWeight: FontWeight.bold, + fontSize: 17), ), ), ), @@ -481,7 +630,8 @@ class __ProductDetailPageState extends State { flex: 0, child: Container( child: Image( - image: AssetImage('assets/images/offer.png'), + image: AssetImage( + 'assets/images/offer.png'), ), ), ), @@ -551,7 +701,9 @@ class __ProductDetailPageState extends State { }, child: Text( TranslationBase.of(context).details, - style: TextStyle(fontSize: 16, fontWeight: FontWeight.bold), + style: TextStyle( + fontSize: 16, + fontWeight: FontWeight.bold), ), color: Colors.white, ), @@ -579,7 +731,9 @@ class __ProductDetailPageState extends State { }, child: Text( TranslationBase.of(context).reviews, - style: TextStyle(fontSize: 16, fontWeight: FontWeight.bold), + style: TextStyle( + fontSize: 16, + fontWeight: FontWeight.bold), ), color: Colors.white, ), @@ -607,7 +761,9 @@ class __ProductDetailPageState extends State { }, child: Text( TranslationBase.of(context).availability, - style: TextStyle(fontSize: 16, fontWeight: FontWeight.bold), + style: TextStyle( + fontSize: 16, + fontWeight: FontWeight.bold), ), color: Colors.white, ), @@ -635,7 +791,10 @@ class __ProductDetailPageState extends State { Container( child: Text( TranslationBase.of(context).description, - style: TextStyle(fontSize: 17, color: Colors.grey, fontWeight: FontWeight.w600), + style: TextStyle( + fontSize: 17, + color: Colors.grey, + fontWeight: FontWeight.w600), ), ), SizedBox( @@ -643,8 +802,12 @@ class __ProductDetailPageState extends State { ), Container( child: Text( - languageID == 'ar' ? widget.product.fullDescriptionn : widget.product.fullDescription, - style: TextStyle(fontSize: 16, fontFamily: 'WorkSans-Regular'), + languageID == 'ar' + ? widget.product.fullDescriptionn + : widget.product.fullDescription, + style: TextStyle( + fontSize: 16, + fontFamily: 'WorkSans-Regular'), ), ), ], @@ -652,79 +815,132 @@ class __ProductDetailPageState extends State { ) : isReviews ? BaseView( - onModelReady: (model) => model.getProductReviewsData(widget.product.id), - builder: (_, model, wi) => - model.productDetailService.length != 0 && model.productDetailService[0].reviews.length != 0 - ? ListView.builder( - physics: ScrollPhysics(), - itemCount: model.productDetailService[0].reviews.length, - scrollDirection: Axis.vertical, - shrinkWrap: true, - itemBuilder: (BuildContext context, int index) { - return Padding( - padding: EdgeInsets.all(8.0), - child: Column( - mainAxisAlignment: MainAxisAlignment.start, - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Container( - child: Row( - children: [ - Container( - child: Text( - model.productDetailService[0].reviews[index].customerId.toString(), - style: TextStyle(fontSize: 17, color: Colors.grey, fontWeight: FontWeight.w600), - ), - ), - Container( - margin: EdgeInsets.only(left: 210), - child: RatingBar.readOnly( - initialRating: model.productDetailService[0].reviews[index].rating.toDouble(), - size: 15.0, - filledColor: Colors.yellow[700], - emptyColor: Colors.grey[500], - isHalfAllowed: true, - halfFilledIcon: Icons.star_half, - filledIcon: Icons.star, - emptyIcon: Icons.star, - ), - ), - ], + onModelReady: (model) => + model.getProductReviewsData( + widget.product.id), + builder: (_, model, wi) => model + .productDetailService + .length != + 0 && + model.productDetailService[0] + .reviews.length != + 0 + ? ListView.builder( + physics: ScrollPhysics(), + itemCount: model + .productDetailService[0] + .reviews + .length, + scrollDirection: Axis.vertical, + shrinkWrap: true, + itemBuilder: (BuildContext context, + int index) { + return Padding( + padding: EdgeInsets.all(8.0), + child: Column( + mainAxisAlignment: + MainAxisAlignment.start, + crossAxisAlignment: + CrossAxisAlignment.start, + children: [ + Container( + child: Row( + children: [ + Container( + child: Text( + model + .productDetailService[ + 0] + .reviews[ + index] + .customerId + .toString(), + style: TextStyle( + fontSize: 17, + color: Colors + .grey, + fontWeight: + FontWeight + .w600), + ), ), - ), - SizedBox( - height: 10, - ), - Container( - child: Text( - model.productDetailService[0].reviews[index].reviewText, - style: TextStyle(fontSize: 20), + Container( + margin: + EdgeInsets.only( + left: 210), + child: RatingBar + .readOnly( + initialRating: model + .productDetailService[ + 0] + .reviews[ + index] + .rating + .toDouble(), + size: 15.0, + filledColor: + Colors.yellow[ + 700], + emptyColor: Colors + .grey[500], + isHalfAllowed: + true, + halfFilledIcon: + Icons + .star_half, + filledIcon: + Icons.star, + emptyIcon: + Icons.star, + ), ), - ), - SizedBox( - height: 50, - ), - Divider(height: 1, color: Colors.grey), - ], + ], + ), ), - ); - }, - ) - : Container( - padding: EdgeInsets.all(15), - alignment: Alignment.center, - child: Text('No Reviews Available'), - ), + SizedBox( + height: 10, + ), + Container( + child: Text( + model + .productDetailService[ + 0] + .reviews[index] + .reviewText, + style: TextStyle( + fontSize: 20), + ), + ), + SizedBox( + height: 50, + ), + Divider( + height: 1, + color: Colors.grey), + ], + ), + ); + }, + ) + : Container( + padding: EdgeInsets.all(15), + alignment: Alignment.center, + child: Text('No Reviews Available'), + ), ) : isAvailabilty ? BaseView( - onModelReady: (model) => model.getProductLocationData(), - builder: (_, model, wi) => ListView.builder( + onModelReady: (model) => + model.getProductLocationData(), + builder: (_, model, wi) => + ListView.builder( physics: ScrollPhysics(), scrollDirection: Axis.vertical, shrinkWrap: true, - itemCount: model.productLocationService.length, - itemBuilder: (BuildContext context, int index) { + itemCount: model + .productLocationService.length, + itemBuilder: (BuildContext context, + int index) { return Padding( padding: EdgeInsets.all(8.0), child: Column( @@ -733,11 +949,15 @@ class __ProductDetailPageState extends State { children: [ Row( // crossAxisAlignment: CrossAxisAlignment.start, - mainAxisAlignment: MainAxisAlignment.start, + mainAxisAlignment: + MainAxisAlignment.start, children: [ Expanded( flex: 1, - child: Image.network(model.productLocationService[index].projectImageUrl), + child: Image.network(model + .productLocationService[ + index] + .projectImageUrl), ), SizedBox( width: 10, @@ -745,16 +965,25 @@ class __ProductDetailPageState extends State { Expanded( flex: 4, child: Text( - model.productLocationService[index].locationDescription + + model + .productLocationService[ + index] + .locationDescription + "\n" + - fixingString(model.productLocationService[0].cityName.toString()), - style: TextStyle(fontSize: 12), + fixingString(model + .productLocationService[ + 0] + .cityName + .toString()), + style: TextStyle( + fontSize: 12), ), ), Expanded( flex: 1, child: IconButton( - icon: Icon(Icons.location_on), + icon: Icon(Icons + .location_on), color: Colors.red, onPressed: () {}, ), @@ -762,14 +991,17 @@ class __ProductDetailPageState extends State { Expanded( flex: 1, child: IconButton( - icon: Icon(Icons.phone), + icon: + Icon(Icons.phone), color: Colors.red, onPressed: () {}, ), ), ], ), - Divider(height: 1.2, color: Colors.grey) + Divider( + height: 1.2, + color: Colors.grey) ], ), ); @@ -784,8 +1016,12 @@ class __ProductDetailPageState extends State { ], ), ), - bottomSheet: footerWidget(widget.product.stockAvailability != 'Out of stock', widget.product.orderMaximumQuantity, - widget.product.orderMinimumQuantity, widget.product.stockQuantity, widget.product), + bottomSheet: footerWidget( + widget.product.stockAvailability != 'Out of stock', + widget.product.orderMaximumQuantity, + widget.product.orderMinimumQuantity, + widget.product.stockQuantity, + widget.product), ); } } @@ -796,7 +1032,8 @@ class footerWidget extends StatefulWidget { final int minQuantity; final int quantityLimit; final PharmacyProduct item; - footerWidget(this.isAvailble, this.maxQuantity, this.minQuantity, this.quantityLimit, this.item); + footerWidget(this.isAvailble, this.maxQuantity, this.minQuantity, + this.quantityLimit, this.item); @override _footerWidgetState createState() => _footerWidgetState(); } @@ -826,7 +1063,8 @@ class _footerWidgetState extends State { padding: const EdgeInsets.all(8.0), child: Text( TranslationBase.of(context).quantity, - style: TextStyle(fontSize: 15, fontWeight: FontWeight.bold), + style: TextStyle( + fontSize: 15, fontWeight: FontWeight.bold), ), ), // ListView( @@ -848,7 +1086,9 @@ class _footerWidgetState extends State { color: Colors.white, child: Text( '1', - style: TextStyle(fontWeight: FontWeight.bold, fontSize: 20), + style: TextStyle( + fontWeight: FontWeight.bold, + fontSize: 20), ), ), onTap: () { @@ -873,7 +1113,9 @@ class _footerWidgetState extends State { color: Colors.white, child: Text( '2', - style: TextStyle(fontWeight: FontWeight.bold, fontSize: 20), + style: TextStyle( + fontWeight: FontWeight.bold, + fontSize: 20), ), ), onTap: () { @@ -898,7 +1140,9 @@ class _footerWidgetState extends State { color: Colors.white, child: Text( '3', - style: TextStyle(fontWeight: FontWeight.bold, fontSize: 20), + style: TextStyle( + fontWeight: FontWeight.bold, + fontSize: 20), ), ), onTap: () { @@ -923,7 +1167,9 @@ class _footerWidgetState extends State { color: Colors.white, child: Text( '4', - style: TextStyle(fontWeight: FontWeight.bold, fontSize: 20), + style: TextStyle( + fontWeight: FontWeight.bold, + fontSize: 20), ), ), onTap: () { @@ -948,7 +1194,9 @@ class _footerWidgetState extends State { color: Colors.white, child: Text( '5', - style: TextStyle(fontWeight: FontWeight.bold, fontSize: 20), + style: TextStyle( + fontWeight: FontWeight.bold, + fontSize: 20), ), ), onTap: () { @@ -973,7 +1221,9 @@ class _footerWidgetState extends State { color: Colors.white, child: Text( '6', - style: TextStyle(fontWeight: FontWeight.bold, fontSize: 20), + style: TextStyle( + fontWeight: FontWeight.bold, + fontSize: 20), ), ), onTap: () { @@ -998,7 +1248,9 @@ class _footerWidgetState extends State { color: Colors.white, child: Text( '7', - style: TextStyle(fontWeight: FontWeight.bold, fontSize: 20), + style: TextStyle( + fontWeight: FontWeight.bold, + fontSize: 20), ), ), onTap: () { @@ -1023,7 +1275,9 @@ class _footerWidgetState extends State { color: Colors.white, child: Text( '8', - style: TextStyle(fontWeight: FontWeight.bold, fontSize: 20), + style: TextStyle( + fontWeight: FontWeight.bold, + fontSize: 20), ), ), onTap: () { @@ -1048,7 +1302,9 @@ class _footerWidgetState extends State { color: Colors.white, child: Text( '9', - style: TextStyle(fontWeight: FontWeight.bold, fontSize: 20), + style: TextStyle( + fontWeight: FontWeight.bold, + fontSize: 20), ), ), onTap: () { @@ -1073,7 +1329,9 @@ class _footerWidgetState extends State { color: Colors.white, child: Text( '10', - style: TextStyle(fontWeight: FontWeight.bold, fontSize: 20), + style: TextStyle( + fontWeight: FontWeight.bold, + fontSize: 20), ), ), onTap: () { @@ -1094,7 +1352,8 @@ class _footerWidgetState extends State { Container( width: 50.0, child: TextField( - decoration: InputDecoration(labelText: 'quantity #'), + decoration: + InputDecoration(labelText: 'quantity #'), onChanged: (text) { print(price); print(widget.quantityLimit); @@ -1164,7 +1423,9 @@ class _footerWidgetState extends State { }, ), ), - !widget.isAvailble && price > 0 || price > widget.quantityLimit + !widget.isAvailble && price > 0 || + price > widget.quantityLimit || + widget.item.rxMessage != null ? Container( width: 190, height: 46, @@ -1173,7 +1434,10 @@ class _footerWidgetState extends State { alignment: Alignment.center, child: Text( TranslationBase.of(context).addToCart, - style: TextStyle(color: Colors.white, fontWeight: FontWeight.bold, fontSize: 15), + style: TextStyle( + color: Colors.white, + fontWeight: FontWeight.bold, + fontSize: 15), ), ), ) @@ -1188,14 +1452,19 @@ class _footerWidgetState extends State { color: Colors.green, child: Text( TranslationBase.of(context).addToCart, - style: TextStyle(color: Colors.white, fontWeight: FontWeight.bold, fontSize: 15), + style: TextStyle( + color: Colors.white, + fontWeight: FontWeight.bold, + fontSize: 15), ), ), ), SizedBox( width: 5, ), - !widget.isAvailble && price > 0 || price > widget.quantityLimit + !widget.isAvailble && price > 0 || + price > widget.quantityLimit || + widget.item.rxMessage != null ? Container( width: 120, height: 46, @@ -1204,7 +1473,10 @@ class _footerWidgetState extends State { alignment: Alignment.center, child: Text( TranslationBase.of(context).buyNow, - style: TextStyle(color: Colors.white, fontWeight: FontWeight.bold, fontSize: 15), + style: TextStyle( + color: Colors.white, + fontWeight: FontWeight.bold, + fontSize: 15), ), ), ) @@ -1214,7 +1486,8 @@ class _footerWidgetState extends State { addToCartFunction(price, widget.item.id); Navigator.push( context, - MaterialPageRoute(builder: (context) => CartOrderPage()), + MaterialPageRoute( + builder: (context) => CartOrderPage()), ); }, child: Container( @@ -1224,7 +1497,10 @@ class _footerWidgetState extends State { color: Colors.blue, child: Text( TranslationBase.of(context).buyNow, - style: TextStyle(color: Colors.white, fontWeight: FontWeight.bold, fontSize: 15), + style: TextStyle( + color: Colors.white, + fontWeight: FontWeight.bold, + fontSize: 15), ), ), ), @@ -1255,7 +1531,7 @@ class _productNameAndPriceState extends State { child: Row( children: [ Text( - widget.item.price.toString()+" "+ "SAR", + widget.item.price.toString() + " " + "SAR", style: TextStyle(fontWeight: FontWeight.bold, fontSize: 30), ), SizedBox( @@ -1265,12 +1541,15 @@ class _productNameAndPriceState extends State { widget.item.stockAvailability, style: widget.item.stockAvailability == 'Out of stock' ? TextStyle(fontWeight: FontWeight.bold, color: Colors.red) - : TextStyle(fontWeight: FontWeight.bold, color: Colors.green), + : TextStyle( + fontWeight: FontWeight.bold, color: Colors.green), ), SizedBox(width: 20), - widget.item.stockAvailability == 'Out of stock' && customerId != null + widget.item.stockAvailability == 'Out of stock' && + customerId != null ? InkWell( - onTap: () => notifyMeWhenAvailable(context, widget.item.id), + onTap: () => + notifyMeWhenAvailable(context, widget.item.id), child: Row(children: [ Text( TranslationBase.of(context).notifyMe, @@ -1288,34 +1567,33 @@ class _productNameAndPriceState extends State { ]), ) : Container( - margin: languageID == 'ar' ? EdgeInsets.only(right: 25) : EdgeInsets.only(left: 25), + margin: languageID == 'ar' + ? EdgeInsets.only(right: 25) + : EdgeInsets.only(left: 25), width: 40, height: 40, decoration: BoxDecoration( color: Colors.grey, borderRadius: BorderRadius.circular(30), ), - child: !isInWishlit - ? IconButton( - icon: Icon(Icons.favorite_border), - color: Colors.white, - onPressed: () { - setState(() { - addToWishlistFunction(widget.item.id); - }); -// MyStatelessWidget(); - }, - ) - : IconButton( - icon: Icon(Icons.favorite), - color: Colors.red, - onPressed: () { - setState(() { - deleteFromWishlistFunction(widget.item.id); - }); -// MyStatelessWidget(); - }, - )), + child: IconButton( + icon: Icon(!isInWishlit + ? Icons.favorite_border + : Icons.favorite), + color: !isInWishlit ? Colors.white : Colors.red, + onPressed: () async { + if (customerId != null) { + if (!isInWishlit) { + await addToWishlistFunction(widget.item.id); + } else { + await deleteFromWishlistFunction(widget.item.id); + } + } else { + return; + } + setState(() {}); + }, + )), ], ), ), @@ -1324,9 +1602,12 @@ class _productNameAndPriceState extends State { child: Container( margin: EdgeInsets.only(left: 5), child: Align( - alignment: languageID == 'ar' ? Alignment.topRight : Alignment.topLeft, + alignment: + languageID == 'ar' ? Alignment.topRight : Alignment.topLeft, child: Text( - languageID == 'ar' ? widget.item.fullDescriptionn : widget.item.fullDescription, + languageID == 'ar' + ? widget.item.fullDescriptionn + : widget.item.fullDescription, style: TextStyle(fontWeight: FontWeight.bold, fontSize: 15), ), ), @@ -1358,7 +1639,9 @@ class _productNameAndPriceState extends State { child: Container( child: widget.item.rxMessage != null ? Text( - languageID == 'ar' ? widget.item.rxMessagen.toString() : widget.item.rxMessage.toString(), + languageID == 'ar' + ? widget.item.rxMessagen.toString() + : widget.item.rxMessage.toString(), style: TextStyle(color: Colors.red, fontSize: 10), ) : Container()), @@ -1377,135 +1660,6 @@ class _productNameAndPriceState extends State { } } -//productNameAndPrice(BuildContext context, item) { -// return Column( -// mainAxisAlignment: MainAxisAlignment.start, -// children: [ -// Padding( -// padding: const EdgeInsets.all(8.0), -// child: Row( -// children: [ -// Text( -// item.price.toString(), -// style: TextStyle(fontWeight: FontWeight.bold, fontSize: 30), -// ), -// SizedBox( -// width: 40, -// ), -// Text( -// item.stockAvailability, -// style: item.stockAvailability == 'Out of stock' -// ? TextStyle(fontWeight: FontWeight.bold, color: Colors.red) -// : TextStyle(fontWeight: FontWeight.bold, color: Colors.green), -// ), -// SizedBox(width: 20), -// item.stockAvailability == 'Out of stock' -// ? Text( -// TranslationBase.of(context).notifyMe, -// style: TextStyle( -// color: Colors.blue, -// decoration: TextDecoration.underline, -// ), -// ) -// : Container(), -// item.stockAvailability == 'Out of stock' -// ? Icon( -// FontAwesomeIcons.bell, -// color: Colors.blue, -// size: 15.0, -// ) -// : Container(), -// -// Container( -// margin: languageID=='ar' ? EdgeInsets.only(right: 25) : EdgeInsets.only(left: 25), -// width: 40, -// height: 40, -// decoration: BoxDecoration( -// color: Colors.grey, -// borderRadius: BorderRadius.circular(30), -// ), -// child: !isInWishlit ?IconButton( -// icon: Icon(Icons.favorite_border), -// color: Colors.white, -// onPressed: () { -// addToWishlistFunction(item.id); -//// MyStatelessWidget(); -// -// }, -// ):IconButton( -// icon: Icon(Icons.favorite), -// color: Colors.red, -// onPressed: () { -// deleteFromWishlistFunction(item.id); -//// MyStatelessWidget(); -// -// }, -// ) -// ), -// -// ], -// ), -// ), -// Padding( -// padding: const EdgeInsets.all(8.0), -// child: Container( -// margin: EdgeInsets.only(left: 5), -// child: Align( -// alignment: -// languageID == 'ar' ? Alignment.topRight : Alignment.topLeft, -// child: Text( -// languageID == 'ar' ? item.fullDescriptionn : item.fullDescription, -// style: TextStyle(fontWeight: FontWeight.bold, fontSize: 15), -// ), -// ), -// ), -// ), -// Row( -// children: [ -// Expanded( -// flex: 2, -// child: Container( -// margin: EdgeInsets.only(right: 150), -// child: Align( -// alignment: Alignment.bottomLeft, -// child: RatingBar.readOnly( -// initialRating: 3, -// size: 15.0, -// filledColor: Colors.yellow[700], -// emptyColor: Colors.grey[500], -// isHalfAllowed: true, -// halfFilledIcon: Icons.star_half, -// filledIcon: Icons.star, -// emptyIcon: Icons.star, -// ), -// ), -// ), -// ), -// Expanded( -// flex: 1, -// child: Container( -// child: item.rxMessage != null -// ? Text( -// languageID == 'ar' -// ? item.rxMessagen.toString() -// : item.rxMessage.toString(), -// style: TextStyle(color: Colors.red, fontSize: 10), -// ) -// : Container()), -// ), -// item.rxMessage != null -// ? Icon( -// FontAwesomeIcons.questionCircle, -// color: Colors.red, -// size: 15.0, -// ) -// : Container(), -// ], -// ), -// ], -// ); -//} - slideDetail() { return Row( mainAxisAlignment: MainAxisAlignment.start, @@ -1524,7 +1678,9 @@ slideDetail() { ), color: Colors.white, ), - child: const Text('1', textAlign: TextAlign.center, style: TextStyle(color: Color(0xFF000000))), + child: const Text('1', + textAlign: TextAlign.center, + style: TextStyle(color: Color(0xFF000000))), ), ) ], @@ -1568,22 +1724,21 @@ addToWishlistFunction(itemID) async { deleteFromWishlistFunction(itemID) async { ProductDetailViewModel x = new ProductDetailViewModel(); isInWishlit = false; - await x.addToWishlistData(itemID); + await x.deletWishlistData(itemID); } checkWishlist() async { ProductDetailViewModel x = new ProductDetailViewModel(); await x.checkWishlistData(); + +// isInWishlit = x.wishListItems.map((e) => e.id.toString()).toList().contains(itemID); + for (int i = 0; i < x.wishListItems.length; i++) { -// print(itemID); -// print(x.wishListItems[i].product.id); if (itemID == x.wishListItems[i].product.id) { isInWishlit = true; -// print('in wishlist'); break; } else { isInWishlit = false; -// print('not in wishlist'); } } } @@ -1603,21 +1758,28 @@ settingModalBottomSheet(context) { child: new Wrap( children: [ new ListTile( - leading: new Icon(Icons.shopping_cart), - title: new Text('Add to cart'), + leading: Icon(Icons.shopping_cart), + title: Text('Add to cart'), onTap: () => { - if (price > 0) {addToCartFunction(price, itemID)} else {AppToast.showErrorToast(message: "you should add quantity")} + if (price > 0) + {addToCartFunction(price, itemID)} + else + { + AppToast.showErrorToast( + message: "you should add quantity") + } }), - new ListTile( - leading: new Icon(Icons.favorite_border), - title: new Text('Add to wishlist'), + ListTile( + leading: Icon(Icons.favorite_border), + title: Text('Add to wishlist'), onTap: () => {addToWishlistFunction(itemID)}, ), - new ListTile( - leading: new Icon(Icons.compare), - title: new Text('Compare'), + ListTile( + leading: Icon(Icons.compare), + title: Text('Compare'), onTap: () => { - Provider.of(context, listen: false).addItem(specificationData), + Provider.of(context, listen: false) + .addItem(specificationData), }, ), ], @@ -1625,15 +1787,3 @@ settingModalBottomSheet(context) { ); }); } - -Future userInfo(id, product) async { - customerId = await sharedPref.getString(PHARMACY_CUSTOMER_ID); - if (customerId != null) { - itemID = id; - product = product; - checkWishlist(); - } - print("customerId:$customerId"); - return customerId; -// getSpecificationData(itemID); -} diff --git a/lib/pages/pharmacies/wishlist.dart b/lib/pages/pharmacies/wishlist.dart index 822dfe89..000e8404 100644 --- a/lib/pages/pharmacies/wishlist.dart +++ b/lib/pages/pharmacies/wishlist.dart @@ -5,6 +5,8 @@ import 'package:flutter/material.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; class WishlistPage extends StatefulWidget { + bool showBar; + WishlistPage(this.showBar); @override _WishlistPageState createState() => _WishlistPageState(); } @@ -17,9 +19,9 @@ class _WishlistPageState extends State { onModelReady: (model) => model.getWishlistData(), builder: (_, model, wi) => AppScaffold( appBarTitle: 'Wishlist page', - isShowAppBar: false, + isShowAppBar: widget.showBar, isShowDecPage: false, - isPharmacy: false, + isPharmacy: true, baseViewModel: model, body: model.wishListList.length == 0 ? Container( diff --git a/lib/pages/pharmacy/profile/profile.dart b/lib/pages/pharmacy/profile/profile.dart index fb1e1c2a..6c07e2a4 100644 --- a/lib/pages/pharmacy/profile/profile.dart +++ b/lib/pages/pharmacy/profile/profile.dart @@ -226,7 +226,7 @@ class _ProfilePageState extends State { context, MaterialPageRoute( builder: (context) => - WishlistPage())); + WishlistPage(true))); }, child: Column( children: [ diff --git a/lib/services/pharmacy_services/product_detail_service.dart b/lib/services/pharmacy_services/product_detail_service.dart index 0aca11a3..276151a7 100644 --- a/lib/services/pharmacy_services/product_detail_service.dart +++ b/lib/services/pharmacy_services/product_detail_service.dart @@ -121,7 +121,7 @@ class ProductDetailService extends BaseService { request = { "shopping_cart_item": {"quantity": 1, "shopping_cart_type": "Wishlist", "product_id": itemID, "customer_id": customerId, "language_id": 1} }; - await baseAppClient.post(GET_SHOPPING_CART, + await baseAppClient.pharmacyPost(GET_SHOPPING_CART, onSuccess: (dynamic response, int statusCode) { _wishListProducts.clear(); response['shopping_carts'].forEach((item) { @@ -172,6 +172,7 @@ class ProductDetailService extends BaseService { _productSpecification.clear(); response['specification'].forEach((item) { _productSpecification.add(SpecificationModel.fromJson(item)); + print(_productSpecification); }); }, onFailure: (String error, int statusCode) { hasError = true; diff --git a/lib/widgets/pharmacy/product_tile.dart b/lib/widgets/pharmacy/product_tile.dart index 169decb0..ddf4f14f 100644 --- a/lib/widgets/pharmacy/product_tile.dart +++ b/lib/widgets/pharmacy/product_tile.dart @@ -66,8 +66,8 @@ class productTile extends StatelessWidget { ) : Container( margin: EdgeInsets.only(left: 10), - child: Image.asset( - "assets/images/no_image.png", + child: Image.network( + productImage, width: 80, height: 80, ) From e5829d8513b83875d9ef00ff2c7e287b059ce303 Mon Sep 17 00:00:00 2001 From: Fatimah Alshammari Date: Mon, 1 Mar 2021 14:22:45 +0300 Subject: [PATCH 05/11] fix recommended for you --- .../screens/pharmacy_module_page.dart | 500 ++++---- .../screens/recommended-product-page.dart | 1055 +++++++++-------- lib/pages/pharmacy/order/OrderDetails.dart | 15 +- 3 files changed, 798 insertions(+), 772 deletions(-) diff --git a/lib/pages/pharmacies/screens/pharmacy_module_page.dart b/lib/pages/pharmacies/screens/pharmacy_module_page.dart index bbdb5f8c..806a2081 100644 --- a/lib/pages/pharmacies/screens/pharmacy_module_page.dart +++ b/lib/pages/pharmacies/screens/pharmacy_module_page.dart @@ -33,13 +33,14 @@ import 'package:diplomaticquarterapp/core/viewModels/medical/prescriptions_view_ bool isInWishlist = false; int price = 0; -dynamic itemID; +var itemID; var product; var customerId; var item; dynamic languageID; List wishlistData; + class PharmacyPage extends StatefulWidget { // final PharmacyProduct product; // PharmacyPage(this.product); @@ -49,7 +50,7 @@ class PharmacyPage extends StatefulWidget { } class _PharmacyPageState extends State { - dynamic wishlistVar; +// dynamic wishlistVar; getLanguageID() async { languageID = await sharedPref.getString(APP_LANGUAGE); @@ -61,7 +62,7 @@ class _PharmacyPageState extends State { var model; // String ProductId="4561"; //String id ="3608"; - String ProductId = ""; + String productId = ""; String id = ""; @override void initState() { @@ -123,7 +124,7 @@ class _PharmacyPageState extends State { ? MediaQuery.of(context).size.height * 0.28 : 0, padding: - EdgeInsets.symmetric(horizontal: 18.0, vertical: 18.0), + EdgeInsets.symmetric(horizontal: 18.0, vertical: 14.0), // height: MediaQuery.of(context).size.height * 0.28, // width: 200.0, // height: MediaQuery.of(context).size.height / 4 + 20, @@ -221,11 +222,9 @@ class _PharmacyPageState extends State { BorderRadius.circular( 30.0)), child: Text( - model - .prescriptionsList[ - index] - .isInOutPatientDescription - .toString(), + languageID == "ar" + ? model.prescriptionsList[index].isInOutPatientDescriptionN.toString() + : model.prescriptionsList[index].isInOutPatientDescription.toString(), style: TextStyle( color: Colors.white, fontSize: 15.0, @@ -341,257 +340,238 @@ class _PharmacyPageState extends State { : Container(), ), ), - Container( - margin: EdgeInsets.fromLTRB(10, 10, 10, 10), - child: Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - Texts( - TranslationBase.of(context).recommended, - bold: true, - ), - BorderedButton( - TranslationBase.of(context).viewAll, - hasBorder: true, - borderColor: Colors.green, - textColor: Colors.green, - vPadding: 6, - hPadding: 4, - handler: () { - Navigator.push( - context, - MaterialPageRoute( - builder: (context) => - RecommendedProductPage())); - }, - ), - ], - ), - ), - Container( - height: model.recommendedProductList.length > 0 - ? MediaQuery.of(context).size.height * 0.30 - : 0, - margin: EdgeInsets.symmetric(horizontal: 6, vertical: 4), -// padding: EdgeInsets.symmetric(horizontal: 5.0, vertical: 22.0), -// margin: EdgeInsets.only(left: 10), - child: BaseView( - onModelReady: (model) => - model.getRecommendedProducts(ProductId), - builder: (_, model, wi) => model - .recommendedProductList.length != - null - ? ListView.builder( - scrollDirection: Axis.horizontal, - shrinkWrap: true, - physics: ScrollPhysics(), - // physics: NeverScrollableScrollPhysics(), - itemCount: model.recommendedProductList.length, - itemBuilder: (context, index) { - return Card( - elevation: 2, - shape: RoundedRectangleBorder( - side: BorderSide( - color: Colors.grey[300], width: 2), - borderRadius: BorderRadius.circular(10)), -// - margin: EdgeInsets.symmetric( - horizontal: 8, - vertical: 4, - ), - child: Container( - decoration: BoxDecoration( - borderRadius: BorderRadius.all( - Radius.circular(15), - ), - ), - padding: EdgeInsets.symmetric(horizontal: 4), - width: MediaQuery.of(context).size.width / 3, -// - child: Column( - crossAxisAlignment: - CrossAxisAlignment.start, - children: [ - Stack(children: [ - Container( - child: Align( - alignment: Alignment.topRight, - child: //true - itemID.contains(model - .recommendedProductList[ - index] - .id) - // !isInWishlist - ? IconButton( - icon: Icon(Icons - .favorite_border), - color: Colors.grey, - iconSize: 30, - onPressed: () { - setState(() { - addToWishlistFunction( - itemID); - }); - }, - ) - : IconButton( - icon: Icon( - Icons.favorite), - color: Colors.red, - iconSize: 30, - onPressed: () { - setState(() { - deleteFromWishlistFunction( - itemID); - }); - }, - ) -// - ), - ), - Container( - margin: EdgeInsets.fromLTRB( - 0, 16, 10, 16), - alignment: Alignment.center, -// padding: EdgeInsets.only(left: 25, bottom: 20), - child: (model - .recommendedProductList[ - index] - .images != - null && - model - .recommendedProductList[ - index] - .images - .length > - 0) - ? Image.network( - model - .recommendedProductList[ - index] - .images[0] - .src - .toString(), -// item.images[0].src, - fit: BoxFit.cover, - height: 60, - ) - : Image.asset( - "assets/images/no_image.png", - fit: BoxFit.cover, - height: 60, - ), - ), - Container( - width: model - .recommendedProductList[ - 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.recommendedProductList[index] - .rxMessage != - null - ? model - .recommendedProductList[ - index] - .rxMessage - : "", - color: Colors.white, - regular: true, - fontSize: 10, - fontWeight: FontWeight.w400, - ), - ), - ]), - Container( - margin: EdgeInsets.symmetric( - horizontal: 6, - vertical: 0, - ), - child: Column( - crossAxisAlignment: - CrossAxisAlignment.start, - children: [ - Text( - model - .recommendedProductList[index] - .name, - style: TextStyle( - color: Colors.black, - fontSize: 13.0, -// fontWeight: FontWeight.bold, - ), - ), - Padding( -// padding: const EdgeInsets.only(top: 15, bottom: 10), - padding: const EdgeInsets.only( - top: 10, bottom: 5), - child: Texts( - "SAR ${model.recommendedProductList[index].price}", - bold: true, - fontSize: 14, - ), - ), - ], - ), - ), - Row( - crossAxisAlignment: - CrossAxisAlignment.start, - children: [ - Container( - padding: - EdgeInsets.only(right: 10), -// margin: EdgeInsets.only(left: 5), - child: Align( - alignment: Alignment.topLeft, - child: RatingBar.readOnly( - initialRating: model - .recommendedProductList[ - index] - .approvedRatingSum - .toDouble(), -// initialRating: productRate, - size: 13.0, - filledColor: - Colors.yellow[700], - emptyColor: Colors.grey[500], - isHalfAllowed: true, - halfFilledIcon: - Icons.star_half, - filledIcon: Icons.star, - emptyIcon: Icons.star, - ), - ), - ), - Texts( - "(${model.recommendedProductList[index].approvedTotalReviews.toString()})", -// bold: true, - fontSize: 12, - ), - ]), - ], - ), - ), - ); - }) - : Container( -// child: Text("NO DATA"), - ), - ), - ), +// Container( +// margin: EdgeInsets.fromLTRB(10, 10, 10, 10), +// child: Row( +// mainAxisAlignment: MainAxisAlignment.spaceBetween, +// children: [ +// Texts( +// TranslationBase.of(context).recommended, +// bold: true, +// ), +// BorderedButton( +// TranslationBase.of(context).viewAll, +// hasBorder: true, +// borderColor: Colors.green, +// textColor: Colors.green, +// vPadding: 6, +// hPadding: 4, +// handler: () { +// Navigator.push( +// context, +// MaterialPageRoute( +// builder: (context) => +// RecommendedProductPage(productId : "2316"))); +// }, +// ), +// ], +// ), +// ), +// Container( +// height: model.recommendedProductList.length > 0 +// ? MediaQuery.of(context).size.height * 0.32 +// : 0, +// margin: EdgeInsets.symmetric(horizontal: 6, vertical: 4), +//// padding: EdgeInsets.symmetric(horizontal: 5.0, vertical: 22.0), +//// margin: EdgeInsets.only(left: 10), +// child: BaseView( +// onModelReady: (model) => +// model.getRecommendedProducts(productId), +// builder: (_, model, wi) => model +// .recommendedProductList.length != +// null +// ? ListView.builder( +// scrollDirection: Axis.horizontal, +// shrinkWrap: true, +// physics: ScrollPhysics(), +// // physics: NeverScrollableScrollPhysics(), +// itemCount: model.recommendedProductList.length, +// itemBuilder: (context, index) { +// return Card( +// elevation: 2, +// shape: RoundedRectangleBorder( +// side: BorderSide( +// color: Colors.grey[300], width: 2), +// borderRadius: BorderRadius.circular(10)), +// margin: EdgeInsets.symmetric( +// horizontal: 8, +// vertical: 0, +// ), +// child: Container( +// decoration: BoxDecoration( +// borderRadius: BorderRadius.all( +// Radius.circular(15), +// ), +// ), +// padding: EdgeInsets.symmetric(horizontal: 4), +// width: MediaQuery.of(context).size.width / 3, +// child: Column( +// crossAxisAlignment: +// CrossAxisAlignment.start, +// children: [ +// Stack(children: [ +// Container( +// child: Align( +// alignment: Alignment.topRight, +// child: //true +// itemID.contains(model.recommendedProductList[index].id) +// // !isInWishlist +// ? IconButton( +// icon: Icon(Icons +// .favorite_border), +// color: Colors.grey, +// iconSize: 30, +// onPressed: () { +// setState(() { +// addToWishlistFunction( +// itemID); +// }); +// }, +// ) +// : IconButton( +// icon: Icon( +// Icons.favorite), +// color: Colors.red, +// iconSize: 30, +// onPressed: () { +// setState(() { +// deleteFromWishlistFunction( +// itemID); +// }); +// }, +// ) +//// +// ), +// ), +// Container( +// margin: EdgeInsets.fromLTRB( +// 0, 16, 10, 16), +// alignment: Alignment.center, +//// padding: EdgeInsets.only(left: 25, bottom: 20), +// child: (model.recommendedProductList[index].images != null && +// model.recommendedProductList[index].images.length > 0) +// ? Image.network( +// model.recommendedProductList[index].images[0].src.toString(), +//// item.images[0].src, +// fit: BoxFit.cover, +// height: 60, +// ) +// : Image.asset( +// "assets/images/no_image.png", +// fit: BoxFit.cover, +// height: 60, +// ), +// ), +// Container( +// width: model +// .recommendedProductList[ +// 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.recommendedProductList[index] +// .rxMessage != +// null +// ? model +// .recommendedProductList[ +// index] +// .rxMessage +// : "", +// color: Colors.white, +// regular: true, +// fontSize: 10, +// fontWeight: FontWeight.w400, +// ), +// ), +// ]), +// Container( +// margin: EdgeInsets.symmetric( +// horizontal: 6, +// vertical: 0, +// ), +// child: Column( +// crossAxisAlignment: +// CrossAxisAlignment.start, +// children: [ +// Text( +// languageID == "ar" +// ? model.recommendedProductList[index].namen +// : model.recommendedProductList[index].name, +// style: TextStyle( +// color: Colors.black, +// fontSize: 13.0, +//// fontWeight: FontWeight.bold, +// ), +// ), +// Padding( +//// padding: const EdgeInsets.only(top: 15, bottom: 10), +// padding: const EdgeInsets.only( +// top: 10, bottom: 5), +// child: Texts( +// "SAR ${model.recommendedProductList[index].price}", +// bold: true, +// fontSize: 14, +// ), +// ), +// ], +// ), +// ), +// Row( +// crossAxisAlignment: +// CrossAxisAlignment.start, +// children: [ +// Container( +// padding: +// EdgeInsets.only(right: 10), +//// margin: EdgeInsets.only(left: 5), +// child: Align( +// alignment: Alignment.topLeft, +// child: RatingBar.readOnly( +// initialRating: model +// .recommendedProductList[ +// index] +// .approvedRatingSum +// .toDouble(), +//// initialRating: productRate, +// size: 13.0, +// filledColor: +// Colors.yellow[700], +// emptyColor: Colors.grey[500], +// isHalfAllowed: true, +// halfFilledIcon: +// Icons.star_half, +// filledIcon: Icons.star, +// emptyIcon: Icons.star, +// ), +// ), +// ), +// Texts( +// "(${model.recommendedProductList[index].approvedTotalReviews.toString()})", +//// bold: true, +// fontSize: 12, +// ), +// ]), +// ], +// ), +// ), +// ); +// }) +// : Container( +//// child: Text("NO DATA"), +// ), +// ), +// ), Container( margin: EdgeInsets.fromLTRB(10, 10, 10, 0), child: Row( diff --git a/lib/pages/pharmacies/screens/recommended-product-page.dart b/lib/pages/pharmacies/screens/recommended-product-page.dart index df5e08d3..28e3cce3 100644 --- a/lib/pages/pharmacies/screens/recommended-product-page.dart +++ b/lib/pages/pharmacies/screens/recommended-product-page.dart @@ -12,17 +12,25 @@ import 'package:diplomaticquarterapp/config/shared_pref_kay.dart'; dynamic languageID; bool isInWishlist = false; +int price = 0; var itemID; +var product; +var customerId; class RecommendedProductPage extends StatefulWidget { + String productId ; + RecommendedProductPage({this.productId}); + @override - _RecommendedProductPageState createState() => _RecommendedProductPageState(); + _RecommendedProductPageState createState() => _RecommendedProductPageState(productId: productId); } class _RecommendedProductPageState extends State with SingleTickerProviderStateMixin { List recommendedProductList = []; - String ProductId = "4561"; + String productId; + _RecommendedProductPageState({this.productId}); + String id = ""; bool styleOne = true; bool styleTwo = false; Icon styleIcon = Icon( @@ -35,9 +43,15 @@ class _RecommendedProductPageState extends State languageID = await sharedPref.getString(APP_LANGUAGE); } + // String productId = "4561"; + // String productId = ""; + @override void initState() { - super.initState(); + checkWishlist(); + userInfo(id, product); + print("-------------this--------------"); + print(itemID); } @override @@ -46,364 +60,366 @@ class _RecommendedProductPageState extends State final double itemHeight = ((size.height - kToolbarHeight - 24) * 0.80) / 2; final double itemWidth = size.width / 2; return BaseView( - onModelReady: (model) => model.getRecommendedProducts(ProductId), + onModelReady: (model) => model.getRecommendedProducts(productId), builder: (_, model, wi) => AppScaffold( appBarTitle: TranslationBase.of(context).recommended, baseViewModel: model, isShowAppBar: true, isPharmacy: true, backgroundColor: Colors.white, - body: Column(children: [ - Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - Row( - mainAxisAlignment: MainAxisAlignment.start, - children: [ - Container( - padding: EdgeInsets.only( - top: 8, - bottom: 10, - left: 10, - ), - child: Text( - model.recommendedProductList.length.toString(), - style: TextStyle( - color: Colors.black, - fontSize: 14.0, + body: SingleChildScrollView( + child: Column(children: [ + Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Row( + mainAxisAlignment: MainAxisAlignment.start, + children: [ + Container( + padding: EdgeInsets.only( + top: 8, + bottom: 10, + left: 10, + ), + child: Text( + model.recommendedProductList.length.toString(), + style: TextStyle( + color: Colors.black, + fontSize: 14.0, + ), ), ), - ), - Container( - padding: EdgeInsets.only(top: 8, bottom: 10, left: 8), - child: Text( - TranslationBase.of(context).result, - style: TextStyle( - color: Colors.black, - fontSize: 14.0, + Container( + padding: EdgeInsets.only(top: 8, bottom: 10, left: 8), + child: Text( + TranslationBase.of(context).result, + style: TextStyle( + color: Colors.black, + fontSize: 14.0, + ), ), ), - ), - ], - ), - Row( - mainAxisAlignment: MainAxisAlignment.end, - children: [ - Padding( - padding: const EdgeInsets.symmetric(vertical: 8), - child: SizedBox( - child: Container( - width: 1, - color: Colors.grey, + ], + ), + Row( + mainAxisAlignment: MainAxisAlignment.end, + children: [ + Padding( + padding: const EdgeInsets.symmetric(vertical: 8), + child: SizedBox( + child: Container( + width: 1, + color: Colors.grey, + ), ), ), - ), - Container( - child: Image.asset( - 'assets/images/pharmacy/sort.png', - width: 20, - height: 20, + Container( + child: Image.asset( + 'assets/images/pharmacy/sort.png', + width: 20, + height: 20, // color: Colors.red, + ), ), - ), - Container( - child: Text( - TranslationBase.of(context).sort, - style: TextStyle( - color: Colors.black, - fontSize: 14.0, + Container( + child: Text( + TranslationBase.of(context).sort, + style: TextStyle( + color: Colors.black, + fontSize: 14.0, + ), ), ), - ), - Padding( - padding: const EdgeInsets.symmetric(vertical: 8), - child: SizedBox( - child: Container( - width: 1, - color: Colors.grey, + Padding( + padding: const EdgeInsets.symmetric(vertical: 8), + child: SizedBox( + child: Container( + width: 1, + color: Colors.grey, + ), ), ), - ), - Divider( - thickness: 1.0, - color: Colors.black12, - ), - Padding( - padding: EdgeInsets.all(8.0), - child: InkWell( - child: styleIcon, - onTap: () { - setState(() { - if (styleOne == true) { - styleOne = false; - styleTwo = true; - styleIcon = Icon( - Icons.auto_awesome_mosaic, - color: Colors.blue, - size: 29.0, - ); - } else { - styleOne = true; - styleTwo = false; - styleIcon = Icon( - Icons.widgets_sharp, - color: Colors.blue, - size: 29.0, - ); - } - }); - }, + Divider( + thickness: 1.0, + color: Colors.black12, ), - ), - ], - ), - ]), - SizedBox( - height: 2, - ), - Divider( - color: Colors.grey[350], - height: 10, - thickness: 6, - indent: 0, - endIndent: 0, - ), - styleOne == true - ? Container( - margin: EdgeInsets.all(5.0), - child: model.recommendedProductList.length != null - ? CustomScrollView( - primary: false, - shrinkWrap: true, - physics: NeverScrollableScrollPhysics(), - slivers: [ - SliverPadding( - padding: const EdgeInsets.fromLTRB(0, 0, 0, 0), - sliver: SliverGrid.count( - crossAxisCount: 2, - childAspectRatio: (itemWidth / itemHeight), - children: model.recommendedProductList - .map((e) => Card( - elevation: 2, - shape: RoundedRectangleBorder( - side: BorderSide( - color: Colors.grey[300], - width: 2), - borderRadius: - BorderRadius.circular( - 10)), - margin: EdgeInsets.symmetric( - horizontal: 8, - vertical: 4, - ), - child: Container( - decoration: BoxDecoration( - borderRadius: - BorderRadius.all( - Radius.circular(15), - ), + Padding( + padding: EdgeInsets.all(8.0), + child: InkWell( + child: styleIcon, + onTap: () { + setState(() { + if (styleOne == true) { + styleOne = false; + styleTwo = true; + styleIcon = Icon( + Icons.auto_awesome_mosaic, + color: Colors.blue, + size: 29.0, + ); + } else { + styleOne = true; + styleTwo = false; + styleIcon = Icon( + Icons.widgets_sharp, + color: Colors.blue, + size: 29.0, + ); + } + }); + }, + ), + ), + ], + ), + ]), + SizedBox( + height: 2, + ), + Divider( + color: Colors.grey[350], + height: 10, + thickness: 6, + indent: 0, + endIndent: 0, + ), + styleOne == true + ? Container( + margin: EdgeInsets.all(5.0), + child: model.recommendedProductList.length != null + ? CustomScrollView( + primary: false, + shrinkWrap: true, + physics: NeverScrollableScrollPhysics(), + slivers: [ + SliverPadding( + padding: const EdgeInsets.fromLTRB(0, 0, 0, 0), + sliver: SliverGrid.count( + crossAxisCount: 2, + childAspectRatio: (itemWidth / itemHeight), + children: model.recommendedProductList + .map((e) => Card( + elevation: 2, + shape: RoundedRectangleBorder( + side: BorderSide( + color: Colors.grey[300], + width: 2), + borderRadius: + BorderRadius.circular( + 10)), + margin: EdgeInsets.symmetric( + horizontal: 8, + vertical: 11, ), - padding: EdgeInsets.symmetric( - horizontal: 4), - width: MediaQuery.of(context) - .size - .width / - 3, + child: Container( + decoration: BoxDecoration( + borderRadius: + BorderRadius.all( + Radius.circular(15), + ), + ), + padding: EdgeInsets.symmetric( + horizontal: 4), + width: MediaQuery.of(context) + .size.width / 3, // - child: Column( - crossAxisAlignment: - CrossAxisAlignment - .start, - children: [ - Stack(children: [ - Container( - child: Align( - alignment: - Alignment - .topRight, - child: //true - //wishlistVar[index].id.contains(model.recommendedProductList[index].id) - !isInWishlist - ? IconButton( - icon: - Icon(Icons.favorite_border), - color: - Colors.grey, - iconSize: - 30, - onPressed: - () { - setState(() { - addToWishlistFunction(itemID); - }); - }, - ) - : IconButton( - icon: - Icon(Icons.favorite), - color: - Colors.red, - iconSize: - 30, - onPressed: - () { - setState(() { - deleteFromWishlistFunction(itemID); - }); - }, - ) + child: Column( + crossAxisAlignment: + CrossAxisAlignment + .start, + children: [ + Stack(children: [ + Container( + child: Align( + alignment: + Alignment + .topRight, + child: + itemID.contains(e.id) + // !isInWishlist + ? IconButton( + icon: + Icon(Icons.favorite_border), + color: + Colors.grey, + iconSize: + 30, + onPressed: + () { + setState(() { + addToWishlistFunction(itemID); + }); + }, + ) + : + IconButton( + icon: + Icon(Icons.favorite), + color: + Colors.red, + iconSize: + 30, + onPressed: + () { + setState(() { + deleteFromWishlistFunction(itemID); + }); + }, + ) // - ), - ), - Container( - margin: EdgeInsets - .fromLTRB(0, 16, - 10, 16), - alignment: - Alignment.center, + ), + ), + Container( + margin: EdgeInsets + .fromLTRB(0, 16, + 10, 16), + alignment: + Alignment.center, // padding: EdgeInsets.only(left: 25, bottom: 20), - child: (e.images != - null && - e.images.length > - 0) - ? Image.network( - e.images[0] - .src - .toString(), + child: (e.images != + null && + e.images.length > + 0) + ? Image.network( + e.images[0] + .src + .toString(), // item.images[0].src, - fit: BoxFit - .cover, - height: 60, - ) - : Image.asset( - "assets/images/no_image.png", - fit: BoxFit - .cover, - height: 60, - ), - ), - Container( - width: e.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)), + fit: BoxFit + .cover, + height: 60, + ) + : Image.asset( + "assets/images/no_image.png", + fit: BoxFit + .cover, + height: 60, + ), ), - child: Texts( - e.rxMessage != null - ? e.rxMessage - : "", - color: Colors.white, - regular: true, - fontSize: 10, - fontWeight: - FontWeight.w400, + Container( + width: e.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( + e.rxMessage != null + ? e.rxMessage + : "", + color: Colors.white, + regular: true, + fontSize: 10, + fontWeight: + FontWeight.w400, + ), ), - ), - ]), - Container( - margin: EdgeInsets - .symmetric( - horizontal: 6, - vertical: 0, - ), - child: Column( - crossAxisAlignment: - CrossAxisAlignment - .start, - children: [ - Text( - e.name, - style: TextStyle( - color: Colors - .black, - fontSize: 13.0, + ]), + Container( + margin: EdgeInsets + .symmetric( + horizontal: 6, + vertical: 0, + ), + child: Column( + crossAxisAlignment: + CrossAxisAlignment + .start, + children: [ + Text( + languageID == "ar" + ? e.namen + : e.name, + style: TextStyle( + color: Colors + .black, + fontSize: 13.0, // fontWeight: FontWeight.bold, + ), ), - ), - Padding( + Padding( // padding: const EdgeInsets.only(top: 15, bottom: 10), - padding: - const EdgeInsets - .only( - top: 10, - bottom: - 5), - child: Texts( - "SAR ${e.price}", - bold: true, - fontSize: 14, + padding: + const EdgeInsets + .only( + top: 10, + bottom: + 5), + child: Texts( + "SAR ${e.price}", + bold: true, + fontSize: 14, + ), ), - ), - ], + ], + ), ), - ), - Row( - crossAxisAlignment: - CrossAxisAlignment - .start, - children: [ - Container( - padding: EdgeInsets - .only( - right: - 10), + Row( + crossAxisAlignment: + CrossAxisAlignment + .start, + children: [ + Container( + padding: EdgeInsets + .only( + right: + 10), // margin: EdgeInsets.only(left: 5), - child: Align( - alignment: - Alignment - .topLeft, - child: RatingBar - .readOnly( - initialRating: e - .approvedRatingSum - .toDouble(), + child: Align( + alignment: + Alignment + .topLeft, + child: RatingBar + .readOnly( + initialRating: e + .approvedRatingSum + .toDouble(), // initialRating: productRate, - size: 13.0, - filledColor: - Colors.yellow[ - 700], - emptyColor: - Colors.grey[ - 500], - isHalfAllowed: - true, - halfFilledIcon: - Icons - .star_half, - filledIcon: - Icons - .star, - emptyIcon: - Icons - .star, + size: 13.0, + filledColor: + Colors.yellow[ + 700], + emptyColor: + Colors.grey[ + 500], + isHalfAllowed: + true, + halfFilledIcon: + Icons + .star_half, + filledIcon: + Icons + .star, + emptyIcon: + Icons + .star, + ), ), ), - ), - Texts( - "(${e.approvedTotalReviews.toString()})", + Texts( + "(${e.approvedTotalReviews.toString()})", // bold: true, - fontSize: 12, - ), - ]), - ], + fontSize: 12, + ), + ]), + ], + ), ), - ), - ) + ) // Column( // crossAxisAlignment: // CrossAxisAlignment.start, @@ -510,8 +526,8 @@ class _RecommendedProductPageState extends State // ]), // ], // ), - ) - .toList(), + ) + .toList(), // children:[ // ListView.builder( // scrollDirection: Axis.vertical, @@ -631,193 +647,193 @@ class _RecommendedProductPageState extends State // } // ), // ] + ), ), - ), - ]) - : Container(), - ) - : Container( - height: model.recommendedProductList.length > 0 - ? MediaQuery.of(context).size.height * 0.60 - : 0, - child: ListView.builder( - physics: ScrollPhysics(), + ]) + : Container(), + ) + : Container( + height: model.recommendedProductList.length > 0 + ? MediaQuery.of(context).size.height * 0.60 + : 0, + child: ListView.builder( + physics: ScrollPhysics(), // physics: NeverScrollableScrollPhysics(), - itemCount: model.recommendedProductList.length, - itemBuilder: (context, index) { - return Card( - elevation: 2, - shape: RoundedRectangleBorder( - side: - BorderSide(color: Colors.grey[300], width: 2), - borderRadius: BorderRadius.circular(10)), + itemCount: model.recommendedProductList.length, + itemBuilder: (context, index) { + return Card( + elevation: 2, + shape: RoundedRectangleBorder( + side: + BorderSide(color: Colors.grey[300], width: 2), + borderRadius: BorderRadius.circular(10)), // - margin: EdgeInsets.symmetric( - horizontal: 8, - vertical: 4, - ), - child: Container( - decoration: BoxDecoration( - borderRadius: BorderRadius.all( - Radius.circular(15), - ), + margin: EdgeInsets.symmetric( + horizontal: 8, + vertical: 4, ), - padding: EdgeInsets.symmetric(horizontal: 5), - width: MediaQuery.of(context).size.width / 3, + child: Container( + decoration: BoxDecoration( + borderRadius: BorderRadius.all( + Radius.circular(15), + ), + ), + padding: EdgeInsets.symmetric(horizontal: 5), + width: MediaQuery.of(context).size.width / 3, // - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Stack(children: [ - Container( - child: Align( - alignment: Alignment.topRight, - child: //true - //wishlistVar[index].id.contains(model.recommendedProductList[index].id) - !isInWishlist - ? IconButton( - icon: Icon( - Icons.favorite_border), - color: Colors.grey, - iconSize: 30, - onPressed: () { - setState(() { - addToWishlistFunction( - itemID); - }); - }, - ) - : IconButton( - icon: Icon(Icons.favorite), - color: Colors.red, - iconSize: 30, - onPressed: () { - setState(() { - deleteFromWishlistFunction( - itemID); - }); - }, - ) + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Stack(children: [ + Container( + child: Align( + alignment: Alignment.topRight, + child: //true + //wishlistVar[index].id.contains(model.recommendedProductList[index].id) + !isInWishlist + ? IconButton( + icon: Icon( + Icons.favorite_border), + color: Colors.grey, + iconSize: 30, + onPressed: () { + setState(() { + addToWishlistFunction( + itemID); + }); + }, + ) + : IconButton( + icon: Icon(Icons.favorite), + color: Colors.red, + iconSize: 30, + onPressed: () { + setState(() { + deleteFromWishlistFunction( + itemID); + }); + }, + ) // - ), - ), - Container( - margin: EdgeInsets.fromLTRB(0, 16, 10, 16), - alignment: Alignment.center, + ), + ), + Container( + margin: EdgeInsets.fromLTRB(0, 16, 10, 16), + alignment: Alignment.center, // padding: EdgeInsets.only(left: 25, bottom: 20), - child: (model.recommendedProductList[index] - .images != - null && - model.recommendedProductList[index] - .images.length > - 0) - ? Image.network( - model.recommendedProductList[index] - .images[0].src - .toString(), + child: (model.recommendedProductList[index] + .images != + null && + model.recommendedProductList[index] + .images.length > + 0) + ? Image.network( + model.recommendedProductList[index] + .images[0].src + .toString(), // item.images[0].src, - fit: BoxFit.cover, - height: 60, - ) - : Image.asset( - "assets/images/no_image.png", - fit: BoxFit.cover, - height: 60, - ), - ), - Container( - width: model.recommendedProductList[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)), + fit: BoxFit.cover, + height: 60, + ) + : Image.asset( + "assets/images/no_image.png", + fit: BoxFit.cover, + height: 60, + ), ), - child: Texts( - model.recommendedProductList[index] + Container( + width: model.recommendedProductList[index] .rxMessage != null - ? model.recommendedProductList[index] - .rxMessage - : "", - color: Colors.white, - regular: true, - fontSize: 10, - fontWeight: FontWeight.w400, + ? 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.recommendedProductList[index] + .rxMessage != + null + ? model.recommendedProductList[index] + .rxMessage + : "", + color: Colors.white, + regular: true, + fontSize: 10, + fontWeight: FontWeight.w400, + ), ), - ), - ]), - Container( - margin: EdgeInsets.symmetric( - horizontal: 6, - vertical: 2, - ), - child: Column( - crossAxisAlignment: - CrossAxisAlignment.start, - children: [ - Text( - model - .recommendedProductList[index].name, - style: TextStyle( - color: Colors.black, - fontSize: 13.0, + ]), + Container( + margin: EdgeInsets.symmetric( + horizontal: 6, + vertical: 2, + ), + child: Column( + crossAxisAlignment: + CrossAxisAlignment.start, + children: [ + Text( + model + .recommendedProductList[index].name, + style: TextStyle( + color: Colors.black, + fontSize: 13.0, // fontWeight: FontWeight.bold, + ), ), - ), - Padding( + Padding( // padding: const EdgeInsets.only(top: 15, bottom: 10), - padding: const EdgeInsets.only( - top: 10, bottom: 5), - child: Texts( - "SAR ${model.recommendedProductList[index].price}", - bold: true, - fontSize: 14, + padding: const EdgeInsets.only( + top: 10, bottom: 5), + child: Texts( + "SAR ${model.recommendedProductList[index].price}", + bold: true, + fontSize: 14, + ), ), - ), - ], + ], + ), ), - ), - Row( - crossAxisAlignment: - CrossAxisAlignment.start, - children: [ - Container( - padding: EdgeInsets.only( - right: 10, bottom: 10), + Row( + crossAxisAlignment: + CrossAxisAlignment.start, + children: [ + Container( + padding: EdgeInsets.only( + right: 10, bottom: 10), // margin: EdgeInsets.only(left: 5), - child: Align( - alignment: Alignment.topLeft, - child: RatingBar.readOnly( - initialRating: model - .recommendedProductList[index] - .approvedRatingSum - .toDouble(), + child: Align( + alignment: Alignment.topLeft, + child: RatingBar.readOnly( + initialRating: model + .recommendedProductList[index] + .approvedRatingSum + .toDouble(), // initialRating: productRate, - size: 13.0, - filledColor: Colors.yellow[700], - emptyColor: Colors.grey[500], - isHalfAllowed: true, - halfFilledIcon: Icons.star_half, - filledIcon: Icons.star, - emptyIcon: Icons.star, + size: 13.0, + filledColor: Colors.yellow[700], + emptyColor: Colors.grey[500], + isHalfAllowed: true, + halfFilledIcon: Icons.star_half, + filledIcon: Icons.star, + emptyIcon: Icons.star, + ), ), ), - ), - Texts( - "(${model.recommendedProductList[index].approvedTotalReviews.toString()})", + Texts( + "(${model.recommendedProductList[index].approvedTotalReviews.toString()})", // bold: true, - fontSize: 12, - ), - ]), - ], + fontSize: 12, + ), + ]), + ], + ), ), - ), - ); + ); // Container( // height: 30, // padding: EdgeInsets.only( left: 10.0, top: 10, right: 10), @@ -927,22 +943,55 @@ class _RecommendedProductPageState extends State // ], // ), // ); - }), - ), - ]), + }), + ), + ]), + ), ), ); } -} + checkWishlist() async { + ProductDetailViewModel x = new ProductDetailViewModel(); + await x.checkWishlistData(); + for (int i = 0; i < x.wishListItems.length; i++) { + // itemID = x.wishListItems[i].id; + print("-------------wishlist---------------"); + print(itemID); +// print(product.id); + print(x.wishListItems[i].productId); + if (itemID == x.wishListItems[i].productId) { + isInWishlist = true; +// print('in wishlist'); + break; + } else { + isInWishlist = false; +// print('not in wishlist'); + } + } + } -addToWishlistFunction(itemID) async { - ProductDetailViewModel x = new ProductDetailViewModel(); - isInWishlist = true; - await x.addToWishlistData(itemID); -} + Future userInfo(id, product) async { + customerId = await sharedPref.getString(PHARMACY_CUSTOMER_ID); + if (customerId != null) { + itemID = id; + product = product; + checkWishlist(); + } + print("customerId:$customerId"); + return customerId; + } -deleteFromWishlistFunction(itemID) async { - ProductDetailViewModel x = new ProductDetailViewModel(); - isInWishlist = false; - await x.addToWishlistData(itemID); + + addToWishlistFunction(itemID) async { + ProductDetailViewModel x = new ProductDetailViewModel(); + isInWishlist = true; + await x.addToWishlistData(itemID); + } + + deleteFromWishlistFunction(itemID) async { + ProductDetailViewModel x = new ProductDetailViewModel(); + isInWishlist = false; + await x.addToWishlistData(itemID); + } } + diff --git a/lib/pages/pharmacy/order/OrderDetails.dart b/lib/pages/pharmacy/order/OrderDetails.dart index 5e9b26ea..9c3c91b9 100644 --- a/lib/pages/pharmacy/order/OrderDetails.dart +++ b/lib/pages/pharmacy/order/OrderDetails.dart @@ -332,17 +332,14 @@ class _OrderDetailsPageState extends State { itemBuilder: (context, index) { return Container( child: productTile( - productName: model - .orderListModel[0].orderItems[index].product.name + productName: languageID == "ar" + ? model.orderListModel[0].orderItems[index].product.namen.toString() + : model.orderListModel[0].orderItems[index].product.name.toString(), + productPrice: model.orderListModel[0].orderItems[index].product.price .toString(), - productPrice: model - .orderListModel[0].orderItems[index].product.price - .toString(), - productRate: model.orderListModel[0].orderItems[index] - .product.approvedRatingSum + productRate: model.orderListModel[0].orderItems[index].product.approvedRatingSum .toDouble(), - productReviews: model.orderListModel[0] - .orderItems[index].product.approvedTotalReviews, + productReviews: model.orderListModel[0].orderItems[index].product.approvedTotalReviews, totalPrice: "${(model.orderListModel[0].orderItems[index].product.price * model.orderListModel[0].orderItems[index].quantity).toStringAsFixed(2)}", qyt: model From 44287db553237b7bfec5d71797e276a9a7757fc1 Mon Sep 17 00:00:00 2001 From: mosazaid Date: Wed, 3 Mar 2021 12:13:41 +0200 Subject: [PATCH 06/11] bug-fixes --- lib/core/model/pharmacies/Customer.dart | 7 ++++++- lib/pages/pharmacy/order/OrderDetails.dart | 4 ++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/lib/core/model/pharmacies/Customer.dart b/lib/core/model/pharmacies/Customer.dart index 0462c0c2..9042930e 100644 --- a/lib/core/model/pharmacies/Customer.dart +++ b/lib/core/model/pharmacies/Customer.dart @@ -107,7 +107,12 @@ class Customer { lastLoginDateUtc = json['last_login_date_utc']; lastActivityDateUtc = json['last_activity_date_utc']; registeredInStoreId = json['registered_in_store_id']; - roleIds = json['role_ids'].cast(); + if (json['role_ids'] != null) { + roleIds = new List(); + json['role_ids'].forEach((v) { + roleIds.add(v); + }); + } } Map toJson() { diff --git a/lib/pages/pharmacy/order/OrderDetails.dart b/lib/pages/pharmacy/order/OrderDetails.dart index ea74ed23..9d7f27bc 100644 --- a/lib/pages/pharmacy/order/OrderDetails.dart +++ b/lib/pages/pharmacy/order/OrderDetails.dart @@ -770,6 +770,10 @@ class _OrderDetailsPageState extends State { message: "شكراً\nPayment status for your order is Paid"); Navigator.pop(context); Navigator.pop(context); + } else { + AppToast.showErrorToast( + message: + "Transaction Failed!\Your transaction is field to some reason please try again or contact to the administration"); } } } From 8624d695dc447072d72c2894e046ecf64145ecb9 Mon Sep 17 00:00:00 2001 From: Fatimah Alshammari Date: Thu, 4 Mar 2021 10:50:00 +0300 Subject: [PATCH 07/11] fixed order details --- lib/core/model/pharmacies/Reviews.dart | 11 +++--- lib/pages/pharmacy/order/OrderDetails.dart | 45 +++++----------------- 2 files changed, 16 insertions(+), 40 deletions(-) diff --git a/lib/core/model/pharmacies/Reviews.dart b/lib/core/model/pharmacies/Reviews.dart index f924dce3..2c767cdd 100644 --- a/lib/core/model/pharmacies/Reviews.dart +++ b/lib/core/model/pharmacies/Reviews.dart @@ -10,13 +10,13 @@ class Reviews { bool isApproved; String title; String reviewText; - Null replyText; + String replyText; int rating; int helpfulYesTotal; int helpfulNoTotal; String createdOnUtc; Customer customer; - Null product; + //Null product; Reviews( {this.id, @@ -34,7 +34,8 @@ class Reviews { this.helpfulNoTotal, this.createdOnUtc, this.customer, - this.product}); + // this.product + }); Reviews.fromJson(Map json) { id = json['id']; @@ -54,7 +55,7 @@ class Reviews { customer = json['customer'] != null ? new Customer.fromJson(json['customer']) : null; - product = json['product']; + // product = json['product']; } Map toJson() { @@ -76,7 +77,7 @@ class Reviews { if (this.customer != null) { data['customer'] = this.customer.toJson(); } - data['product'] = this.product; + // data['product'] = this.product; return data; } } \ No newline at end of file diff --git a/lib/pages/pharmacy/order/OrderDetails.dart b/lib/pages/pharmacy/order/OrderDetails.dart index f7990389..b0fb974f 100644 --- a/lib/pages/pharmacy/order/OrderDetails.dart +++ b/lib/pages/pharmacy/order/OrderDetails.dart @@ -339,43 +339,18 @@ class _OrderDetailsPageState extends State { itemBuilder: (context, index) { return Container( child: productTile( - productName: model.orderListModel[0] - .orderItems[index].product.name - .toString(), - productPrice: model.orderListModel[0] - .orderItems[index].product.price - .toString(), - productRate: model.orderListModel[0] - .orderItems[index].product.approvedRatingSum - .toDouble(), - productReviews: model - .orderListModel[0] - .orderItems[index] - .product - .approvedTotalReviews, - totalPrice: - "${(model.orderListModel[0].orderItems[index].product.price * model.orderListModel[0].orderItems[index].quantity).toStringAsFixed(2)}", - qyt: model.orderListModel[0].orderItems[index] - .quantity - .toString(), + productName: model.orderListModel[0].orderItems[index].product.name.toString(), + productPrice: model.orderListModel[0].orderItems[index].product.price.toString(), + productRate: model.orderListModel[0].orderItems[index].product.approvedRatingSum.toDouble(), + productReviews: model.orderListModel[0].orderItems[index].product.approvedTotalReviews, + totalPrice: "${(model.orderListModel[0].orderItems[index].product.price * model.orderListModel[0].orderItems[index].quantity).toStringAsFixed(2)}", + qyt: model.orderListModel[0].orderItems[index].quantity.toString(), isOrderDetails: true, - imgs: model.orderListModel[0].orderItems[index] - .product.images != - null && - model - .orderListModel[0] - .orderItems[index] - .product - .images - .length != - 0 - ? model.orderListModel[0].orderItems[index] - .product.images[0].src - .toString() - : null, + imgs: model.orderListModel[0].orderItems[index].product.images != null && + model.orderListModel[0].orderItems[index].product.images.length != 0 + ? model.orderListModel[0].orderItems[index].product.images[0].src.toString() : null, status: model.orderListModel[0].orderStatusId, - product: model.orderListModel[0] - .orderItems[index].product, + product: model.orderListModel[0].orderItems[index].product, ), ); }), From 3af37a6a5c3be857828f37664bf461c219fe554c Mon Sep 17 00:00:00 2001 From: hussam al-habibeh Date: Fri, 5 Mar 2021 23:38:10 +0200 Subject: [PATCH 08/11] hussam --- lib/pages/pharmacy_categorise.dart | 63 ++++++++++++++++++++---------- 1 file changed, 42 insertions(+), 21 deletions(-) diff --git a/lib/pages/pharmacy_categorise.dart b/lib/pages/pharmacy_categorise.dart index f0062a1c..2e5088c1 100644 --- a/lib/pages/pharmacy_categorise.dart +++ b/lib/pages/pharmacy_categorise.dart @@ -29,7 +29,9 @@ class _PharmacyCategorisePageState extends State { ProjectViewModel projectViewModel = Provider.of(context); return BaseView( onModelReady: (model) => model.getCategorise(), - builder: (BuildContext context, PharmacyCategoriseViewModel model, Widget child) => AppScaffold( + builder: (BuildContext context, PharmacyCategoriseViewModel model, + Widget child) => + AppScaffold( isShowDecPage: false, baseViewModel: model, body: Column( @@ -57,7 +59,9 @@ class _PharmacyCategorisePageState extends State { child: Padding( padding: EdgeInsets.symmetric(horizontal: 10.0), child: Texts( - projectViewModel.isArabic ? model.categorise[index].namen : model.categorise[index].name, + projectViewModel.isArabic + ? model.categorise[index].namen + : model.categorise[index].name, fontWeight: FontWeight.w600, ), ), @@ -66,14 +70,15 @@ class _PharmacyCategorisePageState extends State { Navigator.push( context, MaterialPageRoute( - builder: (context) => model.categorise[index].id != '12' - ? ParentCategorisePage( - id: model.categorise[index].id, - titleName: model.categorise[index].name, - ) - : FinalProductsPage( - id: model.categorise[index].id, - ), + builder: (context) => + model.categorise[index].id != '12' + ? ParentCategorisePage( + id: model.categorise[index].id, + titleName: model.categorise[index].name, + ) + : FinalProductsPage( + id: model.categorise[index].id, + ), ), ), }, @@ -86,7 +91,10 @@ class _PharmacyCategorisePageState extends State { height: 140, child: Column( children: [ - Divider(height: 2.0, thickness: 1.0, color: Colors.black12.withOpacity(0.14)), + Divider( + height: 2.0, + thickness: 1.0, + color: Colors.black12.withOpacity(0.14)), SizedBox( height: 10.0, ), @@ -102,12 +110,16 @@ class _PharmacyCategorisePageState extends State { width: 55.0, decoration: BoxDecoration( borderRadius: BorderRadius.circular(5.0), - color: Colors.green.shade300.withOpacity(0.34), + color: + Colors.green.shade300.withOpacity(0.34), ), child: Padding( - padding: EdgeInsets.symmetric(horizontal: 10.0), + padding: + EdgeInsets.symmetric(horizontal: 10.0), child: Texts( - projectViewModel.isArabic ? 'الاكثر مبيعا' : 'Best Sellers', + projectViewModel.isArabic + ? 'الاكثر مبيعا' + : 'Best Sellers', fontWeight: FontWeight.w600, ), ), @@ -122,13 +134,16 @@ class _PharmacyCategorisePageState extends State { height: 50.0, width: 55.0, decoration: BoxDecoration( - color: Colors.orangeAccent.shade200.withOpacity(0.34), + color: Colors.orangeAccent.shade200 + .withOpacity(0.34), borderRadius: BorderRadius.circular(5.0), ), child: Padding( padding: EdgeInsets.symmetric(horizontal: 10.0), child: Texts( - projectViewModel.isArabic ? 'الاكثر مشاهدة' : 'Most Viewed', + projectViewModel.isArabic + ? 'الاكثر مشاهدة' + : 'Most Viewed', fontWeight: FontWeight.w600, ), ), @@ -152,7 +167,9 @@ class _PharmacyCategorisePageState extends State { child: Padding( padding: EdgeInsets.symmetric(horizontal: 10.0), child: Texts( - projectViewModel.isArabic ? 'منتجات جديدة' : 'New Products', + projectViewModel.isArabic + ? 'منتجات جديدة' + : 'New Products', fontWeight: FontWeight.w600, ), ), @@ -164,19 +181,23 @@ class _PharmacyCategorisePageState extends State { padding: EdgeInsets.all(4.0), child: InkWell( onTap: () { - _scanQrAndGetPatient(context, model); + // _scanQrAndGetPatient(context, model); }, child: Container( height: 50.0, width: 55.0, decoration: BoxDecoration( - color: Colors.purple.shade200.withOpacity(0.34), + color: + Colors.purple.shade200.withOpacity(0.34), borderRadius: BorderRadius.circular(5.0), ), child: Padding( - padding: EdgeInsets.symmetric(horizontal: 10.0), + padding: + EdgeInsets.symmetric(horizontal: 10.0), child: Texts( - projectViewModel.isArabic ? 'شوهد مؤخرا' : 'Recently Viewed', + projectViewModel.isArabic + ? 'شوهد مؤخرا' + : 'Recently Viewed', fontWeight: FontWeight.w600, ), ), From 299a1bed25c6e77bb0c34656d8946f180b5cb88e Mon Sep 17 00:00:00 2001 From: hussam al-habibeh Date: Fri, 5 Mar 2021 23:45:32 +0200 Subject: [PATCH 09/11] hussam --- lib/pages/pharmacy_categorise.dart | 44 ++++++++++++++++++++++-------- 1 file changed, 32 insertions(+), 12 deletions(-) diff --git a/lib/pages/pharmacy_categorise.dart b/lib/pages/pharmacy_categorise.dart index d8a0ef20..033c7087 100644 --- a/lib/pages/pharmacy_categorise.dart +++ b/lib/pages/pharmacy_categorise.dart @@ -30,7 +30,9 @@ class _PharmacyCategorisePageState extends State { ProjectViewModel projectViewModel = Provider.of(context); return BaseView( onModelReady: (model) => model.getCategorise(), - builder: (BuildContext context, PharmacyCategoriseViewModel model, Widget child) => AppScaffold( + builder: (BuildContext context, PharmacyCategoriseViewModel model, + Widget child) => + AppScaffold( isShowDecPage: false, baseViewModel: model, body: Column( @@ -58,7 +60,9 @@ class _PharmacyCategorisePageState extends State { child: Padding( padding: EdgeInsets.symmetric(horizontal: 10.0), child: Texts( - projectViewModel.isArabic ? model.categorise[index].namen : model.categorise[index].name, + projectViewModel.isArabic + ? model.categorise[index].namen + : model.categorise[index].name, fontWeight: FontWeight.w600, ), ), @@ -87,7 +91,10 @@ class _PharmacyCategorisePageState extends State { height: 140, child: Column( children: [ - Divider(height: 2.0, thickness: 1.0, color: Colors.black12.withOpacity(0.14)), + Divider( + height: 2.0, + thickness: 1.0, + color: Colors.black12.withOpacity(0.14)), SizedBox( height: 10.0, ), @@ -103,12 +110,16 @@ class _PharmacyCategorisePageState extends State { width: 55.0, decoration: BoxDecoration( borderRadius: BorderRadius.circular(5.0), - color: Colors.green.shade300.withOpacity(0.34), + color: + Colors.green.shade300.withOpacity(0.34), ), child: Padding( - padding: EdgeInsets.symmetric(horizontal: 10.0), + padding: + EdgeInsets.symmetric(horizontal: 10.0), child: Texts( - projectViewModel.isArabic ? 'الاكثر مبيعا' : 'Best Sellers', + projectViewModel.isArabic + ? 'الاكثر مبيعا' + : 'Best Sellers', fontWeight: FontWeight.w600, ), ), @@ -123,13 +134,16 @@ class _PharmacyCategorisePageState extends State { height: 50.0, width: 55.0, decoration: BoxDecoration( - color: Colors.orangeAccent.shade200.withOpacity(0.34), + color: Colors.orangeAccent.shade200 + .withOpacity(0.34), borderRadius: BorderRadius.circular(5.0), ), child: Padding( padding: EdgeInsets.symmetric(horizontal: 10.0), child: Texts( - projectViewModel.isArabic ? 'الاكثر مشاهدة' : 'Most Viewed', + projectViewModel.isArabic + ? 'الاكثر مشاهدة' + : 'Most Viewed', fontWeight: FontWeight.w600, ), ), @@ -153,7 +167,9 @@ class _PharmacyCategorisePageState extends State { child: Padding( padding: EdgeInsets.symmetric(horizontal: 10.0), child: Texts( - projectViewModel.isArabic ? 'منتجات جديدة' : 'New Products', + projectViewModel.isArabic + ? 'منتجات جديدة' + : 'New Products', fontWeight: FontWeight.w600, ), ), @@ -171,13 +187,17 @@ class _PharmacyCategorisePageState extends State { height: 50.0, width: 55.0, decoration: BoxDecoration( - color: Colors.purple.shade200.withOpacity(0.34), + color: + Colors.purple.shade200.withOpacity(0.34), borderRadius: BorderRadius.circular(5.0), ), child: Padding( - padding: EdgeInsets.symmetric(horizontal: 10.0), + padding: + EdgeInsets.symmetric(horizontal: 10.0), child: Texts( - projectViewModel.isArabic ? 'شوهد مؤخرا' : 'Recently Viewed', + projectViewModel.isArabic + ? 'شوهد مؤخرا' + : 'Recently Viewed', fontWeight: FontWeight.w600, ), ), From 2723422bbf8d563aea35209b385aa8faeda2c509 Mon Sep 17 00:00:00 2001 From: hussam al-habibeh Date: Mon, 8 Mar 2021 17:37:11 +0200 Subject: [PATCH 10/11] daynimic listing --- .../model/pharmacies/PharmacyProduct.dart | 253 ++- .../service/pharmacy_categorise_service.dart | 2 +- .../pharmacy_categorise_view_model.dart | 6 +- lib/pages/parent_categorise_page.dart | 1834 ++++++++--------- lib/pages/sub_categorise_page.dart | 11 +- lib/widgets/others/entity_checkbox_list.dart | 170 ++ 6 files changed, 1211 insertions(+), 1065 deletions(-) create mode 100644 lib/widgets/others/entity_checkbox_list.dart diff --git a/lib/core/model/pharmacies/PharmacyProduct.dart b/lib/core/model/pharmacies/PharmacyProduct.dart index c472cb4c..f69d035b 100644 --- a/lib/core/model/pharmacies/PharmacyProduct.dart +++ b/lib/core/model/pharmacies/PharmacyProduct.dart @@ -4,29 +4,29 @@ import 'PharmacyImageObject.dart'; import 'Reviews.dart'; class PharmacyProduct { - String id; + dynamic id; bool visibleIndividually; - String name; - String namen; - String shortDescription; - String shortDescriptionn; - String fullDescription; - String fullDescriptionn; + dynamic name; + dynamic namen; + dynamic shortDescription; + dynamic shortDescriptionn; + dynamic fullDescription; + dynamic fullDescriptionn; bool markasNew; bool showOnHomePage; - String metaKeywords; - String metaDescription; - String metaTitle; + dynamic metaKeywords; + dynamic metaDescription; + dynamic metaTitle; bool allowCustomerReviews; int approvedRatingSum; int notApprovedRatingSum; int approvedTotalReviews; int notApprovedTotalReviews; - String sku; + dynamic sku; bool isRx; bool prescriptionRequired; - String rxMessage; - String rxMessagen; + dynamic rxMessage; + dynamic rxMessagen; String manufacturerPartNumber; String gtin; bool isGiftCard; @@ -115,118 +115,117 @@ class PharmacyProduct { int vendorId; String seName; - PharmacyProduct( {this.id, - this.visibleIndividually, - this.name, - this.namen, - this.shortDescription, - this.shortDescriptionn, - this.fullDescription, - this.fullDescriptionn, - this.markasNew, - this.showOnHomePage, - this.metaKeywords, - this.metaDescription, - this.metaTitle, - this.allowCustomerReviews, - this.approvedRatingSum, - this.notApprovedRatingSum, - this.approvedTotalReviews, - this.notApprovedTotalReviews, - this.sku, - this.isRx, - this.prescriptionRequired, - this.rxMessage, - this.rxMessagen, - this.manufacturerPartNumber, - this.gtin, - this.isGiftCard, - this.requireOtherProducts, - this.automaticallyAddRequiredProducts, - this.isDownload, - this.unlimitedDownloads, - this.maxNumberOfDownloads, - this.downloadExpirationDays, - this.hasSampleDownload, - this.hasUserAgreement, - this.isRecurring, - this.recurringCycleLength, - this.recurringTotalCycles, - this.isRental, - this.rentalPriceLength, - this.isShipEnabled, - this.isFreeShipping, - this.shipSeparately, - this.additionalShippingCharge, - this.isTaxExempt, - this.isTelecommunicationsOrBroadcastingOrElectronicServices, - this.useMultipleWarehouses, - this.manageInventoryMethodId, - this.stockQuantity, - this.stockAvailability, - this.stockAvailabilityn, - this.displayStockAvailability, - this.displayStockQuantity, - this.minStockQuantity, - this.notifyAdminForQuantityBelow, - this.allowBackInStockSubscriptions, - this.orderMinimumQuantity, - this.orderMaximumQuantity, - this.allowedQuantities, - this.allowAddingOnlyExistingAttributeCombinations, - this.disableBuyButton, - this.disableWishlistButton, - this.availableForPreOrder, - this.preOrderAvailabilityStartDateTimeUtc, - this.callForPrice, - this.price, - this.oldPrice, - this.productCost, - this.specialPrice, - this.specialPriceStartDateTimeUtc, - this.specialPriceEndDateTimeUtc, - this.customerEntersPrice, - this.minimumCustomerEnteredPrice, - this.maximumCustomerEnteredPrice, - this.basepriceEnabled, - this.basepriceAmount, - this.basepriceBaseAmount, - this.hasTierPrices, - this.hasDiscountsApplied, - this.discountName, - this.discountNamen, - this.discountDescription, - this.discountDescriptionn, - this.discountPercentage, - this.currency, - this.currencyn, - this.weight, - this.length, - this.width, - this.height, - this.availableStartDateTimeUtc, - this.availableEndDateTimeUtc, - this.displayOrder, - this.published, - this.deleted, - this.createdOnUtc, - this.updatedOnUtc, - this.productType, - this.parentGroupedProductId, - this.roleIds, - this.discountIds, - this.storeIds, - this.manufacturerIds, - this.reviews, - this.images, - this.attributes, - this.specifications, - this.associatedProductIds, - this.tags, - this.vendorId, - this.seName}); + this.visibleIndividually, + this.name, + this.namen, + this.shortDescription, + this.shortDescriptionn, + this.fullDescription, + this.fullDescriptionn, + this.markasNew, + this.showOnHomePage, + this.metaKeywords, + this.metaDescription, + this.metaTitle, + this.allowCustomerReviews, + this.approvedRatingSum, + this.notApprovedRatingSum, + this.approvedTotalReviews, + this.notApprovedTotalReviews, + this.sku, + this.isRx, + this.prescriptionRequired, + this.rxMessage, + this.rxMessagen, + this.manufacturerPartNumber, + this.gtin, + this.isGiftCard, + this.requireOtherProducts, + this.automaticallyAddRequiredProducts, + this.isDownload, + this.unlimitedDownloads, + this.maxNumberOfDownloads, + this.downloadExpirationDays, + this.hasSampleDownload, + this.hasUserAgreement, + this.isRecurring, + this.recurringCycleLength, + this.recurringTotalCycles, + this.isRental, + this.rentalPriceLength, + this.isShipEnabled, + this.isFreeShipping, + this.shipSeparately, + this.additionalShippingCharge, + this.isTaxExempt, + this.isTelecommunicationsOrBroadcastingOrElectronicServices, + this.useMultipleWarehouses, + this.manageInventoryMethodId, + this.stockQuantity, + this.stockAvailability, + this.stockAvailabilityn, + this.displayStockAvailability, + this.displayStockQuantity, + this.minStockQuantity, + this.notifyAdminForQuantityBelow, + this.allowBackInStockSubscriptions, + this.orderMinimumQuantity, + this.orderMaximumQuantity, + this.allowedQuantities, + this.allowAddingOnlyExistingAttributeCombinations, + this.disableBuyButton, + this.disableWishlistButton, + this.availableForPreOrder, + this.preOrderAvailabilityStartDateTimeUtc, + this.callForPrice, + this.price, + this.oldPrice, + this.productCost, + this.specialPrice, + this.specialPriceStartDateTimeUtc, + this.specialPriceEndDateTimeUtc, + this.customerEntersPrice, + this.minimumCustomerEnteredPrice, + this.maximumCustomerEnteredPrice, + this.basepriceEnabled, + this.basepriceAmount, + this.basepriceBaseAmount, + this.hasTierPrices, + this.hasDiscountsApplied, + this.discountName, + this.discountNamen, + this.discountDescription, + this.discountDescriptionn, + this.discountPercentage, + this.currency, + this.currencyn, + this.weight, + this.length, + this.width, + this.height, + this.availableStartDateTimeUtc, + this.availableEndDateTimeUtc, + this.displayOrder, + this.published, + this.deleted, + this.createdOnUtc, + this.updatedOnUtc, + this.productType, + this.parentGroupedProductId, + this.roleIds, + this.discountIds, + this.storeIds, + this.manufacturerIds, + this.reviews, + this.images, + this.attributes, + this.specifications, + this.associatedProductIds, + this.tags, + this.vendorId, + this.seName}); PharmacyProduct.fromJson(Map json) { id = json['id']; @@ -257,7 +256,7 @@ class PharmacyProduct { isGiftCard = json['is_gift_card']; requireOtherProducts = json['require_other_products']; automaticallyAddRequiredProducts = - json['automatically_add_required_products']; + json['automatically_add_required_products']; isDownload = json['is_download']; unlimitedDownloads = json['unlimited_downloads']; maxNumberOfDownloads = json['max_number_of_downloads']; @@ -275,7 +274,7 @@ class PharmacyProduct { additionalShippingCharge = json['additional_shipping_charge']; isTaxExempt = json['is_tax_exempt']; isTelecommunicationsOrBroadcastingOrElectronicServices = - json['is_telecommunications_or_broadcasting_or_electronic_services']; + json['is_telecommunications_or_broadcasting_or_electronic_services']; useMultipleWarehouses = json['use_multiple_warehouses']; manageInventoryMethodId = json['manage_inventory_method_id']; stockQuantity = json['stock_quantity']; @@ -290,12 +289,12 @@ class PharmacyProduct { orderMaximumQuantity = json['order_maximum_quantity']; allowedQuantities = json['allowed_quantities']; allowAddingOnlyExistingAttributeCombinations = - json['allow_adding_only_existing_attribute_combinations']; + json['allow_adding_only_existing_attribute_combinations']; disableBuyButton = json['disable_buy_button']; disableWishlistButton = json['disable_wishlist_button']; availableForPreOrder = json['available_for_pre_order']; preOrderAvailabilityStartDateTimeUtc = - json['pre_order_availability_start_date_time_utc']; + json['pre_order_availability_start_date_time_utc']; callForPrice = json['call_for_price']; price = json['price']; oldPrice = json['old_price']; diff --git a/lib/core/service/pharmacy_categorise_service.dart b/lib/core/service/pharmacy_categorise_service.dart index 479fd25f..6b97ee85 100644 --- a/lib/core/service/pharmacy_categorise_service.dart +++ b/lib/core/service/pharmacy_categorise_service.dart @@ -112,7 +112,7 @@ class PharmacyCategoriseService extends BaseService { ); } - Future getBrands() async { + Future getBrands({String id}) async { hasError = false; _brandsList.clear(); await baseAppClient.getPharmacy( diff --git a/lib/core/viewModels/pharmacy_categorise_view_model.dart b/lib/core/viewModels/pharmacy_categorise_view_model.dart index c98eedd7..8e5c755e 100644 --- a/lib/core/viewModels/pharmacy_categorise_view_model.dart +++ b/lib/core/viewModels/pharmacy_categorise_view_model.dart @@ -55,11 +55,11 @@ class PharmacyCategoriseViewModel extends BaseViewModel { setState(ViewState.Idle); } - Future getBrands() async { + Future getBrands({String id}) async { hasError = false; // _insuranceCardService.clearInsuranceCard(); setState(ViewState.Busy); - await _pharmacyCategoriseService.getBrands(); + await _pharmacyCategoriseService.getBrands(id: id); if (_pharmacyCategoriseService.hasError) { error = _pharmacyCategoriseService.error; setState(ViewState.ErrorLocal); @@ -105,7 +105,7 @@ class PharmacyCategoriseViewModel extends BaseViewModel { setState(ViewState.ErrorLocal); } else await getParentProducts(i: i); - await getBrands(); + await getBrands(id: i); } Future getParentProducts({String i}) async { diff --git a/lib/pages/parent_categorise_page.dart b/lib/pages/parent_categorise_page.dart index 46df3df7..e845e3bd 100644 --- a/lib/pages/parent_categorise_page.dart +++ b/lib/pages/parent_categorise_page.dart @@ -1,4 +1,5 @@ import 'package:diplomaticquarterapp/config/size_config.dart'; +import 'package:diplomaticquarterapp/core/model/pharmacy/categorise_parent_model.dart'; import 'package:diplomaticquarterapp/core/viewModels/pharmacy_categorise_view_model.dart'; import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; import 'package:diplomaticquarterapp/pages/pharmacies/product_detail.dart'; @@ -7,6 +8,7 @@ import 'package:diplomaticquarterapp/widgets/buttons/button.dart'; import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; import 'package:diplomaticquarterapp/widgets/others/StarRating.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_pharmacy_widget.dart'; +import 'package:diplomaticquarterapp/widgets/others/entity_checkbox_list.dart'; import 'package:diplomaticquarterapp/widgets/others/network_base_view.dart'; import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart'; import 'package:flutter/material.dart'; @@ -42,7 +44,7 @@ class _ParentCategorisePageState extends State { color: Colors.blue, size: 29.0, ); - + List entityList = List(); @override Widget build(BuildContext context) { ProjectViewModel projectViewModel = Provider.of(context); @@ -57,960 +59,721 @@ class _ParentCategorisePageState extends State { backgroundColor: Colors.white, isShowDecPage: false, baseViewModel: model, - body: Container( - child: ListView( - scrollDirection: Axis.vertical, - children: [ - Container( - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Container( - child: Image.network( - id == '1' - ? 'https://uat.hmgwebservices.com/epharmacy/content/images/thumbs/0089188_personal-care_2.png' - : id == '2' - ? 'https://uat.hmgwebservices.com/epharmacy/content/images/thumbs/0089189_skin-care_2.png' - : id == '3' - ? 'https://uat.hmgwebservices.com/epharmacy/content/images/thumbs/0089190_health-care_2.png' - : id == '4' - ? 'https://uat.hmgwebservices.com/epharmacy/content/images/thumbs/0089191_sexual-health_2.png' - : id == '5' - ? 'https://uat.hmgwebservices.com/epharmacy/content/images/thumbs/0089192_beauty_2.png' - : id == '6' - ? 'https://uat.hmgwebservices.com/epharmacy/content/images/thumbs/0089193_baby-child_2.png' - : id == '7' - ? 'https://uat.hmgwebservices.com/epharmacy/content/images/thumbs/0089194_vitamins-supplements_2.png' - : id == '8' - ? 'https://uat.hmgwebservices.com/epharmacy/content/images/thumbs/0089195_diet-nutrition_2.png' - : id == '9' - ? 'https://uat.hmgwebservices.com/epharmacy/content/images/thumbs/0089196_household_2.png' - : id == '10' - ? 'https://uat.hmgwebservices.com/epharmacy/content/images/thumbs/0089197_home-care-appliances_2.png' - : '', - fit: BoxFit.fill, - height: 160.0, - width: double.infinity), - ), - if (model.categoriseParent.length > 8) - Column( - crossAxisAlignment: CrossAxisAlignment.start, + body: SingleChildScrollView( + child: Container( + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Container( + child: Image.network( + id == '1' + ? 'https://uat.hmgwebservices.com/epharmacy/content/images/thumbs/0089188_personal-care_2.png' + : id == '2' + ? 'https://uat.hmgwebservices.com/epharmacy/content/images/thumbs/0089189_skin-care_2.png' + : id == '3' + ? 'https://uat.hmgwebservices.com/epharmacy/content/images/thumbs/0089190_health-care_2.png' + : id == '4' + ? 'https://uat.hmgwebservices.com/epharmacy/content/images/thumbs/0089191_sexual-health_2.png' + : id == '5' + ? 'https://uat.hmgwebservices.com/epharmacy/content/images/thumbs/0089192_beauty_2.png' + : id == '6' + ? 'https://uat.hmgwebservices.com/epharmacy/content/images/thumbs/0089193_baby-child_2.png' + : id == '7' + ? 'https://uat.hmgwebservices.com/epharmacy/content/images/thumbs/0089194_vitamins-supplements_2.png' + : id == '8' + ? 'https://uat.hmgwebservices.com/epharmacy/content/images/thumbs/0089195_diet-nutrition_2.png' + : id == '9' + ? 'https://uat.hmgwebservices.com/epharmacy/content/images/thumbs/0089196_household_2.png' + : id == '10' + ? 'https://uat.hmgwebservices.com/epharmacy/content/images/thumbs/0089197_home-care-appliances_2.png' + : '', + fit: BoxFit.fill, + height: 160.0, + width: double.infinity), + ), + if (model.categoriseParent.length > 8) + Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ - Row( - mainAxisAlignment: - MainAxisAlignment.spaceBetween, - children: [ - Padding( - padding: EdgeInsets.all(10.0), - child: InkWell( - child: Container( - child: Texts( - 'View All Categories', - fontWeight: FontWeight.w300, - ), - ), - onTap: () { - showModalBottomSheet( - isScrollControlled: true, - context: context, - builder: (BuildContext context) { - return Container( - // height: MediaQuery.of(context) - // .size - // .height * - // 0.89, - color: Colors.white, - child: Center( - child: ListView.builder( - scrollDirection: - Axis.vertical, - itemCount: model - .categoriseParent - .length, - itemBuilder: - (BuildContext context, - int index) { - return Container( - child: Padding( - padding: - EdgeInsets.all( - 4.0), - child: InkWell( - child: Column( - crossAxisAlignment: - CrossAxisAlignment - .start, - children: [ - Texts(model - .categoriseParent[ - index] - .name), - Divider( - thickness: - 0.6, - color: Colors - .black12, - ) - ], - ), - onTap: () { - Navigator.push( - context, - FadePage( - page: - SubCategorisePage( - title: model - .categoriseParent[ - index] - .name, - id: model - .categoriseParent[ - index] - .id, - parentId: - id, - )), - ); - }, - ), + Padding( + padding: EdgeInsets.all(10.0), + child: InkWell( + child: Container( + child: Texts( + 'View All Categories', + fontWeight: FontWeight.w300, + ), + ), + onTap: () { + showModalBottomSheet( + isScrollControlled: true, + context: context, + builder: (BuildContext context) { + return Container( + // height: MediaQuery.of(context) + // .size + // .height * + // 0.89, + color: Colors.white, + child: Center( + child: ListView.builder( + scrollDirection: + Axis.vertical, + itemCount: model + .categoriseParent.length, + itemBuilder: + (BuildContext context, + int index) { + return Container( + child: Padding( + padding: + EdgeInsets.all(4.0), + child: InkWell( + child: Column( + crossAxisAlignment: + CrossAxisAlignment + .start, + children: [ + Texts(model + .categoriseParent[ + index] + .name), + Divider( + thickness: 0.6, + color: Colors + .black12, + ) + ], ), - ); - }), - ), - ); - }, + onTap: () { + Navigator.push( + context, + FadePage( + page: + SubCategorisePage( + title: model + .categoriseParent[ + index] + .name, + id: model + .categoriseParent[ + index] + .id, + parentId: id, + )), + ); + }, + ), + ), + ); + }), + ), ); }, - ), - ), - Icon(Icons.arrow_forward) - ], - ), - Divider( - thickness: 1.0, - color: Colors.grey.shade400, + ); + }, + ), ), + Icon(Icons.arrow_forward) ], ), + Divider( + thickness: 1.0, + color: Colors.grey.shade400, + ), + ], + ), //Expanded widget heree if nassery - Padding( - padding: EdgeInsets.only(top: 35.0), - child: Container( - height: MediaQuery.of(context).size.height * 0.2, - child: Center( - child: ListView.builder( - scrollDirection: Axis.horizontal, - itemCount: model.categoriseParent.length > 8 - ? 8 - : model.categoriseParent.length, - itemBuilder: - (BuildContext context, int index) { - return Padding( - padding: EdgeInsets.symmetric( - horizontal: 8.0), - child: InkWell( - child: Column( - crossAxisAlignment: - CrossAxisAlignment.center, - children: [ - Padding( - padding: EdgeInsets.symmetric( - horizontal: 13.0), - child: Container( - height: 60.0, - width: 65.0, - decoration: BoxDecoration( - shape: BoxShape.circle, - color: Colors - .orange.shade200 - .withOpacity(0.45), - ), - child: Center( - child: Icon( - Icons.apps_sharp, - size: 32.0, - ), - ), - ), + Padding( + padding: EdgeInsets.only(top: 35.0), + child: Container( + height: MediaQuery.of(context).size.height * 0.2, + child: Center( + child: ListView.builder( + scrollDirection: Axis.horizontal, + itemCount: model.categoriseParent.length > 8 + ? 8 + : model.categoriseParent.length, + itemBuilder: (BuildContext context, int index) { + return Padding( + padding: + EdgeInsets.symmetric(horizontal: 8.0), + child: InkWell( + child: Column( + crossAxisAlignment: + CrossAxisAlignment.center, + children: [ + Padding( + padding: EdgeInsets.symmetric( + horizontal: 13.0), + child: Container( + height: 60.0, + width: 65.0, + decoration: BoxDecoration( + shape: BoxShape.circle, + color: Colors.orange.shade200 + .withOpacity(0.45), ), - Container( - width: MediaQuery.of(context) - .size - .width * - 0.197, - // height: MediaQuery.of(context) - // .size - // .height * - // 0.08, - child: Center( - child: Texts( - projectViewModel.isArabic - ? model - .categoriseParent[ - index] - .namen - : model - .categoriseParent[ - index] - .name, - fontSize: 13.4, - fontWeight: FontWeight.w600, - maxLines: 3, - ), + child: Center( + child: Icon( + Icons.apps_sharp, + size: 32.0, ), ), - ], + ), ), - onTap: () { - Navigator.push( - context, - FadePage( - page: SubCategorisePage( - title: model - .categoriseParent[index] - .name, - id: model - .categoriseParent[index].id, - parentId: id, - )), - ); - print(id); - }, - ), - ); - }), - ), - ), + Container( + width: MediaQuery.of(context) + .size + .width * + 0.197, + // height: MediaQuery.of(context) + // .size + // .height * + // 0.08, + child: Center( + child: Texts( + projectViewModel.isArabic + ? model + .categoriseParent[index] + .namen + : model + .categoriseParent[index] + .name, + fontSize: 13.4, + fontWeight: FontWeight.w600, + maxLines: 3, + ), + ), + ), + ], + ), + onTap: () { + Navigator.push( + context, + FadePage( + page: SubCategorisePage( + title: model + .categoriseParent[index].name, + id: model + .categoriseParent[index].id, + parentId: id, + )), + ); + print(id); + }, + ), + ); + }), ), + ), + ), - Divider( - thickness: 1.0, - color: Colors.grey.shade400, - ), - Padding( - padding: EdgeInsets.symmetric(horizontal: 8.0), - child: Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - InkWell( - child: Row( - children: [ - Icon( - Icons.wrap_text, - ), - SizedBox( - width: 10.0, - ), - Texts( - 'Refine', - fontWeight: FontWeight.w600, - ), - ], + Divider( + thickness: 1.0, + color: Colors.grey.shade400, + ), + Padding( + padding: EdgeInsets.symmetric(horizontal: 8.0), + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + InkWell( + child: Row( + children: [ + Icon( + Icons.wrap_text, ), - onTap: () { - showModalBottomSheet( - isScrollControlled: true, - context: context, - builder: (BuildContext context) { - return DraggableScrollableSheet( - initialChildSize: 0.95, - maxChildSize: 0.95, - minChildSize: 0.9, - builder: (BuildContext context, - ScrollController - scrollController) { - return SingleChildScrollView( - controller: scrollController, - child: Container( - height: MediaQuery.of(context) - .size - .height * - 1.95, - child: Column( - children: [ - Padding( - padding: - EdgeInsets.all(8.0), - child: Row( - children: [ - Icon( - Icons.wrap_text, - ), - SizedBox( - width: 10.0, - ), - Texts( - 'Refine', - fontWeight: - FontWeight - .w600, - ), - SizedBox( - width: 250.0, - ), - InkWell( - child: Texts( - 'Close', - color: - Colors.red, - fontWeight: - FontWeight - .w600, - fontSize: 15.0, - ), - onTap: () { - Navigator.pop( - context); - }, - ), - ], + SizedBox( + width: 10.0, + ), + Texts( + 'Refine', + fontWeight: FontWeight.w600, + ), + ], + ), + onTap: () { + showModalBottomSheet( + isScrollControlled: true, + context: context, + builder: (BuildContext context) { + return DraggableScrollableSheet( + initialChildSize: 0.95, + maxChildSize: 0.95, + minChildSize: 0.9, + builder: (BuildContext context, + ScrollController scrollController) { + return SingleChildScrollView( + controller: scrollController, + child: Container( + color: Colors.white, + height: MediaQuery.of(context) + .size + .height * + 1.95, + child: Column( + children: [ + Padding( + padding: + EdgeInsets.all(8.0), + child: Row( + children: [ + Icon( + Icons.wrap_text, + ), + SizedBox( + width: 10.0, + ), + Texts( + 'Refine', + fontWeight: + FontWeight.w600, + ), + SizedBox( + width: 250.0, + ), + InkWell( + child: Texts( + 'Close', + color: Colors.red, + fontWeight: + FontWeight.w600, + fontSize: 15.0, + ), + onTap: () { + Navigator.pop( + context); + }, ), + ], + ), + ), + Divider( + thickness: 1.0, + color: Colors.black12, + ), + Column( + children: [ + ExpansionTile( + title: + Texts('Categorise'), + children: [ + ProcedureListWidget( + model: model, + masterList: model + .categoriseParent, + removeHistory: + (item) { + setState(() { + entityList + .remove( + item); + }); + }, + addHistory: + (history) { + setState(() { + entityList.add( + history); + }); + }, + addSelectedHistories: + () { + //TODO build your fun herr + // widget.addSelectedHistories(); + }, + isEntityListSelected: + (master) => + isEntityListSelected( + master), + ) + ], ), Divider( thickness: 1.0, color: Colors.black12, ), - Column( + ExpansionTile( + title: Texts('Brands'), children: [ - ExpansionTile( - title: Texts( - 'Categorise'), - children: [ - Container( - height: 350, - child: ListView - .builder( - controller: - scrollController, - scrollDirection: - Axis - .vertical, - shrinkWrap: + Container( + height: 350, + child: ListView + .builder( + scrollDirection: + Axis + .vertical, + shrinkWrap: + true, + itemCount: model + .brandsList + .length, + itemBuilder: + (BuildContext + context, + int index) { + return CheckboxListTile( + tristate: true, - itemCount: model - .categoriseParent - .length, - itemBuilder: - (BuildContext context, - int index) { - return CheckboxListTile( - tristate: - true, - title: - Texts(model.categoriseParent[index].name), - controlAffinity: - ListTileControlAffinity.leading, - value: - checkedCategorise, - onChanged: - (bool value) { - setState(() { - checkedCategorise = value; - }); - }, - ); - }), - ) - ], - ), - Divider( - thickness: 1.0, - color: - Colors.black12, - ), - ExpansionTile( - title: - Texts('Brands'), - children: [ - Container( - height: 350, - child: ListView - .builder( - scrollDirection: - Axis - .vertical, - shrinkWrap: + title: Texts(model + .brandsList[index] + .name), + controlAffinity: + ListTileControlAffinity.leading, + value: + checkedBrands, + onChanged: + (bool + value) { + setState( + () { + checkedBrands = + value; + }); + }, + autofocus: true, - itemCount: model - .brandsList - .length, - itemBuilder: - (BuildContext context, - int index) { - return CheckboxListTile( - tristate: - true, - title: - Texts(model.brandsList[index].name), - controlAffinity: - ListTileControlAffinity.leading, - value: - checkedBrands, - onChanged: - (bool value) { - setState(() { - checkedBrands = value; - }); - }, - autofocus: - true, - ); - }), - ) - ], - ), - Divider( - thickness: 1.0, - color: - Colors.black12, - ), - ExpansionTile( - title: - Texts('Price'), - children: [ - Container( - color: Color( - 0xffEEEEEE), - child: Row( + ); + }), + ) + ], + ), + Divider( + thickness: 1.0, + color: Colors.black12, + ), + ExpansionTile( + title: Texts('Price'), + children: [ + Container( + color: Color( + 0xffEEEEEE), + child: Row( + mainAxisAlignment: + MainAxisAlignment + .spaceAround, + children: [ + Column( mainAxisAlignment: MainAxisAlignment - .spaceAround, + .start, children: [ - Column( - mainAxisAlignment: - MainAxisAlignment - .start, - children: [ - Texts( - 'Min'), - Container( - color: - Colors.white, - width: - 200, - height: - 40, - child: - TextFormField( - decoration: - InputDecoration( - border: OutlineInputBorder(), - ), - ), + Texts( + 'Min'), + Container( + color: Colors + .white, + width: + 200, + height: + 40, + child: + TextFormField( + decoration: + InputDecoration( + border: + OutlineInputBorder(), ), - ], + ), ), - Column( - mainAxisAlignment: - MainAxisAlignment - .start, - children: [ - Texts( - 'Max'), - Container( - color: - Colors.white, - width: - 200, - height: - 40, - child: - TextFormField( - decoration: - InputDecoration( - border: OutlineInputBorder(), - ), - ), + ], + ), + Column( + mainAxisAlignment: + MainAxisAlignment + .start, + children: [ + Texts( + 'Max'), + Container( + color: Colors + .white, + width: + 200, + height: + 40, + child: + TextFormField( + decoration: + InputDecoration( + border: + OutlineInputBorder(), ), - ], + ), ), ], ), - ) - ], - ), - Divider( - thickness: 1.0, - color: - Colors.black12, - ), - SizedBox( - height: MediaQuery.of( - context) - .size - .height * - 0.4, - ), - Padding( - padding: - EdgeInsets.all( - 8.0), - child: Row( - mainAxisAlignment: - MainAxisAlignment - .spaceEvenly, - children: [ - Container( - width: 100, - child: Button( - label: - 'Reset', - backgroundColor: - Colors - .red, - ), - ), - SizedBox( - width: 30, - ), - Container( - width: 200, - child: Button( - label: - 'Apply', - backgroundColor: - Colors - .green, - ), - ), ], ), - ), + ) ], ), - ], - ), - ), - ); - }); - }, - ); - }, - ), - Row( - children: [ - Container( - height: 44.0, - child: VerticalDivider( - color: Colors.black45, - thickness: 1.0, -//width: 0.3, -// indent: 0.0, - ), - ), - Padding( - padding: EdgeInsets.all(8.0), - child: InkWell( - child: styleIcon, - onTap: () { - setState(() { - if (styleOne == true) { - styleOne = false; - styleTwo = true; - styleIcon = Icon( - Icons.auto_awesome_mosaic, - color: Colors.blue, - size: 29.0, - ); - } else { - styleOne = true; - styleTwo = false; - styleIcon = Icon( - Icons.widgets_sharp, - color: Colors.blue, - size: 29.0, - ); - } - }); - }, - ), - ), - ], - ), - ], - ), - ), - Divider( - thickness: 1.0, - color: Colors.grey.shade400, - ), - styleOne == true - ? Container( - height: SizeConfig.screenHeight * 7.8, - child: GridView.builder( - physics: NeverScrollableScrollPhysics(), - gridDelegate: - SliverGridDelegateWithFixedCrossAxisCount( - crossAxisCount: 2, - crossAxisSpacing: 0.5, - mainAxisSpacing: 2.0, - childAspectRatio: 0.9, - ), - itemCount: model.parentProducts.length, - itemBuilder: - (BuildContext context, int index) { - return NetworkBaseView( - baseViewModel: model, - child: InkWell( - child: Card( - color: model.parentProducts[index] - .discountName != - null - ? Color(0xffFFFF00) - : Colors.white, - elevation: 0, - shape: Border( - right: BorderSide( - color: Colors.grey.shade300, - width: 1, - ), - left: BorderSide( - color: Colors.grey.shade300, - width: 1, - ), - bottom: BorderSide( - color: Colors.grey.shade300, - width: 1, - ), - top: BorderSide( - color: Colors.grey.shade300, - width: 1, - ), - ), - margin: EdgeInsets.symmetric( - horizontal: 8, - vertical: 4, - ), - child: Container( - decoration: BoxDecoration( - borderRadius: - BorderRadius.only( - topLeft: - Radius.circular(110.0), - ), - color: Colors.white, - ), - padding: EdgeInsets.symmetric( - horizontal: 0), - width: MediaQuery.of(context) - .size - .width / - 3, - child: Column( - crossAxisAlignment: - CrossAxisAlignment.start, - children: [ - Stack( - children: [ - if (model - .parentProducts[ - index] - .discountName != - null) - RotatedBox( - quarterTurns: 4, - child: Container( - decoration: - BoxDecoration(), - child: Padding( - padding: - EdgeInsets - .only( - right: 5.0, - top: 20.0, - bottom: 5.0, - ), - child: Texts( - 'offer' - .toUpperCase(), - color: Colors - .red, - fontSize: - 13.0, - fontWeight: - FontWeight - .w900, - ), - ), - transform: new Matrix4 - .rotationZ( - 5.837200), - ), - ), - Container( - margin: EdgeInsets - .fromLTRB( - 0, 16, 0, 0), - alignment: - Alignment.center, - child: Image.network( - model - .parentProducts[ - index] - .images - .isNotEmpty - ? model - .parentProducts[ - index] - .images[0] - .thumb - : 'https://upload.wikimedia.org/wikipedia/commons/thumb/6/6c/No_image_3x4.svg/1200px-No_image_3x4.svg.png', - fit: BoxFit.cover, - height: 80, - ), - ), - Container( - width: model - .parentProducts[ - index] - .rxMessage != - null - ? 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 - : "", - color: Colors.white, - regular: true, - fontSize: 10, - fontWeight: - FontWeight.w400, - ), - ), - ], - ), - Container( - margin: - EdgeInsets.symmetric( - horizontal: 6, - vertical: 0, + Divider( + thickness: 1.0, + color: Colors.black12, ), - child: Column( - crossAxisAlignment: - CrossAxisAlignment - .start, - children: [ - if (model - .parentProducts[ - index] - .discountName != - null) + SizedBox( + height: MediaQuery.of( + context) + .size + .height * + 0.4, + ), + Padding( + padding: + EdgeInsets.all(8.0), + child: Row( + mainAxisAlignment: + MainAxisAlignment + .spaceEvenly, + children: [ Container( - width: double - .infinity, - height: 13.0, - decoration: - BoxDecoration( - color: Color( - 0xff5AB145), - ), - child: Center( - child: Texts( - model - .parentProducts[ - index] - .discountName, - regular: true, - color: Colors - .white, - fontSize: - 10.4, - ), + width: 100, + child: Button( + label: 'Reset', + backgroundColor: + Colors.red, ), ), - Texts( - model - .parentProducts[ - index] - .name, - regular: true, - fontSize: 12, - fontWeight: - FontWeight.w700, - ), - Padding( - padding: - const EdgeInsets - .only( - top: 4, - bottom: 4), - child: Texts( - "SAR ${model.parentProducts[index].price}", - bold: true, - fontSize: 14, + SizedBox( + width: 30, ), - ), - Row( - children: [ - StarRating( - 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, - ) - ], - ), - ], + Container( + width: 200, + child: Button( + label: 'Apply', + backgroundColor: + Colors + .green, + ), + ), + ], + ), ), - ), - ], - ), + ], + ), + ], ), ), - onTap: () => { - Navigator.push( - context, - FadePage( - page: ProductDetailPage( - model.parentProducts[ - index]), - )), - }, - )); + ); + }); + }, + ); + }, + ), + Row( + children: [ + Container( + height: 44.0, + child: VerticalDivider( + color: Colors.black45, + thickness: 1.0, +//width: 0.3, +// indent: 0.0, + ), + ), + Padding( + padding: EdgeInsets.all(8.0), + child: InkWell( + child: styleIcon, + onTap: () { + setState(() { + if (styleOne == true) { + styleOne = false; + styleTwo = true; + styleIcon = Icon( + Icons.auto_awesome_mosaic, + color: Colors.blue, + size: 29.0, + ); + } else { + styleOne = true; + styleTwo = false; + styleIcon = Icon( + Icons.widgets_sharp, + color: Colors.blue, + size: 29.0, + ); + } + }); }, ), - ) - : Container( - height: - MediaQuery.of(context).size.height * 5.0, - child: ListView.builder( - physics: NeverScrollableScrollPhysics(), - itemCount: model.parentProducts.length, - itemBuilder: - (BuildContext context, int index) { - return InkWell( - child: Card( - child: Row( + ), + ], + ), + ], + ), + ), + Divider( + thickness: 1.0, + color: Colors.grey.shade400, + ), + styleOne == true + ? Container( + height: model.parentProducts.length * + MediaQuery.of(context).size.height * + 0.15, + child: GridView.builder( + physics: NeverScrollableScrollPhysics(), + gridDelegate: + SliverGridDelegateWithFixedCrossAxisCount( + crossAxisCount: 2, + crossAxisSpacing: 0.5, + mainAxisSpacing: 2.0, + childAspectRatio: 0.9, + ), + itemCount: model.parentProducts.length, + itemBuilder: (BuildContext context, int index) { + return NetworkBaseView( + baseViewModel: model, + child: InkWell( + child: Card( + color: model.parentProducts[index] + .discountName != + null + ? Color(0xffFFFF00) + : Colors.white, + elevation: 0, + shape: Border( + right: BorderSide( + color: Colors.grey.shade300, + width: 1, + ), + left: BorderSide( + color: Colors.grey.shade300, + width: 1, + ), + bottom: BorderSide( + color: Colors.grey.shade300, + width: 1, + ), + top: BorderSide( + color: Colors.grey.shade300, + width: 1, + ), + ), + margin: EdgeInsets.symmetric( + horizontal: 8, + vertical: 4, + ), + child: Container( + decoration: BoxDecoration( + borderRadius: BorderRadius.only( + topLeft: Radius.circular(110.0), + ), + color: Colors.white, + ), + padding: EdgeInsets.symmetric( + horizontal: 0), + width: MediaQuery.of(context) + .size + .width / + 3, + child: Column( + crossAxisAlignment: + CrossAxisAlignment.start, children: [ Stack( children: [ - Column( - children: [ - Container( + if (model + .parentProducts[ + index] + .discountName != + null) + RotatedBox( + quarterTurns: 4, + child: Container( decoration: BoxDecoration(), child: Padding( padding: EdgeInsets.only( - left: 9.0, - top: 8.0, - right: 10.0, + right: 5.0, + top: 20.0, + bottom: 5.0, ), - ), - ), - 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: 80, - ), - ), - ], - ), - Column( - children: [ - 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)), - ), - child: Expanded( child: Texts( - model - .parentProducts[ - index] - .rxMessage != - null - ? model - .parentProducts[ - index] - .rxMessage - : "", - color: - Colors.white, - regular: true, - fontSize: 10, + 'offer' + .toUpperCase(), + color: Colors.red, + fontSize: 13.0, fontWeight: FontWeight - .w400, + .w900, ), ), + transform: new Matrix4 + .rotationZ( + 5.837200), ), - ], + ), + Container( + margin: + EdgeInsets.fromLTRB( + 0, 16, 0, 0), + alignment: + Alignment.center, + child: Image.network( + model + .parentProducts[ + index] + .images + .isNotEmpty + ? model + .parentProducts[ + index] + .images[0] + .thumb + : 'https://upload.wikimedia.org/wikipedia/commons/thumb/6/6c/No_image_3x4.svg/1200px-No_image_3x4.svg.png', + fit: BoxFit.cover, + height: 80, + ), + ), + Container( + width: model + .parentProducts[ + index] + .rxMessage != + null + ? 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 + : "", + color: Colors.white, + regular: true, + fontSize: 10, + fontWeight: + FontWeight.w400, + ), ), ], ), @@ -1020,36 +783,46 @@ class _ParentCategorisePageState extends State { vertical: 0, ), child: Column( - mainAxisAlignment: - MainAxisAlignment - .spaceAround, crossAxisAlignment: CrossAxisAlignment .start, children: [ - SizedBox( - height: 4.0, - ), - Container( - width: MediaQuery.of( - context) - .size - .width * - 0.65, - child: Texts( - model + if (model .parentProducts[ index] - .name, - regular: true, - fontSize: 13.2, - fontWeight: - FontWeight.w500, - maxLines: 5, + .discountName != + null) + Container( + width: + double.infinity, + height: 13.0, + decoration: + BoxDecoration( + color: Color( + 0xff5AB145), + ), + child: Center( + child: Texts( + model + .parentProducts[ + index] + .discountName, + regular: true, + color: + Colors.white, + fontSize: 10.4, + ), + ), ), - ), - SizedBox( - height: 8.0, + Texts( + model + .parentProducts[ + index] + .name, + regular: true, + fontSize: 12, + fontWeight: + FontWeight.w700, ), Padding( padding: @@ -1095,23 +868,224 @@ class _ParentCategorisePageState extends State { ], ), ), - onTap: () => { - Navigator.push( - context, - FadePage( - page: ProductDetailPage(model - .parentProducts[index]), - )), - }, - ); - }), - ) - ], - ), - ), - ], + ), + onTap: () => { + Navigator.push( + context, + FadePage( + page: ProductDetailPage(model + .parentProducts[index]), + )), + }, + )); + }, + ), + ) + : Container( + height: model.parentProducts.length * + MediaQuery.of(context).size.height * + 0.122, + child: ListView.builder( + physics: NeverScrollableScrollPhysics(), + itemCount: model.parentProducts.length, + itemBuilder: + (BuildContext context, int index) { + return InkWell( + child: Card( + child: Row( + children: [ + Stack( + children: [ + Column( + children: [ + Container( + decoration: + BoxDecoration(), + child: Padding( + padding: + EdgeInsets.only( + left: 9.0, + top: 8.0, + right: 10.0, + ), + ), + ), + Container( + margin: + EdgeInsets.fromLTRB( + 0, 0, 0, 0), + alignment: + Alignment.center, + child: 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: 80, + ), + ), + ], + ), + Column( + children: [ + 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)), + ), + child: Texts( + model + .parentProducts[ + index] + .rxMessage != + null + ? model + .parentProducts[ + index] + .rxMessage + : "", + color: Colors.white, + regular: true, + fontSize: 10, + fontWeight: + FontWeight.w400, + ), + ), + ], + ), + ], + ), + Container( + margin: EdgeInsets.symmetric( + horizontal: 6, + vertical: 0, + ), + child: Column( + mainAxisAlignment: + MainAxisAlignment + .spaceAround, + crossAxisAlignment: + CrossAxisAlignment.start, + children: [ + SizedBox( + height: 4.0, + ), + Container( + width: + MediaQuery.of(context) + .size + .width * + 0.65, + child: Texts( + model + .parentProducts[index] + .name, + regular: true, + fontSize: 13.2, + fontWeight: + FontWeight.w500, + maxLines: 5, + ), + ), + SizedBox( + height: 8.0, + ), + Padding( + padding: + const EdgeInsets.only( + top: 4, bottom: 4), + child: Texts( + "SAR ${model.parentProducts[index].price}", + bold: true, + fontSize: 14, + ), + ), + Row( + children: [ + StarRating( + totalAverage: model + .parentProducts[ + index] + .approvedRatingSum > + 0 + ? (model + .parentProducts[ + index] + .approvedRatingSum + .toDouble() / + model + .parentProducts[ + index] + .approvedRatingSum + .toDouble()) + .toDouble() + : 0, + forceStars: true), + Texts( + "(${model.parentProducts[index].approvedTotalReviews})", + regular: true, + fontSize: 10, + fontWeight: + FontWeight.w400, + ) + ], + ), + ], + ), + ), + ], + ), + ), + onTap: () => { + Navigator.push( + context, + FadePage( + page: ProductDetailPage( + model.parentProducts[index]), + )), + }, + ); + }), + ) + ], + ), ), ), )); } + + bool isEntityListSelected(CategoriseParentModel masterKey) { + Iterable history = + entityList.where((element) => masterKey.id == element.id); + if (history.length > 0) { + return true; + } + return false; + } } diff --git a/lib/pages/sub_categorise_page.dart b/lib/pages/sub_categorise_page.dart index 7c14e05d..78dda218 100644 --- a/lib/pages/sub_categorise_page.dart +++ b/lib/pages/sub_categorise_page.dart @@ -56,7 +56,6 @@ class _SubCategorisePageState extends State { baseViewModel: model, body: SingleChildScrollView( child: Container( - height: MediaQuery.of(context).size.height * 5.97, child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ @@ -596,7 +595,9 @@ class _SubCategorisePageState extends State { ), styleOne == true ? Container( - height: MediaQuery.of(context).size.height * 3.85, + height: model.subProducts.length * + MediaQuery.of(context).size.height * + 0.15, child: GridView.builder( physics: NeverScrollableScrollPhysics(), gridDelegate: @@ -604,7 +605,7 @@ class _SubCategorisePageState extends State { crossAxisCount: 2, crossAxisSpacing: 0.5, mainAxisSpacing: 2.0, - childAspectRatio: 1.0, + childAspectRatio: 0.9, ), itemCount: model.subProducts.length, itemBuilder: (BuildContext context, int index) { @@ -798,7 +799,9 @@ class _SubCategorisePageState extends State { ), ) : Container( - height: MediaQuery.of(context).size.height * 5.0, + height: model.subProducts.length * + MediaQuery.of(context).size.height * + 0.122, child: ListView.builder( physics: NeverScrollableScrollPhysics(), itemCount: model.subProducts.length, diff --git a/lib/widgets/others/entity_checkbox_list.dart b/lib/widgets/others/entity_checkbox_list.dart new file mode 100644 index 00000000..da09a0ac --- /dev/null +++ b/lib/widgets/others/entity_checkbox_list.dart @@ -0,0 +1,170 @@ +import 'package:diplomaticquarterapp/core/model/pharmacy/categorise_parent_model.dart'; +import 'package:diplomaticquarterapp/core/viewModels/pharmacy_categorise_view_model.dart'; +import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; +import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; +import 'package:diplomaticquarterapp/widgets/input/text_field.dart'; +import 'package:diplomaticquarterapp/widgets/others/network_base_view.dart'; +import 'package:diplomaticquarterapp/widgets/text/app_texts_widget.dart'; +import 'package:eva_icons_flutter/eva_icons_flutter.dart'; +import 'package:flutter/cupertino.dart'; +import 'package:flutter/material.dart'; + +class ProcedureListWidget extends StatefulWidget { + final PharmacyCategoriseViewModel model; + final Function addSelectedHistories; + final Function(CategoriseParentModel) removeHistory; + final Function(CategoriseParentModel) addHistory; + final Function(CategoriseParentModel) addRemarks; + + final bool Function(CategoriseParentModel) isEntityListSelected; + final List masterList; + + ProcedureListWidget( + {Key key, + this.model, + this.addSelectedHistories, + this.removeHistory, + this.masterList, + this.addHistory, + this.isEntityListSelected, + this.addRemarks}) + : super(key: key); + + @override + _ProcedureListWidgetState createState() => _ProcedureListWidgetState(); +} + +class _ProcedureListWidgetState extends State { + int selectedType = 0; + int typeUrgent; + int typeRegular; + + setSelectedType(int val) { + setState(() { + selectedType = val; + }); + } + + List items = List(); + List remarksList = List(); + List typeList = List(); + + @override + void initState() { + items.addAll(widget.masterList); + super.initState(); + } + + TextEditingController remarksController = TextEditingController(); + @override + Widget build(BuildContext context) { + return Container( + child: Column( + children: [ + NetworkBaseView( + baseViewModel: widget.model, + child: Container( + height: MediaQuery.of(context).size.height * 0.35, + child: Center( + child: Container( + margin: EdgeInsets.only(top: 15), + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(12), + color: Colors.white), + child: ListView( + children: [ + // TextFields( + // hintText: + // 'sss', //TranslationBase.of(context).searchProcedures, + // suffixIcon: EvaIcons.search, + // onChanged: (value) { + // filterSearchResults(value); + // }, + // ), + SizedBox( + height: 15, + ), + items.length != 0 + ? Column( + children: items.map((historyInfo) { + return Column( + children: [ + Row( + children: [ + Checkbox( + value: widget.isEntityListSelected( + historyInfo), + activeColor: Colors.red[800], + onChanged: (bool newValue) { + setState(() { + if (widget.isEntityListSelected( + historyInfo)) { + widget + .removeHistory(historyInfo); + } else { + widget.addHistory(historyInfo); + } + }); + }), + Expanded( + child: Padding( + padding: const EdgeInsets.symmetric( + horizontal: 10, vertical: 0), + child: Texts(historyInfo.name, + variant: "bodyText", + bold: true, + color: Colors.black), + ), + ), + ], + ), + Divider( + height: 1, + ), + ], + ); + }).toList(), + ) + : Center( + child: Container( + child: AppText( + "There's no procedures for this category", + color: Color(0xFFB9382C)), + ), + ) + ], + ), + )), + ), + ), + SizedBox( + height: 10, + ), + ], + ), + ); + } + + void filterSearchResults(String query) { + List dummySearchList = List(); + dummySearchList.addAll(widget.masterList); + if (query.isNotEmpty) { + List dummyListData = List(); + dummySearchList.forEach((item) { + if (item.name.toLowerCase().contains(query.toLowerCase())) { + dummyListData.add(item); + } + }); + setState(() { + items.clear(); + items.addAll(dummyListData); + }); + return; + } else { + setState(() { + items.clear(); + items.addAll(widget.masterList); + }); + } + } +} From b891c1bd80503e017fa97e63b6cfce38d8e017a9 Mon Sep 17 00:00:00 2001 From: Sultan Khan Date: Mon, 8 Mar 2021 20:21:12 +0300 Subject: [PATCH 11/11] theme issue --- lib/config/config.dart | 9 +- lib/config/localized_values.dart | 2 + .../service/ancillary_orders_service.dart | 24 ++ .../ancillary_orders_view_model.dart | 22 + .../ancillary_order_list_model.dart | 105 +++++ .../NewCMC/cmc_location_page.dart | 206 ++++----- .../NewCMC/new_cmc_page.dart | 404 ++++++++++-------- .../NewCMC/new_cmc_step_one_page.dart | 143 ++++--- .../NewCMC/new_cmc_step_three_page.dart | 76 ++-- .../NewCMC/new_cmc_step_tow_page.dart | 141 +++--- .../ComprehensiveMedicalCheckup/cmc_page.dart | 28 +- .../new_Home_health_care_step_one_page.dart | 52 +-- .../new_home_health_care_page.dart | 157 ++++--- .../HomeHealthCare/home_health_care_page.dart | 24 +- .../all_habib_medical_service_page.dart | 93 ++-- .../ancillary-orders/ancillaryOrders.dart | 43 ++ .../​ health_calculators.dart | 23 +- lib/pages/Blood/blood_donation.dart | 8 +- lib/pages/Blood/my_balance_page.dart | 6 +- .../components/SearchByClinic.dart | 15 +- lib/pages/login/confirm-login.dart | 39 +- .../medical/balance/advance_payment_page.dart | 8 +- .../medical/balance/my_balance_page.dart | 21 +- lib/pages/medical/balance/new_text_Field.dart | 112 +++-- lib/theme/theme_value.dart | 2 + lib/uitl/translations_delegate_base.dart | 2 + .../bottom_navigation_item.dart | 5 +- lib/widgets/buttons/secondary_button.dart | 23 +- .../data_display/services)contaniner.dart | 2 +- lib/widgets/data_display/text.dart | 12 +- .../others/app_scaffold_pharmacy_widget.dart | 6 +- .../pharmacy/bottom_nav_pharmacy_item.dart | 10 +- 32 files changed, 1088 insertions(+), 735 deletions(-) create mode 100644 lib/core/service/ancillary_orders_service.dart create mode 100644 lib/core/viewModels/ancillary_orders_view_model.dart create mode 100644 lib/models/anicllary-orders/ancillary_order_list_model.dart create mode 100644 lib/pages/AlHabibMedicalService/ancillary-orders/ancillaryOrders.dart diff --git a/lib/config/config.dart b/lib/config/config.dart index f896d304..37d586f3 100644 --- a/lib/config/config.dart +++ b/lib/config/config.dart @@ -12,8 +12,8 @@ const EXA_CART_API_BASE_URL = 'https://mdlaboratories.com/exacartapi'; const PACKAGES_CATEGORIES = '/api/categories'; const PACKAGES_PRODUCTS = '/api/products'; -const BASE_URL = 'https://uat.hmgwebservices.com/'; -//const BASE_URL = 'https://hmgwebservices.com/'; +//const BASE_URL = 'https://uat.hmgwebservices.com/'; +const BASE_URL = 'https://hmgwebservices.com/'; //const BASE_PHARMACY_URL = 'http://swd-pharapp-01:7200/api/'; const BASE_PHARMACY_URL = 'https://uat.hmgwebservices.com/epharmacy/api/'; @@ -435,6 +435,11 @@ const GET_ALL_CITIES = 'services/Lists.svc/rest/GetAllCities'; const CREATE_E_REFERRAL = "Services/Patients.svc/REST/CreateEReferral"; const GET_E_REFERRALS = "Services/Patients.svc/REST/GetEReferrals"; +// Encillary Orders + +const GET_ANCILLARY_ORDERS = + 'Services/Doctors.svc/REST/GetOnlineAncillaryOrderList'; + //Pharmacy wishlist // const GET_WISHLIST = "http://swd-pharapp-01:7200/api/shopping_cart_items/"; diff --git a/lib/config/localized_values.dart b/lib/config/localized_values.dart index 2042d265..ea709ddd 100644 --- a/lib/config/localized_values.dart +++ b/lib/config/localized_values.dart @@ -1956,4 +1956,6 @@ const Map localizedValues = { }, "order-overview": {"en": "Order Overview", "ar": "ملخص الطلب"}, "shipping-address": {"en": "Delivery Address", "ar": "عنوان التوصيل"}, + "ancillary-orders": {"en": "Ancillary Orders", "ar": "الأوامر التبعية"}, + }; diff --git a/lib/core/service/ancillary_orders_service.dart b/lib/core/service/ancillary_orders_service.dart new file mode 100644 index 00000000..5adf5305 --- /dev/null +++ b/lib/core/service/ancillary_orders_service.dart @@ -0,0 +1,24 @@ +import 'package:diplomaticquarterapp/config/config.dart'; +import 'package:diplomaticquarterapp/core/service/base_service.dart'; +import 'package:diplomaticquarterapp/models/anicllary-orders/ancillary_order_list_model.dart'; + +class AncillaryOrdersService extends BaseService { + List _ancillaryLists = List(); + List get ancillaryLists => _ancillaryLists; + + Future getOrders() async { + Map body = Map(); + + hasError = false; + + await baseAppClient.post(GET_ANCILLARY_ORDERS, + onSuccess: (dynamic response, int statusCode) { + response['AncillaryOrderList'].forEach((item) { + ancillaryLists.add(AncillaryOrdersListModel.fromJson(item)); + }); + }, onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + }, body: body); + } +} diff --git a/lib/core/viewModels/ancillary_orders_view_model.dart b/lib/core/viewModels/ancillary_orders_view_model.dart new file mode 100644 index 00000000..2d92a402 --- /dev/null +++ b/lib/core/viewModels/ancillary_orders_view_model.dart @@ -0,0 +1,22 @@ +import 'package:diplomaticquarterapp/core/service/ancillary_orders_service.dart'; + +import 'base_view_model.dart'; +import '../../locator.dart'; +import 'package:diplomaticquarterapp/core/enum/viewstate.dart'; + +class AnciallryOrdersViewModel extends BaseViewModel { + bool hasError = false; + + AncillaryOrdersService _ancillaryService = locator(); + + Future getOrders() async { + hasError = false; + setState(ViewState.Busy); + await _ancillaryService.getOrders(); + if (_ancillaryService.hasError) { + error = _ancillaryService.error; + setState(ViewState.ErrorLocal); + } else + setState(ViewState.Idle); + } +} diff --git a/lib/models/anicllary-orders/ancillary_order_list_model.dart b/lib/models/anicllary-orders/ancillary_order_list_model.dart new file mode 100644 index 00000000..76ef3a7d --- /dev/null +++ b/lib/models/anicllary-orders/ancillary_order_list_model.dart @@ -0,0 +1,105 @@ +class AncillaryOrdersListModel { + List ancillaryOrderList; + Null errCode; + String message; + int patientID; + String patientName; + int patientType; + int projectID; + String projectName; + String setupID; + int statusCode; + + AncillaryOrdersListModel( + {this.ancillaryOrderList, + this.errCode, + this.message, + this.patientID, + this.patientName, + this.patientType, + this.projectID, + this.projectName, + this.setupID, + this.statusCode}); + + AncillaryOrdersListModel.fromJson(Map json) { + if (json['AncillaryOrderList'] != null) { + ancillaryOrderList = new List(); + json['AncillaryOrderList'].forEach((v) { + ancillaryOrderList.add(new AncillaryOrderList.fromJson(v)); + }); + } + errCode = json['ErrCode']; + message = json['Message']; + patientID = json['PatientID']; + patientName = json['PatientName']; + patientType = json['PatientType']; + projectID = json['ProjectID']; + projectName = json['ProjectName']; + setupID = json['SetupID']; + statusCode = json['StatusCode']; + } + + Map toJson() { + final Map data = new Map(); + if (this.ancillaryOrderList != null) { + data['AncillaryOrderList'] = + this.ancillaryOrderList.map((v) => v.toJson()).toList(); + } + data['ErrCode'] = this.errCode; + data['Message'] = this.message; + data['PatientID'] = this.patientID; + data['PatientName'] = this.patientName; + data['PatientType'] = this.patientType; + data['ProjectID'] = this.projectID; + data['ProjectName'] = this.projectName; + data['SetupID'] = this.setupID; + data['StatusCode'] = this.statusCode; + return data; + } +} + +class AncillaryOrderList { + String appointmentDate; + int appointmentNo; + int clinicID; + String clinicName; + int doctorID; + String doctorName; + String orderDate; + int orderNo; + + AncillaryOrderList( + {this.appointmentDate, + this.appointmentNo, + this.clinicID, + this.clinicName, + this.doctorID, + this.doctorName, + this.orderDate, + this.orderNo}); + + AncillaryOrderList.fromJson(Map json) { + appointmentDate = json['AppointmentDate']; + appointmentNo = json['AppointmentNo']; + clinicID = json['ClinicID']; + clinicName = json['ClinicName']; + doctorID = json['DoctorID']; + doctorName = json['DoctorName']; + orderDate = json['OrderDate']; + orderNo = json['OrderNo']; + } + + Map toJson() { + final Map data = new Map(); + data['AppointmentDate'] = this.appointmentDate; + data['AppointmentNo'] = this.appointmentNo; + data['ClinicID'] = this.clinicID; + data['ClinicName'] = this.clinicName; + data['DoctorID'] = this.doctorID; + data['DoctorName'] = this.doctorName; + data['OrderDate'] = this.orderDate; + data['OrderNo'] = this.orderNo; + return data; + } +} diff --git a/lib/pages/AlHabibMedicalService/ComprehensiveMedicalCheckup/NewCMC/cmc_location_page.dart b/lib/pages/AlHabibMedicalService/ComprehensiveMedicalCheckup/NewCMC/cmc_location_page.dart index 4e396427..72aa40dc 100644 --- a/lib/pages/AlHabibMedicalService/ComprehensiveMedicalCheckup/NewCMC/cmc_location_page.dart +++ b/lib/pages/AlHabibMedicalService/ComprehensiveMedicalCheckup/NewCMC/cmc_location_page.dart @@ -22,127 +22,135 @@ class CMCLocationPage extends StatefulWidget { final double longitude; final dynamic model; - const CMCLocationPage({Key key, this.onPick, this.latitude, this.longitude, this.model}) + const CMCLocationPage( + {Key key, this.onPick, this.latitude, this.longitude, this.model}) : super(key: key); @override - _CMCLocationPageState createState() => - _CMCLocationPageState(); + _CMCLocationPageState createState() => _CMCLocationPageState(); } -class _CMCLocationPageState - extends State { +class _CMCLocationPageState extends State { double latitude = 0; double longitude = 0; @override void initState() { - latitude = widget.latitude; longitude = widget.longitude; super.initState(); } - @override Widget build(BuildContext context) { ProjectViewModel projectViewModel = Provider.of(context); return BaseView( onModelReady: (model) {}, builder: (_, model, widget) => AppScaffold( - isShowDecPage: false, - isShowAppBar: true, - baseViewModel: model, - body: PlacePicker( - apiKey: GOOGLE_API_KEY, - enableMyLocationButton: true, - automaticallyImplyAppBarLeading: false, - autocompleteOnTrailingWhitespace: true, - selectInitialPosition: true, - autocompleteLanguage: projectViewModel.currentLanguage, - enableMapTypeButton: true, - searchForInitialValue: false, - onPlacePicked: (PickResult result) { - print(result.adrAddress); - - }, - selectedPlaceWidgetBuilder: - (_, selectedPlace, state, isSearchBarFocused) { - print("state: $state, isSearchBarFocused: $isSearchBarFocused"); - return isSearchBarFocused - ? Container() - : FloatingCard( - bottomPosition: 0.0, - leftPosition: 0.0, - rightPosition: 0.0, - width: 500, - borderRadius: BorderRadius.circular(12.0), - child: state == SearchingState.Searching - ? Center(child: CircularProgressIndicator()) - : Container( - margin: EdgeInsets.all(12), - child: Column( - children: [ - SecondaryButton( - color: Colors.grey[800], - textColor: Colors.white, - onTap: () async { - print(selectedPlace); - AddNewAddressRequestModel - addNewAddressRequestModel = - new AddNewAddressRequestModel( - customer: Customer(addresses: [ - Addresses( - address1: - selectedPlace.formattedAddress, - address2: selectedPlace - .formattedAddress, - customerAttributes: "", - city: "", - createdOnUtc: "", - id: 0, - latLong: "$latitude,$longitude", - email: "") - ]), - ); + isShowDecPage: false, + isShowAppBar: true, + baseViewModel: model, + body: PlacePicker( + apiKey: GOOGLE_API_KEY, + enableMyLocationButton: true, + automaticallyImplyAppBarLeading: false, + autocompleteOnTrailingWhitespace: true, + selectInitialPosition: true, + autocompleteLanguage: projectViewModel.currentLanguage, + enableMapTypeButton: true, + searchForInitialValue: false, + onPlacePicked: (PickResult result) { + print(result.adrAddress); + }, + selectedPlaceWidgetBuilder: + (_, selectedPlace, state, isSearchBarFocused) { + print( + "state: $state, isSearchBarFocused: $isSearchBarFocused"); + return isSearchBarFocused + ? Container() + : FloatingCard( + bottomPosition: 0.0, + leftPosition: 0.0, + rightPosition: 0.0, + width: 500, + borderRadius: BorderRadius.circular(12.0), + child: state == SearchingState.Searching + ? Center(child: CircularProgressIndicator()) + : Container( + margin: EdgeInsets.all(12), + child: Column( + children: [ + SecondaryButton( + color: Colors.grey[800], + textColor: Colors.white, + onTap: () async { + print(selectedPlace); + AddNewAddressRequestModel + addNewAddressRequestModel = + new AddNewAddressRequestModel( + customer: Customer(addresses: [ + Addresses( + address1: selectedPlace + .formattedAddress, + address2: selectedPlace + .formattedAddress, + customerAttributes: "", + city: "", + createdOnUtc: "", + id: 0, + latLong: + "$latitude,$longitude", + email: "") + ]), + ); - selectedPlace.addressComponents.forEach((e) { - if (e.types.contains("country")) { - addNewAddressRequestModel.customer - .addresses[0].country = e.longName; - } - if (e.types.contains("postal_code")) { - addNewAddressRequestModel.customer - .addresses[0].zipPostalCode = - e.longName; - } - if (e.types.contains("locality")) { - addNewAddressRequestModel.customer - .addresses[0].city = - e.longName; - } - }); + selectedPlace.addressComponents + .forEach((e) { + if (e.types.contains("country")) { + addNewAddressRequestModel + .customer + .addresses[0] + .country = e.longName; + } + if (e.types + .contains("postal_code")) { + addNewAddressRequestModel + .customer + .addresses[0] + .zipPostalCode = e.longName; + } + if (e.types.contains("locality")) { + addNewAddressRequestModel + .customer + .addresses[0] + .city = e.longName; + } + }); - await model.addAddressInfo( - addNewAddressRequestModel: addNewAddressRequestModel); - if (model.state == ViewState.ErrorLocal) { - Utils.showErrorToast(model.error); - } else { - AppToast.showSuccessToast( - message: "Address Added Successfully"); - } - Navigator.of(context).pop(); - }, - label: TranslationBase.of(context).addNewAddress, - ), - ], - ), - ), - ); - }, - initialPosition: LatLng(latitude, longitude), - useCurrentLocation: false, - ), - )); + await model.addAddressInfo( + addNewAddressRequestModel: + addNewAddressRequestModel); + if (model.state == + ViewState.ErrorLocal) { + Utils.showErrorToast(model.error); + } else { + AppToast.showSuccessToast( + message: + "Address Added Successfully"); + } + Navigator.of(context).pop(); + }, + label: TranslationBase.of(context) + .addNewAddress, + ), + ], + ), + ), + ); + }, + initialPosition: LatLng(latitude, longitude), + useCurrentLocation: false, + ), + )); } } diff --git a/lib/pages/AlHabibMedicalService/ComprehensiveMedicalCheckup/NewCMC/new_cmc_page.dart b/lib/pages/AlHabibMedicalService/ComprehensiveMedicalCheckup/NewCMC/new_cmc_page.dart index 2a7696b7..f314a9bf 100644 --- a/lib/pages/AlHabibMedicalService/ComprehensiveMedicalCheckup/NewCMC/new_cmc_page.dart +++ b/lib/pages/AlHabibMedicalService/ComprehensiveMedicalCheckup/NewCMC/new_cmc_page.dart @@ -26,12 +26,10 @@ class NewCMCPage extends StatefulWidget { final CMCViewModel model; @override - _NewCMCPageState createState() => - _NewCMCPageState(); + _NewCMCPageState createState() => _NewCMCPageState(); } -class _NewCMCPageState extends State - with TickerProviderStateMixin { +class _NewCMCPageState extends State with TickerProviderStateMixin { PageController _controller; int _currentIndex = 1; @@ -49,7 +47,8 @@ class _NewCMCPageState extends State price: widget.model.cmcAllServicesList[0].price, serviceID: widget.model.cmcAllServicesList[0].serviceID.toString(), selectedServiceName: widget.model.cmcAllServicesList[0].description, - selectedServiceNameAR: widget.model.cmcAllServicesList[0].descriptionN, + selectedServiceNameAR: + widget.model.cmcAllServicesList[0].descriptionN, recordID: 1, totalPrice: widget.model.cmcAllServicesList[0].totalPrice, vAT: widget.model.cmcAllServicesList[0].vAT); @@ -98,20 +97,24 @@ class _NewCMCPageState extends State model: model, onTap: () async { UpdatePresOrderRequestModel updatePresOrderRequestModel = - UpdatePresOrderRequestModel( - presOrderID: order.presOrderID, - rejectionReason: "", - presOrderStatus: 4, editedBy: 3); + UpdatePresOrderRequestModel( + presOrderID: order.presOrderID, + rejectionReason: "", + presOrderStatus: 4, + editedBy: 3); await model.updateCmcPresOrder(updatePresOrderRequestModel); if (model.state == ViewState.ErrorLocal) { Utils.showErrorToast(model.error); } else { - AppToast.showSuccessToast(message:TranslationBase.of(context).processDoneSuccessfully ); + AppToast.showSuccessToast( + message: + TranslationBase.of(context).processDoneSuccessfully); await model.getCmcAllPresOrders(); } }, )); } + return Scaffold( body: SafeArea( child: SingleChildScrollView( @@ -142,212 +145,255 @@ class _NewCMCPageState extends State children: [ widget.model.cmcAllOrderDetail.length != 0 ? FractionallySizedBox( - widthFactor: 0.9, - child: SingleChildScrollView( - child: Column( - children: [ - Container( - width: double.infinity, - margin: EdgeInsets.only(top: 15), - decoration: BoxDecoration( - border: - Border.all(color: Colors.grey, width: 1), - borderRadius: BorderRadius.circular(12), - color: Colors.white), + widthFactor: 0.9, + child: SingleChildScrollView( child: Column( - crossAxisAlignment: CrossAxisAlignment.start, children: [ - SizedBox( - height: 12, - ), Container( width: double.infinity, - padding: EdgeInsets.only( - left: 15, bottom: 15, top: 15,right: 15), + margin: EdgeInsets.only(top: 15), decoration: BoxDecoration( - border: Border( - bottom: BorderSide( - color: Colors.grey, - width: 1.0, - ), - ), - // borderRadius: BorderRadius.circular(12), - color: Colors.white), + border: Border.all( + color: Colors.grey, width: 1), + borderRadius: + BorderRadius.circular(12), + color: + Theme.of(context).primaryColor), child: Column( - crossAxisAlignment: CrossAxisAlignment.start, + crossAxisAlignment: + CrossAxisAlignment.start, children: [ - Texts( - TranslationBase - .of(context) - .requestID, - bold: false, - fontSize: 13, - ), SizedBox( - height: 4, + height: 12, ), - Texts( - widget.model.cmcAllOrderDetail[0].iD.toString(), - fontSize: 22, - ), - ], - ), - ), - Container( - width: double.infinity, - padding: EdgeInsets.only( - left: 15, bottom: 15, top: 15,right: 15), - decoration: BoxDecoration( - border: Border( - bottom: BorderSide( - color: Colors.grey, - width: 1.0, + Container( + width: double.infinity, + padding: EdgeInsets.only( + left: 15, + bottom: 15, + top: 15, + right: 15), + decoration: BoxDecoration( + border: Border( + bottom: BorderSide( + color: Colors.grey, + width: 1.0, + ), + ), + // borderRadius: BorderRadius.circular(12), + color: Theme.of(context) + .primaryColor), + child: Column( + crossAxisAlignment: + CrossAxisAlignment.start, + children: [ + Texts( + TranslationBase.of(context) + .requestID, + bold: false, + fontSize: 13, + ), + SizedBox( + height: 4, + ), + Texts( + widget.model + .cmcAllOrderDetail[0].iD + .toString(), + fontSize: 22, + ), + ], ), ), - // borderRadius: BorderRadius.circular(12), - color: Colors.white), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Texts( - TranslationBase - .of(context) - .OrderStatus, - bold: false, - fontSize: 13, - ), - SizedBox( - height: 4, - ), - Texts( - - projectViewModel.isArabic ? widget.model.cmcAllOrderDetail[0] - .descriptionN : widget.model.cmcAllOrderDetail[0].description, - fontSize: 22, + Container( + width: double.infinity, + padding: EdgeInsets.only( + left: 15, + bottom: 15, + top: 15, + right: 15), + decoration: BoxDecoration( + border: Border( + bottom: BorderSide( + color: Colors.grey, + width: 1.0, + ), + ), + // borderRadius: BorderRadius.circular(12), + color: Theme.of(context) + .primaryColor), + child: Column( + crossAxisAlignment: + CrossAxisAlignment.start, + children: [ + Texts( + TranslationBase.of(context) + .OrderStatus, + bold: false, + fontSize: 13, + ), + SizedBox( + height: 4, + ), + Texts( + projectViewModel.isArabic + ? widget + .model + .cmcAllOrderDetail[0] + .descriptionN + : widget + .model + .cmcAllOrderDetail[0] + .description, + fontSize: 22, + ), + ], + ), ), - ], - ), - ), - Container( - width: double.infinity, - padding: EdgeInsets.only( - left: 15, bottom: 15, top: 15,right: 15), - decoration: BoxDecoration( - border: Border( - bottom: BorderSide( - color: Colors.grey, - width: 1.0, + Container( + width: double.infinity, + padding: EdgeInsets.only( + left: 15, + bottom: 15, + top: 15, + right: 15), + decoration: BoxDecoration( + border: Border( + bottom: BorderSide( + color: Colors.grey, + width: 1.0, + ), + ), + // borderRadius: BorderRadius.circular(12), + color: Theme.of(context) + .primaryColor), + child: Column( + crossAxisAlignment: + CrossAxisAlignment.start, + children: [ + Texts( + TranslationBase.of(context) + .pickupDate, + bold: false, + fontSize: 13, + ), + SizedBox( + height: 4, + ), + Texts( + DateUtil.getDayMonthYearDateFormatted( + DateUtil.convertStringToDate( + widget + .model + .cmcAllOrderDetail[ + 0] + .createdOn)), + fontSize: 22, + ), + ], ), ), - // borderRadius: BorderRadius.circular(12), - color: Colors.white), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Texts( - TranslationBase.of(context).pickupDate, - bold: false, - fontSize: 13, + Container( + width: double.infinity, + padding: EdgeInsets.only( + left: 15, bottom: 15, top: 15), + decoration: BoxDecoration( + border: Border( + bottom: BorderSide( + color: Colors.grey, + width: 1.0, + ), + ), + // borderRadius: BorderRadius.circular(12), + color: Theme.of(context) + .primaryColor), + child: Column( + crossAxisAlignment: + CrossAxisAlignment.start, + children: [ + Texts( + TranslationBase.of(context) + .serviceName, + bold: false, + fontSize: 13, + ), + SizedBox( + height: 4, + ), + Texts( + !projectViewModel.isArabic + ? widget + .model + .cmcAllOrderDetail[0] + .description + .toString() + : widget + .model + .cmcAllOrderDetail[0] + .descriptionN + .toString(), + fontSize: 22, + ), + ], + ), ), SizedBox( - height: 4, + height: 12, ), - Texts( - DateUtil.getDayMonthYearDateFormatted( - DateUtil.convertStringToDate(widget.model.cmcAllOrderDetail[0].createdOn)), - fontSize: 22, - ), - ], - ), - ), - Container( - width: double.infinity, - padding: EdgeInsets.only( - left: 15, bottom: 15, top: 15), - decoration: BoxDecoration( - border: Border( - bottom: BorderSide( - color: Colors.grey, - width: 1.0, + Center( + child: Container( + width: MediaQuery.of(context) + .size + .width * + 0.85, + child: SecondaryButton( + label: TranslationBase.of( + context) + .cancel + .toUpperCase(), + onTap: () { + showConfirmMessage( + widget.model, + widget.model + .cmcAllOrderDetail[0]); + }, + color: Colors.red[800], + disabled: false, + textColor: Theme.of(context) + .backgroundColor), ), ), - // borderRadius: BorderRadius.circular(12), - color: Colors.white), - child: Column( - crossAxisAlignment: - CrossAxisAlignment.start, - children: [ - Texts( - TranslationBase.of(context).serviceName, - bold: false, - fontSize: 13, - ), SizedBox( - height: 4, - ), - Texts( - !projectViewModel.isArabic?widget.model.cmcAllOrderDetail[0].description - .toString() : - widget.model.cmcAllOrderDetail[0] - .descriptionN - .toString(), - fontSize: 22, + height: 22, ), ], ), ), - SizedBox( - height: 12, - ), - Center( - child: Container( - width: MediaQuery - .of(context) - .size - .width * - 0.85, - child: SecondaryButton( - label: TranslationBase.of(context).cancel.toUpperCase(), - onTap: () { - showConfirmMessage(widget.model, - widget.model.cmcAllOrderDetail[0]); - } - , - color: Colors.red[800], - disabled: false, - textColor: Theme - .of(context) - .backgroundColor), - ), - ), SizedBox( height: 22, ), ], ), ), - SizedBox( - height: 22, - ), - ], - ), - ), - ) + ) : NewCMCStepOnePage( - changePageViewIndex: changePageViewIndex, - cMCInsertPresOrderRequestModel: - cMCInsertPresOrderRequestModel, - model: widget.model, - ), + changePageViewIndex: changePageViewIndex, + cMCInsertPresOrderRequestModel: + cMCInsertPresOrderRequestModel, + model: widget.model, + ), NewCMCStepTowPage( longitude: _longitude, latitude: _latitude, changePageViewIndex: changePageViewIndex, - cmcInsertPresOrderRequestModel: cMCInsertPresOrderRequestModel, + cmcInsertPresOrderRequestModel: + cMCInsertPresOrderRequestModel, model: widget.model, - ), NewCMCStepThreePage( + ), + NewCMCStepThreePage( changePageViewIndex: changePageViewIndex, - cmcInsertPresOrderRequestModel: cMCInsertPresOrderRequestModel, + cmcInsertPresOrderRequestModel: + cMCInsertPresOrderRequestModel, model: widget.model, ), ], diff --git a/lib/pages/AlHabibMedicalService/ComprehensiveMedicalCheckup/NewCMC/new_cmc_step_one_page.dart b/lib/pages/AlHabibMedicalService/ComprehensiveMedicalCheckup/NewCMC/new_cmc_step_one_page.dart index b80d125a..c07b8345 100644 --- a/lib/pages/AlHabibMedicalService/ComprehensiveMedicalCheckup/NewCMC/new_cmc_step_one_page.dart +++ b/lib/pages/AlHabibMedicalService/ComprehensiveMedicalCheckup/NewCMC/new_cmc_step_one_page.dart @@ -62,14 +62,14 @@ class _NewCMCStepOnePageState extends State { ), Column( children: - widget.model.cmcAllServicesList.map((service) { + widget.model.cmcAllServicesList.map((service) { return Container( margin: EdgeInsets.only(top: 15), decoration: BoxDecoration( border: - Border.all(color: Colors.grey, width: 1), + Border.all(color: Colors.grey, width: 1), borderRadius: BorderRadius.circular(12), - color: Colors.white), + color: Theme.of(context).primaryColor), child: Column( children: [ Row( @@ -79,53 +79,52 @@ class _NewCMCStepOnePageState extends State { activeColor: Colors.red[800], onChanged: (newValue) async { PatientERCMCInsertServicesList - patientERCMCInsertServicesList = - new PatientERCMCInsertServicesList( - price: service.price, - serviceID: service.serviceID - .toString(), - selectedServiceName: - service.description, - selectedServiceNameAR: - service.descriptionN, - recordID: 1, - totalPrice: - service.totalPrice, - vAT: service.vAT); + patientERCMCInsertServicesList = + new PatientERCMCInsertServicesList( + price: service.price, + serviceID: service.serviceID + .toString(), + selectedServiceName: + service.description, + selectedServiceNameAR: + service.descriptionN, + recordID: 1, + totalPrice: + service.totalPrice, + vAT: service.vAT); setState(() { widget .cMCInsertPresOrderRequestModel - .patientERCMCInsertServicesList = - [ + .patientERCMCInsertServicesList = [ patientERCMCInsertServicesList ]; }); CMCGetItemsRequestModel - cMCGetItemsRequestModel = - new CMCGetItemsRequestModel( - checkupType: newValue); + cMCGetItemsRequestModel = + new CMCGetItemsRequestModel( + checkupType: newValue); await widget.model.getCheckupItems( cMCGetItemsRequestModel: - cMCGetItemsRequestModel); + cMCGetItemsRequestModel); }, groupValue: widget - .cMCInsertPresOrderRequestModel - .patientERCMCInsertServicesList - .length > - 0 + .cMCInsertPresOrderRequestModel + .patientERCMCInsertServicesList + .length > + 0 ? int.parse(widget - .cMCInsertPresOrderRequestModel - .patientERCMCInsertServicesList[ - 0] - .serviceID) + .cMCInsertPresOrderRequestModel + .patientERCMCInsertServicesList[ + 0] + .serviceID) : 1), Expanded( child: Padding( padding: const EdgeInsets.all(20.0), child: Texts( - projectViewModel.isArabic ? service - .descriptionN : service - .description, + projectViewModel.isArabic + ? service.descriptionN + : service.description, fontSize: 15, ), ), @@ -144,14 +143,18 @@ class _NewCMCStepOnePageState extends State { height: 30, ), Container( - color: Colors.white, + color: Theme.of(context).primaryColor, width: double.infinity, child: Column( children: [ Row( children: [ - Container(margin: EdgeInsets.only( - right: 10, left: 10), child: Texts(TranslationBase.of(context).coveredService, fontWeight: FontWeight.bold,)) + Container( + margin: EdgeInsets.only(right: 10, left: 10), + child: Texts( + TranslationBase.of(context).coveredService, + fontWeight: FontWeight.bold, + )) ], ), Column( @@ -163,10 +166,10 @@ class _NewCMCStepOnePageState extends State { child: Container( margin: EdgeInsets.only(top: 15), decoration: BoxDecoration( - color: Colors.white), + color: Theme.of(context).primaryColor), child: Column( - crossAxisAlignment: CrossAxisAlignment - .start, + crossAxisAlignment: + CrossAxisAlignment.start, children: [ SizedBox( height: 12, @@ -182,17 +185,18 @@ class _NewCMCStepOnePageState extends State { width: 0.5, color: Colors.grey)), //borderRadius: , - color: Colors.white), + color: + Theme.of(context).primaryColor), child: Column( crossAxisAlignment: - CrossAxisAlignment.start, + CrossAxisAlignment.start, children: [ - Container(margin: EdgeInsets.only( - right: 10, left: 10), - child: Texts( - item.itemName, - fontSize: 15, fontWeight: FontWeight.bold - ), + Container( + margin: EdgeInsets.only( + right: 10, left: 10), + child: Texts(item.itemName, + fontSize: 15, + fontWeight: FontWeight.bold), ), ], ), @@ -222,37 +226,34 @@ class _NewCMCStepOnePageState extends State { Container( width: MediaQuery.of(context).size.width * 0.9, child: SecondaryButton( - label: TranslationBase - .of(context) - .next, - textColor: Theme - .of(context) - .backgroundColor, + label: TranslationBase.of(context).next, + textColor: Theme.of(context).backgroundColor, color: Colors.grey[800], onTap: () async { if (widget.cMCInsertPresOrderRequestModel - .patientERCMCInsertServicesList.length != - 0 || + .patientERCMCInsertServicesList.length != + 0 || widget.cMCInsertPresOrderRequestModel - .patientERCMCInsertServicesList == + .patientERCMCInsertServicesList == null) { int index = widget.model.cmcAllServicesList.length; PatientERCMCInsertServicesList - patientERCMCInsertServicesList = - new PatientERCMCInsertServicesList( - price: widget - .model.cmcAllServicesList[index - 1].price, - serviceID: widget - .model.cmcAllServicesList[index - 1].serviceID - .toString(), - selectedServiceName: widget.model - .cmcAllServicesList[index - 1].description, - selectedServiceNameAR: widget.model - .cmcAllServicesList[index - 1].descriptionN, - recordID: 1, - totalPrice: widget - .model.cmcAllServicesList[index - 1].totalPrice, - vAT: widget.model.cmcAllServicesList[index - 1].vAT); + patientERCMCInsertServicesList = + new PatientERCMCInsertServicesList( + price: widget + .model.cmcAllServicesList[index - 1].price, + serviceID: widget + .model.cmcAllServicesList[index - 1].serviceID + .toString(), + selectedServiceName: widget.model + .cmcAllServicesList[index - 1].description, + selectedServiceNameAR: widget.model + .cmcAllServicesList[index - 1].descriptionN, + recordID: 1, + totalPrice: widget + .model.cmcAllServicesList[index - 1].totalPrice, + vAT: + widget.model.cmcAllServicesList[index - 1].vAT); widget.cMCInsertPresOrderRequestModel .patientERCMCInsertServicesList = [ diff --git a/lib/pages/AlHabibMedicalService/ComprehensiveMedicalCheckup/NewCMC/new_cmc_step_three_page.dart b/lib/pages/AlHabibMedicalService/ComprehensiveMedicalCheckup/NewCMC/new_cmc_step_three_page.dart index eea9853b..75699a5c 100644 --- a/lib/pages/AlHabibMedicalService/ComprehensiveMedicalCheckup/NewCMC/new_cmc_step_three_page.dart +++ b/lib/pages/AlHabibMedicalService/ComprehensiveMedicalCheckup/NewCMC/new_cmc_step_three_page.dart @@ -22,15 +22,13 @@ class NewCMCStepThreePage extends StatefulWidget { {Key key, this.changePageViewIndex, this.model, - this.cmcInsertPresOrderRequestModel}); + this.cmcInsertPresOrderRequestModel}); @override - _NewCMCStepThreePageState createState() => - _NewCMCStepThreePageState(); + _NewCMCStepThreePageState createState() => _NewCMCStepThreePageState(); } -class _NewCMCStepThreePageState - extends State { +class _NewCMCStepThreePageState extends State { Completer _controller = Completer(); static CameraPosition _kGooglePlex = CameraPosition( @@ -49,8 +47,7 @@ class _NewCMCStepThreePageState widget.cmcInsertPresOrderRequestModel.latitude.hashCode .toString(), ), - position: LatLng( - widget.cmcInsertPresOrderRequestModel.latitude, + position: LatLng(widget.cmcInsertPresOrderRequestModel.latitude, widget.cmcInsertPresOrderRequestModel.longitude)), ); _kGooglePlex = CameraPosition( @@ -86,15 +83,16 @@ class _NewCMCStepThreePageState ), Container( decoration: BoxDecoration( - color: Colors.white, + color: Theme.of(context).primaryColor, borderRadius: BorderRadius.circular(12)), padding: EdgeInsets.all(8), child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ - Texts(TranslationBase - .of(context) - .orderLocation + " : ", fontWeight: FontWeight.bold,), + Texts( + TranslationBase.of(context).orderLocation + " : ", + fontWeight: FontWeight.bold, + ), SizedBox( height: 12, ), @@ -115,40 +113,38 @@ class _NewCMCStepThreePageState SizedBox( height: 12, ), - Texts(TranslationBase - .of(context) - .selectedService), + Texts(TranslationBase.of(context).selectedService), ...List.generate( widget.cmcInsertPresOrderRequestModel .patientERCMCInsertServicesList.length, - (index) => - Container( - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Texts( - TranslationBase - .of(context) - .serviceName, - fontSize: 12, fontWeight: FontWeight.bold, - ), - SizedBox( - height: 5, - ), - Texts( - projectViewModel.isArabic ? widget + (index) => Container( + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Texts( + TranslationBase.of(context).serviceName, + fontSize: 12, + fontWeight: FontWeight.bold, + ), + SizedBox( + height: 5, + ), + Texts( + projectViewModel.isArabic + ? widget .cmcInsertPresOrderRequestModel .patientERCMCInsertServicesList[index] - .selectedServiceNameAR : widget + .selectedServiceNameAR + : widget .cmcInsertPresOrderRequestModel .patientERCMCInsertServicesList[index] .selectedServiceName, - fontSize: 15, - bold: true, - ), - ], + fontSize: 15, + bold: true, ), - ), + ], + ), + ), ) ], ), @@ -165,9 +161,7 @@ class _NewCMCStepThreePageState Container( width: MediaQuery.of(context).size.width * 0.9, child: SecondaryButton( - label: TranslationBase - .of(context) - .confirm, + label: TranslationBase.of(context).confirm, color: Colors.grey[800], onTap: () async { await widget.model.insertPresPresOrder( @@ -176,9 +170,7 @@ class _NewCMCStepThreePageState widget.changePageViewIndex(0); } }, - textColor: Theme - .of(context) - .backgroundColor), + textColor: Theme.of(context).backgroundColor), ), ], ), diff --git a/lib/pages/AlHabibMedicalService/ComprehensiveMedicalCheckup/NewCMC/new_cmc_step_tow_page.dart b/lib/pages/AlHabibMedicalService/ComprehensiveMedicalCheckup/NewCMC/new_cmc_step_tow_page.dart index d9d4c56a..3d969d9e 100644 --- a/lib/pages/AlHabibMedicalService/ComprehensiveMedicalCheckup/NewCMC/new_cmc_step_tow_page.dart +++ b/lib/pages/AlHabibMedicalService/ComprehensiveMedicalCheckup/NewCMC/new_cmc_step_tow_page.dart @@ -37,17 +37,14 @@ class NewCMCStepTowPage extends StatefulWidget { : super(key: key); @override - _NewCMCStepTowPageState createState() => - _NewCMCStepTowPageState(); + _NewCMCStepTowPageState createState() => _NewCMCStepTowPageState(); } -class _NewCMCStepTowPageState - extends State { +class _NewCMCStepTowPageState extends State { double latitude = 0; double longitude = 0; AddressInfo _selectedAddress; - @override void initState() { if (widget.cmcInsertPresOrderRequestModel.latitude == null) { @@ -61,17 +58,18 @@ class _NewCMCStepTowPageState setLatitudeAndLongitude({bool isSetState = false, String latLong}) { if (latLong == null) - latLong = widget.model.addressesList[widget.model.addressesList - .length - 1].latLong; + latLong = widget + .model.addressesList[widget.model.addressesList.length - 1].latLong; List latLongArr = latLong.split(','); latitude = double.parse(latLongArr[0]); longitude = double.parse(latLongArr[1]); } + @override Widget build(BuildContext context) { ProjectViewModel projectViewModel = Provider.of(context); - return AppScaffold( + return AppScaffold( isShowDecPage: false, body: Stack( children: [ @@ -84,7 +82,6 @@ class _NewCMCStepTowPageState autocompleteLanguage: projectViewModel.currentLanguage, enableMapTypeButton: true, searchForInitialValue: false, - onPlacePicked: (PickResult result) { print(result.adrAddress); widget.changePageViewIndex(3); @@ -95,57 +92,56 @@ class _NewCMCStepTowPageState return isSearchBarFocused ? Container() : FloatingCard( - bottomPosition: 0.0, - leftPosition: 0.0, - rightPosition: 0.0, - width: 500, - borderRadius: BorderRadius.circular(12.0), - child: state == SearchingState.Searching - ? Center(child: CircularProgressIndicator()) - : Container( - margin: EdgeInsets.all(12), - child: Column( - children: [ - SecondaryButton( - color: Colors.grey[800], - textColor: Colors.white, - onTap: () { - Navigator.push( - context, - FadePage( - page: - CMCLocationPage( - latitude: latitude, - longitude: longitude, - - ), - ), - ); - }, - label: TranslationBase.of(context).addNewAddress, - ), - SizedBox(height: 10,), - SecondaryButton( - color: Colors.red - [800], - textColor: Colors.white, - onTap: () { - setState(() { - widget.cmcInsertPresOrderRequestModel - .latitude = - selectedPlace.geometry.location.lat; - widget.cmcInsertPresOrderRequestModel - .longitude = - selectedPlace.geometry.location.lng; - }); - widget.changePageViewIndex(3); - }, - label: TranslationBase.of(context).confirm, - ), - ], - ) - ), - ); + bottomPosition: 0.0, + leftPosition: 0.0, + rightPosition: 0.0, + width: 500, + borderRadius: BorderRadius.circular(12.0), + child: state == SearchingState.Searching + ? Center(child: CircularProgressIndicator()) + : Container( + margin: EdgeInsets.all(12), + child: Column( + children: [ + SecondaryButton( + color: Colors.grey[800], + textColor: Colors.white, + onTap: () { + Navigator.push( + context, + FadePage( + page: CMCLocationPage( + latitude: latitude, + longitude: longitude, + ), + ), + ); + }, + label: TranslationBase.of(context) + .addNewAddress, + ), + SizedBox( + height: 10, + ), + SecondaryButton( + color: Colors.red[800], + textColor: Colors.white, + onTap: () { + setState(() { + widget.cmcInsertPresOrderRequestModel + .latitude = + selectedPlace.geometry.location.lat; + widget.cmcInsertPresOrderRequestModel + .longitude = + selectedPlace.geometry.location.lng; + }); + widget.changePageViewIndex(3); + }, + label: TranslationBase.of(context).confirm, + ), + ], + )), + ); }, initialPosition: LatLng(latitude, longitude), useCurrentLocation: false, @@ -160,37 +156,36 @@ class _NewCMCStepTowPageState // height: 65, decoration: BoxDecoration( borderRadius: BorderRadius.circular(10), - color: Colors.white), + color: Theme.of(context).primaryColor), child: Row( - mainAxisAlignment: - MainAxisAlignment.spaceBetween, + mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ - Expanded(child: Texts(getAddressName(), fontSize: 14,),), + Expanded( + child: Texts( + getAddressName(), + fontSize: 14, + ), + ), Icon(Icons.arrow_drop_down) ], ), ), ), - height: 56, width: double.infinity, color: Theme - .of(context) - .scaffoldBackgroundColor, - + height: 56, + width: double.infinity, + color: Theme.of(context).scaffoldBackgroundColor, ) ], ), ); - - } - void confirmSelectLocationDialog(List addresses) { showDialog( context: context, child: SelectLocationDialog( addresses: addresses, - selectedAddress: _selectedAddress - , + selectedAddress: _selectedAddress, onValueSelected: (value) { setLatitudeAndLongitude(latLong: value.latLong); setState(() { diff --git a/lib/pages/AlHabibMedicalService/ComprehensiveMedicalCheckup/cmc_page.dart b/lib/pages/AlHabibMedicalService/ComprehensiveMedicalCheckup/cmc_page.dart index 4f6213d5..f1d3e72f 100644 --- a/lib/pages/AlHabibMedicalService/ComprehensiveMedicalCheckup/cmc_page.dart +++ b/lib/pages/AlHabibMedicalService/ComprehensiveMedicalCheckup/cmc_page.dart @@ -17,8 +17,7 @@ class CMCPage extends StatefulWidget { _CMCPageState createState() => _CMCPageState(); } -class _CMCPageState extends State - with SingleTickerProviderStateMixin { +class _CMCPageState extends State with SingleTickerProviderStateMixin { TabController _tabController; @override @@ -36,14 +35,18 @@ class _CMCPageState extends State @override Widget build(BuildContext context) { return BaseView( - onModelReady: (model) async{ - await model.getCmcAllPresOrders(); - + onModelReady: (model) async { + await model.getCmcAllPresOrders(); }, builder: (_, model, widget) => AppScaffold( isShowAppBar: true, - description:TranslationBase.of(context).infoCMC, - imagesInfo: [ImagesInfo(imageAr: 'assets/images/Wifi-AR.png',imageEn: 'assets/images/wifi-EN.png', isAsset: true)], + description: TranslationBase.of(context).infoCMC, + imagesInfo: [ + ImagesInfo( + imageAr: 'assets/images/Wifi-AR.png', + imageEn: 'assets/images/wifi-EN.png', + isAsset: true) + ], appBarTitle: TranslationBase.of(context).comprehensiveMedicalCheckup, body: Scaffold( extendBodyBehindAppBar: true, @@ -58,9 +61,7 @@ class _CMCPageState extends State child: BackdropFilter( filter: ImageFilter.blur(sigmaX: 10, sigmaY: 10), child: Container( - color: Theme.of(context) - .scaffoldBackgroundColor - .withOpacity(0.8), + color: Theme.of(context).primaryColor.withOpacity(0.8), height: 70.0, ), ), @@ -76,7 +77,7 @@ class _CMCPageState extends State color: Theme.of(context).dividerColor, width: 0.7), ), - color: Colors.white), + color: Theme.of(context).primaryColor), child: Center( child: TabBar( isScrollable: true, @@ -86,7 +87,7 @@ class _CMCPageState extends State indicatorColor: Colors.red[800], labelColor: Theme.of(context).primaryColor, labelPadding: - EdgeInsets.only(top: 4.0, left: 18.0, right: 18.0), + EdgeInsets.only(top: 4.0, left: 18.0, right: 18.0), unselectedLabelColor: Colors.grey[800], tabs: [ Container( @@ -99,7 +100,8 @@ class _CMCPageState extends State Container( width: MediaQuery.of(context).size.width * 0.37, child: Center( - child: Texts(TranslationBase.of(context).orderLog), + child: + Texts(TranslationBase.of(context).orderLog), ), ), ], diff --git a/lib/pages/AlHabibMedicalService/HomeHealthCare/NewHomeHealthCare/new_Home_health_care_step_one_page.dart b/lib/pages/AlHabibMedicalService/HomeHealthCare/NewHomeHealthCare/new_Home_health_care_step_one_page.dart index 447ba177..86ee791b 100644 --- a/lib/pages/AlHabibMedicalService/HomeHealthCare/NewHomeHealthCare/new_Home_health_care_step_one_page.dart +++ b/lib/pages/AlHabibMedicalService/HomeHealthCare/NewHomeHealthCare/new_Home_health_care_step_one_page.dart @@ -31,19 +31,20 @@ class NewHomeHealthCareStepOnePage extends StatefulWidget { _NewHomeHealthCareStepOnePageState(); } -class _NewHomeHealthCareStepOnePageState extends State { - +class _NewHomeHealthCareStepOnePageState + extends State { PickResult _result; - @override void initState() { - if (widget.patientERInsertPresOrderRequestModel.patientERHHCInsertServicesList == null) - widget.patientERInsertPresOrderRequestModel.patientERHHCInsertServicesList = []; + if (widget.patientERInsertPresOrderRequestModel + .patientERHHCInsertServicesList == + null) + widget.patientERInsertPresOrderRequestModel + .patientERHHCInsertServicesList = []; super.initState(); } - @override Widget build(BuildContext context) { ProjectViewModel projectViewModel = Provider.of(context); @@ -67,9 +68,7 @@ class _NewHomeHealthCareStepOnePageState extends State _getCurrentLocation(); } - _getCurrentLocation() async { - await getLastKnownPosition().then((value) { - _latitude = value.latitude; - _longitude = value.longitude; - }).catchError((e) { - _longitude = 0; - _latitude = 0; - }); - } + _getCurrentLocation() async { + await getLastKnownPosition().then((value) { + _latitude = value.latitude; + _longitude = value.longitude; + }).catchError((e) { + _longitude = 0; + _latitude = 0; + }); + } @override void dispose() { @@ -87,7 +87,9 @@ class _NewHomeHealthCarePageState extends State if (model.state == ViewState.ErrorLocal) { Utils.showErrorToast(model.error); } else { - AppToast.showSuccessToast(message:TranslationBase.of(context).processDoneSuccessfully ); + AppToast.showSuccessToast( + message: + TranslationBase.of(context).processDoneSuccessfully); await model.getHHCAllPresOrders(); // await model.getHHCAllServices(); } @@ -105,7 +107,9 @@ class _NewHomeHealthCarePageState extends State child: Column( children: [ Container( - margin: EdgeInsets.only(left: MediaQuery.of(context).size.width*0.05, right: MediaQuery.of(context).size.width*0.05), + margin: EdgeInsets.only( + left: MediaQuery.of(context).size.width * 0.05, + right: MediaQuery.of(context).size.width * 0.05), child: StepsWidget( index: _currentIndex, changeCurrentTab: _changeCurrentTab, @@ -130,11 +134,13 @@ class _NewHomeHealthCarePageState extends State width: double.infinity, margin: EdgeInsets.only(top: 15), decoration: BoxDecoration( - border: Border.all(color: Colors.grey, width: 1), + border: Border.all( + color: Colors.grey, width: 1), borderRadius: BorderRadius.circular(12), - color: Colors.white), + color: Theme.of(context).primaryColor), child: Column( - crossAxisAlignment: CrossAxisAlignment.start, + crossAxisAlignment: + CrossAxisAlignment.start, children: [ SizedBox( height: 12, @@ -142,7 +148,10 @@ class _NewHomeHealthCarePageState extends State Container( width: double.infinity, padding: EdgeInsets.only( - left: 15, bottom: 15, top: 15,right: 15), + left: 15, + bottom: 15, + top: 15, + right: 15), decoration: BoxDecoration( border: Border( bottom: BorderSide( @@ -151,13 +160,14 @@ class _NewHomeHealthCarePageState extends State ), ), // borderRadius: BorderRadius.circular(12), - color: Colors.white), + color: + Theme.of(context).primaryColor), child: Column( - crossAxisAlignment: CrossAxisAlignment.start, + crossAxisAlignment: + CrossAxisAlignment.start, children: [ Texts( - TranslationBase - .of(context) + TranslationBase.of(context) .requestID, bold: false, fontSize: 13, @@ -166,7 +176,8 @@ class _NewHomeHealthCarePageState extends State height: 4, ), Texts( - widget.model.pendingOrder.iD.toString(), + widget.model.pendingOrder.iD + .toString(), fontSize: 22, ), ], @@ -175,7 +186,10 @@ class _NewHomeHealthCarePageState extends State Container( width: double.infinity, padding: EdgeInsets.only( - left: 15, bottom: 15, top: 15,right: 15), + left: 15, + bottom: 15, + top: 15, + right: 15), decoration: BoxDecoration( border: Border( bottom: BorderSide( @@ -184,13 +198,14 @@ class _NewHomeHealthCarePageState extends State ), ), // borderRadius: BorderRadius.circular(12), - color: Colors.white), + color: + Theme.of(context).primaryColor), child: Column( - crossAxisAlignment: CrossAxisAlignment.start, + crossAxisAlignment: + CrossAxisAlignment.start, children: [ Texts( - TranslationBase - .of(context) + TranslationBase.of(context) .OrderStatus, bold: false, fontSize: 13, @@ -199,11 +214,11 @@ class _NewHomeHealthCarePageState extends State height: 4, ), Texts( - - projectViewModel.isArabic ? widget - .model.pendingOrder - .descriptionN : widget.model - .pendingOrder.description, + projectViewModel.isArabic + ? widget.model.pendingOrder + .descriptionN + : widget.model.pendingOrder + .description, fontSize: 22, ), ], @@ -212,7 +227,10 @@ class _NewHomeHealthCarePageState extends State Container( width: double.infinity, padding: EdgeInsets.only( - left: 15, bottom: 15, top: 15,right: 15), + left: 15, + bottom: 15, + top: 15, + right: 15), decoration: BoxDecoration( border: Border( bottom: BorderSide( @@ -221,12 +239,15 @@ class _NewHomeHealthCarePageState extends State ), ), // borderRadius: BorderRadius.circular(12), - color: Colors.white), + color: + Theme.of(context).primaryColor), child: Column( - crossAxisAlignment: CrossAxisAlignment.start, + crossAxisAlignment: + CrossAxisAlignment.start, children: [ Texts( - TranslationBase.of(context).pickupDate, + TranslationBase.of(context) + .pickupDate, bold: false, fontSize: 13, ), @@ -234,9 +255,14 @@ class _NewHomeHealthCarePageState extends State height: 4, ), Texts( - DateUtil.getDayMonthYearDateFormatted( - DateUtil.convertStringToDate(widget - .model.pendingOrder.createdOn)), + DateUtil + .getDayMonthYearDateFormatted( + DateUtil + .convertStringToDate( + widget + .model + .pendingOrder + .createdOn)), fontSize: 22, ), ], @@ -247,7 +273,10 @@ class _NewHomeHealthCarePageState extends State (index) => Container( width: double.infinity, padding: EdgeInsets.only( - left: 15, bottom: 15, top: 15,right: 15), + left: 15, + bottom: 15, + top: 15, + right: 15), decoration: BoxDecoration( border: Border( bottom: BorderSide( @@ -256,14 +285,14 @@ class _NewHomeHealthCarePageState extends State ), ), // borderRadius: BorderRadius.circular(12), - color: Colors.white), + color: Theme.of(context) + .primaryColor), child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ Texts( - TranslationBase - .of(context) + TranslationBase.of(context) .serviceName, bold: false, fontSize: 13, @@ -273,12 +302,16 @@ class _NewHomeHealthCarePageState extends State ), Texts( projectViewModel.isArabic - ? widget.model - .hhcAllOrderDetail[index] - .descriptionN - : widget.model - .hhcAllOrderDetail[index] - .description, + ? widget + .model + .hhcAllOrderDetail[ + index] + .descriptionN + : widget + .model + .hhcAllOrderDetail[ + index] + .description, fontSize: 22, bold: true, ), @@ -291,18 +324,24 @@ class _NewHomeHealthCarePageState extends State ), Center( child: Container( - width: - MediaQuery.of(context).size.width * 0.85, + width: MediaQuery.of(context) + .size + .width * + 0.85, child: SecondaryButton( - label: TranslationBase.of(context).cancel.toUpperCase(), + label: TranslationBase.of(context) + .cancel + .toUpperCase(), onTap: () { - showConfirmMessage(widget.model, - widget.model.hhcAllOrderDetail[0]); + showConfirmMessage( + widget.model, + widget.model + .hhcAllOrderDetail[0]); }, color: Colors.red[800], disabled: false, - textColor: - Theme.of(context).backgroundColor), + textColor: Theme.of(context) + .backgroundColor), ), ), SizedBox( @@ -315,22 +354,24 @@ class _NewHomeHealthCarePageState extends State ) : NewHomeHealthCareStepOnePage( changePageViewIndex: _changeCurrentTab, - patientERInsertPresOrderRequestModel: patientERInsertPresOrderRequestModel, + patientERInsertPresOrderRequestModel: + patientERInsertPresOrderRequestModel, model: widget.model, ), NewHomeHealthCareStepTowPage( latitude: _latitude, longitude: _longitude, changePageViewIndex: _changeCurrentTab, - patientERInsertPresOrderRequestModel: patientERInsertPresOrderRequestModel, + patientERInsertPresOrderRequestModel: + patientERInsertPresOrderRequestModel, model: widget.model, ), NewHomeHealthCareStepThreePage( changePageViewIndex: _changeCurrentTab, - patientERInsertPresOrderRequestModel: patientERInsertPresOrderRequestModel, + patientERInsertPresOrderRequestModel: + patientERInsertPresOrderRequestModel, model: widget.model, ) - ], ), ), diff --git a/lib/pages/AlHabibMedicalService/HomeHealthCare/home_health_care_page.dart b/lib/pages/AlHabibMedicalService/HomeHealthCare/home_health_care_page.dart index 1c10e594..b39c918f 100644 --- a/lib/pages/AlHabibMedicalService/HomeHealthCare/home_health_care_page.dart +++ b/lib/pages/AlHabibMedicalService/HomeHealthCare/home_health_care_page.dart @@ -37,15 +37,19 @@ class _HomeHealthCarePageState extends State @override Widget build(BuildContext context) { return BaseView( - onModelReady: (model){ + onModelReady: (model) { model.getHHCAllPresOrders(); }, builder: (_, model, widget) => AppScaffold( isShowAppBar: true, description: TranslationBase.of(context).HHCNotAuthMsg, appBarTitle: TranslationBase.of(context).homeHealthCare, - imagesInfo: [ImagesInfo(imageAr: 'assets/images/Wifi-AR.png',imageEn: 'assets/images/wifi-EN.png', isAsset: true)], - + imagesInfo: [ + ImagesInfo( + imageAr: 'assets/images/Wifi-AR.png', + imageEn: 'assets/images/wifi-EN.png', + isAsset: true) + ], body: Scaffold( extendBodyBehindAppBar: true, appBar: PreferredSize( @@ -77,7 +81,7 @@ class _HomeHealthCarePageState extends State color: Theme.of(context).dividerColor, width: 0.7), ), - color: Colors.white), + color: Theme.of(context).primaryColor), child: Center( child: TabBar( isScrollable: true, @@ -87,19 +91,25 @@ class _HomeHealthCarePageState extends State indicatorColor: Colors.red[800], labelColor: Theme.of(context).primaryColor, labelPadding: - EdgeInsets.only(top: 4.0, left: 18.0, right: 18.0), + EdgeInsets.only(top: 4.0, left: 18.0, right: 18.0), unselectedLabelColor: Colors.grey[800], tabs: [ Container( width: MediaQuery.of(context).size.width * 0.37, child: Center( - child: Texts(TranslationBase.of(context).homeHealthCare), + child: Texts( + TranslationBase.of(context).homeHealthCare, + color: Colors.black, + ), ), ), Container( width: MediaQuery.of(context).size.width * 0.37, child: Center( - child: Texts(TranslationBase.of(context).orderLog), + child: Texts( + TranslationBase.of(context).orderLog, + color: Colors.black, + ), ), ), ], diff --git a/lib/pages/AlHabibMedicalService/all_habib_medical_service_page.dart b/lib/pages/AlHabibMedicalService/all_habib_medical_service_page.dart index d81fe78f..fe8f73f6 100644 --- a/lib/pages/AlHabibMedicalService/all_habib_medical_service_page.dart +++ b/lib/pages/AlHabibMedicalService/all_habib_medical_service_page.dart @@ -58,8 +58,12 @@ class _AllHabibMedicalServiceState extends State { @override void initState() { WidgetsBinding.instance.addPostFrameCallback((timeStamp) { - locationUtils = new LocationUtils(isShowConfirmDialog: true, context: context); - WidgetsBinding.instance.addPostFrameCallback((_) => {Geolocator.getLastKnownPosition().then((value) => setLocation(value))}); + locationUtils = + new LocationUtils(isShowConfirmDialog: true, context: context); + WidgetsBinding.instance.addPostFrameCallback((_) => { + Geolocator.getLastKnownPosition() + .then((value) => setLocation(value)) + }); }); super.initState(); } @@ -98,12 +102,14 @@ class _AllHabibMedicalServiceState extends State { crossAxisAlignment: CrossAxisAlignment.start, children: [ Texts( - TranslationBase.of(context).healthWeatherIndicators, + TranslationBase.of(context) + .healthWeatherIndicators, color: Colors.white, fontWeight: FontWeight.w600, ), Texts( - TranslationBase.of(context).healthTipsBasedOnCurrentWeather, + TranslationBase.of(context) + .healthTipsBasedOnCurrentWeather, color: Colors.white, fontSize: 14, ), @@ -131,7 +137,11 @@ class _AllHabibMedicalServiceState extends State { width: 60, height: 60, ), - Directionality(textDirection: TextDirection.ltr, child: AppText(weather, fontSize: 22, color: Colors.white)) + Directionality( + textDirection: TextDirection.ltr, + child: AppText(weather, + fontSize: 22, + color: Colors.white)) ], ), Texts( @@ -151,7 +161,8 @@ class _AllHabibMedicalServiceState extends State { Navigator.pop(context); widget.goToMyProfile(); }, - imageLocation: 'assets/images/new-design/my_file_bottom_bar.png', + imageLocation: + 'assets/images/new-design/my_file_bottom_bar.png', title: TranslationBase.of(context).myMedicalFile, ), ServicesContainer( @@ -173,7 +184,8 @@ class _AllHabibMedicalServiceState extends State { ), ), ), - imageLocation: 'assets/images/new-design/booking_icon_active.png', + imageLocation: + 'assets/images/new-design/booking_icon_active.png', title: TranslationBase.of(context).bookAppo, ), ServicesContainer( @@ -183,15 +195,28 @@ class _AllHabibMedicalServiceState extends State { page: PaymentService(), ), ), - imageLocation: 'assets/images/al-habib_online_payment_service_icon.png', + imageLocation: + 'assets/images/al-habib_online_payment_service_icon.png', title: TranslationBase.of(context).onlinePaymentService, ), + ServicesContainer( + onTap: () => Navigator.push( + context, + FadePage( + page: PaymentService(), + ), + ), + imageLocation: + 'assets/images/comprehensive_medical_checkup_logo.png', + title: TranslationBase.of(context).anicllaryOrders, + ), ServicesContainer( onTap: () => Navigator.push( context, FadePage(), ), - imageLocation: 'assets/images/al-habib_online_payment_service_icon.png', + imageLocation: + 'assets/images/al-habib_online_payment_service_icon.png', title: TranslationBase.of(context).covid19_driveThrueTest, ), ServicesContainer( @@ -224,13 +249,17 @@ class _AllHabibMedicalServiceState extends State { page: InsuranceUpdate(), ), ), - imageLocation: 'assets/images/medical/insurance_card_icon.png', + imageLocation: + 'assets/images/medical/insurance_card_icon.png', title: TranslationBase.of(context).updateInsurance, ), ServicesContainer( onTap: () => Navigator.push( context, - FadePage(page: authUser.patientID == null ? EReferralIndexPage() : EReferralPage()), + FadePage( + page: authUser.patientID == null + ? EReferralIndexPage() + : EReferralPage()), ), imageLocation: 'assets/images/ereferral_service_icon.png', title: TranslationBase.of(context).ereferral, @@ -242,7 +271,8 @@ class _AllHabibMedicalServiceState extends State { page: MyFamily(), ), ), - imageLocation: 'assets/images/new-design/family_menu_icon_red.png', + imageLocation: + 'assets/images/new-design/family_menu_icon_red.png', title: TranslationBase.of(context).myFamily, ), if (projectViewModel.havePrivilege(35)) @@ -251,7 +281,8 @@ class _AllHabibMedicalServiceState extends State { context, FadePage(page: ChildVaccinesPage()), ), - imageLocation: 'assets/images/new-design/children_vaccines_icon.png', + imageLocation: + 'assets/images/new-design/children_vaccines_icon.png', title: TranslationBase.of(context).childVaccine, ), ServicesContainer( @@ -261,7 +292,8 @@ class _AllHabibMedicalServiceState extends State { page: ToDo(isShowAppBar: true), ), ), - imageLocation: 'assets/images/new-design/upcoming_icon_bottom_bar.png', + imageLocation: + 'assets/images/new-design/upcoming_icon_bottom_bar.png', title: TranslationBase.of(context).todoList, ), if (projectViewModel.havePrivilege(42)) @@ -288,7 +320,8 @@ class _AllHabibMedicalServiceState extends State { page: (HealthCalculators()), ), ), - imageLocation: 'assets/images/new-design/health_calculator_icon.png', + imageLocation: + 'assets/images/new-design/health_calculator_icon.png', title: TranslationBase.of(context).calculators, ), ServicesContainer( @@ -298,12 +331,14 @@ class _AllHabibMedicalServiceState extends State { page: HealthConverter(), ), ), - imageLocation: 'assets/images/new-design/health_convertor_icon.png', + imageLocation: + 'assets/images/new-design/health_convertor_icon.png', title: TranslationBase.of(context).converters, ), if (projectViewModel.havePrivilege(38)) ServicesContainer( - onTap: () => Navigator.push(context, FadePage(page: H2OPage())), + onTap: () => + Navigator.push(context, FadePage(page: H2OPage())), // Navigator.push( // context, // FadePage( @@ -319,7 +354,8 @@ class _AllHabibMedicalServiceState extends State { context, FadePage(), ), - imageLocation: 'assets/images/new-design/smartwatch_icon.png', + imageLocation: + 'assets/images/new-design/smartwatch_icon.png', title: TranslationBase.of(context).smartWatches, ), ServicesContainer( @@ -329,12 +365,15 @@ class _AllHabibMedicalServiceState extends State { page: ParkingPage(), ), ), - imageLocation: 'assets/images/new-design/parking_system_icon.png', + imageLocation: + 'assets/images/new-design/parking_system_icon.png', title: TranslationBase.of(context).parking, ), ServicesContainer( - onTap: () => launch("https://hmgwebservices.com/vt_mobile/html/index.html"), - imageLocation: 'assets/images/new-design/virtual_tour_icon.png', + onTap: () => launch( + "https://hmgwebservices.com/vt_mobile/html/index.html"), + imageLocation: + 'assets/images/new-design/virtual_tour_icon.png', title: TranslationBase.of(context).vTour, ), ServicesContainer( @@ -342,10 +381,12 @@ class _AllHabibMedicalServiceState extends State { Navigator.of(context).push(MaterialPageRoute( builder: (BuildContext context) => MyWebView( title: "HMG News", - selectedUrl: "https://twitter.com/hashtag/مجموعة_د_سليمان_الحبيب_الطبية?src=hashtag_click&f=live", + selectedUrl: + "https://twitter.com/hashtag/مجموعة_د_سليمان_الحبيب_الطبية?src=hashtag_click&f=live", ))); }, - imageLocation: 'assets/images/new-design/twitter_dashboard_icon.png', + imageLocation: + 'assets/images/new-design/twitter_dashboard_icon.png', title: TranslationBase.of(context).latestNews, ), ServicesContainer( @@ -368,7 +409,8 @@ class _AllHabibMedicalServiceState extends State { getAuthUser() async { if (await this.sharedPref.getObject(USER_PROFILE) != null) { - var data = AuthenticatedUser.fromJson(await this.sharedPref.getObject(USER_PROFILE)); + var data = AuthenticatedUser.fromJson( + await this.sharedPref.getObject(USER_PROFILE)); setState(() { authUser = data; }); @@ -382,7 +424,8 @@ class _AllHabibMedicalServiceState extends State { }); } else { setState(() { - weather = data != null ? data['Temperature'].toString() + '\u2103' : '--'; + weather = + data != null ? data['Temperature'].toString() + '\u2103' : '--'; }); } } diff --git a/lib/pages/AlHabibMedicalService/ancillary-orders/ancillaryOrders.dart b/lib/pages/AlHabibMedicalService/ancillary-orders/ancillaryOrders.dart new file mode 100644 index 00000000..57b134bf --- /dev/null +++ b/lib/pages/AlHabibMedicalService/ancillary-orders/ancillaryOrders.dart @@ -0,0 +1,43 @@ +import 'package:diplomaticquarterapp/core/viewModels/ancillary_orders_view_model.dart'; +import 'package:diplomaticquarterapp/pages/AlHabibMedicalService/health_calculator/body_fat/body_fat.dart'; +import 'package:diplomaticquarterapp/pages/AlHabibMedicalService/health_calculator/bmi_calculator/bmi_calculator.dart'; +import 'package:diplomaticquarterapp/pages/AlHabibMedicalService/health_calculator/calorie_calculator/calorie_calculator.dart'; +import 'package:diplomaticquarterapp/pages/AlHabibMedicalService/health_calculator/carbs/carbs.dart'; +import 'package:diplomaticquarterapp/pages/AlHabibMedicalService/health_calculator/ovulation_period/ovulation_period.dart'; +import 'package:diplomaticquarterapp/pages/base/base_view.dart'; +import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; +import 'package:diplomaticquarterapp/widgets/data_display/medical/medical_profile_item.dart'; +import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; +import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart'; +import 'package:flutter/material.dart'; +import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; + +class AnicllaryOrders extends StatefulWidget { + @override + _AnicllaryOrdersState createState() => _AnicllaryOrdersState(); +} + +class _AnicllaryOrdersState extends State + with SingleTickerProviderStateMixin { + TabController _tabController; + void initState() { + super.initState(); + _tabController = TabController(length: 2, vsync: this); + } + + void dispose() { + super.dispose(); + _tabController.dispose(); + } + + @override + Widget build(BuildContext context) { + return BaseView( + onModelReady: (model) => model.getOrders(), + builder: (_, model, widget) => AppScaffold( + isShowAppBar: true, + appBarTitle: TranslationBase.of(context).parking, + body: SingleChildScrollView( + padding: EdgeInsets.all(12), child: Container()))); + } +} diff --git a/lib/pages/AlHabibMedicalService/​ health_calculators.dart b/lib/pages/AlHabibMedicalService/​ health_calculators.dart index 80e0079f..dbd8939c 100644 --- a/lib/pages/AlHabibMedicalService/​ health_calculators.dart +++ b/lib/pages/AlHabibMedicalService/​ health_calculators.dart @@ -66,7 +66,7 @@ class _HealthCalculatorsState extends State isScrollable: true, indicatorWeight: 4.0, indicatorColor: Colors.red, - labelColor: Theme.of(context).primaryColor, + labelColor: Theme.of(context).buttonColor, labelPadding: EdgeInsets.symmetric(horizontal: 13.0, vertical: 2.0), unselectedLabelColor: Colors.grey, @@ -74,13 +74,15 @@ class _HealthCalculatorsState extends State Container( width: MediaQuery.of(context).size.width * 0.35, child: Center( - child: Texts(TranslationBase.of(context).generalHealth), + child: Texts( + TranslationBase.of(context).generalHealth), ), ), Container( width: MediaQuery.of(context).size.width * 0.35, child: Center( - child: Texts(TranslationBase.of(context).womanHealth), + child: + Texts(TranslationBase.of(context).womanHealth), ), ), ], @@ -119,7 +121,8 @@ class _HealthCalculatorsState extends State child: MedicalProfileItem( title: TranslationBase.of(context).bmi, imagePath: 'bmi_health_calculator.png', - subTitle: TranslationBase.of(context).calcHealth, + subTitle: + TranslationBase.of(context).calcHealth, ), ), ), @@ -137,7 +140,8 @@ class _HealthCalculatorsState extends State child: MedicalProfileItem( title: TranslationBase.of(context).calories, imagePath: 'calories-calculator.png', - subTitle: TranslationBase.of(context).calcHealth, + subTitle: + TranslationBase.of(context).calcHealth, ), ), ), @@ -159,7 +163,8 @@ class _HealthCalculatorsState extends State child: MedicalProfileItem( title: TranslationBase.of(context).bmr, imagePath: 'BMR_calculator.png', - subTitle: TranslationBase.of(context).calcHealth, + subTitle: + TranslationBase.of(context).calcHealth, ), ), ), @@ -215,9 +220,11 @@ class _HealthCalculatorsState extends State ); }, child: MedicalProfileItem( - title: TranslationBase.of(context).carbohydrate, + title: + TranslationBase.of(context).carbohydrate, imagePath: 'carb_protein.png', - subTitle: TranslationBase.of(context).proteinFat, + subTitle: + TranslationBase.of(context).proteinFat, ), ), ), diff --git a/lib/pages/Blood/blood_donation.dart b/lib/pages/Blood/blood_donation.dart index 76ad2e1d..adff790c 100644 --- a/lib/pages/Blood/blood_donation.dart +++ b/lib/pages/Blood/blood_donation.dart @@ -101,7 +101,7 @@ class _BloodDonationPageState extends State { height: 65, decoration: BoxDecoration( borderRadius: BorderRadius.circular(12), - color: Colors.white), + color: Theme.of(context).primaryColor), child: Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ @@ -124,7 +124,7 @@ class _BloodDonationPageState extends State { height: 65, decoration: BoxDecoration( borderRadius: BorderRadius.circular(12), - color: Colors.white), + color: Theme.of(context).primaryColor), child: Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ @@ -148,7 +148,7 @@ class _BloodDonationPageState extends State { height: 65, decoration: BoxDecoration( borderRadius: BorderRadius.circular(12), - color: Colors.white), + color: Theme.of(context).primaryColor), child: Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ @@ -228,7 +228,7 @@ class _BloodDonationPageState extends State { children: [ Center( child: Container( - color: Colors.white, + color: Theme.of(context).primaryColor, width: 350, child: InkWell( onTap: () { diff --git a/lib/pages/Blood/my_balance_page.dart b/lib/pages/Blood/my_balance_page.dart index 26665c2b..06bd50f6 100644 --- a/lib/pages/Blood/my_balance_page.dart +++ b/lib/pages/Blood/my_balance_page.dart @@ -48,11 +48,11 @@ class MyBalancePage extends StatelessWidget { children: [ Texts( TranslationBase.of(context).totalBalance, - color: Colors.white, + color: Theme.of(context).primaryColor, ), Texts( '${model.totalAdvanceBalanceAmount ?? 0} SAR', - color: Colors.white, + color: Theme.of(context).primaryColor, bold: true, ), ], @@ -68,7 +68,7 @@ class MyBalancePage extends StatelessWidget { height: 65, margin: EdgeInsets.only(top: 8), decoration: BoxDecoration( - color: Colors.white, + color: Theme.of(context).primaryColor, shape: BoxShape.rectangle, borderRadius: BorderRadius.circular(7), ), diff --git a/lib/pages/BookAppointment/components/SearchByClinic.dart b/lib/pages/BookAppointment/components/SearchByClinic.dart index 733bbe10..63c5e8e1 100644 --- a/lib/pages/BookAppointment/components/SearchByClinic.dart +++ b/lib/pages/BookAppointment/components/SearchByClinic.dart @@ -309,13 +309,14 @@ class _SearchByClinicState extends State { patientDoctorAppointmentListHospital) async { isProjectLoaded = false; Navigator.push( - context, - FadePage( - page: SearchResults( - isLiveCareAppointment: false, - doctorsList: docList, - patientDoctorAppointmentListHospital: - patientDoctorAppointmentListHospital))).then((value) { + context, + FadePage( + page: SearchResults( + isLiveCareAppointment: false, + doctorsList: docList, + patientDoctorAppointmentListHospital: + patientDoctorAppointmentListHospital))) + .then((value) { getProjectsList(); }); } diff --git a/lib/pages/login/confirm-login.dart b/lib/pages/login/confirm-login.dart index 851c7729..1952de64 100644 --- a/lib/pages/login/confirm-login.dart +++ b/lib/pages/login/confirm-login.dart @@ -658,10 +658,9 @@ class _ConfirmLogin extends State { SizedBox( height: 20, ), - Texts( - TranslationBase.of(context).verifyWhatsApp, - fontSize: SizeConfig.textMultiplier * 2, - ) + Texts(TranslationBase.of(context).verifyWhatsApp, + fontSize: SizeConfig.textMultiplier * 2, + color: Colors.black) ], ), ))); @@ -690,11 +689,10 @@ class _ConfirmLogin extends State { : SizedBox( height: 20, ), - Texts( - TranslationBase.of(context).verifySMS, - fontSize: SizeConfig.textMultiplier * 2, - textAlign: TextAlign.center, - ) + Texts(TranslationBase.of(context).verifySMS, + fontSize: SizeConfig.textMultiplier * 2, + textAlign: TextAlign.center, + color: Colors.black) ], ), ))); @@ -721,10 +719,9 @@ class _ConfirmLogin extends State { SizedBox( height: 20, ), - Texts( - TranslationBase.of(context).verifyFingerprint, - fontSize: SizeConfig.textMultiplier * 2, - ) + Texts(TranslationBase.of(context).verifyFingerprint, + fontSize: SizeConfig.textMultiplier * 2, + color: Colors.black) ], ), ))); @@ -752,10 +749,9 @@ class _ConfirmLogin extends State { SizedBox( height: 20, ), - Texts( - TranslationBase.of(context).verifyFaceID, - fontSize: SizeConfig.textMultiplier * 2, - ) + Texts(TranslationBase.of(context).verifyFaceID, + fontSize: SizeConfig.textMultiplier * 2, + color: Colors.black) ], ), ))); @@ -791,11 +787,10 @@ class _ConfirmLogin extends State { : SizedBox( height: 20, ), - Texts( - TranslationBase.of(context).moreVerification, - fontSize: SizeConfig.textMultiplier * 1.8, - textAlign: TextAlign.center, - ) + Texts(TranslationBase.of(context).moreVerification, + fontSize: SizeConfig.textMultiplier * 1.8, + textAlign: TextAlign.center, + color: Colors.black) ], ), ))); diff --git a/lib/pages/medical/balance/advance_payment_page.dart b/lib/pages/medical/balance/advance_payment_page.dart index 0d752e9f..6611c779 100644 --- a/lib/pages/medical/balance/advance_payment_page.dart +++ b/lib/pages/medical/balance/advance_payment_page.dart @@ -94,7 +94,7 @@ class _AdvancePaymentPageState extends State { height: 65, decoration: BoxDecoration( borderRadius: BorderRadius.circular(12), - color: Colors.white), + color: Theme.of(context).primaryColor), child: Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ @@ -125,7 +125,7 @@ class _AdvancePaymentPageState extends State { height: 65, decoration: BoxDecoration( borderRadius: BorderRadius.circular(12), - color: Colors.white), + color: Theme.of(context).primaryColor), child: Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ @@ -168,7 +168,7 @@ class _AdvancePaymentPageState extends State { height: 65, decoration: BoxDecoration( borderRadius: BorderRadius.circular(12), - color: Colors.white), + color: Theme.of(context).primaryColor), child: Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ @@ -189,7 +189,7 @@ class _AdvancePaymentPageState extends State { height: 65, decoration: BoxDecoration( borderRadius: BorderRadius.circular(12), - color: Colors.white), + color: Theme.of(context).primaryColor), child: Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ diff --git a/lib/pages/medical/balance/my_balance_page.dart b/lib/pages/medical/balance/my_balance_page.dart index 1edbcbf6..8f80eeeb 100644 --- a/lib/pages/medical/balance/my_balance_page.dart +++ b/lib/pages/medical/balance/my_balance_page.dart @@ -13,12 +13,15 @@ import 'package:hexcolor/hexcolor.dart'; import 'advance_payment_page.dart'; class MyBalancePage extends StatelessWidget { - List imagesInfo = List(); @override Widget build(BuildContext context) { - imagesInfo.add(ImagesInfo(imageEn: 'https://hmgwebservices.com/Images/MobileApp/images-info-home/my-balance/en/0.png',imageAr: 'https://hmgwebservices.com/Images/MobileApp/images-info-home/my-balance/ar/0.png')); + imagesInfo.add(ImagesInfo( + imageEn: + 'https://hmgwebservices.com/Images/MobileApp/images-info-home/my-balance/en/0.png', + imageAr: + 'https://hmgwebservices.com/Images/MobileApp/images-info-home/my-balance/ar/0.png')); return BaseView( onModelReady: (model) => model.getPatientAdvanceBalanceAmount(), builder: (_, model, w) => AppScaffold( @@ -53,9 +56,9 @@ class MyBalancePage extends StatelessWidget { child: Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ - Texts( - '${model.totalAdvanceBalanceAmount ?? 0} '+ TranslationBase.of(context).sar, + '${model.totalAdvanceBalanceAmount ?? 0} ' + + TranslationBase.of(context).sar, color: Colors.white, bold: true, ), @@ -76,16 +79,16 @@ class MyBalancePage extends StatelessWidget { height: 65, margin: EdgeInsets.only(top: 8), decoration: BoxDecoration( - color: Colors.white, + color: Theme.of(context).primaryColor, shape: BoxShape.rectangle, borderRadius: BorderRadius.circular(7), ), child: Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ - Texts( - '${model.patientAdvanceBalanceAmountList[index].patientAdvanceBalanceAmount} '+TranslationBase.of(context).sar, + '${model.patientAdvanceBalanceAmountList[index].patientAdvanceBalanceAmount} ' + + TranslationBase.of(context).sar, bold: true, ), Texts(model.patientAdvanceBalanceAmountList[index] @@ -94,7 +97,9 @@ class MyBalancePage extends StatelessWidget { ), ), ), - SizedBox(height: MediaQuery.of(context).size.height * 0.13 ,) + SizedBox( + height: MediaQuery.of(context).size.height * 0.13, + ) ], ), ), diff --git a/lib/pages/medical/balance/new_text_Field.dart b/lib/pages/medical/balance/new_text_Field.dart index ad9eb580..6d368a6a 100644 --- a/lib/pages/medical/balance/new_text_Field.dart +++ b/lib/pages/medical/balance/new_text_Field.dart @@ -42,38 +42,39 @@ final _mobileFormatter = NumberTextInputFormatter(); class NewTextFields extends StatefulWidget { NewTextFields( {Key key, - this.type, - this.hintText, - this.suffixIcon, - this.autoFocus, - this.onChanged, - this.initialValue, - this.minLines, - this.maxLines, - this.inputFormatters, - this.padding, - this.focus = false, - this.maxLengthEnforced = true, - this.suffixIconColor, - this.inputAction, - this.onSubmit, - this.keepPadding = true, - this.textCapitalization = TextCapitalization.none, - this.controller, - this.keyboardType, - this.validator, - this.borderOnlyError = false, - this.onSaved, - this.onSuffixTap, - this.readOnly: false, - this.maxLength, - this.prefixIcon, - this.bare = false, - this.onTap, - this.fontSize = 16.0, - this.fontWeight = FontWeight.w700, - this.autoValidate = false, - this.hintColor,this.isEnabled=true}) + this.type, + this.hintText, + this.suffixIcon, + this.autoFocus, + this.onChanged, + this.initialValue, + this.minLines, + this.maxLines, + this.inputFormatters, + this.padding, + this.focus = false, + this.maxLengthEnforced = true, + this.suffixIconColor, + this.inputAction, + this.onSubmit, + this.keepPadding = true, + this.textCapitalization = TextCapitalization.none, + this.controller, + this.keyboardType, + this.validator, + this.borderOnlyError = false, + this.onSaved, + this.onSuffixTap, + this.readOnly: false, + this.maxLength, + this.prefixIcon, + this.bare = false, + this.onTap, + this.fontSize = 16.0, + this.fontWeight = FontWeight.w700, + this.autoValidate = false, + this.hintColor, + this.isEnabled = true}) : super(key: key); final String hintText; @@ -142,7 +143,6 @@ class _NewTextFieldsState extends State { super.dispose(); } - bool _determineReadOnly() { if (widget.readOnly != null && widget.readOnly) { _focusNode.unfocus(); @@ -156,12 +156,11 @@ class _NewTextFieldsState extends State { Widget build(BuildContext context) { return AnimatedContainer( duration: Duration(milliseconds: 300), - decoration:BoxDecoration( + decoration: BoxDecoration( borderRadius: BorderRadius.circular(12), - color: Colors.white), + color: Theme.of(context).primaryColor), child: Container( margin: EdgeInsets.only(top: 8), - child: TextFormField( enabled: widget.isEnabled, initialValue: widget.initialValue, @@ -171,10 +170,10 @@ class _NewTextFieldsState extends State { textCapitalization: widget.textCapitalization, onFieldSubmitted: widget.inputAction == TextInputAction.next ? (widget.onSubmit != null - ? widget.onSubmit - : (val) { - _focusNode.nextFocus(); - }) + ? widget.onSubmit + : (val) { + _focusNode.nextFocus(); + }) : widget.onSubmit, textInputAction: widget.inputAction, minLines: widget.minLines ?? 1, @@ -190,45 +189,36 @@ class _NewTextFieldsState extends State { autofocus: widget.autoFocus ?? false, validator: widget.validator, onSaved: widget.onSaved, - - style: Theme.of(context) - .textTheme - .body2 - .copyWith(fontSize: widget.fontSize, fontWeight: widget.fontWeight), + style: Theme.of(context).textTheme.body2.copyWith( + fontSize: widget.fontSize, fontWeight: widget.fontWeight), inputFormatters: widget.keyboardType == TextInputType.phone ? [ - WhitelistingTextInputFormatter.digitsOnly, - _mobileFormatter, - ] + WhitelistingTextInputFormatter.digitsOnly, + _mobileFormatter, + ] : widget.inputFormatters, decoration: InputDecoration( labelText: widget.hintText, - labelStyle: TextStyle(color: Colors.black), + labelStyle: + TextStyle(color: Theme.of(context).textTheme.bodyText1.color), errorBorder: OutlineInputBorder( borderSide: BorderSide( - color: Theme.of(context) - .errorColor - .withOpacity(0.5), + color: Theme.of(context).errorColor.withOpacity(0.5), width: 1.0), borderRadius: BorderRadius.circular(12.0)), focusedErrorBorder: OutlineInputBorder( borderSide: BorderSide( - color: Theme.of(context) - .errorColor - .withOpacity(0.5), + color: Theme.of(context).errorColor.withOpacity(0.5), width: 1.0), borderRadius: BorderRadius.circular(8.0)), focusedBorder: OutlineInputBorder( - borderSide: - BorderSide(color: Colors.white, width: 1.0), + borderSide: BorderSide(color: Colors.white, width: 1.0), borderRadius: BorderRadius.circular(12)), disabledBorder: OutlineInputBorder( - borderSide: - BorderSide(color: Colors.white, width: 1.0), + borderSide: BorderSide(color: Colors.white, width: 1.0), borderRadius: BorderRadius.circular(12)), enabledBorder: OutlineInputBorder( - borderSide: - BorderSide(color: Colors.white, width: 1.0), + borderSide: BorderSide(color: Colors.white, width: 1.0), borderRadius: BorderRadius.circular(12), ), ), diff --git a/lib/theme/theme_value.dart b/lib/theme/theme_value.dart index 9f26bb6f..129174ee 100644 --- a/lib/theme/theme_value.dart +++ b/lib/theme/theme_value.dart @@ -36,6 +36,7 @@ defaultTheme({fontName}) { highlightColor: Colors.grey[100].withOpacity(0.4), splashColor: Colors.transparent, primaryColor: Color(0xffffffff), + buttonColor: Colors.black, toggleableActiveColor: secondaryColor, indicatorColor: secondaryColor, bottomSheetTheme: @@ -86,6 +87,7 @@ invertThemes({fontName}) { highlightColor: Colors.grey[100].withOpacity(0.4), splashColor: Colors.transparent, primaryColor: Color(0xff515A5D), + buttonColor: Colors.black, toggleableActiveColor: secondaryColor, indicatorColor: secondaryColor, bottomSheetTheme: diff --git a/lib/uitl/translations_delegate_base.dart b/lib/uitl/translations_delegate_base.dart index 9b52b54d..d9d03112 100644 --- a/lib/uitl/translations_delegate_base.dart +++ b/lib/uitl/translations_delegate_base.dart @@ -1573,6 +1573,8 @@ class TranslationBase { String get shippingAddresss => localizedValues["shipping-address"][locale.languageCode]; String get covidAlert => localizedValues["covid-alert"][locale.languageCode]; + String get anicllaryOrders => + localizedValues["ancillary-orders"][locale.languageCode]; } class TranslationBaseDelegate extends LocalizationsDelegate { diff --git a/lib/widgets/bottom_navigation/bottom_navigation_item.dart b/lib/widgets/bottom_navigation/bottom_navigation_item.dart index 391b6a3d..9a3bbafe 100644 --- a/lib/widgets/bottom_navigation/bottom_navigation_item.dart +++ b/lib/widgets/bottom_navigation/bottom_navigation_item.dart @@ -18,7 +18,8 @@ class BottomNavigationItem extends StatelessWidget { final int currentIndex; final String name; - AuthenticatedUserObject authenticatedUserObject = locator(); + AuthenticatedUserObject authenticatedUserObject = + locator(); BottomNavigationItem( {this.icon, @@ -52,7 +53,7 @@ class BottomNavigationItem extends StatelessWidget { child: Icon(currentIndex == index ? activeIcon : icon, color: currentIndex == index ? secondaryColor - : Theme.of(context).dividerColor, + : Colors.grey, size: 22.0), ), SizedBox( diff --git a/lib/widgets/buttons/secondary_button.dart b/lib/widgets/buttons/secondary_button.dart index 8884039b..b5a4655a 100644 --- a/lib/widgets/buttons/secondary_button.dart +++ b/lib/widgets/buttons/secondary_button.dart @@ -22,7 +22,7 @@ class SecondaryButton extends StatefulWidget { this.label = "", this.icon, this.iconOnly = false, - this.color , + this.color, this.textColor = Colors.white, this.onTap, this.loading: false, @@ -144,8 +144,10 @@ class _SecondaryButtonState extends State onTapCancel: () { _animationController.forward(); }, - onTap: () =>{ widget.disabled ? null : widget.onTap(), }, - // onTap: widget.disabled?null:Feedback.wrapForTap(widget.onTap, context), + onTap: () => { + widget.disabled ? null : widget.onTap(), + }, + // onTap: widget.disabled?null:Feedback.wrapForTap(widget.onTap, context), behavior: HitTestBehavior.opaque, child: Transform.scale( scale: _buttonSize, @@ -177,8 +179,9 @@ class _SecondaryButtonState extends State width: MediaQuery.of(context).size.width, height: 100, decoration: BoxDecoration( - color: widget.disabled? Colors.grey: widget.color ?? Theme.of(context).primaryColor, - ), + color: widget.disabled + ? Colors.grey + : widget.color ?? Theme.of(context).buttonColor), ), ), Positioned( @@ -191,7 +194,9 @@ class _SecondaryButtonState extends State height: MediaQuery.of(context).size.width * 2.2, decoration: BoxDecoration( shape: BoxShape.circle, - color: widget.disabled? Colors.grey: widget.color ?? Theme.of(context).primaryColor, + color: widget.disabled + ? Colors.grey + : widget.color ?? Theme.of(context).buttonColor, ), ), ), @@ -237,8 +242,10 @@ class _SecondaryButtonState extends State style: TextStyle( color: widget.textColor, fontSize: widget.small ? 12.0 : 15.0, - // fontWeight: FontWeight.w800, - fontFamily: projectViewModel.isArabic ? 'Cairo' : 'WorkSans'), + // fontWeight: FontWeight.w800, + fontFamily: projectViewModel.isArabic + ? 'Cairo' + : 'WorkSans'), ), ) ], diff --git a/lib/widgets/data_display/services)contaniner.dart b/lib/widgets/data_display/services)contaniner.dart index 91b0b59d..cb0b3774 100644 --- a/lib/widgets/data_display/services)contaniner.dart +++ b/lib/widgets/data_display/services)contaniner.dart @@ -15,7 +15,7 @@ class ServicesContainer extends StatelessWidget { height: 60, margin: EdgeInsets.all(8), decoration: BoxDecoration( - color: Colors.white, + color: Theme.of(context).primaryColor, shape: BoxShape.rectangle, borderRadius: BorderRadius.circular(7), ), diff --git a/lib/widgets/data_display/text.dart b/lib/widgets/data_display/text.dart index 9797defb..40aabfe3 100644 --- a/lib/widgets/data_display/text.dart +++ b/lib/widgets/data_display/text.dart @@ -203,7 +203,10 @@ class _TextsState extends State { Stack( children: [ Text( - !hidden ? text : (text.substring(0, + !hidden + ? text + : (text.substring( + 0, text.length > widget.maxLength ? widget.maxLength : text.length)), @@ -217,13 +220,16 @@ class _TextsState extends State { style: widget.style != null ? _getFontStyle().copyWith( fontStyle: widget.italic ? FontStyle.italic : null, - color: widget.color != null ? widget.color : null, + color: widget.color != null + ? widget.color + : Theme.of(context).textTheme.bodyText1.color, fontWeight: widget.fontWeight ?? _getFontWeight(), ) : TextStyle( decoration: widget.decoration, fontStyle: widget.italic ? FontStyle.italic : null, - color: widget.color ?? Colors.black, + color: widget.color ?? + Theme.of(context).textTheme.bodyText1.color, fontSize: widget.fontSize ?? _getFontSize(), letterSpacing: widget.variant == "overline" ? 1 : null, fontWeight: widget.fontWeight ?? _getFontWeight(), diff --git a/lib/widgets/others/app_scaffold_pharmacy_widget.dart b/lib/widgets/others/app_scaffold_pharmacy_widget.dart index c3bd8a47..001bc955 100644 --- a/lib/widgets/others/app_scaffold_pharmacy_widget.dart +++ b/lib/widgets/others/app_scaffold_pharmacy_widget.dart @@ -93,7 +93,7 @@ class PharmacyAppScaffold extends StatelessWidget { ) : buildBodyWidget(), bottomSheet: bottomSheet, - floatingActionButton: floatingActionButton ?? floatingActionButton, + // floatingActionButton: floatingActionButton ?? floatingActionButton, // bottomNavigationBar: // this.isBottomBar == true ? BottomBarSearch() : SizedBox() // floatingActionButton: FloatingSearchButton(), @@ -105,7 +105,7 @@ class PharmacyAppScaffold extends StatelessWidget { } buildBodyWidget() { - // return body; //Stack(children: [body, buildAppLoaderWidget(isLoading)]); - return Stack(children: [body, FloatingSearchButton()]); + return body; //Stack(children: [body, buildAppLoaderWidget(isLoading)]); + //return Stack(children: [body, FloatingSearchButton()]); } } diff --git a/lib/widgets/pharmacy/bottom_nav_pharmacy_item.dart b/lib/widgets/pharmacy/bottom_nav_pharmacy_item.dart index 9d46e2eb..47ff1b23 100644 --- a/lib/widgets/pharmacy/bottom_nav_pharmacy_item.dart +++ b/lib/widgets/pharmacy/bottom_nav_pharmacy_item.dart @@ -1,3 +1,4 @@ +import 'package:diplomaticquarterapp/Constants.dart'; import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; import 'package:flutter/material.dart'; @@ -48,9 +49,8 @@ class BottomNavPharmacyItem extends StatelessWidget { ), Container( child: Icon(currentIndex == index ? activeIcon : icon, - color: currentIndex == index - ? Theme.of(context).primaryColor - : Theme.of(context).primaryColor, + color: + currentIndex == index ? secondaryColor : Colors.grey, size: 22.0), ), SizedBox( @@ -61,9 +61,7 @@ class BottomNavPharmacyItem extends StatelessWidget { Texts( title, textAlign: TextAlign.center, - color: currentIndex == index - ? Theme.of(context).primaryColor - : Theme.of(context).primaryColor, + color: currentIndex == index ? secondaryColor : Colors.grey, fontSize: 11, ), ],