Packages and Offer Slider at home
parent
96afe340e7
commit
1155466d19
@ -0,0 +1,11 @@
|
||||
class OffersCategoriesRequestModel {
|
||||
final int limit;
|
||||
final int page;
|
||||
final int sinceId;
|
||||
|
||||
OffersCategoriesRequestModel({this.limit, this.page, this.sinceId});
|
||||
|
||||
Map<String, String> toFlatMap() {
|
||||
return {"limit": limit.toString(), "page": page.toString(), "sinceId": sinceId.toString()};
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,12 @@
|
||||
class OffersProductsRequestModel {
|
||||
final int categoryId;
|
||||
final int limit;
|
||||
final int page;
|
||||
final int sinceId;
|
||||
|
||||
OffersProductsRequestModel({this.categoryId, this.limit, this.page, this.sinceId});
|
||||
|
||||
Map<String, String> toFlatMap() {
|
||||
return {"limit": limit.toString(), "page": page.toString(), "sinceId": sinceId.toString(), "categoryId": categoryId.toString()};
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,65 @@
|
||||
import 'package:diplomaticquarterapp/generated/json/base/json_convert_content.dart';
|
||||
import 'package:diplomaticquarterapp/generated/json/base/json_field.dart';
|
||||
|
||||
class OfferCategoriesResponseModel with JsonConvert<OfferCategoriesResponseModel> {
|
||||
String id;
|
||||
String name;
|
||||
String namen;
|
||||
@JSONField(name: "localized_names")
|
||||
List<OfferCategoriesResponseModelLocalizedName> localizedNames;
|
||||
dynamic description;
|
||||
@JSONField(name: "category_template_id")
|
||||
int categoryTemplateId;
|
||||
@JSONField(name: "meta_keywords")
|
||||
String metaKeywords;
|
||||
@JSONField(name: "meta_description")
|
||||
String metaDescription;
|
||||
@JSONField(name: "meta_title")
|
||||
String metaTitle;
|
||||
@JSONField(name: "parent_category_id")
|
||||
int parentCategoryId;
|
||||
@JSONField(name: "page_size")
|
||||
int pageSize;
|
||||
@JSONField(name: "page_size_options")
|
||||
String pageSizeOptions;
|
||||
@JSONField(name: "price_ranges")
|
||||
dynamic priceRanges;
|
||||
@JSONField(name: "show_on_home_page")
|
||||
bool showOnHomePage;
|
||||
@JSONField(name: "include_in_top_menu")
|
||||
bool includeInTopMenu;
|
||||
@JSONField(name: "has_discounts_applied")
|
||||
dynamic hasDiscountsApplied;
|
||||
bool published;
|
||||
bool deleted;
|
||||
@JSONField(name: "display_order")
|
||||
int displayOrder;
|
||||
@JSONField(name: "created_on_utc")
|
||||
String createdOnUtc;
|
||||
@JSONField(name: "updated_on_utc")
|
||||
String updatedOnUtc;
|
||||
@JSONField(name: "role_ids")
|
||||
List<dynamic> roleIds;
|
||||
@JSONField(name: "discount_ids")
|
||||
List<dynamic> discountIds;
|
||||
@JSONField(name: "store_ids")
|
||||
List<dynamic> storeIds;
|
||||
OfferCategoriesResponseModelImage image;
|
||||
@JSONField(name: "se_name")
|
||||
String seName;
|
||||
@JSONField(name: "is_leaf")
|
||||
bool isLeaf;
|
||||
}
|
||||
|
||||
class OfferCategoriesResponseModelLocalizedName with JsonConvert<OfferCategoriesResponseModelLocalizedName> {
|
||||
@JSONField(name: "language_id")
|
||||
int languageId;
|
||||
@JSONField(name: "localized_name")
|
||||
String localizedName;
|
||||
}
|
||||
|
||||
class OfferCategoriesResponseModelImage with JsonConvert<OfferCategoriesResponseModelImage> {
|
||||
String src;
|
||||
dynamic thumb;
|
||||
dynamic attachment;
|
||||
}
|
||||
@ -0,0 +1,235 @@
|
||||
import 'package:diplomaticquarterapp/generated/json/base/json_convert_content.dart';
|
||||
import 'package:diplomaticquarterapp/generated/json/base/json_field.dart';
|
||||
|
||||
class OfferProductsResponseModel with JsonConvert<OfferProductsResponseModel> {
|
||||
String id;
|
||||
@JSONField(name: "visible_individually")
|
||||
bool visibleIndividually;
|
||||
String name;
|
||||
String namen;
|
||||
@JSONField(name: "localized_names")
|
||||
List<OfferProductsResponseModelLocalizedName> localizedNames;
|
||||
@JSONField(name: "short_description")
|
||||
String shortDescription;
|
||||
@JSONField(name: "short_descriptionn")
|
||||
String shortDescriptionn;
|
||||
@JSONField(name: "full_description")
|
||||
String fullDescription;
|
||||
@JSONField(name: "full_descriptionn")
|
||||
String fullDescriptionn;
|
||||
@JSONField(name: "markas_new")
|
||||
bool markasNew;
|
||||
@JSONField(name: "show_on_home_page")
|
||||
bool showOnHomePage;
|
||||
@JSONField(name: "meta_keywords")
|
||||
dynamic metaKeywords;
|
||||
@JSONField(name: "meta_description")
|
||||
dynamic metaDescription;
|
||||
@JSONField(name: "meta_title")
|
||||
dynamic metaTitle;
|
||||
@JSONField(name: "allow_customer_reviews")
|
||||
bool allowCustomerReviews;
|
||||
@JSONField(name: "approved_rating_sum")
|
||||
int approvedRatingSum;
|
||||
@JSONField(name: "not_approved_rating_sum")
|
||||
int notApprovedRatingSum;
|
||||
@JSONField(name: "approved_total_reviews")
|
||||
int approvedTotalReviews;
|
||||
@JSONField(name: "not_approved_total_reviews")
|
||||
int notApprovedTotalReviews;
|
||||
String sku;
|
||||
@JSONField(name: "is_rx")
|
||||
bool isRx;
|
||||
@JSONField(name: "prescription_required")
|
||||
bool prescriptionRequired;
|
||||
@JSONField(name: "rx_message")
|
||||
dynamic rxMessage;
|
||||
@JSONField(name: "rx_messagen")
|
||||
dynamic rxMessagen;
|
||||
@JSONField(name: "manufacturer_part_number")
|
||||
dynamic manufacturerPartNumber;
|
||||
dynamic gtin;
|
||||
@JSONField(name: "is_gift_card")
|
||||
bool isGiftCard;
|
||||
@JSONField(name: "require_other_products")
|
||||
bool requireOtherProducts;
|
||||
@JSONField(name: "automatically_add_required_products")
|
||||
bool automaticallyAddRequiredProducts;
|
||||
@JSONField(name: "is_download")
|
||||
bool isDownload;
|
||||
@JSONField(name: "unlimited_downloads")
|
||||
bool unlimitedDownloads;
|
||||
@JSONField(name: "max_number_of_downloads")
|
||||
int maxNumberOfDownloads;
|
||||
@JSONField(name: "download_expiration_days")
|
||||
dynamic downloadExpirationDays;
|
||||
@JSONField(name: "has_sample_download")
|
||||
bool hasSampleDownload;
|
||||
@JSONField(name: "has_user_agreement")
|
||||
bool hasUserAgreement;
|
||||
@JSONField(name: "is_recurring")
|
||||
bool isRecurring;
|
||||
@JSONField(name: "recurring_cycle_length")
|
||||
int recurringCycleLength;
|
||||
@JSONField(name: "recurring_total_cycles")
|
||||
int recurringTotalCycles;
|
||||
@JSONField(name: "is_rental")
|
||||
bool isRental;
|
||||
@JSONField(name: "rental_price_length")
|
||||
int rentalPriceLength;
|
||||
@JSONField(name: "is_ship_enabled")
|
||||
bool isShipEnabled;
|
||||
@JSONField(name: "is_free_shipping")
|
||||
bool isFreeShipping;
|
||||
@JSONField(name: "ship_separately")
|
||||
bool shipSeparately;
|
||||
@JSONField(name: "additional_shipping_charge")
|
||||
double additionalShippingCharge;
|
||||
@JSONField(name: "is_tax_exempt")
|
||||
bool isTaxExempt;
|
||||
@JSONField(name: "is_telecommunications_or_broadcasting_or_electronic_services")
|
||||
bool isTelecommunicationsOrBroadcastingOrElectronicServices;
|
||||
@JSONField(name: "use_multiple_warehouses")
|
||||
bool useMultipleWarehouses;
|
||||
@JSONField(name: "manage_inventory_method_id")
|
||||
int manageInventoryMethodId;
|
||||
@JSONField(name: "stock_quantity")
|
||||
int stockQuantity;
|
||||
@JSONField(name: "stock_availability")
|
||||
String stockAvailability;
|
||||
@JSONField(name: "stock_availabilityn")
|
||||
String stockAvailabilityn;
|
||||
@JSONField(name: "display_stock_availability")
|
||||
bool displayStockAvailability;
|
||||
@JSONField(name: "display_stock_quantity")
|
||||
bool displayStockQuantity;
|
||||
@JSONField(name: "min_stock_quantity")
|
||||
int minStockQuantity;
|
||||
@JSONField(name: "notify_admin_for_quantity_below")
|
||||
int notifyAdminForQuantityBelow;
|
||||
@JSONField(name: "allow_back_in_stock_subscriptions")
|
||||
bool allowBackInStockSubscriptions;
|
||||
@JSONField(name: "order_minimum_quantity")
|
||||
int orderMinimumQuantity;
|
||||
@JSONField(name: "order_maximum_quantity")
|
||||
int orderMaximumQuantity;
|
||||
@JSONField(name: "allowed_quantities")
|
||||
dynamic allowedQuantities;
|
||||
@JSONField(name: "allow_adding_only_existing_attribute_combinations")
|
||||
bool allowAddingOnlyExistingAttributeCombinations;
|
||||
@JSONField(name: "disable_buy_button")
|
||||
bool disableBuyButton;
|
||||
@JSONField(name: "disable_wishlist_button")
|
||||
bool disableWishlistButton;
|
||||
@JSONField(name: "available_for_pre_order")
|
||||
bool availableForPreOrder;
|
||||
@JSONField(name: "pre_order_availability_start_date_time_utc")
|
||||
dynamic preOrderAvailabilityStartDateTimeUtc;
|
||||
@JSONField(name: "call_for_price")
|
||||
bool callForPrice;
|
||||
double price;
|
||||
@JSONField(name: "old_price")
|
||||
double oldPrice;
|
||||
@JSONField(name: "product_cost")
|
||||
double productCost;
|
||||
@JSONField(name: "special_price")
|
||||
dynamic specialPrice;
|
||||
@JSONField(name: "special_price_start_date_time_utc")
|
||||
dynamic specialPriceStartDateTimeUtc;
|
||||
@JSONField(name: "special_price_end_date_time_utc")
|
||||
dynamic specialPriceEndDateTimeUtc;
|
||||
@JSONField(name: "customer_enters_price")
|
||||
bool customerEntersPrice;
|
||||
@JSONField(name: "minimum_customer_entered_price")
|
||||
double minimumCustomerEnteredPrice;
|
||||
@JSONField(name: "maximum_customer_entered_price")
|
||||
double maximumCustomerEnteredPrice;
|
||||
@JSONField(name: "baseprice_enabled")
|
||||
bool basepriceEnabled;
|
||||
@JSONField(name: "baseprice_amount")
|
||||
double basepriceAmount;
|
||||
@JSONField(name: "baseprice_base_amount")
|
||||
double basepriceBaseAmount;
|
||||
@JSONField(name: "has_tier_prices")
|
||||
bool hasTierPrices;
|
||||
@JSONField(name: "has_discounts_applied")
|
||||
bool hasDiscountsApplied;
|
||||
@JSONField(name: "discount_name")
|
||||
dynamic discountName;
|
||||
@JSONField(name: "discount_namen")
|
||||
dynamic discountNamen;
|
||||
@JSONField(name: "discount_description")
|
||||
dynamic discountDescription;
|
||||
@JSONField(name: "discount_Descriptionn")
|
||||
dynamic discountDescriptionn;
|
||||
@JSONField(name: "discount_percentage")
|
||||
dynamic discountPercentage;
|
||||
String currency;
|
||||
String currencyn;
|
||||
double weight;
|
||||
double length;
|
||||
double width;
|
||||
double height;
|
||||
@JSONField(name: "available_start_date_time_utc")
|
||||
dynamic availableStartDateTimeUtc;
|
||||
@JSONField(name: "available_end_date_time_utc")
|
||||
dynamic availableEndDateTimeUtc;
|
||||
@JSONField(name: "display_order")
|
||||
int displayOrder;
|
||||
bool published;
|
||||
bool deleted;
|
||||
@JSONField(name: "created_on_utc")
|
||||
String createdOnUtc;
|
||||
@JSONField(name: "updated_on_utc")
|
||||
String updatedOnUtc;
|
||||
@JSONField(name: "product_type")
|
||||
String productType;
|
||||
@JSONField(name: "parent_grouped_product_id")
|
||||
int parentGroupedProductId;
|
||||
@JSONField(name: "role_ids")
|
||||
List<dynamic> roleIds;
|
||||
@JSONField(name: "discount_ids")
|
||||
List<dynamic> discountIds;
|
||||
@JSONField(name: "store_ids")
|
||||
List<dynamic> storeIds;
|
||||
@JSONField(name: "manufacturer_ids")
|
||||
List<int> manufacturerIds;
|
||||
List<dynamic> reviews;
|
||||
List<OfferProductsResponseModelImage> images;
|
||||
List<dynamic> attributes;
|
||||
List<OfferProductsResponseModelSpecification> specifications;
|
||||
@JSONField(name: "associated_product_ids")
|
||||
List<dynamic> associatedProductIds;
|
||||
List<dynamic> tags;
|
||||
@JSONField(name: "vendor_id")
|
||||
int vendorId;
|
||||
@JSONField(name: "se_name")
|
||||
String seName;
|
||||
}
|
||||
|
||||
class OfferProductsResponseModelLocalizedName with JsonConvert<OfferProductsResponseModelLocalizedName> {
|
||||
@JSONField(name: "language_id")
|
||||
int languageId;
|
||||
@JSONField(name: "localized_name")
|
||||
String localizedName;
|
||||
}
|
||||
|
||||
class OfferProductsResponseModelImage with JsonConvert<OfferProductsResponseModelImage> {
|
||||
int id;
|
||||
int position;
|
||||
String src;
|
||||
String thumb;
|
||||
String attachment;
|
||||
}
|
||||
|
||||
class OfferProductsResponseModelSpecification with JsonConvert<OfferProductsResponseModelSpecification> {
|
||||
int id;
|
||||
@JSONField(name: "display_order")
|
||||
int displayOrder;
|
||||
@JSONField(name: "default_value")
|
||||
String defaultValue;
|
||||
@JSONField(name: "default_valuen")
|
||||
String defaultValuen;
|
||||
String name;
|
||||
String nameN;
|
||||
}
|
||||
@ -0,0 +1,53 @@
|
||||
import 'dart:convert';
|
||||
import 'dart:developer';
|
||||
|
||||
import 'package:diplomaticquarterapp/config/config.dart';
|
||||
import 'package:diplomaticquarterapp/core/model/packages_offers/requests/OffersCategoriesRequestModel.dart';
|
||||
import 'package:diplomaticquarterapp/core/model/packages_offers/requests/OffersProductsRequestModel.dart';
|
||||
import 'package:diplomaticquarterapp/core/model/packages_offers/responses/OfferCategoriesResponseModel.dart';
|
||||
import 'package:diplomaticquarterapp/core/model/packages_offers/responses/OfferProductsResponseModel.dart';
|
||||
import 'package:diplomaticquarterapp/core/service/base_service.dart';
|
||||
import 'package:diplomaticquarterapp/core/service/client/base_app_client.dart';
|
||||
|
||||
import '../../../locator.dart';
|
||||
|
||||
class OffersAndPackagesServices extends BaseService {
|
||||
List<OfferCategoriesResponseModel> categoryList = List();
|
||||
|
||||
Future<List<OfferCategoriesResponseModel>> getAllCategories(OffersCategoriesRequestModel request) async {
|
||||
hasError = false;
|
||||
var url = EXA_CART_API_BASE_URL + PACKAGES_CATEGORIES;
|
||||
await baseAppClient.simpleGet(url, onSuccess: (dynamic stringResponse, int statusCode) {
|
||||
log(stringResponse);
|
||||
if (statusCode == 200) {
|
||||
var jsonResponse = json.decode(stringResponse);
|
||||
jsonResponse['categories'].forEach((json) {
|
||||
categoryList.add(OfferCategoriesResponseModel().fromJson(json));
|
||||
});
|
||||
}
|
||||
}, onFailure: (String error, int statusCode) {
|
||||
log(error);
|
||||
}, queryParams: request.toFlatMap());
|
||||
|
||||
return categoryList;
|
||||
}
|
||||
|
||||
List<OfferProductsResponseModel> productList = List();
|
||||
Future<List<OfferProductsResponseModel>> getAllProducts(OffersProductsRequestModel request) async {
|
||||
hasError = false;
|
||||
var url = EXA_CART_API_BASE_URL + PACKAGES_PRODUCTS;
|
||||
await baseAppClient.simpleGet(url, onSuccess: (dynamic stringResponse, int statusCode) {
|
||||
log(stringResponse);
|
||||
if (statusCode == 200) {
|
||||
var jsonResponse = json.decode(stringResponse);
|
||||
jsonResponse['products'].forEach((json) {
|
||||
productList.add(OfferProductsResponseModel().fromJson(json));
|
||||
});
|
||||
}
|
||||
}, onFailure: (String error, int statusCode) {
|
||||
log(error);
|
||||
}, queryParams: request.toFlatMap());
|
||||
|
||||
return productList;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,19 @@
|
||||
import 'package:diplomaticquarterapp/core/enum/viewstate.dart';
|
||||
import 'package:diplomaticquarterapp/core/model/packages_offers/responses/OfferCategoriesResponseModel.dart';
|
||||
import 'package:diplomaticquarterapp/core/model/packages_offers/responses/OfferProductsResponseModel.dart';
|
||||
import 'package:diplomaticquarterapp/core/service/base_service.dart';
|
||||
import 'package:diplomaticquarterapp/core/service/client/base_app_client.dart';
|
||||
import 'package:diplomaticquarterapp/core/service/packages_offers/PackagesOffersServices.dart';
|
||||
import 'package:diplomaticquarterapp/core/viewModels/base_view_model.dart';
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:diplomaticquarterapp/locator.dart';
|
||||
|
||||
class OfferCategoriesViewModel extends BaseViewModel {
|
||||
OffersAndPackagesServices service = locator<OffersAndPackagesServices>();
|
||||
List<OfferCategoriesResponseModel> get list => service.categoryList;
|
||||
}
|
||||
|
||||
class OfferProductsViewModel extends BaseViewModel {
|
||||
OffersAndPackagesServices service = locator<OffersAndPackagesServices>();
|
||||
List<OfferProductsResponseModel> get list => service.productList;
|
||||
}
|
||||
@ -0,0 +1,569 @@
|
||||
import 'package:diplomaticquarterapp/core/model/packages_offers/responses/OfferProductsResponseModel.dart';
|
||||
|
||||
offerProductsResponseModelFromJson(OfferProductsResponseModel data, Map<String, dynamic> json) {
|
||||
if (json['id'] != null) {
|
||||
data.id = json['id']?.toString();
|
||||
}
|
||||
if (json['visible_individually'] != null) {
|
||||
data.visibleIndividually = json['visible_individually'];
|
||||
}
|
||||
if (json['name'] != null) {
|
||||
data.name = json['name']?.toString();
|
||||
}
|
||||
if (json['namen'] != null) {
|
||||
data.namen = json['namen']?.toString();
|
||||
}
|
||||
if (json['localized_names'] != null) {
|
||||
data.localizedNames = new List<OfferProductsResponseModelLocalizedName>();
|
||||
(json['localized_names'] as List).forEach((v) {
|
||||
data.localizedNames.add(new OfferProductsResponseModelLocalizedName().fromJson(v));
|
||||
});
|
||||
}
|
||||
if (json['short_description'] != null) {
|
||||
data.shortDescription = json['short_description']?.toString();
|
||||
}
|
||||
if (json['short_descriptionn'] != null) {
|
||||
data.shortDescriptionn = json['short_descriptionn']?.toString();
|
||||
}
|
||||
if (json['full_description'] != null) {
|
||||
data.fullDescription = json['full_description']?.toString();
|
||||
}
|
||||
if (json['full_descriptionn'] != null) {
|
||||
data.fullDescriptionn = json['full_descriptionn']?.toString();
|
||||
}
|
||||
if (json['markas_new'] != null) {
|
||||
data.markasNew = json['markas_new'];
|
||||
}
|
||||
if (json['show_on_home_page'] != null) {
|
||||
data.showOnHomePage = json['show_on_home_page'];
|
||||
}
|
||||
if (json['meta_keywords'] != null) {
|
||||
data.metaKeywords = json['meta_keywords'];
|
||||
}
|
||||
if (json['meta_description'] != null) {
|
||||
data.metaDescription = json['meta_description'];
|
||||
}
|
||||
if (json['meta_title'] != null) {
|
||||
data.metaTitle = json['meta_title'];
|
||||
}
|
||||
if (json['allow_customer_reviews'] != null) {
|
||||
data.allowCustomerReviews = json['allow_customer_reviews'];
|
||||
}
|
||||
if (json['approved_rating_sum'] != null) {
|
||||
data.approvedRatingSum = json['approved_rating_sum']?.toInt();
|
||||
}
|
||||
if (json['not_approved_rating_sum'] != null) {
|
||||
data.notApprovedRatingSum = json['not_approved_rating_sum']?.toInt();
|
||||
}
|
||||
if (json['approved_total_reviews'] != null) {
|
||||
data.approvedTotalReviews = json['approved_total_reviews']?.toInt();
|
||||
}
|
||||
if (json['not_approved_total_reviews'] != null) {
|
||||
data.notApprovedTotalReviews = json['not_approved_total_reviews']?.toInt();
|
||||
}
|
||||
if (json['sku'] != null) {
|
||||
data.sku = json['sku']?.toString();
|
||||
}
|
||||
if (json['is_rx'] != null) {
|
||||
data.isRx = json['is_rx'];
|
||||
}
|
||||
if (json['prescription_required'] != null) {
|
||||
data.prescriptionRequired = json['prescription_required'];
|
||||
}
|
||||
if (json['rx_message'] != null) {
|
||||
data.rxMessage = json['rx_message'];
|
||||
}
|
||||
if (json['rx_messagen'] != null) {
|
||||
data.rxMessagen = json['rx_messagen'];
|
||||
}
|
||||
if (json['manufacturer_part_number'] != null) {
|
||||
data.manufacturerPartNumber = json['manufacturer_part_number'];
|
||||
}
|
||||
if (json['gtin'] != null) {
|
||||
data.gtin = json['gtin'];
|
||||
}
|
||||
if (json['is_gift_card'] != null) {
|
||||
data.isGiftCard = json['is_gift_card'];
|
||||
}
|
||||
if (json['require_other_products'] != null) {
|
||||
data.requireOtherProducts = json['require_other_products'];
|
||||
}
|
||||
if (json['automatically_add_required_products'] != null) {
|
||||
data.automaticallyAddRequiredProducts = json['automatically_add_required_products'];
|
||||
}
|
||||
if (json['is_download'] != null) {
|
||||
data.isDownload = json['is_download'];
|
||||
}
|
||||
if (json['unlimited_downloads'] != null) {
|
||||
data.unlimitedDownloads = json['unlimited_downloads'];
|
||||
}
|
||||
if (json['max_number_of_downloads'] != null) {
|
||||
data.maxNumberOfDownloads = json['max_number_of_downloads']?.toInt();
|
||||
}
|
||||
if (json['download_expiration_days'] != null) {
|
||||
data.downloadExpirationDays = json['download_expiration_days'];
|
||||
}
|
||||
if (json['has_sample_download'] != null) {
|
||||
data.hasSampleDownload = json['has_sample_download'];
|
||||
}
|
||||
if (json['has_user_agreement'] != null) {
|
||||
data.hasUserAgreement = json['has_user_agreement'];
|
||||
}
|
||||
if (json['is_recurring'] != null) {
|
||||
data.isRecurring = json['is_recurring'];
|
||||
}
|
||||
if (json['recurring_cycle_length'] != null) {
|
||||
data.recurringCycleLength = json['recurring_cycle_length']?.toInt();
|
||||
}
|
||||
if (json['recurring_total_cycles'] != null) {
|
||||
data.recurringTotalCycles = json['recurring_total_cycles']?.toInt();
|
||||
}
|
||||
if (json['is_rental'] != null) {
|
||||
data.isRental = json['is_rental'];
|
||||
}
|
||||
if (json['rental_price_length'] != null) {
|
||||
data.rentalPriceLength = json['rental_price_length']?.toInt();
|
||||
}
|
||||
if (json['is_ship_enabled'] != null) {
|
||||
data.isShipEnabled = json['is_ship_enabled'];
|
||||
}
|
||||
if (json['is_free_shipping'] != null) {
|
||||
data.isFreeShipping = json['is_free_shipping'];
|
||||
}
|
||||
if (json['ship_separately'] != null) {
|
||||
data.shipSeparately = json['ship_separately'];
|
||||
}
|
||||
if (json['additional_shipping_charge'] != null) {
|
||||
data.additionalShippingCharge = json['additional_shipping_charge']?.toDouble();
|
||||
}
|
||||
if (json['is_tax_exempt'] != null) {
|
||||
data.isTaxExempt = json['is_tax_exempt'];
|
||||
}
|
||||
if (json['is_telecommunications_or_broadcasting_or_electronic_services'] != null) {
|
||||
data.isTelecommunicationsOrBroadcastingOrElectronicServices = json['is_telecommunications_or_broadcasting_or_electronic_services'];
|
||||
}
|
||||
if (json['use_multiple_warehouses'] != null) {
|
||||
data.useMultipleWarehouses = json['use_multiple_warehouses'];
|
||||
}
|
||||
if (json['manage_inventory_method_id'] != null) {
|
||||
data.manageInventoryMethodId = json['manage_inventory_method_id']?.toInt();
|
||||
}
|
||||
if (json['stock_quantity'] != null) {
|
||||
data.stockQuantity = json['stock_quantity']?.toInt();
|
||||
}
|
||||
if (json['stock_availability'] != null) {
|
||||
data.stockAvailability = json['stock_availability']?.toString();
|
||||
}
|
||||
if (json['stock_availabilityn'] != null) {
|
||||
data.stockAvailabilityn = json['stock_availabilityn']?.toString();
|
||||
}
|
||||
if (json['display_stock_availability'] != null) {
|
||||
data.displayStockAvailability = json['display_stock_availability'];
|
||||
}
|
||||
if (json['display_stock_quantity'] != null) {
|
||||
data.displayStockQuantity = json['display_stock_quantity'];
|
||||
}
|
||||
if (json['min_stock_quantity'] != null) {
|
||||
data.minStockQuantity = json['min_stock_quantity']?.toInt();
|
||||
}
|
||||
if (json['notify_admin_for_quantity_below'] != null) {
|
||||
data.notifyAdminForQuantityBelow = json['notify_admin_for_quantity_below']?.toInt();
|
||||
}
|
||||
if (json['allow_back_in_stock_subscriptions'] != null) {
|
||||
data.allowBackInStockSubscriptions = json['allow_back_in_stock_subscriptions'];
|
||||
}
|
||||
if (json['order_minimum_quantity'] != null) {
|
||||
data.orderMinimumQuantity = json['order_minimum_quantity']?.toInt();
|
||||
}
|
||||
if (json['order_maximum_quantity'] != null) {
|
||||
data.orderMaximumQuantity = json['order_maximum_quantity']?.toInt();
|
||||
}
|
||||
if (json['allowed_quantities'] != null) {
|
||||
data.allowedQuantities = json['allowed_quantities'];
|
||||
}
|
||||
if (json['allow_adding_only_existing_attribute_combinations'] != null) {
|
||||
data.allowAddingOnlyExistingAttributeCombinations = json['allow_adding_only_existing_attribute_combinations'];
|
||||
}
|
||||
if (json['disable_buy_button'] != null) {
|
||||
data.disableBuyButton = json['disable_buy_button'];
|
||||
}
|
||||
if (json['disable_wishlist_button'] != null) {
|
||||
data.disableWishlistButton = json['disable_wishlist_button'];
|
||||
}
|
||||
if (json['available_for_pre_order'] != null) {
|
||||
data.availableForPreOrder = json['available_for_pre_order'];
|
||||
}
|
||||
if (json['pre_order_availability_start_date_time_utc'] != null) {
|
||||
data.preOrderAvailabilityStartDateTimeUtc = json['pre_order_availability_start_date_time_utc'];
|
||||
}
|
||||
if (json['call_for_price'] != null) {
|
||||
data.callForPrice = json['call_for_price'];
|
||||
}
|
||||
if (json['price'] != null) {
|
||||
data.price = json['price']?.toDouble();
|
||||
}
|
||||
if (json['old_price'] != null) {
|
||||
data.oldPrice = json['old_price']?.toDouble();
|
||||
}
|
||||
if (json['product_cost'] != null) {
|
||||
data.productCost = json['product_cost']?.toDouble();
|
||||
}
|
||||
if (json['special_price'] != null) {
|
||||
data.specialPrice = json['special_price'];
|
||||
}
|
||||
if (json['special_price_start_date_time_utc'] != null) {
|
||||
data.specialPriceStartDateTimeUtc = json['special_price_start_date_time_utc'];
|
||||
}
|
||||
if (json['special_price_end_date_time_utc'] != null) {
|
||||
data.specialPriceEndDateTimeUtc = json['special_price_end_date_time_utc'];
|
||||
}
|
||||
if (json['customer_enters_price'] != null) {
|
||||
data.customerEntersPrice = json['customer_enters_price'];
|
||||
}
|
||||
if (json['minimum_customer_entered_price'] != null) {
|
||||
data.minimumCustomerEnteredPrice = json['minimum_customer_entered_price']?.toDouble();
|
||||
}
|
||||
if (json['maximum_customer_entered_price'] != null) {
|
||||
data.maximumCustomerEnteredPrice = json['maximum_customer_entered_price']?.toDouble();
|
||||
}
|
||||
if (json['baseprice_enabled'] != null) {
|
||||
data.basepriceEnabled = json['baseprice_enabled'];
|
||||
}
|
||||
if (json['baseprice_amount'] != null) {
|
||||
data.basepriceAmount = json['baseprice_amount']?.toDouble();
|
||||
}
|
||||
if (json['baseprice_base_amount'] != null) {
|
||||
data.basepriceBaseAmount = json['baseprice_base_amount']?.toDouble();
|
||||
}
|
||||
if (json['has_tier_prices'] != null) {
|
||||
data.hasTierPrices = json['has_tier_prices'];
|
||||
}
|
||||
if (json['has_discounts_applied'] != null) {
|
||||
data.hasDiscountsApplied = json['has_discounts_applied'];
|
||||
}
|
||||
if (json['discount_name'] != null) {
|
||||
data.discountName = json['discount_name'];
|
||||
}
|
||||
if (json['discount_namen'] != null) {
|
||||
data.discountNamen = json['discount_namen'];
|
||||
}
|
||||
if (json['discount_description'] != null) {
|
||||
data.discountDescription = json['discount_description'];
|
||||
}
|
||||
if (json['discount_Descriptionn'] != null) {
|
||||
data.discountDescriptionn = json['discount_Descriptionn'];
|
||||
}
|
||||
if (json['discount_percentage'] != null) {
|
||||
data.discountPercentage = json['discount_percentage'];
|
||||
}
|
||||
if (json['currency'] != null) {
|
||||
data.currency = json['currency']?.toString();
|
||||
}
|
||||
if (json['currencyn'] != null) {
|
||||
data.currencyn = json['currencyn']?.toString();
|
||||
}
|
||||
if (json['weight'] != null) {
|
||||
data.weight = json['weight']?.toDouble();
|
||||
}
|
||||
if (json['length'] != null) {
|
||||
data.length = json['length']?.toDouble();
|
||||
}
|
||||
if (json['width'] != null) {
|
||||
data.width = json['width']?.toDouble();
|
||||
}
|
||||
if (json['height'] != null) {
|
||||
data.height = json['height']?.toDouble();
|
||||
}
|
||||
if (json['available_start_date_time_utc'] != null) {
|
||||
data.availableStartDateTimeUtc = json['available_start_date_time_utc'];
|
||||
}
|
||||
if (json['available_end_date_time_utc'] != null) {
|
||||
data.availableEndDateTimeUtc = json['available_end_date_time_utc'];
|
||||
}
|
||||
if (json['display_order'] != null) {
|
||||
data.displayOrder = json['display_order']?.toInt();
|
||||
}
|
||||
if (json['published'] != null) {
|
||||
data.published = json['published'];
|
||||
}
|
||||
if (json['deleted'] != null) {
|
||||
data.deleted = json['deleted'];
|
||||
}
|
||||
if (json['created_on_utc'] != null) {
|
||||
data.createdOnUtc = json['created_on_utc']?.toString();
|
||||
}
|
||||
if (json['updated_on_utc'] != null) {
|
||||
data.updatedOnUtc = json['updated_on_utc']?.toString();
|
||||
}
|
||||
if (json['product_type'] != null) {
|
||||
data.productType = json['product_type']?.toString();
|
||||
}
|
||||
if (json['parent_grouped_product_id'] != null) {
|
||||
data.parentGroupedProductId = json['parent_grouped_product_id']?.toInt();
|
||||
}
|
||||
if (json['role_ids'] != null) {
|
||||
data.roleIds = new List<dynamic>();
|
||||
data.roleIds.addAll(json['role_ids']);
|
||||
}
|
||||
if (json['discount_ids'] != null) {
|
||||
data.discountIds = new List<dynamic>();
|
||||
data.discountIds.addAll(json['discount_ids']);
|
||||
}
|
||||
if (json['store_ids'] != null) {
|
||||
data.storeIds = new List<dynamic>();
|
||||
data.storeIds.addAll(json['store_ids']);
|
||||
}
|
||||
if (json['manufacturer_ids'] != null) {
|
||||
data.manufacturerIds = json['manufacturer_ids']?.map((v) => v?.toInt())?.toList()?.cast<int>();
|
||||
}
|
||||
if (json['reviews'] != null) {
|
||||
data.reviews = new List<dynamic>();
|
||||
data.reviews.addAll(json['reviews']);
|
||||
}
|
||||
if (json['images'] != null) {
|
||||
data.images = new List<OfferProductsResponseModelImage>();
|
||||
(json['images'] as List).forEach((v) {
|
||||
data.images.add(new OfferProductsResponseModelImage().fromJson(v));
|
||||
});
|
||||
}
|
||||
if (json['attributes'] != null) {
|
||||
data.attributes = new List<dynamic>();
|
||||
data.attributes.addAll(json['attributes']);
|
||||
}
|
||||
if (json['specifications'] != null) {
|
||||
data.specifications = new List<OfferProductsResponseModelSpecification>();
|
||||
(json['specifications'] as List).forEach((v) {
|
||||
data.specifications.add(new OfferProductsResponseModelSpecification().fromJson(v));
|
||||
});
|
||||
}
|
||||
if (json['associated_product_ids'] != null) {
|
||||
data.associatedProductIds = new List<dynamic>();
|
||||
data.associatedProductIds.addAll(json['associated_product_ids']);
|
||||
}
|
||||
if (json['tags'] != null) {
|
||||
data.tags = new List<dynamic>();
|
||||
data.tags.addAll(json['tags']);
|
||||
}
|
||||
if (json['vendor_id'] != null) {
|
||||
data.vendorId = json['vendor_id']?.toInt();
|
||||
}
|
||||
if (json['se_name'] != null) {
|
||||
data.seName = json['se_name']?.toString();
|
||||
}
|
||||
return data;
|
||||
}
|
||||
|
||||
Map<String, dynamic> offerProductsResponseModelToJson(OfferProductsResponseModel entity) {
|
||||
final Map<String, dynamic> data = new Map<String, dynamic>();
|
||||
data['id'] = entity.id;
|
||||
data['visible_individually'] = entity.visibleIndividually;
|
||||
data['name'] = entity.name;
|
||||
data['namen'] = entity.namen;
|
||||
if (entity.localizedNames != null) {
|
||||
data['localized_names'] = entity.localizedNames.map((v) => v.toJson()).toList();
|
||||
}
|
||||
data['short_description'] = entity.shortDescription;
|
||||
data['short_descriptionn'] = entity.shortDescriptionn;
|
||||
data['full_description'] = entity.fullDescription;
|
||||
data['full_descriptionn'] = entity.fullDescriptionn;
|
||||
data['markas_new'] = entity.markasNew;
|
||||
data['show_on_home_page'] = entity.showOnHomePage;
|
||||
data['meta_keywords'] = entity.metaKeywords;
|
||||
data['meta_description'] = entity.metaDescription;
|
||||
data['meta_title'] = entity.metaTitle;
|
||||
data['allow_customer_reviews'] = entity.allowCustomerReviews;
|
||||
data['approved_rating_sum'] = entity.approvedRatingSum;
|
||||
data['not_approved_rating_sum'] = entity.notApprovedRatingSum;
|
||||
data['approved_total_reviews'] = entity.approvedTotalReviews;
|
||||
data['not_approved_total_reviews'] = entity.notApprovedTotalReviews;
|
||||
data['sku'] = entity.sku;
|
||||
data['is_rx'] = entity.isRx;
|
||||
data['prescription_required'] = entity.prescriptionRequired;
|
||||
data['rx_message'] = entity.rxMessage;
|
||||
data['rx_messagen'] = entity.rxMessagen;
|
||||
data['manufacturer_part_number'] = entity.manufacturerPartNumber;
|
||||
data['gtin'] = entity.gtin;
|
||||
data['is_gift_card'] = entity.isGiftCard;
|
||||
data['require_other_products'] = entity.requireOtherProducts;
|
||||
data['automatically_add_required_products'] = entity.automaticallyAddRequiredProducts;
|
||||
data['is_download'] = entity.isDownload;
|
||||
data['unlimited_downloads'] = entity.unlimitedDownloads;
|
||||
data['max_number_of_downloads'] = entity.maxNumberOfDownloads;
|
||||
data['download_expiration_days'] = entity.downloadExpirationDays;
|
||||
data['has_sample_download'] = entity.hasSampleDownload;
|
||||
data['has_user_agreement'] = entity.hasUserAgreement;
|
||||
data['is_recurring'] = entity.isRecurring;
|
||||
data['recurring_cycle_length'] = entity.recurringCycleLength;
|
||||
data['recurring_total_cycles'] = entity.recurringTotalCycles;
|
||||
data['is_rental'] = entity.isRental;
|
||||
data['rental_price_length'] = entity.rentalPriceLength;
|
||||
data['is_ship_enabled'] = entity.isShipEnabled;
|
||||
data['is_free_shipping'] = entity.isFreeShipping;
|
||||
data['ship_separately'] = entity.shipSeparately;
|
||||
data['additional_shipping_charge'] = entity.additionalShippingCharge;
|
||||
data['is_tax_exempt'] = entity.isTaxExempt;
|
||||
data['is_telecommunications_or_broadcasting_or_electronic_services'] = entity.isTelecommunicationsOrBroadcastingOrElectronicServices;
|
||||
data['use_multiple_warehouses'] = entity.useMultipleWarehouses;
|
||||
data['manage_inventory_method_id'] = entity.manageInventoryMethodId;
|
||||
data['stock_quantity'] = entity.stockQuantity;
|
||||
data['stock_availability'] = entity.stockAvailability;
|
||||
data['stock_availabilityn'] = entity.stockAvailabilityn;
|
||||
data['display_stock_availability'] = entity.displayStockAvailability;
|
||||
data['display_stock_quantity'] = entity.displayStockQuantity;
|
||||
data['min_stock_quantity'] = entity.minStockQuantity;
|
||||
data['notify_admin_for_quantity_below'] = entity.notifyAdminForQuantityBelow;
|
||||
data['allow_back_in_stock_subscriptions'] = entity.allowBackInStockSubscriptions;
|
||||
data['order_minimum_quantity'] = entity.orderMinimumQuantity;
|
||||
data['order_maximum_quantity'] = entity.orderMaximumQuantity;
|
||||
data['allowed_quantities'] = entity.allowedQuantities;
|
||||
data['allow_adding_only_existing_attribute_combinations'] = entity.allowAddingOnlyExistingAttributeCombinations;
|
||||
data['disable_buy_button'] = entity.disableBuyButton;
|
||||
data['disable_wishlist_button'] = entity.disableWishlistButton;
|
||||
data['available_for_pre_order'] = entity.availableForPreOrder;
|
||||
data['pre_order_availability_start_date_time_utc'] = entity.preOrderAvailabilityStartDateTimeUtc;
|
||||
data['call_for_price'] = entity.callForPrice;
|
||||
data['price'] = entity.price;
|
||||
data['old_price'] = entity.oldPrice;
|
||||
data['product_cost'] = entity.productCost;
|
||||
data['special_price'] = entity.specialPrice;
|
||||
data['special_price_start_date_time_utc'] = entity.specialPriceStartDateTimeUtc;
|
||||
data['special_price_end_date_time_utc'] = entity.specialPriceEndDateTimeUtc;
|
||||
data['customer_enters_price'] = entity.customerEntersPrice;
|
||||
data['minimum_customer_entered_price'] = entity.minimumCustomerEnteredPrice;
|
||||
data['maximum_customer_entered_price'] = entity.maximumCustomerEnteredPrice;
|
||||
data['baseprice_enabled'] = entity.basepriceEnabled;
|
||||
data['baseprice_amount'] = entity.basepriceAmount;
|
||||
data['baseprice_base_amount'] = entity.basepriceBaseAmount;
|
||||
data['has_tier_prices'] = entity.hasTierPrices;
|
||||
data['has_discounts_applied'] = entity.hasDiscountsApplied;
|
||||
data['discount_name'] = entity.discountName;
|
||||
data['discount_namen'] = entity.discountNamen;
|
||||
data['discount_description'] = entity.discountDescription;
|
||||
data['discount_Descriptionn'] = entity.discountDescriptionn;
|
||||
data['discount_percentage'] = entity.discountPercentage;
|
||||
data['currency'] = entity.currency;
|
||||
data['currencyn'] = entity.currencyn;
|
||||
data['weight'] = entity.weight;
|
||||
data['length'] = entity.length;
|
||||
data['width'] = entity.width;
|
||||
data['height'] = entity.height;
|
||||
data['available_start_date_time_utc'] = entity.availableStartDateTimeUtc;
|
||||
data['available_end_date_time_utc'] = entity.availableEndDateTimeUtc;
|
||||
data['display_order'] = entity.displayOrder;
|
||||
data['published'] = entity.published;
|
||||
data['deleted'] = entity.deleted;
|
||||
data['created_on_utc'] = entity.createdOnUtc;
|
||||
data['updated_on_utc'] = entity.updatedOnUtc;
|
||||
data['product_type'] = entity.productType;
|
||||
data['parent_grouped_product_id'] = entity.parentGroupedProductId;
|
||||
if (entity.roleIds != null) {
|
||||
data['role_ids'] = [];
|
||||
}
|
||||
if (entity.discountIds != null) {
|
||||
data['discount_ids'] = [];
|
||||
}
|
||||
if (entity.storeIds != null) {
|
||||
data['store_ids'] = [];
|
||||
}
|
||||
data['manufacturer_ids'] = entity.manufacturerIds;
|
||||
if (entity.reviews != null) {
|
||||
data['reviews'] = [];
|
||||
}
|
||||
if (entity.images != null) {
|
||||
data['images'] = entity.images.map((v) => v.toJson()).toList();
|
||||
}
|
||||
if (entity.attributes != null) {
|
||||
data['attributes'] = [];
|
||||
}
|
||||
if (entity.specifications != null) {
|
||||
data['specifications'] = entity.specifications.map((v) => v.toJson()).toList();
|
||||
}
|
||||
if (entity.associatedProductIds != null) {
|
||||
data['associated_product_ids'] = [];
|
||||
}
|
||||
if (entity.tags != null) {
|
||||
data['tags'] = [];
|
||||
}
|
||||
data['vendor_id'] = entity.vendorId;
|
||||
data['se_name'] = entity.seName;
|
||||
return data;
|
||||
}
|
||||
|
||||
offerProductsResponseModelLocalizedNameFromJson(OfferProductsResponseModelLocalizedName data, Map<String, dynamic> json) {
|
||||
if (json['language_id'] != null) {
|
||||
data.languageId = json['language_id']?.toInt();
|
||||
}
|
||||
if (json['localized_name'] != null) {
|
||||
data.localizedName = json['localized_name']?.toString();
|
||||
}
|
||||
return data;
|
||||
}
|
||||
|
||||
Map<String, dynamic> offerProductsResponseModelLocalizedNameToJson(OfferProductsResponseModelLocalizedName entity) {
|
||||
final Map<String, dynamic> data = new Map<String, dynamic>();
|
||||
data['language_id'] = entity.languageId;
|
||||
data['localized_name'] = entity.localizedName;
|
||||
return data;
|
||||
}
|
||||
|
||||
offerProductsResponseModelImageFromJson(OfferProductsResponseModelImage data, Map<String, dynamic> json) {
|
||||
if (json['id'] != null) {
|
||||
data.id = json['id']?.toInt();
|
||||
}
|
||||
if (json['position'] != null) {
|
||||
data.position = json['position']?.toInt();
|
||||
}
|
||||
if (json['src'] != null) {
|
||||
data.src = json['src']?.toString();
|
||||
}
|
||||
if (json['thumb'] != null) {
|
||||
data.thumb = json['thumb']?.toString();
|
||||
}
|
||||
if (json['attachment'] != null) {
|
||||
data.attachment = json['attachment']?.toString();
|
||||
}
|
||||
return data;
|
||||
}
|
||||
|
||||
Map<String, dynamic> offerProductsResponseModelImageToJson(OfferProductsResponseModelImage entity) {
|
||||
final Map<String, dynamic> data = new Map<String, dynamic>();
|
||||
data['id'] = entity.id;
|
||||
data['position'] = entity.position;
|
||||
data['src'] = entity.src;
|
||||
data['thumb'] = entity.thumb;
|
||||
data['attachment'] = entity.attachment;
|
||||
return data;
|
||||
}
|
||||
|
||||
offerProductsResponseModelSpecificationFromJson(OfferProductsResponseModelSpecification data, Map<String, dynamic> json) {
|
||||
if (json['id'] != null) {
|
||||
data.id = json['id']?.toInt();
|
||||
}
|
||||
if (json['display_order'] != null) {
|
||||
data.displayOrder = json['display_order']?.toInt();
|
||||
}
|
||||
if (json['default_value'] != null) {
|
||||
data.defaultValue = json['default_value']?.toString();
|
||||
}
|
||||
if (json['default_valuen'] != null) {
|
||||
data.defaultValuen = json['default_valuen']?.toString();
|
||||
}
|
||||
if (json['name'] != null) {
|
||||
data.name = json['name']?.toString();
|
||||
}
|
||||
if (json['nameN'] != null) {
|
||||
data.nameN = json['nameN']?.toString();
|
||||
}
|
||||
return data;
|
||||
}
|
||||
|
||||
Map<String, dynamic> offerProductsResponseModelSpecificationToJson(OfferProductsResponseModelSpecification entity) {
|
||||
final Map<String, dynamic> data = new Map<String, dynamic>();
|
||||
data['id'] = entity.id;
|
||||
data['display_order'] = entity.displayOrder;
|
||||
data['default_value'] = entity.defaultValue;
|
||||
data['default_valuen'] = entity.defaultValuen;
|
||||
data['name'] = entity.name;
|
||||
data['nameN'] = entity.nameN;
|
||||
return data;
|
||||
}
|
||||
@ -0,0 +1,108 @@
|
||||
// ignore_for_file: non_constant_identifier_names
|
||||
// ignore_for_file: camel_case_types
|
||||
// ignore_for_file: prefer_single_quotes
|
||||
|
||||
// This file is automatically generated. DO NOT EDIT, all your changes would be lost.
|
||||
import 'package:diplomaticquarterapp/core/model/packages_offers/responses/OfferCategoriesResponseModel.dart';
|
||||
import 'package:diplomaticquarterapp/core/model/packages_offers/responses/OfferProductsResponseModel.dart';
|
||||
import 'package:diplomaticquarterapp/generated/json/offer_categories_response_model_entity_helper_.dart';
|
||||
import 'package:diplomaticquarterapp/generated/json/OfferProductsResponseModel_helper_.dart';
|
||||
|
||||
class JsonConvert<T> {
|
||||
T fromJson(Map<String, dynamic> json) {
|
||||
return _getFromJson<T>(runtimeType, this, json);
|
||||
}
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
return _getToJson<T>(runtimeType, this);
|
||||
}
|
||||
|
||||
static _getFromJson<T>(Type type, data, json) {
|
||||
switch (type) {
|
||||
case OfferCategoriesResponseModel:
|
||||
return offerCategoriesResponseModelEntityFromJson(data as OfferCategoriesResponseModel, json) as T;
|
||||
case OfferCategoriesResponseModelLocalizedName:
|
||||
return offerCategoriesResponseModelLocalizedNameFromJson(data as OfferCategoriesResponseModelLocalizedName, json) as T;
|
||||
case OfferCategoriesResponseModelImage:
|
||||
return offerCategoriesResponseModelImageFromJson(data as OfferCategoriesResponseModelImage, json) as T;
|
||||
case OfferProductsResponseModel:
|
||||
return offerProductsResponseModelFromJson(data as OfferProductsResponseModel, json) as T;
|
||||
case OfferProductsResponseModelLocalizedName:
|
||||
return offerProductsResponseModelLocalizedNameFromJson(data as OfferProductsResponseModelLocalizedName, json) as T;
|
||||
case OfferProductsResponseModelImage:
|
||||
return offerProductsResponseModelImageFromJson(data as OfferProductsResponseModelImage, json) as T;
|
||||
case OfferProductsResponseModelSpecification:
|
||||
return offerProductsResponseModelSpecificationFromJson(data as OfferProductsResponseModelSpecification, json) as T;
|
||||
}
|
||||
return data as T;
|
||||
}
|
||||
|
||||
static _getToJson<T>(Type type, data) {
|
||||
switch (type) {
|
||||
case OfferCategoriesResponseModel:
|
||||
return offerCategoriesResponseModelEntityToJson(data as OfferCategoriesResponseModel);
|
||||
case OfferCategoriesResponseModelLocalizedName:
|
||||
return offerCategoriesResponseModelLocalizedNameToJson(data as OfferCategoriesResponseModelLocalizedName);
|
||||
case OfferCategoriesResponseModelImage:
|
||||
return offerCategoriesResponseModelImageToJson(data as OfferCategoriesResponseModelImage);
|
||||
case OfferProductsResponseModel:
|
||||
return offerProductsResponseModelToJson(data as OfferProductsResponseModel);
|
||||
case OfferProductsResponseModelLocalizedName:
|
||||
return offerProductsResponseModelLocalizedNameToJson(data as OfferProductsResponseModelLocalizedName);
|
||||
case OfferProductsResponseModelImage:
|
||||
return offerProductsResponseModelImageToJson(data as OfferProductsResponseModelImage);
|
||||
case OfferProductsResponseModelSpecification:
|
||||
return offerProductsResponseModelSpecificationToJson(data as OfferProductsResponseModelSpecification);
|
||||
}
|
||||
return data as T;
|
||||
}
|
||||
|
||||
//Go back to a single instance by type
|
||||
static _fromJsonSingle<M>(json) {
|
||||
String type = M.toString();
|
||||
if (type == (OfferCategoriesResponseModel).toString()) {
|
||||
return OfferCategoriesResponseModel().fromJson(json);
|
||||
} else if (type == (OfferCategoriesResponseModelLocalizedName).toString()) {
|
||||
return OfferCategoriesResponseModelLocalizedName().fromJson(json);
|
||||
} else if (type == (OfferCategoriesResponseModelImage).toString()) {
|
||||
return OfferCategoriesResponseModelImage().fromJson(json);
|
||||
} else if (type == (OfferProductsResponseModel).toString()) {
|
||||
return OfferProductsResponseModel().fromJson(json);
|
||||
} else if (type == (OfferProductsResponseModelLocalizedName).toString()) {
|
||||
return OfferProductsResponseModelLocalizedName().fromJson(json);
|
||||
} else if (type == (OfferProductsResponseModelImage).toString()) {
|
||||
return OfferProductsResponseModelImage().fromJson(json);
|
||||
} else if (type == (OfferProductsResponseModelSpecification).toString()) {
|
||||
return OfferProductsResponseModelSpecification().fromJson(json);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
//list is returned by type
|
||||
static M _getListChildType<M>(List<Map> data) {
|
||||
if (List<OfferCategoriesResponseModel>() is M) {
|
||||
return data.map((e) => OfferCategoriesResponseModel().fromJson(e)).toList() as M;
|
||||
} else if (List<OfferCategoriesResponseModelLocalizedName>() is M) {
|
||||
return data.map((e) => OfferCategoriesResponseModelLocalizedName().fromJson(e)).toList() as M;
|
||||
} else if (List<OfferCategoriesResponseModelImage>() is M) {
|
||||
return data.map((e) => OfferCategoriesResponseModelImage().fromJson(e)).toList() as M;
|
||||
} else if (List<OfferProductsResponseModel>() is M) {
|
||||
return data.map((e) => OfferProductsResponseModel().fromJson(e)).toList() as M;
|
||||
} else if (List<OfferProductsResponseModelLocalizedName>() is M) {
|
||||
return data.map((e) => OfferProductsResponseModelLocalizedName().fromJson(e)).toList() as M;
|
||||
} else if (List<OfferProductsResponseModelImage>() is M) {
|
||||
return data.map((e) => OfferProductsResponseModelImage().fromJson(e)).toList() as M;
|
||||
} else if (List<OfferProductsResponseModelSpecification>() is M) {
|
||||
return data.map((e) => OfferProductsResponseModelSpecification().fromJson(e)).toList() as M;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
static M fromJsonAsT<M>(json) {
|
||||
if (json is List) {
|
||||
return _getListChildType<M>(json);
|
||||
} else {
|
||||
return _fromJsonSingle<M>(json) as M;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,21 @@
|
||||
// ignore_for_file: non_constant_identifier_names
|
||||
// ignore_for_file: camel_case_types
|
||||
// ignore_for_file: prefer_single_quotes
|
||||
|
||||
// This file is automatically generated. DO NOT EDIT, all your changes would be lost.
|
||||
|
||||
class JSONField {
|
||||
//Specify the parse field name
|
||||
final String name;
|
||||
|
||||
//Specify the time resolution format
|
||||
final String format;
|
||||
|
||||
//Whether to participate in toJson
|
||||
final bool serialize;
|
||||
|
||||
//Whether to participate in fromMap
|
||||
final bool deserialize;
|
||||
|
||||
const JSONField({this.name, this.format, this.serialize, this.deserialize});
|
||||
}
|
||||
@ -0,0 +1,172 @@
|
||||
import 'package:diplomaticquarterapp/core/model/packages_offers/responses/OfferCategoriesResponseModel.dart';
|
||||
|
||||
offerCategoriesResponseModelEntityFromJson(OfferCategoriesResponseModel data, Map<String, dynamic> json) {
|
||||
if (json['id'] != null) {
|
||||
data.id = json['id']?.toString();
|
||||
}
|
||||
if (json['name'] != null) {
|
||||
data.name = json['name']?.toString();
|
||||
}
|
||||
if (json['namen'] != null) {
|
||||
data.namen = json['namen']?.toString();
|
||||
}
|
||||
if (json['localized_names'] != null) {
|
||||
data.localizedNames = new List<OfferCategoriesResponseModelLocalizedName>();
|
||||
(json['localized_names'] as List).forEach((v) {
|
||||
data.localizedNames.add(new OfferCategoriesResponseModelLocalizedName().fromJson(v));
|
||||
});
|
||||
}
|
||||
if (json['description'] != null) {
|
||||
data.description = json['description'];
|
||||
}
|
||||
if (json['category_template_id'] != null) {
|
||||
data.categoryTemplateId = json['category_template_id']?.toInt();
|
||||
}
|
||||
if (json['meta_keywords'] != null) {
|
||||
data.metaKeywords = json['meta_keywords']?.toString();
|
||||
}
|
||||
if (json['meta_description'] != null) {
|
||||
data.metaDescription = json['meta_description']?.toString();
|
||||
}
|
||||
if (json['meta_title'] != null) {
|
||||
data.metaTitle = json['meta_title']?.toString();
|
||||
}
|
||||
if (json['parent_category_id'] != null) {
|
||||
data.parentCategoryId = json['parent_category_id']?.toInt();
|
||||
}
|
||||
if (json['page_size'] != null) {
|
||||
data.pageSize = json['page_size']?.toInt();
|
||||
}
|
||||
if (json['page_size_options'] != null) {
|
||||
data.pageSizeOptions = json['page_size_options']?.toString();
|
||||
}
|
||||
if (json['price_ranges'] != null) {
|
||||
data.priceRanges = json['price_ranges'];
|
||||
}
|
||||
if (json['show_on_home_page'] != null) {
|
||||
data.showOnHomePage = json['show_on_home_page'];
|
||||
}
|
||||
if (json['include_in_top_menu'] != null) {
|
||||
data.includeInTopMenu = json['include_in_top_menu'];
|
||||
}
|
||||
if (json['has_discounts_applied'] != null) {
|
||||
data.hasDiscountsApplied = json['has_discounts_applied'];
|
||||
}
|
||||
if (json['published'] != null) {
|
||||
data.published = json['published'];
|
||||
}
|
||||
if (json['deleted'] != null) {
|
||||
data.deleted = json['deleted'];
|
||||
}
|
||||
if (json['display_order'] != null) {
|
||||
data.displayOrder = json['display_order']?.toInt();
|
||||
}
|
||||
if (json['created_on_utc'] != null) {
|
||||
data.createdOnUtc = json['created_on_utc']?.toString();
|
||||
}
|
||||
if (json['updated_on_utc'] != null) {
|
||||
data.updatedOnUtc = json['updated_on_utc']?.toString();
|
||||
}
|
||||
if (json['role_ids'] != null) {
|
||||
data.roleIds = new List<dynamic>();
|
||||
data.roleIds.addAll(json['role_ids']);
|
||||
}
|
||||
if (json['discount_ids'] != null) {
|
||||
data.discountIds = new List<dynamic>();
|
||||
data.discountIds.addAll(json['discount_ids']);
|
||||
}
|
||||
if (json['store_ids'] != null) {
|
||||
data.storeIds = new List<dynamic>();
|
||||
data.storeIds.addAll(json['store_ids']);
|
||||
}
|
||||
if (json['image'] != null) {
|
||||
data.image = new OfferCategoriesResponseModelImage().fromJson(json['image']);
|
||||
}
|
||||
if (json['se_name'] != null) {
|
||||
data.seName = json['se_name']?.toString();
|
||||
}
|
||||
if (json['is_leaf'] != null) {
|
||||
data.isLeaf = json['is_leaf'];
|
||||
}
|
||||
return data;
|
||||
}
|
||||
|
||||
Map<String, dynamic> offerCategoriesResponseModelEntityToJson(OfferCategoriesResponseModel entity) {
|
||||
final Map<String, dynamic> data = new Map<String, dynamic>();
|
||||
data['id'] = entity.id;
|
||||
data['name'] = entity.name;
|
||||
data['namen'] = entity.namen;
|
||||
if (entity.localizedNames != null) {
|
||||
data['localized_names'] = entity.localizedNames.map((v) => v.toJson()).toList();
|
||||
}
|
||||
data['description'] = entity.description;
|
||||
data['category_template_id'] = entity.categoryTemplateId;
|
||||
data['meta_keywords'] = entity.metaKeywords;
|
||||
data['meta_description'] = entity.metaDescription;
|
||||
data['meta_title'] = entity.metaTitle;
|
||||
data['parent_category_id'] = entity.parentCategoryId;
|
||||
data['page_size'] = entity.pageSize;
|
||||
data['page_size_options'] = entity.pageSizeOptions;
|
||||
data['price_ranges'] = entity.priceRanges;
|
||||
data['show_on_home_page'] = entity.showOnHomePage;
|
||||
data['include_in_top_menu'] = entity.includeInTopMenu;
|
||||
data['has_discounts_applied'] = entity.hasDiscountsApplied;
|
||||
data['published'] = entity.published;
|
||||
data['deleted'] = entity.deleted;
|
||||
data['display_order'] = entity.displayOrder;
|
||||
data['created_on_utc'] = entity.createdOnUtc;
|
||||
data['updated_on_utc'] = entity.updatedOnUtc;
|
||||
if (entity.roleIds != null) {
|
||||
data['role_ids'] = [];
|
||||
}
|
||||
if (entity.discountIds != null) {
|
||||
data['discount_ids'] = [];
|
||||
}
|
||||
if (entity.storeIds != null) {
|
||||
data['store_ids'] = [];
|
||||
}
|
||||
if (entity.image != null) {
|
||||
data['image'] = entity.image.toJson();
|
||||
}
|
||||
data['se_name'] = entity.seName;
|
||||
data['is_leaf'] = entity.isLeaf;
|
||||
return data;
|
||||
}
|
||||
|
||||
offerCategoriesResponseModelLocalizedNameFromJson(OfferCategoriesResponseModelLocalizedName data, Map<String, dynamic> json) {
|
||||
if (json['language_id'] != null) {
|
||||
data.languageId = json['language_id']?.toInt();
|
||||
}
|
||||
if (json['localized_name'] != null) {
|
||||
data.localizedName = json['localized_name']?.toString();
|
||||
}
|
||||
return data;
|
||||
}
|
||||
|
||||
Map<String, dynamic> offerCategoriesResponseModelLocalizedNameToJson(OfferCategoriesResponseModelLocalizedName entity) {
|
||||
final Map<String, dynamic> data = new Map<String, dynamic>();
|
||||
data['language_id'] = entity.languageId;
|
||||
data['localized_name'] = entity.localizedName;
|
||||
return data;
|
||||
}
|
||||
|
||||
offerCategoriesResponseModelImageFromJson(OfferCategoriesResponseModelImage data, Map<String, dynamic> json) {
|
||||
if (json['src'] != null) {
|
||||
data.src = json['src']?.toString();
|
||||
}
|
||||
if (json['thumb'] != null) {
|
||||
data.thumb = json['thumb'];
|
||||
}
|
||||
if (json['attachment'] != null) {
|
||||
data.attachment = json['attachment'];
|
||||
}
|
||||
return data;
|
||||
}
|
||||
|
||||
Map<String, dynamic> offerCategoriesResponseModelImageToJson(OfferCategoriesResponseModelImage entity) {
|
||||
final Map<String, dynamic> data = new Map<String, dynamic>();
|
||||
data['src'] = entity.src;
|
||||
data['thumb'] = entity.thumb;
|
||||
data['attachment'] = entity.attachment;
|
||||
return data;
|
||||
}
|
||||
@ -0,0 +1,62 @@
|
||||
import 'package:diplomaticquarterapp/core/model/packages_offers/requests/OffersCategoriesRequestModel.dart';
|
||||
import 'package:diplomaticquarterapp/core/service/packages_offers/PackagesOffersServices.dart';
|
||||
import 'package:diplomaticquarterapp/locator.dart';
|
||||
import 'package:diplomaticquarterapp/widgets/data_display/text.dart';
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:shimmer/shimmer.dart';
|
||||
|
||||
class ShimmerLoadingWidget extends StatefulWidget {
|
||||
Future<void> Function() onPreProccess;
|
||||
Widget Function() loadingWidget;
|
||||
Widget Function() realWidget;
|
||||
Function() onFinish;
|
||||
ShimmerLoadingWidget({this.onPreProccess, this.loadingWidget, this.realWidget, this.onFinish});
|
||||
|
||||
void loadWidget() {}
|
||||
|
||||
@override
|
||||
State<StatefulWidget> createState() => _ShimmerLoadingWidgetState();
|
||||
}
|
||||
|
||||
class _ShimmerLoadingWidgetState extends State<ShimmerLoadingWidget> {
|
||||
var service = locator<OffersAndPackagesServices>();
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
Stream<bool> preProccess = (() async* {
|
||||
await super.widget.onPreProccess();
|
||||
})();
|
||||
|
||||
// TODO: implement build
|
||||
return StreamBuilder(
|
||||
stream: preProccess,
|
||||
builder: (context, snapshot) {
|
||||
Widget widget;
|
||||
if (snapshot.hasError) {
|
||||
widget = Texts(
|
||||
"Error happened",
|
||||
color: Colors.red,
|
||||
fontSize: 20,
|
||||
bold: true,
|
||||
);
|
||||
} else {
|
||||
switch (snapshot.connectionState) {
|
||||
case ConnectionState.none:
|
||||
break;
|
||||
case ConnectionState.active:
|
||||
break;
|
||||
case ConnectionState.waiting:
|
||||
widget = Shimmer.fromColors(child: super.widget.loadingWidget(), baseColor: Colors.red, highlightColor: Colors.yellow);
|
||||
break;
|
||||
case ConnectionState.done:
|
||||
widget = super.widget.realWidget();
|
||||
if (super.widget.onFinish != null) super.widget.onFinish();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return widget;
|
||||
});
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,282 @@
|
||||
import 'dart:developer';
|
||||
|
||||
import 'package:carousel_pro/carousel_pro.dart';
|
||||
import 'package:carousel_slider/carousel_slider.dart';
|
||||
import 'package:diplomaticquarterapp/core/model/packages_offers/requests/OffersCategoriesRequestModel.dart';
|
||||
import 'package:diplomaticquarterapp/core/model/packages_offers/requests/OffersProductsRequestModel.dart';
|
||||
import 'package:diplomaticquarterapp/core/service/packages_offers/PackagesOffersServices.dart';
|
||||
import 'package:diplomaticquarterapp/core/viewModels/packages_offers/PackagesOffersViewModel.dart';
|
||||
import 'package:diplomaticquarterapp/locator.dart';
|
||||
import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart';
|
||||
import 'package:diplomaticquarterapp/widgets/buttons/button.dart';
|
||||
import 'package:diplomaticquarterapp/widgets/data_display/text.dart';
|
||||
import 'package:diplomaticquarterapp/widgets/loadings/ShimmerLoading.dart';
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:hexcolor/hexcolor.dart';
|
||||
|
||||
class OffersAndPackagesWidget extends StatefulWidget {
|
||||
final List<OfferPackagesItemModel> models;
|
||||
OffersAndPackagesWidget(this.models);
|
||||
|
||||
@override
|
||||
_OffersAndPackagesWidgetState createState() => _OffersAndPackagesWidgetState();
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - -
|
||||
// Carousel Widget
|
||||
// - - - - - - - - - - - - - -
|
||||
class _OffersAndPackagesWidgetState extends State<OffersAndPackagesWidget> {
|
||||
final double HEIGHT = 140; //200;
|
||||
final int AUTO_SLIDE_INTERVAL = 3;
|
||||
final int ANIMATION_DURATION = 1000;
|
||||
|
||||
var service = locator<OffersAndPackagesServices>();
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
// TODO: implement build
|
||||
var option = CarouselOptions(
|
||||
height: HEIGHT,
|
||||
aspectRatio: 16 / 9,
|
||||
viewportFraction: 1,
|
||||
initialPage: 0,
|
||||
enableInfiniteScroll: true,
|
||||
reverse: false,
|
||||
autoPlay: true,
|
||||
autoPlayInterval: Duration(seconds: AUTO_SLIDE_INTERVAL),
|
||||
autoPlayAnimationDuration: Duration(milliseconds: ANIMATION_DURATION),
|
||||
autoPlayCurve: Curves.fastOutSlowIn,
|
||||
enlargeCenterPage: true,
|
||||
scrollDirection: Axis.horizontal,
|
||||
);
|
||||
|
||||
// return Container(
|
||||
// height: HEIGHT,
|
||||
// child: CarouselSlider.builder(
|
||||
// itemCount: widget.models.length,
|
||||
// itemBuilder: (BuildContext context, int itemIndex) {
|
||||
// var item = widget.models[itemIndex];
|
||||
// return OfferPackagesItemWidget(model: item);
|
||||
// },
|
||||
// options: option));
|
||||
|
||||
var header = Padding(
|
||||
padding: const EdgeInsets.only(right: 15, left: 15),
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
Texts(
|
||||
TranslationBase.of(context).offerAndPackages,
|
||||
color: Colors.red,
|
||||
fontSize: 15,
|
||||
bold: true,
|
||||
),
|
||||
Texts(
|
||||
TranslationBase.of(context).viewAll,
|
||||
color: Colors.red,
|
||||
fontSize: 12,
|
||||
)
|
||||
],
|
||||
),
|
||||
);
|
||||
|
||||
var headerSpaceVisible = true;
|
||||
var headerSpace = Visibility(
|
||||
child: header,
|
||||
visible: headerSpaceVisible,
|
||||
);
|
||||
|
||||
return Column(
|
||||
children: [
|
||||
headerSpace,
|
||||
ShimmerLoadingWidget(
|
||||
onPreProccess: () {
|
||||
return service.getAllCategories(OffersCategoriesRequestModel(limit: 100, page: 1, sinceId: 0));
|
||||
},
|
||||
loadingWidget: () {
|
||||
return Texts(
|
||||
"Loading...",
|
||||
fontSize: 20,
|
||||
color: Colors.green,
|
||||
marginBottom: 10,
|
||||
marginTop: 10,
|
||||
);
|
||||
},
|
||||
realWidget: () {
|
||||
if (widget.models.isNotEmpty) {
|
||||
return Container(
|
||||
child: CarouselSlider.builder(
|
||||
itemCount: widget.models.length,
|
||||
itemBuilder: (BuildContext context, int itemIndex) {
|
||||
var item = widget.models[itemIndex];
|
||||
return OfferPackagesItemWidget(model: item);
|
||||
},
|
||||
options: option),
|
||||
);
|
||||
} else {
|
||||
return Container();
|
||||
}
|
||||
},
|
||||
onFinish: () {},
|
||||
)
|
||||
|
||||
//
|
||||
],
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - -
|
||||
// Carousel Item Widget
|
||||
// - - - - - - - - - - - - - -
|
||||
class OfferPackagesItemWidget extends StatefulWidget {
|
||||
final OfferPackagesItemModel model;
|
||||
OfferPackagesItemWidget({@required this.model});
|
||||
|
||||
@override
|
||||
State<OfferPackagesItemWidget> createState() {
|
||||
return _OfferPackagesItemWidgetState();
|
||||
}
|
||||
}
|
||||
|
||||
class _OfferPackagesItemWidgetState extends State<OfferPackagesItemWidget> {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
var model = widget.model;
|
||||
|
||||
return Card(
|
||||
clipBehavior: Clip.hardEdge,
|
||||
elevation: 5,
|
||||
shadowColor: Colors.grey,
|
||||
margin: EdgeInsets.only(left: 15, right: 15, bottom: 15),
|
||||
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(10), side: BorderSide(color: Colors.white, width: 1)),
|
||||
child: Container(
|
||||
padding: EdgeInsets.only(left: 10, right: 20, top: 5, bottom: 5),
|
||||
width: MediaQuery.of(context).size.width,
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Texts(
|
||||
widget.model.title,
|
||||
color: Colors.red,
|
||||
fontSize: 20,
|
||||
),
|
||||
Texts(
|
||||
widget.model.desc,
|
||||
color: Colors.red,
|
||||
fontSize: 12,
|
||||
),
|
||||
Container(
|
||||
alignment: Alignment.bottomLeft,
|
||||
child: MaterialButton(
|
||||
height: 30,
|
||||
color: HexColor('#D81A2E'),
|
||||
onPressed: () => widget.model.action.onClick(model.item),
|
||||
child: Texts(
|
||||
TranslationBase.of(context).view,
|
||||
color: Colors.white,
|
||||
fontSize: 12,
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
)
|
||||
|
||||
// Container(
|
||||
// child: Stack(
|
||||
// children: [
|
||||
// Container(
|
||||
// width: MediaQuery.of(context).size.width,
|
||||
// child: Image.network(
|
||||
// model.bannerUrl,
|
||||
// fit: BoxFit.cover,
|
||||
// ),
|
||||
// ),
|
||||
// Align(
|
||||
// alignment: Alignment.bottomRight,
|
||||
// child: Container(
|
||||
// height: 25,
|
||||
// margin: EdgeInsets.all(5),
|
||||
// child: Row(
|
||||
// mainAxisAlignment: MainAxisAlignment.end,
|
||||
// children: [
|
||||
// MaterialButton(
|
||||
// color: HexColor('#D81A2E'),
|
||||
// onPressed: () => model.action.onClick(model.item),
|
||||
// child: Texts(
|
||||
// TranslationBase.of(context).view,
|
||||
// color: Colors.white,
|
||||
// fontSize: 12,
|
||||
// marginLeft: 2,
|
||||
// marginRight: 2,
|
||||
// ),
|
||||
// ),
|
||||
// VerticalDivider(
|
||||
// color: Colors.white,
|
||||
// thickness: 1,
|
||||
// ),
|
||||
// MaterialButton(
|
||||
// color: HexColor('#D81A2E'),
|
||||
// onPressed: () => model.action.onClick(model.item),
|
||||
// child: Texts(
|
||||
// TranslationBase.of(context).viewAll,
|
||||
// color: Colors.white,
|
||||
// fontSize: 12,
|
||||
// marginLeft: 2,
|
||||
// marginRight: 2,
|
||||
// ),
|
||||
// )
|
||||
// ],
|
||||
// )),
|
||||
// ),
|
||||
// ],
|
||||
// ),
|
||||
// ),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - -
|
||||
// Carousel Item Models
|
||||
// - - - - - - - - - - - - - -
|
||||
class OfferPackagesItemModel<T> {
|
||||
String bannerUrl;
|
||||
String title;
|
||||
String desc;
|
||||
T item;
|
||||
OfferPackagesItemActionModel action;
|
||||
|
||||
OfferPackagesItemModel(this.bannerUrl, this.title, this.desc, this.item, this.action);
|
||||
|
||||
static List<OfferPackagesItemModel> dummy() {
|
||||
List<OfferPackagesItemModel> list = List<OfferPackagesItemModel>();
|
||||
list.add(OfferPackagesItemModel<String>(
|
||||
"http://blog.naseej.com/hs-fs/hubfs/ellucian-banner-9.jpg?width=1486&height=782&name=ellucian-banner-9.jpg",
|
||||
"Sample Title",
|
||||
"Sample Desc here ....",
|
||||
"Sample Item",
|
||||
OfferPackagesItemActionModel<String>("Click here", (item) {
|
||||
var vm_categories = locator<OfferCategoriesViewModel>();
|
||||
vm_categories.service.getAllCategories(OffersCategoriesRequestModel(limit: 100, page: 1, sinceId: 0)).then((value) {
|
||||
print(value.toString());
|
||||
print(value.toString());
|
||||
});
|
||||
|
||||
var vm_products = locator<OfferProductsViewModel>();
|
||||
vm_products.service.getAllProducts(OffersProductsRequestModel(categoryId: 125, limit: 100, page: 1, sinceId: 0)).then((value) {
|
||||
print(value.toString());
|
||||
print(value.toString());
|
||||
});
|
||||
})));
|
||||
return list;
|
||||
}
|
||||
}
|
||||
|
||||
class OfferPackagesItemActionModel<T> {
|
||||
String actionTitle;
|
||||
Function(dynamic) onClick;
|
||||
|
||||
OfferPackagesItemActionModel(this.actionTitle, this.onClick);
|
||||
}
|
||||
Loading…
Reference in New Issue