-
-
Notifications
You must be signed in to change notification settings - Fork 1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(share_plus): support rich preview on the share sheet #3372
base: main
Are you sure you want to change the base?
Conversation
Hi @slaci thanks for the contribution! I am not convinced about adding another two parameters to the method, specially The share method definitely needs a refactor and a parameter cleanup in some way. Maybe this PR is an opportunity to do that? There is some discussion about that in #3307
That's true, maybe there is a way to provide a preview thumbnail on iOS as well? |
I like the idea of adding this functionality as it is something that Android offers by default. But agree with Miguel that we might think about the API more here. |
I can extract the thumbnail to a The rest of the parameters are problematic, as the new |
I have spent some hours checking the iOS thumbnail possibilities, but sadly I couldn't figure out when the mentioned thumbnailImageForActivityType runs. There are multiple reports about this, but sadly without any answers: SO | Apple Forum From the docs it seems like it depends on the target app (though not 💯 ), like the subject (eg. the subjectForActivityType runs for the Mail app), but I couldn't find any app that would trigger the thumbnail callback or maybe it is totally bugged on iOS 18. I haven't played with the title too much yet, but currently the So if I could make the thumbnail work on iOS, then it could stay as a common option, otherwise I guess I would need to extract it to a Platform specific option class. |
Thanks for looking into it @slaci ! Re: params, I'm thinking that just having a single class ShareParams {
final String? text;
/// Used as share sheet title where supported (e.g. EXTRA_TITLE on Android)
final String? title;
/// Only used as email subject where supported (e.g. EXTRA_SUBJECT on Android)
final String? subject;
/// Only used in Android as preview thumbnail
final XFile? previewThumbnail;
/// Only used in iPad and Mac as share sheet origin
final Rect? sharePositionOrigin;
/// Share a URI, alternative to sharing [text]
final Uri? uri;
/// Share multiple files, can be used in combination with [text]
final List<XFile>? files;
final List<String>? fileNameOverrides;
ShareParams({
this.text,
this.subject,
this.extraTitle,
this.previewThumbnail,
this.sharePositionOrigin,
this.uri,
this.files,
this.fileNameOverrides,
});
} Since we would be at it, I'd like to unify all methods into one, and to make |
Added a comment on #3307 (comment) your feedback would be appreciated! |
FYI, started working on the shareplus refactor, that should simplify adding this and other optional parameters: #3404 |
Description
Support rich preview on Android with the help of the new
title
andthumbnail
parameters. Thetitle
is also used for the Web Share API'stitle
parameter in favor of thesubject
, but falls back to thesubject
for backward compatibility (as the previous code used thesubject
for this).The contribution guide says features for only one platform won't be accepted, but I still want to try.
Related Issues
EXTRA_TITLE
in share Intent on Android #3307Checklist
CHANGELOG.md
nor the plugin version inpubspec.yaml
files.flutter analyze
) does not report any problems on my PR.Breaking Change
Does your PR require plugin users to manually update their apps to accommodate your change?
!
in the title as explained in Conventional Commits).