Open TonyHoyleRps opened 1 year ago
Show your code.
It's literally a single line,.. this works correctly on ios and android.
Share.shareXFiles([XFile(image.filename)],
subject: "Conservatory",
sharePositionOrigin: Rect.fromLTWH(0, 0, size.width, size.height / 2));
Hi!
Can you use Share.shareFiles
instead?
I made the Windows implementation in C++/WRL for package:share_plus
, where you can see that it's working correctly. Share.shareXFiles
is a newer API which still internally calls Share.shareFiles
, it might be that it needs some changes specific to Windows.
As expected, that makes no difference.
Share.shareFiles([image.filename],
subject: "Conservatory",
sharePositionOrigin: Rect.fromLTWH(0, 0, size.width, size.height / 2));
I have also tried:
Share.shareFiles([image.filename], mimeTypes: ["image/png"],
subject: "Conservatory",
sharePositionOrigin: Rect.fromLTWH(0, 0, size.width, size.height / 2));
and
Share.shareFiles([image.filename], mimeTypes: ["image/png"],
sharePositionOrigin: Rect.fromLTWH(0, 0, size.width, size.height / 2));
The last one causes the share dialog to fail with an error 'Try that again' (presumably subject is mandatory).
As expected, that makes no difference.
Share.shareFiles([image.filename], subject: "Conservatory", sharePositionOrigin: Rect.fromLTWH(0, 0, size.width, size.height / 2));
I have also tried:
Share.shareFiles([image.filename], mimeTypes: ["image/png"], subject: "Conservatory", sharePositionOrigin: Rect.fromLTWH(0, 0, size.width, size.height / 2));
and
Share.shareFiles([image.filename], mimeTypes: ["image/png"], sharePositionOrigin: Rect.fromLTWH(0, 0, size.width, size.height / 2));
The last one causes the share dialog to fail with an error 'Try that again' (presumably subject is mandatory).
The best guess I can make is to try sharing some another file path (check for some file that exists on your system). Your file path seems to be shortened by Windows (the ~1
symbol).
I just tried with a fixed path:
Share.shareXFiles([XFile(r"D:\Test.PNG")],
subject: "Conservatory",
sharePositionOrigin: Rect.fromLTWH(0, 0, size.width, size.height / 2));
And it did exactly the same thing.
+1
Just in case someone else comes across this issue, the path should be formatted as on windows.
In my case it was enough to do:
path.replaceAll("/", "\\");
and it was working fine
Plugin
share_plus
Use case
On windows the sharing dialog always shows a link to the file rather than a preview, and always shares the path to the file, which may be temporary and linked to a single machine.
This makes the sharing action pretty pointless IMO. Now it may be a limitation of Windows (hence labelling as enhancement) but it would be really nice to have useful file sharing from flutter on windows even if someone has to code a new dialog..
Proposal
Ideally, something like this.. but just a text replacement would suffice, as long as it's possible to share a file.