我的动态

pull/1/head
张萌 3 years ago
parent 3da2ce23ec
commit c52ce50277

@ -103,6 +103,9 @@ class _Message {
} }
class _Community { class _Community {
///
String get singleComment => '/app/user/community/comment/findById';
/// ///
String get topicDetail => '/app/user/community/topic/findById'; String get topicDetail => '/app/user/community/topic/findById';

@ -1,7 +1,7 @@
import 'package:common_utils/common_utils.dart';
import 'package:aku_new_community/model/common/img_model.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 { class MyEventItemModel {
int? id; int? id;
String? content; String? content;

@ -32,7 +32,7 @@ CommentTwoList _$CommentTwoListFromJson(Map<String, dynamic> json) =>
createId: json['createId'] as int, createId: json['createId'] as int,
createName: json['createName'] as String, createName: json['createName'] as String,
parentId: json['parentId'] as int, parentId: json['parentId'] as int,
parentName: json['parentName'] as String, parentName: json['parentName'] as String?,
createDate: json['createDate'] as String, createDate: json['createDate'] as String,
avatarImgList: (json['avatarImgList'] as List<dynamic>) avatarImgList: (json['avatarImgList'] as List<dynamic>)
.map((e) => ImgModel.fromJson(e as Map<String, dynamic>)) .map((e) => ImgModel.fromJson(e as Map<String, dynamic>))

@ -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<ImgModel> dynamicImgList;
final List<TopicTag> topicTags;
final bool isLike;
factory DynamicMyListBody.fromJson(Map<String, dynamic> 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,
});
}

@ -0,0 +1,26 @@
// GENERATED CODE - DO NOT MODIFY BY HAND
part of 'dynamic_my_list_body.dart';
// **************************************************************************
// JsonSerializableGenerator
// **************************************************************************
DynamicMyListBody _$DynamicMyListBodyFromJson(Map<String, dynamic> 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<dynamic>)
.map((e) => ImgModel.fromJson(e as Map<String, dynamic>))
.toList(),
topicTags: (json['topicTags'] as List<dynamic>)
.map((e) => TopicTag.fromJson(e as Map<String, dynamic>))
.toList(),
isLike: json['isLike'] as bool,
);

@ -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<ImgModel> avatarImgList;
final int dynamicNum;
final int commentNum;
final int likesNum;
factory DynamicMyListHead.fromJson(Map<String, dynamic> json) =>
_$DynamicMyListHeadFromJson(json);
const DynamicMyListHead({
required this.id,
required this.createName,
required this.avatarImgList,
required this.dynamicNum,
required this.commentNum,
required this.likesNum,
});
}

@ -0,0 +1,19 @@
// GENERATED CODE - DO NOT MODIFY BY HAND
part of 'dynamic_my_list_head.dart';
// **************************************************************************
// JsonSerializableGenerator
// **************************************************************************
DynamicMyListHead _$DynamicMyListHeadFromJson(Map<String, dynamic> json) =>
DynamicMyListHead(
id: json['id'] as int,
createName: json['createName'] as String,
avatarImgList: (json['avatarImgList'] as List<dynamic>)
.map((e) => ImgModel.fromJson(e as Map<String, dynamic>))
.toList(),
dynamicNum: json['dynamicNum'] as int,
commentNum: json['commentNum'] as int,
likesNum: json['likesNum'] as int,
);

@ -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/activity_item_model.dart';
import 'package:aku_new_community/model/community/board_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/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/community/swiper_model.dart';
import 'package:aku_new_community/model/good/market_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/community/topic_model.dart';
import 'package:aku_new_community/models/market/goods_popular_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'; import 'package:aku_new_community/models/market/market_all_category_model.dart';
@ -28,13 +28,13 @@ class CommunityFunc {
} }
/// ///
static Future<List<MyEventItemModel>> getMyEventItem() async { static Future<List<DynamicMyListBody>> getMyEventItem() async {
BaseListModel model = await NetUtil().getList( BaseListModel model = await NetUtil().getList(
API.community.myEvent, SARSAPI.community.dynamicMyListL,
params: {'pageNum': 1, 'size': 8}, params: {'pageNum': 1, 'size': 8},
); );
if (model.rows.length == 0) return []; if (model.rows.length == 0) return [];
return model.rows.map((e) => MyEventItemModel.fromJson(e)).toList(); return model.rows.map((e) => DynamicMyListBody.fromJson(e)).toList();
} }
/// ///

