feat: release v2.0.5 with 10 QoL features (AMOLED, Dynamic Color, Grid switch, Share, Presets, Cache Manager, Backup & Gestures)
This commit is contained in:
@@ -4,6 +4,7 @@ import 'package:flutter/services.dart';
|
||||
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
||||
import 'package:go_router/go_router.dart';
|
||||
import 'package:cached_network_image/cached_network_image.dart';
|
||||
import 'package:share_plus/share_plus.dart';
|
||||
import 'package:url_launcher/url_launcher.dart';
|
||||
|
||||
import '../../../app/app.dart';
|
||||
@@ -269,6 +270,7 @@ class PostDetailsScreen extends ConsumerWidget {
|
||||
: null,
|
||||
onDeleteLocalFile: () =>
|
||||
_deleteLocalFile(context, ref, post),
|
||||
onShare: () => _sharePost(context, ref, post),
|
||||
),
|
||||
const SizedBox(height: 16),
|
||||
Wrap(
|
||||
@@ -377,6 +379,7 @@ class PostDetailsScreen extends ConsumerWidget {
|
||||
? () => _download(context, ref, post)
|
||||
: null,
|
||||
onDeleteLocalFile: () => _deleteLocalFile(context, ref, post),
|
||||
onShare: () => _sharePost(context, ref, post),
|
||||
),
|
||||
const SizedBox(height: 12),
|
||||
Wrap(
|
||||
@@ -448,6 +451,30 @@ class PostDetailsScreen extends ConsumerWidget {
|
||||
});
|
||||
}
|
||||
|
||||
Future<void> _sharePost(BuildContext context, WidgetRef ref, Post post) async {
|
||||
final strings = ref.read(appStringsProvider);
|
||||
ScaffoldMessenger.of(context).showSnackBar(
|
||||
SnackBar(
|
||||
content: Text(
|
||||
strings.ru
|
||||
? 'Подготовка файла к отправке...'
|
||||
: 'Preparing file for sharing...',
|
||||
),
|
||||
duration: const Duration(seconds: 1),
|
||||
),
|
||||
);
|
||||
try {
|
||||
final path =
|
||||
await ref.read(downloadServiceProvider).prepareFileForShare(post);
|
||||
await Share.shareXFiles([XFile(path)], text: post.source ?? post.fileUrl);
|
||||
} catch (e) {
|
||||
if (!context.mounted) return;
|
||||
ScaffoldMessenger.of(context).showSnackBar(
|
||||
SnackBar(content: Text('Ошибка отправки: $e')),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
Future<void> _showMobileQuickActions(
|
||||
BuildContext context,
|
||||
WidgetRef ref,
|
||||
@@ -558,6 +585,7 @@ class PostDetailsScreen extends ConsumerWidget {
|
||||
download: strings.download,
|
||||
deleteLocalFile: strings.deleteLocalFile,
|
||||
hidePost: strings.hidePost,
|
||||
share: strings.ru ? 'Поделиться' : 'Share',
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -10,6 +10,7 @@ class PostActionBar extends StatelessWidget {
|
||||
this.onOpenSource,
|
||||
this.onDownload,
|
||||
this.onDeleteLocalFile,
|
||||
this.onShare,
|
||||
this.downloaded = false,
|
||||
this.labels,
|
||||
this.onSimilar,
|
||||
@@ -25,6 +26,7 @@ class PostActionBar extends StatelessWidget {
|
||||
final bool isFavorite;
|
||||
final VoidCallback? onDownload;
|
||||
final VoidCallback? onDeleteLocalFile;
|
||||
final VoidCallback? onShare;
|
||||
final VoidCallback? onSimilar;
|
||||
final VoidCallback? onHide;
|
||||
final bool downloaded;
|
||||
@@ -91,6 +93,12 @@ class PostActionBar extends StatelessWidget {
|
||||
onPressed: onHide,
|
||||
icon: const Icon(Icons.visibility_off_rounded),
|
||||
),
|
||||
if (onShare != null)
|
||||
IconButton.filledTonal(
|
||||
tooltip: text.share,
|
||||
onPressed: onShare,
|
||||
icon: const Icon(Icons.share_rounded),
|
||||
),
|
||||
],
|
||||
);
|
||||
}
|
||||
@@ -108,6 +116,7 @@ class PostActionLabels {
|
||||
this.download = 'Download',
|
||||
this.deleteLocalFile = 'Delete local file',
|
||||
this.hidePost = 'Hide post locally',
|
||||
this.share = 'Share',
|
||||
});
|
||||
|
||||
final String favorite;
|
||||
@@ -120,4 +129,5 @@ class PostActionLabels {
|
||||
final String download;
|
||||
final String deleteLocalFile;
|
||||
final String hidePost;
|
||||
final String share;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user