share_extend 1.0.9

Language: English | 中文简体

ShareExtend #

pub package

调用系统分享的Flutter组件,支持分享文本、图片、视频和文件

安装 #

dependencies:
  share_extend: "^1.0.9"

iOS #

添加下面的key到工程的info.plist文件,路径 <project root>/ios/Runner/Info.plist,用于将分享的图片保存到相册

<key>NSPhotoLibraryAddUsageDescription</key>
<string>这里填写为什么需要相写入册权限的描述语句</string>

Android #

如果涉及到要分享存储空间里面的文件,需要用到读写存储空间权限的,请在项目的android模块的下,添加读写权限,路径为 <project root>/android/app/src/main/AndroidManifest.xml

<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>

导入 #

import 'package:share_extend/share_extend.dart';

使用 #


//分享文本
ShareExtend.share("share text", "text");

//分享图片 (例子中使用了一个image_picker的插件来实现图片的选择)
File f =
    await ImagePicker.pickImage(source: ImageSource.gallery);
ShareExtend.share(f.path, "image");

//分享视频
File f = await ImagePicker.pickVideo(
        source: ImageSource.gallery);
ShareExtend.share(f.path, "video");

//分享文件
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"); 

1.0.9 #

  • 移除了Android端的内置存储的读写权限,改成由APP端来按需求配置

1.0.7 #

  • Android端修改了FileProvider的authorities,继承FileProvider,防止FileProvider冲突

1.0.6 #

  • 修复了android端分享应用沙盒内文件可能出错的bug
  • 优化了android端分享时的权限请求逻辑

1.0.5 #

  • Fix bugs when sharing videos to some apps like WeChat.

1.0.4 #

  • Updated to Support Latest Android Dependencies

0.0.1 #

  • TODO: Describe initial release.

example/README.md

share_extend_example #

Demonstrates how to use the share_extend plugin.

Getting Started #

For help getting started with Flutter, view our online documentation.

Use this package as a library

1. Depend on it

Add this to your package's pubspec.yaml file:


dependencies:
  share_extend: ^1.0.9

2. Install it

You can install packages from the command line:

with Flutter:


$ flutter pub get

Alternatively, your editor might support flutter pub get. Check the docs for your editor to learn more.

3. Import it

Now in your Dart code, you can use:


import 'package:share_extend/share_extend.dart';
  
Popularity:
Describes how popular the package is relative to other packages. [more]
92
Health:
Code health derived from static analysis. [more]
100
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
90
Overall:
Weighted score of the above. [more]
94
Learn more about scoring.

We analyzed this package on Jul 22, 2019, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.4.0
  • pana: 0.12.19
  • Flutter: 1.7.8+hotfix.3

Platforms

Detected platforms: Flutter

References Flutter, and has no conflicting libraries.

Maintenance issues and suggestions

Support latest dependencies. (-10 points)

The version constraint in pubspec.yaml does not support the latest published versions for 1 dependency (meta).

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.0.0-dev.28.0 <3.0.0
flutter 0.0.0
meta ^1.0.5 1.1.6 1.1.7
Transitive dependencies
collection 1.14.11
sky_engine 0.0.99
typed_data 1.1.6
vector_math 2.0.8

Admin