diff --git a/lib/main.dart b/lib/main.dart index a8dd81c4..8510d1be 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -1,4 +1,5 @@ import 'package:akuCommunity/pages/tab_navigator.dart'; +import 'package:akuCommunity/provider/user_provider.dart'; import 'package:amap_map_fluttify/amap_map_fluttify.dart'; import 'package:ani_route/ani_route.dart'; import 'package:flutter/material.dart'; @@ -39,6 +40,7 @@ class _MyAppState extends State { return MultiProvider( providers: [ ChangeNotifierProvider(create: (context) => CartProvidde()), + ChangeNotifierProvider(create: (context)=>UserProvider()), ], child: OKToast( textStyle: TextStyle(fontSize: 19.0, color: Colors.white), diff --git a/lib/pages/goods_details/widget/product_content.dart b/lib/pages/goods_details/widget/product_content.dart index cc29e95e..9ec09968 100644 --- a/lib/pages/goods_details/widget/product_content.dart +++ b/lib/pages/goods_details/widget/product_content.dart @@ -150,7 +150,7 @@ class ProductContent extends StatelessWidget { Positioned _positionedRecommend() { return Positioned( right: ScreenUtil().setWidth(453), - top: ScreenUtil().setWidth(252), + bottom: 100.w, child: Row( children: [ Icon( diff --git a/lib/pages/market/market_cart_page/market_cart_page.dart b/lib/pages/market/market_cart_page/market_cart_page.dart index 044c20e4..2d21629b 100644 --- a/lib/pages/market/market_cart_page/market_cart_page.dart +++ b/lib/pages/market/market_cart_page/market_cart_page.dart @@ -1,15 +1,95 @@ +import 'package:akuCommunity/model/aku_shop_model.dart'; +import 'package:akuCommunity/utils/screenutil.dart'; +import 'package:akuCommunity/widget/cached_image_wrapper.dart'; +import 'package:akuCommunity/widget/cart_count.dart'; import 'package:flutter/material.dart'; import 'package:flutter/cupertino.dart'; +import 'package:flutter_slidable/flutter_slidable.dart'; import 'package:provider/provider.dart'; import 'package:akuCommunity/provider/cart.dart'; -import 'package:akuCommunity/routers/page_routers.dart'; -import 'package:akuCommunity/model/aku_shop_model.dart'; import 'widget/market_cart_app_bar.dart'; -import 'widget/market_cart_card.dart'; -import 'widget/market_cart_bottom_bar.dart'; -class MarketCartPage extends StatelessWidget { - MarketCartPage({Key key}) : super(key: key); +class MarketCartPage extends StatefulWidget { + final AkuShopModel cartItem; + + MarketCartPage({Key key, this.cartItem}) : super(key: key); + + @override + _MarketCartPageState createState() => _MarketCartPageState(); +} + +class _MarketCartPageState extends State { + Widget _cardRadio( + BuildContext context, AkuShopModel cartItem, CartProvidde model, index) { + return InkWell( + onTap: () { + setState(() { + cartItem.isCheck = !cartItem.isCheck; + int _goods = shopList.indexWhere( + (element) => element.itemid == _cartList[index].itemid); + _goods > -1 + ? shopList.removeAt(_goods) + : shopList.add(_cartList[index]); + print(shopList); + }); + }, + child: Container( + alignment: Alignment.center, + child: Icon( + Icons.check_circle, + color: cartItem.isCheck ? Color(0xffdb0000) : Color(0xff999999), + size: 36.w, + ), + ), + ); + } + + Widget _image(String imagePath) { + return Container( + margin: EdgeInsets.symmetric(horizontal: 20.w), + child: ClipRRect( + borderRadius: BorderRadius.all(Radius.circular(2)), + child: CachedImageWrapper( + url: imagePath, + width: 180.w, + height: 180.w, + ), + ), + ); + } + + Widget _content(String content, specs, price) { + return Container( + child: Column( + mainAxisAlignment: MainAxisAlignment.start, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Container( + width: 394.w, + child: Text( + content, + maxLines: 2, + overflow: TextOverflow.ellipsis, + style: TextStyle( + fontSize: 24.sp, + color: Color(0xff333333), + ), + ), + ), + Container( + margin: EdgeInsets.only(top: 40.w), + child: Text( + '¥${price}', + style: TextStyle( + fontSize: 28.sp, + color: Color(0xffe60e0e), + ), + ), + ), + ], + ), + ); + } // List> _listGoods = [ // { // 'imagePath': @@ -108,36 +188,255 @@ class MarketCartPage extends StatelessWidget { // // isAll = !isAll; // // }); // } + List shopList = []; + bool get _selectALl { + for (var element in _cartList) { + int _selectGoods = + shopList.indexWhere((index) => element.itemid == index.itemid); + if (_selectGoods == -1) return false; + } + return true; + } + + double get _allprice { + double _price = 0; + for (var element in shopList) { + _price += double.parse(element.itemprice) * element.count; + } + return _price; + } + + int get _goodsCount => shopList.length; + + List _cartList; + Future _getCartInfo(BuildContext context) async { - await Provider.of(context, listen: false).getCartInfo(); + await Provider.of(context, listen: true).getCartInfo(); return 'end'; } + Widget _selectAll( + CartProvidde model, + ) { + return InkWell( + onTap: () { + for (var element in _cartList) { + element.isCheck = !_selectALl; + } + model.changeALlCheckState(true); + setState(() { + if (_selectALl == true) + shopList.clear(); + else { + shopList.clear(); + shopList.addAll(_cartList); + } + }); + }, + child: Container( + margin: EdgeInsets.symmetric(vertical: 29.w), + child: Row( + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + Icon( + _selectALl + ? Icons.radio_button_checked + : Icons.radio_button_unchecked, + color: model.isAllCheck ? Color(0xffdb0000) : Color(0xff999999), + size: 40.w, + ), + Container( + margin: EdgeInsets.only(left: 18.w), + child: Text( + '全选', + style: TextStyle( + fontSize: 28.sp, + color: Color(0xff333333), + ), + ), + ), + ], + ), + ), + ); + } + + Widget _settlement(CartProvidde model, BuildContext context) { + return Row( + children: [ + model.allPrice != null + ? Container( + margin: EdgeInsets.only(right: 10.w), + child: Text( + '合计:¥${_allprice.toStringAsFixed(2)}', + style: TextStyle( + fontSize: 28.sp, + color: Color(0xffe60e0e), + ), + ), + ) + : SizedBox(), + InkWell( + onTap: model.allGoodsCount != 0 ? () {} : null, + child: Container( + alignment: Alignment.center, + decoration: BoxDecoration( + color: model.allGoodsCount != 0 + ? Color(0xffffc40c) + : Color(0xffd8d8d8), + borderRadius: BorderRadius.all(Radius.circular(30)), + ), + width: 198.w, + margin: EdgeInsets.symmetric(vertical: 16.w), + padding: EdgeInsets.symmetric(vertical: 12.w), + child: Text( + '结算(${_goodsCount})', + style: TextStyle( + fontSize: 30.sp, + color: + model.allGoodsCount != 0 ? Color(0xff333333) : Colors.white, + ), + ), + ), + ), + ], + ); + } + + Widget _marketCartCard(AkuShopModel cartItem, index) { + return Consumer(builder: (context, model, child) { + return Container( + margin: EdgeInsets.only( + top: 20.w, + left: 32.w, + right: 32.w, + ), + decoration: BoxDecoration( + borderRadius: BorderRadius.all(Radius.circular(6)), + ), + child: Slidable.builder( + actionPane: SlidableBehindActionPane(), + actionExtentRatio: 0.25, + secondaryActionDelegate: SlideActionBuilderDelegate( + actionCount: 2, + builder: (context, index, animation, renderingMode) { + if (index == 0) { + return SlideAction( + child: Text( + '移至收藏夹', + style: TextStyle( + fontSize: 28.sp, color: Colors.white), + ), + color: renderingMode == SlidableRenderingMode.slide + ? Color(0xffffc40c).withOpacity(animation.value) + : Color(0xffffc40c), + // onTap: () => _showSnackBar(context, 'More'), + closeOnTap: false, + ); + } else { + return SlideAction( + onTap: () { + model.deleteGoods(cartItem.itemid); + }, + decoration: BoxDecoration( + color: renderingMode == SlidableRenderingMode.slide + ? Color(0xffe60e0e).withOpacity(animation.value) + : Color(0xffe60e0e), + borderRadius: BorderRadius.only( + topRight: Radius.circular(6), + bottomRight: Radius.circular(6), + ), + ), + child: Text( + '删除', + style: TextStyle( + fontSize: 28.sp, color: Colors.white), + ), + // onTap: () => _showSnackBar(context, 'Delete'), + ); + } + }, + ), + child: Container( + color: Colors.white, + padding: EdgeInsets.only( + top: 30.w, + left: 15.w, + bottom: 37.w, + ), + child: Stack( + children: [ + Row( + children: [ + _cardRadio(context, cartItem, model, index), + _image(cartItem.itempic), + _content(cartItem.itemtitle, '默认', cartItem.itemprice), + ], + ), + Positioned( + bottom: 0, + right: 16.w, + child: CartCount( + cartItem: cartItem, + // goodsNum: widget.goodsNum, + // index: widget.index, + // reduce: widget.reduce, + // add: widget.add, + ), + ), + ], + ), + ), + ), + ); + }); + } + @override Widget build(BuildContext context) { return Scaffold( appBar: PreferredSize( - child: MarketCartAppBar(), preferredSize: Size.fromHeight(kToolbarHeight), + child: MarketCartAppBar(), ), + bottomNavigationBar: + Consumer(builder: (context, model, child) { + return Container( + color: Colors.white, + height: 98.w, + width: MediaQuery.of(context).size.width, + padding: EdgeInsets.symmetric(horizontal: 32.w), + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + _selectAll(model), + _settlement( + model, + context, + ) + ], + ), + ); + }), body: Stack( children: [ Consumer( builder: (context, model, child) { - List cartList = model.cartList; + List cartList = model.cartList; + _cartList = model.cartList; return ListView.builder( itemCount: cartList.length, itemBuilder: (BuildContext context, int index) { - return MarketCartCard( - cartItem: cartList[index], - ); + return _marketCartCard(cartList[index], index); }); }, ), - Positioned( - bottom: 0, - child: MarketCartBottomBar(), - ), + // Positioned( + // bottom: 0, + // child: MarketCartBottomBar( + // selectAll: _selectALl, + // ), + // ), ], )); } diff --git a/lib/pages/personal/personal_page.dart b/lib/pages/personal/personal_page.dart index d6bf4dd0..a2e662b9 100644 --- a/lib/pages/personal/personal_page.dart +++ b/lib/pages/personal/personal_page.dart @@ -1,4 +1,5 @@ import 'package:akuCommunity/pages/sign/sign_in_page.dart'; +import 'package:akuCommunity/provider/user_provider.dart'; import 'package:ani_route/ani_route.dart'; import 'package:flutter/material.dart'; import 'package:flutter/cupertino.dart'; @@ -11,6 +12,7 @@ import 'package:akuCommunity/widget/single_ad_space.dart'; import 'package:akuCommunity/widget/cached_image_wrapper.dart'; import 'package:akuCommunity/routers/page_routers.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart'; +import 'package:provider/provider.dart'; class PersonalIndex extends StatefulWidget { final bool isSign; @@ -33,6 +35,7 @@ class _PersonalIndexState extends State } SliverAppBar _sliverAppBar(double height) { + final userProvider=Provider.of(context); return SliverAppBar( pinned: true, elevation: 0, @@ -71,18 +74,18 @@ class _PersonalIndexState extends State 'https://dss0.bdstatic.com/70cFuHSh_Q1YnxGkpoWK1HF6hhy/it/u=1851283359,3457678391&fm=26&gp=0.jpg', width: 106.w, height: 106.w, - isSigned: _isSigned, + isSigned: userProvider.isSigned, ), ), ), InkWell( onTap: (){ - _isSigned? null:ARoute.push(context, SignInPage()); + userProvider.isSigned? null:ARoute.push(context, SignInPage()); }, child: Container( margin: EdgeInsets.only( left: 16.w), - child: _isSigned + child: userProvider.isSigned ? Text( 'Cheailune', style: TextStyle( diff --git a/lib/pages/questionnaire_page/questionnaire_details_page/questionnaire_details_page.dart b/lib/pages/questionnaire_page/questionnaire_details_page/questionnaire_details_page.dart index 5cb9ebdb..37ce3c64 100644 --- a/lib/pages/questionnaire_page/questionnaire_details_page/questionnaire_details_page.dart +++ b/lib/pages/questionnaire_page/questionnaire_details_page/questionnaire_details_page.dart @@ -220,24 +220,24 @@ class _QuestionnaireDetailsPageState extends State { Container( padding: EdgeInsets.only( left: 32.w, - right: Screenutil.length(32), - bottom: Screenutil.length(155), + right: 32.w, + bottom: 155.w, ), child: ListView( children: [ Container( - margin: EdgeInsets.only(top: Screenutil.length(24)), + margin: EdgeInsets.only(top: 24.w), child: ClipRRect( - borderRadius: BorderRadius.all(Radius.circular(4)), + borderRadius: BorderRadius.all(Radius.circular(4.w)), child: CachedImageWrapper( url: widget.bundle.getMap('details')['imagePath'], - width: Screenutil.length(686), - height: Screenutil.length(228), + width: 686.w, + height: 228.w, ), ), ), Container( - margin: EdgeInsets.only(top: Screenutil.length(40)), + margin: EdgeInsets.only(top: 40.w), alignment: Alignment.center, child: Text( widget.bundle.getMap('details')['title'], @@ -249,13 +249,13 @@ class _QuestionnaireDetailsPageState extends State { ), ), Container( - margin: EdgeInsets.only(top: Screenutil.length(35)), + margin: EdgeInsets.only(top: 35.w), alignment: Alignment.center, - width: Screenutil.length(672), + width: 672.w, child: Html(data: htmlData), ), Container( - margin: EdgeInsets.only(top: Screenutil.length(129)), + margin: EdgeInsets.only(top: 129.w), child: Column( children: _listQuestion .map((item) => _questionCard( @@ -267,8 +267,8 @@ class _QuestionnaireDetailsPageState extends State { ), Container( margin: EdgeInsets.only( - top: Screenutil.length(80), - bottom: Screenutil.length(24)), + top: 80.w, + bottom: 24.w), child: Text( '您的觉得我们需要改进的地方', style: TextStyle( diff --git a/lib/pages/setting_page/setting_page.dart b/lib/pages/setting_page/setting_page.dart index 5396145f..4cfc1b1f 100644 --- a/lib/pages/setting_page/setting_page.dart +++ b/lib/pages/setting_page/setting_page.dart @@ -1,6 +1,7 @@ import 'dart:async'; import 'package:akuCommunity/pages/setting_page/agreement_page/agreement_page.dart'; import 'package:akuCommunity/pages/sign/sign_in_page.dart'; +import 'package:akuCommunity/provider/user_provider.dart'; import 'package:ani_route/ani_route.dart'; import 'package:flutter/material.dart'; import 'package:flutter/cupertino.dart'; @@ -10,6 +11,8 @@ import 'package:akuCommunity/base/base_style.dart'; import 'package:akuCommunity/widget/common_app_bar.dart'; import 'package:akuCommunity/routers/page_routers.dart'; import 'package:akuCommunity/widget/custom_action_sheet.dart'; +import 'package:provider/provider.dart'; +import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'agreement_page/privacy_page.dart'; @@ -50,7 +53,7 @@ class _SettingPageState extends State { 'isSwitch': false, }, { - 'title':'隐私政策', + 'title': '隐私政策', 'isSwitch': false, } ]; @@ -176,10 +179,10 @@ class _SettingPageState extends State { ); break; case '用户协议': - ARoute.push(context, AgreementPage()); + ARoute.push(context, AgreementPage()); break; - case '隐私政策': - ARoute.push(context,PrivacyPage()); + case '隐私政策': + ARoute.push(context, PrivacyPage()); break; default: } @@ -233,8 +236,10 @@ class _SettingPageState extends State { } Widget _containerQuit() { + final userProvider = Provider.of(context); return InkWell( onTap: () { + userProvider.isSigned? showCupertinoModalPopup( context: context, builder: (context) { @@ -249,14 +254,16 @@ class _SettingPageState extends State { ), ), onPressed: () { - Navigator.popUntil(context, (route) { - return !Navigator.canPop(context); - }); - Navigator.pushReplacement( - context, - CupertinoPageRoute( - builder: (context) => SignInPage(), - )); + userProvider.setisSigned(false); + ARoute.pop(context); + // Navigator.popUntil(context, (route) { + // return !Navigator.canPop(context); + // }); + // Navigator.pushReplacement( + // context, + // CupertinoPageRoute( + // builder: (context) => SignInPage(), + // )); }, ), ], @@ -268,25 +275,46 @@ class _SettingPageState extends State { ), ); }, - ); + ):ARoute.push(context, SignInPage()); }, - child: Container( - color: Colors.white, - height: 96.w, - padding: EdgeInsets.only( - top: 26.w, - bottom: 25.w, - ), - alignment: Alignment.center, - child: Text( - '退出当前帐号', - style: TextStyle( - fontWeight: FontWeight.w600, - fontSize: BaseStyle.fontSize32, - color: BaseStyle.color333333, - ), - ), - ), + child: userProvider.isSigned + ? Container( + color: Colors.white, + height: 96.w, + padding: EdgeInsets.only( + top: 26.w, + bottom: 25.w, + ), + alignment: Alignment.center, + child: Text( + '退出当前帐号', + style: TextStyle( + fontWeight: FontWeight.w600, + fontSize: BaseStyle.fontSize32, + color: BaseStyle.color333333, + ), + ), + ) + : Container( + alignment: Alignment.center, + height: 89.w, + width: 586.w, + padding: EdgeInsets.only( + top: 25.w, bottom: 24.w), + margin: EdgeInsets.symmetric(horizontal: 82.w), + decoration: BoxDecoration( + color: Color(0xffffc40c), + borderRadius: BorderRadius.all(Radius.circular(36)), + ), + child: Text( + '登录', + style: TextStyle( + fontWeight: FontWeight.w600, + fontSize: BaseStyle.fontSize28, + color: BaseStyle.color333333, + ), + ), + ), ); } diff --git a/lib/pages/sign/user_authentication_page.dart b/lib/pages/sign/user_authentication_page.dart index cc212bbc..dfc4328d 100644 --- a/lib/pages/sign/user_authentication_page.dart +++ b/lib/pages/sign/user_authentication_page.dart @@ -1,10 +1,12 @@ import 'package:akuCommunity/pages/tab_navigator.dart'; +import 'package:akuCommunity/provider/user_provider.dart'; import 'package:ani_route/ani_route.dart'; import 'package:flutter/material.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter_icons/flutter_icons.dart'; import 'package:akuCommunity/utils/screenutil.dart'; import 'package:akuCommunity/base/base_style.dart'; +import 'package:provider/provider.dart'; class UserAuthenticationPage extends StatefulWidget { final BuildContext context; @@ -26,6 +28,7 @@ class _UserAuthenticationPageState extends State { ]; AppBar _appBar() { + final userProvider=Provider.of(context); return AppBar( elevation: 0, backgroundColor: Colors.white, @@ -39,8 +42,9 @@ class _UserAuthenticationPageState extends State { MaterialButton( child: Text('跳过'), onPressed: () { + userProvider.setisSigned(true); ARoute.pop(context,root: true); - ARoute.pushReplace(context, TabNavigator(isSign: true,)); + ARoute.pushReplace(context, TabNavigator()); }, ), ], diff --git a/lib/pages/tab_navigator.dart b/lib/pages/tab_navigator.dart index 5cece989..b55f7ea2 100644 --- a/lib/pages/tab_navigator.dart +++ b/lib/pages/tab_navigator.dart @@ -11,9 +11,7 @@ import 'personal/personal_page.dart'; class TabNavigator extends StatefulWidget { - final bool isSign; - - const TabNavigator({Key key, this.isSign=false}) : super(key: key); + const TabNavigator({Key key, }) : super(key: key); @override _TabNavigatorState createState() => _TabNavigatorState(); } @@ -37,7 +35,6 @@ _pages=[ PropertyIndex(), CommunityIndex(), PersonalIndex( - isSign: widget.isSign, ) ]; } diff --git a/lib/pages/things_page/things_create_page/things_create_page.dart b/lib/pages/things_page/things_create_page/things_create_page.dart index 747d63cd..a3d1f55e 100644 --- a/lib/pages/things_page/things_create_page/things_create_page.dart +++ b/lib/pages/things_page/things_create_page/things_create_page.dart @@ -178,7 +178,7 @@ class _ThingsCreatePageState extends State { alignment: Alignment.center, height: 98.w, width: 750.w, - padding: EdgeInsets.symmetric(vertical: Screenutil.length(26.5)), + padding: EdgeInsets.symmetric(vertical:26.5.w), color: Color(0xffffc40c), child: Text( '确认提交', diff --git a/lib/pages/things_page/things_detail_page/things_detail_page.dart b/lib/pages/things_page/things_detail_page/things_detail_page.dart index b41c46d6..a12c83dc 100644 --- a/lib/pages/things_page/things_detail_page/things_detail_page.dart +++ b/lib/pages/things_page/things_detail_page/things_detail_page.dart @@ -84,7 +84,7 @@ class _ThingsDetailPageState extends State { alignment: Alignment.center, height: 98.w, width: 750.w, - padding: EdgeInsets.symmetric(vertical: Screenutil.length(26.5)), + padding: EdgeInsets.symmetric(vertical: 26.5.w), color: Color(0xffffc40c), child: Text( widget.bundle.getMap('things')['isRepair'] ? '确认完成' : '继续提问', diff --git a/lib/pages/things_page/things_detail_page/widget/goods_info_card_button.dart b/lib/pages/things_page/things_detail_page/widget/goods_info_card_button.dart index ae956e27..f66ce714 100644 --- a/lib/pages/things_page/things_detail_page/widget/goods_info_card_button.dart +++ b/lib/pages/things_page/things_detail_page/widget/goods_info_card_button.dart @@ -97,7 +97,7 @@ class GoodsInfoCardButton extends StatelessWidget { child: Container( alignment: Alignment.center, padding: EdgeInsets.symmetric( - vertical: Screenutil.length(26.5), + vertical: 26.5.w, ), decoration: BoxDecoration( border: Border( diff --git a/lib/pages/things_page/things_evaluate_page/things_evaluate_page.dart b/lib/pages/things_page/things_evaluate_page/things_evaluate_page.dart index 6797de39..3568d767 100644 --- a/lib/pages/things_page/things_evaluate_page/things_evaluate_page.dart +++ b/lib/pages/things_page/things_evaluate_page/things_evaluate_page.dart @@ -118,7 +118,7 @@ class _ThingsEvaluatePageState extends State { alignment: Alignment.center, height: 96.w, margin: EdgeInsets.symmetric(horizontal: 32.w), - padding: EdgeInsets.symmetric(vertical: Screenutil.length(25.5)), + padding: EdgeInsets.symmetric(vertical: 25.5.w), decoration: BoxDecoration( color: Color(0xffffc40c), borderRadius: BorderRadius.all(Radius.circular(48)), diff --git a/lib/pages/things_page/things_page.dart b/lib/pages/things_page/things_page.dart index a2b0da61..8b3abd3c 100644 --- a/lib/pages/things_page/things_page.dart +++ b/lib/pages/things_page/things_page.dart @@ -141,7 +141,7 @@ class _ThingsPageState extends State with TickerProviderStateMixin { alignment: Alignment.center, height: 98.w, width: 750.w, - padding: EdgeInsets.symmetric(vertical: Screenutil.length(26.5)), + padding: EdgeInsets.symmetric(vertical: 26.5.w), color: Color(0xffffc40c), child: Text( '新增', diff --git a/lib/pages/things_page/widget/things_app_bar.dart b/lib/pages/things_page/widget/things_app_bar.dart index 0a199416..265ae0cf 100644 --- a/lib/pages/things_page/widget/things_app_bar.dart +++ b/lib/pages/things_page/widget/things_app_bar.dart @@ -48,7 +48,7 @@ class ThingsAppBar extends StatelessWidget { fontSize: 28.sp, ), labelPadding: - EdgeInsets.symmetric(horizontal: Screenutil.length(131.5)), + EdgeInsets.symmetric(horizontal: 131.5.w), indicatorColor: Color(0xffffc40c), indicatorSize: TabBarIndicatorSize.label, indicatorPadding: diff --git a/lib/pages/visitor_access_page/visitor_pass_page.dart b/lib/pages/visitor_access_page/visitor_pass_page.dart index 88886b72..faa9e010 100644 --- a/lib/pages/visitor_access_page/visitor_pass_page.dart +++ b/lib/pages/visitor_access_page/visitor_pass_page.dart @@ -167,7 +167,7 @@ class _VisitorPassPageState extends State { alignment: Alignment.center, height: 98.w, width: 750.w, - padding: EdgeInsets.symmetric(vertical: Screenutil.length(26.5)), + padding: EdgeInsets.symmetric(vertical: 26.5.w), color: Color(0xffffc40c), child: Text( '发送给访客', diff --git a/lib/provider/cart.dart b/lib/provider/cart.dart index 4c5e7b6b..a634e3dd 100644 --- a/lib/provider/cart.dart +++ b/lib/provider/cart.dart @@ -110,21 +110,22 @@ class CartProvidde with ChangeNotifier { ///单选商品 changeCheckState(AkuShopModel cartItem) async { - SharedPreferences prefs = await SharedPreferences.getInstance(); - cartString = prefs.getString("cartInfo"); - List tempList = (json.decode(cartString.toString()) as List).cast(); - int tempIndex = 0; - int changeIndex = 0; - tempList.forEach((item) { - if (item["itemid"] == cartItem.itemid) { - changeIndex = tempIndex; - } - tempIndex++; - }); - tempList[changeIndex] = cartItem.toJson(); - cartString = json.encode(tempList).toString(); - prefs.setString("cartInfo", cartString); - await getCartInfo(); + // SharedPreferences prefs = await SharedPreferences.getInstance(); + // cartString = prefs.getString("cartInfo"); + // List tempList = (json.decode(cartString.toString()) as List).cast(); + // int tempIndex = 0; + // int changeIndex = 0; + // tempList.forEach((item) { + // if (item["itemid"] == cartItem.itemid) { + // changeIndex = tempIndex; + // } + // tempIndex++; + // }); + // tempList[changeIndex] = cartItem.toJson(); + // cartString = json.encode(tempList).toString(); + // prefs.setString("cartInfo", cartString); + // await getCartInfo(); + notifyListeners(); } ///全选商品 @@ -140,7 +141,8 @@ class CartProvidde with ChangeNotifier { }); cartString = json.encode(newList).toString(); prefs.setString("cartInfo", cartString); - await getCartInfo(); + // await getCartInfo(); + notifyListeners(); } ///商品数量加减 diff --git a/lib/provider/user_provider.dart b/lib/provider/user_provider.dart new file mode 100644 index 00000000..453b878f --- /dev/null +++ b/lib/provider/user_provider.dart @@ -0,0 +1,10 @@ +import 'package:flutter/material.dart'; +class UserProvider extends ChangeNotifier{ + //登录状态管理 + bool _isSigned =false; + get isSigned => _isSigned; + setisSigned(bool state){ + _isSigned=state; + notifyListeners(); + } +} \ No newline at end of file diff --git a/lib/widget/bottom_button.dart b/lib/widget/bottom_button.dart index 3cd8449f..3c1fd819 100644 --- a/lib/widget/bottom_button.dart +++ b/lib/widget/bottom_button.dart @@ -27,7 +27,7 @@ class _BottomButtonState extends State { ? BaseStyle.color999999 : BaseStyle.colorffc40c, padding: EdgeInsets.symmetric( - vertical: Screenutil.length(26.5), + vertical: 26.5.w, ), child: Text( widget.title, diff --git a/lib/widget/common_app_bar.dart b/lib/widget/common_app_bar.dart index 2259fc8c..ea970b45 100644 --- a/lib/widget/common_app_bar.dart +++ b/lib/widget/common_app_bar.dart @@ -143,7 +143,7 @@ class CommonAppBar extends StatelessWidget { fontSize: 28.sp, ), labelPadding: - EdgeInsets.symmetric(horizontal: Screenutil.length(131.5)), + EdgeInsets.symmetric(horizontal: 131.5.w), indicatorColor: Color(0xffffc40c), indicatorSize: TabBarIndicatorSize.label, indicatorPadding: diff --git a/pubspec.yaml b/pubspec.yaml index 56e770c2..36f14c88 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -15,7 +15,7 @@ publish_to: 'none' # Remove this line if you wish to publish to pub.dev # In iOS, build-name is used as CFBundleShortVersionString while build-number used as CFBundleVersion. # Read more about iOS versioning at # https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html -version: 1.0.7+8 +version: 1.0.8+9 environment: sdk: ">=2.7.0 <3.0.0"