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,7 +30,7 @@ class BuyService extends StatefulWidget {
|
||||
}
|
||||
|
||||
class BuyServiceState extends State<BuyService> {
|
||||
Map<String, dynamic> data;
|
||||
late Map<String, dynamic> data;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
|
||||
@@ -22,7 +22,7 @@ class ContactUs extends StatefulWidget {
|
||||
}
|
||||
|
||||
class ContactUsState extends State<ContactUs> {
|
||||
Business business;
|
||||
late Business business;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
|
||||
@@ -30,7 +30,7 @@ class Download extends StatefulWidget {
|
||||
|
||||
class DownloadState extends State<Download> {
|
||||
final _scaffoldKey = GlobalKey<ScaffoldState>();
|
||||
Map<String, dynamic> data;
|
||||
late Map<String, dynamic> data;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
@@ -79,7 +79,7 @@ class DownloadState extends State<Download> {
|
||||
super.initState();
|
||||
eventBus.on<OpenDrawer>().listen((event) {
|
||||
if (mounted) {
|
||||
_scaffoldKey.currentState.openDrawer();
|
||||
_scaffoldKey.currentState!.openDrawer();
|
||||
}
|
||||
});
|
||||
_loadData();
|
||||
|
||||
@@ -26,7 +26,7 @@ class IGoShowLearnMore extends StatefulWidget {
|
||||
|
||||
class IGoShowLearnMoreState extends State<IGoShowLearnMore> {
|
||||
final _scaffoldKey = GlobalKey<ScaffoldState>();
|
||||
Map<String, dynamic> data;
|
||||
late Map<String, dynamic> data;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
|
||||
@@ -26,7 +26,7 @@ class MiniPosLearnMore extends StatefulWidget {
|
||||
|
||||
class MiniPosLearnMoreState extends State<MiniPosLearnMore> {
|
||||
final _scaffoldKey = GlobalKey<ScaffoldState>();
|
||||
Map<String, dynamic> data;
|
||||
late Map<String, dynamic> data;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
|
||||
@@ -23,7 +23,7 @@ class PlainPage extends StatefulWidget {
|
||||
}
|
||||
|
||||
class PlainPageState extends State<PlainPage> {
|
||||
Blog blog;
|
||||
late Blog blog;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
|
||||
@@ -25,7 +25,7 @@ class RenewMiniOffice extends StatefulWidget {
|
||||
}
|
||||
|
||||
class RenewMiniOfficeState extends State<RenewMiniOffice> {
|
||||
Map<String, dynamic> data;
|
||||
late Map<String, dynamic> data;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
|
||||
@@ -34,7 +34,7 @@ class DoubleBackToCloseApp extends StatefulWidget {
|
||||
|
||||
class _DoubleBackToCloseAppState extends State<DoubleBackToCloseApp> {
|
||||
/// The last time the user tapped Android's back-button.
|
||||
DateTime _lastTimeBackButtonWasTapped;
|
||||
late DateTime _lastTimeBackButtonWasTapped;
|
||||
|
||||
/// Returns whether the current platform is Android.
|
||||
bool get _isAndroid => Theme.of(context).platform == TargetPlatform.android;
|
||||
@@ -59,7 +59,7 @@ class _DoubleBackToCloseAppState extends State<DoubleBackToCloseApp> {
|
||||
/// local-history of the current route, in order to handle pop. This is done
|
||||
/// by [Drawer], for example, so it can close on pop.
|
||||
bool get _willHandlePopInternally =>
|
||||
ModalRoute.of(context).willHandlePopInternally;
|
||||
ModalRoute.of(context)!.willHandlePopInternally;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
|
||||
@@ -35,8 +35,8 @@ class HttpUtil {
|
||||
'Http-Contact-Authorization': '',
|
||||
'Http-Device-Type': Utils.getOs(checkWeb: true),
|
||||
'Http-Api-Branch': 'flutter',
|
||||
'Http-Language-Code': store.state.locale.languageCode,
|
||||
'Http-Country-Code': store.state.locale.countryCode ?? '',
|
||||
'Http-Language-Code': store.state.locale!.languageCode,
|
||||
'Http-Country-Code': store.state.locale!.countryCode ?? '',
|
||||
};
|
||||
|
||||
static Future<dynamic> httpGet(String url,
|
||||
|
||||
@@ -199,8 +199,8 @@ class Util {
|
||||
return box;
|
||||
}
|
||||
|
||||
static Widget showImage(String imageUrl, {double width, double height,
|
||||
BoxFit fit, Widget Function(BuildContext, String, dynamic) errorWidget}) {
|
||||
static Widget showImage(String imageUrl, {double? width, double? height,
|
||||
BoxFit? fit, Widget Function(BuildContext, String, dynamic)? errorWidget}) {
|
||||
if (imageUrl != null && imageUrl.isNotEmpty && imageUrl.startsWith('https:')) {
|
||||
return CachedNetworkImage(
|
||||
imageUrl: imageUrl,
|
||||
@@ -317,14 +317,14 @@ class Util {
|
||||
final picker = ImagePicker();
|
||||
var image = await picker.pickImage(source: ImageSource.gallery);
|
||||
Navigator.of(context).pop();
|
||||
uploadPicture(context, File(image.path), user, commentId: commentId, orderId: orderId);
|
||||
uploadPicture(context, File(image!.path), user, commentId: commentId, orderId: orderId);
|
||||
}
|
||||
|
||||
void getPictureFromCamera(BuildContext context, User user, {int commentId = -1, int orderId = 0}) async {
|
||||
final picker = ImagePicker();
|
||||
var image = await picker.pickImage(source: ImageSource.camera);
|
||||
Navigator.of(context).pop();
|
||||
uploadPicture(context, File(image.path), user, commentId: commentId, orderId: orderId);
|
||||
uploadPicture(context, File(image!.path), user, commentId: commentId, orderId: orderId);
|
||||
}
|
||||
|
||||
void uploadPicture(BuildContext context, File image, User user, {int commentId = -1, int orderId = 0}) async {
|
||||
@@ -454,18 +454,18 @@ class Util {
|
||||
ImagePicker picker = ImagePicker();
|
||||
var image = await picker.pickImage(source: ImageSource.gallery);
|
||||
Navigator.of(context).pop();
|
||||
onGotFile(imageId, image.path);
|
||||
onGotFile(imageId, image!.path);
|
||||
}
|
||||
|
||||
void getPictureFromCamera2(BuildContext context, int imageId, OnGotFile onGotFile) async {
|
||||
ImagePicker picker = ImagePicker();
|
||||
var image = await picker.pickImage(source: ImageSource.camera);
|
||||
Navigator.of(context).pop();
|
||||
onGotFile(imageId, image.path);
|
||||
onGotFile(imageId, image!.path);
|
||||
}
|
||||
|
||||
Future<void> createTicket(BuildContext context, String msg, List<Map<String, dynamic>> images,
|
||||
OnSuccess onSuccess, OnError onError, {int id}) {
|
||||
OnSuccess onSuccess, OnError onError, {int? id}) {
|
||||
var formData = FormData();
|
||||
formData.fields.add(MapEntry("msg", msg));
|
||||
formData.fields.add(MapEntry('id', id == null ? '0' : id.toString()));
|
||||
@@ -555,6 +555,6 @@ class Util {
|
||||
ByteData data = await rootBundle.load(path);
|
||||
ui.Codec codec = await ui.instantiateImageCodec(data.buffer.asUint8List(), targetWidth: width);
|
||||
ui.FrameInfo fi = await codec.getNextFrame();
|
||||
return (await fi.image.toByteData(format: ui.ImageByteFormat.png)).buffer.asUint8List();
|
||||
return (await fi.image.toByteData(format: ui.ImageByteFormat.png))!.buffer.asUint8List();
|
||||
}
|
||||
}
|
||||
@@ -35,12 +35,12 @@ class CreateOnlineStore1State extends State<CreateOnlineStore1> {
|
||||
bool canSubmit = false;
|
||||
|
||||
List<dynamic> stores = [];
|
||||
Map<String, dynamic> service;
|
||||
late Map<String, dynamic> service;
|
||||
dynamic selectedStore;
|
||||
|
||||
Group group;
|
||||
late Group group;
|
||||
|
||||
String selectedDomain;
|
||||
late String selectedDomain;
|
||||
List<dynamic> domainResult = [];
|
||||
|
||||
@override
|
||||
@@ -284,7 +284,7 @@ class CreateOnlineStore1State extends State<CreateOnlineStore1> {
|
||||
),
|
||||
autofocus: true,
|
||||
validator: (String? value) {
|
||||
if (value.trim().isEmpty) {
|
||||
if (value!.trim().isEmpty) {
|
||||
return S.of(context).domains_separated_comma;
|
||||
}
|
||||
return null;
|
||||
|
||||
@@ -34,7 +34,7 @@ class DesktopBlog extends StatefulWidget {
|
||||
}
|
||||
|
||||
class DesktopBlogState extends State<DesktopBlog> {
|
||||
List<Blog> blogs;
|
||||
late List<Blog> blogs;
|
||||
|
||||
double division = 2;
|
||||
|
||||
|
||||
@@ -27,7 +27,7 @@ class DesktopBuyServiceState extends State<DesktopBuyService> {
|
||||
double mainSpace = 1200;
|
||||
|
||||
List<KeyValue> plans = [];
|
||||
KeyValue selectedPlan;
|
||||
late KeyValue selectedPlan;
|
||||
double price = 0.0;
|
||||
double tax = 0.0;
|
||||
double paymentAmount = 0.0;
|
||||
|
||||
@@ -32,9 +32,9 @@ class DesktopChangeMobileOrEmailState extends State<DesktopChangeMobileOrEmail>
|
||||
bool usernameEnable = true;
|
||||
final codeController = TextEditingController();
|
||||
|
||||
bool enableGetCode;
|
||||
String getCodeText;
|
||||
bool canRegister;
|
||||
late bool enableGetCode;
|
||||
late String getCodeText;
|
||||
late bool canRegister;
|
||||
|
||||
var countDownListener;
|
||||
|
||||
@@ -88,7 +88,7 @@ class DesktopChangeMobileOrEmailState extends State<DesktopChangeMobileOrEmail>
|
||||
),
|
||||
autofocus: true,
|
||||
validator: (String? value) {
|
||||
if (value.trim().isEmpty) {
|
||||
if (value!.trim().isEmpty) {
|
||||
if (widget.isMobile) {
|
||||
return S
|
||||
.of(context)
|
||||
@@ -99,10 +99,10 @@ class DesktopChangeMobileOrEmailState extends State<DesktopChangeMobileOrEmail>
|
||||
.email_is_required;
|
||||
}
|
||||
}
|
||||
if (widget.isMobile && value.trim() == store.state.user.mobile) {
|
||||
if (widget.isMobile && value!.trim() == store.state.user!.mobile) {
|
||||
return S.of(context).the_mobile_number_is_same_as_current;
|
||||
}
|
||||
if (!widget.isMobile && value.trim() == store.state.user.email) {
|
||||
if (!widget.isMobile && value!.trim() == store.state.user!.email) {
|
||||
return S.of(context).the_email_is_same_as_current;
|
||||
}
|
||||
return null;
|
||||
@@ -185,7 +185,7 @@ class DesktopChangeMobileOrEmailState extends State<DesktopChangeMobileOrEmail>
|
||||
fontSize: 18.0
|
||||
),
|
||||
validator: (String? value) {
|
||||
if (value.trim().isEmpty) {
|
||||
if (value!.trim().isEmpty) {
|
||||
return S.of(context).verification_code_is_required;
|
||||
}
|
||||
return null;
|
||||
@@ -332,7 +332,7 @@ class DesktopChangeMobileOrEmailState extends State<DesktopChangeMobileOrEmail>
|
||||
},
|
||||
isFormData: true,
|
||||
body: {
|
||||
'id': store.state.user.id,
|
||||
'id': store.state.user!.id,
|
||||
'mobile': usernameController.text.trim(),
|
||||
'code': codeController.text.trim(),
|
||||
},
|
||||
@@ -344,8 +344,8 @@ class DesktopChangeMobileOrEmailState extends State<DesktopChangeMobileOrEmail>
|
||||
|
||||
void getCodeTapped() {
|
||||
if (usernameController.text.isNotEmpty &&
|
||||
((widget.isMobile && usernameController.text.trim() != store.state.user.mobile) ||
|
||||
(!widget.isMobile && usernameController.text.trim() != store.state.user.email))) {
|
||||
((widget.isMobile && usernameController.text.trim() != store.state.user!.mobile) ||
|
||||
(!widget.isMobile && usernameController.text.trim() != store.state.user!.email))) {
|
||||
HttpUtil.httpPost('v1/users', (response) {
|
||||
Fluttertoast.showToast(
|
||||
msg: S.of(context).verification_code_sent,
|
||||
@@ -366,7 +366,7 @@ class DesktopChangeMobileOrEmailState extends State<DesktopChangeMobileOrEmail>
|
||||
'action': 'change_mobile_email_send_code'
|
||||
},
|
||||
body: {
|
||||
'id': store.state.user.id,
|
||||
'id': store.state.user!.id,
|
||||
'mobile': usernameController.text,
|
||||
},
|
||||
isFormData: true,
|
||||
@@ -384,9 +384,9 @@ class DesktopChangeMobileOrEmailState extends State<DesktopChangeMobileOrEmail>
|
||||
errorMsg = S.of(context).mobile_is_required;
|
||||
} else if (!widget.isMobile && usernameController.text.trim().isEmpty) {
|
||||
errorMsg = S.of(context).email_is_required;
|
||||
} else if (widget.isMobile && usernameController.text.trim() == store.state.user.mobile) {
|
||||
} else if (widget.isMobile && usernameController.text.trim() == store.state.user!.mobile) {
|
||||
errorMsg = S.of(context).the_mobile_number_is_same_as_current;
|
||||
} else if (!widget.isMobile && usernameController.text.trim() == store.state.user.email) {
|
||||
} else if (!widget.isMobile && usernameController.text.trim() == store.state.user!.email) {
|
||||
errorMsg = S.of(context).the_email_is_same_as_current;
|
||||
}
|
||||
Fluttertoast.showToast(
|
||||
|
||||
@@ -24,10 +24,10 @@ class DesktopChangePasswordState extends State<DesktopChangePassword> {
|
||||
final passwordController = TextEditingController();
|
||||
final passwordAgainController = TextEditingController();
|
||||
|
||||
bool passwordVisible;
|
||||
bool passwordAgainVisible;
|
||||
late bool passwordVisible;
|
||||
late bool passwordAgainVisible;
|
||||
|
||||
bool canReset;
|
||||
late bool canReset;
|
||||
|
||||
double sideSpace = 0;
|
||||
double mainSpace = 1200;
|
||||
@@ -138,7 +138,7 @@ class DesktopChangePasswordState extends State<DesktopChangePassword> {
|
||||
fontSize: 18.0
|
||||
),
|
||||
validator: (String? value) {
|
||||
if (value.trim().isEmpty) {
|
||||
if (value!.trim().isEmpty) {
|
||||
return S.of(context).current_password_is_required;
|
||||
}
|
||||
return null;
|
||||
@@ -192,7 +192,7 @@ class DesktopChangePasswordState extends State<DesktopChangePassword> {
|
||||
fontSize: 18.0
|
||||
),
|
||||
validator: (String? value) {
|
||||
if (value.trim().isEmpty) {
|
||||
if (value!.trim().isEmpty) {
|
||||
return S.of(context).password_is_required;
|
||||
}
|
||||
return null;
|
||||
@@ -246,10 +246,10 @@ class DesktopChangePasswordState extends State<DesktopChangePassword> {
|
||||
fontSize: 18.0
|
||||
),
|
||||
validator: (String? value) {
|
||||
if (value.trim().isEmpty) {
|
||||
if (value!.trim().isEmpty) {
|
||||
return S.of(context).password_is_required;
|
||||
}
|
||||
if (value.trim() != passwordController.text.trim()) {
|
||||
if (value!.trim() != passwordController.text.trim()) {
|
||||
return S.of(context).password_is_not_match_password_again;
|
||||
}
|
||||
return null;
|
||||
@@ -338,7 +338,7 @@ class DesktopChangePasswordState extends State<DesktopChangePassword> {
|
||||
},
|
||||
isFormData: true,
|
||||
body: {
|
||||
'id': store.state.user.id,
|
||||
'id': store.state.user!.id,
|
||||
'old_password': oldPasswordController.text.trim(),
|
||||
'password': passwordController.text.trim(),
|
||||
}
|
||||
|
||||
@@ -222,7 +222,7 @@ class DesktopCheckoutState extends State<DesktopCheckout> with SingleTickerProvi
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
Text(
|
||||
'\$${(cartInfo.totalPrice - couponDiscountAmount).toStringAsFixed(2)}',
|
||||
'\$${(cartInfo.totalPrice! - couponDiscountAmount).toStringAsFixed(2)}',
|
||||
style: TextStyle(
|
||||
fontSize: 20.0,
|
||||
color: Colors.white,
|
||||
@@ -292,7 +292,7 @@ class DesktopCheckoutState extends State<DesktopCheckout> with SingleTickerProvi
|
||||
itemCount: 6,
|
||||
addAutomaticKeepAlives: true,
|
||||
itemBuilder: (BuildContext context, int position) {
|
||||
var deliveryTimeInSeconds = cartInfo.businessInfo.shippingTime * 60 + (durationInTraffic != null ? durationInTraffic.value : 0);
|
||||
var deliveryTimeInSeconds = cartInfo!.businessInfo!.shippingTime! * 60 + (durationInTraffic != null ? durationInTraffic!.value : 0);
|
||||
print('aaa: $deliveryTimeInSeconds');
|
||||
DateTime now = DateTime.now();
|
||||
var formatter = DateFormat('H:mm');
|
||||
@@ -366,7 +366,7 @@ class DesktopCheckoutState extends State<DesktopCheckout> with SingleTickerProvi
|
||||
);
|
||||
switch (position) {
|
||||
case 0:
|
||||
if (cartInfo.businessInfo.deliveryPickup) {
|
||||
if (cartInfo!.businessInfo!.deliveryPickup) {
|
||||
return Container(
|
||||
padding: EdgeInsets.only(
|
||||
top: 16.0, bottom: 16.0, left: 16.0, right: 16.0),
|
||||
@@ -380,8 +380,8 @@ class DesktopCheckoutState extends State<DesktopCheckout> with SingleTickerProvi
|
||||
),
|
||||
child: Container(
|
||||
alignment: Alignment.centerLeft,
|
||||
child: store.state.deviceId != null && store.state.deviceId.isNotEmpty ? (
|
||||
store.state.tableNumber != null && store.state.tableNumber.isNotEmpty ?
|
||||
child: store.state.deviceId != null && store.state.deviceId!.isNotEmpty ? (
|
||||
store.state.tableNumber != null && store.state.tableNumber!.isNotEmpty ?
|
||||
peopleCountSelection :
|
||||
SizedBox.shrink()
|
||||
) : Center(child: toggleSwitch,),
|
||||
@@ -394,8 +394,8 @@ class DesktopCheckoutState extends State<DesktopCheckout> with SingleTickerProvi
|
||||
}
|
||||
break;
|
||||
case 1:
|
||||
if (store.state.deviceId != null && store.state.deviceId.isNotEmpty ||
|
||||
store.state.tableNumber != null && store.state.tableNumber.isNotEmpty) {
|
||||
if (store.state.deviceId != null && store.state.deviceId!.isNotEmpty ||
|
||||
store.state.tableNumber != null && store.state.tableNumber!.isNotEmpty) {
|
||||
return SizedBox.shrink();
|
||||
}
|
||||
if (deliveryMethod == 'pickup') {
|
||||
@@ -414,7 +414,7 @@ class DesktopCheckoutState extends State<DesktopCheckout> with SingleTickerProvi
|
||||
Container(
|
||||
margin: EdgeInsets.only(top: 10.0),
|
||||
child: Text(
|
||||
cartInfo.businessInfo.name,
|
||||
cartInfo!.businessInfo!.name,
|
||||
style: TextStyle(
|
||||
fontSize: 17.0,
|
||||
),
|
||||
@@ -423,7 +423,7 @@ class DesktopCheckoutState extends State<DesktopCheckout> with SingleTickerProvi
|
||||
Container(
|
||||
margin: EdgeInsets.only(top: 5.0),
|
||||
child: Text(
|
||||
cartInfo.businessInfo.address.addressLine1,
|
||||
cartInfo!.businessInfo!.address!.addressLine1,
|
||||
style: TextStyle(
|
||||
fontSize: 14.0,
|
||||
color: Colors.black45,
|
||||
@@ -431,9 +431,9 @@ class DesktopCheckoutState extends State<DesktopCheckout> with SingleTickerProvi
|
||||
),
|
||||
),
|
||||
Container(
|
||||
child: cartInfo.businessInfo.address.addressLine2 != null
|
||||
&& cartInfo.businessInfo.address.addressLine2.length > 0 ?
|
||||
Text(cartInfo.businessInfo.address.addressLine2,
|
||||
child: cartInfo!.businessInfo!.address!.addressLine2 != null
|
||||
&& cartInfo!.businessInfo!.address!.addressLine2!.length > 0 ?
|
||||
Text(cartInfo!.businessInfo!.address!.addressLine2,
|
||||
style: TextStyle(
|
||||
fontSize: 14.0,
|
||||
color: Colors.black45,
|
||||
@@ -442,7 +442,7 @@ class DesktopCheckoutState extends State<DesktopCheckout> with SingleTickerProvi
|
||||
),
|
||||
Container(
|
||||
child: Text(
|
||||
'${cartInfo.businessInfo.address.city}, ${cartInfo.businessInfo.address.state}, ${cartInfo.businessInfo.address.zip}',
|
||||
'${cartInfo!.businessInfo!.address!.city}, ${cartInfo!.businessInfo!.address!.state}, ${cartInfo!.businessInfo!.address!.zip}',
|
||||
style: TextStyle(
|
||||
fontSize: 14.0,
|
||||
color: Colors.black45,
|
||||
@@ -452,7 +452,7 @@ class DesktopCheckoutState extends State<DesktopCheckout> with SingleTickerProvi
|
||||
Container(
|
||||
margin: EdgeInsets.only(top: 5.0),
|
||||
child: Text(
|
||||
'Tel: ${cartInfo.businessInfo.phone}',
|
||||
'Tel: ${cartInfo!.businessInfo!.phone}',
|
||||
style: TextStyle(
|
||||
fontSize: 15.0,
|
||||
color: Colors.black54,
|
||||
@@ -494,7 +494,7 @@ class DesktopCheckoutState extends State<DesktopCheckout> with SingleTickerProvi
|
||||
children: <Widget>[
|
||||
Container(
|
||||
child: Text(
|
||||
shipAddress != null ? shipAddress.fullAddress : S.of(context).enter_delivery_address,
|
||||
shipAddress != null ? shipAddress!.fullAddress : S.of(context).enter_delivery_address,
|
||||
style: TextStyle(
|
||||
fontSize: 16.0
|
||||
),
|
||||
@@ -505,7 +505,7 @@ class DesktopCheckoutState extends State<DesktopCheckout> with SingleTickerProvi
|
||||
Container(
|
||||
padding: EdgeInsets.only(top: 6.0),
|
||||
child: Text(
|
||||
shipAddress != null ? shipAddress.contactName + ' ' + shipAddress.phone : '',
|
||||
shipAddress != null ? shipAddress!.contactName! + ' ' + shipAddress!.phone : '',
|
||||
style: TextStyle(
|
||||
fontSize: 14.0,
|
||||
color: Colors.black38,
|
||||
@@ -529,13 +529,13 @@ class DesktopCheckoutState extends State<DesktopCheckout> with SingleTickerProvi
|
||||
),
|
||||
),
|
||||
onTap: () {
|
||||
Routes.router.navigateTo(context, '/my-addresses/${cartInfo.businessInfo.id}', replace: true);
|
||||
Routes.router.navigateTo(context, '/my-addresses/${cartInfo!.businessInfo!.id}', replace: true);
|
||||
},
|
||||
);
|
||||
break;
|
||||
case 2:
|
||||
if (deliveryMethod == 'pickup' || store.state.deviceId != null && store.state.deviceId.isNotEmpty ||
|
||||
store.state.tableNumber != null && store.state.tableNumber.isNotEmpty) {
|
||||
if (deliveryMethod == 'pickup' || store.state.deviceId != null && store.state.deviceId!.isNotEmpty ||
|
||||
store.state.tableNumber != null && store.state.tableNumber!.isNotEmpty) {
|
||||
return SizedBox.shrink();
|
||||
}
|
||||
if (deliveryMethod == 'canada-post') {
|
||||
@@ -578,7 +578,7 @@ class DesktopCheckoutState extends State<DesktopCheckout> with SingleTickerProvi
|
||||
alignment: Alignment.centerRight,
|
||||
child: Text(
|
||||
selectedShippingRate != null ?
|
||||
'${selectedShippingRate.name} \$${selectedShippingRate.price.toStringAsFixed(2)}' :
|
||||
'${selectedShippingRate!.name} \$${selectedShippingRate!.price!.toStringAsFixed(2)}' :
|
||||
S.of(context).please_select,
|
||||
style: TextStyle(
|
||||
fontSize: 15.0,
|
||||
@@ -608,7 +608,7 @@ class DesktopCheckoutState extends State<DesktopCheckout> with SingleTickerProvi
|
||||
},
|
||||
);
|
||||
}
|
||||
if (!cartInfo.businessInfo.instanceDelivery) {
|
||||
if (!cartInfo!.businessInfo!.instanceDelivery) {
|
||||
return Container(
|
||||
padding: EdgeInsets.only(left: 16.0, right: 16.0, top: 0.0, bottom: 16.0),
|
||||
child: Text(S.of(context).no_instance_delivery_desc),
|
||||
@@ -654,7 +654,7 @@ class DesktopCheckoutState extends State<DesktopCheckout> with SingleTickerProvi
|
||||
child: Text(
|
||||
bookingTimeList.length > 0 ? '${Utils.timestampToString(context, bookingTimeList[bookingTimeIndex].unixTime)}'
|
||||
: ((bookingTimeList.length == 0 && bookingDateTimeList.length == 0) ? ''
|
||||
: bookingDateTimeList[bookingDateIndex].viewDate + ' ' + (bookingDateTimeList[bookingDateIndex].bookTimes.length > 0 ? bookingDateTimeList[bookingDateIndex].bookTimes[bookingTimeIndex].viewTime : '')),
|
||||
: bookingDateTimeList[bookingDateIndex].viewDate! + ' ' + (bookingDateTimeList[bookingDateIndex].bookTimes!.length > 0 ? bookingDateTimeList[bookingDateIndex].bookTimes![bookingTimeIndex].viewTime : '')),
|
||||
),
|
||||
),
|
||||
Container(
|
||||
@@ -737,7 +737,7 @@ class DesktopCheckoutState extends State<DesktopCheckout> with SingleTickerProvi
|
||||
width: double.infinity,
|
||||
padding: EdgeInsets.only(bottom: 10.0),
|
||||
child: Text(
|
||||
cartInfo.businessInfo.name,
|
||||
cartInfo!.businessInfo!.name,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
style: TextStyle(
|
||||
fontSize: 16.0,
|
||||
@@ -756,9 +756,9 @@ class DesktopCheckoutState extends State<DesktopCheckout> with SingleTickerProvi
|
||||
|
||||
subtotal = 0.0;
|
||||
|
||||
for (var i = 0; i < cartInfo.productList.length; i++) {
|
||||
subtotal += cartInfo.productList[i].totalPrice;
|
||||
column.children.add(lineItem(cartInfo.productList[i]));
|
||||
for (var i = 0; i < cartInfo!.productList!.length; i++) {
|
||||
subtotal += cartInfo!.productList![i].totalPrice;
|
||||
column.children.add(lineItem(cartInfo!.productList![i]));
|
||||
}
|
||||
column.children.add(GestureDetector(
|
||||
child: Container(
|
||||
@@ -851,8 +851,8 @@ class DesktopCheckoutState extends State<DesktopCheckout> with SingleTickerProvi
|
||||
),
|
||||
));
|
||||
|
||||
if (cartInfo.extraFeeList.length > 0) {
|
||||
for (var i = 0; i < cartInfo.extraFeeList.length; i++) {
|
||||
if (cartInfo!.extraFeeList!.length > 0) {
|
||||
for (var i = 0; i < cartInfo!.extraFeeList!.length; i++) {
|
||||
column.children.add(Container(
|
||||
padding: EdgeInsets.only(bottom: 16.0),
|
||||
alignment: Alignment.centerRight,
|
||||
@@ -863,7 +863,7 @@ class DesktopCheckoutState extends State<DesktopCheckout> with SingleTickerProvi
|
||||
Container(
|
||||
alignment: Alignment.centerRight,
|
||||
child: Text(
|
||||
S.of(context).extra_fee_token(cartInfo.extraFeeList[i].name, cartInfo.extraFeeList[i].rate),
|
||||
S.of(context).extra_fee_token(cartInfo!.extraFeeList![i].name, cartInfo!.extraFeeList![i].rate),
|
||||
style: TextStyle(
|
||||
color: Colors.grey,
|
||||
),
|
||||
@@ -873,7 +873,7 @@ class DesktopCheckoutState extends State<DesktopCheckout> with SingleTickerProvi
|
||||
width: 100.0,
|
||||
alignment: Alignment.centerRight,
|
||||
child: Text(
|
||||
'${cartInfo.extraFeeList[i].price.toStringAsFixed(2)}'
|
||||
'${cartInfo!.extraFeeList![i].price!.toStringAsFixed(2)}'
|
||||
),
|
||||
),
|
||||
],
|
||||
@@ -901,7 +901,7 @@ class DesktopCheckoutState extends State<DesktopCheckout> with SingleTickerProvi
|
||||
width: 100.0,
|
||||
alignment: Alignment.centerRight,
|
||||
child: Text(
|
||||
'${(cartInfo.totalPrice - couponDiscountAmount).toStringAsFixed(2)}',
|
||||
'${(cartInfo!.totalPrice! - couponDiscountAmount).toStringAsFixed(2)}',
|
||||
style: TextStyle(
|
||||
fontSize: 19.0,
|
||||
fontWeight: FontWeight.bold,
|
||||
@@ -999,7 +999,7 @@ class DesktopCheckoutState extends State<DesktopCheckout> with SingleTickerProvi
|
||||
children: <Widget>[
|
||||
Container(
|
||||
padding: EdgeInsets.all(5.0),
|
||||
child: Util.showImage('${cartLineItem.product.imagePath}',
|
||||
child: Util.showImage('${cartLineItem.product!.imagePath}',
|
||||
width: 80.0,
|
||||
height: 80.0,
|
||||
fit: BoxFit.fill,
|
||||
@@ -1036,14 +1036,14 @@ class DesktopCheckoutState extends State<DesktopCheckout> with SingleTickerProvi
|
||||
alignment: Alignment.centerRight,
|
||||
margin: EdgeInsets.only(right: 10.0),
|
||||
child: Text(
|
||||
'x${cartLineItem.quantity.round()}',
|
||||
'x${cartLineItem.quantity!.round()}',
|
||||
),
|
||||
),
|
||||
Container(
|
||||
width: 60.0,
|
||||
alignment: Alignment.centerRight,
|
||||
child: Text(
|
||||
'${cartLineItem.totalPrice.toStringAsFixed(2)}',
|
||||
'${cartLineItem.totalPrice!.toStringAsFixed(2)}',
|
||||
),
|
||||
),
|
||||
],
|
||||
@@ -1099,7 +1099,7 @@ class DesktopCheckoutState extends State<DesktopCheckout> with SingleTickerProvi
|
||||
shippingRates = (response.data['shipping_rates'] as List).map((e) => ShippingRate.fromJson(e)).toList();
|
||||
selectedShippingRate = (response.data['selected_shipping_rate'] as String).length > 0 ? ShippingRate.fromJson(json.decode(response.data['selected_shipping_rate'])) : null;
|
||||
int i = 0;
|
||||
if (cartInfo.businessInfo.deliveryStoreDelivery) {
|
||||
if (cartInfo!.businessInfo!.deliveryStoreDelivery) {
|
||||
shippingMethodLabels.add(S.of(context).delivery);
|
||||
shippingMethodIcons.add(Icons.directions_car);
|
||||
if (deliveryMethod == 'store-delivery') {
|
||||
@@ -1107,7 +1107,7 @@ class DesktopCheckoutState extends State<DesktopCheckout> with SingleTickerProvi
|
||||
}
|
||||
i++;
|
||||
}
|
||||
if (cartInfo.businessInfo.deliveryCanadaPost) {
|
||||
if (cartInfo!.businessInfo!.deliveryCanadaPost) {
|
||||
shippingMethodLabels.add(S.of(context).canada_post);
|
||||
shippingMethodIcons.add(Icons.local_shipping);
|
||||
if (deliveryMethod == 'canada-post') {
|
||||
@@ -1115,7 +1115,7 @@ class DesktopCheckoutState extends State<DesktopCheckout> with SingleTickerProvi
|
||||
}
|
||||
i++;
|
||||
}
|
||||
if (cartInfo.businessInfo.deliveryPickup) {
|
||||
if (cartInfo!.businessInfo!.deliveryPickup) {
|
||||
shippingMethodLabels.add(S.of(context).pickup);
|
||||
shippingMethodIcons.add(Icons.store);
|
||||
if (deliveryMethod == 'pickup') {
|
||||
@@ -1335,14 +1335,14 @@ class DesktopCheckoutState extends State<DesktopCheckout> with SingleTickerProvi
|
||||
Expanded(
|
||||
child: SizedBox.expand(
|
||||
child: ListView.builder(
|
||||
itemCount: bookingDateTimeList[bookingDateIndex].bookTimes.length,
|
||||
itemCount: bookingDateTimeList[bookingDateIndex].bookTimes!.length,
|
||||
itemBuilder: (BuildContext context, int position) {
|
||||
BookingDateTime bookingDateTime = bookingDateTimeList[bookingDateIndex];
|
||||
return GestureDetector(
|
||||
child: Container(
|
||||
padding: EdgeInsets.only(left: 12.0, right: 12.0, top: 12.0, bottom: 12.0),
|
||||
child: Text(
|
||||
bookingDateTime.bookTimes[position].viewTime,
|
||||
bookingDateTime.bookTimes![position].viewTime,
|
||||
),
|
||||
decoration: BoxDecoration(
|
||||
border: Border(
|
||||
@@ -1467,16 +1467,16 @@ class DesktopCheckoutState extends State<DesktopCheckout> with SingleTickerProvi
|
||||
itemBuilder: (BuildContext context, int position) {
|
||||
PaymentPlatform paymentPlatform = paymentPlatforms[position];
|
||||
if (paymentPlatform.code == Constants.PAYMENT_METHOD_CODE_SQUARE &&
|
||||
(paymentPlatform.squareAppId == null || paymentPlatform.squareAppId.isEmpty) &&
|
||||
(paymentPlatform.squareAccessToken == null || paymentPlatform.squareAccessToken.isEmpty) &&
|
||||
(paymentPlatform.squareLocationId == null || paymentPlatform.squareLocationId.isEmpty)
|
||||
(paymentPlatform.squareAppId == null || paymentPlatform.squareAppId!.isEmpty) &&
|
||||
(paymentPlatform.squareAccessToken == null || paymentPlatform.squareAccessToken!.isEmpty) &&
|
||||
(paymentPlatform.squareLocationId == null || paymentPlatform.squareLocationId!.isEmpty)
|
||||
) {
|
||||
return SizedBox.shrink();
|
||||
}
|
||||
if (paymentPlatform.code == Constants.PAYMENT_METHOD_CODE_CHASE &&
|
||||
(paymentPlatform.xLogin == null || paymentPlatform.xLogin.isEmpty) &&
|
||||
(paymentPlatform.transactionKey == null || paymentPlatform.transactionKey.isEmpty) &&
|
||||
(paymentPlatform.responseKey == null || paymentPlatform.responseKey.isEmpty)
|
||||
(paymentPlatform.xLogin == null || paymentPlatform.xLogin!.isEmpty) &&
|
||||
(paymentPlatform.transactionKey == null || paymentPlatform.transactionKey!.isEmpty) &&
|
||||
(paymentPlatform.responseKey == null || paymentPlatform.responseKey!.isEmpty)
|
||||
) {
|
||||
return SizedBox.shrink();
|
||||
}
|
||||
@@ -1566,7 +1566,7 @@ class DesktopCheckoutState extends State<DesktopCheckout> with SingleTickerProvi
|
||||
|
||||
String getSelectedCouponName() {
|
||||
if (selectedCoupon == null) {
|
||||
if (coupons.length > 0) {
|
||||
if (coupons!.length > 0) {
|
||||
return S
|
||||
.of(context)
|
||||
.please_select;
|
||||
@@ -1578,10 +1578,10 @@ class DesktopCheckoutState extends State<DesktopCheckout> with SingleTickerProvi
|
||||
} else if (selectedCoupon == 0) {
|
||||
return S.of(context).dont_use;
|
||||
} else {
|
||||
for (var i = 0; i < coupons.length; i++) {
|
||||
if (selectedCoupon == coupons[i].id) {
|
||||
if (coupons[i].isPercentage) {
|
||||
return S.of(context).percentage_discount_token2(couponDiscountAmount.toStringAsFixed(2), coupons[i].valueAmount);
|
||||
for (var i = 0; i < coupons!.length; i++) {
|
||||
if (selectedCoupon == coupons![i].id) {
|
||||
if (coupons![i].isPercentage) {
|
||||
return S.of(context).percentage_discount_token2(couponDiscountAmount.toStringAsFixed(2), coupons![i].valueAmount);
|
||||
} else {
|
||||
return S.of(context).discount_amount_token(couponDiscountAmount.toStringAsFixed(2));
|
||||
}
|
||||
@@ -1700,13 +1700,13 @@ class DesktopCheckoutState extends State<DesktopCheckout> with SingleTickerProvi
|
||||
} else {
|
||||
widget.children.add(Expanded(
|
||||
child: ListView.builder(
|
||||
itemCount: coupons.length + 1,
|
||||
itemCount: coupons!.length + 1,
|
||||
itemBuilder: (BuildContext context, int position) {
|
||||
if (position == 0) {
|
||||
return GestureDetector(
|
||||
child: Container(
|
||||
decoration: selectedCoupon == 0 ? BoxDecoration(
|
||||
color: subtotal > cartInfo.businessInfo.minPrice ? Colors
|
||||
color: subtotal > cartInfo!.businessInfo!.minPrice ? Colors
|
||||
.transparent : Colors.black38,
|
||||
border: Border(
|
||||
top: BorderSide(
|
||||
@@ -1727,7 +1727,7 @@ class DesktopCheckoutState extends State<DesktopCheckout> with SingleTickerProvi
|
||||
),
|
||||
),
|
||||
) : BoxDecoration(
|
||||
color: subtotal > cartInfo.businessInfo.minPrice ? Colors
|
||||
color: subtotal > cartInfo!.businessInfo!.minPrice ? Colors
|
||||
.transparent : Colors.black38,
|
||||
),
|
||||
child: Row(
|
||||
@@ -1764,11 +1764,11 @@ class DesktopCheckoutState extends State<DesktopCheckout> with SingleTickerProvi
|
||||
},
|
||||
);
|
||||
} else {
|
||||
Coupon coupon = coupons[position - 1];
|
||||
Coupon coupon = coupons![position - 1];
|
||||
return GestureDetector(
|
||||
child: Container(
|
||||
decoration: selectedCoupon == coupon.id ? BoxDecoration(
|
||||
color: subtotal > cartInfo.businessInfo.minPrice ? Colors
|
||||
color: subtotal > cartInfo!.businessInfo!.minPrice ? Colors
|
||||
.transparent : Colors.black38,
|
||||
border: Border(
|
||||
top: BorderSide(
|
||||
@@ -1882,7 +1882,7 @@ class DesktopCheckoutState extends State<DesktopCheckout> with SingleTickerProvi
|
||||
),
|
||||
Container(
|
||||
child: Text(
|
||||
coupon.minAmount > 0 ?
|
||||
coupon.minAmount! > 0 ?
|
||||
S.of(context).min_order_amount_token(
|
||||
coupon.minAmount) :
|
||||
S.of(context)
|
||||
@@ -1942,7 +1942,7 @@ class DesktopCheckoutState extends State<DesktopCheckout> with SingleTickerProvi
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [],
|
||||
);
|
||||
if (cartInfo.businessInfo.quickInputs.length > 0) {
|
||||
if (cartInfo!.businessInfo!.quickInputs!.length > 0) {
|
||||
Wrap w = Wrap(
|
||||
children: [],
|
||||
);
|
||||
@@ -1956,8 +1956,8 @@ class DesktopCheckoutState extends State<DesktopCheckout> with SingleTickerProvi
|
||||
),
|
||||
),
|
||||
));
|
||||
for (int i = 0; i < cartInfo.businessInfo.quickInputs.length; i++) {
|
||||
String qi = cartInfo.businessInfo.quickInputs[i].value;
|
||||
for (int i = 0; i < cartInfo!.businessInfo!.quickInputs!.length; i++) {
|
||||
String qi = cartInfo!.businessInfo!.quickInputs![i].value;
|
||||
w.children.add(TextButton(
|
||||
child: Text(
|
||||
qi,
|
||||
@@ -2137,7 +2137,7 @@ class DesktopCheckoutState extends State<DesktopCheckout> with SingleTickerProvi
|
||||
child: Container(
|
||||
alignment: Alignment.centerRight,
|
||||
child: Text(
|
||||
'${shippingRate.price.toStringAsFixed(2)}',
|
||||
'${shippingRate.price!.toStringAsFixed(2)}',
|
||||
style: TextStyle(
|
||||
fontSize: 16.0,
|
||||
color: Colors.black38,
|
||||
@@ -2221,14 +2221,14 @@ class DesktopCheckoutState extends State<DesktopCheckout> with SingleTickerProvi
|
||||
},
|
||||
businessId: widget.businessId,
|
||||
body: {
|
||||
'cart_id': cartInfo.id,
|
||||
'cart_id': cartInfo!.id,
|
||||
'remark': orderRemark,
|
||||
'booked_at': bookingTimeList.length > 0
|
||||
? bookingTimeList[bookingTimeIndex].unixTime
|
||||
: (
|
||||
(bookingTimeList.length == 0 && bookingDateTimeList.length == 0) ?
|
||||
0 :
|
||||
bookingDateTimeList[bookingDateIndex].bookTimes[bookingTimeIndex]
|
||||
bookingDateTimeList[bookingDateIndex].bookTimes![bookingTimeIndex]
|
||||
.unixTime
|
||||
),
|
||||
'delivery': deliveryMethod,
|
||||
|
||||
@@ -35,7 +35,7 @@ class DesktopContactUsState extends State<DesktopContactUs> {
|
||||
String mapUrl = 'https://goo.gl/maps/M365MF5AW35n9ij67';
|
||||
|
||||
Completer<GoogleMapController> _controller = Completer();
|
||||
LatLng _lastMapPosition;
|
||||
late LatLng _lastMapPosition;
|
||||
final Set<Marker> _markers = {};
|
||||
final Set<Polyline> _polyLine = {};
|
||||
|
||||
@@ -253,16 +253,16 @@ class DesktopContactUsState extends State<DesktopContactUs> {
|
||||
Container(
|
||||
padding: EdgeInsets.only(left: 16, right: 16, top: 4, bottom: 4),
|
||||
child: Text(
|
||||
'${widget.business.address.addressLine1}',
|
||||
'${widget.business.address!.addressLine1}',
|
||||
),
|
||||
)
|
||||
);
|
||||
if (widget.business.address.addressLine2 != null && widget.business.address.addressLine2.isNotEmpty) {
|
||||
if (widget.business.address!.addressLine2 != null && widget.business.address!.addressLine2!.isNotEmpty) {
|
||||
col.children.add(
|
||||
Container(
|
||||
padding: EdgeInsets.only(left: 16, right: 16, top: 4, bottom: 4),
|
||||
child: Text(
|
||||
'${widget.business.address.addressLine2}',
|
||||
'${widget.business.address!.addressLine2}',
|
||||
),
|
||||
)
|
||||
);
|
||||
@@ -271,7 +271,7 @@ class DesktopContactUsState extends State<DesktopContactUs> {
|
||||
Container(
|
||||
padding: EdgeInsets.only(left: 16, right: 16, top: 4, bottom: 4),
|
||||
child: Text(
|
||||
'${widget.business.address.city}, ${widget.business.address.state}',
|
||||
'${widget.business.address!.city}, ${widget.business.address!.state}',
|
||||
),
|
||||
)
|
||||
);
|
||||
@@ -279,7 +279,7 @@ class DesktopContactUsState extends State<DesktopContactUs> {
|
||||
Container(
|
||||
padding: EdgeInsets.only(left: 16, right: 16, top: 4, bottom: 4),
|
||||
child: Text(
|
||||
'${widget.business.address.country}, ${widget.business.address.zip}',
|
||||
'${widget.business.address!.country}, ${widget.business.address!.zip}',
|
||||
),
|
||||
)
|
||||
);
|
||||
@@ -287,8 +287,8 @@ class DesktopContactUsState extends State<DesktopContactUs> {
|
||||
_markers.clear();
|
||||
_markers.add(Marker(
|
||||
markerId: MarkerId('shop_position'),
|
||||
position: LatLng(double.parse(widget.business.address.lat),
|
||||
double.parse(widget.business.address.lng)),
|
||||
position: LatLng(double.parse(widget.business.address!.lat),
|
||||
double.parse(widget.business.address!.lng)),
|
||||
infoWindow: InfoWindow(
|
||||
title: S
|
||||
.of(context)
|
||||
@@ -304,8 +304,8 @@ class DesktopContactUsState extends State<DesktopContactUs> {
|
||||
onMapCreated: _onMapCreated,
|
||||
initialCameraPosition: CameraPosition(
|
||||
target: LatLng(
|
||||
double.parse(widget.business.address.lat),
|
||||
double.parse(widget.business.address.lng)),
|
||||
double.parse(widget.business.address!.lat),
|
||||
double.parse(widget.business.address!.lng)),
|
||||
zoom: 14.0,
|
||||
),
|
||||
onCameraMove: _onCameraMove,
|
||||
|
||||
@@ -27,7 +27,7 @@ class DesktopCoupons extends StatefulWidget {
|
||||
}
|
||||
|
||||
class DesktopCouponsState extends State<DesktopCoupons> {
|
||||
List<Coupon> coupons;
|
||||
late List<Coupon> coupons;
|
||||
|
||||
double sideSpace = 0;
|
||||
double mainSpace = 1200;
|
||||
@@ -120,7 +120,7 @@ class DesktopCouponsState extends State<DesktopCoupons> {
|
||||
Container(
|
||||
padding: EdgeInsets.only(right: 5.0),
|
||||
child: coupon.store != null ?
|
||||
Util.showImage('${coupon.store.picUrl}',
|
||||
Util.showImage('${coupon.store!.picUrl}',
|
||||
fit: BoxFit.fill,
|
||||
width: 40.0,
|
||||
) :
|
||||
@@ -137,7 +137,7 @@ class DesktopCouponsState extends State<DesktopCoupons> {
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: <Widget>[
|
||||
Text(
|
||||
coupon.store != null ? coupon.store.name : S.of(context).general_coupon,
|
||||
coupon.store != null ? coupon.store!.name : S.of(context).general_coupon,
|
||||
style: TextStyle(
|
||||
fontSize: 20.0,
|
||||
fontWeight: FontWeight.bold,
|
||||
@@ -221,7 +221,7 @@ class DesktopCouponsState extends State<DesktopCoupons> {
|
||||
),
|
||||
Container(
|
||||
child: Text(
|
||||
coupon.minAmount > 0 ?
|
||||
coupon.minAmount! > 0 ?
|
||||
S.of(context).available_for_order_over_token(coupon.minAmount) :
|
||||
S.of(context).no_restriction,
|
||||
style: TextStyle(
|
||||
@@ -259,7 +259,7 @@ class DesktopCouponsState extends State<DesktopCoupons> {
|
||||
children: <Widget>[
|
||||
Container(
|
||||
child: Text(
|
||||
coupon.expirationDate == null || coupon.expirationDate.length == 0 ?
|
||||
coupon.expirationDate == null || coupon.expirationDate!.length == 0 ?
|
||||
S.of(context).no_expiration :
|
||||
S.of(context).expiration_date_token(coupon.expirationDate),
|
||||
style: TextStyle(
|
||||
@@ -284,7 +284,7 @@ class DesktopCouponsState extends State<DesktopCoupons> {
|
||||
),
|
||||
onPressed: () {
|
||||
if (coupon.store != null) {
|
||||
Routes.router.navigateTo(context, '/shop/${coupon.store.id}/na/na/na');
|
||||
Routes.router.navigateTo(context, '/shop/${coupon.store!.id}/na/na/na');
|
||||
} else {
|
||||
Routes.router.navigateTo(context, '/businesses');
|
||||
}
|
||||
|
||||
@@ -45,12 +45,12 @@ class DesktopEditAddressState extends State<DesktopEditAddress> {
|
||||
final emailController = TextEditingController();
|
||||
final faxController = TextEditingController();
|
||||
|
||||
String country;
|
||||
Gender _selectedGender;
|
||||
late String country;
|
||||
late Gender _selectedGender;
|
||||
|
||||
String _selectedProvince;
|
||||
late String _selectedProvince;
|
||||
|
||||
bool showLoading;
|
||||
late bool showLoading;
|
||||
|
||||
double sideSpace = 0;
|
||||
double mainSpace = 1200;
|
||||
@@ -362,7 +362,7 @@ class DesktopEditAddressState extends State<DesktopEditAddress> {
|
||||
.email,
|
||||
),
|
||||
validator: (String? value) {
|
||||
if (value.isNotEmpty && !EmailValidator.validate(value)) {
|
||||
if (value!.isNotEmpty && !EmailValidator.validate(value)) {
|
||||
return S
|
||||
.of(context)
|
||||
.email_is_not_valid;
|
||||
|
||||
@@ -29,9 +29,9 @@ class DesktopForgotPasswordState extends State<DesktopForgotPassword> {
|
||||
bool usernameEnable = true;
|
||||
final codeController = TextEditingController();
|
||||
|
||||
bool enableGetCode;
|
||||
String getCodeText;
|
||||
bool canRegister;
|
||||
late bool enableGetCode;
|
||||
late String getCodeText;
|
||||
late bool canRegister;
|
||||
|
||||
var countDownListener;
|
||||
|
||||
@@ -84,7 +84,7 @@ class DesktopForgotPasswordState extends State<DesktopForgotPassword> {
|
||||
),
|
||||
autofocus: true,
|
||||
validator: (String? value) {
|
||||
if (value.trim().isEmpty) {
|
||||
if (value!.trim().isEmpty) {
|
||||
return S.of(context).mobile_or_email_is_required;
|
||||
}
|
||||
return null;
|
||||
@@ -167,7 +167,7 @@ class DesktopForgotPasswordState extends State<DesktopForgotPassword> {
|
||||
fontSize: 18.0
|
||||
),
|
||||
validator: (String? value) {
|
||||
if (value.trim().isEmpty) {
|
||||
if (value!.trim().isEmpty) {
|
||||
return S.of(context).verification_code_is_required;
|
||||
}
|
||||
return null;
|
||||
|
||||
@@ -26,9 +26,9 @@ class DesktopLoginState extends State<DesktopLogin> {
|
||||
|
||||
final usernameController = TextEditingController();
|
||||
final passwordController = TextEditingController();
|
||||
bool passwordVisible;
|
||||
late bool passwordVisible;
|
||||
|
||||
bool onSubmitting;
|
||||
late bool onSubmitting;
|
||||
|
||||
double sideSpace = 0;
|
||||
double mainSpace = 1200;
|
||||
@@ -150,7 +150,7 @@ class DesktopLoginState extends State<DesktopLogin> {
|
||||
style: TextStyle(fontSize: 18.0),
|
||||
autofocus: true,
|
||||
validator: (String? value) {
|
||||
if (value.trim().isEmpty) {
|
||||
if (value!.trim().isEmpty) {
|
||||
return S.of(context).this_field_is_required;
|
||||
}
|
||||
return null;
|
||||
@@ -194,7 +194,7 @@ class DesktopLoginState extends State<DesktopLogin> {
|
||||
style: TextStyle(fontSize: 18.0),
|
||||
obscureText: passwordVisible,
|
||||
validator: (String? value) {
|
||||
if (value.trim().isEmpty) {
|
||||
if (value!.trim().isEmpty) {
|
||||
return S.of(context).password_is_required;
|
||||
}
|
||||
return null;
|
||||
|
||||
@@ -16,9 +16,9 @@ import '../../utils/util_web.dart'
|
||||
if (dart.library.io) '../../utils/util_io.dart';
|
||||
import '../../utils/utils.dart';
|
||||
|
||||
MediaQueryData mediaQuery;
|
||||
double statusBarHeight;
|
||||
double screenHeight;
|
||||
late MediaQueryData mediaQuery;
|
||||
late double statusBarHeight;
|
||||
late double screenHeight;
|
||||
|
||||
class DesktopMe extends StatefulWidget {
|
||||
final Key? key;
|
||||
@@ -32,11 +32,11 @@ class DesktopMe extends StatefulWidget {
|
||||
}
|
||||
|
||||
class DesktopMeState extends State<DesktopMe> {
|
||||
int userId;
|
||||
String accessToken;
|
||||
late int userId;
|
||||
late String accessToken;
|
||||
|
||||
bool isLoading;
|
||||
User _user;
|
||||
late bool isLoading;
|
||||
late User _user;
|
||||
|
||||
double sideSpace = 0;
|
||||
double mainSpace = 1200;
|
||||
@@ -81,7 +81,7 @@ class DesktopMeState extends State<DesktopMe> {
|
||||
children: <Widget>[
|
||||
Container(
|
||||
margin: EdgeInsets.only(right: 5.0),
|
||||
child: _user != null && _user.avatarUrl.isNotEmpty
|
||||
child: _user != null && _user.avatarUrl!.isNotEmpty
|
||||
? Util.showImage(
|
||||
'https:${_user.avatarUrl}',
|
||||
width: 60,
|
||||
@@ -182,7 +182,7 @@ class DesktopMeState extends State<DesktopMe> {
|
||||
Container(
|
||||
child: Text(
|
||||
_user != null
|
||||
? '${_user.wallet.toStringAsFixed(2)}'
|
||||
? '${_user.wallet!.toStringAsFixed(2)}'
|
||||
: '0.00',
|
||||
style: TextStyle(
|
||||
fontSize: 24.0,
|
||||
|
||||
@@ -30,7 +30,7 @@ class DesktopMyAddresses extends StatefulWidget {
|
||||
}
|
||||
|
||||
class DesktopMyAddressesState extends State<DesktopMyAddresses> {
|
||||
List<Address> addresses;
|
||||
late List<Address> addresses;
|
||||
|
||||
double sideSpace = 0;
|
||||
double mainSpace = 1200;
|
||||
|
||||
@@ -30,7 +30,7 @@ class DesktopMySupport extends StatefulWidget {
|
||||
}
|
||||
|
||||
class DesktopMySupportState extends State<DesktopMySupport> {
|
||||
List<Ticket> tickets;
|
||||
late List<Ticket> tickets;
|
||||
|
||||
double division = 3;
|
||||
|
||||
@@ -218,7 +218,7 @@ class DesktopMySupportState extends State<DesktopMySupport> {
|
||||
children: <Widget>[
|
||||
Container(
|
||||
child: Text(
|
||||
ticket.issue.msg,
|
||||
ticket.issue!.msg,
|
||||
style: TextStyle(
|
||||
fontSize: 19.0,
|
||||
),
|
||||
@@ -248,7 +248,7 @@ class DesktopMySupportState extends State<DesktopMySupport> {
|
||||
SizedBox.shrink(),
|
||||
Expanded(
|
||||
child: Text(
|
||||
S.of(context).followups_token(ticket.followUps.length),
|
||||
S.of(context).followups_token(ticket.followUps!.length),
|
||||
style: TextStyle(
|
||||
fontSize: 15.0,
|
||||
color: Colors.black87,
|
||||
|
||||
@@ -39,9 +39,9 @@ class DesktopNewAddressState extends State<DesktopNewAddress> {
|
||||
final faxController = TextEditingController();
|
||||
|
||||
String country = 'CA';
|
||||
Gender _selectedGender;
|
||||
late Gender _selectedGender;
|
||||
|
||||
String _selectedProvince;
|
||||
late String _selectedProvince;
|
||||
|
||||
double sideSpace = 0;
|
||||
double mainSpace = 1200;
|
||||
@@ -98,7 +98,7 @@ class DesktopNewAddressState extends State<DesktopNewAddress> {
|
||||
labelText: S.of(context).contact_name,
|
||||
),
|
||||
validator: (String? value) {
|
||||
if (value.trim().isEmpty) {
|
||||
if (value!.trim().isEmpty) {
|
||||
return S.of(context).contact_name_is_required;
|
||||
}
|
||||
return null;
|
||||
@@ -142,7 +142,7 @@ class DesktopNewAddressState extends State<DesktopNewAddress> {
|
||||
labelText: S.of(context).mobile_phone_number,
|
||||
),
|
||||
validator: (String? value) {
|
||||
if (value.trim().isEmpty) {
|
||||
if (value!.trim().isEmpty) {
|
||||
return S.of(context).mobile_phone_number_is_required;
|
||||
}
|
||||
return null;
|
||||
@@ -167,7 +167,7 @@ class DesktopNewAddressState extends State<DesktopNewAddress> {
|
||||
labelText: S.of(context).street_line_1,
|
||||
),
|
||||
validator: (String? value) {
|
||||
if (value.trim().isEmpty) {
|
||||
if (value!.trim().isEmpty) {
|
||||
return S.of(context).street_line_1_is_required;
|
||||
}
|
||||
return null;
|
||||
@@ -211,7 +211,7 @@ class DesktopNewAddressState extends State<DesktopNewAddress> {
|
||||
labelText: S.of(context).city,
|
||||
),
|
||||
validator: (String? value) {
|
||||
if (value.trim().isEmpty) {
|
||||
if (value!.trim().isEmpty) {
|
||||
return S.of(context).city_is_required;
|
||||
}
|
||||
return null;
|
||||
@@ -257,7 +257,7 @@ class DesktopNewAddressState extends State<DesktopNewAddress> {
|
||||
labelText: S.of(context).postal_code,
|
||||
),
|
||||
validator: (String? value) {
|
||||
if (value.trim().isEmpty) {
|
||||
if (value!.trim().isEmpty) {
|
||||
return S.of(context).postal_code_is_required;
|
||||
}
|
||||
return null;
|
||||
@@ -292,7 +292,7 @@ class DesktopNewAddressState extends State<DesktopNewAddress> {
|
||||
labelText: S.of(context).email,
|
||||
),
|
||||
validator: (String? value) {
|
||||
if (value.isNotEmpty && !EmailValidator.validate(value)) {
|
||||
if (value!.isNotEmpty && !EmailValidator.validate(value)) {
|
||||
return S.of(context).email_is_not_valid;
|
||||
}
|
||||
return null;
|
||||
@@ -383,8 +383,8 @@ class DesktopNewAddressState extends State<DesktopNewAddress> {
|
||||
cityController.text = widget.locatedAddress.city;
|
||||
postalCodeController.text = widget.locatedAddress.postalCode;
|
||||
streetLine1Controller.text = (widget.locatedAddress.streetNumber != null
|
||||
&& widget.locatedAddress.streetNumber.isNotEmpty
|
||||
? widget.locatedAddress.streetNumber + ' ' : '')
|
||||
&& widget.locatedAddress.streetNumber!.isNotEmpty
|
||||
? widget.locatedAddress.streetNumber! + ' ' : '')
|
||||
+ widget.locatedAddress.streetName;
|
||||
} else {
|
||||
_selectedProvince = 'Ontario';
|
||||
|
||||
@@ -34,13 +34,13 @@ class DesktopNewComment extends StatefulWidget {
|
||||
}
|
||||
|
||||
class DesktopNewCommentState extends State<DesktopNewComment> {
|
||||
Comment comment;
|
||||
late Comment comment;
|
||||
|
||||
bool _showProgress;
|
||||
late bool _showProgress;
|
||||
|
||||
double _progress;
|
||||
late double _progress;
|
||||
|
||||
double rating;
|
||||
late double rating;
|
||||
|
||||
bool isSubmitting = false;
|
||||
|
||||
@@ -203,7 +203,7 @@ class DesktopNewCommentState extends State<DesktopNewComment> {
|
||||
children: <Widget>[],
|
||||
);
|
||||
|
||||
if (comment != null && comment.images.length > 0) {
|
||||
if (comment != null && comment.images!.length > 0) {
|
||||
for (ProductImage image in comment.images) {
|
||||
row.children.add(
|
||||
Container(
|
||||
@@ -275,7 +275,7 @@ class DesktopNewCommentState extends State<DesktopNewComment> {
|
||||
child: Icon(
|
||||
Icons.add,
|
||||
size: 60.0,
|
||||
color: comment == null || comment.images.length < 3 ? Colors.lightBlue : Colors.black12,
|
||||
color: comment == null || comment.images!.length < 3 ? Colors.lightBlue : Colors.black12,
|
||||
),
|
||||
decoration: BoxDecoration(
|
||||
color: Colors.white70,
|
||||
@@ -300,7 +300,7 @@ class DesktopNewCommentState extends State<DesktopNewComment> {
|
||||
),
|
||||
),
|
||||
onTap: () {
|
||||
if (comment == null || comment.images.length < 3) {
|
||||
if (comment == null || comment.images!.length < 3) {
|
||||
showDialog(
|
||||
context: mainContext,
|
||||
barrierDismissible: true,
|
||||
|
||||
@@ -155,7 +155,7 @@ class DesktopNewTicketState extends State<DesktopNewTicket> {
|
||||
),
|
||||
autofocus: true,
|
||||
validator: (String? value) {
|
||||
if (value.trim().isEmpty) {
|
||||
if (value!.trim().isEmpty) {
|
||||
return S.of(context).this_field_is_required;
|
||||
}
|
||||
return null;
|
||||
|
||||
@@ -28,9 +28,9 @@ class DesktopNewUserState extends State<DesktopNewUser> {
|
||||
bool usernameEnable = true;
|
||||
final codeController = TextEditingController();
|
||||
|
||||
bool enableGetCode;
|
||||
String getCodeText;
|
||||
bool canRegister;
|
||||
late bool enableGetCode;
|
||||
late String getCodeText;
|
||||
late bool canRegister;
|
||||
|
||||
var countDownListener;
|
||||
|
||||
@@ -81,7 +81,7 @@ class DesktopNewUserState extends State<DesktopNewUser> {
|
||||
),
|
||||
autofocus: true,
|
||||
validator: (String? value) {
|
||||
if (value.trim().isEmpty) {
|
||||
if (value!.trim().isEmpty) {
|
||||
return S.of(context).mobile_or_email_is_required;
|
||||
}
|
||||
return null;
|
||||
@@ -164,7 +164,7 @@ class DesktopNewUserState extends State<DesktopNewUser> {
|
||||
fontSize: 18.0
|
||||
),
|
||||
validator: (String? value) {
|
||||
if (value.trim().isEmpty) {
|
||||
if (value!.trim().isEmpty) {
|
||||
return S.of(context).verification_code_is_required;
|
||||
}
|
||||
return null;
|
||||
|
||||
@@ -39,18 +39,18 @@ class DesktopOrderDetail extends StatefulWidget {
|
||||
}
|
||||
|
||||
class DesktopOrderDetailState extends State<DesktopOrderDetail> {
|
||||
Order order;
|
||||
late Order order;
|
||||
|
||||
LatLng _lastMapPosition;
|
||||
LatLng customerLatLng;
|
||||
LatLng deliveryLatLng;
|
||||
LatLng storeLatLng;
|
||||
late LatLng _lastMapPosition;
|
||||
late LatLng customerLatLng;
|
||||
late LatLng deliveryLatLng;
|
||||
late LatLng storeLatLng;
|
||||
final Set<Marker> _markers = {};
|
||||
final Set<Polyline> _polyLine = {};
|
||||
|
||||
BitmapDescriptor homeIcon;
|
||||
BitmapDescriptor deliveryIcon;
|
||||
BitmapDescriptor shopIcon;
|
||||
late BitmapDescriptor homeIcon;
|
||||
late BitmapDescriptor deliveryIcon;
|
||||
late BitmapDescriptor shopIcon;
|
||||
|
||||
double sideSpace = 0;
|
||||
double mainSpace = 1200;
|
||||
@@ -110,7 +110,7 @@ class DesktopOrderDetailState extends State<DesktopOrderDetail> {
|
||||
width: double.infinity,
|
||||
padding: EdgeInsets.only(top: 0.0, bottom: 16.0),
|
||||
child: Text(
|
||||
order.cartInfo.businessInfo.name,
|
||||
order.cartInfo!.businessInfo!.name,
|
||||
maxLines: 1,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
style: TextStyle(
|
||||
@@ -141,7 +141,7 @@ class DesktopOrderDetailState extends State<DesktopOrderDetail> {
|
||||
Icons.phone,
|
||||
),
|
||||
onTap: () {
|
||||
Utils.launchURL('tel:${order.businessInfo.phone}');
|
||||
Utils.launchURL('tel:${order.businessInfo!.phone}');
|
||||
},
|
||||
),
|
||||
),
|
||||
@@ -156,7 +156,7 @@ class DesktopOrderDetailState extends State<DesktopOrderDetail> {
|
||||
child: GoogleMap(
|
||||
onMapCreated: _onMapCreated,
|
||||
initialCameraPosition: CameraPosition(
|
||||
target: new LatLng(double.parse(order.shippingAddress.lat), double.parse(order.shippingAddress.lng)),
|
||||
target: new LatLng(double.parse(order.shippingAddress!.lat), double.parse(order.shippingAddress!.lng)),
|
||||
zoom: 11.0,
|
||||
),
|
||||
onCameraMove: _onCameraMove,
|
||||
@@ -167,14 +167,14 @@ class DesktopOrderDetailState extends State<DesktopOrderDetail> {
|
||||
].toSet(),
|
||||
),
|
||||
));
|
||||
if (order.deliveryDistance != null && order.deliveryDistance.distance != null) {
|
||||
if (order.deliveryDistance != null && order.deliveryDistance!.distance != null) {
|
||||
col.children.add(Container(
|
||||
padding: EdgeInsets.only(top: 6.0, bottom: 6.0),
|
||||
margin: EdgeInsets.only(bottom: 6.0),
|
||||
child: Text(
|
||||
S.of(context).delivery_distance_token(
|
||||
order.deliveryDistance.distance.text,
|
||||
order.deliveryDistance.duration.text
|
||||
order.deliveryDistance!.distance!.text,
|
||||
order.deliveryDistance!.duration!.text
|
||||
),
|
||||
),
|
||||
decoration: BoxDecoration(
|
||||
@@ -190,7 +190,7 @@ class DesktopOrderDetailState extends State<DesktopOrderDetail> {
|
||||
}
|
||||
}
|
||||
|
||||
for (CartLineItem lineItem in order.cartInfo.productList) {
|
||||
for (CartLineItem lineItem in order.cartInfo!.productList) {
|
||||
|
||||
col.children.add(Container(
|
||||
padding: EdgeInsets.only(top: 16.0, bottom: 0.0),
|
||||
@@ -198,7 +198,7 @@ class DesktopOrderDetailState extends State<DesktopOrderDetail> {
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: <Widget>[
|
||||
Util.showImage('${lineItem.product.imagePath}',
|
||||
Util.showImage('${lineItem.product!.imagePath}',
|
||||
width: 40.0,
|
||||
height: 40.0,
|
||||
fit: BoxFit.fill,
|
||||
@@ -236,7 +236,7 @@ class DesktopOrderDetailState extends State<DesktopOrderDetail> {
|
||||
width: 30.0,
|
||||
alignment: Alignment.centerRight,
|
||||
child: Text(
|
||||
'x${lineItem.quantity.round()}',
|
||||
'x${lineItem.quantity!.round()}',
|
||||
style: TextStyle(
|
||||
fontSize: 14.0,
|
||||
),
|
||||
@@ -298,8 +298,8 @@ class DesktopOrderDetailState extends State<DesktopOrderDetail> {
|
||||
],
|
||||
),
|
||||
);
|
||||
for (var i = 0; i < order.cartInfo.extraFeeList.length; i++) {
|
||||
ExtraFee extraFee = order.cartInfo.extraFeeList[i];
|
||||
for (var i = 0; i < order.cartInfo!.extraFeeList!.length; i++) {
|
||||
ExtraFee extraFee = order.cartInfo!.extraFeeList![i];
|
||||
col.children.add(
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
@@ -323,7 +323,7 @@ class DesktopOrderDetailState extends State<DesktopOrderDetail> {
|
||||
width: 100.0,
|
||||
alignment: Alignment.centerRight,
|
||||
child: Text(
|
||||
'${extraFee.price.toStringAsFixed(2)}',
|
||||
'${extraFee.price!.toStringAsFixed(2)}',
|
||||
style: TextStyle(
|
||||
fontSize: 15.0,
|
||||
),
|
||||
@@ -356,7 +356,7 @@ class DesktopOrderDetailState extends State<DesktopOrderDetail> {
|
||||
width: 100.0,
|
||||
alignment: Alignment.centerRight,
|
||||
child: Text(
|
||||
'${order.totalPrice.toStringAsFixed(2)}',
|
||||
'${order.totalPrice!.toStringAsFixed(2)}',
|
||||
style: TextStyle(
|
||||
fontSize: 18.0,
|
||||
fontWeight: FontWeight.bold,
|
||||
@@ -466,7 +466,7 @@ class DesktopOrderDetailState extends State<DesktopOrderDetail> {
|
||||
margin: EdgeInsets.only(top: 10.0, bottom: 10.0),
|
||||
alignment: Alignment.centerRight,
|
||||
child: Text(
|
||||
'${order.cartInfo.businessInfo.fullAddress}',
|
||||
'${order.cartInfo!.businessInfo!.fullAddress}',
|
||||
style: TextStyle(
|
||||
color: Colors.black38,
|
||||
),
|
||||
@@ -893,19 +893,19 @@ class DesktopOrderDetailState extends State<DesktopOrderDetail> {
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: <Widget>[
|
||||
Container(
|
||||
child: fulfillment.shippingMethod.isNotEmpty && fulfillment.trackingNumber != null && fulfillment.trackingNumber.isNotEmpty ?
|
||||
child: fulfillment.shippingMethod!.isNotEmpty && fulfillment.trackingNumber != null && fulfillment.trackingNumber!.isNotEmpty ?
|
||||
Text(
|
||||
'${fulfillment.shippingMethod} ${fulfillment.trackingNumber}',
|
||||
overflow: TextOverflow.ellipsis,
|
||||
maxLines: 1,
|
||||
) : (fulfillment.shippingMethod.isNotEmpty ? Text(
|
||||
) : (fulfillment.shippingMethod!.isNotEmpty ? Text(
|
||||
'${fulfillment.shippingMethod}',
|
||||
overflow: TextOverflow.ellipsis,
|
||||
maxLines: 1,
|
||||
) : SizedBox.shrink()),
|
||||
),
|
||||
Container(
|
||||
child: fulfillment.note != null && fulfillment.note.isNotEmpty ?
|
||||
child: fulfillment.note != null && fulfillment.note!.isNotEmpty ?
|
||||
Text(
|
||||
'${fulfillment.note}',
|
||||
style: TextStyle(
|
||||
@@ -1092,12 +1092,12 @@ class DesktopOrderDetailState extends State<DesktopOrderDetail> {
|
||||
|
||||
if (!kIsWeb) {
|
||||
if (order.shippingMethod == 'store-delivery' && order.status != Constants.STATUS_COMPLETE && order.status != Constants.STATUS_CANCELLED) {
|
||||
storeLatLng = LatLng(double.parse(order.businessInfo.address.lat),
|
||||
double.parse(order.businessInfo.address.lng));
|
||||
customerLatLng = LatLng(double.parse(order.shippingAddress.lat),
|
||||
double.parse(order.shippingAddress.lng));
|
||||
storeLatLng = LatLng(double.parse(order.businessInfo!.address!.lat),
|
||||
double.parse(order.businessInfo!.address!.lng));
|
||||
customerLatLng = LatLng(double.parse(order.shippingAddress!.lat),
|
||||
double.parse(order.shippingAddress!.lng));
|
||||
deliveryLatLng =
|
||||
LatLng(order.shipperPosition.lat, order.shipperPosition.lng);
|
||||
LatLng(order.shipperPosition!.lat, order.shipperPosition!.lng);
|
||||
|
||||
_polyLine.clear();
|
||||
_polyLine.add(
|
||||
@@ -1110,7 +1110,7 @@ class DesktopOrderDetailState extends State<DesktopOrderDetail> {
|
||||
],
|
||||
width: 3,
|
||||
points: [
|
||||
order.shipperPosition.lat != 0.0 ? deliveryLatLng : storeLatLng,
|
||||
order.shipperPosition!.lat != 0.0 ? deliveryLatLng : storeLatLng,
|
||||
customerLatLng,
|
||||
]
|
||||
)
|
||||
@@ -1135,12 +1135,12 @@ class DesktopOrderDetailState extends State<DesktopOrderDetail> {
|
||||
title: S
|
||||
.of(context)
|
||||
.customer,
|
||||
snippet: order.shippingAddress.addressLine1,
|
||||
snippet: order.shippingAddress!.addressLine1,
|
||||
),
|
||||
icon: homeIcon,
|
||||
));
|
||||
if (order.shipperPosition.lat != 0.0 &&
|
||||
order.shipperPosition.lng != 0.0) {
|
||||
if (order.shipperPosition!.lat != 0.0 &&
|
||||
order.shipperPosition!.lng != 0.0) {
|
||||
_markers.add(Marker(
|
||||
markerId: MarkerId('shipper_position'),
|
||||
position: deliveryLatLng,
|
||||
|
||||
@@ -35,7 +35,7 @@ class DesktopOrders extends StatefulWidget {
|
||||
class DesktopOrdersState extends State<DesktopOrders> with SingleTickerProviderStateMixin {
|
||||
GlobalKey<ScaffoldState> _scaffoldKey = GlobalKey<ScaffoldState>();
|
||||
|
||||
List<Order> orders;
|
||||
late List<Order> orders;
|
||||
|
||||
bool _isLoading = false;
|
||||
|
||||
@@ -181,7 +181,7 @@ class DesktopOrdersState extends State<DesktopOrders> with SingleTickerProviderS
|
||||
row.children.add(Expanded(
|
||||
child: Container(
|
||||
child: Text(
|
||||
order.cartInfo.productList[0].name,
|
||||
order.cartInfo!.productList![0].name,
|
||||
style: TextStyle(
|
||||
fontSize: 14.0,
|
||||
),
|
||||
@@ -190,7 +190,7 @@ class DesktopOrdersState extends State<DesktopOrders> with SingleTickerProviderS
|
||||
),
|
||||
),
|
||||
));
|
||||
if (order.cartInfo.productList.length > 1) {
|
||||
if (order.cartInfo!.productList!.length > 1) {
|
||||
row.children.add(Container(
|
||||
child: Text(
|
||||
S.of(context).and_more_item_token(Utils.getProductLineInOrder(order.cartInfo)),
|
||||
@@ -205,7 +205,7 @@ class DesktopOrdersState extends State<DesktopOrders> with SingleTickerProviderS
|
||||
width: 80.0,
|
||||
alignment: Alignment.centerRight,
|
||||
child: Text(
|
||||
'\$${order.totalPrice.toStringAsFixed(2)}',
|
||||
'\$${order.totalPrice!.toStringAsFixed(2)}',
|
||||
style: TextStyle(
|
||||
fontSize: 16.0,
|
||||
fontWeight: FontWeight.bold,
|
||||
@@ -320,7 +320,7 @@ class DesktopOrdersState extends State<DesktopOrders> with SingleTickerProviderS
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
children: <Widget>[
|
||||
Container(
|
||||
child: Util.showImage('${order.cartInfo.businessInfo.picUrl}',
|
||||
child: Util.showImage('${order.cartInfo!.businessInfo!.picUrl}',
|
||||
width: 32.0,
|
||||
height: 32.0,
|
||||
fit: BoxFit.fill,
|
||||
@@ -336,7 +336,7 @@ class DesktopOrdersState extends State<DesktopOrders> with SingleTickerProviderS
|
||||
children: <Widget>[
|
||||
Container(
|
||||
child: Text(
|
||||
'${order.cartInfo.businessInfo.name}',
|
||||
'${order.cartInfo!.businessInfo!.name}',
|
||||
style: TextStyle(
|
||||
fontSize: 20.0,
|
||||
),
|
||||
|
||||
@@ -32,9 +32,9 @@ class DesktopPayNow extends StatefulWidget {
|
||||
}
|
||||
|
||||
class DesktopPayNowState extends State<DesktopPayNow> {
|
||||
Order order;
|
||||
List<PaymentPlatform> paymentPlatforms;
|
||||
User _user;
|
||||
late Order order;
|
||||
late List<PaymentPlatform> paymentPlatforms;
|
||||
late User _user;
|
||||
|
||||
double sideSpace = 0;
|
||||
double mainSpace = 1200;
|
||||
@@ -86,7 +86,7 @@ class DesktopPayNowState extends State<DesktopPayNow> {
|
||||
),
|
||||
),
|
||||
Text(
|
||||
'\$${order.totalPrice.toStringAsFixed(2)}',
|
||||
'\$${order.totalPrice!.toStringAsFixed(2)}',
|
||||
style: TextStyle(
|
||||
fontSize: 24.0,
|
||||
fontWeight: FontWeight.bold,
|
||||
@@ -103,7 +103,7 @@ class DesktopPayNowState extends State<DesktopPayNow> {
|
||||
)
|
||||
),
|
||||
),
|
||||
store.state.deviceId != null && store.state.deviceId.isNotEmpty || store.state.tableNumber != null && store.state.tableNumber.isNotEmpty ?
|
||||
store.state.deviceId != null && store.state.deviceId!.isNotEmpty || store.state.tableNumber != null && store.state.tableNumber!.isNotEmpty ?
|
||||
GestureDetector(
|
||||
child: Container(
|
||||
padding: EdgeInsets.only(top: 20.0, bottom: 20.0, left: 16.0, right: 16.0),
|
||||
|
||||
@@ -42,13 +42,13 @@ class DesktopProductDetailPage extends StatefulWidget {
|
||||
class DesktopProductDetailPageState extends State<DesktopProductDetailPage>
|
||||
with SingleTickerProviderStateMixin {
|
||||
|
||||
TabController _tabController;
|
||||
late TabController _tabController;
|
||||
|
||||
final double _tabBarHeight = 50;
|
||||
|
||||
ProductDetail productDetail;
|
||||
late ProductDetail productDetail;
|
||||
|
||||
bool refresh;
|
||||
late bool refresh;
|
||||
|
||||
double sideSpace = 0;
|
||||
double mainSpace = 1200;
|
||||
@@ -207,7 +207,7 @@ class DesktopProductDetailPageState extends State<DesktopProductDetailPage>
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: <Widget>[
|
||||
(productDetail.subproducts.length > 0) ?
|
||||
(productDetail.subproducts!.length > 0) ?
|
||||
subProducts(productDetail.subproducts) :
|
||||
SizedBox.shrink(),
|
||||
Container(
|
||||
@@ -222,7 +222,7 @@ class DesktopProductDetailPageState extends State<DesktopProductDetailPage>
|
||||
Container(
|
||||
padding: EdgeInsets.only(left: 10.0, right: 10.0),
|
||||
child: (productDetail.description2 != null &&
|
||||
!productDetail.description2.isEmpty)
|
||||
!productDetail.description2!.isEmpty)
|
||||
? Text(
|
||||
'${productDetail.description2}',
|
||||
style: TextStyle(
|
||||
@@ -299,7 +299,7 @@ class DesktopProductDetailPageState extends State<DesktopProductDetailPage>
|
||||
}
|
||||
|
||||
Widget getImage(double width) {
|
||||
if (productDetail.images.length <= 0) {
|
||||
if (productDetail.images!.length <= 0) {
|
||||
return Util.showImage(
|
||||
productDetail.image,
|
||||
width: width,
|
||||
@@ -346,7 +346,7 @@ class DesktopProductDetailPageState extends State<DesktopProductDetailPage>
|
||||
Container(
|
||||
padding: EdgeInsets.symmetric(horizontal: 12.0, vertical: 5.0),
|
||||
child: Util.showImage(
|
||||
'https:${subproduct.product.image}',
|
||||
'https:${subproduct.product!.image}',
|
||||
width: 48,
|
||||
height: 48,
|
||||
fit: BoxFit.contain,
|
||||
@@ -366,7 +366,7 @@ class DesktopProductDetailPageState extends State<DesktopProductDetailPage>
|
||||
child: Container(
|
||||
padding: EdgeInsets.only(left: 12, top: 5),
|
||||
child: Text(
|
||||
subproduct.product.name,
|
||||
subproduct.product!.name,
|
||||
style: TextStyle(
|
||||
fontSize: 15.0,
|
||||
),
|
||||
@@ -377,7 +377,7 @@ class DesktopProductDetailPageState extends State<DesktopProductDetailPage>
|
||||
width: 80,
|
||||
padding: EdgeInsets.only(left: 12, top: 5, right: 12),
|
||||
child: Text(
|
||||
'${subproduct.product.price.toStringAsFixed(2)}',
|
||||
'${subproduct.product!.price!.toStringAsFixed(2)}',
|
||||
style: TextStyle(
|
||||
fontSize: 13,
|
||||
decoration: TextDecoration.lineThrough,
|
||||
@@ -389,7 +389,7 @@ class DesktopProductDetailPageState extends State<DesktopProductDetailPage>
|
||||
width: 60,
|
||||
padding: EdgeInsets.only(left: 12, top: 5, right: 12),
|
||||
child: Text(
|
||||
'x${subproduct.quantity.toStringAsFixed(0)}',
|
||||
'x${subproduct.quantity!.toStringAsFixed(0)}',
|
||||
style: TextStyle(
|
||||
fontSize: 13,
|
||||
),
|
||||
@@ -401,7 +401,7 @@ class DesktopProductDetailPageState extends State<DesktopProductDetailPage>
|
||||
Container(
|
||||
padding: EdgeInsets.only(left: 12, top: 12, right: 12),
|
||||
child: Text(
|
||||
'${subproduct.product.description}',
|
||||
'${subproduct.product!.description}',
|
||||
style: TextStyle(
|
||||
fontSize: 12,
|
||||
color: Colors.black45,
|
||||
@@ -453,9 +453,9 @@ class DesktopProductDetailPageState extends State<DesktopProductDetailPage>
|
||||
var pages = <Widget>[];
|
||||
List<String> images = [];
|
||||
images.add(productDetail.image);
|
||||
for (var i = 0; i < productDetail.images.length; i++) {
|
||||
for (var i = 0; i < productDetail.images!.length; i++) {
|
||||
// print('>>https:' + productDetail.images[i].image);
|
||||
images.add(productDetail.images[i].image);
|
||||
images.add(productDetail.images![i].image);
|
||||
}
|
||||
|
||||
for (var i = 0; i < images.length; i++) {
|
||||
|
||||
@@ -109,7 +109,7 @@ class DesktopProductItemState extends State<DesktopProductItem> {
|
||||
new Container(
|
||||
child: widget.business.showMonthlySold ?
|
||||
Text(
|
||||
S.of(context).sold_per_month_token(widget.product.monthSales.toStringAsFixed(0)),
|
||||
S.of(context).sold_per_month_token(widget.product.monthSales!.toStringAsFixed(0)),
|
||||
style: new TextStyle(
|
||||
fontSize: 9.0
|
||||
),
|
||||
@@ -193,7 +193,7 @@ class DesktopProductItemState extends State<DesktopProductItem> {
|
||||
new Container(
|
||||
child: widget.business.showMonthlySold ?
|
||||
Text(
|
||||
S.of(context).sold_per_month_token(widget.product.monthSales.toStringAsFixed(0)),
|
||||
S.of(context).sold_per_month_token(widget.product.monthSales!.toStringAsFixed(0)),
|
||||
style: new TextStyle(
|
||||
fontSize: 9.0
|
||||
),
|
||||
|
||||
@@ -134,7 +134,7 @@ class DesktopRenewLicenseState extends State<DesktopRenewLicense> {
|
||||
),
|
||||
autofocus: true,
|
||||
validator: (String? value) {
|
||||
if (value.trim().isEmpty) {
|
||||
if (value!.trim().isEmpty) {
|
||||
return S.of(context).please_enter_group_number;
|
||||
}
|
||||
return null;
|
||||
|
||||
@@ -26,10 +26,10 @@ class DesktopResetPasswordState extends State<DesktopResetPassword> {
|
||||
final passwordController = TextEditingController();
|
||||
final passwordAgainController = TextEditingController();
|
||||
|
||||
bool passwordVisible;
|
||||
bool passwordAgainVisible;
|
||||
late bool passwordVisible;
|
||||
late bool passwordAgainVisible;
|
||||
|
||||
bool canReset;
|
||||
late bool canReset;
|
||||
|
||||
double sideSpace = 0;
|
||||
double mainSpace = 1200;
|
||||
@@ -93,7 +93,7 @@ class DesktopResetPasswordState extends State<DesktopResetPassword> {
|
||||
fontSize: 18.0
|
||||
),
|
||||
validator: (String? value) {
|
||||
if (value.trim().isEmpty) {
|
||||
if (value!.trim().isEmpty) {
|
||||
return S.of(context).password_is_required;
|
||||
}
|
||||
return null;
|
||||
@@ -147,10 +147,10 @@ class DesktopResetPasswordState extends State<DesktopResetPassword> {
|
||||
fontSize: 18.0
|
||||
),
|
||||
validator: (String? value) {
|
||||
if (value.trim().isEmpty) {
|
||||
if (value!.trim().isEmpty) {
|
||||
return S.of(context).password_is_required;
|
||||
}
|
||||
if (value.trim() != passwordController.text.trim()) {
|
||||
if (value!.trim() != passwordController.text.trim()) {
|
||||
return S.of(context).password_is_not_match_password_again;
|
||||
}
|
||||
return null;
|
||||
|
||||
@@ -128,7 +128,7 @@ class DesktopSearchPlaceState extends State<DesktopSearchPlace> {
|
||||
);
|
||||
if (result is DioError) {
|
||||
if (result.response != null) {
|
||||
throw RuntimeError(result.response.data['message']);
|
||||
throw RuntimeError(result.response!.data['message']);
|
||||
} else {
|
||||
throw RuntimeError(result.message);
|
||||
}
|
||||
|
||||
@@ -26,10 +26,10 @@ class DesktopSetPasswordState extends State<DesktopSetPassword> {
|
||||
final passwordController = TextEditingController();
|
||||
final passwordAgainController = TextEditingController();
|
||||
|
||||
bool passwordVisible;
|
||||
bool passwordAgainVisible;
|
||||
late bool passwordVisible;
|
||||
late bool passwordAgainVisible;
|
||||
|
||||
bool canReset;
|
||||
late bool canReset;
|
||||
|
||||
double sideSpace = 0;
|
||||
double mainSpace = 1200;
|
||||
@@ -93,7 +93,7 @@ class DesktopSetPasswordState extends State<DesktopSetPassword> {
|
||||
fontSize: 18.0
|
||||
),
|
||||
validator: (String? value) {
|
||||
if (value.trim().isEmpty) {
|
||||
if (value!.trim().isEmpty) {
|
||||
return S.of(context).password_is_required;
|
||||
}
|
||||
return null;
|
||||
@@ -147,10 +147,10 @@ class DesktopSetPasswordState extends State<DesktopSetPassword> {
|
||||
fontSize: 18.0
|
||||
),
|
||||
validator: (String? value) {
|
||||
if (value.trim().isEmpty) {
|
||||
if (value!.trim().isEmpty) {
|
||||
return S.of(context).password_is_required;
|
||||
}
|
||||
if (value.trim() != passwordController.text.trim()) {
|
||||
if (value!.trim() != passwordController.text.trim()) {
|
||||
return S.of(context).password_is_not_match_password_again;
|
||||
}
|
||||
return null;
|
||||
|
||||
@@ -18,14 +18,14 @@ class DesktopShoppingCartWidget extends StatefulWidget {
|
||||
}
|
||||
|
||||
class DesktopShoppingCartWidgetState extends State<DesktopShoppingCartWidget> {
|
||||
CartInfo cartInfo;
|
||||
late CartInfo cartInfo;
|
||||
double totalPrice = 0.0;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
totalPrice = 0.0;
|
||||
cartInfo = Utils.getCartInfoByBusiness(store.state.cartInfos, widget.business);
|
||||
if (cartInfo != null && cartInfo.businessInfo.id == widget.business.id) {
|
||||
if (cartInfo != null && cartInfo.businessInfo!.id == widget.business.id) {
|
||||
totalPrice = cartInfo.getTotalPrice();
|
||||
}
|
||||
Row row = Row(
|
||||
|
||||
@@ -134,7 +134,7 @@ class DesktopStoreProductSearchState extends State<DesktopStoreProductSearch> {
|
||||
);
|
||||
if (result is DioError) {
|
||||
if (result.response != null) {
|
||||
throw RuntimeError(result.response.data);
|
||||
throw RuntimeError(result.response!.data);
|
||||
} else {
|
||||
throw RuntimeError(result.message);
|
||||
}
|
||||
|
||||
@@ -27,10 +27,10 @@ class DesktopUserProfile extends StatefulWidget {
|
||||
}
|
||||
|
||||
class DesktopUserProfileState extends State<DesktopUserProfile> {
|
||||
User _user;
|
||||
late User _user;
|
||||
|
||||
bool _showProgress;
|
||||
double _progress;
|
||||
late bool _showProgress;
|
||||
late double _progress;
|
||||
|
||||
double sideSpace = 0;
|
||||
double mainSpace = 1200;
|
||||
@@ -253,7 +253,7 @@ class DesktopUserProfileState extends State<DesktopUserProfile> {
|
||||
),
|
||||
Container(
|
||||
child: Text(
|
||||
_user.mobile != null && _user.mobile.isNotEmpty ? Utils.safePhoneNumber(_user.mobile) : S.of(context).not_binding,
|
||||
_user.mobile != null && _user.mobile!.isNotEmpty ? Utils.safePhoneNumber(_user.mobile) : S.of(context).not_binding,
|
||||
style: TextStyle(
|
||||
color: Colors.grey,
|
||||
),
|
||||
@@ -306,7 +306,7 @@ class DesktopUserProfileState extends State<DesktopUserProfile> {
|
||||
),
|
||||
Container(
|
||||
child: Text(
|
||||
_user.email != null && _user.email.isNotEmpty ? Utils.safePhoneNumber(_user.email) : S.of(context).not_binding,
|
||||
_user.email != null && _user.email!.isNotEmpty ? Utils.safePhoneNumber(_user.email) : S.of(context).not_binding,
|
||||
style: TextStyle(
|
||||
color: Colors.grey,
|
||||
),
|
||||
@@ -425,7 +425,7 @@ class DesktopUserProfileState extends State<DesktopUserProfile> {
|
||||
),
|
||||
autofocus: true,
|
||||
validator: (String? value) {
|
||||
if (value.trim().isEmpty) {
|
||||
if (value!.trim().isEmpty) {
|
||||
return S.of(context).nickname_is_required;
|
||||
}
|
||||
return null;
|
||||
|
||||
@@ -28,7 +28,7 @@ class DesktopViewBlog extends StatefulWidget {
|
||||
}
|
||||
|
||||
class DesktopViewBlogState extends State<DesktopViewBlog> {
|
||||
Blog blog;
|
||||
late Blog blog;
|
||||
|
||||
double sideSpace = 0;
|
||||
double mainSpace = 1200;
|
||||
|
||||
@@ -33,7 +33,7 @@ class DesktopViewTicket extends StatefulWidget {
|
||||
class DesktopViewTicketState extends State<DesktopViewTicket> {
|
||||
final GlobalKey<FormState> _formKey = GlobalKey<FormState>();
|
||||
|
||||
Ticket ticket;
|
||||
late Ticket ticket;
|
||||
|
||||
final issueMsgController = TextEditingController();
|
||||
|
||||
@@ -144,7 +144,7 @@ class DesktopViewTicketState extends State<DesktopViewTicket> {
|
||||
),
|
||||
autofocus: false,
|
||||
validator: (String? value) {
|
||||
if (value.trim().isEmpty) {
|
||||
if (value!.trim().isEmpty) {
|
||||
return S.of(context).this_field_is_required;
|
||||
}
|
||||
return null;
|
||||
@@ -240,7 +240,7 @@ class DesktopViewTicketState extends State<DesktopViewTicket> {
|
||||
width: double.maxFinite,
|
||||
padding: EdgeInsets.only(top: 8.0, left: 16.0, right: 16.0, bottom: 24.0),
|
||||
child: Text(
|
||||
'${ticket.issue.msg}',
|
||||
'${ticket.issue!.msg}',
|
||||
style: TextStyle(
|
||||
color: Colors.black54,
|
||||
fontSize: 14.0,
|
||||
@@ -260,7 +260,7 @@ class DesktopViewTicketState extends State<DesktopViewTicket> {
|
||||
padding: EdgeInsets.only(top: 16.0, bottom: 16.0, left: 16.0, right: 16.0),
|
||||
child: SingleChildScrollView(
|
||||
scrollDirection: Axis.horizontal,
|
||||
child: showGalleryImages(mainContext, ticket.issue.files),
|
||||
child: showGalleryImages(mainContext, ticket.issue!.files),
|
||||
),
|
||||
decoration: BoxDecoration(
|
||||
border: Border(
|
||||
@@ -291,7 +291,7 @@ class DesktopViewTicketState extends State<DesktopViewTicket> {
|
||||
],
|
||||
);
|
||||
|
||||
if (ticket.followUps.length > 0) {
|
||||
if (ticket.followUps!.length > 0) {
|
||||
ticketCol.children.add(
|
||||
Container(
|
||||
width: double.maxFinite,
|
||||
@@ -305,8 +305,8 @@ class DesktopViewTicketState extends State<DesktopViewTicket> {
|
||||
),
|
||||
),
|
||||
);
|
||||
for (int i = 0; i < ticket.followUps.length; i++) {
|
||||
FollowUp followUp = ticket.followUps[i];
|
||||
for (int i = 0; i < ticket.followUps!.length; i++) {
|
||||
FollowUp followUp = ticket.followUps![i];
|
||||
ticketCol.children.add(
|
||||
Container(
|
||||
width: double.maxFinite,
|
||||
@@ -423,7 +423,7 @@ class DesktopViewTicketState extends State<DesktopViewTicket> {
|
||||
padding: EdgeInsets.only(left: 20.0, right: 20.0, top: 0.0, bottom: 30.0),
|
||||
child: TextLink(
|
||||
S.of(context).new_ticket,
|
||||
'/new-ticket/${ticket.store.id}',
|
||||
'/new-ticket/${ticket.store!.id}',
|
||||
),
|
||||
)
|
||||
],
|
||||
@@ -693,7 +693,7 @@ class DesktopViewTicketState extends State<DesktopViewTicket> {
|
||||
child: Text(S.of(context).ok),
|
||||
onPressed: () {
|
||||
Routes.router.navigateTo(context,
|
||||
'/my-support/${ticket.store.id}',
|
||||
'/my-support/${ticket.store!.id}',
|
||||
replace: true,
|
||||
);
|
||||
},
|
||||
|
||||
@@ -90,7 +90,7 @@ class ProductItemState extends State<ProductItem> {
|
||||
width: 110.0,
|
||||
height: 110.0,
|
||||
child: GestureDetector(
|
||||
child: onHover && widget.product.secondImagePath.isNotEmpty ?
|
||||
child: onHover && widget.product.secondImagePath!.isNotEmpty ?
|
||||
Util.showImage('${widget.product.secondImagePath}',
|
||||
fit: BoxFit.fill,
|
||||
) :
|
||||
@@ -143,7 +143,7 @@ class ProductItemState extends State<ProductItem> {
|
||||
new Container(
|
||||
child: widget.business.showMonthlySold ?
|
||||
Text(
|
||||
S.of(context).sold_per_month_token(widget.product.monthSales.toStringAsFixed(0)),
|
||||
S.of(context).sold_per_month_token(widget.product.monthSales!.toStringAsFixed(0)),
|
||||
style: new TextStyle(
|
||||
fontSize: 9.0
|
||||
),
|
||||
@@ -176,7 +176,7 @@ class ProductItemState extends State<ProductItem> {
|
||||
width: 110.0,
|
||||
height: 110.0,
|
||||
child: GestureDetector(
|
||||
child: onHover && widget.product.secondImagePath.isNotEmpty ?
|
||||
child: onHover && widget.product.secondImagePath!.isNotEmpty ?
|
||||
Util.showImage('${widget.product.secondImagePath}',
|
||||
fit: BoxFit.fill,
|
||||
) :
|
||||
@@ -231,7 +231,7 @@ class ProductItemState extends State<ProductItem> {
|
||||
new Container(
|
||||
child: widget.business.showMonthlySold ?
|
||||
Text(
|
||||
S.of(context).sold_per_month_token(widget.product.monthSales.toStringAsFixed(0)),
|
||||
S.of(context).sold_per_month_token(widget.product.monthSales!.toStringAsFixed(0)),
|
||||
style: new TextStyle(
|
||||
fontSize: 9.0
|
||||
),
|
||||
|
||||
@@ -142,7 +142,7 @@ class ProductSearchState extends State<ProductSearch> {
|
||||
);
|
||||
if (result is DioError) {
|
||||
if (result.response != null) {
|
||||
throw RuntimeError(result.response.data);
|
||||
throw RuntimeError(result.response!.data);
|
||||
} else {
|
||||
throw RuntimeError(result.message);
|
||||
}
|
||||
|
||||
@@ -32,13 +32,13 @@ class Shop extends StatefulWidget {
|
||||
}
|
||||
|
||||
class ShopState extends State<Shop> {
|
||||
Business _business;
|
||||
late Business _business;
|
||||
|
||||
PanelController panelController = PanelController();
|
||||
SlidingUpPanel _slidUpShoppingCart;
|
||||
late SlidingUpPanel _slidUpShoppingCart;
|
||||
GlobalKey endKey = GlobalKey();
|
||||
|
||||
List<CategoryProducts> _categoryProducts;
|
||||
late List<CategoryProducts> _categoryProducts;
|
||||
bool displayProductByCategoryClick = false;
|
||||
String displayProductByCategoryClickIndicator = '';
|
||||
int categoryId = 0;
|
||||
@@ -261,7 +261,7 @@ class ShopState extends State<Shop> {
|
||||
if (moreCategoryProducts.isEmpty) {
|
||||
_productCurrentPage = 0;
|
||||
} else {
|
||||
if (moreCategoryProducts[0].products.length < Constants.ORDERS_PER_PAGE) {
|
||||
if (moreCategoryProducts[0].products!.length < Constants.ORDERS_PER_PAGE) {
|
||||
_productCurrentPage = 0;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -28,7 +28,7 @@ class ShopBulletinState extends State<ShopBulletin> {
|
||||
sideSpace = (MediaQuery.of(context).size.width - 1200) / 2;
|
||||
}
|
||||
|
||||
if (widget.business.bulletin != null && widget.business.bulletin.isNotEmpty) {
|
||||
if (widget.business.bulletin != null && widget.business.bulletin!.isNotEmpty) {
|
||||
return Container(
|
||||
margin: EdgeInsets.only(bottom: 12),
|
||||
child: Row(
|
||||
|
||||
@@ -39,7 +39,7 @@ class ShopProductsState extends State<ShopProducts> {
|
||||
|
||||
int _categoryIndex = 0;
|
||||
List<CategoryProducts> _categoryProducts = [];
|
||||
Business _business;
|
||||
late Business _business;
|
||||
|
||||
double menuPosition = 0;
|
||||
|
||||
@@ -116,11 +116,11 @@ class ShopProductsState extends State<ShopProducts> {
|
||||
int qtyInCategory = 0;
|
||||
CartInfo cartInfo = Utils.getCartInfoByBusiness(store.state.cartInfos, _business);
|
||||
if (cartInfo != null &&
|
||||
cartInfo.businessInfo.id == _business.id &&
|
||||
cartInfo.businessInfo!.id == _business.id &&
|
||||
cartInfo.productList != null) {
|
||||
for (var i = 0; i < cartInfo.productList.length; i++) {
|
||||
if (cartInfo.productList[i].product.categoryId == cp.id) {
|
||||
qtyInCategory += cartInfo.productList[i].quantity.ceil();
|
||||
for (var i = 0; i < cartInfo.productList!.length; i++) {
|
||||
if (cartInfo.productList![i].product!.categoryId == cp.id) {
|
||||
qtyInCategory += cartInfo.productList![i].quantity!.ceil();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -205,7 +205,7 @@ class ShopProductsState extends State<ShopProducts> {
|
||||
);
|
||||
for (int i = 0; i < _categoryProducts.length; i++) {
|
||||
CategoryProducts cp = _categoryProducts[i];
|
||||
if (cp.products.length > 0) {
|
||||
if (cp.products!.length > 0) {
|
||||
col.children.add(new Container(
|
||||
height: _categoryDescHeight,
|
||||
padding: new EdgeInsets.symmetric(horizontal: 10.0),
|
||||
@@ -239,7 +239,7 @@ class ShopProductsState extends State<ShopProducts> {
|
||||
),
|
||||
),
|
||||
new Visibility(
|
||||
visible: cp.description.isNotEmpty,
|
||||
visible: cp.description!.isNotEmpty,
|
||||
child: new Text(
|
||||
cp.description,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
@@ -253,8 +253,8 @@ class ShopProductsState extends State<ShopProducts> {
|
||||
],
|
||||
)));
|
||||
|
||||
var it = cp.products.iterator;
|
||||
for (int i = 0; i < cp.products.length; i++) {
|
||||
var it = cp.products!.iterator;
|
||||
for (int i = 0; i < cp.products!.length; i++) {
|
||||
var r1 = Row(
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
children: [],
|
||||
@@ -295,7 +295,7 @@ class ShopProductsState extends State<ShopProducts> {
|
||||
),
|
||||
);
|
||||
} else if (categoryId > 0) {
|
||||
if (cp.products.length < Constants.ORDERS_PER_PAGE) {
|
||||
if (cp.products!.length < Constants.ORDERS_PER_PAGE) {
|
||||
col.children.add(
|
||||
Container(
|
||||
padding: EdgeInsets.all(12.0),
|
||||
@@ -374,7 +374,7 @@ class ShopProductsState extends State<ShopProducts> {
|
||||
.of(context)
|
||||
.end_of_the_list;
|
||||
} else {
|
||||
if (moreCategoryProducts[0].products.length <
|
||||
if (moreCategoryProducts[0].products!.length <
|
||||
Constants.ORDERS_PER_PAGE) {
|
||||
displayProductByCategoryClickIndicator = S
|
||||
.of(context)
|
||||
@@ -388,7 +388,7 @@ class ShopProductsState extends State<ShopProducts> {
|
||||
CategoryProducts currentCp =
|
||||
getCategoryProductByCategoryId(categoryId);
|
||||
if (currentCp != null) {
|
||||
currentCp.products.addAll(moreCategoryProducts[0].products);
|
||||
currentCp.products!.addAll(moreCategoryProducts[0].products);
|
||||
} else {
|
||||
displayProductByCategoryClickIndicator = S
|
||||
.of(context)
|
||||
@@ -403,7 +403,7 @@ class ShopProductsState extends State<ShopProducts> {
|
||||
int numCategoriesHasProducts() {
|
||||
int num = 0;
|
||||
for (CategoryProducts cp in _categoryProducts) {
|
||||
if (cp.products.length > 0) {
|
||||
if (cp.products!.length > 0) {
|
||||
num += 1;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -22,7 +22,7 @@ class ShopPromoteState extends State<ShopPromote> {
|
||||
double sideSpace = 0;
|
||||
double mainSpace = 1200;
|
||||
|
||||
Business _business;
|
||||
late Business _business;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
@@ -90,7 +90,7 @@ class ShopPromoteState extends State<ShopPromote> {
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
children: <Widget>[],
|
||||
);
|
||||
for (var i = 0; i < _business.promoProducts.length; i++) {
|
||||
for (var i = 0; i < _business.promoProducts!.length; i++) {
|
||||
promotRow.children.add(Container(
|
||||
padding: EdgeInsets.only(
|
||||
left: 10.0,
|
||||
@@ -129,17 +129,17 @@ class ShopPromoteState extends State<ShopPromote> {
|
||||
GestureDetector(
|
||||
child: Container(
|
||||
child: Util.showImage(
|
||||
_business.promoProducts[i].imagePath,
|
||||
_business.promoProducts![i].imagePath,
|
||||
width: 120.0,
|
||||
),
|
||||
),
|
||||
onTap: () {
|
||||
_showProductDetail(_business.promoProducts[i]);
|
||||
_showProductDetail(_business.promoProducts![i]);
|
||||
},
|
||||
),
|
||||
Container(
|
||||
child: Text(
|
||||
_business.promoProducts[i].name,
|
||||
_business.promoProducts![i].name,
|
||||
maxLines: 2,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
style: TextStyle(fontSize: 14.0),
|
||||
@@ -149,16 +149,16 @@ class ShopPromoteState extends State<ShopPromote> {
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: <Widget>[
|
||||
ShowPrice(
|
||||
_business.promoProducts[i].price,
|
||||
_business.promoProducts![i].price,
|
||||
currencySign: '\$',
|
||||
fontWeight: FontWeight.bold,
|
||||
smallFontSize: 15,
|
||||
largeFontSize: 24,
|
||||
regularPrice: _business.promoProducts[i].regularPrice,
|
||||
regularPrice: _business.promoProducts![i].regularPrice,
|
||||
),
|
||||
Container(
|
||||
child: AddRemoveButton(
|
||||
product: _business.promoProducts[i],
|
||||
product: _business.promoProducts![i],
|
||||
business: _business,
|
||||
addOnly: true,
|
||||
),
|
||||
|
||||
@@ -19,14 +19,14 @@ class ShoppingCartWidget extends StatefulWidget {
|
||||
}
|
||||
|
||||
class ShoppingCartWidgetState extends State<ShoppingCartWidget> {
|
||||
CartInfo cartInfo;
|
||||
late CartInfo cartInfo;
|
||||
double totalPrice = 0.0;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
totalPrice = 0.0;
|
||||
cartInfo = Utils.getCartInfoByBusiness(store.state.cartInfos, widget.business);
|
||||
if (cartInfo != null && cartInfo.businessInfo.id == widget.business.id) {
|
||||
if (cartInfo != null && cartInfo.businessInfo!.id == widget.business.id) {
|
||||
totalPrice = cartInfo.getTotalPrice();
|
||||
}
|
||||
Row row = Row(
|
||||
|
||||
@@ -40,7 +40,7 @@ class AddRemoveButton extends StatefulWidget {
|
||||
}
|
||||
|
||||
class AddRemoveButtonState extends State<AddRemoveButton> {
|
||||
int _qty;
|
||||
late int _qty;
|
||||
var zeroColor = const Color(0xFFEFEFEF);
|
||||
var qtyColor = const Color(0xFFFF6666);
|
||||
var zeroFontColor = const Color(0xFF888888);
|
||||
@@ -48,7 +48,7 @@ class AddRemoveButtonState extends State<AddRemoveButton> {
|
||||
|
||||
var d = 1;
|
||||
|
||||
CartInfo cartInfo;
|
||||
late CartInfo cartInfo;
|
||||
|
||||
GlobalKey startKey = GlobalKey();
|
||||
|
||||
@@ -63,10 +63,10 @@ class AddRemoveButtonState extends State<AddRemoveButton> {
|
||||
_qty = 0;
|
||||
cartInfo = Utils.getCartInfoByBusiness(store.state.cartInfos, widget.business);
|
||||
if (cartInfo != null) {
|
||||
for (var i = 0; i < cartInfo.productList.length; i++) {
|
||||
if (cartInfo.productList[i].product.id == widget.product.id
|
||||
&& cartInfo.productList[i].unitPrice == 0.0) {
|
||||
_qty = cartInfo.productList[i].quantity.round();
|
||||
for (var i = 0; i < cartInfo.productList!.length; i++) {
|
||||
if (cartInfo.productList![i].product!.id == widget.product.id
|
||||
&& cartInfo.productList![i].unitPrice == 0.0) {
|
||||
_qty = cartInfo.productList![i].quantity!.round();
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -78,7 +78,7 @@ class AddRemoveButtonState extends State<AddRemoveButton> {
|
||||
),
|
||||
);
|
||||
}
|
||||
if (widget.product.leftNum <= 0) {
|
||||
if (widget.product.leftNum! <= 0) {
|
||||
return Container(
|
||||
padding: EdgeInsets.only(top: 0.0, bottom: 10.0, left: 8.0, right: 8.0),
|
||||
child: Text(
|
||||
@@ -104,9 +104,9 @@ class AddRemoveButtonState extends State<AddRemoveButton> {
|
||||
_qty = 0;
|
||||
cartInfo = Utils.getCartInfoByBusiness(store.state.cartInfos, widget.business);
|
||||
if (cartInfo != null) {
|
||||
for (var i = 0; i < cartInfo.productList.length; i++) {
|
||||
if (cartInfo.productList[i].product.id == widget.product.id) {
|
||||
_qty = cartInfo.productList[i].quantity.round();
|
||||
for (var i = 0; i < cartInfo.productList!.length; i++) {
|
||||
if (cartInfo.productList![i].product!.id == widget.product.id) {
|
||||
_qty = cartInfo.productList![i].quantity!.round();
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -197,15 +197,15 @@ class AddRemoveButtonState extends State<AddRemoveButton> {
|
||||
_qty = 0;
|
||||
cartInfo = Utils.getCartInfoByBusiness(store.state.cartInfos, widget.business);
|
||||
if (cartInfo != null) {
|
||||
for (var i = 0; i < cartInfo.productList.length; i++) {
|
||||
if (cartInfo.productList[i].product.id == widget.product.id) {
|
||||
_qty = cartInfo.productList[i].quantity.round();
|
||||
for (var i = 0; i < cartInfo.productList!.length; i++) {
|
||||
if (cartInfo.productList![i].product!.id == widget.product.id) {
|
||||
_qty = cartInfo.productList![i].quantity!.round();
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (widget.product.productAttributes != null &&
|
||||
widget.product.productAttributes.length > 0 && widget.cartLineItemIndex == -1) {
|
||||
widget.product.productAttributes!.length > 0 && widget.cartLineItemIndex == -1) {
|
||||
return new Row(
|
||||
key: startKey,
|
||||
crossAxisAlignment: CrossAxisAlignment.end,
|
||||
@@ -312,7 +312,7 @@ class AddRemoveButtonState extends State<AddRemoveButton> {
|
||||
|
||||
void _addToCart(BuildContext context) {
|
||||
if (widget.cartLineItemIndex != -1) {
|
||||
if (cartInfo.productList[widget.cartLineItemIndex].quantity + 1.0 > widget.product.leftNum) {
|
||||
if (cartInfo.productList![widget.cartLineItemIndex].quantity! + 1.0 > widget.product.leftNum) {
|
||||
Fluttertoast.showToast(
|
||||
msg: S.of(context).product_insufficient,
|
||||
toastLength: Toast.LENGTH_SHORT,
|
||||
@@ -321,14 +321,14 @@ class AddRemoveButtonState extends State<AddRemoveButton> {
|
||||
textColor: Colors.white
|
||||
);
|
||||
} else {
|
||||
cartInfo.productList[widget.cartLineItemIndex].quantity += 1.0;
|
||||
Utils.addSubproductQty(cartInfo, cartInfo.productList[widget.cartLineItemIndex]);
|
||||
cartInfo.productList![widget.cartLineItemIndex].quantity += 1.0;
|
||||
Utils.addSubproductQty(cartInfo, cartInfo.productList![widget.cartLineItemIndex]);
|
||||
store.dispatch(UpdateCartInfo(
|
||||
Utils.addCartInfoToCartInfoList(store.state.cartInfos, cartInfo)));
|
||||
eventBus.fire(new OnCartInfoUpdated());
|
||||
}
|
||||
} else {
|
||||
if (widget.product.productAttributes.length > 0) {
|
||||
if (widget.product.productAttributes!.length > 0) {
|
||||
Navigator.push(
|
||||
context,
|
||||
MaterialPageRoute(builder: (context) =>
|
||||
@@ -345,7 +345,7 @@ class AddRemoveButtonState extends State<AddRemoveButton> {
|
||||
|
||||
void _removeFromCart(BuildContext context) {
|
||||
if (widget.cartLineItemIndex != -1) {
|
||||
if (cartInfo.productList[widget.cartLineItemIndex].quantity <= 1) {
|
||||
if (cartInfo.productList![widget.cartLineItemIndex].quantity! <= 1) {
|
||||
showDialog(
|
||||
context: context,
|
||||
builder: (BuildContext context) {
|
||||
@@ -380,15 +380,15 @@ class AddRemoveButtonState extends State<AddRemoveButton> {
|
||||
}
|
||||
|
||||
void _removeCartLineItem() {
|
||||
if (cartInfo.productList[widget.cartLineItemIndex].quantity <= 1) {
|
||||
String uuid = cartInfo.productList[widget.cartLineItemIndex].uuid;
|
||||
cartInfo.productList.removeAt(widget.cartLineItemIndex);
|
||||
if (cartInfo.productList![widget.cartLineItemIndex].quantity! <= 1) {
|
||||
String uuid = cartInfo.productList![widget.cartLineItemIndex].uuid;
|
||||
cartInfo.productList!.removeAt(widget.cartLineItemIndex);
|
||||
Utils.removeSubproduct(cartInfo, uuid);
|
||||
} else {
|
||||
cartInfo.productList[widget.cartLineItemIndex].quantity -= 1;
|
||||
Utils.addSubproductQty(cartInfo, cartInfo.productList[widget.cartLineItemIndex], remove: true);
|
||||
cartInfo.productList![widget.cartLineItemIndex].quantity -= 1;
|
||||
Utils.addSubproductQty(cartInfo, cartInfo.productList![widget.cartLineItemIndex], remove: true);
|
||||
}
|
||||
if (cartInfo.productList.length <= 0) {
|
||||
if (cartInfo.productList!.length <= 0) {
|
||||
store.dispatch(new UpdateCartInfo(Utils.removeCartInfoFromCartInfoList(store.state.cartInfos, cartInfo)));
|
||||
} else {
|
||||
store.dispatch(new UpdateCartInfo(Utils.addCartInfoToCartInfoList(store.state.cartInfos, cartInfo)));
|
||||
|
||||
@@ -5,8 +5,8 @@ import 'popup_animation_widget.dart';
|
||||
|
||||
class AnimationPointManager {
|
||||
List<AnimatedWidget> list = [];
|
||||
static AnimationController controller1;
|
||||
static AnimationController controller2;
|
||||
static late AnimationController controller1;
|
||||
static late AnimationController controller2;
|
||||
|
||||
Future<void> addParabolicAniamtion({
|
||||
@required TickerProvider vsync,
|
||||
@@ -55,9 +55,9 @@ class AnimationPointManager {
|
||||
@required GlobalKey stackKey,
|
||||
@required GlobalKey startKey,
|
||||
@required Widget child,
|
||||
Duration duration,
|
||||
Duration? duration,
|
||||
Offset popupOffset = Offset.zero,
|
||||
AnimationStatusListener statusListener,
|
||||
AnimationStatusListener? statusListener,
|
||||
}) async {
|
||||
controller2 = createController(vsync, duration);
|
||||
|
||||
|
||||
@@ -50,14 +50,14 @@ class CheckOptionsState extends OptionsBaseState<CheckOptions> {
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: <Widget>[
|
||||
new Text(
|
||||
S.of(context).check_option_select_token(product.productAttributes[this.index].name),
|
||||
S.of(context).check_option_select_token(product.productAttributes![this.index].name),
|
||||
style: new TextStyle(
|
||||
fontSize: 12.5,
|
||||
),
|
||||
overflow: TextOverflow.ellipsis,
|
||||
),
|
||||
new Text(
|
||||
product.productAttributes[this.index].required ? S.of(context).check_option_is_required : S.of(context).check_option_is_optional,
|
||||
product.productAttributes![this.index].required ? S.of(context).check_option_is_required : S.of(context).check_option_is_optional,
|
||||
style: new TextStyle(
|
||||
fontSize: 10.0,
|
||||
color: new Color(0xFF999999)
|
||||
@@ -95,20 +95,20 @@ class CheckOptionsState extends OptionsBaseState<CheckOptions> {
|
||||
'adjust_amount': adjustAmount
|
||||
};
|
||||
var cloneSelections = json.decode(json.encode(selections));
|
||||
int idx = Utils.selectionsContains(cloneSelections, product.productAttributes[index].name, name);
|
||||
int idx = Utils.selectionsContains(cloneSelections, product.productAttributes![index].name, name);
|
||||
if (idx != -1) {
|
||||
(cloneSelections[product.productAttributes[index].name.toUpperCase()] as List).removeAt(idx);
|
||||
} else if (cloneSelections.containsKey(product.productAttributes[index].name.toUpperCase())) {
|
||||
(cloneSelections[product.productAttributes[index].name.toUpperCase()] as List).add(opt);
|
||||
(cloneSelections[product.productAttributes![index].name!.toUpperCase()] as List).removeAt(idx);
|
||||
} else if (cloneSelections.containsKey(product.productAttributes![index].name!.toUpperCase())) {
|
||||
(cloneSelections[product.productAttributes![index].name!.toUpperCase()] as List).add(opt);
|
||||
} else {
|
||||
cloneSelections[product.productAttributes[index].name.toUpperCase()] = [opt];
|
||||
cloneSelections[product.productAttributes![index].name!.toUpperCase()] = [opt];
|
||||
}
|
||||
|
||||
if (idx != -1 && (cloneSelections[product.productAttributes[index].name.toUpperCase()] as List).length == 0) {
|
||||
cloneSelections.remove(product.productAttributes[index].name.toUpperCase());
|
||||
if (idx != -1 && (cloneSelections[product.productAttributes![index].name!.toUpperCase()] as List).length == 0) {
|
||||
cloneSelections.remove(product.productAttributes![index].name!.toUpperCase());
|
||||
}
|
||||
|
||||
setOptionsStateDisabled(product.productAttributes[index].name, false);
|
||||
setOptionsStateDisabled(product.productAttributes![index].name, false);
|
||||
|
||||
setState(() {
|
||||
selections = cloneSelections;
|
||||
@@ -121,20 +121,20 @@ class CheckOptionsState extends OptionsBaseState<CheckOptions> {
|
||||
children: <Widget>[],
|
||||
);
|
||||
|
||||
List<ProductOption> productOptions = product.productAttributes[index].productOptions;
|
||||
List<ProductOption> productOptions = product.productAttributes![index].productOptions;
|
||||
|
||||
if (!optionsState.containsKey(product.productAttributes[index].name)) {
|
||||
if (!optionsState.containsKey(product.productAttributes![index].name)) {
|
||||
List<Map<String, dynamic>> optionState = [];
|
||||
for (var i = 0; i < productOptions.length; i++) {
|
||||
optionState.add({'name': product.productAttributes[index].productOptions[i].name, 'disabled': false, 'check': false});
|
||||
optionState.add({'name': product.productAttributes![index].productOptions![i].name, 'disabled': false, 'check': false});
|
||||
}
|
||||
optionsState[product.productAttributes[index].name] = optionState;
|
||||
optionsState[product.productAttributes![index].name] = optionState;
|
||||
}
|
||||
|
||||
if (selections.containsKey(product.productAttributes[index].name.toUpperCase())) {
|
||||
if (selections.containsKey(product.productAttributes![index].name!.toUpperCase())) {
|
||||
|
||||
Map<String, dynamic> attrExtraJson = Utils.stringToJson(
|
||||
product.productAttributes[index].extra);
|
||||
product.productAttributes![index].extra);
|
||||
if (attrExtraJson != null) {
|
||||
var selectLimitIfFieldEqualsTo = Rule.getRule(
|
||||
attrExtraJson, Rule.RULE_SELECT_LIMIT_IF_FIELD_EQUALS_TO);
|
||||
@@ -147,7 +147,7 @@ class CheckOptionsState extends OptionsBaseState<CheckOptions> {
|
||||
int limitQty = selectLimitIfFieldEqualsTo1[Rule
|
||||
.RULE_KEY_FORCE_LIMITED];
|
||||
thisLimitQty = limitQty;
|
||||
if ((selections[product.productAttributes[index].name
|
||||
if ((selections[product.productAttributes![index].name
|
||||
.toUpperCase()] as List).length >= limitQty) {
|
||||
disableOptionIfNotSelected();
|
||||
}
|
||||
@@ -155,7 +155,7 @@ class CheckOptionsState extends OptionsBaseState<CheckOptions> {
|
||||
if (selectLimitIfFieldEqualsTo1.containsKey(Utils.getSelectedAttributeValue(selections, selectLimitIfFieldEqualsTo1[Rule.RULE_KEY_FIELD_KEY])[0])) {
|
||||
int limitQty = selectLimitIfFieldEqualsTo1[Utils.getSelectedAttributeValue(selections, selectLimitIfFieldEqualsTo1[Rule.RULE_KEY_FIELD_KEY])[0]];
|
||||
thisLimitQty = limitQty;
|
||||
if ((selections[product.productAttributes[index].name
|
||||
if ((selections[product.productAttributes![index].name
|
||||
.toUpperCase()] as List).length >= limitQty) {
|
||||
disableOptionIfNotSelected();
|
||||
}
|
||||
@@ -168,7 +168,7 @@ class CheckOptionsState extends OptionsBaseState<CheckOptions> {
|
||||
int limitQty = selectLimitIfFieldEqualsTo[Rule
|
||||
.RULE_KEY_FORCE_LIMITED];
|
||||
thisLimitQty = limitQty;
|
||||
if ((selections[product.productAttributes[index].name
|
||||
if ((selections[product.productAttributes![index].name
|
||||
.toUpperCase()] as List).length >= limitQty) {
|
||||
disableOptionIfNotSelected();
|
||||
}
|
||||
@@ -176,7 +176,7 @@ class CheckOptionsState extends OptionsBaseState<CheckOptions> {
|
||||
if (selectLimitIfFieldEqualsTo.containsKey(Utils.getSelectedAttributeValue(selections, selectLimitIfFieldEqualsTo[Rule.RULE_KEY_FIELD_KEY])[0])) {
|
||||
int limitQty = selectLimitIfFieldEqualsTo[Utils.getSelectedAttributeValue(selections, selectLimitIfFieldEqualsTo[Rule.RULE_KEY_FIELD_KEY])[0]];
|
||||
thisLimitQty = limitQty;
|
||||
if ((selections[product.productAttributes[index].name
|
||||
if ((selections[product.productAttributes![index].name
|
||||
.toUpperCase()] as List).length >= limitQty) {
|
||||
disableOptionIfNotSelected();
|
||||
}
|
||||
@@ -195,12 +195,12 @@ class CheckOptionsState extends OptionsBaseState<CheckOptions> {
|
||||
Map<String, dynamic> multiItemRule = Rule.getRule(extraJson, Rule.RULE_ACTUAL_QTY_IS);
|
||||
if (exclusiveRule != null) {
|
||||
if (thisLimitQty > 0 && !_checkOptionIsCheck(productOptions[i].name)) {
|
||||
optionsState[product.productAttributes[index].name][i]['disabled'] = true;
|
||||
optionsState[product.productAttributes![index].name][i]['disabled'] = true;
|
||||
} else {
|
||||
if (_checkOptionIsCheck(productOptions[i].name)) {
|
||||
setOptionsStateDisabled(
|
||||
product.productAttributes[index].name, true);
|
||||
optionsState[product.productAttributes[index]
|
||||
product.productAttributes![index].name, true);
|
||||
optionsState[product.productAttributes![index]
|
||||
.name][i]['disabled'] = false;
|
||||
break;
|
||||
}
|
||||
@@ -208,12 +208,12 @@ class CheckOptionsState extends OptionsBaseState<CheckOptions> {
|
||||
}
|
||||
if (multiItemRule != null) {
|
||||
if (_checkOptionIsCheck(productOptions[i].name)) {
|
||||
if (multiItemRule[Rule.RULE_ACTUAL_QTY_IS] > thisLimitQty - (selections[product.productAttributes[index].name.toUpperCase()] as List).length) {
|
||||
if (multiItemRule[Rule.RULE_ACTUAL_QTY_IS] > thisLimitQty - (selections[product.productAttributes![index].name!.toUpperCase()] as List).length) {
|
||||
disableOptionIfNotSelected();
|
||||
}
|
||||
} else {
|
||||
if (multiItemRule[Rule.RULE_ACTUAL_QTY_IS] > thisLimitQty - (selections[product.productAttributes[index].name.toUpperCase()] as List).length) {
|
||||
optionsState[product.productAttributes[index]
|
||||
if (multiItemRule[Rule.RULE_ACTUAL_QTY_IS] > thisLimitQty - (selections[product.productAttributes![index].name!.toUpperCase()] as List).length) {
|
||||
optionsState[product.productAttributes![index]
|
||||
.name][i]['disabled'] = true;
|
||||
}
|
||||
}
|
||||
@@ -222,26 +222,26 @@ class CheckOptionsState extends OptionsBaseState<CheckOptions> {
|
||||
}
|
||||
}
|
||||
|
||||
List<Map<String, dynamic>> optionState = optionsState[product.productAttributes[index].name];
|
||||
List<Map<String, dynamic>> optionState = optionsState[product.productAttributes![index].name];
|
||||
for (var i = 0; i < optionState.length; i++) {
|
||||
Widget optionWidget = _getOptionCheck(
|
||||
product.productAttributes[index].productOptions[i], optionState[i]['disabled'], i);
|
||||
product.productAttributes![index].productOptions![i], optionState[i]['disabled'], i);
|
||||
row.children.add(optionWidget);
|
||||
}
|
||||
return row;
|
||||
}
|
||||
|
||||
void disableOptionIfNotSelected() {
|
||||
setOptionsStateDisabled(product.productAttributes[index].name, true);
|
||||
for (var i = 0; i < optionsState[product.productAttributes[index].name].length; i++) {
|
||||
if (Utils.selectionsContains(selections, product.productAttributes[index].name, optionsState[product.productAttributes[index].name][i]['name']) != -1) {
|
||||
optionsState[product.productAttributes[index].name][i]['disabled'] = false;
|
||||
setOptionsStateDisabled(product.productAttributes![index].name, true);
|
||||
for (var i = 0; i < optionsState[product.productAttributes![index].name].length; i++) {
|
||||
if (Utils.selectionsContains(selections, product.productAttributes![index].name, optionsState[product.productAttributes![index].name][i]['name']) != -1) {
|
||||
optionsState[product.productAttributes![index].name][i]['disabled'] = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
bool _checkOptionIsCheck(String name) {
|
||||
if (Utils.selectionsContains(selections, product.productAttributes[index].name, name) != -1) {
|
||||
if (Utils.selectionsContains(selections, product.productAttributes![index].name, name) != -1) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
@@ -343,7 +343,7 @@ class CheckOptionsState extends OptionsBaseState<CheckOptions> {
|
||||
overflow: TextOverflow.ellipsis,
|
||||
),
|
||||
new Text(
|
||||
(productOption.adjustAmount + extraAdjustAmount) > 0 ? '+${(productOption.adjustAmount + extraAdjustAmount).toStringAsFixed(2)}' : '',
|
||||
(productOption.adjustAmount! + extraAdjustAmount) > 0 ? '+${(productOption.adjustAmount! + extraAdjustAmount).toStringAsFixed(2)}' : '',
|
||||
style: new TextStyle(
|
||||
fontSize: 11.0,
|
||||
color: check ? selectedTextColor : new Color(0xFFABABAB),
|
||||
@@ -354,7 +354,7 @@ class CheckOptionsState extends OptionsBaseState<CheckOptions> {
|
||||
),
|
||||
),
|
||||
onTap: () => disabled ? null : _onOptionTappedCallback(
|
||||
productOption.name, 0, productOption.adjustAmount + extraAdjustAmount, optIndex, productOption),
|
||||
productOption.name, 0, productOption.adjustAmount! + extraAdjustAmount, optIndex, productOption),
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -16,9 +16,9 @@ abstract class OptionsBase extends StatefulWidget {
|
||||
}
|
||||
|
||||
abstract class OptionsBaseState<Base extends OptionsBase> extends State<Base> {
|
||||
Product product;
|
||||
Map<String, dynamic> selections;
|
||||
int index;
|
||||
late Product product;
|
||||
late Map<String, dynamic> selections;
|
||||
late int index;
|
||||
|
||||
final Color disabledBackgroundColor = new Color(0xFFBCBCBC);
|
||||
|
||||
|
||||
@@ -41,14 +41,14 @@ class QtyOptionsState extends OptionsBaseState<QtyOptions> {
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: <Widget>[
|
||||
new Text(
|
||||
S.of(context).check_option_select_token(product.productAttributes[this.index].name),
|
||||
S.of(context).check_option_select_token(product.productAttributes![this.index].name),
|
||||
style: new TextStyle(
|
||||
fontSize: 12.5,
|
||||
),
|
||||
overflow: TextOverflow.ellipsis,
|
||||
),
|
||||
new Text(
|
||||
product.productAttributes[this.index].required ? S.of(context).check_option_is_required : S.of(context).check_option_is_optional,
|
||||
product.productAttributes![this.index].required ? S.of(context).check_option_is_required : S.of(context).check_option_is_optional,
|
||||
style: new TextStyle(
|
||||
fontSize: 10.0,
|
||||
color: new Color(0xFF999999)
|
||||
@@ -86,33 +86,33 @@ class QtyOptionsState extends OptionsBaseState<QtyOptions> {
|
||||
'adjust_amount': adjustAmount
|
||||
};
|
||||
var cloneSelections = json.decode(json.encode(selections));
|
||||
int idx = Utils.selectionsContains(cloneSelections, product.productAttributes[index].name, name);
|
||||
int idx = Utils.selectionsContains(cloneSelections, product.productAttributes![index].name, name);
|
||||
if (idx != -1) {
|
||||
if (quantity == 1) {
|
||||
cloneSelections[product.productAttributes[index].name.toUpperCase()][idx]['quantity'] += 1;
|
||||
optionsState[product.productAttributes[index].name][optIndex]['quantity'] = cloneSelections[product.productAttributes[index].name.toUpperCase()][idx]['quantity'];
|
||||
cloneSelections[product.productAttributes![index].name!.toUpperCase()][idx]['quantity'] += 1;
|
||||
optionsState[product.productAttributes![index].name][optIndex]['quantity'] = cloneSelections[product.productAttributes![index].name!.toUpperCase()][idx]['quantity'];
|
||||
} else {
|
||||
if (cloneSelections[product.productAttributes[index].name.toUpperCase()][idx]['quantity'] - 1 > 0) {
|
||||
cloneSelections[product.productAttributes[index].name.toUpperCase()][idx]['quantity'] -= 1;
|
||||
optionsState[product.productAttributes[index].name][optIndex]['quantity'] = cloneSelections[product.productAttributes[index].name.toUpperCase()][idx]['quantity'];
|
||||
if (cloneSelections[product.productAttributes![index].name!.toUpperCase()][idx]['quantity'] - 1 > 0) {
|
||||
cloneSelections[product.productAttributes![index].name!.toUpperCase()][idx]['quantity'] -= 1;
|
||||
optionsState[product.productAttributes![index].name][optIndex]['quantity'] = cloneSelections[product.productAttributes![index].name!.toUpperCase()][idx]['quantity'];
|
||||
} else {
|
||||
(cloneSelections[product.productAttributes[index].name.toUpperCase()] as List).removeAt(idx);
|
||||
optionsState[product.productAttributes[index].name][optIndex]['quantity'] = 0;
|
||||
(cloneSelections[product.productAttributes![index].name!.toUpperCase()] as List).removeAt(idx);
|
||||
optionsState[product.productAttributes![index].name][optIndex]['quantity'] = 0;
|
||||
}
|
||||
}
|
||||
} else if (cloneSelections.containsKey(product.productAttributes[index].name.toUpperCase())) {
|
||||
(cloneSelections[product.productAttributes[index].name.toUpperCase()] as List).add(opt);
|
||||
optionsState[product.productAttributes[index].name][optIndex]['quantity'] = 1;
|
||||
} else if (cloneSelections.containsKey(product.productAttributes![index].name!.toUpperCase())) {
|
||||
(cloneSelections[product.productAttributes![index].name!.toUpperCase()] as List).add(opt);
|
||||
optionsState[product.productAttributes![index].name][optIndex]['quantity'] = 1;
|
||||
} else {
|
||||
cloneSelections[product.productAttributes[index].name.toUpperCase()] = [opt];
|
||||
optionsState[product.productAttributes[index].name][optIndex]['quantity'] = 1;
|
||||
cloneSelections[product.productAttributes![index].name!.toUpperCase()] = [opt];
|
||||
optionsState[product.productAttributes![index].name][optIndex]['quantity'] = 1;
|
||||
}
|
||||
|
||||
if (idx != -1 && (cloneSelections[product.productAttributes[index].name.toUpperCase()] as List).length == 0) {
|
||||
cloneSelections.remove(product.productAttributes[index].name.toUpperCase());
|
||||
if (idx != -1 && (cloneSelections[product.productAttributes![index].name!.toUpperCase()] as List).length == 0) {
|
||||
cloneSelections.remove(product.productAttributes![index].name!.toUpperCase());
|
||||
}
|
||||
|
||||
setOptionsStateDisabled(product.productAttributes[index].name, false);
|
||||
setOptionsStateDisabled(product.productAttributes![index].name, false);
|
||||
|
||||
setState(() {
|
||||
selections = cloneSelections;
|
||||
@@ -125,24 +125,24 @@ class QtyOptionsState extends OptionsBaseState<QtyOptions> {
|
||||
children: <Widget>[],
|
||||
);
|
||||
|
||||
List<ProductOption> productOptions = product.productAttributes[index].productOptions;
|
||||
List<ProductOption> productOptions = product.productAttributes![index].productOptions;
|
||||
|
||||
if (!optionsState.containsKey(product.productAttributes[index].name)) {
|
||||
if (!optionsState.containsKey(product.productAttributes![index].name)) {
|
||||
List<Map<String, dynamic>> optionState = [];
|
||||
for (var i = 0; i < productOptions.length; i++) {
|
||||
int qty = 0;
|
||||
int idx = Utils.selectionsContains(selections, product.productAttributes[index].name, productOptions[i].name);
|
||||
int idx = Utils.selectionsContains(selections, product.productAttributes![index].name, productOptions[i].name);
|
||||
if (idx != -1) {
|
||||
qty = selections[product.productAttributes[index].name.toUpperCase()][idx]['quantity'];
|
||||
qty = selections[product.productAttributes![index].name!.toUpperCase()][idx]['quantity'];
|
||||
}
|
||||
optionState.add({'name': product.productAttributes[index].productOptions[i].name, 'disabled': false, 'quantity': qty, 'check': false});
|
||||
optionState.add({'name': product.productAttributes![index].productOptions![i].name, 'disabled': false, 'quantity': qty, 'check': false});
|
||||
}
|
||||
optionsState[product.productAttributes[index].name] = optionState;
|
||||
optionsState[product.productAttributes![index].name] = optionState;
|
||||
}
|
||||
|
||||
if (selections.containsKey(product.productAttributes[index].name.toUpperCase())) {
|
||||
if (selections.containsKey(product.productAttributes![index].name!.toUpperCase())) {
|
||||
Map<String, dynamic> attrExtraJson = Utils.stringToJson(
|
||||
product.productAttributes[index].extra);
|
||||
product.productAttributes![index].extra);
|
||||
if (attrExtraJson != null) {
|
||||
var selectLimitIfFieldEqualsTo = Rule.getRule(
|
||||
attrExtraJson, Rule.RULE_SELECT_LIMIT_IF_FIELD_EQUALS_TO);
|
||||
@@ -155,7 +155,7 @@ class QtyOptionsState extends OptionsBaseState<QtyOptions> {
|
||||
int limitQty = selectLimitIfFieldEqualsTo1[Rule
|
||||
.RULE_KEY_FORCE_LIMITED];
|
||||
thisLimitQty = limitQty;
|
||||
if ((selections[product.productAttributes[index].name
|
||||
if ((selections[product.productAttributes![index].name
|
||||
.toUpperCase()] as List).length >= limitQty) {
|
||||
disableOptionIfNotSelected();
|
||||
}
|
||||
@@ -163,7 +163,7 @@ class QtyOptionsState extends OptionsBaseState<QtyOptions> {
|
||||
if (selectLimitIfFieldEqualsTo1.containsKey(Utils.getSelectedAttributeValue(selections, selectLimitIfFieldEqualsTo1[Rule.RULE_KEY_FIELD_KEY])[0])) {
|
||||
int limitQty = selectLimitIfFieldEqualsTo1[Utils.getSelectedAttributeValue(selections, selectLimitIfFieldEqualsTo1[Rule.RULE_KEY_FIELD_KEY])[0]];
|
||||
thisLimitQty = limitQty;
|
||||
if ((selections[product.productAttributes[index].name
|
||||
if ((selections[product.productAttributes![index].name
|
||||
.toUpperCase()] as List).length >= limitQty) {
|
||||
disableOptionIfNotSelected();
|
||||
}
|
||||
@@ -176,7 +176,7 @@ class QtyOptionsState extends OptionsBaseState<QtyOptions> {
|
||||
int limitQty = selectLimitIfFieldEqualsTo[Rule
|
||||
.RULE_KEY_FORCE_LIMITED];
|
||||
thisLimitQty = limitQty;
|
||||
if ((selections[product.productAttributes[index].name
|
||||
if ((selections[product.productAttributes![index].name
|
||||
.toUpperCase()] as List).length >= limitQty) {
|
||||
disableOptionIfNotSelected();
|
||||
}
|
||||
@@ -184,7 +184,7 @@ class QtyOptionsState extends OptionsBaseState<QtyOptions> {
|
||||
if (selectLimitIfFieldEqualsTo.containsKey(Utils.getSelectedAttributeValue(selections, selectLimitIfFieldEqualsTo[Rule.RULE_KEY_FIELD_KEY])[0])) {
|
||||
int limitQty = selectLimitIfFieldEqualsTo[Utils.getSelectedAttributeValue(selections, selectLimitIfFieldEqualsTo[Rule.RULE_KEY_FIELD_KEY])[0]];
|
||||
thisLimitQty = limitQty;
|
||||
if ((selections[product.productAttributes[index].name
|
||||
if ((selections[product.productAttributes![index].name
|
||||
.toUpperCase()] as List).length >= limitQty) {
|
||||
disableOptionIfNotSelected();
|
||||
}
|
||||
@@ -203,12 +203,12 @@ class QtyOptionsState extends OptionsBaseState<QtyOptions> {
|
||||
Map<String, dynamic> multiItemRule = Rule.getRule(extraJson, Rule.RULE_ACTUAL_QTY_IS);
|
||||
if (exclusiveRule != null) {
|
||||
if (thisLimitQty > 0 && !_checkOptionIsCheck(productOptions[i].name)) {
|
||||
optionsState[product.productAttributes[index].name][i]['disabled'] = true;
|
||||
optionsState[product.productAttributes![index].name][i]['disabled'] = true;
|
||||
} else {
|
||||
if (_checkOptionIsCheck(productOptions[i].name)) {
|
||||
setOptionsStateDisabled(
|
||||
product.productAttributes[index].name, true);
|
||||
optionsState[product.productAttributes[index]
|
||||
product.productAttributes![index].name, true);
|
||||
optionsState[product.productAttributes![index]
|
||||
.name][i]['disabled'] = false;
|
||||
break;
|
||||
}
|
||||
@@ -216,12 +216,12 @@ class QtyOptionsState extends OptionsBaseState<QtyOptions> {
|
||||
}
|
||||
if (multiItemRule != null) {
|
||||
if (_checkOptionIsCheck(productOptions[i].name)) {
|
||||
if (multiItemRule[Rule.RULE_ACTUAL_QTY_IS] > thisLimitQty - (selections[product.productAttributes[index].name.toUpperCase()] as List).length) {
|
||||
if (multiItemRule[Rule.RULE_ACTUAL_QTY_IS] > thisLimitQty - (selections[product.productAttributes![index].name!.toUpperCase()] as List).length) {
|
||||
disableOptionIfNotSelected();
|
||||
}
|
||||
} else {
|
||||
if (multiItemRule[Rule.RULE_ACTUAL_QTY_IS] > thisLimitQty - (selections[product.productAttributes[index].name.toUpperCase()] as List).length) {
|
||||
optionsState[product.productAttributes[index]
|
||||
if (multiItemRule[Rule.RULE_ACTUAL_QTY_IS] > thisLimitQty - (selections[product.productAttributes![index].name!.toUpperCase()] as List).length) {
|
||||
optionsState[product.productAttributes![index]
|
||||
.name][i]['disabled'] = true;
|
||||
}
|
||||
}
|
||||
@@ -230,26 +230,26 @@ class QtyOptionsState extends OptionsBaseState<QtyOptions> {
|
||||
}
|
||||
}
|
||||
|
||||
List<Map<String, dynamic>> optionState = optionsState[product.productAttributes[index].name];
|
||||
List<Map<String, dynamic>> optionState = optionsState[product.productAttributes![index].name];
|
||||
for (var i = 0; i < optionState.length; i++) {
|
||||
Widget optionWidget = _getOptionQty(
|
||||
product.productAttributes[index].productOptions[i], optionState[i]['disabled'], optionState[i]['quantity'], i);
|
||||
product.productAttributes![index].productOptions![i], optionState[i]['disabled'], optionState[i]['quantity'], i);
|
||||
row.children.add(optionWidget);
|
||||
}
|
||||
return row;
|
||||
}
|
||||
|
||||
void disableOptionIfNotSelected() {
|
||||
setOptionsStateDisabled(product.productAttributes[index].name, true);
|
||||
for (var i = 0; i < optionsState[product.productAttributes[index].name].length; i++) {
|
||||
if (Utils.selectionsContains(selections, product.productAttributes[index].name, optionsState[product.productAttributes[index].name][i]['name']) != -1) {
|
||||
optionsState[product.productAttributes[index].name][i]['disabled'] = false;
|
||||
setOptionsStateDisabled(product.productAttributes![index].name, true);
|
||||
for (var i = 0; i < optionsState[product.productAttributes![index].name].length; i++) {
|
||||
if (Utils.selectionsContains(selections, product.productAttributes![index].name, optionsState[product.productAttributes![index].name][i]['name']) != -1) {
|
||||
optionsState[product.productAttributes![index].name][i]['disabled'] = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
bool _checkOptionIsCheck(String name) {
|
||||
if (Utils.selectionsContains(selections, product.productAttributes[index].name, name) != -1) {
|
||||
if (Utils.selectionsContains(selections, product.productAttributes![index].name, name) != -1) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
@@ -361,7 +361,7 @@ class QtyOptionsState extends OptionsBaseState<QtyOptions> {
|
||||
overflow: TextOverflow.ellipsis,
|
||||
),
|
||||
new Text(
|
||||
(productOption.adjustAmount + extraAdjustAmount) > 0 ? '+${(productOption.adjustAmount + extraAdjustAmount).toStringAsFixed(2)}' : '',
|
||||
(productOption.adjustAmount! + extraAdjustAmount) > 0 ? '+${(productOption.adjustAmount! + extraAdjustAmount).toStringAsFixed(2)}' : '',
|
||||
style: new TextStyle(
|
||||
fontSize: 11.0,
|
||||
color: check ? selectedTextColor : new Color(0xFFABABAB),
|
||||
@@ -372,7 +372,7 @@ class QtyOptionsState extends OptionsBaseState<QtyOptions> {
|
||||
),
|
||||
),
|
||||
onTap: () => disabled ? null : _onOptionTappedCallback(
|
||||
productOption.name, 1, productOption.adjustAmount + extraAdjustAmount, optIndex, productOption),
|
||||
productOption.name, 1, productOption.adjustAmount! + extraAdjustAmount, optIndex, productOption),
|
||||
),
|
||||
new Container(
|
||||
width: 100.0,
|
||||
@@ -406,7 +406,7 @@ class QtyOptionsState extends OptionsBaseState<QtyOptions> {
|
||||
),
|
||||
),
|
||||
onTap: () => disabled ? null : _onOptionTappedCallback(
|
||||
productOption.name, 1, productOption.adjustAmount + extraAdjustAmount, optIndex, productOption),
|
||||
productOption.name, 1, productOption.adjustAmount! + extraAdjustAmount, optIndex, productOption),
|
||||
),
|
||||
),
|
||||
new Expanded(
|
||||
@@ -420,7 +420,7 @@ class QtyOptionsState extends OptionsBaseState<QtyOptions> {
|
||||
),
|
||||
),
|
||||
onTap: () => (disabled || quantity == 0) ? null : _onOptionTappedCallback(
|
||||
productOption.name, -1, productOption.adjustAmount + extraAdjustAmount, optIndex, productOption),
|
||||
productOption.name, -1, productOption.adjustAmount! + extraAdjustAmount, optIndex, productOption),
|
||||
),
|
||||
),
|
||||
],
|
||||
|
||||
@@ -40,14 +40,14 @@ class RadioOptionsState extends OptionsBaseState<RadioOptions> {
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: <Widget>[
|
||||
new Text(
|
||||
S.of(context).radio_option_select_token(product.productAttributes[this.index].name),
|
||||
S.of(context).radio_option_select_token(product.productAttributes![this.index].name),
|
||||
style: new TextStyle(
|
||||
fontSize: 12.5,
|
||||
),
|
||||
overflow: TextOverflow.ellipsis,
|
||||
),
|
||||
new Text(
|
||||
product.productAttributes[this.index].required ? S.of(context).radio_option_is_required : S.of(context).radio_option_is_optional,
|
||||
product.productAttributes![this.index].required ? S.of(context).radio_option_is_required : S.of(context).radio_option_is_optional,
|
||||
style: new TextStyle(
|
||||
fontSize: 10.0,
|
||||
color: new Color(0xFF999999)
|
||||
@@ -85,14 +85,14 @@ class RadioOptionsState extends OptionsBaseState<RadioOptions> {
|
||||
'adjust_amount': adjustAmount
|
||||
};
|
||||
var cloneSelections = json.decode(json.encode(selections));
|
||||
if (product.productAttributes[index].required) {
|
||||
cloneSelections[product.productAttributes[index].name.toUpperCase()] = [opt];
|
||||
if (product.productAttributes![index].required) {
|
||||
cloneSelections[product.productAttributes![index].name!.toUpperCase()] = [opt];
|
||||
} else {
|
||||
if (cloneSelections.containsKey(product.productAttributes[index].name.toUpperCase())
|
||||
&& Utils.equalsIgnoreCase(cloneSelections[product.productAttributes[index].name.toUpperCase()][0]['name'], name)) {
|
||||
cloneSelections.remove(product.productAttributes[index].name.toUpperCase());
|
||||
if (cloneSelections.containsKey(product.productAttributes![index].name!.toUpperCase())
|
||||
&& Utils.equalsIgnoreCase(cloneSelections[product.productAttributes![index].name!.toUpperCase()][0]['name'], name)) {
|
||||
cloneSelections.remove(product.productAttributes![index].name!.toUpperCase());
|
||||
} else {
|
||||
cloneSelections[product.productAttributes[index].name.toUpperCase()] = [opt];
|
||||
cloneSelections[product.productAttributes![index].name!.toUpperCase()] = [opt];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -102,7 +102,7 @@ class RadioOptionsState extends OptionsBaseState<RadioOptions> {
|
||||
extraJson, Rule.RULE_EXCLUSIVE_SELECTION);
|
||||
if (exclusiveRule != null) {
|
||||
if (_checkOptionIsCheck(productOption.name)) {
|
||||
setOptionsStateDisabled(product.productAttributes[index].name, false);
|
||||
setOptionsStateDisabled(product.productAttributes![index].name, false);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -118,14 +118,14 @@ class RadioOptionsState extends OptionsBaseState<RadioOptions> {
|
||||
children: <Widget>[],
|
||||
);
|
||||
|
||||
List<ProductOption> productOptions = product.productAttributes[index].productOptions;
|
||||
List<ProductOption> productOptions = product.productAttributes![index].productOptions;
|
||||
|
||||
if (!optionsState.containsKey(product.productAttributes[index].name)) {
|
||||
if (!optionsState.containsKey(product.productAttributes![index].name)) {
|
||||
List<Map<String, dynamic>> optionState = [];
|
||||
for (var i = 0; i < productOptions.length; i++) {
|
||||
optionState.add({'name': product.productAttributes[index].productOptions[i].name, 'disabled': false, 'check': false});
|
||||
optionState.add({'name': product.productAttributes![index].productOptions![i].name, 'disabled': false, 'check': false});
|
||||
}
|
||||
optionsState[product.productAttributes[index].name] = optionState;
|
||||
optionsState[product.productAttributes![index].name] = optionState;
|
||||
}
|
||||
|
||||
for (var i = 0; i < productOptions.length; i++) {
|
||||
@@ -135,25 +135,25 @@ class RadioOptionsState extends OptionsBaseState<RadioOptions> {
|
||||
extraJson, Rule.RULE_EXCLUSIVE_SELECTION);
|
||||
if (exclusiveRule != null) {
|
||||
if (_checkOptionIsCheck(productOptions[i].name)) {
|
||||
setOptionsStateDisabled(product.productAttributes[index].name, true);
|
||||
optionsState[product.productAttributes[index].name][i]['disabled'] = false;
|
||||
setOptionsStateDisabled(product.productAttributes![index].name, true);
|
||||
optionsState[product.productAttributes![index].name][i]['disabled'] = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
List<Map<String, dynamic>> optionState = optionsState[product.productAttributes[index].name];
|
||||
List<Map<String, dynamic>> optionState = optionsState[product.productAttributes![index].name];
|
||||
for (var i = 0; i < optionState.length; i++) {
|
||||
Widget optionWidget = _getOptionRadio(
|
||||
product.productAttributes[index].productOptions[i], optionState[i]['disabled'], i);
|
||||
product.productAttributes![index].productOptions![i], optionState[i]['disabled'], i);
|
||||
row.children.add(optionWidget);
|
||||
}
|
||||
return row;
|
||||
}
|
||||
|
||||
bool _checkOptionIsCheck(String name) {
|
||||
if (Utils.selectionsContains(selections, product.productAttributes[index].name, name) != -1) {
|
||||
if (Utils.selectionsContains(selections, product.productAttributes![index].name, name) != -1) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
@@ -255,7 +255,7 @@ class RadioOptionsState extends OptionsBaseState<RadioOptions> {
|
||||
overflow: TextOverflow.ellipsis,
|
||||
),
|
||||
new Text(
|
||||
(productOption.adjustAmount + extraAdjustAmount) > 0 ? '+${(productOption.adjustAmount + extraAdjustAmount).toStringAsFixed(2)}' : '',
|
||||
(productOption.adjustAmount! + extraAdjustAmount) > 0 ? '+${(productOption.adjustAmount! + extraAdjustAmount).toStringAsFixed(2)}' : '',
|
||||
style: new TextStyle(
|
||||
fontSize: 11.0,
|
||||
color: check ? selectedTextColor : new Color(0xFFABABAB),
|
||||
@@ -266,7 +266,7 @@ class RadioOptionsState extends OptionsBaseState<RadioOptions> {
|
||||
),
|
||||
),
|
||||
onTap: () => disabled ? null : _onOptionTappedCallback(
|
||||
productOption.name, 0, productOption.adjustAmount + extraAdjustAmount, optIndex, productOption),
|
||||
productOption.name, 0, productOption.adjustAmount! + extraAdjustAmount, optIndex, productOption),
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -6,8 +6,8 @@ import 'style.dart';
|
||||
class Carousel extends StatefulWidget {
|
||||
Carousel({
|
||||
double height = 200.0,
|
||||
List<Widget> pages,
|
||||
bool autoPlay,
|
||||
List<Widget>? pages,
|
||||
bool? autoPlay,
|
||||
Duration duration = const Duration(seconds: 2),
|
||||
Duration animationDuration = const Duration(milliseconds: 1000),
|
||||
})
|
||||
@@ -30,7 +30,7 @@ class Carousel extends StatefulWidget {
|
||||
class CarouselState extends State<Carousel> {
|
||||
final _pageController = new PageController();
|
||||
|
||||
Timer _timer;
|
||||
late Timer _timer;
|
||||
int _currentPage = 0;
|
||||
bool reverse = false;
|
||||
GlobalKey<IndicatorState> _indicatorStateKey = new GlobalKey();
|
||||
@@ -80,7 +80,7 @@ class CarouselState extends State<Carousel> {
|
||||
children: widget.pages,
|
||||
onPageChanged: (index) {
|
||||
_currentPage = index;
|
||||
_indicatorStateKey.currentState.changeIndex(index);
|
||||
_indicatorStateKey.currentState!.changeIndex(index);
|
||||
},
|
||||
),
|
||||
),
|
||||
@@ -102,7 +102,7 @@ class CarouselState extends State<Carousel> {
|
||||
}
|
||||
|
||||
class Indicator extends StatefulWidget {
|
||||
Indicator({Key? key, int count})
|
||||
Indicator({Key? key, int? count})
|
||||
: count = count,
|
||||
super(key: key);
|
||||
|
||||
|
||||
@@ -65,7 +65,7 @@ class ETransferPay extends StatelessWidget {
|
||||
fontSize: 15, color: Colors.black54),
|
||||
),
|
||||
Text(
|
||||
'\$${order.totalPrice.toStringAsFixed(2)}',
|
||||
'\$${order.totalPrice!.toStringAsFixed(2)}',
|
||||
style: const TextStyle(
|
||||
fontSize: 28,
|
||||
fontWeight: FontWeight.bold,
|
||||
|
||||
@@ -11,7 +11,7 @@ class ParabolicAnimationWidget extends AnimatedWidget {
|
||||
final Offset startAdjustOffset;
|
||||
final Offset endAdjustOffset;
|
||||
|
||||
ParabolicAnimationWidget({
|
||||
late ParabolicAnimationWidget({
|
||||
@required Animation<double> animation,
|
||||
@required this.stackKey,
|
||||
@required this.startKey,
|
||||
@@ -66,17 +66,17 @@ class ParabolicAnimationWidget extends AnimatedWidget {
|
||||
|
||||
void _calPoints() {
|
||||
if (_startOffset == null) {
|
||||
RenderBox stackBox = stackKey.currentContext.findRenderObject();
|
||||
RenderBox stackBox = stackKey.currentContext!.findRenderObject();
|
||||
Offset stackBoxOffset = stackBox.globalToLocal(Offset.zero);
|
||||
|
||||
EdgeInsets startMargin = _margin(startKey);
|
||||
RenderBox startBox = startKey.currentContext.findRenderObject();
|
||||
RenderBox startBox = startKey.currentContext!.findRenderObject();
|
||||
_startOffset = startBox.localToGlobal(Offset(
|
||||
startMargin.left + startAdjustOffset.dx,
|
||||
stackBoxOffset.dy + startMargin.top + startAdjustOffset.dy));
|
||||
|
||||
EdgeInsets endMargin = _margin(endKey);
|
||||
RenderBox endBox = endKey.currentContext.findRenderObject();
|
||||
RenderBox endBox = endKey.currentContext!.findRenderObject();
|
||||
_endOffset = endBox.localToGlobal(Offset(
|
||||
endMargin.left + endAdjustOffset.dx,
|
||||
stackBoxOffset.dy + endMargin.top + endAdjustOffset.dy));
|
||||
@@ -84,7 +84,7 @@ class ParabolicAnimationWidget extends AnimatedWidget {
|
||||
}
|
||||
|
||||
EdgeInsets _margin(GlobalKey key) {
|
||||
final Widget widget = key.currentContext.widget;
|
||||
final Widget widget = key.currentContext!.widget;
|
||||
EdgeInsets margin = (widget is Container) ? widget.margin : EdgeInsets.zero;
|
||||
return margin ?? EdgeInsets.zero;
|
||||
}
|
||||
|
||||
@@ -33,8 +33,8 @@ class PaymentVerificationCodeDialogState extends State<PaymentVerificationCodeDi
|
||||
String getCodeText = '';
|
||||
String paymentCodeEncrypt = '';
|
||||
|
||||
String verifyMethod;
|
||||
String verifyName;
|
||||
late String verifyMethod;
|
||||
late String verifyName;
|
||||
|
||||
final TextEditingController _pinPutController = TextEditingController();
|
||||
final FocusNode _pinPutFocusNode = FocusNode();
|
||||
|
||||
@@ -9,7 +9,7 @@ class PopupAnimationWidget extends AnimatedWidget {
|
||||
final Offset popupOffset;
|
||||
final Animation<double> animation;
|
||||
|
||||
PopupAnimationWidget({
|
||||
late PopupAnimationWidget({
|
||||
@required this.animation,
|
||||
@required this.stackKey,
|
||||
@required this.startKey,
|
||||
@@ -49,11 +49,11 @@ class PopupAnimationWidget extends AnimatedWidget {
|
||||
|
||||
void _calAnimation() {
|
||||
if (_startOffset == null) {
|
||||
final RenderBox stackBox = stackKey.currentContext.findRenderObject();
|
||||
final RenderBox stackBox = stackKey.currentContext!.findRenderObject();
|
||||
final Offset stackBoxOffset = stackBox.globalToLocal(Offset.zero);
|
||||
|
||||
final EdgeInsets startMargin = _margin(startKey);
|
||||
final RenderBox startBox = startKey.currentContext.findRenderObject();
|
||||
final RenderBox startBox = startKey.currentContext!.findRenderObject();
|
||||
|
||||
_startOffset = startBox.localToGlobal(Offset(
|
||||
startMargin.left + popupOffset.dx,
|
||||
@@ -62,7 +62,7 @@ class PopupAnimationWidget extends AnimatedWidget {
|
||||
}
|
||||
|
||||
EdgeInsets _margin(GlobalKey key) {
|
||||
final Widget widget = key.currentContext.widget;
|
||||
final Widget widget = key.currentContext!.widget;
|
||||
final EdgeInsets margin =
|
||||
(widget is Container) ? widget.margin : EdgeInsets.zero;
|
||||
return margin ?? EdgeInsets.zero;
|
||||
|
||||
@@ -211,9 +211,9 @@ class SlidingUpPanel extends StatefulWidget {
|
||||
|
||||
class _SlidingUpPanelState extends State<SlidingUpPanel> with SingleTickerProviderStateMixin{
|
||||
|
||||
AnimationController _ac;
|
||||
late AnimationController _ac;
|
||||
|
||||
ScrollController _sc;
|
||||
late ScrollController _sc;
|
||||
bool _scrollingEnabled = false;
|
||||
VelocityTracker _vt = VelocityTracker.withKind(PointerDeviceKind.touch);
|
||||
|
||||
@@ -390,7 +390,7 @@ class _SlidingUpPanelState extends State<SlidingUpPanel> with SingleTickerProvid
|
||||
// and a listener if panelBuilder is used.
|
||||
// this is because the listener is designed only for use with linking the scrolling of
|
||||
// panels and using it for panels that don't want to linked scrolling yields odd results
|
||||
Widget _gestureHandler({Widget child}){
|
||||
Widget _gestureHandler({Widget? child}){
|
||||
if (!widget.isDraggable) return child;
|
||||
|
||||
if (widget.panel != null){
|
||||
@@ -552,14 +552,14 @@ class _SlidingUpPanelState extends State<SlidingUpPanel> with SingleTickerProvid
|
||||
|
||||
//animate the panel position to value - must
|
||||
//be between 0.0 and 1.0
|
||||
Future<void> _animatePanelToPosition(double value, {Duration duration, Curve curve = Curves.linear}){
|
||||
Future<void> _animatePanelToPosition(double value, {Duration? duration, Curve curve = Curves.linear}){
|
||||
assert(0.0 <= value && value <= 1.0);
|
||||
return _ac.animateTo(value, duration: duration, curve: curve);
|
||||
}
|
||||
|
||||
//animate the panel position to the snap point
|
||||
//REQUIRES that widget.snapPoint != null
|
||||
Future<void> _animatePanelToSnapPoint({Duration duration, Curve curve = Curves.linear}){
|
||||
Future<void> _animatePanelToSnapPoint({Duration? duration, Curve curve = Curves.linear}){
|
||||
assert(widget.snapPoint != null);
|
||||
return _ac.animateTo(widget.snapPoint, duration: duration, curve: curve);
|
||||
}
|
||||
@@ -602,7 +602,7 @@ class _SlidingUpPanelState extends State<SlidingUpPanel> with SingleTickerProvid
|
||||
|
||||
|
||||
class PanelController{
|
||||
_SlidingUpPanelState _panelState;
|
||||
late _SlidingUpPanelState _panelState;
|
||||
|
||||
void _addState(_SlidingUpPanelState panelState){
|
||||
this._panelState = panelState;
|
||||
@@ -644,7 +644,7 @@ class PanelController{
|
||||
/// where 0.0 is fully collapsed and 1.0 is completely open.
|
||||
/// (optional) duration specifies the time for the animation to complete
|
||||
/// (optional) curve specifies the easing behavior of the animation.
|
||||
Future<void> animatePanelToPosition(double value, {Duration duration, Curve curve = Curves.linear}){
|
||||
Future<void> animatePanelToPosition(double value, {Duration? duration, Curve curve = Curves.linear}){
|
||||
assert(isAttached, "PanelController must be attached to a SlidingUpPanel");
|
||||
assert(0.0 <= value && value <= 1.0);
|
||||
return _panelState._animatePanelToPosition(value, duration: duration, curve: curve);
|
||||
@@ -654,7 +654,7 @@ class PanelController{
|
||||
/// Requires that the SlidingUpPanel snapPoint property is not null
|
||||
/// (optional) duration specifies the time for the animation to complete
|
||||
/// (optional) curve specifies the easing behavior of the animation.
|
||||
Future<void> animatePanelToSnapPoint({Duration duration, Curve curve = Curves.linear}){
|
||||
Future<void> animatePanelToSnapPoint({Duration? duration, Curve curve = Curves.linear}){
|
||||
assert(isAttached, "PanelController must be attached to a SlidingUpPanel");
|
||||
assert(_panelState.widget.snapPoint != null, "SlidingUpPanel snapPoint property must not be null");
|
||||
return _panelState._animatePanelToSnapPoint(duration: duration, curve: curve);
|
||||
|
||||
@@ -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,
|
||||
|
||||
175
tools/nullfix.py
Normal file
175
tools/nullfix.py
Normal file
@@ -0,0 +1,175 @@
|
||||
#!/usr/bin/env python3
|
||||
"""
|
||||
nullfix.py — dart analyze 驱动的空安全批量修复(保守、带语法损坏自检)。
|
||||
|
||||
处理的规则(全部由 analyzer 位置驱动,逐轮迭代):
|
||||
1. unchecked_use_of_nullable_value -> 在接收者后插 '!'(属性/方法/[]/运算符)
|
||||
2. not_initialized_non_nullable_instance_field / _variable
|
||||
-> 字段/变量改为可空(在类型后插 '?'),跳过 return/this./关键词行
|
||||
3. missing_default_value_for_parameter
|
||||
-> 参数改为可空(类型后插 '?'),跳过 field-formal this.x
|
||||
|
||||
不处理(需语义判断): argument_type_not_assignable / invalid_assignment
|
||||
(这两类留给后续:多为 nullable 传给非空形参,常伴随 1/2 解决后自动减少)
|
||||
|
||||
每轮结束检测 expected_token / missing_identifier(语法损坏),有则中止。
|
||||
|
||||
用法: python3 tools/nullfix.py [file] [--max-rounds N]
|
||||
"""
|
||||
import re, subprocess, sys, os
|
||||
|
||||
ROUNDS = 40
|
||||
args=[]
|
||||
i=0
|
||||
while i<len(sys.argv):
|
||||
a=sys.argv[i]
|
||||
if a=='--max-rounds': ROUNDS=int(sys.argv[i+1]); i+=2; continue
|
||||
if not a.endswith('nullfix.py'): args.append(a)
|
||||
i+=1
|
||||
TARGET = args[0] if args else None
|
||||
|
||||
ERR = re.compile(r'\s+error\s+-\s+([\w/.\-]+):(\d+):(\d+)\s+-\s+(.*?)\s+-\s+([a-z_]+)\s*$')
|
||||
PROP = re.compile(r"The property '([^']+)'")
|
||||
METH = re.compile(r"The method '([^']+)'")
|
||||
OPR = re.compile(r"The operator '([^']+)'")
|
||||
NAME = re.compile(r"'([^']+)'")
|
||||
KEYWORDS = {'return','throw','await','yield','break','continue','assert','new','const',
|
||||
'final','var','late','switch','case','default','if','else','for','while',
|
||||
'do','try','catch','finally','in','is','as','super','this'}
|
||||
|
||||
def analyze():
|
||||
out = subprocess.run(['dart','analyze','lib'], capture_output=True, text=True).stdout
|
||||
errs=[]; corruption=0
|
||||
for ln in out.splitlines():
|
||||
if 'expected_token' in ln or 'missing_identifier' in ln:
|
||||
corruption += 1
|
||||
m = ERR.match(ln)
|
||||
if m:
|
||||
p,l,c,msg,r=m.groups(); errs.append((p,int(l),int(c),msg,r))
|
||||
if TARGET:
|
||||
t=TARGET.replace('lib/','')
|
||||
errs=[e for e in errs if e[0].endswith(t)]
|
||||
return errs, corruption, out
|
||||
|
||||
def classify_use(msg):
|
||||
m=PROP.search(msg)
|
||||
if m: return (m.group(1),'prop')
|
||||
m=METH.search(msg)
|
||||
if m: return (None,'index') if m.group(1)=='[]' else (m.group(1),'meth')
|
||||
m=OPR.search(msg)
|
||||
if m: return (m.group(1),'op')
|
||||
return None
|
||||
|
||||
def find_name_col(line, name, col0):
|
||||
"""在 line 上找 name 的出现,返回最接近 col0 的起始 index;找不到 None。"""
|
||||
best=None
|
||||
for mm in re.finditer(r'(?<![\w])'+re.escape(name)+r'(?!\w)', line):
|
||||
d=abs(mm.start()-col0)
|
||||
if best is None or d<best[0]: best=(d,mm.start())
|
||||
return best[1] if best else None
|
||||
|
||||
def insert_bang(line, col0, name, kind):
|
||||
if kind in ('prop','meth') and name:
|
||||
pat = re.compile(r'(?<!!)\.' + re.escape(name) + r'\b')
|
||||
best=None
|
||||
for mm in pat.finditer(line):
|
||||
d=abs(mm.start()-col0)
|
||||
if best is None or d<best[0]: best=(d,mm)
|
||||
if not best: return None
|
||||
idx=best[1].start(); j=idx-1
|
||||
if j<0: return None
|
||||
if line[j]=='!': return None
|
||||
if not (line[j].isalnum() or line[j] in '_)?]'): return None
|
||||
return line[:idx]+'!'+line[idx:]
|
||||
if kind=='index':
|
||||
best=None
|
||||
for i,ch in enumerate(line):
|
||||
if ch=='[':
|
||||
d=abs(i-col0)
|
||||
if best is None or d<best[0]: best=(d,i)
|
||||
if not best: return None
|
||||
idx=best[1]; j=idx-1
|
||||
if j<0 or line[j]=='!': return None
|
||||
if line[j].isalnum() or line[j] in '_)?]': return line[:idx]+'!'+line[idx:]
|
||||
return None
|
||||
if kind=='op':
|
||||
for mm in re.finditer(re.escape(name), line):
|
||||
idx=mm.start(); j=idx-1
|
||||
while j>=0 and line[j]==' ': j-=1
|
||||
if j<0 or line[j]=='!': continue
|
||||
if line[j].isalnum() or line[j] in '_)?]': return line[:j+1]+'!'+line[j+1:]
|
||||
return None
|
||||
return None
|
||||
|
||||
def insert_late(line):
|
||||
stripped=line.strip()
|
||||
if not stripped or stripped.startswith('late '): return None
|
||||
head=stripped.split(';')[0]
|
||||
if '?' in head or '=' in head: return None # 已可空/已初始化
|
||||
indent=line[:len(line)-len(stripped)]
|
||||
if stripped.startswith('static '): return indent+'static late '+stripped[len('static '):]
|
||||
if stripped.startswith('external '): return indent+'external late '+stripped[len('external '):]
|
||||
return indent+'late '+stripped
|
||||
|
||||
def insert_nullable_before_name(line, name, col0):
|
||||
"""把 'Type name' 改为 'Type? name'。跳过 field-formal(this.)、关键词行。"""
|
||||
stripped=line.strip()
|
||||
first=stripped.split(' ')[0] if stripped else ''
|
||||
if first.rstrip(')').rstrip('(') in KEYWORDS: return None
|
||||
idx=find_name_col(line, name, col0)
|
||||
if idx is None: return None
|
||||
# name 前一个非空字符
|
||||
j=idx-1
|
||||
while j>=0 and line[j] in ' \t': j-=1
|
||||
if j<0: return None
|
||||
if line[j]=='.': return None # field-formal this.name
|
||||
if line[j]=='?': return None # 已可空
|
||||
# j 应是类型末尾(字母/>/)/])
|
||||
if not (line[j].isalnum() or line[j] in '_>]?)'): return None
|
||||
return line[:j+1]+'?'+line[j+1:]
|
||||
|
||||
def apply_round(errs):
|
||||
changed=0; files={}
|
||||
def get(path):
|
||||
if path not in files:
|
||||
files[path]=open('lib/'+path).read().split('\n')
|
||||
return files[path]
|
||||
def flush():
|
||||
for p,ls in files.items():
|
||||
open('lib/'+p,'w').write('\n'.join(ls))
|
||||
for path,line,col,msg,rule in errs:
|
||||
if not os.path.exists('lib/'+path): continue
|
||||
L=get(path)
|
||||
if line>len(L): continue
|
||||
old=L[line-1]; new=old
|
||||
if rule=='unchecked_use_of_nullable_value':
|
||||
cls=classify_use(msg)
|
||||
if cls: new=insert_bang(old, col-1, cls[0], cls[1])
|
||||
elif rule=='missing_default_value_for_parameter':
|
||||
nm=NAME.search(msg)
|
||||
if nm: new=insert_nullable_before_name(old, nm.group(1), col-1)
|
||||
elif rule in ('not_initialized_non_nullable_instance_field','not_initialized_non_nullable_variable'):
|
||||
new=insert_late(old)
|
||||
if new and new!=old:
|
||||
L[line-1]=new; changed+=1
|
||||
flush()
|
||||
return changed
|
||||
|
||||
rounds=0
|
||||
while rounds<ROUNDS:
|
||||
errs,corruption,_=analyze()
|
||||
if corruption:
|
||||
print(f'!! 检测到 {corruption} 处语法损坏,中止。请 git diff 检查。'); sys.exit(2)
|
||||
if not errs: print('无错误,完成。'); break
|
||||
c=apply_round(errs)
|
||||
rounds+=1
|
||||
print(f'第 {rounds} 轮:修复 {c} 处(剩余 error {len(errs)})')
|
||||
if c==0:
|
||||
print('本轮无新增修复,剩余需人工/IDE 处理:')
|
||||
from collections import Counter
|
||||
cnt=Counter(e[4] for e in errs)
|
||||
for r,n in cnt.most_common(8): print(f' {n:4d} {r}')
|
||||
break
|
||||
|
||||
errs,corruption,_=analyze()
|
||||
print(f'\n=== 完成。剩余 error: {len(errs)} | 语法损坏: {corruption} ===')
|
||||
Reference in New Issue
Block a user