mirror of
https://gitlab.com/comunic/comunicmobile
synced 2024-12-30 14:58:52 +00:00
50 lines
1.2 KiB
Dart
50 lines
1.2 KiB
Dart
import 'package:comunic/enums/likes_type.dart';
|
|
import 'package:comunic/models/displayed_content.dart';
|
|
import 'package:comunic/models/like_element.dart';
|
|
import 'package:comunic/utils/account_utils.dart' as account;
|
|
import 'package:meta/meta.dart';
|
|
|
|
/// Comments
|
|
///
|
|
/// Contains information about a single comment
|
|
///
|
|
/// @author Pierre HUBERT
|
|
|
|
class Comment implements LikeElement {
|
|
final int id;
|
|
final int userID;
|
|
final int postID;
|
|
final int timeSent;
|
|
DisplayedString content;
|
|
final String imageURL;
|
|
int likes;
|
|
bool userLike;
|
|
|
|
Comment({
|
|
@required this.id,
|
|
@required this.userID,
|
|
@required this.postID,
|
|
@required this.timeSent,
|
|
@required this.content,
|
|
@required this.imageURL,
|
|
@required this.likes,
|
|
@required this.userLike,
|
|
}) : assert(id != null),
|
|
assert(userID != null),
|
|
assert(postID != null),
|
|
assert(timeSent != null),
|
|
assert(content != null),
|
|
assert(likes != null),
|
|
assert(userLike != null);
|
|
|
|
bool get hasContent =>
|
|
content != null && !content.isNull && content.length > 0;
|
|
|
|
bool get hasImage => imageURL != null;
|
|
|
|
bool get isOwner => userID == account.userID();
|
|
|
|
@override
|
|
LikesType get likeType => LikesType.COMMENT;
|
|
}
|