Bug fixes

This commit is contained in:
Juan Gilsanz Polo
2024-03-24 02:46:39 +01:00
parent 822c65c4e6
commit aa0a468d19
3 changed files with 53 additions and 40 deletions

View File

@@ -108,43 +108,53 @@ class WebViewScreen extends HookConsumerWidget {
),
],
),
PopupMenuButton(
itemBuilder: (context) => [
PopupMenuItem(
onTap: () => Share.shareUri(Uri.parse(bookmark.url!)),
child: Row(
children: [
const Icon(Icons.share_rounded),
const SizedBox(width: 12),
Flexible(child: Text(t.webview.share)),
],
),
),
PopupMenuItem(
onTap: () => copyToClipboard(
key: ScaffoldMessengerKeys.root,
value: bookmark.url!,
successMessage: t.webview.linkCopiedClipboard,
),
child: Row(
children: [
const Icon(Icons.copy_rounded),
const SizedBox(width: 12),
Flexible(child: Text(t.webview.copyLinkClipboard)),
],
),
),
PopupMenuItem(
onTap: () => openUrl(bookmark.url!),
child: Row(
children: [
const Icon(Icons.open_in_browser_rounded),
const SizedBox(width: 12),
Flexible(child: Text(t.webview.openInSystemBrowser)),
],
),
),
],
Builder(
builder: (ctx) {
return PopupMenuButton(
itemBuilder: (context) => [
PopupMenuItem(
onTap: () {
final box = ctx.findRenderObject() as RenderBox?;
Share.share(
bookmark.url!,
sharePositionOrigin: box!.localToGlobal(Offset.zero) & box.size,
);
},
child: Row(
children: [
const Icon(Icons.share_rounded),
const SizedBox(width: 12),
Flexible(child: Text(t.webview.share)),
],
),
),
PopupMenuItem(
onTap: () => copyToClipboard(
key: ScaffoldMessengerKeys.root,
value: bookmark.url!,
successMessage: t.webview.linkCopiedClipboard,
),
child: Row(
children: [
const Icon(Icons.copy_rounded),
const SizedBox(width: 12),
Flexible(child: Text(t.webview.copyLinkClipboard)),
],
),
),
PopupMenuItem(
onTap: () => openUrl(bookmark.url!),
child: Row(
children: [
const Icon(Icons.open_in_browser_rounded),
const SizedBox(width: 12),
Flexible(child: Text(t.webview.openInSystemBrowser)),
],
),
),
],
);
},
),
],
),