Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
41 changes: 39 additions & 2 deletions lib/src/features/comment/data/models/thunder_comment.dart
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
import 'package:equatable/equatable.dart';

import 'package:thunder/src/features/community/community.dart';
import 'package:thunder/src/core/enums/subscription_status.dart';
import 'package:thunder/src/features/post/post.dart';
import 'package:thunder/src/features/user/user.dart';

class ThunderComment {
class ThunderComment extends Equatable {
/// The comment's ID
final int id;

Expand Down Expand Up @@ -97,7 +99,7 @@ class ThunderComment {
/// Whether the comment is read (comment reply/mention)
final bool? read;

ThunderComment({
const ThunderComment({
required this.id,
required this.creatorId,
this.replyMentionId,
Expand Down Expand Up @@ -131,6 +133,41 @@ class ThunderComment {
this.read,
});

@override
List<Object?> get props => [
id,
creatorId,
replyMentionId,
postId,
content,
removed,
published,
updated,
deleted,
apId,
local,
path,
distinguished,
languageId,
recipient,
creator,
post,
community,
score,
upvotes,
downvotes,
childCount,
creatorBannedFromCommunity,
bannedFromCommunity,
creatorIsModerator,
creatorIsAdmin,
subscribed,
saved,
creatorBlocked,
myVote,
read,
];

ThunderComment copyWith({
int? id,
int? creatorId,
Expand Down
38 changes: 36 additions & 2 deletions lib/src/features/community/data/models/thunder_community.dart
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import 'package:equatable/equatable.dart';

import 'package:thunder/src/core/enums/subscription_status.dart';

class ThunderCommunity {
class ThunderCommunity extends Equatable {
/// The community's ID
final int id;

Expand Down Expand Up @@ -88,7 +90,7 @@ class ThunderCommunity {
/// The number of users active in the last half year
final int? usersActiveHalfYear;

ThunderCommunity({
const ThunderCommunity({
required this.id,
required this.name,
required this.title,
Expand Down Expand Up @@ -119,6 +121,38 @@ class ThunderCommunity {
this.usersActiveHalfYear,
});

@override
List<Object?> get props => [
id,
name,
title,
description,
removed,
published,
updated,
deleted,
nsfw,
actorId,
local,
icon,
banner,
hidden,
postingRestrictedToMods,
instanceId,
visibility,
subscribed,
blocked,
bannedFromCommunity,
subscribers,
subscribersLocal,
posts,
comments,
usersActiveDay,
usersActiveWeek,
usersActiveMonth,
usersActiveHalfYear,
];

factory ThunderCommunity.fromLemmyCommunity(Map<String, dynamic> community, {SubscriptionStatus? subscribed}) {
return ThunderCommunity(
id: community['id'],
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
import 'package:flutter/material.dart';

import 'package:cached_network_image/cached_network_image.dart';

import 'package:thunder/src/features/community/community.dart';
import 'package:thunder/src/core/enums/font_scale.dart';
import 'package:thunder/src/core/models/models.dart';
import 'package:thunder/src/shared/images/image_preview.dart';
import 'package:thunder/src/shared/widgets/avatars/community_avatar.dart';
import 'package:thunder/src/shared/full_name_widgets.dart';
import 'package:thunder/src/shared/icon_text.dart';
Expand Down Expand Up @@ -217,13 +216,9 @@ class _BannerImage extends StatelessWidget {
@override
Widget build(BuildContext context) {
return Positioned.fill(
child: Container(
decoration: BoxDecoration(
image: DecorationImage(
image: CachedNetworkImageProvider(url),
fit: BoxFit.cover,
),
),
child: ImagePreview(
url: url,
fit: BoxFit.cover,
),
);
}
Expand Down
Loading