phase3: checkout files clean (nullable fields, ternary/concat/condition fixes). 142->131
This commit is contained in:
@@ -292,7 +292,7 @@ class DesktopCheckoutState extends State<DesktopCheckout> with SingleTickerProvi
|
||||
itemCount: 6,
|
||||
addAutomaticKeepAlives: true,
|
||||
itemBuilder: (BuildContext context, int position) {
|
||||
var deliveryTimeInSeconds = cartInfo!.businessInfo!.shippingTime! * 60 + (durationInTraffic != null ? durationInTraffic!.value : 0);
|
||||
var deliveryTimeInSeconds = cartInfo!.businessInfo!.shippingTime! * 60 + (durationInTraffic != null ? durationInTraffic!.value ?? 0 : 0);
|
||||
print('aaa: $deliveryTimeInSeconds');
|
||||
DateTime now = DateTime.now();
|
||||
var formatter = DateFormat('H:mm');
|
||||
@@ -494,7 +494,7 @@ class DesktopCheckoutState extends State<DesktopCheckout> with SingleTickerProvi
|
||||
children: <Widget>[
|
||||
Container(
|
||||
child: Text(
|
||||
shipAddress != null ? shipAddress!.fullAddress : S.of(context).enter_delivery_address,
|
||||
shipAddress != null ? shipAddress!.fullAddress! : S.of(context).enter_delivery_address,
|
||||
style: TextStyle(
|
||||
fontSize: 16.0
|
||||
),
|
||||
@@ -505,7 +505,7 @@ class DesktopCheckoutState extends State<DesktopCheckout> with SingleTickerProvi
|
||||
Container(
|
||||
padding: EdgeInsets.only(top: 6.0),
|
||||
child: Text(
|
||||
shipAddress != null ? shipAddress!.contactName! + ' ' + shipAddress!.phone : '',
|
||||
shipAddress != null ? shipAddress!.contactName! + ' ' + shipAddress!.phone! : '',
|
||||
style: TextStyle(
|
||||
fontSize: 14.0,
|
||||
color: Colors.black38,
|
||||
@@ -654,7 +654,7 @@ class DesktopCheckoutState extends State<DesktopCheckout> with SingleTickerProvi
|
||||
child: Text(
|
||||
bookingTimeList.length > 0 ? '${Utils.timestampToString(context, bookingTimeList[bookingTimeIndex].unixTime!)}'
|
||||
: ((bookingTimeList.length == 0 && bookingDateTimeList.length == 0) ? ''
|
||||
: bookingDateTimeList[bookingDateIndex].viewDate! + ' ' + (bookingDateTimeList[bookingDateIndex].bookTimes!.length > 0 ? bookingDateTimeList[bookingDateIndex].bookTimes![bookingTimeIndex].viewTime : '')),
|
||||
: bookingDateTimeList[bookingDateIndex].viewDate! + ' ' + (bookingDateTimeList[bookingDateIndex].bookTimes!.length > 0 ? bookingDateTimeList[bookingDateIndex].bookTimes![bookingTimeIndex].viewTime! : '')),
|
||||
),
|
||||
),
|
||||
Container(
|
||||
@@ -1075,7 +1075,7 @@ class DesktopCheckoutState extends State<DesktopCheckout> with SingleTickerProvi
|
||||
if (cartInfo != null) {
|
||||
Utils.showLoadingDialog(context);
|
||||
}
|
||||
CartInfo ci = Utils.getCartInfoByBusinessId(store.state.cartInfos, widget.businessId);
|
||||
CartInfo ci = Utils.getCartInfoByBusinessId(store.state.cartInfos, widget.businessId)!;
|
||||
HttpUtil.httpPost('v1/orders/check', (response) {
|
||||
if (cartInfo != null) {
|
||||
Navigator.of(context).pop();
|
||||
@@ -1706,7 +1706,7 @@ class DesktopCheckoutState extends State<DesktopCheckout> with SingleTickerProvi
|
||||
return GestureDetector(
|
||||
child: Container(
|
||||
decoration: selectedCoupon == 0 ? BoxDecoration(
|
||||
color: subtotal > cartInfo!.businessInfo!.minPrice ? Colors
|
||||
color: subtotal > cartInfo!.businessInfo!.minPrice! ? Colors
|
||||
.transparent : Colors.black38,
|
||||
border: Border(
|
||||
top: BorderSide(
|
||||
@@ -1727,7 +1727,7 @@ class DesktopCheckoutState extends State<DesktopCheckout> with SingleTickerProvi
|
||||
),
|
||||
),
|
||||
) : BoxDecoration(
|
||||
color: subtotal > cartInfo!.businessInfo!.minPrice ? Colors
|
||||
color: subtotal > cartInfo!.businessInfo!.minPrice! ? Colors
|
||||
.transparent : Colors.black38,
|
||||
),
|
||||
child: Row(
|
||||
@@ -1768,7 +1768,7 @@ class DesktopCheckoutState extends State<DesktopCheckout> with SingleTickerProvi
|
||||
return GestureDetector(
|
||||
child: Container(
|
||||
decoration: selectedCoupon == coupon.id ? BoxDecoration(
|
||||
color: subtotal > cartInfo!.businessInfo!.minPrice ? Colors
|
||||
color: subtotal > cartInfo!.businessInfo!.minPrice! ? Colors
|
||||
.transparent : Colors.black38,
|
||||
border: Border(
|
||||
top: BorderSide(
|
||||
@@ -1789,7 +1789,7 @@ class DesktopCheckoutState extends State<DesktopCheckout> with SingleTickerProvi
|
||||
),
|
||||
),
|
||||
) : BoxDecoration(
|
||||
color: subtotal > coupon.minAmount ? Colors
|
||||
color: subtotal > coupon.minAmount! ? Colors
|
||||
.transparent : Colors.black26,
|
||||
),
|
||||
child: Row(
|
||||
@@ -1799,7 +1799,7 @@ class DesktopCheckoutState extends State<DesktopCheckout> with SingleTickerProvi
|
||||
Container(
|
||||
padding: EdgeInsets.only(
|
||||
left: 16.0, top: 16.0, right: 16.0, bottom: 16.0),
|
||||
child: coupon.isPercentage ?
|
||||
child: coupon.isPercentage == true ?
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
@@ -1910,12 +1910,12 @@ class DesktopCheckoutState extends State<DesktopCheckout> with SingleTickerProvi
|
||||
),
|
||||
),
|
||||
onTap: () {
|
||||
if (subtotal > coupon.minAmount &&
|
||||
if (subtotal > coupon.minAmount! &&
|
||||
mounted) {
|
||||
setState(() {
|
||||
selectedCoupon = coupon.id;
|
||||
if (coupon.isPercentage == true) {
|
||||
couponDiscountAmount = subtotal * coupon.valueAmount / 100.0;
|
||||
couponDiscountAmount = subtotal * coupon.valueAmount! / 100.0;
|
||||
} else {
|
||||
couponDiscountAmount = coupon.valueAmount!;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user