daynmic products listing

merge-requests/225/head
hussam al-habibeh 4 years ago
parent 6162833bba
commit 69ea8b7bd7

@ -362,9 +362,12 @@ const GET_OFFERS_CATEGORISE = 'epharmacy/api/discountcategories';
const GET_OFFERS_PRODUCTS = 'epharmacy/api/offerproducts/'; const GET_OFFERS_PRODUCTS = 'epharmacy/api/offerproducts/';
const GET_CATEGORISE_PARENT = const GET_CATEGORISE_PARENT =
'epharmacy/api/categories?fields=id,name,namen,description,image,localized_names,display_order,parent_category_id,is_leaf&parent_id='; 'epharmacy/api/categories?fields=id,name,namen,description,image,localized_names,display_order,parent_category_id,is_leaf&parent_id=';
const GET_PARENT_PRODUCTS = const GET_PARENT_PRODUCTS = 'epharmacy/api/products?categoryid=';
'epharmacy/api/products?categoryid=1&page=1&limit=50'; const GET_SUB_CATEGORISE =
'epharmacy/api/categories?fields=id,name,namen,description,image,localized_names,display_order,parent_category_id,is_leaf&parent_id=';
const GET_SUB_PRODUCTS = 'epharmacy/api/products?categoryid=';
const GET_FINAL_PRODUCTS =
'epharmacy/api/products?fields=id,reviews,discount_ids,name,namen,localized_names,display_order,short_description,full_description,full_descriptionn,sku,order_minimum_quantity,order_maximum_quantity,price,old_price,images,is_rx,rx_message,rx_messagen,discount_name,discount_namen,approved_rating_sum,approved_total_reviews,allow_back_in_stock_subscriptions,stock_quantity,stock_availability,stock_availabilityn,discount_percentage&CategoryId=';
const TIMER_MIN = 10; const TIMER_MIN = 10;
const GOOGLE_API_KEY = "AIzaSyCmevVlr2Bh-c8W1VUzo8gt8JRY7n5PANw"; const GOOGLE_API_KEY = "AIzaSyCmevVlr2Bh-c8W1VUzo8gt8JRY7n5PANw";

@ -0,0 +1,184 @@
class FinalProductsModel {
String id;
String name;
String namen;
List<LocalizedNames> localizedNames;
String shortDescription;
String fullDescription;
String fullDescriptionn;
dynamic approvedRatingSum;
dynamic approvedTotalReviews;
String sku;
bool isRx;
dynamic rxMessage;
dynamic rxMessagen;
dynamic stockQuantity;
String stockAvailability;
String stockAvailabilityn;
bool allowBackInStockSubscriptions;
dynamic orderMinimumQuantity;
dynamic orderMaximumQuantity;
dynamic price;
dynamic oldPrice;
dynamic discountName;
dynamic discountNamen;
dynamic discountPercentage;
dynamic displayOrder;
List<dynamic> discountIds;
List<dynamic> reviews;
List<Images> images;
FinalProductsModel(
{this.id,
this.name,
this.namen,
this.localizedNames,
this.shortDescription,
this.fullDescription,
this.fullDescriptionn,
this.approvedRatingSum,
this.approvedTotalReviews,
this.sku,
this.isRx,
this.rxMessage,
this.rxMessagen,
this.stockQuantity,
this.stockAvailability,
this.stockAvailabilityn,
this.allowBackInStockSubscriptions,
this.orderMinimumQuantity,
this.orderMaximumQuantity,
this.price,
this.oldPrice,
this.discountName,
this.discountNamen,
this.discountPercentage,
this.displayOrder,
this.discountIds,
this.reviews,
this.images});
FinalProductsModel.fromJson(Map<String, dynamic> json) {
id = json['id'];
name = json['name'];
if (json['images'] != null) {
images = new List<Images>();
json['images'].forEach((v) {
images.add(new Images.fromJson(v));
});
}
namen = json['namen'];
if (json['localized_names'] != null) {
localizedNames = new List<LocalizedNames>();
json['localized_names'].forEach((v) {
localizedNames.add(new LocalizedNames.fromJson(v));
});
}
shortDescription = json['short_description'];
fullDescription = json['full_description'];
fullDescriptionn = json['full_descriptionn'];
approvedRatingSum = json['approved_rating_sum'];
approvedTotalReviews = json['approved_total_reviews'];
sku = json['sku'];
isRx = json['is_rx'];
rxMessage = json['rx_message'];
rxMessagen = json['rx_messagen'];
stockQuantity = json['stock_quantity'];
stockAvailability = json['stock_availability'];
stockAvailabilityn = json['stock_availabilityn'];
allowBackInStockSubscriptions = json['allow_back_in_stock_subscriptions'];
orderMinimumQuantity = json['order_minimum_quantity'];
orderMaximumQuantity = json['order_maximum_quantity'];
price = json['price'];
oldPrice = json['old_price'];
discountName = json['discount_name'];
discountNamen = json['discount_namen'];
discountPercentage = json['discount_percentage'];
displayOrder = json['display_order'];
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
data['id'] = this.id;
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['full_description'] = this.fullDescription;
data['full_descriptionn'] = this.fullDescriptionn;
data['approved_rating_sum'] = this.approvedRatingSum;
data['approved_total_reviews'] = this.approvedTotalReviews;
data['sku'] = this.sku;
data['is_rx'] = this.isRx;
data['rx_message'] = this.rxMessage;
data['rx_messagen'] = this.rxMessagen;
data['stock_quantity'] = this.stockQuantity;
data['stock_availability'] = this.stockAvailability;
data['stock_availabilityn'] = this.stockAvailabilityn;
data['allow_back_in_stock_subscriptions'] =
this.allowBackInStockSubscriptions;
data['order_minimum_quantity'] = this.orderMinimumQuantity;
data['order_maximum_quantity'] = this.orderMaximumQuantity;
data['price'] = this.price;
data['old_price'] = this.oldPrice;
data['discount_name'] = this.discountName;
data['discount_namen'] = this.discountNamen;
data['discount_percentage'] = this.discountPercentage;
data['display_order'] = this.displayOrder;
if (this.images != null) {
data['images'] = this.images.map((v) => v.toJson()).toList();
}
return data;
}
}
class LocalizedNames {
int languageId;
String localizedName;
LocalizedNames({this.languageId, this.localizedName});
LocalizedNames.fromJson(Map<String, dynamic> json) {
languageId = json['language_id'];
localizedName = json['localized_name'];
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
data['language_id'] = this.languageId;
data['localized_name'] = this.localizedName;
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<String, dynamic> json) {
id = json['id'];
position = json['position'];
src = json['src'];
thumb = json['thumb'];
attachment = json['attachment'];
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
data['id'] = this.id;
data['position'] = this.position;
data['src'] = this.src;
data['thumb'] = this.thumb;
data['attachment'] = this.attachment;
return data;
}
}

