Skip to content

Commit

Permalink
Fix dim read posts setting not being applied for card view (#1530)
Browse files Browse the repository at this point in the history
fix: fix issue where disabling dim read posts on card view was not respected
  • Loading branch information
hjiangsu authored Aug 14, 2024
1 parent d38c37a commit cc8c44a
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 10 deletions.
16 changes: 8 additions & 8 deletions lib/community/widgets/post_card_metadata.dart
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ class ScorePostCardMetaData extends StatelessWidget {
}

return Container(
margin: const EdgeInsets.only(right: 4.0),
margin: const EdgeInsets.only(right: 8.0),
child: Wrap(
spacing: 2.0,
crossAxisAlignment: WrapCrossAlignment.center,
Expand Down Expand Up @@ -217,7 +217,7 @@ class UpvotePostCardMetaData extends StatelessWidget {
}

return Container(
margin: const EdgeInsets.only(right: 4.0),
margin: const EdgeInsets.only(right: 8.0),
child: IconText(
fontScale: state.metadataFontSizeScale,
text: showScores ? formatNumberToK(upvotes ?? 0) : null,
Expand Down Expand Up @@ -267,7 +267,7 @@ class DownvotePostCardMetaData extends StatelessWidget {
}

return Container(
margin: const EdgeInsets.only(right: 4.0),
margin: const EdgeInsets.only(right: 8.0),
child: IconText(
fontScale: state.metadataFontSizeScale,
text: showScores ? formatNumberToK(downvotes ?? 0) : null,
Expand Down Expand Up @@ -309,12 +309,12 @@ class CommentCountPostCardMetaData extends StatelessWidget {
};

return Container(
margin: const EdgeInsets.only(right: 4.0),
margin: const EdgeInsets.only(right: 8.0),
child: IconText(
fontScale: state.metadataFontSizeScale,
text: (unreadCommentCount > 0 && unreadCommentCount != commentCount) ? '+${formatNumberToK(unreadCommentCount)}' : formatNumberToK(commentCount ?? 0),
textColor: color,
padding: 5.0,
padding: 4.0,
icon: Icon(unreadCommentCount > 0 && unreadCommentCount != commentCount ? Icons.mark_unread_chat_alt_rounded : Icons.chat, size: 17.0, color: color),
),
);
Expand Down Expand Up @@ -351,7 +351,7 @@ class DateTimePostCardMetaData extends StatelessWidget {
};

return Container(
margin: const EdgeInsets.only(right: 4.0),
margin: const EdgeInsets.only(right: 8.0),
child: IconText(
fontScale: state.metadataFontSizeScale,
text: state.showFullPostDate ? state.dateFormat?.format(DateTime.parse(dateTime)) : formatTimeToString(dateTime: dateTime),
Expand Down Expand Up @@ -393,7 +393,7 @@ class UrlPostCardMetaData extends StatelessWidget {
}

return Container(
margin: const EdgeInsets.only(right: 4.0),
margin: const EdgeInsets.only(right: 8.0),
child: Tooltip(
message: url,
preferBelow: false,
Expand Down Expand Up @@ -443,7 +443,7 @@ class LanguagePostCardMetaData extends StatelessWidget {
}

return Container(
margin: const EdgeInsets.only(right: 4.0),
margin: const EdgeInsets.only(right: 8.0),
child: Tooltip(
message: languageId == -1 ? 'English' : language!.name,
preferBelow: false,
Expand Down
6 changes: 4 additions & 2 deletions lib/community/widgets/post_card_view_comfortable.dart
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ class PostCardViewComfortable extends StatelessWidget {
final bool markPostReadOnMediaView;
final ListingType? listingType;
final void Function({PostViewMedia? postViewMedia})? navigateToPost;
final bool indicateRead;
final bool? indicateRead;

const PostCardViewComfortable({
super.key,
Expand All @@ -66,7 +66,7 @@ class PostCardViewComfortable extends StatelessWidget {
required this.onSaveAction,
required this.markPostReadOnMediaView,
required this.listingType,
required this.indicateRead,
this.indicateRead,
this.navigateToPost,
});

Expand All @@ -75,6 +75,8 @@ class PostCardViewComfortable extends StatelessWidget {
final theme = Theme.of(context);
final ThunderState state = context.read<ThunderBloc>().state;

bool indicateRead = this.indicateRead ?? state.dimReadPosts;

final showCommunitySubscription = (listingType == ListingType.all || listingType == ListingType.local) &&
isUserLoggedIn &&
context.read<AccountBloc>().state.subsciptions.map((subscription) => subscription.community.actorId).contains(postViewMedia.postView.community.actorId);
Expand Down

0 comments on commit cc8c44a

Please sign in to comment.