From cc8c44abf1fbd004ebdcf34f4689af82a2a7f185 Mon Sep 17 00:00:00 2001 From: Hamlet Jiang Su <30667958+hjiangsu@users.noreply.github.com> Date: Tue, 13 Aug 2024 18:32:57 -0700 Subject: [PATCH] Fix dim read posts setting not being applied for card view (#1530) fix: fix issue where disabling dim read posts on card view was not respected --- lib/community/widgets/post_card_metadata.dart | 16 ++++++++-------- .../widgets/post_card_view_comfortable.dart | 6 ++++-- 2 files changed, 12 insertions(+), 10 deletions(-) diff --git a/lib/community/widgets/post_card_metadata.dart b/lib/community/widgets/post_card_metadata.dart index 2bf158b09..1bd0abc6d 100644 --- a/lib/community/widgets/post_card_metadata.dart +++ b/lib/community/widgets/post_card_metadata.dart @@ -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, @@ -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, @@ -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, @@ -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), ), ); @@ -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), @@ -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, @@ -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, diff --git a/lib/community/widgets/post_card_view_comfortable.dart b/lib/community/widgets/post_card_view_comfortable.dart index 8d6b5ee78..19a0a4351 100644 --- a/lib/community/widgets/post_card_view_comfortable.dart +++ b/lib/community/widgets/post_card_view_comfortable.dart @@ -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, @@ -66,7 +66,7 @@ class PostCardViewComfortable extends StatelessWidget { required this.onSaveAction, required this.markPostReadOnMediaView, required this.listingType, - required this.indicateRead, + this.indicateRead, this.navigateToPost, }); @@ -75,6 +75,8 @@ class PostCardViewComfortable extends StatelessWidget { final theme = Theme.of(context); final ThunderState state = context.read().state; + bool indicateRead = this.indicateRead ?? state.dimReadPosts; + final showCommunitySubscription = (listingType == ListingType.all || listingType == ListingType.local) && isUserLoggedIn && context.read().state.subsciptions.map((subscription) => subscription.community.actorId).contains(postViewMedia.postView.community.actorId);