@ -1,102 +1,102 @@
class ParentProductsModel { class ParentProductsModel {
String id; dynamic id;
bool visibleIndividually; dynamic visibleIndividually;
String name; dynamic name;
String namen; dynamic namen;
List<LocalizedNames> localizedNames; List<LocalizedNames> localizedNames;
dynamic shortDescription; dynamic shortDescription;
dynamic shortDescriptionn; dynamic shortDescriptionn;
String fullDescription; dynamic fullDescription;
String fullDescriptionn; dynamic fullDescriptionn;
bool markasNew; dynamic markasNew;
bool showOnHomePage; dynamic showOnHomePage;
String metaKeywords; dynamic metaKeywords;
String metaDescription; dynamic metaDescription;
String metaTitle; dynamic metaTitle;
bool allowCustomerReviews; dynamic allowCustomerReviews;
dynamic approvedRatingSum; dynamic approvedRatingSum;
dynamic notApprovedRatingSum; dynamic notApprovedRatingSum;
dynamic approvedTotalReviews; dynamic approvedTotalReviews;
dynamic notApprovedTotalReviews; dynamic notApprovedTotalReviews;
String sku; dynamic sku;
bool isRx; dynamic isRx;
bool prescriptionRequired; dynamic prescriptionRequired;
dynamic rxMessage; dynamic rxMessage;
dynamic rxMessagen; dynamic rxMessagen;
dynamic manufacturerPartNumber; dynamic manufacturerPartNumber;
dynamic gtin; dynamic gtin;
bool isGiftCard; dynamic isGiftCard;
bool requireOtherProducts; dynamic requireOtherProducts;
bool automaticallyAddRequiredProducts; dynamic automaticallyAddRequiredProducts;
bool isDownload; dynamic isDownload;
bool unlimitedDownloads; dynamic unlimitedDownloads;
dynamic maxNumberOfDownloads; dynamic maxNumberOfDownloads;
dynamic downloadExpirationDays; dynamic downloadExpirationDays;
bool hasSampleDownload; dynamic hasSampleDownload;
bool hasUserAgreement; dynamic hasUserAgreement;
bool isRecurring; dynamic isRecurring;
dynamic recurringCycleLength; dynamic recurringCycleLength;
dynamic recurringTotalCycles; dynamic recurringTotalCycles;
bool isRental; dynamic isRental;
dynamic rentalPriceLength; dynamic rentalPriceLength;
bool isShipEnabled; dynamic isShipEnabled;
bool isFreeShipping; dynamic isFreeShipping;
bool shipSeparately; dynamic shipSeparately;
dynamic additionalShippingCharge; dynamic additionalShippingCharge;
bool isTaxExempt; dynamic isTaxExempt;
bool isTelecommunicationsOrBroadcastingOrElectronicServices; dynamic isTelecommunicationsOrBroadcastingOrElectronicServices;
bool useMultipleWarehouses; dynamic useMultipleWarehouses;
dynamic manageInventoryMethodId; dynamic manageInventoryMethodId;
dynamic stockQuantity; dynamic stockQuantity;
String stockAvailability; dynamic stockAvailability;
String stockAvailabilityn; dynamic stockAvailabilityn;
bool displayStockAvailability; dynamic displayStockAvailability;
bool displayStockQuantity; dynamic displayStockQuantity;
dynamic minStockQuantity; dynamic minStockQuantity;
dynamic notifyAdminForQuantityBelow; dynamic notifyAdminForQuantityBelow;
bool allowBackInStockSubscriptions; dynamic allowBackInStockSubscriptions;
dynamic orderMinimumQuantity; dynamic orderMinimumQuantity;
dynamic orderMaximumQuantity; dynamic orderMaximumQuantity;
dynamic allowedQuantities; dynamic allowedQuantities;
bool allowAddingOnlyExistingAttributeCombinations; dynamic allowAddingOnlyExistingAttributeCombinations;
bool disableBuyButton; dynamic disableBuyButton;
bool disableWishlistButton; dynamic disableWishlistButton;
bool availableForPreOrder; dynamic availableForPreOrder;
dynamic preOrderAvailabilityStartDateTimeUtc; dynamic preOrderAvailabilityStartDateTimeUtc;
bool callForPrice; dynamic callForPrice;
double price; dynamic price;
dynamic oldPrice; dynamic oldPrice;
double productCost; dynamic productCost;
dynamic specialPrice; dynamic specialPrice;
dynamic specialPriceStartDateTimeUtc; dynamic specialPriceStartDateTimeUtc;
dynamic specialPriceEndDateTimeUtc; dynamic specialPriceEndDateTimeUtc;
bool customerEntersPrice; dynamic customerEntersPrice;
dynamic minimumCustomerEnteredPrice; dynamic minimumCustomerEnteredPrice;
dynamic maximumCustomerEnteredPrice; dynamic maximumCustomerEnteredPrice;
bool basepriceEnabled; dynamic basepriceEnabled;
dynamic basepriceAmount; dynamic basepriceAmount;
dynamic basepriceBaseAmount; dynamic basepriceBaseAmount;
bool hasTierPrices; dynamic hasTierPrices;
bool hasDiscountsApplied; dynamic hasDiscountsApplied;
dynamic discountName; dynamic discountName;
dynamic discountNamen; dynamic discountNamen;
dynamic discountDescription; dynamic discountDescription;
dynamic discountDescriptionn; dynamic discountDescriptionn;
dynamic discountPercentage; dynamic discountPercentage;
String currency; dynamic currency;
String currencyn; dynamic currencyn;
double weight; dynamic weight;
dynamic length; dynamic length;
dynamic width; dynamic width;
dynamic height; dynamic height;
dynamic availableStartDateTimeUtc; dynamic availableStartDateTimeUtc;
dynamic availableEndDateTimeUtc; dynamic availableEndDateTimeUtc;
dynamic displayOrder; dynamic displayOrder;
bool published; dynamic published;
bool deleted; dynamic deleted;
String createdOnUtc; dynamic createdOnUtc;
String updatedOnUtc; dynamic updatedOnUtc;
String productType; dynamic productType;
dynamic parentGroupedProductId; dynamic parentGroupedProductId;
List<dynamic> roleIds; List<dynamic> roleIds;
List<dynamic> discountIds; List<dynamic> discountIds;
@ -228,6 +228,12 @@ class ParentProductsModel {
id = json['id']; id = json['id'];
visibleIndividually = json['visible_individually']; visibleIndividually = json['visible_individually'];
name = json['name']; name = json['name'];
if (json['images'] != null) {
images = new List<Images>();
json['images'].forEach((v) {
images.add(new Images.fromJson(v));
});
}
namen = json['namen']; namen = json['namen'];
if (json['localized_names'] != null) { if (json['localized_names'] != null) {
localizedNames = new List<LocalizedNames>(); localizedNames = new List<LocalizedNames>();

@ -0,0 +1,75 @@
class SubCategoriesModel {
String id;
String name;
String namen;
List<LocalizedNames> localizedNames;
String description;
int parentCategoryId;
int displayOrder;
dynamic image;
bool isLeaf;
SubCategoriesModel(
{this.id,
this.name,
this.namen,
this.localizedNames,
this.description,
this.parentCategoryId,
this.displayOrder,
this.image,
this.isLeaf});
SubCategoriesModel.fromJson(Map<String, dynamic> json) {
id = json['id'];
name = json['name'];
namen = json['namen'];
if (json['localized_names'] != null) {
localizedNames = new List<LocalizedNames>();
json['localized_names'].forEach((v) {
localizedNames.add(new LocalizedNames.fromJson(v));
});
}
description = json['description'];
parentCategoryId = json['parent_category_id'];
displayOrder = json['display_order'];
image = json['image'];
isLeaf = json['is_leaf'];
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
data['id'] = this.id;
data['name'] = this.name;
data['namen'] = this.namen;
if (this.localizedNames != null) {
data['localized_names'] =
this.localizedNames.map((v) => v.toJson()).toList();
}
data['description'] = this.description;
data['parent_category_id'] = this.parentCategoryId;
data['display_order'] = this.displayOrder;
data['image'] = this.image;
data['is_leaf'] = this.isLeaf;
return data;
}
}
class LocalizedNames {
int languageId;
String localizedName;
LocalizedNames({this.languageId, this.localizedName});
LocalizedNames.fromJson(Map<String, dynamic> json) {
languageId = json['language_id'];
localizedName = json['localized_name'];
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
data['language_id'] = this.languageId;
data['localized_name'] = this.localizedName;
return data;
}
}

@ -0,0 +1,562 @@
class SubProductsModel {
String id;
bool visibleIndividually;
String name;
String namen;
List<LocalizedNames> localizedNames;
String shortDescription;
String shortDescriptionn;
String fullDescription;
String fullDescriptionn;
bool markasNew;
bool showOnHomePage;
dynamic metaKeywords;
dynamic metaDescription;
dynamic metaTitle;
bool allowCustomerReviews;
dynamic approvedRatingSum;
dynamic notApprovedRatingSum;
dynamic approvedTotalReviews;
dynamic notApprovedTotalReviews;
String sku;
bool isRx;
bool prescriptionRequired;
dynamic rxMessage;
dynamic rxMessagen;
dynamic manufacturerPartNumber;
dynamic gtin;
bool isGiftCard;
bool requireOtherProducts;
bool automaticallyAddRequiredProducts;
bool isDownload;
bool unlimitedDownloads;
dynamic maxNumberOfDownloads;
dynamic downloadExpirationDays;
bool hasSampleDownload;
bool hasUserAgreement;
bool isRecurring;
dynamic recurringCycleLength;
dynamic recurringTotalCycles;
bool isRental;
dynamic rentalPriceLength;
bool isShipEnabled;
bool isFreeShipping;
bool shipSeparately;
dynamic additionalShippingCharge;
bool isTaxExempt;
bool isTelecommunicationsOrBroadcastingOrElectronicServices;
bool useMultipleWarehouses;
dynamic manageInventoryMethodId;
dynamic stockQuantity;
String stockAvailability;
String stockAvailabilityn;
bool displayStockAvailability;
bool displayStockQuantity;
dynamic minStockQuantity;
dynamic notifyAdminForQuantityBelow;
bool allowBackInStockSubscriptions;
dynamic orderMinimumQuantity;
dynamic orderMaximumQuantity;
dynamic allowedQuantities;
bool allowAddingOnlyExistingAttributeCombinations;
bool disableBuyButton;
bool disableWishlistButton;
bool availableForPreOrder;
dynamic preOrderAvailabilityStartDateTimeUtc;
bool callForPrice;
dynamic price;
dynamic oldPrice;
dynamic productCost;
dynamic specialPrice;
dynamic specialPriceStartDateTimeUtc;
dynamic specialPriceEndDateTimeUtc;
bool customerEntersPrice;
dynamic minimumCustomerEnteredPrice;
dynamic maximumCustomerEnteredPrice;
bool basepriceEnabled;
dynamic basepriceAmount;
dynamic basepriceBaseAmount;
bool hasTierPrices;
bool hasDiscountsApplied;
dynamic discountName;
dynamic discountNamen;
dynamic discountDescription;
dynamic discountDescriptionn;
dynamic discountPercentage;
String currency;
String currencyn;
double weight;
dynamic length;
dynamic width;
dynamic height;
dynamic availableStartDateTimeUtc;
dynamic availableEndDateTimeUtc;
dynamic displayOrder;
bool published;
bool deleted;
String createdOnUtc;
String updatedOnUtc;
String productType;
dynamic parentGroupedProductId;
List<dynamic> roleIds;
List<dynamic> discountIds;
List<dynamic> storeIds;
List<int> manufacturerIds;
List<dynamic> reviews;
List<Images> images;
List<dynamic> attributes;
List<Specifications> specifications;
List<dynamic> associatedProductIds;
List<dynamic> tags;
dynamic vendorId;
String seName;
SubProductsModel(
{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});
SubProductsModel.fromJson(Map<String, dynamic> json) {
id = json['id'];
visibleIndividually = json['visible_individually'];
name = json['name'];
if (json['images'] != null) {
images = new List<Images>();
json['images'].forEach((v) {
images.add(new Images.fromJson(v));
});
}
namen = json['namen'];
if (json['localized_names'] != null) {
localizedNames = new List<LocalizedNames>();
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'];
manufacturerIds = json['manufacturer_ids'].cast<int>();
if (json['specifications'] != null) {
specifications = new List<Specifications>();
json['specifications'].forEach((v) {
specifications.add(new Specifications.fromJson(v));
});
}
vendorId = json['vendor_id'];
seName = json['se_name'];
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
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;
data['manufacturer_ids'] = this.manufacturerIds;
if (this.specifications != null) {
data['specifications'] =
this.specifications.map((v) => v.toJson()).toList();
}
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<String, dynamic> json) {
languageId = json['language_id'];
localizedName = json['localized_name'];
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
data['language_id'] = this.languageId;
data['localized_name'] = this.localizedName;
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<String, dynamic> json) {
id = json['id'];
position = json['position'];
src = json['src'];
thumb = json['thumb'];
attachment = json['attachment'];
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
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<String, dynamic> json) {
id = json['id'];
displayOrder = json['display_order'];
defaultValue = json['default_value'];
defaultValuen = json['default_valuen'];
name = json['name'];
nameN = json['nameN'];
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
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;
}
}

@ -1,7 +1,10 @@
import 'package:diplomaticquarterapp/config/config.dart'; import 'package:diplomaticquarterapp/config/config.dart';
import 'package:diplomaticquarterapp/core/model/pharmacy/categorise_parent_model.dart'; import 'package:diplomaticquarterapp/core/model/pharmacy/categorise_parent_model.dart';
import 'package:diplomaticquarterapp/core/model/pharmacy/final_products_model.dart';
import 'package:diplomaticquarterapp/core/model/pharmacy/parent_products_model.dart'; import 'package:diplomaticquarterapp/core/model/pharmacy/parent_products_model.dart';
import 'package:diplomaticquarterapp/core/model/pharmacy/pharmacy_categorise.dart'; import 'package:diplomaticquarterapp/core/model/pharmacy/pharmacy_categorise.dart';
import 'package:diplomaticquarterapp/core/model/pharmacy/sub_categories_model.dart';
import 'package:diplomaticquarterapp/core/model/pharmacy/sub_products_model.dart';
import 'base_service.dart'; import 'base_service.dart';
@ -18,6 +21,18 @@ class PharmacyCategoriseService extends BaseService {
List<ParentProductsModel> _parentProductsList = List(); List<ParentProductsModel> _parentProductsList = List();
List<ParentProductsModel> get parentProductsList => _parentProductsList; List<ParentProductsModel> get parentProductsList => _parentProductsList;
//service four
List<SubCategoriesModel> _subCategoriseList = List();
List<SubCategoriesModel> get subCategoriseList => _subCategoriseList;
//service five
List<SubProductsModel> _subProductsList = List();
List<SubProductsModel> get subProductsList => _subProductsList;
//service six
List<FinalProductsModel> _finalProducts = List();
List<FinalProductsModel> get finalProducts => _finalProducts;
Future getCategorise() async { Future getCategorise() async {
hasError = false; hasError = false;
_categoriseList.clear(); _categoriseList.clear();
@ -54,11 +69,14 @@ class PharmacyCategoriseService extends BaseService {
); );
} }
Future getParentProducts() async { Future getParentProducts({String id}) async {
hasError = false; hasError = false;
_parentProductsList.clear(); _parentProductsList.clear();
String endPoint = id != null
? GET_PARENT_PRODUCTS + "$id" + '&page=1&limit=50'
: GET_PARENT_PRODUCTS + "";
await baseAppClient.get( await baseAppClient.get(
GET_PARENT_PRODUCTS, endPoint,
onSuccess: (dynamic response, int statusCode) { onSuccess: (dynamic response, int statusCode) {
response['products'].forEach((item) { response['products'].forEach((item) {
_parentProductsList.add(ParentProductsModel.fromJson(item)); _parentProductsList.add(ParentProductsModel.fromJson(item));
@ -70,4 +88,63 @@ class PharmacyCategoriseService extends BaseService {
}, },
); );
} }
Future getSubCategorise({String id}) async {
hasError = false;
_subCategoriseList.clear();
String endPoint =
id != null ? GET_SUB_CATEGORISE + "$id" : GET_SUB_CATEGORISE + "";
await baseAppClient.get(
endPoint,
onSuccess: (dynamic response, int statusCode) {
response['categories'].forEach((item) {
_subCategoriseList.add(SubCategoriesModel.fromJson(item));
});
},
onFailure: (String error, int statusCode) {
hasError = true;
super.error = error;
},
);
}
Future getSubProducts({String id}) async {
hasError = false;
_subProductsList.clear();
String endPoint = id != null
? GET_SUB_PRODUCTS + "$id" + '&page=1&limit=50'
: GET_SUB_PRODUCTS + "";
await baseAppClient.get(
endPoint,
onSuccess: (dynamic response, int statusCode) {
response['products'].forEach((item) {
_subProductsList.add(SubProductsModel.fromJson(item));
});
},
onFailure: (String error, int statusCode) {
hasError = true;
super.error = error;
},
);
}
Future getFinalProducts({String id}) async {
hasError = false;
_finalProducts.clear();
String endPoint =
id != null ? GET_FINAL_PRODUCTS + "$id" : GET_FINAL_PRODUCTS + "";
await baseAppClient.get(
endPoint,
onSuccess: (dynamic response, int statusCode) {
response['products'].forEach((item) {
_finalProducts.add(FinalProductsModel.fromJson(item));
});
},
onFailure: (String error, int statusCode) {
hasError = true;
super.error = error;
},
);
}
} }

@ -1,7 +1,10 @@
import 'package:diplomaticquarterapp/core/enum/viewstate.dart'; import 'package:diplomaticquarterapp/core/enum/viewstate.dart';
import 'package:diplomaticquarterapp/core/model/pharmacy/categorise_parent_model.dart'; import 'package:diplomaticquarterapp/core/model/pharmacy/categorise_parent_model.dart';
import 'package:diplomaticquarterapp/core/model/pharmacy/final_products_model.dart';
import 'package:diplomaticquarterapp/core/model/pharmacy/parent_products_model.dart'; import 'package:diplomaticquarterapp/core/model/pharmacy/parent_products_model.dart';
import 'package:diplomaticquarterapp/core/model/pharmacy/pharmacy_categorise.dart'; import 'package:diplomaticquarterapp/core/model/pharmacy/pharmacy_categorise.dart';
import 'package:diplomaticquarterapp/core/model/pharmacy/sub_categories_model.dart';
import 'package:diplomaticquarterapp/core/model/pharmacy/sub_products_model.dart';
import 'package:diplomaticquarterapp/core/service/pharmacy_categorise_service.dart'; import 'package:diplomaticquarterapp/core/service/pharmacy_categorise_service.dart';
import 'package:diplomaticquarterapp/locator.dart'; import 'package:diplomaticquarterapp/locator.dart';
@ -21,6 +24,15 @@ class PharmacyCategoriseViewModel extends BaseViewModel {
List<ParentProductsModel> get parentProducts => List<ParentProductsModel> get parentProducts =>
_pharmacyCategoriseService.parentProductsList; _pharmacyCategoriseService.parentProductsList;
List<SubCategoriesModel> get subCategorise =>
_pharmacyCategoriseService.subCategoriseList;
List<SubProductsModel> get subProducts =>
_pharmacyCategoriseService.subProductsList;
List<FinalProductsModel> get finalProducts =>
_pharmacyCategoriseService.finalProducts;
Future getCategorise() async { Future getCategorise() async {
hasError = false; hasError = false;
// _insuranceCardService.clearInsuranceCard(); // _insuranceCardService.clearInsuranceCard();
@ -42,14 +54,50 @@ class PharmacyCategoriseViewModel extends BaseViewModel {
error = _pharmacyCategoriseService.error; error = _pharmacyCategoriseService.error;
setState(ViewState.ErrorLocal); setState(ViewState.ErrorLocal);
} else } else
await getParentProducts(); await getParentProducts(i: i);
}
Future getParentProducts({String i}) async {
hasError = false;
// _insuranceCardService.clearInsuranceCard();
setState(ViewState.Busy);
await _pharmacyCategoriseService.getParentProducts(id: i);
if (_pharmacyCategoriseService.hasError) {
error = _pharmacyCategoriseService.error;
setState(ViewState.ErrorLocal);
} else
setState(ViewState.Idle);
}
Future getSubCategorise({String i}) async {
hasError = false;
// _insuranceCardService.clearInsuranceCard();
setState(ViewState.Busy);
await _pharmacyCategoriseService.getSubCategorise(id: i);
if (_pharmacyCategoriseService.hasError) {
error = _pharmacyCategoriseService.error;
setState(ViewState.ErrorLocal);
} else
getSubProducts(i: i);
}
Future getSubProducts({String i}) async {
hasError = false;
// _insuranceCardService.clearInsuranceCard();
setState(ViewState.Busy);
await _pharmacyCategoriseService.getSubProducts(id: i);
if (_pharmacyCategoriseService.hasError) {
error = _pharmacyCategoriseService.error;
setState(ViewState.ErrorLocal);
} else
setState(ViewState.Idle);
} }
Future getParentProducts() async { Future getFinalProducts({String i}) async {
hasError = false; hasError = false;
// _insuranceCardService.clearInsuranceCard(); // _insuranceCardService.clearInsuranceCard();
setState(ViewState.Busy); setState(ViewState.Busy);
await _pharmacyCategoriseService.getParentProducts(); await _pharmacyCategoriseService.getFinalProducts(id: i);
if (_pharmacyCategoriseService.hasError) { if (_pharmacyCategoriseService.hasError) {
error = _pharmacyCategoriseService.error; error = _pharmacyCategoriseService.error;
setState(ViewState.ErrorLocal); setState(ViewState.ErrorLocal);

@ -0,0 +1,510 @@
import 'package:diplomaticquarterapp/core/viewModels/pharmacy_categorise_view_model.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/network_base_view.dart';
import 'package:flutter/material.dart';
import 'base/base_view.dart';
class FinalProductsPage extends StatelessWidget {
String id;
FinalProductsPage({this.id});
String categoriseName = "Personal Care";
bool styleOne = true;
bool styleTwo = false;
Icon styleIcon = Icon(
Icons.widgets_sharp,
color: Colors.blue,
size: 29.0,
);
@override
Widget build(BuildContext context) {
return BaseView<PharmacyCategoriseViewModel>(
onModelReady: (model) => model.getFinalProducts(i: id),
builder: (BuildContext context, PharmacyCategoriseViewModel model,
Widget child) =>
PharmacyAppScaffold(
appBarTitle: 'Products',
isBottomBar: false,
isShowAppBar: true,
backgroundColor: Colors.white,
isShowDecPage: false,
baseViewModel: model,
body: Container(
height: MediaQuery.of(context).size.height * 1.87,
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
//Expanded widget heree if nassery
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Padding(
padding: EdgeInsets.all(8.0),
child: Texts(
'Products',
fontWeight: FontWeight.w600,
),
),
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: () {
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
? Expanded(
child: Container(
height: MediaQuery.of(context).size.height * 1.90,
child: GridView.builder(
gridDelegate:
SliverGridDelegateWithFixedCrossAxisCount(
crossAxisCount: 2,
crossAxisSpacing: 0.5,
mainAxisSpacing: 2.0,
childAspectRatio: 1.0,
),
itemCount: model.finalProducts.length,
itemBuilder: (BuildContext context, int index) {
return NetworkBaseView(
baseViewModel: model,
child: Card(
color: model.finalProducts[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: [
Container(
margin: EdgeInsets.fromLTRB(
0, 16, 0, 0),
alignment: Alignment.center,
child: Image.network(
model.finalProducts[index]
.images.isNotEmpty
? model
.finalProducts[
index]
.images[0]
.thumb
: 'https://upload.wikimedia.org/wikipedia/commons/thumb/6/6c/No_image_3x4.svg/1200px-No_image_3x4.svg.png',
fit: BoxFit.cover,
height: 80,
),
),
Container(
width: model
.finalProducts[
index]
.rxMessage !=
null
? MediaQuery.of(context)
.size
.width /
2.8
: 0,
padding: EdgeInsets.all(4),
decoration: BoxDecoration(
color: Color(0xffb23838),
borderRadius:
BorderRadius.only(
topLeft: Radius
.circular(6)),
),
child: Texts(
model.finalProducts[index]
.rxMessage !=
null
? model
.finalProducts[
index]
.rxMessage
: "",
color: Colors.white,
regular: true,
fontSize: 10,
fontWeight:
FontWeight.w600,
),
),
],
),
Container(
margin: EdgeInsets.symmetric(
horizontal: 6,
vertical: 0,
),
child: Column(
crossAxisAlignment:
CrossAxisAlignment.start,
children: [
if (model
.finalProducts[
index]
.discountName !=
null)
Container(
width: double.infinity,
height: 13.0,
decoration:
BoxDecoration(
color:
Color(0xff5AB145),
),
child: Center(
child: Texts(
model
.finalProducts[
index]
.discountName,
regular: true,
color: Colors.white,
fontSize: 10.4,
),
),
),
Texts(
model.finalProducts[index]
.name,
regular: true,
fontSize: 12,
fontWeight:
FontWeight.w400,
),
Padding(
padding:
const EdgeInsets.only(
top: 4,
bottom: 4),
child: Texts(
"SAR ${model.finalProducts[index].price}",
bold: true,
fontSize: 14,
),
),
Row(
children: [
StarRating(
totalAverage: model
.finalProducts[
index]
.approvedRatingSum >
0
? (model.finalProducts[index].approvedRatingSum
.toDouble() /
model
.finalProducts[index]
.approvedRatingSum
.toDouble())
.toDouble()
: 0,
forceStars: true),
Texts(
"(${model.finalProducts[index].approvedTotalReviews})",
regular: true,
fontSize: 10,
fontWeight:
FontWeight.w400,
)
],
),
],
),
),
],
),
),
));
},
),
),
)
: Expanded(
child: Container(
child: ListView.builder(
itemCount: model.finalProducts.length,
itemBuilder:
(BuildContext context, int index) {
return Card(
// color:
// model.products[index].discountName !=
// null
// ? Color(0xffFFFF00)
// : Colors.white,
child: Row(
children: [
Stack(
children: [
Column(
children: [
if (model.finalProducts[index]
.discountName !=
null)
Container(
decoration:
BoxDecoration(),
child: Padding(
padding:
EdgeInsets.only(
left: 9.0,
top: 8.0,
right: 10.0,
),
child: Container(
color: Colors.yellow,
height: 25.0,
width: 70.0,
child: Center(
child: Texts(
'offer'
.toUpperCase(),
color: Colors.red,
fontSize: 13.0,
fontWeight:
FontWeight
.w900,
),
),
),
),
transform:
new Matrix4.rotationZ(
6.15099),
),
Container(
margin: EdgeInsets.fromLTRB(
0, 0, 0, 0),
alignment: Alignment.center,
child: Image.network(
model.finalProducts[index]
.images[index].thumb,
fit: BoxFit.cover,
height: 80,
),
),
],
),
Column(
children: [
Container(
width: model
.finalProducts[
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.finalProducts[index]
.rxMessage !=
null
? model
.finalProducts[
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: [
if (model.finalProducts[index]
.discountName !=
null)
Container(
width: 250.0,
height: 18.5,
decoration: BoxDecoration(
color: Color(0xff5AB145),
),
child: Padding(
padding:
EdgeInsets.symmetric(
horizontal: 5.5,
),
child: Texts(
model
.finalProducts[
index]
.discountName,
regular: true,
color: Colors.white,
fontSize: 11.4,
),
),
),
SizedBox(
height: 4.0,
),
Texts(
model.finalProducts[index]
.name,
regular: true,
fontSize: 12,
fontWeight: FontWeight.w400,
),
SizedBox(
height: 8.0,
),
Padding(
padding:
const EdgeInsets.only(
top: 4, bottom: 4),
child: Texts(
"SAR ${model.finalProducts[index].price}",
bold: true,
fontSize: 14,
),
),
Row(
children: [
StarRating(
totalAverage: model
.finalProducts[
index]
.approvedRatingSum >
0
? (model
.finalProducts[
index]
.approvedRatingSum
.toDouble() /
model
.finalProducts[
index]
.approvedRatingSum
.toDouble())
.toDouble()
: 0,
forceStars: true),
Texts(
"(${model.finalProducts[index].approvedTotalReviews})",
regular: true,
fontSize: 10,
fontWeight:
FontWeight.w400,
)
],
),
],
),
),
],
),
);
}),
),
)
],
),
),
));
}
}

@ -44,11 +44,14 @@ class _OffersCategorisePageState extends State<OffersCategorisePage> {
Padding( Padding(
padding: EdgeInsets.all(10.0), padding: EdgeInsets.all(10.0),
child: Container( child: Container(
child: Texts('Categories'), child: Texts(
'Categories',
fontWeight: FontWeight.w800,
),
), ),
), ),
Divider( Divider(
thickness: 2.0, thickness: 1.0,
color: Colors.grey.shade400, color: Colors.grey.shade400,
), ),
//Expanded widget heree if nassery //Expanded widget heree if nassery
@ -89,7 +92,9 @@ class _OffersCategorisePageState extends State<OffersCategorisePage> {
0.09, 0.09,
child: Center( child: Center(
child: Texts( child: Texts(
model.categorise[index].name), model.categorise[index].name,
fontWeight: FontWeight.w600,
),
), ),
), ),
], ],
@ -116,7 +121,10 @@ class _OffersCategorisePageState extends State<OffersCategorisePage> {
children: [ children: [
Padding( Padding(
padding: EdgeInsets.all(8.0), padding: EdgeInsets.all(8.0),
child: Texts(categoriseName), child: Texts(
categoriseName,
fontWeight: FontWeight.w800,
),
), ),
Row( Row(
children: [ children: [
@ -124,7 +132,7 @@ class _OffersCategorisePageState extends State<OffersCategorisePage> {
height: 44.0, height: 44.0,
child: VerticalDivider( child: VerticalDivider(
color: Colors.black45, color: Colors.black45,
thickness: 1.0, thickness: 0.7,
//width: 0.3, //width: 0.3,
// indent: 0.0, // indent: 0.0,
), ),
@ -174,7 +182,7 @@ class _OffersCategorisePageState extends State<OffersCategorisePage> {
crossAxisCount: 2, crossAxisCount: 2,
crossAxisSpacing: 0.5, crossAxisSpacing: 0.5,
mainAxisSpacing: 2.0, mainAxisSpacing: 2.0,
childAspectRatio: 1.2, childAspectRatio: 0.85,
), ),
itemCount: model.products.length, itemCount: model.products.length,
itemBuilder: (BuildContext context, int index) { itemBuilder: (BuildContext context, int index) {
@ -210,6 +218,7 @@ class _OffersCategorisePageState extends State<OffersCategorisePage> {
vertical: 4, vertical: 4,
), ),
child: Container( child: Container(
height: 250.0,
decoration: BoxDecoration( decoration: BoxDecoration(
borderRadius: BorderRadius.only( borderRadius: BorderRadius.only(
topLeft: Radius.circular(110.0), topLeft: Radius.circular(110.0),
@ -321,7 +330,7 @@ class _OffersCategorisePageState extends State<OffersCategorisePage> {
null) null)
Container( Container(
width: double.infinity, width: double.infinity,
height: 13.0, height: 22.0,
decoration: decoration:
BoxDecoration( BoxDecoration(
color: color:
@ -334,22 +343,19 @@ class _OffersCategorisePageState extends State<OffersCategorisePage> {
.discountName, .discountName,
regular: true, regular: true,
color: Colors.white, color: Colors.white,
fontSize: 10.4, fontSize: 12.0,
fontWeight:
FontWeight.w700,
), ),
), ),
), ),
Texts( Texts(
projectProvider.isArabic model
? model .products[index].name,
.products[index]
.name
: model
.products[index]
.namen,
regular: true, regular: true,
fontSize: 12, fontSize: 12.58,
fontWeight: fontWeight:
FontWeight.w400, FontWeight.w600,
), ),
Padding( Padding(
padding: padding:
@ -521,7 +527,7 @@ class _OffersCategorisePageState extends State<OffersCategorisePage> {
null) null)
Container( Container(
width: 250.0, width: 250.0,
height: 18.5, height: 22.5,
decoration: BoxDecoration( decoration: BoxDecoration(
color: Color(0xff5AB145), color: Color(0xff5AB145),
), ),
@ -535,7 +541,9 @@ class _OffersCategorisePageState extends State<OffersCategorisePage> {
.discountName, .discountName,
regular: true, regular: true,
color: Colors.white, color: Colors.white,
fontSize: 11.4, fontSize: 12.0,
fontWeight:
FontWeight.w700,
), ),
), ),
), ),
@ -543,14 +551,10 @@ class _OffersCategorisePageState extends State<OffersCategorisePage> {
height: 4.0, height: 4.0,
), ),
Texts( Texts(
projectProvider.isArabic model.products[index].name,
? model
.products[index].name
: model.products[index]
.namen,
regular: true, regular: true,
fontSize: 12, fontSize: 14.0,
fontWeight: FontWeight.w400, fontWeight: FontWeight.w600,
), ),
SizedBox( SizedBox(
height: 8.0, height: 8.0,
@ -591,7 +595,7 @@ class _OffersCategorisePageState extends State<OffersCategorisePage> {
regular: true, regular: true,
fontSize: 10, fontSize: 10,
fontWeight: fontWeight:
FontWeight.w400, FontWeight.w500,
) )
], ],
), ),

@ -1,5 +1,6 @@
import 'package:diplomaticquarterapp/core/viewModels/pharmacy_categorise_view_model.dart'; import 'package:diplomaticquarterapp/core/viewModels/pharmacy_categorise_view_model.dart';
import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart';
import 'package:diplomaticquarterapp/pages/sub_categorise_page.dart';
import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; import 'package:diplomaticquarterapp/widgets/data_display/text.dart';
import 'package:diplomaticquarterapp/widgets/others/StarRating.dart'; import 'package:diplomaticquarterapp/widgets/others/StarRating.dart';
import 'package:diplomaticquarterapp/widgets/others/app_scaffold_pharmacy_widget.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_pharmacy_widget.dart';
@ -7,8 +8,10 @@ import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart';
import 'package:diplomaticquarterapp/widgets/others/network_base_view.dart'; import 'package:diplomaticquarterapp/widgets/others/network_base_view.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:provider/provider.dart'; import 'package:provider/provider.dart';
import 'package:giffy_dialog/giffy_dialog.dart';
import 'base/base_view.dart'; import 'base/base_view.dart';
import 'final_products_page.dart';
class ParentCategorisePage extends StatelessWidget { class ParentCategorisePage extends StatelessWidget {
final String id; final String id;
@ -16,6 +19,8 @@ class ParentCategorisePage extends StatelessWidget {
ParentCategorisePage({this.id, this.titleName}); ParentCategorisePage({this.id, this.titleName});
String categoriesID;
String categoriseName = "Personal Care"; String categoriseName = "Personal Care";
bool styleOne = true; bool styleOne = true;
bool styleTwo = false; bool styleTwo = false;
@ -38,139 +43,253 @@ class ParentCategorisePage extends StatelessWidget {
backgroundColor: Colors.white, backgroundColor: Colors.white,
isShowDecPage: false, isShowDecPage: false,
baseViewModel: model, baseViewModel: model,
body: Container( body: SingleChildScrollView(
//height: MediaQuery.of(context).size.height * 0.57, child: Container(
child: Column( height: MediaQuery.of(context).size.height * 5.90,
crossAxisAlignment: CrossAxisAlignment.start, child: Column(
children: [ crossAxisAlignment: CrossAxisAlignment.start,
Padding( children: [
padding: EdgeInsets.all(10.0), Container(
child: Container( child: Image.network(
child: Texts(model.categoriseParent.length >= 8 id == '1'
? 'View All Categories' ? '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)
Divider( Column(
thickness: 2.0, crossAxisAlignment: CrossAxisAlignment.start,
color: Colors.grey.shade400, children: [
), Padding(
//Expanded widget heree if nassery padding: EdgeInsets.all(10.0),
Container( child: InkWell(
height: MediaQuery.of(context).size.height * 0.20, child: Container(
child: ListView.builder( child: Texts(
scrollDirection: Axis.horizontal, 'View All Categories',
itemCount: model.categoriseParent.length, fontWeight: FontWeight.w300,
itemBuilder: (BuildContext context, int index) { ),
return Padding( ),
padding: EdgeInsets.all(8.0), onTap: () {
child: Row( showModalBottomSheet<void>(
children: [ context: context,
InkWell( builder: (BuildContext context) {
child: Column( return Container(
children: [ height:
Container( MediaQuery.of(context).size.height *
height: 60.0, 0.9,
width: 65.0, color: Colors.white,
decoration: BoxDecoration( child: Center(
shape: BoxShape.circle, child: Column(
color: Colors.orange.shade200 mainAxisAlignment:
.withOpacity(0.45), MainAxisAlignment.center,
), mainAxisSize: MainAxisSize.min,
child: Icon( children: <Widget>[
Icons.apps_sharp, const Text('Modal BottomSheet'),
size: 32.0, ElevatedButton(
), child: const Text(
), 'Close BottomSheet'),
Container( onPressed: () =>
width: MediaQuery.of(context) Navigator.pop(context),
.size )
.width * ],
0.2,
height: MediaQuery.of(context)
.size
.height *
0.09,
child: Center(
child: Texts(model
.categoriseParent[index].name),
), ),
), ),
], );
), },
), );
], },
), ),
); ),
}), Divider(
), thickness: 1.0,
color: Colors.grey.shade400,
),
],
),
Divider( //Expanded widget heree if nassery
thickness: 1.0, Padding(
color: Colors.grey.shade400, padding: EdgeInsets.only(top: 35.0),
), child: Container(
Row( height: MediaQuery.of(context).size.height * 0.2,
mainAxisAlignment: MainAxisAlignment.spaceBetween, child: Center(
children: [ child: ListView.builder(
Padding( scrollDirection: Axis.horizontal,
padding: EdgeInsets.all(8.0), itemCount: model.categoriseParent.length > 8
child: Texts(categoriseName), ? 8
: model.categoriseParent.length,
itemBuilder: (BuildContext context, int index) {
return Padding(
padding:
EdgeInsets.symmetric(horizontal: 8.0),
child: InkWell(
child: Column(
crossAxisAlignment:
CrossAxisAlignment.center,
children: [
Padding(
padding: EdgeInsets.symmetric(
horizontal: 13.0),
child: Container(
height: 60.0,
width: 65.0,
decoration: BoxDecoration(
shape: BoxShape.circle,
color: Colors.orange.shade200
.withOpacity(0.45),
),
child: Center(
child: Icon(
Icons.apps_sharp,
size: 32.0,
),
),
),
),
Container(
width: MediaQuery.of(context)
.size
.width *
0.17,
height: MediaQuery.of(context)
.size
.height *
0.10,
child: Center(
child: Texts(
model.categoriseParent[index]
.name,
fontSize: 14,
fontWeight: FontWeight.w600,
maxLines: 2,
),
),
),
],
),
onTap: () {
Navigator.push(
context,
MaterialPageRoute(
builder: (context) =>
SubCategorisePage(
title: model
.categoriseParent[index]
.name,
id: model
.categoriseParent[index]
.id,
parentId: id,
)),
);
print(id);
},
),
);
}),
),
), ),
Row( ),
Divider(
thickness: 1.0,
color: Colors.grey.shade400,
),
Padding(
padding: EdgeInsets.symmetric(horizontal: 8.0),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [ children: [
Container( Row(
height: 44.0, children: [
child: VerticalDivider( Icon(
color: Colors.black45, Icons.wrap_text,
thickness: 1.0, ),
//width: 0.3, SizedBox(
// indent: 0.0, width: 10.0,
), ),
Texts(
'Refine',
fontWeight: FontWeight.w600,
),
],
), ),
Padding( Row(
padding: EdgeInsets.all(8.0), children: [
child: InkWell( Container(
child: styleIcon, height: 44.0,
onTap: () { child: VerticalDivider(
if (styleOne == true) { color: Colors.black45,
styleOne = false; thickness: 1.0,
styleTwo = true; //width: 0.3,
styleIcon = Icon( // indent: 0.0,
Icons.auto_awesome_mosaic, ),
color: Colors.blue, ),
size: 29.0, Padding(
); padding: EdgeInsets.all(8.0),
} else { child: InkWell(
styleOne = true; child: styleIcon,
styleTwo = false; onTap: () {
styleIcon = Icon( if (styleOne == true) {
Icons.widgets_sharp, styleOne = false;
color: Colors.blue, styleTwo = true;
size: 29.0, 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(
Divider( thickness: 1.0,
thickness: 1.0, color: Colors.grey.shade400,
color: Colors.grey.shade400, ),
), styleOne == true
styleOne == true ? Container(
? Expanded( height: MediaQuery.of(context).size.height * 4.89,
child: Container(
height: MediaQuery.of(context).size.height * 0.50,
child: GridView.builder( child: GridView.builder(
physics: NeverScrollableScrollPhysics(),
gridDelegate: gridDelegate:
SliverGridDelegateWithFixedCrossAxisCount( SliverGridDelegateWithFixedCrossAxisCount(
crossAxisCount: 2, crossAxisCount: 2,
crossAxisSpacing: 0.5, crossAxisSpacing: 0.5,
mainAxisSpacing: 2.0, mainAxisSpacing: 2.0,
childAspectRatio: 1.2, childAspectRatio: 0.9,
), ),
itemCount: model.parentProducts.length, itemCount: model.parentProducts.length,
itemBuilder: (BuildContext context, int index) { itemBuilder: (BuildContext context, int index) {
@ -260,9 +379,16 @@ class ParentCategorisePage extends StatelessWidget {
alignment: Alignment.center, alignment: Alignment.center,
child: Image.network( child: Image.network(
model model
.parentProducts[index] .parentProducts[
.images[index] index]
.thumb, .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, fit: BoxFit.cover,
height: 80, height: 80,
), ),
@ -341,19 +467,13 @@ class ParentCategorisePage extends StatelessWidget {
), ),
), ),
Texts( Texts(
projectProvider.isArabic model
? model .parentProducts[index]
.parentProducts[ .name,
index]
.name
: model
.parentProducts[
index]
.namen,
regular: true, regular: true,
fontSize: 12, fontSize: 12,
fontWeight: fontWeight:
FontWeight.w400, FontWeight.w700,
), ),
Padding( Padding(
padding: padding:
@ -401,228 +521,233 @@ class ParentCategorisePage extends StatelessWidget {
)); ));
}, },
), ),
), )
) : Expanded(
: Expanded( child: Container(
child: Container( child: ListView.builder(
child: ListView.builder( itemCount: model.parentProducts.length,
itemCount: model.parentProducts.length, itemBuilder:
itemBuilder: (BuildContext context, int index) {
(BuildContext context, int index) { return Card(
return Card( // color:
// color: // model.products[index].discountName !=
// model.products[index].discountName != // null
// null // ? Color(0xffFFFF00)
// ? Color(0xffFFFF00) // : Colors.white,
// : Colors.white, child: Row(
child: Row( children: [
children: [ Stack(
Stack( children: [
children: [ Column(
Column( children: [
children: [ if (model
if (model .parentProducts[
.parentProducts[index] index]
.discountName != .discountName !=
null) null)
Container( Container(
decoration: decoration:
BoxDecoration(), BoxDecoration(),
child: Padding( child: Padding(
padding: padding:
EdgeInsets.only( EdgeInsets.only(
left: 9.0, left: 9.0,
top: 8.0, top: 8.0,
right: 10.0, right: 10.0,
), ),
child: Container( child: Container(
color: Colors.yellow, color:
height: 25.0, Colors.yellow,
width: 70.0, height: 25.0,
child: Center( width: 70.0,
child: Texts( child: Center(
'offer' child: Texts(
.toUpperCase(), 'offer'
color: Colors.red, .toUpperCase(),
fontSize: 13.0, color:
fontWeight: Colors.red,
FontWeight fontSize: 13.0,
.w900, fontWeight:
FontWeight
.w900,
),
), ),
), ),
), ),
transform: new Matrix4
.rotationZ(6.15099),
), ),
transform: Container(
new Matrix4.rotationZ( margin:
6.15099), EdgeInsets.fromLTRB(
), 0, 0, 0, 0),
Container( alignment:
margin: EdgeInsets.fromLTRB( Alignment.center,
0, 0, 0, 0), child: Image.network(
alignment: Alignment.center, model
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,
),
),
],
),
Column(
children: [
Container(
width: model
.parentProducts[ .parentProducts[
index] index]
.rxMessage != .images
null .isNotEmpty
? MediaQuery.of(context) ? model
.size .parentProducts[
.width / index]
5 .images[0]
: 0, .thumb
padding: EdgeInsets.all(4), : 'https://upload.wikimedia.org/wikipedia/commons/thumb/6/6c/No_image_3x4.svg/1200px-No_image_3x4.svg.png',
decoration: BoxDecoration( fit: BoxFit.cover,
color: Color(0xffb23838), height: 80,
borderRadius: ),
BorderRadius.only(
topLeft: Radius
.circular(6)),
), ),
child: Texts( ],
model ),
Column(
children: [
Container(
width: model
.parentProducts[ .parentProducts[
index] index]
.rxMessage != .rxMessage !=
null null
? model ? MediaQuery.of(
.parentProducts[ context)
index] .size
.rxMessage .width /
: "", 5
color: Colors.white, : 0,
regular: true,
fontSize: 10,
fontWeight:
FontWeight.w400,
),
),
],
),
],
),
Container(
margin: EdgeInsets.symmetric(
horizontal: 6,
vertical: 0,
),
child: Column(
crossAxisAlignment:
CrossAxisAlignment.start,
children: [
if (model.parentProducts[index]
.discountName !=
null)
Container(
width: 250.0,
height: 18.5,
decoration: BoxDecoration(
color: Color(0xff5AB145),
),
child: Padding(
padding: padding:
EdgeInsets.symmetric( EdgeInsets.all(4),
horizontal: 5.5, decoration: BoxDecoration(
color:
Color(0xffb23838),
borderRadius:
BorderRadius.only(
topLeft: Radius
.circular(
6)),
), ),
child: Texts( child: Texts(
model model
.parentProducts[ .parentProducts[
index] index]
.discountName, .rxMessage !=
regular: true, null
? model
.parentProducts[
index]
.rxMessage
: "",
color: Colors.white, color: Colors.white,
fontSize: 11.4, regular: true,
fontSize: 10,
fontWeight:
FontWeight.w400,
), ),
), ),
),
SizedBox(
height: 4.0,
),
Texts(
projectProvider.isArabic
? model
.parentProducts[index]
.name
: model
.parentProducts[index]
.namen,
regular: true,
fontSize: 12,
fontWeight: FontWeight.w400,
),
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,
)
], ],
), ),
], ],
), ),
), Container(
], margin: EdgeInsets.symmetric(
), horizontal: 6,
); vertical: 0,
}), ),
), child: Column(
) crossAxisAlignment:
], CrossAxisAlignment.start,
children: [
if (model
.parentProducts[index]
.discountName !=
null)
Container(
width: 250.0,
height: 18.5,
decoration: BoxDecoration(
color:
Color(0xff5AB145),
),
child: Padding(
padding: EdgeInsets
.symmetric(
horizontal: 5.5,
),
child: Texts(
model
.parentProducts[
index]
.discountName,
regular: true,
color: Colors.white,
fontSize: 11.4,
),
),
),
SizedBox(
height: 4.0,
),
Texts(
model.parentProducts[index]
.name,
regular: true,
fontSize: 12,
fontWeight: FontWeight.w400,
),
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,
)
],
),
],
),
),
],
),
);
}),
),
)
],
),
), ),
), ),
)); ));

@ -6,6 +6,7 @@ import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'base/base_view.dart'; import 'base/base_view.dart';
import 'final_products_page.dart';
class PharmacyCategorisePage extends StatefulWidget { class PharmacyCategorisePage extends StatefulWidget {
@override @override
@ -13,6 +14,8 @@ class PharmacyCategorisePage extends StatefulWidget {
} }
class _PharmacyCategorisePageState extends State<PharmacyCategorisePage> { class _PharmacyCategorisePageState extends State<PharmacyCategorisePage> {
String idCategorise;
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return BaseView<PharmacyCategoriseViewModel>( return BaseView<PharmacyCategoriseViewModel>(
@ -44,18 +47,27 @@ class _PharmacyCategorisePageState extends State<PharmacyCategorisePage> {
borderRadius: BorderRadius.circular(5), borderRadius: BorderRadius.circular(5),
color: Colors.grey.withOpacity(0.24), color: Colors.grey.withOpacity(0.24),
), ),
child: Center( child: Padding(
child: Texts(model.categorise[index].name), padding: EdgeInsets.symmetric(horizontal: 10.0),
child: Texts(
model.categorise[index].name,
fontWeight: FontWeight.w600,
),
), ),
), ),
onTap: () => { onTap: () => {
Navigator.push( Navigator.push(
context, context,
MaterialPageRoute( MaterialPageRoute(
builder: (context) => ParentCategorisePage( builder: (context) =>
id: model.categorise[index].id, model.categorise[index].id != '12'
titleName: model.categorise[index].name, ? ParentCategorisePage(
), id: model.categorise[index].id,
titleName: model.categorise[index].name,
)
: FinalProductsPage(
id: model.categorise[index].id,
),
), ),
), ),
}, },
@ -70,7 +82,7 @@ class _PharmacyCategorisePageState extends State<PharmacyCategorisePage> {
children: [ children: [
Divider( Divider(
height: 2.0, height: 2.0,
thickness: 2.0, thickness: 1.0,
color: Colors.black12.withOpacity(0.14)), color: Colors.black12.withOpacity(0.14)),
SizedBox( SizedBox(
height: 15.0, height: 15.0,
@ -87,10 +99,13 @@ class _PharmacyCategorisePageState extends State<PharmacyCategorisePage> {
borderRadius: BorderRadius.circular(5.0), borderRadius: BorderRadius.circular(5.0),
color: Colors.green.shade300.withOpacity(0.34), color: Colors.green.shade300.withOpacity(0.34),
), ),
child: Center( child: Padding(
child: Texts( padding: EdgeInsets.symmetric(horizontal: 10.0),
'best sellers', child: Texts(
)), 'best sellers',
fontWeight: FontWeight.w600,
),
),
), ),
), ),
), ),
@ -105,7 +120,13 @@ class _PharmacyCategorisePageState extends State<PharmacyCategorisePage> {
.withOpacity(0.34), .withOpacity(0.34),
borderRadius: BorderRadius.circular(5.0), borderRadius: BorderRadius.circular(5.0),
), ),
child: Center(child: Texts('Most Viewed')), child: Padding(
padding: EdgeInsets.symmetric(horizontal: 10.0),
child: Texts(
'Most Viewed',
fontWeight: FontWeight.w600,
),
),
), ),
), ),
), ),
@ -123,7 +144,13 @@ class _PharmacyCategorisePageState extends State<PharmacyCategorisePage> {
color: Colors.blue.shade200.withOpacity(0.34), color: Colors.blue.shade200.withOpacity(0.34),
borderRadius: BorderRadius.circular(5.0), borderRadius: BorderRadius.circular(5.0),
), ),
child: Center(child: Texts('New Proudcts')), child: Padding(
padding: EdgeInsets.symmetric(horizontal: 10.0),
child: Texts(
'New Proudcts',
fontWeight: FontWeight.w600,
),
),
), ),
), ),
), ),
@ -137,7 +164,13 @@ class _PharmacyCategorisePageState extends State<PharmacyCategorisePage> {
color: Colors.purple.shade200.withOpacity(0.34), color: Colors.purple.shade200.withOpacity(0.34),
borderRadius: BorderRadius.circular(5.0), borderRadius: BorderRadius.circular(5.0),
), ),
child: Center(child: Texts('Recently Viewed')), child: Padding(
padding: EdgeInsets.symmetric(horizontal: 10.0),
child: Texts(
'Recently Viewed',
fontWeight: FontWeight.w600,
),
),
), ),
), ),
), ),

@ -0,0 +1,688 @@
import 'package:diplomaticquarterapp/core/viewModels/pharmacy_categorise_view_model.dart';
import 'package:diplomaticquarterapp/core/viewModels/project_view_model.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/network_base_view.dart';
import 'package:flutter/material.dart';
import 'package:provider/provider.dart';
import 'base/base_view.dart';
import 'final_products_page.dart';
class SubCategorisePage extends StatelessWidget {
String parentId;
String id;
String title;
SubCategorisePage({this.id, this.title, this.parentId});
String categoriseName = "Personal Care";
bool styleOne = true;
bool styleTwo = false;
Icon styleIcon = Icon(
Icons.widgets_sharp,
color: Colors.blue,
size: 29.0,
);
@override
Widget build(BuildContext context) {
ProjectViewModel projectProvider = Provider.of(context);
return BaseView<PharmacyCategoriseViewModel>(
onModelReady: (model) => model.getSubCategorise(i: id),
builder: (BuildContext context, PharmacyCategoriseViewModel model,
Widget child) =>
PharmacyAppScaffold(
appBarTitle: title,
isBottomBar: false,
isShowAppBar: true,
backgroundColor: Colors.white,
isShowDecPage: false,
baseViewModel: model,
body: SingleChildScrollView(
child: Container(
height: MediaQuery.of(context).size.height * 2.97,
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Container(
child: Image.network(
parentId == '1'
? 'https://uat.hmgwebservices.com/epharmacy/content/images/thumbs/0089188_personal-care_2.png'
: parentId == '2'
? 'https://uat.hmgwebservices.com/epharmacy/content/images/thumbs/0089189_skin-care_2.png'
: parentId == '3'
? 'https://uat.hmgwebservices.com/epharmacy/content/images/thumbs/0089190_health-care_2.png'
: parentId == '4'
? 'https://uat.hmgwebservices.com/epharmacy/content/images/thumbs/0089191_sexual-health_2.png'
: parentId == '5'
? 'https://uat.hmgwebservices.com/epharmacy/content/images/thumbs/0089192_beauty_2.png'
: parentId == '6'
? 'https://uat.hmgwebservices.com/epharmacy/content/images/thumbs/0089193_baby-child_2.png'
: parentId == '7'
? 'https://uat.hmgwebservices.com/epharmacy/content/images/thumbs/0089194_vitamins-supplements_2.png'
: parentId == '8'
? 'https://uat.hmgwebservices.com/epharmacy/content/images/thumbs/0089195_diet-nutrition_2.png'
: parentId == '9'
? 'https://uat.hmgwebservices.com/epharmacy/content/images/thumbs/0089196_household_2.png'
: parentId ==
'10'
? '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.subCategorise.length >= 8)
Column(
children: [
Padding(
padding: EdgeInsets.all(10.0),
child: Container(
child: Texts(model.categoriseParent.length >= 8
? 'View All Categories'
: ''),
),
),
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.subCategorise.length,
itemBuilder: (BuildContext context, int index) {
return Padding(
padding:
EdgeInsets.symmetric(horizontal: 8.0),
child: InkWell(
child: Column(
crossAxisAlignment:
CrossAxisAlignment.center,
children: [
Padding(
padding: EdgeInsets.symmetric(
horizontal: 13.0),
child: Container(
height: 60.0,
width: 65.0,
decoration: BoxDecoration(
shape: BoxShape.circle,
color: Colors.orange.shade200
.withOpacity(0.45),
),
child: Center(
child: Icon(
Icons.apps_sharp,
size: 32.0,
),
),
),
),
Container(
width: MediaQuery.of(context)
.size
.width *
0.17,
height: MediaQuery.of(context)
.size
.height *
0.10,
child: Center(
child: Texts(
model.subCategorise[index].name,
fontSize: 14,
fontWeight: FontWeight.w600,
maxLines: 2,
),
),
),
],
),
onTap: () {
Navigator.push(
context,
MaterialPageRoute(
builder: (context) =>
FinalProductsPage(
id: model.subCategorise[index].id,
),
),
);
},
),
);
}),
),
),
),
Divider(
thickness: 1.0,
color: Colors.grey.shade400,
),
Padding(
padding: EdgeInsets.symmetric(horizontal: 8.0),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Row(
children: [
Icon(Icons.wrap_text),
SizedBox(
width: 10.0,
),
Texts('Refine'),
],
),
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: () {
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: MediaQuery.of(context).size.height * 1.85,
child: GridView.builder(
physics: NeverScrollableScrollPhysics(),
gridDelegate:
SliverGridDelegateWithFixedCrossAxisCount(
crossAxisCount: 2,
crossAxisSpacing: 0.5,
mainAxisSpacing: 2.0,
childAspectRatio: 1.0,
),
itemCount: model.subProducts.length,
itemBuilder: (BuildContext context, int index) {
return NetworkBaseView(
baseViewModel: model,
child: Card(
color: model.subProducts[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.subProducts[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.subProducts[index]
.images.isNotEmpty
? model
.subProducts[
index]
.images[0]
.thumb
: 'https://upload.wikimedia.org/wikipedia/commons/thumb/6/6c/No_image_3x4.svg/1200px-No_image_3x4.svg.png',
fit: BoxFit.cover,
height: 80,
),
),
Container(
width: model
.subProducts[
index]
.rxMessage !=
null
? MediaQuery.of(context)
.size
.width /
5
: 0,
padding: EdgeInsets.all(4),
decoration: BoxDecoration(
color: Color(0xffb23838),
borderRadius:
BorderRadius.only(
topLeft: Radius
.circular(6)),
),
child: Texts(
model.subProducts[index]
.rxMessage !=
null
? model
.subProducts[
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: [
if (model.subProducts[index]
.discountName !=
null)
Container(
width: double.infinity,
height: 13.0,
decoration:
BoxDecoration(
color:
Color(0xff5AB145),
),
child: Center(
child: Texts(
model
.subProducts[
index]
.discountName,
regular: true,
color: Colors.white,
fontSize: 10.4,
),
),
),
Texts(
model.subProducts[index]
.name,
regular: true,
fontSize: 12,
fontWeight:
FontWeight.w400,
),
Padding(
padding:
const EdgeInsets.only(
top: 4,
bottom: 4),
child: Texts(
"SAR ${model.subProducts[index].price}",
bold: true,
fontSize: 14,
),
),
Row(
children: [
StarRating(
totalAverage: model
.subProducts[
index]
.approvedRatingSum >
0
? (model.subProducts[index].approvedRatingSum
.toDouble() /
model
.subProducts[index]
.approvedRatingSum
.toDouble())
.toDouble()
: 0,
forceStars: true),
Texts(
"(${model.subProducts[index].approvedTotalReviews})",
regular: true,
fontSize: 10,
fontWeight:
FontWeight.w400,
)
],
),
],
),
),
],
),
),
));
},
),
)
: Expanded(
child: Container(
child: ListView.builder(
itemCount: model.subProducts.length,
itemBuilder:
(BuildContext context, int index) {
return Card(
// color:
// model.products[index].discountName !=
// null
// ? Color(0xffFFFF00)
// : Colors.white,
child: Row(
children: [
Stack(
children: [
Column(
children: [
if (model.subProducts[index]
.discountName !=
null)
Container(
decoration:
BoxDecoration(),
child: Padding(
padding:
EdgeInsets.only(
left: 9.0,
top: 8.0,
right: 10.0,
),
child: Container(
color:
Colors.yellow,
height: 25.0,
width: 70.0,
child: Center(
child: Texts(
'offer'
.toUpperCase(),
color:
Colors.red,
fontSize: 13.0,
fontWeight:
FontWeight
.w900,
),
),
),
),
transform: new Matrix4
.rotationZ(6.15099),
),
Container(
margin:
EdgeInsets.fromLTRB(
0, 0, 0, 0),
alignment:
Alignment.center,
child: Image.network(
model
.subProducts[index]
.images[index]
.thumb,
fit: BoxFit.cover,
height: 80,
),
),
],
),
Column(
children: [
Container(
width: model
.subProducts[
index]
.rxMessage !=
null
? MediaQuery.of(
context)
.size
.width /
5
: 0,
padding:
EdgeInsets.all(4),
decoration: BoxDecoration(
color:
Color(0xffb23838),
borderRadius:
BorderRadius.only(
topLeft: Radius
.circular(
6)),
),
child: Texts(
model.subProducts[index]
.rxMessage !=
null
? model
.subProducts[
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: [
if (model.subProducts[index]
.discountName !=
null)
Container(
width: 250.0,
height: 18.5,
decoration: BoxDecoration(
color:
Color(0xff5AB145),
),
child: Padding(
padding: EdgeInsets
.symmetric(
horizontal: 5.5,
),
child: Texts(
model
.subProducts[
index]
.discountName,
regular: true,
color: Colors.white,
fontSize: 11.4,
),
),
),
SizedBox(
height: 4.0,
),
Texts(
projectProvider.isArabic
? model
.subProducts[index]
.name
: model
.subProducts[index]
.namen,
regular: true,
fontSize: 12,
fontWeight: FontWeight.w400,
),
SizedBox(
height: 8.0,
),
Padding(
padding:
const EdgeInsets.only(
top: 4, bottom: 4),
child: Texts(
"SAR ${model.subProducts[index].price}",
bold: true,
fontSize: 14,
),
),
Row(
children: [
StarRating(
totalAverage: model
.subProducts[
index]
.approvedRatingSum >
0
? (model
.subProducts[
index]
.approvedRatingSum
.toDouble() /
model
.subProducts[
index]
.approvedRatingSum
.toDouble())
.toDouble()
: 0,
forceStars: true),
Texts(
"(${model.subProducts[index].approvedTotalReviews})",
regular: true,
fontSize: 10,
fontWeight:
FontWeight.w400,
)
],
),
],
),
),
],
),
);
}),
),
)
],
),
),
),
));
}
}
Loading…
Cancel
Save