Prepare RuleGel 1.0
This commit is contained in:
@@ -218,6 +218,7 @@ class PostDetailsScreen extends ConsumerWidget {
|
||||
onCopy: () =>
|
||||
Clipboard.setData(ClipboardData(text: post.fileUrl)),
|
||||
onSimilar: () => _openSimilar(context, ref, post),
|
||||
onHide: () => _hidePost(context, ref, post),
|
||||
onDownload: settings.allowDownloads
|
||||
? () => _download(context, ref, post)
|
||||
: null,
|
||||
@@ -300,6 +301,7 @@ class PostDetailsScreen extends ConsumerWidget {
|
||||
onOpen: () => launchUrl(Uri.parse(post.fileUrl)),
|
||||
onCopy: () => Clipboard.setData(ClipboardData(text: post.fileUrl)),
|
||||
onSimilar: () => _openSimilar(context, ref, post),
|
||||
onHide: () => _hidePost(context, ref, post),
|
||||
onDownload: settings.allowDownloads
|
||||
? () => _download(context, ref, post)
|
||||
: null,
|
||||
@@ -442,6 +444,21 @@ class PostDetailsScreen extends ConsumerWidget {
|
||||
ref.invalidate(favoritesControllerProvider);
|
||||
}
|
||||
|
||||
Future<void> _hidePost(
|
||||
BuildContext context,
|
||||
WidgetRef ref,
|
||||
Post post,
|
||||
) async {
|
||||
await ref.read(settingsServiceProvider).hidePostKey(post.cacheKey);
|
||||
ref.invalidate(appSettingsProvider);
|
||||
ref.read(feedControllerProvider.notifier).refresh();
|
||||
if (!context.mounted) return;
|
||||
ScaffoldMessenger.of(context).showSnackBar(
|
||||
const SnackBar(content: Text('Post hidden locally')),
|
||||
);
|
||||
_close(context);
|
||||
}
|
||||
|
||||
void _openPost(BuildContext context, Post post) {
|
||||
_replacePost(context, post);
|
||||
}
|
||||
|
||||
@@ -9,6 +9,7 @@ class PostActionBar extends StatelessWidget {
|
||||
required this.isFavorite,
|
||||
this.onDownload,
|
||||
this.onSimilar,
|
||||
this.onHide,
|
||||
super.key,
|
||||
});
|
||||
|
||||
@@ -19,6 +20,7 @@ class PostActionBar extends StatelessWidget {
|
||||
final bool isFavorite;
|
||||
final VoidCallback? onDownload;
|
||||
final VoidCallback? onSimilar;
|
||||
final VoidCallback? onHide;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
@@ -60,6 +62,12 @@ class PostActionBar extends StatelessWidget {
|
||||
onPressed: onDownload,
|
||||
icon: const Icon(Icons.download_rounded),
|
||||
),
|
||||
if (onHide != null)
|
||||
IconButton.filledTonal(
|
||||
tooltip: 'Hide post locally',
|
||||
onPressed: onHide,
|
||||
icon: const Icon(Icons.visibility_off_rounded),
|
||||
),
|
||||
],
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user