@ -1,7 +1,6 @@
import 'dart:math'; import 'dart:math';
import 'package:aku_new_community/base/base_style.dart'; 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/constants/sars_api.dart';
import 'package:aku_new_community/model/common/img_model.dart'; import 'package:aku_new_community/model/common/img_model.dart';
import 'package:aku_new_community/models/community/comment_list_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/login_util.dart';
import 'package:aku_new_community/utils/network/base_model.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/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:aku_new_community/widget/bee_scaffold.dart';
import 'package:bot_toast/bot_toast.dart'; import 'package:bot_toast/bot_toast.dart';
import 'package:common_utils/common_utils.dart'; import 'package:common_utils/common_utils.dart';
@ -47,33 +47,42 @@ class _EventDetailPageState extends State<EventDetailPage> {
} }
TextEditingController _textEditingController = TextEditingController(); TextEditingController _textEditingController = TextEditingController();
int rootId = 0;
int parentId = 0; //id
int _rootId = 0;
//id
int _parentId = 0;
int _page = 1; int _page = 1;
int _type = 1; int _type = 1;
int _size = 10; int _size = 10;
int _currentCommentIndex = 0;
List<CommentListModel> _comments = []; List<CommentListModel> _comments = [];
List<bool> _folds = [];
List<bool> _likes = [];
// //
FocusNode _focusNode = FocusNode(); FocusNode _focusNode = FocusNode();
Map<String, dynamic> get params => { Map<String, dynamic> get params => {
'rootId': rootId, 'rootId': _rootId,
'parentId': parentId, 'parentId': _parentId,
'dynamicId': widget.dynamicId, 'dynamicId': widget.dynamicId,
'content': _textEditingController.text 'content': _textEditingController.text
}; };
Future updateComments() async { Future updateComments() async {
var base = await NetUtil().getList(SARSAPI.community.commentList, params: { var base = await NetUtil().get(SARSAPI.community.singleComment, params: {
'pageNum': _page, 'commentId': _comments[_currentCommentIndex].id,
'size': _size,
'dynamicId': widget.dynamicId,
'type': _type,
}); });
_comments.replaceRange((_page - 1) * _size, _page * _size, if (base.success) {
base.rows.map((e) => CommentListModel.fromJson(e)).toList()); _comments.removeAt(_currentCommentIndex);
_comments.insert(
_currentCommentIndex, CommentListModel.fromJson(base.data));
} else {
BotToast.showText(text: base.msg);
}
setState(() {}); setState(() {});
} }
@ -120,11 +129,6 @@ class _EventDetailPageState extends State<EventDetailPage> {
)); ));
if (result == true) { if (result == true) {
await NetUtil().get(
API.community.deleteMyEvent,
params: {'dynamicId': widget.dynamicId},
showMessage: true,
);
if (widget.onDelete != null) { if (widget.onDelete != null) {
widget.onDelete!(); widget.onDelete!();
Get.back(); Get.back();
@ -145,7 +149,6 @@ class _EventDetailPageState extends State<EventDetailPage> {
); );
_model = DynamicDetailModel.fromJson(model.data); _model = DynamicDetailModel.fromJson(model.data);
_page = 1; _page = 1;
var base = var base =
await NetUtil().getList(SARSAPI.community.commentList, params: { await NetUtil().getList(SARSAPI.community.commentList, params: {
'pageNum': _page, 'pageNum': _page,
@ -155,6 +158,14 @@ class _EventDetailPageState extends State<EventDetailPage> {
}); });
_comments = _comments =
base.rows.map((e) => CommentListModel.fromJson(e)).toList(); 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(() {}); setState(() {});
}, },
onLoad: () async { onLoad: () async {
@ -167,8 +178,17 @@ class _EventDetailPageState extends State<EventDetailPage> {
'type': _type, 'type': _type,
}); });
if (_comments.length < base.total) { if (_comments.length < base.total) {
_comments.addAll( var _list =
base.rows.map((e) => CommentListModel.fromJson(e)).toList()); 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(() {}); setState(() {});
}, },
@ -178,18 +198,30 @@ class _EventDetailPageState extends State<EventDetailPage> {
SliverToBoxAdapter( SliverToBoxAdapter(
child: Column( child: Column(
children: [ children: [
ChatCardDetail( GestureDetector(
model: _model!, onTap: () {
hideLine: true, _rootId = 0;
canTap: false, _parentId = 0;
},
child: ChatCardDetail(
model: _model!,
hideLine: true,
canTap: false,
),
), ),
_renderLikeAndCommentWidget(), _renderLikeAndCommentWidget(),
], ],
), ),
), ),
SliverList( SliverList(
delegate: SliverChildListDelegate( delegate: SliverChildListDelegate(_comments
_comments.map((e) => _commentWidget(e)).toList())) .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<EventDetailPage> {
); );
} }
Widget _commentWidget(CommentListModel model) { Widget _commentWidget(CommentListModel model, int rootIndex) {
return Container( return Container(
// key: UniqueKey(),
color: Colors.white, color: Colors.white,
padding: EdgeInsets.symmetric(vertical: 32.w, horizontal: 32.w), padding: EdgeInsets.symmetric(vertical: 32.w, horizontal: 32.w),
width: double.infinity, width: double.infinity,
@ -313,34 +346,63 @@ class _EventDetailPageState extends State<EventDetailPage> {
40.hb, 40.hb,
model.content.text.size(28.sp).color(ktextSubColor).make(), model.content.text.size(28.sp).color(ktextSubColor).make(),
30.hb, 30.hb,
Row( GestureDetector(
children: [ onTap: () async {
Spacer(), var res =
Image.asset( await NetUtil().get(SARSAPI.community.commentLike, params: {
R.ASSETS_ICONS_COMMUNITY_LIKE_PNG, 'commentId': model.id,
width: 40.w, });
height: 40.w, if (res.success) {
), _likes[rootIndex] = !_likes[rootIndex];
5.wb, setState(() {});
'${model.likes}'.text.size(24.sp).color(Color(0xFF999999)).make(), }
32.wb, },
Image.asset( child: Row(
R.ASSETS_ICONS_COMMUNITY_COMMENT_PNG, children: [
width: 40.w, Spacer(),
height: 40.w, Image.asset(
), R.ASSETS_ICONS_COMMUNITY_LIKE_PNG,
5.wb, width: 40.w,
'${model.commentNum}' height: 40.w,
.text ),
.size(24.sp) 5.wb,
.color(Color(0xFF999999)) '${model.likes}'
.make(), .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, 40.hb,
model.commentTwoList.isEmpty model.commentTwoList.isEmpty
? SizedBox.shrink() ? SizedBox.shrink()
: Container( : Container(
alignment: Alignment.topLeft,
decoration: BoxDecoration( decoration: BoxDecoration(
color: Colors.black.withOpacity(0.06), color: Colors.black.withOpacity(0.06),
borderRadius: BorderRadius.circular(16.w)), borderRadius: BorderRadius.circular(16.w)),
@ -349,11 +411,20 @@ class _EventDetailPageState extends State<EventDetailPage> {
padding: padding:
EdgeInsets.symmetric(vertical: 24.w, horizontal: 32.w), EdgeInsets.symmetric(vertical: 24.w, horizontal: 32.w),
child: Column( child: Column(
children: model.commentTwoList crossAxisAlignment: CrossAxisAlignment.start,
.map((e) => children: <Widget>[
_subCommentWidget(e, model.createId, model.id)) ...List.generate(
.toList() model.commentTwoList.length < 3
.sepWidget(separate: 24.hb), ? 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<EventDetailPage> {
); );
} }
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( return GestureDetector(
onTap: () { onTap: () {
rootId = rootId; _rootId = rootId;
parentId = model.id; _parentId = model.id;
_focusNode.requestFocus(); _focusNode.requestFocus();
_currentCommentIndex = rootIndex;
}, },
child: RichText( child: RichText(
text: TextSpan( text: TextSpan(
@ -376,11 +478,13 @@ class _EventDetailPageState extends State<EventDetailPage> {
fontSize: 28.sp, fontSize: 28.sp,
), ),
children: [ children: [
if (rootId == model.createId) if (createId == model.createId)
WidgetSpan( WidgetSpan(
child: Container( child: Container(
width: 56.w, width: 56.w,
height: 28.w, height: 28.w,
margin: EdgeInsets.only(left: 4.w, right: 4.w, bottom: 4.w),
alignment: Alignment.center,
decoration: BoxDecoration( decoration: BoxDecoration(
color: Color(0xFFF8B133), color: Color(0xFFF8B133),
borderRadius: BorderRadius.circular(4.w)), borderRadius: BorderRadius.circular(4.w)),
@ -423,6 +527,8 @@ class _EventDetailPageState extends State<EventDetailPage> {
width: double.infinity, width: double.infinity,
height: 100.w, height: 100.w,
padding: EdgeInsets.symmetric(vertical: 16.w, horizontal: 32.w), padding: EdgeInsets.symmetric(vertical: 16.w, horizontal: 32.w),
margin:
EdgeInsets.only(bottom: MediaQuery.of(context).viewInsets.bottom),
decoration: BoxDecoration( decoration: BoxDecoration(
color: Colors.white, color: Colors.white,
), ),
@ -438,6 +544,7 @@ class _EventDetailPageState extends State<EventDetailPage> {
child: TextField( child: TextField(
controller: _textEditingController, controller: _textEditingController,
focusNode: _focusNode, focusNode: _focusNode,
autofocus: false,
decoration: InputDecoration( decoration: InputDecoration(
hintText: '参与评论', hintText: '参与评论',
contentPadding: contentPadding:
@ -465,7 +572,12 @@ class _EventDetailPageState extends State<EventDetailPage> {
.post(SARSAPI.community.commentInsert, params: params); .post(SARSAPI.community.commentInsert, params: params);
if (res.success) { if (res.success) {
_textEditingController.clear(); _textEditingController.clear();
await updateComments(); if (_rootId == 0) {
_refreshController.callRefresh();
} else {
await updateComments();
_focusNode.unfocus();
}
setState(() {}); setState(() {});
} else { } else {
BotToast.showText(text: res.msg); BotToast.showText(text: res.msg);

@ -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/api.dart';
import 'package:aku_new_community/constants/sars_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/common/img_model.dart';
import 'package:aku_new_community/model/community/my_event_item_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/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/ui/community/community_views/widgets/my_event_card.dart';
import 'package:aku_new_community/utils/headers.dart'; import 'package:aku_new_community/utils/headers.dart';
import 'package:aku_new_community/utils/login_util.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/line/vertical_line_painter.dart';
import 'package:aku_new_community/widget/picker/bee_image_preview.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: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'; import '../community_func.dart';
class MyCommunityView extends StatefulWidget { class MyCommunityView extends StatefulWidget {
@ -28,7 +30,8 @@ class MyCommunityViewState extends State<MyCommunityView>
with AutomaticKeepAliveClientMixin { with AutomaticKeepAliveClientMixin {
EasyRefreshController _refreshController = EasyRefreshController(); EasyRefreshController _refreshController = EasyRefreshController();
bool _onload = true; bool _onload = true;
List<MyEventItemModel> _myEventItems = []; List<DynamicMyListBody> _myEventItems = [];
DynamicMyListHead? _head;
refresh() { refresh() {
_refreshController.callRefresh(); _refreshController.callRefresh();
@ -37,13 +40,103 @@ class MyCommunityViewState extends State<MyCommunityView>
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
super.build(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( return EasyRefresh(
firstRefresh: true, firstRefresh: true,
header: MaterialHeader(), header: MaterialHeader(),
controller: _refreshController, controller: _refreshController,
onRefresh: () async { onRefresh: () async {
// API.community.myEvent
_myEventItems = await CommunityFunc.getMyEventItem(); _myEventItems = await CommunityFunc.getMyEventItem();
var base = await NetUtil().get(SARSAPI.community.dynamicMyListH);
if (base.success) {
_head = DynamicMyListHead.fromJson(base.data);
}
_onload = false; _onload = false;
setState(() {}); setState(() {});
}, },
@ -51,112 +144,15 @@ class MyCommunityViewState extends State<MyCommunityView>
? SizedBox() ? SizedBox()
: ListView( : ListView(
children: [ children: [
Container( head,
width: double.infinity, headNum,
decoration: BoxDecoration( 20.hb,
image: new DecorationImage( ..._myEventItems
image: new AssetImage( .map(
R.ASSETS_IMAGES_COMMUNITY_MY_BG_PNG, (e) => _getMoments(e),
), )
fit: BoxFit.fitWidth), .toList()
), .sepWidget(separate: 20.hb),
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),
),
//_getMoments(), //_getMoments(),
// _getMoments(), // _getMoments(),
@ -186,17 +182,21 @@ class MyCommunityViewState extends State<MyCommunityView>
); );
} }
Widget _getMoments(MyEventItemModel item) { Widget _getMoments(DynamicMyListBody item) {
return Container( return Container(
padding: padding:
EdgeInsets.only(top: 32.w, left: 25.w, right: 32.w, bottom: 32.w), EdgeInsets.only(top: 32.w, left: 25.w, right: 32.w, bottom: 32.w),
color: Colors.white, color: Colors.white,
child: CustomPaint( child: CustomPaint(
painter: VerticalLinePainter( painter: VerticalLinePainter(
color: Color(0x0F000000), // color: Color(0x0F000000),
width: 4.w, //UI //
paddingTop: 100.w, //UI width: 4.w,
paddingLeft: 0, //UI //UI
paddingTop: 100.w,
//UI
paddingLeft: 0,
//UI
paddingBottom: 100.w), //UI paddingBottom: 100.w), //UI
child: Row( child: Row(
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
@ -310,9 +310,9 @@ class MyCommunityViewState extends State<MyCommunityView>
); );
} }
_renderImage(MyEventItemModel item) { _renderImage(DynamicMyListBody item) {
if (item.imgUrl!.isEmpty) return SizedBox(); if (item.dynamicImgList.isEmpty) return SizedBox();
if (item.imgUrl!.length == 1) if (item.dynamicImgList.length == 1)
return MaterialButton( return MaterialButton(
materialTapTargetSize: MaterialTapTargetSize.shrinkWrap, materialTapTargetSize: MaterialTapTargetSize.shrinkWrap,
padding: EdgeInsets.zero, padding: EdgeInsets.zero,
@ -323,8 +323,8 @@ class MyCommunityViewState extends State<MyCommunityView>
), ),
onPressed: () { onPressed: () {
BeeImagePreview.toPath( BeeImagePreview.toPath(
path: ImgModel.first(item.imgUrl), path: ImgModel.first(item.dynamicImgList),
tag: ImgModel.first(item.imgUrl), tag: ImgModel.first(item.dynamicImgList),
); );
}, },
child: ConstrainedBox( child: ConstrainedBox(
@ -333,10 +333,10 @@ class MyCommunityViewState extends State<MyCommunityView>
maxWidth: 300.w, maxWidth: 300.w,
), ),
child: Hero( child: Hero(
tag: ImgModel.first(item.imgUrl), tag: ImgModel.first(item.dynamicImgList),
child: FadeInImage.assetNetwork( child: FadeInImage.assetNetwork(
placeholder: R.ASSETS_IMAGES_PLACEHOLDER_WEBP, placeholder: R.ASSETS_IMAGES_PLACEHOLDER_WEBP,
image: SARSAPI.image(ImgModel.first(item.imgUrl)), image: SARSAPI.image(ImgModel.first(item.dynamicImgList)),
imageErrorBuilder: (context, error, stackTrace) { imageErrorBuilder: (context, error, stackTrace) {
return Image.asset( return Image.asset(
R.ASSETS_IMAGES_PLACEHOLDER_WEBP, R.ASSETS_IMAGES_PLACEHOLDER_WEBP,
@ -351,7 +351,8 @@ class MyCommunityViewState extends State<MyCommunityView>
else else
return Container( return Container(
width: 552.w, width: 552.w,
child: BeeGridImageView(urls: item.imgUrl!.map((e) => e.url).toList()), child: BeeGridImageView(
urls: item.dynamicImgList.map((e) => e.url).toList()),
); );
} }

Loading…
Cancel
Save