From 2bd339a3bcccec1240175642dd63eeabda198e31 Mon Sep 17 00:00:00 2001 From: zhang <494089941@qq.com> Date: Wed, 28 Oct 2020 14:06:21 +0800 Subject: [PATCH] =?UTF-8?q?=E7=A4=BE=E5=8C=BA=E9=A1=B5=E9=9D=A2=E7=88=B1?= =?UTF-8?q?=E5=BF=83=E6=8C=89=E9=92=AE=EF=BC=8C=E5=A4=B4=E5=83=8F=E6=98=BE?= =?UTF-8?q?=E7=A4=BA=E9=80=BB=E8=BE=91=E6=9B=B4=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- assets/example/touxiang3.jpeg | Bin 0 -> 25510 bytes lib/main.dart | 4 -- lib/pages/community/widget/tab_list.dart | 10 ++- lib/pages/community/widget/trend_card.dart | 32 +++++++--- .../market_cart_page/market_cart_page.dart | 59 +++++++----------- lib/provider/cart.dart | 37 +++++------ 6 files changed, 72 insertions(+), 70 deletions(-) create mode 100644 assets/example/touxiang3.jpeg diff --git a/assets/example/touxiang3.jpeg b/assets/example/touxiang3.jpeg new file mode 100644 index 0000000000000000000000000000000000000000..33ea522944f59f13b8864ec733a010c045fe8dab GIT binary patch literal 25510 zcmb@t2UL^Gx;GxgiUko61%g`;kRTu>R0DfU?ZN~i*%_ulz9XPvfU^;REP&?9)oWKT(_FiH?Z$PQ8??-Hw6|{2KDc|2o|*F@H`k+wk2rYvrG$8% zh(FlDg8b>QcWwm-!nJs_Qpy(B7nFqoZS!0X+iA{Qpj8UjcMi zFBD!Vq^4pAT%e<(rlUG*0I&k6092RG(f(JuLUrNdrOVV;&!1}D22fE`Q(e4t?b5}o z7p`78e~sz_^~Fncm#^G;C`kXCw&`02_U8_vDFxqpID~|C92w0D*B{A3--V@q|LN3w zms8X^yl85JiAw|wgTFUFr^s^N)dlMR)*scy3)Gh`UparsM|b}4!g-zQBGpCezhgS@ zj_%^6zjr3Yz^-ljoRLG=K}6@R*%=vdr!zEh>_&YP*gtS zPWX68S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_Q1YnxGkpoWK1HF6hhy/it/u=107966910,699677438&fm=26&gp=0.jpg', 'https://ss2.bdstatic.com/70cFvnSh_Q1YnxGkpoWK1HF6hhy/it/u=3011269428,2056805718&fm=26&gp=0.jpg' ], - 'isLike':false + 'isLike':false, + 'avatar':Image.asset('assets/example/touxiang1.png'), }, { 'name': '马泽鹏', @@ -95,7 +96,8 @@ class _TabListState extends State with AutomaticKeepAliveClientMixin { 'https://ss0.bdstatic.com/70cFuHSh_Q1YnxGkpoWK1HF6hhy/it/u=3445658157,2379681095&fm=26&gp=0.jpg', 'https://ss1.bdstatic.com/70cFuXSh_Q1YnxGkpoWK1HF6hhy/it/u=3539674557,3804837870&fm=26&gp=0.jpg', ], - 'isLike':true + 'isLike':true, + 'avatar':Image.asset('assets/example/touxiang2.png') }, { 'name': '王管事', @@ -104,7 +106,8 @@ class _TabListState extends State with AutomaticKeepAliveClientMixin { 'https://ss1.bdstatic.com/70cFuXSh_Q1YnxGkpoWK1HF6hhy/it/u=2446247351,2922660058&fm=26&gp=0.jpg', 'https://timgsa.baidu.com/timg?image&quality=80&size=b9999_10000&sec=1601274815221&di=3a50314a4d2c7188f6003f67d24177c2&imgtype=0&src=http%3A%2F%2Fimg1.cache.netease.com%2Fcatchpic%2F6%2F62%2F620DAF59053DF902F1D991EDBF14FD26.gif', ], - 'isLike':false + 'isLike':false, + 'avatar':Image.asset('assets/example/touxiang3.jpeg') }, ]; @@ -155,6 +158,7 @@ class _TabListState extends State with AutomaticKeepAliveClientMixin { content: _newsList[index]['content'], imageUrl: _newsList[index]['imageUrl'], isLike: _newsList[index]['isLike'], + avatar:_newsList[index]['avatar'] ) : widget.index == 1 ? TopicCard( diff --git a/lib/pages/community/widget/trend_card.dart b/lib/pages/community/widget/trend_card.dart index b7822ddb..9cb1a527 100644 --- a/lib/pages/community/widget/trend_card.dart +++ b/lib/pages/community/widget/trend_card.dart @@ -1,3 +1,4 @@ + import 'dart:ui'; import 'package:flutter/material.dart'; import 'package:flutter/cupertino.dart'; @@ -5,13 +6,15 @@ import 'package:flutter_icons/flutter_icons.dart'; import 'package:akuCommunity/utils/screenutil.dart'; import 'package:akuCommunity/widget/expandable_text.dart'; import 'package:akuCommunity/widget/image_grid.dart'; +import 'package:flutter_screenutil/flutter_screenutil.dart'; class TrendCard extends StatefulWidget { final String name; final String content; final List imageUrl; final bool isLike; - TrendCard({Key key, this.name, this.content, this.imageUrl, this.isLike}) + final Image avatar; + TrendCard({Key key, this.name, this.content, this.imageUrl, this.isLike, this.avatar}) : super(key: key); @override @@ -19,6 +22,12 @@ class TrendCard extends StatefulWidget { } class _TrendCardState extends State { + bool _isLike; + @override + void initState() { + super.initState(); + _isLike=widget.isLike??false; + } void _showDialog(String url) { showCupertinoDialog( context: context, @@ -294,7 +303,7 @@ class _TrendCardState extends State { ); } - Widget _columnCard(String name, String content, bool isLike) { + Widget _columnCard(String name, String content,Image avatar) { return Stack( children: [ Column( @@ -303,10 +312,10 @@ class _TrendCardState extends State { children: [ Row( children: [ - Image.asset( - 'assets/example/touxiang1.png', - height: Screenutil.length(86), - width: Screenutil.length(86), + Container( + width: 86.w, + height: 86.w, + child: avatar, ), SizedBox(width: Screenutil.length(9)), Column( @@ -356,12 +365,15 @@ class _TrendCardState extends State { bottom: 0, child: InkWell( onTap: () { - isLike = !isLike; + setState(() { + _isLike = !_isLike; + }); + }, child: Icon( - isLike ? AntDesign.heart : AntDesign.hearto, + _isLike ? AntDesign.heart : AntDesign.hearto, color: - isLike ? Color(0xffff6666) : Color(0xffd8d8d8), + _isLike ? Color(0xffff6666) : Color(0xffd8d8d8), size: Screenutil.size(36), ), ), @@ -419,7 +431,7 @@ class _TrendCardState extends State { bottom: Screenutil.length(22), right: Screenutil.length(32), ), - child: _columnCard(widget.name, widget.content, widget.isLike), + child: _columnCard(widget.name, widget.content,widget.avatar) ); } } 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 e116bc8b..044c20e4 100644 --- a/lib/pages/market/market_cart_page/market_cart_page.dart +++ b/lib/pages/market/market_cart_page/market_cart_page.dart @@ -116,40 +116,29 @@ class MarketCartPage extends StatelessWidget { @override Widget build(BuildContext context) { return Scaffold( - appBar: PreferredSize( - child: MarketCartAppBar(), - preferredSize: Size.fromHeight(kToolbarHeight), - ), - body: FutureBuilder( - future: _getCartInfo(context), - builder: (BuildContext context, snapshot) { - if (snapshot.hasData) { - // List cartList = Provider.of(context).cartList; - return Stack( - children: [ - Consumer( - builder: (context, model, child) { - List cartList = model.cartList; - return ListView.builder( - itemCount: cartList.length, - itemBuilder: (BuildContext context, int index) { - return MarketCartCard( - cartItem: cartList[index], - ); - }); - }, - ), - Positioned( - bottom: 0, - child: MarketCartBottomBar(), - ), - ], - ); - } else { - return Text('正在加载中'); - } - }, - ), - ); + appBar: PreferredSize( + child: MarketCartAppBar(), + preferredSize: Size.fromHeight(kToolbarHeight), + ), + body: Stack( + children: [ + Consumer( + builder: (context, model, child) { + List cartList = model.cartList; + return ListView.builder( + itemCount: cartList.length, + itemBuilder: (BuildContext context, int index) { + return MarketCartCard( + cartItem: cartList[index], + ); + }); + }, + ), + Positioned( + bottom: 0, + child: MarketCartBottomBar(), + ), + ], + )); } } diff --git a/lib/provider/cart.dart b/lib/provider/cart.dart index b70be669..acc2e110 100644 --- a/lib/provider/cart.dart +++ b/lib/provider/cart.dart @@ -12,8 +12,6 @@ class CartProvidde with ChangeNotifier { int allGoodsCount = 0; bool isAllCheck = true; - - save(itemid, itemtitle, count, itemprice, itempic) async { SharedPreferences prefs = await SharedPreferences.getInstance(); cartString = prefs.getString("cartString"); @@ -60,7 +58,7 @@ class CartProvidde with ChangeNotifier { getCartInfo() async { SharedPreferences prefs = await SharedPreferences.getInstance(); cartString = prefs.getString("cartInfo"); - cartList = []; + // cartList = []; if (cartString == null) { cartList = []; } else { @@ -85,21 +83,24 @@ class CartProvidde with ChangeNotifier { ///删除单个购物车商品 deleteGoods(String itemid) async { - SharedPreferences prefs = await SharedPreferences.getInstance(); - cartString = prefs.getString("cartInfo"); - List tempList = (json.decode(cartString.toString()) as List).cast(); - int tempIndex = 0; - int deleteIndex = 0; - tempList.forEach((item) { - if (item["itemid"] == itemid) { - deleteIndex = tempIndex; - } - tempIndex++; - }); - tempList.removeAt(deleteIndex); - 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 deleteIndex = 0; + // tempList.forEach((item) { + // if (item["itemid"] == itemid) { + // deleteIndex = tempIndex; + // } + // tempIndex++; + // }); + // tempList.removeAt(deleteIndex); + // cartString = json.encode(tempList).toString(); + // prefs.setString("cartInfo", cartString); + // await getCartInfo(); + + cartList.removeWhere((element) => element.itemid == itemid); + notifyListeners(); } ///单选商品