1
0
mirror of https://gitlab.com/comunic/comunicmobile synced 2025-09-18 21:38:48 +00:00

Simplify use of like widget

This commit is contained in:
2020-04-15 19:17:29 +02:00
parent 2d26395d73
commit dde909457d
6 changed files with 30 additions and 49 deletions

View File

@@ -1,3 +1,4 @@
import 'package:comunic/enums/likes_type.dart';
import 'package:comunic/models/like_element.dart';
import 'package:meta/meta.dart';
import 'package:comunic/utils/account_utils.dart' as account;
@@ -40,4 +41,7 @@ class Comment implements LikeElement {
bool get hasImage => imageURL != null;
bool get isOwner => userID == account.userID();
@override
LikesType get likeType => LikesType.COMMENT;
}

View File

@@ -1,11 +1,14 @@
import 'package:comunic/enums/likes_type.dart';
/// Element that can be liked by the user
///
/// @author Pierre HUBERT
abstract class LikeElement {
LikesType get likeType;
int get id;
bool userLike;
int likes;
}
}

View File

@@ -1,3 +1,4 @@
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/enums/user_access_levels.dart';
@@ -83,4 +84,7 @@ class Post implements LikeElement {
bool get canDelete =>
access == UserAccessLevels.FULL ||
access == UserAccessLevels.INTERMEDIATE;
@override
LikesType get likeType => LikesType.POST;
}