share_extend 1.0.1 copy "share_extend: ^1.0.1" to clipboard
share_extend: ^1.0.1 copied to clipboard

outdated

A flutter plugin to share text, image, file with systemui. 一个调用系统分享的flutter插件,支持分享文本,图片和文件。

example/lib/main.dart

import 'package:flutter/material.dart';
import 'dart:io';

import 'package:share_extend/share_extend.dart';
import 'package:image_picker/image_picker.dart';

void main() => runApp(new MyApp());

class MyApp extends StatefulWidget {
  @override
  _MyAppState createState() => new _MyAppState();
}

class _MyAppState extends State<MyApp> {
  ///define in android project AndroidManifest.xml for FileProvider
  static const String authorities = "com.zt.shareextend.fileprovider";

  @override
  void initState() {
    super.initState();
  }

  @override
  Widget build(BuildContext context) {
    return new MaterialApp(
      home: new Scaffold(
        appBar: new AppBar(
          title: const Text('Plugin example app'),
        ),
        body: new Center(
            child: new Column(
          children: <Widget>[
            new RaisedButton(
              onPressed: () {
                ShareExtend.share("share text", "text", authorities);
              },
              child: new Text("share text"),
            ),
            new RaisedButton(
              onPressed: () async {
                File f =
                    await ImagePicker.pickImage(source: ImageSource.gallery);
                ShareExtend.share(f.path, "image", authorities);
              },
              child: new Text("share image"),
            ),
            new RaisedButton(
              onPressed: () async {
                File f =
                    await ImagePicker.pickImage(source: ImageSource.gallery);
                ShareExtend.share(f.path, "file", authorities);
              },
              child: new Text("share file"),
            ),
          ],
        )),
      ),
    );
  }
}
134
likes
0
pub points
96%
popularity

Publisher

unverified uploader

A flutter plugin to share text, image, file with systemui. 一个调用系统分享的flutter插件,支持分享文本,图片和文件。

Repository (GitHub)
View/report issues

License

unknown (LICENSE)

Dependencies

flutter, meta

More

Packages that depend on share_extend