From 6853a6928fb36b1490bbd213d74a77aaa29cc085 Mon Sep 17 00:00:00 2001 From: wurong <953969641@qq.com> Date: Thu, 30 Mar 2023 16:59:07 +0800 Subject: [PATCH] =?UTF-8?q?=E4=B8=AA=E4=BA=BA=E4=BF=A1=E6=81=AF=EF=BC=8C?= =?UTF-8?q?=E5=8E=BB=E6=8E=89=E6=88=91=E7=9A=84=E5=B9=B4=E9=BE=84=E6=94=B9?= =?UTF-8?q?=E6=80=A7=E5=88=AB=EF=BC=9B=20=E6=B8=85=E9=99=A4=E8=B4=AD?= =?UTF-8?q?=E7=89=A9=E8=BD=A6=E6=8E=A5=E5=8F=A3=EF=BC=8C=E8=AF=B7=E6=B1=82?= =?UTF-8?q?=E6=97=B6=E5=A2=9E=E5=8A=A0storeId=EF=BC=9B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/mine/user_info_page.dart | 152 +++++++++++++++++++++++++++++-- lib/retrofit/min_api.dart | 4 +- lib/retrofit/min_api.g.dart | 5 +- lib/store/shop_details_page.dart | 2 +- lib/store/store_order.dart | 2 +- 5 files changed, 153 insertions(+), 12 deletions(-) diff --git a/lib/mine/user_info_page.dart b/lib/mine/user_info_page.dart index 096cff0a..eda3367b 100644 --- a/lib/mine/user_info_page.dart +++ b/lib/mine/user_info_page.dart @@ -61,6 +61,7 @@ class _UserInfoPage extends State { String mobile = ""; String locale = "zh"; UserInfo user; + int selectSexIndex = 0; refresh() async { setState(() {}); @@ -155,11 +156,13 @@ class _UserInfoPage extends State { height: 1, color: Color(0xFFF2F2F2), ), - avatarItem( - 5, - (age == null || age == "") - ? S.of(context).wanshanshengrixinxi_nl - : S.of(context).sui(age)), + InkWell( + onTap: () { + showSexSelect(selectSexIndex); + }, + child: avatarItem( + 5, (modifyInfo["sex"] != null && modifyInfo["sex"] != "") ? modifyInfo["sex"]:"还未选择性别"), + ), ], ), ); @@ -192,9 +195,10 @@ class _UserInfoPage extends State { "个性签名", S.current.wodeshengri, S.current.shoujihao, - S.current.wodenianling, + "性别", ]; + ///生日时期选择 showDateSelector() async { DateTime dateTime = await showModalBottomSheet( backgroundColor: Colors.transparent, @@ -211,6 +215,142 @@ class _UserInfoPage extends State { } } + ///性别选择 + showSexSelect(index) { + showModalBottomSheet( + context: context, + builder: (context) { + return StatefulBuilder(builder: ( + context, + state, + ) { + return Container( + width: double.infinity, + height: 170.h, + padding: EdgeInsets.only(top: 12.h), + decoration: BoxDecoration( + color: Colors.white, + borderRadius: BorderRadius.only( + topRight: Radius.circular(6), + topLeft: Radius.circular(6), + )), + child: Column( + children: [ + Padding( + padding: EdgeInsets.symmetric(horizontal: 14.w), + child: Row( + children: [ + Expanded( + child:GestureDetector( + behavior:HitTestBehavior.opaque, + onTap: (){ + Navigator.of(context).pop(); + }, + child: Text( + S.of(context).quxiao, + style: TextStyle( + color: Colors.black, + fontSize: 16.sp, + fontWeight: MyFontWeight.black, + ), + ), + )), + GestureDetector( + behavior:HitTestBehavior.opaque, + onTap: (){ + state((){ + modifyInfo["sex"] = (selectSexIndex == 0)?"男":"女"; + modifyInfos(); + Navigator.of(context).pop(); + });}, + child: Text( + S.of(context).queding, + style: TextStyle( + color: Color(0xFF32A060), + fontSize: 16.sp, + fontWeight: MyFontWeight.black, + ), + ), + ) + ], + ), + ), + Container( + margin: EdgeInsets.only(top: 12.h, bottom: 13.h), + height: 1.h, + color: Color(0xFFF2F2F2)), + GestureDetector( + behavior:HitTestBehavior.opaque, + onTap: () { + state((){ + selectSexIndex = 0; + }); + }, + child: Container( + width: double.infinity, + alignment: Alignment.center, + padding: + EdgeInsets.only(top:12.h, bottom:12.h, left: 12.w), + margin: EdgeInsets.symmetric(horizontal: 14.w), + decoration: BoxDecoration( + borderRadius:BorderRadius.circular(6), + border: Border.all( + color: selectSexIndex == 0 ? Color(0xFF32A060):Color(0xFFF7F7F7), + width: selectSexIndex == 0 ? 1 :0, + ), + color: selectSexIndex == 0 ? Color(0xFFF0FAF4) :Color(0xFFF7F7F7), + ), + child: Text( + "男", + style: TextStyle( + color: selectSexIndex == 0? Color(0xFF32A060):Color(0xFF4D4D4D), + fontSize: 18.sp, + fontWeight: MyFontWeight.regular, + ), + ), + ), + ), + SizedBox( + height: 13.h, + ), + GestureDetector( + behavior:HitTestBehavior.opaque, + onTap: () { + state((){ + selectSexIndex = 1; + }); + }, + child: Container( + width: double.infinity, + alignment: Alignment.center, + padding: + EdgeInsets.only(top: 12.h, bottom: 12.h, left: 12.w), + margin: EdgeInsets.symmetric(horizontal: 14.w), + decoration: BoxDecoration( + borderRadius:BorderRadius.circular(6), + border: Border.all( + color: selectSexIndex == 1 ? Color(0xFF32A060):Color(0xFFF7F7F7), + width: selectSexIndex == 1 ? 1 :0, + ), + color: selectSexIndex == 1 ? Color(0xFFF0FAF4) :Color(0xFFF7F7F7), + ), + child: Text( + "女", + style: TextStyle( + color: selectSexIndex == 1 ?Color(0xFF32A060):Color(0xFF4D4D4D), + fontSize: 18.sp, + fontWeight: MyFontWeight.regular, + ), + )), + ) + ], + ), + ); + }); + }, + ); + } + ///显示图片选择方式 showImagePicker() { showCupertinoModalPopup( diff --git a/lib/retrofit/min_api.dart b/lib/retrofit/min_api.dart index f7e60731..dc0384e3 100644 --- a/lib/retrofit/min_api.dart +++ b/lib/retrofit/min_api.dart @@ -150,8 +150,8 @@ abstract class MinApiService { Future>> getShoppingCart(@Query("tableId") int tableId); ///清空购物车商品 - @GET("shoppingcart/delCart") - Future> clearShoppingCart(); + @GET("shoppingcart/delCart?storeId={storeId}") + Future> clearShoppingCart(@Query("storeId") String storeId); ///修改购物车 @PUT("shoppingcart") diff --git a/lib/retrofit/min_api.g.dart b/lib/retrofit/min_api.g.dart index 2e4cd7a2..b27f12ef 100644 --- a/lib/retrofit/min_api.g.dart +++ b/lib/retrofit/min_api.g.dart @@ -131,12 +131,13 @@ class _MinApiService implements MinApiService { } @override - Future> clearShoppingCart() async { + Future> clearShoppingCart(storeId) async { + ArgumentError.checkNotNull(storeId, 'storeId'); const _extra = {}; final queryParameters = {}; final _data = {}; final _result = await _dio.request>( - 'shoppingcart/delCart', + 'shoppingcart/delCart?storeId=$storeId', queryParameters: queryParameters, options: RequestOptions( method: 'GET', diff --git a/lib/store/shop_details_page.dart b/lib/store/shop_details_page.dart index 305216f7..5e9ae062 100644 --- a/lib/store/shop_details_page.dart +++ b/lib/store/shop_details_page.dart @@ -302,7 +302,7 @@ class _ShopDetailsPage extends State { ///清空购物车 clearShopCar() async { - BaseData baseData = await minService.clearShoppingCart(); + BaseData baseData = await minService.clearShoppingCart(storeId); if (baseData.isSuccess) { shopCarGoods = null; setState(() {}); diff --git a/lib/store/store_order.dart b/lib/store/store_order.dart index 5491a73b..25dfbf5a 100644 --- a/lib/store/store_order.dart +++ b/lib/store/store_order.dart @@ -727,7 +727,7 @@ class _StoreOrderPage extends State ///清空购物车 clearShopCar() async { - BaseData baseData = await minService.clearShoppingCart(); + BaseData baseData = await minService.clearShoppingCart(storeId); if (baseData.isSuccess) { shopCarGoods = null; setState(() {});