phase3: nullable fields/methods, casts, ?.call, condition fixes across 11 files. 108->72
This commit is contained in:
@@ -27,7 +27,7 @@ class DesktopCoupons extends StatefulWidget {
|
||||
}
|
||||
|
||||
class DesktopCouponsState extends State<DesktopCoupons> {
|
||||
late List<Coupon> coupons;
|
||||
List<Coupon>? coupons;
|
||||
|
||||
double sideSpace = 0;
|
||||
double mainSpace = 1200;
|
||||
@@ -56,10 +56,10 @@ class DesktopCouponsState extends State<DesktopCoupons> {
|
||||
}
|
||||
|
||||
Widget w = 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),
|
||||
@@ -137,7 +137,7 @@ class DesktopCouponsState extends State<DesktopCoupons> {
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: <Widget>[
|
||||
Text(
|
||||
coupon.store != null ? coupon.store!.name : S.of(context).general_coupon,
|
||||
coupon.store != null ? coupon.store!.name! : S.of(context).general_coupon,
|
||||
style: TextStyle(
|
||||
fontSize: 20.0,
|
||||
fontWeight: FontWeight.bold,
|
||||
@@ -169,7 +169,7 @@ class DesktopCouponsState extends State<DesktopCoupons> {
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
children: <Widget>[
|
||||
Container(
|
||||
child: !coupon.isPercentage ?
|
||||
child: coupon.isPercentage != true ?
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
|
||||
@@ -106,7 +106,7 @@ class DesktopEditAddressState extends State<DesktopEditAddress> {
|
||||
.contact_name,
|
||||
),
|
||||
validator: (String? value) {
|
||||
if (value
|
||||
if (value!
|
||||
.trim()
|
||||
.isEmpty) {
|
||||
return S
|
||||
@@ -161,7 +161,7 @@ class DesktopEditAddressState extends State<DesktopEditAddress> {
|
||||
.mobile_phone_number,
|
||||
),
|
||||
validator: (String? value) {
|
||||
if (value
|
||||
if (value!
|
||||
.trim()
|
||||
.isEmpty) {
|
||||
return S
|
||||
@@ -193,7 +193,7 @@ class DesktopEditAddressState extends State<DesktopEditAddress> {
|
||||
.street_line_1,
|
||||
),
|
||||
validator: (String? value) {
|
||||
if (value
|
||||
if (value!
|
||||
.trim()
|
||||
.isEmpty) {
|
||||
return S
|
||||
@@ -247,7 +247,7 @@ class DesktopEditAddressState extends State<DesktopEditAddress> {
|
||||
.city,
|
||||
),
|
||||
validator: (String? value) {
|
||||
if (value
|
||||
if (value!
|
||||
.trim()
|
||||
.isEmpty) {
|
||||
return S
|
||||
@@ -317,7 +317,7 @@ class DesktopEditAddressState extends State<DesktopEditAddress> {
|
||||
.postal_code,
|
||||
),
|
||||
validator: (String? value) {
|
||||
if (value
|
||||
if (value!
|
||||
.trim()
|
||||
.isEmpty) {
|
||||
return S
|
||||
|
||||
@@ -36,7 +36,7 @@ class DesktopMeState extends State<DesktopMe> {
|
||||
late String accessToken;
|
||||
|
||||
late bool isLoading;
|
||||
late User _user;
|
||||
User? _user;
|
||||
|
||||
double sideSpace = 0;
|
||||
double mainSpace = 1200;
|
||||
@@ -81,9 +81,9 @@ class DesktopMeState extends State<DesktopMe> {
|
||||
children: <Widget>[
|
||||
Container(
|
||||
margin: EdgeInsets.only(right: 5.0),
|
||||
child: _user != null && _user.avatarUrl!.isNotEmpty
|
||||
child: _user != null && _user!.avatarUrl!.isNotEmpty
|
||||
? Util.showImage(
|
||||
'https:${_user.avatarUrl}',
|
||||
'https:${_user!.avatarUrl}',
|
||||
width: 60,
|
||||
height: 60,
|
||||
fit: BoxFit.fill,
|
||||
@@ -101,7 +101,7 @@ class DesktopMeState extends State<DesktopMe> {
|
||||
),
|
||||
Container(
|
||||
child: Text(
|
||||
_user != null ? _user.nickname : S.of(context).please_login,
|
||||
_user != null ? _user!.nickname! : S.of(context).please_login,
|
||||
style: TextStyle(
|
||||
color: Colors.black38,
|
||||
fontSize: 18.0,
|
||||
@@ -125,7 +125,7 @@ class DesktopMeState extends State<DesktopMe> {
|
||||
Container(
|
||||
child: Text(
|
||||
_user != null
|
||||
? Utils.safePhoneNumber(_user.mobile!)
|
||||
? Utils.safePhoneNumber(_user!.mobile!)
|
||||
: '',
|
||||
style: TextStyle(
|
||||
color: Colors.black38,
|
||||
@@ -182,7 +182,7 @@ class DesktopMeState extends State<DesktopMe> {
|
||||
Container(
|
||||
child: Text(
|
||||
_user != null
|
||||
? '${_user.wallet!.toStringAsFixed(2)}'
|
||||
? '${_user!.wallet!.toStringAsFixed(2)}'
|
||||
: '0.00',
|
||||
style: TextStyle(
|
||||
fontSize: 24.0,
|
||||
@@ -228,7 +228,7 @@ class DesktopMeState extends State<DesktopMe> {
|
||||
children: <Widget>[
|
||||
Container(
|
||||
child: Text(
|
||||
_user != null ? '${_user.coupon}' : '0',
|
||||
_user != null ? '${_user!.coupon}' : '0',
|
||||
style: TextStyle(
|
||||
fontSize: 24.0,
|
||||
color: Colors.orangeAccent,
|
||||
@@ -262,7 +262,7 @@ class DesktopMeState extends State<DesktopMe> {
|
||||
onTap: () {
|
||||
if (_user != null) {
|
||||
Routes.router.navigateTo(
|
||||
context, '/coupons/${_user.id}');
|
||||
context, '/coupons/${_user!.id}');
|
||||
} else {
|
||||
_pleaseLoginToast();
|
||||
}
|
||||
@@ -281,7 +281,7 @@ class DesktopMeState extends State<DesktopMe> {
|
||||
children: <Widget>[
|
||||
Container(
|
||||
child: Text(
|
||||
_user != null ? '${_user.points}' : '0',
|
||||
_user != null ? '${_user!.points}' : '0',
|
||||
style: TextStyle(
|
||||
fontSize: 24.0,
|
||||
color: Colors.lightGreen,
|
||||
@@ -493,7 +493,7 @@ class DesktopMeState extends State<DesktopMe> {
|
||||
),
|
||||
),
|
||||
),
|
||||
onTap: tap!,
|
||||
onTap: () => tap(),
|
||||
),
|
||||
);
|
||||
return widget;
|
||||
|
||||
@@ -30,7 +30,7 @@ class DesktopMySupport extends StatefulWidget {
|
||||
}
|
||||
|
||||
class DesktopMySupportState extends State<DesktopMySupport> {
|
||||
late List<Ticket> tickets;
|
||||
List<Ticket>? tickets;
|
||||
|
||||
double division = 3;
|
||||
|
||||
@@ -45,7 +45,7 @@ class DesktopMySupportState extends State<DesktopMySupport> {
|
||||
void _onRefresh() {
|
||||
_page = 1;
|
||||
if (tickets != null) {
|
||||
tickets.clear();
|
||||
tickets!.clear();
|
||||
} else {
|
||||
tickets = [];
|
||||
}
|
||||
@@ -106,7 +106,7 @@ class DesktopMySupportState extends State<DesktopMySupport> {
|
||||
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);
|
||||
@@ -157,9 +157,9 @@ class DesktopMySupportState extends State<DesktopMySupport> {
|
||||
right: 8.0,
|
||||
),
|
||||
child: tickets == null ? Text('') :
|
||||
(tickets.length > 0 ?
|
||||
(tickets!.length > 0 ?
|
||||
Wrap(
|
||||
children: tickets.map((a) => _getTicket(a)).toList(),
|
||||
children: tickets!.map((a) => _getTicket(a)).toList(),
|
||||
) :
|
||||
Center(
|
||||
child: Text(S.of(context).no_ticket_yet),
|
||||
@@ -240,7 +240,7 @@ class DesktopMySupportState extends State<DesktopMySupport> {
|
||||
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,),
|
||||
@@ -321,7 +321,7 @@ class DesktopMySupportState extends State<DesktopMySupport> {
|
||||
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) {
|
||||
|
||||
@@ -39,7 +39,7 @@ class DesktopOrderDetail extends StatefulWidget {
|
||||
}
|
||||
|
||||
class DesktopOrderDetailState extends State<DesktopOrderDetail> {
|
||||
late Order order;
|
||||
Order? order;
|
||||
|
||||
late LatLng _lastMapPosition;
|
||||
late LatLng customerLatLng;
|
||||
@@ -110,7 +110,7 @@ class DesktopOrderDetailState extends State<DesktopOrderDetail> {
|
||||
width: double.infinity,
|
||||
padding: EdgeInsets.only(top: 0.0, bottom: 16.0),
|
||||
child: Text(
|
||||
order.cartInfo!.businessInfo!.name!,
|
||||
order!.cartInfo!.businessInfo!.name!,
|
||||
maxLines: 1,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
style: TextStyle(
|
||||
@@ -129,7 +129,7 @@ class DesktopOrderDetailState extends State<DesktopOrderDetail> {
|
||||
),
|
||||
),
|
||||
onTap: () {
|
||||
Routes.router.navigateTo(context, '/shop/${order.businessId}/na/na/na');
|
||||
Routes.router.navigateTo(context, '/shop/${order!.businessId}/na/na/na');
|
||||
},
|
||||
),
|
||||
),
|
||||
@@ -141,7 +141,7 @@ class DesktopOrderDetailState extends State<DesktopOrderDetail> {
|
||||
Icons.phone,
|
||||
),
|
||||
onTap: () {
|
||||
Utils.launchURL('tel:${order.businessInfo!.phone}');
|
||||
Utils.launchURL('tel:${order!.businessInfo!.phone}');
|
||||
},
|
||||
),
|
||||
),
|
||||
@@ -150,13 +150,13 @@ class DesktopOrderDetailState extends State<DesktopOrderDetail> {
|
||||
);
|
||||
|
||||
if (!kIsWeb) {
|
||||
if (order.shippingMethod == 'store-delivery' && order.status != Constants.STATUS_COMPLETE && order.status != Constants.STATUS_CANCELLED) {
|
||||
if (order!.shippingMethod == 'store-delivery' && order!.status != Constants.STATUS_COMPLETE && order!.status != Constants.STATUS_CANCELLED) {
|
||||
col.children.add(Container(
|
||||
height: 200.0,
|
||||
child: GoogleMap(
|
||||
onMapCreated: _onMapCreated,
|
||||
initialCameraPosition: CameraPosition(
|
||||
target: new LatLng(double.parse(order.shippingAddress!.lat!), double.parse(order.shippingAddress!.lng!)!),
|
||||
target: new LatLng(double.parse(order!.shippingAddress!.lat!), double.parse(order!.shippingAddress!.lng!)!),
|
||||
zoom: 11.0,
|
||||
),
|
||||
onCameraMove: _onCameraMove,
|
||||
@@ -167,14 +167,14 @@ class DesktopOrderDetailState extends State<DesktopOrderDetail> {
|
||||
].toSet(),
|
||||
),
|
||||
));
|
||||
if (order.deliveryDistance != null && order.deliveryDistance!.distance != null) {
|
||||
if (order!.deliveryDistance != null && order!.deliveryDistance!.distance != null) {
|
||||
col.children.add(Container(
|
||||
padding: EdgeInsets.only(top: 6.0, bottom: 6.0),
|
||||
margin: EdgeInsets.only(bottom: 6.0),
|
||||
child: Text(
|
||||
S.of(context).delivery_distance_token(
|
||||
order.deliveryDistance!.distance!.text!,
|
||||
order.deliveryDistance!.duration!.text!
|
||||
order!.deliveryDistance!.distance!.text!,
|
||||
order!.deliveryDistance!.duration!.text!
|
||||
),
|
||||
),
|
||||
decoration: BoxDecoration(
|
||||
@@ -190,7 +190,7 @@ class DesktopOrderDetailState extends State<DesktopOrderDetail> {
|
||||
}
|
||||
}
|
||||
|
||||
for (CartLineItem lineItem in order.cartInfo!.productList!) {
|
||||
for (CartLineItem lineItem in order!.cartInfo!.productList!) {
|
||||
|
||||
col.children.add(Container(
|
||||
padding: EdgeInsets.only(top: 16.0, bottom: 0.0),
|
||||
@@ -289,7 +289,7 @@ class DesktopOrderDetailState extends State<DesktopOrderDetail> {
|
||||
width: 100.0,
|
||||
alignment: Alignment.centerRight,
|
||||
child: Text(
|
||||
'${order.getSubtotal().toStringAsFixed(2)}',
|
||||
'${order!.getSubtotal().toStringAsFixed(2)}',
|
||||
style: TextStyle(
|
||||
fontSize: 15.0,
|
||||
),
|
||||
@@ -298,8 +298,8 @@ class DesktopOrderDetailState extends State<DesktopOrderDetail> {
|
||||
],
|
||||
),
|
||||
);
|
||||
for (var i = 0; i < order.cartInfo!.extraFeeList!.length; i++) {
|
||||
ExtraFee extraFee = order.cartInfo!.extraFeeList![i];
|
||||
for (var i = 0; i < order!.cartInfo!.extraFeeList!.length; i++) {
|
||||
ExtraFee extraFee = order!.cartInfo!.extraFeeList![i];
|
||||
col.children.add(
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
@@ -356,7 +356,7 @@ class DesktopOrderDetailState extends State<DesktopOrderDetail> {
|
||||
width: 100.0,
|
||||
alignment: Alignment.centerRight,
|
||||
child: Text(
|
||||
'${order.totalPrice!.toStringAsFixed(2)}',
|
||||
'${order!.totalPrice!.toStringAsFixed(2)}',
|
||||
style: TextStyle(
|
||||
fontSize: 18.0,
|
||||
fontWeight: FontWeight.bold,
|
||||
@@ -409,7 +409,7 @@ class DesktopOrderDetailState extends State<DesktopOrderDetail> {
|
||||
),
|
||||
),
|
||||
);
|
||||
if (order.shippingMethod != 'pickup') {
|
||||
if (order!.shippingMethod != 'pickup') {
|
||||
col.children.add(Container(
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
@@ -428,7 +428,7 @@ class DesktopOrderDetailState extends State<DesktopOrderDetail> {
|
||||
child: Container(
|
||||
margin: EdgeInsets.only(top: 10.0, bottom: 10.0),
|
||||
child: Text(
|
||||
'${order.address}, ${order.consignee}, ${order.phone}',
|
||||
'${order!.address}, ${order!.consignee}, ${order!.phone}',
|
||||
style: TextStyle(
|
||||
color: Colors.black38,
|
||||
),
|
||||
@@ -466,7 +466,7 @@ class DesktopOrderDetailState extends State<DesktopOrderDetail> {
|
||||
margin: EdgeInsets.only(top: 10.0, bottom: 10.0),
|
||||
alignment: Alignment.centerRight,
|
||||
child: Text(
|
||||
'${order.cartInfo!.businessInfo!.fullAddress}',
|
||||
'${order!.cartInfo!.businessInfo!.fullAddress}',
|
||||
style: TextStyle(
|
||||
color: Colors.black38,
|
||||
),
|
||||
@@ -505,7 +505,7 @@ class DesktopOrderDetailState extends State<DesktopOrderDetail> {
|
||||
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,
|
||||
),
|
||||
@@ -543,7 +543,7 @@ class DesktopOrderDetailState extends State<DesktopOrderDetail> {
|
||||
margin: EdgeInsets.only(top: 10.0, bottom: 10.0),
|
||||
alignment: Alignment.centerRight,
|
||||
child: Text(
|
||||
order.shippingMethod == 'pickup' ? S.of(context).pickup : S.of(context).store_delivery,
|
||||
order!.shippingMethod == 'pickup' ? S.of(context).pickup : S.of(context).store_delivery,
|
||||
style: TextStyle(
|
||||
color: Colors.black38,
|
||||
),
|
||||
@@ -633,7 +633,7 @@ class DesktopOrderDetailState extends State<DesktopOrderDetail> {
|
||||
mainAxisAlignment: MainAxisAlignment.end,
|
||||
children: <Widget>[
|
||||
Text(
|
||||
'${order.orderNum}',
|
||||
'${order!.orderNum}',
|
||||
style: TextStyle(
|
||||
color: Colors.black38,
|
||||
),
|
||||
@@ -655,7 +655,7 @@ class DesktopOrderDetailState extends State<DesktopOrderDetail> {
|
||||
S.of(context).copy,
|
||||
),
|
||||
onTap: () {
|
||||
Clipboard.setData(ClipboardData(text: '${order.orderNum}'));
|
||||
Clipboard.setData(ClipboardData(text: '${order!.orderNum}'));
|
||||
Fluttertoast.showToast(
|
||||
msg: S.of(context).order_number_copied_to_clipboard,
|
||||
toastLength: Toast.LENGTH_SHORT,
|
||||
@@ -700,7 +700,7 @@ class DesktopOrderDetailState extends State<DesktopOrderDetail> {
|
||||
margin: EdgeInsets.only(top: 10.0, bottom: 10.0),
|
||||
alignment: Alignment.centerRight,
|
||||
child: Text(
|
||||
order.payMethod == 0 ? S.of(context).online_payment : S.of(context).pay_on_deliery,
|
||||
order!.payMethod == 0 ? S.of(context).online_payment : S.of(context).pay_on_deliery,
|
||||
style: TextStyle(
|
||||
color: Colors.black38,
|
||||
),
|
||||
@@ -741,15 +741,15 @@ class DesktopOrderDetailState extends State<DesktopOrderDetail> {
|
||||
mainAxisAlignment: MainAxisAlignment.end,
|
||||
children: <Widget>[
|
||||
Text(
|
||||
order.paymentStatus == Constants.PAYMENT_STATUS_PAID ? S.of(context).paid : S.of(context).unpaid,
|
||||
order!.paymentStatus == Constants.PAYMENT_STATUS_PAID ? S.of(context).paid : S.of(context).unpaid,
|
||||
style: TextStyle(
|
||||
color: Colors.black38,
|
||||
),
|
||||
),
|
||||
Container(
|
||||
margin: order.paymentStatus != Constants.PAYMENT_STATUS_PAID && order.status != Constants.STATUS_CANCELLED ? EdgeInsets.only(left: 10.0, right: 10.0) : EdgeInsets.only(left: 0.0, right: 0.0),
|
||||
child: order.paymentStatus != Constants.PAYMENT_STATUS_PAID && order.status != Constants.STATUS_CANCELLED ? Text('') : SizedBox.shrink(),
|
||||
decoration: order.paymentStatus != Constants.PAYMENT_STATUS_PAID && order.status != Constants.STATUS_CANCELLED ? BoxDecoration(
|
||||
margin: order!.paymentStatus != Constants.PAYMENT_STATUS_PAID && order!.status != Constants.STATUS_CANCELLED ? EdgeInsets.only(left: 10.0, right: 10.0) : EdgeInsets.only(left: 0.0, right: 0.0),
|
||||
child: order!.paymentStatus != Constants.PAYMENT_STATUS_PAID && order!.status != Constants.STATUS_CANCELLED ? Text('') : SizedBox.shrink(),
|
||||
decoration: order!.paymentStatus != Constants.PAYMENT_STATUS_PAID && order!.status != Constants.STATUS_CANCELLED ? BoxDecoration(
|
||||
border: Border(
|
||||
left: BorderSide(
|
||||
width: 0.5,
|
||||
@@ -759,16 +759,16 @@ class DesktopOrderDetailState extends State<DesktopOrderDetail> {
|
||||
) : null,
|
||||
),
|
||||
GestureDetector(
|
||||
child: order.paymentStatus != Constants.PAYMENT_STATUS_PAID
|
||||
&& order.status != Constants.STATUS_CANCELLED
|
||||
&& order.status != Constants.STATUS_COMPLETE ? Text(
|
||||
child: order!.paymentStatus != Constants.PAYMENT_STATUS_PAID
|
||||
&& order!.status != Constants.STATUS_CANCELLED
|
||||
&& order!.status != Constants.STATUS_COMPLETE ? Text(
|
||||
S.of(context).pay_now,
|
||||
style: TextStyle(
|
||||
fontWeight: FontWeight.bold,
|
||||
),
|
||||
) : SizedBox.shrink(),
|
||||
onTap: () {
|
||||
Routes.router.navigateTo(context, '/paynow/${order.id}');
|
||||
Routes.router.navigateTo(context, '/paynow/${order!.id}');
|
||||
},
|
||||
),
|
||||
],
|
||||
@@ -806,7 +806,7 @@ class DesktopOrderDetailState extends State<DesktopOrderDetail> {
|
||||
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<DesktopOrderDetail> {
|
||||
),
|
||||
),
|
||||
Text(
|
||||
Utils.getOrderStatus(context, order.status!),
|
||||
Utils.getOrderStatus(context, order!.status!),
|
||||
maxLines: 1,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
style: TextStyle(
|
||||
@@ -884,7 +884,7 @@ class DesktopOrderDetailState extends State<DesktopOrderDetail> {
|
||||
),
|
||||
),);
|
||||
|
||||
for (Fulfillment fulfillment in order.fulfillments!) {
|
||||
for (Fulfillment fulfillment in order!.fulfillments!) {
|
||||
col.children.add(Container(
|
||||
padding: EdgeInsets.only(top: 10.0, bottom: 10.0),
|
||||
width: double.infinity,
|
||||
@@ -963,13 +963,13 @@ class DesktopOrderDetailState extends State<DesktopOrderDetail> {
|
||||
back: true,
|
||||
breadCrumbs: [
|
||||
BreadCrumb(S.of(context).order_detail, null),
|
||||
BreadCrumb('#${order.orderNum}', null)
|
||||
BreadCrumb('#${order!.orderNum}', null)
|
||||
],
|
||||
breadCrumbHeight: Constants.BREADCRUMB_HEIGHT,
|
||||
),
|
||||
body: WillPopScope(
|
||||
onWillPop: () async {
|
||||
if (widget.fromOrders != null && widget.fromOrders) {
|
||||
if (widget.fromOrders == true) {
|
||||
return true;
|
||||
} else {
|
||||
Routes.router.navigateTo(
|
||||
@@ -1000,7 +1000,7 @@ class DesktopOrderDetailState extends State<DesktopOrderDetail> {
|
||||
children: <Widget>[
|
||||
Container(
|
||||
padding: EdgeInsets.only(right: 10.0),
|
||||
child: order.status == Constants.STATUS_PENDING && order.paymentStatus == Constants.PAYMENT_STATUS_UNPAID ?
|
||||
child: order!.status == Constants.STATUS_PENDING && order!.paymentStatus == Constants.PAYMENT_STATUS_UNPAID ?
|
||||
TextButton(
|
||||
child: Text(
|
||||
S.of(context).cancel_order,
|
||||
@@ -1015,7 +1015,7 @@ class DesktopOrderDetailState extends State<DesktopOrderDetail> {
|
||||
) : SizedBox.shrink(),
|
||||
),
|
||||
Container(
|
||||
child: order.status == Constants.STATUS_COMPLETE && !order.hasComment ? ElevatedButton(
|
||||
child: order!.status == Constants.STATUS_COMPLETE && order!.hasComment != true ? ElevatedButton(
|
||||
child: Text(
|
||||
S.of(context).comment,
|
||||
style: TextStyle(
|
||||
@@ -1023,16 +1023,16 @@ class DesktopOrderDetailState extends State<DesktopOrderDetail> {
|
||||
),
|
||||
),
|
||||
onPressed: () {
|
||||
Routes.router.navigateTo(context, '/new-comment/${order.id}');
|
||||
Routes.router.navigateTo(context, '/new-comment/${order!.id}');
|
||||
},
|
||||
) : SizedBox.shrink(),
|
||||
),
|
||||
],
|
||||
),
|
||||
Container(
|
||||
child: order.paymentStatus != Constants.PAYMENT_STATUS_PAID
|
||||
&& order.status != Constants.STATUS_CANCELLED
|
||||
&& order.status != Constants.STATUS_COMPLETE ?
|
||||
child: order!.paymentStatus != Constants.PAYMENT_STATUS_PAID
|
||||
&& order!.status != Constants.STATUS_CANCELLED
|
||||
&& order!.status != Constants.STATUS_COMPLETE ?
|
||||
TextButton(
|
||||
child: Text(
|
||||
S.of(context).pay_now,
|
||||
@@ -1042,7 +1042,7 @@ class DesktopOrderDetailState extends State<DesktopOrderDetail> {
|
||||
),
|
||||
),
|
||||
onPressed: () {
|
||||
Routes.router.navigateTo(context, '/paynow/${order.id}');
|
||||
Routes.router.navigateTo(context, '/paynow/${order!.id}');
|
||||
},
|
||||
) : TextButton(
|
||||
child: Text(
|
||||
@@ -1053,7 +1053,7 @@ class DesktopOrderDetailState extends State<DesktopOrderDetail> {
|
||||
),
|
||||
),
|
||||
onPressed: () {
|
||||
Utils.orderAgain(context, order.cartInfo!);
|
||||
Utils.orderAgain(context, order!.cartInfo!);
|
||||
},
|
||||
),
|
||||
),
|
||||
@@ -1091,13 +1091,13 @@ class DesktopOrderDetailState extends State<DesktopOrderDetail> {
|
||||
order = Order.fromJson(data);
|
||||
|
||||
if (!kIsWeb) {
|
||||
if (order.shippingMethod == 'store-delivery' && order.status != Constants.STATUS_COMPLETE && order.status != Constants.STATUS_CANCELLED) {
|
||||
storeLatLng = LatLng(double.parse(order.businessInfo!.address!.lat!),
|
||||
double.parse(order.businessInfo!.address!.lng!));
|
||||
customerLatLng = LatLng(double.parse(order.shippingAddress!.lat!),
|
||||
double.parse(order.shippingAddress!.lng!));
|
||||
if (order!.shippingMethod == 'store-delivery' && order!.status != Constants.STATUS_COMPLETE && order!.status != Constants.STATUS_CANCELLED) {
|
||||
storeLatLng = LatLng(double.parse(order!.businessInfo!.address!.lat!),
|
||||
double.parse(order!.businessInfo!.address!.lng!));
|
||||
customerLatLng = LatLng(double.parse(order!.shippingAddress!.lat!),
|
||||
double.parse(order!.shippingAddress!.lng!));
|
||||
deliveryLatLng =
|
||||
LatLng(order.shipperPosition!.lat!, order.shipperPosition!.lng!);
|
||||
LatLng(order!.shipperPosition!.lat!, order!.shipperPosition!.lng!);
|
||||
|
||||
_polyLine.clear();
|
||||
_polyLine.add(
|
||||
@@ -1110,7 +1110,7 @@ class DesktopOrderDetailState extends State<DesktopOrderDetail> {
|
||||
],
|
||||
width: 3,
|
||||
points: [
|
||||
order.shipperPosition!.lat != 0.0 ? deliveryLatLng : storeLatLng,
|
||||
order!.shipperPosition!.lat != 0.0 ? deliveryLatLng : storeLatLng,
|
||||
customerLatLng,
|
||||
]
|
||||
)
|
||||
@@ -1135,12 +1135,12 @@ class DesktopOrderDetailState extends State<DesktopOrderDetail> {
|
||||
title: S
|
||||
.of(context)
|
||||
.customer,
|
||||
snippet: order.shippingAddress!.addressLine1,
|
||||
snippet: order!.shippingAddress!.addressLine1,
|
||||
),
|
||||
icon: homeIcon,
|
||||
));
|
||||
if (order.shipperPosition!.lat != 0.0 &&
|
||||
order.shipperPosition!.lng != 0.0) {
|
||||
if (order!.shipperPosition!.lat != 0.0 &&
|
||||
order!.shipperPosition!.lng != 0.0) {
|
||||
_markers.add(Marker(
|
||||
markerId: MarkerId('shipper_position'),
|
||||
position: deliveryLatLng,
|
||||
|
||||
@@ -29,7 +29,7 @@ class ShopProductsState extends State<ShopProducts> {
|
||||
dynamic data;
|
||||
|
||||
static const num _categoryHeight = 50.0;
|
||||
static const num _categoryDescHeight = 50.0;
|
||||
static const double _categoryDescHeight = 50.0;
|
||||
static const num _productHeight = 266.0;
|
||||
|
||||
bool displayProductByCategoryClick = false;
|
||||
@@ -114,7 +114,7 @@ class ShopProductsState extends State<ShopProducts> {
|
||||
itemBuilder: (BuildContext context, int i) {
|
||||
CategoryProducts cp = _categoryProducts[i];
|
||||
int qtyInCategory = 0;
|
||||
CartInfo cartInfo = Utils.getCartInfoByBusiness(store.state.cartInfos, _business);
|
||||
CartInfo cartInfo = Utils.getCartInfoByBusiness(store.state.cartInfos, _business)!;
|
||||
if (cartInfo != null &&
|
||||
cartInfo.businessInfo!.id == _business.id &&
|
||||
cartInfo.productList != null) {
|
||||
@@ -207,7 +207,7 @@ class ShopProductsState extends State<ShopProducts> {
|
||||
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(
|
||||
@@ -386,7 +386,7 @@ class ShopProductsState extends State<ShopProducts> {
|
||||
.pull_up_to_load_more;
|
||||
}
|
||||
CategoryProducts currentCp =
|
||||
getCategoryProductByCategoryId(categoryId);
|
||||
getCategoryProductByCategoryId(categoryId)!;
|
||||
if (currentCp != null) {
|
||||
currentCp.products!.addAll(moreCategoryProducts[0].products!);
|
||||
} else {
|
||||
@@ -410,7 +410,7 @@ class ShopProductsState extends State<ShopProducts> {
|
||||
return num;
|
||||
}
|
||||
|
||||
CategoryProducts getCategoryProductByCategoryId(int cid) {
|
||||
CategoryProducts? getCategoryProductByCategoryId(int cid) {
|
||||
for (CategoryProducts cp in _categoryProducts) {
|
||||
if (cp.id == cid) {
|
||||
return cp;
|
||||
|
||||
Reference in New Issue
Block a user