diff --git a/assets/image/2x/home_lm.webp b/assets/image/2x/home_lm.webp index 8f7b28df..501dcebd 100644 Binary files a/assets/image/2x/home_lm.webp and b/assets/image/2x/home_lm.webp differ diff --git a/assets/image/2x/home_recharge.webp b/assets/image/2x/home_recharge.webp index 154d654f..eba2ce11 100644 Binary files a/assets/image/2x/home_recharge.webp and b/assets/image/2x/home_recharge.webp differ diff --git a/assets/image/2x/home_welfare.webp b/assets/image/2x/home_welfare.webp index daa3b646..0eeab06a 100644 Binary files a/assets/image/2x/home_welfare.webp and b/assets/image/2x/home_welfare.webp differ diff --git a/assets/image/3x/home_lm.webp b/assets/image/3x/home_lm.webp index f08d09f8..fb796300 100644 Binary files a/assets/image/3x/home_lm.webp and b/assets/image/3x/home_lm.webp differ diff --git a/assets/image/3x/home_recharge.webp b/assets/image/3x/home_recharge.webp index d90ee0f4..27f39a25 100644 Binary files a/assets/image/3x/home_recharge.webp and b/assets/image/3x/home_recharge.webp differ diff --git a/assets/image/3x/home_welfare.webp b/assets/image/3x/home_welfare.webp index 06b2d229..151efea7 100644 Binary files a/assets/image/3x/home_welfare.webp and b/assets/image/3x/home_welfare.webp differ diff --git a/assets/image/home_lm.webp b/assets/image/home_lm.webp index 7997a2e9..2421ec84 100644 Binary files a/assets/image/home_lm.webp and b/assets/image/home_lm.webp differ diff --git a/assets/image/home_recharge.webp b/assets/image/home_recharge.webp index b750d260..ad7cc03c 100644 Binary files a/assets/image/home_recharge.webp and b/assets/image/home_recharge.webp differ diff --git a/assets/image/home_welfare.webp b/assets/image/home_welfare.webp index d73472aa..da506e31 100644 Binary files a/assets/image/home_welfare.webp and b/assets/image/home_welfare.webp differ diff --git a/lib/community/community_view/class_details_video.dart b/lib/community/community_view/class_details_video.dart index 752880f8..11fdf1a6 100644 --- a/lib/community/community_view/class_details_video.dart +++ b/lib/community/community_view/class_details_video.dart @@ -96,7 +96,7 @@ class ClassDetailsVideoState extends State { @override Widget build(BuildContext context) { return Container( - key: globalKey,child:(videoPlayerController?.value?.isInitialized ?? false) ?videoWidget( + key: globalKey,child:(videoPlayerController?.value?.isInitialized ?? false) ? videoWidget( MediaQuery.of(context).size.height, (MediaQuery.of(context).size.height/videoPlayerController.value.aspectRatio)-43, widget.coverImg, diff --git a/lib/home/home_view/discount_zone.dart b/lib/home/home_view/discount_zone.dart index 2aef255f..35b99c66 100644 --- a/lib/home/home_view/discount_zone.dart +++ b/lib/home/home_view/discount_zone.dart @@ -35,7 +35,7 @@ class _DiscountZone extends State { Widget build(BuildContext context) { return Container( width: double.infinity, - margin: EdgeInsets.only(top: 24.h), + margin: EdgeInsets.only(top: 14.h), child: Column( crossAxisAlignment: CrossAxisAlignment.start, mainAxisAlignment: MainAxisAlignment.start, diff --git a/lib/home/home_view/home_banner.dart b/lib/home/home_view/home_banner.dart index d3270268..dd191bca 100644 --- a/lib/home/home_view/home_banner.dart +++ b/lib/home/home_view/home_banner.dart @@ -23,7 +23,7 @@ class _HomeBanner extends State { Widget build(BuildContext context) { return Container( child: AspectRatio( - aspectRatio: 375/230, + aspectRatio: 375/300, child: Swiper( pagination: SwiperPagination( margin: EdgeInsets.only(bottom: 12.h), diff --git a/lib/home/home_view/home_recommend_goods.dart b/lib/home/home_view/home_recommend_goods.dart index 7f36da79..aa876b8c 100644 --- a/lib/home/home_view/home_recommend_goods.dart +++ b/lib/home/home_view/home_recommend_goods.dart @@ -47,7 +47,7 @@ class _HomeRecommendGoods extends State { color: Colors.white, ), margin: EdgeInsets.only( - left: 14.w, right: 14.w, top: 14.h, bottom: 24.h), + left: 14.w, right: 14.w, top: 14.h, bottom: 14.h), child: ListView.builder( scrollDirection: Axis.horizontal, physics: BouncingScrollPhysics(), diff --git a/lib/home/home_view/shortcut_operation.dart b/lib/home/home_view/shortcut_operation.dart index 1ff402db..5609e15c 100644 --- a/lib/home/home_view/shortcut_operation.dart +++ b/lib/home/home_view/shortcut_operation.dart @@ -24,93 +24,108 @@ class _ShortcutOperation extends State { super.initState(); } - @override Widget build(BuildContext context) { return Container( - height: 80.h, - width: double.infinity, - margin: EdgeInsets.only(bottom:15.h,left: 10.w,right: 10.w), - child: Row( - crossAxisAlignment: CrossAxisAlignment.center, - mainAxisAlignment: MainAxisAlignment.center, - children: [ - Expanded(child:GestureDetector( - onTap: (){ - widget.goToOrder(0); - }, - child: Container( - width: double.infinity, - margin: EdgeInsets.symmetric(horizontal:5), - padding: EdgeInsets.all(10.h), - decoration: BoxDecoration( - color: Colors.white, - boxShadow: [ - BoxShadow( - color: Colors.black.withAlpha(12), - offset: Offset(0, 3), - blurRadius: 14, - spreadRadius: 0, - ) - ], - borderRadius: BorderRadius.circular(4), - ), - child: Row( - mainAxisAlignment: MainAxisAlignment.center, - crossAxisAlignment: CrossAxisAlignment.center, - children: [ - Column( - mainAxisAlignment: MainAxisAlignment.center, - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Text( - "联盟", - style: TextStyle( - fontWeight: MyFontWeight.semi_bold, - fontSize: 14.sp, - color: Color(0xFF0D0D0D), - ), + height: 70.h, + width: double.infinity, + margin: EdgeInsets.only(bottom: 15.h, left: 9.w, right: 9.w), + child: Row( + crossAxisAlignment: CrossAxisAlignment.center, + mainAxisAlignment: MainAxisAlignment.center, + children: [ + Expanded( + child: GestureDetector( + onTap: () { + widget.goToOrder(0); + }, + child: Container( + width: double.infinity, + margin: EdgeInsets.symmetric(horizontal: 5), + padding: EdgeInsets.all(10.h), + decoration: BoxDecoration( + gradient: new LinearGradient( + begin: Alignment.centerLeft, + end: Alignment.centerRight, + colors: [ + Color(0xFFD1E8D9), + Color(0xFFE4F7EA), + ]), + boxShadow: [ + BoxShadow( + color: Colors.black.withAlpha(12), + offset: Offset(0, 2), + blurRadius: 4, + spreadRadius: 1, + ) + ], + borderRadius: BorderRadius.circular(6), + ), + child: Row( + mainAxisAlignment: MainAxisAlignment.center, + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + Column( + mainAxisAlignment: MainAxisAlignment.center, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + "联盟", + style: TextStyle( + fontWeight: MyFontWeight.semi_bold, + fontSize: 14.sp, + color: Color(0xFF32A060), ), - SizedBox(height:5.h), - Text( - "下单赚积分", - style: TextStyle( - fontWeight: MyFontWeight.regular, - fontSize: 12.sp, - color: Color(0xFF4D4D4D), - ), + ), + SizedBox(height: 5.h), + Text( + "下单赚积分", + style: TextStyle( + fontWeight: MyFontWeight.regular, + fontSize: 12.sp, + color: Color(0xFF61836F), ), - ], - ), - SizedBox(width: 3.w), - Expanded(child: Image.asset( + ), + ], + ), + SizedBox(width: 3.w), + Expanded( + child: Image.asset( "assets/image/home_lm.webp", - width:36.w, - height:36.h, - ),), - ], - ), + width: 36.w, + height: 36.h, + ), + ), + ], ), - ) ), - Expanded(child:GestureDetector( - onTap: (){ + ), + )), + Expanded( + child: GestureDetector( + onTap: () { Navigator.of(context).pushNamed('/router/recharge_page'); }, child: Container( width: double.infinity, - margin: EdgeInsets.symmetric(horizontal:5.w), + margin: EdgeInsets.symmetric(horizontal: 5.w), padding: EdgeInsets.all(10.h), decoration: BoxDecoration( - color: Colors.white, + gradient: new LinearGradient( + begin: Alignment.centerLeft, + end: Alignment.centerRight, + colors: [ + Color(0xFFFAEDCB), + Color(0xFFFAF4E2), + ]), boxShadow: [ BoxShadow( color: Colors.black.withAlpha(12), - offset: Offset(0, 3), - blurRadius: 14, - spreadRadius: 0, + offset: Offset(0, 2), + blurRadius: 4, + spreadRadius: 1, ) ], - borderRadius: BorderRadius.circular(4.r), + borderRadius: BorderRadius.circular(6.r), ), child: Row( mainAxisAlignment: MainAxisAlignment.center, @@ -125,7 +140,7 @@ class _ShortcutOperation extends State { style: TextStyle( fontWeight: MyFontWeight.semi_bold, fontSize: 14.sp, - color: Color(0xFF0D0D0D), + color: Color(0xFFFFBA1B), ), ), SizedBox(height: 5.h), @@ -134,41 +149,51 @@ class _ShortcutOperation extends State { style: TextStyle( fontWeight: MyFontWeight.regular, fontSize: 12.sp, - color: Color(0xFF4D4D4D), + color: Color(0xFFA59162), ), ), ], ), SizedBox(width: 3.w), - Expanded(child: Image.asset( - "assets/image/home_recharge.webp", - width:36.w, - height:36.h, - ),), + Expanded( + child: Image.asset( + "assets/image/home_recharge.webp", + width: 36.w, + height: 36.h, + ), + ), ], ), ), - ), ), - Expanded(child: GestureDetector( - onTap: (){ + ), + ), + Expanded( + child: GestureDetector( + onTap: () { // Navigator.of(context).pushNamed('/router/roll_center_page'); Navigator.of(context).pushNamed('/router/welfare_page'); }, - child:Container( + child: Container( width: double.infinity, - margin: EdgeInsets.symmetric(horizontal:5.w), + margin: EdgeInsets.symmetric(horizontal: 5.w), padding: EdgeInsets.all(10.h), decoration: BoxDecoration( - color: Colors.white, + gradient: new LinearGradient( + begin: Alignment.centerLeft, + end: Alignment.centerRight, + colors: [ + Color(0xFFFAE5CB), + Color(0xFFFAF1E4), + ]), boxShadow: [ BoxShadow( color: Colors.black.withAlpha(12), - offset: Offset(0, 3), - blurRadius: 14, - spreadRadius: 0, + offset: Offset(0, 2), + blurRadius: 4, + spreadRadius: 1, ) ], - borderRadius: BorderRadius.circular(4.r), + borderRadius: BorderRadius.circular(6.r), ), child: Row( mainAxisAlignment: MainAxisAlignment.center, @@ -183,7 +208,7 @@ class _ShortcutOperation extends State { style: TextStyle( fontWeight: MyFontWeight.semi_bold, fontSize: 14.sp, - color: Color(0xFF0D0D0D), + color: Color(0xFFFF910F), ), ), SizedBox(height: 5.h), @@ -192,24 +217,26 @@ class _ShortcutOperation extends State { style: TextStyle( fontWeight: MyFontWeight.regular, fontSize: 12.sp, - color: Color(0xFF4D4D4D), + color: Color(0xFF89755D), ), ), ], ), SizedBox(width: 3.w), - Expanded(child: Image.asset( - "assets/image/home_welfare.webp", - width:36.w, - height:36.h, - ),), + Expanded( + child: Image.asset( + "assets/image/home_welfare.webp", + width: 36.w, + height: 36.h, + ), + ), ], ), ), - ),), - ], - ), - ); + ), + ), + ], + ), + ); } - } diff --git a/lib/home/home_view/top_selling_list.dart b/lib/home/home_view/top_selling_list.dart index 853ca4a1..14d73261 100644 --- a/lib/home/home_view/top_selling_list.dart +++ b/lib/home/home_view/top_selling_list.dart @@ -44,7 +44,7 @@ class _TopSellingList extends State { fit: BoxFit.cover, ), ), - margin: EdgeInsets.only(left: 14.w,right: 14.w,top: 12.h,bottom: 23.h), + margin: EdgeInsets.only(left: 14.w,right: 14.w,bottom: 14.h), padding: EdgeInsets.only(left: 12.w,top: 16.h), child: Column( crossAxisAlignment: CrossAxisAlignment.start, diff --git a/lib/home/home_view/union_entry.dart b/lib/home/home_view/union_entry.dart index 48dee0be..d090691f 100644 --- a/lib/home/home_view/union_entry.dart +++ b/lib/home/home_view/union_entry.dart @@ -30,7 +30,19 @@ class _UnionEntry extends State { return Container( height: 130.h, width: double.infinity, - margin: EdgeInsets.only(bottom:10.h,left: 10.w,right: 10.w,top: 14.h), + margin: EdgeInsets.all(14.h), + decoration: BoxDecoration( + color: Color(0xFFFFFFFF), + boxShadow: [ + BoxShadow( + color: Colors.black.withAlpha(12), + offset: Offset(0, 3), + blurRadius: 14, + spreadRadius: 0, + ) + ], + borderRadius: BorderRadius.circular(6.r), + ), child: Row( crossAxisAlignment: CrossAxisAlignment.center, mainAxisAlignment: MainAxisAlignment.center, @@ -39,129 +51,78 @@ class _UnionEntry extends State { onTap: (){ widget.goToOrder(1); }, - child: Container( - width: double.infinity, - margin: EdgeInsets.symmetric(horizontal:5.w), - padding: EdgeInsets.symmetric(vertical:12.h), - decoration: BoxDecoration( - color: Colors.white, - boxShadow: [ - BoxShadow( - color: Colors.black.withAlpha(12), - offset: Offset(0, 3), - blurRadius: 14, - spreadRadius: 0, - ) - ], - borderRadius: BorderRadius.circular(6.r), - ), - child: Column( - crossAxisAlignment: CrossAxisAlignment.center, - mainAxisAlignment: MainAxisAlignment.center, - children: [ - Image.asset( - "assets/image/home_chi.webp", - fit: BoxFit.cover, - width: 60.w, - height: 60.h, + child: Column( + crossAxisAlignment: CrossAxisAlignment.center, + mainAxisAlignment: MainAxisAlignment.center, + children: [ + Image.asset( + "assets/image/home_chi.webp", + fit: BoxFit.cover, + width: 60.w, + height: 60.h, + ), + SizedBox(height:4.h), + Text( + "吃健康", + style: TextStyle( + fontWeight: MyFontWeight.medium, + fontSize: 15.sp, + color: Color(0xFF0D0D0D), ), - SizedBox(height:4.h), - Text( - "吃健康", - style: TextStyle( - fontWeight: MyFontWeight.medium, - fontSize: 15.sp, - color: Color(0xFF0D0D0D), - ), - ), - ], - ), + ), + ], ), ) ), Expanded(child:GestureDetector( onTap: (){ widget.goToOrder(2); }, - child: Container( - width: double.infinity, - margin: EdgeInsets.symmetric(horizontal:5.w), - // padding: EdgeInsets.symmetric(vertical:12.h), - decoration: BoxDecoration( - color: Colors.white, - boxShadow: [ - BoxShadow( - color: Colors.black.withAlpha(12), - offset: Offset(0, 3), - blurRadius: 14, - spreadRadius: 0, - ) - ], - borderRadius: BorderRadius.circular(6.r), - ), - child: Column( - crossAxisAlignment: CrossAxisAlignment.center, - mainAxisAlignment: MainAxisAlignment.center, - children: [ - Image.asset( - "assets/image/home_he.webp", - fit: BoxFit.cover, - width: 60.w, - height: 60.h, - ), - SizedBox(height:4.h), - Text( - "喝健康", - style: TextStyle( - fontWeight: MyFontWeight.medium, - fontSize: 15.sp, - color: Color(0xFF0D0D0D), - ), + child: Column( + crossAxisAlignment: CrossAxisAlignment.center, + mainAxisAlignment: MainAxisAlignment.center, + children: [ + Image.asset( + "assets/image/home_he.webp", + fit: BoxFit.cover, + width: 60.w, + height: 60.h, + ), + SizedBox(height:4.h), + Text( + "喝健康", + style: TextStyle( + fontWeight: MyFontWeight.medium, + fontSize: 15.sp, + color: Color(0xFF0D0D0D), ), - ], - ), + ), + ], ), ) ), Expanded(child: GestureDetector( onTap: (){ widget.goToOrder(3); }, - child: Container( - width: double.infinity, - margin: EdgeInsets.symmetric(horizontal:5.w), - padding: EdgeInsets.symmetric(vertical:12.h), - decoration: BoxDecoration( - color: Colors.white, - boxShadow: [ - BoxShadow( - color: Colors.black.withAlpha(12), - offset: Offset(0, 3), - blurRadius: 14, - spreadRadius: 0, - ) - ], - borderRadius: BorderRadius.circular(6.r), - ), - child: Column( - crossAxisAlignment: CrossAxisAlignment.center, - mainAxisAlignment: MainAxisAlignment.center, - children: [ - Image.asset( - "assets/image/home_wan.webp", - fit: BoxFit.cover, - width: 60.w, - height: 60.h, - ), - SizedBox(height:4.h), - Text( - "玩健康", - style: TextStyle( - fontWeight: MyFontWeight.medium, - fontSize: 15.sp, - color: Color(0xFF0D0D0D), - ), + child:Column( + crossAxisAlignment: CrossAxisAlignment.center, + mainAxisAlignment: MainAxisAlignment.center, + children: [ + Image.asset( + "assets/image/home_wan.webp", + fit: BoxFit.cover, + width: 60.w, + height: 60.h, + ), + SizedBox(height:4.h), + Text( + "玩健康", + style: TextStyle( + fontWeight: MyFontWeight.medium, + fontSize: 15.sp, + color: Color(0xFF0D0D0D), ), - ], - ), + ), + ], ), )), ], diff --git a/lib/home/home_view/welfare_core.dart b/lib/home/home_view/welfare_core.dart index 35a937ad..29c252ce 100644 --- a/lib/home/home_view/welfare_core.dart +++ b/lib/home/home_view/welfare_core.dart @@ -60,7 +60,7 @@ class _WelfareCore extends State { ),), Container( width: double.infinity, - margin: EdgeInsets.only(left:9.w,right: 9.w,top: 16.h,bottom: 12.h), + margin: EdgeInsets.only(left:10.w,right: 10.w,top: 14.h,bottom: 14.h), child: Row( mainAxisAlignment: MainAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start, diff --git a/lib/home/points_mall_view/points_goods_view.dart b/lib/home/points_mall_view/points_goods_view.dart index 4743515c..60be2792 100644 --- a/lib/home/points_mall_view/points_goods_view.dart +++ b/lib/home/points_mall_view/points_goods_view.dart @@ -5,6 +5,7 @@ import 'package:huixiang/utils/flutter_utils.dart'; import 'package:huixiang/utils/font_weight.dart'; import 'package:huixiang/view_widget/custom_image.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart'; +import 'package:huixiang/view_widget/no_data_view.dart'; class PointGoods extends StatefulWidget { final List goods; @@ -19,50 +20,64 @@ class PointGoods extends StatefulWidget { } class _PointGoods extends State { - String pointPrice(Goods goods){ - if(goods == null) - return ""; - if(goods?.onePrice!=null && goods?.onePrice!="0"){ + String pointPrice(Goods goods) { + if (goods == null) return ""; + if (goods?.onePrice != null && goods?.onePrice != "0") { return S.of(context).jifen_(goods?.onePrice); - }else if((goods?.onePrice == null || goods?.onePrice == "0") && ((goods?.price != null && goods?.price != "0") || (goods?.money != null && goods?.money != "0.00"))){ - return (goods?.price== "0"|| goods?.price == null ? "" : S.of(context).jifen_(goods?.price)) + (goods?.money== "0"|| goods?.money == null ? "" : " + ${AppUtils.calculateDouble(double.tryParse(goods?.money) ?? 0)}元"); - }else if(goods.oneMoney != null && goods.oneMoney != "0.00"){ + } else if ((goods?.onePrice == null || goods?.onePrice == "0") && + ((goods?.price != null && goods?.price != "0") || + (goods?.money != null && goods?.money != "0.00"))) { + return (goods?.price == "0" || goods?.price == null + ? "" + : S.of(context).jifen_(goods?.price)) + + (goods?.money == "0" || goods?.money == null + ? "" + : " + ${AppUtils.calculateDouble(double.tryParse(goods?.money) ?? 0)}元"); + } else if (goods.oneMoney != null && goods.oneMoney != "0.00") { return "${AppUtils.calculateDouble(double.tryParse(goods.oneMoney) ?? 0)}元"; } } @override Widget build(BuildContext context) { - return GridView.builder( - itemCount: widget.goods == null ? 0 : widget.goods.length, - padding: EdgeInsets.only( - left: 16.w, - right: 16.w, - top: 18.h, - bottom: 16.h, - ), - shrinkWrap: true, - physics: NeverScrollableScrollPhysics(), - gridDelegate: SliverGridDelegateWithFixedCrossAxisCount( - //一行的Widget数量 - crossAxisCount: 2, - //水平子Widget之间间距 - crossAxisSpacing: 11.w, - //垂直子Widget之间间距 - mainAxisSpacing: 16.w, - //子Widget宽高比例 0.59 - childAspectRatio: - 200 / (286 / 2 + (286 / 2) * AppUtils.textScale(context)), - ), - itemBuilder: (context, index) { - return GestureDetector( - onTap: () { - widget.onTap(index); - }, - child: buildItem(widget.goods[index]), - ); - }, - ); + return (widget.goods == null || widget.goods.length == 0) + ? NoDataView( + src: "assets/image/xiao_fei.webp", + isShowBtn: false, + text: "当前分类暂无商品", + fontSize: 16.sp, + margin: EdgeInsets.all(60.h), + ) + : GridView.builder( + itemCount: widget.goods == null ? 0 : widget.goods.length, + padding: EdgeInsets.only( + left: 16.w, + right: 16.w, + top: 18.h, + bottom: 16.h, + ), + shrinkWrap: true, + physics: NeverScrollableScrollPhysics(), + gridDelegate: SliverGridDelegateWithFixedCrossAxisCount( + //一行的Widget数量 + crossAxisCount: 2, + //水平子Widget之间间距 + crossAxisSpacing: 11.w, + //垂直子Widget之间间距 + mainAxisSpacing: 16.w, + //子Widget宽高比例 0.59 + childAspectRatio: + 200 / (266 / 2 + (266 / 2) * AppUtils.textScale(context)), + ), + itemBuilder: (context, index) { + return GestureDetector( + onTap: () { + widget.onTap(index); + }, + child: buildItem(widget.goods[index]), + ); + }, + ); } Widget buildItem(Goods goods) { @@ -91,7 +106,7 @@ class _PointGoods extends State { children: [ MImage( goods.mainImgPath, - aspectRatio: 158/158, + aspectRatio: 158 / 158, radius: BorderRadius.only( topLeft: Radius.circular(6), topRight: Radius.circular(6), @@ -111,17 +126,20 @@ class _PointGoods extends State { mainAxisAlignment: MainAxisAlignment.spaceAround, crossAxisAlignment: CrossAxisAlignment.start, children: [ - Expanded(child: Text( + Expanded( + child: Text( goods.name, overflow: TextOverflow.ellipsis, - maxLines: 2, + maxLines: 1, style: TextStyle( color: Color(0xff353535), fontWeight: MyFontWeight.medium, fontSize: 15.sp, ), )), - SizedBox(height: 5.h,), + SizedBox( + height: 5.h, + ), Column( mainAxisAlignment: MainAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start, diff --git a/lib/home/welfare_exchange.dart b/lib/home/welfare_exchange.dart index fd096098..36a286ca 100644 --- a/lib/home/welfare_exchange.dart +++ b/lib/home/welfare_exchange.dart @@ -16,8 +16,10 @@ import 'package:huixiang/utils/font_weight.dart'; import 'package:huixiang/view_widget/classic_header.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:huixiang/view_widget/custom_image.dart'; +import 'package:huixiang/view_widget/item_title.dart'; import 'package:huixiang/view_widget/my_appbar.dart'; import 'package:huixiang/view_widget/my_footer.dart'; +import 'package:huixiang/view_widget/my_tab.dart'; import 'package:huixiang/view_widget/no_data_view.dart'; import 'package:pull_to_refresh/pull_to_refresh.dart'; import 'package:shared_preferences/shared_preferences.dart'; @@ -34,8 +36,10 @@ class _WelfareExchange extends State { final ScrollController scrollController = ScrollController(); final RefreshController refreshController = RefreshController(); int pageNum = 1; + //排序类型枚举:1-自然排序,2-销量,3-价格 int orderType = 1; + //是否降序排列 bool orderDesc = true; List goods = []; @@ -43,6 +47,12 @@ class _WelfareExchange extends State { List gooodsCategorys = []; UserInfo userInfo; String categoryId; + var _itemText = S.current.morenpaixu; + List sortString = [ + S.current.morenpaixu, + S.current.jifengaodaodi, + S.current.jifendidaogao, + ]; @override void dispose() { @@ -65,6 +75,7 @@ class _WelfareExchange extends State { await apiService.queryInfo().catchError((onError) {}); if (baseData != null && baseData.isSuccess) { userInfo = baseData.data; + setState(() {}); SharedPreferences.getInstance().then((value) => { value.setString('user', jsonEncode(baseData.data)), }); @@ -95,7 +106,7 @@ class _WelfareExchange extends State { } BaseData> dataCategory = - await apiService.goodsCategory({ + await apiService.goodsCategory({ "current": 1, "map": {}, "model": {"pageNum": 1, "pageSize": 20, "searchKey": ""}, @@ -126,7 +137,7 @@ class _WelfareExchange extends State { "state": 1 }; BaseData> pageGoods = - await apiService.creditGoods(param).catchError((onError) { + await apiService.creditGoods(param).catchError((onError) { refreshController.loadFailed(); refreshController.refreshFailed(); }); @@ -147,6 +158,7 @@ class _WelfareExchange extends State { refreshController.loadFailed(); refreshController.refreshFailed(); } + setState(() {}); } _onRefresh() { @@ -155,102 +167,119 @@ class _WelfareExchange extends State { @override Widget build(BuildContext context) { - return Container( - color: Color(0xFFF7F7F7), - child: Stack( - children: [ - Container( - // padding: EdgeInsets.only(top: 40.h), - height: 172.h, - decoration: BoxDecoration( - // border: Border.all(color: Colors.white,width: 0.5), - color: Color(0xFF277D4B), - shape: BoxShape.rectangle, - borderRadius: BorderRadius.only( - bottomRight: Radius.circular(40), - bottomLeft: Radius.circular(40), + return Scaffold( + backgroundColor: Colors.transparent, + body: NestedScrollView( + headerSliverBuilder: (context, inner) { + return [ + SliverAppBar( + pinned: true, + backgroundColor: Colors.white, + elevation: 0, + title: Text( + "福利兑换", + style: + TextStyle(fontWeight: FontWeight.w500, color: Colors.white), ), - ), - // child: ClipPath( - // 只裁切底部的方法 - // clipper: BottonClipper(), - // child: Container( - // color: Colors.deepOrange, - // height: 300, - // ), - // ), - ), - Scaffold( - backgroundColor: Colors.transparent, - appBar: MyAppBar( - background: Colors.transparent, - leadingColor: Colors.white, - title: "福利兑换", - titleColor: Colors.white, - titleSize: 18.sp, - brightness: Brightness.dark, - ), - body: SmartRefresher( - controller: refreshController, - enablePullDown: true, - enablePullUp: false, - header: MyHeader(), - footer: CustomFooter( - builder: (context, mode) { - return MyFooter(mode); + centerTitle: true, + leading: GestureDetector( + onTap: () { + Navigator.of(context).pop(); }, + child: Container( + alignment: Alignment.centerRight, + margin: EdgeInsets.only(left: 10), + padding: EdgeInsets.all(6), + child: Icon( + Icons.arrow_back_ios, + color: Colors.white, + size: 24, + ), + ), ), - onRefresh: () { - setState(() { - _onRefresh(); - }); - }, - physics: BouncingScrollPhysics(), - scrollController: scrollController, - child: Container( - child: SingleChildScrollView( - physics: BouncingScrollPhysics(), - child: FutureBuilder( - future: creditGoods(), - builder: (context, snap) { - return Column( - children: [ - ///积分商城的用户信息 - pointUser(), - - Container( - color: Colors.white, - child: Column( - children: [ - ///积分商品头Tab - PointsGoodsTitle( - gooodsCategorys, - (orderType, orderDesc) { - this.orderType = orderType; - this.orderDesc = orderDesc; - setState(() {}); - }, - (index) { - categoryId = gooodsCategorys[index].id; - pageNum = 1; - setState(() {}); - }, - ), - - ///积分商品列表, - pointList() - ], - ), - ) - ], - ); - }, + flexibleSpace: FlexibleSpaceBar( + background: Stack( + children: [ + Container( + // padding: EdgeInsets.only(top: 40.h), + height: 172.h, + decoration: BoxDecoration( + // border: Border.all(color: Colors.white,width: 0.5), + color: Color(0xFF277D4B), + shape: BoxShape.rectangle, + borderRadius: BorderRadius.only( + bottomRight: Radius.circular(40), + bottomLeft: Radius.circular(40), + ), + ), + ), + Container( + alignment: Alignment.topCenter, + margin: EdgeInsets.only(top: 106.h), + child: pointUser(), + ), + ], + )), + expandedHeight: 258.h, + bottom: PreferredSize( + preferredSize: Size(double.infinity, 0), + child: DefaultTabController( + length: gooodsCategorys == null ? 0 : gooodsCategorys.length, + child: Container( + color: Colors.white, + child: TabBar( + isScrollable: true, + //可滚动 + indicatorColor: Color(0xff39B54A), + labelColor: Color(0xff32A060), + labelStyle: TextStyle( + fontSize: 14.sp, + fontWeight: FontWeight.bold, + ), + unselectedLabelStyle: TextStyle( + fontSize: 14.sp, + fontWeight: MyFontWeight.regular, + ), + // controller: tabController, + //未选中文字颜色 + unselectedLabelColor: Color(0xff4D4D4D), + indicatorSize: TabBarIndicatorSize.label, + //指示器与文字等宽 + tabs: gooodsCategorys == null + ? [] + : gooodsCategorys + .map((e) => MyTab(text: e.name)) + .toList(), + onTap: (index) { + categoryId = gooodsCategorys[index].id; + pageNum = 1; + creditGoods(); + setState(() {}); + }, + ), ), ), ), ), - ), - ], + ]; + }, + body: SmartRefresher( + controller: refreshController, + enablePullDown: true, + enablePullUp: true, + physics: ClampingScrollPhysics(), + header: MyHeader(), + footer: CustomFooter( + builder: (context, mode) { + return MyFooter(mode); + }, + ), + onRefresh: _onRefresh, + child: Container( + color: Colors.white, + padding: EdgeInsets.only(top: 19.h), + child: pointList(), + )), ), ); } @@ -347,8 +376,9 @@ class _WelfareExchange extends State { crossAxisAlignment: CrossAxisAlignment.end, children: [ GestureDetector( - onTap: (){ - Navigator.of(context).pushNamed('/router/integral_detailed_page'); + onTap: () { + Navigator.of(context) + .pushNamed('/router/integral_detailed_page'); }, child: Row( children: [ @@ -368,7 +398,7 @@ class _WelfareExchange extends State { color: Color(0xFF32A060), borderRadius: BorderRadius.circular(10), ), - child:Icon( + child: Icon( Icons.keyboard_arrow_right, size: 20, color: Colors.white, @@ -390,7 +420,9 @@ class _WelfareExchange extends State { fontWeight: MyFontWeight.medium, ), ), - SizedBox(width: 6,), + SizedBox( + width: 6, + ), Image.asset( "assets/image/icon_gold_coin.webp", width: 18, @@ -406,47 +438,49 @@ class _WelfareExchange extends State { ); } - Widget pointList(){ + Widget pointList() { return Container( - child: (goods == null || goods.length == 0)? NoDataView( - src: "assets/image/xiao_fei.webp", - isShowBtn: false, - text: "当前分类暂无商品", - fontSize: 16.sp, - margin: EdgeInsets.only(top: 120.h,left: 60.w,right: 60.w), - ):GridView.builder( - itemCount:goods == null ? 0 : goods.length, - padding: EdgeInsets.only( - left: 16.w, - right: 16.w, - top: 18.h, - bottom: 16.h, - ), - shrinkWrap: true, - physics: BouncingScrollPhysics(), - gridDelegate: SliverGridDelegateWithFixedCrossAxisCount( - //一行的Widget数量 - crossAxisCount: 2, - //水平子Widget之间间距 - crossAxisSpacing: 11.w, - //垂直子Widget之间间距 - mainAxisSpacing: 16.w, - //子Widget宽高比例 0.59 - childAspectRatio: - 200 / (285 / 2 + (285 / 2) * AppUtils.textScale(context)), - ), - itemBuilder: (context, index) { - return GestureDetector( - onTap: () { - Navigator.of(context).pushNamed( - '/router/integral_store_page', - arguments: {"goodsId": goods[index].id}, - ); - }, - child: pointItem(goods[index]), - ); - }, - ), + child: (goods == null || goods.length == 0) + ? NoDataView( + src: "assets/image/xiao_fei.webp", + isShowBtn: false, + text: "当前分类暂无商品", + fontSize: 16.sp, + margin: EdgeInsets.only(top: 120.h, left: 60.w, right: 60.w), + ) + : GridView.builder( + itemCount: goods == null ? 0 : goods.length, + padding: EdgeInsets.only( + left: 16.w, + right: 16.w, + top: 18.h, + bottom: 16.h, + ), + shrinkWrap: true, + physics: BouncingScrollPhysics(), + gridDelegate: SliverGridDelegateWithFixedCrossAxisCount( + //一行的Widget数量 + crossAxisCount: 2, + //水平子Widget之间间距 + crossAxisSpacing: 11.w, + //垂直子Widget之间间距 + mainAxisSpacing: 16.w, + //子Widget宽高比例 0.59 + childAspectRatio: + 200 / (266 / 2 + (266 / 2) * AppUtils.textScale(context)), + ), + itemBuilder: (context, index) { + return GestureDetector( + onTap: () { + Navigator.of(context).pushNamed( + '/router/integral_store_page', + arguments: {"goodsId": goods[index].id}, + ); + }, + child: pointItem(goods[index]), + ); + }, + ), ); } @@ -490,10 +524,8 @@ class _WelfareExchange extends State { margin: EdgeInsets.only( right: 12.w, top: 10.h, - ),padding: EdgeInsets.only( - bottom: 8.h, - left: 8.w - ), + ), + padding: EdgeInsets.only(bottom: 8.h, left: 8.w), child: Column( mainAxisAlignment: MainAxisAlignment.spaceAround, crossAxisAlignment: CrossAxisAlignment.start, @@ -501,7 +533,7 @@ class _WelfareExchange extends State { Text( goods.name, overflow: TextOverflow.ellipsis, - maxLines: 2, + maxLines: 1, style: TextStyle( color: Color(0xFF0D0D0D), height: 1.2, @@ -511,7 +543,7 @@ class _WelfareExchange extends State { ), Spacer(), Text( - pointPrice(goods), + pointPrice(goods), overflow: TextOverflow.ellipsis, maxLines: 2, style: TextStyle( @@ -532,17 +564,21 @@ class _WelfareExchange extends State { ); } - String pointPrice(Goods goods){ - if(goods == null) - return ""; - if(goods?.onePrice!=null && goods?.onePrice!="0"){ + String pointPrice(Goods goods) { + if (goods == null) return ""; + if (goods?.onePrice != null && goods?.onePrice != "0") { return S.of(context).jifen_(goods?.onePrice); - }else if((goods?.onePrice == null || goods?.onePrice == "0") && ((goods?.price != null && goods?.price != "0") || (goods?.money != null && goods?.money != "0.00"))){ - return (goods?.price== "0"|| goods?.price == null ? "" : S.of(context).jifen_(goods?.price)) + (goods?.money== "0"|| goods?.money == null ? "" : " + ${AppUtils.calculateDouble(double.tryParse(goods?.money) ?? 0)}元"); - }else if(goods.oneMoney != null && goods.oneMoney != "0.00"){ + } else if ((goods?.onePrice == null || goods?.onePrice == "0") && + ((goods?.price != null && goods?.price != "0") || + (goods?.money != null && goods?.money != "0.00"))) { + return (goods?.price == "0" || goods?.price == null + ? "" + : S.of(context).jifen_(goods?.price)) + + (goods?.money == "0" || goods?.money == null + ? "" + : " + ${AppUtils.calculateDouble(double.tryParse(goods?.money) ?? 0)}元"); + } else if (goods.oneMoney != null && goods.oneMoney != "0.00") { return "${AppUtils.calculateDouble(double.tryParse(goods.oneMoney) ?? 0)}元"; } } - - } diff --git a/lib/home/welfare_page.dart b/lib/home/welfare_page.dart index 181de2ea..1c66369f 100644 --- a/lib/home/welfare_page.dart +++ b/lib/home/welfare_page.dart @@ -755,7 +755,14 @@ class _WelfarePage extends State { ), ), SizedBox(height: 12,), - GridView.builder( + (goods == null || goods.length == 0)? NoDataView( + src: "assets/image/xiao_fei.webp", + isShowBtn: false, + text: "暂无商品可兑换", + fontSize: 16.sp, + margin: EdgeInsets.all(60.h), + ) + :GridView.builder( itemCount:goods.length>6?6:goods.length, padding: EdgeInsets.only( // left: 16.w, @@ -774,7 +781,7 @@ class _WelfarePage extends State { mainAxisSpacing: 16.w, //子Widget宽高比例 0.59 childAspectRatio: - 200 / (286 / 2 + (286 / 2) * AppUtils.textScale(context)), + 200 / (266 / 2 + (266 / 2) * AppUtils.textScale(context)), ), itemBuilder: (context, index) { return GestureDetector( @@ -844,7 +851,7 @@ class _WelfarePage extends State { Text( goods.name, overflow: TextOverflow.ellipsis, - maxLines: 2, + maxLines: 1, style: TextStyle( color: Color(0xFF0D0D0D), height: 1.2, diff --git a/lib/integral/integral_detailed_page.dart b/lib/integral/integral_detailed_page.dart index 0ca14c82..2032affc 100644 --- a/lib/integral/integral_detailed_page.dart +++ b/lib/integral/integral_detailed_page.dart @@ -155,30 +155,30 @@ class _IntegralDetailedPage extends State leadingWidth: 56, flexibleSpace: FlexibleSpaceBar( background: Container( - alignment: Alignment.center, - margin: EdgeInsets.only(top: 56.h), - child: Column( - mainAxisAlignment: MainAxisAlignment.center, - crossAxisAlignment: CrossAxisAlignment.center, - children: [ - Text( - userInfo != null ? userInfo.points : "0", - style: TextStyle( - color: Colors.white, - fontWeight: MyFontWeight.medium, - fontSize: 48.sp), - ), - Text( - S.of(context).wodejifenzhi, - style: TextStyle( - color: Color(0xFFF2F2F2), - fontSize: 12.sp, - fontWeight: MyFontWeight.regular), - ), - ], - ), + alignment: Alignment.center, + margin: EdgeInsets.only(top: 56.h), + child: Column( + mainAxisAlignment: MainAxisAlignment.center, + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + Text( + userInfo != null ? userInfo.points : "0", + style: TextStyle( + color: Colors.white, + fontWeight: MyFontWeight.medium, + fontSize: 48.sp), + ), + Text( + S.of(context).wodejifenzhi, + style: TextStyle( + color: Color(0xFFF2F2F2), + fontSize: 12.sp, + fontWeight: MyFontWeight.regular), + ), + ], ), ), + ), expandedHeight: 228, bottom: PreferredSize( preferredSize: Size(double.infinity, 38), diff --git a/lib/mine/mine_page.dart b/lib/mine/mine_page.dart index 8f983dfe..72f134d7 100644 --- a/lib/mine/mine_page.dart +++ b/lib/mine/mine_page.dart @@ -195,9 +195,13 @@ class MinePageState extends State with AutomaticKeepAliveClientMixin { // alignment: Alignment.centerRight, children: [ Container( - height: 317, + height: 502.h, decoration: BoxDecoration( - color: Color(0xFF32A060) + // color: Color(0xFF32A060) + image: DecorationImage( + fit: BoxFit.cover, + image: AssetImage("assets/image/settlement_bg.webp"), + ), ), ), FutureBuilder( @@ -205,68 +209,52 @@ class MinePageState extends State with AutomaticKeepAliveClientMixin { builder: (context, snapshot) { return Column( children: [ - Stack( - children: [ - Container( - child: Column( - children: [ - ///我的 用户信息 - MineView( - userInfo, - () { - _toUserInfo(); - }, - () { - toIntegralPage(); - }, - (){ - setState(() { - totalMsg =0; - }); - }, - totalMsg, - infoNumber - ), - - ///我的 VIP等级信息 - MineVipEntry( - tag: "vip", - ranks: ranks, - userInfo: userInfo, - rank: double.tryParse( - userInfo?.expendAmount ?? "0") - .toInt(), - rankMax: - userInfo?.memberRankVo?.nextOrigin ?? 0, - createTime: userInfo?.createTime ?? "", - ), - - ], - ), - ), - Container( - margin: EdgeInsets.only(top: 258.h), - child: Column( - children: [ - ///我的订单 - MineOrderView(), - - ///推广图 - spreadImage(), - - ///我的 下面item - MineItem(), - - ///我的成就 - attainment(), - - ///绿色足迹 - MineCalendar() - ], - ), - ) - ], - ) + + ///我的 用户信息 + MineView( + userInfo, + () { + _toUserInfo(); + }, + () { + toIntegralPage(); + }, + (){ + setState(() { + totalMsg =0; + }); + }, + totalMsg, + infoNumber + ), + + ///我的 VIP等级信息 + MineVipEntry( + tag: "vip", + ranks: ranks, + userInfo: userInfo, + rank: double.tryParse( + userInfo?.expendAmount ?? "0") + .toInt(), + rankMax: + userInfo?.memberRankVo?.nextOrigin ?? 0, + createTime: userInfo?.createTime ?? "", + ), + + ///我的订单 + MineOrderView(), + + ///推广图 + spreadImage(), + + ///我的 下面item + MineItem(), + + ///我的成就 + attainment(), + + ///绿色足迹 + MineCalendar() // ///关注度/粉丝/发布 // attention(), @@ -298,8 +286,8 @@ class MinePageState extends State with AutomaticKeepAliveClientMixin { ); }, child:Container( - margin: EdgeInsets.only(left:14,right:14,bottom:10), - padding: EdgeInsets.only(left:12, top:12, right:10,bottom: 12), + margin: EdgeInsets.only(left:16.w,right:16.w,bottom:15.h), + padding: EdgeInsets.only(left:12.w, top:12.h, right:10.w,bottom: 17.h), width: double.infinity, decoration: BoxDecoration( color: Colors.white, @@ -395,7 +383,7 @@ class MinePageState extends State with AutomaticKeepAliveClientMixin { ///推广图 Widget spreadImage() { return Container( - margin: EdgeInsets.only(right:14.w,bottom:10.h,left: 14.w), + margin: EdgeInsets.only(right:14.w,bottom:15.h,left: 14.w), child: GestureDetector( onTap: (){ Navigator.of(context).pushNamed('/router/invite_friends'); diff --git a/lib/mine/mine_view/mine_calendar.dart b/lib/mine/mine_view/mine_calendar.dart index c1675ef1..06956aaf 100644 --- a/lib/mine/mine_view/mine_calendar.dart +++ b/lib/mine/mine_view/mine_calendar.dart @@ -15,7 +15,7 @@ class _MineCalendar extends State { @override Widget build(BuildContext context) { return Container( - margin: EdgeInsets.fromLTRB(14.w, 20.h, 14.w, 30.h), + margin: EdgeInsets.fromLTRB(14.w, 0.h, 14.w, 30.h), padding: EdgeInsets.only(top: 12.h,left: 12,), decoration: BoxDecoration( // color: Colors.white, @@ -41,7 +41,7 @@ class _MineCalendar extends State { children: [ GestureDetector( onTap: (){ - Navigator.of(context).pushNamed('/router/mine_greenery'); + // Navigator.of(context).pushNamed('/router/mine_greenery'); }, child: Row( children: [ diff --git a/lib/mine/mine_view/mine_item.dart b/lib/mine/mine_view/mine_item.dart index f4238f5b..4ac8e307 100644 --- a/lib/mine/mine_view/mine_item.dart +++ b/lib/mine/mine_view/mine_item.dart @@ -20,7 +20,7 @@ class _MineItem extends State { @override Widget build(BuildContext context) { return Container( - margin: EdgeInsets.fromLTRB(16.w, 20.h, 16.w, 30.h), + margin: EdgeInsets.fromLTRB(16.w,0.h, 16.w, 15.h), // padding: EdgeInsets.fromLTRB(20.w, 12.h, 20.w, 12.h), decoration: BoxDecoration( color: Colors.white, @@ -38,13 +38,13 @@ class _MineItem extends State { crossAxisAlignment: CrossAxisAlignment.start, children: [ Container( - padding: EdgeInsets.only(left: 16,top:16,bottom:4,right: 16), + padding: EdgeInsets.only(left: 16,top:16,bottom:13,right: 16), child:Text( "其他", style: TextStyle( color: Color(0xFF353535), fontWeight: MyFontWeight.semi_bold, - fontSize: 16.sp, + fontSize: 15.sp, ), ), ), @@ -223,7 +223,7 @@ class _MineItem extends State { // ),), ], ), - SizedBox(height: 10.h,), + SizedBox(height: 12.h,), if(isShowMore) Row( children: [ @@ -314,7 +314,7 @@ class _MineItem extends State { ], ), if(isShowMore) - SizedBox(height: 10.h,), + SizedBox(height: 12.h,), if(isShowMore) Row( children: [ diff --git a/lib/mine/mine_view/mine_order.dart b/lib/mine/mine_view/mine_order.dart index 487680b9..d8a16318 100644 --- a/lib/mine/mine_view/mine_order.dart +++ b/lib/mine/mine_view/mine_order.dart @@ -16,7 +16,7 @@ class _MineOrderView extends State { @override Widget build(BuildContext context) { return Container( - margin: EdgeInsets.only(left:14, bottom:30, right:14), + margin: EdgeInsets.only(left:14, bottom:15, right:14), padding: EdgeInsets.fromLTRB(20.w, 12.h, 20.w, 12.h), decoration: BoxDecoration( color: Colors.white, @@ -40,11 +40,11 @@ class _MineOrderView extends State { style: TextStyle( color: Color(0xFF353535), fontWeight: MyFontWeight.semi_bold, - fontSize: 16.sp, + fontSize: 15.sp, ), ), ), - SizedBox(height: 8.h,), + SizedBox(height: 10.h,), Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, crossAxisAlignment: CrossAxisAlignment.center, diff --git a/lib/mine/mine_view/mine_view.dart b/lib/mine/mine_view/mine_view.dart index ea9811dd..a27c8241 100644 --- a/lib/mine/mine_view/mine_view.dart +++ b/lib/mine/mine_view/mine_view.dart @@ -67,13 +67,13 @@ class _MineView extends State { return Column( children: [ Container( - margin: EdgeInsets.only(top: 28.w), + margin: EdgeInsets.only(top: 29.h), alignment: Alignment.centerRight, child: Row( mainAxisAlignment: MainAxisAlignment.end, children: [ Container( - height: 24, + height: 24.h, alignment: Alignment.center, child: GestureDetector( onTap: () { @@ -82,23 +82,23 @@ class _MineView extends State { }); }, child: Container( - height: 24, + height: 24.h, alignment:Alignment.center, child:Stack( children: [ Image.asset( "assets/image/icon_notices.webp", - width:32.w, - height: 32.h, + width:32, + height: 32, color: Colors.white, ), if(widget.totalMsg != 0) Container( - width:36, + width:36.w, alignment: Alignment.topRight, child:Container( - width:22, - height:14, + width:22.w, + height:14.h, decoration: BoxDecoration( borderRadius: BorderRadius.circular(100), border: Border.all( @@ -131,8 +131,8 @@ class _MineView extends State { padding: EdgeInsets.all(8.h), child: Image.asset( "assets/image/icon_scan_qr_code.webp", - width:32.w, - height: 32.h, + width:32, + height: 32, color: Colors.white, ), ), @@ -146,8 +146,8 @@ class _MineView extends State { margin: EdgeInsets.only(right: 12.w), child: Image.asset( "assets/image/icon_mine_setting.webp", - width: 32.w, - height: 32.h, + width: 32, + height: 32, color: Colors.white, ), ), @@ -259,8 +259,8 @@ class _MineView extends State { right: 2.w, child: Image.asset( "assets/image/icon_mine_edit.webp", - width: 17.w, - height: 17.w, + width: 17, + height: 17, ), ), ], @@ -373,7 +373,7 @@ class _MineView extends State { widget.toIntegralPage(); }, child: Container( - padding: EdgeInsets.only(top: 4, bottom: 4, right: 16,left: 7), + padding: EdgeInsets.only(top: 4.h, bottom: 4.h, right: 16.w,left: 7.w), margin: EdgeInsets.only(right: 14.w), decoration: BoxDecoration( borderRadius: BorderRadius.circular(12), @@ -384,8 +384,8 @@ class _MineView extends State { children: [ Image.asset( "assets/image/icon_gold_coin.webp", - width: 16.w, - height: 16.h, + width: 16, + height: 16, ), Text( "天天领积分", diff --git a/lib/mine/recharge_page.dart b/lib/mine/recharge_page.dart index 002f04b7..d5e442c1 100644 --- a/lib/mine/recharge_page.dart +++ b/lib/mine/recharge_page.dart @@ -558,7 +558,7 @@ class _RechargePage extends State { }, child: Row( mainAxisAlignment: MainAxisAlignment.start, - crossAxisAlignment: CrossAxisAlignment.start, + crossAxisAlignment: CrossAxisAlignment.center, children: [ Text( "充值说明", diff --git a/lib/store/store_order.dart b/lib/store/store_order.dart index caa0ddc3..c9c6e829 100644 --- a/lib/store/store_order.dart +++ b/lib/store/store_order.dart @@ -22,9 +22,8 @@ import 'package:huixiang/store/store_view/shop_car.dart'; import 'package:huixiang/store/store_view/store_activity.dart'; import 'package:huixiang/store/store_view/store_info.dart'; import 'package:huixiang/store/store_view/store_order_list.dart'; -import 'package:huixiang/union/union_view/union_coupon.dart'; -import 'package:huixiang/union/union_view/vip.dart'; import 'package:huixiang/utils/font_weight.dart'; +import 'package:huixiang/view_widget/classic_header.dart'; import 'package:huixiang/view_widget/custom_image.dart'; import 'package:huixiang/view_widget/my_tab.dart'; import 'package:huixiang/view_widget/receive_success.dart'; @@ -60,6 +59,7 @@ class _StoreOrderPage extends State String tenant = ""; String storeId = ""; int numberOfPeople = 0; + ///小程序token String minToken; String pName; @@ -138,11 +138,12 @@ class _StoreOrderPage extends State ///会员信息 queryMemberInfo() async { - BaseData baseData = await minService.memberInfo() - .catchError((error){debugPrint(error);}); + BaseData baseData = await minService.memberInfo().catchError((error) { + debugPrint(error); + }); if (baseData != null && baseData.isSuccess) { SharedPreferences.getInstance().then( - (value) => { + (value) => { value.setString('minMember', jsonEncode(baseData.data)), }, ); @@ -151,8 +152,10 @@ class _StoreOrderPage extends State ///获取父订单(火锅订单加菜前调用) getParentInfo() async { - BaseData baseData = await minService.getParentInfo("$tableId") - .catchError((error) {debugPrint(error);}); + BaseData baseData = + await minService.getParentInfo("$tableId").catchError((error) { + debugPrint(error); + }); if (baseData != null && baseData.isSuccess) { if (baseData.data != null) { parentId = baseData.data["id"]; @@ -183,7 +186,8 @@ class _StoreOrderPage extends State /// 查询店铺信息 queryStoreInfo() async { - BaseData baseData = await apiService.queryStoreInfo(storeId).catchError((error) { + BaseData baseData = + await apiService.queryStoreInfo(storeId).catchError((error) { debugPrint(error); }); if (baseData != null && baseData.isSuccess) { @@ -203,217 +207,233 @@ class _StoreOrderPage extends State @override Widget build(BuildContext context) { - return Container( - color: Colors.white, - child: Stack( - children: [ - Positioned( - left: 0, - right: 0, - top: 0, - bottom: 54.h, - child: NestedScrollView( - controller: controller, - dragStartBehavior: DragStartBehavior.start, - physics: BouncingScrollPhysics(), - headerSliverBuilder: (BuildContext context, bool innerScrolled) { - return [ - SliverOverlapAbsorber( - handle: NestedScrollView.sliverOverlapAbsorberHandleFor( - context), - sliver: SliverAppBar( - expandedHeight: (storeInfo != null && - storeInfo.couponVOList != null) - ? 400.h - : 395.h, - floating: false, - snap: false, - pinned: true, - stretch: false, - brightness: Brightness.light, - leading: GestureDetector( - behavior: HitTestBehavior.opaque, - onTap: () { - Navigator.of(context).pop(); - }, - child: Container( - width: double.infinity, - height: double.infinity, - color: Colors.transparent, - alignment: Alignment.centerRight, - margin: EdgeInsets.only(left: 10.w), - padding: EdgeInsets.all(10.h), - child: Icon( - Icons.arrow_back_ios, - color: Colors.black, - size: 24, - ), - ), - ), - flexibleSpace: FlexibleSpaceBar( - title: Title(controller, - storeInfo != null ? storeInfo.storeName : ''), - collapseMode: CollapseMode.pin, - stretchModes: [ - StretchMode.zoomBackground, - StretchMode.fadeTitle, - StretchMode.blurBackground, - ], - background: Container( - decoration: BoxDecoration( - color: Colors.white, - borderRadius: BorderRadius.circular(8.w), - ), - child: Stack( - children: [ - Positioned( - child: Column( + return WillPopScope( + onWillPop: () async { + if (dialogShowing) { + debugPrint("ssssasdadsasdadasd"); + SmartDialog.dismiss(); + return false; + } else { + return true; + } + }, + child:Container( + color: Colors.white, + child: Stack( + children: [ + Positioned( + left: 0, + right: 0, + top: 0, + bottom: 54.h, + child: NestedScrollView( + controller: controller, + dragStartBehavior: DragStartBehavior.start, + physics: BouncingScrollPhysics(), + headerSliverBuilder: + (BuildContext context, bool innerScrolled) { + return [ + SliverOverlapAbsorber( + handle: NestedScrollView + .sliverOverlapAbsorberHandleFor(context), + sliver: SliverAppBar( + expandedHeight: (storeInfo != null && + storeInfo.couponVOList != null) + ? 400.h + : 395.h, + floating: false, + snap: false, + pinned: true, + stretch: false, + brightness: Brightness.light, + leading: GestureDetector( + behavior: HitTestBehavior.opaque, + onTap: () { + Navigator.of(context).pop(); + }, + child: Container( + width: double.infinity, + height: double.infinity, + color: Colors.transparent, + alignment: Alignment.centerRight, + margin: EdgeInsets.only(left: 10.w), + padding: EdgeInsets.all(10.h), + child: Icon( + Icons.arrow_back_ios, + color: Colors.black, + size: 24, + ), + ), + ), + flexibleSpace: FlexibleSpaceBar( + title: Title( + controller, + storeInfo != null + ? storeInfo.storeName + : ''), + collapseMode: CollapseMode.pin, + stretchModes: [ + StretchMode.zoomBackground, + StretchMode.fadeTitle, + StretchMode.blurBackground, + ], + background: Container( + decoration: BoxDecoration( + color: Colors.white, + borderRadius: BorderRadius.circular(8.w), + ), + child: Stack( children: [ - buildSwiper(), - Expanded( + Positioned( + child: Column( + children: [ + buildSwiper(), + Expanded( + child: Container( + color: Colors.transparent, + ), + flex: 1, + ), + ], + ), + top: 0, + bottom: 0, + left: 0, + right: 0, + ), + Positioned( child: Container( - color: Colors.transparent, + decoration: BoxDecoration( + color: Colors.white, + borderRadius: + BorderRadius.circular(8.w), + ), + child: Column( + mainAxisAlignment: + MainAxisAlignment.start, + crossAxisAlignment: + CrossAxisAlignment.start, + children: [ + ///门店信息 + StoreInfoView(storeInfo), + // Padding(padding:EdgeInsets.only(left: 14.w), + // child: Text( + // S.of(context).diandan, + // style: TextStyle( + // fontWeight: MyFontWeight.bold, + // fontSize: 15.sp, + // color: Color(0xFF000000), + // ), + // ),), + // Container( + // width:22.w, + // height: 3.h, + // color: Color(0xFF32A060), + // margin: EdgeInsets.only(top: 5.h,left: 14.w), + // ), + // ///门店对应优惠券 + // if (storeInfo != null && + // storeInfo.couponVOList != null) + // UnionCoupon( + // storeInfo, + // _receiveCoupon, + // coupon: true, + // ), + // + // if (storeInfo == null || + // storeInfo.couponVOList == null) + // SizedBox( + // height: 8, + // ), + // + // ///门店对应VIP信息 + // Vip(storeInfo, () {}, false), + ], + ), ), - flex: 1, + top: 233.h, + bottom: 0, + left: 0, + right: 0, ), ], ), - top: 0, - bottom: 0, - left: 0, - right: 0, ), - Positioned( - child: Container( - decoration: BoxDecoration( - color: Colors.white, - borderRadius: BorderRadius.circular(8.w), + ), + backgroundColor: Color(0x33FAFAFA), + centerTitle: false, + elevation: 0, + bottom: PreferredSize( + preferredSize: Size( + MediaQuery.of(context).size.width, + 38.h, + ), + child: Container( + padding: + EdgeInsets.symmetric(horizontal: 10.w), + width: MediaQuery.of(context).size.width, + child: TabBar( + controller: tabcontroller, + automaticIndicatorColorAdjustment: true, + isScrollable: true, + indicatorWeight: 3, + indicatorColor: Color(0xFF32A060), + labelPadding: EdgeInsets.only( + left: 8.w, + right: 8.w, + ), + indicatorSize: TabBarIndicatorSize.label, + unselectedLabelStyle: TextStyle( + fontSize: 15.sp, + fontWeight: FontWeight.w400, ), - child: Column( - mainAxisAlignment: MainAxisAlignment.start, - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - ///门店信息 - StoreInfoView(storeInfo), - // Padding(padding:EdgeInsets.only(left: 14.w), - // child: Text( - // S.of(context).diandan, - // style: TextStyle( - // fontWeight: MyFontWeight.bold, - // fontSize: 15.sp, - // color: Color(0xFF000000), - // ), - // ),), - // Container( - // width:22.w, - // height: 3.h, - // color: Color(0xFF32A060), - // margin: EdgeInsets.only(top: 5.h,left: 14.w), - // ), - // ///门店对应优惠券 - // if (storeInfo != null && - // storeInfo.couponVOList != null) - // UnionCoupon( - // storeInfo, - // _receiveCoupon, - // coupon: true, - // ), - // - // if (storeInfo == null || - // storeInfo.couponVOList == null) - // SizedBox( - // height: 8, - // ), - // - // ///门店对应VIP信息 - // Vip(storeInfo, () {}, false), - ], + labelStyle: TextStyle( + color: Colors.black, + fontSize: 18.sp, + fontWeight: FontWeight.bold, ), + labelColor: Colors.black, + tabs: [ + MyTab(text: S.of(context).diandan), + // MyTab(text: ""), + ], ), - top:233.h, - bottom: 0, - left: 0, - right: 0, ), - ], - ), - ), - ), - backgroundColor: Color(0x33FAFAFA), - centerTitle: false, - elevation: 0, - bottom: PreferredSize( - preferredSize: Size( - MediaQuery.of(context).size.width, - 38.h, - ), - child: Container( - padding: EdgeInsets.symmetric(horizontal: 10.w), - width: MediaQuery.of(context).size.width, - child: TabBar( - controller: tabcontroller, - automaticIndicatorColorAdjustment: true, - isScrollable: true, - indicatorWeight: 3, - indicatorColor: Color(0xFF32A060), - labelPadding: EdgeInsets.only( - left: 8.w, - right: 8.w, ), - indicatorSize: TabBarIndicatorSize.label, - unselectedLabelStyle: TextStyle( - fontSize: 15.sp, - fontWeight: FontWeight.w400, - ), - labelStyle: TextStyle( - color: Colors.black, - fontSize: 18.sp, - fontWeight: FontWeight.bold, - ), - labelColor: Colors.black, - tabs: [ - MyTab(text: S.of(context).diandan), - // MyTab(text: ""), - ], ), ), - ), - ), - ), - ]; - }, - body: - ///点餐 - TabBarView( - physics: NeverScrollableScrollPhysics(), - children: [ - ///点餐 - StoreOrderListPage( - widget.arguments, - activitys, - storeInfo, - shopCarGoods, - controller, - minToken, - tenant, - _queryMiNiDetail, - (){ - queryShopCar().then((value) { - this.shopCarGoods = value; - setState(() {}); - }); - } - ), + ]; + }, + body: + ///点餐 + TabBarView( + physics: NeverScrollableScrollPhysics(), + children: [ + ///点餐 + StoreOrderListPage( + widget.arguments, + activitys, + storeInfo, + shopCarGoods, + controller, + minToken, + tenant, + _queryMiNiDetail, () { + queryShopCar().then((value) { + this.shopCarGoods = value; + setState(() {}); + }); + }), - ///星店活动, - // StoreActivity( - // widget.arguments, - // activitys, - // ), - ], - controller: tabcontroller, - ), - ), /*SmartRefresher( + ///星店活动, + // StoreActivity( + // widget.arguments, + // activitys, + // ), + ], + controller: tabcontroller, + ), + ), /*SmartRefresher( controller: refreshController = RefreshController(initialRefresh: false), enablePullDown: true, @@ -425,104 +445,106 @@ class _StoreOrderPage extends State }, child: ),*/ - ), - // if(count() != 0) - Positioned( - bottom: 30, - left: 0, - right: 0, - child: Stack( - alignment: Alignment.bottomLeft, - children: [ - Container( - margin: EdgeInsets.symmetric(horizontal: 14), - height: 45.h, - // color: Color(0xFFFAFAFA), - decoration: BoxDecoration( - color: Color(0xFF383A38), - borderRadius: BorderRadius.circular(100), - ), - child: Row( - mainAxisAlignment: MainAxisAlignment.spaceAround, - crossAxisAlignment: CrossAxisAlignment.center, + ), + // if(count() != 0) + Positioned( + bottom: 30, + left: 0, + right: 0, + child: Stack( + alignment: Alignment.bottomLeft, children: [ - SizedBox(width:45.w,), - Text.rich( - TextSpan(children: [ - TextSpan( - text: "¥ ", - style: TextStyle( - fontSize: 12.sp, - color: Color(0xFFFFFFFF), - fontWeight: MyFontWeight.bold), - ), - TextSpan( - text: - shopCarGoods != null ? shopCarGoods.cartSum : "0.0", - style: TextStyle( - fontSize: 20.sp, - color: Color(0xFFFFFFFF), - fontWeight: MyFontWeight.semi_bold), - ), - ]), - ), - Spacer(), - GestureDetector( - onTap: () { - toDownOrder(); - }, - child: RoundButton( - width: 103.w, - height: 54.h, - text: S.current.jiesuan, - textColor: Colors.white, - fontWeight: MyFontWeight.bold, - backgroup: Color(0xFF32A060), - radius: 100, - fontSize: 16.sp, - padding: EdgeInsets.symmetric(vertical: 5.h), + Container( + margin: EdgeInsets.symmetric(horizontal: 14), + height: 45.h, + // color: Color(0xFFFAFAFA), + decoration: BoxDecoration( + color: Color(0xFF383A38), + borderRadius: BorderRadius.circular(100), + ), + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceAround, + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + SizedBox( + width: 45.w, + ), + Text.rich( + TextSpan(children: [ + TextSpan( + text: "¥ ", + style: TextStyle( + fontSize: 12.sp, + color: Color(0xFFFFFFFF), + fontWeight: MyFontWeight.bold), + ), + TextSpan( + text: shopCarGoods != null + ? shopCarGoods.cartSum + : "0.0", + style: TextStyle( + fontSize: 20.sp, + color: Color(0xFFFFFFFF), + fontWeight: MyFontWeight.semi_bold), + ), + ]), + ), + Spacer(), + GestureDetector( + onTap: () { + toDownOrder(); + }, + child: RoundButton( + width: 103.w, + height: 54.h, + text: S.current.jiesuan, + textColor: Colors.white, + fontWeight: MyFontWeight.bold, + backgroup: Color(0xFF32A060), + radius: 100, + fontSize: 16.sp, + padding: + EdgeInsets.symmetric(vertical: 5.h), + ), + ), + ], ), ), + Stack( + children: [ + InkWell( + onTap: () { + if (count() != 0) showShoppingCart(); + }, + child: Image.asset( + "assets/image/shopping_bag.webp", + width: 66, + height: 66, + fit: BoxFit.fitWidth, + ), + ), + if (count() != 0) + Positioned( + right: 5, + // top: 14, + child: RoundButton( + width: 17.w, + height: 17.h, + text: "${count()}", + textColor: Colors.white, + fontWeight: MyFontWeight.regular, + backgroup: Color(0xFFF65720), + fontSize: 12.sp, + radius: 100, + ), + ), + ], + ), ], ), ), - Stack( - children: [ - InkWell( - onTap: () { - if(count() != 0) - showShoppingCart(); - }, - child: Image.asset( - "assets/image/shopping_bag.webp", - width: 66, - height: 66, - fit: BoxFit.fitWidth, - ), - ), - if(count() != 0) - Positioned( - right: 5, - // top: 14, - child: RoundButton( - width: 17.w, - height: 17.h, - text: "${count()}", - textColor: Colors.white, - fontWeight: MyFontWeight.regular, - backgroup: Color(0xFFF65720), - fontSize: 12.sp, - radius: 100, - ), - ), - ], - ), ], - ), - ), - ], - ), - ); + ))); } ///领取优惠券 @@ -635,7 +657,7 @@ class _StoreOrderPage extends State ? storeInfo.bannerList[position].imgUrl : "", height: 230.h, - width:double.infinity, + width: double.infinity, fit: BoxFit.cover, radius: BorderRadius.zero, errorSrc: "assets/image/default_2_1.webp", @@ -687,12 +709,11 @@ class _StoreOrderPage extends State ///选规格 _queryMiNiDetail(String id, int count) async { EasyLoading.show(status: S.current.zhengzaijiazai); - if(count < 0){ + if (count < 0) { shopCarGoods.shoppingCartSkuItemList.forEach((element) { - if(element.productId == id){ + if (element.productId == id) { shopCartReduce(element); - setState(() { - }); + setState(() {}); } }); return; @@ -782,8 +803,7 @@ class _StoreOrderPage extends State this.shopCarGoods = value; setState(() {}); }); - } - else { + } else { SmartDialog.showToast(baseDate?.msg, alignment: Alignment.center); } } @@ -854,8 +874,7 @@ class _StoreOrderPage extends State if (shopCartKey?.currentState != null) { shopCartKey.currentState.setState(() {}); } - setState(() { - }); + setState(() {}); } return this.shopCarGoods; } diff --git a/lib/union/union_list.dart b/lib/union/union_list.dart index ad9d7866..0ae3d6e6 100644 --- a/lib/union/union_list.dart +++ b/lib/union/union_list.dart @@ -49,7 +49,7 @@ class _UnionList extends State { itemCount:widget.storeList == null ? 0 : widget.storeList.length, padding: EdgeInsets.only( top: 8.h, - bottom: 84.h, /* + (375.h - 88.h) + 4.h*/ + bottom: 100.h, /* + (375.h - 88.h) + 4.h*/ ), physics: NeverScrollableScrollPhysics(), itemBuilder: (context, position) { @@ -142,8 +142,7 @@ class _UnionList extends State { Widget buildStoreItem(Store store, position) { return Container( - margin: EdgeInsets.fromLTRB(16.w, 8.h, 16.w, 8.h), - // padding: EdgeInsets.fromLTRB(20.w, 20.h, 20.w, 20.h), + margin: EdgeInsets.fromLTRB(16.w, 8.h, 16.w, 12.h), decoration: BoxDecoration( color: Colors.white, borderRadius: BorderRadius.all(Radius.circular(8)), @@ -186,7 +185,7 @@ class _UnionList extends State { Positioned( bottom: 16.h, left: 12.w, - right: 0, + right: 12.w, child: Container( height: 100.h, child: Row( diff --git a/lib/union/union_page.dart b/lib/union/union_page.dart index 7e118cca..224b27b3 100644 --- a/lib/union/union_page.dart +++ b/lib/union/union_page.dart @@ -242,10 +242,10 @@ class UnionPageState extends State ); } BaseData> baseData = await apiService.queryStore({ - "city": city, + // "city": city, // "district": district, // "province": province, - // "latitude": latitude, + "latitude": latitude, "longitude": longitude, "searchKey": searchKey, "serviceType": (tabController.index == 0 && index == -1) || index == 0 diff --git a/lib/view_widget/mine_vip_entry.dart b/lib/view_widget/mine_vip_entry.dart index b2b66354..f3d68cf9 100644 --- a/lib/view_widget/mine_vip_entry.dart +++ b/lib/view_widget/mine_vip_entry.dart @@ -70,15 +70,11 @@ class MineVipEntry extends StatelessWidget { Widget widget = Container( width: double.infinity, - padding: EdgeInsets.only(top: 12.h, bottom: 35.h, left: 12.w, right: 12.w), - // margin: EdgeInsets.symmetric(horizontal: 14), - margin: EdgeInsets.only(top: 15.h,left: 14.w,right: 14.w,bottom:15.h), + padding: EdgeInsets.only(top: 12.h, bottom: 22.h, left: 12.w, right: 12.w), + margin: EdgeInsets.only(top: 23.h,left: 16.w,right: 16.w,bottom:15.h), decoration: BoxDecoration( color: Color(0xFF3D3D5D), - borderRadius: BorderRadius.only( - topLeft: Radius.circular(6), - topRight: Radius.circular(6), - ), + borderRadius: BorderRadius.circular(6), boxShadow: [ BoxShadow( color: Colors.black.withAlpha(12), @@ -100,7 +96,7 @@ class MineVipEntry extends StatelessWidget { height: 24, ), SizedBox( - width: 4.w, + width: 5.w, ), Expanded( child: Text( @@ -128,7 +124,7 @@ class MineVipEntry extends StatelessWidget { ], ), SizedBox( - height: 14.h, + height: 16.h, ), Container( height: 4.h, diff --git a/pubspec.yaml b/pubspec.yaml index a91080b1..81c81947 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -3,7 +3,7 @@ description: 一心回乡. publish_to: 'none' # Remove this line if you wish to publish to pub.dev -version: 2.0.8+7 +version: 2.0.9+8 environment: sdk: ">=2.7.0 <3.0.0"