phase3: nullfix.py batch script — bang/late/param-nullable

Automated null-safety fixes driven by dart analyze (no corruption):
- unchecked_use_of_nullable_value: insert '!' on receiver (property/method/[]/op)
- not_initialized field/var: mark 'late'
- missing_default_value_for_parameter: nullable param
Errors: 2374(peak) -> 907
This commit is contained in:
2026-07-25 18:13:01 +08:00
parent 8f3d3509ea
commit fce670664b
99 changed files with 1013 additions and 838 deletions

View File

@@ -35,12 +35,12 @@ class CreateOnlineStore1State extends State<CreateOnlineStore1> {
bool canSubmit = false;
List<dynamic> stores = [];
Map<String, dynamic> service;
late Map<String, dynamic> service;
dynamic selectedStore;
Group group;
late Group group;
String selectedDomain;
late String selectedDomain;
List<dynamic> domainResult = [];
@override
@@ -284,7 +284,7 @@ class CreateOnlineStore1State extends State<CreateOnlineStore1> {
),
autofocus: true,
validator: (String? value) {
if (value.trim().isEmpty) {
if (value!.trim().isEmpty) {
return S.of(context).domains_separated_comma;
}
return null;

View File

@@ -34,7 +34,7 @@ class DesktopBlog extends StatefulWidget {
}
class DesktopBlogState extends State<DesktopBlog> {
List<Blog> blogs;
late List<Blog> blogs;
double division = 2;

View File

@@ -27,7 +27,7 @@ class DesktopBuyServiceState extends State<DesktopBuyService> {
double mainSpace = 1200;
List<KeyValue> plans = [];
KeyValue selectedPlan;
late KeyValue selectedPlan;
double price = 0.0;
double tax = 0.0;
double paymentAmount = 0.0;

View File

@@ -32,9 +32,9 @@ class DesktopChangeMobileOrEmailState extends State<DesktopChangeMobileOrEmail>
bool usernameEnable = true;
final codeController = TextEditingController();
bool enableGetCode;
String getCodeText;
bool canRegister;
late bool enableGetCode;
late String getCodeText;
late bool canRegister;
var countDownListener;
@@ -88,7 +88,7 @@ class DesktopChangeMobileOrEmailState extends State<DesktopChangeMobileOrEmail>
),
autofocus: true,
validator: (String? value) {
if (value.trim().isEmpty) {
if (value!.trim().isEmpty) {
if (widget.isMobile) {
return S
.of(context)
@@ -99,10 +99,10 @@ class DesktopChangeMobileOrEmailState extends State<DesktopChangeMobileOrEmail>
.email_is_required;
}
}
if (widget.isMobile && value.trim() == store.state.user.mobile) {
if (widget.isMobile && value!.trim() == store.state.user!.mobile) {
return S.of(context).the_mobile_number_is_same_as_current;
}
if (!widget.isMobile && value.trim() == store.state.user.email) {
if (!widget.isMobile && value!.trim() == store.state.user!.email) {
return S.of(context).the_email_is_same_as_current;
}
return null;
@@ -185,7 +185,7 @@ class DesktopChangeMobileOrEmailState extends State<DesktopChangeMobileOrEmail>
fontSize: 18.0
),
validator: (String? value) {
if (value.trim().isEmpty) {
if (value!.trim().isEmpty) {
return S.of(context).verification_code_is_required;
}
return null;
@@ -332,7 +332,7 @@ class DesktopChangeMobileOrEmailState extends State<DesktopChangeMobileOrEmail>
},
isFormData: true,
body: {
'id': store.state.user.id,
'id': store.state.user!.id,
'mobile': usernameController.text.trim(),
'code': codeController.text.trim(),
},
@@ -344,8 +344,8 @@ class DesktopChangeMobileOrEmailState extends State<DesktopChangeMobileOrEmail>
void getCodeTapped() {
if (usernameController.text.isNotEmpty &&
((widget.isMobile && usernameController.text.trim() != store.state.user.mobile) ||
(!widget.isMobile && usernameController.text.trim() != store.state.user.email))) {
((widget.isMobile && usernameController.text.trim() != store.state.user!.mobile) ||
(!widget.isMobile && usernameController.text.trim() != store.state.user!.email))) {
HttpUtil.httpPost('v1/users', (response) {
Fluttertoast.showToast(
msg: S.of(context).verification_code_sent,
@@ -366,7 +366,7 @@ class DesktopChangeMobileOrEmailState extends State<DesktopChangeMobileOrEmail>
'action': 'change_mobile_email_send_code'
},
body: {
'id': store.state.user.id,
'id': store.state.user!.id,
'mobile': usernameController.text,
},
isFormData: true,
@@ -384,9 +384,9 @@ class DesktopChangeMobileOrEmailState extends State<DesktopChangeMobileOrEmail>
errorMsg = S.of(context).mobile_is_required;
} else if (!widget.isMobile && usernameController.text.trim().isEmpty) {
errorMsg = S.of(context).email_is_required;
} else if (widget.isMobile && usernameController.text.trim() == store.state.user.mobile) {
} else if (widget.isMobile && usernameController.text.trim() == store.state.user!.mobile) {
errorMsg = S.of(context).the_mobile_number_is_same_as_current;
} else if (!widget.isMobile && usernameController.text.trim() == store.state.user.email) {
} else if (!widget.isMobile && usernameController.text.trim() == store.state.user!.email) {
errorMsg = S.of(context).the_email_is_same_as_current;
}
Fluttertoast.showToast(

View File

@@ -24,10 +24,10 @@ class DesktopChangePasswordState extends State<DesktopChangePassword> {
final passwordController = TextEditingController();
final passwordAgainController = TextEditingController();
bool passwordVisible;
bool passwordAgainVisible;
late bool passwordVisible;
late bool passwordAgainVisible;
bool canReset;
late bool canReset;
double sideSpace = 0;
double mainSpace = 1200;
@@ -138,7 +138,7 @@ class DesktopChangePasswordState extends State<DesktopChangePassword> {
fontSize: 18.0
),
validator: (String? value) {
if (value.trim().isEmpty) {
if (value!.trim().isEmpty) {
return S.of(context).current_password_is_required;
}
return null;
@@ -192,7 +192,7 @@ class DesktopChangePasswordState extends State<DesktopChangePassword> {
fontSize: 18.0
),
validator: (String? value) {
if (value.trim().isEmpty) {
if (value!.trim().isEmpty) {
return S.of(context).password_is_required;
}
return null;
@@ -246,10 +246,10 @@ class DesktopChangePasswordState extends State<DesktopChangePassword> {
fontSize: 18.0
),
validator: (String? value) {
if (value.trim().isEmpty) {
if (value!.trim().isEmpty) {
return S.of(context).password_is_required;
}
if (value.trim() != passwordController.text.trim()) {
if (value!.trim() != passwordController.text.trim()) {
return S.of(context).password_is_not_match_password_again;
}
return null;
@@ -338,7 +338,7 @@ class DesktopChangePasswordState extends State<DesktopChangePassword> {
},
isFormData: true,
body: {
'id': store.state.user.id,
'id': store.state.user!.id,
'old_password': oldPasswordController.text.trim(),
'password': passwordController.text.trim(),
}

View File

@@ -222,7 +222,7 @@ class DesktopCheckoutState extends State<DesktopCheckout> with SingleTickerProvi
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Text(
'\$${(cartInfo.totalPrice - couponDiscountAmount).toStringAsFixed(2)}',
'\$${(cartInfo.totalPrice! - couponDiscountAmount).toStringAsFixed(2)}',
style: TextStyle(
fontSize: 20.0,
color: Colors.white,
@@ -292,7 +292,7 @@ class DesktopCheckoutState extends State<DesktopCheckout> with SingleTickerProvi
itemCount: 6,
addAutomaticKeepAlives: true,
itemBuilder: (BuildContext context, int position) {
var deliveryTimeInSeconds = cartInfo.businessInfo.shippingTime * 60 + (durationInTraffic != null ? durationInTraffic.value : 0);
var deliveryTimeInSeconds = cartInfo!.businessInfo!.shippingTime! * 60 + (durationInTraffic != null ? durationInTraffic!.value : 0);
print('aaa: $deliveryTimeInSeconds');
DateTime now = DateTime.now();
var formatter = DateFormat('H:mm');
@@ -366,7 +366,7 @@ class DesktopCheckoutState extends State<DesktopCheckout> with SingleTickerProvi
);
switch (position) {
case 0:
if (cartInfo.businessInfo.deliveryPickup) {
if (cartInfo!.businessInfo!.deliveryPickup) {
return Container(
padding: EdgeInsets.only(
top: 16.0, bottom: 16.0, left: 16.0, right: 16.0),
@@ -380,8 +380,8 @@ class DesktopCheckoutState extends State<DesktopCheckout> with SingleTickerProvi
),
child: Container(
alignment: Alignment.centerLeft,
child: store.state.deviceId != null && store.state.deviceId.isNotEmpty ? (
store.state.tableNumber != null && store.state.tableNumber.isNotEmpty ?
child: store.state.deviceId != null && store.state.deviceId!.isNotEmpty ? (
store.state.tableNumber != null && store.state.tableNumber!.isNotEmpty ?
peopleCountSelection :
SizedBox.shrink()
) : Center(child: toggleSwitch,),
@@ -394,8 +394,8 @@ class DesktopCheckoutState extends State<DesktopCheckout> with SingleTickerProvi
}
break;
case 1:
if (store.state.deviceId != null && store.state.deviceId.isNotEmpty ||
store.state.tableNumber != null && store.state.tableNumber.isNotEmpty) {
if (store.state.deviceId != null && store.state.deviceId!.isNotEmpty ||
store.state.tableNumber != null && store.state.tableNumber!.isNotEmpty) {
return SizedBox.shrink();
}
if (deliveryMethod == 'pickup') {
@@ -414,7 +414,7 @@ class DesktopCheckoutState extends State<DesktopCheckout> with SingleTickerProvi
Container(
margin: EdgeInsets.only(top: 10.0),
child: Text(
cartInfo.businessInfo.name,
cartInfo!.businessInfo!.name,
style: TextStyle(
fontSize: 17.0,
),
@@ -423,7 +423,7 @@ class DesktopCheckoutState extends State<DesktopCheckout> with SingleTickerProvi
Container(
margin: EdgeInsets.only(top: 5.0),
child: Text(
cartInfo.businessInfo.address.addressLine1,
cartInfo!.businessInfo!.address!.addressLine1,
style: TextStyle(
fontSize: 14.0,
color: Colors.black45,
@@ -431,9 +431,9 @@ class DesktopCheckoutState extends State<DesktopCheckout> with SingleTickerProvi
),
),
Container(
child: cartInfo.businessInfo.address.addressLine2 != null
&& cartInfo.businessInfo.address.addressLine2.length > 0 ?
Text(cartInfo.businessInfo.address.addressLine2,
child: cartInfo!.businessInfo!.address!.addressLine2 != null
&& cartInfo!.businessInfo!.address!.addressLine2!.length > 0 ?
Text(cartInfo!.businessInfo!.address!.addressLine2,
style: TextStyle(
fontSize: 14.0,
color: Colors.black45,
@@ -442,7 +442,7 @@ class DesktopCheckoutState extends State<DesktopCheckout> with SingleTickerProvi
),
Container(
child: Text(
'${cartInfo.businessInfo.address.city}, ${cartInfo.businessInfo.address.state}, ${cartInfo.businessInfo.address.zip}',
'${cartInfo!.businessInfo!.address!.city}, ${cartInfo!.businessInfo!.address!.state}, ${cartInfo!.businessInfo!.address!.zip}',
style: TextStyle(
fontSize: 14.0,
color: Colors.black45,
@@ -452,7 +452,7 @@ class DesktopCheckoutState extends State<DesktopCheckout> with SingleTickerProvi
Container(
margin: EdgeInsets.only(top: 5.0),
child: Text(
'Tel: ${cartInfo.businessInfo.phone}',
'Tel: ${cartInfo!.businessInfo!.phone}',
style: TextStyle(
fontSize: 15.0,
color: Colors.black54,
@@ -494,7 +494,7 @@ class DesktopCheckoutState extends State<DesktopCheckout> with SingleTickerProvi
children: <Widget>[
Container(
child: Text(
shipAddress != null ? shipAddress.fullAddress : S.of(context).enter_delivery_address,
shipAddress != null ? shipAddress!.fullAddress : S.of(context).enter_delivery_address,
style: TextStyle(
fontSize: 16.0
),
@@ -505,7 +505,7 @@ class DesktopCheckoutState extends State<DesktopCheckout> with SingleTickerProvi
Container(
padding: EdgeInsets.only(top: 6.0),
child: Text(
shipAddress != null ? shipAddress.contactName + ' ' + shipAddress.phone : '',
shipAddress != null ? shipAddress!.contactName! + ' ' + shipAddress!.phone : '',
style: TextStyle(
fontSize: 14.0,
color: Colors.black38,
@@ -529,13 +529,13 @@ class DesktopCheckoutState extends State<DesktopCheckout> with SingleTickerProvi
),
),
onTap: () {
Routes.router.navigateTo(context, '/my-addresses/${cartInfo.businessInfo.id}', replace: true);
Routes.router.navigateTo(context, '/my-addresses/${cartInfo!.businessInfo!.id}', replace: true);
},
);
break;
case 2:
if (deliveryMethod == 'pickup' || store.state.deviceId != null && store.state.deviceId.isNotEmpty ||
store.state.tableNumber != null && store.state.tableNumber.isNotEmpty) {
if (deliveryMethod == 'pickup' || store.state.deviceId != null && store.state.deviceId!.isNotEmpty ||
store.state.tableNumber != null && store.state.tableNumber!.isNotEmpty) {
return SizedBox.shrink();
}
if (deliveryMethod == 'canada-post') {
@@ -578,7 +578,7 @@ class DesktopCheckoutState extends State<DesktopCheckout> with SingleTickerProvi
alignment: Alignment.centerRight,
child: Text(
selectedShippingRate != null ?
'${selectedShippingRate.name} \$${selectedShippingRate.price.toStringAsFixed(2)}' :
'${selectedShippingRate!.name} \$${selectedShippingRate!.price!.toStringAsFixed(2)}' :
S.of(context).please_select,
style: TextStyle(
fontSize: 15.0,
@@ -608,7 +608,7 @@ class DesktopCheckoutState extends State<DesktopCheckout> with SingleTickerProvi
},
);
}
if (!cartInfo.businessInfo.instanceDelivery) {
if (!cartInfo!.businessInfo!.instanceDelivery) {
return Container(
padding: EdgeInsets.only(left: 16.0, right: 16.0, top: 0.0, bottom: 16.0),
child: Text(S.of(context).no_instance_delivery_desc),
@@ -654,7 +654,7 @@ class DesktopCheckoutState extends State<DesktopCheckout> with SingleTickerProvi
child: Text(
bookingTimeList.length > 0 ? '${Utils.timestampToString(context, bookingTimeList[bookingTimeIndex].unixTime)}'
: ((bookingTimeList.length == 0 && bookingDateTimeList.length == 0) ? ''
: bookingDateTimeList[bookingDateIndex].viewDate + ' ' + (bookingDateTimeList[bookingDateIndex].bookTimes.length > 0 ? bookingDateTimeList[bookingDateIndex].bookTimes[bookingTimeIndex].viewTime : '')),
: bookingDateTimeList[bookingDateIndex].viewDate! + ' ' + (bookingDateTimeList[bookingDateIndex].bookTimes!.length > 0 ? bookingDateTimeList[bookingDateIndex].bookTimes![bookingTimeIndex].viewTime : '')),
),
),
Container(
@@ -737,7 +737,7 @@ class DesktopCheckoutState extends State<DesktopCheckout> with SingleTickerProvi
width: double.infinity,
padding: EdgeInsets.only(bottom: 10.0),
child: Text(
cartInfo.businessInfo.name,
cartInfo!.businessInfo!.name,
overflow: TextOverflow.ellipsis,
style: TextStyle(
fontSize: 16.0,
@@ -756,9 +756,9 @@ class DesktopCheckoutState extends State<DesktopCheckout> with SingleTickerProvi
subtotal = 0.0;
for (var i = 0; i < cartInfo.productList.length; i++) {
subtotal += cartInfo.productList[i].totalPrice;
column.children.add(lineItem(cartInfo.productList[i]));
for (var i = 0; i < cartInfo!.productList!.length; i++) {
subtotal += cartInfo!.productList![i].totalPrice;
column.children.add(lineItem(cartInfo!.productList![i]));
}
column.children.add(GestureDetector(
child: Container(
@@ -851,8 +851,8 @@ class DesktopCheckoutState extends State<DesktopCheckout> with SingleTickerProvi
),
));
if (cartInfo.extraFeeList.length > 0) {
for (var i = 0; i < cartInfo.extraFeeList.length; i++) {
if (cartInfo!.extraFeeList!.length > 0) {
for (var i = 0; i < cartInfo!.extraFeeList!.length; i++) {
column.children.add(Container(
padding: EdgeInsets.only(bottom: 16.0),
alignment: Alignment.centerRight,
@@ -863,7 +863,7 @@ class DesktopCheckoutState extends State<DesktopCheckout> with SingleTickerProvi
Container(
alignment: Alignment.centerRight,
child: Text(
S.of(context).extra_fee_token(cartInfo.extraFeeList[i].name, cartInfo.extraFeeList[i].rate),
S.of(context).extra_fee_token(cartInfo!.extraFeeList![i].name, cartInfo!.extraFeeList![i].rate),
style: TextStyle(
color: Colors.grey,
),
@@ -873,7 +873,7 @@ class DesktopCheckoutState extends State<DesktopCheckout> with SingleTickerProvi
width: 100.0,
alignment: Alignment.centerRight,
child: Text(
'${cartInfo.extraFeeList[i].price.toStringAsFixed(2)}'
'${cartInfo!.extraFeeList![i].price!.toStringAsFixed(2)}'
),
),
],
@@ -901,7 +901,7 @@ class DesktopCheckoutState extends State<DesktopCheckout> with SingleTickerProvi
width: 100.0,
alignment: Alignment.centerRight,
child: Text(
'${(cartInfo.totalPrice - couponDiscountAmount).toStringAsFixed(2)}',
'${(cartInfo!.totalPrice! - couponDiscountAmount).toStringAsFixed(2)}',
style: TextStyle(
fontSize: 19.0,
fontWeight: FontWeight.bold,
@@ -999,7 +999,7 @@ class DesktopCheckoutState extends State<DesktopCheckout> with SingleTickerProvi
children: <Widget>[
Container(
padding: EdgeInsets.all(5.0),
child: Util.showImage('${cartLineItem.product.imagePath}',
child: Util.showImage('${cartLineItem.product!.imagePath}',
width: 80.0,
height: 80.0,
fit: BoxFit.fill,
@@ -1036,14 +1036,14 @@ class DesktopCheckoutState extends State<DesktopCheckout> with SingleTickerProvi
alignment: Alignment.centerRight,
margin: EdgeInsets.only(right: 10.0),
child: Text(
'x${cartLineItem.quantity.round()}',
'x${cartLineItem.quantity!.round()}',
),
),
Container(
width: 60.0,
alignment: Alignment.centerRight,
child: Text(
'${cartLineItem.totalPrice.toStringAsFixed(2)}',
'${cartLineItem.totalPrice!.toStringAsFixed(2)}',
),
),
],
@@ -1099,7 +1099,7 @@ class DesktopCheckoutState extends State<DesktopCheckout> with SingleTickerProvi
shippingRates = (response.data['shipping_rates'] as List).map((e) => ShippingRate.fromJson(e)).toList();
selectedShippingRate = (response.data['selected_shipping_rate'] as String).length > 0 ? ShippingRate.fromJson(json.decode(response.data['selected_shipping_rate'])) : null;
int i = 0;
if (cartInfo.businessInfo.deliveryStoreDelivery) {
if (cartInfo!.businessInfo!.deliveryStoreDelivery) {
shippingMethodLabels.add(S.of(context).delivery);
shippingMethodIcons.add(Icons.directions_car);
if (deliveryMethod == 'store-delivery') {
@@ -1107,7 +1107,7 @@ class DesktopCheckoutState extends State<DesktopCheckout> with SingleTickerProvi
}
i++;
}
if (cartInfo.businessInfo.deliveryCanadaPost) {
if (cartInfo!.businessInfo!.deliveryCanadaPost) {
shippingMethodLabels.add(S.of(context).canada_post);
shippingMethodIcons.add(Icons.local_shipping);
if (deliveryMethod == 'canada-post') {
@@ -1115,7 +1115,7 @@ class DesktopCheckoutState extends State<DesktopCheckout> with SingleTickerProvi
}
i++;
}
if (cartInfo.businessInfo.deliveryPickup) {
if (cartInfo!.businessInfo!.deliveryPickup) {
shippingMethodLabels.add(S.of(context).pickup);
shippingMethodIcons.add(Icons.store);
if (deliveryMethod == 'pickup') {
@@ -1335,14 +1335,14 @@ class DesktopCheckoutState extends State<DesktopCheckout> with SingleTickerProvi
Expanded(
child: SizedBox.expand(
child: ListView.builder(
itemCount: bookingDateTimeList[bookingDateIndex].bookTimes.length,
itemCount: bookingDateTimeList[bookingDateIndex].bookTimes!.length,
itemBuilder: (BuildContext context, int position) {
BookingDateTime bookingDateTime = bookingDateTimeList[bookingDateIndex];
return GestureDetector(
child: Container(
padding: EdgeInsets.only(left: 12.0, right: 12.0, top: 12.0, bottom: 12.0),
child: Text(
bookingDateTime.bookTimes[position].viewTime,
bookingDateTime.bookTimes![position].viewTime,
),
decoration: BoxDecoration(
border: Border(
@@ -1467,16 +1467,16 @@ class DesktopCheckoutState extends State<DesktopCheckout> with SingleTickerProvi
itemBuilder: (BuildContext context, int position) {
PaymentPlatform paymentPlatform = paymentPlatforms[position];
if (paymentPlatform.code == Constants.PAYMENT_METHOD_CODE_SQUARE &&
(paymentPlatform.squareAppId == null || paymentPlatform.squareAppId.isEmpty) &&
(paymentPlatform.squareAccessToken == null || paymentPlatform.squareAccessToken.isEmpty) &&
(paymentPlatform.squareLocationId == null || paymentPlatform.squareLocationId.isEmpty)
(paymentPlatform.squareAppId == null || paymentPlatform.squareAppId!.isEmpty) &&
(paymentPlatform.squareAccessToken == null || paymentPlatform.squareAccessToken!.isEmpty) &&
(paymentPlatform.squareLocationId == null || paymentPlatform.squareLocationId!.isEmpty)
) {
return SizedBox.shrink();
}
if (paymentPlatform.code == Constants.PAYMENT_METHOD_CODE_CHASE &&
(paymentPlatform.xLogin == null || paymentPlatform.xLogin.isEmpty) &&
(paymentPlatform.transactionKey == null || paymentPlatform.transactionKey.isEmpty) &&
(paymentPlatform.responseKey == null || paymentPlatform.responseKey.isEmpty)
(paymentPlatform.xLogin == null || paymentPlatform.xLogin!.isEmpty) &&
(paymentPlatform.transactionKey == null || paymentPlatform.transactionKey!.isEmpty) &&
(paymentPlatform.responseKey == null || paymentPlatform.responseKey!.isEmpty)
) {
return SizedBox.shrink();
}
@@ -1566,7 +1566,7 @@ class DesktopCheckoutState extends State<DesktopCheckout> with SingleTickerProvi
String getSelectedCouponName() {
if (selectedCoupon == null) {
if (coupons.length > 0) {
if (coupons!.length > 0) {
return S
.of(context)
.please_select;
@@ -1578,10 +1578,10 @@ class DesktopCheckoutState extends State<DesktopCheckout> with SingleTickerProvi
} else if (selectedCoupon == 0) {
return S.of(context).dont_use;
} else {
for (var i = 0; i < coupons.length; i++) {
if (selectedCoupon == coupons[i].id) {
if (coupons[i].isPercentage) {
return S.of(context).percentage_discount_token2(couponDiscountAmount.toStringAsFixed(2), coupons[i].valueAmount);
for (var i = 0; i < coupons!.length; i++) {
if (selectedCoupon == coupons![i].id) {
if (coupons![i].isPercentage) {
return S.of(context).percentage_discount_token2(couponDiscountAmount.toStringAsFixed(2), coupons![i].valueAmount);
} else {
return S.of(context).discount_amount_token(couponDiscountAmount.toStringAsFixed(2));
}
@@ -1700,13 +1700,13 @@ class DesktopCheckoutState extends State<DesktopCheckout> with SingleTickerProvi
} else {
widget.children.add(Expanded(
child: ListView.builder(
itemCount: coupons.length + 1,
itemCount: coupons!.length + 1,
itemBuilder: (BuildContext context, int position) {
if (position == 0) {
return GestureDetector(
child: Container(
decoration: selectedCoupon == 0 ? BoxDecoration(
color: subtotal > cartInfo.businessInfo.minPrice ? Colors
color: subtotal > cartInfo!.businessInfo!.minPrice ? Colors
.transparent : Colors.black38,
border: Border(
top: BorderSide(
@@ -1727,7 +1727,7 @@ class DesktopCheckoutState extends State<DesktopCheckout> with SingleTickerProvi
),
),
) : BoxDecoration(
color: subtotal > cartInfo.businessInfo.minPrice ? Colors
color: subtotal > cartInfo!.businessInfo!.minPrice ? Colors
.transparent : Colors.black38,
),
child: Row(
@@ -1764,11 +1764,11 @@ class DesktopCheckoutState extends State<DesktopCheckout> with SingleTickerProvi
},
);
} else {
Coupon coupon = coupons[position - 1];
Coupon coupon = coupons![position - 1];
return GestureDetector(
child: Container(
decoration: selectedCoupon == coupon.id ? BoxDecoration(
color: subtotal > cartInfo.businessInfo.minPrice ? Colors
color: subtotal > cartInfo!.businessInfo!.minPrice ? Colors
.transparent : Colors.black38,
border: Border(
top: BorderSide(
@@ -1882,7 +1882,7 @@ class DesktopCheckoutState extends State<DesktopCheckout> with SingleTickerProvi
),
Container(
child: Text(
coupon.minAmount > 0 ?
coupon.minAmount! > 0 ?
S.of(context).min_order_amount_token(
coupon.minAmount) :
S.of(context)
@@ -1942,7 +1942,7 @@ class DesktopCheckoutState extends State<DesktopCheckout> with SingleTickerProvi
crossAxisAlignment: CrossAxisAlignment.start,
children: [],
);
if (cartInfo.businessInfo.quickInputs.length > 0) {
if (cartInfo!.businessInfo!.quickInputs!.length > 0) {
Wrap w = Wrap(
children: [],
);
@@ -1956,8 +1956,8 @@ class DesktopCheckoutState extends State<DesktopCheckout> with SingleTickerProvi
),
),
));
for (int i = 0; i < cartInfo.businessInfo.quickInputs.length; i++) {
String qi = cartInfo.businessInfo.quickInputs[i].value;
for (int i = 0; i < cartInfo!.businessInfo!.quickInputs!.length; i++) {
String qi = cartInfo!.businessInfo!.quickInputs![i].value;
w.children.add(TextButton(
child: Text(
qi,
@@ -2137,7 +2137,7 @@ class DesktopCheckoutState extends State<DesktopCheckout> with SingleTickerProvi
child: Container(
alignment: Alignment.centerRight,
child: Text(
'${shippingRate.price.toStringAsFixed(2)}',
'${shippingRate.price!.toStringAsFixed(2)}',
style: TextStyle(
fontSize: 16.0,
color: Colors.black38,
@@ -2221,14 +2221,14 @@ class DesktopCheckoutState extends State<DesktopCheckout> with SingleTickerProvi
},
businessId: widget.businessId,
body: {
'cart_id': cartInfo.id,
'cart_id': cartInfo!.id,
'remark': orderRemark,
'booked_at': bookingTimeList.length > 0
? bookingTimeList[bookingTimeIndex].unixTime
: (
(bookingTimeList.length == 0 && bookingDateTimeList.length == 0) ?
0 :
bookingDateTimeList[bookingDateIndex].bookTimes[bookingTimeIndex]
bookingDateTimeList[bookingDateIndex].bookTimes![bookingTimeIndex]
.unixTime
),
'delivery': deliveryMethod,

View File

@@ -35,7 +35,7 @@ class DesktopContactUsState extends State<DesktopContactUs> {
String mapUrl = 'https://goo.gl/maps/M365MF5AW35n9ij67';
Completer<GoogleMapController> _controller = Completer();
LatLng _lastMapPosition;
late LatLng _lastMapPosition;
final Set<Marker> _markers = {};
final Set<Polyline> _polyLine = {};
@@ -253,16 +253,16 @@ class DesktopContactUsState extends State<DesktopContactUs> {
Container(
padding: EdgeInsets.only(left: 16, right: 16, top: 4, bottom: 4),
child: Text(
'${widget.business.address.addressLine1}',
'${widget.business.address!.addressLine1}',
),
)
);
if (widget.business.address.addressLine2 != null && widget.business.address.addressLine2.isNotEmpty) {
if (widget.business.address!.addressLine2 != null && widget.business.address!.addressLine2!.isNotEmpty) {
col.children.add(
Container(
padding: EdgeInsets.only(left: 16, right: 16, top: 4, bottom: 4),
child: Text(
'${widget.business.address.addressLine2}',
'${widget.business.address!.addressLine2}',
),
)
);
@@ -271,7 +271,7 @@ class DesktopContactUsState extends State<DesktopContactUs> {
Container(
padding: EdgeInsets.only(left: 16, right: 16, top: 4, bottom: 4),
child: Text(
'${widget.business.address.city}, ${widget.business.address.state}',
'${widget.business.address!.city}, ${widget.business.address!.state}',
),
)
);
@@ -279,7 +279,7 @@ class DesktopContactUsState extends State<DesktopContactUs> {
Container(
padding: EdgeInsets.only(left: 16, right: 16, top: 4, bottom: 4),
child: Text(
'${widget.business.address.country}, ${widget.business.address.zip}',
'${widget.business.address!.country}, ${widget.business.address!.zip}',
),
)
);
@@ -287,8 +287,8 @@ class DesktopContactUsState extends State<DesktopContactUs> {
_markers.clear();
_markers.add(Marker(
markerId: MarkerId('shop_position'),
position: LatLng(double.parse(widget.business.address.lat),
double.parse(widget.business.address.lng)),
position: LatLng(double.parse(widget.business.address!.lat),
double.parse(widget.business.address!.lng)),
infoWindow: InfoWindow(
title: S
.of(context)
@@ -304,8 +304,8 @@ class DesktopContactUsState extends State<DesktopContactUs> {
onMapCreated: _onMapCreated,
initialCameraPosition: CameraPosition(
target: LatLng(
double.parse(widget.business.address.lat),
double.parse(widget.business.address.lng)),
double.parse(widget.business.address!.lat),
double.parse(widget.business.address!.lng)),
zoom: 14.0,
),
onCameraMove: _onCameraMove,

View File

@@ -27,7 +27,7 @@ class DesktopCoupons extends StatefulWidget {
}
class DesktopCouponsState extends State<DesktopCoupons> {
List<Coupon> coupons;
late List<Coupon> coupons;
double sideSpace = 0;
double mainSpace = 1200;
@@ -120,7 +120,7 @@ class DesktopCouponsState extends State<DesktopCoupons> {
Container(
padding: EdgeInsets.only(right: 5.0),
child: coupon.store != null ?
Util.showImage('${coupon.store.picUrl}',
Util.showImage('${coupon.store!.picUrl}',
fit: BoxFit.fill,
width: 40.0,
) :
@@ -137,7 +137,7 @@ class DesktopCouponsState extends State<DesktopCoupons> {
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
Text(
coupon.store != null ? coupon.store.name : S.of(context).general_coupon,
coupon.store != null ? coupon.store!.name : S.of(context).general_coupon,
style: TextStyle(
fontSize: 20.0,
fontWeight: FontWeight.bold,
@@ -221,7 +221,7 @@ class DesktopCouponsState extends State<DesktopCoupons> {
),
Container(
child: Text(
coupon.minAmount > 0 ?
coupon.minAmount! > 0 ?
S.of(context).available_for_order_over_token(coupon.minAmount) :
S.of(context).no_restriction,
style: TextStyle(
@@ -259,7 +259,7 @@ class DesktopCouponsState extends State<DesktopCoupons> {
children: <Widget>[
Container(
child: Text(
coupon.expirationDate == null || coupon.expirationDate.length == 0 ?
coupon.expirationDate == null || coupon.expirationDate!.length == 0 ?
S.of(context).no_expiration :
S.of(context).expiration_date_token(coupon.expirationDate),
style: TextStyle(
@@ -284,7 +284,7 @@ class DesktopCouponsState extends State<DesktopCoupons> {
),
onPressed: () {
if (coupon.store != null) {
Routes.router.navigateTo(context, '/shop/${coupon.store.id}/na/na/na');
Routes.router.navigateTo(context, '/shop/${coupon.store!.id}/na/na/na');
} else {
Routes.router.navigateTo(context, '/businesses');
}

View File

@@ -45,12 +45,12 @@ class DesktopEditAddressState extends State<DesktopEditAddress> {
final emailController = TextEditingController();
final faxController = TextEditingController();
String country;
Gender _selectedGender;
late String country;
late Gender _selectedGender;
String _selectedProvince;
late String _selectedProvince;
bool showLoading;
late bool showLoading;
double sideSpace = 0;
double mainSpace = 1200;
@@ -362,7 +362,7 @@ class DesktopEditAddressState extends State<DesktopEditAddress> {
.email,
),
validator: (String? value) {
if (value.isNotEmpty && !EmailValidator.validate(value)) {
if (value!.isNotEmpty && !EmailValidator.validate(value)) {
return S
.of(context)
.email_is_not_valid;

View File

@@ -29,9 +29,9 @@ class DesktopForgotPasswordState extends State<DesktopForgotPassword> {
bool usernameEnable = true;
final codeController = TextEditingController();
bool enableGetCode;
String getCodeText;
bool canRegister;
late bool enableGetCode;
late String getCodeText;
late bool canRegister;
var countDownListener;
@@ -84,7 +84,7 @@ class DesktopForgotPasswordState extends State<DesktopForgotPassword> {
),
autofocus: true,
validator: (String? value) {
if (value.trim().isEmpty) {
if (value!.trim().isEmpty) {
return S.of(context).mobile_or_email_is_required;
}
return null;
@@ -167,7 +167,7 @@ class DesktopForgotPasswordState extends State<DesktopForgotPassword> {
fontSize: 18.0
),
validator: (String? value) {
if (value.trim().isEmpty) {
if (value!.trim().isEmpty) {
return S.of(context).verification_code_is_required;
}
return null;

View File

@@ -26,9 +26,9 @@ class DesktopLoginState extends State<DesktopLogin> {
final usernameController = TextEditingController();
final passwordController = TextEditingController();
bool passwordVisible;
late bool passwordVisible;
bool onSubmitting;
late bool onSubmitting;
double sideSpace = 0;
double mainSpace = 1200;
@@ -150,7 +150,7 @@ class DesktopLoginState extends State<DesktopLogin> {
style: TextStyle(fontSize: 18.0),
autofocus: true,
validator: (String? value) {
if (value.trim().isEmpty) {
if (value!.trim().isEmpty) {
return S.of(context).this_field_is_required;
}
return null;
@@ -194,7 +194,7 @@ class DesktopLoginState extends State<DesktopLogin> {
style: TextStyle(fontSize: 18.0),
obscureText: passwordVisible,
validator: (String? value) {
if (value.trim().isEmpty) {
if (value!.trim().isEmpty) {
return S.of(context).password_is_required;
}
return null;

View File

@@ -16,9 +16,9 @@ import '../../utils/util_web.dart'
if (dart.library.io) '../../utils/util_io.dart';
import '../../utils/utils.dart';
MediaQueryData mediaQuery;
double statusBarHeight;
double screenHeight;
late MediaQueryData mediaQuery;
late double statusBarHeight;
late double screenHeight;
class DesktopMe extends StatefulWidget {
final Key? key;
@@ -32,11 +32,11 @@ class DesktopMe extends StatefulWidget {
}
class DesktopMeState extends State<DesktopMe> {
int userId;
String accessToken;
late int userId;
late String accessToken;
bool isLoading;
User _user;
late bool isLoading;
late User _user;
double sideSpace = 0;
double mainSpace = 1200;
@@ -81,7 +81,7 @@ class DesktopMeState extends State<DesktopMe> {
children: <Widget>[
Container(
margin: EdgeInsets.only(right: 5.0),
child: _user != null && _user.avatarUrl.isNotEmpty
child: _user != null && _user.avatarUrl!.isNotEmpty
? Util.showImage(
'https:${_user.avatarUrl}',
width: 60,
@@ -182,7 +182,7 @@ class DesktopMeState extends State<DesktopMe> {
Container(
child: Text(
_user != null
? '${_user.wallet.toStringAsFixed(2)}'
? '${_user.wallet!.toStringAsFixed(2)}'
: '0.00',
style: TextStyle(
fontSize: 24.0,

View File

@@ -30,7 +30,7 @@ class DesktopMyAddresses extends StatefulWidget {
}
class DesktopMyAddressesState extends State<DesktopMyAddresses> {
List<Address> addresses;
late List<Address> addresses;
double sideSpace = 0;
double mainSpace = 1200;

View File

@@ -30,7 +30,7 @@ class DesktopMySupport extends StatefulWidget {
}
class DesktopMySupportState extends State<DesktopMySupport> {
List<Ticket> tickets;
late List<Ticket> tickets;
double division = 3;
@@ -218,7 +218,7 @@ class DesktopMySupportState extends State<DesktopMySupport> {
children: <Widget>[
Container(
child: Text(
ticket.issue.msg,
ticket.issue!.msg,
style: TextStyle(
fontSize: 19.0,
),
@@ -248,7 +248,7 @@ class DesktopMySupportState extends State<DesktopMySupport> {
SizedBox.shrink(),
Expanded(
child: Text(
S.of(context).followups_token(ticket.followUps.length),
S.of(context).followups_token(ticket.followUps!.length),
style: TextStyle(
fontSize: 15.0,
color: Colors.black87,

View File

@@ -39,9 +39,9 @@ class DesktopNewAddressState extends State<DesktopNewAddress> {
final faxController = TextEditingController();
String country = 'CA';
Gender _selectedGender;
late Gender _selectedGender;
String _selectedProvince;
late String _selectedProvince;
double sideSpace = 0;
double mainSpace = 1200;
@@ -98,7 +98,7 @@ class DesktopNewAddressState extends State<DesktopNewAddress> {
labelText: S.of(context).contact_name,
),
validator: (String? value) {
if (value.trim().isEmpty) {
if (value!.trim().isEmpty) {
return S.of(context).contact_name_is_required;
}
return null;
@@ -142,7 +142,7 @@ class DesktopNewAddressState extends State<DesktopNewAddress> {
labelText: S.of(context).mobile_phone_number,
),
validator: (String? value) {
if (value.trim().isEmpty) {
if (value!.trim().isEmpty) {
return S.of(context).mobile_phone_number_is_required;
}
return null;
@@ -167,7 +167,7 @@ class DesktopNewAddressState extends State<DesktopNewAddress> {
labelText: S.of(context).street_line_1,
),
validator: (String? value) {
if (value.trim().isEmpty) {
if (value!.trim().isEmpty) {
return S.of(context).street_line_1_is_required;
}
return null;
@@ -211,7 +211,7 @@ class DesktopNewAddressState extends State<DesktopNewAddress> {
labelText: S.of(context).city,
),
validator: (String? value) {
if (value.trim().isEmpty) {
if (value!.trim().isEmpty) {
return S.of(context).city_is_required;
}
return null;
@@ -257,7 +257,7 @@ class DesktopNewAddressState extends State<DesktopNewAddress> {
labelText: S.of(context).postal_code,
),
validator: (String? value) {
if (value.trim().isEmpty) {
if (value!.trim().isEmpty) {
return S.of(context).postal_code_is_required;
}
return null;
@@ -292,7 +292,7 @@ class DesktopNewAddressState extends State<DesktopNewAddress> {
labelText: S.of(context).email,
),
validator: (String? value) {
if (value.isNotEmpty && !EmailValidator.validate(value)) {
if (value!.isNotEmpty && !EmailValidator.validate(value)) {
return S.of(context).email_is_not_valid;
}
return null;
@@ -383,8 +383,8 @@ class DesktopNewAddressState extends State<DesktopNewAddress> {
cityController.text = widget.locatedAddress.city;
postalCodeController.text = widget.locatedAddress.postalCode;
streetLine1Controller.text = (widget.locatedAddress.streetNumber != null
&& widget.locatedAddress.streetNumber.isNotEmpty
? widget.locatedAddress.streetNumber + ' ' : '')
&& widget.locatedAddress.streetNumber!.isNotEmpty
? widget.locatedAddress.streetNumber! + ' ' : '')
+ widget.locatedAddress.streetName;
} else {
_selectedProvince = 'Ontario';

View File

@@ -34,13 +34,13 @@ class DesktopNewComment extends StatefulWidget {
}
class DesktopNewCommentState extends State<DesktopNewComment> {
Comment comment;
late Comment comment;
bool _showProgress;
late bool _showProgress;
double _progress;
late double _progress;
double rating;
late double rating;
bool isSubmitting = false;
@@ -203,7 +203,7 @@ class DesktopNewCommentState extends State<DesktopNewComment> {
children: <Widget>[],
);
if (comment != null && comment.images.length > 0) {
if (comment != null && comment.images!.length > 0) {
for (ProductImage image in comment.images) {
row.children.add(
Container(
@@ -275,7 +275,7 @@ class DesktopNewCommentState extends State<DesktopNewComment> {
child: Icon(
Icons.add,
size: 60.0,
color: comment == null || comment.images.length < 3 ? Colors.lightBlue : Colors.black12,
color: comment == null || comment.images!.length < 3 ? Colors.lightBlue : Colors.black12,
),
decoration: BoxDecoration(
color: Colors.white70,
@@ -300,7 +300,7 @@ class DesktopNewCommentState extends State<DesktopNewComment> {
),
),
onTap: () {
if (comment == null || comment.images.length < 3) {
if (comment == null || comment.images!.length < 3) {
showDialog(
context: mainContext,
barrierDismissible: true,

View File

@@ -155,7 +155,7 @@ class DesktopNewTicketState extends State<DesktopNewTicket> {
),
autofocus: true,
validator: (String? value) {
if (value.trim().isEmpty) {
if (value!.trim().isEmpty) {
return S.of(context).this_field_is_required;
}
return null;

View File

@@ -28,9 +28,9 @@ class DesktopNewUserState extends State<DesktopNewUser> {
bool usernameEnable = true;
final codeController = TextEditingController();
bool enableGetCode;
String getCodeText;
bool canRegister;
late bool enableGetCode;
late String getCodeText;
late bool canRegister;
var countDownListener;
@@ -81,7 +81,7 @@ class DesktopNewUserState extends State<DesktopNewUser> {
),
autofocus: true,
validator: (String? value) {
if (value.trim().isEmpty) {
if (value!.trim().isEmpty) {
return S.of(context).mobile_or_email_is_required;
}
return null;
@@ -164,7 +164,7 @@ class DesktopNewUserState extends State<DesktopNewUser> {
fontSize: 18.0
),
validator: (String? value) {
if (value.trim().isEmpty) {
if (value!.trim().isEmpty) {
return S.of(context).verification_code_is_required;
}
return null;

View File

@@ -39,18 +39,18 @@ class DesktopOrderDetail extends StatefulWidget {
}
class DesktopOrderDetailState extends State<DesktopOrderDetail> {
Order order;
late Order order;
LatLng _lastMapPosition;
LatLng customerLatLng;
LatLng deliveryLatLng;
LatLng storeLatLng;
late LatLng _lastMapPosition;
late LatLng customerLatLng;
late LatLng deliveryLatLng;
late LatLng storeLatLng;
final Set<Marker> _markers = {};
final Set<Polyline> _polyLine = {};
BitmapDescriptor homeIcon;
BitmapDescriptor deliveryIcon;
BitmapDescriptor shopIcon;
late BitmapDescriptor homeIcon;
late BitmapDescriptor deliveryIcon;
late BitmapDescriptor shopIcon;
double sideSpace = 0;
double mainSpace = 1200;
@@ -110,7 +110,7 @@ class DesktopOrderDetailState extends State<DesktopOrderDetail> {
width: double.infinity,
padding: EdgeInsets.only(top: 0.0, bottom: 16.0),
child: Text(
order.cartInfo.businessInfo.name,
order.cartInfo!.businessInfo!.name,
maxLines: 1,
overflow: TextOverflow.ellipsis,
style: TextStyle(
@@ -141,7 +141,7 @@ class DesktopOrderDetailState extends State<DesktopOrderDetail> {
Icons.phone,
),
onTap: () {
Utils.launchURL('tel:${order.businessInfo.phone}');
Utils.launchURL('tel:${order.businessInfo!.phone}');
},
),
),
@@ -156,7 +156,7 @@ class DesktopOrderDetailState extends State<DesktopOrderDetail> {
child: GoogleMap(
onMapCreated: _onMapCreated,
initialCameraPosition: CameraPosition(
target: new LatLng(double.parse(order.shippingAddress.lat), double.parse(order.shippingAddress.lng)),
target: new LatLng(double.parse(order.shippingAddress!.lat), double.parse(order.shippingAddress!.lng)),
zoom: 11.0,
),
onCameraMove: _onCameraMove,
@@ -167,14 +167,14 @@ class DesktopOrderDetailState extends State<DesktopOrderDetail> {
].toSet(),
),
));
if (order.deliveryDistance != null && order.deliveryDistance.distance != null) {
if (order.deliveryDistance != null && order.deliveryDistance!.distance != null) {
col.children.add(Container(
padding: EdgeInsets.only(top: 6.0, bottom: 6.0),
margin: EdgeInsets.only(bottom: 6.0),
child: Text(
S.of(context).delivery_distance_token(
order.deliveryDistance.distance.text,
order.deliveryDistance.duration.text
order.deliveryDistance!.distance!.text,
order.deliveryDistance!.duration!.text
),
),
decoration: BoxDecoration(
@@ -190,7 +190,7 @@ class DesktopOrderDetailState extends State<DesktopOrderDetail> {
}
}
for (CartLineItem lineItem in order.cartInfo.productList) {
for (CartLineItem lineItem in order.cartInfo!.productList) {
col.children.add(Container(
padding: EdgeInsets.only(top: 16.0, bottom: 0.0),
@@ -198,7 +198,7 @@ class DesktopOrderDetailState extends State<DesktopOrderDetail> {
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
Util.showImage('${lineItem.product.imagePath}',
Util.showImage('${lineItem.product!.imagePath}',
width: 40.0,
height: 40.0,
fit: BoxFit.fill,
@@ -236,7 +236,7 @@ class DesktopOrderDetailState extends State<DesktopOrderDetail> {
width: 30.0,
alignment: Alignment.centerRight,
child: Text(
'x${lineItem.quantity.round()}',
'x${lineItem.quantity!.round()}',
style: TextStyle(
fontSize: 14.0,
),
@@ -298,8 +298,8 @@ class DesktopOrderDetailState extends State<DesktopOrderDetail> {
],
),
);
for (var i = 0; i < order.cartInfo.extraFeeList.length; i++) {
ExtraFee extraFee = order.cartInfo.extraFeeList[i];
for (var i = 0; i < order.cartInfo!.extraFeeList!.length; i++) {
ExtraFee extraFee = order.cartInfo!.extraFeeList![i];
col.children.add(
Row(
mainAxisAlignment: MainAxisAlignment.start,
@@ -323,7 +323,7 @@ class DesktopOrderDetailState extends State<DesktopOrderDetail> {
width: 100.0,
alignment: Alignment.centerRight,
child: Text(
'${extraFee.price.toStringAsFixed(2)}',
'${extraFee.price!.toStringAsFixed(2)}',
style: TextStyle(
fontSize: 15.0,
),
@@ -356,7 +356,7 @@ class DesktopOrderDetailState extends State<DesktopOrderDetail> {
width: 100.0,
alignment: Alignment.centerRight,
child: Text(
'${order.totalPrice.toStringAsFixed(2)}',
'${order.totalPrice!.toStringAsFixed(2)}',
style: TextStyle(
fontSize: 18.0,
fontWeight: FontWeight.bold,
@@ -466,7 +466,7 @@ class DesktopOrderDetailState extends State<DesktopOrderDetail> {
margin: EdgeInsets.only(top: 10.0, bottom: 10.0),
alignment: Alignment.centerRight,
child: Text(
'${order.cartInfo.businessInfo.fullAddress}',
'${order.cartInfo!.businessInfo!.fullAddress}',
style: TextStyle(
color: Colors.black38,
),
@@ -893,19 +893,19 @@ class DesktopOrderDetailState extends State<DesktopOrderDetail> {
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
Container(
child: fulfillment.shippingMethod.isNotEmpty && fulfillment.trackingNumber != null && fulfillment.trackingNumber.isNotEmpty ?
child: fulfillment.shippingMethod!.isNotEmpty && fulfillment.trackingNumber != null && fulfillment.trackingNumber!.isNotEmpty ?
Text(
'${fulfillment.shippingMethod} ${fulfillment.trackingNumber}',
overflow: TextOverflow.ellipsis,
maxLines: 1,
) : (fulfillment.shippingMethod.isNotEmpty ? Text(
) : (fulfillment.shippingMethod!.isNotEmpty ? Text(
'${fulfillment.shippingMethod}',
overflow: TextOverflow.ellipsis,
maxLines: 1,
) : SizedBox.shrink()),
),
Container(
child: fulfillment.note != null && fulfillment.note.isNotEmpty ?
child: fulfillment.note != null && fulfillment.note!.isNotEmpty ?
Text(
'${fulfillment.note}',
style: TextStyle(
@@ -1092,12 +1092,12 @@ class DesktopOrderDetailState extends State<DesktopOrderDetail> {
if (!kIsWeb) {
if (order.shippingMethod == 'store-delivery' && order.status != Constants.STATUS_COMPLETE && order.status != Constants.STATUS_CANCELLED) {
storeLatLng = LatLng(double.parse(order.businessInfo.address.lat),
double.parse(order.businessInfo.address.lng));
customerLatLng = LatLng(double.parse(order.shippingAddress.lat),
double.parse(order.shippingAddress.lng));
storeLatLng = LatLng(double.parse(order.businessInfo!.address!.lat),
double.parse(order.businessInfo!.address!.lng));
customerLatLng = LatLng(double.parse(order.shippingAddress!.lat),
double.parse(order.shippingAddress!.lng));
deliveryLatLng =
LatLng(order.shipperPosition.lat, order.shipperPosition.lng);
LatLng(order.shipperPosition!.lat, order.shipperPosition!.lng);
_polyLine.clear();
_polyLine.add(
@@ -1110,7 +1110,7 @@ class DesktopOrderDetailState extends State<DesktopOrderDetail> {
],
width: 3,
points: [
order.shipperPosition.lat != 0.0 ? deliveryLatLng : storeLatLng,
order.shipperPosition!.lat != 0.0 ? deliveryLatLng : storeLatLng,
customerLatLng,
]
)
@@ -1135,12 +1135,12 @@ class DesktopOrderDetailState extends State<DesktopOrderDetail> {
title: S
.of(context)
.customer,
snippet: order.shippingAddress.addressLine1,
snippet: order.shippingAddress!.addressLine1,
),
icon: homeIcon,
));
if (order.shipperPosition.lat != 0.0 &&
order.shipperPosition.lng != 0.0) {
if (order.shipperPosition!.lat != 0.0 &&
order.shipperPosition!.lng != 0.0) {
_markers.add(Marker(
markerId: MarkerId('shipper_position'),
position: deliveryLatLng,

View File

@@ -35,7 +35,7 @@ class DesktopOrders extends StatefulWidget {
class DesktopOrdersState extends State<DesktopOrders> with SingleTickerProviderStateMixin {
GlobalKey<ScaffoldState> _scaffoldKey = GlobalKey<ScaffoldState>();
List<Order> orders;
late List<Order> orders;
bool _isLoading = false;
@@ -181,7 +181,7 @@ class DesktopOrdersState extends State<DesktopOrders> with SingleTickerProviderS
row.children.add(Expanded(
child: Container(
child: Text(
order.cartInfo.productList[0].name,
order.cartInfo!.productList![0].name,
style: TextStyle(
fontSize: 14.0,
),
@@ -190,7 +190,7 @@ class DesktopOrdersState extends State<DesktopOrders> with SingleTickerProviderS
),
),
));
if (order.cartInfo.productList.length > 1) {
if (order.cartInfo!.productList!.length > 1) {
row.children.add(Container(
child: Text(
S.of(context).and_more_item_token(Utils.getProductLineInOrder(order.cartInfo)),
@@ -205,7 +205,7 @@ class DesktopOrdersState extends State<DesktopOrders> with SingleTickerProviderS
width: 80.0,
alignment: Alignment.centerRight,
child: Text(
'\$${order.totalPrice.toStringAsFixed(2)}',
'\$${order.totalPrice!.toStringAsFixed(2)}',
style: TextStyle(
fontSize: 16.0,
fontWeight: FontWeight.bold,
@@ -320,7 +320,7 @@ class DesktopOrdersState extends State<DesktopOrders> with SingleTickerProviderS
mainAxisAlignment: MainAxisAlignment.start,
children: <Widget>[
Container(
child: Util.showImage('${order.cartInfo.businessInfo.picUrl}',
child: Util.showImage('${order.cartInfo!.businessInfo!.picUrl}',
width: 32.0,
height: 32.0,
fit: BoxFit.fill,
@@ -336,7 +336,7 @@ class DesktopOrdersState extends State<DesktopOrders> with SingleTickerProviderS
children: <Widget>[
Container(
child: Text(
'${order.cartInfo.businessInfo.name}',
'${order.cartInfo!.businessInfo!.name}',
style: TextStyle(
fontSize: 20.0,
),

View File

@@ -32,9 +32,9 @@ class DesktopPayNow extends StatefulWidget {
}
class DesktopPayNowState extends State<DesktopPayNow> {
Order order;
List<PaymentPlatform> paymentPlatforms;
User _user;
late Order order;
late List<PaymentPlatform> paymentPlatforms;
late User _user;
double sideSpace = 0;
double mainSpace = 1200;
@@ -86,7 +86,7 @@ class DesktopPayNowState extends State<DesktopPayNow> {
),
),
Text(
'\$${order.totalPrice.toStringAsFixed(2)}',
'\$${order.totalPrice!.toStringAsFixed(2)}',
style: TextStyle(
fontSize: 24.0,
fontWeight: FontWeight.bold,
@@ -103,7 +103,7 @@ class DesktopPayNowState extends State<DesktopPayNow> {
)
),
),
store.state.deviceId != null && store.state.deviceId.isNotEmpty || store.state.tableNumber != null && store.state.tableNumber.isNotEmpty ?
store.state.deviceId != null && store.state.deviceId!.isNotEmpty || store.state.tableNumber != null && store.state.tableNumber!.isNotEmpty ?
GestureDetector(
child: Container(
padding: EdgeInsets.only(top: 20.0, bottom: 20.0, left: 16.0, right: 16.0),

View File

@@ -42,13 +42,13 @@ class DesktopProductDetailPage extends StatefulWidget {
class DesktopProductDetailPageState extends State<DesktopProductDetailPage>
with SingleTickerProviderStateMixin {
TabController _tabController;
late TabController _tabController;
final double _tabBarHeight = 50;
ProductDetail productDetail;
late ProductDetail productDetail;
bool refresh;
late bool refresh;
double sideSpace = 0;
double mainSpace = 1200;
@@ -207,7 +207,7 @@ class DesktopProductDetailPageState extends State<DesktopProductDetailPage>
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
(productDetail.subproducts.length > 0) ?
(productDetail.subproducts!.length > 0) ?
subProducts(productDetail.subproducts) :
SizedBox.shrink(),
Container(
@@ -222,7 +222,7 @@ class DesktopProductDetailPageState extends State<DesktopProductDetailPage>
Container(
padding: EdgeInsets.only(left: 10.0, right: 10.0),
child: (productDetail.description2 != null &&
!productDetail.description2.isEmpty)
!productDetail.description2!.isEmpty)
? Text(
'${productDetail.description2}',
style: TextStyle(
@@ -299,7 +299,7 @@ class DesktopProductDetailPageState extends State<DesktopProductDetailPage>
}
Widget getImage(double width) {
if (productDetail.images.length <= 0) {
if (productDetail.images!.length <= 0) {
return Util.showImage(
productDetail.image,
width: width,
@@ -346,7 +346,7 @@ class DesktopProductDetailPageState extends State<DesktopProductDetailPage>
Container(
padding: EdgeInsets.symmetric(horizontal: 12.0, vertical: 5.0),
child: Util.showImage(
'https:${subproduct.product.image}',
'https:${subproduct.product!.image}',
width: 48,
height: 48,
fit: BoxFit.contain,
@@ -366,7 +366,7 @@ class DesktopProductDetailPageState extends State<DesktopProductDetailPage>
child: Container(
padding: EdgeInsets.only(left: 12, top: 5),
child: Text(
subproduct.product.name,
subproduct.product!.name,
style: TextStyle(
fontSize: 15.0,
),
@@ -377,7 +377,7 @@ class DesktopProductDetailPageState extends State<DesktopProductDetailPage>
width: 80,
padding: EdgeInsets.only(left: 12, top: 5, right: 12),
child: Text(
'${subproduct.product.price.toStringAsFixed(2)}',
'${subproduct.product!.price!.toStringAsFixed(2)}',
style: TextStyle(
fontSize: 13,
decoration: TextDecoration.lineThrough,
@@ -389,7 +389,7 @@ class DesktopProductDetailPageState extends State<DesktopProductDetailPage>
width: 60,
padding: EdgeInsets.only(left: 12, top: 5, right: 12),
child: Text(
'x${subproduct.quantity.toStringAsFixed(0)}',
'x${subproduct.quantity!.toStringAsFixed(0)}',
style: TextStyle(
fontSize: 13,
),
@@ -401,7 +401,7 @@ class DesktopProductDetailPageState extends State<DesktopProductDetailPage>
Container(
padding: EdgeInsets.only(left: 12, top: 12, right: 12),
child: Text(
'${subproduct.product.description}',
'${subproduct.product!.description}',
style: TextStyle(
fontSize: 12,
color: Colors.black45,
@@ -453,9 +453,9 @@ class DesktopProductDetailPageState extends State<DesktopProductDetailPage>
var pages = <Widget>[];
List<String> images = [];
images.add(productDetail.image);
for (var i = 0; i < productDetail.images.length; i++) {
for (var i = 0; i < productDetail.images!.length; i++) {
// print('>>https:' + productDetail.images[i].image);
images.add(productDetail.images[i].image);
images.add(productDetail.images![i].image);
}
for (var i = 0; i < images.length; i++) {

View File

@@ -109,7 +109,7 @@ class DesktopProductItemState extends State<DesktopProductItem> {
new Container(
child: widget.business.showMonthlySold ?
Text(
S.of(context).sold_per_month_token(widget.product.monthSales.toStringAsFixed(0)),
S.of(context).sold_per_month_token(widget.product.monthSales!.toStringAsFixed(0)),
style: new TextStyle(
fontSize: 9.0
),
@@ -193,7 +193,7 @@ class DesktopProductItemState extends State<DesktopProductItem> {
new Container(
child: widget.business.showMonthlySold ?
Text(
S.of(context).sold_per_month_token(widget.product.monthSales.toStringAsFixed(0)),
S.of(context).sold_per_month_token(widget.product.monthSales!.toStringAsFixed(0)),
style: new TextStyle(
fontSize: 9.0
),

View File

@@ -134,7 +134,7 @@ class DesktopRenewLicenseState extends State<DesktopRenewLicense> {
),
autofocus: true,
validator: (String? value) {
if (value.trim().isEmpty) {
if (value!.trim().isEmpty) {
return S.of(context).please_enter_group_number;
}
return null;

View File

@@ -26,10 +26,10 @@ class DesktopResetPasswordState extends State<DesktopResetPassword> {
final passwordController = TextEditingController();
final passwordAgainController = TextEditingController();
bool passwordVisible;
bool passwordAgainVisible;
late bool passwordVisible;
late bool passwordAgainVisible;
bool canReset;
late bool canReset;
double sideSpace = 0;
double mainSpace = 1200;
@@ -93,7 +93,7 @@ class DesktopResetPasswordState extends State<DesktopResetPassword> {
fontSize: 18.0
),
validator: (String? value) {
if (value.trim().isEmpty) {
if (value!.trim().isEmpty) {
return S.of(context).password_is_required;
}
return null;
@@ -147,10 +147,10 @@ class DesktopResetPasswordState extends State<DesktopResetPassword> {
fontSize: 18.0
),
validator: (String? value) {
if (value.trim().isEmpty) {
if (value!.trim().isEmpty) {
return S.of(context).password_is_required;
}
if (value.trim() != passwordController.text.trim()) {
if (value!.trim() != passwordController.text.trim()) {
return S.of(context).password_is_not_match_password_again;
}
return null;

View File

@@ -128,7 +128,7 @@ class DesktopSearchPlaceState extends State<DesktopSearchPlace> {
);
if (result is DioError) {
if (result.response != null) {
throw RuntimeError(result.response.data['message']);
throw RuntimeError(result.response!.data['message']);
} else {
throw RuntimeError(result.message);
}

View File

@@ -26,10 +26,10 @@ class DesktopSetPasswordState extends State<DesktopSetPassword> {
final passwordController = TextEditingController();
final passwordAgainController = TextEditingController();
bool passwordVisible;
bool passwordAgainVisible;
late bool passwordVisible;
late bool passwordAgainVisible;
bool canReset;
late bool canReset;
double sideSpace = 0;
double mainSpace = 1200;
@@ -93,7 +93,7 @@ class DesktopSetPasswordState extends State<DesktopSetPassword> {
fontSize: 18.0
),
validator: (String? value) {
if (value.trim().isEmpty) {
if (value!.trim().isEmpty) {
return S.of(context).password_is_required;
}
return null;
@@ -147,10 +147,10 @@ class DesktopSetPasswordState extends State<DesktopSetPassword> {
fontSize: 18.0
),
validator: (String? value) {
if (value.trim().isEmpty) {
if (value!.trim().isEmpty) {
return S.of(context).password_is_required;
}
if (value.trim() != passwordController.text.trim()) {
if (value!.trim() != passwordController.text.trim()) {
return S.of(context).password_is_not_match_password_again;
}
return null;

View File

@@ -18,14 +18,14 @@ class DesktopShoppingCartWidget extends StatefulWidget {
}
class DesktopShoppingCartWidgetState extends State<DesktopShoppingCartWidget> {
CartInfo cartInfo;
late CartInfo cartInfo;
double totalPrice = 0.0;
@override
Widget build(BuildContext context) {
totalPrice = 0.0;
cartInfo = Utils.getCartInfoByBusiness(store.state.cartInfos, widget.business);
if (cartInfo != null && cartInfo.businessInfo.id == widget.business.id) {
if (cartInfo != null && cartInfo.businessInfo!.id == widget.business.id) {
totalPrice = cartInfo.getTotalPrice();
}
Row row = Row(

View File

@@ -134,7 +134,7 @@ class DesktopStoreProductSearchState extends State<DesktopStoreProductSearch> {
);
if (result is DioError) {
if (result.response != null) {
throw RuntimeError(result.response.data);
throw RuntimeError(result.response!.data);
} else {
throw RuntimeError(result.message);
}

View File

@@ -27,10 +27,10 @@ class DesktopUserProfile extends StatefulWidget {
}
class DesktopUserProfileState extends State<DesktopUserProfile> {
User _user;
late User _user;
bool _showProgress;
double _progress;
late bool _showProgress;
late double _progress;
double sideSpace = 0;
double mainSpace = 1200;
@@ -253,7 +253,7 @@ class DesktopUserProfileState extends State<DesktopUserProfile> {
),
Container(
child: Text(
_user.mobile != null && _user.mobile.isNotEmpty ? Utils.safePhoneNumber(_user.mobile) : S.of(context).not_binding,
_user.mobile != null && _user.mobile!.isNotEmpty ? Utils.safePhoneNumber(_user.mobile) : S.of(context).not_binding,
style: TextStyle(
color: Colors.grey,
),
@@ -306,7 +306,7 @@ class DesktopUserProfileState extends State<DesktopUserProfile> {
),
Container(
child: Text(
_user.email != null && _user.email.isNotEmpty ? Utils.safePhoneNumber(_user.email) : S.of(context).not_binding,
_user.email != null && _user.email!.isNotEmpty ? Utils.safePhoneNumber(_user.email) : S.of(context).not_binding,
style: TextStyle(
color: Colors.grey,
),
@@ -425,7 +425,7 @@ class DesktopUserProfileState extends State<DesktopUserProfile> {
),
autofocus: true,
validator: (String? value) {
if (value.trim().isEmpty) {
if (value!.trim().isEmpty) {
return S.of(context).nickname_is_required;
}
return null;

View File

@@ -28,7 +28,7 @@ class DesktopViewBlog extends StatefulWidget {
}
class DesktopViewBlogState extends State<DesktopViewBlog> {
Blog blog;
late Blog blog;
double sideSpace = 0;
double mainSpace = 1200;

View File

@@ -33,7 +33,7 @@ class DesktopViewTicket extends StatefulWidget {
class DesktopViewTicketState extends State<DesktopViewTicket> {
final GlobalKey<FormState> _formKey = GlobalKey<FormState>();
Ticket ticket;
late Ticket ticket;
final issueMsgController = TextEditingController();
@@ -144,7 +144,7 @@ class DesktopViewTicketState extends State<DesktopViewTicket> {
),
autofocus: false,
validator: (String? value) {
if (value.trim().isEmpty) {
if (value!.trim().isEmpty) {
return S.of(context).this_field_is_required;
}
return null;
@@ -240,7 +240,7 @@ class DesktopViewTicketState extends State<DesktopViewTicket> {
width: double.maxFinite,
padding: EdgeInsets.only(top: 8.0, left: 16.0, right: 16.0, bottom: 24.0),
child: Text(
'${ticket.issue.msg}',
'${ticket.issue!.msg}',
style: TextStyle(
color: Colors.black54,
fontSize: 14.0,
@@ -260,7 +260,7 @@ class DesktopViewTicketState extends State<DesktopViewTicket> {
padding: EdgeInsets.only(top: 16.0, bottom: 16.0, left: 16.0, right: 16.0),
child: SingleChildScrollView(
scrollDirection: Axis.horizontal,
child: showGalleryImages(mainContext, ticket.issue.files),
child: showGalleryImages(mainContext, ticket.issue!.files),
),
decoration: BoxDecoration(
border: Border(
@@ -291,7 +291,7 @@ class DesktopViewTicketState extends State<DesktopViewTicket> {
],
);
if (ticket.followUps.length > 0) {
if (ticket.followUps!.length > 0) {
ticketCol.children.add(
Container(
width: double.maxFinite,
@@ -305,8 +305,8 @@ class DesktopViewTicketState extends State<DesktopViewTicket> {
),
),
);
for (int i = 0; i < ticket.followUps.length; i++) {
FollowUp followUp = ticket.followUps[i];
for (int i = 0; i < ticket.followUps!.length; i++) {
FollowUp followUp = ticket.followUps![i];
ticketCol.children.add(
Container(
width: double.maxFinite,
@@ -423,7 +423,7 @@ class DesktopViewTicketState extends State<DesktopViewTicket> {
padding: EdgeInsets.only(left: 20.0, right: 20.0, top: 0.0, bottom: 30.0),
child: TextLink(
S.of(context).new_ticket,
'/new-ticket/${ticket.store.id}',
'/new-ticket/${ticket.store!.id}',
),
)
],
@@ -693,7 +693,7 @@ class DesktopViewTicketState extends State<DesktopViewTicket> {
child: Text(S.of(context).ok),
onPressed: () {
Routes.router.navigateTo(context,
'/my-support/${ticket.store.id}',
'/my-support/${ticket.store!.id}',
replace: true,
);
},

View File

@@ -90,7 +90,7 @@ class ProductItemState extends State<ProductItem> {
width: 110.0,
height: 110.0,
child: GestureDetector(
child: onHover && widget.product.secondImagePath.isNotEmpty ?
child: onHover && widget.product.secondImagePath!.isNotEmpty ?
Util.showImage('${widget.product.secondImagePath}',
fit: BoxFit.fill,
) :
@@ -143,7 +143,7 @@ class ProductItemState extends State<ProductItem> {
new Container(
child: widget.business.showMonthlySold ?
Text(
S.of(context).sold_per_month_token(widget.product.monthSales.toStringAsFixed(0)),
S.of(context).sold_per_month_token(widget.product.monthSales!.toStringAsFixed(0)),
style: new TextStyle(
fontSize: 9.0
),
@@ -176,7 +176,7 @@ class ProductItemState extends State<ProductItem> {
width: 110.0,
height: 110.0,
child: GestureDetector(
child: onHover && widget.product.secondImagePath.isNotEmpty ?
child: onHover && widget.product.secondImagePath!.isNotEmpty ?
Util.showImage('${widget.product.secondImagePath}',
fit: BoxFit.fill,
) :
@@ -231,7 +231,7 @@ class ProductItemState extends State<ProductItem> {
new Container(
child: widget.business.showMonthlySold ?
Text(
S.of(context).sold_per_month_token(widget.product.monthSales.toStringAsFixed(0)),
S.of(context).sold_per_month_token(widget.product.monthSales!.toStringAsFixed(0)),
style: new TextStyle(
fontSize: 9.0
),

View File

@@ -142,7 +142,7 @@ class ProductSearchState extends State<ProductSearch> {
);
if (result is DioError) {
if (result.response != null) {
throw RuntimeError(result.response.data);
throw RuntimeError(result.response!.data);
} else {
throw RuntimeError(result.message);
}

View File

@@ -32,13 +32,13 @@ class Shop extends StatefulWidget {
}
class ShopState extends State<Shop> {
Business _business;
late Business _business;
PanelController panelController = PanelController();
SlidingUpPanel _slidUpShoppingCart;
late SlidingUpPanel _slidUpShoppingCart;
GlobalKey endKey = GlobalKey();
List<CategoryProducts> _categoryProducts;
late List<CategoryProducts> _categoryProducts;
bool displayProductByCategoryClick = false;
String displayProductByCategoryClickIndicator = '';
int categoryId = 0;
@@ -261,7 +261,7 @@ class ShopState extends State<Shop> {
if (moreCategoryProducts.isEmpty) {
_productCurrentPage = 0;
} else {
if (moreCategoryProducts[0].products.length < Constants.ORDERS_PER_PAGE) {
if (moreCategoryProducts[0].products!.length < Constants.ORDERS_PER_PAGE) {
_productCurrentPage = 0;
}
}

View File

@@ -28,7 +28,7 @@ class ShopBulletinState extends State<ShopBulletin> {
sideSpace = (MediaQuery.of(context).size.width - 1200) / 2;
}
if (widget.business.bulletin != null && widget.business.bulletin.isNotEmpty) {
if (widget.business.bulletin != null && widget.business.bulletin!.isNotEmpty) {
return Container(
margin: EdgeInsets.only(bottom: 12),
child: Row(

View File

@@ -39,7 +39,7 @@ class ShopProductsState extends State<ShopProducts> {
int _categoryIndex = 0;
List<CategoryProducts> _categoryProducts = [];
Business _business;
late Business _business;
double menuPosition = 0;
@@ -116,11 +116,11 @@ class ShopProductsState extends State<ShopProducts> {
int qtyInCategory = 0;
CartInfo cartInfo = Utils.getCartInfoByBusiness(store.state.cartInfos, _business);
if (cartInfo != null &&
cartInfo.businessInfo.id == _business.id &&
cartInfo.businessInfo!.id == _business.id &&
cartInfo.productList != null) {
for (var i = 0; i < cartInfo.productList.length; i++) {
if (cartInfo.productList[i].product.categoryId == cp.id) {
qtyInCategory += cartInfo.productList[i].quantity.ceil();
for (var i = 0; i < cartInfo.productList!.length; i++) {
if (cartInfo.productList![i].product!.categoryId == cp.id) {
qtyInCategory += cartInfo.productList![i].quantity!.ceil();
}
}
}
@@ -205,7 +205,7 @@ class ShopProductsState extends State<ShopProducts> {
);
for (int i = 0; i < _categoryProducts.length; i++) {
CategoryProducts cp = _categoryProducts[i];
if (cp.products.length > 0) {
if (cp.products!.length > 0) {
col.children.add(new Container(
height: _categoryDescHeight,
padding: new EdgeInsets.symmetric(horizontal: 10.0),
@@ -239,7 +239,7 @@ class ShopProductsState extends State<ShopProducts> {
),
),
new Visibility(
visible: cp.description.isNotEmpty,
visible: cp.description!.isNotEmpty,
child: new Text(
cp.description,
overflow: TextOverflow.ellipsis,
@@ -253,8 +253,8 @@ class ShopProductsState extends State<ShopProducts> {
],
)));
var it = cp.products.iterator;
for (int i = 0; i < cp.products.length; i++) {
var it = cp.products!.iterator;
for (int i = 0; i < cp.products!.length; i++) {
var r1 = Row(
mainAxisAlignment: MainAxisAlignment.start,
children: [],
@@ -295,7 +295,7 @@ class ShopProductsState extends State<ShopProducts> {
),
);
} else if (categoryId > 0) {
if (cp.products.length < Constants.ORDERS_PER_PAGE) {
if (cp.products!.length < Constants.ORDERS_PER_PAGE) {
col.children.add(
Container(
padding: EdgeInsets.all(12.0),
@@ -374,7 +374,7 @@ class ShopProductsState extends State<ShopProducts> {
.of(context)
.end_of_the_list;
} else {
if (moreCategoryProducts[0].products.length <
if (moreCategoryProducts[0].products!.length <
Constants.ORDERS_PER_PAGE) {
displayProductByCategoryClickIndicator = S
.of(context)
@@ -388,7 +388,7 @@ class ShopProductsState extends State<ShopProducts> {
CategoryProducts currentCp =
getCategoryProductByCategoryId(categoryId);
if (currentCp != null) {
currentCp.products.addAll(moreCategoryProducts[0].products);
currentCp.products!.addAll(moreCategoryProducts[0].products);
} else {
displayProductByCategoryClickIndicator = S
.of(context)
@@ -403,7 +403,7 @@ class ShopProductsState extends State<ShopProducts> {
int numCategoriesHasProducts() {
int num = 0;
for (CategoryProducts cp in _categoryProducts) {
if (cp.products.length > 0) {
if (cp.products!.length > 0) {
num += 1;
}
}

View File

@@ -22,7 +22,7 @@ class ShopPromoteState extends State<ShopPromote> {
double sideSpace = 0;
double mainSpace = 1200;
Business _business;
late Business _business;
@override
Widget build(BuildContext context) {
@@ -90,7 +90,7 @@ class ShopPromoteState extends State<ShopPromote> {
mainAxisAlignment: MainAxisAlignment.start,
children: <Widget>[],
);
for (var i = 0; i < _business.promoProducts.length; i++) {
for (var i = 0; i < _business.promoProducts!.length; i++) {
promotRow.children.add(Container(
padding: EdgeInsets.only(
left: 10.0,
@@ -129,17 +129,17 @@ class ShopPromoteState extends State<ShopPromote> {
GestureDetector(
child: Container(
child: Util.showImage(
_business.promoProducts[i].imagePath,
_business.promoProducts![i].imagePath,
width: 120.0,
),
),
onTap: () {
_showProductDetail(_business.promoProducts[i]);
_showProductDetail(_business.promoProducts![i]);
},
),
Container(
child: Text(
_business.promoProducts[i].name,
_business.promoProducts![i].name,
maxLines: 2,
overflow: TextOverflow.ellipsis,
style: TextStyle(fontSize: 14.0),
@@ -149,16 +149,16 @@ class ShopPromoteState extends State<ShopPromote> {
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: <Widget>[
ShowPrice(
_business.promoProducts[i].price,
_business.promoProducts![i].price,
currencySign: '\$',
fontWeight: FontWeight.bold,
smallFontSize: 15,
largeFontSize: 24,
regularPrice: _business.promoProducts[i].regularPrice,
regularPrice: _business.promoProducts![i].regularPrice,
),
Container(
child: AddRemoveButton(
product: _business.promoProducts[i],
product: _business.promoProducts![i],
business: _business,
addOnly: true,
),

View File

@@ -19,14 +19,14 @@ class ShoppingCartWidget extends StatefulWidget {
}
class ShoppingCartWidgetState extends State<ShoppingCartWidget> {
CartInfo cartInfo;
late CartInfo cartInfo;
double totalPrice = 0.0;
@override
Widget build(BuildContext context) {
totalPrice = 0.0;
cartInfo = Utils.getCartInfoByBusiness(store.state.cartInfos, widget.business);
if (cartInfo != null && cartInfo.businessInfo.id == widget.business.id) {
if (cartInfo != null && cartInfo.businessInfo!.id == widget.business.id) {
totalPrice = cartInfo.getTotalPrice();
}
Row row = Row(