small changes to tools.dart

This commit is contained in:
WooSignal 2020-05-12 10:55:47 +01:00
parent d403225743
commit 9d57663115
2 changed files with 50 additions and 56 deletions

View File

@ -38,9 +38,8 @@ appWooSignal(Function(WooSignal) api) async {
return await api(wooSignal);
}
List<PaymentType> getPaymentTypes() {
return arrPaymentMethods.where((v) => v != null).toList();
}
List<PaymentType> getPaymentTypes() =>
arrPaymentMethods.where((v) => v != null).toList();
PaymentType addPayment(PaymentType paymentType) {
return app_payment_methods.contains(paymentType.name) ? paymentType : null;
@ -424,17 +423,12 @@ showPlatformAlertDialog(BuildContext context,
);
}
DateTime parseDateTime(String strDate) {
return DateTime.parse(strDate);
}
DateTime parseDateTime(String strDate) => DateTime.parse(strDate);
DateFormat formatDateTime(String format) {
return DateFormat(format);
}
DateFormat formatDateTime(String format) => DateFormat(format);
String dateFormatted({@required String date, @required String formatType}) {
return formatDateTime(formatType).format(parseDateTime(date));
}
String dateFormatted({@required String date, @required String formatType}) =>
formatDateTime(formatType).format(parseDateTime(date));
enum FormatType {
DateTime,
@ -512,7 +506,8 @@ Widget refreshableScroll(context,
index: index, product: products[index], onTap: onTap);
},
))
: wsNoResults(context)));
: wsNoResults(context)),
);
}
class UserAuth {

View File

@ -39,14 +39,13 @@ class CustomerAddress {
emailAddress = "";
}
bool hasMissingFields() {
return (this.firstName.isEmpty ||
bool hasMissingFields() =>
(this.firstName.isEmpty ||
this.lastName.isEmpty ||
this.addressLine.isEmpty ||
this.city.isEmpty ||
this.postalCode.isEmpty) &&
this.postalCode.isEmpty) ||
(this.country == "United States" ? this.state.isEmpty : false);
}
String addressFull() {
List<String> tmpArrAddress = new List<String>();