diff --git a/assets/image/2x/add.webp b/assets/image/2x/add.webp index 4b9cd6b9..ecc7a536 100644 Binary files a/assets/image/2x/add.webp and b/assets/image/2x/add.webp differ diff --git a/assets/image/2x/reduce.webp b/assets/image/2x/reduce.webp index d0c58b64..b06646f5 100644 Binary files a/assets/image/2x/reduce.webp and b/assets/image/2x/reduce.webp differ diff --git a/assets/image/3x/add.webp b/assets/image/3x/add.webp index 507f8289..22297276 100644 Binary files a/assets/image/3x/add.webp and b/assets/image/3x/add.webp differ diff --git a/assets/image/3x/reduce.webp b/assets/image/3x/reduce.webp index e7edbc83..4cde0aa6 100644 Binary files a/assets/image/3x/reduce.webp and b/assets/image/3x/reduce.webp differ diff --git a/assets/image/add.webp b/assets/image/add.webp index dff3b1be..9b45ea3f 100644 Binary files a/assets/image/add.webp and b/assets/image/add.webp differ diff --git a/assets/image/reduce.webp b/assets/image/reduce.webp index e2072825..57cf7da3 100644 Binary files a/assets/image/reduce.webp and b/assets/image/reduce.webp differ diff --git a/lib/settlement/settlement.dart b/lib/settlement/settlement.dart index e594a731..091c5af0 100644 --- a/lib/settlement/settlement.dart +++ b/lib/settlement/settlement.dart @@ -1011,11 +1011,10 @@ class _Settlement extends State { subscribeStoresName, ), + ///支付方式 if (settleOrderInfo != null && placeOrder && joinA != JoinActivity.BargainBug) - - ///支付方式 PayMethod( payChannelCheck, coupons, @@ -1146,7 +1145,7 @@ class _Settlement extends State { ], borderRadius: BorderRadius.circular(8), ), - margin: EdgeInsets.only(left: 16.w, right: 16.w, top: 6.h, bottom: 6.h), + margin: EdgeInsets.only(left: 16.w, right: 16.w,bottom: 16.h), padding: EdgeInsets.symmetric(horizontal: 12.w, vertical: 10.h), child: Row( children: [ diff --git a/lib/settlement/settlement_view/activity_coupon_remarks.dart b/lib/settlement/settlement_view/activity_coupon_remarks.dart index db8522c9..fd259c86 100644 --- a/lib/settlement/settlement_view/activity_coupon_remarks.dart +++ b/lib/settlement/settlement_view/activity_coupon_remarks.dart @@ -84,7 +84,7 @@ class _ActivityCouponRemarks extends State { ], borderRadius: BorderRadius.circular(8), ), - margin: EdgeInsets.only(left: 16.w, right: 16.w, top: 14.h, bottom: 14.h), + margin: EdgeInsets.only(left: 16.w, right: 16.w,bottom: 16.h), padding: EdgeInsets.only( left: 16.w, right: 16.w, diff --git a/lib/settlement/settlement_view/pay_method.dart b/lib/settlement/settlement_view/pay_method.dart index 9a22199a..a108e23d 100644 --- a/lib/settlement/settlement_view/pay_method.dart +++ b/lib/settlement/settlement_view/pay_method.dart @@ -54,7 +54,6 @@ class _PayMethod extends State { margin: EdgeInsets.only( left: 16.w, right: 16.w, - top: 8.h, bottom: 16.h, ), padding: EdgeInsets.only( diff --git a/lib/settlement/settlement_view/settlement_order_commodity.dart b/lib/settlement/settlement_view/settlement_order_commodity.dart index 0fc396f7..31e7ecb2 100644 --- a/lib/settlement/settlement_view/settlement_order_commodity.dart +++ b/lib/settlement/settlement_view/settlement_order_commodity.dart @@ -52,8 +52,7 @@ class _SettlementOrderCommodity extends State { margin: EdgeInsets.only( left: 16.w, right: 16.w, - top: 16.h, - bottom: 8.h, + bottom: 16.h, ), padding: EdgeInsets.only( left: 20.w, diff --git a/lib/settlement/settlement_view/vip_discounts_select.dart b/lib/settlement/settlement_view/vip_discounts_select.dart index 6a017e50..7e62c5af 100644 --- a/lib/settlement/settlement_view/vip_discounts_select.dart +++ b/lib/settlement/settlement_view/vip_discounts_select.dart @@ -41,7 +41,7 @@ class _VipDiscountsSelect extends State { ], borderRadius: BorderRadius.circular(8), ), - margin: EdgeInsets.only(left: 16.w, right: 16.w, top: 14.h, bottom: 14.h), + margin: EdgeInsets.only(left: 16.w, right: 16.w,bottom: 16.h), padding: EdgeInsets.only( left: 16.w, right: 16.w, diff --git a/lib/store/shop_details_page.dart b/lib/store/shop_details_page.dart index 57b023dd..3b331db7 100644 --- a/lib/store/shop_details_page.dart +++ b/lib/store/shop_details_page.dart @@ -16,6 +16,7 @@ import 'package:huixiang/retrofit/data/store_info.dart'; import 'package:huixiang/retrofit/min_api.dart'; import 'package:huixiang/retrofit/retrofit_api.dart'; import 'package:huixiang/store/store_view/people_num.dart'; +import 'package:huixiang/store/store_view/red_dot_page.dart'; import 'package:huixiang/store/store_view/shop_car.dart'; import 'package:huixiang/utils/font_weight.dart'; import 'package:huixiang/view_widget/classic_header.dart'; @@ -73,6 +74,9 @@ class _ShopDetailsPage extends State { int singleNum = 0; String goodsSkuId; bool isCounts = false; + GlobalKey _key = GlobalKey(); + Offset _endOffset; + double rightOffset = 23.0; @override void initState() { @@ -91,6 +95,12 @@ class _ShopDetailsPage extends State { }); } }); + WidgetsBinding.instance.addPostFrameCallback((c) { + // 获取「购物车」的位置 + _endOffset = (_key.currentContext.findRenderObject() as RenderBox) + .localToGlobal(Offset.zero)+ + Offset(rightOffset, 0.0); + }); // SharedPreferences.getInstance().then((value) { // String minToken = value.getString("minToken"); // String tenant = value.getString("tenant"); @@ -330,20 +340,36 @@ class _ShopDetailsPage extends State { queryShopCar().then((value) { this.shopCarGoods = value; dialogShowing = true; - SmartDialog.show( - widget: ShopCar( - shopCartKey, - this.shopCarGoods, - clearShopCar, - toDownOrder, - shopCartAdd, - shopCartReduce, - ), - onDismiss: () { - dialogShowing = false; - }, - alignmentTemp: Alignment.bottomCenter, - ); + //使用showModalBottomSheet加载弹窗才有效 + showModalBottomSheet( + backgroundColor: Colors.transparent, + context: context, + //点击背景弹窗是否关闭 + // isDismissible: true, + builder: (_) { + return ShopCar( + shopCartKey, + this.shopCarGoods, + clearShopCar, + toDownOrder, + shopCartAdd, + shopCartReduce, + ); + }); + // SmartDialog.show( + // widget: ShopCar( + // shopCartKey, + // this.shopCarGoods, + // clearShopCar, + // toDownOrder, + // shopCartAdd, + // shopCartReduce, + // ), + // onDismiss: () { + // dialogShowing = false; + // }, + // alignmentTemp: Alignment.bottomCenter, + // ); }); } @@ -359,8 +385,8 @@ class _ShopDetailsPage extends State { ///选规格 _queryMiNiDetail(String id, int count) async { - EasyLoading.show( - status: S.current.zhengzaijiazai, maskType: EasyLoadingMaskType.black); + //加红点抛物线动画,故单规格加购时不显示加载中 + // EasyLoading.show( status: S.current.zhengzaijiazai, maskType: EasyLoadingMaskType.black); if (count < 0) { shopCarGoods.shoppingCartSkuItemList.forEach((element) { if (element.productId == id) { @@ -376,7 +402,7 @@ class _ShopDetailsPage extends State { }else{ SmartDialog.showToast(baseData.msg); } - EasyLoading.dismiss(); + // EasyLoading.dismiss(); } ///选规格弹窗 @@ -822,9 +848,10 @@ class _ShopDetailsPage extends State { }, child: Image.asset( "assets/image/shopping_bag.webp", - width: 66, - height: 66, + width: 57.w, + height: 57.w, fit: BoxFit.fitWidth, + key: _key, ), ), if (count() != 0) @@ -910,65 +937,89 @@ class _ShopDetailsPage extends State { ), ), Spacer(), - GestureDetector( - onTap: () async { - if (storeInfo.posType.code == "NORMALSTORE" && - tableId == 0) { - showDeleteDialog(); - } else if (isSetMeal == true) { - await Navigator.of(context) - .pushNamed('/router/product_meals_sku', arguments: { - "id": id, - "storeId": storeId, - "tableId": tableId - }); - queryShopCar().then((value) { - this.shopCarGoods = value; - setState(() {}); - }); - } else { - _queryMiNiDetail(id, counts); - } - }, - child: Container( - width: 92.w, - height: 32.h, - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(4), - color: Color(0xFF32A060), - ), - margin: EdgeInsets.only(bottom: 8), - child: Row( - mainAxisAlignment: MainAxisAlignment.center, - crossAxisAlignment: CrossAxisAlignment.center, - children: [ - Image.asset( - "assets/image/goods_shopp.webp", - fit: BoxFit.fill, - width: 18, - height: 18, - ), - SizedBox( - width: 2, + Builder( + builder: (context) { + return GestureDetector( + onTap: () async { + if (storeInfo.posType.code == "NORMALSTORE" && + tableId == 0) { + showDeleteDialog(); + } else if (isSetMeal == true) { + await Navigator.of(context).pushNamed( + '/router/product_meals_sku', + arguments: { + "id": id, + "storeId": storeId, + "tableId": tableId + }); + queryShopCar().then((value) { + this.shopCarGoods = value; + setState(() {}); + }); + } else { + if (miNiDetail.attrList != null && + miNiDetail.attrList.length == 1 && + miNiDetail.attrList[0].attrValueList.length == 1){ + /// 点击的时候获取当前 widget 的位置,传入 overlayEntry + var _overlayEntry = OverlayEntry(builder: (_) { + RenderBox box = context.findRenderObject(); + var offset = box.localToGlobal(Offset.zero); + return RedDotPage( + startPosition: offset, + endPosition: _endOffset, + ); + }); + // 显示Overlay + Overlay.of(context).insert(_overlayEntry); + // 等待动画结束 + Future.delayed(Duration(milliseconds: 800), () { + _overlayEntry.remove(); + _overlayEntry = null; + }); + } + _queryMiNiDetail(id,(skuMinQty > 1 ? counts : ((widget.arguments["minQty"]??0) > 1 && singleNum==0) + ? (widget.arguments["minQty"]??0):counts)); + } + }, + child: Container( + width: 92.w, + height: 32.h, + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(4), + color: Color(0xFF32A060), ), - Text( - ((miNiDetail?.subscribeParam?.isEnableSubscribe ?? - false) == - true) - ? S.of(context).lijiyuyue - : (isSetMeal ?? false) == true - ? "选套餐" - : "加入购物车", - style: TextStyle( - fontSize: 12.sp, - fontWeight: MyFontWeight.regular, - color: Color(0xFFFFFFFF), - ), + margin: EdgeInsets.only(bottom: 8), + child: Row( + mainAxisAlignment: MainAxisAlignment.center, + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + Image.asset( + "assets/image/goods_shopp.webp", + fit: BoxFit.fill, + width: 18, + height: 18, + ), + SizedBox( + width: 2, + ), + Text( + ((miNiDetail?.subscribeParam?.isEnableSubscribe ?? + false) == + true) + ? S.of(context).lijiyuyue + : (isSetMeal ?? false) == true + ? "选套餐" + : "加入购物车", + style: TextStyle( + fontSize: 12.sp, + fontWeight: MyFontWeight.regular, + color: Color(0xFFFFFFFF), + ), + ), + ], ), - ], - ), - ), - ) + ), + );},) ], ), ) @@ -1053,67 +1104,89 @@ class _ShopDetailsPage extends State { ), ), Spacer(), - GestureDetector( - onTap: () async { - if (storeInfo.posType.code == "NORMALSTORE" && - tableId == 0) { - showDeleteDialog(); - } else if (isSetMeal == true) { - await Navigator.of(context).pushNamed( - '/router/product_meals_sku', - arguments: { - "id": id, - "storeId": storeId, - "tableId": tableId + Builder( + builder: (context) { + return GestureDetector( + onTap: () async { + if (storeInfo.posType.code == "NORMALSTORE" && + tableId == 0) { + showDeleteDialog(); + } else if (isSetMeal == true) { + await Navigator.of(context).pushNamed( + '/router/product_meals_sku', + arguments: { + "id": id, + "storeId": storeId, + "tableId": tableId + }); + queryShopCar().then((value) { + this.shopCarGoods = value; + setState(() {}); }); - queryShopCar().then((value) { - this.shopCarGoods = value; - setState(() {}); - }); - } else { - _queryMiNiDetail(id,(skuMinQty > 1 ? counts : ((widget.arguments["minQty"]??0) > 1 && singleNum==0) - ? (widget.arguments["minQty"]??0):counts)); - } - }, - child: Container( - width: 92.w, - height: 32.h, - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(4), - color: Color(0xFF32A060), - ), - margin: EdgeInsets.only(bottom: 8), - child: Row( - mainAxisAlignment: MainAxisAlignment.center, - crossAxisAlignment: CrossAxisAlignment.center, - children: [ - Image.asset( - "assets/image/goods_shopp.webp", - fit: BoxFit.fill, - width: 18, - height: 18, - ), - SizedBox( - width: 2, + } else { + if (miNiDetail.attrList != null && + miNiDetail.attrList.length == 1 && + miNiDetail.attrList[0].attrValueList.length == 1){ + /// 点击的时候获取当前 widget 的位置,传入 overlayEntry + var _overlayEntry = OverlayEntry(builder: (_) { + RenderBox box = context.findRenderObject(); + var offset = box.localToGlobal(Offset.zero); + return RedDotPage( + startPosition: offset, + endPosition: _endOffset, + ); + }); + // 显示Overlay + Overlay.of(context).insert(_overlayEntry); + // 等待动画结束 + Future.delayed(Duration(milliseconds: 800), () { + _overlayEntry.remove(); + _overlayEntry = null; + }); + } + _queryMiNiDetail(id,(skuMinQty > 1 ? counts : ((widget.arguments["minQty"]??0) > 1 && singleNum==0) + ? (widget.arguments["minQty"]??0):counts)); + } + }, + child: Container( + width: 92.w, + height: 32.h, + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(4), + color: Color(0xFF32A060), ), - Text( - ((miNiDetail?.subscribeParam?.isEnableSubscribe ?? - false) == + margin: EdgeInsets.only(bottom: 8), + child: Row( + mainAxisAlignment: MainAxisAlignment.center, + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + Image.asset( + "assets/image/goods_shopp.webp", + fit: BoxFit.fill, + width: 18, + height: 18, + ), + SizedBox( + width: 2, + ), + Text( + ((miNiDetail?.subscribeParam?.isEnableSubscribe ?? + false) == true) - ? S.of(context).lijiyuyue - : (isSetMeal ?? false) == true + ? S.of(context).lijiyuyue + : (isSetMeal ?? false) == true ? "选套餐" : "加入购物车", - style: TextStyle( - fontSize: 12.sp, - fontWeight: MyFontWeight.regular, - color: Color(0xFFFFFFFF), - ), + style: TextStyle( + fontSize: 12.sp, + fontWeight: MyFontWeight.regular, + color: Color(0xFFFFFFFF), + ), + ), + ], ), - ], - ), - ), - ) + ), + );},), ], ), Text( diff --git a/lib/store/store_order.dart b/lib/store/store_order.dart index b77a8a34..64089526 100644 --- a/lib/store/store_order.dart +++ b/lib/store/store_order.dart @@ -18,6 +18,7 @@ import 'package:huixiang/retrofit/min_api.dart'; import 'package:huixiang/retrofit/retrofit_api.dart'; import 'package:huixiang/store/store_view/people_num.dart'; import 'package:huixiang/store/store_view/product_sku.dart'; +import 'package:huixiang/store/store_view/red_dot_page.dart'; import 'package:huixiang/store/store_view/shop_car.dart'; import 'package:huixiang/store/store_view/store_info.dart'; import 'package:huixiang/store/store_view/store_order_list.dart'; @@ -74,6 +75,10 @@ class _StoreOrderPage extends State String cName; String cid; + GlobalKey _key = GlobalKey(); + Offset _endOffset; + double rightOffset = 23.0; + @override void initState() { super.initState(); @@ -81,6 +86,12 @@ class _StoreOrderPage extends State tableId = widget.arguments["tableId"] ?? 0; tenant = widget.arguments["tenant"]; storeId = widget.arguments["id"]; + WidgetsBinding.instance.addPostFrameCallback((c) { + // 获取「购物车」的位置 + _endOffset = (_key.currentContext.findRenderObject() as RenderBox) + .localToGlobal(Offset.zero)+ + Offset(rightOffset, 0.0); + }); debugPrint( "store_param tableId:$tableId tenant:$tenant storeId:$storeId"); @@ -458,6 +469,7 @@ class _StoreOrderPage extends State minToken, tenant, tableId, + _endOffset, _queryMiNiDetail, () { queryShopCar().then((value) { this.shopCarGoods = value; @@ -563,21 +575,21 @@ class _StoreOrderPage extends State ), ), Stack( - children: [ + children: [ InkWell( onTap: () { if (count() != 0) showShoppingCart(); }, child: Image.asset( "assets/image/shopping_bag.webp", - width: 66, - height: 66, + width: 57.w, + height: 57.h, fit: BoxFit.fitWidth, ), ), if (count() != 0) Positioned( - right: 5, + right: 0, // top: 14, child: RoundButton( width: 17.w, @@ -591,6 +603,7 @@ class _StoreOrderPage extends State ), ), ], + key: _key, ), ], ), @@ -745,25 +758,42 @@ class _StoreOrderPage extends State queryShopCar().then((value) { this.shopCarGoods = value; dialogShowing = true; - SmartDialog.show( - widget: ShopCar( - shopCartKey, - this.shopCarGoods, - clearShopCar, - toDownOrder, - shopCartAdd, - shopCartReduce, - ), - onDismiss: () { - dialogShowing = false; - }, - alignmentTemp: Alignment.bottomCenter, - ); + //使用showModalBottomSheet加载弹窗才有效 + showModalBottomSheet( + backgroundColor: Colors.transparent, + context: context, + //点击背景弹窗是否关闭 + // isDismissible: true, + builder: (_) { + return ShopCar( + shopCartKey, + this.shopCarGoods, + clearShopCar, + toDownOrder, + shopCartAdd, + shopCartReduce, + ); + }); + // SmartDialog.show( + // widget: ShopCar( + // shopCartKey, + // this.shopCarGoods, + // clearShopCar, + // toDownOrder, + // shopCartAdd, + // shopCartReduce, + // ), + // onDismiss: () { + // dialogShowing = false; + // }, + // alignmentTemp: Alignment.bottomCenter, + // ); }); } ///清空购物车 clearShopCar() async { + // EasyLoading.show(status: S.current.zhengzaijiazai); BaseData baseData = await minService.clearShoppingCart(storeId); if (baseData.isSuccess) { shopCarGoods = null; @@ -773,8 +803,8 @@ class _StoreOrderPage extends State ///选规格 _queryMiNiDetail(String id, int count) async { - EasyLoading.show( - status: S.current.zhengzaijiazai, maskType: EasyLoadingMaskType.black); + //加红点抛物线动画,故单规格加购时不显示加载中 + // EasyLoading.show(status: S.current.zhengzaijiazai, maskType: EasyLoadingMaskType.black); if (count < 0) { shopCarGoods.shoppingCartSkuItemList.forEach((element) async { if (element.productId == id) { @@ -785,7 +815,7 @@ class _StoreOrderPage extends State return; } BaseData baseData = await minService.miNiDetail(id); - EasyLoading.dismiss(); + // EasyLoading.dismiss(); if (baseData != null && baseData.isSuccess) { miNiDetail = baseData.data; showStoreSelector(baseData.data, id, count); diff --git a/lib/store/store_view/red_dot_page.dart b/lib/store/store_view/red_dot_page.dart new file mode 100644 index 00000000..3b7162a2 --- /dev/null +++ b/lib/store/store_view/red_dot_page.dart @@ -0,0 +1,83 @@ +import 'dart:math'; + +import 'package:flutter/material.dart'; + +class RedDotPage extends StatefulWidget { + final Offset startPosition; + final Offset endPosition; + + const RedDotPage({Key key, this.startPosition, this.endPosition}) + : super(key: key); + + @override + _RedDotPageState createState() => _RedDotPageState(); +} + +class _RedDotPageState extends State + with SingleTickerProviderStateMixin { + AnimationController _controller; // 动画 controller + Animation _animation; // 动画 + double left; // 小圆点的left(动态计算) + double top; // 小圆点的right(动态计算) + + @override + void initState() { + super.initState(); + _controller = + AnimationController(duration: Duration(milliseconds: 800), vsync: this); + _animation = Tween(begin: 0.0, end: 1.0).animate(_controller); + + // 二阶贝塞尔曲线用值 + var x0 = widget.startPosition.dx; + var y0 = widget.startPosition.dy; + + var x1 = widget.startPosition.dx - 250; + var y1 = widget.startPosition.dy - 100; + + var x2 = widget.endPosition.dx; + var y2 = widget.endPosition.dy; + + _animation.addListener(() { + // t 动态变化的值 + var t = _animation.value; + if (mounted) + setState(() { + left = pow(1 - t, 2) * x0 + 2 * t * (1 - t) * x1 + pow(t, 2) * x2; + top = pow(1 - t, 2) * y0 + 2 * t * (1 - t) * y1 + pow(t, 2) * y2; + }); + }); + + // 初始化小圆点的位置 + left = widget.startPosition.dx; + top = widget.startPosition.dy; + + // 显示小圆点的时候动画就开始 + _controller.forward(); + } + + @override + Widget build(BuildContext context) { + // 用 Stack -> Positioned 来控制小圆点的位置 + return Stack( + children: [ + Positioned( + left: left, + top: top, + child: ClipOval( + child: Container( + width: 14, + height: 14, + color: Colors.red, + ), + ), + ) + ], + ); + } + + @override + void dispose() { + _controller.dispose(); + super.dispose(); + } +} \ No newline at end of file diff --git a/lib/store/store_view/shop_car.dart b/lib/store/store_view/shop_car.dart index 4aba88e5..881e73c6 100644 --- a/lib/store/store_view/shop_car.dart +++ b/lib/store/store_view/shop_car.dart @@ -1,4 +1,5 @@ import 'package:flutter/material.dart'; +import 'package:flutter_easyloading/flutter_easyloading.dart'; import 'package:flutter_smart_dialog/flutter_smart_dialog.dart'; import 'package:huixiang/generated/l10n.dart'; import 'package:huixiang/retrofit/data/shoppingCart.dart'; @@ -38,8 +39,9 @@ class _ShopCar extends State { Widget build(BuildContext context) { return WillPopScope( onWillPop: () async { - debugPrint("ssssasdadsasdadasd"); - SmartDialog.dismiss(); + // debugPrint("ssssasdadsasdadasd"); + // SmartDialog.dismiss(); + Navigator.of(context).pop(); return true; }, child: StatefulBuilder( @@ -79,12 +81,15 @@ class _ShopCar extends State { ), ), InkWell( - onTap: () { + onTap: () async{ if (widget.shopingCar.shoppingCartSkuItemList != null) { + EasyLoading.show(status: S.current.zhengzaijiazai, maskType: EasyLoadingMaskType.black); widget.shopingCar.shoppingCartSkuItemList.clear(); } + await widget.clearShopCar(); + EasyLoading.dismiss(); + Navigator.of(context).pop(); state(() {}); - widget.clearShopCar(); }, child: Image.asset( "assets/image/delete.webp", @@ -117,10 +122,13 @@ class _ShopCar extends State { widget.shopingCar = await widget.shopCartAdd(cart); setState(() {}); - }, + }, (ShoppingCartSkuItemListBean cart) async { widget.shopingCar = await widget.shopCartReduce(cart); + if(widget.shopingCar?.shoppingCartSkuItemList == null){ + Navigator.of(context).pop(); + } setState(() {}); }, isShopCart: true, @@ -175,7 +183,8 @@ class _ShopCar extends State { Spacer(), GestureDetector( onTap: () { - SmartDialog.dismiss(); + // SmartDialog.dismiss(); + Navigator.of(context).pop(); widget.toDownOrder(); }, child: RoundButton( @@ -197,13 +206,14 @@ class _ShopCar extends State { children: [ InkWell( onTap: () { - // Navigator.of(context).pop(); - SmartDialog.dismiss(); + Navigator.of(context).pop(); + // SmartDialog.dismiss(); }, child: Image.asset( "assets/image/shopping_bag.webp", - width: 66, - height: 66, + width: 57.w, + height: 57.h, + fit: BoxFit.fitWidth, ), ), Positioned( diff --git a/lib/store/store_view/shop_goods.dart b/lib/store/store_view/shop_goods.dart index 0e0fadf6..4e8588c4 100644 --- a/lib/store/store_view/shop_goods.dart +++ b/lib/store/store_view/shop_goods.dart @@ -5,6 +5,7 @@ import 'package:flutter_smart_dialog/flutter_smart_dialog.dart'; import 'package:huixiang/generated/l10n.dart'; import 'package:huixiang/retrofit/data/findMiNiGroupList.dart'; import 'package:huixiang/retrofit/data/shoppingCart.dart'; +import 'package:huixiang/store/store_view/red_dot_page.dart'; import 'package:huixiang/utils/flutter_utils.dart'; import 'package:huixiang/utils/font_weight.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart'; @@ -30,6 +31,7 @@ class ShopGoods extends StatefulWidget { final ShoppingCartSkuItemListBean shoppingCartSkuItemListBean; final int count; final int tableId; + final Offset endOffset; final bool isShopCart; final StoreInfo storeInfo; @@ -40,6 +42,7 @@ class ShopGoods extends StatefulWidget { this.count = 0, this.isShopCart = false, this.tableId, + this.endOffset, this.queryShoppingCart, this.queryMiNiDetail, this.shoppingCartSkuItemListBean, @@ -114,8 +117,8 @@ class _ShopGoods extends State { : (widget.shoppingCartSkuItemListBean != null ? widget.shoppingCartSkuItemListBean.skuImg : ""), - width: 70.h, - height: 70.h, + width: 102.h, + height: 102.h, radius: BorderRadius.circular(4), fit: BoxFit.cover, errorSrc: "assets/image/default_1.webp", @@ -127,9 +130,9 @@ class _ShopGoods extends State { Expanded( child: Column( crossAxisAlignment: CrossAxisAlignment.start, - children: [ + children:[ Padding( - padding: EdgeInsets.only(right: 16.w), + padding: EdgeInsets.only(right: 16.w,bottom:7.h), child: Row( children: [ Expanded( @@ -140,9 +143,9 @@ class _ShopGoods extends State { overflow: TextOverflow.ellipsis, maxLines: 1, style: TextStyle( - color: Colors.black, - fontSize: 13.sp, - fontWeight: MyFontWeight.medium, + color: Color(0xFF282828), + fontSize: 16.sp, + fontWeight:MyFontWeight.semi_bold, ), ), ), @@ -163,102 +166,106 @@ class _ShopGoods extends State { ], ), ), - SizedBox( - height: 2.h, - ), Padding( - padding: EdgeInsets.only(right: 16.w), - child: Row( - children: [ - Expanded( - child: Text( - (widget.productListBean != null - ? widget.productListBean.shortName - : widget.shoppingCartSkuItemListBean.skuName ?? - ""), - overflow: TextOverflow.ellipsis, - maxLines: 2, - style: TextStyle( - color: Color(0xFF4C4C4C), - fontSize: 10.sp, - fontWeight: MyFontWeight.regular, - ), + padding: EdgeInsets.only(right: 16.w,bottom:7.h), + child:Text( + (widget.productListBean != null + ? widget.productListBean.shortName + : widget.shoppingCartSkuItemListBean.skuName ?? + ""), + overflow: TextOverflow.ellipsis, + maxLines: 2, + style: TextStyle( + color: Color(0xFF4C4C4C), + fontSize: 10.sp, + fontWeight: MyFontWeight.regular, + ), + ),), + ((widget.productListBean?.minQty ?? 0).toInt() > 1)? + Row( + children: [ + Container( + padding: EdgeInsets.symmetric(horizontal:4.w), + decoration: BoxDecoration( + borderRadius: + BorderRadius.circular(2), + border: Border.all( + width: 1, + color: Color(0xFFF65720), + style: BorderStyle.solid, ), ), - SizedBox( - width: 10.w, - ), - ], - )), - SizedBox( - height: 7.h, - ), - Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - Row( - children: [ - Text( - "¥${AppUtils.calculateDouble(double.tryParse(widget.isShopCart ? widget.shoppingCartSkuItemListBean.skuPrice : widget.productListBean.price) ?? 0)}", + alignment: Alignment.center, + child: Text( + "${widget.productListBean?.minQty ?? 0}份起购", style: TextStyle( - color: Color(0xFFFF4500), - fontSize: 16.sp, - fontFamily: 'JDZhengHT', - fontWeight: MyFontWeight.medium, + color: Color(0xFFF65720), + fontSize: 10.sp, + fontWeight: MyFontWeight.regular, ), ), - SizedBox( - width:5.w, - ), - // Container( - // width: 44.w, - // height: 18.h, - // decoration: BoxDecoration( - // color: Color(0xFFFF4500), - // borderRadius: BorderRadius.circular(2), - // ), - // alignment: Alignment.center, - // child: Text( - // "APP专享", - // style: TextStyle( - // color: Color(0xFFFFFFFF), - // fontSize: 10.sp, - // fontWeight: MyFontWeight.medium, - // ), - // ), - // ), - if((widget.productListBean?.minQty ?? 0).toInt() > 1) - Container( - padding: EdgeInsets.symmetric(horizontal:4.w), - decoration: BoxDecoration( - borderRadius: - BorderRadius.circular(2), - border: Border.all( - width: 1, - color: Color(0xFFF65720), - style: BorderStyle.solid, - ), - ), - alignment: Alignment.center, - child: Text( - "${widget.productListBean?.minQty ?? 0}份起购", - style: TextStyle( - color: Color(0xFFF65720), - fontSize: 10.sp, - fontWeight: MyFontWeight.regular, - ), - ), - ), - ], - ), + ), + Spacer(), + ], + ):SizedBox(height:23.h), + Row( + children: [ + Expanded(child:Text( + "¥${AppUtils.calculateDouble(double.tryParse(widget.isShopCart ? widget.shoppingCartSkuItemListBean.skuPrice : widget.productListBean.price) ?? 0)}", + style: TextStyle( + color: Color(0xFFFF4500), + fontSize: 16.sp, + fontFamily: 'JDZhengHT', + fontWeight: MyFontWeight.medium, + ), + )), + // SizedBox( + // width:5.w, + // ), + // Container( + // width: 44.w, + // height: 18.h, + // decoration: BoxDecoration( + // color: Color(0xFFFF4500), + // borderRadius: BorderRadius.circular(2), + // ), + // alignment: Alignment.center, + // child: Text( + // "APP专享", + // style: TextStyle( + // color: Color(0xFFFFFFFF), + // fontSize: 10.sp, + // fontWeight: MyFontWeight.medium, + // ), + // ), + // ), + ///起购量 if((widget.productListBean?.minQty ?? 0).toInt() > 1 && widget.count == 0 && (widget.productListBean?.attrStyle ?? 0) != 1) - GestureDetector( + Builder( + builder: (context) { + return GestureDetector( behavior: HitTestBehavior.opaque, onTap: () async { if (widget.storeInfo.posType.code == "NORMALSTORE" && widget.tableId == 0) { showDeleteDialog(); } else { + /// 点击的时候获取当前 widget 的位置,传入 overlayEntry + var _overlayEntry = OverlayEntry(builder: (_) { + RenderBox box = context.findRenderObject(); + var offset = box.localToGlobal(Offset.zero); + return RedDotPage( + startPosition: offset, + endPosition: widget.endOffset, + ); + }); + // 显示Overlay + Overlay.of(context).insert(_overlayEntry); + // 等待动画结束 + Future.delayed(Duration(milliseconds: 800), () { + _overlayEntry.remove(); + _overlayEntry = null; + }); if (_jumpType == -1) queryMiNiDetail(widget.productListBean.id); else if (_jumpType == 0) @@ -276,7 +283,7 @@ class _ShopGoods extends State { }, child:Container( padding: EdgeInsets.only( - left:50.w, + // left:48.w, top: 4.h, bottom: 4.h, ), @@ -285,13 +292,14 @@ class _ShopGoods extends State { text:"${widget?.productListBean?.minQty ?? 0}份起购", textColor: Colors.white, fontWeight: MyFontWeight.medium, - radius: 3, + radius: 11, backgroup: Color(0xFF32A060), fontSize: 11.sp, padding: EdgeInsets.symmetric( - vertical: 5.h, horizontal: 3.w), + vertical:2.h, horizontal:6.w), ), - )), + ));},), + ///选规格 if (!widget.isShopCart && (widget.productListBean?.attrStyle ?? 0) == 1 && !(widget?.productListBean?.subscribeParam @@ -302,15 +310,15 @@ class _ShopGoods extends State { behavior: HitTestBehavior.opaque, onTap: () async { if (widget.storeInfo.posType.code == - "NORMALSTORE" && + "NORMALSTORE" && widget.tableId == 0) { showDeleteDialog(); } else { - widget.queryMiNiDetail( + await widget.queryMiNiDetail( widget.productListBean != null ? widget.productListBean.id : widget.shoppingCartSkuItemListBean - .productId, + .productId, 0); } }, @@ -318,7 +326,6 @@ class _ShopGoods extends State { children: [ Container( padding: EdgeInsets.only( - left: 35.w, top: 4.h, bottom: 4.h, ), @@ -327,11 +334,11 @@ class _ShopGoods extends State { text: S.of(context).xuanguige, textColor: Colors.white, fontWeight: MyFontWeight.medium, - radius: 3, + radius: 11, backgroup: Color(0xFF32A060), fontSize: 11.sp, padding: EdgeInsets.symmetric( - vertical: 5.h, horizontal: 3.w), + vertical:3.h, horizontal:6.w), ), ), Positioned( @@ -352,20 +359,14 @@ class _ShopGoods extends State { ), ], )), - if (widget.isShopCart || - (widget.productListBean?.attrStyle ?? 0) == 0 && - !(widget?.productListBean?.subscribeParam - ?.isEnableSubscribe ?? - false) && - !(widget?.productListBean?.isSetMeal ?? false)) - Spacer(), + ///数量- if (widget.isShopCart || (widget.productListBean?.attrStyle ?? 0) == 0 && (((widget.productListBean?.minQty ?? 0).toInt() > 1 && widget.count != 0) || (widget.productListBean?.minQty ?? 0).toInt() == 0) && !(widget?.productListBean?.subscribeParam ?.isEnableSubscribe ?? false) && - !(widget?.productListBean?.isSetMeal ?? false)) + !(widget?.productListBean?.isSetMeal ?? false) && widget.count != 0) GestureDetector( behavior: HitTestBehavior.opaque, onTap: () async { @@ -380,18 +381,19 @@ class _ShopGoods extends State { padding: EdgeInsets.only(left: 15.w, right: 6.w), child: Image.asset( "assets/image/reduce.webp", - width: 22, + width: 22.h, height: 22.h, ), ), ), + ///数量显示 if (widget.isShopCart || (widget.productListBean?.attrStyle ?? 0) == 0 && (((widget.productListBean?.minQty ?? 0).toInt() > 1 && widget.count != 0) || (widget.productListBean?.minQty ?? 0).toInt() == 0) && !(widget?.productListBean?.subscribeParam ?.isEnableSubscribe ?? false) && - !(widget?.productListBean?.isSetMeal ?? false)) + !(widget?.productListBean?.isSetMeal ?? false) && widget.count != 0) Container( alignment: Alignment.center, child: Text( @@ -403,6 +405,7 @@ class _ShopGoods extends State { ), ), ), + ///数量+ if (widget.isShopCart || (widget.productListBean?.attrStyle ?? 0) == 0 &&(((widget.productListBean?.minQty ?? 0).toInt() > 1 && widget.count != 0) || (widget.productListBean?.minQty ?? 0).toInt() == 0) && @@ -410,45 +413,67 @@ class _ShopGoods extends State { ?.isEnableSubscribe ?? false) && !(widget?.productListBean?.isSetMeal ?? false)) - GestureDetector( - behavior: HitTestBehavior.opaque, - onTap: () async { - if (widget.storeInfo.posType.code == "NORMALSTORE" && - widget.tableId == 0) { - showDeleteDialog(); - } else { - // if ((widget?.productListBean?.oversold ?? 0) == 0 && - // widget.count >= - // (widget?.shoppingCartSkuItemListBean - // ?.skuStock ?? - // 0)) { - // SmartDialog.showToast("库存不足", - // alignment: Alignment.center); - // } else - if (_jumpType == -1) - queryMiNiDetail(widget.productListBean.id); - else if (_jumpType == 0) - widget.add(widget.shoppingCartSkuItemListBean); - else if (_jumpType == 1) - await Navigator.of(context).pushNamed( - '/router/product_meals_sku', - arguments: { - "id": widget.productListBean.id, - "storeId": widget.productListBean.storeId, - "tableId": widget.tableId - }); - widget.queryShoppingCart(); - } + Builder( + builder: (context) { + return GestureDetector( + behavior: HitTestBehavior.opaque, + onTap: () async { + if (widget.storeInfo.posType.code == "NORMALSTORE" && + widget.tableId == 0) { + showDeleteDialog(); + } else { + // if ((widget?.productListBean?.oversold ?? 0) == 0 && + // widget.count >= + // (widget?.shoppingCartSkuItemListBean + // ?.skuStock ?? + // 0)) { + // SmartDialog.showToast("库存不足", + // alignment: Alignment.center); + // } else + /// 点击的时候获取当前 widget 的位置,传入 overlayEntry + var _overlayEntry = OverlayEntry(builder: (_) { + RenderBox box = context.findRenderObject(); + var offset = box.localToGlobal(Offset.zero); + return RedDotPage( + startPosition: offset, + endPosition: widget.endOffset, + ); + }); + // 显示Overlay + Overlay.of(context).insert(_overlayEntry); + // 等待动画结束 + Future.delayed(Duration(milliseconds: 800), () { + _overlayEntry.remove(); + _overlayEntry = null; + }); + if (_jumpType == -1) + queryMiNiDetail(widget.productListBean.id); + else if (_jumpType == 0) + widget.add(widget.shoppingCartSkuItemListBean); + else if (_jumpType == 1) + await Navigator.of(context).pushNamed( + '/router/product_meals_sku', + arguments: { + "id": widget.productListBean.id, + "storeId": widget.productListBean.storeId, + "tableId": widget.tableId + }); + widget.queryShoppingCart(); + } + // Navigator.of(context).pushNamed('/router/goods_list_page'); + }, + child: Container( + padding: EdgeInsets.only(left: 6.w, right: 5.5.w), + child: Image.asset( + "assets/image/add.webp", + width: 22.h, + height: 22.h, + ), + ), + ); }, - child: Container( - padding: EdgeInsets.only(left: 6.w, right: 5.5.w), - child: Image.asset( - "assets/image/add.webp", - width: 22, - height: 22.h, - ), - ), ), + ///立即预约 if ((widget.productListBean.subscribeParam .isEnableSubscribe ?? false) == @@ -474,7 +499,6 @@ class _ShopGoods extends State { }, child: Container( padding: EdgeInsets.only( - left: 35.w, top: 4.h, bottom: 4.h, ), @@ -483,13 +507,14 @@ class _ShopGoods extends State { text: S.of(context).lijiyuyue, textColor: Colors.white, fontWeight: MyFontWeight.medium, - radius: 3, + radius: 11, backgroup: Color(0xFF32A060), fontSize: 11.sp, padding: EdgeInsets.symmetric( - vertical: 5.h, horizontal: 3.w), + vertical:3.h, horizontal:6.w), ), )), + ///选套餐 if ((widget.productListBean.isSetMeal ?? false) == true) GestureDetector( behavior: HitTestBehavior.opaque, @@ -524,7 +549,6 @@ class _ShopGoods extends State { children: [ Container( padding: EdgeInsets.only( - left: 35.w, top: 4.h, bottom: 4.h, ), @@ -533,11 +557,11 @@ class _ShopGoods extends State { text: "选套餐", textColor: Colors.white, fontWeight: MyFontWeight.medium, - radius: 3, + radius: 11, backgroup: Color(0xFF32A060), fontSize: 11.sp, padding: EdgeInsets.symmetric( - vertical: 5.h, horizontal: 3.w), + vertical:3.h, horizontal:6.w), ), ), Positioned( @@ -563,7 +587,6 @@ class _ShopGoods extends State { SizedBox( height: 4.h, ), - ///VIP价格(暂时弃用) // if (widget.productListBean.vipPrice != null) // Row( diff --git a/lib/store/store_view/store_order_list.dart b/lib/store/store_view/store_order_list.dart index efe59f6c..5f9fec2c 100644 --- a/lib/store/store_view/store_order_list.dart +++ b/lib/store/store_view/store_order_list.dart @@ -27,6 +27,7 @@ class StoreOrderListPage extends StatefulWidget { final String minToken; final String tenant; final int tableId; + final Offset _endOffset; final Function(String id, int count) queryMiNiDetail; final Function queryShoppingCart; final ScrollPhysics scrollPhysics; @@ -42,6 +43,7 @@ class StoreOrderListPage extends StatefulWidget { this.minToken, this.tenant, this.tableId, + this._endOffset, this.queryMiNiDetail, this.queryShoppingCart, this.scrollPhysics); @@ -377,6 +379,7 @@ class _StoreOrderListPage extends State { count: count, isShopCart: false, tableId: widget.tableId, + endOffset: widget._endOffset, queryShoppingCart: widget.queryShoppingCart, queryMiNiDetail: widget.queryMiNiDetail, shoppingCartSkuItemListBean: shoppingCartSkuItemListBean, diff --git a/lib/union/union_list.dart b/lib/union/union_list.dart index ba2d2cc1..2d70861b 100644 --- a/lib/union/union_list.dart +++ b/lib/union/union_list.dart @@ -226,8 +226,8 @@ class _UnionList extends State with AutomaticKeepAliveClientMixin { Widget buildStoreItem(Store store, position) { return Container( - margin: EdgeInsets.fromLTRB(16.w, 8.h, 16.w, 12.h), - padding: EdgeInsets.symmetric(horizontal:12.w,vertical: 12.h), + margin: EdgeInsets.fromLTRB(14.w, 16.h, 14.w, 12.h), + padding: EdgeInsets.symmetric(vertical: 12.h,horizontal: 12.w), decoration: BoxDecoration( color: Colors.white, borderRadius: BorderRadius.all(Radius.circular(6)), @@ -240,136 +240,149 @@ class _UnionList extends State with AutomaticKeepAliveClientMixin { ) ]), width: double.infinity, - child: Row( + child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ - Stack( - children: [ - MImage( - store.facade, - width: 74.h, - height: 74.h, - fit: BoxFit.cover, - radius: BorderRadius.circular(6), - errorSrc: "assets/image/default_1.webp", - fadeSrc: "assets/image/default_1.webp", - ), - Container( - decoration: BoxDecoration( - color: Color(0xFF32A060), - borderRadius: BorderRadius.only( - topLeft: Radius.circular(6), - bottomRight: Radius.circular(6), - topRight: Radius.circular(2), - bottomLeft: Radius.circular(2)), - ), - padding: EdgeInsets.symmetric(horizontal: 3.w, vertical: 2.h), - child: Text( - "品牌", - style: TextStyle( - color: Colors.white, - fontSize: 10.sp, - fontWeight: MyFontWeight.regular, - ), - ), - ) - ], - ), - SizedBox( - width: 12.w, - ), - Expanded( - child: Column( - mainAxisAlignment: MainAxisAlignment.start, + Row( crossAxisAlignment: CrossAxisAlignment.start, children: [ - Text( - store?.storeName ?? "", - overflow: TextOverflow.ellipsis, - style: TextStyle( - color: Color(0xFF0D0D0D), - fontSize: 14.sp, - fontWeight: MyFontWeight.bold, - ), - ), - SizedBox(height: 6.h), - Row( + Stack( children: [ - if(store.perCapitaConsumption != null && (store?.perCapitaConsumption ?? "0") != "0") - Padding(padding: EdgeInsets.only(right: 22.w),child:Text( - S.of(context).ren( - store?.perCapitaConsumption ?? "", - ), - style: TextStyle( - color: Color(0xFF4D4D4D), - fontSize: 12.sp, - fontWeight: MyFontWeight.regular, - ), - ),), - if (store.distance != null) - Image.asset( - "assets/image/icon_union_location_black.webp", - fit: BoxFit.fill, - height: 12, - width: 12, + MImage( + store.facade, + width: 74.h, + height: 74.h, + fit: BoxFit.cover, + radius: BorderRadius.circular(6), + errorSrc: "assets/image/default_1.webp", + fadeSrc: "assets/image/default_1.webp", ), - SizedBox(width: 4.w), - if (store.distance != null) - Text( - (store.distance ?? 0) > 1000 - ? S.of(context).gongli( - ((store.distance ?? 0) / 1000 * 100).toInt() / - 100.0) - : S - .of(context) - .mi(((store.distance ?? 0) * 100).toInt() / 100.0), - style: TextStyle( - color: Color(0xFF4D4D4D), - fontSize: 12.sp, + Container( + decoration: BoxDecoration( + color: Color(0xFF32A060), + borderRadius: BorderRadius.only( + topLeft: Radius.circular(6), + bottomRight: Radius.circular(6), + topRight: Radius.circular(2), + bottomLeft: Radius.circular(2)), ), - ), + padding: EdgeInsets.symmetric(horizontal: 3.w, vertical: 2.h), + child: Text( + "品牌", + style: TextStyle( + color: Colors.white, + fontSize: 10.sp, + fontWeight: MyFontWeight.regular, + ), + ), + ) ], ), - SizedBox(height: 10.h), - Row( - children: []..addAll( - itemServer(store != null ? store.businessService : "")), + SizedBox( + width: 11.w, ), - if (storeList[position].productShow != null) - SizedBox(height: store.businessService == "" ? 40.h : 23.h), - if (storeList[position].productShow != null) - Container( - height: 100.h, - child: ListView.builder( - padding: EdgeInsets.zero, - itemCount: - (storeList[position].productShow?.length ?? 0) > 3 - ? 3 - : storeList[position].productShow?.length ?? 0, - scrollDirection: Axis.horizontal, - shrinkWrap: true, - physics:BouncingScrollPhysics(), - itemBuilder: (context, index) { - return GestureDetector( - onTap: () {Navigator.of(context).pushNamed( - '/router/store_order', - arguments: { - "id": storeList[position].id, - "tenant": storeList[position].tenantCode, - "storeName": storeList[position].storeName, - "distance": storeList[position].distance - }, - );}, - child: unionGoodsItem( - storeList[position].productShow[index]), - ); - }, - ), - ), + Expanded( + child: Column( + mainAxisAlignment: MainAxisAlignment.start, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + store?.storeName ?? "", + overflow: TextOverflow.ellipsis, + style: TextStyle( + color: Color(0xFF0D0D0D), + fontSize: 14.sp, + fontWeight: MyFontWeight.bold, + ), + ), + Padding(padding:EdgeInsets.only(left:2.w,top:8.h,bottom:10.h), + child: Row( + children: [ + if(store.perCapitaConsumption != null && (store?.perCapitaConsumption ?? "0") != "0") + Padding(padding: EdgeInsets.only(right: 22.w),child:Text( + S.of(context).ren( + store?.perCapitaConsumption ?? "", + ), + style: TextStyle( + color: Color(0xFF4D4D4D), + fontSize: 12.sp, + fontWeight: MyFontWeight.regular, + ), + ),), + if (store.distance != null) + Image.asset( + "assets/image/icon_union_location_black.webp", + fit: BoxFit.fill, + height: 12, + width: 12, + ), + SizedBox(width: 4.w), + if (store.distance != null) + Text( + (store.distance ?? 0) > 1000 + ? S.of(context).gongli( + ((store.distance ?? 0) / 1000 * 100).toInt() / + 100.0) + : S + .of(context) + .mi(((store.distance ?? 0) * 100).toInt() / 100.0), + style: TextStyle( + color: Color(0xFF4D4D4D), + fontSize: 12.sp, + ), + ), + ], + ),), + Row( + children: []..addAll( + itemServer(store != null ? store.businessService : "")), + ), + if (storeList[position].productShow != null) + SizedBox(height: store.businessService == "" ? 40.h : 23.h), + ], + )) ], - )) - ], - ), + ), + if (storeList[position].productShow != null) + Row( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Expanded(child: unionItem(position,0)), + SizedBox(width:16.w), + Expanded(child: unionItem(position,1)), + SizedBox(width:16.w), + Expanded(child: unionItem(position,2)), + ], + ) + // Container( + // height: 150.h, + // child: ListView.builder( + // padding: EdgeInsets.zero, + // itemCount: + // (storeList[position].productShow?.length ?? 0) > 3 + // ? 3 + // : storeList[position].productShow?.length ?? 0, + // scrollDirection: Axis.horizontal, + // shrinkWrap: true, + // physics:BouncingScrollPhysics(), + // itemBuilder: (context, index) { + // return GestureDetector( + // onTap: () {Navigator.of(context).pushNamed( + // '/router/store_order', + // arguments: { + // "id": storeList[position].id, + // "tenant": storeList[position].tenantCode, + // "storeName": storeList[position].storeName, + // "distance": storeList[position].distance + // }, + // );}, + // child: unionGoodsItem( + // storeList[position].productShow[index]), + // ); + // }, + // ), + // ), + ],), ); } @@ -394,38 +407,177 @@ class _UnionList extends State with AutomaticKeepAliveClientMixin { )) .toList(); } - - Widget unionGoodsItem(ProductShow productShow) { - return Container( - width: 74.h, - margin: EdgeInsets.only(right: 8.w), - child: Column( - mainAxisAlignment: MainAxisAlignment.spaceAround, - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - MImage( - productShow?.imgs[0] ?? "", - width: 74.h, - height: 74.h, - fit: BoxFit.cover, - radius: BorderRadius.circular(4), - errorSrc: "assets/image/default_1.webp", - fadeSrc: "assets/image/default_1.webp", + + Widget unionItem(int position,int unionIndex) { + return Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + MImage( + storeList[position].productShow[unionIndex]?.imgs[0] ?? "", + width:double.infinity, + height:97.w, + fit: BoxFit.cover, + radius: BorderRadius.circular(4), + errorSrc: "assets/image/default_1.webp", + fadeSrc: "assets/image/default_1.webp", + ), + Padding( + padding: EdgeInsets.only(top: 8.h,bottom:6.h), + child: Text( + storeList[position].productShow[unionIndex]?.productName ?? "", + overflow: TextOverflow.ellipsis, + style: TextStyle( + color: Color(0xFF0D0D0D), + fontSize: 12.sp, + fontWeight: MyFontWeight.regular, + ), ), - Padding( - padding: EdgeInsets.only(top: 8.h), - child: Text( - productShow?.productName ?? "", - overflow: TextOverflow.ellipsis, - style: TextStyle( - color: Color(0xFFA29E9E), - fontSize: 12.sp, - fontWeight: MyFontWeight.regular, + ), + Row( + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + Padding(padding:EdgeInsets.only(right:2.w), + child: Text.rich( + TextSpan( + children: [ + TextSpan( + text: "¥", + style: TextStyle( + fontWeight: FontWeight.bold, + fontSize:12.sp, + color: Color(0xFFF65720), + ), + ), + TextSpan( + text:"${(storeList[position].productShow[unionIndex]?.price ?? "").split(".")[0]}", + style: TextStyle( + fontWeight: FontWeight.bold, + fontSize: 16.sp, + color: Color(0xFFF65720), + ), + ), + if(storeList[position].productShow[unionIndex].price.contains(".")) + TextSpan( + text:".", + style: TextStyle( + fontWeight: FontWeight.bold, + fontSize: 16.sp, + color: Color(0xFFF65720), + ), + ), + if(storeList[position].productShow[unionIndex].price.contains(".")) + TextSpan( + text:(storeList[position].productShow[unionIndex]?.price ?? "").split(".")[1], + style: TextStyle( + fontWeight: FontWeight.bold, + fontSize:12.sp, + color: Color(0xFFF65720), + ), + ), + ], + ), + textDirection: TextDirection.ltr, + ),), + Text( + "¥${storeList[position].productShow[unionIndex]?.applyPrice ?? ""}", + overflow: TextOverflow.ellipsis, + style: TextStyle( + color: Color(0xFFA29E9E), + fontSize: 10.sp, + fontWeight: MyFontWeight.regular, + decoration: TextDecoration.lineThrough, + decorationColor: Color(0xFFA29E9E), + ), ), + ]) + ], + ); + } + + Widget unionGoodsItem(ProductShow productShow) { + return Column( + mainAxisAlignment: MainAxisAlignment.spaceAround, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + MImage( + productShow?.imgs[0] ?? "", + width: 97.h, + height: 97.h, + fit: BoxFit.cover, + radius: BorderRadius.circular(4), + errorSrc: "assets/image/default_1.webp", + fadeSrc: "assets/image/default_1.webp", + ), + Padding( + padding: EdgeInsets.only(top: 8.h,bottom:6.h), + child: Text( + productShow?.productName ?? "", + overflow: TextOverflow.ellipsis, + style: TextStyle( + color: Color(0xFF0D0D0D), + fontSize: 12.sp, + fontWeight: MyFontWeight.regular, ), ), - ], - ), + ), + Expanded(child:Row( + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + Padding(padding:EdgeInsets.only(right:2.w), + child: Text.rich( + TextSpan( + children: [ + TextSpan( + text: "¥", + style: TextStyle( + fontWeight: FontWeight.bold, + fontSize:12.sp, + color: Color(0xFFF65720), + ), + ), + TextSpan( + text:"${(productShow?.price ?? "").split(".")[0]}", + style: TextStyle( + fontWeight: FontWeight.bold, + fontSize: 16.sp, + color: Color(0xFFF65720), + ), + ), + if(productShow.price.contains(".")) + TextSpan( + text:".", + style: TextStyle( + fontWeight: FontWeight.bold, + fontSize: 16.sp, + color: Color(0xFFF65720), + ), + ), + if(productShow.price.contains(".")) + TextSpan( + text:(productShow?.price ?? "").split(".")[1], + style: TextStyle( + fontWeight: FontWeight.bold, + fontSize:12.sp, + color: Color(0xFFF65720), + ), + ), + ], + ), + textDirection: TextDirection.ltr, + ),), + Text( + "¥${productShow?.applyPrice ?? ""}", + overflow: TextOverflow.ellipsis, + style: TextStyle( + color: Color(0xFFA29E9E), + fontSize: 10.sp, + fontWeight: MyFontWeight.regular, + decoration: TextDecoration.lineThrough, + decorationColor: Color(0xFFA29E9E), + ), + ), + ])) + ], ); } diff --git a/lib/view_widget/coupon_details_dialog.dart b/lib/view_widget/coupon_details_dialog.dart index 663ec786..fd5a96ad 100644 --- a/lib/view_widget/coupon_details_dialog.dart +++ b/lib/view_widget/coupon_details_dialog.dart @@ -41,13 +41,13 @@ class _CouponDetailsWidget extends State { crossAxisAlignment: CrossAxisAlignment.start, children: [ Row( - mainAxisAlignment: MainAxisAlignment.start, + mainAxisAlignment: MainAxisAlignment.spaceEvenly, crossAxisAlignment: CrossAxisAlignment.center, children: [ Expanded( child: Container( alignment: Alignment.center, - margin: EdgeInsets.symmetric(vertical: 12), + margin: EdgeInsets.only(top: 12.h,bottom: 12.h,left:32.w), child: Text( S.of(context).shiyongxiangqing, style: TextStyle( diff --git a/lib/view_widget/my_appbar.dart b/lib/view_widget/my_appbar.dart index 36f55441..4cbb09fb 100644 --- a/lib/view_widget/my_appbar.dart +++ b/lib/view_widget/my_appbar.dart @@ -93,7 +93,7 @@ class MyAppBar extends StatelessWidget implements PreferredSizeWidget { }, child: Container( width: double.infinity, - margin: EdgeInsets.only(right:34.w), + margin: EdgeInsets.only(right:50.w), padding: EdgeInsets.all(10), alignment: Alignment.center, child: Text( diff --git a/lib/view_widget/recharge_details_dialog.dart b/lib/view_widget/recharge_details_dialog.dart index aa93077e..612a1edb 100644 --- a/lib/view_widget/recharge_details_dialog.dart +++ b/lib/view_widget/recharge_details_dialog.dart @@ -38,7 +38,7 @@ class _RechargeWidget extends State { children: [ Expanded(child: Container( - margin: EdgeInsets.symmetric(vertical: 12.h), + margin: EdgeInsets.only(top: 12.h,bottom: 12.h,left: 32.w), alignment: Alignment.center, child: Text( "充值说明", diff --git a/lib/view_widget/selector_store_dialog.dart b/lib/view_widget/selector_store_dialog.dart index 8aefc7b0..97f52a7a 100644 --- a/lib/view_widget/selector_store_dialog.dart +++ b/lib/view_widget/selector_store_dialog.dart @@ -56,7 +56,7 @@ class _SelectorStoreWidget extends State { Expanded( child: Container( alignment: Alignment.center, - margin: EdgeInsets.symmetric(vertical: 12), + margin: EdgeInsets.only(top: 12.h,bottom: 12.h,left: 32.w), child: Text( S.of(context).qingxuanzeshiyongmendian, style: TextStyle(