offers page

merge-requests/225/head
hussam al-habibeh 5 years ago
parent e74e168e88
commit 69a6bc2812

@ -354,7 +354,11 @@ const GET_CHECK_UP_ITEMS = "Services/Patients.svc/REST/GetCheckUpItems";
const GET_PHARMACY_CATEGORISE =
'epharmacy/api/categories?fields=id,name,namen,description,image,localized_names,display_order,parent_category_id,is_leaf&parent_id=0';
const GET_OFFERS_CATEGORISE = 'epharmacy/api/discountcategories';
const GET_OFFERS_PRODUCTS = 'epharmacy/api/offerproducts/12';
const GET_OFFERS_PRODUCTS = 'epharmacy/api/offerproducts/';
const GET_CATEGORISE_PARENT =
'epharmacy/api/categories?fields=id,name,namen,description,image,localized_names,display_order,parent_category_id,is_leaf&parent_id=';
const GET_PARENT_PRODUCTS =
'epharmacy/api/products?categoryid=1&page=1&limit=50';
const TIMER_MIN = 10;

@ -0,0 +1,75 @@
class CategoriseParentModel {
String id;
String name;
String namen;
List<LocalizedNames> localizedNames;
dynamic description;
int parentCategoryId;
int displayOrder;
dynamic image;
bool isLeaf;
CategoriseParentModel(
{this.id,
this.name,
this.namen,
this.localizedNames,
this.description,
this.parentCategoryId,
this.displayOrder,
this.image,
this.isLeaf});
CategoriseParentModel.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,560 @@
class ParentProductsModel {
String id;
bool visibleIndividually;
String name;
String namen;
List<LocalizedNames> localizedNames;
dynamic shortDescription;
dynamic shortDescriptionn;
String fullDescription;
String fullDescriptionn;
bool markasNew;
bool showOnHomePage;
String metaKeywords;
String metaDescription;
String 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;
double price;
dynamic oldPrice;
double 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<dynamic> manufacturerIds;
List<dynamic> reviews;
List<Images> images;
List<dynamic> attributes;
List<Specifications> specifications;
List<dynamic> associatedProductIds;
List<dynamic> tags;
dynamic vendorId;
String seName;
ParentProductsModel(
{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});
ParentProductsModel.fromJson(Map<String, dynamic> json) {
id = json['id'];
visibleIndividually = json['visible_individually'];
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));
});
}
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.images != null) {
data['images'] = this.images.map((v) => v.toJson()).toList();
}
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;
}
}

