Initial commit
This commit is contained in:
46
app_code/lib/models/auth/login_response_model.dart
Normal file
46
app_code/lib/models/auth/login_response_model.dart
Normal file
@@ -0,0 +1,46 @@
|
||||
// To parse this JSON data, do
|
||||
//
|
||||
// final loginResponse = loginResponseFromJson(jsonString);
|
||||
|
||||
import 'dart:convert';
|
||||
|
||||
import 'package:grostore/models/common/user_info.dart';
|
||||
|
||||
LoginResponse loginResponseFromJson(String str) => LoginResponse.fromJson(json.decode(str));
|
||||
LoginResponse loginResponseDefaultValue() => LoginResponse(result: false, message: "Faild", accessToken: "", tokenType: "",user: UserInfo.init());
|
||||
|
||||
String loginResponseToJson(LoginResponse data) => json.encode(data.toJson());
|
||||
|
||||
class LoginResponse {
|
||||
bool result;
|
||||
String message;
|
||||
String accessToken;
|
||||
String tokenType;
|
||||
UserInfo user;
|
||||
|
||||
|
||||
LoginResponse({
|
||||
required this.result,
|
||||
required this.message,
|
||||
required this.accessToken,
|
||||
required this.tokenType,
|
||||
required this.user
|
||||
|
||||
});
|
||||
|
||||
factory LoginResponse.fromJson(Map<String, dynamic> json) => LoginResponse(
|
||||
result: json["result"],
|
||||
message: json["message"],
|
||||
accessToken: json["access_token"],
|
||||
tokenType: json["token_type"],
|
||||
user: UserInfo.fromJson(json["user"]),
|
||||
);
|
||||
|
||||
Map<String, dynamic> toJson() => {
|
||||
"result": result,
|
||||
"message": message,
|
||||
"access_token": accessToken,
|
||||
"token_type": tokenType,
|
||||
"user": user.toJson(),
|
||||
};
|
||||
}
|
||||
117
app_code/lib/models/auth/registration_response_model.dart
Normal file
117
app_code/lib/models/auth/registration_response_model.dart
Normal file
@@ -0,0 +1,117 @@
|
||||
// To parse this JSON data, do
|
||||
//
|
||||
// final registrationResponse = registrationResponseFromJson(jsonString);
|
||||
|
||||
import 'dart:convert';
|
||||
|
||||
import 'package:grostore/models/common/user_info.dart';
|
||||
|
||||
RegistrationResponse registrationResponseFromJson(String str) =>RegistrationResponse.fromJson(json.decode(str));
|
||||
|
||||
RegistrationResponses registrationResFromJson(String str) =>RegistrationResponses.fromJson(json.decode(str));
|
||||
|
||||
RegistrationResp registrationRespFromJson(String str) =>RegistrationResp.fromJson(json.decode(str));
|
||||
|
||||
RegistrationResp registrationRespDefault() =>RegistrationResp.fromJson(json.decode('''{
|
||||
"result": false,
|
||||
"message": "",
|
||||
"code":1}'''));
|
||||
|
||||
RegistrationResponse registrationResponseDefault() =>RegistrationResponse.fromJson(json.decode('''{
|
||||
"result": false,
|
||||
"message": "",
|
||||
"access_token": "",
|
||||
"token_type": ""
|
||||
}'''));
|
||||
|
||||
RegistrationResponses registrationResponsesDefault() => RegistrationResponses.fromJson(json.decode('''{
|
||||
"result": false,
|
||||
"message": "",
|
||||
"access_token": "",
|
||||
"token_type": ""
|
||||
}'''));
|
||||
|
||||
String registrationResponseToJson(RegistrationResponse data) =>json.encode(data.toJson());
|
||||
|
||||
|
||||
class RegistrationResponse {
|
||||
bool result;
|
||||
String message;
|
||||
String accessToken;
|
||||
String tokenType;
|
||||
UserInfo user;
|
||||
|
||||
RegistrationResponse(
|
||||
{required this.result,
|
||||
required this.message,
|
||||
required this.accessToken,
|
||||
required this.tokenType,
|
||||
required this.user});
|
||||
|
||||
factory RegistrationResponse.fromJson(Map<String, dynamic> json) =>
|
||||
RegistrationResponse(
|
||||
result: json["result"],
|
||||
message: json["message"],
|
||||
accessToken: json["access_token"],
|
||||
tokenType: json["token_type"],
|
||||
user: UserInfo.fromJson(json["user"]),
|
||||
);
|
||||
|
||||
Map<String, dynamic> toJson() => {
|
||||
"result": result,
|
||||
"message": message,
|
||||
"access_token": accessToken,
|
||||
"token_type": tokenType,
|
||||
"user": user.toJson(),
|
||||
};
|
||||
}
|
||||
|
||||
class RegistrationResponses {
|
||||
bool result;
|
||||
var message;
|
||||
String accessToken;
|
||||
String tokenType;
|
||||
|
||||
RegistrationResponses({
|
||||
required this.result,
|
||||
required this.message,
|
||||
required this.accessToken,
|
||||
required this.tokenType,
|
||||
});
|
||||
|
||||
factory RegistrationResponses.fromJson(Map<String, dynamic> json) =>
|
||||
RegistrationResponses(
|
||||
result: json["result"],
|
||||
message: json["message"],
|
||||
accessToken: json["access_token"],
|
||||
tokenType: json["token_type"],
|
||||
);
|
||||
|
||||
Map<String, dynamic> toJson() => {
|
||||
"result": result,
|
||||
"message": message,
|
||||
"access_token": accessToken,
|
||||
"token_type": tokenType,
|
||||
};
|
||||
}
|
||||
|
||||
class RegistrationResp {
|
||||
bool result;
|
||||
String message;
|
||||
int code;
|
||||
|
||||
RegistrationResp({required this.result, required this.message, required this.code});
|
||||
|
||||
factory RegistrationResp.fromJson(Map<String, dynamic> json) =>
|
||||
RegistrationResp(
|
||||
result: json["result"],
|
||||
message: json["message"],
|
||||
code: json["code"],
|
||||
);
|
||||
|
||||
Map<String, dynamic> toJson() => {
|
||||
"result": result,
|
||||
"message": message,
|
||||
"code": code,
|
||||
};
|
||||
}
|
||||
34
app_code/lib/models/auth/token_check_response.dart
Normal file
34
app_code/lib/models/auth/token_check_response.dart
Normal file
@@ -0,0 +1,34 @@
|
||||
// To parse this JSON data, do
|
||||
//
|
||||
// final tokenCheckResponse = tokenCheckResponseFromJson(jsonString);
|
||||
|
||||
import 'dart:convert';
|
||||
|
||||
import 'package:grostore/models/common/user_info.dart';
|
||||
|
||||
TokenCheckResponse tokenCheckResponseFromJson(String str) => TokenCheckResponse.fromJson(json.decode(str));
|
||||
|
||||
String tokenCheckResponseToJson(TokenCheckResponse data) => json.encode(data.toJson());
|
||||
|
||||
class TokenCheckResponse {
|
||||
bool result;
|
||||
UserInfo user;
|
||||
|
||||
TokenCheckResponse({
|
||||
required this.result,
|
||||
required this.user,
|
||||
});
|
||||
|
||||
factory TokenCheckResponse.fromJson(Map<String, dynamic> json) => TokenCheckResponse(
|
||||
result: json["result"],
|
||||
user: UserInfo.fromJson(json["user"]),
|
||||
);
|
||||
|
||||
Map<String, dynamic> toJson() => {
|
||||
"result": result,
|
||||
"user": user.toJson(),
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
|
||||
93
app_code/lib/models/cart_response.dart
Normal file
93
app_code/lib/models/cart_response.dart
Normal file
@@ -0,0 +1,93 @@
|
||||
// To parse this JSON data, do
|
||||
//
|
||||
// final cartResponse = cartResponseFromJson(jsonString);
|
||||
|
||||
import 'dart:convert';
|
||||
|
||||
CartResponse cartResponseFromJson(String str) => CartResponse.fromJson(json.decode(str));
|
||||
|
||||
String cartResponseToJson(CartResponse data) => json.encode(data.toJson());
|
||||
|
||||
class CartResponse {
|
||||
bool result;
|
||||
String message;
|
||||
List<Cart> carts;
|
||||
var cartCount;
|
||||
String subTotal;
|
||||
String total;
|
||||
String couponDiscount;
|
||||
|
||||
CartResponse({
|
||||
required this.result,
|
||||
required this.message,
|
||||
required this.carts,
|
||||
required this.cartCount,
|
||||
required this.subTotal,
|
||||
required this.total,
|
||||
required this.couponDiscount,
|
||||
});
|
||||
|
||||
factory CartResponse.fromJson(Map<String, dynamic> json) => CartResponse(
|
||||
result: json["result"],
|
||||
message: json["message"],
|
||||
carts: List<Cart>.from(json["carts"].map((x) => Cart.fromJson(x))),
|
||||
cartCount: json["cartCount"],
|
||||
subTotal: json["subTotal"],
|
||||
total: json["total"],
|
||||
couponDiscount: json["couponDiscount"],
|
||||
);
|
||||
|
||||
Map<String, dynamic> toJson() => {
|
||||
"result": result,
|
||||
"message": message,
|
||||
"carts": List<dynamic>.from(carts.map((x) => x.toJson())),
|
||||
"cartCount": cartCount,
|
||||
"subTotal": subTotal,
|
||||
"total": total,
|
||||
"couponDiscount": couponDiscount,
|
||||
};
|
||||
}
|
||||
|
||||
class Cart {
|
||||
var id;
|
||||
String slug;
|
||||
String name;
|
||||
var quantity;
|
||||
String thumbnailImage;
|
||||
String unit;
|
||||
String price;
|
||||
String category;
|
||||
|
||||
Cart({
|
||||
required this.id,
|
||||
required this.slug,
|
||||
required this.name,
|
||||
required this.quantity,
|
||||
required this.thumbnailImage,
|
||||
required this.unit,
|
||||
required this.price,
|
||||
required this.category,
|
||||
});
|
||||
|
||||
factory Cart.fromJson(Map<String, dynamic> json) => Cart(
|
||||
id: json["id"],
|
||||
slug: json["slug"],
|
||||
name: json["name"],
|
||||
quantity: json["quantity"],
|
||||
thumbnailImage: json["thumbnail_image"],
|
||||
unit: json["unit"],
|
||||
price: json["price"],
|
||||
category: json["category"],
|
||||
);
|
||||
|
||||
Map<String, dynamic> toJson() => {
|
||||
"id": id,
|
||||
"slug": slug,
|
||||
"name": name,
|
||||
"quantity": quantity,
|
||||
"thumbnail_image": thumbnailImage,
|
||||
"unit": unit,
|
||||
"price": price,
|
||||
"category": category,
|
||||
};
|
||||
}
|
||||
129
app_code/lib/models/category_response.dart
Normal file
129
app_code/lib/models/category_response.dart
Normal file
@@ -0,0 +1,129 @@
|
||||
|
||||
import 'dart:convert';
|
||||
|
||||
import 'package:grostore/models/common/category_info.dart';
|
||||
|
||||
CategoryResponse categoryResponseFromJson(String str) => CategoryResponse.fromJson(json.decode(str));
|
||||
|
||||
String categoryResponseToJson(CategoryResponse data) => json.encode(data.toJson());
|
||||
|
||||
class CategoryResponse {
|
||||
List<CategoryInfo> data;
|
||||
Links links;
|
||||
Meta meta;
|
||||
|
||||
CategoryResponse({
|
||||
required this.data,
|
||||
required this.links,
|
||||
required this.meta,
|
||||
});
|
||||
|
||||
factory CategoryResponse.fromJson(Map<String, dynamic> json) => CategoryResponse(
|
||||
data: List<CategoryInfo>.from(json["data"].map((x) => CategoryInfo.fromJson(x))),
|
||||
links: Links.fromJson(json["links"]),
|
||||
meta: Meta.fromJson(json["meta"]),
|
||||
);
|
||||
|
||||
Map<String, dynamic> toJson() => {
|
||||
"data": List<dynamic>.from(data.map((x) => x.toJson())),
|
||||
"links": links.toJson(),
|
||||
"meta": meta.toJson(),
|
||||
};
|
||||
}
|
||||
|
||||
class Links {
|
||||
String first;
|
||||
String last;
|
||||
dynamic prev;
|
||||
dynamic next;
|
||||
|
||||
Links({
|
||||
required this.first,
|
||||
required this.last,
|
||||
this.prev,
|
||||
this.next,
|
||||
});
|
||||
|
||||
factory Links.fromJson(Map<String, dynamic> json) => Links(
|
||||
first: json["first"],
|
||||
last: json["last"],
|
||||
prev: json["prev"],
|
||||
next: json["next"],
|
||||
);
|
||||
|
||||
Map<String, dynamic> toJson() => {
|
||||
"first": first,
|
||||
"last": last,
|
||||
"prev": prev,
|
||||
"next": next,
|
||||
};
|
||||
}
|
||||
|
||||
class Meta {
|
||||
var currentPage;
|
||||
var from;
|
||||
var lastPage;
|
||||
List<Link> links;
|
||||
String path;
|
||||
var perPage;
|
||||
var to;
|
||||
var total;
|
||||
|
||||
Meta({
|
||||
required this.currentPage,
|
||||
required this.from,
|
||||
required this.lastPage,
|
||||
required this.links,
|
||||
required this.path,
|
||||
required this.perPage,
|
||||
required this.to,
|
||||
required this.total,
|
||||
});
|
||||
|
||||
factory Meta.fromJson(Map<String, dynamic> json) => Meta(
|
||||
currentPage: json["current_page"],
|
||||
from: json["from"],
|
||||
lastPage: json["last_page"],
|
||||
links: List<Link>.from(json["links"].map((x) => Link.fromJson(x))),
|
||||
path: json["path"],
|
||||
perPage: json["per_page"],
|
||||
to: json["to"],
|
||||
total: json["total"],
|
||||
);
|
||||
|
||||
Map<String, dynamic> toJson() => {
|
||||
"current_page": currentPage,
|
||||
"from": from,
|
||||
"last_page": lastPage,
|
||||
"links": List<dynamic>.from(links.map((x) => x.toJson())),
|
||||
"path": path,
|
||||
"per_page": perPage,
|
||||
"to": to,
|
||||
"total": total,
|
||||
};
|
||||
}
|
||||
|
||||
class Link {
|
||||
String? url;
|
||||
String label;
|
||||
bool active;
|
||||
|
||||
Link({
|
||||
this.url,
|
||||
required this.label,
|
||||
required this.active,
|
||||
});
|
||||
|
||||
factory Link.fromJson(Map<String, dynamic> json) => Link(
|
||||
url: json["url"],
|
||||
label: json["label"],
|
||||
active: json["active"],
|
||||
);
|
||||
|
||||
Map<String, dynamic> toJson() => {
|
||||
"url": url,
|
||||
"label": label,
|
||||
"active": active,
|
||||
};
|
||||
}
|
||||
|
||||
53
app_code/lib/models/city_response.dart
Normal file
53
app_code/lib/models/city_response.dart
Normal file
@@ -0,0 +1,53 @@
|
||||
// To parse this JSON data, do
|
||||
//
|
||||
// final cityResponse = cityResponseFromJson(jsonString);
|
||||
|
||||
import 'dart:convert';
|
||||
|
||||
CityResponse cityResponseFromJson(String str) => CityResponse.fromJson(json.decode(str));
|
||||
|
||||
String cityResponseToJson(CityResponse data) => json.encode(data.toJson());
|
||||
|
||||
class CityResponse {
|
||||
List<CityInfo> data;
|
||||
|
||||
CityResponse({
|
||||
required this.data,
|
||||
});
|
||||
|
||||
factory CityResponse.fromJson(Map<String, dynamic> json) => CityResponse(
|
||||
data: List<CityInfo>.from(json["data"].map((x) => CityInfo.fromJson(x))),
|
||||
);
|
||||
|
||||
Map<String, dynamic> toJson() => {
|
||||
"data": List<dynamic>.from(data.map((x) => x.toJson())),
|
||||
};
|
||||
}
|
||||
|
||||
class CityInfo {
|
||||
int stateId;
|
||||
int id;
|
||||
String name;
|
||||
bool isActive;
|
||||
|
||||
CityInfo({
|
||||
required this.stateId,
|
||||
required this.id,
|
||||
required this.name,
|
||||
required this.isActive,
|
||||
});
|
||||
|
||||
factory CityInfo.fromJson(Map<String, dynamic> json) => CityInfo(
|
||||
stateId: json["state_id"],
|
||||
id: json["id"],
|
||||
name: json["name"],
|
||||
isActive: json["is_active"],
|
||||
);
|
||||
|
||||
Map<String, dynamic> toJson() => {
|
||||
"state_id": stateId,
|
||||
"id": id,
|
||||
"name": name,
|
||||
"is_active": isActive,
|
||||
};
|
||||
}
|
||||
27
app_code/lib/models/common/category_info.dart
Normal file
27
app_code/lib/models/common/category_info.dart
Normal file
@@ -0,0 +1,27 @@
|
||||
class CategoryInfo {
|
||||
var id;
|
||||
String name;
|
||||
var products;
|
||||
String thumbnailImage;
|
||||
|
||||
CategoryInfo({
|
||||
required this.id,
|
||||
required this.name,
|
||||
required this.products,
|
||||
required this.thumbnailImage,
|
||||
});
|
||||
|
||||
factory CategoryInfo.fromJson(Map<String, dynamic> json) => CategoryInfo(
|
||||
id: json["id"],
|
||||
name: json["name"],
|
||||
products: json["products"],
|
||||
thumbnailImage: json["thumbnail_image"],
|
||||
);
|
||||
|
||||
Map<String, dynamic> toJson() => {
|
||||
"id": id,
|
||||
"name": name,
|
||||
"products": products,
|
||||
"thumbnail_image": thumbnailImage,
|
||||
};
|
||||
}
|
||||
39
app_code/lib/models/common/user_info.dart
Normal file
39
app_code/lib/models/common/user_info.dart
Normal file
@@ -0,0 +1,39 @@
|
||||
class UserInfo {
|
||||
String name;
|
||||
String? email;
|
||||
String phone;
|
||||
var balance;
|
||||
String avatar;
|
||||
|
||||
UserInfo({
|
||||
required this.name,
|
||||
this.email,
|
||||
required this.phone,
|
||||
required this.balance,
|
||||
required this.avatar,
|
||||
});
|
||||
|
||||
factory UserInfo.fromJson(Map<String, dynamic> json) => UserInfo(
|
||||
name: json["name"],
|
||||
email: json["email"],
|
||||
phone: json["phone"],
|
||||
balance: json["balance"],
|
||||
avatar: json["avatar"],
|
||||
);
|
||||
|
||||
factory UserInfo.init() => UserInfo(
|
||||
name: '',
|
||||
email: '',
|
||||
phone: '',
|
||||
balance:'',
|
||||
avatar: ''
|
||||
);
|
||||
|
||||
Map<String, dynamic> toJson() => {
|
||||
"name": name,
|
||||
"email": email,
|
||||
"phone": phone,
|
||||
"balance": balance,
|
||||
"avatar": avatar,
|
||||
};
|
||||
}
|
||||
29
app_code/lib/models/common_response.dart
Normal file
29
app_code/lib/models/common_response.dart
Normal file
@@ -0,0 +1,29 @@
|
||||
// To parse this JSON data, do
|
||||
//
|
||||
// final commonResponse = commonResponseFromJson(jsonString);
|
||||
|
||||
import 'dart:convert';
|
||||
|
||||
CommonResponse commonResponseFromJson(String str) => CommonResponse.fromJson(json.decode(str));
|
||||
|
||||
String commonResponseToJson(CommonResponse data) => json.encode(data.toJson());
|
||||
|
||||
class CommonResponse {
|
||||
bool result;
|
||||
var message;
|
||||
|
||||
CommonResponse({
|
||||
required this.result,
|
||||
required this.message,
|
||||
});
|
||||
|
||||
factory CommonResponse.fromJson(Map<String, dynamic> json) => CommonResponse(
|
||||
result: json["result"],
|
||||
message: json["message"],
|
||||
);
|
||||
|
||||
Map<String, dynamic> toJson() => {
|
||||
"result": result,
|
||||
"message": message,
|
||||
};
|
||||
}
|
||||
53
app_code/lib/models/country_response.dart
Normal file
53
app_code/lib/models/country_response.dart
Normal file
@@ -0,0 +1,53 @@
|
||||
// To parse this JSON data, do
|
||||
//
|
||||
// final countryResponse = countryResponseFromJson(jsonString);
|
||||
|
||||
import 'dart:convert';
|
||||
|
||||
CountryResponse countryResponseFromJson(String str) => CountryResponse.fromJson(json.decode(str));
|
||||
|
||||
String countryResponseToJson(CountryResponse data) => json.encode(data.toJson());
|
||||
|
||||
class CountryResponse {
|
||||
List<CountryInfo> data;
|
||||
|
||||
CountryResponse({
|
||||
required this.data,
|
||||
});
|
||||
|
||||
factory CountryResponse.fromJson(Map<String, dynamic> json) => CountryResponse(
|
||||
data: List<CountryInfo>.from(json["data"].map((x) => CountryInfo.fromJson(x))),
|
||||
);
|
||||
|
||||
Map<String, dynamic> toJson() => {
|
||||
"data": List<dynamic>.from(data.map((x) => x.toJson())),
|
||||
};
|
||||
}
|
||||
|
||||
class CountryInfo {
|
||||
int id;
|
||||
String code;
|
||||
String name;
|
||||
bool isActive;
|
||||
|
||||
CountryInfo({
|
||||
required this.id,
|
||||
required this.code,
|
||||
required this.name,
|
||||
required this.isActive,
|
||||
});
|
||||
|
||||
factory CountryInfo.fromJson(Map<String, dynamic> json) => CountryInfo(
|
||||
id: json["id"],
|
||||
code: json["code"],
|
||||
name: json["name"],
|
||||
isActive: json["is_active"],
|
||||
);
|
||||
|
||||
Map<String, dynamic> toJson() => {
|
||||
"id": id,
|
||||
"code": code,
|
||||
"name": name,
|
||||
"is_active": isActive,
|
||||
};
|
||||
}
|
||||
93
app_code/lib/models/coupon_response.dart
Normal file
93
app_code/lib/models/coupon_response.dart
Normal file
@@ -0,0 +1,93 @@
|
||||
// To parse this JSON data, do
|
||||
//
|
||||
// final couponResponse = couponResponseFromJson(jsonString);
|
||||
|
||||
import 'dart:convert';
|
||||
|
||||
CouponResponse couponResponseFromJson(String str) => CouponResponse.fromJson(json.decode(str));
|
||||
|
||||
String couponResponseToJson(CouponResponse data) => json.encode(data.toJson());
|
||||
|
||||
class CouponResponse {
|
||||
List<CouponInfo> data;
|
||||
|
||||
CouponResponse({
|
||||
required this.data,
|
||||
});
|
||||
|
||||
factory CouponResponse.fromJson(Map<String, dynamic> json) => CouponResponse(
|
||||
data: List<CouponInfo>.from(json["data"].map((x) => CouponInfo.fromJson(x))),
|
||||
);
|
||||
|
||||
Map<String, dynamic> toJson() => {
|
||||
"data": List<dynamic>.from(data.map((x) => x.toJson())),
|
||||
};
|
||||
}
|
||||
|
||||
class CouponInfo {
|
||||
var id;
|
||||
var shopId;
|
||||
String banner;
|
||||
String code;
|
||||
String discountType;
|
||||
var discountValue;
|
||||
var isFreeShipping;
|
||||
String startDate;
|
||||
String endDate;
|
||||
var minSpend;
|
||||
var maxDiscountAmount;
|
||||
var customerUsageLimit;
|
||||
String? productIds;
|
||||
String? categoryIds;
|
||||
|
||||
CouponInfo({
|
||||
required this.id,
|
||||
required this.shopId,
|
||||
required this.banner,
|
||||
required this.code,
|
||||
required this.discountType,
|
||||
required this.discountValue,
|
||||
required this.isFreeShipping,
|
||||
required this.startDate,
|
||||
required this.endDate,
|
||||
required this.minSpend,
|
||||
required this.maxDiscountAmount,
|
||||
required this.customerUsageLimit,
|
||||
this.productIds,
|
||||
this.categoryIds,
|
||||
});
|
||||
|
||||
factory CouponInfo.fromJson(Map<String, dynamic> json) => CouponInfo(
|
||||
id: json["id"],
|
||||
shopId: json["shop_id"],
|
||||
banner: json["banner"],
|
||||
code: json["code"],
|
||||
discountType: json["discount_type"],
|
||||
discountValue: json["discount_value"],
|
||||
isFreeShipping: json["is_free_shipping"],
|
||||
startDate: json["start_date"],
|
||||
endDate: json["end_date"],
|
||||
minSpend: json["min_spend"],
|
||||
maxDiscountAmount: json["max_discount_amount"],
|
||||
customerUsageLimit: json["customer_usage_limit"],
|
||||
productIds: json["product_ids"],
|
||||
categoryIds: json["category_ids"],
|
||||
);
|
||||
|
||||
Map<String, dynamic> toJson() => {
|
||||
"id": id,
|
||||
"shop_id": shopId,
|
||||
"banner": banner,
|
||||
"code": code,
|
||||
"discount_type": discountType,
|
||||
"discount_value": discountValue,
|
||||
"is_free_shipping": isFreeShipping,
|
||||
"start_date": startDate,
|
||||
"end_date": endDate,
|
||||
"min_spend": minSpend,
|
||||
"max_discount_amount": maxDiscountAmount,
|
||||
"customer_usage_limit": customerUsageLimit,
|
||||
"product_ids": productIds,
|
||||
"category_ids": categoryIds,
|
||||
};
|
||||
}
|
||||
61
app_code/lib/models/currency_response.dart
Normal file
61
app_code/lib/models/currency_response.dart
Normal file
@@ -0,0 +1,61 @@
|
||||
// To parse this JSON data, do
|
||||
//
|
||||
// final currencyResponse = currencyResponseFromJson(jsonString);
|
||||
|
||||
import 'dart:convert';
|
||||
|
||||
CurrencyResponse currencyResponseFromJson(String str) => CurrencyResponse.fromJson(json.decode(str));
|
||||
|
||||
String currencyResponseToJson(CurrencyResponse data) => json.encode(data.toJson());
|
||||
|
||||
class CurrencyResponse {
|
||||
List<CurrencyInfo> data;
|
||||
|
||||
CurrencyResponse({
|
||||
required this.data,
|
||||
});
|
||||
|
||||
factory CurrencyResponse.fromJson(Map<String, dynamic> json) => CurrencyResponse(
|
||||
data: List<CurrencyInfo>.from(json["data"].map((x) => CurrencyInfo.fromJson(x))),
|
||||
);
|
||||
|
||||
Map<String, dynamic> toJson() => {
|
||||
"data": List<dynamic>.from(data.map((x) => x.toJson())),
|
||||
};
|
||||
}
|
||||
|
||||
class CurrencyInfo {
|
||||
String code;
|
||||
String name;
|
||||
String symbol;
|
||||
var rate;
|
||||
var alignment;
|
||||
bool isDefault;
|
||||
|
||||
CurrencyInfo({
|
||||
required this.code,
|
||||
required this.name,
|
||||
required this.symbol,
|
||||
required this.rate,
|
||||
required this.alignment,
|
||||
required this.isDefault,
|
||||
});
|
||||
|
||||
factory CurrencyInfo.fromJson(Map<String, dynamic> json) => CurrencyInfo(
|
||||
code: json["code"],
|
||||
name: json["name"],
|
||||
symbol: json["symbol"],
|
||||
alignment: json["alignment"],
|
||||
rate: json["rate"],
|
||||
isDefault: json["is_default"],
|
||||
);
|
||||
|
||||
Map<String, dynamic> toJson() => {
|
||||
"code": code,
|
||||
"name": name,
|
||||
"symbol": symbol,
|
||||
"rate": rate,
|
||||
"alignment": alignment,
|
||||
"is_default": isDefault,
|
||||
};
|
||||
}
|
||||
9
app_code/lib/models/customer.dart
Normal file
9
app_code/lib/models/customer.dart
Normal file
@@ -0,0 +1,9 @@
|
||||
class Customer {
|
||||
final String name;
|
||||
final String address;
|
||||
|
||||
const Customer({
|
||||
required this.name,
|
||||
required this.address,
|
||||
});
|
||||
}
|
||||
88
app_code/lib/models/edit_address_response.dart
Normal file
88
app_code/lib/models/edit_address_response.dart
Normal file
@@ -0,0 +1,88 @@
|
||||
// To parse this JSON data, do
|
||||
//
|
||||
// final editAddressResponse = editAddressResponseFromJson(jsonString);
|
||||
|
||||
import 'dart:convert';
|
||||
|
||||
EditAddressResponse editAddressResponseFromJson(String str) =>
|
||||
EditAddressResponse.fromJson(json.decode(str));
|
||||
|
||||
String editAddressResponseToJson(EditAddressResponse data) =>
|
||||
json.encode(data.toJson());
|
||||
|
||||
class EditAddressResponse {
|
||||
Data data;
|
||||
bool result;
|
||||
int status;
|
||||
|
||||
EditAddressResponse({
|
||||
required this.data,
|
||||
required this.result,
|
||||
required this.status,
|
||||
});
|
||||
|
||||
factory EditAddressResponse.fromJson(Map<String, dynamic> json) =>
|
||||
EditAddressResponse(
|
||||
data: Data.fromJson(json["data"]),
|
||||
result: json["result"],
|
||||
status: json["status"],
|
||||
);
|
||||
|
||||
Map<String, dynamic> toJson() => {
|
||||
"data": data.toJson(),
|
||||
"result": result,
|
||||
"status": status,
|
||||
};
|
||||
}
|
||||
|
||||
class Data {
|
||||
int id;
|
||||
int userId;
|
||||
int countryId;
|
||||
String countryName;
|
||||
int stateId;
|
||||
String stateName;
|
||||
int cityId;
|
||||
String cityName;
|
||||
String address;
|
||||
int isDefault;
|
||||
|
||||
Data({
|
||||
required this.id,
|
||||
required this.userId,
|
||||
required this.countryId,
|
||||
required this.countryName,
|
||||
required this.stateId,
|
||||
required this.stateName,
|
||||
required this.cityId,
|
||||
required this.cityName,
|
||||
required this.address,
|
||||
required this.isDefault,
|
||||
});
|
||||
|
||||
factory Data.fromJson(Map<String, dynamic> json) => Data(
|
||||
id: json["id"],
|
||||
userId: json["user_id"],
|
||||
countryId: json["country_id"],
|
||||
countryName: json["country_name"],
|
||||
stateId: json["state_id"],
|
||||
stateName: json["state_name"],
|
||||
cityId: json["city_id"],
|
||||
cityName: json["city_name"],
|
||||
address: json["address"],
|
||||
isDefault: json["is_default"],
|
||||
);
|
||||
|
||||
Map<String, dynamic> toJson() => {
|
||||
"id": id,
|
||||
"user_id": userId,
|
||||
"country_id": countryId,
|
||||
"country_name": countryName,
|
||||
"state_id": stateId,
|
||||
"state_name": stateName,
|
||||
"city_id": cityId,
|
||||
"city_name": cityName,
|
||||
"address": address,
|
||||
"is_default": isDefault,
|
||||
};
|
||||
}
|
||||
33
app_code/lib/models/help_center_response.dart
Normal file
33
app_code/lib/models/help_center_response.dart
Normal file
@@ -0,0 +1,33 @@
|
||||
// To parse this JSON data, do
|
||||
//
|
||||
// final helpCenterResponse = helpCenterResponseFromJson(jsonString);
|
||||
|
||||
import 'dart:convert';
|
||||
|
||||
HelpCenterResponse helpCenterResponseFromJson(String str) => HelpCenterResponse.fromJson(json.decode(str));
|
||||
|
||||
String helpCenterResponseToJson(HelpCenterResponse data) => json.encode(data.toJson());
|
||||
|
||||
class HelpCenterResponse {
|
||||
String location;
|
||||
String contactNumber;
|
||||
String email;
|
||||
|
||||
HelpCenterResponse({
|
||||
required this.location,
|
||||
required this.contactNumber,
|
||||
required this.email,
|
||||
});
|
||||
|
||||
factory HelpCenterResponse.fromJson(Map<String, dynamic> json) => HelpCenterResponse(
|
||||
location: json["location"],
|
||||
contactNumber: json["contact_number"],
|
||||
email: json["email"],
|
||||
);
|
||||
|
||||
Map<String, dynamic> toJson() => {
|
||||
"location": location,
|
||||
"contact_number": contactNumber,
|
||||
"email": email,
|
||||
};
|
||||
}
|
||||
45
app_code/lib/models/home_banner_response.dart
Normal file
45
app_code/lib/models/home_banner_response.dart
Normal file
@@ -0,0 +1,45 @@
|
||||
// To parse this JSON data, do
|
||||
//
|
||||
// final homeBannerResponse = homeBannerResponseFromJson(jsonString);
|
||||
|
||||
import 'dart:convert';
|
||||
|
||||
HomeBannerResponse homeBannerResponseFromJson(String str) => HomeBannerResponse.fromJson(json.decode(str));
|
||||
|
||||
String homeBannerResponseToJson(HomeBannerResponse data) => json.encode(data.toJson());
|
||||
|
||||
class HomeBannerResponse {
|
||||
List<BannerData> data;
|
||||
|
||||
HomeBannerResponse({
|
||||
required this.data,
|
||||
});
|
||||
|
||||
factory HomeBannerResponse.fromJson(Map<String, dynamic> json) => HomeBannerResponse(
|
||||
data: List<BannerData>.from(json["data"].map((x) => BannerData.fromJson(x))),
|
||||
);
|
||||
|
||||
Map<String, dynamic> toJson() => {
|
||||
"data": List<dynamic>.from(data.map((x) => x.toJson())),
|
||||
};
|
||||
}
|
||||
|
||||
class BannerData {
|
||||
String image;
|
||||
String link;
|
||||
|
||||
BannerData({
|
||||
required this.image,
|
||||
required this.link,
|
||||
});
|
||||
|
||||
factory BannerData.fromJson(Map<String, dynamic> json) => BannerData(
|
||||
image: json["image"],
|
||||
link: json["link"],
|
||||
);
|
||||
|
||||
Map<String, dynamic> toJson() => {
|
||||
"image": image,
|
||||
"link": link,
|
||||
};
|
||||
}
|
||||
48
app_code/lib/models/invoice.dart
Normal file
48
app_code/lib/models/invoice.dart
Normal file
@@ -0,0 +1,48 @@
|
||||
|
||||
import 'package:grostore/models/supplire.dart';
|
||||
|
||||
import 'customer.dart';
|
||||
|
||||
class Invoice {
|
||||
final InvoiceInfo info;
|
||||
final Supplier supplier;
|
||||
final Customer customer;
|
||||
final List<InvoiceItem> items;
|
||||
|
||||
const Invoice({
|
||||
required this.info,
|
||||
required this.supplier,
|
||||
required this.customer,
|
||||
required this.items,
|
||||
});
|
||||
}
|
||||
|
||||
class InvoiceInfo {
|
||||
final String description;
|
||||
final String number;
|
||||
final DateTime date;
|
||||
final DateTime dueDate;
|
||||
|
||||
const InvoiceInfo({
|
||||
required this.description,
|
||||
required this.number,
|
||||
required this.date,
|
||||
required this.dueDate,
|
||||
});
|
||||
}
|
||||
|
||||
class InvoiceItem {
|
||||
final String description;
|
||||
final DateTime date;
|
||||
final int quantity;
|
||||
final double vat;
|
||||
final double unitPrice;
|
||||
|
||||
const InvoiceItem({
|
||||
required this.description,
|
||||
required this.date,
|
||||
required this.quantity,
|
||||
required this.vat,
|
||||
required this.unitPrice,
|
||||
});
|
||||
}
|
||||
61
app_code/lib/models/language_response.dart
Normal file
61
app_code/lib/models/language_response.dart
Normal file
@@ -0,0 +1,61 @@
|
||||
// To parse this JSON data, do
|
||||
//
|
||||
// final languageResponse = languageResponseFromJson(jsonString);
|
||||
|
||||
import 'dart:convert';
|
||||
|
||||
LanguageResponse languageResponseFromJson(String str) => LanguageResponse.fromJson(json.decode(str));
|
||||
|
||||
String languageResponseToJson(LanguageResponse data) => json.encode(data.toJson());
|
||||
|
||||
class LanguageResponse {
|
||||
List<LanguageInfo> data;
|
||||
|
||||
LanguageResponse({
|
||||
required this.data,
|
||||
});
|
||||
|
||||
factory LanguageResponse.fromJson(Map<String, dynamic> json) => LanguageResponse(
|
||||
data: List<LanguageInfo>.from(json["data"].map((x) => LanguageInfo.fromJson(x))),
|
||||
);
|
||||
|
||||
Map<String, dynamic> toJson() => {
|
||||
"data": List<dynamic>.from(data.map((x) => x.toJson())),
|
||||
};
|
||||
}
|
||||
|
||||
class LanguageInfo {
|
||||
int id;
|
||||
String name;
|
||||
String flag;
|
||||
String code;
|
||||
var isRtl;
|
||||
var isActive;
|
||||
|
||||
LanguageInfo({
|
||||
required this.id,
|
||||
required this.name,
|
||||
required this.flag,
|
||||
required this.code,
|
||||
required this.isRtl,
|
||||
required this.isActive,
|
||||
});
|
||||
|
||||
factory LanguageInfo.fromJson(Map<String, dynamic> json) => LanguageInfo(
|
||||
id: json["id"],
|
||||
name: json["name"],
|
||||
flag: json["flag"],
|
||||
code: json["code"],
|
||||
isRtl: json["is_rtl"],
|
||||
isActive: json["is_active"],
|
||||
);
|
||||
|
||||
Map<String, dynamic> toJson() => {
|
||||
"id": id,
|
||||
"name": name,
|
||||
"flag": flag,
|
||||
"code": code,
|
||||
"is_rtl": isRtl,
|
||||
"is_active": isActive,
|
||||
};
|
||||
}
|
||||
65
app_code/lib/models/locations_response.dart
Normal file
65
app_code/lib/models/locations_response.dart
Normal file
@@ -0,0 +1,65 @@
|
||||
// To parse this JSON data, do
|
||||
//
|
||||
// final locationsResponse = locationsResponseFromJson(jsonString);
|
||||
|
||||
import 'dart:convert';
|
||||
|
||||
LocationsResponse locationsResponseFromJson(String str) => LocationsResponse.fromJson(json.decode(str));
|
||||
|
||||
String locationsResponseToJson(LocationsResponse data) => json.encode(data.toJson());
|
||||
|
||||
class LocationsResponse {
|
||||
List<LocationInfo> data;
|
||||
|
||||
LocationsResponse({
|
||||
required this.data,
|
||||
});
|
||||
|
||||
factory LocationsResponse.fromJson(Map<String, dynamic> json) => LocationsResponse(
|
||||
data: List<LocationInfo>.from(json["data"].map((x) => LocationInfo.fromJson(x))),
|
||||
);
|
||||
|
||||
Map<String, dynamic> toJson() => {
|
||||
"data": List<dynamic>.from(data.map((x) => x.toJson())),
|
||||
};
|
||||
}
|
||||
|
||||
class LocationInfo {
|
||||
int id;
|
||||
String name;
|
||||
String image;
|
||||
String address;
|
||||
dynamic lat;
|
||||
dynamic lng;
|
||||
bool isDefault;
|
||||
|
||||
LocationInfo({
|
||||
required this.id,
|
||||
required this.name,
|
||||
required this.image,
|
||||
required this.address,
|
||||
this.lat,
|
||||
this.lng,
|
||||
required this.isDefault,
|
||||
});
|
||||
|
||||
factory LocationInfo.fromJson(Map<String, dynamic> json) => LocationInfo(
|
||||
id: json["id"],
|
||||
name: json["name"],
|
||||
image: json["image"],
|
||||
address: json["address"],
|
||||
lat: json["lat"],
|
||||
lng: json["lng"],
|
||||
isDefault: json["is_default"],
|
||||
);
|
||||
|
||||
Map<String, dynamic> toJson() => {
|
||||
"id": id,
|
||||
"name": name,
|
||||
"image": image,
|
||||
"address": address,
|
||||
"lat": lat,
|
||||
"lng": lng,
|
||||
"is_default": isDefault,
|
||||
};
|
||||
}
|
||||
57
app_code/lib/models/logistics_response.dart
Normal file
57
app_code/lib/models/logistics_response.dart
Normal file
@@ -0,0 +1,57 @@
|
||||
// To parse this JSON data, do
|
||||
//
|
||||
// final logisticsResponse = logisticsResponseFromJson(jsonString);
|
||||
|
||||
import 'dart:convert';
|
||||
|
||||
LogisticsResponse logisticsResponseFromJson(String str) => LogisticsResponse.fromJson(json.decode(str));
|
||||
|
||||
String logisticsResponseToJson(LogisticsResponse data) => json.encode(data.toJson());
|
||||
|
||||
class LogisticsResponse {
|
||||
List<LogisticInfo> data;
|
||||
|
||||
LogisticsResponse({
|
||||
required this.data,
|
||||
});
|
||||
|
||||
factory LogisticsResponse.fromJson(Map<String, dynamic> json) => LogisticsResponse(
|
||||
data: List<LogisticInfo>.from(json["data"].map((x) => LogisticInfo.fromJson(x))),
|
||||
);
|
||||
|
||||
Map<String, dynamic> toJson() => {
|
||||
"data": List<dynamic>.from(data.map((x) => x.toJson())),
|
||||
};
|
||||
}
|
||||
|
||||
class LogisticInfo {
|
||||
int id;
|
||||
String name;
|
||||
int logisticId;
|
||||
String price;
|
||||
String image;
|
||||
|
||||
LogisticInfo({
|
||||
required this.id,
|
||||
required this.name,
|
||||
required this.logisticId,
|
||||
required this.price,
|
||||
required this.image,
|
||||
});
|
||||
|
||||
factory LogisticInfo.fromJson(Map<String, dynamic> json) => LogisticInfo(
|
||||
id: json["id"],
|
||||
name: json["name"],
|
||||
logisticId: json["logistic_id"],
|
||||
price: json["price"],
|
||||
image: json["image"],
|
||||
);
|
||||
|
||||
Map<String, dynamic> toJson() => {
|
||||
"id": id,
|
||||
"name": name,
|
||||
"logistic_id": logisticId,
|
||||
"price": price,
|
||||
"image": image,
|
||||
};
|
||||
}
|
||||
177
app_code/lib/models/order/order_details_response.dart
Normal file
177
app_code/lib/models/order/order_details_response.dart
Normal file
@@ -0,0 +1,177 @@
|
||||
// To parse this JSON data, do
|
||||
//
|
||||
// final orderDetailsResponse = orderDetailsResponseFromJson(jsonString);
|
||||
|
||||
import 'dart:convert';
|
||||
|
||||
import 'package:grostore/models/product_mini_response.dart';
|
||||
|
||||
OrderDetailsResponse orderDetailsResponseFromJson(String str) => OrderDetailsResponse.fromJson(json.decode(str));
|
||||
|
||||
String orderDetailsResponseToJson(OrderDetailsResponse data) => json.encode(data.toJson());
|
||||
|
||||
class OrderDetailsResponse {
|
||||
OrderDetailsInfo data;
|
||||
|
||||
OrderDetailsResponse({
|
||||
required this.data,
|
||||
});
|
||||
|
||||
factory OrderDetailsResponse.fromJson(Map<String, dynamic> json) => OrderDetailsResponse(
|
||||
data: OrderDetailsInfo.fromJson(json["data"]),
|
||||
);
|
||||
|
||||
Map<String, dynamic> toJson() => {
|
||||
"data": data.toJson(),
|
||||
};
|
||||
}
|
||||
|
||||
class OrderDetailsInfo {
|
||||
int id;
|
||||
String code;
|
||||
String date;
|
||||
IngAddress? shippingAddress;
|
||||
IngAddress? billingAddress;
|
||||
List<Item> items;
|
||||
String status;
|
||||
String payment_method;
|
||||
String subTotalAmount;
|
||||
String totalTips;
|
||||
String totalShippingCost;
|
||||
String couponDiscountAmount;
|
||||
String totalPrice;
|
||||
|
||||
OrderDetailsInfo({
|
||||
required this.id,
|
||||
required this.code,
|
||||
required this.date,
|
||||
this.shippingAddress,
|
||||
this.billingAddress,
|
||||
required this.items,
|
||||
required this.status,
|
||||
required this.payment_method,
|
||||
required this.subTotalAmount,
|
||||
required this.totalTips,
|
||||
required this.totalShippingCost,
|
||||
required this.totalPrice,
|
||||
required this.couponDiscountAmount
|
||||
});
|
||||
|
||||
factory OrderDetailsInfo.fromJson(Map<String, dynamic> json) => OrderDetailsInfo(
|
||||
id: json["id"],
|
||||
code: json["order_code"],
|
||||
date: json["date"],
|
||||
shippingAddress:json["shipping_address"]==null?null: IngAddress.fromJson(json["shipping_address"]),
|
||||
billingAddress: json["billing_address"]==null?null:IngAddress.fromJson(json["billing_address"]),
|
||||
items: List<Item>.from(json["items"].map((x) => Item.fromJson(x))),
|
||||
status: json["status"],
|
||||
payment_method: json["payment_method"],
|
||||
subTotalAmount: json["sub_total_amount"],
|
||||
totalTips: json["total_tips"],
|
||||
totalShippingCost: json["total_shipping_cost"],
|
||||
couponDiscountAmount: json["coupon_discount_amount"],
|
||||
totalPrice: json["total_price"],
|
||||
);
|
||||
|
||||
Map<String, dynamic> toJson() => {
|
||||
"id": id,
|
||||
"date": date,
|
||||
"shipping_address": shippingAddress?.toJson(),
|
||||
"billing_address": billingAddress?.toJson(),
|
||||
"items": List<dynamic>.from(items.map((x) => x.toJson())),
|
||||
"status": status,
|
||||
"sub_total_amount": subTotalAmount,
|
||||
"total_tips": totalTips,
|
||||
"total_shipping_cost": totalShippingCost,
|
||||
"total_price": totalPrice,
|
||||
};
|
||||
}
|
||||
|
||||
class IngAddress {
|
||||
var id;
|
||||
var userId;
|
||||
var countryId;
|
||||
String countryName;
|
||||
var stateId;
|
||||
String stateName;
|
||||
var cityId;
|
||||
String cityName;
|
||||
String address;
|
||||
var isDefault;
|
||||
|
||||
IngAddress({
|
||||
required this.id,
|
||||
required this.userId,
|
||||
required this.countryId,
|
||||
required this.countryName,
|
||||
required this.stateId,
|
||||
required this.stateName,
|
||||
required this.cityId,
|
||||
required this.cityName,
|
||||
required this.address,
|
||||
required this.isDefault,
|
||||
});
|
||||
|
||||
factory IngAddress.fromJson(Map<String, dynamic> json) => IngAddress(
|
||||
id: json["id"],
|
||||
userId: json["user_id"],
|
||||
countryId: json["country_id"],
|
||||
countryName: json["country_name"],
|
||||
stateId: json["state_id"],
|
||||
stateName: json["state_name"],
|
||||
cityId: json["city_id"],
|
||||
cityName: json["city_name"],
|
||||
address: json["address"],
|
||||
isDefault: json["is_default"],
|
||||
);
|
||||
|
||||
Map<String, dynamic> toJson() => {
|
||||
"id": id,
|
||||
"user_id": userId,
|
||||
"country_id": countryId,
|
||||
"country_name": countryName,
|
||||
"state_id": stateId,
|
||||
"state_name": stateName,
|
||||
"city_id": cityId,
|
||||
"city_name": cityName,
|
||||
"address": address,
|
||||
"is_default": isDefault,
|
||||
};
|
||||
}
|
||||
|
||||
class Item {
|
||||
var id;
|
||||
ProductMini? product;
|
||||
var qty;
|
||||
String unitPrice;
|
||||
String totalPrice;
|
||||
var refund_status;
|
||||
|
||||
Item({
|
||||
required this.id,
|
||||
this.product,
|
||||
required this.qty,
|
||||
required this.unitPrice,
|
||||
required this.totalPrice,
|
||||
required this.refund_status,
|
||||
});
|
||||
|
||||
factory Item.fromJson(Map<String, dynamic> json) => Item(
|
||||
id: json["id"],
|
||||
product: ProductMini.fromJson(json["product"]),
|
||||
qty: json["qty"],
|
||||
unitPrice: json["unit_price"],
|
||||
totalPrice: json["total_price"],
|
||||
refund_status: json["refund_status"],
|
||||
);
|
||||
|
||||
Map<String, dynamic> toJson() => {
|
||||
"id":id,
|
||||
"product": product?.toJson(),
|
||||
"qty": qty,
|
||||
"unit_price": unitPrice,
|
||||
"total_price": totalPrice,
|
||||
"refund_status": refund_status,
|
||||
};
|
||||
}
|
||||
|
||||
45
app_code/lib/models/order/order_summery_response.dart
Normal file
45
app_code/lib/models/order/order_summery_response.dart
Normal file
@@ -0,0 +1,45 @@
|
||||
// To parse this JSON data, do
|
||||
//
|
||||
// final orderSummeryResponse = orderSummeryResponseFromJson(jsonString);
|
||||
|
||||
import 'dart:convert';
|
||||
|
||||
OrderSummeryResponse orderSummeryResponseFromJson(String str) => OrderSummeryResponse.fromJson(json.decode(str));
|
||||
|
||||
String orderSummeryResponseToJson(OrderSummeryResponse data) => json.encode(data.toJson());
|
||||
|
||||
class OrderSummeryResponse {
|
||||
String subTotal;
|
||||
String tax;
|
||||
String shippingCharge;
|
||||
bool isFreeShipping;
|
||||
String couponDiscount;
|
||||
String total;
|
||||
|
||||
OrderSummeryResponse({
|
||||
required this.subTotal,
|
||||
required this.tax,
|
||||
required this.shippingCharge,
|
||||
required this.isFreeShipping,
|
||||
required this.couponDiscount,
|
||||
required this.total,
|
||||
});
|
||||
|
||||
factory OrderSummeryResponse.fromJson(Map<String, dynamic> json) => OrderSummeryResponse(
|
||||
subTotal: json["sub_total"],
|
||||
tax: json["tax"],
|
||||
shippingCharge: json["shipping_charge"],
|
||||
isFreeShipping: json["is_free_shipping"],
|
||||
couponDiscount: json["coupon_discount"],
|
||||
total: json["total"],
|
||||
);
|
||||
|
||||
Map<String, dynamic> toJson() => {
|
||||
"sub_total": subTotal,
|
||||
"tax": tax,
|
||||
"shipping_charge": shippingCharge,
|
||||
"is_free_shipping": isFreeShipping,
|
||||
"coupon_discount": couponDiscount,
|
||||
"total": total,
|
||||
};
|
||||
}
|
||||
233
app_code/lib/models/order/orders_response.dart
Normal file
233
app_code/lib/models/order/orders_response.dart
Normal file
@@ -0,0 +1,233 @@
|
||||
// To parse this JSON data, do
|
||||
//
|
||||
// final ordersResponse = ordersResponseFromJson(jsonString);
|
||||
|
||||
import 'dart:convert';
|
||||
|
||||
import 'package:grostore/models/product_mini_response.dart';
|
||||
|
||||
OrdersResponse ordersResponseFromJson(String str) => OrdersResponse.fromJson(json.decode(str));
|
||||
|
||||
String ordersResponseToJson(OrdersResponse data) => json.encode(data.toJson());
|
||||
|
||||
class OrdersResponse {
|
||||
List<OrderInfo> data;
|
||||
Links links;
|
||||
Meta meta;
|
||||
|
||||
OrdersResponse({
|
||||
required this.data,
|
||||
required this.links,
|
||||
required this.meta,
|
||||
});
|
||||
factory OrdersResponse.init(){
|
||||
return OrdersResponse(data: [], links: Links.fromJson({}), meta: Meta.fromJson({}),);
|
||||
|
||||
}
|
||||
factory OrdersResponse.fromJson(Map<String, dynamic> json) => OrdersResponse(
|
||||
data: List<OrderInfo>.from(json["data"].map((x) => OrderInfo.fromJson(x))),
|
||||
links: Links.fromJson(json["links"]),
|
||||
meta: Meta.fromJson(json["meta"]),
|
||||
);
|
||||
|
||||
Map<String, dynamic> toJson() => {
|
||||
"data": List<dynamic>.from(data.map((x) => x.toJson())),
|
||||
"links": links.toJson(),
|
||||
"meta": meta.toJson(),
|
||||
};
|
||||
}
|
||||
|
||||
class OrderInfo{
|
||||
int id;
|
||||
int group_id;
|
||||
Item item;
|
||||
String status;
|
||||
DateTime date;
|
||||
|
||||
OrderInfo({
|
||||
required this.id,
|
||||
required this.group_id,
|
||||
required this.item,
|
||||
required this.status,
|
||||
required this.date,
|
||||
});
|
||||
|
||||
factory OrderInfo.fromJson(Map<String, dynamic> json)
|
||||
{
|
||||
return OrderInfo(
|
||||
id: json["id"],
|
||||
group_id: json["group_id"],
|
||||
item: Item.fromJson(json["items"]),
|
||||
status: json["status"],
|
||||
date: DateTime.parse(json["date"]),
|
||||
);
|
||||
}
|
||||
|
||||
Map<String, dynamic> toJson() => {
|
||||
"id": id,
|
||||
"group_id": group_id,
|
||||
"items": item.toJson(),
|
||||
"status": statusValues.reverse[status],
|
||||
"date": date.toIso8601String(),
|
||||
};
|
||||
}
|
||||
|
||||
class Item {
|
||||
int id;
|
||||
ProductMini? product;
|
||||
var qty;
|
||||
String unitPrice;
|
||||
String totalPrice;
|
||||
var isRefunded;
|
||||
|
||||
Item({
|
||||
required this.id,
|
||||
required this.product,
|
||||
required this.qty,
|
||||
required this.unitPrice,
|
||||
required this.totalPrice,
|
||||
required this.isRefunded,
|
||||
});
|
||||
|
||||
factory Item.fromJson(Map<String, dynamic> json) => Item(
|
||||
id: json["id"],
|
||||
product: ProductMini.fromJson(json["product"]),
|
||||
qty: json["qty"],
|
||||
unitPrice: json["unit_price"],
|
||||
totalPrice: json["total_price"],
|
||||
isRefunded: json["is_refunded"],
|
||||
);
|
||||
|
||||
Map<String, dynamic> toJson() => {
|
||||
"id": id,
|
||||
"product": product?.toJson(),
|
||||
"qty": qty,
|
||||
"unit_price": unitPrice,
|
||||
"total_price": totalPrice,
|
||||
"is_refunded": isRefunded,
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
enum Status { ORDER_PLACED, DELIVERED, PROCESSING }
|
||||
|
||||
final statusValues = EnumValues({
|
||||
"delivered": Status.DELIVERED,
|
||||
"order_placed": Status.ORDER_PLACED,
|
||||
"processing": Status.PROCESSING
|
||||
});
|
||||
|
||||
class Links {
|
||||
String first;
|
||||
String last;
|
||||
dynamic prev;
|
||||
dynamic next;
|
||||
|
||||
Links({
|
||||
required this.first,
|
||||
required this.last,
|
||||
this.prev,
|
||||
this.next,
|
||||
});
|
||||
|
||||
factory Links.fromJson(Map<String, dynamic> json) => Links(
|
||||
first: json["first"],
|
||||
last: json["last"],
|
||||
prev: json["prev"],
|
||||
next: json["next"],
|
||||
);
|
||||
|
||||
Map<String, dynamic> toJson() => {
|
||||
"first": first,
|
||||
"last": last,
|
||||
"prev": prev,
|
||||
"next": next,
|
||||
};
|
||||
}
|
||||
|
||||
class Meta {
|
||||
int currentPage;
|
||||
int? from;
|
||||
int lastPage;
|
||||
List<Link> links;
|
||||
String path;
|
||||
int perPage;
|
||||
int? to;
|
||||
int total;
|
||||
|
||||
Meta({
|
||||
required this.currentPage,
|
||||
this.from,
|
||||
required this.lastPage,
|
||||
required this.links,
|
||||
required this.path,
|
||||
required this.perPage,
|
||||
this.to,
|
||||
required this.total,
|
||||
});
|
||||
|
||||
factory Meta.fromJson(Map<String, dynamic> json) => Meta(
|
||||
currentPage: json["current_page"],
|
||||
from: json["from"],
|
||||
lastPage: json["last_page"],
|
||||
links: List<Link>.from(json["links"].map((x) => Link.fromJson(x))),
|
||||
path: json["path"],
|
||||
perPage: json["per_page"],
|
||||
to: json["to"],
|
||||
total: json["total"],
|
||||
);
|
||||
|
||||
Map<String, dynamic> toJson() => {
|
||||
"current_page": currentPage,
|
||||
"from": from,
|
||||
"last_page": lastPage,
|
||||
"links": List<dynamic>.from(links.map((x) => x.toJson())),
|
||||
"path": path,
|
||||
"per_page": perPage,
|
||||
"to": to,
|
||||
"total": total,
|
||||
};
|
||||
}
|
||||
|
||||
class Link {
|
||||
String? url;
|
||||
String label;
|
||||
bool active;
|
||||
|
||||
Link({
|
||||
this.url,
|
||||
required this.label,
|
||||
required this.active,
|
||||
});
|
||||
|
||||
factory Link.fromJson(Map<String, dynamic> json) => Link(
|
||||
url: json["url"],
|
||||
label: json["label"],
|
||||
active: json["active"],
|
||||
);
|
||||
|
||||
Map<String, dynamic> toJson() => {
|
||||
"url": url,
|
||||
"label": label,
|
||||
"active": active,
|
||||
};
|
||||
}
|
||||
|
||||
class EnumValues<T> {
|
||||
Map<String, T> map;
|
||||
late Map<T, String> reverseMap;
|
||||
|
||||
EnumValues(this.map);
|
||||
|
||||
Map<T, String> get reverse {
|
||||
reverseMap = map.map((k, v) => MapEntry(v, k));
|
||||
return reverseMap;
|
||||
}
|
||||
}
|
||||
69
app_code/lib/models/order/track_order_response.dart
Normal file
69
app_code/lib/models/order/track_order_response.dart
Normal file
@@ -0,0 +1,69 @@
|
||||
// To parse this JSON TrackInfo, do
|
||||
//
|
||||
// final trackOrderResponse = trackOrderResponseFromJson(jsonString);
|
||||
|
||||
import 'dart:convert';
|
||||
|
||||
TrackOrderResponse trackOrderResponseFromJson(String str) => TrackOrderResponse.fromJson(json.decode(str));
|
||||
|
||||
String trackOrderResponseToJson(TrackOrderResponse data) => json.encode(data.toJson());
|
||||
|
||||
class TrackOrderResponse {
|
||||
TrackInfo? data;
|
||||
|
||||
TrackOrderResponse({
|
||||
this.data,
|
||||
});
|
||||
|
||||
factory TrackOrderResponse.fromJson(Map<String, dynamic> json) => TrackOrderResponse(
|
||||
data:json["data"]==null?null: TrackInfo.fromJson(json["data"]),
|
||||
);
|
||||
|
||||
Map<String, dynamic> toJson() => {
|
||||
"data": data?.toJson(),
|
||||
};
|
||||
}
|
||||
|
||||
class TrackInfo {
|
||||
int id;
|
||||
List<OrderUpdate> orderUpdates;
|
||||
String createdDate;
|
||||
|
||||
TrackInfo({
|
||||
required this.id,
|
||||
required this.orderUpdates,
|
||||
required this.createdDate,
|
||||
});
|
||||
|
||||
factory TrackInfo.fromJson(Map<String, dynamic> json) => TrackInfo(
|
||||
id: json["id"],
|
||||
orderUpdates: List<OrderUpdate>.from(json["order_updates"].map((x) => OrderUpdate.fromJson(x))),
|
||||
createdDate: json["created_date"],
|
||||
);
|
||||
|
||||
Map<String, dynamic> toJson() => {
|
||||
"id": id,
|
||||
"order_updates": List<dynamic>.from(orderUpdates.map((x) => x.toJson())),
|
||||
"created_date": createdDate,
|
||||
};
|
||||
}
|
||||
|
||||
class OrderUpdate {
|
||||
String date;
|
||||
String note;
|
||||
|
||||
OrderUpdate({
|
||||
required this.date,
|
||||
required this.note,
|
||||
});
|
||||
|
||||
factory OrderUpdate.fromJson(Map<String, dynamic> json) => OrderUpdate(
|
||||
date: json["date"],
|
||||
note: json["note"],
|
||||
);
|
||||
|
||||
Map<String, dynamic> toJson() => {
|
||||
"date": date,
|
||||
"note": note,
|
||||
};
|
||||
}
|
||||
39
app_code/lib/models/order_create_response.dart
Normal file
39
app_code/lib/models/order_create_response.dart
Normal file
@@ -0,0 +1,39 @@
|
||||
// To parse this JSON data, do
|
||||
//
|
||||
// final orderCreateResponse = orderCreateResponseFromJson(jsonString);
|
||||
|
||||
import 'dart:convert';
|
||||
|
||||
OrderCreateResponse orderCreateResponseFromJson(String str) => OrderCreateResponse.fromJson(json.decode(str));
|
||||
|
||||
String orderCreateResponseToJson(OrderCreateResponse data) => json.encode(data.toJson());
|
||||
|
||||
class OrderCreateResponse {
|
||||
|
||||
bool result;
|
||||
int orderCode;
|
||||
String message;
|
||||
|
||||
factory OrderCreateResponse.init(){
|
||||
return OrderCreateResponse(message: "",orderCode: 0,result: false);
|
||||
}
|
||||
|
||||
|
||||
OrderCreateResponse({
|
||||
required this.result,
|
||||
required this.orderCode,
|
||||
required this.message,
|
||||
});
|
||||
|
||||
factory OrderCreateResponse.fromJson(Map<String, dynamic> json) => OrderCreateResponse(
|
||||
result: json["result"],
|
||||
orderCode: json["order_code"],
|
||||
message: json["message"],
|
||||
);
|
||||
|
||||
Map<String, dynamic> toJson() => {
|
||||
"result": result,
|
||||
"order_code": orderCode,
|
||||
"message": message,
|
||||
};
|
||||
}
|
||||
125
app_code/lib/models/page_response.dart
Normal file
125
app_code/lib/models/page_response.dart
Normal file
@@ -0,0 +1,125 @@
|
||||
// To parse this JSON data, do
|
||||
//
|
||||
// final pageResponse = pageResponseFromJson(jsonString);
|
||||
|
||||
import 'dart:convert';
|
||||
|
||||
PageResponse pageResponseFromJson(String str) => PageResponse.fromJson(json.decode(str));
|
||||
|
||||
String pageResponseToJson(PageResponse data) => json.encode(data.toJson());
|
||||
|
||||
class PageResponse {
|
||||
PageInfo data;
|
||||
|
||||
PageResponse({
|
||||
required this.data,
|
||||
});
|
||||
|
||||
factory PageResponse.fromJson(Map<String, dynamic> json) => PageResponse(
|
||||
data: PageInfo.fromJson(json["data"]),
|
||||
);
|
||||
|
||||
Map<String, dynamic> toJson() => {
|
||||
"data": data.toJson(),
|
||||
};
|
||||
}
|
||||
|
||||
class PageInfo {
|
||||
int id;
|
||||
String title;
|
||||
String slug;
|
||||
String content;
|
||||
String metaTitle;
|
||||
String metaImage;
|
||||
String metaDescription;
|
||||
DateTime createdAt;
|
||||
DateTime updatedAt;
|
||||
dynamic deletedAt;
|
||||
List<PageLocalization> pageLocalizations;
|
||||
|
||||
PageInfo({
|
||||
required this.id,
|
||||
required this.title,
|
||||
required this.slug,
|
||||
required this.content,
|
||||
required this.metaTitle,
|
||||
required this.metaImage,
|
||||
required this.metaDescription,
|
||||
required this.createdAt,
|
||||
required this.updatedAt,
|
||||
this.deletedAt,
|
||||
required this.pageLocalizations,
|
||||
});
|
||||
|
||||
factory PageInfo.fromJson(Map<String, dynamic> json) => PageInfo(
|
||||
id: json["id"],
|
||||
title: json["title"],
|
||||
slug: json["slug"],
|
||||
content: json["content"],
|
||||
metaTitle: json["meta_title"],
|
||||
metaImage: json["meta_image"],
|
||||
metaDescription: json["meta_description"],
|
||||
createdAt: DateTime.parse(json["created_at"]),
|
||||
updatedAt: DateTime.parse(json["updated_at"]),
|
||||
deletedAt: json["deleted_at"],
|
||||
pageLocalizations: List<PageLocalization>.from(json["page_localizations"].map((x) => PageLocalization.fromJson(x))),
|
||||
);
|
||||
|
||||
Map<String, dynamic> toJson() => {
|
||||
"id": id,
|
||||
"title": title,
|
||||
"slug": slug,
|
||||
"content": content,
|
||||
"meta_title": metaTitle,
|
||||
"meta_image": metaImage,
|
||||
"meta_description": metaDescription,
|
||||
"created_at": createdAt.toIso8601String(),
|
||||
"updated_at": updatedAt.toIso8601String(),
|
||||
"deleted_at": deletedAt,
|
||||
"page_localizations": List<dynamic>.from(pageLocalizations.map((x) => x.toJson())),
|
||||
};
|
||||
}
|
||||
|
||||
class PageLocalization {
|
||||
int id;
|
||||
var pageId;
|
||||
String title;
|
||||
String content;
|
||||
String langKey;
|
||||
DateTime createdAt;
|
||||
DateTime updatedAt;
|
||||
dynamic deletedAt;
|
||||
|
||||
PageLocalization({
|
||||
required this.id,
|
||||
required this.pageId,
|
||||
required this.title,
|
||||
required this.content,
|
||||
required this.langKey,
|
||||
required this.createdAt,
|
||||
required this.updatedAt,
|
||||
this.deletedAt,
|
||||
});
|
||||
|
||||
factory PageLocalization.fromJson(Map<String, dynamic> json) => PageLocalization(
|
||||
id: json["id"],
|
||||
pageId: json["page_id"],
|
||||
title: json["title"],
|
||||
content: json["content"],
|
||||
langKey: json["lang_key"],
|
||||
createdAt: DateTime.parse(json["created_at"]),
|
||||
updatedAt: DateTime.parse(json["updated_at"]),
|
||||
deletedAt: json["deleted_at"],
|
||||
);
|
||||
|
||||
Map<String, dynamic> toJson() => {
|
||||
"id": id,
|
||||
"page_id": pageId,
|
||||
"title": title,
|
||||
"content": content,
|
||||
"lang_key": langKey,
|
||||
"created_at": createdAt.toIso8601String(),
|
||||
"updated_at": updatedAt.toIso8601String(),
|
||||
"deleted_at": deletedAt,
|
||||
};
|
||||
}
|
||||
33
app_code/lib/models/payment_types_response.dart
Normal file
33
app_code/lib/models/payment_types_response.dart
Normal file
@@ -0,0 +1,33 @@
|
||||
// To parse this JSON data, do
|
||||
//
|
||||
// final paymentTypesResponse = paymentTypesResponseFromJson(jsonString);
|
||||
|
||||
import 'dart:convert';
|
||||
|
||||
List<PaymentTypesResponse> paymentTypesResponseFromJson(String str) => List<PaymentTypesResponse>.from(json.decode(str).map((x) => PaymentTypesResponse.fromJson(x)));
|
||||
|
||||
String paymentTypesResponseToJson(List<PaymentTypesResponse> data) => json.encode(List<dynamic>.from(data.map((x) => x.toJson())));
|
||||
|
||||
class PaymentTypesResponse {
|
||||
String key;
|
||||
String name;
|
||||
String image;
|
||||
|
||||
PaymentTypesResponse({
|
||||
required this.key,
|
||||
required this.name,
|
||||
required this.image,
|
||||
});
|
||||
|
||||
factory PaymentTypesResponse.fromJson(Map<String, dynamic> json) => PaymentTypesResponse(
|
||||
key: json["key"],
|
||||
name: json["name"],
|
||||
image: json["image"],
|
||||
);
|
||||
|
||||
Map<String, dynamic> toJson() => {
|
||||
"key": key,
|
||||
"name": name,
|
||||
"image": image,
|
||||
};
|
||||
}
|
||||
255
app_code/lib/models/product_details_response.dart
Normal file
255
app_code/lib/models/product_details_response.dart
Normal file
@@ -0,0 +1,255 @@
|
||||
// To parse this JSON data, do
|
||||
//
|
||||
// final productDetailsResponse = productDetailsResponseFromJson(jsonString);
|
||||
|
||||
import 'dart:convert';
|
||||
|
||||
ProductDetailsResponse productDetailsResponseFromJson(String str) => ProductDetailsResponse.fromJson(json.decode(str));
|
||||
|
||||
String productDetailsResponseToJson(ProductDetailsResponse data) => json.encode(data.toJson());
|
||||
|
||||
class ProductDetailsResponse {
|
||||
ProductDetailsInfo data;
|
||||
bool result;
|
||||
var status;
|
||||
|
||||
ProductDetailsResponse({
|
||||
required this.data,
|
||||
required this.result,
|
||||
required this.status,
|
||||
});
|
||||
|
||||
factory ProductDetailsResponse.fromJson(Map<String, dynamic> json) => ProductDetailsResponse(
|
||||
data: ProductDetailsInfo.fromJson(json["data"]),
|
||||
result: json["result"],
|
||||
status: json["status"],
|
||||
);
|
||||
|
||||
Map<String, dynamic> toJson() => {
|
||||
"data": data.toJson(),
|
||||
"result": result,
|
||||
"status": status,
|
||||
};
|
||||
}
|
||||
|
||||
class ProductDetailsInfo {
|
||||
var id;
|
||||
List<Variation> variations;
|
||||
List<VariationMaterial> variationMaterials;
|
||||
String slug;
|
||||
String name;
|
||||
String thumbnailImage;
|
||||
List<String> galleryImages;
|
||||
String price;
|
||||
double mainPrice;
|
||||
bool isDiscounted;
|
||||
var discount;
|
||||
String? shortDescription;
|
||||
String? description;
|
||||
String? brand;
|
||||
String? unit;
|
||||
var stock;
|
||||
var rewardPovars;
|
||||
List<Category> categories;
|
||||
|
||||
ProductDetailsInfo({
|
||||
required this.id,
|
||||
required this.variations,
|
||||
required this.variationMaterials,
|
||||
required this.slug,
|
||||
required this.name,
|
||||
required this.thumbnailImage,
|
||||
required this.galleryImages,
|
||||
required this.price,
|
||||
required this.mainPrice,
|
||||
required this.isDiscounted,
|
||||
required this.discount,
|
||||
this.shortDescription,
|
||||
this.description,
|
||||
this.brand,
|
||||
this.unit,
|
||||
required this.stock,
|
||||
required this.rewardPovars,
|
||||
required this.categories,
|
||||
});
|
||||
|
||||
factory ProductDetailsInfo.fromJson(Map<String, dynamic> json) => ProductDetailsInfo(
|
||||
id: json["id"],
|
||||
variations:json["variations"]==[]?[]: List<Variation>.from(json["variations"].map((x) => Variation.fromJson(x))),
|
||||
variationMaterials:json["variation_materials"]==[]?[]: List<VariationMaterial>.from(json["variation_materials"].map((x) => VariationMaterial.fromJson(x))),
|
||||
slug: json["slug"],
|
||||
name: json["name"],
|
||||
thumbnailImage: json["thumbnail_image"],
|
||||
galleryImages: List<String>.from(json["gallery_images"].map((x) => x)),
|
||||
price: json["price"],
|
||||
mainPrice: json["main_price"]?.toDouble(),
|
||||
isDiscounted: json["is_discounted"],
|
||||
discount: json["discount"],
|
||||
shortDescription: json["short_description"],
|
||||
description: json["description"],
|
||||
brand: json["brand"],
|
||||
unit: json["unit"],
|
||||
stock: json["stock"],
|
||||
rewardPovars: json["reward_povars"],
|
||||
categories: List<Category>.from(json["categories"].map((x) => Category.fromJson(x))),
|
||||
);
|
||||
factory ProductDetailsInfo.init() => ProductDetailsInfo(
|
||||
id: 0,
|
||||
variations: [],
|
||||
variationMaterials: [],
|
||||
slug:"",
|
||||
name: '',
|
||||
thumbnailImage: '',
|
||||
galleryImages:[],
|
||||
price: "",
|
||||
mainPrice: 0.0,
|
||||
isDiscounted: false,
|
||||
discount: "",
|
||||
shortDescription: "",
|
||||
description: "",
|
||||
brand: "",
|
||||
unit: "",
|
||||
stock: "",
|
||||
rewardPovars: "",
|
||||
categories: []
|
||||
);
|
||||
|
||||
Map<String, dynamic> toJson() => {
|
||||
"id": id,
|
||||
"variations": List<dynamic>.from(variations.map((x) => x.toJson())),
|
||||
"variation_materials": List<dynamic>.from(variationMaterials.map((x) => x.toJson())),
|
||||
"slug": slug,
|
||||
"name": name,
|
||||
"thumbnail_image": thumbnailImage,
|
||||
"gallery_images": List<dynamic>.from(galleryImages.map((x) => x)),
|
||||
"price": price,
|
||||
"main_price": mainPrice,
|
||||
"is_discounted": isDiscounted,
|
||||
"discount": discount,
|
||||
"short_description": shortDescription,
|
||||
"description": description,
|
||||
"brand": brand,
|
||||
"unit": unit,
|
||||
"stock": stock,
|
||||
"reward_povars": rewardPovars,
|
||||
"categories": List<dynamic>.from(categories.map((x) => x.toJson())),
|
||||
};
|
||||
}
|
||||
|
||||
class Category {
|
||||
var id;
|
||||
String name;
|
||||
var products;
|
||||
String thumbnailImage;
|
||||
|
||||
Category({
|
||||
required this.id,
|
||||
required this.name,
|
||||
required this.products,
|
||||
required this.thumbnailImage,
|
||||
});
|
||||
|
||||
factory Category.fromJson(Map<String, dynamic> json) => Category(
|
||||
id: json["id"],
|
||||
name: json["name"],
|
||||
products: json["products"],
|
||||
thumbnailImage: json["thumbnail_image"],
|
||||
);
|
||||
|
||||
Map<String, dynamic> toJson() => {
|
||||
"id": id,
|
||||
"name": name,
|
||||
"products": products,
|
||||
"thumbnail_image": thumbnailImage,
|
||||
};
|
||||
}
|
||||
|
||||
class VariationMaterial {
|
||||
var id;
|
||||
String name;
|
||||
List<Value> values;
|
||||
|
||||
VariationMaterial({
|
||||
required this.id,
|
||||
required this.name,
|
||||
required this.values,
|
||||
});
|
||||
|
||||
factory VariationMaterial.fromJson(Map<String, dynamic> json) => VariationMaterial(
|
||||
id: json["id"],
|
||||
name: json["name"],
|
||||
values: List<Value>.from(json["values"].map((x) => Value.fromJson(x))),
|
||||
);
|
||||
|
||||
Map<String, dynamic> toJson() => {
|
||||
"id": id,
|
||||
"name": name,
|
||||
"values": List<dynamic>.from(values.map((x) => x.toJson())),
|
||||
};
|
||||
}
|
||||
|
||||
class Value {
|
||||
var id;
|
||||
String name;
|
||||
String? code;
|
||||
|
||||
Value({
|
||||
required this.id,
|
||||
required this.name,
|
||||
this.code,
|
||||
});
|
||||
|
||||
factory Value.fromJson(Map<String, dynamic> json) => Value(
|
||||
id: json["id"],
|
||||
name: json["name"],
|
||||
code: json["code"],
|
||||
);
|
||||
|
||||
Map<String, dynamic> toJson() => {
|
||||
"id": id,
|
||||
"name": name,
|
||||
"code": code,
|
||||
};
|
||||
}
|
||||
|
||||
class Variation {
|
||||
var id;
|
||||
var productId;
|
||||
String? variationKey;
|
||||
String? sku;
|
||||
String? code;
|
||||
int sock;
|
||||
var price;
|
||||
|
||||
|
||||
Variation({
|
||||
required this.id,
|
||||
required this.productId,
|
||||
this.variationKey,
|
||||
this.sku,
|
||||
this.code,
|
||||
required this.sock,
|
||||
required this.price,
|
||||
|
||||
});
|
||||
|
||||
factory Variation.fromJson(Map<String, dynamic> json) => Variation(
|
||||
id: json["id"],
|
||||
productId: json["product_id"],
|
||||
variationKey: json["variation_key"],
|
||||
sku: json["sku"],
|
||||
sock: json["stock"],
|
||||
code: json["code"],
|
||||
price: json["price"],
|
||||
);
|
||||
|
||||
Map<String, dynamic> toJson() => {
|
||||
"id": id,
|
||||
"product_id": productId,
|
||||
"variation_key": variationKey,
|
||||
"sku": sku,
|
||||
"stock": sock,
|
||||
"code": code,
|
||||
"price": price,
|
||||
};
|
||||
}
|
||||
87
app_code/lib/models/product_mini_response.dart
Normal file
87
app_code/lib/models/product_mini_response.dart
Normal file
@@ -0,0 +1,87 @@
|
||||
// To parse this JSON data, do
|
||||
//
|
||||
// final productMiniResponse = productMiniResponseFromJson(jsonString);
|
||||
|
||||
import 'dart:convert';
|
||||
|
||||
import 'package:grostore/models/common/category_info.dart';
|
||||
|
||||
import 'product_details_response.dart';
|
||||
|
||||
ProductMiniResponse productMiniResponseFromJson(String str) => ProductMiniResponse.fromJson(json.decode(str));
|
||||
|
||||
String productMiniResponseToJson(ProductMiniResponse data) => json.encode(data.toJson());
|
||||
|
||||
class ProductMiniResponse {
|
||||
List<ProductMini> data;
|
||||
|
||||
ProductMiniResponse({
|
||||
required this.data,
|
||||
});
|
||||
|
||||
factory ProductMiniResponse.fromJson(Map<String, dynamic> json) => ProductMiniResponse(
|
||||
data: List<ProductMini>.from(json["data"].map((x) => ProductMini.fromJson(x))),
|
||||
);
|
||||
|
||||
Map<String, dynamic> toJson() => {
|
||||
"data": List<dynamic>.from(data.map((x) => x.toJson())),
|
||||
};
|
||||
}
|
||||
|
||||
class ProductMini {
|
||||
var id;
|
||||
String name;
|
||||
String slug;
|
||||
String? brand;
|
||||
String unit;
|
||||
String thumbnailImage;
|
||||
String price;
|
||||
var discount;
|
||||
bool isDiscounted;
|
||||
var rewardPovars;
|
||||
List<CategoryInfo> categories;
|
||||
List<Variation> variations;
|
||||
|
||||
ProductMini({
|
||||
required this.id,
|
||||
required this.variations,
|
||||
required this.name,
|
||||
required this.slug,
|
||||
required this.brand,
|
||||
required this.unit,
|
||||
required this.thumbnailImage,
|
||||
required this.price,
|
||||
required this.discount,
|
||||
required this.isDiscounted,
|
||||
required this.rewardPovars,
|
||||
required this.categories,
|
||||
});
|
||||
|
||||
factory ProductMini.fromJson(Map<String, dynamic> json) => ProductMini(
|
||||
id: json["id"],
|
||||
name: json["name"],
|
||||
variations:json["variations"]==[]?[]: List<Variation>.from(json["variations"].map((x) => Variation.fromJson(x))),
|
||||
slug: json["slug"],
|
||||
brand: json["brand"],
|
||||
unit: json["unit"],
|
||||
thumbnailImage: json["thumbnail_image"],
|
||||
price: json["price"],
|
||||
discount: json["discount"],
|
||||
isDiscounted: json["is_discounted"],
|
||||
rewardPovars: json["reward_points"],
|
||||
categories: List<CategoryInfo>.from(json["categories"].map((x) => CategoryInfo.fromJson(x))),
|
||||
);
|
||||
|
||||
Map<String, dynamic> toJson() => {
|
||||
"name": name,
|
||||
"slug": slug,
|
||||
"brand": brand,
|
||||
"unit": unit,
|
||||
"thumbnail_image": thumbnailImage,
|
||||
"price": price,
|
||||
"is_discounted": isDiscounted,
|
||||
"discount": discount,
|
||||
"reward_povars": rewardPovars,
|
||||
"categories": List<dynamic>.from(categories.map((x) => x.toJson())),
|
||||
};
|
||||
}
|
||||
169
app_code/lib/models/refund_response.dart
Normal file
169
app_code/lib/models/refund_response.dart
Normal file
@@ -0,0 +1,169 @@
|
||||
// To parse this JSON data, do
|
||||
//
|
||||
// final refundResponse = refundResponseFromJson(jsonString);
|
||||
|
||||
import 'dart:convert';
|
||||
|
||||
RefundResponse refundResponseFromJson(String str) => RefundResponse.fromJson(json.decode(str));
|
||||
|
||||
String refundResponseToJson(RefundResponse data) => json.encode(data.toJson());
|
||||
|
||||
class RefundResponse {
|
||||
List<RefundInfo> data;
|
||||
Links links;
|
||||
Meta meta;
|
||||
|
||||
RefundResponse({
|
||||
required this.data,
|
||||
required this.links,
|
||||
required this.meta,
|
||||
});
|
||||
|
||||
factory RefundResponse.fromJson(Map<String, dynamic> json) => RefundResponse(
|
||||
data: List<RefundInfo>.from(json["data"].map((x) => RefundInfo.fromJson(x))),
|
||||
links: Links.fromJson(json["links"]),
|
||||
meta: Meta.fromJson(json["meta"]),
|
||||
);
|
||||
|
||||
Map<String, dynamic> toJson() => {
|
||||
"data": List<dynamic>.from(data.map((x) => x.toJson())),
|
||||
"links": links.toJson(),
|
||||
"meta": meta.toJson(),
|
||||
};
|
||||
}
|
||||
|
||||
class RefundInfo {
|
||||
int id;
|
||||
String orderCode;
|
||||
String amount;
|
||||
String productName;
|
||||
String status;
|
||||
dynamic reson;
|
||||
String date;
|
||||
|
||||
RefundInfo({
|
||||
required this.id,
|
||||
required this.orderCode,
|
||||
required this.amount,
|
||||
required this.productName,
|
||||
required this.status,
|
||||
this.reson,
|
||||
required this.date,
|
||||
});
|
||||
|
||||
factory RefundInfo.fromJson(Map<String, dynamic> json) => RefundInfo(
|
||||
id: json["id"],
|
||||
orderCode: json["order_code"],
|
||||
amount: json["amount"],
|
||||
productName: json["product_name"],
|
||||
status: json["status"],
|
||||
reson: json["reson"],
|
||||
date: json["date"],
|
||||
);
|
||||
|
||||
Map<String, dynamic> toJson() => {
|
||||
"id": id,
|
||||
"order_code": orderCode,
|
||||
"amount": amount,
|
||||
"product_name": productName,
|
||||
"status": status,
|
||||
"reson": reson,
|
||||
"date": date,
|
||||
};
|
||||
}
|
||||
|
||||
class Links {
|
||||
String first;
|
||||
String last;
|
||||
dynamic prev;
|
||||
dynamic next;
|
||||
|
||||
Links({
|
||||
required this.first,
|
||||
required this.last,
|
||||
this.prev,
|
||||
this.next,
|
||||
});
|
||||
|
||||
factory Links.fromJson(Map<String, dynamic> json) => Links(
|
||||
first: json["first"],
|
||||
last: json["last"],
|
||||
prev: json["prev"],
|
||||
next: json["next"],
|
||||
);
|
||||
|
||||
Map<String, dynamic> toJson() => {
|
||||
"first": first,
|
||||
"last": last,
|
||||
"prev": prev,
|
||||
"next": next,
|
||||
};
|
||||
}
|
||||
|
||||
class Meta {
|
||||
int currentPage;
|
||||
int? from;
|
||||
int lastPage;
|
||||
List<Link> links;
|
||||
String path;
|
||||
String perPage;
|
||||
int? to;
|
||||
int total;
|
||||
|
||||
Meta({
|
||||
required this.currentPage,
|
||||
this.from,
|
||||
required this.lastPage,
|
||||
required this.links,
|
||||
required this.path,
|
||||
required this.perPage,
|
||||
this.to,
|
||||
required this.total,
|
||||
});
|
||||
|
||||
factory Meta.fromJson(Map<String, dynamic> json) => Meta(
|
||||
currentPage: json["current_page"],
|
||||
from: json["from"],
|
||||
lastPage: json["last_page"],
|
||||
links: List<Link>.from(json["links"].map((x) => Link.fromJson(x))),
|
||||
path: json["path"],
|
||||
perPage: json["per_page"],
|
||||
to: json["to"],
|
||||
total: json["total"],
|
||||
);
|
||||
|
||||
Map<String, dynamic> toJson() => {
|
||||
"current_page": currentPage,
|
||||
"from": from,
|
||||
"last_page": lastPage,
|
||||
"links": List<dynamic>.from(links.map((x) => x.toJson())),
|
||||
"path": path,
|
||||
"per_page": perPage,
|
||||
"to": to,
|
||||
"total": total,
|
||||
};
|
||||
}
|
||||
|
||||
class Link {
|
||||
String? url;
|
||||
String label;
|
||||
bool active;
|
||||
|
||||
Link({
|
||||
this.url,
|
||||
required this.label,
|
||||
required this.active,
|
||||
});
|
||||
|
||||
factory Link.fromJson(Map<String, dynamic> json) => Link(
|
||||
url: json["url"],
|
||||
label: json["label"],
|
||||
active: json["active"],
|
||||
);
|
||||
|
||||
Map<String, dynamic> toJson() => {
|
||||
"url": url,
|
||||
"label": label,
|
||||
"active": active,
|
||||
};
|
||||
}
|
||||
5
app_code/lib/models/response_model.dart
Normal file
5
app_code/lib/models/response_model.dart
Normal file
@@ -0,0 +1,5 @@
|
||||
class ResponseModel<T>{
|
||||
late int statusCode;
|
||||
late T object ;
|
||||
ResponseModel(this.statusCode, this.object);
|
||||
}
|
||||
25
app_code/lib/models/setting_response.dart
Normal file
25
app_code/lib/models/setting_response.dart
Normal file
@@ -0,0 +1,25 @@
|
||||
// To parse this JSON data, do
|
||||
//
|
||||
// final settingResponse = settingResponseFromJson(jsonString);
|
||||
|
||||
import 'dart:convert';
|
||||
|
||||
SettingResponse settingResponseFromJson(String str) => SettingResponse.fromJson(json.decode(str));
|
||||
|
||||
String settingResponseToJson(SettingResponse data) => json.encode(data.toJson());
|
||||
|
||||
class SettingResponse {
|
||||
String orderCodePrefix;
|
||||
|
||||
SettingResponse({
|
||||
required this.orderCodePrefix,
|
||||
});
|
||||
|
||||
factory SettingResponse.fromJson(Map<String, dynamic> json) => SettingResponse(
|
||||
orderCodePrefix: json["order_code_prefix"],
|
||||
);
|
||||
|
||||
Map<String, dynamic> toJson() => {
|
||||
"order_code_prefix": orderCodePrefix,
|
||||
};
|
||||
}
|
||||
53
app_code/lib/models/state_response.dart
Normal file
53
app_code/lib/models/state_response.dart
Normal file
@@ -0,0 +1,53 @@
|
||||
// To parse this JSON data, do
|
||||
//
|
||||
// final stateResponse = stateResponseFromJson(jsonString);
|
||||
|
||||
import 'dart:convert';
|
||||
|
||||
StateResponse stateResponseFromJson(String str) => StateResponse.fromJson(json.decode(str));
|
||||
|
||||
String stateResponseToJson(StateResponse data) => json.encode(data.toJson());
|
||||
|
||||
class StateResponse {
|
||||
List<StateInfo> data;
|
||||
|
||||
StateResponse({
|
||||
required this.data,
|
||||
});
|
||||
|
||||
factory StateResponse.fromJson(Map<String, dynamic> json) => StateResponse(
|
||||
data: List<StateInfo>.from(json["data"].map((x) => StateInfo.fromJson(x))),
|
||||
);
|
||||
|
||||
Map<String, dynamic> toJson() => {
|
||||
"data": List<dynamic>.from(data.map((x) => x.toJson())),
|
||||
};
|
||||
}
|
||||
|
||||
class StateInfo {
|
||||
int countryId;
|
||||
int id;
|
||||
String name;
|
||||
bool isActive;
|
||||
|
||||
StateInfo({
|
||||
required this.countryId,
|
||||
required this.id,
|
||||
required this.name,
|
||||
required this.isActive,
|
||||
});
|
||||
|
||||
factory StateInfo.fromJson(Map<String, dynamic> json) => StateInfo(
|
||||
countryId: json["country_id"],
|
||||
id: json["id"],
|
||||
name: json["name"],
|
||||
isActive: json["is_active"],
|
||||
);
|
||||
|
||||
Map<String, dynamic> toJson() => {
|
||||
"country_id": countryId,
|
||||
"id": id,
|
||||
"name": name,
|
||||
"is_active": isActive,
|
||||
};
|
||||
}
|
||||
11
app_code/lib/models/supplire.dart
Normal file
11
app_code/lib/models/supplire.dart
Normal file
@@ -0,0 +1,11 @@
|
||||
class Supplier {
|
||||
final String name;
|
||||
final String address;
|
||||
final String paymentInfo;
|
||||
|
||||
const Supplier({
|
||||
required this.name,
|
||||
required this.address,
|
||||
required this.paymentInfo,
|
||||
});
|
||||
}
|
||||
57
app_code/lib/models/time_slote_response.dart
Normal file
57
app_code/lib/models/time_slote_response.dart
Normal file
@@ -0,0 +1,57 @@
|
||||
// To parse this JSON data, do
|
||||
//
|
||||
// final timeSlotResponse = timeSlotResponseFromJson(jsonString);
|
||||
|
||||
import 'dart:convert';
|
||||
|
||||
import 'package:grostore/models/product_details_response.dart';
|
||||
|
||||
TimeSlotResponse timeSlotResponseFromJson(String str) => TimeSlotResponse.fromJson(json.decode(str));
|
||||
|
||||
String timeSlotResponseToJson(TimeSlotResponse data) => json.encode(data.toJson());
|
||||
|
||||
class TimeSlotResponse {
|
||||
int days;
|
||||
List<TimeSlot> timeSlots;
|
||||
|
||||
TimeSlotResponse({
|
||||
required this.days,
|
||||
required this.timeSlots,
|
||||
});
|
||||
|
||||
factory TimeSlotResponse.fromJson(Map<String, dynamic> json) => TimeSlotResponse(
|
||||
days: json["days"],
|
||||
timeSlots: List<TimeSlot>.from(json["time_slots"].map((x) => TimeSlot.fromJson(x))),
|
||||
);
|
||||
|
||||
Map<String, dynamic> toJson() => {
|
||||
"days": days,
|
||||
"time_slots": List<dynamic>.from(timeSlots.map((x) => x.toJson())),
|
||||
};
|
||||
}
|
||||
|
||||
class TimeSlot {
|
||||
var id;
|
||||
String timeline;
|
||||
var sortingOrder;
|
||||
|
||||
|
||||
|
||||
TimeSlot({
|
||||
required this.id,
|
||||
required this.timeline,
|
||||
required this.sortingOrder,
|
||||
});
|
||||
|
||||
factory TimeSlot.fromJson(Map<String, dynamic> json) => TimeSlot(
|
||||
id: json["id"],
|
||||
timeline: json["timeline"],
|
||||
sortingOrder: json["sorting_order"],
|
||||
);
|
||||
|
||||
Map<String, dynamic> toJson() => {
|
||||
"id": id,
|
||||
"timeline": timeline,
|
||||
"sorting_order": sortingOrder,
|
||||
};
|
||||
}
|
||||
77
app_code/lib/models/user/addresses_response.dart
Normal file
77
app_code/lib/models/user/addresses_response.dart
Normal file
@@ -0,0 +1,77 @@
|
||||
// To parse this JSON data, do
|
||||
//
|
||||
// final addressesResponse = addressesResponseFromJson(jsonString);
|
||||
|
||||
import 'dart:convert';
|
||||
|
||||
AddressesResponse addressesResponseFromJson(String str) => AddressesResponse.fromJson(json.decode(str));
|
||||
|
||||
String addressesResponseToJson(AddressesResponse data) => json.encode(data.toJson());
|
||||
|
||||
class AddressesResponse {
|
||||
List<AddressInfo> data;
|
||||
|
||||
AddressesResponse({
|
||||
required this.data,
|
||||
});
|
||||
|
||||
factory AddressesResponse.fromJson(Map<String, dynamic> json) => AddressesResponse(
|
||||
data: List<AddressInfo>.from(json["data"].map((x) => AddressInfo.fromJson(x))),
|
||||
);
|
||||
|
||||
Map<String, dynamic> toJson() => {
|
||||
"data": List<dynamic>.from(data.map((x) => x.toJson())),
|
||||
};
|
||||
}
|
||||
|
||||
class AddressInfo {
|
||||
var id;
|
||||
var userId;
|
||||
var countryId;
|
||||
String countryName;
|
||||
var stateId;
|
||||
String stateName;
|
||||
var cityId;
|
||||
String cityName;
|
||||
String address;
|
||||
var isDefault;
|
||||
|
||||
AddressInfo({
|
||||
required this.id,
|
||||
required this.userId,
|
||||
required this.countryId,
|
||||
required this.countryName,
|
||||
required this.stateId,
|
||||
required this.stateName,
|
||||
required this.cityId,
|
||||
required this.cityName,
|
||||
required this.address,
|
||||
required this.isDefault,
|
||||
});
|
||||
|
||||
factory AddressInfo.fromJson(Map<String, dynamic> json) => AddressInfo(
|
||||
id: json["id"],
|
||||
userId: json["user_id"],
|
||||
countryId: json["country_id"],
|
||||
countryName: json["country_name"],
|
||||
stateId: json["state_id"],
|
||||
stateName: json["state_name"],
|
||||
cityId: json["city_id"],
|
||||
cityName: json["city_name"],
|
||||
address: json["address"],
|
||||
isDefault: json["is_default"],
|
||||
);
|
||||
|
||||
Map<String, dynamic> toJson() => {
|
||||
"id": id,
|
||||
"user_id": userId,
|
||||
"country_id": countryId,
|
||||
"country_name": countryName,
|
||||
"state_id": stateId,
|
||||
"state_name": stateName,
|
||||
"city_id": cityId,
|
||||
"city_name": cityName,
|
||||
"address": address,
|
||||
"is_default": isDefault,
|
||||
};
|
||||
}
|
||||
50
app_code/lib/models/user_info_response_model.dart
Normal file
50
app_code/lib/models/user_info_response_model.dart
Normal file
@@ -0,0 +1,50 @@
|
||||
// To parse this JSON data, do
|
||||
//
|
||||
// final userInfoResponse = userInfoResponseFromJson(jsonString);
|
||||
|
||||
import 'dart:convert';
|
||||
|
||||
import 'common/user_info.dart';
|
||||
|
||||
UserInfoResponse userInfoResponseFromJson(String str) => UserInfoResponse.fromJson(json.decode(str));
|
||||
UserInfoResponse userInfoResponseDefault() => UserInfoResponse.fromJson(json.decode('''
|
||||
{
|
||||
"data": {
|
||||
"name": "",
|
||||
"email": "",
|
||||
"phone": "",
|
||||
"balance": 0,
|
||||
"avatar": ""
|
||||
},
|
||||
"result": false,
|
||||
"message": "failed"
|
||||
}
|
||||
'''));
|
||||
|
||||
String userInfoResponseToJson(UserInfoResponse data) => json.encode(data.toJson());
|
||||
|
||||
class UserInfoResponse {
|
||||
UserInfo data;
|
||||
bool result;
|
||||
String message;
|
||||
|
||||
UserInfoResponse({
|
||||
required this.data,
|
||||
required this.result,
|
||||
required this.message,
|
||||
});
|
||||
|
||||
factory UserInfoResponse.fromJson(Map<String, dynamic> json) => UserInfoResponse(
|
||||
data: UserInfo.fromJson(json["data"]),
|
||||
result: json["result"],
|
||||
message: json["message"],
|
||||
);
|
||||
|
||||
Map<String, dynamic> toJson() => {
|
||||
"data": data.toJson(),
|
||||
"result": result,
|
||||
"message": message,
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
161
app_code/lib/models/wallet_history_response.dart
Normal file
161
app_code/lib/models/wallet_history_response.dart
Normal file
@@ -0,0 +1,161 @@
|
||||
// To parse this JSON data, do
|
||||
//
|
||||
// final walletHistoryResponse = walletHistoryResponseFromJson(jsonString);
|
||||
|
||||
import 'dart:convert';
|
||||
|
||||
WalletHistoryResponse walletHistoryResponseFromJson(String str) => WalletHistoryResponse.fromJson(json.decode(str));
|
||||
|
||||
String walletHistoryResponseToJson(WalletHistoryResponse data) => json.encode(data.toJson());
|
||||
|
||||
class WalletHistoryResponse {
|
||||
List<WalletInfo> data;
|
||||
Links links;
|
||||
Meta meta;
|
||||
|
||||
WalletHistoryResponse({
|
||||
required this.data,
|
||||
required this.links,
|
||||
required this.meta,
|
||||
});
|
||||
|
||||
factory WalletHistoryResponse.fromJson(Map<String, dynamic> json) => WalletHistoryResponse(
|
||||
data: List<WalletInfo>.from(json["data"].map((x) => WalletInfo.fromJson(x))),
|
||||
links: Links.fromJson(json["links"]),
|
||||
meta: Meta.fromJson(json["meta"]),
|
||||
);
|
||||
|
||||
Map<String, dynamic> toJson() => {
|
||||
"data": List<dynamic>.from(data.map((x) => x.toJson())),
|
||||
"links": links.toJson(),
|
||||
"meta": meta.toJson(),
|
||||
};
|
||||
}
|
||||
|
||||
class WalletInfo {
|
||||
int id;
|
||||
String amount;
|
||||
String paymentMethod;
|
||||
String status;
|
||||
String date;
|
||||
|
||||
WalletInfo({
|
||||
required this.id,
|
||||
required this.amount,
|
||||
required this.paymentMethod,
|
||||
required this.status,
|
||||
required this.date,
|
||||
});
|
||||
|
||||
factory WalletInfo.fromJson(Map<String, dynamic> json) => WalletInfo(
|
||||
id: json["id"],
|
||||
amount: json["amount"],
|
||||
paymentMethod: json["payment_method"],
|
||||
status: json["status"],
|
||||
date: json["date"],
|
||||
);
|
||||
|
||||
Map<String, dynamic> toJson() => {
|
||||
"id": id,
|
||||
"amount": amount,
|
||||
"payment_method": paymentMethod,
|
||||
"status": status,
|
||||
"date": date,
|
||||
};
|
||||
}
|
||||
|
||||
class Links {
|
||||
String first;
|
||||
String last;
|
||||
dynamic prev;
|
||||
dynamic next;
|
||||
|
||||
Links({
|
||||
required this.first,
|
||||
required this.last,
|
||||
this.prev,
|
||||
this.next,
|
||||
});
|
||||
|
||||
factory Links.fromJson(Map<String, dynamic> json) => Links(
|
||||
first: json["first"],
|
||||
last: json["last"],
|
||||
prev: json["prev"],
|
||||
next: json["next"],
|
||||
);
|
||||
|
||||
Map<String, dynamic> toJson() => {
|
||||
"first": first,
|
||||
"last": last,
|
||||
"prev": prev,
|
||||
"next": next,
|
||||
};
|
||||
}
|
||||
|
||||
class Meta {
|
||||
int currentPage;
|
||||
int? from;
|
||||
int lastPage;
|
||||
List<Link> links;
|
||||
String path;
|
||||
String perPage;
|
||||
int? to;
|
||||
int total;
|
||||
|
||||
Meta({
|
||||
required this.currentPage,
|
||||
this.from,
|
||||
required this.lastPage,
|
||||
required this.links,
|
||||
required this.path,
|
||||
required this.perPage,
|
||||
this.to,
|
||||
required this.total,
|
||||
});
|
||||
|
||||
factory Meta.fromJson(Map<String, dynamic> json) => Meta(
|
||||
currentPage: json["current_page"],
|
||||
from: json["from"],
|
||||
lastPage: json["last_page"],
|
||||
links: List<Link>.from(json["links"].map((x) => Link.fromJson(x))),
|
||||
path: json["path"],
|
||||
perPage: json["per_page"],
|
||||
to: json["to"],
|
||||
total: json["total"],
|
||||
);
|
||||
|
||||
Map<String, dynamic> toJson() => {
|
||||
"current_page": currentPage,
|
||||
"from": from,
|
||||
"last_page": lastPage,
|
||||
"links": List<dynamic>.from(links.map((x) => x.toJson())),
|
||||
"path": path,
|
||||
"per_page": perPage,
|
||||
"to": to,
|
||||
"total": total,
|
||||
};
|
||||
}
|
||||
|
||||
class Link {
|
||||
String? url;
|
||||
String label;
|
||||
bool active;
|
||||
|
||||
Link({
|
||||
this.url,
|
||||
required this.label,
|
||||
required this.active,
|
||||
});
|
||||
|
||||
factory Link.fromJson(Map<String, dynamic> json) => Link(
|
||||
url: json["url"],
|
||||
label: json["label"],
|
||||
active: json["active"],
|
||||
);
|
||||
|
||||
Map<String, dynamic> toJson() => {
|
||||
"url": url,
|
||||
"label": label,
|
||||
"active": active,
|
||||
};
|
||||
}
|
||||
50
app_code/lib/models/wishlist_response.dart
Normal file
50
app_code/lib/models/wishlist_response.dart
Normal file
@@ -0,0 +1,50 @@
|
||||
// To parse this JSON data, do
|
||||
//
|
||||
// final wishlistResponse = wishlistResponseFromJson(jsonString);
|
||||
|
||||
import 'dart:convert';
|
||||
|
||||
import 'package:grostore/models/product_mini_response.dart';
|
||||
|
||||
WishlistResponse wishlistResponseFromJson(String str) => WishlistResponse.fromJson(json.decode(str));
|
||||
|
||||
String wishlistResponseToJson(WishlistResponse data) => json.encode(data.toJson());
|
||||
|
||||
class WishlistResponse {
|
||||
List<WishlistInfo> data;
|
||||
|
||||
WishlistResponse({
|
||||
required this.data,
|
||||
});
|
||||
|
||||
factory WishlistResponse.fromJson(Map<String, dynamic> json) => WishlistResponse(
|
||||
data: List<WishlistInfo>.from(json["data"].map((x) => WishlistInfo.fromJson(x))),
|
||||
);
|
||||
|
||||
Map<String, dynamic> toJson() => {
|
||||
"data": List<dynamic>.from(data.map((x) => x.toJson())),
|
||||
};
|
||||
}
|
||||
|
||||
class WishlistInfo {
|
||||
int id;
|
||||
ProductMini product;
|
||||
|
||||
WishlistInfo({
|
||||
required this.id,
|
||||
required this.product,
|
||||
});
|
||||
|
||||
factory WishlistInfo.fromJson(Map<String, dynamic> json) => WishlistInfo(
|
||||
id: json["id"],
|
||||
product: ProductMini.fromJson(json["product"]),
|
||||
);
|
||||
|
||||
Map<String, dynamic> toJson() => {
|
||||
"id": id,
|
||||
"product": product.toJson(),
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user