Search code examples
facebooktwittersocial-networkingflutter

Creating A Share Button Using Flutter for iOS and Android?


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)

Solution

  • Check out the Flutter share plugin -- it might have what you need.