share_extend 1.0.2

  • README.md
  • CHANGELOG.md
  • Example
  • Installing
  • Versions
  • 81

ShareExtend

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

安装

dependencies:
  share_extend: "^1.0.2"

导入

import 'package:share_extend/share_extend.dart';

使用

  • 如果要分享手机外部存储(external storage)中的图片和文件,对于Android工程来说,

    1. 需要配置WRITE_EXTERNAL_STORAGE权限,在android工程AndroidManifest.xml中配置
        <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
    

    对于targetSdkVersion>=23的版本,需要动态获取权限 动态权限获取,可以借助其他第三方flutter插件来实现

    1. 需要配置FileProvider来实现文件的分享,在android工程AndroidManifest.xml中配置
            <provider
                android:name="android.support.v4.content.FileProvider"
                android:authorities="{your_authorities}"
                android:grantUriPermissions="true"
                android:exported="false">
                <meta-data
                    android:name="android.support.FILE_PROVIDER_PATHS"
                    android:resource="@xml/{your_provider_file}" />
            </provider>
    
    
    

    工程的res文件夹下,新建一个xml文件夹,添加一个{your_provider_file}的xml文件,配置类似如下:

    <?xml version="1.0" encoding="utf-8"?>
    <resources>
        <paths>
            <external-path
                name="external_cache"
                path="" />
        </paths>
    </resources>
    

    Dart中调用

      // authorities 上面定义authorities
    
      //分享文本(只分享文本时,authorities参数是不必需的)
      ShareExtend.share("share text", "text", authorities);
    
      //分享图片 (例子中使用了一个image_picker的插件来实现图片的选择)
      File f =
          await ImagePicker.pickImage(source: ImageSource.gallery);
      ShareExtend.share(f.path, "image", authorities);
      //分享文件
      File f =
        await ImagePicker.pickImage(source: ImageSource.gallery);
      ShareExtend.share(f.path, "file", authorities);   
    

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.2

2. Install it

You can install packages from the command line:

with Flutter:


$ flutter packages get

Alternatively, your editor might support flutter packages 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';
  
Version Uploaded Documentation Archive
1.0.2 Dec 3, 2018 Go to the documentation of share_extend 1.0.2 Download share_extend 1.0.2 archive
1.0.1 Oct 28, 2018 Go to the documentation of share_extend 1.0.1 Download share_extend 1.0.1 archive
1.0.0 Oct 28, 2018 Go to the documentation of share_extend 1.0.0 Download share_extend 1.0.0 archive
0.0.1 Oct 9, 2018 Go to the documentation of share_extend 0.0.1 Download share_extend 0.0.1 archive
Popularity:
Describes how popular the package is relative to other packages. [more]
62
Health:
Code health derived from static analysis. [more]
100
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
100
Overall:
Weighted score of the above. [more]
81
Learn more about scoring.

We analyzed this package on Dec 5, 2018, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.1.0
  • pana: 0.12.7
  • Flutter: 1.0.0

Platforms

Detected platforms: Flutter

References Flutter, and has no conflicting libraries.

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
Transitive dependencies
collection 1.14.11
sky_engine 0.0.99
typed_data 1.1.6
vector_math 2.0.8