backup.
This commit is contained in:
24
lib/models/gallery.dart
Normal file
24
lib/models/gallery.dart
Normal file
@@ -0,0 +1,24 @@
|
||||
|
||||
import 'dart:convert';
|
||||
|
||||
class Gallery {
|
||||
int id;
|
||||
String image;
|
||||
String linkUrl;
|
||||
|
||||
Gallery.fromJson(Map<String, dynamic> json)
|
||||
: id = json['id'],
|
||||
image = json['image'],
|
||||
linkUrl = json['link_url'];
|
||||
|
||||
Map<String, dynamic> toJson() => {
|
||||
'id': id,
|
||||
'image': image,
|
||||
'link_url': linkUrl
|
||||
};
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return json.encode(this);
|
||||
}
|
||||
}
|
||||
46
lib/models/stripe_payment_method.dart
Normal file
46
lib/models/stripe_payment_method.dart
Normal file
@@ -0,0 +1,46 @@
|
||||
|
||||
import 'dart:convert';
|
||||
|
||||
class StripePaymentMethod {
|
||||
int id;
|
||||
String customerId;
|
||||
String paymentMethodId;
|
||||
String paymentMethodType;
|
||||
String cardBrand;
|
||||
String cardCountry;
|
||||
int cardExpMonth;
|
||||
int cardExpYear;
|
||||
String cardFunding;
|
||||
String cardLast4;
|
||||
|
||||
StripePaymentMethod.fromJson(Map<String, dynamic> json) :
|
||||
id = json['id'],
|
||||
customerId = json['customer_id'],
|
||||
paymentMethodId = json['payment_method_id'],
|
||||
paymentMethodType = json['payment_method_type'],
|
||||
cardBrand = json['card_brand'],
|
||||
cardCountry = json['card_country'],
|
||||
cardExpMonth = json['card_exp_month'],
|
||||
cardExpYear = json['card_exp_year'],
|
||||
cardFunding = json['card_funding'],
|
||||
cardLast4 = json['card_last4'];
|
||||
|
||||
Map<String, dynamic> toJson() => {
|
||||
'id': id,
|
||||
'customer_id': customerId,
|
||||
'payment_method_id': paymentMethodId,
|
||||
'payment_method_type': paymentMethodType,
|
||||
'card_brand': cardBrand,
|
||||
'card_country': cardCountry,
|
||||
'card_exp_month': cardExpMonth,
|
||||
'card_exp_year': cardExpYear,
|
||||
'card_funding': cardFunding,
|
||||
'card_last4': cardLast4,
|
||||
};
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return json.encode(this);
|
||||
}
|
||||
|
||||
}
|
||||
68
lib/models/user.dart
Normal file
68
lib/models/user.dart
Normal file
@@ -0,0 +1,68 @@
|
||||
|
||||
import 'dart:convert';
|
||||
|
||||
import 'stripe_payment_method.dart';
|
||||
|
||||
class User {
|
||||
int id;
|
||||
String username;
|
||||
String nickname;
|
||||
String mobile;
|
||||
String email;
|
||||
String avatarUrl;
|
||||
int lastAddressId;
|
||||
String passCode;
|
||||
double credit;
|
||||
double wallet;
|
||||
int coupon;
|
||||
int points;
|
||||
int orderNum;
|
||||
double pointsToCreditsConversionRate;
|
||||
String contactNumber;
|
||||
String flutterMiniStoreToken;
|
||||
List<StripePaymentMethod> stripePaymentMethods;
|
||||
|
||||
User.fromJson(Map<String, dynamic> json)
|
||||
: id = json['id'],
|
||||
username = json['username'],
|
||||
nickname = json['nickname'],
|
||||
mobile = json['mobile'],
|
||||
email = json['email'],
|
||||
avatarUrl = json['avatar_url'],
|
||||
lastAddressId = json['last_address_id'],
|
||||
passCode = json['pass_code'],
|
||||
credit = double.parse(json['credit'].toString()),
|
||||
wallet = double.parse((json['wallet'] == null) ? "0": json['wallet'].toString()),
|
||||
coupon = json['coupon'],
|
||||
points = json['points'],
|
||||
orderNum = json['order_num'],
|
||||
pointsToCreditsConversionRate = double.parse(json['points_to_credits_conversion_rate'].toString()),
|
||||
contactNumber = json['contact_number'],
|
||||
flutterMiniStoreToken = json['flutter_ministore_token'],
|
||||
stripePaymentMethods = (json['stripe_payment_methods'] as List).map((e) => StripePaymentMethod.fromJson(e)).toList();
|
||||
|
||||
Map<String, dynamic> toJson() => {
|
||||
'id': id,
|
||||
'username': username,
|
||||
'nickname': nickname,
|
||||
'mobile': mobile,
|
||||
'email': email,
|
||||
'avatar_url': avatarUrl,
|
||||
'last_address_id': lastAddressId,
|
||||
'pass_code': passCode,
|
||||
'credit': credit,
|
||||
'wallet': wallet,
|
||||
'coupon': coupon,
|
||||
'points': points,
|
||||
'order_num': orderNum,
|
||||
'points_to_credits_conversion_rate': pointsToCreditsConversionRate,
|
||||
'contact_number': contactNumber,
|
||||
'flutter_ministore_token': flutterMiniStoreToken,
|
||||
'stripe_payment_methods': stripePaymentMethods,
|
||||
};
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return json.encode(this);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user