Commit 6f87f891 authored by zhouteng's avatar zhouteng

update pubspec and readme

parent 4e42bd9e
## 1.1.1
* add option param "share panel title" on android
* add option param "subject" on both android and ios
* update sample code with latest image_picker plugin version that fixed video picker bugs
## 1.1.0 ## 1.1.0
* 添加多图,多文件分享功能 * 添加多图,多文件分享功能
* 合并image_picker在ios13中选取视频不可用的补丁 * 合并image_picker在ios13中选取视频不可用的补丁
......
...@@ -12,7 +12,7 @@ First, add `share_extend` as a dependency in your pubspec.yaml file. ...@@ -12,7 +12,7 @@ First, add `share_extend` as a dependency in your pubspec.yaml file.
``` ```
dependencies: dependencies:
share_extend: "^1.1.0" share_extend: "^1.1.1"
``` ```
### iOS ### iOS
...@@ -45,7 +45,7 @@ import 'package:share_extend/share_extend.dart'; ...@@ -45,7 +45,7 @@ import 'package:share_extend/share_extend.dart';
``` ```
//share text //share text
ShareExtend.share("share text", "text"); ShareExtend.share("share text", "text","android share panel title","share subject");
//share image //share image
File f = File f =
...@@ -71,9 +71,20 @@ _shareMultipleImages() async { ...@@ -71,9 +71,20 @@ _shareMultipleImages() async {
List<Asset> assetList = await MultiImagePicker.pickImages(maxImages: 5); List<Asset> assetList = await MultiImagePicker.pickImages(maxImages: 5);
var imageList = List<String>(); var imageList = List<String>();
for (var asset in assetList) { for (var asset in assetList) {
imageList.add(await asset.filePath); String path =
await _writeByteToImageFile(await asset.getByteData(quality: 30));
imageList.add(path);
} }
ShareExtend.shareMultiple(imageList, "image"); ShareExtend.shareMultiple(imageList, "image");
} }
Future<String> _writeByteToImageFile(ByteData byteData) async {
Directory dir = await getApplicationDocumentsDirectory();
File imageFile = new File(
"${dir.path}/flutter/${DateTime.now().millisecondsSinceEpoch}.png");
imageFile.createSync(recursive: true);
imageFile.writeAsBytesSync(byteData.buffer.asUint8List(0));
return imageFile.path;
}
``` ```
\ No newline at end of file
...@@ -10,7 +10,7 @@ Language: [English](https://github.com/zhouteng0217/ShareExtend/blob/master/READ ...@@ -10,7 +10,7 @@ Language: [English](https://github.com/zhouteng0217/ShareExtend/blob/master/READ
``` ```
dependencies: dependencies:
share_extend: "^1.1.0" share_extend: "^1.1.1"
``` ```
### iOS ### iOS
...@@ -42,7 +42,7 @@ import 'package:share_extend/share_extend.dart'; ...@@ -42,7 +42,7 @@ import 'package:share_extend/share_extend.dart';
``` ```
//分享文本 //分享文本
ShareExtend.share("share text", "text"); ShareExtend.share("share text", "text","android share panel title","share subject");
//分享图片 (例子中使用了一个image_picker的插件来实现图片的选择) //分享图片 (例子中使用了一个image_picker的插件来实现图片的选择)
File f = File f =
...@@ -63,14 +63,25 @@ if (!await testFile.exists()) { ...@@ -63,14 +63,25 @@ if (!await testFile.exists()) {
} }
ShareExtend.share(testFile.path, "file"); ShareExtend.share(testFile.path, "file");
///分享多图 //分享多图(借助了MultiImagePicker来多选获取图片图片,由于该库没有提供文件路径,因此demo里面先将图片保存为图片再调用分享)
_shareMultipleImages() async { _shareMultipleImages() async {
List<Asset> assetList = await MultiImagePicker.pickImages(maxImages: 5); List<Asset> assetList = await MultiImagePicker.pickImages(maxImages: 5);
var imageList = List<String>(); var imageList = List<String>();
for (var asset in assetList) { for (var asset in assetList) {
imageList.add(await asset.filePath); String path =
await _writeByteToImageFile(await asset.getByteData(quality: 30));
imageList.add(path);
} }
ShareExtend.shareMultiple(imageList, "image"); ShareExtend.shareMultiple(imageList, "image");
} }
Future<String> _writeByteToImageFile(ByteData byteData) async {
Directory dir = await getApplicationDocumentsDirectory();
File imageFile = new File(
"${dir.path}/flutter/${DateTime.now().millisecondsSinceEpoch}.png");
imageFile.createSync(recursive: true);
imageFile.writeAsBytesSync(byteData.buffer.asUint8List(0));
return imageFile.path;
}
``` ```
\ No newline at end of file
name: share_extend name: share_extend
description: A Flutter plugin for Android and iOS for sharing text, image, video and file with system ui. description: A Flutter plugin for Android and iOS for sharing text, image, video and file with system ui.
version: 1.1.0 version: 1.1.1
author: zhouteng <qfszyq@gmail.com> author: zhouteng <qfszyq@gmail.com>
homepage: https://github.com/zhouteng0217/ShareExtend 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