diff --git a/lib/constants/sars_api.dart b/lib/constants/sars_api.dart index 2a7bd4d3..80f83e97 100644 --- a/lib/constants/sars_api.dart +++ b/lib/constants/sars_api.dart @@ -103,6 +103,9 @@ class _Message { } class _Community { + ///查询动态下的单个评论信息 + String get singleComment => '/app/user/community/comment/findById'; + ///话题详情 String get topicDetail => '/app/user/community/topic/findById'; diff --git a/lib/model/community/my_event_item_model.dart b/lib/model/community/my_event_item_model.dart index a7deb53c..46a9c6db 100644 --- a/lib/model/community/my_event_item_model.dart +++ b/lib/model/community/my_event_item_model.dart @@ -1,7 +1,7 @@ -import 'package:common_utils/common_utils.dart'; - import 'package:aku_new_community/model/common/img_model.dart'; +import 'package:common_utils/common_utils.dart'; +@Deprecated('old model to deprecate') class MyEventItemModel { int? id; String? content; diff --git a/lib/models/community/comment_list_model.g.dart b/lib/models/community/comment_list_model.g.dart index db45f831..6b6ce3b8 100644 --- a/lib/models/community/comment_list_model.g.dart +++ b/lib/models/community/comment_list_model.g.dart @@ -32,7 +32,7 @@ CommentTwoList _$CommentTwoListFromJson(Map json) => createId: json['createId'] as int, createName: json['createName'] as String, parentId: json['parentId'] as int, - parentName: json['parentName'] as String, + parentName: json['parentName'] as String?, createDate: json['createDate'] as String, avatarImgList: (json['avatarImgList'] as List) .map((e) => ImgModel.fromJson(e as Map)) diff --git a/lib/models/community/dynamic_my_list_body.dart b/lib/models/community/dynamic_my_list_body.dart new file mode 100644 index 00000000..ba71c126 --- /dev/null +++ b/lib/models/community/dynamic_my_list_body.dart @@ -0,0 +1,36 @@ +import 'package:aku_new_community/model/common/img_model.dart'; +import 'package:aku_new_community/models/community/all_dynamic_list_model.dart'; +import 'package:json_annotation/json_annotation.dart'; + +part 'dynamic_my_list_body.g.dart'; + +@JsonSerializable() +class DynamicMyListBody { + final int id; + final String? content; + final int isComment; + final int isPublic; + final String createDate; + final int likes; + final int views; + final int commentNum; + final List dynamicImgList; + final List topicTags; + final bool isLike; + factory DynamicMyListBody.fromJson(Map json) => + _$DynamicMyListBodyFromJson(json); + + const DynamicMyListBody({ + required this.id, + this.content, + required this.isComment, + required this.isPublic, + required this.createDate, + required this.likes, + required this.views, + required this.commentNum, + required this.dynamicImgList, + required this.topicTags, + required this.isLike, + }); +} diff --git a/lib/models/community/dynamic_my_list_body.g.dart b/lib/models/community/dynamic_my_list_body.g.dart new file mode 100644 index 00000000..835e0360 --- /dev/null +++ b/lib/models/community/dynamic_my_list_body.g.dart @@ -0,0 +1,26 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'dynamic_my_list_body.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +DynamicMyListBody _$DynamicMyListBodyFromJson(Map json) => + DynamicMyListBody( + id: json['id'] as int, + content: json['content'] as String?, + isComment: json['isComment'] as int, + isPublic: json['isPublic'] as int, + createDate: json['createDate'] as String, + likes: json['likes'] as int, + views: json['views'] as int, + commentNum: json['commentNum'] as int, + dynamicImgList: (json['dynamicImgList'] as List) + .map((e) => ImgModel.fromJson(e as Map)) + .toList(), + topicTags: (json['topicTags'] as List) + .map((e) => TopicTag.fromJson(e as Map)) + .toList(), + isLike: json['isLike'] as bool, + ); diff --git a/lib/models/community/dynamic_my_list_head.dart b/lib/models/community/dynamic_my_list_head.dart new file mode 100644 index 00000000..8bd1d7bf --- /dev/null +++ b/lib/models/community/dynamic_my_list_head.dart @@ -0,0 +1,25 @@ +import 'package:aku_new_community/model/common/img_model.dart'; +import 'package:json_annotation/json_annotation.dart'; + +part 'dynamic_my_list_head.g.dart'; + +@JsonSerializable() +class DynamicMyListHead { + final int id; + final String createName; + final List avatarImgList; + final int dynamicNum; + final int commentNum; + final int likesNum; + factory DynamicMyListHead.fromJson(Map json) => + _$DynamicMyListHeadFromJson(json); + + const DynamicMyListHead({ + required this.id, + required this.createName, + required this.avatarImgList, + required this.dynamicNum, + required this.commentNum, + required this.likesNum, + }); +} diff --git a/lib/models/community/dynamic_my_list_head.g.dart b/lib/models/community/dynamic_my_list_head.g.dart new file mode 100644 index 00000000..2c64b793 --- /dev/null +++ b/lib/models/community/dynamic_my_list_head.g.dart @@ -0,0 +1,19 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'dynamic_my_list_head.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +DynamicMyListHead _$DynamicMyListHeadFromJson(Map json) => + DynamicMyListHead( + id: json['id'] as int, + createName: json['createName'] as String, + avatarImgList: (json['avatarImgList'] as List) + .map((e) => ImgModel.fromJson(e as Map)) + .toList(), + dynamicNum: json['dynamicNum'] as int, + commentNum: json['commentNum'] as int, + likesNum: json['likesNum'] as int, + ); diff --git a/lib/ui/community/community_func.dart b/lib/ui/community/community_func.dart index 3a73f883..346db155 100644 --- a/lib/ui/community/community_func.dart +++ b/lib/ui/community/community_func.dart @@ -3,9 +3,9 @@ import 'package:aku_new_community/constants/sars_api.dart'; import 'package:aku_new_community/model/community/activity_item_model.dart'; import 'package:aku_new_community/model/community/board_model.dart'; import 'package:aku_new_community/model/community/hot_news_model.dart'; -import 'package:aku_new_community/model/community/my_event_item_model.dart'; import 'package:aku_new_community/model/community/swiper_model.dart'; import 'package:aku_new_community/model/good/market_swiper_model.dart'; +import 'package:aku_new_community/models/community/dynamic_my_list_body.dart'; import 'package:aku_new_community/models/community/topic_model.dart'; import 'package:aku_new_community/models/market/goods_popular_model.dart'; import 'package:aku_new_community/models/market/market_all_category_model.dart'; @@ -28,13 +28,13 @@ class CommunityFunc { } ///我的动态 - static Future> getMyEventItem() async { + static Future> getMyEventItem() async { BaseListModel model = await NetUtil().getList( - API.community.myEvent, + SARSAPI.community.dynamicMyListL, params: {'pageNum': 1, 'size': 8}, ); if (model.rows.length == 0) return []; - return model.rows.map((e) => MyEventItemModel.fromJson(e)).toList(); + return model.rows.map((e) => DynamicMyListBody.fromJson(e)).toList(); } ///查询热门资讯 diff --git a/lib/ui/community/community_views/event_detail_page.dart b/lib/ui/community/community_views/event_detail_page.dart index dba33411..7f61146f 100644 --- a/lib/ui/community/community_views/event_detail_page.dart +++ b/lib/ui/community/community_views/event_detail_page.dart @@ -1,7 +1,6 @@ import 'dart:math'; import 'package:aku_new_community/base/base_style.dart'; -import 'package:aku_new_community/constants/api.dart'; import 'package:aku_new_community/constants/sars_api.dart'; import 'package:aku_new_community/model/common/img_model.dart'; import 'package:aku_new_community/models/community/comment_list_model.dart'; @@ -14,6 +13,7 @@ import 'package:aku_new_community/utils/headers.dart'; import 'package:aku_new_community/utils/login_util.dart'; import 'package:aku_new_community/utils/network/base_model.dart'; import 'package:aku_new_community/utils/network/net_util.dart'; +import 'package:aku_new_community/widget/bee_divider.dart'; import 'package:aku_new_community/widget/bee_scaffold.dart'; import 'package:bot_toast/bot_toast.dart'; import 'package:common_utils/common_utils.dart'; @@ -47,33 +47,42 @@ class _EventDetailPageState extends State { } TextEditingController _textEditingController = TextEditingController(); - int rootId = 0; - int parentId = 0; + + //评论根id + int _rootId = 0; + + //回复的id + int _parentId = 0; int _page = 1; int _type = 1; int _size = 10; + int _currentCommentIndex = 0; List _comments = []; + List _folds = []; + List _likes = []; //评论输入框焦点 FocusNode _focusNode = FocusNode(); Map get params => { - 'rootId': rootId, - 'parentId': parentId, + 'rootId': _rootId, + 'parentId': _parentId, 'dynamicId': widget.dynamicId, 'content': _textEditingController.text }; Future updateComments() async { - var base = await NetUtil().getList(SARSAPI.community.commentList, params: { - 'pageNum': _page, - 'size': _size, - 'dynamicId': widget.dynamicId, - 'type': _type, + var base = await NetUtil().get(SARSAPI.community.singleComment, params: { + 'commentId': _comments[_currentCommentIndex].id, }); - _comments.replaceRange((_page - 1) * _size, _page * _size, - base.rows.map((e) => CommentListModel.fromJson(e)).toList()); + if (base.success) { + _comments.removeAt(_currentCommentIndex); + _comments.insert( + _currentCommentIndex, CommentListModel.fromJson(base.data)); + } else { + BotToast.showText(text: base.msg); + } setState(() {}); } @@ -120,11 +129,6 @@ class _EventDetailPageState extends State { )); if (result == true) { - await NetUtil().get( - API.community.deleteMyEvent, - params: {'dynamicId': widget.dynamicId}, - showMessage: true, - ); if (widget.onDelete != null) { widget.onDelete!(); Get.back(); @@ -145,7 +149,6 @@ class _EventDetailPageState extends State { ); _model = DynamicDetailModel.fromJson(model.data); _page = 1; - var base = await NetUtil().getList(SARSAPI.community.commentList, params: { 'pageNum': _page, @@ -155,6 +158,14 @@ class _EventDetailPageState extends State { }); _comments = base.rows.map((e) => CommentListModel.fromJson(e)).toList(); + _folds = List.filled(_size, true); + _comments.forEach((element) { + if (element.isLike) { + _likes.add(true); + } else { + _likes.add(false); + } + }); setState(() {}); }, onLoad: () async { @@ -167,8 +178,17 @@ class _EventDetailPageState extends State { 'type': _type, }); if (_comments.length < base.total) { - _comments.addAll( - base.rows.map((e) => CommentListModel.fromJson(e)).toList()); + var _list = + base.rows.map((e) => CommentListModel.fromJson(e)).toList(); + _comments.addAll(_list); + _folds.addAll(List.filled(_list.length, true)); + _list.forEach((element) { + if (element.isLike) { + _likes.add(true); + } else { + _likes.add(false); + } + }); } setState(() {}); }, @@ -178,18 +198,30 @@ class _EventDetailPageState extends State { SliverToBoxAdapter( child: Column( children: [ - ChatCardDetail( - model: _model!, - hideLine: true, - canTap: false, + GestureDetector( + onTap: () { + _rootId = 0; + _parentId = 0; + }, + child: ChatCardDetail( + model: _model!, + hideLine: true, + canTap: false, + ), ), _renderLikeAndCommentWidget(), ], ), ), SliverList( - delegate: SliverChildListDelegate( - _comments.map((e) => _commentWidget(e)).toList())) + delegate: SliverChildListDelegate(_comments + .mapIndexed((e, index) => _commentWidget(e, index)) + .toList() + .sepWidget( + separate: BeeDivider.horizontal( + indent: 32.w, + endIndent: 32.w, + )))) ], ), ); @@ -257,8 +289,9 @@ class _EventDetailPageState extends State { ); } - Widget _commentWidget(CommentListModel model) { + Widget _commentWidget(CommentListModel model, int rootIndex) { return Container( + // key: UniqueKey(), color: Colors.white, padding: EdgeInsets.symmetric(vertical: 32.w, horizontal: 32.w), width: double.infinity, @@ -313,34 +346,63 @@ class _EventDetailPageState extends State { 40.hb, model.content.text.size(28.sp).color(ktextSubColor).make(), 30.hb, - Row( - children: [ - Spacer(), - Image.asset( - R.ASSETS_ICONS_COMMUNITY_LIKE_PNG, - width: 40.w, - height: 40.w, - ), - 5.wb, - '${model.likes}'.text.size(24.sp).color(Color(0xFF999999)).make(), - 32.wb, - 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(), - ], + GestureDetector( + onTap: () async { + var res = + await NetUtil().get(SARSAPI.community.commentLike, params: { + 'commentId': model.id, + }); + if (res.success) { + _likes[rootIndex] = !_likes[rootIndex]; + setState(() {}); + } + }, + child: Row( + children: [ + Spacer(), + Image.asset( + R.ASSETS_ICONS_COMMUNITY_LIKE_PNG, + width: 40.w, + height: 40.w, + ), + 5.wb, + '${model.likes}' + .text + .size(24.sp) + .color(Color(0xFF999999)) + .make(), + 32.wb, + GestureDetector( + onTap: () { + _rootId = model.id; + _parentId = model.id; + _focusNode.requestFocus(); + _currentCommentIndex = rootIndex; + }, + child: 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 ? SizedBox.shrink() : Container( + alignment: Alignment.topLeft, decoration: BoxDecoration( color: Colors.black.withOpacity(0.06), borderRadius: BorderRadius.circular(16.w)), @@ -349,11 +411,20 @@ class _EventDetailPageState extends State { padding: EdgeInsets.symmetric(vertical: 24.w, horizontal: 32.w), child: Column( - children: model.commentTwoList - .map((e) => - _subCommentWidget(e, model.createId, model.id)) - .toList() - .sepWidget(separate: 24.hb), + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + ...List.generate( + model.commentTwoList.length < 3 + ? model.commentTwoList.length + : 3, + (index) => _subCommentWidget( + model.commentTwoList[index], + model.createId, + model.id, + rootIndex)), + if (model.commentTwoList.length > 3) + _foldComment(model, rootIndex) + ].sepWidget(separate: 24.hb), ), ), ], @@ -361,12 +432,43 @@ class _EventDetailPageState extends State { ); } - Widget _subCommentWidget(CommentTwoList model, int createId, int rootId) { + Widget _foldComment(CommentListModel model, int rootIndex) { + return _folds[rootIndex] + ? Row( + children: [ + '共有${model.commentNum}条回复' + .text + .size(28.sp) + .color(Colors.black.withOpacity(0.45)) + .make(), + Spacer(), + TextButton( + onPressed: () { + _folds[rootIndex] = false; + setState(() {}); + }, + child: '展开'.text.size(28.sp).color(Color(0xFF5D98F9)).make()) + ], + ) + : Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + ...List.generate( + model.commentTwoList.length - 3, + (index) => _subCommentWidget(model.commentTwoList[index + 3], + model.createId, model.id, rootIndex)) + ].sepWidget(separate: 24.hb), + ); + } + + Widget _subCommentWidget( + CommentTwoList model, int createId, int rootId, int rootIndex) { return GestureDetector( onTap: () { - rootId = rootId; - parentId = model.id; + _rootId = rootId; + _parentId = model.id; _focusNode.requestFocus(); + _currentCommentIndex = rootIndex; }, child: RichText( text: TextSpan( @@ -376,11 +478,13 @@ class _EventDetailPageState extends State { fontSize: 28.sp, ), children: [ - if (rootId == model.createId) + if (createId == model.createId) WidgetSpan( child: Container( width: 56.w, height: 28.w, + margin: EdgeInsets.only(left: 4.w, right: 4.w, bottom: 4.w), + alignment: Alignment.center, decoration: BoxDecoration( color: Color(0xFFF8B133), borderRadius: BorderRadius.circular(4.w)), @@ -423,6 +527,8 @@ class _EventDetailPageState extends State { width: double.infinity, height: 100.w, padding: EdgeInsets.symmetric(vertical: 16.w, horizontal: 32.w), + margin: + EdgeInsets.only(bottom: MediaQuery.of(context).viewInsets.bottom), decoration: BoxDecoration( color: Colors.white, ), @@ -438,6 +544,7 @@ class _EventDetailPageState extends State { child: TextField( controller: _textEditingController, focusNode: _focusNode, + autofocus: false, decoration: InputDecoration( hintText: '参与评论', contentPadding: @@ -465,7 +572,12 @@ class _EventDetailPageState extends State { .post(SARSAPI.community.commentInsert, params: params); if (res.success) { _textEditingController.clear(); - await updateComments(); + if (_rootId == 0) { + _refreshController.callRefresh(); + } else { + await updateComments(); + _focusNode.unfocus(); + } setState(() {}); } else { BotToast.showText(text: res.msg); diff --git a/lib/ui/community/community_views/my_community_view.dart b/lib/ui/community/community_views/my_community_view.dart index 417ace07..f547ad4c 100644 --- a/lib/ui/community/community_views/my_community_view.dart +++ b/lib/ui/community/community_views/my_community_view.dart @@ -1,20 +1,22 @@ -import 'package:flutter/cupertino.dart'; -import 'package:flutter/material.dart'; - -import 'package:flutter_easyrefresh/easy_refresh.dart'; -import 'package:get/get.dart'; - import 'package:aku_new_community/constants/api.dart'; import 'package:aku_new_community/constants/sars_api.dart'; import 'package:aku_new_community/model/common/img_model.dart'; import 'package:aku_new_community/model/community/my_event_item_model.dart'; +import 'package:aku_new_community/models/community/dynamic_my_list_body.dart'; +import 'package:aku_new_community/models/community/dynamic_my_list_head.dart'; import 'package:aku_new_community/pages/things_page/widget/bee_list_view.dart'; import 'package:aku_new_community/ui/community/community_views/widgets/my_event_card.dart'; import 'package:aku_new_community/utils/headers.dart'; import 'package:aku_new_community/utils/login_util.dart'; +import 'package:aku_new_community/utils/network/net_util.dart'; import 'package:aku_new_community/widget/line/vertical_line_painter.dart'; import 'package:aku_new_community/widget/picker/bee_image_preview.dart'; import 'package:aku_new_community/widget/views/bee_grid_image_view.dart'; +import 'package:flutter/cupertino.dart'; +import 'package:flutter/material.dart'; +import 'package:flutter_easyrefresh/easy_refresh.dart'; +import 'package:get/get.dart'; + import '../community_func.dart'; class MyCommunityView extends StatefulWidget { @@ -28,7 +30,8 @@ class MyCommunityViewState extends State with AutomaticKeepAliveClientMixin { EasyRefreshController _refreshController = EasyRefreshController(); bool _onload = true; - List _myEventItems = []; + List _myEventItems = []; + DynamicMyListHead? _head; refresh() { _refreshController.callRefresh(); @@ -37,13 +40,103 @@ class MyCommunityViewState extends State @override Widget build(BuildContext context) { super.build(context); + var head = Container( + width: double.infinity, + decoration: BoxDecoration( + image: new DecorationImage( + image: new AssetImage( + R.ASSETS_IMAGES_COMMUNITY_MY_BG_PNG, + ), + fit: BoxFit.fitWidth), + ), + child: Column( + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + 12.hb, + Image.asset( + R.ASSETS_ICONS_ICON_LOGISTICS_PNG, + width: 132.w, + height: 132.w, + ), + 32.hb, + '${_head?.createName}' + .text + .size(32.sp) + .fontWeight(FontWeight.bold) + .color(Color(0xD9000000)) + .make(), + 12.hb, + '当一个新时代的有志青年'.text.size(24.sp).color(Color(0x73000000)).make(), + 32.hb, + ], + ), + ); + var headNum = Container( + width: double.infinity, + height: 156.w, + color: Colors.white, + child: Row( + crossAxisAlignment: CrossAxisAlignment.center, + mainAxisAlignment: MainAxisAlignment.center, + children: [ + Expanded( + child: Column( + crossAxisAlignment: CrossAxisAlignment.center, + mainAxisAlignment: MainAxisAlignment.center, + children: [ + '${_head?.dynamicNum}' + .text + .size(40.sp) + .fontWeight(FontWeight.bold) + .color(Color(0xD9000000)) + .make(), + '动态'.text.size(24.sp).color(Color(0x73000000)).make(), + ], + ), + ), + Expanded( + child: Column( + crossAxisAlignment: CrossAxisAlignment.center, + mainAxisAlignment: MainAxisAlignment.center, + children: [ + '${_head?.commentNum}' + .text + .size(40.sp) + .fontWeight(FontWeight.bold) + .color(Color(0xD9000000)) + .make(), + '评论'.text.size(24.sp).color(Color(0x73000000)).make(), + ], + ), + ), + Expanded( + child: Column( + crossAxisAlignment: CrossAxisAlignment.center, + mainAxisAlignment: MainAxisAlignment.center, + children: [ + '${_head?.likesNum}' + .text + .size(40.sp) + .fontWeight(FontWeight.bold) + .color(Color(0xD9000000)) + .make(), + '点赞'.text.size(24.sp).color(Color(0x73000000)).make(), + ], + ), + ), + ], + ), + ); return EasyRefresh( firstRefresh: true, header: MaterialHeader(), controller: _refreshController, onRefresh: () async { - // API.community.myEvent _myEventItems = await CommunityFunc.getMyEventItem(); + var base = await NetUtil().get(SARSAPI.community.dynamicMyListH); + if (base.success) { + _head = DynamicMyListHead.fromJson(base.data); + } _onload = false; setState(() {}); }, @@ -51,112 +144,15 @@ class MyCommunityViewState extends State ? SizedBox() : ListView( children: [ - Container( - width: double.infinity, - decoration: BoxDecoration( - image: new DecorationImage( - image: new AssetImage( - R.ASSETS_IMAGES_COMMUNITY_MY_BG_PNG, - ), - fit: BoxFit.fitWidth), - ), - child: Column( - crossAxisAlignment: CrossAxisAlignment.center, - children: [ - 12.hb, - Image.asset( - R.ASSETS_ICONS_ICON_LOGISTICS_PNG, - width: 132.w, - height: 132.w, - ), - 32.hb, - '吼姆拉' - .text - .size(32.sp) - .fontWeight(FontWeight.bold) - .color(Color(0xD9000000)) - .make(), - 12.hb, - '当一个新时代的天之圣杯' - .text - .size(24.sp) - .color(Color(0x73000000)) - .make(), - 32.hb, - ], - ), - ), - Container( - width: double.infinity, - height: 156.w, - color: Colors.white, - child: Row( - crossAxisAlignment: CrossAxisAlignment.center, - mainAxisAlignment: MainAxisAlignment.center, - children: [ - Expanded( - child: Column( - crossAxisAlignment: CrossAxisAlignment.center, - mainAxisAlignment: MainAxisAlignment.center, - children: [ - '111' - .text - .size(40.sp) - .fontWeight(FontWeight.bold) - .color(Color(0xD9000000)) - .make(), - '动态' - .text - .size(24.sp) - .color(Color(0x73000000)) - .make(), - ], - ), - ), - Expanded( - child: Column( - crossAxisAlignment: CrossAxisAlignment.center, - mainAxisAlignment: MainAxisAlignment.center, - children: [ - '111' - .text - .size(40.sp) - .fontWeight(FontWeight.bold) - .color(Color(0xD9000000)) - .make(), - '动态' - .text - .size(24.sp) - .color(Color(0x73000000)) - .make(), - ], - ), - ), - Expanded( - child: Column( - crossAxisAlignment: CrossAxisAlignment.center, - mainAxisAlignment: MainAxisAlignment.center, - children: [ - '111' - .text - .size(40.sp) - .fontWeight(FontWeight.bold) - .color(Color(0xD9000000)) - .make(), - '动态' - .text - .size(24.sp) - .color(Color(0x73000000)) - .make(), - ], - ), - ), - ], - ), - ), - ..._myEventItems.map( - (e) => _getMoments(e), - ), + head, + headNum, + 20.hb, + ..._myEventItems + .map( + (e) => _getMoments(e), + ) + .toList() + .sepWidget(separate: 20.hb), //_getMoments(), // _getMoments(), @@ -186,17 +182,21 @@ class MyCommunityViewState extends State ); } - Widget _getMoments(MyEventItemModel item) { + Widget _getMoments(DynamicMyListBody item) { return Container( padding: EdgeInsets.only(top: 32.w, left: 25.w, right: 32.w, bottom: 32.w), color: Colors.white, child: CustomPaint( painter: VerticalLinePainter( - color: Color(0x0F000000), //最后一个调整为透明 - width: 4.w, //根据UI调整即可 - paddingTop: 100.w, //根据UI调整即可 - paddingLeft: 0, //根据UI调整即可 + color: Color(0x0F000000), + //最后一个调整为透明 + width: 4.w, + //根据UI调整即可 + paddingTop: 100.w, + //根据UI调整即可 + paddingLeft: 0, + //根据UI调整即可 paddingBottom: 100.w), //根据UI child: Row( crossAxisAlignment: CrossAxisAlignment.start, @@ -310,9 +310,9 @@ class MyCommunityViewState extends State ); } - _renderImage(MyEventItemModel item) { - if (item.imgUrl!.isEmpty) return SizedBox(); - if (item.imgUrl!.length == 1) + _renderImage(DynamicMyListBody item) { + if (item.dynamicImgList.isEmpty) return SizedBox(); + if (item.dynamicImgList.length == 1) return MaterialButton( materialTapTargetSize: MaterialTapTargetSize.shrinkWrap, padding: EdgeInsets.zero, @@ -323,8 +323,8 @@ class MyCommunityViewState extends State ), onPressed: () { BeeImagePreview.toPath( - path: ImgModel.first(item.imgUrl), - tag: ImgModel.first(item.imgUrl), + path: ImgModel.first(item.dynamicImgList), + tag: ImgModel.first(item.dynamicImgList), ); }, child: ConstrainedBox( @@ -333,10 +333,10 @@ class MyCommunityViewState extends State maxWidth: 300.w, ), child: Hero( - tag: ImgModel.first(item.imgUrl), + tag: ImgModel.first(item.dynamicImgList), child: FadeInImage.assetNetwork( placeholder: R.ASSETS_IMAGES_PLACEHOLDER_WEBP, - image: SARSAPI.image(ImgModel.first(item.imgUrl)), + image: SARSAPI.image(ImgModel.first(item.dynamicImgList)), imageErrorBuilder: (context, error, stackTrace) { return Image.asset( R.ASSETS_IMAGES_PLACEHOLDER_WEBP, @@ -351,7 +351,8 @@ class MyCommunityViewState extends State else return Container( width: 552.w, - child: BeeGridImageView(urls: item.imgUrl!.map((e) => e.url).toList()), + child: BeeGridImageView( + urls: item.dynamicImgList.map((e) => e.url).toList()), ); }