backup. before shop update
This commit is contained in:
93
lib/models/product_detail.dart
Normal file
93
lib/models/product_detail.dart
Normal file
@@ -0,0 +1,93 @@
|
||||
|
||||
import 'dart:convert';
|
||||
|
||||
import 'package:flutter_wisetronic/models/Subproduct.dart';
|
||||
|
||||
import 'category.dart';
|
||||
import 'product_attribute.dart';
|
||||
import 'product_image.dart';
|
||||
|
||||
class ProductDetail {
|
||||
int id;
|
||||
String image;
|
||||
List<ProductImage> images;
|
||||
String sku;
|
||||
String name;
|
||||
double price;
|
||||
double regularPrice;
|
||||
String description;
|
||||
String description2;
|
||||
String detailDescription;
|
||||
double monthSales;
|
||||
int rate;
|
||||
double leftNum;
|
||||
List<ProductAttribute> productAttributes;
|
||||
bool nonInventory;
|
||||
String extraData;
|
||||
String purchaseNote;
|
||||
double weight;
|
||||
double dimentionsLength;
|
||||
double dimentionsWidth;
|
||||
double dimentionsHeight;
|
||||
bool reviewsAllowed;
|
||||
List<Category> categories;
|
||||
List<Subproduct> subproducts;
|
||||
|
||||
ProductDetail.fromJson(Map<String, dynamic> json)
|
||||
: id = json['id'],
|
||||
image = json['image'],
|
||||
images = (json['images'] as List).map((e) => ProductImage.fromJson(e)).toList(),
|
||||
sku = json['sku'],
|
||||
name = json['name'],
|
||||
price = double.parse(json['price'].toString()),
|
||||
regularPrice = double.parse(json['regular_price'].toString()),
|
||||
description = json['description'],
|
||||
description2 = json['description2'],
|
||||
detailDescription = json['detail_description'],
|
||||
reviewsAllowed = json['reviews_allowed'],
|
||||
monthSales = double.parse(json['month_sales'].toString()),
|
||||
rate = json['rate'],
|
||||
leftNum = double.parse(json['left_num'].toString()),
|
||||
productAttributes = (json['productattributes'] as List).map((i) => ProductAttribute.fromJson(i)).toList(),
|
||||
nonInventory = json['non_inventory'],
|
||||
extraData = json['extra_data'],
|
||||
purchaseNote = json['purchase_note'],
|
||||
weight = double.parse(json['weight'].toString()),
|
||||
dimentionsLength = double.parse(json['dimentions_length'].toString()),
|
||||
dimentionsWidth = double.parse(json['dimentions_width'].toString()),
|
||||
dimentionsHeight = double.parse(json['dimentions_height'].toString()),
|
||||
categories = (json['categories'] as List).map((e) => Category.fromJson(e)).toList(),
|
||||
subproducts = (json['subproducts'] as List).map((e) => Subproduct.fromJson(e)).toList();
|
||||
|
||||
Map<String, dynamic> toJson() => {
|
||||
'id': id,
|
||||
'image': image,
|
||||
'images': images,
|
||||
'sku': sku,
|
||||
'name': name,
|
||||
'price': price,
|
||||
'regular_price': regularPrice,
|
||||
'description': description,
|
||||
'description2': description2,
|
||||
'detail_description': detailDescription,
|
||||
'month_sales': monthSales,
|
||||
'rate': rate,
|
||||
'left_num': leftNum,
|
||||
'productattributes': productAttributes,
|
||||
'non_inventory': nonInventory,
|
||||
'extra_data': extraData,
|
||||
'purchase_note': purchaseNote,
|
||||
'weight': weight,
|
||||
'dimentions_length': dimentionsLength,
|
||||
'dimentions_width': dimentionsWidth,
|
||||
'dimentions_height': dimentionsHeight,
|
||||
'reviews_allowed': reviewsAllowed,
|
||||
'categories': categories,
|
||||
'subproducts': subproducts,
|
||||
};
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return json.encode(this);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user