From 4a225e65059d4a36be92be2079bf6863fbe3f954 Mon Sep 17 00:00:00 2001 From: Micah Morrison Date: Fri, 19 Jan 2024 08:56:47 -0500 Subject: [PATCH] Fix a few things changed by type badge refactor --- lib/community/widgets/post_card.dart | 1 + .../widgets/post_card_type_badge.dart | 2 +- .../widgets/post_card_view_compact.dart | 21 +++++++++++++++---- .../pages/post_appearance_settings_page.dart | 1 + 4 files changed, 20 insertions(+), 5 deletions(-) diff --git a/lib/community/widgets/post_card.dart b/lib/community/widgets/post_card.dart index 28b23cce2..4bfac6d9b 100644 --- a/lib/community/widgets/post_card.dart +++ b/lib/community/widgets/post_card.dart @@ -196,6 +196,7 @@ class _PostCardState extends State { isUserLoggedIn: isUserLoggedIn, listingType: widget.listingType, navigateToPost: ({PostViewMedia? postViewMedia}) async => await navigateToPost(context, postViewMedia: widget.postViewMedia), + indicateRead: widget.indicateRead, ) : PostCardViewComfortable( postViewMedia: widget.postViewMedia, diff --git a/lib/community/widgets/post_card_type_badge.dart b/lib/community/widgets/post_card_type_badge.dart index c47cfae0f..4ef130001 100644 --- a/lib/community/widgets/post_card_type_badge.dart +++ b/lib/community/widgets/post_card_type_badge.dart @@ -42,7 +42,7 @@ class TypeBadge extends StatelessWidget { ), MediaType.image: MediaTypeBadgeItem( baseColor: Colors.red, - icon: Icon(size: 17, Icons.image_rounded, color: getIconColor(theme, Colors.red)), + icon: Icon(size: 17, Icons.image_outlined, color: getIconColor(theme, Colors.red)), ) }; diff --git a/lib/community/widgets/post_card_view_compact.dart b/lib/community/widgets/post_card_view_compact.dart index 199c3e72a..13729ebfb 100644 --- a/lib/community/widgets/post_card_view_compact.dart +++ b/lib/community/widgets/post_card_view_compact.dart @@ -22,6 +22,7 @@ class PostCardViewCompact extends StatelessWidget { final bool isUserLoggedIn; final ListingType? listingType; final void Function({PostViewMedia? postViewMedia})? navigateToPost; + final bool? indicateRead; const PostCardViewCompact({ super.key, @@ -30,6 +31,7 @@ class PostCardViewCompact extends StatelessWidget { required this.isUserLoggedIn, required this.listingType, this.navigateToPost, + this.indicateRead, }); @override @@ -39,7 +41,7 @@ class PostCardViewCompact extends StatelessWidget { bool showThumbnailPreviewOnRight = state.showThumbnailPreviewOnRight; bool showTextPostIndicator = state.showTextPostIndicator; - bool indicateRead = state.dimReadPosts; + bool indicateRead = this.indicateRead ?? state.dimReadPosts; final showCommunitySubscription = (listingType == ListingType.all || listingType == ListingType.local) && isUserLoggedIn && @@ -61,7 +63,11 @@ class PostCardViewCompact extends StatelessWidget { crossAxisAlignment: CrossAxisAlignment.center, children: [ !showThumbnailPreviewOnRight && (postViewMedia.media.isNotEmpty || showTextPostIndicator) - ? ThumbnailPreview(postViewMedia: postViewMedia, navigateToPost: navigateToPost) + ? ThumbnailPreview( + postViewMedia: postViewMedia, + navigateToPost: navigateToPost, + indicateRead: indicateRead, + ) : const SizedBox(width: 8.0), Expanded( child: Column( @@ -137,7 +143,11 @@ class PostCardViewCompact extends StatelessWidget { ), ), showThumbnailPreviewOnRight && (postViewMedia.media.isNotEmpty || showTextPostIndicator) - ? ThumbnailPreview(postViewMedia: postViewMedia, navigateToPost: navigateToPost) + ? ThumbnailPreview( + postViewMedia: postViewMedia, + navigateToPost: navigateToPost, + indicateRead: indicateRead, + ) : const SizedBox(width: 8.0), ], ), @@ -153,10 +163,13 @@ class ThumbnailPreview extends StatelessWidget { /// The callback function to navigate to the post final void Function({PostViewMedia? postViewMedia})? navigateToPost; + final bool? indicateRead; + const ThumbnailPreview({ super.key, required this.postViewMedia, required this.navigateToPost, + this.indicateRead, }); @override @@ -164,7 +177,7 @@ class ThumbnailPreview extends StatelessWidget { final state = context.read().state; final isUserLoggedIn = context.read().state.isLoggedIn; - final indicateRead = state.dimReadPosts; + final indicateRead = this.indicateRead ?? state.dimReadPosts; final hideNsfwPreviews = state.hideNsfwPreviews; final markPostReadOnMediaView = state.markPostReadOnMediaView; diff --git a/lib/settings/pages/post_appearance_settings_page.dart b/lib/settings/pages/post_appearance_settings_page.dart index 03f5fc443..f01b32595 100644 --- a/lib/settings/pages/post_appearance_settings_page.dart +++ b/lib/settings/pages/post_appearance_settings_page.dart @@ -357,6 +357,7 @@ class _PostAppearanceSettingsPageState extends State communityMode: false, isUserLoggedIn: true, listingType: ListingType.all, + indicateRead: dimReadPosts, ), ) : IgnorePointer(