Fix Share on iPad and Mac "https://pub.dev/packages/share_plus#known-issues"

OmarHatem committed Feb 8, 2023 at 00:06 UTC 1b42d2b61cf7e02dcc30b83b2cfb1c77fea597b0
3 files changed +24 -4
lib/src/screens/dashboard/widgets/address_page.dart
+8 -1
@@ -100,7 +100,14 @@ class AddressPage extends BasePage {
100 highlightColor: Colors.transparent,
101 splashColor: Colors.transparent,
102 iconSize: 25,
103 - onPressed: () => Share.share(addressListViewModel.address.address),
103 + onPressed: () {
104 + final box = context.findRenderObject() as RenderBox?;
105 +
106 + Share.share(
107 + addressListViewModel.address.address,
108 + sharePositionOrigin: box!.localToGlobal(Offset.zero) & box.size,
109 + );
110 + },
111 icon: shareImage,
112 ),
113 ) : null;
lib/src/screens/receive/receive_page.dart
+8 -1
@@ -101,7 +101,14 @@ class ReceivePage extends BasePage {
101 highlightColor: Colors.transparent,
102 splashColor: Colors.transparent,
103 iconSize: 25,
104 - onPressed: () => Share.share(addressListViewModel.address.address),
104 + onPressed: () {
105 + final box = context.findRenderObject() as RenderBox?;
106 +
107 + Share.share(
108 + addressListViewModel.address.address,
109 + sharePositionOrigin: box!.localToGlobal(Offset.zero) & box.size,
110 + );
111 + },
112 icon: shareImage
113 )
114 );
lib/src/screens/seed/wallet_seed_page.dart
+8 -2
@@ -159,8 +159,14 @@ class WalletSeedPage extends BasePage {
159 child: Container(
160 padding: EdgeInsets.only(right: 8.0),
161 child: PrimaryButton(
162 - onPressed: () =>
163 - Share.share(walletSeedViewModel.seed),
162 + onPressed: () {
163 + final box = context.findRenderObject() as RenderBox?;
164 +
165 + Share.share(
166 + walletSeedViewModel.seed,
167 + sharePositionOrigin: box!.localToGlobal(Offset.zero) & box.size,
168 + );
169 + },
170 text: S.of(context).save,
171 color: Colors.green,
172 textColor: Colors.white),