Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
S
ShareExtend
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
李增强
ShareExtend
Commits
fef96289
Commit
fef96289
authored
Mar 31, 2019
by
zhouteng
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
添加NSPhotoLibraryAddUsageDescription,并更新readme
parent
6f3e02d2
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
90 additions
and
5 deletions
+90
-5
README-en.md
README-en.md
+64
-0
README.md
README.md
+22
-3
example/ios/Runner/Info.plist
example/ios/Runner/Info.plist
+2
-0
pubspec.yaml
pubspec.yaml
+2
-2
No files found.
README-en.md
0 → 100644
View file @
fef96289
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
README.md
View file @
fef96289
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
example/ios/Runner/Info.plist
View file @
fef96289
...
...
@@ -41,5 +41,7 @@
</array>
<key>
UIViewControllerBasedStatusBarAppearance
</key>
<false/>
<key>
NSPhotoLibraryAddUsageDescription
</key>
<string>
App needs photo library permission for saving images
</string>
</dict>
</plist>
pubspec.yaml
View file @
fef96289
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
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment