fix(runtime): 37 late fields with == null checks were wrongly migrated -> nullable. Fixes LateInitializationError crashes on page navigation (shop/checkout/comment/data pages)
This commit is contained in:
@@ -35,7 +35,7 @@ class CreateOnlineStore1State extends State<CreateOnlineStore1> {
|
||||
bool canSubmit = false;
|
||||
|
||||
List<dynamic> stores = [];
|
||||
late Map<String, dynamic> service;
|
||||
Map<String, dynamic>? service;
|
||||
dynamic selectedStore;
|
||||
|
||||
late Group group;
|
||||
@@ -322,7 +322,7 @@ class CreateOnlineStore1State extends State<CreateOnlineStore1> {
|
||||
Container(
|
||||
padding: EdgeInsets.only(top: 8.0),
|
||||
child: Text(
|
||||
service['description'],
|
||||
service!['description'],
|
||||
),
|
||||
),
|
||||
);
|
||||
@@ -330,7 +330,7 @@ class CreateOnlineStore1State extends State<CreateOnlineStore1> {
|
||||
Container(
|
||||
padding: EdgeInsets.only(top: 8.0),
|
||||
child: Text(
|
||||
service['options'][0]['name'],
|
||||
service!['options'][0]['name'],
|
||||
),
|
||||
),
|
||||
);
|
||||
@@ -338,7 +338,7 @@ class CreateOnlineStore1State extends State<CreateOnlineStore1> {
|
||||
Container(
|
||||
padding: EdgeInsets.only(top: 8.0),
|
||||
child: Text(
|
||||
'\$${service['options'][0]['price']}',
|
||||
'\$${service!['options'][0]['price']}',
|
||||
style: TextStyle(
|
||||
fontSize: 20,
|
||||
fontWeight: FontWeight.bold,
|
||||
|
||||
@@ -34,7 +34,7 @@ class DesktopNewComment extends StatefulWidget {
|
||||
}
|
||||
|
||||
class DesktopNewCommentState extends State<DesktopNewComment> {
|
||||
late Comment comment;
|
||||
Comment? comment;
|
||||
|
||||
late bool _showProgress;
|
||||
|
||||
@@ -203,8 +203,8 @@ class DesktopNewCommentState extends State<DesktopNewComment> {
|
||||
children: <Widget>[],
|
||||
);
|
||||
|
||||
if (comment != null && comment.images!.length > 0) {
|
||||
for (ProductImage image in comment.images!) {
|
||||
if (comment != null && comment!.images!.length > 0) {
|
||||
for (ProductImage image in comment!.images!) {
|
||||
row.children.add(
|
||||
Container(
|
||||
padding: EdgeInsets.only(left: 10.0),
|
||||
@@ -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,13 +300,13 @@ 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,
|
||||
builder: (BuildContext context) {
|
||||
return Util().getPicture(mainContext, store.state.user!,
|
||||
commentId: comment != null ? comment.id! : 0,
|
||||
commentId: comment != null ? comment!.id! : 0,
|
||||
orderId: widget.orderId);
|
||||
}
|
||||
);
|
||||
@@ -365,7 +365,7 @@ class DesktopNewCommentState extends State<DesktopNewComment> {
|
||||
}
|
||||
},
|
||||
queryParameters: {
|
||||
'comment_id': comment != null ? comment.id! : 0,
|
||||
'comment_id': comment != null ? comment!.id! : 0,
|
||||
},
|
||||
).catchError((error) {
|
||||
Utils.showMessageDialog(context, error);
|
||||
@@ -392,7 +392,7 @@ class DesktopNewCommentState extends State<DesktopNewComment> {
|
||||
isFormData: true,
|
||||
body: {
|
||||
'order_id': widget.orderId,
|
||||
'comment_id': comment != null ? comment.id! : 0,
|
||||
'comment_id': comment != null ? comment!.id! : 0,
|
||||
'content': commentController.text,
|
||||
'rating': rating.round(),
|
||||
},
|
||||
|
||||
@@ -32,7 +32,7 @@ class DesktopPayNow extends StatefulWidget {
|
||||
}
|
||||
|
||||
class DesktopPayNowState extends State<DesktopPayNow> {
|
||||
late Order order;
|
||||
Order? order;
|
||||
late List<PaymentPlatform> paymentPlatforms;
|
||||
late User _user;
|
||||
|
||||
@@ -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,
|
||||
@@ -206,7 +206,7 @@ class DesktopPayNowState extends State<DesktopPayNow> {
|
||||
),
|
||||
),
|
||||
onTap: () {
|
||||
Util.goPayment(context, order, paymentPlatform);
|
||||
Util.goPayment(context, order!, paymentPlatform);
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
@@ -46,7 +46,7 @@ class DesktopProductDetailPageState extends State<DesktopProductDetailPage>
|
||||
|
||||
final double _tabBarHeight = 50;
|
||||
|
||||
late ProductDetail productDetail;
|
||||
ProductDetail? productDetail;
|
||||
|
||||
late bool refresh;
|
||||
|
||||
@@ -83,7 +83,7 @@ class DesktopProductDetailPageState extends State<DesktopProductDetailPage>
|
||||
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,),
|
||||
@@ -114,7 +114,7 @@ class DesktopProductDetailPageState extends State<DesktopProductDetailPage>
|
||||
Container(
|
||||
margin: EdgeInsets.only(top: 10),
|
||||
child: Text(
|
||||
'SKU: ${productDetail.sku}',
|
||||
'SKU: ${productDetail!.sku}',
|
||||
overflow: TextOverflow.ellipsis,
|
||||
maxLines: 2,
|
||||
style: TextStyle(
|
||||
@@ -125,7 +125,7 @@ class DesktopProductDetailPageState extends State<DesktopProductDetailPage>
|
||||
),
|
||||
Container(
|
||||
child: Text(
|
||||
productDetail.name!,
|
||||
productDetail!.name!,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
maxLines: 2,
|
||||
style: TextStyle(
|
||||
@@ -137,7 +137,7 @@ class DesktopProductDetailPageState extends State<DesktopProductDetailPage>
|
||||
Container(
|
||||
padding: EdgeInsets.only(top: 10, bottom: 20),
|
||||
child: Text(
|
||||
'${productDetail.description}',
|
||||
'${productDetail!.description}',
|
||||
overflow: TextOverflow.ellipsis,
|
||||
maxLines: 3,
|
||||
style: TextStyle(
|
||||
@@ -163,12 +163,12 @@ class DesktopProductDetailPageState extends State<DesktopProductDetailPage>
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
ShowPrice(
|
||||
productDetail.price!,
|
||||
productDetail!.price!,
|
||||
currencySign: '\$',
|
||||
fontWeight: FontWeight.bold,
|
||||
smallFontSize: 24,
|
||||
largeFontSize: 40,
|
||||
regularPrice: productDetail.regularPrice,
|
||||
regularPrice: productDetail!.regularPrice,
|
||||
),
|
||||
AddRemoveButton(
|
||||
product: widget.product,
|
||||
@@ -207,35 +207,35 @@ class DesktopProductDetailPageState extends State<DesktopProductDetailPage>
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: <Widget>[
|
||||
(productDetail.subproducts!.length > 0) ?
|
||||
subProducts(productDetail.subproducts!) :
|
||||
(productDetail!.subproducts!.length > 0) ?
|
||||
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),
|
||||
),
|
||||
),
|
||||
Container(
|
||||
padding: EdgeInsets.only(left: 10.0, right: 10.0),
|
||||
child: (productDetail.description2 != null &&
|
||||
!productDetail.description2!.isEmpty)
|
||||
child: (productDetail!.description2 != null &&
|
||||
!productDetail!.description2!.isEmpty)
|
||||
? Text(
|
||||
'${productDetail.description2}',
|
||||
'${productDetail!.description2}',
|
||||
style: TextStyle(
|
||||
fontSize: 14.0, color: Colors.black54),
|
||||
)
|
||||
: SizedBox.shrink(),
|
||||
),
|
||||
productDetail.detailDescription != null
|
||||
productDetail!.detailDescription != null
|
||||
? Container(
|
||||
padding:
|
||||
EdgeInsets.only(left: 10.0, right: 10.0),
|
||||
child: MarkdownBody(
|
||||
data: '${productDetail.detailDescription}',
|
||||
data: '${productDetail!.detailDescription}',
|
||||
shrinkWrap: true,
|
||||
),
|
||||
)
|
||||
@@ -253,7 +253,7 @@ class DesktopProductDetailPageState extends State<DesktopProductDetailPage>
|
||||
children: <Widget>[
|
||||
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<DesktopProductDetailPage>
|
||||
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,
|
||||
@@ -299,9 +299,9 @@ class DesktopProductDetailPageState extends State<DesktopProductDetailPage>
|
||||
}
|
||||
|
||||
Widget getImage(double width) {
|
||||
if (productDetail.images!.length <= 0) {
|
||||
if (productDetail!.images!.length <= 0) {
|
||||
return Util.showImage(
|
||||
productDetail.image!,
|
||||
productDetail!.image!,
|
||||
width: width,
|
||||
height: width,
|
||||
);
|
||||
@@ -452,10 +452,10 @@ class DesktopProductDetailPageState extends State<DesktopProductDetailPage>
|
||||
List<Widget> _getProductPictures(BuildContext context) {
|
||||
var pages = <Widget>[];
|
||||
List<String> images = [];
|
||||
images.add(productDetail.image!);
|
||||
for (var i = 0; i < productDetail.images!.length; i++) {
|
||||
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!);
|
||||
images.add(productDetail!.images![i].image!);
|
||||
}
|
||||
|
||||
for (var i = 0; i < images.length; i++) {
|
||||
|
||||
@@ -18,15 +18,15 @@ class DesktopShoppingCartWidget extends StatefulWidget {
|
||||
}
|
||||
|
||||
class DesktopShoppingCartWidgetState extends State<DesktopShoppingCartWidget> {
|
||||
late CartInfo cartInfo;
|
||||
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) {
|
||||
totalPrice = cartInfo.getTotalPrice();
|
||||
if (cartInfo != null && cartInfo!.businessInfo!.id == widget.business.id) {
|
||||
totalPrice = cartInfo!.getTotalPrice();
|
||||
}
|
||||
Row row = Row(
|
||||
mainAxisAlignment: MainAxisAlignment.end,
|
||||
|
||||
@@ -28,7 +28,7 @@ class DesktopViewBlog extends StatefulWidget {
|
||||
}
|
||||
|
||||
class DesktopViewBlogState extends State<DesktopViewBlog> {
|
||||
late Blog blog;
|
||||
Blog? blog;
|
||||
|
||||
double sideSpace = 0;
|
||||
double mainSpace = 1200;
|
||||
@@ -97,7 +97,7 @@ class DesktopViewBlogState extends State<DesktopViewBlog> {
|
||||
children: [
|
||||
Expanded(
|
||||
child: Text(
|
||||
'${blog.title}',
|
||||
'${blog!.title}',
|
||||
style: TextStyle(
|
||||
fontSize: 24.0,
|
||||
color: Colors.black
|
||||
@@ -105,7 +105,7 @@ class DesktopViewBlogState extends State<DesktopViewBlog> {
|
||||
),
|
||||
),
|
||||
Text(
|
||||
Utils.utcDatetimeStringToLocalDatetimeString(context, blog.createdAt!),
|
||||
Utils.utcDatetimeStringToLocalDatetimeString(context, blog!.createdAt!),
|
||||
style: TextStyle(
|
||||
fontSize: 14.0,
|
||||
color: Colors.black38,
|
||||
@@ -119,7 +119,7 @@ class DesktopViewBlogState extends State<DesktopViewBlog> {
|
||||
padding: EdgeInsets.only(top: 8.0, left: 16.0, right: 16.0, bottom: 24.0),
|
||||
child: Container(
|
||||
child: Text(
|
||||
'${blog.body}',
|
||||
'${blog!.body}',
|
||||
style: TextStyle(
|
||||
color: Colors.black87,
|
||||
fontSize: 17.0,
|
||||
@@ -169,12 +169,12 @@ class DesktopViewBlogState extends State<DesktopViewBlog> {
|
||||
width: mainSpace / 2,
|
||||
margin: EdgeInsets.only(top: 16.0, bottom: 16.0),
|
||||
padding: EdgeInsets.all(10.0),
|
||||
child: (blog.imageUrl == null) ?
|
||||
child: (blog!.imageUrl == null) ?
|
||||
SizedBox.shrink()
|
||||
: Container(
|
||||
width: mainSpace / 2 - 100.0,
|
||||
height: mainSpace / 2 - 100.0,
|
||||
child: Util.showImage('https:${blog.imageUrl}'),
|
||||
child: Util.showImage('https:${blog!.imageUrl}'),
|
||||
),
|
||||
),
|
||||
],
|
||||
|
||||
@@ -33,7 +33,7 @@ class DesktopViewTicket extends StatefulWidget {
|
||||
class DesktopViewTicketState extends State<DesktopViewTicket> {
|
||||
final GlobalKey<FormState> _formKey = GlobalKey<FormState>();
|
||||
|
||||
late Ticket ticket;
|
||||
Ticket? ticket;
|
||||
|
||||
final issueMsgController = TextEditingController();
|
||||
|
||||
@@ -220,14 +220,14 @@ class DesktopViewTicketState extends State<DesktopViewTicket> {
|
||||
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,
|
||||
@@ -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,
|
||||
@@ -406,7 +406,7 @@ class DesktopViewTicketState extends State<DesktopViewTicket> {
|
||||
width: mainSpace / 2,
|
||||
margin: EdgeInsets.only(top: 16.0, bottom: 16.0),
|
||||
padding: EdgeInsets.all(10.0),
|
||||
child: (ticket.isClosed == true) ?
|
||||
child: (ticket!.isClosed == true) ?
|
||||
Column(
|
||||
children: [
|
||||
Container(
|
||||
@@ -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}',
|
||||
),
|
||||
)
|
||||
],
|
||||
@@ -692,7 +692,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,
|
||||
);
|
||||
},
|
||||
|
||||
@@ -32,7 +32,7 @@ class Shop extends StatefulWidget {
|
||||
}
|
||||
|
||||
class ShopState extends State<Shop> {
|
||||
late Business _business;
|
||||
Business? _business;
|
||||
|
||||
PanelController panelController = PanelController();
|
||||
late SlidingUpPanel _slidUpShoppingCart;
|
||||
@@ -71,7 +71,7 @@ class ShopState extends State<Shop> {
|
||||
backdropEnabled: true,
|
||||
slideDirection: SlideDirection.DOWN,
|
||||
panel: ShoppingCartBar(
|
||||
business: _business,
|
||||
business: _business!,
|
||||
endKey: endKey,
|
||||
barAtBottom: true,
|
||||
hasPicture: true,
|
||||
@@ -119,14 +119,14 @@ class ShopState extends State<Shop> {
|
||||
onTap: () {
|
||||
Navigator.push(context,
|
||||
MaterialPageRoute(builder: (BuildContext context) {
|
||||
return ProductSearch(_business);
|
||||
return ProductSearch(_business!);
|
||||
}));
|
||||
},
|
||||
),
|
||||
],
|
||||
breadCrumbHeight: Constants.BREADCRUMB_HEIGHT,
|
||||
shoppingCart: ShoppingCartWidget(
|
||||
business: _business,
|
||||
business: _business!,
|
||||
onTap: () {
|
||||
if (panelController.isPanelClosed) {
|
||||
panelController.open();
|
||||
@@ -150,7 +150,7 @@ class ShopState extends State<Shop> {
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
ShopPromote(data),
|
||||
ShopBulletin(_business),
|
||||
ShopBulletin(_business!),
|
||||
ShopProducts(data),
|
||||
],
|
||||
),
|
||||
|
||||
@@ -19,15 +19,15 @@ class ShoppingCartWidget extends StatefulWidget {
|
||||
}
|
||||
|
||||
class ShoppingCartWidgetState extends State<ShoppingCartWidget> {
|
||||
late CartInfo cartInfo;
|
||||
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) {
|
||||
totalPrice = cartInfo.getTotalPrice();
|
||||
if (cartInfo != null && cartInfo!.businessInfo!.id == widget.business.id) {
|
||||
totalPrice = cartInfo!.getTotalPrice();
|
||||
}
|
||||
Row row = Row(
|
||||
mainAxisAlignment: MainAxisAlignment.end,
|
||||
|
||||
Reference in New Issue
Block a user