├── .gitattributes ├── .gitignore ├── CHANGELOG.md ├── LICENSE ├── README-cn.md ├── README.md ├── android ├── .gitignore ├── build.gradle ├── gradle.properties ├── settings.gradle └── src │ └── main │ ├── AndroidManifest.xml │ └── java │ └── com │ └── zt │ └── shareextend │ ├── MethodCallHandlerImpl.java │ ├── MimeUtils.java │ ├── Share.java │ ├── ShareExtendPlugin.java │ ├── ShareExtendProvider.java │ └── ShareUtils.java ├── example ├── .gitignore ├── .metadata ├── README.md ├── android │ ├── app │ │ ├── build.gradle │ │ └── src │ │ │ └── main │ │ │ ├── AndroidManifest.xml │ │ │ ├── java │ │ │ └── com │ │ │ │ └── zt │ │ │ │ └── shareextendexample │ │ │ │ └── EmbeddingV1Activity.java │ │ │ └── res │ │ │ ├── drawable │ │ │ └── launch_background.xml │ │ │ ├── mipmap-hdpi │ │ │ └── ic_launcher.png │ │ │ ├── mipmap-mdpi │ │ │ └── ic_launcher.png │ │ │ ├── mipmap-xhdpi │ │ │ └── ic_launcher.png │ │ │ ├── mipmap-xxhdpi │ │ │ └── ic_launcher.png │ │ │ ├── mipmap-xxxhdpi │ │ │ └── ic_launcher.png │ │ │ └── values │ │ │ └── styles.xml │ ├── build.gradle │ ├── gradle.properties │ ├── gradle │ │ └── wrapper │ │ │ └── gradle-wrapper.properties │ └── settings.gradle ├── ios │ ├── Flutter │ │ ├── AppFrameworkInfo.plist │ │ ├── Debug.xcconfig │ │ ├── Flutter.podspec │ │ └── Release.xcconfig │ ├── Podfile │ ├── Runner.xcodeproj │ │ ├── project.pbxproj │ │ ├── project.xcworkspace │ │ │ └── contents.xcworkspacedata │ │ └── xcshareddata │ │ │ └── xcschemes │ │ │ └── Runner.xcscheme │ ├── Runner.xcworkspace │ │ ├── contents.xcworkspacedata │ │ └── xcshareddata │ │ │ └── IDEWorkspaceChecks.plist │ └── Runner │ │ ├── AppDelegate.h │ │ ├── AppDelegate.m │ │ ├── Assets.xcassets │ │ ├── AppIcon.appiconset │ │ │ ├── Contents.json │ │ │ ├── Icon-App-1024x1024@1x.png │ │ │ ├── Icon-App-20x20@1x.png │ │ │ ├── Icon-App-20x20@2x.png │ │ │ ├── Icon-App-20x20@3x.png │ │ │ ├── Icon-App-29x29@1x.png │ │ │ ├── Icon-App-29x29@2x.png │ │ │ ├── Icon-App-29x29@3x.png │ │ │ ├── Icon-App-40x40@1x.png │ │ │ ├── Icon-App-40x40@2x.png │ │ │ ├── Icon-App-40x40@3x.png │ │ │ ├── Icon-App-60x60@2x.png │ │ │ ├── Icon-App-60x60@3x.png │ │ │ ├── Icon-App-76x76@1x.png │ │ │ ├── Icon-App-76x76@2x.png │ │ │ └── Icon-App-83.5x83.5@2x.png │ │ └── LaunchImage.imageset │ │ │ ├── Contents.json │ │ │ ├── LaunchImage.png │ │ │ ├── LaunchImage@2x.png │ │ │ ├── LaunchImage@3x.png │ │ │ └── README.md │ │ ├── Base.lproj │ │ ├── LaunchScreen.storyboard │ │ └── Main.storyboard │ │ ├── Info.plist │ │ ├── Runner-Bridging-Header.h │ │ └── main.m ├── lib │ └── main.dart ├── pubspec.yaml └── test │ └── widget_test.dart ├── ios ├── .gitignore ├── Assets │ └── .gitkeep ├── Classes │ ├── ShareExtendPlugin.h │ └── ShareExtendPlugin.m └── share_extend.podspec ├── lib └── share_extend.dart └── pubspec.yaml /.gitattributes: -------------------------------------------------------------------------------- 1 | * linguist-language=Dart -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Built application files 2 | *.apk 3 | *.ap_ 4 | 5 | # Files for the ART/Dalvik VM 6 | *.dex 7 | 8 | # Java class files 9 | *.class 10 | 11 | # Generated files 12 | bin/ 13 | gen/ 14 | out/ 15 | 16 | # Gradle files 17 | .gradle/ 18 | build/ 19 | 20 | # Local configuration file (sdk path, etc) 21 | local.properties 22 | 23 | # Proguard folder generated by Eclipse 24 | proguard/ 25 | 26 | # Log Files 27 | *.log 28 | 29 | # Android Studio Navigation editor temp files 30 | .navigation/ 31 | 32 | # Android Studio captures folder 33 | captures/ 34 | 35 | # IntelliJ 36 | *.iml 37 | .idea/workspace.xml 38 | .idea/tasks.xml 39 | .idea/gradle.xml 40 | .idea/assetWizardSettings.xml 41 | .idea/dictionaries 42 | .idea/libraries 43 | .idea/caches 44 | 45 | # Keystore files 46 | # Uncomment the following line if you do not want to check your keystore files in. 47 | #*.jks 48 | 49 | *.idea 50 | *.packages 51 | 52 | # External native build folder generated in Android Studio 2.2 and later 53 | .externalNativeBuild 54 | 55 | # Google Services (e.g. APIs or Firebase) 56 | google-services.json 57 | 58 | # Freeline 59 | freeline.py 60 | freeline/ 61 | freeline_project_description.json 62 | 63 | # fastlane 64 | fastlane/report.xml 65 | fastlane/Preview.html 66 | fastlane/screenshots 67 | fastlane/test_output 68 | fastlane/readme.md 69 | 70 | pubspec.lock 71 | *.iml 72 | 73 | .DS_Store 74 | .atom/ 75 | .idea/ 76 | .vscode/ 77 | .flutter-plugins-dependencies 78 | .dart_tool 79 | flutter_export_environment.sh -------------------------------------------------------------------------------- /CHANGELOG.md: -------------------------------------------------------------------------------- 1 | ## 2.0.0 2 | * support audio share 3 | * null safety support 4 | 5 | ## 1.1.9 6 | * fix ios not found module issue. 7 | 8 | ## 1.1.8 9 | * support android embedding v2 api 10 | * add extraText option for android Intent.EXTRA_TEXT when sharing image or file. 11 | 12 | ## 1.1.7 13 | * set default popover point on the ipad 14 | 15 | ## 1.1.6 16 | * fix some permission issues on some devices. 17 | * update lower bound dart dependency to 2.0.0. 18 | 19 | ## 1.1.5 20 | * fix provider issues for api < 24 21 | 22 | ## 1.1.4 23 | * add grant uri permission on Android 24 | 25 | ## 1.1.3 26 | * add option subject for sharing multiple images 27 | 28 | ## 1.1.2 29 | * rebuild the provider code on android platform 30 | * update sample code 31 | 32 | ## 1.1.1 33 | * add option param "share panel title" on android 34 | * add option param "subject" on both android and ios 35 | * update sample code with latest image_picker plugin version that fixed video picker bugs 36 | 37 | ## 1.1.0 38 | * 添加多图,多文件分享功能 39 | * 合并image_picker在ios13中选取视频不可用的补丁 40 | 41 | ## 1.0.9 42 | * 移除了Android端的内置存储的读写权限,改成由APP端来按需求配置 43 | 44 | ## 1.0.7 45 | * Android端修改了FileProvider的authorities,继承FileProvider,防止FileProvider冲突 46 | 47 | ## 1.0.6 48 | * 修复了android端分享应用沙盒内文件可能出错的bug 49 | * 优化了android端分享时的权限请求逻辑 50 | 51 | ## 1.0.5 52 | * Fix bugs when sharing videos to some apps like WeChat. 53 | 54 | ## 1.0.4 55 | 56 | * Updated to Support Latest Android Dependencies 57 | 58 | 59 | ## 0.0.1 60 | 61 | * TODO: Describe initial release. 62 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2018 zhouteng 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README-cn.md: -------------------------------------------------------------------------------- 1 | Language: [English](https://github.com/zhouteng0217/ShareExtend/blob/master/README-en.md) | [中文简体](https://github.com/zhouteng0217/ShareExtend/blob/master/README.md) 2 | 3 | # ShareExtend 4 | 5 | [![pub package](https://img.shields.io/pub/v/share_extend.svg)](https://pub.dartlang.org/packages/share_extend) 6 | 7 | 调用系统分享的Flutter组件,支持分享文本、图片、视频和文件 8 | 9 | ## 安装 10 | 11 | ``` 12 | dependencies: 13 | share_extend: "^2.0.0" 14 | ``` 15 | 16 | ### iOS 17 | 18 | 添加下面的key到工程的info.plist文件,路径 ```/ios/Runner/Info.plist```,用于将分享的图片保存到相册 19 | 20 | ``` 21 | NSPhotoLibraryAddUsageDescription 22 | 这里填写为什么需要相册写入权限的描述语句 23 | ``` 24 | 25 | ### Android 26 | 27 | 如果涉及到要分享存储空间里面的文件,需要用到读写存储空间权限的,请在项目的android模块的下,添加读写权限,路径为 `/android/app/src/main/AndroidManifest.xml` 28 | 29 | ``` 30 | 31 | 32 | ``` 33 | 34 | ## 导入 35 | 36 | ``` 37 | import 'package:share_extend/share_extend.dart'; 38 | ``` 39 | 40 | ## 使用 41 | 42 | ``` 43 | 44 | //分享文本 45 | ShareExtend.share("share text", "text","android share panel title","share subject"); 46 | 47 | //分享图片 (例子中使用了一个image_picker的插件来实现图片的选择) 48 | File f = 49 | await ImagePicker.pickImage(source: ImageSource.gallery); 50 | ShareExtend.share(f.path, "image"); 51 | 52 | //分享视频 53 | File f = await ImagePicker.pickVideo( 54 | source: ImageSource.gallery); 55 | ShareExtend.share(f.path, "video"); 56 | 57 | //分享文件 58 | Directory dir = Platform.isAndroid 59 | ? await getExternalStorageDirectory() 60 | : await getApplicationDocumentsDirectory(); 61 | File testFile = new File("${dir.path}/flutter/test.txt"); 62 | if (!await testFile.exists()) { 63 | await testFile.create(recursive: true); 64 | testFile.writeAsStringSync("test for share documents file"); 65 | } 66 | ShareExtend.share(testFile.path, "file"); 67 | 68 | //分享多图(借助了MultiImagePicker来多选获取图片图片,由于该库没有提供文件路径,因此demo里面先将图片保存为图片再调用分享) 69 | _shareMultipleImages() async { 70 | List assetList = await MultiImagePicker.pickImages(maxImages: 5); 71 | var imageList = List(); 72 | for (var asset in assetList) { 73 | String path = 74 | await _writeByteToImageFile(await asset.getByteData(quality: 30)); 75 | imageList.add(path); 76 | } 77 | ShareExtend.shareMultiple(imageList, "image",subject: "share muti image"); 78 | } 79 | 80 | Future _writeByteToImageFile(ByteData byteData) async { 81 | Directory dir = Platform.isAndroid 82 | ? await getExternalStorageDirectory() 83 | : await getApplicationDocumentsDirectory(); 84 | File imageFile = new File( 85 | "${dir.path}/flutter/${DateTime.now().millisecondsSinceEpoch}.png"); 86 | imageFile.createSync(recursive: true); 87 | imageFile.writeAsBytesSync(byteData.buffer.asUint8List(0)); 88 | return imageFile.path; 89 | } 90 | 91 | ``` -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | Language: [English](https://github.com/zhouteng0217/ShareExtend/blob/master/README.md) | [中文简体](https://github.com/zhouteng0217/ShareExtend/blob/master/README-cn.md) 2 | 3 | # ShareExtend 4 | 5 | [![pub package](https://img.shields.io/pub/v/share_extend.svg)](https://pub.dartlang.org/packages/share_extend) 6 | 7 | A Flutter plugin for iOS and Android for sharing text, image, video and file with system ui. 8 | 9 | ## Installation 10 | 11 | First, add `share_extend` as a dependency in your pubspec.yaml file. 12 | 13 | ``` 14 | dependencies: 15 | share_extend: "^2.0.0" 16 | ``` 17 | 18 | ### iOS 19 | 20 | Add the following key to your info.plist file, located in `/ios/Runner/Info.plist` for saving shared images to photo library. 21 | 22 | ``` 23 | NSPhotoLibraryAddUsageDescription 24 | describe why your app needs access to write photo library 25 | ``` 26 | 27 | ### Android 28 | 29 | If your project needs read and write permissions for sharing external storage file, please add the following permissions to your AndroidManifest.xml, located in `/android/app/src/main/AndroidManifest.xml` 30 | 31 | ``` 32 | 33 | 34 | ``` 35 | 36 | ## Import 37 | 38 | ``` 39 | import 'package:share_extend/share_extend.dart'; 40 | ``` 41 | 42 | 43 | ## Example 44 | 45 | ``` 46 | 47 | //share text 48 | ShareExtend.share("share text", "text","android share panel title","share subject"); 49 | 50 | //share image 51 | File f = 52 | await ImagePicker.pickImage(source: ImageSource.gallery); 53 | ShareExtend.share(f.path, "image"); 54 | 55 | //share video 56 | File f = await ImagePicker.pickVideo( 57 | source: ImageSource.gallery); 58 | ShareExtend.share(f.path, "video"); 59 | 60 | //share file 61 | Directory dir = Platform.isAndroid 62 | ? await getExternalStorageDirectory() 63 | : await getApplicationDocumentsDirectory(); 64 | File testFile = new File("${dir.path}/flutter/test.txt"); 65 | if (!await testFile.exists()) { 66 | await testFile.create(recursive: true); 67 | testFile.writeAsStringSync("test for share documents file"); 68 | } 69 | ShareExtend.share(testFile.path, "file"); 70 | 71 | ///share multiple images 72 | _shareMultipleImages() async { 73 | List assetList = await MultiImagePicker.pickImages(maxImages: 5); 74 | var imageList = List(); 75 | for (var asset in assetList) { 76 | String path = 77 | await _writeByteToImageFile(await asset.getByteData(quality: 30)); 78 | imageList.add(path); 79 | } 80 | ShareExtend.shareMultiple(imageList, "image",subject: "share muti image"); 81 | } 82 | 83 | Future _writeByteToImageFile(ByteData byteData) async { 84 | Directory dir = Platform.isAndroid 85 | ? await getExternalStorageDirectory() 86 | : await getApplicationDocumentsDirectory(); 87 | File imageFile = new File( 88 | "${dir.path}/flutter/${DateTime.now().millisecondsSinceEpoch}.png"); 89 | imageFile.createSync(recursive: true); 90 | imageFile.writeAsBytesSync(byteData.buffer.asUint8List(0)); 91 | return imageFile.path; 92 | } 93 | 94 | ``` -------------------------------------------------------------------------------- /android/.gitignore: -------------------------------------------------------------------------------- 1 | *.iml 2 | .gradle 3 | /local.properties 4 | /.idea/workspace.xml 5 | /.idea/libraries 6 | .DS_Store 7 | /build 8 | /captures 9 | -------------------------------------------------------------------------------- /android/build.gradle: -------------------------------------------------------------------------------- 1 | group 'com.zt.shareextend' 2 | version '1.0-SNAPSHOT' 3 | 4 | buildscript { 5 | repositories { 6 | google() 7 | jcenter() 8 | } 9 | 10 | dependencies { 11 | classpath 'com.android.tools.build:gradle:3.1.2' 12 | } 13 | } 14 | 15 | rootProject.allprojects { 16 | repositories { 17 | google() 18 | jcenter() 19 | } 20 | } 21 | 22 | apply plugin: 'com.android.library' 23 | 24 | android { 25 | compileSdkVersion 29 26 | 27 | defaultConfig { 28 | minSdkVersion 19 29 | testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" 30 | } 31 | lintOptions { 32 | disable 'InvalidPackage' 33 | } 34 | } 35 | 36 | dependencies { 37 | api 'androidx.legacy:legacy-support-core-utils:1.0.0' 38 | } 39 | -------------------------------------------------------------------------------- /android/gradle.properties: -------------------------------------------------------------------------------- 1 | org.gradle.jvmargs=-Xmx1536M 2 | android.enableJetifier=true 3 | android.useAndroidX=true -------------------------------------------------------------------------------- /android/settings.gradle: -------------------------------------------------------------------------------- 1 | rootProject.name = 'share_extend' 2 | -------------------------------------------------------------------------------- /android/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 3 | 4 | 5 | 6 | 11 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /android/src/main/java/com/zt/shareextend/MethodCallHandlerImpl.java: -------------------------------------------------------------------------------- 1 | package com.zt.shareextend; 2 | 3 | import androidx.annotation.NonNull; 4 | 5 | import java.util.Map; 6 | 7 | import io.flutter.plugin.common.MethodCall; 8 | import io.flutter.plugin.common.MethodChannel; 9 | 10 | /** 11 | * Created by zhouteng on 2020/6/27 12 | */ 13 | public class MethodCallHandlerImpl implements MethodChannel.MethodCallHandler { 14 | 15 | private static final String METHOD_SHARE = "share"; 16 | 17 | private Share share; 18 | 19 | public MethodCallHandlerImpl(Share share) { 20 | this.share = share; 21 | } 22 | 23 | @Override 24 | public void onMethodCall(@NonNull MethodCall call, @NonNull MethodChannel.Result result) { 25 | if (METHOD_SHARE.equals(call.method)) { 26 | if (!(call.arguments instanceof Map)) { 27 | throw new IllegalArgumentException("Map argument expected"); 28 | } 29 | share.share(call); 30 | result.success(null); 31 | } else { 32 | result.notImplemented(); 33 | } 34 | } 35 | 36 | } 37 | -------------------------------------------------------------------------------- /android/src/main/java/com/zt/shareextend/MimeUtils.java: -------------------------------------------------------------------------------- 1 | package com.zt.shareextend; 2 | 3 | import android.text.TextUtils; 4 | import android.webkit.MimeTypeMap; 5 | 6 | import java.io.File; 7 | import java.util.HashMap; 8 | import java.util.Map; 9 | 10 | /** 11 | * Created by zhouteng on 2020-03-29 12 | */ 13 | public class MimeUtils { 14 | 15 | private static final String DEFAULT_MINE_TYPE = "application/octet-stream"; 16 | 17 | private static final Map extensionToMimeTypeMap = new HashMap<>(); 18 | 19 | static { 20 | add("epub", "application/epub+zip"); 21 | add("ogx", "application/ogg"); 22 | add("odp", "application/vnd.oasis.opendocument.presentation"); 23 | add("otp", "application/vnd.oasis.opendocument.presentation-template"); 24 | add("yt", "application/vnd.youtube.yt"); 25 | add("hwp", "application/x-hwp"); 26 | add("3gpp", "video/3gpp"); 27 | add("3gp", "video/3gpp"); 28 | add("3gpp2", "video/3gpp2"); 29 | add("3g2", "video/3gpp2"); 30 | add("oga", "audio/ogg"); 31 | add("ogg", "audio/ogg"); 32 | add("spx", "audio/ogg"); 33 | add("dng", "image/x-adobe-dng"); 34 | add("cr2", "image/x-canon-cr2"); 35 | add("raf", "image/x-fuji-raf"); 36 | add("nef", "image/x-nikon-nef"); 37 | add("nrw", "image/x-nikon-nrw"); 38 | add("orf", "image/x-olympus-orf"); 39 | add("rw2", "image/x-panasonic-rw2"); 40 | add("pef", "image/x-pentax-pef"); 41 | add("srw", "image/x-samsung-srw"); 42 | add("arw", "image/x-sony-arw"); 43 | add("ogv", "video/ogg"); 44 | add("tgz", "application/x-gtar-compressed"); 45 | add("taz", "application/x-gtar-compressed"); 46 | add("csv", "text/csv"); 47 | add("gz", "application/gzip"); 48 | add("cab", "application/vnd.ms-cab-compressed"); 49 | add("7z", "application/x-7z-compressed"); 50 | add("bz", "application/x-bzip"); 51 | add("bz2", "application/x-bzip2"); 52 | add("z", "application/x-compress"); 53 | add("jar", "application/x-java-archive"); 54 | add("lzma", "application/x-lzma"); 55 | add("xz", "application/x-xz"); 56 | add("m3u", "audio/x-mpegurl"); 57 | add("m3u8", "audio/x-mpegurl"); 58 | add("p7b", "application/x-pkcs7-certificates"); 59 | add("spc", "application/x-pkcs7-certificates"); 60 | add("p7c", "application/pkcs7-mime"); 61 | add("p7s", "application/pkcs7-signature"); 62 | add("es", "application/ecmascript"); 63 | add("js", "application/javascript"); 64 | add("json", "application/json"); 65 | add("ts", "application/typescript"); 66 | add("perl", "text/x-perl"); 67 | add("pl", "text/x-perl"); 68 | add("pm", "text/x-perl"); 69 | add("py", "text/x-python"); 70 | add("py3", "text/x-python"); 71 | add("py3x", "text/x-python"); 72 | add("pyx", "text/x-python"); 73 | add("wsgi", "text/x-python"); 74 | add("rb", "text/ruby"); 75 | add("sh", "application/x-sh"); 76 | add("yaml", "text/x-yaml"); 77 | add("yml", "text/x-yaml"); 78 | add("asm", "text/x-asm"); 79 | add("s", "text/x-asm"); 80 | add("cs", "text/x-csharp"); 81 | add("azw", "application/vnd.amazon.ebook"); 82 | add("ibooks", "application/x-ibooks+zip"); 83 | add("mobi", "application/x-mobipocket-ebook"); 84 | add("woff", "font/woff"); 85 | add("woff2", "font/woff2"); 86 | add("msg", "application/vnd.ms-outlook"); 87 | add("eml", "message/rfc822"); 88 | add("eot", "application/vnd.ms-fontobject"); 89 | add("ttf", "font/ttf"); 90 | add("otf", "font/otf"); 91 | add("ttc", "font/collection"); 92 | add("markdown", "text/markdown"); 93 | add("md", "text/markdown"); 94 | add("mkd", "text/markdown"); 95 | add("conf", "text/plain"); 96 | add("ini", "text/plain"); 97 | add("list", "text/plain"); 98 | add("log", "text/plain"); 99 | add("prop", "text/plain"); 100 | add("properties", "text/plain"); 101 | add("rc", "text/plain"); 102 | add("flv", "video/x-flv"); 103 | } 104 | 105 | private static void add(String extension, String mimeType) { 106 | if (!extensionToMimeTypeMap.containsKey(extension)) { 107 | extensionToMimeTypeMap.put(extension, mimeType); 108 | } 109 | } 110 | 111 | public static String getMineType(File file) { 112 | final int lastDot = file.getName().lastIndexOf('.'); 113 | if (lastDot < 0) { 114 | return DEFAULT_MINE_TYPE; 115 | } 116 | 117 | final String extension = file.getName().substring(lastDot + 1).toLowerCase(); 118 | String mineType = extensionToMimeTypeMap.get(extension); 119 | if (!TextUtils.isEmpty(mineType)) { 120 | return mineType; 121 | } 122 | 123 | mineType = MimeTypeMap.getSingleton().getMimeTypeFromExtension(extension); 124 | if (!TextUtils.isEmpty(mineType)) { 125 | return mineType; 126 | } 127 | return DEFAULT_MINE_TYPE; 128 | } 129 | } 130 | -------------------------------------------------------------------------------- /android/src/main/java/com/zt/shareextend/Share.java: -------------------------------------------------------------------------------- 1 | package com.zt.shareextend; 2 | 3 | import android.Manifest; 4 | import android.app.Activity; 5 | import android.content.Context; 6 | import android.content.Intent; 7 | import android.content.pm.PackageManager; 8 | import android.net.Uri; 9 | 10 | import androidx.core.app.ActivityCompat; 11 | import androidx.core.content.ContextCompat; 12 | 13 | import java.io.File; 14 | import java.util.ArrayList; 15 | import java.util.List; 16 | 17 | import io.flutter.plugin.common.MethodCall; 18 | 19 | /** 20 | * Created by zhouteng on 2020/6/27 21 | *

