From ed61867ab75eb2be6b2af221b5894013ac3e022f Mon Sep 17 00:00:00 2001 From: datang Date: Mon, 6 Jun 2022 13:57:59 +0800 Subject: [PATCH] =?UTF-8?q?=E7=A4=BE=E5=8C=BA=E8=AF=84=E8=AE=BA=E5=88=A0?= =?UTF-8?q?=E9=99=A4=E6=8C=89=E9=92=AE=E9=97=AE=E9=A2=98=EF=BC=8C=E7=A4=BE?= =?UTF-8?q?=E5=8C=BA=E8=AF=84=E8=AE=BAicon=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../community_views/event_detail_page.dart | 153 ++++++++---------- .../community_views/widgets/chat_card.dart | 1 + 2 files changed, 70 insertions(+), 84 deletions(-) diff --git a/lib/ui/community/community_views/event_detail_page.dart b/lib/ui/community/community_views/event_detail_page.dart index ee7a230c..4f8df288 100644 --- a/lib/ui/community/community_views/event_detail_page.dart +++ b/lib/ui/community/community_views/event_detail_page.dart @@ -106,18 +106,15 @@ class _EventDetailPageState extends State { @override Widget build(BuildContext context) { return BeeScaffold( - leading: Navigator.canPop(context) ? IconButton( - onPressed: () => Get.back(result: true), - icon: Icon( - CupertinoIcons.chevron_back, - color: Colors.black, - ), - ) + onPressed: () => Get.back(result: true), + icon: Icon( + CupertinoIcons.chevron_back, + color: Colors.black, + ), + ) : SizedBox(), - - title: '详情', bottomNavi: _bottomButton(), actions: [ @@ -303,8 +300,9 @@ class _EventDetailPageState extends State { ); } - Widget _commentWidget(CommentListModel model, int rootIndex) { - return GestureDetector( + Widget _commentWidget(CommentListModel model, int rootIndex){ + final userProvider = Provider.of(context); + return GestureDetector( onTap: () { _rootId = model.id; _parentId = model.id; @@ -363,9 +361,9 @@ class _EventDetailPageState extends State { ), Spacer(), CommunityPopButton( - isMyself: _isMyself, + isMyself: userProvider.userInfoModel?.id==model.createId, onSelect: (value) async { - if (_isMyself) { + if (userProvider.userInfoModel?.id==model.createId) { await CommunityFunc.deleteComment(model.id); _refreshController.callRefresh(); } @@ -374,80 +372,68 @@ class _EventDetailPageState extends State { 40.hb, model.content.text.size(28.sp).color(ktextSubColor).make(), 30.hb, - GestureDetector( - onTap: () async { - var res = - await NetUtil().get(SAASAPI.community.commentLike, params: { - 'commentId': model.id, - }); - if (res.success) { - _likes[rootIndex] = !_likes[rootIndex]; - setState(() {}); - } - }, - child: Row( - children: [ - Spacer(), - GestureDetector( - onTap: () async { - var base = await NetUtil().get( - SAASAPI.community.commentLike, - params: {'commentId': model.id}); - if (base.success) { - _likes[rootIndex] = !_likes[rootIndex]; - if (_likes[rootIndex]) { - _likeNums[rootIndex] += 1; - } else { - _likeNums[rootIndex] -= 1; - } - BotToast.showText( - text: _likes[rootIndex] ? '点赞成功' : '取消点赞成功'); + Row( + children: [ + Spacer(), + GestureDetector( + onTap: () async { + var base = await NetUtil().get( + SAASAPI.community.commentLike, + params: {'commentId': model.id}); + if (base.success) { + _likes[rootIndex] = !_likes[rootIndex]; + if (_likes[rootIndex]) { + _likeNums[rootIndex] += 1; } else { - BotToast.showText(text: base.msg); + _likeNums[rootIndex] -= 1; } + BotToast.showText( + text: _likes[rootIndex] ? '点赞成功' : '取消点赞成功'); + } else { + BotToast.showText(text: base.msg); + } - setState(() {}); - }, - child: Material( - color: Colors.transparent, - child: Row( - children: [ - Image.asset( - R.ASSETS_ICONS_COMMUNITY_LIKE_PNG, - width: 32.w, - height: 32.w, - color: !_likes[rootIndex] - ? Colors.black.withOpacity(0.45) - : kPrimaryColor, - ), - 5.wb, - '${_likeNums[rootIndex]}' - .text - .size(24.sp) - .color(Color(0xFF999999)) - .make(), - ], - ), + setState(() {}); + }, + child: Material( + color: Colors.transparent, + child: Row( + children: [ + Image.asset( + R.ASSETS_ICONS_COMMUNITY_LIKE_PNG, + width: 32.w, + height: 32.w, + color: !_likes[rootIndex] + ? Colors.black.withOpacity(0.45) + : kPrimaryColor, + ), + 5.wb, + '${_likeNums[rootIndex]}' + .text + .size(24.sp) + .color(Color(0xFF999999)) + .make(), + ], ), ), - 32.wb, - Row( - children: [ - Image.asset( - R.ASSETS_ICONS_COMMUNITY_COMMENT_PNG, - width: 40.w, - height: 40.w, - ), - ], - ), - 5.wb, - '${model.commentNum}' - .text - .size(24.sp) - .color(Color(0xFF999999)) - .make(), - ], - ), + ), + 32.wb, + Row( + children: [ + Image.asset( + R.ASSETS_ICONS_COMMUNITY_COMMENT_PNG, + width: 40.w, + height: 40.w, + ), + ], + ), + 5.wb, + '${model.commentNum}' + .text + .size(24.sp) + .color(Color(0xFF999999)) + .make(), + ], ), 40.hb, model.commentTwoList.isEmpty @@ -535,7 +521,7 @@ class _EventDetailPageState extends State { fontSize: 28.sp, ), children: [ - if (model.createId ==widget.createId) + if (model.createId == widget.createId) WidgetSpan( child: Container( width: 56.w, @@ -584,7 +570,6 @@ class _EventDetailPageState extends State { } _bottomButton() { - final userProvider = Provider.of(context); return Container( width: double.infinity, height: 100.w, diff --git a/lib/ui/community/community_views/widgets/chat_card.dart b/lib/ui/community/community_views/widgets/chat_card.dart index abc60097..e5226df4 100644 --- a/lib/ui/community/community_views/widgets/chat_card.dart +++ b/lib/ui/community/community_views/widgets/chat_card.dart @@ -247,6 +247,7 @@ class _ChatCardState extends State { ], ), Spacer(), + CommunityPopButton( isMyself: _isMyself, onSelect: (dynamic _) async {