migrate share deprecations

This commit is contained in:
Fabian Freund
2025-04-25 20:41:40 +02:00
parent f95331c654
commit f1cccc92d5
4 changed files with 15 additions and 8 deletions
@@ -190,7 +190,9 @@ class WebPageDialog extends HookConsumerWidget {
leading: const Icon(Icons.share), leading: const Icon(Icons.share),
title: const Text('Share link'), title: const Text('Share link'),
onTap: () async { onTap: () async {
await Share.shareUri(url); await SharePlus.instance.share(
ShareParams(uri: url),
);
if (context.mounted) { if (context.mounted) {
context.pop(); context.pop();
@@ -220,9 +222,12 @@ class WebPageDialog extends HookConsumerWidget {
mimeType: 'image/png', mimeType: 'image/png',
); );
await Share.shareXFiles([ await SharePlus.instance.share(
file, ShareParams(
], subject: precachedInfo?.title); files: [file],
subject: precachedInfo?.title,
),
);
} }
}); });
} }
@@ -126,7 +126,7 @@ class BrowserBottomAppBar extends HookConsumerWidget {
}, },
leadingIcon: const Icon(MdiIcons.tabUnselected), leadingIcon: const Icon(MdiIcons.tabUnselected),
child: const Text('Add Private Tab'), child: const Text('Add Private Tab'),
), ),
MenuItemButton( MenuItemButton(
onPressed: () async { onPressed: () async {
await const SearchRoute( await const SearchRoute(
@@ -300,7 +300,7 @@ class BrowserBottomAppBar extends HookConsumerWidget {
final tabState = ref.read(tabStateProvider(selectedTabId)); final tabState = ref.read(tabStateProvider(selectedTabId));
if (tabState?.url case final Uri url) { if (tabState?.url case final Uri url) {
await Share.shareUri(url); await SharePlus.instance.share(ShareParams(uri: url));
} }
}, },
leadingIcon: const Icon(Icons.share), leadingIcon: const Icon(Icons.share),
@@ -24,7 +24,7 @@ class ShareEmail extends HookConsumerWidget {
onTap: () async { onTap: () async {
final email = hitResult.tryGetLink().mapNotNull((url) => url.path); final email = hitResult.tryGetLink().mapNotNull((url) => url.path);
if (email != null) { if (email != null) {
await Share.share(email); await SharePlus.instance.share(ShareParams(text: email));
if (context.mounted) { if (context.mounted) {
context.pop(); context.pop();
@@ -21,7 +21,9 @@ class ShareLink extends HookConsumerWidget {
leading: const Icon(Icons.share), leading: const Icon(Icons.share),
title: const Text('Share link'), title: const Text('Share link'),
onTap: () async { onTap: () async {
await hitResult.tryGetLink().mapNotNull((url) => Share.shareUri(url)); await hitResult.tryGetLink().mapNotNull(
(url) => SharePlus.instance.share(ShareParams(uri: url)),
);
if (context.mounted) { if (context.mounted) {
context.pop(); context.pop();