diff --git a/lib/pages/attribute_selection.dart b/lib/pages/attribute_selection.dart index e6c89c8..5e3282a 100644 --- a/lib/pages/attribute_selection.dart +++ b/lib/pages/attribute_selection.dart @@ -17,9 +17,9 @@ class AttributeSelection extends StatelessWidget { return ResponsiveBuilder( builder: (context, sizingInformation) => ScreenTypeLayout( - mobile: MobileAttributeSelection(product: product, business: business, startKey: startKey,), - tablet: MobileAttributeSelection(product: product, business: business, startKey: startKey,), - desktop: MobileAttributeSelection(product: product, business: business, startKey: startKey,), + mobile: MobileAttributeSelection(product: product!, business: business!, startKey: startKey,), + tablet: MobileAttributeSelection(product: product!, business: business!, startKey: startKey,), + desktop: MobileAttributeSelection(product: product!, business: business!, startKey: startKey,), ), ); } diff --git a/lib/pages/contact_us.dart b/lib/pages/contact_us.dart index d486833..0e06bf2 100644 --- a/lib/pages/contact_us.dart +++ b/lib/pages/contact_us.dart @@ -59,7 +59,7 @@ class ContactUsState extends State { void loadData() { HttpUtil.httpGet( 'v1/get-business', - businessId: widget.businessId, + businessId: widget.businessId!, ).then((value) { business = Business.fromJson(value); setState(() {}); diff --git a/lib/pages/plain_page.dart b/lib/pages/plain_page.dart index 8784a31..ca1ace8 100644 --- a/lib/pages/plain_page.dart +++ b/lib/pages/plain_page.dart @@ -60,7 +60,7 @@ class PlainPageState extends State { void loadData() { HttpUtil.httpGet( 'v1/special-page', - businessId: widget.businessId, + businessId: widget.businessId!, queryParameters: { 'bid': widget.slug, } diff --git a/lib/pages/product_detail_page.dart b/lib/pages/product_detail_page.dart index e793f25..cd6597b 100644 --- a/lib/pages/product_detail_page.dart +++ b/lib/pages/product_detail_page.dart @@ -24,9 +24,9 @@ class ProductDetailPage extends StatelessWidget { return ResponsiveBuilder( builder: (context, sizingInformation) => ScreenTypeLayout( - mobile: MobileProductDetailPage(business: business, product: product,), - tablet: DesktopProductDetailPage(business: business, product: product,), - desktop: DesktopProductDetailPage(business: business, product: product,), + mobile: MobileProductDetailPage(business: business!, product: product!,), + tablet: DesktopProductDetailPage(business: business!, product: product!,), + desktop: DesktopProductDetailPage(business: business!, product: product!,), ), ); } diff --git a/lib/utils/util_io.dart b/lib/utils/util_io.dart index 907241a..e56d007 100644 --- a/lib/utils/util_io.dart +++ b/lib/utils/util_io.dart @@ -77,7 +77,7 @@ class Util { Future onSelectNotification(String payload, {bool replace=false}) async { print('payload: $payload'); if (payload != null && payload.isNotEmpty) { - Routes.router.navigateTo(store.state.context, payload, replace: replace); + Routes.router.navigateTo(store.state.context!, payload, replace: replace); } } @@ -132,7 +132,7 @@ class Util { Future onDidReceiveLocalNotification(int id, String title, String body, String payload) async { showDialog( - context: store.state.context, + context: store.state.context!, builder: (BuildContext context) => CupertinoAlertDialog( title: Text(title), content: Text(body), @@ -207,7 +207,7 @@ class Util { width: width, height: width, fit: fit, - placeholder: (context, url) => Utils.imageLoadingIndicator(width: width, height: height), + placeholder: (context, url) => Utils.imageLoadingIndicator(width: width!, height: height!), errorWidget: errorWidget != null ? errorWidget : (context, url, error) { return Image.asset( 'assets/images/not_found.png', diff --git a/lib/widgets/desktop/create_online_store_1.dart b/lib/widgets/desktop/create_online_store_1.dart index f232db7..26c5580 100644 --- a/lib/widgets/desktop/create_online_store_1.dart +++ b/lib/widgets/desktop/create_online_store_1.dart @@ -240,7 +240,7 @@ class CreateOnlineStore1State extends State { onPressed: () { Navigator.pushReplacement(context, MaterialPageRoute( builder: (BuildContext context) => - BuyService(group.id, Constants.WEB_MINISTORE_SERVICE, + BuyService(group.id!, Constants.WEB_MINISTORE_SERVICE, domain: existing_web_svc['domain'], sid: existing_web_svc['store']['id'], ), @@ -357,7 +357,7 @@ class CreateOnlineStore1State extends State { onPressed: () { Navigator.pushReplacement(context, MaterialPageRoute( builder: (BuildContext context) => - BuyService(group.id, Constants.WEB_MINISTORE_SERVICE, + BuyService(group.id!, Constants.WEB_MINISTORE_SERVICE, domain: selectedDomain, sid: selectedStore['id'], ), diff --git a/lib/widgets/desktop/desktop_blog.dart b/lib/widgets/desktop/desktop_blog.dart index 37f7f97..f96cb5d 100644 --- a/lib/widgets/desktop/desktop_blog.dart +++ b/lib/widgets/desktop/desktop_blog.dart @@ -217,7 +217,7 @@ class DesktopBlogState extends State { children: [ Container( child: Text( - blog.title, + blog.title!, style: TextStyle( fontSize: 19.0, ), @@ -226,7 +226,7 @@ class DesktopBlogState extends State { ), Container( child: Text( - Utils.utcDatetimeStringToLocalDatetimeString(context, blog.createdAt,), + Utils.utcDatetimeStringToLocalDatetimeString(context, blog.createdAt!,), style: TextStyle( fontSize: 13.0, color: Colors.grey, @@ -266,7 +266,7 @@ class DesktopBlogState extends State { _loadingFinish = false; HttpUtil.httpGet( 'v1/blogs', - businessId: widget.businessId, + businessId: widget.businessId!, queryParameters: { 'page': _page.toString(), 'size': Constants.BLOG_PER_PAGE_DESKTOP.toString() diff --git a/lib/widgets/desktop/desktop_buy_service.dart b/lib/widgets/desktop/desktop_buy_service.dart index a3eae26..0d2b6c7 100644 --- a/lib/widgets/desktop/desktop_buy_service.dart +++ b/lib/widgets/desktop/desktop_buy_service.dart @@ -106,7 +106,7 @@ class DesktopBuyServiceState extends State { items: plans.map((e) { return DropdownMenuItem( value: e, - child: Text(e.name), + child: Text(e.name!), ); }).toList(), isExpanded: true, diff --git a/lib/widgets/desktop/desktop_checkout.dart b/lib/widgets/desktop/desktop_checkout.dart index c6654c3..7e52f87 100644 --- a/lib/widgets/desktop/desktop_checkout.dart +++ b/lib/widgets/desktop/desktop_checkout.dart @@ -306,7 +306,7 @@ class DesktopCheckoutState extends State with SingleTickerProvi mainAxisSize: MainAxisSize.min, children: [ Text( - S.of(context).table_token(store.state.tableNumber), + S.of(context).table_token(store.state.tableNumber!), style: TextStyle( fontSize: 20.0, fontWeight: FontWeight.bold, @@ -358,7 +358,7 @@ class DesktopCheckoutState extends State with SingleTickerProvi icons: shippingMethodIcons, onToggle: (index) { selectedShippingRate = null; - deliveryMethod = getShippingMethod(index); + deliveryMethod = getShippingMethod(index!); check(); }, initialLabelIndex: deliveryMethodIndex, @@ -652,7 +652,7 @@ class DesktopCheckoutState extends State with SingleTickerProvi children: [ Container( child: Text( - bookingTimeList.length > 0 ? '${Utils.timestampToString(context, bookingTimeList[bookingTimeIndex].unixTime)}' + 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 : '')), ), @@ -706,7 +706,7 @@ class DesktopCheckoutState extends State with SingleTickerProvi children: [ Container( child: Text( - paymentPlatforms.length == 0 ? S.of(context).pay_on_deliery : PaymentPlatform.getPaymentPlatformName(context, paymentPlatforms[paymentPlatformIndex].code), + paymentPlatforms.length == 0 ? S.of(context).pay_on_deliery : PaymentPlatform.getPaymentPlatformName(context, paymentPlatforms[paymentPlatformIndex].code!), ), ), Container( @@ -1013,14 +1013,14 @@ class DesktopCheckoutState extends State with SingleTickerProvi children: [ Container( child: Text( - Utils.knownName(context, cartLineItem.name), + Utils.knownName(context, cartLineItem.name!), maxLines: 1, overflow: TextOverflow.ellipsis, ), ), Container( child: Text( - cartLineItem.description, + cartLineItem.description!, style: TextStyle( fontSize: 12.0, color: Colors.black38, @@ -1180,7 +1180,7 @@ class DesktopCheckoutState extends State with SingleTickerProvi column.children.add(Container( padding: EdgeInsets.only(left: 0.0, right: 0.0, top: 10.0, bottom: 0.0), child: Text( - Utils.errorMsg2(context, messages[i].code, messages[i].string), + Utils.errorMsg2(context, messages[i].code!, messages[i].string!), ), )); } @@ -1240,7 +1240,7 @@ class DesktopCheckoutState extends State with SingleTickerProvi child: Container( padding: EdgeInsets.only(left: 16.0, right: 16.0, bottom: 10.0, top: 10.0), child: Text( - '${Utils.timestampToString(context, bookingTime.unixTime)}', + '${Utils.timestampToString(context, bookingTime.unixTime!)}', ), decoration: BoxDecoration( border: Border( @@ -1315,7 +1315,7 @@ class DesktopCheckoutState extends State with SingleTickerProvi padding: EdgeInsets.only(left: 10.0, right: 10.0, top: 10.0, bottom: 10.0), child: Center( child: Text( - '${bookingDateTime.viewDate} (${Utils.getWeekDayName(context, bookingDateTime.unixTime, true)})', + '${bookingDateTime.viewDate} (${Utils.getWeekDayName(context, bookingDateTime.unixTime!, true)})', ), ), ), @@ -1519,7 +1519,7 @@ class DesktopCheckoutState extends State with SingleTickerProvi crossAxisAlignment: CrossAxisAlignment.center, children: [ Container( - child: Util.showImage(paymentPlatform.icon, + child: Util.showImage(paymentPlatform.icon!, errorWidget: (context, url, error) => Icon(Icons.broken_image, size: 50.0, color: Colors.transparent,), fit: BoxFit.cover, width: 50.0, @@ -1529,7 +1529,7 @@ class DesktopCheckoutState extends State with SingleTickerProvi Container( margin: EdgeInsets.only(left: 10.0), child: Text( - PaymentPlatform.getPaymentPlatformName(context, paymentPlatform.code), + PaymentPlatform.getPaymentPlatformName(context, paymentPlatform.code!), style: TextStyle( fontSize: 18.0, fontWeight: FontWeight.bold, @@ -1807,7 +1807,7 @@ class DesktopCheckoutState extends State with SingleTickerProvi Container( padding: EdgeInsets.only(right: 5.0), child: Text( - '${Utils.smartRound(coupon.valueAmount, 2)}', + '${Utils.smartRound(coupon.valueAmount!, 2)}', style: TextStyle( fontSize: 30.0, color: Colors.redAccent, @@ -1843,7 +1843,7 @@ class DesktopCheckoutState extends State with SingleTickerProvi ), Container( child: Text( - '${Utils.smartRound(coupon.valueAmount, 2)}', + '${Utils.smartRound(coupon.valueAmount!, 2)}', style: TextStyle( fontSize: 30.0, color: Colors.redAccent, @@ -1871,7 +1871,7 @@ class DesktopCheckoutState extends State with SingleTickerProvi child: Text( coupon.expirationDate != null ? S.of(context).expiration_date_token( - coupon.expirationDate) : + coupon.expirationDate!) : S.of(context) .no_expiration, style: TextStyle( @@ -1884,7 +1884,7 @@ class DesktopCheckoutState extends State with SingleTickerProvi child: Text( coupon.minAmount! > 0 ? S.of(context).min_order_amount_token( - coupon.minAmount) : + coupon.minAmount!) : S.of(context) .no_restriction, style: TextStyle( @@ -2126,7 +2126,7 @@ class DesktopCheckoutState extends State with SingleTickerProvi left: 16.0, top: 16.0, right: 16.0, bottom: 16.0), child: Container( child: Text( - shippingRate.name, + shippingRate.name!, style: TextStyle( fontSize: 20.0, ), diff --git a/lib/widgets/desktop/desktop_coupons.dart b/lib/widgets/desktop/desktop_coupons.dart index 1cc6f62..1d2632e 100644 --- a/lib/widgets/desktop/desktop_coupons.dart +++ b/lib/widgets/desktop/desktop_coupons.dart @@ -146,7 +146,7 @@ class DesktopCouponsState extends State { overflow: TextOverflow.ellipsis, ), Text( - coupon.description, + coupon.description!, style: TextStyle( fontSize: 12.0, color: Colors.black26, @@ -185,7 +185,7 @@ class DesktopCouponsState extends State { ), Container( child: Text( - '${Utils.smartRound(coupon.valueAmount, 2)}', + '${Utils.smartRound(coupon.valueAmount!, 2)}', style: TextStyle( fontSize: 28.0, color: Colors.redAccent, @@ -200,7 +200,7 @@ class DesktopCouponsState extends State { children: [ Container( child: Text( - '${Utils.smartRound(coupon.valueAmount, 2)}', + '${Utils.smartRound(coupon.valueAmount!, 2)}', style: TextStyle( fontSize: 28.0, color: Colors.redAccent, @@ -222,7 +222,7 @@ class DesktopCouponsState extends State { Container( child: Text( coupon.minAmount! > 0 ? - S.of(context).available_for_order_over_token(coupon.minAmount) : + S.of(context).available_for_order_over_token(coupon.minAmount!) : S.of(context).no_restriction, style: TextStyle( fontSize: 10.0, @@ -261,7 +261,7 @@ class DesktopCouponsState extends State { child: Text( coupon.expirationDate == null || coupon.expirationDate!.length == 0 ? S.of(context).no_expiration : - S.of(context).expiration_date_token(coupon.expirationDate), + S.of(context).expiration_date_token(coupon.expirationDate!), style: TextStyle( color: Colors.black26, fontSize: 15.0, diff --git a/lib/widgets/desktop/desktop_login.dart b/lib/widgets/desktop/desktop_login.dart index 94ea67d..5c17d3e 100644 --- a/lib/widgets/desktop/desktop_login.dart +++ b/lib/widgets/desktop/desktop_login.dart @@ -303,7 +303,7 @@ class DesktopLoginState extends State { box.put(Constants.KEY_USER_ID, response.data['user_id']); box.put(Constants.KEY_ACCESS_TOKEN, response.data['access_token']); if (store.state.redirectRoute != null) { - Routes.router.navigateTo(context, store.state.redirectRoute, + Routes.router.navigateTo(context, store.state.redirectRoute!, replace: true); store.dispatch(UpdateRedirectRoute(null)); } else { diff --git a/lib/widgets/desktop/desktop_me.dart b/lib/widgets/desktop/desktop_me.dart index 9f78ebe..19b6ea4 100644 --- a/lib/widgets/desktop/desktop_me.dart +++ b/lib/widgets/desktop/desktop_me.dart @@ -125,7 +125,7 @@ class DesktopMeState extends State { Container( child: Text( _user != null - ? Utils.safePhoneNumber(_user.mobile) + ? Utils.safePhoneNumber(_user.mobile!) : '', style: TextStyle( color: Colors.black38, @@ -493,7 +493,7 @@ class DesktopMeState extends State { ), ), ), - onTap: tap, + onTap: tap!, ), ); return widget; diff --git a/lib/widgets/desktop/desktop_my_addresses.dart b/lib/widgets/desktop/desktop_my_addresses.dart index cf527de..9055823 100644 --- a/lib/widgets/desktop/desktop_my_addresses.dart +++ b/lib/widgets/desktop/desktop_my_addresses.dart @@ -147,7 +147,7 @@ class DesktopMyAddressesState extends State { children: [ Container( child: Text( - address.addressLine1, + address.addressLine1!, style: TextStyle( fontSize: 19.0, ), @@ -156,7 +156,7 @@ class DesktopMyAddressesState extends State { ), Container( child: Text( - address.addressLine2, + address.addressLine2!, style: TextStyle( fontSize: 13.0, color: Colors.grey, @@ -166,7 +166,7 @@ class DesktopMyAddressesState extends State { Container( margin: EdgeInsets.only(top: 10.0), child: Text( - '${address.contactName} ${Utils.safePhoneNumber(address.phone)}', + '${address.contactName} ${Utils.safePhoneNumber(address.phone!)}', style: TextStyle( fontSize: 15.0, color: Colors.black87, @@ -202,7 +202,7 @@ class DesktopMyAddressesState extends State { ), onPressed: () { Navigator.push(context, MaterialPageRoute( - builder: (BuildContext context) => new EditAddress(address, businessId: widget.businessId,), + builder: (BuildContext context) => new EditAddress(address, businessId: widget.businessId!,), )); }, ), diff --git a/lib/widgets/desktop/desktop_my_support.dart b/lib/widgets/desktop/desktop_my_support.dart index d45170e..b265130 100644 --- a/lib/widgets/desktop/desktop_my_support.dart +++ b/lib/widgets/desktop/desktop_my_support.dart @@ -227,7 +227,7 @@ class DesktopMySupportState extends State { ), Container( child: Text( - Utils.utcDatetimeStringToLocalDatetimeString(context, ticket.createdAt, withTime: true), + Utils.utcDatetimeStringToLocalDatetimeString(context, ticket.createdAt!, withTime: true), style: TextStyle( fontSize: 13.0, color: Colors.grey, @@ -296,7 +296,7 @@ class DesktopMySupportState extends State { void loadTicketes(bool isRefresh) { HttpUtil.httpGet( 'v1/mysupport', - businessId: widget.businessId, + businessId: widget.businessId!, queryParameters: { 'page': _page.toString(), 'size': Constants.TICKET_PER_PAGE_DESKTOP.toString(), diff --git a/lib/widgets/desktop/desktop_new_comment.dart b/lib/widgets/desktop/desktop_new_comment.dart index 3431c6f..2f8e5f2 100644 --- a/lib/widgets/desktop/desktop_new_comment.dart +++ b/lib/widgets/desktop/desktop_new_comment.dart @@ -253,7 +253,7 @@ class DesktopNewCommentState extends State { child: Text(S.of(context).yes_i_am_sure), onPressed: () { Navigator.of(context).pop(); - _deleteImage(image.id); + _deleteImage(image.id!); }, ), ], @@ -305,7 +305,7 @@ class DesktopNewCommentState extends State { context: mainContext, barrierDismissible: true, builder: (BuildContext context) { - return Util().getPicture(mainContext, store.state.user, + return Util().getPicture(mainContext, store.state.user!, commentId: comment != null ? comment.id : 0, orderId: widget.orderId); } diff --git a/lib/widgets/desktop/desktop_order_detail.dart b/lib/widgets/desktop/desktop_order_detail.dart index 5b1f5a2..0bd2807 100644 --- a/lib/widgets/desktop/desktop_order_detail.dart +++ b/lib/widgets/desktop/desktop_order_detail.dart @@ -505,7 +505,7 @@ class DesktopOrderDetailState extends State { margin: EdgeInsets.only(top: 10.0, bottom: 10.0), alignment: Alignment.centerRight, child: Text( - '${Utils.timestampToString(context, order.bookedAt, withTime: true)}', + '${Utils.timestampToString(context, order.bookedAt!, withTime: true)}', style: TextStyle( color: Colors.black38, ), @@ -806,7 +806,7 @@ class DesktopOrderDetailState extends State { margin: EdgeInsets.only(top: 10.0, bottom: 10.0), alignment: Alignment.centerRight, child: Text( - Utils.timestampToString(context, order.createdAt, withTime: true), + Utils.timestampToString(context, order.createdAt!, withTime: true), style: TextStyle( color: Colors.black38, ), @@ -862,7 +862,7 @@ class DesktopOrderDetailState extends State { ), ), Text( - Utils.getOrderStatus(context, order.status), + Utils.getOrderStatus(context, order.status!), maxLines: 1, overflow: TextOverflow.ellipsis, style: TextStyle( @@ -918,7 +918,7 @@ class DesktopOrderDetailState extends State { ), Container( child: Text( - '${Utils.utcDatetimeStringToLocalDatetimeString(context, fulfillment.createdAt, withTime: true)}', + '${Utils.utcDatetimeStringToLocalDatetimeString(context, fulfillment.createdAt!, withTime: true)}', style: TextStyle( fontSize: 12.0, color: Colors.black26, @@ -1053,7 +1053,7 @@ class DesktopOrderDetailState extends State { ), ), onPressed: () { - Utils.orderAgain(context, order.cartInfo); + Utils.orderAgain(context, order.cartInfo!); }, ), ), diff --git a/lib/widgets/desktop/desktop_orders.dart b/lib/widgets/desktop/desktop_orders.dart index 541766d..1d1c56d 100644 --- a/lib/widgets/desktop/desktop_orders.dart +++ b/lib/widgets/desktop/desktop_orders.dart @@ -193,7 +193,7 @@ class DesktopOrdersState extends State with SingleTickerProviderS if (order.cartInfo!.productList!.length > 1) { row.children.add(Container( child: Text( - S.of(context).and_more_item_token(Utils.getProductLineInOrder(order.cartInfo)), + S.of(context).and_more_item_token(Utils.getProductLineInOrder(order.cartInfo!)), style: TextStyle( fontSize: 12.0, color: Colors.black26, @@ -222,7 +222,7 @@ class DesktopOrdersState extends State with SingleTickerProviderS ), onPressed: () { Navigator.push(context, MaterialPageRoute( - builder: (BuildContext context) => OrderDetail(order.id, fromOrders: true,), + builder: (BuildContext context) => OrderDetail(order.id!, fromOrders: true,), )); }, ), @@ -281,7 +281,7 @@ class DesktopOrdersState extends State with SingleTickerProviderS backgroundColor: Theme.of(context).primaryColor, ), onPressed: () { - Utils.orderAgain(context, order.cartInfo); + Utils.orderAgain(context, order.cartInfo!); }, )); } @@ -298,7 +298,7 @@ class DesktopOrdersState extends State with SingleTickerProviderS backgroundColor: Theme.of(context).primaryColor, ), onPressed: () { - Utils.orderAgain(context, order.cartInfo); + Utils.orderAgain(context, order.cartInfo!); }, )); } @@ -346,7 +346,7 @@ class DesktopOrdersState extends State with SingleTickerProviderS ), Container( child: Text( - '#${order.orderNum} ${Utils.timestampToString(context, order.createdAt, withTime: true)}', + '#${order.orderNum} ${Utils.timestampToString(context, order.createdAt!, withTime: true)}', style: TextStyle( fontSize: 12.0, color: Colors.black26, @@ -358,7 +358,7 @@ class DesktopOrdersState extends State with SingleTickerProviderS ), onTap: () { Navigator.push(context, MaterialPageRoute( - builder: (BuildContext context) => OrderDetail(order.id, fromOrders: true,), + builder: (BuildContext context) => OrderDetail(order.id!, fromOrders: true,), )); }, ), @@ -369,7 +369,7 @@ class DesktopOrdersState extends State with SingleTickerProviderS children: [ Container( child: Text( - '${Utils.getOrderStatus(context, order.status)}', + '${Utils.getOrderStatus(context, order.status!)}', style: TextStyle( fontSize: 15.0, fontWeight: FontWeight.bold, @@ -404,7 +404,7 @@ class DesktopOrdersState extends State with SingleTickerProviderS ), onTap: () { Navigator.push(context, MaterialPageRoute( - builder: (BuildContext context) => OrderDetail(order.id, fromOrders: true,), + builder: (BuildContext context) => OrderDetail(order.id!, fromOrders: true,), )); }, ), diff --git a/lib/widgets/desktop/desktop_pay_now.dart b/lib/widgets/desktop/desktop_pay_now.dart index fe5d935..01b44a3 100644 --- a/lib/widgets/desktop/desktop_pay_now.dart +++ b/lib/widgets/desktop/desktop_pay_now.dart @@ -174,7 +174,7 @@ class DesktopPayNowState extends State { children: [ Container( padding: EdgeInsets.only(right: 10.0), - child: Util.showImage(paymentPlatform.icon, + child: Util.showImage(paymentPlatform.icon!, errorWidget: (context, url, error) => Icon(Icons.broken_image, size: 50.0, color: Colors.transparent,), fit: BoxFit.cover, width: 50.0, @@ -183,7 +183,7 @@ class DesktopPayNowState extends State { ), Expanded( child: Text( - S.of(context).pay_with_token(PaymentPlatform.getPaymentPlatformName(context, paymentPlatform.code)), + S.of(context).pay_with_token(PaymentPlatform.getPaymentPlatformName(context, paymentPlatform.code!)), style: TextStyle( fontSize: 18.0, fontWeight: FontWeight.bold, diff --git a/lib/widgets/desktop/desktop_plain_page.dart b/lib/widgets/desktop/desktop_plain_page.dart index 10d5d6e..6a7018f 100644 --- a/lib/widgets/desktop/desktop_plain_page.dart +++ b/lib/widgets/desktop/desktop_plain_page.dart @@ -43,7 +43,7 @@ class DesktopPlainPageState extends State { padding: EdgeInsets.only(top: 20, left: 16.0, right: 16.0, bottom: 16.0), child: Center( child: Text( - widget.blog.title, + widget.blog.title!, style: TextStyle( fontWeight: FontWeight.bold, fontSize: 20, @@ -55,7 +55,7 @@ class DesktopPlainPageState extends State { padding: EdgeInsets.only(left: 16.0, right: 16.0, bottom: 20.0), child: MarkdownBody( shrinkWrap: true, - data: widget.blog.body, + data: widget.blog.body!, ), )); @@ -64,7 +64,7 @@ class DesktopPlainPageState extends State { title: S.of(context).blog, back: true, breadCrumbs: [ - BreadCrumb(widget.blog.title, null), + BreadCrumb(widget.blog.title!, null), ], breadCrumbHeight: Constants.BREADCRUMB_HEIGHT, ), diff --git a/lib/widgets/desktop/desktop_product_detail_page.dart b/lib/widgets/desktop/desktop_product_detail_page.dart index e716ad0..9924de7 100644 --- a/lib/widgets/desktop/desktop_product_detail_page.dart +++ b/lib/widgets/desktop/desktop_product_detail_page.dart @@ -83,7 +83,7 @@ class DesktopProductDetailPageState extends State title: S.of(context).shop, back: true, breadCrumbs: [ - BreadCrumb(productDetail.name, null), + BreadCrumb(productDetail.name!, null), ], breadCrumbHeight: Constants.BREADCRUMB_HEIGHT, // shoppingCart: DesktopShoppingCartWidget(business: widget.business,), @@ -125,7 +125,7 @@ class DesktopProductDetailPageState extends State ), Container( child: Text( - productDetail.name, + productDetail.name!, overflow: TextOverflow.ellipsis, maxLines: 2, style: TextStyle( @@ -163,7 +163,7 @@ class DesktopProductDetailPageState extends State crossAxisAlignment: CrossAxisAlignment.start, children: [ ShowPrice( - productDetail.price, + productDetail.price!, currencySign: '\$', fontWeight: FontWeight.bold, smallFontSize: 24, @@ -208,13 +208,13 @@ class DesktopProductDetailPageState extends State crossAxisAlignment: CrossAxisAlignment.start, children: [ (productDetail.subproducts!.length > 0) ? - subProducts(productDetail.subproducts) : + subProducts(productDetail.subproducts!) : SizedBox.shrink(), Container( padding: EdgeInsets.only( top: 10.0, left: 10.0, right: 10.0, bottom: 16.0), child: Text( - productDetail.description, + productDetail.description!, style: TextStyle( fontSize: 14.0, color: Colors.black54), ), @@ -253,7 +253,7 @@ class DesktopProductDetailPageState extends State children: [ Container( child: Text( - S.of(context).weight_token(productDetail.weight), + S.of(context).weight_token(productDetail.weight!), style: TextStyle( fontSize: 12.0, color: Colors.black54, @@ -263,9 +263,9 @@ class DesktopProductDetailPageState extends State Container( child: Text( S.of(context).dimentions_token( - productDetail.dimentionsLength, - productDetail.dimentionsWidth, - productDetail.dimentionsHeight), + productDetail.dimentionsLength!, + productDetail.dimentionsWidth!, + productDetail.dimentionsHeight!), style: TextStyle( fontSize: 12.0, color: Colors.black54, @@ -301,7 +301,7 @@ class DesktopProductDetailPageState extends State Widget getImage(double width) { if (productDetail.images!.length <= 0) { return Util.showImage( - productDetail.image, + productDetail.image!, width: width, height: width, ); @@ -427,7 +427,7 @@ class DesktopProductDetailPageState extends State _tabController = TabController(vsync: this, length: 2); HttpUtil.httpGet( 'v1/product-detail/${widget.product.id}', - businessId: widget.business.id, + businessId: widget.business.id!, ).then((value) { print(value); productDetail = ProductDetail.fromJson(value); @@ -452,7 +452,7 @@ class DesktopProductDetailPageState extends State List _getProductPictures(BuildContext context) { var pages = []; List images = []; - images.add(productDetail.image); + images.add(productDetail.image!); for (var i = 0; i < productDetail.images!.length; i++) { // print('>>https:' + productDetail.images[i].image); images.add(productDetail.images![i].image); diff --git a/lib/widgets/desktop/desktop_search_place.dart b/lib/widgets/desktop/desktop_search_place.dart index 59b9dc4..3d61e80 100644 --- a/lib/widgets/desktop/desktop_search_place.dart +++ b/lib/widgets/desktop/desktop_search_place.dart @@ -72,8 +72,8 @@ class DesktopSearchPlaceState extends State { onSearch: search, onItemFound: (LocatedAddress locatedAddress, int index) { return ListTile( - title: Text(locatedAddress.streetName), - subtitle: Text(locatedAddress.formattedAddress), + title: Text(locatedAddress.streetName!), + subtitle: Text(locatedAddress.formattedAddress!), onTap: () { if (widget.businessId == 0) { _selectPlace(locatedAddress); @@ -130,7 +130,7 @@ class DesktopSearchPlaceState extends State { if (result.response != null) { throw RuntimeError(result.response!.data['message']); } else { - throw RuntimeError(result.message); + throw RuntimeError(result.message!); } } else if (result != null && result is List) { return result.map((e) => LocatedAddress.fromJson(e)).toList(); diff --git a/lib/widgets/desktop/desktop_shopping_cart_widget.dart b/lib/widgets/desktop/desktop_shopping_cart_widget.dart index 08f38b8..6409195 100644 --- a/lib/widgets/desktop/desktop_shopping_cart_widget.dart +++ b/lib/widgets/desktop/desktop_shopping_cart_widget.dart @@ -59,7 +59,7 @@ class DesktopShoppingCartWidgetState extends State { child: row, width: 160.0, ), - onTap: widget.onTap, + onTap: widget.onTap!, ), ); } diff --git a/lib/widgets/desktop/desktop_store_product_search.dart b/lib/widgets/desktop/desktop_store_product_search.dart index 5deedda..2c6f0a0 100644 --- a/lib/widgets/desktop/desktop_store_product_search.dart +++ b/lib/widgets/desktop/desktop_store_product_search.dart @@ -136,7 +136,7 @@ class DesktopStoreProductSearchState extends State { if (result.response != null) { throw RuntimeError(result.response!.data); } else { - throw RuntimeError(result.message); + throw RuntimeError(result.message!); } } else if (result != null && result is List) { lastBottomPosition = 0; diff --git a/lib/widgets/desktop/desktop_user_profile.dart b/lib/widgets/desktop/desktop_user_profile.dart index 38aba47..4f7d77f 100644 --- a/lib/widgets/desktop/desktop_user_profile.dart +++ b/lib/widgets/desktop/desktop_user_profile.dart @@ -153,7 +153,7 @@ class DesktopUserProfileState extends State { ), Container( child: Text( - _user.nickname, + _user.nickname!, style: TextStyle( color: Colors.grey ), @@ -253,7 +253,7 @@ class DesktopUserProfileState extends State { ), 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 { ), 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, ), diff --git a/lib/widgets/desktop/desktop_view_blog.dart b/lib/widgets/desktop/desktop_view_blog.dart index 8bde1d3..f02c8a5 100644 --- a/lib/widgets/desktop/desktop_view_blog.dart +++ b/lib/widgets/desktop/desktop_view_blog.dart @@ -105,7 +105,7 @@ class DesktopViewBlogState extends State { ), ), Text( - Utils.utcDatetimeStringToLocalDatetimeString(context, blog.createdAt), + Utils.utcDatetimeStringToLocalDatetimeString(context, blog.createdAt!), style: TextStyle( fontSize: 14.0, color: Colors.black38, diff --git a/lib/widgets/desktop/desktop_view_ticket.dart b/lib/widgets/desktop/desktop_view_ticket.dart index b765a65..cad8f7a 100644 --- a/lib/widgets/desktop/desktop_view_ticket.dart +++ b/lib/widgets/desktop/desktop_view_ticket.dart @@ -220,14 +220,14 @@ class DesktopViewTicketState extends State { crossAxisAlignment: CrossAxisAlignment.end, children: [ Text( - S.of(context).ticket_number_token(ticket.id), + S.of(context).ticket_number_token(ticket.id!), style: TextStyle( fontSize: 24.0, color: Colors.black ), ), Text( - Utils.utcDatetimeStringToLocalDatetimeString(context, ticket.createdAt), + Utils.utcDatetimeStringToLocalDatetimeString(context, ticket.createdAt!), style: TextStyle( fontSize: 14.0, color: Colors.black38, @@ -331,7 +331,7 @@ class DesktopViewTicketState extends State { Text( Utils.utcDatetimeStringToLocalDatetimeString( context, - followUp.createdAt + followUp.createdAt! ), style: TextStyle( fontSize: 14.0, @@ -364,7 +364,7 @@ class DesktopViewTicketState extends State { child: SingleChildScrollView( scrollDirection: Axis.horizontal, child: showGalleryImages( - mainContext, followUp.files, + mainContext, followUp.files!, ), ), ), diff --git a/lib/widgets/desktop/product_item.dart b/lib/widgets/desktop/product_item.dart index e35752f..e0f6e1a 100644 --- a/lib/widgets/desktop/product_item.dart +++ b/lib/widgets/desktop/product_item.dart @@ -125,7 +125,7 @@ class ProductItemState extends State { ), ), Text( - widget.product.description, + widget.product.description!, // overflow: kIsWeb ? null : TextOverflow.ellipsis, overflow: TextOverflow.ellipsis, maxLines: 2, @@ -150,7 +150,7 @@ class ProductItemState extends State { ) : SizedBox.shrink(), ), ShowPrice( - widget.product.price, + widget.product.price!, regularPrice: widget.product.regularPrice, currencySign: '\$', fontWeight: FontWeight.bold, @@ -212,7 +212,7 @@ class ProductItemState extends State { ), Container( child: Text( - widget.product.description, + widget.product.description!, // overflow: kIsWeb ? null : TextOverflow.ellipsis, overflow: TextOverflow.ellipsis, maxLines: 2, @@ -238,7 +238,7 @@ class ProductItemState extends State { ) : SizedBox.shrink(), ), ShowPrice( - widget.product.price, + widget.product.price!, regularPrice: widget.product.regularPrice, currencySign: '\$', fontWeight: FontWeight.bold, diff --git a/lib/widgets/desktop/product_search.dart b/lib/widgets/desktop/product_search.dart index 9cdf7de..da06e80 100644 --- a/lib/widgets/desktop/product_search.dart +++ b/lib/widgets/desktop/product_search.dart @@ -144,7 +144,7 @@ class ProductSearchState extends State { if (result.response != null) { throw RuntimeError(result.response!.data); } else { - throw RuntimeError(result.message); + throw RuntimeError(result.message!); } } else if (result != null && result is List) { lastBottomPosition = 0; diff --git a/lib/widgets/desktop/shop.dart b/lib/widgets/desktop/shop.dart index 91ea41d..80c9e75 100644 --- a/lib/widgets/desktop/shop.dart +++ b/lib/widgets/desktop/shop.dart @@ -206,7 +206,7 @@ class ShopState extends State { } _productCurrentPage = 1; Utils.loadProducts( - widget.businessId, categoryId, _productCurrentPage, false, + widget.businessId!, categoryId, _productCurrentPage, false, (value) { if (_isLoading) { _isLoading = false; @@ -251,7 +251,7 @@ class ShopState extends State { return; } _productCurrentPage += 1; - Utils.loadProducts(widget.businessId, categoryId, _productCurrentPage, true, (value) { + Utils.loadProducts(widget.businessId!, categoryId, _productCurrentPage, true, (value) { if (_isLoading) { _isLoading = false; Navigator.of(context).pop(); diff --git a/lib/widgets/desktop/shop_bulletin.dart b/lib/widgets/desktop/shop_bulletin.dart index f2cc3ea..3be2cf8 100644 --- a/lib/widgets/desktop/shop_bulletin.dart +++ b/lib/widgets/desktop/shop_bulletin.dart @@ -50,7 +50,7 @@ class ShopBulletinState extends State { decoration: BoxDecoration( color: Colors.orangeAccent, border: Border.all( - color: Colors.red[500], + color: Colors.red[500]!, width: 1.0, ), borderRadius: BorderRadius.all(Radius.circular(16)), diff --git a/lib/widgets/desktop/shop_products.dart b/lib/widgets/desktop/shop_products.dart index 666fa36..84146c7 100644 --- a/lib/widgets/desktop/shop_products.dart +++ b/lib/widgets/desktop/shop_products.dart @@ -135,7 +135,7 @@ class ShopProductsState extends State { child: Container( margin: EdgeInsets.only(top: 5.0, bottom: 5.0), child: Text( - cp.name, + cp.name!, style: TextStyle( fontSize: 13.0, fontWeight: (cp.id == Constants.FEATURED_PRODUCT_ID || @@ -182,7 +182,7 @@ class ShopProductsState extends State { new BorderSide(color: new Color(0xFFEBEBEB)))), child: categoryRow, ), - onTap: () => _selectCategory(cp.id), + onTap: () => _selectCategory(cp.id!), ); } ), @@ -207,7 +207,7 @@ class ShopProductsState extends State { CategoryProducts cp = _categoryProducts[i]; if (cp.products!.length > 0) { col.children.add(new Container( - height: _categoryDescHeight, + height: _categoryDescHeight!, padding: new EdgeInsets.symmetric(horizontal: 10.0), color: new Color(0xFFF5F5F5), child: new Row( @@ -221,7 +221,7 @@ class ShopProductsState extends State { new Padding( padding: new EdgeInsets.only(right: 5.0), child: new Text( - cp.name, + cp.name!, style: new TextStyle( fontSize: 16.0, fontWeight: @@ -241,7 +241,7 @@ class ShopProductsState extends State { new Visibility( visible: cp.description!.isNotEmpty, child: new Text( - cp.description, + cp.description!, overflow: TextOverflow.ellipsis, style: new TextStyle( fontSize: 10.0, @@ -388,7 +388,7 @@ class ShopProductsState extends State { CategoryProducts currentCp = getCategoryProductByCategoryId(categoryId); if (currentCp != null) { - currentCp.products!.addAll(moreCategoryProducts[0].products); + currentCp.products!.addAll(moreCategoryProducts[0].products!); } else { displayProductByCategoryClickIndicator = S .of(context) diff --git a/lib/widgets/desktop/shopping_cart_widget.dart b/lib/widgets/desktop/shopping_cart_widget.dart index 1e273f5..8510e7a 100644 --- a/lib/widgets/desktop/shopping_cart_widget.dart +++ b/lib/widgets/desktop/shopping_cart_widget.dart @@ -60,7 +60,7 @@ class ShoppingCartWidgetState extends State { child: row, width: 160.0, ), - onTap: widget.onTap, + onTap: widget.onTap!, ), ); } diff --git a/lib/widgets/general/add_remove_button.dart b/lib/widgets/general/add_remove_button.dart index 0eacc8f..a864761 100644 --- a/lib/widgets/general/add_remove_button.dart +++ b/lib/widgets/general/add_remove_button.dart @@ -61,7 +61,7 @@ class AddRemoveButtonState extends State { Widget build(BuildContext context) { if (widget.product!.leftNum == null) { _qty = 0; - cartInfo = Utils.getCartInfoByBusiness(store.state.cartInfos, widget.business); + 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 @@ -102,7 +102,7 @@ class AddRemoveButtonState extends State { } if (widget.addToBasket) { _qty = 0; - cartInfo = Utils.getCartInfoByBusiness(store.state.cartInfos, widget.business); + 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) { @@ -195,7 +195,7 @@ class AddRemoveButtonState extends State { ); } else { _qty = 0; - cartInfo = Utils.getCartInfoByBusiness(store.state.cartInfos, widget.business); + 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) { @@ -336,9 +336,9 @@ class AddRemoveButtonState extends State { product: widget.product, business: widget.business, startKey: startKey,)), ); } else { - eventBus.fire(new OnProductWillAddToCart(widget.product, {}, + eventBus.fire(new OnProductWillAddToCart(widget.product!, {}, widget.product!.price, widget.product!.description, - widget.business, buttonKey: startKey)); + widget.business!, buttonKey: startKey)); } } } @@ -375,7 +375,7 @@ class AddRemoveButtonState extends State { } } else { eventBus.fire(new OnProductWillRemoveFromCart( - widget.product, -1, widget.business)); + widget.product!, -1, widget.business!)); } } diff --git a/lib/widgets/general/animation_point_manager.dart b/lib/widgets/general/animation_point_manager.dart index 321e3bc..9fa906c 100644 --- a/lib/widgets/general/animation_point_manager.dart +++ b/lib/widgets/general/animation_point_manager.dart @@ -24,7 +24,7 @@ class AnimationPointManager { Animation animation = createAnimation(controller1); AnimatedWidget animatedWidget = ParabolicAnimationWidget( - animation: animation, + animation: animation!, stackKey: stackKey, startKey: startKey, endKey: endKey, @@ -59,7 +59,7 @@ class AnimationPointManager { Offset popupOffset = Offset.zero, AnimationStatusListener? statusListener, }) async { - controller2 = createController(vsync, duration); + controller2 = createController(vsync, duration!); AnimatedWidget animatedWidget = PopupAnimationWidget( animation: controller2.view, diff --git a/lib/widgets/general/attribute/check_options.dart b/lib/widgets/general/attribute/check_options.dart index f7f9ce7..2965d58 100644 --- a/lib/widgets/general/attribute/check_options.dart +++ b/lib/widgets/general/attribute/check_options.dart @@ -133,7 +133,7 @@ class CheckOptionsState extends OptionsBaseState { if (selections.containsKey(product.productAttributes![index].name!.toUpperCase())) { - Map attrExtraJson = Utils.stringToJson( + Map attrExtraJson = Utils.stringToJson(! product.productAttributes![index].extra); if (attrExtraJson != null) { var selectLimitIfFieldEqualsTo = Rule.getRule( @@ -187,17 +187,17 @@ class CheckOptionsState extends OptionsBaseState { } for (var i = 0; i < productOptions.length; i++) { - Map extraJson = Utils.stringToJson( - productOptions[i].extra); + Map extraJson = Utils.stringToJson(! + productOptions[i].extra!); if (extraJson != null) { Map exclusiveRule = Rule.getRule( extraJson, Rule.RULE_EXCLUSIVE_SELECTION); Map multiItemRule = Rule.getRule(extraJson, Rule.RULE_ACTUAL_QTY_IS); if (exclusiveRule != null) { - if (thisLimitQty > 0 && !_checkOptionIsCheck(productOptions[i].name)) { + if (thisLimitQty > 0 && !_checkOptionIsCheck(productOptions[i].name!)) { optionsState[product.productAttributes![index].name][i]['disabled'] = true; } else { - if (_checkOptionIsCheck(productOptions[i].name)) { + if (_checkOptionIsCheck(productOptions[i].name!)) { setOptionsStateDisabled( product.productAttributes![index].name, true); optionsState[product.productAttributes![index] @@ -207,7 +207,7 @@ class CheckOptionsState extends OptionsBaseState { } } if (multiItemRule != null) { - if (_checkOptionIsCheck(productOptions[i].name)) { + if (_checkOptionIsCheck(productOptions[i].name!)) { if (multiItemRule[Rule.RULE_ACTUAL_QTY_IS] > thisLimitQty - (selections[product.productAttributes![index].name!.toUpperCase()] as List).length) { disableOptionIfNotSelected(); } @@ -249,9 +249,9 @@ class CheckOptionsState extends OptionsBaseState { Widget _getOptionCheck(ProductOption productOption, bool optDisabled, int optIndex) { bool disabled = optDisabled; - bool check = _checkOptionIsCheck(productOption.name); + bool check = _checkOptionIsCheck(productOption.name!); - Map extraJson = Utils.stringToJson(productOption.extra); + Map extraJson = Utils.stringToJson(productOption.extra!); // Utils.jsonPrettyPrint(extraJson); double extraAdjustAmount = 0.0; @@ -333,7 +333,7 @@ class CheckOptionsState extends OptionsBaseState { mainAxisAlignment: MainAxisAlignment.center, children: [ new Text( - productOption.name, + productOption.name!, style: new TextStyle( fontSize: 14.0, color: check ? selectedTextColor : deselectTextColor, diff --git a/lib/widgets/general/attribute/qty_options.dart b/lib/widgets/general/attribute/qty_options.dart index bd06cea..c7e902b 100644 --- a/lib/widgets/general/attribute/qty_options.dart +++ b/lib/widgets/general/attribute/qty_options.dart @@ -131,7 +131,7 @@ class QtyOptionsState extends OptionsBaseState { List> 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']; } @@ -141,7 +141,7 @@ class QtyOptionsState extends OptionsBaseState { } if (selections.containsKey(product.productAttributes![index].name!.toUpperCase())) { - Map attrExtraJson = Utils.stringToJson( + Map attrExtraJson = Utils.stringToJson(! product.productAttributes![index].extra); if (attrExtraJson != null) { var selectLimitIfFieldEqualsTo = Rule.getRule( @@ -195,17 +195,17 @@ class QtyOptionsState extends OptionsBaseState { } for (var i = 0; i < productOptions.length; i++) { - Map extraJson = Utils.stringToJson( - productOptions[i].extra); + Map extraJson = Utils.stringToJson(! + productOptions[i].extra!); if (extraJson != null) { Map exclusiveRule = Rule.getRule( extraJson, Rule.RULE_EXCLUSIVE_SELECTION); Map multiItemRule = Rule.getRule(extraJson, Rule.RULE_ACTUAL_QTY_IS); if (exclusiveRule != null) { - if (thisLimitQty > 0 && !_checkOptionIsCheck(productOptions[i].name)) { + if (thisLimitQty > 0 && !_checkOptionIsCheck(productOptions[i].name!)) { optionsState[product.productAttributes![index].name][i]['disabled'] = true; } else { - if (_checkOptionIsCheck(productOptions[i].name)) { + if (_checkOptionIsCheck(productOptions[i].name!)) { setOptionsStateDisabled( product.productAttributes![index].name, true); optionsState[product.productAttributes![index] @@ -215,7 +215,7 @@ class QtyOptionsState extends OptionsBaseState { } } if (multiItemRule != null) { - if (_checkOptionIsCheck(productOptions[i].name)) { + if (_checkOptionIsCheck(productOptions[i].name!)) { if (multiItemRule[Rule.RULE_ACTUAL_QTY_IS] > thisLimitQty - (selections[product.productAttributes![index].name!.toUpperCase()] as List).length) { disableOptionIfNotSelected(); } @@ -257,9 +257,9 @@ class QtyOptionsState extends OptionsBaseState { Widget _getOptionQty(ProductOption productOption, bool optDisabled, int quantity, int optIndex) { bool disabled = optDisabled; - bool check = _checkOptionIsCheck(productOption.name); + bool check = _checkOptionIsCheck(productOption.name!); - Map extraJson = Utils.stringToJson(productOption.extra); + Map extraJson = Utils.stringToJson(productOption.extra!); // Utils.jsonPrettyPrint(extraJson); double extraAdjustAmount = 0.0; @@ -351,7 +351,7 @@ class QtyOptionsState extends OptionsBaseState { mainAxisAlignment: MainAxisAlignment.center, children: [ new Text( - productOption.name, + productOption.name!, style: new TextStyle( fontSize: 14.0, color: check ? selectedTextColor : deselectTextColor, diff --git a/lib/widgets/general/attribute/radio_options.dart b/lib/widgets/general/attribute/radio_options.dart index ed89f19..f5e5be6 100644 --- a/lib/widgets/general/attribute/radio_options.dart +++ b/lib/widgets/general/attribute/radio_options.dart @@ -96,12 +96,12 @@ class RadioOptionsState extends OptionsBaseState { } } - Map extraJson = Utils.stringToJson(productOption.extra); + Map extraJson = Utils.stringToJson(productOption.extra!); if (extraJson != null) { Map exclusiveRule = Rule.getRule( extraJson, Rule.RULE_EXCLUSIVE_SELECTION); if (exclusiveRule != null) { - if (_checkOptionIsCheck(productOption.name)) { + if (_checkOptionIsCheck(productOption.name!)) { setOptionsStateDisabled(product.productAttributes![index].name, false); } } @@ -129,12 +129,12 @@ class RadioOptionsState extends OptionsBaseState { } for (var i = 0; i < productOptions.length; i++) { - Map extraJson = Utils.stringToJson(productOptions[i].extra); + Map extraJson = Utils.stringToJson(productOptions[i].extra!); if (extraJson != null) { Map exclusiveRule = Rule.getRule( extraJson, Rule.RULE_EXCLUSIVE_SELECTION); if (exclusiveRule != null) { - if (_checkOptionIsCheck(productOptions[i].name)) { + if (_checkOptionIsCheck(productOptions[i].name!)) { setOptionsStateDisabled(product.productAttributes![index].name, true); optionsState[product.productAttributes![index].name][i]['disabled'] = false; break; @@ -161,9 +161,9 @@ class RadioOptionsState extends OptionsBaseState { Widget _getOptionRadio(ProductOption productOption, bool optDisabled, int optIndex) { bool disabled = optDisabled; - bool check = _checkOptionIsCheck(productOption.name); + bool check = _checkOptionIsCheck(productOption.name!); - Map extraJson = Utils.stringToJson(productOption.extra); + Map extraJson = Utils.stringToJson(productOption.extra!); // Utils.jsonPrettyPrint(extraJson); double extraAdjustAmount = 0.0; @@ -245,7 +245,7 @@ class RadioOptionsState extends OptionsBaseState { mainAxisAlignment: MainAxisAlignment.center, children: [ new Text( - productOption.name, + productOption.name!, style: new TextStyle( fontSize: 14.0, color: check ? selectedTextColor : deselectTextColor, diff --git a/lib/widgets/general/show_price.dart b/lib/widgets/general/show_price.dart index d73e35e..9f67e59 100644 --- a/lib/widgets/general/show_price.dart +++ b/lib/widgets/general/show_price.dart @@ -36,7 +36,7 @@ class ShowPrice extends StatelessWidget { Container( padding: EdgeInsets.only(top: largeFontSize / 10.0), child: Text( - currencySign, + currencySign!, style: TextStyle( fontSize: smallFontSize, color: color, diff --git a/lib/widgets/general/sliding_up_panel.dart b/lib/widgets/general/sliding_up_panel.dart index dad9e28..c54adbd 100644 --- a/lib/widgets/general/sliding_up_panel.dart +++ b/lib/widgets/general/sliding_up_panel.dart @@ -258,7 +258,7 @@ class _SlidingUpPanelState extends State with SingleTickerProvid builder: (context, child){ return Positioned( top: widget.parallaxEnabled ? _getParallax() : 0.0, - child: child, + child: child!, ); }, child: Container( @@ -334,14 +334,14 @@ class _SlidingUpPanelState extends State with SingleTickerProvid widget.header != null ? Positioned( top: widget.slideDirection == SlideDirection.UP ? 0.0 : null, bottom: widget.slideDirection == SlideDirection.DOWN ? 0.0 : null, - child: widget.header, + child: widget.header!, ) : Container(), // footer widget.footer != null ? Positioned( top: widget.slideDirection == SlideDirection.UP ? null : 0.0, bottom: widget.slideDirection == SlideDirection.DOWN ? null : 0.0, - child: widget.footer + child: widget.footer! ) : Container(), // collapsed panel @@ -471,7 +471,7 @@ class _SlidingUpPanelState extends State with SingleTickerProvid if(v.pixelsPerSecond.dy.abs() >= kSnap*minFlingVelocity || minDistance == d2Snap) _ac.fling(velocity: visualVelocity); else - _flingPanelToPosition(widget.snapPoint, visualVelocity); + _flingPanelToPosition(widget.snapPoint!, visualVelocity); // no snap point exists }else if(widget.panelSnapping){ @@ -495,7 +495,7 @@ class _SlidingUpPanelState extends State with SingleTickerProvid if(minDistance == d2Close){ _close(); }else if(minDistance == d2Snap){ - _flingPanelToPosition(widget.snapPoint, visualVelocity); + _flingPanelToPosition(widget.snapPoint!, visualVelocity); }else{ _open(); } @@ -561,7 +561,7 @@ class _SlidingUpPanelState extends State with SingleTickerProvid //REQUIRES that widget.snapPoint != null Future _animatePanelToSnapPoint({Duration? duration, Curve curve = Curves.linear}){ assert(widget.snapPoint != null); - return _ac.animateTo(widget.snapPoint, duration: duration, curve: curve); + return _ac.animateTo(widget.snapPoint!, duration: duration, curve: curve); } //set the panel position to value - must diff --git a/lib/widgets/mobile/create_online_store_1.dart b/lib/widgets/mobile/create_online_store_1.dart index 2e9e966..6c455c0 100644 --- a/lib/widgets/mobile/create_online_store_1.dart +++ b/lib/widgets/mobile/create_online_store_1.dart @@ -187,7 +187,7 @@ class CreateOnlineStore1State extends State { onPressed: () { Navigator.pushReplacement(context, MaterialPageRoute( builder: (BuildContext context) => - BuyService(group.id, Constants.WEB_MINISTORE_SERVICE, + BuyService(group.id!, Constants.WEB_MINISTORE_SERVICE, domain: existing_web_svc['domain'], sid: existing_web_svc['store']['id'], ), @@ -304,7 +304,7 @@ class CreateOnlineStore1State extends State { onPressed: () { Navigator.pushReplacement(context, MaterialPageRoute( builder: (BuildContext context) => - BuyService(group.id, Constants.WEB_MINISTORE_SERVICE, + BuyService(group.id!, Constants.WEB_MINISTORE_SERVICE, domain: selectedDomain, sid: selectedStore['id'], ), diff --git a/lib/widgets/mobile/mobile_attribute_selection.dart b/lib/widgets/mobile/mobile_attribute_selection.dart index a44a49f..1ebbef2 100644 --- a/lib/widgets/mobile/mobile_attribute_selection.dart +++ b/lib/widgets/mobile/mobile_attribute_selection.dart @@ -119,7 +119,7 @@ class MobileAttributeSelectionState extends State { }); ProductAttribute pa = product.productAttributes![index]; - if (pa.required && Utils.selectionsNotEmptyAt(selections, pa.name)) { + if (pa.required && Utils.selectionsNotEmptyAt(selections, pa.name!)) { setState(() { nextButtonEnable = true; productDesc = product.description! + ', ' + extendDescription.join('; '); @@ -143,7 +143,7 @@ class MobileAttributeSelectionState extends State { bool _checkCanGoNext() { ProductAttribute pa = product.productAttributes![index]; - if (pa.required && Utils.selectionsNotEmptyAt(selections, pa.name)) { + if (pa.required && Utils.selectionsNotEmptyAt(selections, pa.name!)) { return true; } else if (!pa.required){ return true; @@ -180,7 +180,7 @@ class MobileAttributeSelectionState extends State { padding: new EdgeInsets.all(10.0), width: 70.0, height: 70.0, - child: Util.showImage(product.imagePath, + child: Util.showImage(product.imagePath!, width: 70.0, height: 70.0, fit: BoxFit.fill, @@ -194,7 +194,7 @@ class MobileAttributeSelectionState extends State { new Container( padding: new EdgeInsets.all(10.0).copyWith(left: 0.0).copyWith(bottom: 0.0), child: new Text( - product.name, + product.name!, style: new TextStyle( fontSize: 15.0, ), diff --git a/lib/widgets/mobile/mobile_blog.dart b/lib/widgets/mobile/mobile_blog.dart index 8f7d0ad..20ccafa 100644 --- a/lib/widgets/mobile/mobile_blog.dart +++ b/lib/widgets/mobile/mobile_blog.dart @@ -165,7 +165,7 @@ class MobileBlogState extends State { children: [ Container( child: Text( - blog.title, + blog.title!, style: TextStyle( fontSize: 19.0, ), @@ -174,7 +174,7 @@ class MobileBlogState extends State { ), Container( child: Text( - Utils.utcDatetimeStringToLocalDatetimeString(context, blog.createdAt), + Utils.utcDatetimeStringToLocalDatetimeString(context, blog.createdAt!), style: TextStyle( fontSize: 13.0, color: Colors.grey, @@ -217,7 +217,7 @@ class MobileBlogState extends State { _loadingFinish = false; HttpUtil.httpGet( 'v1/blogs', - businessId: widget.businessId, + businessId: widget.businessId!, queryParameters: { 'page': _page.toString(), 'size': Constants.BLOG_PER_PAGE_MOBILE.toString() diff --git a/lib/widgets/mobile/mobile_buy_service.dart b/lib/widgets/mobile/mobile_buy_service.dart index 3ab13e5..143c203 100644 --- a/lib/widgets/mobile/mobile_buy_service.dart +++ b/lib/widgets/mobile/mobile_buy_service.dart @@ -86,7 +86,7 @@ class MobileBuyServiceState extends State { items: plans.map((e) { return DropdownMenuItem( value: e, - child: Text(e.name), + child: Text(e.name!), ); }).toList(), isExpanded: true, diff --git a/lib/widgets/mobile/mobile_checkout.dart b/lib/widgets/mobile/mobile_checkout.dart index 5f59cfe..6643edf 100644 --- a/lib/widgets/mobile/mobile_checkout.dart +++ b/lib/widgets/mobile/mobile_checkout.dart @@ -281,7 +281,7 @@ class MobileCheckoutState extends State with SingleTickerProvide mainAxisSize: MainAxisSize.min, children: [ Text( - S.of(context).table_token(store.state.tableNumber), + S.of(context).table_token(store.state.tableNumber!), style: TextStyle( fontSize: 20.0, fontWeight: FontWeight.bold, @@ -333,7 +333,7 @@ class MobileCheckoutState extends State with SingleTickerProvide icons: shippingMethodIcons, onToggle: (index) { selectedShippingRate = null; - deliveryMethod = getShippingMethod(index); + deliveryMethod = getShippingMethod(index!); check(); }, initialLabelIndex: deliveryMethodIndex, @@ -627,7 +627,7 @@ class MobileCheckoutState extends State with SingleTickerProvide children: [ Container( child: Text( - bookingTimeList.length > 0 ? '${Utils.timestampToString(context, bookingTimeList[bookingTimeIndex].unixTime)}' + 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 : '')), ), @@ -681,7 +681,7 @@ class MobileCheckoutState extends State with SingleTickerProvide children: [ Container( child: Text( - paymentPlatforms.length == 0 ? S.of(context).pay_on_deliery : PaymentPlatform.getPaymentPlatformName(context, paymentPlatforms[paymentPlatformIndex].code), + paymentPlatforms.length == 0 ? S.of(context).pay_on_deliery : PaymentPlatform.getPaymentPlatformName(context, paymentPlatforms[paymentPlatformIndex].code!), ), ), Container( @@ -988,14 +988,14 @@ class MobileCheckoutState extends State with SingleTickerProvide children: [ Container( child: Text( - Utils.knownName(context, cartLineItem.name), + Utils.knownName(context, cartLineItem.name!), maxLines: 1, overflow: TextOverflow.ellipsis, ), ), Container( child: Text( - cartLineItem.description, + cartLineItem.description!, style: TextStyle( fontSize: 12.0, color: Colors.black38, @@ -1155,7 +1155,7 @@ class MobileCheckoutState extends State with SingleTickerProvide column.children.add(Container( padding: EdgeInsets.only(left: 0.0, right: 0.0, top: 10.0, bottom: 0.0), child: Text( - Utils.errorMsg2(context, messages[i].code, messages[i].string), + Utils.errorMsg2(context, messages[i].code!, messages[i].string!), ), )); } @@ -1215,7 +1215,7 @@ class MobileCheckoutState extends State with SingleTickerProvide child: Container( padding: EdgeInsets.only(left: 16.0, right: 16.0, bottom: 10.0, top: 10.0), child: Text( - '${Utils.timestampToString(context, bookingTime.unixTime)}', + '${Utils.timestampToString(context, bookingTime.unixTime!)}', ), decoration: BoxDecoration( border: Border( @@ -1290,7 +1290,7 @@ class MobileCheckoutState extends State with SingleTickerProvide padding: EdgeInsets.only(left: 10.0, right: 10.0, top: 10.0, bottom: 10.0), child: Center( child: Text( - '${bookingDateTime.viewDate} (${Utils.getWeekDayName(context, bookingDateTime.unixTime, true)})', + '${bookingDateTime.viewDate} (${Utils.getWeekDayName(context, bookingDateTime.unixTime!, true)})', ), ), ), @@ -1494,7 +1494,7 @@ class MobileCheckoutState extends State with SingleTickerProvide crossAxisAlignment: CrossAxisAlignment.center, children: [ Container( - child: Util.showImage(paymentPlatform.icon, + child: Util.showImage(paymentPlatform.icon!, errorWidget: (context, url, error) => Icon(Icons.broken_image, size: 50.0, color: Colors.transparent,), fit: BoxFit.cover, width: 50.0, @@ -1504,7 +1504,7 @@ class MobileCheckoutState extends State with SingleTickerProvide Container( margin: EdgeInsets.only(left: 10.0), child: Text( - PaymentPlatform.getPaymentPlatformName(context, paymentPlatform.code), + PaymentPlatform.getPaymentPlatformName(context, paymentPlatform.code!), style: TextStyle( fontSize: 18.0, fontWeight: FontWeight.bold, @@ -1556,7 +1556,7 @@ class MobileCheckoutState extends State with SingleTickerProvide 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); + return S.of(context).percentage_discount_token2(couponDiscountAmount.toStringAsFixed(2), coupons[i].valueAmount!); } else { return S.of(context).discount_amount_token(couponDiscountAmount.toStringAsFixed(2)); } @@ -1782,7 +1782,7 @@ class MobileCheckoutState extends State with SingleTickerProvide Container( padding: EdgeInsets.only(right: 5.0), child: Text( - '${Utils.smartRound(coupon.valueAmount, 2)}', + '${Utils.smartRound(coupon.valueAmount!, 2)}', style: TextStyle( fontSize: 30.0, color: Colors.redAccent, @@ -1818,7 +1818,7 @@ class MobileCheckoutState extends State with SingleTickerProvide ), Container( child: Text( - '${Utils.smartRound(coupon.valueAmount, 2)}', + '${Utils.smartRound(coupon.valueAmount!, 2)}', style: TextStyle( fontSize: 30.0, color: Colors.redAccent, @@ -1846,7 +1846,7 @@ class MobileCheckoutState extends State with SingleTickerProvide child: Text( coupon.expirationDate != null ? S.of(context).expiration_date_token( - coupon.expirationDate) : + coupon.expirationDate!) : S.of(context) .no_expiration, style: TextStyle( @@ -1859,7 +1859,7 @@ class MobileCheckoutState extends State with SingleTickerProvide child: Text( coupon.minAmount! > 0 ? S.of(context).min_order_amount_token( - coupon.minAmount) : + coupon.minAmount!) : S.of(context) .no_restriction, style: TextStyle( @@ -2101,7 +2101,7 @@ class MobileCheckoutState extends State with SingleTickerProvide left: 16.0, top: 16.0, right: 16.0, bottom: 16.0), child: Container( child: Text( - shippingRate.name, + shippingRate.name!, style: TextStyle( fontSize: 20.0, ), diff --git a/lib/widgets/mobile/mobile_coupons.dart b/lib/widgets/mobile/mobile_coupons.dart index c6485e8..1ba73f7 100644 --- a/lib/widgets/mobile/mobile_coupons.dart +++ b/lib/widgets/mobile/mobile_coupons.dart @@ -123,7 +123,7 @@ class MobileCouponsState extends State { overflow: TextOverflow.ellipsis, ), Text( - coupon.description, + coupon.description!, style: TextStyle( fontSize: 12.0, color: Colors.black26, @@ -162,7 +162,7 @@ class MobileCouponsState extends State { ), Container( child: Text( - '${Utils.smartRound(coupon.valueAmount, 2)}', + '${Utils.smartRound(coupon.valueAmount!, 2)}', style: TextStyle( fontSize: 28.0, color: Colors.redAccent, @@ -177,7 +177,7 @@ class MobileCouponsState extends State { children: [ Container( child: Text( - '${Utils.smartRound(coupon.valueAmount, 2)}', + '${Utils.smartRound(coupon.valueAmount!, 2)}', style: TextStyle( fontSize: 28.0, color: Colors.redAccent, @@ -199,7 +199,7 @@ class MobileCouponsState extends State { Container( child: Text( coupon.minAmount! > 0 ? - S.of(context).available_for_order_over_token(coupon.minAmount) : + S.of(context).available_for_order_over_token(coupon.minAmount!) : S.of(context).no_restriction, style: TextStyle( fontSize: 10.0, @@ -238,7 +238,7 @@ class MobileCouponsState extends State { child: Text( coupon.expirationDate == null || coupon.expirationDate!.length == 0 ? S.of(context).no_expiration : - S.of(context).expiration_date_token(coupon.expirationDate), + S.of(context).expiration_date_token(coupon.expirationDate!), style: TextStyle( color: Colors.black26, fontSize: 15.0, diff --git a/lib/widgets/mobile/mobile_login.dart b/lib/widgets/mobile/mobile_login.dart index df92a21..d95457d 100644 --- a/lib/widgets/mobile/mobile_login.dart +++ b/lib/widgets/mobile/mobile_login.dart @@ -243,7 +243,7 @@ class MobileLoginState extends State { box.put(Constants.KEY_USER_ID, response.data['user_id']); box.put(Constants.KEY_ACCESS_TOKEN, response.data['access_token']); if (store.state.redirectRoute != null) { - Routes.router.navigateTo(context, store.state.redirectRoute, replace: true); + Routes.router.navigateTo(context, store.state.redirectRoute!, replace: true); store.dispatch(UpdateRedirectRoute(null)); } else { Routes.router.navigateTo( diff --git a/lib/widgets/mobile/mobile_me.dart b/lib/widgets/mobile/mobile_me.dart index f6da143..e035d1c 100644 --- a/lib/widgets/mobile/mobile_me.dart +++ b/lib/widgets/mobile/mobile_me.dart @@ -142,7 +142,7 @@ class MobileMeState extends State { Container( child: Text( _user != null - ? Utils.safePhoneNumber(_user.mobile) + ? Utils.safePhoneNumber(_user.mobile!) : '', style: TextStyle( color: diff --git a/lib/widgets/mobile/mobile_my_addresses.dart b/lib/widgets/mobile/mobile_my_addresses.dart index 18545da..9e0091d 100644 --- a/lib/widgets/mobile/mobile_my_addresses.dart +++ b/lib/widgets/mobile/mobile_my_addresses.dart @@ -102,7 +102,7 @@ class MobileMyAddressesState extends State { children: [ Container( child: Text( - address.addressLine1, + address.addressLine1!, style: TextStyle( fontSize: 19.0, ), @@ -110,7 +110,7 @@ class MobileMyAddressesState extends State { ), Container( child: Text( - address.addressLine2, + address.addressLine2!, style: TextStyle( fontSize: 13.0, color: Colors.grey, @@ -120,7 +120,7 @@ class MobileMyAddressesState extends State { Container( margin: EdgeInsets.only(top: 10.0), child: Text( - '${address.contactName} ${Utils.safePhoneNumber(address.phone)}', + '${address.contactName} ${Utils.safePhoneNumber(address.phone!)}', style: TextStyle( fontSize: 15.0, color: Colors.black87, @@ -156,7 +156,7 @@ class MobileMyAddressesState extends State { ), onPressed: () { Navigator.push(context, MaterialPageRoute( - builder: (BuildContext context) => new EditAddress(address, businessId: widget.businessId,), + builder: (BuildContext context) => new EditAddress(address, businessId: widget.businessId!,), )); }, ), diff --git a/lib/widgets/mobile/mobile_my_support.dart b/lib/widgets/mobile/mobile_my_support.dart index 4439638..b7ef111 100644 --- a/lib/widgets/mobile/mobile_my_support.dart +++ b/lib/widgets/mobile/mobile_my_support.dart @@ -188,7 +188,7 @@ class MobileMySupportState extends State { ), Container( child: Text( - Utils.utcDatetimeStringToLocalDatetimeString(context, ticket.createdAt, withTime: true), + Utils.utcDatetimeStringToLocalDatetimeString(context, ticket.createdAt!, withTime: true), style: TextStyle( fontSize: 13.0, color: Colors.grey, @@ -247,7 +247,7 @@ class MobileMySupportState extends State { _loadingFinish = false; HttpUtil.httpGet( 'v1/mysupport', - businessId: widget.businessId, + businessId: widget.businessId!, queryParameters: { 'page': _page.toString(), 'size': Constants.TICKET_PER_PAGE_MOBILE.toString() diff --git a/lib/widgets/mobile/mobile_new_comment.dart b/lib/widgets/mobile/mobile_new_comment.dart index 1c8beeb..ae9950e 100644 --- a/lib/widgets/mobile/mobile_new_comment.dart +++ b/lib/widgets/mobile/mobile_new_comment.dart @@ -217,7 +217,7 @@ class MobileNewCommentState extends State { child: Text(S.of(context).yes_i_am_sure), onPressed: () { Navigator.of(context).pop(); - _deleteImage(image.id); + _deleteImage(image.id!); }, ), ], @@ -269,7 +269,7 @@ class MobileNewCommentState extends State { context: mainContext, barrierDismissible: true, builder: (BuildContext context) { - return Util().getPicture(mainContext, store.state.user, + return Util().getPicture(mainContext, store.state.user!, commentId: comment != null ? comment.id : 0, orderId: widget.orderId); } diff --git a/lib/widgets/mobile/mobile_order_detail.dart b/lib/widgets/mobile/mobile_order_detail.dart index 3fee39b..8e88b7f 100644 --- a/lib/widgets/mobile/mobile_order_detail.dart +++ b/lib/widgets/mobile/mobile_order_detail.dart @@ -520,7 +520,7 @@ class MobileOrderDetailState extends State { margin: EdgeInsets.only(top: 10.0, bottom: 10.0), alignment: Alignment.centerRight, child: Text( - '${Utils.timestampToString(context, order.bookedAt, withTime: true)}', + '${Utils.timestampToString(context, order.bookedAt!, withTime: true)}', style: TextStyle( color: Colors.black38, ), @@ -821,7 +821,7 @@ class MobileOrderDetailState extends State { margin: EdgeInsets.only(top: 10.0, bottom: 10.0), alignment: Alignment.centerRight, child: Text( - Utils.timestampToString(context, order.createdAt, withTime: true), + Utils.timestampToString(context, order.createdAt!, withTime: true), style: TextStyle( color: Colors.black38, ), @@ -877,7 +877,7 @@ class MobileOrderDetailState extends State { ), ), Text( - Utils.getOrderStatus(context, order.status), + Utils.getOrderStatus(context, order.status!), maxLines: 1, overflow: TextOverflow.ellipsis, style: TextStyle( @@ -933,7 +933,7 @@ class MobileOrderDetailState extends State { ), Container( child: Text( - '${Utils.utcDatetimeStringToLocalDatetimeString(context, fulfillment.createdAt, withTime: true)}', + '${Utils.utcDatetimeStringToLocalDatetimeString(context, fulfillment.createdAt!, withTime: true)}', style: TextStyle( fontSize: 12.0, color: Colors.black26, @@ -1021,7 +1021,7 @@ class MobileOrderDetailState extends State { S.of(context).order_again, ), onPressed: () { - Utils.orderAgain(context, order.cartInfo); + Utils.orderAgain(context, order.cartInfo!); }, ), ), diff --git a/lib/widgets/mobile/mobile_orders.dart b/lib/widgets/mobile/mobile_orders.dart index 1079cc2..dd1e0b0 100644 --- a/lib/widgets/mobile/mobile_orders.dart +++ b/lib/widgets/mobile/mobile_orders.dart @@ -164,7 +164,7 @@ class MobileOrdersState extends State with SingleTickerProviderSta if (order.cartInfo!.productList!.length > 1) { row.children.add(Container( child: Text( - S.of(context).and_more_item_token(Utils.getProductLineInOrder(order.cartInfo)), + S.of(context).and_more_item_token(Utils.getProductLineInOrder(order.cartInfo!)), style: TextStyle( fontSize: 12.0, color: Colors.black26, @@ -193,7 +193,7 @@ class MobileOrdersState extends State with SingleTickerProviderSta ), onPressed: () { Navigator.push(context, MaterialPageRoute( - builder: (BuildContext context) => OrderDetail(order.id, fromOrders: true,), + builder: (BuildContext context) => OrderDetail(order.id!, fromOrders: true,), )); }, ), @@ -252,7 +252,7 @@ class MobileOrdersState extends State with SingleTickerProviderSta backgroundColor: Theme.of(context).primaryColor, ), onPressed: () { - Utils.orderAgain(context, order.cartInfo); + Utils.orderAgain(context, order.cartInfo!); }, )); } @@ -269,7 +269,7 @@ class MobileOrdersState extends State with SingleTickerProviderSta backgroundColor: Theme.of(context).primaryColor, ), onPressed: () { - Utils.orderAgain(context, order.cartInfo); + Utils.orderAgain(context, order.cartInfo!); }, )); } @@ -317,7 +317,7 @@ class MobileOrdersState extends State with SingleTickerProviderSta ), Container( child: Text( - '#${order.orderNum} ${Utils.timestampToString(context, order.createdAt, withTime: true)}', + '#${order.orderNum} ${Utils.timestampToString(context, order.createdAt!, withTime: true)}', style: TextStyle( fontSize: 12.0, color: Colors.black26, @@ -329,7 +329,7 @@ class MobileOrdersState extends State with SingleTickerProviderSta ), onTap: () { Navigator.push(context, MaterialPageRoute( - builder: (BuildContext context) => OrderDetail(order.id, fromOrders: true,), + builder: (BuildContext context) => OrderDetail(order.id!, fromOrders: true,), )); }, ), @@ -340,7 +340,7 @@ class MobileOrdersState extends State with SingleTickerProviderSta children: [ Container( child: Text( - '${Utils.getOrderStatus(context, order.status)}', + '${Utils.getOrderStatus(context, order.status!)}', style: TextStyle( fontSize: 15.0, fontWeight: FontWeight.bold, @@ -375,7 +375,7 @@ class MobileOrdersState extends State with SingleTickerProviderSta ), onTap: () { Navigator.push(context, MaterialPageRoute( - builder: (BuildContext context) => OrderDetail(order.id, fromOrders: true,), + builder: (BuildContext context) => OrderDetail(order.id!, fromOrders: true,), )); }, ), diff --git a/lib/widgets/mobile/mobile_pay_now.dart b/lib/widgets/mobile/mobile_pay_now.dart index 6ec650c..ed043f4 100644 --- a/lib/widgets/mobile/mobile_pay_now.dart +++ b/lib/widgets/mobile/mobile_pay_now.dart @@ -162,7 +162,7 @@ class MobilePayNowState extends State { children: [ Container( padding: EdgeInsets.only(right: 10.0), - child: Util.showImage(paymentPlatform.icon, + child: Util.showImage(paymentPlatform.icon!, errorWidget: (context, url, error) => Icon(Icons.broken_image, size: 50.0, color: Colors.transparent,), fit: BoxFit.cover, width: 50.0, @@ -171,7 +171,7 @@ class MobilePayNowState extends State { ), Expanded( child: Text( - S.of(context).pay_with_token(PaymentPlatform.getPaymentPlatformName(context, paymentPlatform.code)), + S.of(context).pay_with_token(PaymentPlatform.getPaymentPlatformName(context, paymentPlatform.code!)), style: TextStyle( fontSize: 18.0, fontWeight: FontWeight.bold, diff --git a/lib/widgets/mobile/mobile_plain_page.dart b/lib/widgets/mobile/mobile_plain_page.dart index 1bcdd44..dccecc2 100644 --- a/lib/widgets/mobile/mobile_plain_page.dart +++ b/lib/widgets/mobile/mobile_plain_page.dart @@ -28,7 +28,7 @@ class MobilePlainPageState extends State { padding: EdgeInsets.only(top: 20, left: 16.0, right: 16.0, bottom: 16.0), child: Center( child: Text( - widget.blog.title, + widget.blog.title!, style: TextStyle( fontWeight: FontWeight.bold, fontSize: 20, @@ -40,7 +40,7 @@ class MobilePlainPageState extends State { padding: EdgeInsets.only(left: 16.0, right: 16.0, bottom: 20.0), child: MarkdownBody( shrinkWrap: true, - data: widget.blog.body, + data: widget.blog.body!, ), )); @@ -52,7 +52,7 @@ class MobilePlainPageState extends State { Navigator.of(context).pop(); }, ), - title: Text(widget.blog.title), + title: Text(widget.blog.title!), backgroundColor: Theme.of(context).primaryColor, ), body: SingleChildScrollView( diff --git a/lib/widgets/mobile/mobile_product_detail_page.dart b/lib/widgets/mobile/mobile_product_detail_page.dart index abea27f..e9dd65e 100644 --- a/lib/widgets/mobile/mobile_product_detail_page.dart +++ b/lib/widgets/mobile/mobile_product_detail_page.dart @@ -133,7 +133,7 @@ class MobileProductDetailPageState extends State padding: EdgeInsets.only(left: 10.0, top: 5.0, right: 10.0), child: Text( - productDetail.name, + productDetail.name!, style: TextStyle( fontSize: 15.0, fontWeight: FontWeight.bold), maxLines: 1, @@ -144,7 +144,7 @@ class MobileProductDetailPageState extends State mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ ShowPrice( - productDetail.price, + productDetail.price!, currencySign: '\$', fontWeight: FontWeight.bold, smallFontSize: 14, @@ -205,13 +205,13 @@ class MobileProductDetailPageState extends State crossAxisAlignment: CrossAxisAlignment.start, children: [ (productDetail.subproducts!.length > 0) ? - subProducts(productDetail.subproducts) : + subProducts(productDetail.subproducts!) : SizedBox.shrink(), Container( padding: EdgeInsets.only( top: 10.0, left: 10.0, right: 10.0), child: Text( - productDetail.description, + productDetail.description!, style: TextStyle( fontSize: 14.0, color: Colors.black54), ), @@ -250,7 +250,7 @@ class MobileProductDetailPageState extends State children: [ Container( child: Text( - S.of(context).weight_token(productDetail.weight), + S.of(context).weight_token(productDetail.weight!), style: TextStyle( fontSize: 12.0, color: Colors.black54, @@ -260,9 +260,9 @@ class MobileProductDetailPageState extends State Container( child: Text( S.of(context).dimentions_token( - productDetail.dimentionsLength, - productDetail.dimentionsWidth, - productDetail.dimentionsHeight), + productDetail.dimentionsLength!, + productDetail.dimentionsWidth!, + productDetail.dimentionsHeight!), style: TextStyle( fontSize: 12.0, color: Colors.black54, @@ -291,7 +291,7 @@ class MobileProductDetailPageState extends State _tabController = TabController(vsync: this, length: 2); HttpUtil.httpGet( 'v1/product-detail/${widget.product.id}', - businessId: widget.business.id, + businessId: widget.business.id!, ).then((value) { productDetail = ProductDetail.fromJson(value); setState(() { @@ -418,7 +418,7 @@ class MobileProductDetailPageState extends State List _getProductPictures(BuildContext context) { var pages = []; List images = []; - images.add(productDetail.image); + images.add(productDetail.image!); for (var i = 0; i < productDetail.images!.length; i++) { // print('>>https:' + productDetail.images[i].image); images.add(productDetail.images![i].image); diff --git a/lib/widgets/mobile/mobile_search_place.dart b/lib/widgets/mobile/mobile_search_place.dart index b590189..0c53c50 100644 --- a/lib/widgets/mobile/mobile_search_place.dart +++ b/lib/widgets/mobile/mobile_search_place.dart @@ -55,8 +55,8 @@ class MobileSearchPlaceState extends State { onSearch: search, onItemFound: (LocatedAddress locatedAddress, int index) { return ListTile( - title: Text(locatedAddress.streetName), - subtitle: Text(locatedAddress.formattedAddress), + title: Text(locatedAddress.streetName!), + subtitle: Text(locatedAddress.formattedAddress!), onTap: () { if (widget.businessId == 0) { _selectPlace(locatedAddress); @@ -109,7 +109,7 @@ class MobileSearchPlaceState extends State { if (result.response != null) { throw RuntimeError(result.response!.data['message']); } else { - throw RuntimeError(result.message); + throw RuntimeError(result.message!); } } else if (result != null && result is List) { return result.map((e) => LocatedAddress.fromJson(e)).toList(); diff --git a/lib/widgets/mobile/mobile_store_product_search.dart b/lib/widgets/mobile/mobile_store_product_search.dart index f61ac85..55dc690 100644 --- a/lib/widgets/mobile/mobile_store_product_search.dart +++ b/lib/widgets/mobile/mobile_store_product_search.dart @@ -107,7 +107,7 @@ class MobileStoreProductSearchState extends State { if (result.response != null) { throw RuntimeError(result.response!.data); } else { - throw RuntimeError(result.message); + throw RuntimeError(result.message!); } } else if (result != null && result is List) { lastBottomPosition = 0; diff --git a/lib/widgets/mobile/mobile_user_profile.dart b/lib/widgets/mobile/mobile_user_profile.dart index e8c4c61..d922956 100644 --- a/lib/widgets/mobile/mobile_user_profile.dart +++ b/lib/widgets/mobile/mobile_user_profile.dart @@ -129,7 +129,7 @@ class MobileUserProfileState extends State { ), Container( child: Text( - _user.nickname, + _user.nickname!, style: TextStyle( color: Colors.grey ), @@ -229,7 +229,7 @@ class MobileUserProfileState extends State { ), 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 { ), 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, ), diff --git a/lib/widgets/mobile/mobile_view_blog.dart b/lib/widgets/mobile/mobile_view_blog.dart index 889c592..124819d 100644 --- a/lib/widgets/mobile/mobile_view_blog.dart +++ b/lib/widgets/mobile/mobile_view_blog.dart @@ -93,7 +93,7 @@ class MobileViewBlogState extends State { ), ), Text( - Utils.utcDatetimeStringToLocalDatetimeString(context, blog.createdAt), + Utils.utcDatetimeStringToLocalDatetimeString(context, blog.createdAt!), style: TextStyle( fontSize: 14.0, color: Colors.black38, diff --git a/lib/widgets/mobile/mobile_view_ticket.dart b/lib/widgets/mobile/mobile_view_ticket.dart index 16a6d2a..60a3999 100644 --- a/lib/widgets/mobile/mobile_view_ticket.dart +++ b/lib/widgets/mobile/mobile_view_ticket.dart @@ -103,14 +103,14 @@ class MobileViewTicketState extends State { crossAxisAlignment: CrossAxisAlignment.end, children: [ Text( - S.of(context).ticket_number_token(ticket.id), + S.of(context).ticket_number_token(ticket.id!), style: TextStyle( fontSize: 24.0, color: Colors.black ), ), Text( - Utils.utcDatetimeStringToLocalDatetimeString(context, ticket.createdAt), + Utils.utcDatetimeStringToLocalDatetimeString(context, ticket.createdAt!), style: TextStyle( fontSize: 14.0, color: Colors.black38, @@ -211,7 +211,7 @@ class MobileViewTicketState extends State { Text( Utils.utcDatetimeStringToLocalDatetimeString( context, - followUp.createdAt + followUp.createdAt! ), style: TextStyle( fontSize: 14.0, @@ -242,7 +242,7 @@ class MobileViewTicketState extends State { Container( padding: EdgeInsets.only(top: 8.0, left: 8.0, right: 8.0, bottom: 20.0), child: showGalleryImages( - mainContext, followUp.files, + mainContext, followUp.files!, ), ), ], diff --git a/lib/widgets/mobile/product_item.dart b/lib/widgets/mobile/product_item.dart index 93b32b6..20a17f9 100644 --- a/lib/widgets/mobile/product_item.dart +++ b/lib/widgets/mobile/product_item.dart @@ -99,7 +99,7 @@ class ProductItemState extends State { ), ), Text( - widget.product.description, + widget.product.description!, // overflow: kIsWeb ? null : TextOverflow.ellipsis, overflow: TextOverflow.ellipsis, maxLines: 2, @@ -134,7 +134,7 @@ class ProductItemState extends State { ) : SizedBox.shrink(), ), ShowPrice( - widget.product.price, + widget.product.price!, regularPrice: widget.product.regularPrice, currencySign: '\$', fontWeight: FontWeight.bold, @@ -193,7 +193,7 @@ class ProductItemState extends State { ), Container( child: Text( - widget.product.description, + widget.product.description!, // overflow: kIsWeb ? null : TextOverflow.ellipsis, overflow: TextOverflow.ellipsis, maxLines: 2, @@ -219,7 +219,7 @@ class ProductItemState extends State { ) : SizedBox.shrink(), ), ShowPrice( - widget.product.price, + widget.product.price!, regularPrice: widget.product.regularPrice, currencySign: '\$', fontWeight: FontWeight.bold, diff --git a/lib/widgets/mobile/product_search.dart b/lib/widgets/mobile/product_search.dart index 8ba3001..211bc33 100644 --- a/lib/widgets/mobile/product_search.dart +++ b/lib/widgets/mobile/product_search.dart @@ -115,7 +115,7 @@ class ProductSearchState extends State { if (result.response != null) { throw RuntimeError(result.response!.data); } else { - throw RuntimeError(result.message); + throw RuntimeError(result.message!); } } else if (result != null && result is List) { lastBottomPosition = 0; diff --git a/lib/widgets/mobile/shop.dart b/lib/widgets/mobile/shop.dart index d06cce6..e699cde 100644 --- a/lib/widgets/mobile/shop.dart +++ b/lib/widgets/mobile/shop.dart @@ -140,7 +140,7 @@ class ShopState extends State 'page': _commentPage.toString(), 'size': Constants.ORDERS_PER_PAGE.toString(), }, - businessId: _business.id, + businessId: _business.id!, ).then((data) { if (isRefresh) { _commentRefreshController.refreshCompleted(); @@ -403,7 +403,7 @@ class ShopState extends State child: new Icon(Icons.phone), onTap: () { Utils.launchURL( - 'tel:${Utils.getFirstNumberFromString(_business.phone)}'); + 'tel:${Utils.getFirstNumberFromString(_business.phone!)}'); }, ), ), @@ -628,7 +628,7 @@ class ShopState extends State Container( padding: EdgeInsets.only(bottom: 16.0), child: ReadMoreText( - comment.replyFromStore, + comment.replyFromStore!, style: TextStyle( fontSize: 13.0, color: Colors.black54, @@ -657,7 +657,7 @@ class ShopState extends State margin: EdgeInsets.only(bottom: 5.0), width: double.infinity, child: ReadMoreText( - comment.content, + comment.content!, trimLines: 3, trimLength: 66, colorClickableText: Colors.blue, @@ -689,10 +689,10 @@ class ShopState extends State ), Container( child: Text( - Utils.safeString(comment.contact) + + Utils.safeString(comment.contact!) + ' ' + Utils.utcDatetimeStringToLocalDatetimeString( - context, comment.createdAt), + context, comment.createdAt!), style: TextStyle( fontSize: 12.0, color: Colors.black26, @@ -825,7 +825,7 @@ class ShopState extends State distanceRow.children.add( new Text( ' / ' + - S.of(context).min_order_amount_token(_business.minPrice) + + S.of(context).min_order_amount_token(_business.minPrice!) + ' ', style: new TextStyle(fontSize: 13.0, color: const Color(0xFFEEEEEE)), ), @@ -895,7 +895,7 @@ class ShopState extends State color: Colors.white, ), new Text( - _business.phone, + _business.phone!, style: new TextStyle( fontSize: 13.0, color: const Color(0xFFEEEEEE)), ) @@ -996,7 +996,7 @@ class ShopState extends State padding: EdgeInsets.only(left: 10.0, right: 10.0, top: 5.0, bottom: 5.0), child: Text( - _business.description, + _business.description!, style: TextStyle( color: Colors.lightGreen, fontSize: 12.0, @@ -1040,7 +1040,7 @@ class ShopState extends State padding: EdgeInsets.only(left: 10.0, right: 10.0, bottom: 10.0), child: SingleChildScrollView( child: Text( - _business.policy, + _business.policy!, softWrap: true, style: TextStyle( fontSize: 10.0, @@ -1062,7 +1062,7 @@ class ShopState extends State right: 0, bottom: 0, child: Util.showImage( - _business.bannerImageUrl, + _business.bannerImageUrl!, fit: BoxFit.cover, ), ), @@ -1158,7 +1158,7 @@ class ShopState extends State child: Container( margin: EdgeInsets.only(top: 5.0, bottom: 5.0), child: Text( - cp.name, + cp.name!, style: TextStyle( fontSize: 13.0, fontWeight: (cp.id == Constants.FEATURED_PRODUCT_ID || @@ -1371,7 +1371,7 @@ class ShopState extends State children: [], ); col.children.add(new Container( - height: _categoryDescHeight, + height: _categoryDescHeight!, padding: new EdgeInsets.symmetric(horizontal: 10.0), color: new Color(0xFFF5F5F5), child: new Row( @@ -1385,7 +1385,7 @@ class ShopState extends State new Padding( padding: new EdgeInsets.only(right: 5.0), child: new Text( - cp.name, + cp.name!, style: new TextStyle( fontSize: 16.0, fontWeight: @@ -1405,7 +1405,7 @@ class ShopState extends State new Visibility( visible: cp.description!.isNotEmpty, child: new Text( - cp.description, + cp.description!, overflow: TextOverflow.ellipsis, style: new TextStyle( fontSize: 10.0, @@ -1532,7 +1532,7 @@ class ShopState extends State } _productCurrentPage = 1; Utils.loadProducts( - widget.businessId, categoryId, _productCurrentPage, false, + widget.businessId!, categoryId, _productCurrentPage, false, (value) { if (_isLoading) { _isLoading = false; @@ -1605,7 +1605,7 @@ class ShopState extends State return; } _productCurrentPage += 1; - Utils.loadProducts(widget.businessId, categoryId, _productCurrentPage, true, + Utils.loadProducts(widget.businessId!, categoryId, _productCurrentPage, true, (value) { if (_isLoading) { _isLoading = false; @@ -1631,7 +1631,7 @@ class ShopState extends State CategoryProducts currentCp = getCategoryProductByCategoryId(categoryId); if (currentCp != null) { - currentCp.products!.addAll(moreCategoryProducts[0].products); + currentCp.products!.addAll(moreCategoryProducts[0].products!); } else { _productCurrentPage = 0; displayProductByCategoryClickIndicator = @@ -1844,7 +1844,7 @@ class ShopState extends State } else { DateTime now = DateTime.now(); if (!(now.hour >= business.todayOpen && - now.hour <= business.todayClose)) { + now.hour <= business.todayClose!)) { showDialog( context: context, builder: (BuildContext context) { @@ -1876,7 +1876,7 @@ class ShopState extends State Container( child: Text( S.of(context).book_now_delivery_later_token( - business.todayOpen), + business.todayOpen!), style: TextStyle( color: Colors.black38, ), diff --git a/lib/widgets/mobile/shopping_cart_bar.dart b/lib/widgets/mobile/shopping_cart_bar.dart index 3397bcc..b084c5b 100644 --- a/lib/widgets/mobile/shopping_cart_bar.dart +++ b/lib/widgets/mobile/shopping_cart_bar.dart @@ -270,7 +270,7 @@ class ShoppingCartBarState extends State { children: [ Container( child: Text( - item.name, + item.name!, maxLines: 1, style: TextStyle( color: Colors.black87, @@ -281,7 +281,7 @@ class ShoppingCartBarState extends State { ), Container( child: Text( - item.description, + item.description!, style: TextStyle( color: Colors.black38, fontSize: 10.0 diff --git a/tools/nullfix.py b/tools/nullfix.py index 133d5f3..7690ffb 100644 --- a/tools/nullfix.py +++ b/tools/nullfix.py @@ -101,6 +101,29 @@ def insert_bang(line, col0, name, kind): return None return None +def insert_arg_bang(line, col0): + """在参数值末尾插 '!'(仅限简单值:标识符/成员/调用/下标)。""" + depth=0; end=None + for i in range(col0, len(line)): + ch=line[i] + if ch in '([{': depth+=1 + elif ch in ')]}': + if depth==0: end=i; break + depth-=1 + elif ch==',' and depth==0: end=i; break + if end is None: end=len(line) + # 值的实际末尾(跳过空白) + j=end-1 + while j>=col0 and line[j] in ' \t': j-=1 + if j