Skip to content

Commit 9d57663

Browse files
author
WooSignal
committed
small changes to tools.dart
1 parent d403225 commit 9d57663

File tree

2 files changed

+50
-56
lines changed

2 files changed

+50
-56
lines changed

LabelStoreMax/lib/helpers/tools.dart

Lines changed: 43 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -38,9 +38,8 @@ appWooSignal(Function(WooSignal) api) async {
3838
return await api(wooSignal);
3939
}
4040

41-
List<PaymentType> getPaymentTypes() {
42-
return arrPaymentMethods.where((v) => v != null).toList();
43-
}
41+
List<PaymentType> getPaymentTypes() =>
42+
arrPaymentMethods.where((v) => v != null).toList();
4443

4544
PaymentType addPayment(PaymentType paymentType) {
4645
return app_payment_methods.contains(paymentType.name) ? paymentType : null;
@@ -424,17 +423,12 @@ showPlatformAlertDialog(BuildContext context,
424423
);
425424
}
426425

427-
DateTime parseDateTime(String strDate) {
428-
return DateTime.parse(strDate);
429-
}
426+
DateTime parseDateTime(String strDate) => DateTime.parse(strDate);
430427

431-
DateFormat formatDateTime(String format) {
432-
return DateFormat(format);
433-
}
428+
DateFormat formatDateTime(String format) => DateFormat(format);
434429

435-
String dateFormatted({@required String date, @required String formatType}) {
436-
return formatDateTime(formatType).format(parseDateTime(date));
437-
}
430+
String dateFormatted({@required String date, @required String formatType}) =>
431+
formatDateTime(formatType).format(parseDateTime(date));
438432

439433
enum FormatType {
440434
DateTime,
@@ -477,42 +471,43 @@ Widget refreshableScroll(context,
477471
@required onTap,
478472
key}) {
479473
return SmartRefresher(
480-
enablePullDown: false,
481-
enablePullUp: true,
482-
footer: CustomFooter(
483-
builder: (BuildContext context, LoadStatus mode) {
484-
Widget body;
485-
if (mode == LoadStatus.idle) {
486-
body = Text(trans(context, "pull up load"));
487-
} else if (mode == LoadStatus.loading) {
488-
body = CupertinoActivityIndicator();
489-
} else if (mode == LoadStatus.failed) {
490-
body = Text(trans(context, "Load Failed! Click retry!"));
491-
} else if (mode == LoadStatus.canLoading) {
492-
body = Text(trans(context, "release to load more"));
493-
} else {
494-
body = Text(trans(context, "No more products"));
495-
}
496-
return Container(
497-
height: 55.0,
498-
child: Center(child: body),
499-
);
500-
},
501-
),
502-
controller: refreshController,
503-
onRefresh: onRefresh,
504-
onLoading: onLoading,
505-
child: (products.length != null && products.length > 0
506-
? GridView.count(
507-
crossAxisCount: 2,
508-
children: List.generate(
509-
products.length,
510-
(index) {
511-
return wsCardProductItem(context,
512-
index: index, product: products[index], onTap: onTap);
513-
},
514-
))
515-
: wsNoResults(context)));
474+
enablePullDown: false,
475+
enablePullUp: true,
476+
footer: CustomFooter(
477+
builder: (BuildContext context, LoadStatus mode) {
478+
Widget body;
479+
if (mode == LoadStatus.idle) {
480+
body = Text(trans(context, "pull up load"));
481+
} else if (mode == LoadStatus.loading) {
482+
body = CupertinoActivityIndicator();
483+
} else if (mode == LoadStatus.failed) {
484+
body = Text(trans(context, "Load Failed! Click retry!"));
485+
} else if (mode == LoadStatus.canLoading) {
486+
body = Text(trans(context, "release to load more"));
487+
} else {
488+
body = Text(trans(context, "No more products"));
489+
}
490+
return Container(
491+
height: 55.0,
492+
child: Center(child: body),
493+
);
494+
},
495+
),
496+
controller: refreshController,
497+
onRefresh: onRefresh,
498+
onLoading: onLoading,
499+
child: (products.length != null && products.length > 0
500+
? GridView.count(
501+
crossAxisCount: 2,
502+
children: List.generate(
503+
products.length,
504+
(index) {
505+
return wsCardProductItem(context,
506+
index: index, product: products[index], onTap: onTap);
507+
},
508+
))
509+
: wsNoResults(context)),
510+
);
516511
}
517512

518513
class UserAuth {

LabelStoreMax/lib/models/customer_address.dart

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -39,14 +39,13 @@ class CustomerAddress {
3939
emailAddress = "";
4040
}
4141

42-
bool hasMissingFields() {
43-
return (this.firstName.isEmpty ||
44-
this.lastName.isEmpty ||
45-
this.addressLine.isEmpty ||
46-
this.city.isEmpty ||
47-
this.postalCode.isEmpty) &&
48-
(this.country == "United States" ? this.state.isEmpty : false);
49-
}
42+
bool hasMissingFields() =>
43+
(this.firstName.isEmpty ||
44+
this.lastName.isEmpty ||
45+
this.addressLine.isEmpty ||
46+
this.city.isEmpty ||
47+
this.postalCode.isEmpty) ||
48+
(this.country == "United States" ? this.state.isEmpty : false);
5049

5150
String addressFull() {
5251
List<String> tmpArrAddress = new List<String>();

0 commit comments

Comments
 (0)