final
This commit is contained in:
@@ -1,21 +1,21 @@
|
||||
import 'dart:convert';
|
||||
|
||||
class Address {
|
||||
int id;
|
||||
String addressLine1;
|
||||
String addressLine2;
|
||||
String city;
|
||||
String state;
|
||||
String country;
|
||||
String zip;
|
||||
String phone;
|
||||
String fax;
|
||||
String email;
|
||||
String contactName;
|
||||
int gender;
|
||||
String lat;
|
||||
String lng;
|
||||
String fullAddress;
|
||||
int? id;
|
||||
String? addressLine1;
|
||||
String? addressLine2;
|
||||
String? city;
|
||||
String? state;
|
||||
String? country;
|
||||
String? zip;
|
||||
String? phone;
|
||||
String? fax;
|
||||
String? email;
|
||||
String? contactName;
|
||||
int? gender;
|
||||
String? lat;
|
||||
String? lng;
|
||||
String? fullAddress;
|
||||
|
||||
Address.fromJson(Map<String, dynamic> json)
|
||||
: id = json['id'],
|
||||
|
||||
@@ -58,7 +58,7 @@ class Business {
|
||||
String chaseXLogin;
|
||||
String chaseTransactionKey;
|
||||
String chaseResponseKey;
|
||||
DistanceInfo distanceInfo;
|
||||
DistanceInfo? distanceInfo;
|
||||
int commentsCount;
|
||||
bool forceClose;
|
||||
bool isPublic;
|
||||
|
||||
@@ -7,18 +7,18 @@ import 'cart_line_item.dart';
|
||||
import 'extra_fee.dart';
|
||||
|
||||
class CartInfo {
|
||||
int id;
|
||||
double originPrice;
|
||||
double discountPrice;
|
||||
double totalPrice;
|
||||
Business businessInfo;
|
||||
List<CartLineItem> productList;
|
||||
List<ExtraFee> extraFeeList;
|
||||
List<ExtraFee> discountList;
|
||||
int deliveryMethod;
|
||||
String shippingMethod;
|
||||
double amountPaid;
|
||||
String extraData;
|
||||
int? id;
|
||||
double? originPrice;
|
||||
double? discountPrice;
|
||||
double? totalPrice;
|
||||
Business? businessInfo;
|
||||
List<CartLineItem>? productList;
|
||||
List<ExtraFee>? extraFeeList;
|
||||
List<ExtraFee>? discountList;
|
||||
int? deliveryMethod;
|
||||
String? shippingMethod;
|
||||
double? amountPaid;
|
||||
String? extraData;
|
||||
|
||||
CartInfo.fromJson(Map<String, dynamic> json)
|
||||
: id = json['id'],
|
||||
@@ -53,7 +53,7 @@ class CartInfo {
|
||||
if (productList == null) {
|
||||
productList = [item];
|
||||
} else {
|
||||
productList.add(item);
|
||||
productList!.add(item);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -74,19 +74,19 @@ class CartInfo {
|
||||
originPrice = 0.0;
|
||||
discountPrice = 0.0;
|
||||
totalPrice = 0.0;
|
||||
for (var i = 0; i < productList.length; i++) {
|
||||
newTotal += productList[i].getTotalPrice();
|
||||
for (var i = 0; i < productList!.length; i++) {
|
||||
newTotal += productList![i].getTotalPrice();
|
||||
}
|
||||
originPrice = newTotal;
|
||||
totalPrice = newTotal;
|
||||
return totalPrice;
|
||||
return totalPrice!;
|
||||
}
|
||||
|
||||
int getProductListTotalQuantity() {
|
||||
int qty = 0;
|
||||
if (productList != null && productList.length > 0) {
|
||||
for (var i = 0; i < productList.length; i++) {
|
||||
qty += productList[i].quantity.round();
|
||||
if (productList != null && productList!.length > 0) {
|
||||
for (var i = 0; i < productList!.length; i++) {
|
||||
qty += productList![i].quantity!.round();
|
||||
}
|
||||
}
|
||||
return qty;
|
||||
|
||||
@@ -6,15 +6,15 @@ import 'package:uuid/uuid.dart';
|
||||
import 'product.dart';
|
||||
|
||||
class CartLineItem {
|
||||
int id;
|
||||
double unitPrice;
|
||||
double totalPrice;
|
||||
Product product;
|
||||
String name;
|
||||
String description;
|
||||
double quantity;
|
||||
String uuid;
|
||||
String parentUuid;
|
||||
int? id;
|
||||
double? unitPrice;
|
||||
double? totalPrice;
|
||||
Product? product;
|
||||
String? name;
|
||||
String? description;
|
||||
double? quantity;
|
||||
String? uuid;
|
||||
String? parentUuid;
|
||||
|
||||
CartLineItem() {
|
||||
uuid = Uuid().v4();
|
||||
@@ -48,7 +48,7 @@ class CartLineItem {
|
||||
}
|
||||
|
||||
double getTotalPrice() {
|
||||
totalPrice = unitPrice * quantity;
|
||||
return totalPrice;
|
||||
totalPrice = unitPrice! * quantity!;
|
||||
return totalPrice!;
|
||||
}
|
||||
}
|
||||
@@ -9,7 +9,7 @@ class Coupon {
|
||||
String description;
|
||||
String expirationDate;
|
||||
double minAmount;
|
||||
Business store;
|
||||
Business? store;
|
||||
double valueAmount;
|
||||
bool isPercentage;
|
||||
|
||||
|
||||
@@ -4,9 +4,9 @@ import 'dart:convert';
|
||||
import 'text_value.dart';
|
||||
|
||||
class DistanceInfo {
|
||||
TextValue duration;
|
||||
TextValue distance;
|
||||
String status;
|
||||
TextValue? duration;
|
||||
TextValue? distance;
|
||||
String? status;
|
||||
|
||||
DistanceInfo.fromJson(Map<String, dynamic> json)
|
||||
: duration = json['duration'] != null ? TextValue.fromJson(json['duration']) : null,
|
||||
|
||||
@@ -14,8 +14,8 @@ class Order {
|
||||
int id;
|
||||
int userId;
|
||||
int businessId;
|
||||
Business businessInfo;
|
||||
CartInfo cartInfo;
|
||||
Business? businessInfo;
|
||||
CartInfo? cartInfo;
|
||||
int status;
|
||||
double originPrice;
|
||||
double discountPrice;
|
||||
@@ -23,7 +23,7 @@ class Order {
|
||||
String consignee;
|
||||
String phone;
|
||||
String address;
|
||||
Address shippingAddress;
|
||||
Address? shippingAddress;
|
||||
int payMethod;
|
||||
String remark;
|
||||
String orderNum;
|
||||
@@ -33,11 +33,11 @@ class Order {
|
||||
String paymentStatus; // UNPAID, PAID, PARTIALPAID
|
||||
double amountPaid;
|
||||
List<Fulfillment> fulfillments;
|
||||
String extraData;
|
||||
String? extraData;
|
||||
bool hasComment;
|
||||
double fee;
|
||||
UserPosition shipperPosition;
|
||||
DistanceInfo deliveryDistance;
|
||||
DistanceInfo? deliveryDistance;
|
||||
|
||||
Order.fromJson(Map<String, dynamic> json)
|
||||
: id = json['id'],
|
||||
@@ -100,8 +100,10 @@ class Order {
|
||||
|
||||
double getSubtotal() {
|
||||
double subtotal = 0.0;
|
||||
for (CartLineItem lineItem in cartInfo.productList) {
|
||||
subtotal += lineItem.getTotalPrice();
|
||||
if (cartInfo != null) {
|
||||
for (CartLineItem lineItem in cartInfo!.productList!) {
|
||||
subtotal += lineItem.getTotalPrice();
|
||||
}
|
||||
}
|
||||
return subtotal;
|
||||
}
|
||||
|
||||
@@ -6,19 +6,19 @@ import 'package:flutter/cupertino.dart';
|
||||
import '../generated/l10n.dart';
|
||||
|
||||
class PaymentPlatform {
|
||||
int id;
|
||||
String name;
|
||||
String code;
|
||||
String method;
|
||||
String icon;
|
||||
String xLogin;
|
||||
String transactionKey;
|
||||
String responseKey;
|
||||
String squareAppId;
|
||||
String squareAccessToken;
|
||||
String squareLocationId;
|
||||
String publishableKey;
|
||||
String merchantId;
|
||||
int? id;
|
||||
String? name;
|
||||
String? code;
|
||||
String? method;
|
||||
String? icon;
|
||||
String? xLogin;
|
||||
String? transactionKey;
|
||||
String? responseKey;
|
||||
String? squareAppId;
|
||||
String? squareAccessToken;
|
||||
String? squareLocationId;
|
||||
String? publishableKey;
|
||||
String? merchantId;
|
||||
|
||||
PaymentPlatform(this.code);
|
||||
|
||||
@@ -57,16 +57,12 @@ class PaymentPlatform {
|
||||
switch(code) {
|
||||
case 'chase':
|
||||
return S.of(context).credit_debit_card;
|
||||
break;
|
||||
case 'web-credit-card':
|
||||
return S.of(context).credit_card;
|
||||
break;
|
||||
case 'ALIPAY':
|
||||
return S.of(context).alipay;
|
||||
break;
|
||||
case 'WECHATPAY':
|
||||
return S.of(context).wechatpay;
|
||||
break;
|
||||
case 'paypal':
|
||||
return S.of(context).paypal;
|
||||
case 'payondeliverypickup':
|
||||
|
||||
@@ -3,7 +3,7 @@ class Position {
|
||||
final double latitude;
|
||||
final double longitude;
|
||||
|
||||
Position({this.latitude, this.longitude});
|
||||
Position({required this.latitude, required this.longitude});
|
||||
|
||||
@override
|
||||
bool operator ==(other) {
|
||||
|
||||
@@ -5,23 +5,23 @@ import 'Subproduct.dart';
|
||||
import 'product_attribute.dart';
|
||||
|
||||
class Product {
|
||||
int id;
|
||||
int businessId;
|
||||
int categoryId;
|
||||
String name;
|
||||
double price;
|
||||
double regularPrice;
|
||||
String description;
|
||||
String detailDescription;
|
||||
String imagePath;
|
||||
String secondImagePath;
|
||||
double monthSales;
|
||||
int rate;
|
||||
double leftNum;
|
||||
List<ProductAttribute> productAttributes;
|
||||
bool nonInventory;
|
||||
String extraData;
|
||||
List<Subproduct> subproducts;
|
||||
int? id;
|
||||
int? businessId;
|
||||
int? categoryId;
|
||||
String? name;
|
||||
double? price;
|
||||
double? regularPrice;
|
||||
String? description;
|
||||
String? detailDescription;
|
||||
String? imagePath;
|
||||
String? secondImagePath;
|
||||
double? monthSales;
|
||||
int? rate;
|
||||
double? leftNum;
|
||||
List<ProductAttribute>? productAttributes;
|
||||
bool? nonInventory;
|
||||
String? extraData;
|
||||
List<Subproduct>? subproducts;
|
||||
|
||||
Product(int id, int businessId, String name, double price, String description,
|
||||
String imagePath, List<ProductAttribute> productAttributes) {
|
||||
|
||||
@@ -10,7 +10,7 @@ class ProductAttribute {
|
||||
bool singleSelection;
|
||||
bool byQuantity;
|
||||
bool required;
|
||||
String extra;
|
||||
String? extra;
|
||||
bool disabled;
|
||||
|
||||
ProductAttribute.fromJson(Map<String, dynamic> json)
|
||||
|
||||
@@ -4,8 +4,8 @@ import 'dart:convert';
|
||||
import 'waiting_line_item.dart';
|
||||
|
||||
class WaitingLine {
|
||||
List<WaitingLineItem> waitingLines;
|
||||
String storeSn;
|
||||
List<WaitingLineItem>? waitingLines;
|
||||
String? storeSn;
|
||||
|
||||
WaitingLine.fromJson(Map<String, dynamic> json)
|
||||
: waitingLines = (json['waiting_lines'] as List).map((i) => WaitingLineItem.fromJson(i)).toList(),
|
||||
|
||||
Reference in New Issue
Block a user