使用 Flutter 为 iOS 和 Android 创建共享按钮?

Creating A Share Button Using Flutter for iOS and Android?

我正在用 Flutter 转换一些较旧的 Swift 应用程序。我如何使用 flutter 创建一个 "share" 按钮,它至少可以获取 Facebook 和 Twitter,并使其跨平台用于我的 iOS 和 Android 版本。这是我使用的 Swift 代码....

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)

查看 Flutter share plugin -- 它可能有您需要的东西。

截至 2018 年 10 月,我发现最好的方法是从这个 SO post 这里 需要你使用文件提供程序包并对 Android Studio 自定义了解一点.从 Albert Lardizabal 那里寻找答案。看起来他可能是制作出色的 "Hamilton" Flutter 应用程序的团队的一员。