initial commit to gitea
This commit is contained in:
@@ -14,6 +14,7 @@ class Product {
|
||||
String description;
|
||||
String detailDescription;
|
||||
String imagePath;
|
||||
String secondImagePath;
|
||||
double monthSales;
|
||||
int rate;
|
||||
double leftNum;
|
||||
@@ -30,26 +31,28 @@ class Product {
|
||||
this.price = price;
|
||||
this.description = description;
|
||||
this.imagePath = imagePath;
|
||||
this.secondImagePath = secondImagePath;
|
||||
this.productAttributes = productAttributes;
|
||||
}
|
||||
|
||||
Product.fromJson(Map<String, dynamic> json)
|
||||
: id = json['id'],
|
||||
businessId = json['business_id'],
|
||||
categoryId = json['category_id'],
|
||||
name = json['name'],
|
||||
price = double.parse(json['price'].toString()),
|
||||
regularPrice = double.parse(json['regular_price'].toString()),
|
||||
description = json['description'],
|
||||
detailDescription = json['detail_description'],
|
||||
imagePath = json['image_path'],
|
||||
monthSales = json['month_sales'] != null ? double.parse(json['month_sales'].toString()) : 0.0,
|
||||
rate = json['rate'],
|
||||
leftNum = json['left_num'] != null ? double.parse(json['left_num'].toString()) : 0.0,
|
||||
productAttributes = json['productattributes'] != null ? (json['productattributes'] as List).map((i) => ProductAttribute.fromJson(i)).toList() : [],
|
||||
nonInventory = json['non_inventory'],
|
||||
extraData = json['extra_data'],
|
||||
subproducts = json['subproducts'] != null ? (json['subproducts'] as List).map((e) => Subproduct.fromJson(e)).toList() : [];
|
||||
: id = json['id'],
|
||||
businessId = json['business_id'],
|
||||
categoryId = json['category_id'],
|
||||
name = json['name'],
|
||||
price = double.parse(json['price'].toString()),
|
||||
regularPrice = double.parse(json['regular_price'].toString()),
|
||||
description = json['description'],
|
||||
detailDescription = json['detail_description'],
|
||||
imagePath = json['image_path'],
|
||||
secondImagePath = json['second_image_path'],
|
||||
monthSales = json['month_sales'] != null ? double.parse(json['month_sales'].toString()) : 0.0,
|
||||
rate = json['rate'],
|
||||
leftNum = json['left_num'] != null ? double.parse(json['left_num'].toString()) : 0.0,
|
||||
productAttributes = json['productattributes'] != null ? (json['productattributes'] as List).map((i) => ProductAttribute.fromJson(i)).toList() : [],
|
||||
nonInventory = json['non_inventory'],
|
||||
extraData = json['extra_data'],
|
||||
subproducts = json['subproducts'] != null ? (json['subproducts'] as List).map((e) => Subproduct.fromJson(e)).toList() : [];
|
||||
|
||||
Map<String, dynamic> toJson() => {
|
||||
'id': id,
|
||||
@@ -61,6 +64,7 @@ class Product {
|
||||
'description': description,
|
||||
'detail_description': detailDescription,
|
||||
'image_path': imagePath,
|
||||
'second_image_path': secondImagePath,
|
||||
'month_sales': monthSales,
|
||||
'rate': rate,
|
||||
'left_num': leftNum,
|
||||
|
||||
Reference in New Issue
Block a user