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> {
|
class DesktopCouponsState extends State<DesktopCoupons> {
|
||||||
late List<Coupon> coupons;
|
List<Coupon>? coupons;
|
||||||
|
|
||||||
double sideSpace = 0;
|
double sideSpace = 0;
|
||||||
double mainSpace = 1200;
|
double mainSpace = 1200;
|
||||||
@@ -56,10 +56,10 @@ class DesktopCouponsState extends State<DesktopCoupons> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Widget w = ListView.builder(
|
Widget w = ListView.builder(
|
||||||
itemCount: coupons.length > 0 ? coupons.length : 1,
|
itemCount: coupons!.length > 0 ? coupons!.length : 1,
|
||||||
itemBuilder: (BuildContext context, int position) {
|
itemBuilder: (BuildContext context, int position) {
|
||||||
if (coupons.length > 0) {
|
if (coupons!.length > 0) {
|
||||||
Coupon coupon = coupons[position];
|
Coupon coupon = coupons![position];
|
||||||
return Container(
|
return Container(
|
||||||
color: Colors.black12,
|
color: Colors.black12,
|
||||||
child: couponWidget(coupon),
|
child: couponWidget(coupon),
|
||||||
@@ -137,7 +137,7 @@ class DesktopCouponsState extends State<DesktopCoupons> {
|
|||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
children: <Widget>[
|
children: <Widget>[
|
||||||
Text(
|
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(
|
style: TextStyle(
|
||||||
fontSize: 20.0,
|
fontSize: 20.0,
|
||||||
fontWeight: FontWeight.bold,
|
fontWeight: FontWeight.bold,
|
||||||
@@ -169,7 +169,7 @@ class DesktopCouponsState extends State<DesktopCoupons> {
|
|||||||
crossAxisAlignment: CrossAxisAlignment.center,
|
crossAxisAlignment: CrossAxisAlignment.center,
|
||||||
children: <Widget>[
|
children: <Widget>[
|
||||||
Container(
|
Container(
|
||||||
child: !coupon.isPercentage ?
|
child: coupon.isPercentage != true ?
|
||||||
Row(
|
Row(
|
||||||
mainAxisAlignment: MainAxisAlignment.start,
|
mainAxisAlignment: MainAxisAlignment.start,
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
|
|||||||
@@ -106,7 +106,7 @@ class DesktopEditAddressState extends State<DesktopEditAddress> {
|
|||||||
.contact_name,
|
.contact_name,
|
||||||
),
|
),
|
||||||
validator: (String? value) {
|
validator: (String? value) {
|
||||||
if (value
|
if (value!
|
||||||
.trim()
|
.trim()
|
||||||
.isEmpty) {
|
.isEmpty) {
|
||||||
return S
|
return S
|
||||||
@@ -161,7 +161,7 @@ class DesktopEditAddressState extends State<DesktopEditAddress> {
|
|||||||
.mobile_phone_number,
|
.mobile_phone_number,
|
||||||
),
|
),
|
||||||
validator: (String? value) {
|
validator: (String? value) {
|
||||||
if (value
|
if (value!
|
||||||
.trim()
|
.trim()
|
||||||
.isEmpty) {
|
.isEmpty) {
|
||||||
return S
|
return S
|
||||||
@@ -193,7 +193,7 @@ class DesktopEditAddressState extends State<DesktopEditAddress> {
|
|||||||
.street_line_1,
|
.street_line_1,
|
||||||
),
|
),
|
||||||
validator: (String? value) {
|
validator: (String? value) {
|
||||||
if (value
|
if (value!
|
||||||
.trim()
|
.trim()
|
||||||
.isEmpty) {
|
.isEmpty) {
|
||||||
return S
|
return S
|
||||||
@@ -247,7 +247,7 @@ class DesktopEditAddressState extends State<DesktopEditAddress> {
|
|||||||
.city,
|
.city,
|
||||||
),
|
),
|
||||||
validator: (String? value) {
|
validator: (String? value) {
|
||||||
if (value
|
if (value!
|
||||||
.trim()
|
.trim()
|
||||||
.isEmpty) {
|
.isEmpty) {
|
||||||
return S
|
return S
|
||||||
@@ -317,7 +317,7 @@ class DesktopEditAddressState extends State<DesktopEditAddress> {
|
|||||||
.postal_code,
|
.postal_code,
|
||||||
),
|
),
|
||||||
validator: (String? value) {
|
validator: (String? value) {
|
||||||
if (value
|
if (value!
|
||||||
.trim()
|
.trim()
|
||||||
.isEmpty) {
|
.isEmpty) {
|
||||||
return S
|
return S
|
||||||
|
|||||||
@@ -36,7 +36,7 @@ class DesktopMeState extends State<DesktopMe> {
|
|||||||
late String accessToken;
|
late String accessToken;
|
||||||
|
|
||||||
late bool isLoading;
|
late bool isLoading;
|
||||||
late User _user;
|
User? _user;
|
||||||
|
|
||||||
double sideSpace = 0;
|
double sideSpace = 0;
|
||||||
double mainSpace = 1200;
|
double mainSpace = 1200;
|
||||||
@@ -81,9 +81,9 @@ class DesktopMeState extends State<DesktopMe> {
|
|||||||
children: <Widget>[
|
children: <Widget>[
|
||||||
Container(
|
Container(
|
||||||
margin: EdgeInsets.only(right: 5.0),
|
margin: EdgeInsets.only(right: 5.0),
|
||||||
child: _user != null && _user.avatarUrl!.isNotEmpty
|
child: _user != null && _user!.avatarUrl!.isNotEmpty
|
||||||
? Util.showImage(
|
? Util.showImage(
|
||||||
'https:${_user.avatarUrl}',
|
'https:${_user!.avatarUrl}',
|
||||||
width: 60,
|
width: 60,
|
||||||
height: 60,
|
height: 60,
|
||||||
fit: BoxFit.fill,
|
fit: BoxFit.fill,
|
||||||
@@ -101,7 +101,7 @@ class DesktopMeState extends State<DesktopMe> {
|
|||||||
),
|
),
|
||||||
Container(
|
Container(
|
||||||
child: Text(
|
child: Text(
|
||||||
_user != null ? _user.nickname : S.of(context).please_login,
|
_user != null ? _user!.nickname! : S.of(context).please_login,
|
||||||
style: TextStyle(
|
style: TextStyle(
|
||||||
color: Colors.black38,
|
color: Colors.black38,
|
||||||
fontSize: 18.0,
|
fontSize: 18.0,
|
||||||
@@ -125,7 +125,7 @@ class DesktopMeState extends State<DesktopMe> {
|
|||||||
Container(
|
Container(
|
||||||
child: Text(
|
child: Text(
|
||||||
_user != null
|
_user != null
|
||||||
? Utils.safePhoneNumber(_user.mobile!)
|
? Utils.safePhoneNumber(_user!.mobile!)
|
||||||
: '',
|
: '',
|
||||||
style: TextStyle(
|
style: TextStyle(
|
||||||
color: Colors.black38,
|
color: Colors.black38,
|
||||||
@@ -182,7 +182,7 @@ class DesktopMeState extends State<DesktopMe> {
|
|||||||
Container(
|
Container(
|
||||||
child: Text(
|
child: Text(
|
||||||
_user != null
|
_user != null
|
||||||
? '${_user.wallet!.toStringAsFixed(2)}'
|
? '${_user!.wallet!.toStringAsFixed(2)}'
|
||||||
: '0.00',
|
: '0.00',
|
||||||
style: TextStyle(
|
style: TextStyle(
|
||||||
fontSize: 24.0,
|
fontSize: 24.0,
|
||||||
@@ -228,7 +228,7 @@ class DesktopMeState extends State<DesktopMe> {
|
|||||||
children: <Widget>[
|
children: <Widget>[
|
||||||
Container(
|
Container(
|
||||||
child: Text(
|
child: Text(
|
||||||
_user != null ? '${_user.coupon}' : '0',
|
_user != null ? '${_user!.coupon}' : '0',
|
||||||
style: TextStyle(
|
style: TextStyle(
|
||||||
fontSize: 24.0,
|
fontSize: 24.0,
|
||||||
color: Colors.orangeAccent,
|
color: Colors.orangeAccent,
|
||||||
@@ -262,7 +262,7 @@ class DesktopMeState extends State<DesktopMe> {
|
|||||||
onTap: () {
|
onTap: () {
|
||||||
if (_user != null) {
|
if (_user != null) {
|
||||||
Routes.router.navigateTo(
|
Routes.router.navigateTo(
|
||||||
context, '/coupons/${_user.id}');
|
context, '/coupons/${_user!.id}');
|
||||||
} else {
|
} else {
|
||||||
_pleaseLoginToast();
|
_pleaseLoginToast();
|
||||||
}
|
}
|
||||||
@@ -281,7 +281,7 @@ class DesktopMeState extends State<DesktopMe> {
|
|||||||
children: <Widget>[
|
children: <Widget>[
|
||||||
Container(
|
Container(
|
||||||
child: Text(
|
child: Text(
|
||||||
_user != null ? '${_user.points}' : '0',
|
_user != null ? '${_user!.points}' : '0',
|
||||||
style: TextStyle(
|
style: TextStyle(
|
||||||
fontSize: 24.0,
|
fontSize: 24.0,
|
||||||
color: Colors.lightGreen,
|
color: Colors.lightGreen,
|
||||||
@@ -493,7 +493,7 @@ class DesktopMeState extends State<DesktopMe> {
|
|||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
onTap: tap!,
|
onTap: () => tap(),
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
return widget;
|
return widget;
|
||||||
|
|||||||
@@ -30,7 +30,7 @@ class DesktopMySupport extends StatefulWidget {
|
|||||||
}
|
}
|
||||||
|
|
||||||
class DesktopMySupportState extends State<DesktopMySupport> {
|
class DesktopMySupportState extends State<DesktopMySupport> {
|
||||||
late List<Ticket> tickets;
|
List<Ticket>? tickets;
|
||||||
|
|
||||||
double division = 3;
|
double division = 3;
|
||||||
|
|
||||||
@@ -45,7 +45,7 @@ class DesktopMySupportState extends State<DesktopMySupport> {
|
|||||||
void _onRefresh() {
|
void _onRefresh() {
|
||||||
_page = 1;
|
_page = 1;
|
||||||
if (tickets != null) {
|
if (tickets != null) {
|
||||||
tickets.clear();
|
tickets!.clear();
|
||||||
} else {
|
} else {
|
||||||
tickets = [];
|
tickets = [];
|
||||||
}
|
}
|
||||||
@@ -106,7 +106,7 @@ class DesktopMySupportState extends State<DesktopMySupport> {
|
|||||||
enablePullUp: true,
|
enablePullUp: true,
|
||||||
header: WaterDropHeader(),
|
header: WaterDropHeader(),
|
||||||
footer: CustomFooter(
|
footer: CustomFooter(
|
||||||
builder: (BuildContext context, LoadStatus mode){
|
builder: (BuildContext context, LoadStatus? mode){
|
||||||
Widget footer;
|
Widget footer;
|
||||||
if(mode == LoadStatus.idle) {
|
if(mode == LoadStatus.idle) {
|
||||||
footer = Text(S.of(context).pull_up_to_load_more);
|
footer = Text(S.of(context).pull_up_to_load_more);
|
||||||
@@ -157,9 +157,9 @@ class DesktopMySupportState extends State<DesktopMySupport> {
|
|||||||
right: 8.0,
|
right: 8.0,
|
||||||
),
|
),
|
||||||
child: tickets == null ? Text('') :
|
child: tickets == null ? Text('') :
|
||||||
(tickets.length > 0 ?
|
(tickets!.length > 0 ?
|
||||||
Wrap(
|
Wrap(
|
||||||
children: tickets.map((a) => _getTicket(a)).toList(),
|
children: tickets!.map((a) => _getTicket(a)).toList(),
|
||||||
) :
|
) :
|
||||||
Center(
|
Center(
|
||||||
child: Text(S.of(context).no_ticket_yet),
|
child: Text(S.of(context).no_ticket_yet),
|
||||||
@@ -240,7 +240,7 @@ class DesktopMySupportState extends State<DesktopMySupport> {
|
|||||||
mainAxisAlignment: MainAxisAlignment.start,
|
mainAxisAlignment: MainAxisAlignment.start,
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
children: [
|
children: [
|
||||||
ticket.isClosed ?
|
ticket.isClosed == true ?
|
||||||
Container(
|
Container(
|
||||||
padding: EdgeInsets.only(right: 10.0),
|
padding: EdgeInsets.only(right: 10.0),
|
||||||
child: Icon(Icons.lock, color: Colors.green, size: 16.0,),
|
child: Icon(Icons.lock, color: Colors.green, size: 16.0,),
|
||||||
@@ -321,7 +321,7 @@ class DesktopMySupportState extends State<DesktopMySupport> {
|
|||||||
if (tickets == null) {
|
if (tickets == null) {
|
||||||
tickets = [];
|
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) {
|
}).catchError((error) {
|
||||||
|
|||||||
@@ -39,7 +39,7 @@ class DesktopOrderDetail extends StatefulWidget {
|
|||||||
}
|
}
|
||||||
|
|
||||||
class DesktopOrderDetailState extends State<DesktopOrderDetail> {
|
class DesktopOrderDetailState extends State<DesktopOrderDetail> {
|
||||||
late Order order;
|
Order? order;
|
||||||
|
|
||||||
late LatLng _lastMapPosition;
|
late LatLng _lastMapPosition;
|
||||||
late LatLng customerLatLng;
|
late LatLng customerLatLng;
|
||||||
@@ -110,7 +110,7 @@ class DesktopOrderDetailState extends State<DesktopOrderDetail> {
|
|||||||
width: double.infinity,
|
width: double.infinity,
|
||||||
padding: EdgeInsets.only(top: 0.0, bottom: 16.0),
|
padding: EdgeInsets.only(top: 0.0, bottom: 16.0),
|
||||||
child: Text(
|
child: Text(
|
||||||
order.cartInfo!.businessInfo!.name!,
|
order!.cartInfo!.businessInfo!.name!,
|
||||||
maxLines: 1,
|
maxLines: 1,
|
||||||
overflow: TextOverflow.ellipsis,
|
overflow: TextOverflow.ellipsis,
|
||||||
style: TextStyle(
|
style: TextStyle(
|
||||||
@@ -129,7 +129,7 @@ class DesktopOrderDetailState extends State<DesktopOrderDetail> {
|
|||||||
),
|
),
|
||||||
),
|
),
|
||||||
onTap: () {
|
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,
|
Icons.phone,
|
||||||
),
|
),
|
||||||
onTap: () {
|
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 (!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(
|
col.children.add(Container(
|
||||||
height: 200.0,
|
height: 200.0,
|
||||||
child: GoogleMap(
|
child: GoogleMap(
|
||||||
onMapCreated: _onMapCreated,
|
onMapCreated: _onMapCreated,
|
||||||
initialCameraPosition: CameraPosition(
|
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,
|
zoom: 11.0,
|
||||||
),
|
),
|
||||||
onCameraMove: _onCameraMove,
|
onCameraMove: _onCameraMove,
|
||||||
@@ -167,14 +167,14 @@ class DesktopOrderDetailState extends State<DesktopOrderDetail> {
|
|||||||
].toSet(),
|
].toSet(),
|
||||||
),
|
),
|
||||||
));
|
));
|
||||||
if (order.deliveryDistance != null && order.deliveryDistance!.distance != null) {
|
if (order!.deliveryDistance != null && order!.deliveryDistance!.distance != null) {
|
||||||
col.children.add(Container(
|
col.children.add(Container(
|
||||||
padding: EdgeInsets.only(top: 6.0, bottom: 6.0),
|
padding: EdgeInsets.only(top: 6.0, bottom: 6.0),
|
||||||
margin: EdgeInsets.only(bottom: 6.0),
|
margin: EdgeInsets.only(bottom: 6.0),
|
||||||
child: Text(
|
child: Text(
|
||||||
S.of(context).delivery_distance_token(
|
S.of(context).delivery_distance_token(
|
||||||
order.deliveryDistance!.distance!.text!,
|
order!.deliveryDistance!.distance!.text!,
|
||||||
order.deliveryDistance!.duration!.text!
|
order!.deliveryDistance!.duration!.text!
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
decoration: BoxDecoration(
|
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(
|
col.children.add(Container(
|
||||||
padding: EdgeInsets.only(top: 16.0, bottom: 0.0),
|
padding: EdgeInsets.only(top: 16.0, bottom: 0.0),
|
||||||
@@ -289,7 +289,7 @@ class DesktopOrderDetailState extends State<DesktopOrderDetail> {
|
|||||||
width: 100.0,
|
width: 100.0,
|
||||||
alignment: Alignment.centerRight,
|
alignment: Alignment.centerRight,
|
||||||
child: Text(
|
child: Text(
|
||||||
'${order.getSubtotal().toStringAsFixed(2)}',
|
'${order!.getSubtotal().toStringAsFixed(2)}',
|
||||||
style: TextStyle(
|
style: TextStyle(
|
||||||
fontSize: 15.0,
|
fontSize: 15.0,
|
||||||
),
|
),
|
||||||
@@ -298,8 +298,8 @@ class DesktopOrderDetailState extends State<DesktopOrderDetail> {
|
|||||||
],
|
],
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
for (var i = 0; i < order.cartInfo!.extraFeeList!.length; i++) {
|
for (var i = 0; i < order!.cartInfo!.extraFeeList!.length; i++) {
|
||||||
ExtraFee extraFee = order.cartInfo!.extraFeeList![i];
|
ExtraFee extraFee = order!.cartInfo!.extraFeeList![i];
|
||||||
col.children.add(
|
col.children.add(
|
||||||
Row(
|
Row(
|
||||||
mainAxisAlignment: MainAxisAlignment.start,
|
mainAxisAlignment: MainAxisAlignment.start,
|
||||||
@@ -356,7 +356,7 @@ class DesktopOrderDetailState extends State<DesktopOrderDetail> {
|
|||||||
width: 100.0,
|
width: 100.0,
|
||||||
alignment: Alignment.centerRight,
|
alignment: Alignment.centerRight,
|
||||||
child: Text(
|
child: Text(
|
||||||
'${order.totalPrice!.toStringAsFixed(2)}',
|
'${order!.totalPrice!.toStringAsFixed(2)}',
|
||||||
style: TextStyle(
|
style: TextStyle(
|
||||||
fontSize: 18.0,
|
fontSize: 18.0,
|
||||||
fontWeight: FontWeight.bold,
|
fontWeight: FontWeight.bold,
|
||||||
@@ -409,7 +409,7 @@ class DesktopOrderDetailState extends State<DesktopOrderDetail> {
|
|||||||
),
|
),
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
if (order.shippingMethod != 'pickup') {
|
if (order!.shippingMethod != 'pickup') {
|
||||||
col.children.add(Container(
|
col.children.add(Container(
|
||||||
child: Row(
|
child: Row(
|
||||||
mainAxisAlignment: MainAxisAlignment.start,
|
mainAxisAlignment: MainAxisAlignment.start,
|
||||||
@@ -428,7 +428,7 @@ class DesktopOrderDetailState extends State<DesktopOrderDetail> {
|
|||||||
child: Container(
|
child: Container(
|
||||||
margin: EdgeInsets.only(top: 10.0, bottom: 10.0),
|
margin: EdgeInsets.only(top: 10.0, bottom: 10.0),
|
||||||
child: Text(
|
child: Text(
|
||||||
'${order.address}, ${order.consignee}, ${order.phone}',
|
'${order!.address}, ${order!.consignee}, ${order!.phone}',
|
||||||
style: TextStyle(
|
style: TextStyle(
|
||||||
color: Colors.black38,
|
color: Colors.black38,
|
||||||
),
|
),
|
||||||
@@ -466,7 +466,7 @@ class DesktopOrderDetailState extends State<DesktopOrderDetail> {
|
|||||||
margin: EdgeInsets.only(top: 10.0, bottom: 10.0),
|
margin: EdgeInsets.only(top: 10.0, bottom: 10.0),
|
||||||
alignment: Alignment.centerRight,
|
alignment: Alignment.centerRight,
|
||||||
child: Text(
|
child: Text(
|
||||||
'${order.cartInfo!.businessInfo!.fullAddress}',
|
'${order!.cartInfo!.businessInfo!.fullAddress}',
|
||||||
style: TextStyle(
|
style: TextStyle(
|
||||||
color: Colors.black38,
|
color: Colors.black38,
|
||||||
),
|
),
|
||||||
@@ -505,7 +505,7 @@ class DesktopOrderDetailState extends State<DesktopOrderDetail> {
|
|||||||
margin: EdgeInsets.only(top: 10.0, bottom: 10.0),
|
margin: EdgeInsets.only(top: 10.0, bottom: 10.0),
|
||||||
alignment: Alignment.centerRight,
|
alignment: Alignment.centerRight,
|
||||||
child: Text(
|
child: Text(
|
||||||
'${Utils.timestampToString(context, order.bookedAt!, withTime: true)}',
|
'${Utils.timestampToString(context, order!.bookedAt!, withTime: true)}',
|
||||||
style: TextStyle(
|
style: TextStyle(
|
||||||
color: Colors.black38,
|
color: Colors.black38,
|
||||||
),
|
),
|
||||||
@@ -543,7 +543,7 @@ class DesktopOrderDetailState extends State<DesktopOrderDetail> {
|
|||||||
margin: EdgeInsets.only(top: 10.0, bottom: 10.0),
|
margin: EdgeInsets.only(top: 10.0, bottom: 10.0),
|
||||||
alignment: Alignment.centerRight,
|
alignment: Alignment.centerRight,
|
||||||
child: Text(
|
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(
|
style: TextStyle(
|
||||||
color: Colors.black38,
|
color: Colors.black38,
|
||||||
),
|
),
|
||||||
@@ -633,7 +633,7 @@ class DesktopOrderDetailState extends State<DesktopOrderDetail> {
|
|||||||
mainAxisAlignment: MainAxisAlignment.end,
|
mainAxisAlignment: MainAxisAlignment.end,
|
||||||
children: <Widget>[
|
children: <Widget>[
|
||||||
Text(
|
Text(
|
||||||
'${order.orderNum}',
|
'${order!.orderNum}',
|
||||||
style: TextStyle(
|
style: TextStyle(
|
||||||
color: Colors.black38,
|
color: Colors.black38,
|
||||||
),
|
),
|
||||||
@@ -655,7 +655,7 @@ class DesktopOrderDetailState extends State<DesktopOrderDetail> {
|
|||||||
S.of(context).copy,
|
S.of(context).copy,
|
||||||
),
|
),
|
||||||
onTap: () {
|
onTap: () {
|
||||||
Clipboard.setData(ClipboardData(text: '${order.orderNum}'));
|
Clipboard.setData(ClipboardData(text: '${order!.orderNum}'));
|
||||||
Fluttertoast.showToast(
|
Fluttertoast.showToast(
|
||||||
msg: S.of(context).order_number_copied_to_clipboard,
|
msg: S.of(context).order_number_copied_to_clipboard,
|
||||||
toastLength: Toast.LENGTH_SHORT,
|
toastLength: Toast.LENGTH_SHORT,
|
||||||
@@ -700,7 +700,7 @@ class DesktopOrderDetailState extends State<DesktopOrderDetail> {
|
|||||||
margin: EdgeInsets.only(top: 10.0, bottom: 10.0),
|
margin: EdgeInsets.only(top: 10.0, bottom: 10.0),
|
||||||
alignment: Alignment.centerRight,
|
alignment: Alignment.centerRight,
|
||||||
child: Text(
|
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(
|
style: TextStyle(
|
||||||
color: Colors.black38,
|
color: Colors.black38,
|
||||||
),
|
),
|
||||||
@@ -741,15 +741,15 @@ class DesktopOrderDetailState extends State<DesktopOrderDetail> {
|
|||||||
mainAxisAlignment: MainAxisAlignment.end,
|
mainAxisAlignment: MainAxisAlignment.end,
|
||||||
children: <Widget>[
|
children: <Widget>[
|
||||||
Text(
|
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(
|
style: TextStyle(
|
||||||
color: Colors.black38,
|
color: Colors.black38,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
Container(
|
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),
|
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(),
|
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(
|
decoration: order!.paymentStatus != Constants.PAYMENT_STATUS_PAID && order!.status != Constants.STATUS_CANCELLED ? BoxDecoration(
|
||||||
border: Border(
|
border: Border(
|
||||||
left: BorderSide(
|
left: BorderSide(
|
||||||
width: 0.5,
|
width: 0.5,
|
||||||
@@ -759,16 +759,16 @@ class DesktopOrderDetailState extends State<DesktopOrderDetail> {
|
|||||||
) : null,
|
) : null,
|
||||||
),
|
),
|
||||||
GestureDetector(
|
GestureDetector(
|
||||||
child: order.paymentStatus != Constants.PAYMENT_STATUS_PAID
|
child: order!.paymentStatus != Constants.PAYMENT_STATUS_PAID
|
||||||
&& order.status != Constants.STATUS_CANCELLED
|
&& order!.status != Constants.STATUS_CANCELLED
|
||||||
&& order.status != Constants.STATUS_COMPLETE ? Text(
|
&& order!.status != Constants.STATUS_COMPLETE ? Text(
|
||||||
S.of(context).pay_now,
|
S.of(context).pay_now,
|
||||||
style: TextStyle(
|
style: TextStyle(
|
||||||
fontWeight: FontWeight.bold,
|
fontWeight: FontWeight.bold,
|
||||||
),
|
),
|
||||||
) : SizedBox.shrink(),
|
) : SizedBox.shrink(),
|
||||||
onTap: () {
|
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),
|
margin: EdgeInsets.only(top: 10.0, bottom: 10.0),
|
||||||
alignment: Alignment.centerRight,
|
alignment: Alignment.centerRight,
|
||||||
child: Text(
|
child: Text(
|
||||||
Utils.timestampToString(context, order.createdAt!, withTime: true),
|
Utils.timestampToString(context, order!.createdAt!, withTime: true),
|
||||||
style: TextStyle(
|
style: TextStyle(
|
||||||
color: Colors.black38,
|
color: Colors.black38,
|
||||||
),
|
),
|
||||||
@@ -862,7 +862,7 @@ class DesktopOrderDetailState extends State<DesktopOrderDetail> {
|
|||||||
),
|
),
|
||||||
),
|
),
|
||||||
Text(
|
Text(
|
||||||
Utils.getOrderStatus(context, order.status!),
|
Utils.getOrderStatus(context, order!.status!),
|
||||||
maxLines: 1,
|
maxLines: 1,
|
||||||
overflow: TextOverflow.ellipsis,
|
overflow: TextOverflow.ellipsis,
|
||||||
style: TextStyle(
|
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(
|
col.children.add(Container(
|
||||||
padding: EdgeInsets.only(top: 10.0, bottom: 10.0),
|
padding: EdgeInsets.only(top: 10.0, bottom: 10.0),
|
||||||
width: double.infinity,
|
width: double.infinity,
|
||||||
@@ -963,13 +963,13 @@ class DesktopOrderDetailState extends State<DesktopOrderDetail> {
|
|||||||
back: true,
|
back: true,
|
||||||
breadCrumbs: [
|
breadCrumbs: [
|
||||||
BreadCrumb(S.of(context).order_detail, null),
|
BreadCrumb(S.of(context).order_detail, null),
|
||||||
BreadCrumb('#${order.orderNum}', null)
|
BreadCrumb('#${order!.orderNum}', null)
|
||||||
],
|
],
|
||||||
breadCrumbHeight: Constants.BREADCRUMB_HEIGHT,
|
breadCrumbHeight: Constants.BREADCRUMB_HEIGHT,
|
||||||
),
|
),
|
||||||
body: WillPopScope(
|
body: WillPopScope(
|
||||||
onWillPop: () async {
|
onWillPop: () async {
|
||||||
if (widget.fromOrders != null && widget.fromOrders) {
|
if (widget.fromOrders == true) {
|
||||||
return true;
|
return true;
|
||||||
} else {
|
} else {
|
||||||
Routes.router.navigateTo(
|
Routes.router.navigateTo(
|
||||||
@@ -1000,7 +1000,7 @@ class DesktopOrderDetailState extends State<DesktopOrderDetail> {
|
|||||||
children: <Widget>[
|
children: <Widget>[
|
||||||
Container(
|
Container(
|
||||||
padding: EdgeInsets.only(right: 10.0),
|
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(
|
TextButton(
|
||||||
child: Text(
|
child: Text(
|
||||||
S.of(context).cancel_order,
|
S.of(context).cancel_order,
|
||||||
@@ -1015,7 +1015,7 @@ class DesktopOrderDetailState extends State<DesktopOrderDetail> {
|
|||||||
) : SizedBox.shrink(),
|
) : SizedBox.shrink(),
|
||||||
),
|
),
|
||||||
Container(
|
Container(
|
||||||
child: order.status == Constants.STATUS_COMPLETE && !order.hasComment ? ElevatedButton(
|
child: order!.status == Constants.STATUS_COMPLETE && order!.hasComment != true ? ElevatedButton(
|
||||||
child: Text(
|
child: Text(
|
||||||
S.of(context).comment,
|
S.of(context).comment,
|
||||||
style: TextStyle(
|
style: TextStyle(
|
||||||
@@ -1023,16 +1023,16 @@ class DesktopOrderDetailState extends State<DesktopOrderDetail> {
|
|||||||
),
|
),
|
||||||
),
|
),
|
||||||
onPressed: () {
|
onPressed: () {
|
||||||
Routes.router.navigateTo(context, '/new-comment/${order.id}');
|
Routes.router.navigateTo(context, '/new-comment/${order!.id}');
|
||||||
},
|
},
|
||||||
) : SizedBox.shrink(),
|
) : SizedBox.shrink(),
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
Container(
|
Container(
|
||||||
child: order.paymentStatus != Constants.PAYMENT_STATUS_PAID
|
child: order!.paymentStatus != Constants.PAYMENT_STATUS_PAID
|
||||||
&& order.status != Constants.STATUS_CANCELLED
|
&& order!.status != Constants.STATUS_CANCELLED
|
||||||
&& order.status != Constants.STATUS_COMPLETE ?
|
&& order!.status != Constants.STATUS_COMPLETE ?
|
||||||
TextButton(
|
TextButton(
|
||||||
child: Text(
|
child: Text(
|
||||||
S.of(context).pay_now,
|
S.of(context).pay_now,
|
||||||
@@ -1042,7 +1042,7 @@ class DesktopOrderDetailState extends State<DesktopOrderDetail> {
|
|||||||
),
|
),
|
||||||
),
|
),
|
||||||
onPressed: () {
|
onPressed: () {
|
||||||
Routes.router.navigateTo(context, '/paynow/${order.id}');
|
Routes.router.navigateTo(context, '/paynow/${order!.id}');
|
||||||
},
|
},
|
||||||
) : TextButton(
|
) : TextButton(
|
||||||
child: Text(
|
child: Text(
|
||||||
@@ -1053,7 +1053,7 @@ class DesktopOrderDetailState extends State<DesktopOrderDetail> {
|
|||||||
),
|
),
|
||||||
),
|
),
|
||||||
onPressed: () {
|
onPressed: () {
|
||||||
Utils.orderAgain(context, order.cartInfo!);
|
Utils.orderAgain(context, order!.cartInfo!);
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
@@ -1091,13 +1091,13 @@ class DesktopOrderDetailState extends State<DesktopOrderDetail> {
|
|||||||
order = Order.fromJson(data);
|
order = Order.fromJson(data);
|
||||||
|
|
||||||
if (!kIsWeb) {
|
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) {
|
||||||
storeLatLng = LatLng(double.parse(order.businessInfo!.address!.lat!),
|
storeLatLng = LatLng(double.parse(order!.businessInfo!.address!.lat!),
|
||||||
double.parse(order.businessInfo!.address!.lng!));
|
double.parse(order!.businessInfo!.address!.lng!));
|
||||||
customerLatLng = LatLng(double.parse(order.shippingAddress!.lat!),
|
customerLatLng = LatLng(double.parse(order!.shippingAddress!.lat!),
|
||||||
double.parse(order.shippingAddress!.lng!));
|
double.parse(order!.shippingAddress!.lng!));
|
||||||
deliveryLatLng =
|
deliveryLatLng =
|
||||||
LatLng(order.shipperPosition!.lat!, order.shipperPosition!.lng!);
|
LatLng(order!.shipperPosition!.lat!, order!.shipperPosition!.lng!);
|
||||||
|
|
||||||
_polyLine.clear();
|
_polyLine.clear();
|
||||||
_polyLine.add(
|
_polyLine.add(
|
||||||
@@ -1110,7 +1110,7 @@ class DesktopOrderDetailState extends State<DesktopOrderDetail> {
|
|||||||
],
|
],
|
||||||
width: 3,
|
width: 3,
|
||||||
points: [
|
points: [
|
||||||
order.shipperPosition!.lat != 0.0 ? deliveryLatLng : storeLatLng,
|
order!.shipperPosition!.lat != 0.0 ? deliveryLatLng : storeLatLng,
|
||||||
customerLatLng,
|
customerLatLng,
|
||||||
]
|
]
|
||||||
)
|
)
|
||||||
@@ -1135,12 +1135,12 @@ class DesktopOrderDetailState extends State<DesktopOrderDetail> {
|
|||||||
title: S
|
title: S
|
||||||
.of(context)
|
.of(context)
|
||||||
.customer,
|
.customer,
|
||||||
snippet: order.shippingAddress!.addressLine1,
|
snippet: order!.shippingAddress!.addressLine1,
|
||||||
),
|
),
|
||||||
icon: homeIcon,
|
icon: homeIcon,
|
||||||
));
|
));
|
||||||
if (order.shipperPosition!.lat != 0.0 &&
|
if (order!.shipperPosition!.lat != 0.0 &&
|
||||||
order.shipperPosition!.lng != 0.0) {
|
order!.shipperPosition!.lng != 0.0) {
|
||||||
_markers.add(Marker(
|
_markers.add(Marker(
|
||||||
markerId: MarkerId('shipper_position'),
|
markerId: MarkerId('shipper_position'),
|
||||||
position: deliveryLatLng,
|
position: deliveryLatLng,
|
||||||
|
|||||||
@@ -29,7 +29,7 @@ class ShopProductsState extends State<ShopProducts> {
|
|||||||
dynamic data;
|
dynamic data;
|
||||||
|
|
||||||
static const num _categoryHeight = 50.0;
|
static const num _categoryHeight = 50.0;
|
||||||
static const num _categoryDescHeight = 50.0;
|
static const double _categoryDescHeight = 50.0;
|
||||||
static const num _productHeight = 266.0;
|
static const num _productHeight = 266.0;
|
||||||
|
|
||||||
bool displayProductByCategoryClick = false;
|
bool displayProductByCategoryClick = false;
|
||||||
@@ -114,7 +114,7 @@ class ShopProductsState extends State<ShopProducts> {
|
|||||||
itemBuilder: (BuildContext context, int i) {
|
itemBuilder: (BuildContext context, int i) {
|
||||||
CategoryProducts cp = _categoryProducts[i];
|
CategoryProducts cp = _categoryProducts[i];
|
||||||
int qtyInCategory = 0;
|
int qtyInCategory = 0;
|
||||||
CartInfo cartInfo = Utils.getCartInfoByBusiness(store.state.cartInfos, _business);
|
CartInfo cartInfo = Utils.getCartInfoByBusiness(store.state.cartInfos, _business)!;
|
||||||
if (cartInfo != null &&
|
if (cartInfo != null &&
|
||||||
cartInfo.businessInfo!.id == _business.id &&
|
cartInfo.businessInfo!.id == _business.id &&
|
||||||
cartInfo.productList != null) {
|
cartInfo.productList != null) {
|
||||||
@@ -207,7 +207,7 @@ class ShopProductsState extends State<ShopProducts> {
|
|||||||
CategoryProducts cp = _categoryProducts[i];
|
CategoryProducts cp = _categoryProducts[i];
|
||||||
if (cp.products!.length > 0) {
|
if (cp.products!.length > 0) {
|
||||||
col.children.add(new Container(
|
col.children.add(new Container(
|
||||||
height: _categoryDescHeight!,
|
height: _categoryDescHeight,
|
||||||
padding: new EdgeInsets.symmetric(horizontal: 10.0),
|
padding: new EdgeInsets.symmetric(horizontal: 10.0),
|
||||||
color: new Color(0xFFF5F5F5),
|
color: new Color(0xFFF5F5F5),
|
||||||
child: new Row(
|
child: new Row(
|
||||||
@@ -386,7 +386,7 @@ class ShopProductsState extends State<ShopProducts> {
|
|||||||
.pull_up_to_load_more;
|
.pull_up_to_load_more;
|
||||||
}
|
}
|
||||||
CategoryProducts currentCp =
|
CategoryProducts currentCp =
|
||||||
getCategoryProductByCategoryId(categoryId);
|
getCategoryProductByCategoryId(categoryId)!;
|
||||||
if (currentCp != null) {
|
if (currentCp != null) {
|
||||||
currentCp.products!.addAll(moreCategoryProducts[0].products!);
|
currentCp.products!.addAll(moreCategoryProducts[0].products!);
|
||||||
} else {
|
} else {
|
||||||
@@ -410,7 +410,7 @@ class ShopProductsState extends State<ShopProducts> {
|
|||||||
return num;
|
return num;
|
||||||
}
|
}
|
||||||
|
|
||||||
CategoryProducts getCategoryProductByCategoryId(int cid) {
|
CategoryProducts? getCategoryProductByCategoryId(int cid) {
|
||||||
for (CategoryProducts cp in _categoryProducts) {
|
for (CategoryProducts cp in _categoryProducts) {
|
||||||
if (cp.id == cid) {
|
if (cp.id == cid) {
|
||||||
return cp;
|
return cp;
|
||||||
|
|||||||
@@ -21,7 +21,7 @@ class AnimationPointManager {
|
|||||||
Offset endAdjustOffset = Offset.zero,
|
Offset endAdjustOffset = Offset.zero,
|
||||||
}) async {
|
}) async {
|
||||||
controller1 = createController(vsync, duration);
|
controller1 = createController(vsync, duration);
|
||||||
Animation animation = createAnimation(controller1);
|
Animation<double> animation = createAnimation(controller1);
|
||||||
|
|
||||||
AnimatedWidget animatedWidget = ParabolicAnimationWidget(
|
AnimatedWidget animatedWidget = ParabolicAnimationWidget(
|
||||||
animation: animation!,
|
animation: animation!,
|
||||||
@@ -34,7 +34,7 @@ class AnimationPointManager {
|
|||||||
endAdjustOffset: endAdjustOffset,
|
endAdjustOffset: endAdjustOffset,
|
||||||
);
|
);
|
||||||
list.add(animatedWidget);
|
list.add(animatedWidget);
|
||||||
statusListener(AnimationStatus.dismissed);
|
statusListener?.call(AnimationStatus.dismissed);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
await controller1.forward().orCancel;
|
await controller1.forward().orCancel;
|
||||||
@@ -47,7 +47,7 @@ class AnimationPointManager {
|
|||||||
print('Error: $error');
|
print('Error: $error');
|
||||||
}
|
}
|
||||||
|
|
||||||
statusListener(AnimationStatus.completed);
|
statusListener?.call(AnimationStatus.completed);
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<void> addPopupAniamtion({
|
Future<void> addPopupAniamtion({
|
||||||
@@ -69,7 +69,7 @@ class AnimationPointManager {
|
|||||||
popupOffset: popupOffset,
|
popupOffset: popupOffset,
|
||||||
);
|
);
|
||||||
list.add(animatedWidget);
|
list.add(animatedWidget);
|
||||||
statusListener(AnimationStatus.dismissed);
|
statusListener?.call(AnimationStatus.dismissed);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
await controller2.forward().orCancel;
|
await controller2.forward().orCancel;
|
||||||
@@ -83,7 +83,7 @@ class AnimationPointManager {
|
|||||||
print('Error: $error');
|
print('Error: $error');
|
||||||
}
|
}
|
||||||
|
|
||||||
statusListener(AnimationStatus.completed);
|
statusListener?.call(AnimationStatus.completed);
|
||||||
}
|
}
|
||||||
|
|
||||||
static AnimationController createController(
|
static AnimationController createController(
|
||||||
|
|||||||
@@ -29,7 +29,7 @@ class ParabolicAnimationWidget extends AnimatedWidget {
|
|||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
_calPoints();
|
_calPoints();
|
||||||
|
|
||||||
final Animation<double> animation = listenable!;
|
final Animation<double> animation = listenable! as Animation<double>;
|
||||||
final double time = animation.value;
|
final double time = animation.value;
|
||||||
|
|
||||||
// 设time=1 已知两点坐标 和 初速度 可求出 加速度 a
|
// 设time=1 已知两点坐标 和 初速度 可求出 加速度 a
|
||||||
@@ -66,17 +66,17 @@ class ParabolicAnimationWidget extends AnimatedWidget {
|
|||||||
|
|
||||||
void _calPoints() {
|
void _calPoints() {
|
||||||
if (_startOffset == null) {
|
if (_startOffset == null) {
|
||||||
RenderBox stackBox = stackKey.currentContext!.findRenderObject()!;
|
RenderBox stackBox = stackKey.currentContext!.findRenderObject()! as RenderBox;
|
||||||
Offset stackBoxOffset = stackBox.globalToLocal(Offset.zero);
|
Offset stackBoxOffset = stackBox.globalToLocal(Offset.zero);
|
||||||
|
|
||||||
EdgeInsets startMargin = _margin(startKey);
|
EdgeInsets startMargin = _margin(startKey);
|
||||||
RenderBox startBox = startKey.currentContext!.findRenderObject()!;
|
RenderBox startBox = startKey.currentContext!.findRenderObject()! as RenderBox;
|
||||||
_startOffset = startBox.localToGlobal(Offset(
|
_startOffset = startBox.localToGlobal(Offset(
|
||||||
startMargin.left + startAdjustOffset.dx,
|
startMargin.left + startAdjustOffset.dx,
|
||||||
stackBoxOffset.dy + startMargin.top + startAdjustOffset.dy));
|
stackBoxOffset.dy + startMargin.top + startAdjustOffset.dy));
|
||||||
|
|
||||||
EdgeInsets endMargin = _margin(endKey);
|
EdgeInsets endMargin = _margin(endKey);
|
||||||
RenderBox endBox = endKey.currentContext!.findRenderObject()!;
|
RenderBox endBox = endKey.currentContext!.findRenderObject()! as RenderBox;
|
||||||
_endOffset = endBox.localToGlobal(Offset(
|
_endOffset = endBox.localToGlobal(Offset(
|
||||||
endMargin.left + endAdjustOffset.dx,
|
endMargin.left + endAdjustOffset.dx,
|
||||||
stackBoxOffset.dy + endMargin.top + endAdjustOffset.dy));
|
stackBoxOffset.dy + endMargin.top + endAdjustOffset.dy));
|
||||||
@@ -85,7 +85,7 @@ class ParabolicAnimationWidget extends AnimatedWidget {
|
|||||||
|
|
||||||
EdgeInsets _margin(GlobalKey key) {
|
EdgeInsets _margin(GlobalKey key) {
|
||||||
final Widget widget = key.currentContext!.widget;
|
final Widget widget = key.currentContext!.widget;
|
||||||
EdgeInsets margin = (widget is Container) ? widget.margin : EdgeInsets.zero;
|
EdgeInsets margin = (widget is Container) ? (widget.margin ?? EdgeInsets.zero) : EdgeInsets.zero;
|
||||||
return margin ?? EdgeInsets.zero;
|
return margin ?? EdgeInsets.zero;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -228,11 +228,11 @@ class _SlidingUpPanelState extends State<SlidingUpPanel> with SingleTickerProvid
|
|||||||
duration: const Duration(milliseconds: 300),
|
duration: const Duration(milliseconds: 300),
|
||||||
value: widget.defaultPanelState == PanelState.CLOSED ? 0.0 : 1.0 //set the default panel state (i.e. set initial value of _ac)
|
value: widget.defaultPanelState == PanelState.CLOSED ? 0.0 : 1.0 //set the default panel state (i.e. set initial value of _ac)
|
||||||
)..addListener((){
|
)..addListener((){
|
||||||
if(widget.onPanelSlide != null) widget.onPanelSlide(_ac.value);
|
if(widget.onPanelSlide != null) widget.onPanelSlide?.call(_ac.value);
|
||||||
|
|
||||||
if(widget.onPanelOpened != null && _ac.value == 1.0) widget.onPanelOpened();
|
if(widget.onPanelOpened != null && _ac.value == 1.0) widget.onPanelOpened?.call();
|
||||||
|
|
||||||
if(widget.onPanelClosed != null && _ac.value == 0.0) widget.onPanelClosed();
|
if(widget.onPanelClosed != null && _ac.value == 0.0) widget.onPanelClosed?.call();
|
||||||
});
|
});
|
||||||
|
|
||||||
// prevent the panel content from being scrolled only if the widget is
|
// prevent the panel content from being scrolled only if the widget is
|
||||||
@@ -326,7 +326,7 @@ class _SlidingUpPanelState extends State<SlidingUpPanel> with SingleTickerProvid
|
|||||||
height: widget.maxHeight,
|
height: widget.maxHeight,
|
||||||
child: widget.panel != null
|
child: widget.panel != null
|
||||||
? widget.panel
|
? widget.panel
|
||||||
: widget.panelBuilder(_sc),
|
: widget.panelBuilder!(_sc),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
|
||||||
@@ -391,7 +391,7 @@ class _SlidingUpPanelState extends State<SlidingUpPanel> with SingleTickerProvid
|
|||||||
// this is because the listener is designed only for use with linking the scrolling of
|
// this is because the listener is designed only for use with linking the scrolling of
|
||||||
// panels and using it for panels that don't want to linked scrolling yields odd results
|
// panels and using it for panels that don't want to linked scrolling yields odd results
|
||||||
Widget _gestureHandler({Widget? child}){
|
Widget _gestureHandler({Widget? child}){
|
||||||
if (!widget.isDraggable) return child;
|
if (!widget.isDraggable) return child!;
|
||||||
|
|
||||||
if (widget.panel != null){
|
if (widget.panel != null){
|
||||||
return GestureDetector(
|
return GestureDetector(
|
||||||
|
|||||||
@@ -119,13 +119,13 @@ class MobileAttributeSelectionState extends State<MobileAttributeSelection> {
|
|||||||
});
|
});
|
||||||
|
|
||||||
ProductAttribute pa = product.productAttributes![index];
|
ProductAttribute pa = product.productAttributes![index];
|
||||||
if (pa.required && Utils.selectionsNotEmptyAt(selections, pa.name!)) {
|
if (pa.required == true && Utils.selectionsNotEmptyAt(selections, pa.name!)) {
|
||||||
setState(() {
|
setState(() {
|
||||||
nextButtonEnable = true;
|
nextButtonEnable = true;
|
||||||
productDesc = product.description! + ', ' + extendDescription.join('; ');
|
productDesc = product.description! + ', ' + extendDescription.join('; ');
|
||||||
productPrice = product.price! + extendPrice;
|
productPrice = product.price! + extendPrice;
|
||||||
});
|
});
|
||||||
} else if (!pa.required){
|
} else if (pa.required != true){
|
||||||
setState(() {
|
setState(() {
|
||||||
nextButtonEnable = true;
|
nextButtonEnable = true;
|
||||||
productDesc = product.description! + ', ' + extendDescription.join('; ');
|
productDesc = product.description! + ', ' + extendDescription.join('; ');
|
||||||
@@ -143,9 +143,9 @@ class MobileAttributeSelectionState extends State<MobileAttributeSelection> {
|
|||||||
|
|
||||||
bool _checkCanGoNext() {
|
bool _checkCanGoNext() {
|
||||||
ProductAttribute pa = product.productAttributes![index];
|
ProductAttribute pa = product.productAttributes![index];
|
||||||
if (pa.required && Utils.selectionsNotEmptyAt(selections, pa.name!)) {
|
if (pa.required == true && Utils.selectionsNotEmptyAt(selections, pa.name!)) {
|
||||||
return true;
|
return true;
|
||||||
} else if (!pa.required){
|
} else if (pa.required != true){
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
|
|||||||
@@ -110,7 +110,7 @@ class MobileEditAddressState extends State<MobileEditAddress> {
|
|||||||
.contact_name,
|
.contact_name,
|
||||||
),
|
),
|
||||||
validator: (String? value) {
|
validator: (String? value) {
|
||||||
if (value
|
if (value!
|
||||||
.trim()
|
.trim()
|
||||||
.isEmpty) {
|
.isEmpty) {
|
||||||
return S
|
return S
|
||||||
@@ -165,7 +165,7 @@ class MobileEditAddressState extends State<MobileEditAddress> {
|
|||||||
.mobile_phone_number,
|
.mobile_phone_number,
|
||||||
),
|
),
|
||||||
validator: (String? value) {
|
validator: (String? value) {
|
||||||
if (value
|
if (value!
|
||||||
.trim()
|
.trim()
|
||||||
.isEmpty) {
|
.isEmpty) {
|
||||||
return S
|
return S
|
||||||
@@ -197,7 +197,7 @@ class MobileEditAddressState extends State<MobileEditAddress> {
|
|||||||
.street_line_1,
|
.street_line_1,
|
||||||
),
|
),
|
||||||
validator: (String? value) {
|
validator: (String? value) {
|
||||||
if (value
|
if (value!
|
||||||
.trim()
|
.trim()
|
||||||
.isEmpty) {
|
.isEmpty) {
|
||||||
return S
|
return S
|
||||||
@@ -251,7 +251,7 @@ class MobileEditAddressState extends State<MobileEditAddress> {
|
|||||||
.city,
|
.city,
|
||||||
),
|
),
|
||||||
validator: (String? value) {
|
validator: (String? value) {
|
||||||
if (value
|
if (value!
|
||||||
.trim()
|
.trim()
|
||||||
.isEmpty) {
|
.isEmpty) {
|
||||||
return S
|
return S
|
||||||
@@ -321,7 +321,7 @@ class MobileEditAddressState extends State<MobileEditAddress> {
|
|||||||
.postal_code,
|
.postal_code,
|
||||||
),
|
),
|
||||||
validator: (String? value) {
|
validator: (String? value) {
|
||||||
if (value
|
if (value!
|
||||||
.trim()
|
.trim()
|
||||||
.isEmpty) {
|
.isEmpty) {
|
||||||
return S
|
return S
|
||||||
|
|||||||
@@ -37,7 +37,7 @@ class MobileOrderDetail extends StatefulWidget {
|
|||||||
}
|
}
|
||||||
|
|
||||||
class MobileOrderDetailState extends State<MobileOrderDetail> {
|
class MobileOrderDetailState extends State<MobileOrderDetail> {
|
||||||
late Order order;
|
Order? order;
|
||||||
|
|
||||||
late LatLng _lastMapPosition;
|
late LatLng _lastMapPosition;
|
||||||
late LatLng customerLatLng;
|
late LatLng customerLatLng;
|
||||||
@@ -80,7 +80,7 @@ class MobileOrderDetailState extends State<MobileOrderDetail> {
|
|||||||
leading: IconButton(
|
leading: IconButton(
|
||||||
icon: Icon(Icons.arrow_back_ios),
|
icon: Icon(Icons.arrow_back_ios),
|
||||||
onPressed: (){
|
onPressed: (){
|
||||||
if (widget.fromOrders != null && widget.fromOrders) {
|
if (widget.fromOrders == true) {
|
||||||
Navigator.of(context).pop();
|
Navigator.of(context).pop();
|
||||||
} else {
|
} else {
|
||||||
Routes.router.navigateTo(
|
Routes.router.navigateTo(
|
||||||
@@ -93,7 +93,7 @@ class MobileOrderDetailState extends State<MobileOrderDetail> {
|
|||||||
),
|
),
|
||||||
body: WillPopScope(
|
body: WillPopScope(
|
||||||
onWillPop: () async {
|
onWillPop: () async {
|
||||||
if (widget.fromOrders != null && widget.fromOrders) {
|
if (widget.fromOrders == true) {
|
||||||
return true;
|
return true;
|
||||||
} else {
|
} else {
|
||||||
Routes.router.navigateTo(
|
Routes.router.navigateTo(
|
||||||
@@ -123,7 +123,7 @@ class MobileOrderDetailState extends State<MobileOrderDetail> {
|
|||||||
width: double.infinity,
|
width: double.infinity,
|
||||||
padding: EdgeInsets.only(top: 0.0, bottom: 16.0),
|
padding: EdgeInsets.only(top: 0.0, bottom: 16.0),
|
||||||
child: Text(
|
child: Text(
|
||||||
order.cartInfo!.businessInfo!.name!,
|
order!.cartInfo!.businessInfo!.name!,
|
||||||
maxLines: 1,
|
maxLines: 1,
|
||||||
overflow: TextOverflow.ellipsis,
|
overflow: TextOverflow.ellipsis,
|
||||||
style: TextStyle(
|
style: TextStyle(
|
||||||
@@ -142,7 +142,7 @@ class MobileOrderDetailState extends State<MobileOrderDetail> {
|
|||||||
),
|
),
|
||||||
),
|
),
|
||||||
onTap: () {
|
onTap: () {
|
||||||
Routes.router.navigateTo(context, '/shop/${order.businessId}/na/na/na');
|
Routes.router.navigateTo(context, '/shop/${order!.businessId}/na/na/na');
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
@@ -154,7 +154,7 @@ class MobileOrderDetailState extends State<MobileOrderDetail> {
|
|||||||
Icons.phone,
|
Icons.phone,
|
||||||
),
|
),
|
||||||
onTap: () {
|
onTap: () {
|
||||||
Utils.launchURL('tel:${order.businessInfo!.phone}');
|
Utils.launchURL('tel:${order!.businessInfo!.phone}');
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
@@ -163,15 +163,15 @@ class MobileOrderDetailState extends State<MobileOrderDetail> {
|
|||||||
);
|
);
|
||||||
|
|
||||||
if (!kIsWeb) {
|
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(
|
col.children.add(Container(
|
||||||
height: 200.0,
|
height: 200.0,
|
||||||
child: GoogleMap(
|
child: GoogleMap(
|
||||||
onMapCreated: _onMapCreated,
|
onMapCreated: _onMapCreated,
|
||||||
initialCameraPosition: CameraPosition(
|
initialCameraPosition: CameraPosition(
|
||||||
target: LatLng(
|
target: LatLng(
|
||||||
double.parse(order.shippingAddress!.lat!),
|
double.parse(order!.shippingAddress!.lat!),
|
||||||
double.parse(order.shippingAddress!.lng!)),
|
double.parse(order!.shippingAddress!.lng!)),
|
||||||
zoom: 11.0,
|
zoom: 11.0,
|
||||||
),
|
),
|
||||||
onCameraMove: _onCameraMove,
|
onCameraMove: _onCameraMove,
|
||||||
@@ -182,14 +182,14 @@ class MobileOrderDetailState extends State<MobileOrderDetail> {
|
|||||||
].toSet(),
|
].toSet(),
|
||||||
),
|
),
|
||||||
));
|
));
|
||||||
if (order.deliveryDistance != null && order.deliveryDistance!.distance != null) {
|
if (order!.deliveryDistance != null && order!.deliveryDistance!.distance != null) {
|
||||||
col.children.add(Container(
|
col.children.add(Container(
|
||||||
padding: EdgeInsets.only(top: 6.0, bottom: 6.0),
|
padding: EdgeInsets.only(top: 6.0, bottom: 6.0),
|
||||||
margin: EdgeInsets.only(bottom: 6.0),
|
margin: EdgeInsets.only(bottom: 6.0),
|
||||||
child: Text(
|
child: Text(
|
||||||
S.of(context).delivery_distance_token(
|
S.of(context).delivery_distance_token(
|
||||||
order.deliveryDistance!.distance!.text!,
|
order!.deliveryDistance!.distance!.text!,
|
||||||
order.deliveryDistance!.duration!.text!
|
order!.deliveryDistance!.duration!.text!
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
decoration: BoxDecoration(
|
decoration: BoxDecoration(
|
||||||
@@ -205,7 +205,7 @@ class MobileOrderDetailState extends State<MobileOrderDetail> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for (CartLineItem lineItem in order.cartInfo!.productList!) {
|
for (CartLineItem lineItem in order!.cartInfo!.productList!) {
|
||||||
|
|
||||||
col.children.add(Container(
|
col.children.add(Container(
|
||||||
padding: EdgeInsets.only(top: 16.0, bottom: 0.0),
|
padding: EdgeInsets.only(top: 16.0, bottom: 0.0),
|
||||||
@@ -304,7 +304,7 @@ class MobileOrderDetailState extends State<MobileOrderDetail> {
|
|||||||
width: 100.0,
|
width: 100.0,
|
||||||
alignment: Alignment.centerRight,
|
alignment: Alignment.centerRight,
|
||||||
child: Text(
|
child: Text(
|
||||||
'${order.getSubtotal().toStringAsFixed(2)}',
|
'${order!.getSubtotal().toStringAsFixed(2)}',
|
||||||
style: TextStyle(
|
style: TextStyle(
|
||||||
fontSize: 15.0,
|
fontSize: 15.0,
|
||||||
),
|
),
|
||||||
@@ -313,8 +313,8 @@ class MobileOrderDetailState extends State<MobileOrderDetail> {
|
|||||||
],
|
],
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
for (var i = 0; i < order.cartInfo!.extraFeeList!.length; i++) {
|
for (var i = 0; i < order!.cartInfo!.extraFeeList!.length; i++) {
|
||||||
ExtraFee extraFee = order.cartInfo!.extraFeeList![i];
|
ExtraFee extraFee = order!.cartInfo!.extraFeeList![i];
|
||||||
col.children.add(
|
col.children.add(
|
||||||
Row(
|
Row(
|
||||||
mainAxisAlignment: MainAxisAlignment.start,
|
mainAxisAlignment: MainAxisAlignment.start,
|
||||||
@@ -371,7 +371,7 @@ class MobileOrderDetailState extends State<MobileOrderDetail> {
|
|||||||
width: 100.0,
|
width: 100.0,
|
||||||
alignment: Alignment.centerRight,
|
alignment: Alignment.centerRight,
|
||||||
child: Text(
|
child: Text(
|
||||||
'${order.totalPrice!.toStringAsFixed(2)}',
|
'${order!.totalPrice!.toStringAsFixed(2)}',
|
||||||
style: TextStyle(
|
style: TextStyle(
|
||||||
fontSize: 18.0,
|
fontSize: 18.0,
|
||||||
fontWeight: FontWeight.bold,
|
fontWeight: FontWeight.bold,
|
||||||
@@ -424,7 +424,7 @@ class MobileOrderDetailState extends State<MobileOrderDetail> {
|
|||||||
),
|
),
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
if (order.shippingMethod != 'pickup') {
|
if (order!.shippingMethod != 'pickup') {
|
||||||
col.children.add(Container(
|
col.children.add(Container(
|
||||||
child: Row(
|
child: Row(
|
||||||
mainAxisAlignment: MainAxisAlignment.start,
|
mainAxisAlignment: MainAxisAlignment.start,
|
||||||
@@ -443,7 +443,7 @@ class MobileOrderDetailState extends State<MobileOrderDetail> {
|
|||||||
child: Container(
|
child: Container(
|
||||||
margin: EdgeInsets.only(top: 10.0, bottom: 10.0),
|
margin: EdgeInsets.only(top: 10.0, bottom: 10.0),
|
||||||
child: Text(
|
child: Text(
|
||||||
'${order.address}, ${order.consignee}, ${order.phone}',
|
'${order!.address}, ${order!.consignee}, ${order!.phone}',
|
||||||
style: TextStyle(
|
style: TextStyle(
|
||||||
color: Colors.black38,
|
color: Colors.black38,
|
||||||
),
|
),
|
||||||
@@ -481,7 +481,7 @@ class MobileOrderDetailState extends State<MobileOrderDetail> {
|
|||||||
margin: EdgeInsets.only(top: 10.0, bottom: 10.0),
|
margin: EdgeInsets.only(top: 10.0, bottom: 10.0),
|
||||||
alignment: Alignment.centerRight,
|
alignment: Alignment.centerRight,
|
||||||
child: Text(
|
child: Text(
|
||||||
'${order.cartInfo!.businessInfo!.fullAddress}',
|
'${order!.cartInfo!.businessInfo!.fullAddress}',
|
||||||
style: TextStyle(
|
style: TextStyle(
|
||||||
color: Colors.black38,
|
color: Colors.black38,
|
||||||
),
|
),
|
||||||
@@ -520,7 +520,7 @@ class MobileOrderDetailState extends State<MobileOrderDetail> {
|
|||||||
margin: EdgeInsets.only(top: 10.0, bottom: 10.0),
|
margin: EdgeInsets.only(top: 10.0, bottom: 10.0),
|
||||||
alignment: Alignment.centerRight,
|
alignment: Alignment.centerRight,
|
||||||
child: Text(
|
child: Text(
|
||||||
'${Utils.timestampToString(context, order.bookedAt!, withTime: true)}',
|
'${Utils.timestampToString(context, order!.bookedAt!, withTime: true)}',
|
||||||
style: TextStyle(
|
style: TextStyle(
|
||||||
color: Colors.black38,
|
color: Colors.black38,
|
||||||
),
|
),
|
||||||
@@ -558,7 +558,7 @@ class MobileOrderDetailState extends State<MobileOrderDetail> {
|
|||||||
margin: EdgeInsets.only(top: 10.0, bottom: 10.0),
|
margin: EdgeInsets.only(top: 10.0, bottom: 10.0),
|
||||||
alignment: Alignment.centerRight,
|
alignment: Alignment.centerRight,
|
||||||
child: Text(
|
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(
|
style: TextStyle(
|
||||||
color: Colors.black38,
|
color: Colors.black38,
|
||||||
),
|
),
|
||||||
@@ -648,7 +648,7 @@ class MobileOrderDetailState extends State<MobileOrderDetail> {
|
|||||||
mainAxisAlignment: MainAxisAlignment.end,
|
mainAxisAlignment: MainAxisAlignment.end,
|
||||||
children: <Widget>[
|
children: <Widget>[
|
||||||
Text(
|
Text(
|
||||||
'${order.orderNum}',
|
'${order!.orderNum}',
|
||||||
style: TextStyle(
|
style: TextStyle(
|
||||||
color: Colors.black38,
|
color: Colors.black38,
|
||||||
),
|
),
|
||||||
@@ -670,7 +670,7 @@ class MobileOrderDetailState extends State<MobileOrderDetail> {
|
|||||||
S.of(context).copy,
|
S.of(context).copy,
|
||||||
),
|
),
|
||||||
onTap: () {
|
onTap: () {
|
||||||
Clipboard.setData(ClipboardData(text: '${order.orderNum}'));
|
Clipboard.setData(ClipboardData(text: '${order!.orderNum}'));
|
||||||
Fluttertoast.showToast(
|
Fluttertoast.showToast(
|
||||||
msg: S.of(context).order_number_copied_to_clipboard,
|
msg: S.of(context).order_number_copied_to_clipboard,
|
||||||
toastLength: Toast.LENGTH_SHORT,
|
toastLength: Toast.LENGTH_SHORT,
|
||||||
@@ -715,7 +715,7 @@ class MobileOrderDetailState extends State<MobileOrderDetail> {
|
|||||||
margin: EdgeInsets.only(top: 10.0, bottom: 10.0),
|
margin: EdgeInsets.only(top: 10.0, bottom: 10.0),
|
||||||
alignment: Alignment.centerRight,
|
alignment: Alignment.centerRight,
|
||||||
child: Text(
|
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(
|
style: TextStyle(
|
||||||
color: Colors.black38,
|
color: Colors.black38,
|
||||||
),
|
),
|
||||||
@@ -756,15 +756,15 @@ class MobileOrderDetailState extends State<MobileOrderDetail> {
|
|||||||
mainAxisAlignment: MainAxisAlignment.end,
|
mainAxisAlignment: MainAxisAlignment.end,
|
||||||
children: <Widget>[
|
children: <Widget>[
|
||||||
Text(
|
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(
|
style: TextStyle(
|
||||||
color: Colors.black38,
|
color: Colors.black38,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
Container(
|
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),
|
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(),
|
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(
|
decoration: order!.paymentStatus != Constants.PAYMENT_STATUS_PAID && order!.status != Constants.STATUS_CANCELLED ? BoxDecoration(
|
||||||
border: Border(
|
border: Border(
|
||||||
left: BorderSide(
|
left: BorderSide(
|
||||||
width: 0.5,
|
width: 0.5,
|
||||||
@@ -774,16 +774,16 @@ class MobileOrderDetailState extends State<MobileOrderDetail> {
|
|||||||
) : null,
|
) : null,
|
||||||
),
|
),
|
||||||
GestureDetector(
|
GestureDetector(
|
||||||
child: order.paymentStatus != Constants.PAYMENT_STATUS_PAID
|
child: order!.paymentStatus != Constants.PAYMENT_STATUS_PAID
|
||||||
&& order.status != Constants.STATUS_CANCELLED
|
&& order!.status != Constants.STATUS_CANCELLED
|
||||||
&& order.status != Constants.STATUS_COMPLETE ? Text(
|
&& order!.status != Constants.STATUS_COMPLETE ? Text(
|
||||||
S.of(context).pay_now,
|
S.of(context).pay_now,
|
||||||
style: TextStyle(
|
style: TextStyle(
|
||||||
fontWeight: FontWeight.bold,
|
fontWeight: FontWeight.bold,
|
||||||
),
|
),
|
||||||
) : SizedBox.shrink(),
|
) : SizedBox.shrink(),
|
||||||
onTap: () {
|
onTap: () {
|
||||||
Routes.router.navigateTo(context, '/paynow/${order.id}');
|
Routes.router.navigateTo(context, '/paynow/${order!.id}');
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
@@ -821,7 +821,7 @@ class MobileOrderDetailState extends State<MobileOrderDetail> {
|
|||||||
margin: EdgeInsets.only(top: 10.0, bottom: 10.0),
|
margin: EdgeInsets.only(top: 10.0, bottom: 10.0),
|
||||||
alignment: Alignment.centerRight,
|
alignment: Alignment.centerRight,
|
||||||
child: Text(
|
child: Text(
|
||||||
Utils.timestampToString(context, order.createdAt!, withTime: true),
|
Utils.timestampToString(context, order!.createdAt!, withTime: true),
|
||||||
style: TextStyle(
|
style: TextStyle(
|
||||||
color: Colors.black38,
|
color: Colors.black38,
|
||||||
),
|
),
|
||||||
@@ -877,7 +877,7 @@ class MobileOrderDetailState extends State<MobileOrderDetail> {
|
|||||||
),
|
),
|
||||||
),
|
),
|
||||||
Text(
|
Text(
|
||||||
Utils.getOrderStatus(context, order.status!),
|
Utils.getOrderStatus(context, order!.status!),
|
||||||
maxLines: 1,
|
maxLines: 1,
|
||||||
overflow: TextOverflow.ellipsis,
|
overflow: TextOverflow.ellipsis,
|
||||||
style: TextStyle(
|
style: TextStyle(
|
||||||
@@ -899,7 +899,7 @@ class MobileOrderDetailState extends State<MobileOrderDetail> {
|
|||||||
),
|
),
|
||||||
),);
|
),);
|
||||||
|
|
||||||
for (Fulfillment fulfillment in order.fulfillments!) {
|
for (Fulfillment fulfillment in order!.fulfillments!) {
|
||||||
col.children.add(Container(
|
col.children.add(Container(
|
||||||
padding: EdgeInsets.only(top: 10.0, bottom: 10.0),
|
padding: EdgeInsets.only(top: 10.0, bottom: 10.0),
|
||||||
width: double.infinity,
|
width: double.infinity,
|
||||||
@@ -983,7 +983,7 @@ class MobileOrderDetailState extends State<MobileOrderDetail> {
|
|||||||
children: <Widget>[
|
children: <Widget>[
|
||||||
Container(
|
Container(
|
||||||
padding: EdgeInsets.only(right: 10.0),
|
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(
|
TextButton(
|
||||||
child: Text(
|
child: Text(
|
||||||
S.of(context).cancel_order,
|
S.of(context).cancel_order,
|
||||||
@@ -994,34 +994,34 @@ class MobileOrderDetailState extends State<MobileOrderDetail> {
|
|||||||
) : SizedBox.shrink(),
|
) : SizedBox.shrink(),
|
||||||
),
|
),
|
||||||
Container(
|
Container(
|
||||||
child: order.status == Constants.STATUS_COMPLETE && !order.hasComment ? ElevatedButton(
|
child: order!.status == Constants.STATUS_COMPLETE && order!.hasComment != true ? ElevatedButton(
|
||||||
child: Text(
|
child: Text(
|
||||||
S.of(context).comment,
|
S.of(context).comment,
|
||||||
),
|
),
|
||||||
onPressed: () {
|
onPressed: () {
|
||||||
Routes.router.navigateTo(context, '/new-comment/${order.id}');
|
Routes.router.navigateTo(context, '/new-comment/${order!.id}');
|
||||||
},
|
},
|
||||||
) : SizedBox.shrink(),
|
) : SizedBox.shrink(),
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
Container(
|
Container(
|
||||||
child: order.paymentStatus != Constants.PAYMENT_STATUS_PAID
|
child: order!.paymentStatus != Constants.PAYMENT_STATUS_PAID
|
||||||
&& order.status != Constants.STATUS_CANCELLED
|
&& order!.status != Constants.STATUS_CANCELLED
|
||||||
&& order.status != Constants.STATUS_COMPLETE ?
|
&& order!.status != Constants.STATUS_COMPLETE ?
|
||||||
TextButton(
|
TextButton(
|
||||||
child: Text(
|
child: Text(
|
||||||
S.of(context).pay_now,
|
S.of(context).pay_now,
|
||||||
),
|
),
|
||||||
onPressed: () {
|
onPressed: () {
|
||||||
Routes.router.navigateTo(context, '/paynow/${order.id}');
|
Routes.router.navigateTo(context, '/paynow/${order!.id}');
|
||||||
},
|
},
|
||||||
) : TextButton(
|
) : TextButton(
|
||||||
child: Text(
|
child: Text(
|
||||||
S.of(context).order_again,
|
S.of(context).order_again,
|
||||||
),
|
),
|
||||||
onPressed: () {
|
onPressed: () {
|
||||||
Utils.orderAgain(context, order.cartInfo!);
|
Utils.orderAgain(context, order!.cartInfo!);
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
@@ -1059,13 +1059,13 @@ class MobileOrderDetailState extends State<MobileOrderDetail> {
|
|||||||
order = Order.fromJson(data);
|
order = Order.fromJson(data);
|
||||||
|
|
||||||
if (!kIsWeb) {
|
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) {
|
||||||
storeLatLng = LatLng(double.parse(order.businessInfo!.address!.lat!),
|
storeLatLng = LatLng(double.parse(order!.businessInfo!.address!.lat!),
|
||||||
double.parse(order.businessInfo!.address!.lng!));
|
double.parse(order!.businessInfo!.address!.lng!));
|
||||||
customerLatLng = LatLng(double.parse(order.shippingAddress!.lat!),
|
customerLatLng = LatLng(double.parse(order!.shippingAddress!.lat!),
|
||||||
double.parse(order.shippingAddress!.lng!));
|
double.parse(order!.shippingAddress!.lng!));
|
||||||
deliveryLatLng =
|
deliveryLatLng =
|
||||||
LatLng(order.shipperPosition!.lat!, order.shipperPosition!.lng!);
|
LatLng(order!.shipperPosition!.lat!, order!.shipperPosition!.lng!);
|
||||||
|
|
||||||
_polyLine.clear();
|
_polyLine.clear();
|
||||||
_polyLine.add(
|
_polyLine.add(
|
||||||
@@ -1078,7 +1078,7 @@ class MobileOrderDetailState extends State<MobileOrderDetail> {
|
|||||||
],
|
],
|
||||||
width: 3,
|
width: 3,
|
||||||
points: [
|
points: [
|
||||||
order.shipperPosition!.lat != 0.0 ? deliveryLatLng : storeLatLng,
|
order!.shipperPosition!.lat != 0.0 ? deliveryLatLng : storeLatLng,
|
||||||
customerLatLng,
|
customerLatLng,
|
||||||
]
|
]
|
||||||
)
|
)
|
||||||
@@ -1103,12 +1103,12 @@ class MobileOrderDetailState extends State<MobileOrderDetail> {
|
|||||||
title: S
|
title: S
|
||||||
.of(context)
|
.of(context)
|
||||||
.customer,
|
.customer,
|
||||||
snippet: order.shippingAddress!.addressLine1,
|
snippet: order!.shippingAddress!.addressLine1,
|
||||||
),
|
),
|
||||||
icon: homeIcon,
|
icon: homeIcon,
|
||||||
));
|
));
|
||||||
if (order.shipperPosition!.lat != 0.0 &&
|
if (order!.shipperPosition!.lat != 0.0 &&
|
||||||
order.shipperPosition!.lng != 0.0) {
|
order!.shipperPosition!.lng != 0.0) {
|
||||||
_markers.add(Marker(
|
_markers.add(Marker(
|
||||||
markerId: MarkerId('shipper_position'),
|
markerId: MarkerId('shipper_position'),
|
||||||
position: deliveryLatLng,
|
position: deliveryLatLng,
|
||||||
|
|||||||
Reference in New Issue
Block a user