phase3(wip): desktop_checkout field null-safety + build local-shadow
This commit is contained in:
@@ -47,17 +47,17 @@ class DesktopCheckout extends StatefulWidget {
|
|||||||
}
|
}
|
||||||
|
|
||||||
class DesktopCheckoutState extends State<DesktopCheckout> with SingleTickerProviderStateMixin, AutomaticKeepAliveClientMixin {
|
class DesktopCheckoutState extends State<DesktopCheckout> with SingleTickerProviderStateMixin, AutomaticKeepAliveClientMixin {
|
||||||
CartInfo cartInfo;
|
CartInfo? cartInfo;
|
||||||
Address shipAddress;
|
Address? shipAddress;
|
||||||
bool canSubmit;
|
bool canSubmit = false;
|
||||||
List<ErrorMessage> errorMessages;
|
List<ErrorMessage> errorMessages = [];
|
||||||
List<BookingTime> bookingTimeList;
|
List<BookingTime> bookingTimeList = [];
|
||||||
List<BookingDateTime> bookingDateTimeList;
|
List<BookingDateTime> bookingDateTimeList = [];
|
||||||
List<PaymentPlatform> paymentPlatforms;
|
List<PaymentPlatform> paymentPlatforms = [];
|
||||||
TextValue durationInTraffic;
|
TextValue? durationInTraffic;
|
||||||
int selectedCoupon;
|
int? selectedCoupon;
|
||||||
double couponDiscountAmount = 0;
|
double couponDiscountAmount = 0;
|
||||||
List<Coupon> coupons;
|
List<Coupon>? coupons;
|
||||||
|
|
||||||
int peopleCount = 2;
|
int peopleCount = 2;
|
||||||
|
|
||||||
@@ -65,25 +65,25 @@ class DesktopCheckoutState extends State<DesktopCheckout> with SingleTickerProvi
|
|||||||
String orderRemark = '';
|
String orderRemark = '';
|
||||||
|
|
||||||
int deliveryMethodIndex = 0;
|
int deliveryMethodIndex = 0;
|
||||||
String deliveryMethod;
|
String? deliveryMethod;
|
||||||
List<ShippingRate> shippingRates = [];
|
List<ShippingRate> shippingRates = [];
|
||||||
ShippingRate selectedShippingRate;
|
ShippingRate? selectedShippingRate;
|
||||||
|
|
||||||
List<String> shippingMethodLabels = [];
|
List<String> shippingMethodLabels = [];
|
||||||
List<IconData> shippingMethodIcons = [];
|
List<IconData> shippingMethodIcons = [];
|
||||||
|
|
||||||
GlobalKey<ScaffoldState> _scaffoldKey = GlobalKey<ScaffoldState>();
|
GlobalKey<ScaffoldState> _scaffoldKey = GlobalKey<ScaffoldState>();
|
||||||
|
|
||||||
int bookingDateIndex;
|
int bookingDateIndex = 0;
|
||||||
int bookingTimeIndex;
|
int bookingTimeIndex = 0;
|
||||||
int paymentPlatformIndex;
|
int paymentPlatformIndex = 0;
|
||||||
|
|
||||||
GlobalKey slidingUpPanelKey = GlobalKey();
|
GlobalKey slidingUpPanelKey = GlobalKey();
|
||||||
SlidingUpPanel slidingUpPanel;
|
SlidingUpPanel? slidingUpPanel;
|
||||||
PanelController panelController = PanelController();
|
PanelController panelController = PanelController();
|
||||||
Widget panel;
|
Widget? panel;
|
||||||
|
|
||||||
double subtotal;
|
double subtotal = 0;
|
||||||
|
|
||||||
TextEditingController newCouponController = TextEditingController();
|
TextEditingController newCouponController = TextEditingController();
|
||||||
|
|
||||||
@@ -104,7 +104,7 @@ class DesktopCheckoutState extends State<DesktopCheckout> with SingleTickerProvi
|
|||||||
|
|
||||||
store.dispatch(UpdateContext(context));
|
store.dispatch(UpdateContext(context));
|
||||||
|
|
||||||
if (cartInfo == null ) {
|
if (this.cartInfo == null ) {
|
||||||
return new Scaffold(
|
return new Scaffold(
|
||||||
body: Center(
|
body: Center(
|
||||||
child: SpinKitWave(
|
child: SpinKitWave(
|
||||||
@@ -114,8 +114,13 @@ class DesktopCheckoutState extends State<DesktopCheckout> with SingleTickerProvi
|
|||||||
),
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
final cartInfo = this.cartInfo!;
|
||||||
|
final businessInfo = cartInfo.businessInfo;
|
||||||
|
|
||||||
if (cartInfo.businessInfo.deliveryPickup == false && cartInfo.businessInfo.deliveryCanadaPost == false && cartInfo.businessInfo.deliveryStoreDelivery == false) {
|
if (businessInfo == null ||
|
||||||
|
businessInfo.deliveryPickup != true &&
|
||||||
|
businessInfo.deliveryCanadaPost != true &&
|
||||||
|
businessInfo.deliveryStoreDelivery != true) {
|
||||||
return Scaffold(
|
return Scaffold(
|
||||||
body: Container(
|
body: Container(
|
||||||
child: Center(
|
child: Center(
|
||||||
@@ -163,7 +168,7 @@ class DesktopCheckoutState extends State<DesktopCheckout> with SingleTickerProvi
|
|||||||
backdropTapClosesPanel: false,
|
backdropTapClosesPanel: false,
|
||||||
isDraggable: false,
|
isDraggable: false,
|
||||||
controller: panelController,
|
controller: panelController,
|
||||||
panel: panel,
|
panel: panel ?? SizedBox.shrink(),
|
||||||
body: Row(
|
body: Row(
|
||||||
children: [
|
children: [
|
||||||
Container(
|
Container(
|
||||||
@@ -189,7 +194,7 @@ class DesktopCheckoutState extends State<DesktopCheckout> with SingleTickerProvi
|
|||||||
breadCrumbHeight: Constants.BREADCRUMB_HEIGHT,
|
breadCrumbHeight: Constants.BREADCRUMB_HEIGHT,
|
||||||
),
|
),
|
||||||
body: WillPopScope(
|
body: WillPopScope(
|
||||||
child: slidingUpPanel,
|
child: slidingUpPanel ?? SizedBox.shrink(),
|
||||||
onWillPop: () async {
|
onWillPop: () async {
|
||||||
if (panelController != null && panelController.isPanelOpen) {
|
if (panelController != null && panelController.isPanelOpen) {
|
||||||
panelController.close();
|
panelController.close();
|
||||||
@@ -223,7 +228,7 @@ class DesktopCheckoutState extends State<DesktopCheckout> with SingleTickerProvi
|
|||||||
color: Colors.white,
|
color: Colors.white,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
cartInfo.businessInfo.isPublic ? SizedBox.shrink() : Container(
|
(cartInfo.businessInfo?.isPublic ?? false) ? SizedBox.shrink() : Container(
|
||||||
padding: EdgeInsets.only(top: 2.0, bottom: 2.0, left: 5.0, right: 5.0),
|
padding: EdgeInsets.only(top: 2.0, bottom: 2.0, left: 5.0, right: 5.0),
|
||||||
width: 100.0,
|
width: 100.0,
|
||||||
color: Colors.red,
|
color: Colors.red,
|
||||||
|
|||||||
Reference in New Issue
Block a user