diff --git a/assets/image/2x/vip_price.webp b/assets/image/2x/vip_price.webp new file mode 100644 index 00000000..d2a158fc Binary files /dev/null and b/assets/image/2x/vip_price.webp differ diff --git a/assets/image/2x/vip_unprice.webp b/assets/image/2x/vip_unprice.webp new file mode 100644 index 00000000..1aa11ee5 Binary files /dev/null and b/assets/image/2x/vip_unprice.webp differ diff --git a/assets/image/3x/vip_price.webp b/assets/image/3x/vip_price.webp new file mode 100644 index 00000000..7a211060 Binary files /dev/null and b/assets/image/3x/vip_price.webp differ diff --git a/assets/image/3x/vip_unprice.webp b/assets/image/3x/vip_unprice.webp new file mode 100644 index 00000000..a752fd3f Binary files /dev/null and b/assets/image/3x/vip_unprice.webp differ diff --git a/assets/image/vip_price.webp b/assets/image/vip_price.webp new file mode 100644 index 00000000..53a68fbf Binary files /dev/null and b/assets/image/vip_price.webp differ diff --git a/assets/image/vip_unprice.webp b/assets/image/vip_unprice.webp new file mode 100644 index 00000000..27ac2913 Binary files /dev/null and b/assets/image/vip_unprice.webp differ diff --git a/lib/settlement/settlement_view/activity_coupon_remarks.dart b/lib/settlement/settlement_view/activity_coupon_remarks.dart index ebcc690a..9fbe2070 100644 --- a/lib/settlement/settlement_view/activity_coupon_remarks.dart +++ b/lib/settlement/settlement_view/activity_coupon_remarks.dart @@ -1,3 +1,5 @@ +import 'dart:io'; + import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:flutter_smart_dialog/flutter_smart_dialog.dart'; @@ -24,20 +26,19 @@ class ActivityCouponRemarks extends StatefulWidget { final Function showVipTips; ActivityCouponRemarks( - this.couponCart, - this.activityCart, - this.settleOrderInfo, - this.minOrderInfo, - this.coupons, - this.promotions, - this.couponCount, - this.placeOrder, - this.remark, - this.editRemark, - this.tableId, - this.vipPriceSelect, - this.showVipTips - ); + this.couponCart, + this.activityCart, + this.settleOrderInfo, + this.minOrderInfo, + this.coupons, + this.promotions, + this.couponCount, + this.placeOrder, + this.remark, + this.editRemark, + this.tableId, + this.vipPriceSelect, + this.showVipTips); @override State createState() { @@ -64,12 +65,7 @@ class _ActivityCouponRemarks extends State { borderRadius: BorderRadius.circular(8), ), // height: 122.h / (!widget.placeOrder ? 2 : 1), - margin: EdgeInsets.only( - left: 16, - right: 16, - top: 15, - bottom: 14 - ), + margin: EdgeInsets.only(left: 16, right: 16, top: 15, bottom: 14), padding: EdgeInsets.only( left: 16, right: 16, @@ -81,70 +77,98 @@ class _ActivityCouponRemarks extends State { crossAxisAlignment: CrossAxisAlignment.center, children: [ // if(widget?.settleOrderInfo?.memberVO?.isVip ?? false) - Row( - mainAxisAlignment: MainAxisAlignment.center, - crossAxisAlignment: CrossAxisAlignment.center, - children: [ - Expanded( - flex: 1, - child: Text( - "VIP价格", - style: TextStyle( - fontWeight: MyFontWeight.regular, - fontSize: 14.sp, - color: Color(0xFF353535), - ), + Row( + mainAxisAlignment: MainAxisAlignment.center, + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + Expanded( + flex: 1, + child: Text( + "VIP价格", + style: TextStyle( + fontWeight: MyFontWeight.regular, + fontSize: 14.sp, + color: Color(0xFF353535), ), ), - Switch.adaptive( - value: (widget.coupons != null && widget.coupons != ""||widget.promotions != null && widget.promotions != "") ? false:vipSelect, - materialTapTargetSize: MaterialTapTargetSize.shrinkWrap, - activeColor: Color(0xff32A060), - onChanged: (bool value) { - setState(() { - if((widget?.settleOrderInfo?.memberVO?.isVip ?? false)){ - vipSelect = !vipSelect; - widget.vipPriceSelect(vipSelect); - }else{ - widget.showVipTips(); - return; - } - }); - }, + ), + Platform.isAndroid ? + Switch.adaptive( + value: (widget.coupons != null && widget.coupons != ""||widget.promotions != null && widget.promotions != "") ? false:vipSelect, + materialTapTargetSize: MaterialTapTargetSize.shrinkWrap, + activeColor: Color(0xff32A060), + onChanged: (bool value) { + setState(() { + if((widget?.settleOrderInfo?.memberVO?.isVip ?? false)){ + vipSelect = !vipSelect; + widget.vipPriceSelect(vipSelect); + }else{ + widget.showVipTips(); + return; + } + }); + }, + ): + GestureDetector( + onTap: () { + setState(() { + // (widget.coupons != null && widget.coupons != ""||widget.promotions != null && widget.promotions != "") ? false:vipSelect, + if ((widget?.settleOrderInfo?.memberVO?.isVip ?? false)) { + vipSelect = !vipSelect; + widget.vipPriceSelect(vipSelect); + } else { + widget.showVipTips(); + return; + } + }); + }, + child: Container( + padding: EdgeInsets.only(bottom: 18.w), + alignment: Alignment.center, + child: Image.asset( + vipSelect + ? "assets/image/vip_price.webp" + : "assets/image/vip_unprice.webp", + width: 38.w, + height: 20.h, + ), ), - ], - ), - if (widget.placeOrder && widget?.settleOrderInfo?.benefitDiscountAmount != null && widget?.settleOrderInfo?.benefitDiscountAmount != "0") - Container( - margin:EdgeInsets.only(bottom: 13), - child:Row( - mainAxisAlignment: MainAxisAlignment.center, - crossAxisAlignment: CrossAxisAlignment.center, - children: [ - Expanded( - flex: 1, - child: Text( - "会员优惠金额", + ) + ], + ), + if (widget.placeOrder && + widget?.settleOrderInfo?.benefitDiscountAmount != null && + widget?.settleOrderInfo?.benefitDiscountAmount != "0") + Container( + margin: EdgeInsets.only(bottom: 13), + child: Row( + mainAxisAlignment: MainAxisAlignment.center, + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + Expanded( + flex: 1, + child: Text( + "会员优惠金额", + style: TextStyle( + fontWeight: MyFontWeight.regular, + fontSize: 14.sp, + color: Color(0xFF353535), + ), + ), + ), + Text( + widget.settleOrderInfo.benefitDiscountAmount, + textAlign: TextAlign.end, style: TextStyle( - fontWeight: MyFontWeight.regular, fontSize: 14.sp, - color: Color(0xFF353535), + color: Color(0xFF32A060), + fontWeight: MyFontWeight.semi_bold, ), ), - ), - Text( - widget.settleOrderInfo.benefitDiscountAmount, - textAlign: TextAlign.end, - style: TextStyle( - fontSize: 14.sp, - color: Color(0xFF32A060), - fontWeight: MyFontWeight.semi_bold, - ), - ), - ], + ], + ), ), - ), - if (widget.placeOrder && widget.tableId <=0) + if (widget.placeOrder && widget.tableId <= 0) InkWell( onTap: () { widget.activityCart(); @@ -245,7 +269,7 @@ class _ActivityCouponRemarks extends State { ), Expanded( child: Text( - widget.remark != "" ? widget.remark:"点击添加备注", + widget.remark != "" ? widget.remark : "点击添加备注", textAlign: TextAlign.end, style: TextStyle( fontSize: 14.sp, @@ -286,13 +310,12 @@ class _ActivityCouponRemarks extends State { String coupon = ""; if (widget.coupons == null || widget.coupons == "") { coupon = "未选择任何优惠券"; - if(widget.placeOrder) - if(widget.minOrderInfo == null || - widget.minOrderInfo.orderInfoVo.couponList == null) - {coupon = "未选择任何优惠券";} - else if(widget.promotions != null && widget.promotions != ""){ - coupon = "优惠券与活动不可同享"; - } + if (widget.placeOrder) if (widget.minOrderInfo == null || + widget.minOrderInfo.orderInfoVo.couponList == null) { + coupon = "未选择任何优惠券"; + } else if (widget.promotions != null && widget.promotions != "") { + coupon = "优惠券与活动不可同享"; + } if (widget.settleOrderInfo == null || widget.settleOrderInfo.couponList == null) { coupon = "暂无可选优惠券";