GithubHelp home page GithubHelp logo

wittech / shareextend Goto Github PK

View Code? Open in Web Editor NEW

This project forked from zhouteng0217/shareextend

0.0 0.0 0.0 143 KB

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

License: MIT License

Dart 100.00%

shareextend's Introduction

Language: English | 中文简体

ShareExtend

pub package

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

安装

dependencies:
  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';

使用


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

shareextend's People

Contributors

zhouteng0217 avatar wittech avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.