修复评论不能点赞的问题

修复发布任务提示文字显示问题
pull/1/head
张萌 3 years ago
parent 194be7e636
commit f8c5cc5592

@ -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,
))
])),
],
),
),
);
}

@ -172,9 +172,12 @@ class _ChatCardDetailState extends State<ChatCardDetail> {
},
likeBuilder: (bool isLiked) {
return Image.asset(
isLiked
? Assets.icons.communityLikeIs.path
: Assets.icons.communityLike.path,
Assets.icons.communityLike.path,
width: 32.w,
height: 32.w,
color: !_isLiked
? Colors.black.withOpacity(0.45)
: kPrimaryColor,
);
},
likeCount: _likeNum,

@ -1073,7 +1073,7 @@ class _PublishTaskPageState extends State<PublishTaskPage> {
return false;
}
if (int.parse(_rewardController.text) == 0) {
BotToast.showText(text: '赏金不能为0');
BotToast.showText(text: '报酬不能为0');
return false;
}
if (_nameController.text.isEmpty) {

Loading…
Cancel
Save