phase3: nullable fields/methods, casts, ?.call, pinput/YoutubePlayer v5, buttonColor, dead-code removal. 72->16
This commit is contained in:
@@ -40,7 +40,7 @@ class CreateOnlineStore1State extends State<CreateOnlineStore1> {
|
||||
|
||||
late Group group;
|
||||
|
||||
late String selectedDomain;
|
||||
String? selectedDomain;
|
||||
List<dynamic> domainResult = [];
|
||||
|
||||
@override
|
||||
|
||||
@@ -34,7 +34,7 @@ class DesktopBlog extends StatefulWidget {
|
||||
}
|
||||
|
||||
class DesktopBlogState extends State<DesktopBlog> {
|
||||
late List<Blog> blogs;
|
||||
List<Blog>? blogs;
|
||||
|
||||
double division = 2;
|
||||
|
||||
@@ -49,7 +49,7 @@ class DesktopBlogState extends State<DesktopBlog> {
|
||||
void _onRefresh() {
|
||||
_page = 1;
|
||||
if (blogs != null) {
|
||||
blogs.clear();
|
||||
blogs!.clear();
|
||||
} else {
|
||||
blogs = [];
|
||||
}
|
||||
@@ -98,7 +98,7 @@ class DesktopBlogState extends State<DesktopBlog> {
|
||||
enablePullUp: true,
|
||||
header: WaterDropHeader(),
|
||||
footer: CustomFooter(
|
||||
builder: (BuildContext context, LoadStatus mode){
|
||||
builder: (BuildContext context, LoadStatus? mode){
|
||||
Widget footer;
|
||||
if(mode == LoadStatus.idle) {
|
||||
footer = Text(S.of(context).pull_up_to_load_more);
|
||||
@@ -148,9 +148,9 @@ class DesktopBlogState extends State<DesktopBlog> {
|
||||
right: 8.0,
|
||||
),
|
||||
child: blogs == null ? Text('') :
|
||||
(blogs.length > 0 ?
|
||||
(blogs!.length > 0 ?
|
||||
Wrap(
|
||||
children: blogs.map((a) => GestureDetector(
|
||||
children: blogs!.map((a) => GestureDetector(
|
||||
child: _getBlog(a),
|
||||
onTap: () {
|
||||
Routes.router.navigateTo(context, '/view-blog/${a.id}');
|
||||
@@ -293,7 +293,7 @@ class DesktopBlogState extends State<DesktopBlog> {
|
||||
if (blogs == null) {
|
||||
blogs = [];
|
||||
}
|
||||
blogs.addAll((value['blogs'] as List).map((e) => Blog.fromJson(e)).toList());
|
||||
blogs!.addAll((value['blogs'] as List).map((e) => Blog.fromJson(e)).toList());
|
||||
});
|
||||
}
|
||||
}).catchError((error) {
|
||||
|
||||
@@ -112,7 +112,7 @@ class DesktopiGoShowLearnMoreState extends State<DesktopiGoShowLearnMore> {
|
||||
),
|
||||
child: ClipRRect(
|
||||
borderRadius: BorderRadius.circular(20.0),
|
||||
child: YoutubePlayerIFrame(
|
||||
child: YoutubePlayer(
|
||||
controller: _controller,
|
||||
aspectRatio: 1.7778,
|
||||
),
|
||||
|
||||
@@ -30,7 +30,7 @@ class DesktopMyAddresses extends StatefulWidget {
|
||||
}
|
||||
|
||||
class DesktopMyAddressesState extends State<DesktopMyAddresses> {
|
||||
late List<Address> addresses;
|
||||
List<Address>? addresses;
|
||||
|
||||
double sideSpace = 0;
|
||||
double mainSpace = 1200;
|
||||
@@ -91,9 +91,9 @@ class DesktopMyAddressesState extends State<DesktopMyAddresses> {
|
||||
right: 8.0,
|
||||
),
|
||||
child: addresses == null ? Text('') :
|
||||
(addresses.length > 0 ?
|
||||
(addresses!.length > 0 ?
|
||||
Wrap(
|
||||
children: addresses.map((a) => _getAddress(a)).toList(),
|
||||
children: addresses!.map((a) => _getAddress(a)).toList(),
|
||||
) :
|
||||
Center(
|
||||
child: Text(S.of(context).no_address_yet),
|
||||
|
||||
@@ -353,7 +353,7 @@ class DesktopNewAddressState extends State<DesktopNewAddress> {
|
||||
),
|
||||
bottomNavigationBar: Container(
|
||||
padding: EdgeInsets.all(8.0),
|
||||
color: Theme.of(context).buttonColor,
|
||||
color: Theme.of(context).colorScheme.primary,
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: <Widget>[
|
||||
|
||||
@@ -306,7 +306,7 @@ class DesktopNewCommentState extends State<DesktopNewComment> {
|
||||
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(),
|
||||
},
|
||||
|
||||
@@ -357,7 +357,6 @@ class DesktopNewTicketState extends State<DesktopNewTicket> {
|
||||
galleryImagesFlag[imageId]['path'] = path;
|
||||
});
|
||||
});
|
||||
return null;
|
||||
}
|
||||
);
|
||||
},
|
||||
|
||||
@@ -35,7 +35,7 @@ class DesktopOrders extends StatefulWidget {
|
||||
class DesktopOrdersState extends State<DesktopOrders> with SingleTickerProviderStateMixin {
|
||||
GlobalKey<ScaffoldState> _scaffoldKey = GlobalKey<ScaffoldState>();
|
||||
|
||||
late List<Order> orders;
|
||||
List<Order>? orders;
|
||||
|
||||
bool _isLoading = false;
|
||||
|
||||
@@ -132,14 +132,14 @@ class DesktopOrdersState extends State<DesktopOrders> with SingleTickerProviderS
|
||||
|
||||
return ListView.builder(
|
||||
controller: scrollController,
|
||||
itemCount: orders != null && orders.length > 0 ? orders.length + 1 : 1,
|
||||
itemCount: orders != null && orders!.length > 0 ? orders!.length + 1 : 1,
|
||||
itemBuilder: (BuildContext context, int position) {
|
||||
Order? order;
|
||||
if (orders != null && orders.length > 0 && position < orders.length) {
|
||||
order = orders[position];
|
||||
if (orders != null && orders!.length > 0 && position < orders!.length) {
|
||||
order = orders![position];
|
||||
}
|
||||
|
||||
if (order == null && orders.length <= 0) {
|
||||
if (order == null && orders!.length <= 0) {
|
||||
return Container(
|
||||
padding: EdgeInsets.all(16.0),
|
||||
child: Center(
|
||||
@@ -148,7 +148,7 @@ class DesktopOrdersState extends State<DesktopOrders> with SingleTickerProviderS
|
||||
),
|
||||
),
|
||||
);
|
||||
} else if (position >= orders.length) {
|
||||
} else if (position >= orders!.length) {
|
||||
if (_pageCount > _page) {
|
||||
return Container(
|
||||
padding: EdgeInsets.all(16.0),
|
||||
@@ -228,7 +228,7 @@ class DesktopOrdersState extends State<DesktopOrders> with SingleTickerProviderS
|
||||
),
|
||||
],
|
||||
);
|
||||
if (order!.status == Constants.STATUS_COMPLETE && !order!.hasComment) {
|
||||
if (order!.status == Constants.STATUS_COMPLETE && order!.hasComment != true) {
|
||||
row3.children.add(
|
||||
Padding(
|
||||
padding: EdgeInsets.only(left: 10.0),
|
||||
@@ -458,7 +458,7 @@ class DesktopOrdersState extends State<DesktopOrders> with SingleTickerProviderS
|
||||
if (orders == null) {
|
||||
orders = [];
|
||||
}
|
||||
orders.addAll((data['items'] as List).map((e) => Order.fromJson(e)).toList());
|
||||
orders!.addAll((data['items'] as List).map((e) => Order.fromJson(e)).toList());
|
||||
});
|
||||
}
|
||||
}).catchError((error) {
|
||||
|
||||
@@ -107,7 +107,7 @@ class DesktopProductItemState extends State<DesktopProductItem> {
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: <Widget>[
|
||||
new Container(
|
||||
child: widget.business!.showMonthlySold ?
|
||||
child: widget.business!.showMonthlySold == true ?
|
||||
Text(
|
||||
S.of(context).sold_per_month_token(widget.product!.monthSales!.toStringAsFixed(0)),
|
||||
style: new TextStyle(
|
||||
@@ -191,7 +191,7 @@ class DesktopProductItemState extends State<DesktopProductItem> {
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: <Widget>[
|
||||
new Container(
|
||||
child: widget.business!.showMonthlySold ?
|
||||
child: widget.business!.showMonthlySold == true ?
|
||||
Text(
|
||||
S.of(context).sold_per_month_token(widget.product!.monthSales!.toStringAsFixed(0)),
|
||||
style: new TextStyle(
|
||||
|
||||
@@ -144,7 +144,7 @@ class DesktopSearchPlaceState extends State<DesktopSearchPlace> {
|
||||
Navigator.of(context).pop();
|
||||
}
|
||||
|
||||
void _selectPlaceAsNew(LocatedAddress locatedAddress) {
|
||||
void _selectPlaceAsNew(LocatedAddress? locatedAddress) {
|
||||
print('located address: ${locatedAddress.toString()}');
|
||||
Navigator.push(context, MaterialPageRoute(
|
||||
builder: (BuildContext context) => NewAddress(locatedAddress: locatedAddress, businessId: widget.businessId,),
|
||||
|
||||
@@ -24,7 +24,7 @@ class DesktopShoppingCartWidgetState extends State<DesktopShoppingCartWidget> {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
totalPrice = 0.0;
|
||||
cartInfo = Utils.getCartInfoByBusiness(store.state.cartInfos, widget.business);
|
||||
cartInfo = Utils.getCartInfoByBusiness(store.state.cartInfos, widget.business)!;
|
||||
if (cartInfo != null && cartInfo.businessInfo!.id == widget.business.id) {
|
||||
totalPrice = cartInfo.getTotalPrice();
|
||||
}
|
||||
@@ -59,7 +59,7 @@ class DesktopShoppingCartWidgetState extends State<DesktopShoppingCartWidget> {
|
||||
child: row,
|
||||
width: 160.0,
|
||||
),
|
||||
onTap: widget.onTap!,
|
||||
onTap: () => widget.onTap!(),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -601,7 +601,6 @@ class DesktopViewTicketState extends State<DesktopViewTicket> {
|
||||
galleryImagesFlag[imageId]['path'] = path;
|
||||
});
|
||||
});
|
||||
return null;
|
||||
}
|
||||
);
|
||||
},
|
||||
|
||||
@@ -141,7 +141,7 @@ class ProductItemState extends State<ProductItem> {
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: <Widget>[
|
||||
new Container(
|
||||
child: widget.business.showMonthlySold ?
|
||||
child: widget.business.showMonthlySold == true ?
|
||||
Text(
|
||||
S.of(context).sold_per_month_token(widget.product.monthSales!.toStringAsFixed(0)),
|
||||
style: new TextStyle(
|
||||
@@ -229,7 +229,7 @@ class ProductItemState extends State<ProductItem> {
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: <Widget>[
|
||||
new Container(
|
||||
child: widget.business.showMonthlySold ?
|
||||
child: widget.business.showMonthlySold == true ?
|
||||
Text(
|
||||
S.of(context).sold_per_month_token(widget.product.monthSales!.toStringAsFixed(0)),
|
||||
style: new TextStyle(
|
||||
|
||||
@@ -286,7 +286,7 @@ class ShopState extends State<Shop> {
|
||||
if (_categoryProducts[i].id == currentCategoryId) {
|
||||
try {
|
||||
CategoryProducts cps = _categoryProducts[i + 1];
|
||||
return cps.id;
|
||||
return cps.id!;
|
||||
} catch (error) {
|
||||
print('Error $error');
|
||||
}
|
||||
|
||||
@@ -25,7 +25,7 @@ class ShoppingCartWidgetState extends State<ShoppingCartWidget> {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
totalPrice = 0.0;
|
||||
cartInfo = Utils.getCartInfoByBusiness(store.state.cartInfos, widget.business);
|
||||
cartInfo = Utils.getCartInfoByBusiness(store.state.cartInfos, widget.business)!;
|
||||
if (cartInfo != null && cartInfo.businessInfo!.id == widget.business.id) {
|
||||
totalPrice = cartInfo.getTotalPrice();
|
||||
}
|
||||
@@ -60,7 +60,7 @@ class ShoppingCartWidgetState extends State<ShoppingCartWidget> {
|
||||
child: row,
|
||||
width: 160.0,
|
||||
),
|
||||
onTap: widget.onTap!,
|
||||
onTap: () => widget.onTap!(),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -61,7 +61,7 @@ class AddRemoveButtonState extends State<AddRemoveButton> {
|
||||
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<AddRemoveButton> {
|
||||
}
|
||||
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) {
|
||||
@@ -194,7 +194,7 @@ class AddRemoveButtonState extends State<AddRemoveButton> {
|
||||
);
|
||||
} 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) {
|
||||
|
||||
@@ -94,7 +94,7 @@ class BreadCrumbs extends StatelessWidget {
|
||||
color: Colors.blueAccent,
|
||||
),
|
||||
Text(
|
||||
breadCrumb.text,
|
||||
breadCrumb.text!,
|
||||
style: TextStyle(
|
||||
color: Colors.blueAccent,
|
||||
fontSize: 14.0,
|
||||
@@ -103,7 +103,7 @@ class BreadCrumbs extends StatelessWidget {
|
||||
],
|
||||
) :
|
||||
Text(
|
||||
breadCrumb.text,
|
||||
breadCrumb.text!,
|
||||
style: TextStyle(
|
||||
color: Colors.blueAccent,
|
||||
fontSize: 14.0,
|
||||
@@ -145,7 +145,7 @@ class BreadCrumbs extends StatelessWidget {
|
||||
color: Colors.lightBlueAccent,
|
||||
),
|
||||
Text(
|
||||
breadCrumb.text,
|
||||
breadCrumb.text!,
|
||||
style: TextStyle(
|
||||
color: Colors.black54,
|
||||
fontSize: 14.0,
|
||||
@@ -155,7 +155,7 @@ class BreadCrumbs extends StatelessWidget {
|
||||
],
|
||||
) :
|
||||
Text(
|
||||
breadCrumb.text,
|
||||
breadCrumb.text!,
|
||||
style: TextStyle(
|
||||
color: Colors.black54,
|
||||
fontSize: 14.0,
|
||||
@@ -184,7 +184,7 @@ class BreadCrumbs extends StatelessWidget {
|
||||
}
|
||||
|
||||
class BreadCrumb {
|
||||
final String text;
|
||||
final String? text;
|
||||
final String? route;
|
||||
final IconData? icon;
|
||||
final Widget? item;
|
||||
|
||||
@@ -38,7 +38,7 @@ class CarouselState extends State<Carousel> {
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
if (widget.autoPlay) {
|
||||
if (widget.autoPlay == true) {
|
||||
_timer = new Timer.periodic(widget.duration, (timer) {
|
||||
_pageController.animateToPage(_currentPage,
|
||||
duration: widget.animationDuration, curve: Curves.linear);
|
||||
|
||||
@@ -69,13 +69,13 @@ class ParabolicAnimationWidget extends AnimatedWidget {
|
||||
RenderBox stackBox = stackKey.currentContext!.findRenderObject()! as RenderBox;
|
||||
Offset stackBoxOffset = stackBox.globalToLocal(Offset.zero);
|
||||
|
||||
EdgeInsets startMargin = _margin(startKey);
|
||||
EdgeInsets startMargin = _margin(startKey)!;
|
||||
RenderBox startBox = startKey.currentContext!.findRenderObject()! as RenderBox;
|
||||
_startOffset = startBox.localToGlobal(Offset(
|
||||
startMargin.left + startAdjustOffset.dx,
|
||||
stackBoxOffset.dy + startMargin.top + startAdjustOffset.dy));
|
||||
|
||||
EdgeInsets endMargin = _margin(endKey);
|
||||
EdgeInsets endMargin = _margin(endKey)!;
|
||||
RenderBox endBox = endKey.currentContext!.findRenderObject()! as RenderBox;
|
||||
_endOffset = endBox.localToGlobal(Offset(
|
||||
endMargin.left + endAdjustOffset.dx,
|
||||
@@ -83,9 +83,9 @@ class ParabolicAnimationWidget extends AnimatedWidget {
|
||||
}
|
||||
}
|
||||
|
||||
EdgeInsets _margin(GlobalKey key) {
|
||||
EdgeInsetsGeometry _margin(GlobalKey key) {
|
||||
final Widget widget = key.currentContext!.widget;
|
||||
EdgeInsets margin = (widget is Container) ? (widget.margin ?? EdgeInsets.zero) : EdgeInsets.zero;
|
||||
EdgeInsetsGeometry margin = (widget is Container) ? (widget.margin ?? EdgeInsets.zero) : EdgeInsets.zero;
|
||||
return margin ?? EdgeInsets.zero;
|
||||
}
|
||||
}
|
||||
@@ -109,8 +109,6 @@ class PaymentVerificationCodeDialogState extends State<PaymentVerificationCodeDi
|
||||
);
|
||||
}
|
||||
},
|
||||
defaultPinDecoration: _pinPutDecoration.copyWith(
|
||||
borderRadius: BorderRadius.circular(20)),
|
||||
),
|
||||
),
|
||||
),
|
||||
|
||||
@@ -49,11 +49,11 @@ class PopupAnimationWidget extends AnimatedWidget {
|
||||
|
||||
void _calAnimation() {
|
||||
if (_startOffset == null) {
|
||||
final RenderBox stackBox = stackKey.currentContext!.findRenderObject()!;
|
||||
final RenderBox stackBox = stackKey.currentContext!.findRenderObject()! as RenderBox;
|
||||
final Offset stackBoxOffset = stackBox.globalToLocal(Offset.zero);
|
||||
|
||||
final EdgeInsets startMargin = _margin(startKey);
|
||||
final RenderBox startBox = startKey.currentContext!.findRenderObject()!;
|
||||
final EdgeInsets startMargin = _margin(startKey)!;
|
||||
final RenderBox startBox = startKey.currentContext!.findRenderObject()! as RenderBox;
|
||||
|
||||
_startOffset = startBox.localToGlobal(Offset(
|
||||
startMargin.left + popupOffset.dx,
|
||||
@@ -61,9 +61,9 @@ class PopupAnimationWidget extends AnimatedWidget {
|
||||
}
|
||||
}
|
||||
|
||||
EdgeInsets _margin(GlobalKey key) {
|
||||
EdgeInsetsGeometry _margin(GlobalKey key) {
|
||||
final Widget widget = key.currentContext!.widget;
|
||||
final EdgeInsets margin =
|
||||
final EdgeInsetsGeometry margin =
|
||||
(widget is Container) ? widget.margin : EdgeInsets.zero;
|
||||
return margin ?? EdgeInsets.zero;
|
||||
}
|
||||
|
||||
@@ -35,7 +35,7 @@ class CreateOnlineStore1State extends State<CreateOnlineStore1> {
|
||||
|
||||
late Group group;
|
||||
|
||||
late String selectedDomain;
|
||||
String? selectedDomain;
|
||||
List<dynamic> domainResult = [];
|
||||
|
||||
@override
|
||||
|
||||
@@ -28,7 +28,7 @@ class MobileBlog extends StatefulWidget {
|
||||
}
|
||||
|
||||
class MobileBlogState extends State<MobileBlog> {
|
||||
late List<Blog> blogs;
|
||||
List<Blog>? blogs;
|
||||
|
||||
int _page = 1;
|
||||
int _pageCount = 1;
|
||||
@@ -41,7 +41,7 @@ class MobileBlogState extends State<MobileBlog> {
|
||||
void _onRefresh() {
|
||||
_page = 1;
|
||||
if (blogs != null) {
|
||||
blogs.clear();
|
||||
blogs!.clear();
|
||||
} else {
|
||||
blogs = [];
|
||||
}
|
||||
@@ -82,7 +82,7 @@ class MobileBlogState extends State<MobileBlog> {
|
||||
enablePullUp: true,
|
||||
header: WaterDropHeader(),
|
||||
footer: CustomFooter(
|
||||
builder: (BuildContext context, LoadStatus mode){
|
||||
builder: (BuildContext context, LoadStatus? mode){
|
||||
Widget footer;
|
||||
if(mode == LoadStatus.idle) {
|
||||
footer = Text(S.of(context).pull_up_to_load_more);
|
||||
@@ -123,9 +123,9 @@ class MobileBlogState extends State<MobileBlog> {
|
||||
return SizedBox.shrink();
|
||||
}
|
||||
return ListView.builder(
|
||||
itemCount: blogs.length <= 1 ? 1 : blogs.length,
|
||||
itemCount: blogs!.length <= 1 ? 1 : blogs!.length,
|
||||
itemBuilder: (BuildContext context, int i) {
|
||||
if (blogs.length <= 0) {
|
||||
if (blogs!.length <= 0) {
|
||||
return Container(
|
||||
padding: EdgeInsets.all(16.0),
|
||||
child: Center(
|
||||
@@ -133,7 +133,7 @@ class MobileBlogState extends State<MobileBlog> {
|
||||
),
|
||||
);
|
||||
} else {
|
||||
Blog blog = blogs[i];
|
||||
Blog blog = blogs![i];
|
||||
|
||||
Widget w = Container(
|
||||
padding: EdgeInsets.symmetric(vertical: 20.0, horizontal: 16.0),
|
||||
@@ -243,7 +243,7 @@ class MobileBlogState extends State<MobileBlog> {
|
||||
if (blogs == null) {
|
||||
blogs = [];
|
||||
}
|
||||
blogs.addAll((value['blogs'] as List).map((e) => Blog.fromJson(e)).toList());
|
||||
blogs!.addAll((value['blogs'] as List).map((e) => Blog.fromJson(e)).toList());
|
||||
});
|
||||
}
|
||||
}).catchError((error) {
|
||||
|
||||
@@ -24,7 +24,7 @@ class MobileCoupons extends StatefulWidget {
|
||||
}
|
||||
|
||||
class MobileCouponsState extends State<MobileCoupons> {
|
||||
late List<Coupon> coupons;
|
||||
List<Coupon>? coupons;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
@@ -54,10 +54,10 @@ class MobileCouponsState extends State<MobileCoupons> {
|
||||
),
|
||||
),
|
||||
body: ListView.builder(
|
||||
itemCount: coupons.length > 0 ? coupons.length : 1,
|
||||
itemCount: coupons!.length > 0 ? coupons!.length : 1,
|
||||
itemBuilder: (BuildContext context, int position) {
|
||||
if (coupons.length > 0) {
|
||||
Coupon coupon = coupons[position];
|
||||
if (coupons!.length > 0) {
|
||||
Coupon coupon = coupons![position];
|
||||
return Container(
|
||||
color: Colors.black12,
|
||||
child: couponWidget(coupon),
|
||||
|
||||
@@ -94,7 +94,7 @@ class MobileiGoShowLearnMoreState extends State<MobileiGoShowLearnMore> {
|
||||
),
|
||||
child: ClipRRect(
|
||||
borderRadius: BorderRadius.circular(20.0),
|
||||
child: YoutubePlayerIFrame(
|
||||
child: YoutubePlayer(
|
||||
controller: _controller,
|
||||
aspectRatio: 2 / 1,
|
||||
),
|
||||
|
||||
@@ -40,7 +40,7 @@ class MobileMeState extends State<MobileMe> {
|
||||
late String accessToken;
|
||||
|
||||
late bool isLoading;
|
||||
late User _user;
|
||||
User? _user;
|
||||
|
||||
late ShopScrollCoordinator _shopCoordinator;
|
||||
late ShopScrollController _pageScrollController;
|
||||
@@ -88,9 +88,9 @@ class MobileMeState extends State<MobileMe> {
|
||||
children: <Widget>[
|
||||
Container(
|
||||
margin: EdgeInsets.only(right: 5.0),
|
||||
child: _user != null && _user.avatarUrl!.isNotEmpty
|
||||
child: _user != null && _user!.avatarUrl!.isNotEmpty
|
||||
? Util.showImage(
|
||||
'https:${_user.avatarUrl}',
|
||||
'https:${_user!.avatarUrl}',
|
||||
width: 60,
|
||||
height: 60,
|
||||
fit: BoxFit.fill,
|
||||
@@ -116,7 +116,7 @@ class MobileMeState extends State<MobileMe> {
|
||||
Container(
|
||||
child: Text(
|
||||
_user != null
|
||||
? _user.nickname
|
||||
? _user!.nickname!
|
||||
: S.of(context).please_login,
|
||||
style: TextStyle(
|
||||
color: Theme.of(context).scaffoldBackgroundColor,
|
||||
@@ -142,7 +142,7 @@ class MobileMeState extends State<MobileMe> {
|
||||
Container(
|
||||
child: Text(
|
||||
_user != null
|
||||
? Utils.safePhoneNumber(_user.mobile!)
|
||||
? Utils.safePhoneNumber(_user!.mobile!)
|
||||
: '',
|
||||
style: TextStyle(
|
||||
color:
|
||||
@@ -219,7 +219,7 @@ class MobileMeState extends State<MobileMe> {
|
||||
Container(
|
||||
child: Text(
|
||||
_user != null
|
||||
? '${_user.wallet!.toStringAsFixed(2)}'
|
||||
? '${_user!.wallet!.toStringAsFixed(2)}'
|
||||
: '0.00',
|
||||
style: TextStyle(
|
||||
fontSize: 24.0,
|
||||
@@ -262,7 +262,7 @@ class MobileMeState extends State<MobileMe> {
|
||||
children: <Widget>[
|
||||
Container(
|
||||
child: Text(
|
||||
_user != null ? '${_user.coupon}' : '0',
|
||||
_user != null ? '${_user!.coupon}' : '0',
|
||||
style: TextStyle(
|
||||
fontSize: 24.0,
|
||||
color: Colors.orangeAccent,
|
||||
@@ -296,7 +296,7 @@ class MobileMeState extends State<MobileMe> {
|
||||
onTap: () {
|
||||
if (_user != null) {
|
||||
Routes.router
|
||||
.navigateTo(context, '/coupons/${_user.id}');
|
||||
.navigateTo(context, '/coupons/${_user!.id}');
|
||||
} else {
|
||||
_pleaseLoginToast();
|
||||
}
|
||||
@@ -312,7 +312,7 @@ class MobileMeState extends State<MobileMe> {
|
||||
children: <Widget>[
|
||||
Container(
|
||||
child: Text(
|
||||
_user != null ? '${_user.points}' : '0',
|
||||
_user != null ? '${_user!.points}' : '0',
|
||||
style: TextStyle(
|
||||
fontSize: 24.0,
|
||||
color: Colors.lightGreen,
|
||||
@@ -671,7 +671,7 @@ class MobileMeState extends State<MobileMe> {
|
||||
),
|
||||
onTap: () {
|
||||
if (_user != null) {
|
||||
if (_user.email == null || _user.email!.isEmpty) {
|
||||
if (_user!.email == null || _user!.email!.isEmpty) {
|
||||
showDialog(
|
||||
context: context,
|
||||
builder: (BuildContext context) {
|
||||
|
||||
@@ -27,7 +27,7 @@ class MobileMyAddresses extends StatefulWidget {
|
||||
}
|
||||
|
||||
class MobileMyAddressesState extends State<MobileMyAddresses> {
|
||||
late List<Address> addresses;
|
||||
List<Address>? addresses;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
@@ -70,9 +70,9 @@ class MobileMyAddressesState extends State<MobileMyAddresses> {
|
||||
],
|
||||
),
|
||||
body: ListView.builder(
|
||||
itemCount: addresses.length <= 1 ? 1 : addresses.length,
|
||||
itemCount: addresses!.length <= 1 ? 1 : addresses!.length,
|
||||
itemBuilder: (BuildContext context, int i) {
|
||||
if (addresses.length <= 0) {
|
||||
if (addresses!.length <= 0) {
|
||||
return Container(
|
||||
padding: EdgeInsets.all(16.0),
|
||||
child: Center(
|
||||
@@ -80,7 +80,7 @@ class MobileMyAddressesState extends State<MobileMyAddresses> {
|
||||
),
|
||||
);
|
||||
} else {
|
||||
Address address = addresses[i];
|
||||
Address address = addresses![i];
|
||||
|
||||
return Container(
|
||||
padding: EdgeInsets.symmetric(vertical: 20.0, horizontal: 16.0),
|
||||
|
||||
@@ -28,7 +28,7 @@ class MobileMySupport extends StatefulWidget {
|
||||
}
|
||||
|
||||
class MobileMySupportState extends State<MobileMySupport> {
|
||||
late List<Ticket> tickets;
|
||||
List<Ticket>? tickets;
|
||||
|
||||
int _page = 1;
|
||||
int _pageCount = 1;
|
||||
@@ -41,7 +41,7 @@ class MobileMySupportState extends State<MobileMySupport> {
|
||||
void _onRefresh() {
|
||||
_page = 1;
|
||||
if (tickets != null) {
|
||||
tickets.clear();
|
||||
tickets!.clear();
|
||||
} else {
|
||||
tickets = [];
|
||||
}
|
||||
@@ -101,7 +101,7 @@ class MobileMySupportState extends State<MobileMySupport> {
|
||||
enablePullUp: true,
|
||||
header: WaterDropHeader(),
|
||||
footer: CustomFooter(
|
||||
builder: (BuildContext context, LoadStatus mode){
|
||||
builder: (BuildContext context, LoadStatus? mode){
|
||||
Widget footer;
|
||||
if(mode == LoadStatus.idle) {
|
||||
footer = Text(S.of(context).pull_up_to_load_more);
|
||||
@@ -143,9 +143,9 @@ class MobileMySupportState extends State<MobileMySupport> {
|
||||
return SizedBox.shrink();
|
||||
}
|
||||
return ListView.builder(
|
||||
itemCount: tickets.length <= 1 ? 1 : tickets.length,
|
||||
itemCount: tickets!.length <= 1 ? 1 : tickets!.length,
|
||||
itemBuilder: (BuildContext context, int i) {
|
||||
if (tickets.length <= 0) {
|
||||
if (tickets!.length <= 0) {
|
||||
return Container(
|
||||
padding: EdgeInsets.all(16.0),
|
||||
child: Center(
|
||||
@@ -153,7 +153,7 @@ class MobileMySupportState extends State<MobileMySupport> {
|
||||
),
|
||||
);
|
||||
} else {
|
||||
Ticket ticket = tickets[i];
|
||||
Ticket ticket = tickets![i];
|
||||
|
||||
return GestureDetector(
|
||||
onTap: () {
|
||||
@@ -201,7 +201,7 @@ class MobileMySupportState extends State<MobileMySupport> {
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
ticket.isClosed ?
|
||||
ticket.isClosed == true ?
|
||||
Container(
|
||||
padding: EdgeInsets.only(right: 10.0),
|
||||
child: Icon(Icons.lock, color: Colors.green, size: 16.0,),
|
||||
@@ -273,7 +273,7 @@ class MobileMySupportState extends State<MobileMySupport> {
|
||||
if (tickets == null) {
|
||||
tickets = [];
|
||||
}
|
||||
tickets.addAll((value['tickets'] as List).map((e) => Ticket.fromJson(e)).toList());
|
||||
tickets!.addAll((value['tickets'] as List).map((e) => Ticket.fromJson(e)).toList());
|
||||
});
|
||||
}
|
||||
}).catchError((error) {
|
||||
|
||||
@@ -324,7 +324,7 @@ class MobileNewAddressState extends State<MobileNewAddress> {
|
||||
),
|
||||
bottomNavigationBar: Container(
|
||||
padding: EdgeInsets.all(8.0),
|
||||
color: Theme.of(context).buttonColor,
|
||||
color: Theme.of(context).colorScheme.primary,
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: <Widget>[
|
||||
|
||||
@@ -270,7 +270,7 @@ class MobileNewCommentState extends State<MobileNewComment> {
|
||||
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);
|
||||
}
|
||||
);
|
||||
@@ -329,7 +329,7 @@ class MobileNewCommentState extends State<MobileNewComment> {
|
||||
}
|
||||
},
|
||||
queryParameters: {
|
||||
'comment_id': comment != null ? comment.id : 0,
|
||||
'comment_id': comment != null ? comment.id! : 0,
|
||||
},
|
||||
).catchError((error) {
|
||||
Utils.showMessageDialog(context, error);
|
||||
@@ -356,7 +356,7 @@ class MobileNewCommentState extends State<MobileNewComment> {
|
||||
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(),
|
||||
},
|
||||
|
||||
@@ -331,7 +331,6 @@ class MobileNewTicketState extends State<MobileNewTicket> {
|
||||
galleryImagesFlag[imageId]['path'] = path;
|
||||
});
|
||||
});
|
||||
return null;
|
||||
}
|
||||
);
|
||||
},
|
||||
|
||||
@@ -31,7 +31,7 @@ class MobileOrders extends StatefulWidget {
|
||||
class MobileOrdersState extends State<MobileOrders> with SingleTickerProviderStateMixin {
|
||||
GlobalKey<ScaffoldState> _scaffoldKey = GlobalKey<ScaffoldState>();
|
||||
|
||||
List<Order> orders = [];
|
||||
List<Order>? orders;
|
||||
|
||||
int _page = 1;
|
||||
int _pageCount = 1;
|
||||
@@ -44,7 +44,7 @@ class MobileOrdersState extends State<MobileOrders> with SingleTickerProviderSta
|
||||
void _onRefresh() {
|
||||
_page = 1;
|
||||
if (orders != null) {
|
||||
orders.clear();
|
||||
orders!.clear();
|
||||
} else {
|
||||
orders = [];
|
||||
}
|
||||
@@ -79,7 +79,7 @@ class MobileOrdersState extends State<MobileOrders> with SingleTickerProviderSta
|
||||
enablePullUp: true,
|
||||
header: WaterDropHeader(),
|
||||
footer: CustomFooter(
|
||||
builder: (BuildContext context, LoadStatus mode){
|
||||
builder: (BuildContext context, LoadStatus? mode){
|
||||
Widget footer;
|
||||
if(mode == LoadStatus.idle) {
|
||||
footer = Text(S.of(context).pull_up_to_load_more);
|
||||
@@ -127,11 +127,11 @@ class MobileOrdersState extends State<MobileOrders> with SingleTickerProviderSta
|
||||
Widget _buildBody() {
|
||||
|
||||
return ListView.builder(
|
||||
itemCount: orders != null && orders.length > 0 ? orders.length : 1,
|
||||
itemCount: orders != null && orders!.length > 0 ? orders!.length : 1,
|
||||
itemBuilder: (BuildContext context, int position) {
|
||||
Order? order;
|
||||
if (orders != null && orders.length > 0) {
|
||||
order = orders[position];
|
||||
if (orders != null && orders!.length > 0) {
|
||||
order = orders![position];
|
||||
}
|
||||
if (order == null) {
|
||||
return Container(
|
||||
@@ -199,7 +199,7 @@ class MobileOrdersState extends State<MobileOrders> with SingleTickerProviderSta
|
||||
),
|
||||
],
|
||||
);
|
||||
if (order.status == Constants.STATUS_COMPLETE && !order.hasComment) {
|
||||
if (order.status == Constants.STATUS_COMPLETE && order.hasComment != true) {
|
||||
row3.children.add(
|
||||
Padding(
|
||||
padding: EdgeInsets.only(left: 10.0),
|
||||
@@ -438,7 +438,7 @@ class MobileOrdersState extends State<MobileOrders> with SingleTickerProviderSta
|
||||
if (mounted) {
|
||||
setState(() {
|
||||
_isLoading = false;
|
||||
orders.addAll((data['items'] as List).map((e) => Order.fromJson(e)).toList());
|
||||
orders!.addAll((data['items'] as List).map((e) => Order.fromJson(e)).toList());
|
||||
});
|
||||
}
|
||||
}).catchError((error) {
|
||||
|
||||
@@ -96,7 +96,7 @@ class MobileProductItemState extends State<MobileProductItem> {
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: <Widget>[
|
||||
new Container(
|
||||
child: widget.business!.showMonthlySold ?
|
||||
child: widget.business!.showMonthlySold == true ?
|
||||
Text(
|
||||
S.of(context).sold_per_month_token(widget.product!.monthSales!.toStringAsFixed(0)),
|
||||
style: new TextStyle(
|
||||
|
||||
@@ -123,7 +123,7 @@ class MobileSearchPlaceState extends State<MobileSearchPlace> {
|
||||
Navigator.of(context).pop();
|
||||
}
|
||||
|
||||
void _selectPlaceAsNew(LocatedAddress locatedAddress) {
|
||||
void _selectPlaceAsNew(LocatedAddress? locatedAddress) {
|
||||
print('located address: ${locatedAddress.toString()}');
|
||||
Navigator.push(context, MaterialPageRoute(
|
||||
builder: (BuildContext context) => NewAddress(locatedAddress: locatedAddress, businessId: widget.businessId,),
|
||||
|
||||
@@ -598,7 +598,6 @@ class MobileViewTicketState extends State<MobileViewTicket> {
|
||||
galleryImagesFlag[imageId]['path'] = path;
|
||||
});
|
||||
});
|
||||
return null;
|
||||
}
|
||||
);
|
||||
},
|
||||
|
||||
@@ -125,7 +125,7 @@ class ProductItemState extends State<ProductItem> {
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: <Widget>[
|
||||
new Container(
|
||||
child: widget.business.showMonthlySold ?
|
||||
child: widget.business.showMonthlySold == true ?
|
||||
Text(
|
||||
S.of(context).sold_per_month_token(widget.product.monthSales!.toStringAsFixed(0)),
|
||||
style: new TextStyle(
|
||||
@@ -210,7 +210,7 @@ class ProductItemState extends State<ProductItem> {
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: <Widget>[
|
||||
new Container(
|
||||
child: widget.business.showMonthlySold ?
|
||||
child: widget.business.showMonthlySold == true ?
|
||||
Text(
|
||||
S.of(context).sold_per_month_token(widget.product.monthSales!.toStringAsFixed(0)),
|
||||
style: new TextStyle(
|
||||
|
||||
@@ -41,7 +41,7 @@ class ShoppingCartBarState extends State<ShoppingCartBar> {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
totalPrice = 0.0;
|
||||
cartInfo = Utils.getCartInfoByBusiness(store.state.cartInfos, widget.business);
|
||||
cartInfo = Utils.getCartInfoByBusiness(store.state.cartInfos, widget.business)!;
|
||||
if (cartInfo != null && cartInfo.businessInfo!.id == widget.business.id) {
|
||||
totalPrice = cartInfo.getTotalPrice();
|
||||
}
|
||||
@@ -86,7 +86,7 @@ class ShoppingCartBarState extends State<ShoppingCartBar> {
|
||||
onTap: () {
|
||||
Utils.clearCart(context, cartInfo, onComplete: (_) {
|
||||
if (widget.onEmptyCartListener != null) {
|
||||
widget.onEmptyCartListener();
|
||||
widget.onEmptyCartListener?.call();
|
||||
}
|
||||
});
|
||||
},
|
||||
@@ -198,7 +198,7 @@ class ShoppingCartBarState extends State<ShoppingCartBar> {
|
||||
),
|
||||
onTap: () {
|
||||
if (widget.onPanelOpenCloseRequest != null) {
|
||||
widget.onPanelOpenCloseRequest();
|
||||
widget.onPanelOpenCloseRequest?.call();
|
||||
}
|
||||
},
|
||||
),
|
||||
|
||||
Reference in New Issue
Block a user