22 | * Handles share action 23 | */ 24 | public class Share { 25 | 26 | private static final int CODE_ASK_PERMISSION = 100; 27 | 28 | private Context context; 29 | private MethodCall call; 30 | 31 | public Share(Context context) { 32 | this.context = context; 33 | } 34 | 35 | void share() { 36 | share(call); 37 | } 38 | 39 | void share(MethodCall call) { 40 | 41 | if (call == null) { 42 | return; 43 | } 44 | 45 | this.call = call; 46 | 47 | List list = call.argument("list"); 48 | String type = call.argument("type"); 49 | String sharePanelTitle = call.argument("sharePanelTitle"); 50 | String subject = call.argument("subject"); 51 | ArrayList extraTexts = call.argument("extraTexts"); 52 | 53 | if (list == null || list.isEmpty()) { 54 | throw new IllegalArgumentException("Non-empty list expected"); 55 | } 56 | 57 | ArrayList uriList = new ArrayList<>(); 58 | 59 | Intent shareIntent = new Intent(); 60 | shareIntent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION); 61 | shareIntent.putExtra(Intent.EXTRA_SUBJECT, subject); 62 | 63 | if ("text".equals(type)) { 64 | shareIntent.setAction(Intent.ACTION_SEND); 65 | shareIntent.putExtra(Intent.EXTRA_TEXT, list.get(0)); 66 | shareIntent.setType("text/plain"); 67 | } else { 68 | if (ShareUtils.shouldRequestPermission(list)) { 69 | if (!checkPermission()) { 70 | requestPermission(); 71 | return; 72 | } 73 | } 74 | for (String path : list) { 75 | File f = new File(path); 76 | Uri uri = ShareUtils.getUriForFile(context, f); 77 | uriList.add(uri); 78 | } 79 | 80 | if ("image".equals(type)) { 81 | shareIntent.setType("image/*"); 82 | } else if ("video".equals(type)) { 83 | shareIntent.setType("video/*"); 84 | } else if ("audio".equals(type)) { 85 | shareIntent.setType("audio/*"); 86 | } else { 87 | shareIntent.setType("application/*"); 88 | } 89 | if (uriList.size() == 1) { 90 | shareIntent.putExtra(Intent.EXTRA_TEXT, extraTexts != null && !extraTexts.isEmpty() ? extraTexts.get(0) : null); 91 | shareIntent.setAction(Intent.ACTION_SEND); 92 | shareIntent.putExtra(Intent.EXTRA_STREAM, uriList.get(0)); 93 | } else { 94 | shareIntent.putExtra(Intent.EXTRA_TEXT, extraTexts); 95 | shareIntent.setAction(Intent.ACTION_SEND_MULTIPLE); 96 | shareIntent.putParcelableArrayListExtra(Intent.EXTRA_STREAM, uriList); 97 | } 98 | } 99 | startChooserActivity(shareIntent, sharePanelTitle, uriList); 100 | } 101 | 102 | private void startChooserActivity(Intent shareIntent, String sharePanelTitle, ArrayList uriList) { 103 | Intent chooserIntent = Intent.createChooser(shareIntent, sharePanelTitle); 104 | ShareUtils.grantUriPermission(context, uriList, chooserIntent); 105 | 106 | if (context instanceof Activity) { 107 | context.startActivity(chooserIntent); 108 | } else { 109 | chooserIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); 110 | context.startActivity(chooserIntent); 111 | } 112 | } 113 | 114 | private boolean checkPermission() { 115 | return ContextCompat.checkSelfPermission(context, Manifest.permission.WRITE_EXTERNAL_STORAGE) 116 | == PackageManager.PERMISSION_GRANTED; 117 | } 118 | 119 | private void requestPermission() { 120 | if (!(context instanceof Activity)) { 121 | return; 122 | } 123 | ActivityCompat.requestPermissions((Activity) context, new String[]{Manifest.permission.WRITE_EXTERNAL_STORAGE}, CODE_ASK_PERMISSION); 124 | } 125 | } 126 | -------------------------------------------------------------------------------- /android/src/main/java/com/zt/shareextend/ShareExtendPlugin.java: -------------------------------------------------------------------------------- 1 | package com.zt.shareextend; 2 | 3 | import android.content.Context; 4 | import android.content.pm.PackageManager; 5 | 6 | import androidx.annotation.NonNull; 7 | 8 | import io.flutter.embedding.engine.plugins.FlutterPlugin; 9 | import io.flutter.embedding.engine.plugins.activity.ActivityAware; 10 | import io.flutter.embedding.engine.plugins.activity.ActivityPluginBinding; 11 | import io.flutter.plugin.common.BinaryMessenger; 12 | import io.flutter.plugin.common.MethodChannel; 13 | import io.flutter.plugin.common.PluginRegistry; 14 | import io.flutter.plugin.common.PluginRegistry.Registrar; 15 | 16 | /** 17 | * Plugin method host for presenting a share sheet via Intent 18 | */ 19 | public class ShareExtendPlugin implements FlutterPlugin, ActivityAware, PluginRegistry.RequestPermissionsResultListener { 20 | 21 | /// the authorities for FileProvider 22 | private static final int CODE_ASK_PERMISSION = 100; 23 | private static final String CHANNEL = "com.zt.shareextend/share_extend"; 24 | 25 | private FlutterPluginBinding pluginBinding; 26 | private ActivityPluginBinding activityBinding; 27 | 28 | private MethodChannel methodChannel; 29 | private MethodCallHandlerImpl callHandler; 30 | private Share share; 31 | 32 | public static void registerWith(Registrar registrar) { 33 | ShareExtendPlugin plugin = new ShareExtendPlugin(); 34 | plugin.setUpChannel(registrar.context(), registrar.messenger(), registrar, null); 35 | } 36 | 37 | @Override 38 | public void onAttachedToEngine(@NonNull FlutterPluginBinding flutterPluginBinding) { 39 | pluginBinding = flutterPluginBinding; 40 | } 41 | 42 | @Override 43 | public void onDetachedFromEngine(@NonNull FlutterPluginBinding flutterPluginBinding) { 44 | pluginBinding = null; 45 | } 46 | 47 | @Override 48 | public void onAttachedToActivity(@NonNull ActivityPluginBinding activityPluginBinding) { 49 | activityBinding = activityPluginBinding; 50 | setUpChannel(activityBinding.getActivity(), pluginBinding.getBinaryMessenger(), null, activityBinding); 51 | } 52 | 53 | @Override 54 | public void onDetachedFromActivityForConfigChanges() { 55 | onDetachedFromActivity(); 56 | } 57 | 58 | @Override 59 | public void onReattachedToActivityForConfigChanges(@NonNull ActivityPluginBinding activityPluginBinding) { 60 | onAttachedToActivity(activityPluginBinding); 61 | } 62 | 63 | @Override 64 | public void onDetachedFromActivity() { 65 | tearDown(); 66 | } 67 | 68 | private void setUpChannel(Context context, BinaryMessenger messenger,Registrar registrar, ActivityPluginBinding activityBinding) { 69 | methodChannel = new MethodChannel(messenger, CHANNEL); 70 | share = new Share(context); 71 | callHandler = new MethodCallHandlerImpl(share); 72 | methodChannel.setMethodCallHandler(callHandler); 73 | if (registrar != null) { 74 | registrar.addRequestPermissionsResultListener(this); 75 | } else { 76 | activityBinding.addRequestPermissionsResultListener(this); 77 | } 78 | } 79 | 80 | private void tearDown() { 81 | activityBinding.removeRequestPermissionsResultListener(this); 82 | activityBinding = null; 83 | methodChannel.setMethodCallHandler(null); 84 | methodChannel = null; 85 | } 86 | 87 | @Override 88 | public boolean onRequestPermissionsResult(int requestCode, String[] perms, int[] grantResults) { 89 | if (requestCode == CODE_ASK_PERMISSION && grantResults.length > 0 && grantResults[0] == PackageManager.PERMISSION_GRANTED) { 90 | share.share(); 91 | } 92 | return false; 93 | } 94 | } 95 | -------------------------------------------------------------------------------- /android/src/main/java/com/zt/shareextend/ShareExtendProvider.java: -------------------------------------------------------------------------------- 1 | package com.zt.shareextend; 2 | 3 | import android.content.ContentProvider; 4 | import android.content.ContentResolver; 5 | import android.content.ContentValues; 6 | import android.content.Context; 7 | import android.content.pm.ProviderInfo; 8 | import android.database.Cursor; 9 | import android.database.MatrixCursor; 10 | import android.net.Uri; 11 | import android.os.ParcelFileDescriptor; 12 | import android.provider.MediaStore; 13 | import android.provider.OpenableColumns; 14 | 15 | import androidx.annotation.NonNull; 16 | import androidx.annotation.Nullable; 17 | 18 | import java.io.File; 19 | import java.io.FileNotFoundException; 20 | 21 | public class ShareExtendProvider extends ContentProvider { 22 | 23 | private static final String[] COLUMNS = { 24 | OpenableColumns.DISPLAY_NAME, 25 | OpenableColumns.SIZE, 26 | MediaStore.MediaColumns.DATA 27 | }; 28 | 29 | @Override 30 | public void attachInfo(Context context, ProviderInfo info) { 31 | super.attachInfo(context, info); 32 | 33 | // Sanity check our security 34 | if (info.exported) { 35 | throw new SecurityException("Provider must not be exported"); 36 | } 37 | if (!info.grantUriPermissions) { 38 | throw new SecurityException("Provider must grant uri permissions"); 39 | } 40 | } 41 | 42 | @Override 43 | public boolean onCreate() { 44 | return false; 45 | } 46 | 47 | @Nullable 48 | @Override 49 | public ParcelFileDescriptor openFile(@NonNull Uri uri, @NonNull String mode) throws FileNotFoundException { 50 | final File file = getFileForUri(uri); 51 | final int fileMode = modeToMode(mode); 52 | return ParcelFileDescriptor.open(file, fileMode); 53 | } 54 | 55 | private static int modeToMode(String mode) { 56 | int modeBits; 57 | if ("r".equals(mode)) { 58 | modeBits = ParcelFileDescriptor.MODE_READ_ONLY; 59 | } else if ("w".equals(mode) || "wt".equals(mode)) { 60 | modeBits = ParcelFileDescriptor.MODE_WRITE_ONLY 61 | | ParcelFileDescriptor.MODE_CREATE 62 | | ParcelFileDescriptor.MODE_TRUNCATE; 63 | } else if ("wa".equals(mode)) { 64 | modeBits = ParcelFileDescriptor.MODE_WRITE_ONLY 65 | | ParcelFileDescriptor.MODE_CREATE 66 | | ParcelFileDescriptor.MODE_APPEND; 67 | } else if ("rw".equals(mode)) { 68 | modeBits = ParcelFileDescriptor.MODE_READ_WRITE 69 | | ParcelFileDescriptor.MODE_CREATE; 70 | } else if ("rwt".equals(mode)) { 71 | modeBits = ParcelFileDescriptor.MODE_READ_WRITE 72 | | ParcelFileDescriptor.MODE_CREATE 73 | | ParcelFileDescriptor.MODE_TRUNCATE; 74 | } else { 75 | throw new IllegalArgumentException("Invalid mode: " + mode); 76 | } 77 | return modeBits; 78 | } 79 | 80 | @Nullable 81 | @Override 82 | public Cursor query(@NonNull Uri uri, @Nullable String[] projection, @Nullable String selection, @Nullable String[] selectionArgs, @Nullable String sortOrder) { 83 | 84 | File file = getFileForUri(uri); 85 | 86 | if (projection == null) { 87 | projection = COLUMNS; 88 | } 89 | 90 | String[] cols = new String[projection.length]; 91 | Object[] values = new Object[projection.length]; 92 | int i = 0; 93 | for (String col : projection) { 94 | if (OpenableColumns.DISPLAY_NAME.equals(col)) { 95 | cols[i] = OpenableColumns.DISPLAY_NAME; 96 | values[i++] = file.getName(); 97 | } else if (OpenableColumns.SIZE.equals(col)) { 98 | cols[i] = OpenableColumns.SIZE; 99 | values[i++] = file.length(); 100 | } else if (MediaStore.MediaColumns.DATA.equals(col)) { 101 | cols[i] = MediaStore.MediaColumns.DATA; 102 | values[i++] = file.getAbsolutePath(); 103 | } 104 | } 105 | 106 | cols = copyOf(cols, i); 107 | values = copyOf(values, i); 108 | 109 | final MatrixCursor cursor = new MatrixCursor(cols, 1); 110 | cursor.addRow(values); 111 | return cursor; 112 | } 113 | 114 | private static String[] copyOf(String[] original, int newLength) { 115 | final String[] result = new String[newLength]; 116 | System.arraycopy(original, 0, result, 0, newLength); 117 | return result; 118 | } 119 | 120 | private static Object[] copyOf(Object[] original, int newLength) { 121 | final Object[] result = new Object[newLength]; 122 | System.arraycopy(original, 0, result, 0, newLength); 123 | return result; 124 | } 125 | 126 | @Nullable 127 | @Override 128 | public String getType(@NonNull Uri uri) { 129 | return MimeUtils.getMineType(getFileForUri(uri)); 130 | } 131 | 132 | public static Uri getUriForPath(String authority, String path) { 133 | return new Uri.Builder() 134 | .scheme(ContentResolver.SCHEME_CONTENT) 135 | .authority(authority) 136 | .path(Uri.encode(path)) 137 | .build(); 138 | } 139 | 140 | private File getFileForUri(Uri uri) { 141 | String path = Uri.decode(uri.getPath()).substring(1); 142 | return new File(path); 143 | } 144 | 145 | @Nullable 146 | @Override 147 | public Uri insert(@NonNull Uri uri, @Nullable ContentValues values) { 148 | throw new UnsupportedOperationException("No external inserts"); 149 | } 150 | 151 | @Override 152 | public int delete(@NonNull Uri uri, @Nullable String selection, @Nullable String[] selectionArgs) { 153 | throw new UnsupportedOperationException("No external deletes"); 154 | } 155 | 156 | @Override 157 | public int update(@NonNull Uri uri, @Nullable ContentValues values, @Nullable String selection, @Nullable String[] selectionArgs) { 158 | throw new UnsupportedOperationException("No external updates"); 159 | } 160 | } 161 | -------------------------------------------------------------------------------- /android/src/main/java/com/zt/shareextend/ShareUtils.java: -------------------------------------------------------------------------------- 1 | package com.zt.shareextend; 2 | 3 | import android.content.Context; 4 | import android.content.Intent; 5 | import android.content.pm.PackageManager; 6 | import android.content.pm.ResolveInfo; 7 | import android.net.Uri; 8 | import android.os.Build; 9 | import android.os.Environment; 10 | 11 | import java.io.File; 12 | import java.util.List; 13 | 14 | class ShareUtils { 15 | 16 | /// get the uri for file 17 | static Uri getUriForFile(Context context, File file) { 18 | 19 | String authorities = context.getPackageName() + ".shareextend.fileprovider"; 20 | 21 | return ShareExtendProvider.getUriForPath(authorities, file.getAbsolutePath()); 22 | } 23 | 24 | static void grantUriPermission(Context context, List uriList, Intent intent) { 25 | // some devices will crash when calling queryIntentActivities, so add try catch temporarily. 26 | try { 27 | for (Uri uri : uriList) { 28 | List resolveInfos = context.getPackageManager().queryIntentActivities(intent, PackageManager.MATCH_DEFAULT_ONLY); 29 | for (ResolveInfo resolveInfo : resolveInfos) { 30 | context.grantUriPermission(resolveInfo.activityInfo.packageName, uri, Intent.FLAG_GRANT_READ_URI_PERMISSION | Intent.FLAG_GRANT_WRITE_URI_PERMISSION); 31 | } 32 | } 33 | } catch (Exception e) { 34 | 35 | } 36 | } 37 | 38 | static boolean shouldRequestPermission(List pathList) { 39 | for (String path : pathList) { 40 | if (shouldRequestPermission(path)) { 41 | return true; 42 | } 43 | } 44 | return false; 45 | } 46 | 47 | private static boolean shouldRequestPermission(String path) { 48 | return Build.VERSION.SDK_INT >= Build.VERSION_CODES.M && isPathInExternalStorage(path); 49 | } 50 | 51 | private static boolean isPathInExternalStorage(String path) { 52 | File storagePath = Environment.getExternalStorageDirectory(); 53 | return path.startsWith(storagePath.getAbsolutePath()); 54 | } 55 | } 56 | -------------------------------------------------------------------------------- /example/.gitignore: -------------------------------------------------------------------------------- 1 | # Miscellaneous 2 | *.class 3 | *.lock 4 | *.log 5 | *.pyc 6 | *.swp 7 | .DS_Store 8 | .atom/ 9 | .buildlog/ 10 | .history 11 | .svn/ 12 | 13 | # IntelliJ related 14 | *.iml 15 | *.ipr 16 | *.iws 17 | .idea/ 18 | 19 | # Visual Studio Code related 20 | .vscode/ 21 | 22 | # Flutter/Dart/Pub related 23 | **/doc/api/ 24 | .dart_tool/ 25 | .flutter-plugins 26 | .packages 27 | .pub-cache/ 28 | .pub/ 29 | build/ 30 | 31 | # Android related 32 | **/android/**/gradle-wrapper.jar 33 | **/android/.gradle 34 | **/android/captures/ 35 | **/android/gradlew 36 | **/android/gradlew.bat 37 | **/android/local.properties 38 | **/android/**/GeneratedPluginRegistrant.java 39 | 40 | # iOS/XCode related 41 | **/ios/**/*.mode1v3 42 | **/ios/**/*.mode2v3 43 | **/ios/**/*.moved-aside 44 | **/ios/**/*.pbxuser 45 | **/ios/**/*.perspectivev3 46 | **/ios/**/*sync/ 47 | **/ios/**/.sconsign.dblite 48 | **/ios/**/.tags* 49 | **/ios/**/.vagrant/ 50 | **/ios/**/DerivedData/ 51 | **/ios/**/Icon? 52 | **/ios/**/Pods/ 53 | **/ios/**/.symlinks/ 54 | **/ios/**/profile 55 | **/ios/**/xcuserdata 56 | **/ios/.generated/ 57 | **/ios/Flutter/App.framework 58 | **/ios/Flutter/Flutter.framework 59 | **/ios/Flutter/Generated.xcconfig 60 | **/ios/Flutter/app.flx 61 | **/ios/Flutter/app.zip 62 | **/ios/Flutter/flutter_assets/ 63 | **/ios/ServiceDefinitions.json 64 | **/ios/Runner/GeneratedPluginRegistrant.* 65 | 66 | # Exceptions to above rules. 67 | !**/ios/**/default.mode1v3 68 | !**/ios/**/default.mode2v3 69 | !**/ios/**/default.pbxuser 70 | !**/ios/**/default.perspectivev3 71 | !/packages/flutter_tools/test/data/dart_dependencies_test/**/.packages 72 | -------------------------------------------------------------------------------- /example/.metadata: -------------------------------------------------------------------------------- 1 | # This file tracks properties of this Flutter project. 2 | # Used by Flutter tool to assess capabilities and perform upgrades etc. 3 | # 4 | # This file should be version controlled and should not be manually edited. 5 | 6 | version: 7 | revision: 13684e4f8e9edb4c2b2a0fd8e1439f93e6e30fde 8 | channel: unknown 9 | -------------------------------------------------------------------------------- /example/README.md: -------------------------------------------------------------------------------- 1 | # share_extend_example 2 | 3 | Demonstrates how to use the share_extend plugin. 4 | 5 | ## Getting Started 6 | 7 | For help getting started with Flutter, view our online 8 | [documentation](https://flutter.io/). 9 | -------------------------------------------------------------------------------- /example/android/app/build.gradle: -------------------------------------------------------------------------------- 1 | def localProperties = new Properties() 2 | def localPropertiesFile = rootProject.file('local.properties') 3 | if (localPropertiesFile.exists()) { 4 | localPropertiesFile.withReader('UTF-8') { reader -> 5 | localProperties.load(reader) 6 | } 7 | } 8 | 9 | def flutterRoot = localProperties.getProperty('flutter.sdk') 10 | if (flutterRoot == null) { 11 | throw new GradleException("Flutter SDK not found. Define location with flutter.sdk in the local.properties file.") 12 | } 13 | 14 | def flutterVersionCode = localProperties.getProperty('flutter.versionCode') 15 | if (flutterVersionCode == null) { 16 | flutterVersionCode = '1' 17 | } 18 | 19 | def flutterVersionName = localProperties.getProperty('flutter.versionName') 20 | if (flutterVersionName == null) { 21 | flutterVersionName = '1.0' 22 | } 23 | 24 | apply plugin: 'com.android.application' 25 | apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle" 26 | 27 | android { 28 | compileSdkVersion 28 29 | 30 | lintOptions { 31 | disable 'InvalidPackage' 32 | } 33 | 34 | defaultConfig { 35 | // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html). 36 | applicationId "com.zt.shareextendexample" 37 | minSdkVersion 19 38 | targetSdkVersion 28 39 | versionCode flutterVersionCode.toInteger() 40 | versionName flutterVersionName 41 | testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" 42 | } 43 | 44 | buildTypes { 45 | release { 46 | // TODO: Add your own signing config for the release build. 47 | // Signing with the debug keys for now, so `flutter run --release` works. 48 | signingConfig signingConfigs.debug 49 | } 50 | } 51 | } 52 | 53 | flutter { 54 | source '../..' 55 | } 56 | 57 | dependencies { 58 | testImplementation 'junit:junit:4.12' 59 | androidTestImplementation 'androidx.test:runner:1.1.2-alpha01' 60 | androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.2-alpha01' 61 | } 62 | -------------------------------------------------------------------------------- /example/android/app/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 3 | 4 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 19 | 23 | 24 | 31 | 32 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 49 | 50 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | -------------------------------------------------------------------------------- /example/android/app/src/main/java/com/zt/shareextendexample/EmbeddingV1Activity.java: -------------------------------------------------------------------------------- 1 | package com.zt.shareextendexample; 2 | 3 | import android.os.Bundle; 4 | 5 | import com.vitanov.multiimagepicker.MultiImagePickerPlugin; 6 | import com.zt.shareextend.ShareExtendPlugin; 7 | 8 | import io.flutter.app.FlutterActivity; 9 | import io.flutter.embedding.engine.plugins.FlutterPlugin; 10 | import io.flutter.plugins.GeneratedPluginRegistrant; 11 | import io.flutter.plugins.flutter_plugin_android_lifecycle.FlutterAndroidLifecyclePlugin; 12 | import io.flutter.plugins.imagepicker.ImagePickerPlugin; 13 | import io.flutter.plugins.pathprovider.PathProviderPlugin; 14 | 15 | public class EmbeddingV1Activity extends FlutterActivity { 16 | @Override 17 | protected void onCreate(Bundle savedInstanceState) { 18 | super.onCreate(savedInstanceState); 19 | ShareExtendPlugin.registerWith(registrarFor("com.zt.shareextend.ShareExtendPlugin")); 20 | ImagePickerPlugin.registerWith(registrarFor("io.flutter.plugins.imagepicker.ImagePickerPlugin")); 21 | MultiImagePickerPlugin.registerWith(registrarFor("com.vitanov.multiimagepicker.MultiImagePickerPlugin")); 22 | PathProviderPlugin.registerWith(registrarFor("io.flutter.plugins.pathprovider.PathProviderPlugin")); 23 | FlutterAndroidLifecyclePlugin.registerWith(registrarFor("io.flutter.plugins.flutter_plugin_android_lifecycle.FlutterAndroidLifecyclePlugin")); 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /example/android/app/src/main/res/drawable/launch_background.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 12 | 13 | -------------------------------------------------------------------------------- /example/android/app/src/main/res/mipmap-hdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhouteng0217/ShareExtend/9169405eaceb37159063d37c392bcd9270785b2b/example/android/app/src/main/res/mipmap-hdpi/ic_launcher.png -------------------------------------------------------------------------------- /example/android/app/src/main/res/mipmap-mdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhouteng0217/ShareExtend/9169405eaceb37159063d37c392bcd9270785b2b/example/android/app/src/main/res/mipmap-mdpi/ic_launcher.png -------------------------------------------------------------------------------- /example/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhouteng0217/ShareExtend/9169405eaceb37159063d37c392bcd9270785b2b/example/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png -------------------------------------------------------------------------------- /example/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhouteng0217/ShareExtend/9169405eaceb37159063d37c392bcd9270785b2b/example/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /example/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhouteng0217/ShareExtend/9169405eaceb37159063d37c392bcd9270785b2b/example/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /example/android/app/src/main/res/values/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 8 | 9 | -------------------------------------------------------------------------------- /example/android/build.gradle: -------------------------------------------------------------------------------- 1 | buildscript { 2 | repositories { 3 | google() 4 | jcenter() 5 | } 6 | 7 | dependencies { 8 | classpath 'com.android.tools.build:gradle:3.3.1' 9 | } 10 | } 11 | 12 | allprojects { 13 | repositories { 14 | google() 15 | jcenter() 16 | } 17 | } 18 | 19 | rootProject.buildDir = '../build' 20 | 21 | subprojects { 22 | project.buildDir = "${rootProject.buildDir}/${project.name}" 23 | } 24 | subprojects { 25 | project.evaluationDependsOn(':app') 26 | } 27 | 28 | task clean(type: Delete) { 29 | delete rootProject.buildDir 30 | } 31 | -------------------------------------------------------------------------------- /example/android/gradle.properties: -------------------------------------------------------------------------------- 1 | android.enableJetifier=true 2 | android.useAndroidX=true 3 | org.gradle.jvmargs=-Xmx1536M 4 | android.enableR8=true 5 | -------------------------------------------------------------------------------- /example/android/gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | #Thu Feb 07 10:23:11 EST 2019 2 | distributionBase=GRADLE_USER_HOME 3 | distributionPath=wrapper/dists 4 | zipStoreBase=GRADLE_USER_HOME 5 | zipStorePath=wrapper/dists 6 | distributionUrl=https\://services.gradle.org/distributions/gradle-4.10.1-all.zip 7 | -------------------------------------------------------------------------------- /example/android/settings.gradle: -------------------------------------------------------------------------------- 1 | include ':app' 2 | 3 | def flutterProjectRoot = rootProject.projectDir.parentFile.toPath() 4 | 5 | def plugins = new Properties() 6 | def pluginsFile = new File(flutterProjectRoot.toFile(), '.flutter-plugins') 7 | if (pluginsFile.exists()) { 8 | pluginsFile.withReader('UTF-8') { reader -> plugins.load(reader) } 9 | } 10 | 11 | plugins.each { name, path -> 12 | def pluginDirectory = flutterProjectRoot.resolve(path).resolve('android').toFile() 13 | include ":$name" 14 | project(":$name").projectDir = pluginDirectory 15 | } 16 | -------------------------------------------------------------------------------- /example/ios/Flutter/AppFrameworkInfo.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | App 9 | CFBundleIdentifier 10 | io.flutter.flutter.app 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | App 15 | CFBundlePackageType 16 | FMWK 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | 1.0 23 | MinimumOSVersion 24 | 8.0 25 | 26 | 27 | -------------------------------------------------------------------------------- /example/ios/Flutter/Debug.xcconfig: -------------------------------------------------------------------------------- 1 | #include "Pods/Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig" 2 | #include "Generated.xcconfig" 3 | -------------------------------------------------------------------------------- /example/ios/Flutter/Flutter.podspec: -------------------------------------------------------------------------------- 1 | # 2 | # NOTE: This podspec is NOT to be published. It is only used as a local source! 3 | # This is a generated file; do not edit or check into version control. 4 | # 5 | 6 | Pod::Spec.new do |s| 7 | s.name = 'Flutter' 8 | s.version = '1.0.0' 9 | s.summary = 'High-performance, high-fidelity mobile apps.' 10 | s.homepage = 'https://flutter.io' 11 | s.license = { :type => 'MIT' } 12 | s.author = { 'Flutter Dev Team' => 'flutter-dev@googlegroups.com' } 13 | s.source = { :git => 'https://github.com/flutter/engine', :tag => s.version.to_s } 14 | s.ios.deployment_target = '8.0' 15 | # Framework linking is handled by Flutter tooling, not CocoaPods. 16 | # Add a placeholder to satisfy `s.dependency 'Flutter'` plugin podspecs. 17 | s.vendored_frameworks = 'path/to/nothing' 18 | end 19 | -------------------------------------------------------------------------------- /example/ios/Flutter/Release.xcconfig: -------------------------------------------------------------------------------- 1 | #include "Pods/Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig" 2 | #include "Generated.xcconfig" 3 | -------------------------------------------------------------------------------- /example/ios/Podfile: -------------------------------------------------------------------------------- 1 | # Uncomment this line to define a global platform for your project 2 | platform :ios, '9.0' 3 | 4 | # CocoaPods analytics sends network stats synchronously affecting flutter build latency. 5 | ENV['COCOAPODS_DISABLE_STATS'] = 'true' 6 | 7 | project 'Runner', { 8 | 'Debug' => :debug, 9 | 'Profile' => :release, 10 | 'Release' => :release, 11 | } 12 | 13 | def flutter_root 14 | generated_xcode_build_settings_path = File.expand_path(File.join('..', 'Flutter', 'Generated.xcconfig'), __FILE__) 15 | unless File.exist?(generated_xcode_build_settings_path) 16 | raise "#{generated_xcode_build_settings_path} must exist. If you're running pod install manually, make sure flutter pub get is executed first" 17 | end 18 | 19 | File.foreach(generated_xcode_build_settings_path) do |line| 20 | matches = line.match(/FLUTTER_ROOT\=(.*)/) 21 | return matches[1].strip if matches 22 | end 23 | raise "FLUTTER_ROOT not found in #{generated_xcode_build_settings_path}. Try deleting Generated.xcconfig, then run flutter pub get" 24 | end 25 | 26 | require File.expand_path(File.join('packages', 'flutter_tools', 'bin', 'podhelper'), flutter_root) 27 | 28 | flutter_ios_podfile_setup 29 | 30 | target 'Runner' do 31 | use_frameworks! 32 | use_modular_headers! 33 | 34 | flutter_install_all_ios_pods File.dirname(File.realpath(__FILE__)) 35 | end 36 | 37 | post_install do |installer| 38 | installer.pods_project.targets.each do |target| 39 | flutter_additional_ios_build_settings(target) 40 | end 41 | end 42 | -------------------------------------------------------------------------------- /example/ios/Runner.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 46; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | 1498D2341E8E89220040F4C2 /* GeneratedPluginRegistrant.m in Sources */ = {isa = PBXBuildFile; fileRef = 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */; }; 11 | 3B3967161E833CAA004F5970 /* AppFrameworkInfo.plist in Resources */ = {isa = PBXBuildFile; fileRef = 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */; }; 12 | 84FDDEBB9BBADAD8164AA15C /* Pods_Runner.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = E0A688444B97628794691EEF /* Pods_Runner.framework */; }; 13 | 978B8F6F1D3862AE00F588F7 /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 7AFFD8EE1D35381100E5BB4D /* AppDelegate.m */; }; 14 | 97C146F31CF9000F007C117D /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 97C146F21CF9000F007C117D /* main.m */; }; 15 | 97C146FC1CF9000F007C117D /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FA1CF9000F007C117D /* Main.storyboard */; }; 16 | 97C146FE1CF9000F007C117D /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FD1CF9000F007C117D /* Assets.xcassets */; }; 17 | 97C147011CF9000F007C117D /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */; }; 18 | /* End PBXBuildFile section */ 19 | 20 | /* Begin PBXCopyFilesBuildPhase section */ 21 | 9705A1C41CF9048500538489 /* Embed Frameworks */ = { 22 | isa = PBXCopyFilesBuildPhase; 23 | buildActionMask = 2147483647; 24 | dstPath = ""; 25 | dstSubfolderSpec = 10; 26 | files = ( 27 | ); 28 | name = "Embed Frameworks"; 29 | runOnlyForDeploymentPostprocessing = 0; 30 | }; 31 | /* End PBXCopyFilesBuildPhase section */ 32 | 33 | /* Begin PBXFileReference section */ 34 | 07029D33E422EE11C426D7C7 /* Pods-Runner.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.debug.xcconfig"; path = "Pods/Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig"; sourceTree = ""; }; 35 | 1498D2321E8E86230040F4C2 /* GeneratedPluginRegistrant.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = GeneratedPluginRegistrant.h; sourceTree = ""; }; 36 | 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GeneratedPluginRegistrant.m; sourceTree = ""; }; 37 | 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = AppFrameworkInfo.plist; path = Flutter/AppFrameworkInfo.plist; sourceTree = ""; }; 38 | 7AFA3C8E1D35360C0083082E /* Release.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; name = Release.xcconfig; path = Flutter/Release.xcconfig; sourceTree = ""; }; 39 | 7AFFD8ED1D35381100E5BB4D /* AppDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = ""; }; 40 | 7AFFD8EE1D35381100E5BB4D /* AppDelegate.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = AppDelegate.m; sourceTree = ""; }; 41 | 817ED98B236B2F6900BBAFE4 /* Runner-Bridging-Header.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "Runner-Bridging-Header.h"; sourceTree = ""; }; 42 | 9740EEB21CF90195004384FC /* Debug.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = Debug.xcconfig; path = Flutter/Debug.xcconfig; sourceTree = ""; }; 43 | 9740EEB31CF90195004384FC /* Generated.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = Generated.xcconfig; path = Flutter/Generated.xcconfig; sourceTree = ""; }; 44 | 97C146EE1CF9000F007C117D /* Runner.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Runner.app; sourceTree = BUILT_PRODUCTS_DIR; }; 45 | 97C146F21CF9000F007C117D /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = ""; }; 46 | 97C146FB1CF9000F007C117D /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; 47 | 97C146FD1CF9000F007C117D /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; 48 | 97C147001CF9000F007C117D /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; }; 49 | 97C147021CF9000F007C117D /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 50 | CD456C76FAC541BD38BB2841 /* Pods-Runner.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.release.xcconfig"; path = "Pods/Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig"; sourceTree = ""; }; 51 | E0A688444B97628794691EEF /* Pods_Runner.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_Runner.framework; sourceTree = BUILT_PRODUCTS_DIR; }; 52 | /* End PBXFileReference section */ 53 | 54 | /* Begin PBXFrameworksBuildPhase section */ 55 | 97C146EB1CF9000F007C117D /* Frameworks */ = { 56 | isa = PBXFrameworksBuildPhase; 57 | buildActionMask = 2147483647; 58 | files = ( 59 | 84FDDEBB9BBADAD8164AA15C /* Pods_Runner.framework in Frameworks */, 60 | ); 61 | runOnlyForDeploymentPostprocessing = 0; 62 | }; 63 | /* End PBXFrameworksBuildPhase section */ 64 | 65 | /* Begin PBXGroup section */ 66 | 1929A27D658C0F8DBB7285DC /* Frameworks */ = { 67 | isa = PBXGroup; 68 | children = ( 69 | E0A688444B97628794691EEF /* Pods_Runner.framework */, 70 | ); 71 | name = Frameworks; 72 | sourceTree = ""; 73 | }; 74 | 9740EEB11CF90186004384FC /* Flutter */ = { 75 | isa = PBXGroup; 76 | children = ( 77 | 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */, 78 | 9740EEB21CF90195004384FC /* Debug.xcconfig */, 79 | 7AFA3C8E1D35360C0083082E /* Release.xcconfig */, 80 | 9740EEB31CF90195004384FC /* Generated.xcconfig */, 81 | ); 82 | name = Flutter; 83 | sourceTree = ""; 84 | }; 85 | 97C146E51CF9000F007C117D = { 86 | isa = PBXGroup; 87 | children = ( 88 | 9740EEB11CF90186004384FC /* Flutter */, 89 | 97C146F01CF9000F007C117D /* Runner */, 90 | 97C146EF1CF9000F007C117D /* Products */, 91 | A73596DA6A4E5A47E033894D /* Pods */, 92 | 1929A27D658C0F8DBB7285DC /* Frameworks */, 93 | ); 94 | sourceTree = ""; 95 | }; 96 | 97C146EF1CF9000F007C117D /* Products */ = { 97 | isa = PBXGroup; 98 | children = ( 99 | 97C146EE1CF9000F007C117D /* Runner.app */, 100 | ); 101 | name = Products; 102 | sourceTree = ""; 103 | }; 104 | 97C146F01CF9000F007C117D /* Runner */ = { 105 | isa = PBXGroup; 106 | children = ( 107 | 7AFFD8ED1D35381100E5BB4D /* AppDelegate.h */, 108 | 7AFFD8EE1D35381100E5BB4D /* AppDelegate.m */, 109 | 97C146FA1CF9000F007C117D /* Main.storyboard */, 110 | 97C146FD1CF9000F007C117D /* Assets.xcassets */, 111 | 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */, 112 | 97C147021CF9000F007C117D /* Info.plist */, 113 | 97C146F11CF9000F007C117D /* Supporting Files */, 114 | 1498D2321E8E86230040F4C2 /* GeneratedPluginRegistrant.h */, 115 | 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */, 116 | 817ED98B236B2F6900BBAFE4 /* Runner-Bridging-Header.h */, 117 | ); 118 | path = Runner; 119 | sourceTree = ""; 120 | }; 121 | 97C146F11CF9000F007C117D /* Supporting Files */ = { 122 | isa = PBXGroup; 123 | children = ( 124 | 97C146F21CF9000F007C117D /* main.m */, 125 | ); 126 | name = "Supporting Files"; 127 | sourceTree = ""; 128 | }; 129 | A73596DA6A4E5A47E033894D /* Pods */ = { 130 | isa = PBXGroup; 131 | children = ( 132 | 07029D33E422EE11C426D7C7 /* Pods-Runner.debug.xcconfig */, 133 | CD456C76FAC541BD38BB2841 /* Pods-Runner.release.xcconfig */, 134 | ); 135 | name = Pods; 136 | sourceTree = ""; 137 | }; 138 | /* End PBXGroup section */ 139 | 140 | /* Begin PBXNativeTarget section */ 141 | 97C146ED1CF9000F007C117D /* Runner */ = { 142 | isa = PBXNativeTarget; 143 | buildConfigurationList = 97C147051CF9000F007C117D /* Build configuration list for PBXNativeTarget "Runner" */; 144 | buildPhases = ( 145 | 41B0890A4A82A6143DF13DD5 /* [CP] Check Pods Manifest.lock */, 146 | 9740EEB61CF901F6004384FC /* Run Script */, 147 | 97C146EA1CF9000F007C117D /* Sources */, 148 | 97C146EB1CF9000F007C117D /* Frameworks */, 149 | 97C146EC1CF9000F007C117D /* Resources */, 150 | 9705A1C41CF9048500538489 /* Embed Frameworks */, 151 | 3B06AD1E1E4923F5004D2608 /* Thin Binary */, 152 | E909F93B03931C31C89F1BEB /* [CP] Embed Pods Frameworks */, 153 | ); 154 | buildRules = ( 155 | ); 156 | dependencies = ( 157 | ); 158 | name = Runner; 159 | productName = Runner; 160 | productReference = 97C146EE1CF9000F007C117D /* Runner.app */; 161 | productType = "com.apple.product-type.application"; 162 | }; 163 | /* End PBXNativeTarget section */ 164 | 165 | /* Begin PBXProject section */ 166 | 97C146E61CF9000F007C117D /* Project object */ = { 167 | isa = PBXProject; 168 | attributes = { 169 | LastUpgradeCheck = 1010; 170 | ORGANIZATIONNAME = "The Chromium Authors"; 171 | TargetAttributes = { 172 | 97C146ED1CF9000F007C117D = { 173 | CreatedOnToolsVersion = 7.3.1; 174 | DevelopmentTeam = 67JZ7MB7A8; 175 | LastSwiftMigration = 1100; 176 | }; 177 | }; 178 | }; 179 | buildConfigurationList = 97C146E91CF9000F007C117D /* Build configuration list for PBXProject "Runner" */; 180 | compatibilityVersion = "Xcode 3.2"; 181 | developmentRegion = English; 182 | hasScannedForEncodings = 0; 183 | knownRegions = ( 184 | English, 185 | en, 186 | Base, 187 | ); 188 | mainGroup = 97C146E51CF9000F007C117D; 189 | productRefGroup = 97C146EF1CF9000F007C117D /* Products */; 190 | projectDirPath = ""; 191 | projectRoot = ""; 192 | targets = ( 193 | 97C146ED1CF9000F007C117D /* Runner */, 194 | ); 195 | }; 196 | /* End PBXProject section */ 197 | 198 | /* Begin PBXResourcesBuildPhase section */ 199 | 97C146EC1CF9000F007C117D /* Resources */ = { 200 | isa = PBXResourcesBuildPhase; 201 | buildActionMask = 2147483647; 202 | files = ( 203 | 97C147011CF9000F007C117D /* LaunchScreen.storyboard in Resources */, 204 | 3B3967161E833CAA004F5970 /* AppFrameworkInfo.plist in Resources */, 205 | 97C146FE1CF9000F007C117D /* Assets.xcassets in Resources */, 206 | 97C146FC1CF9000F007C117D /* Main.storyboard in Resources */, 207 | ); 208 | runOnlyForDeploymentPostprocessing = 0; 209 | }; 210 | /* End PBXResourcesBuildPhase section */ 211 | 212 | /* Begin PBXShellScriptBuildPhase section */ 213 | 3B06AD1E1E4923F5004D2608 /* Thin Binary */ = { 214 | isa = PBXShellScriptBuildPhase; 215 | buildActionMask = 2147483647; 216 | files = ( 217 | ); 218 | inputPaths = ( 219 | ); 220 | name = "Thin Binary"; 221 | outputPaths = ( 222 | ); 223 | runOnlyForDeploymentPostprocessing = 0; 224 | shellPath = /bin/sh; 225 | shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" embed_and_thin"; 226 | }; 227 | 41B0890A4A82A6143DF13DD5 /* [CP] Check Pods Manifest.lock */ = { 228 | isa = PBXShellScriptBuildPhase; 229 | buildActionMask = 2147483647; 230 | files = ( 231 | ); 232 | inputPaths = ( 233 | "${PODS_PODFILE_DIR_PATH}/Podfile.lock", 234 | "${PODS_ROOT}/Manifest.lock", 235 | ); 236 | name = "[CP] Check Pods Manifest.lock"; 237 | outputPaths = ( 238 | "$(DERIVED_FILE_DIR)/Pods-Runner-checkManifestLockResult.txt", 239 | ); 240 | runOnlyForDeploymentPostprocessing = 0; 241 | shellPath = /bin/sh; 242 | shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n"; 243 | showEnvVarsInLog = 0; 244 | }; 245 | 9740EEB61CF901F6004384FC /* Run Script */ = { 246 | isa = PBXShellScriptBuildPhase; 247 | buildActionMask = 2147483647; 248 | files = ( 249 | ); 250 | inputPaths = ( 251 | ); 252 | name = "Run Script"; 253 | outputPaths = ( 254 | ); 255 | runOnlyForDeploymentPostprocessing = 0; 256 | shellPath = /bin/sh; 257 | shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" build"; 258 | }; 259 | E909F93B03931C31C89F1BEB /* [CP] Embed Pods Frameworks */ = { 260 | isa = PBXShellScriptBuildPhase; 261 | buildActionMask = 2147483647; 262 | files = ( 263 | ); 264 | inputPaths = ( 265 | "${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks.sh", 266 | "${BUILT_PRODUCTS_DIR}/BSGridCollectionViewLayout/BSGridCollectionViewLayout.framework", 267 | "${BUILT_PRODUCTS_DIR}/BSImagePicker/BSImagePicker.framework", 268 | "${BUILT_PRODUCTS_DIR}/BSImageView/BSImageView.framework", 269 | "${BUILT_PRODUCTS_DIR}/image_picker/image_picker.framework", 270 | "${BUILT_PRODUCTS_DIR}/multi_image_picker/multi_image_picker.framework", 271 | "${BUILT_PRODUCTS_DIR}/path_provider/path_provider.framework", 272 | "${BUILT_PRODUCTS_DIR}/share_extend/share_extend.framework", 273 | ); 274 | name = "[CP] Embed Pods Frameworks"; 275 | outputPaths = ( 276 | "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/BSGridCollectionViewLayout.framework", 277 | "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/BSImagePicker.framework", 278 | "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/BSImageView.framework", 279 | "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/image_picker.framework", 280 | "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/multi_image_picker.framework", 281 | "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/path_provider.framework", 282 | "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/share_extend.framework", 283 | ); 284 | runOnlyForDeploymentPostprocessing = 0; 285 | shellPath = /bin/sh; 286 | shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks.sh\"\n"; 287 | showEnvVarsInLog = 0; 288 | }; 289 | /* End PBXShellScriptBuildPhase section */ 290 | 291 | /* Begin PBXSourcesBuildPhase section */ 292 | 97C146EA1CF9000F007C117D /* Sources */ = { 293 | isa = PBXSourcesBuildPhase; 294 | buildActionMask = 2147483647; 295 | files = ( 296 | 978B8F6F1D3862AE00F588F7 /* AppDelegate.m in Sources */, 297 | 97C146F31CF9000F007C117D /* main.m in Sources */, 298 | 1498D2341E8E89220040F4C2 /* GeneratedPluginRegistrant.m in Sources */, 299 | ); 300 | runOnlyForDeploymentPostprocessing = 0; 301 | }; 302 | /* End PBXSourcesBuildPhase section */ 303 | 304 | /* Begin PBXVariantGroup section */ 305 | 97C146FA1CF9000F007C117D /* Main.storyboard */ = { 306 | isa = PBXVariantGroup; 307 | children = ( 308 | 97C146FB1CF9000F007C117D /* Base */, 309 | ); 310 | name = Main.storyboard; 311 | sourceTree = ""; 312 | }; 313 | 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */ = { 314 | isa = PBXVariantGroup; 315 | children = ( 316 | 97C147001CF9000F007C117D /* Base */, 317 | ); 318 | name = LaunchScreen.storyboard; 319 | sourceTree = ""; 320 | }; 321 | /* End PBXVariantGroup section */ 322 | 323 | /* Begin XCBuildConfiguration section */ 324 | 97C147031CF9000F007C117D /* Debug */ = { 325 | isa = XCBuildConfiguration; 326 | buildSettings = { 327 | ALWAYS_SEARCH_USER_PATHS = NO; 328 | CLANG_ANALYZER_NONNULL = YES; 329 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 330 | CLANG_CXX_LIBRARY = "libc++"; 331 | CLANG_ENABLE_MODULES = YES; 332 | CLANG_ENABLE_OBJC_ARC = YES; 333 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 334 | CLANG_WARN_BOOL_CONVERSION = YES; 335 | CLANG_WARN_COMMA = YES; 336 | CLANG_WARN_CONSTANT_CONVERSION = YES; 337 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; 338 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 339 | CLANG_WARN_EMPTY_BODY = YES; 340 | CLANG_WARN_ENUM_CONVERSION = YES; 341 | CLANG_WARN_INFINITE_RECURSION = YES; 342 | CLANG_WARN_INT_CONVERSION = YES; 343 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 344 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; 345 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 346 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 347 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 348 | CLANG_WARN_STRICT_PROTOTYPES = YES; 349 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 350 | CLANG_WARN_UNREACHABLE_CODE = YES; 351 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 352 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 353 | COPY_PHASE_STRIP = NO; 354 | DEBUG_INFORMATION_FORMAT = dwarf; 355 | ENABLE_STRICT_OBJC_MSGSEND = YES; 356 | ENABLE_TESTABILITY = YES; 357 | GCC_C_LANGUAGE_STANDARD = gnu99; 358 | GCC_DYNAMIC_NO_PIC = NO; 359 | GCC_NO_COMMON_BLOCKS = YES; 360 | GCC_OPTIMIZATION_LEVEL = 0; 361 | GCC_PREPROCESSOR_DEFINITIONS = ( 362 | "DEBUG=1", 363 | "$(inherited)", 364 | ); 365 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 366 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 367 | GCC_WARN_UNDECLARED_SELECTOR = YES; 368 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 369 | GCC_WARN_UNUSED_FUNCTION = YES; 370 | GCC_WARN_UNUSED_VARIABLE = YES; 371 | IPHONEOS_DEPLOYMENT_TARGET = 8.0; 372 | MTL_ENABLE_DEBUG_INFO = YES; 373 | ONLY_ACTIVE_ARCH = YES; 374 | SDKROOT = iphoneos; 375 | TARGETED_DEVICE_FAMILY = "1,2"; 376 | }; 377 | name = Debug; 378 | }; 379 | 97C147041CF9000F007C117D /* Release */ = { 380 | isa = XCBuildConfiguration; 381 | buildSettings = { 382 | ALWAYS_SEARCH_USER_PATHS = NO; 383 | CLANG_ANALYZER_NONNULL = YES; 384 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 385 | CLANG_CXX_LIBRARY = "libc++"; 386 | CLANG_ENABLE_MODULES = YES; 387 | CLANG_ENABLE_OBJC_ARC = YES; 388 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 389 | CLANG_WARN_BOOL_CONVERSION = YES; 390 | CLANG_WARN_COMMA = YES; 391 | CLANG_WARN_CONSTANT_CONVERSION = YES; 392 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; 393 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 394 | CLANG_WARN_EMPTY_BODY = YES; 395 | CLANG_WARN_ENUM_CONVERSION = YES; 396 | CLANG_WARN_INFINITE_RECURSION = YES; 397 | CLANG_WARN_INT_CONVERSION = YES; 398 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 399 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; 400 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 401 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 402 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 403 | CLANG_WARN_STRICT_PROTOTYPES = YES; 404 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 405 | CLANG_WARN_UNREACHABLE_CODE = YES; 406 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 407 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 408 | COPY_PHASE_STRIP = NO; 409 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 410 | ENABLE_NS_ASSERTIONS = NO; 411 | ENABLE_STRICT_OBJC_MSGSEND = YES; 412 | GCC_C_LANGUAGE_STANDARD = gnu99; 413 | GCC_NO_COMMON_BLOCKS = YES; 414 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 415 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 416 | GCC_WARN_UNDECLARED_SELECTOR = YES; 417 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 418 | GCC_WARN_UNUSED_FUNCTION = YES; 419 | GCC_WARN_UNUSED_VARIABLE = YES; 420 | IPHONEOS_DEPLOYMENT_TARGET = 8.0; 421 | MTL_ENABLE_DEBUG_INFO = NO; 422 | SDKROOT = iphoneos; 423 | TARGETED_DEVICE_FAMILY = "1,2"; 424 | VALIDATE_PRODUCT = YES; 425 | }; 426 | name = Release; 427 | }; 428 | 97C147061CF9000F007C117D /* Debug */ = { 429 | isa = XCBuildConfiguration; 430 | baseConfigurationReference = 9740EEB21CF90195004384FC /* Debug.xcconfig */; 431 | buildSettings = { 432 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 433 | CLANG_ENABLE_MODULES = YES; 434 | CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)"; 435 | DEVELOPMENT_TEAM = 67JZ7MB7A8; 436 | ENABLE_BITCODE = NO; 437 | FRAMEWORK_SEARCH_PATHS = ( 438 | "$(inherited)", 439 | "$(PROJECT_DIR)/Flutter", 440 | ); 441 | INFOPLIST_FILE = Runner/Info.plist; 442 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 443 | LIBRARY_SEARCH_PATHS = ( 444 | "$(inherited)", 445 | "$(PROJECT_DIR)/Flutter", 446 | ); 447 | PRODUCT_BUNDLE_IDENTIFIER = com.zt.shareExtendExample; 448 | PRODUCT_NAME = "$(TARGET_NAME)"; 449 | SWIFT_OBJC_BRIDGING_HEADER = "Runner-Bridging-Header.h"; 450 | SWIFT_OPTIMIZATION_LEVEL = "-Onone"; 451 | SWIFT_VERSION = 5.0; 452 | VERSIONING_SYSTEM = "apple-generic"; 453 | }; 454 | name = Debug; 455 | }; 456 | 97C147071CF9000F007C117D /* Release */ = { 457 | isa = XCBuildConfiguration; 458 | baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */; 459 | buildSettings = { 460 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 461 | CLANG_ENABLE_MODULES = YES; 462 | CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)"; 463 | DEVELOPMENT_TEAM = 67JZ7MB7A8; 464 | ENABLE_BITCODE = NO; 465 | FRAMEWORK_SEARCH_PATHS = ( 466 | "$(inherited)", 467 | "$(PROJECT_DIR)/Flutter", 468 | ); 469 | INFOPLIST_FILE = Runner/Info.plist; 470 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 471 | LIBRARY_SEARCH_PATHS = ( 472 | "$(inherited)", 473 | "$(PROJECT_DIR)/Flutter", 474 | ); 475 | PRODUCT_BUNDLE_IDENTIFIER = com.zt.shareExtendExample; 476 | PRODUCT_NAME = "$(TARGET_NAME)"; 477 | SWIFT_OBJC_BRIDGING_HEADER = "Runner-Bridging-Header.h"; 478 | SWIFT_VERSION = 5.0; 479 | VERSIONING_SYSTEM = "apple-generic"; 480 | }; 481 | name = Release; 482 | }; 483 | /* End XCBuildConfiguration section */ 484 | 485 | /* Begin XCConfigurationList section */ 486 | 97C146E91CF9000F007C117D /* Build configuration list for PBXProject "Runner" */ = { 487 | isa = XCConfigurationList; 488 | buildConfigurations = ( 489 | 97C147031CF9000F007C117D /* Debug */, 490 | 97C147041CF9000F007C117D /* Release */, 491 | ); 492 | defaultConfigurationIsVisible = 0; 493 | defaultConfigurationName = Release; 494 | }; 495 | 97C147051CF9000F007C117D /* Build configuration list for PBXNativeTarget "Runner" */ = { 496 | isa = XCConfigurationList; 497 | buildConfigurations = ( 498 | 97C147061CF9000F007C117D /* Debug */, 499 | 97C147071CF9000F007C117D /* Release */, 500 | ); 501 | defaultConfigurationIsVisible = 0; 502 | defaultConfigurationName = Release; 503 | }; 504 | /* End XCConfigurationList section */ 505 | }; 506 | rootObject = 97C146E61CF9000F007C117D /* Project object */; 507 | } 508 | -------------------------------------------------------------------------------- /example/ios/Runner.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /example/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 24 | 25 | 30 | 31 | 32 | 33 | 39 | 40 | 41 | 42 | 43 | 44 | 54 | 56 | 62 | 63 | 64 | 65 | 66 | 67 | 73 | 75 | 81 | 82 | 83 | 84 | 86 | 87 | 90 | 91 | 92 | -------------------------------------------------------------------------------- /example/ios/Runner.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /example/ios/Runner.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /example/ios/Runner/AppDelegate.h: -------------------------------------------------------------------------------- 1 | #import 2 | #import 3 | 4 | @interface AppDelegate : FlutterAppDelegate 5 | 6 | @end 7 | -------------------------------------------------------------------------------- /example/ios/Runner/AppDelegate.m: -------------------------------------------------------------------------------- 1 | #include "AppDelegate.h" 2 | #include "GeneratedPluginRegistrant.h" 3 | 4 | @implementation AppDelegate 5 | 6 | - (BOOL)application:(UIApplication *)application 7 | didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { 8 | [GeneratedPluginRegistrant registerWithRegistry:self]; 9 | // Override point for customization after application launch. 10 | return [super application:application didFinishLaunchingWithOptions:launchOptions]; 11 | } 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "size" : "20x20", 5 | "idiom" : "iphone", 6 | "filename" : "Icon-App-20x20@2x.png", 7 | "scale" : "2x" 8 | }, 9 | { 10 | "size" : "20x20", 11 | "idiom" : "iphone", 12 | "filename" : "Icon-App-20x20@3x.png", 13 | "scale" : "3x" 14 | }, 15 | { 16 | "size" : "29x29", 17 | "idiom" : "iphone", 18 | "filename" : "Icon-App-29x29@1x.png", 19 | "scale" : "1x" 20 | }, 21 | { 22 | "size" : "29x29", 23 | "idiom" : "iphone", 24 | "filename" : "Icon-App-29x29@2x.png", 25 | "scale" : "2x" 26 | }, 27 | { 28 | "size" : "29x29", 29 | "idiom" : "iphone", 30 | "filename" : "Icon-App-29x29@3x.png", 31 | "scale" : "3x" 32 | }, 33 | { 34 | "size" : "40x40", 35 | "idiom" : "iphone", 36 | "filename" : "Icon-App-40x40@2x.png", 37 | "scale" : "2x" 38 | }, 39 | { 40 | "size" : "40x40", 41 | "idiom" : "iphone", 42 | "filename" : "Icon-App-40x40@3x.png", 43 | "scale" : "3x" 44 | }, 45 | { 46 | "size" : "60x60", 47 | "idiom" : "iphone", 48 | "filename" : "Icon-App-60x60@2x.png", 49 | "scale" : "2x" 50 | }, 51 | { 52 | "size" : "60x60", 53 | "idiom" : "iphone", 54 | "filename" : "Icon-App-60x60@3x.png", 55 | "scale" : "3x" 56 | }, 57 | { 58 | "size" : "20x20", 59 | "idiom" : "ipad", 60 | "filename" : "Icon-App-20x20@1x.png", 61 | "scale" : "1x" 62 | }, 63 | { 64 | "size" : "20x20", 65 | "idiom" : "ipad", 66 | "filename" : "Icon-App-20x20@2x.png", 67 | "scale" : "2x" 68 | }, 69 | { 70 | "size" : "29x29", 71 | "idiom" : "ipad", 72 | "filename" : "Icon-App-29x29@1x.png", 73 | "scale" : "1x" 74 | }, 75 | { 76 | "size" : "29x29", 77 | "idiom" : "ipad", 78 | "filename" : "Icon-App-29x29@2x.png", 79 | "scale" : "2x" 80 | }, 81 | { 82 | "size" : "40x40", 83 | "idiom" : "ipad", 84 | "filename" : "Icon-App-40x40@1x.png", 85 | "scale" : "1x" 86 | }, 87 | { 88 | "size" : "40x40", 89 | "idiom" : "ipad", 90 | "filename" : "Icon-App-40x40@2x.png", 91 | "scale" : "2x" 92 | }, 93 | { 94 | "size" : "76x76", 95 | "idiom" : "ipad", 96 | "filename" : "Icon-App-76x76@1x.png", 97 | "scale" : "1x" 98 | }, 99 | { 100 | "size" : "76x76", 101 | "idiom" : "ipad", 102 | "filename" : "Icon-App-76x76@2x.png", 103 | "scale" : "2x" 104 | }, 105 | { 106 | "size" : "83.5x83.5", 107 | "idiom" : "ipad", 108 | "filename" : "Icon-App-83.5x83.5@2x.png", 109 | "scale" : "2x" 110 | }, 111 | { 112 | "size" : "1024x1024", 113 | "idiom" : "ios-marketing", 114 | "filename" : "Icon-App-1024x1024@1x.png", 115 | "scale" : "1x" 116 | } 117 | ], 118 | "info" : { 119 | "version" : 1, 120 | "author" : "xcode" 121 | } 122 | } 123 | -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-1024x1024@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhouteng0217/ShareExtend/9169405eaceb37159063d37c392bcd9270785b2b/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-1024x1024@1x.png -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhouteng0217/ShareExtend/9169405eaceb37159063d37c392bcd9270785b2b/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@1x.png -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhouteng0217/ShareExtend/9169405eaceb37159063d37c392bcd9270785b2b/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@2x.png -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhouteng0217/ShareExtend/9169405eaceb37159063d37c392bcd9270785b2b/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@3x.png -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhouteng0217/ShareExtend/9169405eaceb37159063d37c392bcd9270785b2b/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@1x.png -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhouteng0217/ShareExtend/9169405eaceb37159063d37c392bcd9270785b2b/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@2x.png -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhouteng0217/ShareExtend/9169405eaceb37159063d37c392bcd9270785b2b/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@3x.png -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhouteng0217/ShareExtend/9169405eaceb37159063d37c392bcd9270785b2b/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@1x.png -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhouteng0217/ShareExtend/9169405eaceb37159063d37c392bcd9270785b2b/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@2x.png -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhouteng0217/ShareExtend/9169405eaceb37159063d37c392bcd9270785b2b/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@3x.png -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhouteng0217/ShareExtend/9169405eaceb37159063d37c392bcd9270785b2b/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@2x.png -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhouteng0217/ShareExtend/9169405eaceb37159063d37c392bcd9270785b2b/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@3x.png -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhouteng0217/ShareExtend/9169405eaceb37159063d37c392bcd9270785b2b/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@1x.png -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhouteng0217/ShareExtend/9169405eaceb37159063d37c392bcd9270785b2b/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@2x.png -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-83.5x83.5@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhouteng0217/ShareExtend/9169405eaceb37159063d37c392bcd9270785b2b/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-83.5x83.5@2x.png -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/LaunchImage.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "filename" : "LaunchImage.png", 6 | "scale" : "1x" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "filename" : "LaunchImage@2x.png", 11 | "scale" : "2x" 12 | }, 13 | { 14 | "idiom" : "universal", 15 | "filename" : "LaunchImage@3x.png", 16 | "scale" : "3x" 17 | } 18 | ], 19 | "info" : { 20 | "version" : 1, 21 | "author" : "xcode" 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhouteng0217/ShareExtend/9169405eaceb37159063d37c392bcd9270785b2b/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhouteng0217/ShareExtend/9169405eaceb37159063d37c392bcd9270785b2b/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhouteng0217/ShareExtend/9169405eaceb37159063d37c392bcd9270785b2b/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/LaunchImage.imageset/README.md: -------------------------------------------------------------------------------- 1 | # Launch Screen Assets 2 | 3 | You can customize the launch screen with your own desired assets by replacing the image files in this directory. 4 | 5 | You can also do it by opening your Flutter project's Xcode project with `open ios/Runner.xcworkspace`, selecting `Runner/Assets.xcassets` in the Project Navigator and dropping in the desired images. -------------------------------------------------------------------------------- /example/ios/Runner/Base.lproj/LaunchScreen.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | -------------------------------------------------------------------------------- /example/ios/Runner/Base.lproj/Main.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /example/ios/Runner/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | share_extend_example 15 | CFBundlePackageType 16 | APPL 17 | CFBundleShortVersionString 18 | $(FLUTTER_BUILD_NAME) 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | $(FLUTTER_BUILD_NUMBER) 23 | LSRequiresIPhoneOS 24 | 25 | UILaunchStoryboardName 26 | LaunchScreen 27 | UIMainStoryboardFile 28 | Main 29 | UISupportedInterfaceOrientations 30 | 31 | UIInterfaceOrientationPortrait 32 | UIInterfaceOrientationLandscapeLeft 33 | UIInterfaceOrientationLandscapeRight 34 | 35 | UISupportedInterfaceOrientations~ipad 36 | 37 | UIInterfaceOrientationPortrait 38 | UIInterfaceOrientationPortraitUpsideDown 39 | UIInterfaceOrientationLandscapeLeft 40 | UIInterfaceOrientationLandscapeRight 41 | 42 | UIViewControllerBasedStatusBarAppearance 43 | 44 | NSPhotoLibraryAddUsageDescription 45 | App needs photo library permission for saving images 46 | NSPhotoLibraryUsageDescription 47 | Used to demonstrate image picker plugin 48 | 49 | 50 | -------------------------------------------------------------------------------- /example/ios/Runner/Runner-Bridging-Header.h: -------------------------------------------------------------------------------- 1 | #import "GeneratedPluginRegistrant.h" 2 | -------------------------------------------------------------------------------- /example/ios/Runner/main.m: -------------------------------------------------------------------------------- 1 | #import 2 | #import 3 | #import "AppDelegate.h" 4 | 5 | int main(int argc, char* argv[]) { 6 | @autoreleasepool { 7 | return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class])); 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /example/lib/main.dart: -------------------------------------------------------------------------------- 1 | import 'dart:async'; 2 | import 'dart:io'; 3 | 4 | import 'package:flutter/material.dart'; 5 | import 'package:flutter/services.dart'; 6 | import 'package:multi_image_picker/multi_image_picker.dart'; 7 | 8 | import 'package:share_extend/share_extend.dart'; 9 | import 'package:image_picker/image_picker.dart'; 10 | import 'package:path_provider/path_provider.dart'; 11 | 12 | void main() => runApp(MyApp()); 13 | 14 | class MyApp extends StatefulWidget { 15 | @override 16 | _MyAppState createState() => _MyAppState(); 17 | } 18 | 19 | class _MyAppState extends State { 20 | final _picker = ImagePicker(); 21 | 22 | @override 23 | void initState() { 24 | super.initState(); 25 | } 26 | 27 | @override 28 | Widget build(BuildContext context) { 29 | return MaterialApp( 30 | home: Scaffold( 31 | appBar: AppBar( 32 | title: const Text('Plugin example app'), 33 | ), 34 | body: Container( 35 | child: Center( 36 | child: Column( 37 | children: [ 38 | ElevatedButton( 39 | style: ButtonStyle( 40 | backgroundColor: 41 | MaterialStateProperty.all(Colors.white70), 42 | foregroundColor: MaterialStateProperty.all(Colors.black)), 43 | onPressed: () { 44 | ShareExtend.share("share text", "text", 45 | sharePanelTitle: "share text title", 46 | subject: "share text subject"); 47 | }, 48 | child: Text("share text"), 49 | ), 50 | ElevatedButton( 51 | style: ButtonStyle( 52 | backgroundColor: 53 | MaterialStateProperty.all(Colors.white70), 54 | foregroundColor: MaterialStateProperty.all(Colors.black)), 55 | onPressed: () async { 56 | final res = 57 | await _picker.getImage(source: ImageSource.gallery); 58 | if (res.path != null) { 59 | ShareExtend.share(res.path, "image", 60 | sharePanelTitle: "share image title", 61 | subject: "share image subject"); 62 | } 63 | }, 64 | child: Text("share image"), 65 | ), 66 | ElevatedButton( 67 | style: ButtonStyle( 68 | backgroundColor: 69 | MaterialStateProperty.all(Colors.white70), 70 | foregroundColor: MaterialStateProperty.all(Colors.black)), 71 | onPressed: () async { 72 | final res = 73 | await _picker.getVideo(source: ImageSource.gallery); 74 | if (res.path != null) { 75 | ShareExtend.share(res.path, "video"); 76 | } 77 | }, 78 | child: Text("share video"), 79 | ), 80 | ElevatedButton( 81 | style: ButtonStyle( 82 | backgroundColor: 83 | MaterialStateProperty.all(Colors.white70), 84 | foregroundColor: MaterialStateProperty.all(Colors.black)), 85 | onPressed: () { 86 | _shareStorageFile(); 87 | }, 88 | child: Text("share file"), 89 | ), 90 | ElevatedButton( 91 | style: ButtonStyle( 92 | backgroundColor: 93 | MaterialStateProperty.all(Colors.white70), 94 | foregroundColor: MaterialStateProperty.all(Colors.black)), 95 | onPressed: () { 96 | _shareMultipleImages(); 97 | }, 98 | child: Text("share multiple images"), 99 | ), 100 | ], 101 | ), 102 | ), 103 | ), 104 | ), 105 | ); 106 | } 107 | 108 | ///share multiple images 109 | _shareMultipleImages() async { 110 | List assetList = await MultiImagePicker.pickImages(maxImages: 5); 111 | var imageList = []; 112 | for (var asset in assetList) { 113 | String path = 114 | await _writeByteToImageFile(await asset.getByteData(quality: 30)); 115 | imageList.add(path); 116 | } 117 | ShareExtend.shareMultiple(imageList, "image", subject: "share multi image"); 118 | } 119 | 120 | Future _writeByteToImageFile(ByteData byteData) async { 121 | Directory dir = Platform.isAndroid 122 | ? await getExternalStorageDirectory() 123 | : await getApplicationDocumentsDirectory(); 124 | File imageFile = new File( 125 | "${dir.path}/flutter/${DateTime.now().millisecondsSinceEpoch}.png"); 126 | imageFile.createSync(recursive: true); 127 | imageFile.writeAsBytesSync(byteData.buffer.asUint8List(0)); 128 | return imageFile.path; 129 | } 130 | 131 | ///share the storage file 132 | _shareStorageFile() async { 133 | Directory dir = Platform.isAndroid 134 | ? await getExternalStorageDirectory() 135 | : await getApplicationDocumentsDirectory(); 136 | File testFile = File("${dir.path}/flutter/test.txt"); 137 | if (!await testFile.exists()) { 138 | await testFile.create(recursive: true); 139 | testFile.writeAsStringSync("test for share documents file"); 140 | } 141 | ShareExtend.share(testFile.path, "file"); 142 | } 143 | } 144 | -------------------------------------------------------------------------------- /example/pubspec.yaml: -------------------------------------------------------------------------------- 1 | name: share_extend_example 2 | description: Demonstrates how to use the share_extend plugin. 3 | 4 | # The following defines the version and build number for your application. 5 | # A version number is three numbers separated by dots, like 1.2.43 6 | # followed by an optional build number separated by a +. 7 | # Both the version and the builder number may be overridden in flutter 8 | # build by specifying --build-name and --build-number, respectively. 9 | # Read more about versioning at semver.org. 10 | version: 1.0.0+1 11 | 12 | environment: 13 | sdk: ">=2.0.0 <3.0.0" 14 | 15 | dependencies: 16 | flutter: 17 | sdk: flutter 18 | 19 | # The following adds the Cupertino Icons font to your application. 20 | # Use with the CupertinoIcons class for iOS style icons. 21 | cupertino_icons: ^1.0.2 22 | path_provider: ^2.0.1 23 | multi_image_picker: ^4.8.00 24 | image_picker: ^0.7.4 25 | # image_picker: 26 | # git: 27 | # url: git@github.com:miguelpruivo/plugins.git 28 | # path: packages/image_picker 29 | # ref: image_picker-Fix-#41046 30 | 31 | dev_dependencies: 32 | flutter_test: 33 | sdk: flutter 34 | 35 | share_extend: 36 | path: ../ 37 | 38 | 39 | 40 | # For information on the generic Dart part of this file, see the 41 | # following page: https://www.dartlang.org/tools/pub/pubspec 42 | 43 | # The following section is specific to Flutter. 44 | flutter: 45 | 46 | # The following line ensures that the Material Icons font is 47 | # included with your application, so that you can use the icons in 48 | # the material Icons class. 49 | uses-material-design: true 50 | 51 | # To add assets to your application, add an assets section, like this: 52 | # assets: 53 | # - images/a_dot_burr.jpeg 54 | # - images/a_dot_ham.jpeg 55 | 56 | # An image asset can refer to one or more resolution-specific "variants", see 57 | # https://flutter.io/assets-and-images/#resolution-aware. 58 | 59 | # For details regarding adding assets from package dependencies, see 60 | # https://flutter.io/assets-and-images/#from-packages 61 | 62 | # To add custom fonts to your application, add a fonts section here, 63 | # in this "flutter" section. Each entry in this list should have a 64 | # "family" key with the font family name, and a "fonts" key with a 65 | # list giving the asset and other descriptors for the font. For 66 | # example: 67 | # fonts: 68 | # - family: Schyler 69 | # fonts: 70 | # - asset: fonts/Schyler-Regular.ttf 71 | # - asset: fonts/Schyler-Italic.ttf 72 | # style: italic 73 | # - family: Trajan Pro 74 | # fonts: 75 | # - asset: fonts/TrajanPro.ttf 76 | # - asset: fonts/TrajanPro_Bold.ttf 77 | # weight: 700 78 | # 79 | # For details regarding fonts from package dependencies, 80 | # see https://flutter.io/custom-fonts/#from-packages 81 | -------------------------------------------------------------------------------- /example/test/widget_test.dart: -------------------------------------------------------------------------------- 1 | // This is a basic Flutter widget test. 2 | // To perform an interaction with a widget in your test, use the WidgetTester utility that Flutter 3 | // provides. For example, you can send tap and scroll gestures. You can also use WidgetTester to 4 | // find child widgets in the widget tree, read text, and verify that the values of widget properties 5 | // are correct. 6 | 7 | //import 'package:flutter/material.dart'; 8 | //import 'package:flutter_test/flutter_test.dart'; 9 | 10 | //import 'package:share_extend_example/main.dart'; 11 | 12 | void main() { 13 | // testWidgets('Verify Platform version', (WidgetTester tester) async { 14 | // // Build our app and trigger a frame. 15 | // await tester.pumpWidget(new MyApp()); 16 | // 17 | // // Verify that platform version is retrieved. 18 | // expect( 19 | // find.byWidgetPredicate( 20 | // (Widget widget) => 21 | // widget is Text && widget.data.startsWith('Running on:'), 22 | // ), 23 | // findsOneWidget); 24 | // }); 25 | } 26 | -------------------------------------------------------------------------------- /ios/.gitignore: -------------------------------------------------------------------------------- 1 | .idea/ 2 | .vagrant/ 3 | .sconsign.dblite 4 | .svn/ 5 | 6 | .DS_Store 7 | *.swp 8 | profile 9 | 10 | DerivedData/ 11 | build/ 12 | GeneratedPluginRegistrant.h 13 | GeneratedPluginRegistrant.m 14 | 15 | .generated/ 16 | 17 | *.pbxuser 18 | *.mode1v3 19 | *.mode2v3 20 | *.perspectivev3 21 | 22 | !default.pbxuser 23 | !default.mode1v3 24 | !default.mode2v3 25 | !default.perspectivev3 26 | 27 | xcuserdata 28 | 29 | *.moved-aside 30 | 31 | *.pyc 32 | *sync/ 33 | Icon? 34 | .tags* 35 | 36 | /Flutter/Generated.xcconfig 37 | -------------------------------------------------------------------------------- /ios/Assets/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhouteng0217/ShareExtend/9169405eaceb37159063d37c392bcd9270785b2b/ios/Assets/.gitkeep -------------------------------------------------------------------------------- /ios/Classes/ShareExtendPlugin.h: -------------------------------------------------------------------------------- 1 | #import 2 | 3 | @interface ShareExtendPlugin : NSObject 4 | @end 5 | -------------------------------------------------------------------------------- /ios/Classes/ShareExtendPlugin.m: -------------------------------------------------------------------------------- 1 | #import "ShareExtendPlugin.h" 2 | 3 | @implementation ShareExtendPlugin 4 | 5 | + (void)registerWithRegistrar:(NSObject*)registrar { 6 | FlutterMethodChannel* shareChannel = [FlutterMethodChannel 7 | methodChannelWithName:@"com.zt.shareextend/share_extend" 8 | binaryMessenger:[registrar messenger]]; 9 | 10 | [shareChannel setMethodCallHandler:^(FlutterMethodCall *call, FlutterResult result) { 11 | if ([@"share" isEqualToString:call.method]) { 12 | NSDictionary *arguments = [call arguments]; 13 | NSArray *array = arguments[@"list"]; 14 | NSString *shareType = arguments[@"type"]; 15 | NSString *subject = arguments[@"subject"]; 16 | 17 | if (array.count == 0) { 18 | result( 19 | [FlutterError errorWithCode:@"error" message:@"Non-empty list expected" details:nil]); 20 | return; 21 | } 22 | 23 | NSNumber *originX = arguments[@"originX"]; 24 | NSNumber *originY = arguments[@"originY"]; 25 | NSNumber *originWidth = arguments[@"originWidth"]; 26 | NSNumber *originHeight = arguments[@"originHeight"]; 27 | 28 | CGRect originRect = CGRectZero; 29 | if (originX != nil && originY != nil && originWidth != nil && originHeight != nil) { 30 | originRect = CGRectMake([originX doubleValue], [originY doubleValue], 31 | [originWidth doubleValue], [originHeight doubleValue]); 32 | } 33 | 34 | if ([shareType isEqualToString:@"text"]) { 35 | [self share:array atSource:originRect withSubject:subject]; 36 | result(nil); 37 | } else if ([shareType isEqualToString:@"image"]) { 38 | NSMutableArray * imageArray = [[NSMutableArray alloc] init]; 39 | for (NSString * path in array) { 40 | UIImage *image = [UIImage imageWithContentsOfFile:path]; 41 | [imageArray addObject:image]; 42 | } 43 | [self share:imageArray atSource:originRect withSubject:subject]; 44 | } else { 45 | NSMutableArray * urlArray = [[NSMutableArray alloc] init]; 46 | for (NSString * path in array) { 47 | NSURL *url = [NSURL fileURLWithPath:path]; 48 | [urlArray addObject:url]; 49 | } 50 | [self share:urlArray atSource:originRect withSubject:subject]; 51 | result(nil); 52 | } 53 | } else { 54 | result(FlutterMethodNotImplemented); 55 | } 56 | }]; 57 | } 58 | 59 | + (void)share:(NSArray *)sharedItems atSource:(CGRect)origin withSubject:(NSString *) subject { 60 | UIActivityViewController *activityViewController = [[UIActivityViewController alloc] initWithActivityItems:sharedItems applicationActivities:nil]; 61 | 62 | UIViewController *controller =[UIApplication sharedApplication].keyWindow.rootViewController; 63 | activityViewController.popoverPresentationController.sourceView = controller.view; 64 | 65 | if (CGRectIsEmpty(origin)) { 66 | origin = CGRectMake(0, 0, controller.view.bounds.size.width, controller.view.bounds.size.width /2); 67 | } 68 | activityViewController.popoverPresentationController.sourceRect = origin; 69 | 70 | [activityViewController setValue:subject forKey:@"subject"]; 71 | 72 | [controller presentViewController:activityViewController animated:YES completion:nil]; 73 | } 74 | 75 | @end 76 | -------------------------------------------------------------------------------- /ios/share_extend.podspec: -------------------------------------------------------------------------------- 1 | # 2 | # To learn more about a Podspec see http://guides.cocoapods.org/syntax/podspec.html 3 | # 4 | Pod::Spec.new do |s| 5 | s.name = 'share_extend' 6 | s.version = '0.0.1' 7 | s.summary = 'A new flutter plugin project.' 8 | s.description = <<-DESC 9 | A new flutter plugin project. 10 | DESC 11 | s.homepage = 'http://example.com' 12 | s.license = { :file => '../LICENSE' } 13 | s.author = { 'Your Company' => 'email@example.com' } 14 | s.source = { :path => '.' } 15 | s.source_files = 'Classes/**/*' 16 | s.public_header_files = 'Classes/**/*.h' 17 | s.dependency 'Flutter' 18 | 19 | s.ios.deployment_target = '8.0' 20 | end 21 | 22 | -------------------------------------------------------------------------------- /lib/share_extend.dart: -------------------------------------------------------------------------------- 1 | /// A flutter plugin to share text, image, file with system ui. 2 | /// It is compatible with both android and ios. 3 | /// 4 | /// 5 | /// A open source authorized by zhouteng [https://github.com/zhouteng0217/ShareExtend](https://github.com/zhouteng0217/ShareExtend). 6 | 7 | import 'dart:async'; 8 | import 'package:flutter/services.dart'; 9 | import 'dart:ui'; 10 | 11 | /// Plugin for summoning a platform share sheet. 12 | class ShareExtend { 13 | /// [MethodChannel] used to communicate with the platform side. 14 | static const MethodChannel _channel = 15 | const MethodChannel('com.zt.shareextend/share_extend'); 16 | 17 | /// method to share with system ui 18 | /// It uses the ACTION_SEND Intent on Android and UIActivityViewController 19 | /// on iOS. 20 | /// [list] can be text or path list 21 | /// [type] "text", "image", "audio", "video" or "file" 22 | /// [sharePositionOrigin] only supports iPad os 23 | /// [sharePanelTitle] only supports android (some devices may not support) 24 | /// [subject] Intent.EXTRA_SUBJECT on Android and "subject" on iOS. 25 | /// [extraText] only supports android for Intent.EXTRA_TEXT when sharing image or file. 26 | /// 27 | static Future shareMultiple(List list, String type, 28 | {Rect? sharePositionOrigin, 29 | String? sharePanelTitle, 30 | String subject = "", 31 | List? extraTexts}) { 32 | assert(list.isNotEmpty); 33 | return _shareInner(list, type, 34 | sharePositionOrigin: sharePositionOrigin, 35 | subject: subject, 36 | sharePanelTitle: sharePanelTitle, 37 | extraTexts: extraTexts); 38 | } 39 | 40 | /// method to share with system ui 41 | /// It uses the ACTION_SEND Intent on Android and UIActivityViewController 42 | /// on iOS. 43 | /// [list] can be text or path list 44 | /// [type] "text", "image", "audio", "video" or "file" 45 | /// [sharePositionOrigin] only supports iPad os 46 | /// [sharePanelTitle] only supports android (some devices may not support) 47 | /// [subject] Intent.EXTRA_SUBJECT on Android and "subject" on iOS. 48 | /// [extraText] only supports android for Intent.EXTRA_TEXT when sharing image or file. 49 | /// 50 | static Future share(String text, String type, 51 | {Rect? sharePositionOrigin, 52 | String? sharePanelTitle, 53 | String subject = "", 54 | String extraText = ""}) { 55 | assert(text.isNotEmpty); 56 | List list = [text]; 57 | return _shareInner( 58 | list, 59 | type, 60 | sharePositionOrigin: sharePositionOrigin, 61 | sharePanelTitle: sharePanelTitle, 62 | subject: subject, 63 | extraTexts: [extraText], 64 | ); 65 | } 66 | 67 | static Future _shareInner(List list, String type, 68 | {Rect? sharePositionOrigin, 69 | String? sharePanelTitle, 70 | String? subject, 71 | List? extraTexts}) { 72 | assert(list.isNotEmpty); 73 | final Map params = { 74 | 'list': list, 75 | 'type': type, 76 | 'sharePanelTitle': sharePanelTitle, 77 | 'subject': subject, 78 | 'extraTexts': extraTexts 79 | }; 80 | if (sharePositionOrigin != null) { 81 | params['originX'] = sharePositionOrigin.left; 82 | params['originY'] = sharePositionOrigin.top; 83 | params['originWidth'] = sharePositionOrigin.width; 84 | params['originHeight'] = sharePositionOrigin.height; 85 | } 86 | return _channel.invokeMethod('share', params); 87 | } 88 | } 89 | -------------------------------------------------------------------------------- /pubspec.yaml: -------------------------------------------------------------------------------- 1 | name: share_extend 2 | description: A Flutter plugin for Android and iOS for sharing text, image, video and file with system ui. 3 | version: 2.0.0 4 | author: zhouteng 5 | homepage: https://github.com/zhouteng0217/ShareExtend 6 | 7 | environment: 8 | sdk: '>=2.12.0 <3.0.0' 9 | flutter: ">=1.10.0" 10 | 11 | dependencies: 12 | meta: ^1.3.0 13 | flutter: 14 | sdk: flutter 15 | 16 | # For information on the generic Dart part of this file, see the 17 | # following page: https://www.dartlang.org/tools/pub/pubspec 18 | 19 | # The following section is specific to Flutter. 20 | flutter: 21 | plugin: 22 | platforms: 23 | android: 24 | package: com.zt.shareextend 25 | pluginClass: ShareExtendPlugin 26 | ios: 27 | pluginClass: ShareExtendPlugin 28 | 29 | # To add assets to your plugin package, add an assets section, like this: 30 | # assets: 31 | # - images/a_dot_burr.jpeg 32 | # - images/a_dot_ham.jpeg 33 | # 34 | # For details regarding assets in packages, see 35 | # https://flutter.io/assets-and-images/#from-packages 36 | # 37 | # An image asset can refer to one or more resolution-specific "variants", see 38 | # https://flutter.io/assets-and-images/#resolution-aware. 39 | 40 | # To add custom fonts to your plugin package, add a fonts section here, 41 | # in this "flutter" section. Each entry in this list should have a 42 | # "family" key with the font family name, and a "fonts" key with a 43 | # list giving the asset and other descriptors for the font. For 44 | # example: 45 | # fonts: 46 | # - family: Schyler 47 | # fonts: 48 | # - asset: fonts/Schyler-Regular.ttf 49 | # - asset: fonts/Schyler-Italic.ttf 50 | # style: italic 51 | # - family: Trajan Pro 52 | # fonts: 53 | # - asset: fonts/TrajanPro.ttf 54 | # - asset: fonts/TrajanPro_Bold.ttf 55 | # weight: 700 56 | # 57 | # For details regarding fonts in packages, see 58 | # https://flutter.io/custom-fonts/#from-packages 59 | --------------------------------------------------------------------------------