Reputation: 9139
I'm converting some older Swift apps with Flutter. How can I create a "share" button using flutter that at least gets Facebook and Twitter and make it cross platform for my iOS and Android versions. Here is the Swift code I use....
let activityViewController : UIActivityViewController = UIActivityViewController(
activityItems: [firstActivityItem, secondActivityItem, image], applicationActivities: nil)
// This lines is for the popover you need to show in iPad
activityViewController.popoverPresentationController?.sourceView = (self.shareBTN)
// This line remove the arrow of the popover to show in iPad
activityViewController.popoverPresentationController?.permittedArrowDirections = UIPopoverArrowDirection()
activityViewController.popoverPresentationController?.sourceRect = CGRect(x: 150, y: 150, width: 0, height: 0)
actInd.stopAnimating()
self.present(activityViewController, animated: true, completion: nil)
Upvotes: 1
Views: 3519
Reputation: 9139
As of Oct 2018, the best way I found was from this SO post here How do I share an image on iOS and Android using Flutter? that requires you use the File Provider package and know a little about Android Studio customization. Look for the answer from Albert Lardizabal. Looks like he may be part of the team that made the awesome "Hamilton" Flutter app.
Upvotes: 0
Reputation: 116818
Check out the Flutter share plugin -- it might have what you need.
Upvotes: 2