|
|
|
@ -61,6 +61,7 @@ class _EventDetailPageState extends State<EventDetailPage> {
|
|
|
|
|
List<CommentListModel> _comments = [];
|
|
|
|
|
List<bool> _folds = [];
|
|
|
|
|
List<bool> _likes = [];
|
|
|
|
|
List<int> _likeNums = [];
|
|
|
|
|
|
|
|
|
|
//评论输入框焦点
|
|
|
|
|
FocusNode _focusNode = FocusNode();
|
|
|
|
@ -161,11 +162,8 @@ class _EventDetailPageState extends State<EventDetailPage> {
|
|
|
|
|
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);
|
|
|
|
|
}
|
|
|
|
|
_likes.add(element.isLike);
|
|
|
|
|
_likeNums.add(element.likes);
|
|
|
|
|
});
|
|
|
|
|
setState(() {});
|
|
|
|
|
},
|
|
|
|
@ -184,11 +182,8 @@ class _EventDetailPageState extends State<EventDetailPage> {
|
|
|
|
|
_comments.addAll(_list);
|
|
|
|
|
_folds.addAll(List.filled(_list.length, true));
|
|
|
|
|
_list.forEach((element) {
|
|
|
|
|
if (element.isLike) {
|
|
|
|
|
_likes.add(true);
|
|
|
|
|
} else {
|
|
|
|
|
_likes.add(false);
|
|
|
|
|
}
|
|
|
|
|
_likes.add(element.isLike);
|
|
|
|
|
_likeNums.add(element.likes);
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
setState(() {});
|
|
|
|
@ -361,17 +356,48 @@ class _EventDetailPageState extends State<EventDetailPage> {
|
|
|
|
|
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] ? '点赞成功' : '取消点赞成功');
|
|
|
|
|
} else {
|
|
|
|
|
BotToast.showText(text: base.msg);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
setState(() {});
|
|
|
|
|
},
|
|
|
|
|
child: Material(
|
|
|
|
|
color: Colors.transparent,
|
|
|
|
|
child: Row(
|
|
|
|
|
children: [
|
|
|
|
|
Image.asset(
|
|
|
|
|
R.ASSETS_ICONS_COMMUNITY_LIKE_PNG,
|
|
|
|
|
width: 40.w,
|
|
|
|
|
height: 40.w,
|
|
|
|
|
width: 32.w,
|
|
|
|
|
height: 32.w,
|
|
|
|
|
color: !_likes[rootIndex]
|
|
|
|
|
? Colors.black.withOpacity(0.45)
|
|
|
|
|
: kPrimaryColor,
|
|
|
|
|
),
|
|
|
|
|
5.wb,
|
|
|
|
|
'${model.likes}'
|
|
|
|
|
'${_likeNums[rootIndex]}'
|
|
|
|
|
.text
|
|
|
|
|
.size(24.sp)
|
|
|
|
|
.color(Color(0xFF999999))
|
|
|
|
|
.make(),
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
32.wb,
|
|
|
|
|
GestureDetector(
|
|
|
|
|
onTap: () {
|
|
|
|
@ -471,7 +497,12 @@ class _EventDetailPageState extends State<EventDetailPage> {
|
|
|
|
|
_focusNode.requestFocus();
|
|
|
|
|
_currentCommentIndex = rootIndex;
|
|
|
|
|
},
|
|
|
|
|
child: RichText(
|
|
|
|
|
child: Material(
|
|
|
|
|
color: Colors.transparent,
|
|
|
|
|
child: Row(
|
|
|
|
|
mainAxisSize: MainAxisSize.max,
|
|
|
|
|
children: [
|
|
|
|
|
RichText(
|
|
|
|
|
text: TextSpan(
|
|
|
|
|
text: '${model.createName}',
|
|
|
|
|
style: TextStyle(
|
|
|
|
@ -484,7 +515,8 @@ class _EventDetailPageState extends State<EventDetailPage> {
|
|
|
|
|
child: Container(
|
|
|
|
|
width: 56.w,
|
|
|
|
|
height: 28.w,
|
|
|
|
|
margin: EdgeInsets.only(left: 4.w, right: 4.w, bottom: 4.w),
|
|
|
|
|
margin:
|
|
|
|
|
EdgeInsets.only(left: 4.w, right: 4.w, bottom: 4.w),
|
|
|
|
|
alignment: Alignment.center,
|
|
|
|
|
decoration: BoxDecoration(
|
|
|
|
|
color: Color(0xFFF8B133),
|
|
|
|
@ -520,6 +552,9 @@ class _EventDetailPageState extends State<EventDetailPage> {
|
|
|
|
|
fontSize: 28.sp,
|
|
|
|
|
))
|
|
|
|
|
])),
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|