@ -10,6 +10,14 @@ class OffersCategoriseService extends BaseService {
List<OfferProductsModel> _offerProducts = List();
List<OfferProductsModel> get offersProducts => _offerProducts;
clearCategorise() {
_offerProducts.clear();
}
// clearCategorise2() {
// _offersList.clear();
// }
Future getOffersCategorise() async {
hasError = false;
_offersList.clear();
@ -27,11 +35,13 @@ class OffersCategoriseService extends BaseService {
);
}
Future getOffersProducts() async {
Future getOffersProducts({String id}) async {
hasError = false;
_offerProducts.clear();
String endPoint =
id != null ? GET_OFFERS_PRODUCTS + "$id" : GET_OFFERS_PRODUCTS + "1";
await baseAppClient.get(
GET_OFFERS_PRODUCTS,
endPoint,
onSuccess: (dynamic response, int statusCode) {
response['products'].forEach((item) {
_offerProducts.add(OfferProductsModel.fromJson(item));

@ -1,12 +1,23 @@
import 'package:diplomaticquarterapp/config/config.dart';
import 'package:diplomaticquarterapp/core/model/pharmacy/categorise_parent_model.dart';
import 'package:diplomaticquarterapp/core/model/pharmacy/parent_products_model.dart';
import 'package:diplomaticquarterapp/core/model/pharmacy/pharmacy_categorise.dart';
import 'base_service.dart';
class PharmacyCategoriseService extends BaseService {
//service one
List<PharmacyCategorise> _categoriseList = List();
List<PharmacyCategorise> get categoriseList => _categoriseList;
//service two
List<CategoriseParentModel> _parentCategoriseList = List();
List<CategoriseParentModel> get parentCategoriseList => _parentCategoriseList;
//service three
List<ParentProductsModel> _parentProductsList = List();
List<ParentProductsModel> get parentProductsList => _parentProductsList;
Future getCategorise() async {
hasError = false;
_categoriseList.clear();
@ -23,4 +34,40 @@ class PharmacyCategoriseService extends BaseService {
},
);
}
Future getCategoriseParent({String id}) async {
hasError = false;
_parentCategoriseList.clear();
String endPoint =
id != null ? GET_CATEGORISE_PARENT + "$id" : GET_CATEGORISE_PARENT + "";
await baseAppClient.get(
endPoint,
onSuccess: (dynamic response, int statusCode) {
response['categories'].forEach((item) {
_parentCategoriseList.add(CategoriseParentModel.fromJson(item));
});
},
onFailure: (String error, int statusCode) {
hasError = true;
super.error = error;
},
);
}
Future getParentProducts() async {
hasError = false;
_parentProductsList.clear();
await baseAppClient.get(
GET_PARENT_PRODUCTS,
onSuccess: (dynamic response, int statusCode) {
response['products'].forEach((item) {
_parentProductsList.add(ParentProductsModel.fromJson(item));
});
},
onFailure: (String error, int statusCode) {
hasError = true;
super.error = error;
},
);
}
}

@ -18,7 +18,7 @@ class OffersCategoriseViewModel extends BaseViewModel {
Future getOffersCategorise() async {
hasError = false;
// _insuranceCardService.clearInsuranceCard();
_offersCategoriseService.clearCategorise();
setState(ViewState.Busy);
await _offersCategoriseService.getOffersCategorise();
if (_offersCategoriseService.hasError) {
@ -28,11 +28,11 @@ class OffersCategoriseViewModel extends BaseViewModel {
await getOffersProducts();
}
Future getOffersProducts() async {
Future getOffersProducts({String i}) async {
hasError = false;
// _insuranceCardService.clearInsuranceCard();
// setState(ViewState.Busy);
await _offersCategoriseService.getOffersProducts();
setState(ViewState.Busy);
await _offersCategoriseService.getOffersProducts(id: i);
if (_offersCategoriseService.hasError) {
error = _offersCategoriseService.error;
setState(ViewState.ErrorLocal);

@ -1,4 +1,6 @@
import 'package:diplomaticquarterapp/core/enum/viewstate.dart';
import 'package:diplomaticquarterapp/core/model/pharmacy/categorise_parent_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/service/pharmacy_categorise_service.dart';
import 'package:diplomaticquarterapp/locator.dart';
@ -9,9 +11,16 @@ class PharmacyCategoriseViewModel extends BaseViewModel {
bool hasError = false;
PharmacyCategoriseService _pharmacyCategoriseService =
locator<PharmacyCategoriseService>();
List<PharmacyCategorise> get categorise =>
_pharmacyCategoriseService.categoriseList;
List<CategoriseParentModel> get categoriseParent =>
_pharmacyCategoriseService.parentCategoriseList;
List<ParentProductsModel> get parentProducts =>
_pharmacyCategoriseService.parentProductsList;
Future getCategorise() async {
hasError = false;
// _insuranceCardService.clearInsuranceCard();
@ -23,4 +32,28 @@ class PharmacyCategoriseViewModel extends BaseViewModel {
} else
setState(ViewState.Idle);
}
Future getCategoriseParent({String i}) async {
hasError = false;
// _insuranceCardService.clearInsuranceCard();
setState(ViewState.Busy);
await _pharmacyCategoriseService.getCategoriseParent(id: i);
if (_pharmacyCategoriseService.hasError) {
error = _pharmacyCategoriseService.error;
setState(ViewState.ErrorLocal);
} else
await getParentProducts();
}
Future getParentProducts() async {
hasError = false;
// _insuranceCardService.clearInsuranceCard();
setState(ViewState.Busy);
await _pharmacyCategoriseService.getParentProducts();
if (_pharmacyCategoriseService.hasError) {
error = _pharmacyCategoriseService.error;
setState(ViewState.ErrorLocal);
} else
setState(ViewState.Idle);
}
}

@ -146,7 +146,6 @@ void setupLocator() {
locator.registerLazySingleton(() => PharmacyModuleService());
/// View Model
locator.registerFactory(() => HospitalViewModel());
locator.registerFactory(() => PharmacyViewModel());
@ -190,12 +189,8 @@ void setupLocator() {
locator.registerFactory(() => HomeHealthCareViewModel());
locator.registerFactory(() => CMCViewModel());
locator.registerFactory(() => PharmacyModuleViewModel());
//pharmacy
locator.registerFactory(() => PharmacyCategoriseViewModel());
locator.registerFactory(() => OffersCategoriseViewModel());

@ -483,8 +483,6 @@ class _HomePageState extends State<HomePage> {
opacity: 0.5,
),
DashboardItem(
onTap: () => Navigator.push(context, FadePage(page: PharmacyPage())),
child: Center(
child: Padding(
padding: const EdgeInsets.all(15.0),
@ -512,10 +510,12 @@ class _HomePageState extends State<HomePage> {
height: MediaQuery.of(context).size.width * 0.4,
imageName: 'al-habib_onlne_pharmacy_bg.png',
onTap: () => Navigator.push(
context, FadePage(page: LandingPagePharmacy())),
context,
FadePage(page: LandingPagePharmacy()),
),
),
DashboardItem(
onTap: (){
onTap: () {
Navigator.push(
context,
FadePage(
@ -829,8 +829,10 @@ class DashboardItem extends StatelessWidget {
? DecorationImage(
image: ExactAssetImage('assets/images/$imageName'),
fit: BoxFit.cover,
colorFilter: hasColorFilter ? new ColorFilter.mode(
Colors.black.withOpacity(0.2), BlendMode.dstIn) : null,
colorFilter: hasColorFilter
? new ColorFilter.mode(
Colors.black.withOpacity(0.2), BlendMode.dstIn)
: null,
)
: null,
),

@ -1,4 +1,5 @@
import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart';
import 'package:diplomaticquarterapp/pages/parent_categorise_page.dart';
import 'package:diplomaticquarterapp/pages/pharmacy_categorise.dart';
import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart';
import 'package:diplomaticquarterapp/widgets/drawer/app_drawer_widget.dart';
@ -114,7 +115,7 @@ class _LandingPagePharmacyState extends State<LandingPagePharmacy> {
],
centerTitle: true,
),
extendBody: true,
extendBody: false,
body: PageView(
physics: NeverScrollableScrollPhysics(),
controller: pageController,
@ -124,9 +125,7 @@ class _LandingPagePharmacyState extends State<LandingPagePharmacy> {
),
PharmacyCategorisePage(),
OffersCategorisePage(),
Container(
child: Center(child: Text('This Is My Account Page')),
),
ParentCategorisePage(),
Container(
child: Center(child: Text('This Is Cart Page')),
),

@ -1,8 +1,12 @@
import 'package:diplomaticquarterapp/config/size_config.dart';
import 'package:diplomaticquarterapp/core/viewModels/offers_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_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';
@ -12,17 +16,28 @@ class OffersCategorisePage extends StatefulWidget {
}
class _OffersCategorisePageState extends State<OffersCategorisePage> {
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<OffersCategoriseViewModel>(
onModelReady: (model) => model.getOffersCategorise(),
builder: (BuildContext context, OffersCategoriseViewModel model,
Widget child) =>
AppScaffold(
backgroundColor: Colors.white,
isShowDecPage: false,
baseViewModel: model,
body: Container(
height: MediaQuery.of(context).size.height * 0.58,
//height: MediaQuery.of(context).size.height * 0.57,
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
@ -36,59 +51,64 @@ class _OffersCategorisePageState extends State<OffersCategorisePage> {
thickness: 2.0,
color: Colors.grey.shade400,
),
Expanded(
child: Container(
child: ListView.builder(
scrollDirection: Axis.horizontal,
itemCount: model.categorise.length,
itemBuilder: (BuildContext context, int index) {
return Padding(
padding: EdgeInsets.all(8.0),
child: Row(
children: [
InkWell(
child: Column(
children: [
Container(
height: 60.0,
width: 65.0,
decoration: BoxDecoration(
shape: BoxShape.circle,
color: Colors.orange.shade200
.withOpacity(0.45),
),
child: Icon(
Icons.apps_sharp,
size: 32.0,
),
//Expanded widget heree if nassery
Container(
height: MediaQuery.of(context).size.height * 0.20,
child: ListView.builder(
scrollDirection: Axis.horizontal,
itemCount: model.categorise.length,
itemBuilder: (BuildContext context, int index) {
return Padding(
padding: EdgeInsets.all(8.0),
child: Row(
children: [
InkWell(
child: Column(
children: [
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.2,
height: MediaQuery.of(context)
.size
.height *
0.08,
child: Center(
child: Texts(model
.categorise[index].name),
),
child: Icon(
Icons.apps_sharp,
size: 32.0,
),
],
),
onTap: () {
model.getOffersProducts();
}),
],
),
);
}),
),
),
Container(
width: MediaQuery.of(context)
.size
.width *
0.2,
height: MediaQuery.of(context)
.size
.height *
0.09,
child: Center(
child: Texts(
model.categorise[index].name),
),
),
],
),
onTap: () {
model.getOffersProducts(
i: model.categorise[index].id);
String ids = model.categorise[index].id;
categoriseName =
model.categorise[index].name;
}),
],
),
);
}),
),
Divider(
thickness: 2.0,
thickness: 1.0,
color: Colors.grey.shade400,
),
Row(
@ -96,7 +116,7 @@ class _OffersCategorisePageState extends State<OffersCategorisePage> {
children: [
Padding(
padding: EdgeInsets.all(8.0),
child: Texts('Parsonal Care'),
child: Texts(categoriseName),
),
Row(
children: [
@ -104,17 +124,36 @@ class _OffersCategorisePageState extends State<OffersCategorisePage> {
height: 44.0,
child: VerticalDivider(
color: Colors.black45,
thickness: 1.5,
thickness: 1.0,
//width: 0.3,
// indent: 0.0,
),
),
Padding(
padding: EdgeInsets.all(8.0),
child: Icon(
Icons.widgets_sharp,
color: Colors.blue,
size: 29.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,
);
}
});
},
),
),
],
@ -122,49 +161,452 @@ class _OffersCategorisePageState extends State<OffersCategorisePage> {
],
),
Divider(
thickness: 2.0,
thickness: 1.0,
color: Colors.grey.shade400,
),
Expanded(
child: Container(
child: GridView.builder(
gridDelegate:
SliverGridDelegateWithFixedCrossAxisCount(
crossAxisCount: 2,
crossAxisSpacing: 0.2,
mainAxisSpacing: 7.0,
childAspectRatio: 3.2,
),
itemCount: model.products.length,
itemBuilder: (BuildContext context, int index) {
return Padding(
padding: EdgeInsets.all(4.0),
child: Container(
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(1),
color: Colors.grey.withOpacity(0.24),
),
child: Column(
children: [
Container(
child: Image.network(model
.products[index].images.isNotEmpty
? model
.products[index].images[0].thumb
: 'https://upload.wikimedia.org/wikipedia/commons/thumb/6/6c/No_image_3x4.svg/1200px-No_image_3x4.svg.png'),
),
],
styleOne == true
? Expanded(
child: Container(
height: MediaQuery.of(context).size.height * 0.50,
child: GridView.builder(
gridDelegate:
SliverGridDelegateWithFixedCrossAxisCount(
crossAxisCount: 2,
crossAxisSpacing: 0.5,
mainAxisSpacing: 2.0,
childAspectRatio: 1.2,
),
itemCount: model.products.length,
itemBuilder: (BuildContext context, int index) {
return NetworkBaseView(
baseViewModel: model,
child: Card(
color: model.products[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.products[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.products[index]
.images.isNotEmpty
? model
.products[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.products[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.products[index]
.rxMessage !=
null
? model
.products[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.products[index]
.discountName !=
null)
Container(
width: double.infinity,
height: 13.0,
decoration:
BoxDecoration(
color:
Color(0xff5AB145),
),
child: Center(
child: Texts(
model
.products[index]
.discountName,
regular: true,
color: Colors.white,
fontSize: 10.4,
),
),
),
Texts(
projectProvider.isArabic
? model
.products[index]
.name
: model
.products[index]
.namen,
regular: true,
fontSize: 12,
fontWeight:
FontWeight.w400,
),
Padding(
padding:
const EdgeInsets.only(
top: 4,
bottom: 4),
child: Texts(
"SAR ${model.products[index].price}",
bold: true,
fontSize: 14,
),
),
Row(
children: [
StarRating(
totalAverage: model
.products[
index]
.approvedRatingSum >
0
? (model.products[index].approvedRatingSum
.toDouble() /
model
.products[index]
.approvedRatingSum
.toDouble())
.toDouble()
: 0,
forceStars: true),
Texts(
"(${model.products[index].approvedTotalReviews})",
regular: true,
fontSize: 10,
fontWeight:
FontWeight.w400,
)
],
),
],
),
),
],
),
),
));
},
),
);
},
),
),
),
),
)
: Expanded(
child: Container(
child: ListView.builder(
itemCount: model.products.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.products[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.products[index]
.images.isNotEmpty
? model
.products[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.products[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.products[index]
.rxMessage !=
null
? model
.products[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.products[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.products[index]
.discountName,
regular: true,
color: Colors.white,
fontSize: 11.4,
),
),
),
SizedBox(
height: 4.0,
),
Texts(
projectProvider.isArabic
? model
.products[index].name
: model.products[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.products[index].price}",
bold: true,
fontSize: 14,
),
),
Row(
children: [
StarRating(
totalAverage: model
.products[
index]
.approvedRatingSum >
0
? (model
.products[
index]
.approvedRatingSum
.toDouble() /
model
.products[
index]
.approvedRatingSum
.toDouble())
.toDouble()
: 0,
forceStars: true),
Texts(
"(${model.products[index].approvedTotalReviews})",
regular: true,
fontSize: 10,
fontWeight:
FontWeight.w400,
)
],
),
],
),
),
],
),
);
}),
),
)
],
),
),
));
}
}
//

@ -0,0 +1,630 @@
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/app_scaffold_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';
class ParentCategorisePage extends StatelessWidget {
final String id;
final String titleName;
ParentCategorisePage({this.id, this.titleName});
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.getCategoriseParent(i: id),
builder: (BuildContext context, PharmacyCategoriseViewModel model,
Widget child) =>
PharmacyAppScaffold(
appBarTitle: titleName,
isBottomBar: false,
isShowAppBar: true,
backgroundColor: Colors.white,
isShowDecPage: false,
baseViewModel: model,
body: Container(
//height: MediaQuery.of(context).size.height * 0.57,
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Padding(
padding: EdgeInsets.all(10.0),
child: Container(
child: Texts(model.categoriseParent.length >= 8
? 'View All Categories'
: ''),
),
),
Divider(
thickness: 2.0,
color: Colors.grey.shade400,
),
//Expanded widget heree if nassery
Container(
height: MediaQuery.of(context).size.height * 0.20,
child: ListView.builder(
scrollDirection: Axis.horizontal,
itemCount: model.categoriseParent.length,
itemBuilder: (BuildContext context, int index) {
return Padding(
padding: EdgeInsets.all(8.0),
child: Row(
children: [
InkWell(
child: Column(
children: [
Container(
height: 60.0,
width: 65.0,
decoration: BoxDecoration(
shape: BoxShape.circle,
color: Colors.orange.shade200
.withOpacity(0.45),
),
child: Icon(
Icons.apps_sharp,
size: 32.0,
),
),
Container(
width: MediaQuery.of(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,
),
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Padding(
padding: EdgeInsets.all(8.0),
child: Texts(categoriseName),
),
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 * 0.50,
child: GridView.builder(
gridDelegate:
SliverGridDelegateWithFixedCrossAxisCount(
crossAxisCount: 2,
crossAxisSpacing: 0.5,
mainAxisSpacing: 2.0,
childAspectRatio: 1.2,
),
itemCount: model.parentProducts.length,
itemBuilder: (BuildContext context, int index) {
return NetworkBaseView(
baseViewModel: model,
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[index]
.thumb,
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,
),
child: Column(
crossAxisAlignment:
CrossAxisAlignment.start,
children: [
if (model
.parentProducts[
index]
.discountName !=
null)
Container(
width: double.infinity,
height: 13.0,
decoration:
BoxDecoration(
color:
Color(0xff5AB145),
),
child: Center(
child: Texts(
model
.parentProducts[
index]
.discountName,
regular: true,
color: Colors.white,
fontSize: 10.4,
),
),
),
Texts(
projectProvider.isArabic
? model
.parentProducts[
index]
.name
: model
.parentProducts[
index]
.namen,
regular: true,
fontSize: 12,
fontWeight:
FontWeight.w400,
),
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,
)
],
),
],
),
),
],
),
),
));
},
),
),
)
: Expanded(
child: Container(
child: ListView.builder(
itemCount: model.parentProducts.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
.parentProducts[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
.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[
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(
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(
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,
)
],
),
],
),
),
],
),
);
}),
),
)
],
),
),
));
}
}

