mirror of
https://gitlab.com/comunic/comunicmobile
synced 2025-06-19 00:05:16 +00:00
Simplify use of like widget
This commit is contained in:
@ -1,4 +1,3 @@
|
||||
import 'package:comunic/enums/likes_type.dart';
|
||||
import 'package:comunic/models/comment.dart';
|
||||
import 'package:comunic/models/user.dart';
|
||||
import 'package:comunic/ui/widgets/account_image_widget.dart';
|
||||
@ -100,15 +99,7 @@ class CommentTile extends StatelessWidget {
|
||||
),
|
||||
|
||||
// Comment likes
|
||||
LikeWidget(
|
||||
likeType: LikesType.COMMENT,
|
||||
likeID: comment.id,
|
||||
likesCount: comment.likes,
|
||||
isLiking: comment.userLike,
|
||||
onUpdatedLikings: (count, isLiking) {
|
||||
comment.likes = count;
|
||||
comment.userLike = isLiking;
|
||||
}),
|
||||
LikeWidget(likeElement: comment),
|
||||
],
|
||||
);
|
||||
}
|
||||
|
@ -1,10 +1,8 @@
|
||||
import 'dart:io';
|
||||
|
||||
import 'package:comunic/enums/likes_type.dart';
|
||||
import 'package:comunic/enums/post_kind.dart';
|
||||
import 'package:comunic/enums/post_visibility_level.dart';
|
||||
import 'package:comunic/helpers/comments_helper.dart';
|
||||
import 'package:comunic/helpers/likes_helper.dart';
|
||||
import 'package:comunic/helpers/posts_helper.dart';
|
||||
import 'package:comunic/lists/groups_list.dart';
|
||||
import 'package:comunic/lists/users_list.dart';
|
||||
@ -211,15 +209,8 @@ class _PostTileState extends State<PostTile> {
|
||||
children: <Widget>[
|
||||
// Like button
|
||||
Center(
|
||||
child: LikeWidget(
|
||||
likeType: LikesType.POST,
|
||||
likeID: widget.post.id,
|
||||
likesCount: widget.post.likes,
|
||||
isLiking: widget.post.userLike,
|
||||
onUpdatedLikings: (num, userLike) {
|
||||
widget.post.likes = num;
|
||||
widget.post.userLike = userLike;
|
||||
})),
|
||||
child: LikeWidget(likeElement: widget.post),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
|
Reference in New Issue
Block a user