diff --git a/lib/widgets/posts/post_action.dart b/lib/widgets/posts/post_action.dart index 61f85b1..26f3719 100644 --- a/lib/widgets/posts/post_action.dart +++ b/lib/widgets/posts/post_action.dart @@ -25,7 +25,7 @@ class _PostActionState extends State { bool _isBusy = true; bool _canModifyContent = false; - void checkAbleToModifyContent() async { + void _checkAbleToModifyContent() async { final AuthProvider auth = Get.find(); if (auth.isAuthorized.isFalse) return; @@ -38,10 +38,25 @@ class _PostActionState extends State { }); } + Future _doShare() async { + final box = context.findRenderObject() as RenderBox?; + await Share.share( + 'postShareContent'.trParams({ + 'username': widget.item.author.nick, + 'content': widget.item.body['content'] ?? 'no content', + 'link': 'https://sn.solsynth.dev/posts/${widget.item.id}', + }), + subject: 'postShareSubject'.trParams({ + 'username': widget.item.author.nick, + }), + sharePositionOrigin: box!.localToGlobal(Offset.zero) & box.size, + ); + } + @override void initState() { super.initState(); - checkAbleToModifyContent(); + _checkAbleToModifyContent(); } @override @@ -72,17 +87,7 @@ class _PostActionState extends State { leading: const Icon(Icons.share), title: Text('share'.tr), onTap: () async { - await Share.share( - 'postShareContent'.trParams({ - 'username': widget.item.author.nick, - 'content': widget.item.body['text'], - 'link': - 'https://sn.solsynth.dev/posts/${widget.item.id}', - }), - subject: 'postShareSubject'.trParams({ - 'username': widget.item.author.nick, - }), - ); + await _doShare(); Navigator.pop(context); }, ), @@ -187,7 +192,7 @@ class PostDeletionDialog extends StatefulWidget { class _PostDeletionDialogState extends State { bool _isBusy = false; - void performAction() async { + void _performAction() async { final AuthProvider auth = Get.find(); if (auth.isAuthorized.isFalse) return; @@ -219,7 +224,7 @@ class _PostDeletionDialogState extends State { child: Text('cancel'.tr), ), TextButton( - onPressed: _isBusy ? null : () => performAction(), + onPressed: _isBusy ? null : () => _performAction(), child: Text('confirm'.tr), ), ], diff --git a/pubspec.yaml b/pubspec.yaml index 0c2b3d5..de5cfa6 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -2,7 +2,7 @@ name: solian description: "The Solar Network App" publish_to: "none" -version: 1.1.0+47 +version: 1.1.0+48 environment: sdk: ">=3.3.4 <4.0.0"