Commit fef96289 authored by zhouteng's avatar zhouteng

添加NSPhotoLibraryAddUsageDescription,并更新readme

parent 6f3e02d2
Language: [English](https://github.com/zhouteng0217/ShareExtend/blob/master/README-en.md) | [中文简体](https://github.com/zhouteng0217/ShareExtend/blob/master/README.md)
# ShareExtend
[![pub package](https://img.shields.io/pub/v/share_extend.svg)](https://pub.dartlang.org/packages/share_extend)
A Flutter plugin for iOS and Android for sharing text, image, video and file with system ui.
## Installation
First, add `share_extend` as a dependency in your pubspec.yaml file.
```
dependencies:
share_extend: "^1.0.8"
```
### iOS
Add the following key to your info.plist file, located in `<project root>/ios/Runner/Info.plist` for saving shared images to photo library.
```
<key>NSPhotoLibraryAddUsageDescription</key>
<string>describe why your app needs access to write photo library</string>
```
### Android
No configuration required.
## Import
```
import 'package:share_extend/share_extend.dart';
```
## Example
```
//share text
ShareExtend.share("share text", "text");
//share image
File f =
await ImagePicker.pickImage(source: ImageSource.gallery);
ShareExtend.share(f.path, "image");
//share video
File f = await ImagePicker.pickVideo(
source: ImageSource.gallery);
ShareExtend.share(f.path, "video");
//share file
Directory dir = await getApplicationDocumentsDirectory();
File testFile = new File("${dir.path}/flutter/test.txt");
if (!await testFile.exists()) {
await testFile.create(recursive: true);
testFile.writeAsStringSync("test for share documents file");
}
ShareExtend.share(testFile.path, "file");
```
\ No newline at end of file
Language: [English](https://github.com/zhouteng0217/ShareExtend/blob/master/README-en.md) | [中文简体](https://github.com/zhouteng0217/ShareExtend/blob/master/README.md)
# ShareExtend
[![pub package](https://img.shields.io/pub/v/share_extend.svg)](https://pub.dartlang.org/packages/share_extend)
调用系统分享的Flutter组件,支持分享文本、图片、视频和文件
## 安装
```
dependencies:
share_extend: "^1.0.7"
share_extend: "^1.0.8"
```
### iOS
添加下面的key到工程的info.plist文件,路径 ```<project root>/ios/Runner/Info.plist```,用于将分享的图片保存到相册
```
<key>NSPhotoLibraryAddUsageDescription</key>
<string>这里填写为什么需要相写入册权限的描述语句</string>
```
### Android
暂无特殊配置
## 导入
```
import 'package:share_extend/share_extend.dart';
```
......@@ -38,5 +58,4 @@ if (!await testFile.exists()) {
}
ShareExtend.share(testFile.path, "file");
```
```
\ No newline at end of file
......@@ -41,5 +41,7 @@
</array>
<key>UIViewControllerBasedStatusBarAppearance</key>
<false/>
<key>NSPhotoLibraryAddUsageDescription</key>
<string>App needs photo library permission for saving images</string>
</dict>
</plist>
name: share_extend
description: A flutter plugin to share text, image, file with system ui. It is compatible with both andorid and ios.
version: 1.0.7
description: A Flutter plugin for Android and iOS for sharing text, image, video and file with system ui.
version: 1.0.8
author: zhouteng <qfszyq@gmail.com>
homepage: https://github.com/zhouteng0217/ShareExtend
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment