🐛 Fix missing sharePositionOrigin in share
This commit is contained in:
@@ -117,8 +117,12 @@ class PostActionableItem extends HookConsumerWidget {
|
||||
await File('${directory.path}/image.png').create();
|
||||
await imagePath.writeAsBytes(image);
|
||||
|
||||
if (context.mounted) hideLoadingModal(context);
|
||||
await Share.shareXFiles([XFile(imagePath.path)]);
|
||||
if (!context.mounted) return;
|
||||
hideLoadingModal(context);
|
||||
final box = context.findRenderObject() as RenderBox?;
|
||||
await Share.shareXFiles([
|
||||
XFile(imagePath.path),
|
||||
], sharePositionOrigin: box!.localToGlobal(Offset.zero) & box.size);
|
||||
})
|
||||
.catchError((err) {
|
||||
if (context.mounted) hideLoadingModal(context);
|
||||
@@ -174,7 +178,7 @@ class PostActionableItem extends HookConsumerWidget {
|
||||
image: MenuImage.icon(Symbols.link),
|
||||
callback: () {
|
||||
Clipboard.setData(
|
||||
ClipboardData(text: 'https://solsynth.dev/posts/${item.id}'),
|
||||
ClipboardData(text: 'https://solian.app/posts/${item.id}'),
|
||||
);
|
||||
},
|
||||
),
|
||||
|
@@ -340,22 +340,33 @@ class _ShareSheetState extends ConsumerState<ShareSheet> {
|
||||
Future<void> _shareToSystem() async {
|
||||
if (!widget.toSystem) return;
|
||||
|
||||
final box = context.findRenderObject() as RenderBox?;
|
||||
|
||||
setState(() => _isLoading = true);
|
||||
try {
|
||||
switch (widget.content.type) {
|
||||
case ShareContentType.text:
|
||||
if (widget.content.text?.isNotEmpty == true) {
|
||||
await Share.share(widget.content.text!);
|
||||
await Share.share(
|
||||
widget.content.text!,
|
||||
sharePositionOrigin: box!.localToGlobal(Offset.zero) & box.size,
|
||||
);
|
||||
}
|
||||
break;
|
||||
case ShareContentType.link:
|
||||
if (widget.content.link?.isNotEmpty == true) {
|
||||
await Share.share(widget.content.link!);
|
||||
await Share.share(
|
||||
widget.content.link!,
|
||||
sharePositionOrigin: box!.localToGlobal(Offset.zero) & box.size,
|
||||
);
|
||||
}
|
||||
break;
|
||||
case ShareContentType.file:
|
||||
if (widget.content.files?.isNotEmpty == true) {
|
||||
await Share.shareXFiles(widget.content.files!);
|
||||
await Share.shareXFiles(
|
||||
widget.content.files!,
|
||||
sharePositionOrigin: box!.localToGlobal(Offset.zero) & box.size,
|
||||
);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
Reference in New Issue
Block a user