small changes to tools.dart
This commit is contained in:
parent
d403225743
commit
9d57663115
@ -38,9 +38,8 @@ appWooSignal(Function(WooSignal) api) async {
|
|||||||
return await api(wooSignal);
|
return await api(wooSignal);
|
||||||
}
|
}
|
||||||
|
|
||||||
List<PaymentType> getPaymentTypes() {
|
List<PaymentType> getPaymentTypes() =>
|
||||||
return arrPaymentMethods.where((v) => v != null).toList();
|
arrPaymentMethods.where((v) => v != null).toList();
|
||||||
}
|
|
||||||
|
|
||||||
PaymentType addPayment(PaymentType paymentType) {
|
PaymentType addPayment(PaymentType paymentType) {
|
||||||
return app_payment_methods.contains(paymentType.name) ? paymentType : null;
|
return app_payment_methods.contains(paymentType.name) ? paymentType : null;
|
||||||
@ -424,17 +423,12 @@ showPlatformAlertDialog(BuildContext context,
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
DateTime parseDateTime(String strDate) {
|
DateTime parseDateTime(String strDate) => DateTime.parse(strDate);
|
||||||
return DateTime.parse(strDate);
|
|
||||||
}
|
|
||||||
|
|
||||||
DateFormat formatDateTime(String format) {
|
DateFormat formatDateTime(String format) => DateFormat(format);
|
||||||
return DateFormat(format);
|
|
||||||
}
|
|
||||||
|
|
||||||
String dateFormatted({@required String date, @required String formatType}) {
|
String dateFormatted({@required String date, @required String formatType}) =>
|
||||||
return formatDateTime(formatType).format(parseDateTime(date));
|
formatDateTime(formatType).format(parseDateTime(date));
|
||||||
}
|
|
||||||
|
|
||||||
enum FormatType {
|
enum FormatType {
|
||||||
DateTime,
|
DateTime,
|
||||||
@ -477,42 +471,43 @@ Widget refreshableScroll(context,
|
|||||||
@required onTap,
|
@required onTap,
|
||||||
key}) {
|
key}) {
|
||||||
return SmartRefresher(
|
return SmartRefresher(
|
||||||
enablePullDown: false,
|
enablePullDown: false,
|
||||||
enablePullUp: true,
|
enablePullUp: true,
|
||||||
footer: CustomFooter(
|
footer: CustomFooter(
|
||||||
builder: (BuildContext context, LoadStatus mode) {
|
builder: (BuildContext context, LoadStatus mode) {
|
||||||
Widget body;
|
Widget body;
|
||||||
if (mode == LoadStatus.idle) {
|
if (mode == LoadStatus.idle) {
|
||||||
body = Text(trans(context, "pull up load"));
|
body = Text(trans(context, "pull up load"));
|
||||||
} else if (mode == LoadStatus.loading) {
|
} else if (mode == LoadStatus.loading) {
|
||||||
body = CupertinoActivityIndicator();
|
body = CupertinoActivityIndicator();
|
||||||
} else if (mode == LoadStatus.failed) {
|
} else if (mode == LoadStatus.failed) {
|
||||||
body = Text(trans(context, "Load Failed! Click retry!"));
|
body = Text(trans(context, "Load Failed! Click retry!"));
|
||||||
} else if (mode == LoadStatus.canLoading) {
|
} else if (mode == LoadStatus.canLoading) {
|
||||||
body = Text(trans(context, "release to load more"));
|
body = Text(trans(context, "release to load more"));
|
||||||
} else {
|
} else {
|
||||||
body = Text(trans(context, "No more products"));
|
body = Text(trans(context, "No more products"));
|
||||||
}
|
}
|
||||||
return Container(
|
return Container(
|
||||||
height: 55.0,
|
height: 55.0,
|
||||||
child: Center(child: body),
|
child: Center(child: body),
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
controller: refreshController,
|
controller: refreshController,
|
||||||
onRefresh: onRefresh,
|
onRefresh: onRefresh,
|
||||||
onLoading: onLoading,
|
onLoading: onLoading,
|
||||||
child: (products.length != null && products.length > 0
|
child: (products.length != null && products.length > 0
|
||||||
? GridView.count(
|
? GridView.count(
|
||||||
crossAxisCount: 2,
|
crossAxisCount: 2,
|
||||||
children: List.generate(
|
children: List.generate(
|
||||||
products.length,
|
products.length,
|
||||||
(index) {
|
(index) {
|
||||||
return wsCardProductItem(context,
|
return wsCardProductItem(context,
|
||||||
index: index, product: products[index], onTap: onTap);
|
index: index, product: products[index], onTap: onTap);
|
||||||
},
|
},
|
||||||
))
|
))
|
||||||
: wsNoResults(context)));
|
: wsNoResults(context)),
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
class UserAuth {
|
class UserAuth {
|
||||||
|
|||||||
@ -39,14 +39,13 @@ class CustomerAddress {
|
|||||||
emailAddress = "";
|
emailAddress = "";
|
||||||
}
|
}
|
||||||
|
|
||||||
bool hasMissingFields() {
|
bool hasMissingFields() =>
|
||||||
return (this.firstName.isEmpty ||
|
(this.firstName.isEmpty ||
|
||||||
this.lastName.isEmpty ||
|
this.lastName.isEmpty ||
|
||||||
this.addressLine.isEmpty ||
|
this.addressLine.isEmpty ||
|
||||||
this.city.isEmpty ||
|
this.city.isEmpty ||
|
||||||
this.postalCode.isEmpty) &&
|
this.postalCode.isEmpty) ||
|
||||||
(this.country == "United States" ? this.state.isEmpty : false);
|
(this.country == "United States" ? this.state.isEmpty : false);
|
||||||
}
|
|
||||||
|
|
||||||
String addressFull() {
|
String addressFull() {
|
||||||
List<String> tmpArrAddress = new List<String>();
|
List<String> tmpArrAddress = new List<String>();
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user