🐛 Fix share as image on iPad

This commit is contained in:
LittleSheep 2024-10-14 00:10:13 +08:00
parent 0b8a5a3303
commit 8bbd964026
2 changed files with 10 additions and 2 deletions

View File

@ -115,8 +115,16 @@ class _PostActionState extends State<PostAction> {
).create(); ).create();
await imageFile.writeAsBytes(image); await imageFile.writeAsBytes(image);
final box = context.findRenderObject() as RenderBox?;
final file = XFile(imageFile.path); final file = XFile(imageFile.path);
await Share.shareXFiles([file]); await Share.shareXFiles(
[file],
subject: 'postShareSubject'.trParams({
'username': widget.item.author.nick,
}),
sharePositionOrigin: box!.localToGlobal(Offset.zero) & box.size,
);
await imageFile.delete(); await imageFile.delete();
} }

View File

@ -34,7 +34,7 @@ class PostShareImage extends StatelessWidget {
isNonScrollAttachment: true, isNonScrollAttachment: true,
padding: const EdgeInsets.symmetric( padding: const EdgeInsets.symmetric(
horizontal: 4, horizontal: 4,
vertical: 8, vertical: 16,
), ),
onComment: () {}, onComment: () {},
), ),