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:
@@ -30,12 +30,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
|
||||
@@ -231,7 +231,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;
|
||||
|
||||
@@ -33,18 +33,18 @@ class MobileAttributeSelection extends StatefulWidget {
|
||||
}
|
||||
|
||||
class MobileAttributeSelectionState extends State<MobileAttributeSelection> {
|
||||
Product product;
|
||||
int index;
|
||||
TextButton previousButton;
|
||||
TextButton nextButton;
|
||||
bool previousButtonEnable;
|
||||
bool nextButtonEnable;
|
||||
late Product product;
|
||||
late int index;
|
||||
late TextButton previousButton;
|
||||
late TextButton nextButton;
|
||||
late bool previousButtonEnable;
|
||||
late bool nextButtonEnable;
|
||||
|
||||
String productDesc;
|
||||
double productPrice;
|
||||
late String productDesc;
|
||||
late double productPrice;
|
||||
|
||||
String nextText;
|
||||
String finishText;
|
||||
late String nextText;
|
||||
late String finishText;
|
||||
|
||||
Map<String, dynamic> selections = new Map();
|
||||
|
||||
@@ -118,31 +118,31 @@ class MobileAttributeSelectionState extends State<MobileAttributeSelection> {
|
||||
extendDescription.add(key + ': ' + opt.join(', '));
|
||||
});
|
||||
|
||||
ProductAttribute pa = product.productAttributes[index];
|
||||
ProductAttribute pa = product.productAttributes![index];
|
||||
if (pa.required && Utils.selectionsNotEmptyAt(selections, pa.name)) {
|
||||
setState(() {
|
||||
nextButtonEnable = true;
|
||||
productDesc = product.description + ', ' + extendDescription.join('; ');
|
||||
productPrice = product.price + extendPrice;
|
||||
productDesc = product.description! + ', ' + extendDescription.join('; ');
|
||||
productPrice = product.price! + extendPrice;
|
||||
});
|
||||
} else if (!pa.required){
|
||||
setState(() {
|
||||
nextButtonEnable = true;
|
||||
productDesc = product.description + ', ' + extendDescription.join('; ');
|
||||
productPrice = product.price + extendPrice;
|
||||
productDesc = product.description! + ', ' + extendDescription.join('; ');
|
||||
productPrice = product.price! + extendPrice;
|
||||
});
|
||||
} else {
|
||||
setState(() {
|
||||
nextButtonEnable = false;
|
||||
productDesc = product.description + ', ' + extendDescription.join('; ');
|
||||
productPrice = product.price + extendPrice;
|
||||
productDesc = product.description! + ', ' + extendDescription.join('; ');
|
||||
productPrice = product.price! + extendPrice;
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
bool _checkCanGoNext() {
|
||||
ProductAttribute pa = product.productAttributes[index];
|
||||
ProductAttribute pa = product.productAttributes![index];
|
||||
if (pa.required && Utils.selectionsNotEmptyAt(selections, pa.name)) {
|
||||
return true;
|
||||
} else if (!pa.required){
|
||||
@@ -167,7 +167,7 @@ class MobileAttributeSelectionState extends State<MobileAttributeSelection> {
|
||||
nextButton = TextButton(
|
||||
onPressed: nextButtonEnable ? _goNext : null,
|
||||
child: new Text(
|
||||
product.productAttributes.length > index + 1 ? nextText : finishText
|
||||
product.productAttributes!.length > index + 1 ? nextText : finishText
|
||||
),
|
||||
);
|
||||
|
||||
@@ -239,7 +239,7 @@ class MobileAttributeSelectionState extends State<MobileAttributeSelection> {
|
||||
Widget _getOptionsView() {
|
||||
Widget optionsView;
|
||||
|
||||
ProductAttribute productAttribute = product.productAttributes[index];
|
||||
ProductAttribute productAttribute = product.productAttributes![index];
|
||||
if (productAttribute.byQuantity) {
|
||||
optionsView = new QtyOptions(product: product, index: index, selections: selections);
|
||||
} else {
|
||||
@@ -254,13 +254,13 @@ class MobileAttributeSelectionState extends State<MobileAttributeSelection> {
|
||||
}
|
||||
|
||||
void _goNext() {
|
||||
if (index + 1 < product.productAttributes.length) {
|
||||
if (index + 1 < product.productAttributes!.length) {
|
||||
setState(() {
|
||||
index = index + 1;
|
||||
previousButtonEnable = index >= 1;
|
||||
nextButtonEnable = _checkCanGoNext();
|
||||
});
|
||||
} else if (product.productAttributes.length == index + 1) {
|
||||
} else if (product.productAttributes!.length == index + 1) {
|
||||
eventBus.fire(new OnProductWillAddToCart(product, selections, productPrice, productDesc, widget.business, buttonKey: widget.startKey));
|
||||
Navigator.pop(context);
|
||||
}
|
||||
|
||||
@@ -28,7 +28,7 @@ class MobileBlog extends StatefulWidget {
|
||||
}
|
||||
|
||||
class MobileBlogState extends State<MobileBlog> {
|
||||
List<Blog> blogs;
|
||||
late List<Blog> blogs;
|
||||
|
||||
int _page = 1;
|
||||
int _pageCount = 1;
|
||||
|
||||
@@ -20,7 +20,7 @@ class MobileBuyService extends StatefulWidget {
|
||||
|
||||
class MobileBuyServiceState extends State<MobileBuyService> {
|
||||
List<KeyValue> plans = [];
|
||||
KeyValue selectedPlan;
|
||||
late KeyValue selectedPlan;
|
||||
double price = 0.0;
|
||||
double tax = 0.0;
|
||||
double paymentAmount = 0.0;
|
||||
|
||||
@@ -31,9 +31,9 @@ class MobileChangeMobileOrEmailState extends State<MobileChangeMobileOrEmail> {
|
||||
bool usernameEnable = true;
|
||||
final codeController = TextEditingController();
|
||||
|
||||
bool enableGetCode;
|
||||
String getCodeText;
|
||||
bool canRegister;
|
||||
late bool enableGetCode;
|
||||
late String getCodeText;
|
||||
late bool canRegister;
|
||||
|
||||
var countDownListener;
|
||||
|
||||
@@ -94,7 +94,7 @@ class MobileChangeMobileOrEmailState extends State<MobileChangeMobileOrEmail> {
|
||||
),
|
||||
autofocus: true,
|
||||
validator: (String? value) {
|
||||
if (value.trim().isEmpty) {
|
||||
if (value!.trim().isEmpty) {
|
||||
if (widget.isMobile) {
|
||||
return S
|
||||
.of(context)
|
||||
@@ -105,10 +105,10 @@ class MobileChangeMobileOrEmailState extends State<MobileChangeMobileOrEmail> {
|
||||
.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;
|
||||
@@ -191,7 +191,7 @@ class MobileChangeMobileOrEmailState extends State<MobileChangeMobileOrEmail> {
|
||||
fontSize: 18.0
|
||||
),
|
||||
validator: (String? value) {
|
||||
if (value.trim().isEmpty) {
|
||||
if (value!.trim().isEmpty) {
|
||||
return S.of(context).verification_code_is_required;
|
||||
}
|
||||
return null;
|
||||
@@ -269,7 +269,7 @@ class MobileChangeMobileOrEmailState extends State<MobileChangeMobileOrEmail> {
|
||||
},
|
||||
isFormData: true,
|
||||
body: {
|
||||
'id': store.state.user.id,
|
||||
'id': store.state.user!.id,
|
||||
'mobile': usernameController.text.trim(),
|
||||
'code': codeController.text.trim(),
|
||||
},
|
||||
@@ -281,8 +281,8 @@ class MobileChangeMobileOrEmailState extends State<MobileChangeMobileOrEmail> {
|
||||
|
||||
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,
|
||||
@@ -303,7 +303,7 @@ class MobileChangeMobileOrEmailState extends State<MobileChangeMobileOrEmail> {
|
||||
'action': 'change_mobile_email_send_code'
|
||||
},
|
||||
body: {
|
||||
'id': store.state.user.id,
|
||||
'id': store.state.user!.id,
|
||||
'mobile': usernameController.text,
|
||||
},
|
||||
isFormData: true,
|
||||
@@ -321,9 +321,9 @@ class MobileChangeMobileOrEmailState extends State<MobileChangeMobileOrEmail> {
|
||||
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(
|
||||
|
||||
@@ -22,10 +22,10 @@ class MobileChangePasswordState extends State<MobileChangePassword> {
|
||||
final passwordController = TextEditingController();
|
||||
final passwordAgainController = TextEditingController();
|
||||
|
||||
bool passwordVisible;
|
||||
bool passwordAgainVisible;
|
||||
late bool passwordVisible;
|
||||
late bool passwordAgainVisible;
|
||||
|
||||
bool canReset;
|
||||
late bool canReset;
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
@@ -88,7 +88,7 @@ class MobileChangePasswordState extends State<MobileChangePassword> {
|
||||
fontSize: 18.0
|
||||
),
|
||||
validator: (String? value) {
|
||||
if (value.trim().isEmpty) {
|
||||
if (value!.trim().isEmpty) {
|
||||
return S.of(context).current_password_is_required;
|
||||
}
|
||||
return null;
|
||||
@@ -142,7 +142,7 @@ class MobileChangePasswordState extends State<MobileChangePassword> {
|
||||
fontSize: 18.0
|
||||
),
|
||||
validator: (String? value) {
|
||||
if (value.trim().isEmpty) {
|
||||
if (value!.trim().isEmpty) {
|
||||
return S.of(context).password_is_required;
|
||||
}
|
||||
return null;
|
||||
@@ -196,10 +196,10 @@ class MobileChangePasswordState extends State<MobileChangePassword> {
|
||||
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;
|
||||
@@ -276,7 +276,7 @@ class MobileChangePasswordState extends State<MobileChangePassword> {
|
||||
},
|
||||
isFormData: true,
|
||||
body: {
|
||||
'id': store.state.user.id,
|
||||
'id': store.state.user!.id,
|
||||
'old_password': oldPasswordController.text.trim(),
|
||||
'password': passwordController.text.trim(),
|
||||
}
|
||||
|
||||
@@ -45,17 +45,17 @@ class MobileCheckout extends StatefulWidget {
|
||||
}
|
||||
|
||||
class MobileCheckoutState extends State<MobileCheckout> with SingleTickerProviderStateMixin, AutomaticKeepAliveClientMixin {
|
||||
CartInfo cartInfo;
|
||||
Address shipAddress;
|
||||
bool canSubmit;
|
||||
List<ErrorMessage> errorMessages;
|
||||
List<BookingTime> bookingTimeList;
|
||||
List<BookingDateTime> bookingDateTimeList;
|
||||
List<PaymentPlatform> paymentPlatforms;
|
||||
TextValue durationInTraffic;
|
||||
int selectedCoupon;
|
||||
late CartInfo cartInfo;
|
||||
late Address shipAddress;
|
||||
late bool canSubmit;
|
||||
late List<ErrorMessage> errorMessages;
|
||||
late List<BookingTime> bookingTimeList;
|
||||
late List<BookingDateTime> bookingDateTimeList;
|
||||
late List<PaymentPlatform> paymentPlatforms;
|
||||
late TextValue durationInTraffic;
|
||||
late int selectedCoupon;
|
||||
double couponDiscountAmount = 0;
|
||||
List<Coupon> coupons;
|
||||
late List<Coupon> coupons;
|
||||
|
||||
int peopleCount = 2;
|
||||
|
||||
@@ -63,25 +63,25 @@ class MobileCheckoutState extends State<MobileCheckout> with SingleTickerProvide
|
||||
String orderRemark = '';
|
||||
|
||||
int deliveryMethodIndex = 0;
|
||||
String deliveryMethod;
|
||||
late String deliveryMethod;
|
||||
List<ShippingRate> shippingRates = [];
|
||||
ShippingRate selectedShippingRate;
|
||||
late ShippingRate selectedShippingRate;
|
||||
|
||||
List<String> shippingMethodLabels = [];
|
||||
List<IconData> shippingMethodIcons = [];
|
||||
|
||||
GlobalKey<ScaffoldState> _scaffoldKey = GlobalKey<ScaffoldState>();
|
||||
|
||||
int bookingDateIndex;
|
||||
int bookingTimeIndex;
|
||||
int paymentPlatformIndex;
|
||||
late int bookingDateIndex;
|
||||
late int bookingTimeIndex;
|
||||
late int paymentPlatformIndex;
|
||||
|
||||
GlobalKey slidingUpPanelKey = GlobalKey();
|
||||
SlidingUpPanel slidingUpPanel;
|
||||
late SlidingUpPanel slidingUpPanel;
|
||||
PanelController panelController = PanelController();
|
||||
Widget panel;
|
||||
late Widget panel;
|
||||
|
||||
double subtotal;
|
||||
late double subtotal;
|
||||
|
||||
TextEditingController newCouponController = TextEditingController();
|
||||
|
||||
@@ -102,7 +102,7 @@ class MobileCheckoutState extends State<MobileCheckout> with SingleTickerProvide
|
||||
);
|
||||
}
|
||||
|
||||
if (cartInfo.businessInfo.deliveryPickup == false && cartInfo.businessInfo.deliveryCanadaPost == false && cartInfo.businessInfo.deliveryStoreDelivery == false) {
|
||||
if (cartInfo.businessInfo!.deliveryPickup == false && cartInfo.businessInfo!.deliveryCanadaPost == false && cartInfo.businessInfo!.deliveryStoreDelivery == false) {
|
||||
return Scaffold(
|
||||
body: Container(
|
||||
child: Center(
|
||||
@@ -197,13 +197,13 @@ class MobileCheckoutState extends State<MobileCheckout> with SingleTickerProvide
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
Text(
|
||||
'\$${(cartInfo.totalPrice - couponDiscountAmount).toStringAsFixed(2)}',
|
||||
'\$${(cartInfo.totalPrice! - couponDiscountAmount).toStringAsFixed(2)}',
|
||||
style: TextStyle(
|
||||
fontSize: 20.0,
|
||||
color: Colors.white,
|
||||
),
|
||||
),
|
||||
cartInfo.businessInfo.isPublic ? SizedBox.shrink() : Container(
|
||||
cartInfo.businessInfo!.isPublic ? SizedBox.shrink() : Container(
|
||||
padding: EdgeInsets.only(top: 2.0, bottom: 2.0, left: 5.0, right: 5.0),
|
||||
width: 100.0,
|
||||
color: Colors.red,
|
||||
@@ -267,7 +267,7 @@ class MobileCheckoutState extends State<MobileCheckout> with SingleTickerProvide
|
||||
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');
|
||||
@@ -341,7 +341,7 @@ class MobileCheckoutState extends State<MobileCheckout> with SingleTickerProvide
|
||||
);
|
||||
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),
|
||||
@@ -355,8 +355,8 @@ class MobileCheckoutState extends State<MobileCheckout> with SingleTickerProvide
|
||||
),
|
||||
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,),
|
||||
@@ -369,8 +369,8 @@ class MobileCheckoutState extends State<MobileCheckout> with SingleTickerProvide
|
||||
}
|
||||
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') {
|
||||
@@ -389,7 +389,7 @@ class MobileCheckoutState extends State<MobileCheckout> with SingleTickerProvide
|
||||
Container(
|
||||
margin: EdgeInsets.only(top: 10.0),
|
||||
child: Text(
|
||||
cartInfo.businessInfo.name,
|
||||
cartInfo.businessInfo!.name,
|
||||
style: TextStyle(
|
||||
fontSize: 17.0,
|
||||
),
|
||||
@@ -398,7 +398,7 @@ class MobileCheckoutState extends State<MobileCheckout> with SingleTickerProvide
|
||||
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,
|
||||
@@ -406,9 +406,9 @@ class MobileCheckoutState extends State<MobileCheckout> with SingleTickerProvide
|
||||
),
|
||||
),
|
||||
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,
|
||||
@@ -417,7 +417,7 @@ class MobileCheckoutState extends State<MobileCheckout> with SingleTickerProvide
|
||||
),
|
||||
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,
|
||||
@@ -427,7 +427,7 @@ class MobileCheckoutState extends State<MobileCheckout> with SingleTickerProvide
|
||||
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,
|
||||
@@ -480,7 +480,7 @@ class MobileCheckoutState extends State<MobileCheckout> with SingleTickerProvide
|
||||
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,
|
||||
@@ -504,13 +504,13 @@ class MobileCheckoutState extends State<MobileCheckout> with SingleTickerProvide
|
||||
),
|
||||
),
|
||||
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') {
|
||||
@@ -553,7 +553,7 @@ class MobileCheckoutState extends State<MobileCheckout> with SingleTickerProvide
|
||||
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,
|
||||
@@ -583,7 +583,7 @@ class MobileCheckoutState extends State<MobileCheckout> with SingleTickerProvide
|
||||
},
|
||||
);
|
||||
}
|
||||
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),
|
||||
@@ -629,7 +629,7 @@ class MobileCheckoutState extends State<MobileCheckout> with SingleTickerProvide
|
||||
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(
|
||||
@@ -712,7 +712,7 @@ class MobileCheckoutState extends State<MobileCheckout> with SingleTickerProvide
|
||||
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,
|
||||
@@ -731,9 +731,9 @@ class MobileCheckoutState extends State<MobileCheckout> with SingleTickerProvide
|
||||
|
||||
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(
|
||||
@@ -826,8 +826,8 @@ class MobileCheckoutState extends State<MobileCheckout> with SingleTickerProvide
|
||||
),
|
||||
));
|
||||
|
||||
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,
|
||||
@@ -838,7 +838,7 @@ class MobileCheckoutState extends State<MobileCheckout> with SingleTickerProvide
|
||||
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,
|
||||
),
|
||||
@@ -848,7 +848,7 @@ class MobileCheckoutState extends State<MobileCheckout> with SingleTickerProvide
|
||||
width: 100.0,
|
||||
alignment: Alignment.centerRight,
|
||||
child: Text(
|
||||
'${cartInfo.extraFeeList[i].price.toStringAsFixed(2)}'
|
||||
'${cartInfo.extraFeeList![i].price!.toStringAsFixed(2)}'
|
||||
),
|
||||
),
|
||||
],
|
||||
@@ -876,7 +876,7 @@ class MobileCheckoutState extends State<MobileCheckout> with SingleTickerProvide
|
||||
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,
|
||||
@@ -974,7 +974,7 @@ class MobileCheckoutState extends State<MobileCheckout> with SingleTickerProvide
|
||||
children: <Widget>[
|
||||
Container(
|
||||
padding: EdgeInsets.all(5.0),
|
||||
child: Util.showImage('${cartLineItem.product.imagePath}',
|
||||
child: Util.showImage('${cartLineItem.product!.imagePath}',
|
||||
width: 40.0,
|
||||
height: 40.0,
|
||||
fit: BoxFit.fill,
|
||||
@@ -1011,14 +1011,14 @@ class MobileCheckoutState extends State<MobileCheckout> with SingleTickerProvide
|
||||
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)}',
|
||||
),
|
||||
),
|
||||
],
|
||||
@@ -1074,7 +1074,7 @@ class MobileCheckoutState extends State<MobileCheckout> with SingleTickerProvide
|
||||
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') {
|
||||
@@ -1082,7 +1082,7 @@ class MobileCheckoutState extends State<MobileCheckout> with SingleTickerProvide
|
||||
}
|
||||
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') {
|
||||
@@ -1090,7 +1090,7 @@ class MobileCheckoutState extends State<MobileCheckout> with SingleTickerProvide
|
||||
}
|
||||
i++;
|
||||
}
|
||||
if (cartInfo.businessInfo.deliveryPickup) {
|
||||
if (cartInfo.businessInfo!.deliveryPickup) {
|
||||
shippingMethodLabels.add(S.of(context).pickup);
|
||||
shippingMethodIcons.add(Icons.store);
|
||||
if (deliveryMethod == 'pickup') {
|
||||
@@ -1310,14 +1310,14 @@ class MobileCheckoutState extends State<MobileCheckout> with SingleTickerProvide
|
||||
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(
|
||||
@@ -1442,16 +1442,16 @@ class MobileCheckoutState extends State<MobileCheckout> with SingleTickerProvide
|
||||
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();
|
||||
}
|
||||
@@ -1681,7 +1681,7 @@ class MobileCheckoutState extends State<MobileCheckout> with SingleTickerProvide
|
||||
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(
|
||||
@@ -1702,7 +1702,7 @@ class MobileCheckoutState extends State<MobileCheckout> with SingleTickerProvide
|
||||
),
|
||||
),
|
||||
) : BoxDecoration(
|
||||
color: subtotal > cartInfo.businessInfo.minPrice ? Colors
|
||||
color: subtotal > cartInfo.businessInfo!.minPrice ? Colors
|
||||
.transparent : Colors.black38,
|
||||
),
|
||||
child: Row(
|
||||
@@ -1743,7 +1743,7 @@ class MobileCheckoutState extends State<MobileCheckout> with SingleTickerProvide
|
||||
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(
|
||||
@@ -1857,7 +1857,7 @@ class MobileCheckoutState extends State<MobileCheckout> with SingleTickerProvide
|
||||
),
|
||||
Container(
|
||||
child: Text(
|
||||
coupon.minAmount > 0 ?
|
||||
coupon.minAmount! > 0 ?
|
||||
S.of(context).min_order_amount_token(
|
||||
coupon.minAmount) :
|
||||
S.of(context)
|
||||
@@ -1917,7 +1917,7 @@ class MobileCheckoutState extends State<MobileCheckout> with SingleTickerProvide
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [],
|
||||
);
|
||||
if (cartInfo.businessInfo.quickInputs.length > 0) {
|
||||
if (cartInfo.businessInfo!.quickInputs!.length > 0) {
|
||||
Wrap w = Wrap(
|
||||
children: [],
|
||||
);
|
||||
@@ -1931,8 +1931,8 @@ class MobileCheckoutState extends State<MobileCheckout> with SingleTickerProvide
|
||||
),
|
||||
),
|
||||
));
|
||||
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,
|
||||
@@ -2112,7 +2112,7 @@ class MobileCheckoutState extends State<MobileCheckout> with SingleTickerProvide
|
||||
child: Container(
|
||||
alignment: Alignment.centerRight,
|
||||
child: Text(
|
||||
'${shippingRate.price.toStringAsFixed(2)}',
|
||||
'${shippingRate.price!.toStringAsFixed(2)}',
|
||||
style: TextStyle(
|
||||
fontSize: 16.0,
|
||||
color: Colors.black38,
|
||||
@@ -2203,7 +2203,7 @@ class MobileCheckoutState extends State<MobileCheckout> with SingleTickerProvide
|
||||
: (
|
||||
(bookingTimeList.length == 0 && bookingDateTimeList.length == 0) ?
|
||||
0 :
|
||||
bookingDateTimeList[bookingDateIndex].bookTimes[bookingTimeIndex]
|
||||
bookingDateTimeList[bookingDateIndex].bookTimes![bookingTimeIndex]
|
||||
.unixTime
|
||||
),
|
||||
'delivery': deliveryMethod,
|
||||
|
||||
@@ -29,7 +29,7 @@ class MobileContactUsState extends State<MobileContactUs> {
|
||||
String mapUrl = 'https://goo.gl/maps/M365MF5AW35n9ij67';
|
||||
|
||||
Completer<GoogleMapController> _controller = Completer();
|
||||
LatLng _lastMapPosition;
|
||||
late LatLng _lastMapPosition;
|
||||
final Set<Marker> _markers = {};
|
||||
final Set<Polyline> _polyLine = {};
|
||||
|
||||
@@ -239,16 +239,16 @@ class MobileContactUsState extends State<MobileContactUs> {
|
||||
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}',
|
||||
),
|
||||
)
|
||||
);
|
||||
@@ -257,7 +257,7 @@ class MobileContactUsState extends State<MobileContactUs> {
|
||||
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}',
|
||||
),
|
||||
)
|
||||
);
|
||||
@@ -265,7 +265,7 @@ class MobileContactUsState extends State<MobileContactUs> {
|
||||
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}',
|
||||
),
|
||||
)
|
||||
);
|
||||
@@ -273,8 +273,8 @@ class MobileContactUsState extends State<MobileContactUs> {
|
||||
_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)
|
||||
@@ -290,8 +290,8 @@ class MobileContactUsState extends State<MobileContactUs> {
|
||||
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,
|
||||
|
||||
@@ -24,7 +24,7 @@ class MobileCoupons extends StatefulWidget {
|
||||
}
|
||||
|
||||
class MobileCouponsState extends State<MobileCoupons> {
|
||||
List<Coupon> coupons;
|
||||
late List<Coupon> coupons;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
@@ -97,7 +97,7 @@ class MobileCouponsState extends State<MobileCoupons> {
|
||||
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,
|
||||
) :
|
||||
@@ -114,7 +114,7 @@ class MobileCouponsState extends State<MobileCoupons> {
|
||||
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,
|
||||
@@ -198,7 +198,7 @@ class MobileCouponsState extends State<MobileCoupons> {
|
||||
),
|
||||
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(
|
||||
@@ -236,7 +236,7 @@ class MobileCouponsState extends State<MobileCoupons> {
|
||||
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(
|
||||
@@ -261,7 +261,7 @@ class MobileCouponsState extends State<MobileCoupons> {
|
||||
),
|
||||
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');
|
||||
}
|
||||
|
||||
@@ -43,12 +43,12 @@ class MobileEditAddressState extends State<MobileEditAddress> {
|
||||
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;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
@@ -366,7 +366,7 @@ class MobileEditAddressState extends State<MobileEditAddress> {
|
||||
.email,
|
||||
),
|
||||
validator: (String? value) {
|
||||
if (value.isNotEmpty && !EmailValidator.validate(value)) {
|
||||
if (value!.isNotEmpty && !EmailValidator.validate(value)) {
|
||||
return S
|
||||
.of(context)
|
||||
.email_is_not_valid;
|
||||
|
||||
@@ -28,9 +28,9 @@ class MobileForgotPasswordState extends State<MobileForgotPassword> {
|
||||
bool usernameEnable = true;
|
||||
final codeController = TextEditingController();
|
||||
|
||||
bool enableGetCode;
|
||||
String getCodeText;
|
||||
bool canRegister;
|
||||
late bool enableGetCode;
|
||||
late String getCodeText;
|
||||
late bool canRegister;
|
||||
|
||||
var countDownListener;
|
||||
|
||||
@@ -91,7 +91,7 @@ class MobileForgotPasswordState extends State<MobileForgotPassword> {
|
||||
),
|
||||
autofocus: true,
|
||||
validator: (String? value) {
|
||||
if (value.trim().isEmpty) {
|
||||
if (value!.trim().isEmpty) {
|
||||
return S.of(context).mobile_or_email_is_required;
|
||||
}
|
||||
return null;
|
||||
@@ -174,7 +174,7 @@ class MobileForgotPasswordState extends State<MobileForgotPassword> {
|
||||
fontSize: 18.0
|
||||
),
|
||||
validator: (String? value) {
|
||||
if (value.trim().isEmpty) {
|
||||
if (value!.trim().isEmpty) {
|
||||
return S.of(context).verification_code_is_required;
|
||||
}
|
||||
return null;
|
||||
|
||||
@@ -26,9 +26,9 @@ class MobileLoginState extends State<MobileLogin> {
|
||||
|
||||
final usernameController = TextEditingController();
|
||||
final passwordController = TextEditingController();
|
||||
bool passwordVisible;
|
||||
late bool passwordVisible;
|
||||
|
||||
bool onSubmitting;
|
||||
late bool onSubmitting;
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
@@ -104,7 +104,7 @@ class MobileLoginState extends State<MobileLogin> {
|
||||
),
|
||||
autofocus: true,
|
||||
validator: (String? value) {
|
||||
if (value.trim().isEmpty) {
|
||||
if (value!.trim().isEmpty) {
|
||||
return S.of(context).this_field_is_required;
|
||||
}
|
||||
return null;
|
||||
@@ -144,7 +144,7 @@ class MobileLoginState extends State<MobileLogin> {
|
||||
),
|
||||
obscureText: passwordVisible,
|
||||
validator: (String? value) {
|
||||
if (value.trim().isEmpty) {
|
||||
if (value!.trim().isEmpty) {
|
||||
return S.of(context).password_is_required;
|
||||
}
|
||||
return null;
|
||||
|
||||
@@ -20,9 +20,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 MobileMe extends StatefulWidget {
|
||||
final Key? key;
|
||||
@@ -36,18 +36,18 @@ class MobileMe extends StatefulWidget {
|
||||
}
|
||||
|
||||
class MobileMeState extends State<MobileMe> {
|
||||
int userId;
|
||||
String accessToken;
|
||||
late int userId;
|
||||
late String accessToken;
|
||||
|
||||
bool isLoading;
|
||||
User _user;
|
||||
late bool isLoading;
|
||||
late User _user;
|
||||
|
||||
ShopScrollCoordinator _shopCoordinator;
|
||||
ShopScrollController _pageScrollController;
|
||||
late ShopScrollCoordinator _shopCoordinator;
|
||||
late ShopScrollController _pageScrollController;
|
||||
final double _sliverAppBarInitHeight = 165.0;
|
||||
final double _appBarHeight = 85.0;
|
||||
|
||||
ShopScrollController _listScrollController1;
|
||||
late ShopScrollController _listScrollController1;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
@@ -88,7 +88,7 @@ class MobileMeState extends State<MobileMe> {
|
||||
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,
|
||||
@@ -219,7 +219,7 @@ class MobileMeState extends State<MobileMe> {
|
||||
Container(
|
||||
child: Text(
|
||||
_user != null
|
||||
? '${_user.wallet.toStringAsFixed(2)}'
|
||||
? '${_user.wallet!.toStringAsFixed(2)}'
|
||||
: '0.00',
|
||||
style: TextStyle(
|
||||
fontSize: 24.0,
|
||||
@@ -671,7 +671,7 @@ class MobileMeState extends State<MobileMe> {
|
||||
),
|
||||
onTap: () {
|
||||
if (_user != null) {
|
||||
if (_user.email == null || _user.email.isEmpty) {
|
||||
if (_user.email == null || _user.email!.isEmpty) {
|
||||
showDialog(
|
||||
context: context,
|
||||
builder: (BuildContext context) {
|
||||
|
||||
@@ -27,7 +27,7 @@ class MobileMyAddresses extends StatefulWidget {
|
||||
}
|
||||
|
||||
class MobileMyAddressesState extends State<MobileMyAddresses> {
|
||||
List<Address> addresses;
|
||||
late List<Address> addresses;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
|
||||
@@ -28,7 +28,7 @@ class MobileMySupport extends StatefulWidget {
|
||||
}
|
||||
|
||||
class MobileMySupportState extends State<MobileMySupport> {
|
||||
List<Ticket> tickets;
|
||||
late List<Ticket> tickets;
|
||||
|
||||
int _page = 1;
|
||||
int _pageCount = 1;
|
||||
@@ -179,7 +179,7 @@ class MobileMySupportState extends State<MobileMySupport> {
|
||||
children: <Widget>[
|
||||
Container(
|
||||
child: Text(
|
||||
ticket.issue.msg,
|
||||
ticket.issue!.msg,
|
||||
style: TextStyle(
|
||||
fontSize: 19.0,
|
||||
),
|
||||
@@ -208,7 +208,7 @@ class MobileMySupportState extends State<MobileMySupport> {
|
||||
) :
|
||||
SizedBox.shrink(),
|
||||
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,
|
||||
|
||||
@@ -36,9 +36,9 @@ class MobileNewAddressState extends State<MobileNewAddress> {
|
||||
final faxController = TextEditingController();
|
||||
|
||||
String country = 'CA';
|
||||
Gender _selectedGender;
|
||||
late Gender _selectedGender;
|
||||
|
||||
String _selectedProvince;
|
||||
late String _selectedProvince;
|
||||
|
||||
List<String> provinces = <String>[
|
||||
'Ontario',
|
||||
@@ -97,7 +97,7 @@ class MobileNewAddressState extends State<MobileNewAddress> {
|
||||
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;
|
||||
@@ -141,7 +141,7 @@ class MobileNewAddressState extends State<MobileNewAddress> {
|
||||
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;
|
||||
@@ -166,7 +166,7 @@ class MobileNewAddressState extends State<MobileNewAddress> {
|
||||
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;
|
||||
@@ -210,7 +210,7 @@ class MobileNewAddressState extends State<MobileNewAddress> {
|
||||
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;
|
||||
@@ -256,7 +256,7 @@ class MobileNewAddressState extends State<MobileNewAddress> {
|
||||
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;
|
||||
@@ -291,7 +291,7 @@ class MobileNewAddressState extends State<MobileNewAddress> {
|
||||
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;
|
||||
@@ -354,8 +354,8 @@ class MobileNewAddressState extends State<MobileNewAddress> {
|
||||
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';
|
||||
|
||||
@@ -31,13 +31,13 @@ class MobileNewComment extends StatefulWidget {
|
||||
}
|
||||
|
||||
class MobileNewCommentState extends State<MobileNewComment> {
|
||||
Comment comment;
|
||||
late Comment comment;
|
||||
|
||||
bool _showProgress;
|
||||
late bool _showProgress;
|
||||
|
||||
double _progress;
|
||||
late double _progress;
|
||||
|
||||
double rating;
|
||||
late double rating;
|
||||
|
||||
bool isSubmitting = false;
|
||||
|
||||
@@ -167,7 +167,7 @@ class MobileNewCommentState extends State<MobileNewComment> {
|
||||
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(
|
||||
@@ -239,7 +239,7 @@ class MobileNewCommentState extends State<MobileNewComment> {
|
||||
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,
|
||||
@@ -264,7 +264,7 @@ class MobileNewCommentState extends State<MobileNewComment> {
|
||||
),
|
||||
),
|
||||
onTap: () {
|
||||
if (comment == null || comment.images.length < 3) {
|
||||
if (comment == null || comment.images!.length < 3) {
|
||||
showDialog(
|
||||
context: mainContext,
|
||||
barrierDismissible: true,
|
||||
|
||||
@@ -111,7 +111,7 @@ class MobileNewTicketState extends State<MobileNewTicket> {
|
||||
),
|
||||
autofocus: true,
|
||||
validator: (String? value) {
|
||||
if (value.trim().isEmpty) {
|
||||
if (value!.trim().isEmpty) {
|
||||
return S.of(context).this_field_is_required;
|
||||
}
|
||||
return null;
|
||||
|
||||
@@ -28,9 +28,9 @@ class MobileNewUserState extends State<MobileNewUser> {
|
||||
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 MobileNewUserState extends State<MobileNewUser> {
|
||||
),
|
||||
autofocus: true,
|
||||
validator: (String? value) {
|
||||
if (value.trim().isEmpty) {
|
||||
if (value!.trim().isEmpty) {
|
||||
return S.of(context).mobile_or_email_is_required;
|
||||
}
|
||||
return null;
|
||||
@@ -171,7 +171,7 @@ class MobileNewUserState extends State<MobileNewUser> {
|
||||
fontSize: 18.0
|
||||
),
|
||||
validator: (String? value) {
|
||||
if (value.trim().isEmpty) {
|
||||
if (value!.trim().isEmpty) {
|
||||
return S.of(context).verification_code_is_required;
|
||||
}
|
||||
return null;
|
||||
|
||||
@@ -37,18 +37,18 @@ class MobileOrderDetail extends StatefulWidget {
|
||||
}
|
||||
|
||||
class MobileOrderDetailState extends State<MobileOrderDetail> {
|
||||
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;
|
||||
|
||||
Completer<GoogleMapController> _controller = Completer();
|
||||
|
||||
@@ -123,7 +123,7 @@ class MobileOrderDetailState extends State<MobileOrderDetail> {
|
||||
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(
|
||||
@@ -154,7 +154,7 @@ class MobileOrderDetailState extends State<MobileOrderDetail> {
|
||||
Icons.phone,
|
||||
),
|
||||
onTap: () {
|
||||
Utils.launchURL('tel:${order.businessInfo.phone}');
|
||||
Utils.launchURL('tel:${order.businessInfo!.phone}');
|
||||
},
|
||||
),
|
||||
),
|
||||
@@ -170,8 +170,8 @@ class MobileOrderDetailState extends State<MobileOrderDetail> {
|
||||
onMapCreated: _onMapCreated,
|
||||
initialCameraPosition: CameraPosition(
|
||||
target: LatLng(
|
||||
double.parse(order.shippingAddress.lat),
|
||||
double.parse(order.shippingAddress.lng)),
|
||||
double.parse(order.shippingAddress!.lat),
|
||||
double.parse(order.shippingAddress!.lng)),
|
||||
zoom: 11.0,
|
||||
),
|
||||
onCameraMove: _onCameraMove,
|
||||
@@ -182,14 +182,14 @@ class MobileOrderDetailState extends State<MobileOrderDetail> {
|
||||
].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(
|
||||
@@ -205,7 +205,7 @@ class MobileOrderDetailState extends State<MobileOrderDetail> {
|
||||
}
|
||||
}
|
||||
|
||||
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),
|
||||
@@ -213,7 +213,7 @@ class MobileOrderDetailState extends State<MobileOrderDetail> {
|
||||
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,
|
||||
@@ -251,7 +251,7 @@ class MobileOrderDetailState extends State<MobileOrderDetail> {
|
||||
width: 30.0,
|
||||
alignment: Alignment.centerRight,
|
||||
child: Text(
|
||||
'x${lineItem.quantity.round()}',
|
||||
'x${lineItem.quantity!.round()}',
|
||||
style: TextStyle(
|
||||
fontSize: 14.0,
|
||||
),
|
||||
@@ -313,8 +313,8 @@ class MobileOrderDetailState extends State<MobileOrderDetail> {
|
||||
],
|
||||
),
|
||||
);
|
||||
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,
|
||||
@@ -338,7 +338,7 @@ class MobileOrderDetailState extends State<MobileOrderDetail> {
|
||||
width: 100.0,
|
||||
alignment: Alignment.centerRight,
|
||||
child: Text(
|
||||
'${extraFee.price.toStringAsFixed(2)}',
|
||||
'${extraFee.price!.toStringAsFixed(2)}',
|
||||
style: TextStyle(
|
||||
fontSize: 15.0,
|
||||
),
|
||||
@@ -371,7 +371,7 @@ class MobileOrderDetailState extends State<MobileOrderDetail> {
|
||||
width: 100.0,
|
||||
alignment: Alignment.centerRight,
|
||||
child: Text(
|
||||
'${order.totalPrice.toStringAsFixed(2)}',
|
||||
'${order.totalPrice!.toStringAsFixed(2)}',
|
||||
style: TextStyle(
|
||||
fontSize: 18.0,
|
||||
fontWeight: FontWeight.bold,
|
||||
@@ -481,7 +481,7 @@ class MobileOrderDetailState extends State<MobileOrderDetail> {
|
||||
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,
|
||||
),
|
||||
@@ -908,19 +908,19 @@ class MobileOrderDetailState extends State<MobileOrderDetail> {
|
||||
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(
|
||||
@@ -1060,12 +1060,12 @@ class MobileOrderDetailState extends State<MobileOrderDetail> {
|
||||
|
||||
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(
|
||||
@@ -1078,7 +1078,7 @@ class MobileOrderDetailState extends State<MobileOrderDetail> {
|
||||
],
|
||||
width: 3,
|
||||
points: [
|
||||
order.shipperPosition.lat != 0.0 ? deliveryLatLng : storeLatLng,
|
||||
order.shipperPosition!.lat != 0.0 ? deliveryLatLng : storeLatLng,
|
||||
customerLatLng,
|
||||
]
|
||||
)
|
||||
@@ -1103,12 +1103,12 @@ class MobileOrderDetailState extends State<MobileOrderDetail> {
|
||||
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,
|
||||
|
||||
@@ -152,7 +152,7 @@ class MobileOrdersState extends State<MobileOrders> with SingleTickerProviderSta
|
||||
row.children.add(Expanded(
|
||||
child: Container(
|
||||
child: Text(
|
||||
order.cartInfo.productList[0].name,
|
||||
order.cartInfo!.productList![0].name,
|
||||
style: TextStyle(
|
||||
fontSize: 14.0,
|
||||
),
|
||||
@@ -161,7 +161,7 @@ class MobileOrdersState extends State<MobileOrders> with SingleTickerProviderSta
|
||||
),
|
||||
),
|
||||
));
|
||||
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)),
|
||||
@@ -176,7 +176,7 @@ class MobileOrdersState extends State<MobileOrders> with SingleTickerProviderSta
|
||||
width: 80.0,
|
||||
alignment: Alignment.centerRight,
|
||||
child: Text(
|
||||
'\$${order.totalPrice.toStringAsFixed(2)}',
|
||||
'\$${order.totalPrice!.toStringAsFixed(2)}',
|
||||
style: TextStyle(
|
||||
fontSize: 16.0,
|
||||
fontWeight: FontWeight.bold,
|
||||
@@ -291,7 +291,7 @@ class MobileOrdersState extends State<MobileOrders> with SingleTickerProviderSta
|
||||
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,
|
||||
@@ -307,7 +307,7 @@ class MobileOrdersState extends State<MobileOrders> with SingleTickerProviderSta
|
||||
children: <Widget>[
|
||||
Container(
|
||||
child: Text(
|
||||
'${order.cartInfo.businessInfo.name}',
|
||||
'${order.cartInfo!.businessInfo!.name}',
|
||||
style: TextStyle(
|
||||
fontSize: 20.0,
|
||||
),
|
||||
|
||||
@@ -30,9 +30,9 @@ class MobilePayNow extends StatefulWidget {
|
||||
}
|
||||
|
||||
class MobilePayNowState extends State<MobilePayNow> {
|
||||
Order order;
|
||||
List<PaymentPlatform> paymentPlatforms;
|
||||
User _user;
|
||||
late Order order;
|
||||
late List<PaymentPlatform> paymentPlatforms;
|
||||
late User _user;
|
||||
|
||||
|
||||
@override
|
||||
@@ -74,7 +74,7 @@ class MobilePayNowState extends State<MobilePayNow> {
|
||||
),
|
||||
),
|
||||
Text(
|
||||
'\$${order.totalPrice.toStringAsFixed(2)}',
|
||||
'\$${order.totalPrice!.toStringAsFixed(2)}',
|
||||
style: TextStyle(
|
||||
fontSize: 24.0,
|
||||
fontWeight: FontWeight.bold,
|
||||
@@ -91,7 +91,7 @@ class MobilePayNowState extends State<MobilePayNow> {
|
||||
)
|
||||
),
|
||||
),
|
||||
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),
|
||||
|
||||
@@ -23,10 +23,10 @@ import '../../widgets/general/add_remove_button.dart';
|
||||
import '../../widgets/general/carousel.dart';
|
||||
import '../../widgets/general/show_price.dart';
|
||||
|
||||
MediaQueryData mediaQuery;
|
||||
double statusBarHeight;
|
||||
double screenHeight;
|
||||
double screenWidth;
|
||||
late MediaQueryData mediaQuery;
|
||||
late double statusBarHeight;
|
||||
late double screenHeight;
|
||||
late double screenWidth;
|
||||
|
||||
class MobileProductDetailPage extends StatefulWidget {
|
||||
final Business business;
|
||||
@@ -44,18 +44,18 @@ class MobileProductDetailPage extends StatefulWidget {
|
||||
|
||||
class MobileProductDetailPageState extends State<MobileProductDetailPage>
|
||||
with SingleTickerProviderStateMixin {
|
||||
ShopScrollCoordinator _shopCoordinator;
|
||||
ShopScrollController _pageScrollController;
|
||||
late ShopScrollCoordinator _shopCoordinator;
|
||||
late ShopScrollController _pageScrollController;
|
||||
|
||||
TabController _tabController;
|
||||
late TabController _tabController;
|
||||
|
||||
double _sliverAppBarInitHeight;
|
||||
double _sliverAppBarMaxHeight;
|
||||
late double _sliverAppBarInitHeight;
|
||||
late double _sliverAppBarMaxHeight;
|
||||
final double _tabBarHeight = 50;
|
||||
|
||||
ProductDetail productDetail;
|
||||
late ProductDetail productDetail;
|
||||
|
||||
bool refresh;
|
||||
late bool refresh;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
@@ -204,7 +204,7 @@ class MobileProductDetailPageState extends State<MobileProductDetailPage>
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: <Widget>[
|
||||
(productDetail.subproducts.length > 0) ?
|
||||
(productDetail.subproducts!.length > 0) ?
|
||||
subProducts(productDetail.subproducts) :
|
||||
SizedBox.shrink(),
|
||||
Container(
|
||||
@@ -219,7 +219,7 @@ class MobileProductDetailPageState extends State<MobileProductDetailPage>
|
||||
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(
|
||||
@@ -343,7 +343,7 @@ class MobileProductDetailPageState extends State<MobileProductDetailPage>
|
||||
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,
|
||||
@@ -363,7 +363,7 @@ class MobileProductDetailPageState extends State<MobileProductDetailPage>
|
||||
child: Container(
|
||||
padding: EdgeInsets.only(left: 12, top: 5),
|
||||
child: Text(
|
||||
subproduct.product.name,
|
||||
subproduct.product!.name,
|
||||
style: TextStyle(
|
||||
fontSize: 15.0,
|
||||
),
|
||||
@@ -374,7 +374,7 @@ class MobileProductDetailPageState extends State<MobileProductDetailPage>
|
||||
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,
|
||||
@@ -386,7 +386,7 @@ class MobileProductDetailPageState extends State<MobileProductDetailPage>
|
||||
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,
|
||||
),
|
||||
@@ -398,7 +398,7 @@ class MobileProductDetailPageState extends State<MobileProductDetailPage>
|
||||
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,
|
||||
@@ -419,9 +419,9 @@ class MobileProductDetailPageState extends State<MobileProductDetailPage>
|
||||
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++) {
|
||||
|
||||
@@ -98,7 +98,7 @@ class MobileProductItemState extends State<MobileProductItem> {
|
||||
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
|
||||
),
|
||||
|
||||
@@ -97,7 +97,7 @@ class MobileRenewLicenseState extends State<MobileRenewLicense> {
|
||||
),
|
||||
autofocus: true,
|
||||
validator: (String? value) {
|
||||
if (value.trim().isEmpty) {
|
||||
if (value!.trim().isEmpty) {
|
||||
return S.of(context).please_enter_group_number;
|
||||
}
|
||||
return null;
|
||||
|
||||
@@ -104,7 +104,7 @@ class MobileRenewMiniOfficeState extends State<MobileRenewMiniOffice> {
|
||||
);
|
||||
}
|
||||
|
||||
Widget buildLine(String name, String value, {double nameSize, double valueSize}) {
|
||||
Widget buildLine(String name, String value, {double? nameSize, double? valueSize}) {
|
||||
Row row = Row(
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
|
||||
@@ -27,10 +27,10 @@ class MobileResetPasswordState extends State<MobileResetPassword> {
|
||||
final passwordController = TextEditingController();
|
||||
final passwordAgainController = TextEditingController();
|
||||
|
||||
bool passwordVisible;
|
||||
bool passwordAgainVisible;
|
||||
late bool passwordVisible;
|
||||
late bool passwordAgainVisible;
|
||||
|
||||
bool canReset;
|
||||
late bool canReset;
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
@@ -105,7 +105,7 @@ class MobileResetPasswordState extends State<MobileResetPassword> {
|
||||
fontSize: 18.0
|
||||
),
|
||||
validator: (String? value) {
|
||||
if (value.trim().isEmpty) {
|
||||
if (value!.trim().isEmpty) {
|
||||
return S.of(context).password_is_required;
|
||||
}
|
||||
return null;
|
||||
@@ -159,10 +159,10 @@ class MobileResetPasswordState extends State<MobileResetPassword> {
|
||||
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;
|
||||
|
||||
@@ -107,7 +107,7 @@ class MobileSearchPlaceState extends State<MobileSearchPlace> {
|
||||
);
|
||||
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);
|
||||
}
|
||||
|
||||
@@ -28,10 +28,10 @@ class MobileSetPasswordState extends State<MobileSetPassword> {
|
||||
final passwordController = TextEditingController();
|
||||
final passwordAgainController = TextEditingController();
|
||||
|
||||
bool passwordVisible;
|
||||
bool passwordAgainVisible;
|
||||
late bool passwordVisible;
|
||||
late bool passwordAgainVisible;
|
||||
|
||||
bool canReset;
|
||||
late bool canReset;
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
@@ -106,7 +106,7 @@ class MobileSetPasswordState extends State<MobileSetPassword> {
|
||||
fontSize: 18.0
|
||||
),
|
||||
validator: (String? value) {
|
||||
if (value.trim().isEmpty) {
|
||||
if (value!.trim().isEmpty) {
|
||||
return S.of(context).password_is_required;
|
||||
}
|
||||
return null;
|
||||
@@ -160,10 +160,10 @@ class MobileSetPasswordState extends State<MobileSetPassword> {
|
||||
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;
|
||||
|
||||
@@ -105,7 +105,7 @@ class MobileStoreProductSearchState extends State<MobileStoreProductSearch> {
|
||||
);
|
||||
if (result is DioError) {
|
||||
if (result.response != null) {
|
||||
throw RuntimeError(result.response.data);
|
||||
throw RuntimeError(result.response!.data);
|
||||
} else {
|
||||
throw RuntimeError(result.message);
|
||||
}
|
||||
|
||||
@@ -27,10 +27,10 @@ class MobileUserProfile extends StatefulWidget {
|
||||
}
|
||||
|
||||
class MobileUserProfileState extends State<MobileUserProfile> {
|
||||
User _user;
|
||||
late User _user;
|
||||
|
||||
bool _showProgress;
|
||||
double _progress;
|
||||
late bool _showProgress;
|
||||
late double _progress;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
@@ -229,7 +229,7 @@ class MobileUserProfileState extends State<MobileUserProfile> {
|
||||
),
|
||||
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,
|
||||
),
|
||||
@@ -282,7 +282,7 @@ class MobileUserProfileState extends State<MobileUserProfile> {
|
||||
),
|
||||
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,
|
||||
),
|
||||
@@ -393,7 +393,7 @@ class MobileUserProfileState extends State<MobileUserProfile> {
|
||||
),
|
||||
autofocus: true,
|
||||
validator: (String? value) {
|
||||
if (value.trim().isEmpty) {
|
||||
if (value!.trim().isEmpty) {
|
||||
return S.of(context).nickname_is_required;
|
||||
}
|
||||
return null;
|
||||
|
||||
@@ -28,7 +28,7 @@ class MobileViewBlog extends StatefulWidget {
|
||||
}
|
||||
|
||||
class MobileViewBlogState extends State<MobileViewBlog> {
|
||||
Blog blog;
|
||||
late Blog blog;
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
|
||||
@@ -34,7 +34,7 @@ class MobileViewTicket extends StatefulWidget {
|
||||
class MobileViewTicketState extends State<MobileViewTicket> {
|
||||
final GlobalKey<FormState> _formKey = GlobalKey<FormState>();
|
||||
|
||||
Ticket ticket;
|
||||
late Ticket ticket;
|
||||
|
||||
final issueMsgController = TextEditingController();
|
||||
|
||||
@@ -123,7 +123,7 @@ class MobileViewTicketState extends State<MobileViewTicket> {
|
||||
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,
|
||||
@@ -141,7 +141,7 @@ class MobileViewTicketState extends State<MobileViewTicket> {
|
||||
Container(
|
||||
width: double.maxFinite,
|
||||
padding: EdgeInsets.only(top: 16.0, bottom: 16.0, left: 16.0, right: 16.0),
|
||||
child: showGalleryImages(mainContext, ticket.issue.files),
|
||||
child: showGalleryImages(mainContext, ticket.issue!.files),
|
||||
decoration: BoxDecoration(
|
||||
border: Border(
|
||||
bottom: BorderSide(
|
||||
@@ -171,7 +171,7 @@ class MobileViewTicketState extends State<MobileViewTicket> {
|
||||
],
|
||||
);
|
||||
|
||||
if (ticket.followUps.length > 0) {
|
||||
if (ticket.followUps!.length > 0) {
|
||||
view.children.add(
|
||||
Container(
|
||||
width: double.maxFinite,
|
||||
@@ -185,8 +185,8 @@ class MobileViewTicketState extends State<MobileViewTicket> {
|
||||
),
|
||||
),
|
||||
);
|
||||
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];
|
||||
view.children.add(
|
||||
Container(
|
||||
width: double.maxFinite,
|
||||
@@ -294,7 +294,7 @@ class MobileViewTicketState extends State<MobileViewTicket> {
|
||||
),
|
||||
autofocus: false,
|
||||
validator: (String? value) {
|
||||
if (value.trim().isEmpty) {
|
||||
if (value!.trim().isEmpty) {
|
||||
return S.of(context).this_field_is_required;
|
||||
}
|
||||
return null;
|
||||
@@ -353,7 +353,7 @@ class MobileViewTicketState extends State<MobileViewTicket> {
|
||||
),
|
||||
);
|
||||
|
||||
if (ticket.followUps.length > 0) {
|
||||
if (ticket.followUps!.length > 0) {
|
||||
view.children.add(
|
||||
Container(
|
||||
width: double.maxFinite,
|
||||
@@ -393,7 +393,7 @@ class MobileViewTicketState extends State<MobileViewTicket> {
|
||||
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}',
|
||||
),
|
||||
),
|
||||
);
|
||||
@@ -690,7 +690,7 @@ class MobileViewTicketState extends State<MobileViewTicket> {
|
||||
child: Text(S.of(context).ok),
|
||||
onPressed: () {
|
||||
Routes.router.navigateTo(context,
|
||||
'/my-support/${ticket.store.id}',
|
||||
'/my-support/${ticket.store!.id}',
|
||||
replace: true,
|
||||
);
|
||||
},
|
||||
|
||||
@@ -64,7 +64,7 @@ class ProductItemState extends State<ProductItem> {
|
||||
width: widget.imageWidth,
|
||||
height: widget.imageWidth,
|
||||
child: GestureDetector(
|
||||
child: onHover && widget.product.secondImagePath.isNotEmpty ?
|
||||
child: onHover && widget.product.secondImagePath!.isNotEmpty ?
|
||||
Util.showImage('${widget.product.secondImagePath}',
|
||||
fit: BoxFit.fill,
|
||||
) :
|
||||
@@ -127,7 +127,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
|
||||
),
|
||||
@@ -157,7 +157,7 @@ class ProductItemState extends State<ProductItem> {
|
||||
width: widget.imageWidth,
|
||||
height: widget.imageWidth,
|
||||
child: GestureDetector(
|
||||
child: onHover && widget.product.secondImagePath.isNotEmpty ?
|
||||
child: onHover && widget.product.secondImagePath!.isNotEmpty ?
|
||||
Util.showImage('${widget.product.secondImagePath}',
|
||||
fit: BoxFit.fill,
|
||||
) :
|
||||
@@ -212,7 +212,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
|
||||
),
|
||||
|
||||
@@ -113,7 +113,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);
|
||||
}
|
||||
|
||||
@@ -37,10 +37,10 @@ import 'product_item.dart';
|
||||
import 'product_search.dart';
|
||||
import 'shopping_cart_bar.dart';
|
||||
|
||||
MediaQueryData mediaQuery;
|
||||
double statusBarHeight;
|
||||
double screenWidth;
|
||||
double screenHeight;
|
||||
late MediaQueryData mediaQuery;
|
||||
late double statusBarHeight;
|
||||
late double screenWidth;
|
||||
late double screenHeight;
|
||||
|
||||
class Shop extends StatefulWidget {
|
||||
final int businessId;
|
||||
@@ -56,10 +56,10 @@ class ShopState extends State<Shop>
|
||||
|
||||
GlobalKey<ScaffoldState> _scaffoldKey = new GlobalKey<ScaffoldState>();
|
||||
|
||||
Business _business;
|
||||
List<CategoryProducts> _categoryProducts;
|
||||
List<Product> _featuredProducts;
|
||||
List<Product> _hotSaleProducts;
|
||||
late Business _business;
|
||||
late List<CategoryProducts> _categoryProducts;
|
||||
late List<Product> _featuredProducts;
|
||||
late List<Product> _hotSaleProducts;
|
||||
|
||||
List<dynamic> _prompts = [];
|
||||
bool checkCloseFlag = false;
|
||||
@@ -79,22 +79,22 @@ class ShopState extends State<Shop>
|
||||
|
||||
bool refresh = false;
|
||||
|
||||
ShopScrollCoordinator _shopCoordinator;
|
||||
ShopScrollController _pageScrollController;
|
||||
TabController _tabController;
|
||||
late ShopScrollCoordinator _shopCoordinator;
|
||||
late ShopScrollController _pageScrollController;
|
||||
late TabController _tabController;
|
||||
final double _sliverAppBarInitHeight = 150.0;
|
||||
final double _tabBarHeight = 50.0;
|
||||
double _sliverAppBarMaxHeight;
|
||||
late double _sliverAppBarMaxHeight;
|
||||
|
||||
ShopScrollController _listScrollController1;
|
||||
ShopScrollController _listScrollController2;
|
||||
ShopScrollController _listScrollController3;
|
||||
late ShopScrollController _listScrollController1;
|
||||
late ShopScrollController _listScrollController2;
|
||||
late ShopScrollController _listScrollController3;
|
||||
|
||||
AnimationPointManager _animationPointManager = AnimationPointManager();
|
||||
GlobalKey stackKey = GlobalKey();
|
||||
GlobalKey endKey = GlobalKey();
|
||||
|
||||
List<Comment> comments;
|
||||
late List<Comment> comments;
|
||||
int _commentPage = 1;
|
||||
int _commentPageCount = 1;
|
||||
bool _commentLoadingFinish = false;
|
||||
@@ -102,13 +102,13 @@ class ShopState extends State<Shop>
|
||||
RefreshController(initialRefresh: true);
|
||||
|
||||
PanelController panelController = PanelController();
|
||||
SlidingUpPanel _slidUpShoppingCart;
|
||||
late SlidingUpPanel _slidUpShoppingCart;
|
||||
|
||||
SliverPersistentHeader promotHeader;
|
||||
late SliverPersistentHeader promotHeader;
|
||||
|
||||
bool _animationFinish = true;
|
||||
|
||||
Carousel slidingGellery;
|
||||
late Carousel slidingGellery;
|
||||
|
||||
// StreamSubscription onProductWillAddToCartSubscription;
|
||||
// StreamSubscription onProductWillRemoveFromCartSubscription;
|
||||
@@ -247,7 +247,7 @@ class ShopState extends State<Shop>
|
||||
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,
|
||||
@@ -286,17 +286,17 @@ class ShopState extends State<Shop>
|
||||
GestureDetector(
|
||||
child: Container(
|
||||
child: Util.showImage(
|
||||
_business.promoProducts[i].imagePath,
|
||||
_business.promoProducts![i].imagePath,
|
||||
width: 110.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),
|
||||
@@ -306,13 +306,13 @@ class ShopState extends State<Shop>
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: <Widget>[
|
||||
ShowPrice(
|
||||
_business.promoProducts[i].price,
|
||||
_business.promoProducts![i].price,
|
||||
currencySign: '\$',
|
||||
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,
|
||||
),
|
||||
@@ -581,7 +581,7 @@ class ShopState extends State<Shop>
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
children: <Widget>[],
|
||||
);
|
||||
if (comment.images.length > 0) {
|
||||
if (comment.images!.length > 0) {
|
||||
for (ProductImage image in comment.images) {
|
||||
imageRow.children.add(
|
||||
GestureDetector(
|
||||
@@ -609,7 +609,7 @@ class ShopState extends State<Shop>
|
||||
}
|
||||
Widget replyWidget = SizedBox.shrink();
|
||||
if (comment.replyFromStore != null &&
|
||||
comment.replyFromStore.isNotEmpty) {
|
||||
comment.replyFromStore!.isNotEmpty) {
|
||||
replyWidget = Container(
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
@@ -681,7 +681,7 @@ class ShopState extends State<Shop>
|
||||
Container(
|
||||
child: SmoothStarRating(
|
||||
starCount: 5,
|
||||
rating: comment.rating.toDouble(),
|
||||
rating: comment.rating!.toDouble(),
|
||||
size: 12.0,
|
||||
filledIconData: Icons.star,
|
||||
color: Colors.green,
|
||||
@@ -772,18 +772,18 @@ class ShopState extends State<Shop>
|
||||
children: <Widget>[],
|
||||
);
|
||||
addressColumn.children.add(new Text(
|
||||
_business.address.addressLine1 +
|
||||
(_business.address.addressLine2.isNotEmpty
|
||||
? ' ' + _business.address.addressLine2
|
||||
_business.address!.addressLine1! +
|
||||
(_business.address!.addressLine2!.isNotEmpty
|
||||
? ' ' + _business.address!.addressLine2
|
||||
: ''),
|
||||
style: new TextStyle(fontSize: 13.0, color: const Color(0xFFEEEEEE)),
|
||||
));
|
||||
addressColumn.children.add(new Text(
|
||||
_business.address.city +
|
||||
_business.address!.city! +
|
||||
', ' +
|
||||
_business.address.state +
|
||||
_business.address!.state +
|
||||
', ' +
|
||||
_business.address.zip,
|
||||
_business.address!.zip,
|
||||
style: new TextStyle(fontSize: 13.0, color: const Color(0xFFEEEEEE)),
|
||||
));
|
||||
|
||||
@@ -800,16 +800,16 @@ class ShopState extends State<Shop>
|
||||
color: Colors.white,
|
||||
));
|
||||
distanceRow.children.add(new Text(
|
||||
_business.distanceInfo.distance != null
|
||||
? _business.distanceInfo.distance.text
|
||||
_business.distanceInfo!.distance != null
|
||||
? _business.distanceInfo!.distance!.text
|
||||
: '***' + ' / ',
|
||||
style: new TextStyle(color: const Color(0xFFEEEEEE), fontSize: 13.0),
|
||||
));
|
||||
var duration = Duration(
|
||||
seconds: (_business.distanceInfo.duration != null
|
||||
? _business.distanceInfo.duration.value
|
||||
: 30) +
|
||||
_business.shippingTime * 60);
|
||||
seconds: (_business.distanceInfo!.duration != null
|
||||
? _business.distanceInfo!.duration!.value
|
||||
: 30)! +
|
||||
_business.shippingTime! * 60);
|
||||
var hours = duration.inHours.remainder(60);
|
||||
var minutes = duration.inMinutes.remainder(60);
|
||||
distanceRow.children.add(new Text(
|
||||
@@ -910,9 +910,9 @@ class ShopState extends State<Shop>
|
||||
color: Colors.white,
|
||||
),
|
||||
new Text(
|
||||
_business.openingTime[0].openTime +
|
||||
_business.openingTime![0].openTime! +
|
||||
':00 - ' +
|
||||
_business.openingTime[0].closeTime +
|
||||
_business.openingTime![0].closeTime +
|
||||
':00',
|
||||
style: new TextStyle(
|
||||
fontSize: 13.0, color: const Color(0xFFEEEEEE)),
|
||||
@@ -941,7 +941,7 @@ class ShopState extends State<Shop>
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: <Widget>[
|
||||
_business.bulletin.isNotEmpty ? Row(
|
||||
_business.bulletin!.isNotEmpty ? Row(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: <Widget>[
|
||||
Container(
|
||||
@@ -956,7 +956,7 @@ class ShopState extends State<Shop>
|
||||
width: mediaQuery.size.width - 30.0,
|
||||
padding: EdgeInsets.only(right: 10.0, bottom: 10.0),
|
||||
child: new Text(
|
||||
_business.bulletin.isEmpty ? '' : _business.bulletin,
|
||||
_business.bulletin!.isEmpty ? '' : _business.bulletin,
|
||||
softWrap: true,
|
||||
style: new TextStyle(
|
||||
fontSize: 12.0, color: const Color(0xFFDDDDDD)),
|
||||
@@ -965,7 +965,7 @@ class ShopState extends State<Shop>
|
||||
),
|
||||
],
|
||||
) : SizedBox.shrink(),
|
||||
_business.description.isNotEmpty ? Column(
|
||||
_business.description!.isNotEmpty ? Column(
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
@@ -1009,7 +1009,7 @@ class ShopState extends State<Shop>
|
||||
padding: EdgeInsets.only(left: 10.0, right: 10.0, bottom: 10.0),
|
||||
child: slidingGellery,
|
||||
) : SizedBox.shrink(),
|
||||
_business.policy.isNotEmpty ? Column(
|
||||
_business.policy!.isNotEmpty ? Column(
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
@@ -1098,11 +1098,11 @@ class ShopState extends State<Shop>
|
||||
|
||||
List<Widget> _buildBanners(BuildContext context) {
|
||||
var pages = <Widget>[];
|
||||
for (var i = 0; i < _business.slideImages.length; i++) {
|
||||
for (var i = 0; i < _business.slideImages!.length; i++) {
|
||||
pages.add(new GestureDetector(
|
||||
child: new Container(
|
||||
child: Util.showImage(
|
||||
_business.slideImages[i].imageUrl,
|
||||
_business.slideImages![i].imageUrl,
|
||||
fit: BoxFit.cover,
|
||||
),
|
||||
),
|
||||
@@ -1139,11 +1139,11 @@ class ShopState extends State<Shop>
|
||||
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.round();
|
||||
for (var i = 0; i < cartInfo.productList!.length; i++) {
|
||||
if (cartInfo.productList![i].product!.categoryId == cp.id) {
|
||||
qtyInCategory += cartInfo.productList![i].quantity!.round();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1213,7 +1213,7 @@ class ShopState extends State<Shop>
|
||||
}
|
||||
|
||||
void _selectCategory(int index) {
|
||||
if (displayProductByCategoryClick && _categoryProducts[index].id > 0) {
|
||||
if (displayProductByCategoryClick && _categoryProducts[index].id! > 0) {
|
||||
categoryId = _categoryProducts[index].id;
|
||||
loadProducts();
|
||||
return;
|
||||
@@ -1221,7 +1221,7 @@ class ShopState extends State<Shop>
|
||||
double height = 0.0;
|
||||
for (int i = 0; i < index; ++i) {
|
||||
height += _categoryDescHeight +
|
||||
_categoryProducts[i].products.length * _productHeight;
|
||||
_categoryProducts[i].products!.length * _productHeight;
|
||||
}
|
||||
if (height > _listScrollController1.position.maxScrollExtent) {
|
||||
height = _listScrollController1.position.maxScrollExtent;
|
||||
@@ -1237,7 +1237,7 @@ class ShopState extends State<Shop>
|
||||
_categoryIndexChange = false;
|
||||
});
|
||||
print(
|
||||
'height: $height, index: $index, ${_categoryProducts[0].products.length}');
|
||||
'height: $height, index: $index, ${_categoryProducts[0].products!.length}');
|
||||
if (mounted) {
|
||||
setState(() {
|
||||
_categoryIndex = index;
|
||||
@@ -1272,7 +1272,7 @@ class ShopState extends State<Shop>
|
||||
if (height > 0) {
|
||||
for (int i = 0; i < _categoryProducts.length; ++i) {
|
||||
double categoryHeight = _categoryDescHeight +
|
||||
_categoryProducts[i].products.length * _productHeight;
|
||||
_categoryProducts[i].products!.length * _productHeight;
|
||||
if (height >= cHeight && height < cHeight + categoryHeight) {
|
||||
return i;
|
||||
}
|
||||
@@ -1311,7 +1311,7 @@ class ShopState extends State<Shop>
|
||||
int numCategoriesHasProducts() {
|
||||
int num = 0;
|
||||
for (CategoryProducts cp in _categoryProducts) {
|
||||
if (cp.products.length > 0) {
|
||||
if (cp.products!.length > 0) {
|
||||
num += 1;
|
||||
}
|
||||
}
|
||||
@@ -1362,7 +1362,7 @@ class ShopState extends State<Shop>
|
||||
});
|
||||
}
|
||||
|
||||
if (cp.products.length == 0) {
|
||||
if (cp.products!.length == 0) {
|
||||
return SizedBox.shrink();
|
||||
}
|
||||
|
||||
@@ -1403,7 +1403,7 @@ class ShopState extends State<Shop>
|
||||
),
|
||||
),
|
||||
new Visibility(
|
||||
visible: cp.description.isNotEmpty,
|
||||
visible: cp.description!.isNotEmpty,
|
||||
child: new Text(
|
||||
cp.description,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
@@ -1448,7 +1448,7 @@ class ShopState extends State<Shop>
|
||||
),
|
||||
);
|
||||
} else {
|
||||
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),
|
||||
@@ -1620,7 +1620,7 @@ class ShopState extends State<Shop>
|
||||
displayProductByCategoryClickIndicator =
|
||||
S.of(context).end_of_the_list;
|
||||
} else {
|
||||
if (moreCategoryProducts[0].products.length < Constants.ORDERS_PER_PAGE) {
|
||||
if (moreCategoryProducts[0].products!.length < Constants.ORDERS_PER_PAGE) {
|
||||
_productCurrentPage = 0;
|
||||
displayProductByCategoryClickIndicator =
|
||||
S.of(context).end_of_the_list;
|
||||
@@ -1631,7 +1631,7 @@ class ShopState extends State<Shop>
|
||||
CategoryProducts currentCp =
|
||||
getCategoryProductByCategoryId(categoryId);
|
||||
if (currentCp != null) {
|
||||
currentCp.products.addAll(moreCategoryProducts[0].products);
|
||||
currentCp.products!.addAll(moreCategoryProducts[0].products);
|
||||
} else {
|
||||
_productCurrentPage = 0;
|
||||
displayProductByCategoryClickIndicator =
|
||||
@@ -1653,16 +1653,16 @@ class ShopState extends State<Shop>
|
||||
}
|
||||
|
||||
CartLineItem _newCartLineItem(
|
||||
{int id,
|
||||
double price,
|
||||
Product product,
|
||||
String name,
|
||||
String description,
|
||||
double quantity}) {
|
||||
{int? id,
|
||||
double? price,
|
||||
Product? product,
|
||||
String? name,
|
||||
String? description,
|
||||
double? quantity}) {
|
||||
CartLineItem lineItem = CartLineItem();
|
||||
lineItem.unitPrice = price;
|
||||
lineItem.product = product;
|
||||
lineItem.name = product.name;
|
||||
lineItem.name = product!.name;
|
||||
lineItem.description = description;
|
||||
lineItem.quantity = quantity;
|
||||
return lineItem;
|
||||
|
||||
@@ -35,21 +35,21 @@ class ShoppingCartBar extends StatefulWidget {
|
||||
}
|
||||
|
||||
class ShoppingCartBarState extends State<ShoppingCartBar> {
|
||||
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();
|
||||
}
|
||||
|
||||
Widget cartContent;
|
||||
|
||||
if (cartInfo == null || (cartInfo.businessInfo.id != widget.business.id)
|
||||
|| (totalPrice == 0.0 && cartInfo.productList.length == 0)) {
|
||||
if (cartInfo == null || (cartInfo.businessInfo!.id != widget.business.id)
|
||||
|| (totalPrice == 0.0 && cartInfo.productList!.length == 0)) {
|
||||
cartContent = Center(
|
||||
child: Container(
|
||||
padding: EdgeInsets.all(20.0),
|
||||
@@ -92,8 +92,8 @@ class ShoppingCartBarState extends State<ShoppingCartBar> {
|
||||
},
|
||||
),
|
||||
);
|
||||
for (var i = 0; i < cartInfo.productList.length; i++) {
|
||||
(cartContent as Column).children.add(cartLineItem(cartInfo.productList[i], i));
|
||||
for (var i = 0; i < cartInfo.productList!.length; i++) {
|
||||
(cartContent as Column).children.add(cartLineItem(cartInfo.productList![i], i));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -134,7 +134,7 @@ class ShoppingCartBarState extends State<ShoppingCartBar> {
|
||||
],
|
||||
),
|
||||
new Text(
|
||||
S.of(context).delivery_fee(widget.business.shippingFee.toStringAsFixed(2)),
|
||||
S.of(context).delivery_fee(widget.business.shippingFee!.toStringAsFixed(2)),
|
||||
style: new TextStyle(
|
||||
fontSize: 9.0,
|
||||
color: Style.backgroundColor,
|
||||
@@ -149,10 +149,10 @@ class ShoppingCartBarState extends State<ShoppingCartBar> {
|
||||
child: GestureDetector(
|
||||
child: Container(
|
||||
padding: EdgeInsets.all(10.0),
|
||||
color: widget.business.minPrice - totalPrice >= 0 ? new Color(0xFF535356) : Colors.lightGreen,
|
||||
color: widget.business.minPrice! - totalPrice >= 0 ? new Color(0xFF535356) : Colors.lightGreen,
|
||||
child: Center(
|
||||
child: Text(
|
||||
widget.business.minPrice - totalPrice >= 0 ? S.of(context).order_more((widget.business.minPrice - totalPrice).toStringAsFixed(2)) : S.of(context).checkout,
|
||||
widget.business.minPrice! - totalPrice >= 0 ? S.of(context).order_more((widget.business.minPrice! - totalPrice).toStringAsFixed(2)) : S.of(context).checkout,
|
||||
style: TextStyle(
|
||||
fontSize: 14.0,
|
||||
color: Style.backgroundColor,
|
||||
@@ -160,7 +160,7 @@ class ShoppingCartBarState extends State<ShoppingCartBar> {
|
||||
),
|
||||
),
|
||||
),
|
||||
onTap: widget.business.minPrice >= totalPrice ? null : () {
|
||||
onTap: widget.business.minPrice! >= totalPrice ? null : () {
|
||||
if (store.state.user != null) {
|
||||
Routes.router.navigateTo(context, '/checkout/${widget.business.id}');
|
||||
} else {
|
||||
@@ -255,7 +255,7 @@ class ShoppingCartBarState extends State<ShoppingCartBar> {
|
||||
widget.hasPicture ? Container(
|
||||
padding: EdgeInsets.all(6.0),
|
||||
child: Util.showImage(
|
||||
'${item.product.imagePath}',
|
||||
'${item.product!.imagePath}',
|
||||
width: 80,
|
||||
height: 80,
|
||||
fit: BoxFit.cover,
|
||||
@@ -300,7 +300,7 @@ class ShoppingCartBarState extends State<ShoppingCartBar> {
|
||||
children: <Widget>[
|
||||
Container(
|
||||
child: Text(
|
||||
'${item.totalPrice.toStringAsFixed(2)}',
|
||||
'${item.totalPrice!.toStringAsFixed(2)}',
|
||||
style: TextStyle(
|
||||
color: Colors.redAccent,
|
||||
fontSize: 14.0,
|
||||
|
||||
Reference in New Issue
Block a user