Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix a few things changed by type badge refactor #1067

Merged
merged 1 commit into from
Jan 19, 2024
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
1 change: 1 addition & 0 deletions lib/community/widgets/post_card.dart
Original file line number Diff line number Diff line change
Expand Up @@ -196,6 +196,7 @@ class _PostCardState extends State<PostCard> {
isUserLoggedIn: isUserLoggedIn,
listingType: widget.listingType,
navigateToPost: ({PostViewMedia? postViewMedia}) async => await navigateToPost(context, postViewMedia: widget.postViewMedia),
indicateRead: widget.indicateRead,
)
: PostCardViewComfortable(
postViewMedia: widget.postViewMedia,
Expand Down
2 changes: 1 addition & 1 deletion lib/community/widgets/post_card_type_badge.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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)),
)
};

Expand Down
21 changes: 17 additions & 4 deletions lib/community/widgets/post_card_view_compact.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -30,6 +31,7 @@ class PostCardViewCompact extends StatelessWidget {
required this.isUserLoggedIn,
required this.listingType,
this.navigateToPost,
this.indicateRead,
});

@override
Expand All @@ -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 &&
Expand All @@ -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(
Expand Down Expand Up @@ -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),
],
),
Expand All @@ -153,18 +163,21 @@ 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
Widget build(BuildContext context) {
final state = context.read<ThunderBloc>().state;
final isUserLoggedIn = context.read<AuthBloc>().state.isLoggedIn;

final indicateRead = state.dimReadPosts;
final indicateRead = this.indicateRead ?? state.dimReadPosts;
final hideNsfwPreviews = state.hideNsfwPreviews;
final markPostReadOnMediaView = state.markPostReadOnMediaView;

Expand Down
1 change: 1 addition & 0 deletions lib/settings/pages/post_appearance_settings_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -357,6 +357,7 @@ class _PostAppearanceSettingsPageState extends State<PostAppearanceSettingsPage>
communityMode: false,
isUserLoggedIn: true,
listingType: ListingType.all,
indicateRead: dimReadPosts,
),
)
: IgnorePointer(
Expand Down
Loading