@ -1,5 +1,6 @@
import 'package:charts_flutter/flutter.dart';
import 'package:diplomaticquarterapp/core/viewModels/pharmacy_categorise_view_model.dart';
import 'package:diplomaticquarterapp/pages/parent_categorise_page.dart';
import 'package:diplomaticquarterapp/widgets/data_display/text.dart';
import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart';
import 'package:flutter/material.dart';
@ -37,14 +38,27 @@ class _PharmacyCategorisePageState extends State<PharmacyCategorisePage> {
itemBuilder: (BuildContext context, int index) {
return Padding(
padding: EdgeInsets.all(4.0),
child: Container(
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(5),
color: Colors.grey.withOpacity(0.24),
),
child: Center(
child: Texts(model.categorise[index].name),
child: InkWell(
child: Container(
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(5),
color: Colors.grey.withOpacity(0.24),
),
child: Center(
child: Texts(model.categorise[index].name),
),
),
onTap: () => {
Navigator.push(
context,
MaterialPageRoute(
builder: (context) => ParentCategorisePage(
id: model.categorise[index].id,
titleName: model.categorise[index].name,
),
),
),
},
),
);
},

@ -0,0 +1,114 @@
import 'package:diplomaticquarterapp/config/config.dart';
import 'package:diplomaticquarterapp/core/service/AuthenticatedUserObject.dart';
import 'package:diplomaticquarterapp/core/viewModels/base_view_model.dart';
import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart';
import 'package:diplomaticquarterapp/pages/landing/landing_page.dart';
import 'package:diplomaticquarterapp/routes.dart';
import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart';
import 'package:diplomaticquarterapp/widgets/others/bottom_bar.dart';
import 'package:diplomaticquarterapp/widgets/progress_indicator/app_loader_widget.dart';
import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart';
import 'package:diplomaticquarterapp/widgets/robo-search/robosearch.dart';
import 'package:diplomaticquarterapp/widgets/robo-search/search.dart';
import 'package:flutter/material.dart';
import 'package:flutter_svg/flutter_svg.dart';
import 'package:font_awesome_flutter/font_awesome_flutter.dart';
import 'package:provider/provider.dart';
import '../../locator.dart';
import 'floating_button_search.dart';
import '../progress_indicator/app_loader_widget.dart';
import 'arrow_back.dart';
import 'network_base_view.dart';
import 'not_auh_page.dart';
class PharmacyAppScaffold extends StatelessWidget {
final String appBarTitle;
final Widget body;
final Widget bottomSheet;
final bool isLoading;
final bool isShowAppBar;
final bool hasAppBarParam;
final BaseViewModel baseViewModel;
final bool isBottomBar;
final Widget floatingActionButton;
final String title;
final String description;
final bool isShowDecPage;
final Color backgroundColor;
AuthenticatedUserObject authenticatedUserObject =
locator<AuthenticatedUserObject>();
PharmacyAppScaffold(
{@required this.body,
this.appBarTitle = '',
this.isLoading = false,
this.isShowAppBar = false,
this.hasAppBarParam,
this.bottomSheet,
this.baseViewModel,
this.floatingActionButton,
this.title,
this.description,
this.isShowDecPage = true,
this.isBottomBar,
this.backgroundColor});
@override
Widget build(BuildContext context) {
AppGlobal.context = context;
return Scaffold(
backgroundColor:
backgroundColor ?? Theme.of(context).scaffoldBackgroundColor,
appBar: isShowAppBar
? AppBar(
elevation: 0,
backgroundColor: Color(0xff5AB145),
textTheme: TextTheme(
headline6:
TextStyle(color: Colors.white, fontWeight: FontWeight.bold),
),
title: Text(authenticatedUserObject.isLogin
? appBarTitle.toUpperCase()
: TranslationBase.of(context).serviceInformationTitle),
leading: Builder(
builder: (BuildContext context) {
return ArrowBack();
},
),
centerTitle: true,
actions: <Widget>[],
)
: null,
body: (!authenticatedUserObject.isLogin && isShowDecPage)
? NotAutPage(
title: appBarTitle,
description: description,
)
: baseViewModel != null
? NetworkBaseView(
child: buildBodyWidget(),
baseViewModel: baseViewModel,
)
: buildBodyWidget(),
bottomSheet: bottomSheet,
floatingActionButton: floatingActionButton ?? floatingActionButton,
// bottomNavigationBar:
// this.isBottomBar == true ? BottomBarSearch() : SizedBox()
// floatingActionButton: FloatingSearchButton(),
);
}
buildAppLoaderWidget(bool isLoading) {
return isLoading ? AppLoaderWidget() : Container();
}
buildBodyWidget() {
// return body; //Stack(children: <Widget>[body, buildAppLoaderWidget(isLoading)]);
return Stack(children: <Widget>[
body, /*FloatingSearchButton()*/
]);
}
}

@ -51,14 +51,17 @@ class AppScaffold extends StatelessWidget {
this.floatingActionButton,
this.title,
this.description,
this.isShowDecPage = true, this.isBottomBar,this.backgroundColor});
this.isShowDecPage = true,
this.isBottomBar,
this.backgroundColor});
@override
Widget build(BuildContext context) {
AppGlobal.context = context;
return Scaffold(
backgroundColor: backgroundColor ?? Theme.of(context).scaffoldBackgroundColor,
backgroundColor:
backgroundColor ?? Theme.of(context).scaffoldBackgroundColor,
appBar: isShowAppBar
? AppBar(
elevation: 0,
@ -69,7 +72,8 @@ class AppScaffold extends StatelessWidget {
),
title: Text(authenticatedUserObject.isLogin
? appBarTitle.toUpperCase()
: TranslationBase.of(context).serviceInformationTitle),leading: Builder(
: TranslationBase.of(context).serviceInformationTitle),
leading: Builder(
builder: (BuildContext context) {
return ArrowBack();
},
@ -80,7 +84,10 @@ class AppScaffold extends StatelessWidget {
icon: Icon(FontAwesomeIcons.home),
color: Colors.white,
onPressed: () {
Navigator.pushAndRemoveUntil(context, MaterialPageRoute(builder: (context) => LandingPage()), (Route<dynamic> r) => false);
Navigator.pushAndRemoveUntil(
context,
MaterialPageRoute(builder: (context) => LandingPage()),
(Route<dynamic> r) => false);
},
),
],
@ -91,12 +98,12 @@ class AppScaffold extends StatelessWidget {
title: appBarTitle,
description: description,
)
:baseViewModel != null
? NetworkBaseView(
child: buildBodyWidget(),
baseViewModel: baseViewModel,
)
: buildBodyWidget(),
: baseViewModel != null
? NetworkBaseView(
child: buildBodyWidget(),
baseViewModel: baseViewModel,
)
: buildBodyWidget(),
bottomSheet: bottomSheet,
floatingActionButton: floatingActionButton ?? floatingActionButton,
// bottomNavigationBar:
@ -111,6 +118,8 @@ class AppScaffold extends StatelessWidget {
buildBodyWidget() {
// return body; //Stack(children: <Widget>[body, buildAppLoaderWidget(isLoading)]);
return Stack(children: <Widget>[body, /*FloatingSearchButton()*/]);
return Stack(children: <Widget>[
body, /*FloatingSearchButton()*/
]);
}
}

Loading…
Cancel
Save