搜索插件、代码仓与 APP 分类

插件详情v1.0.2

esys_flutter_share

一个用于与其他应用程序共享图片和文本的 Flutter 插件。

近 30 天下载
3310
喜欢数
212
Pub 分数
30

安装插件

flutter pub add esys_flutter_share

插件介绍

基于插件公开信息、社区数据与项目使用情况整理的选型参考。

EsysFlutterShare 是一个 Flutter 插件,可通过原生分享意图实现文本和图像与其他应用的无缝共享。它简化了 Android 和 iOS 上的跨平台分享,允许用户直接从应用将内容发送到社交媒体、消息应用或电子邮件客户端。该插件与 Flutter 生态系统无缝集成,设置简单。它支持分享纯文本、URL 和图像文件,非常适合需要快速分发内容的应用。该包由 EsysBerlin 维护,并托管在 GitHub 上,以确保透明度和社区贡献。

适合场景

  • 分享链接到社交媒体
  • 从应用发送图片到其他应用
  • 通过共享表单分发文本内容
  • 启用用户生成内容共享
  • 与消息平台集成

主要特点

  • 支持文本和图片分享
  • 跨平台兼容性
  • 简单的 API,配置最少
  • 原生分享意图集成
  • 开源且积极维护

适合对象

  • 社交媒体应用
  • 照片共享应用
  • 内容发现平台
  • 用户生成内容功能
  • 需要轻松外部共享的应用程序

使用建议

  • 某些设备需要平台特定的权限
  • 仅限基本分享功能
  • 无内置的分享表单自定义
  • 依赖原生操作系统共享对话框
  • 可能需要对大图像文件进行额外处理

原始 README

以下为关联源码仓库的 README 原文快照,最新内容请访问源码仓库。

Important Note

We have decided to discontinue the development of this library to concentrate our efforts on other projects. You can use share_plus instead for example.

esys_flutter_share

A Flutter plugin for sharing files & text with other applications.

IMPORTANT Note for iOS

If you are starting a new fresh app, you need to create the Flutter App with flutter create -i swift (see flutter/flutter#13422 (comment)), otherwise, you will get this message:

=== BUILD TARGET flutter_inappbrowser OF PROJECT Pods WITH CONFIGURATION Debug ===
The "Swift Language Version" (SWIFT_VERSION) build setting must be set to a supported value for targets which use Swift. Supported values are: 3.0, 4.0, 4.2. This setting can be set in the build settings editor.

If you still have this problem, try to edit iOS Podfile like this (see #15):

target 'Runner' do
  use_frameworks!  # required by simple_permission
  ...
end

post_install do |installer|
  installer.pods_project.targets.each do |target|
    target.build_configurations.each do |config|
      config.build_settings['SWIFT_VERSION'] = '4.0'  # required by simple_permission
      config.build_settings['ENABLE_BITCODE'] = 'NO'
    end
  end
end

Instead, if you have already a non-swift project, you can check this issue to solve the problem: Friction adding swift plugin to objective-c project.

Usage

Import:

import 'package:esys_flutter_share/esys_flutter_share.dart';

Share text:

Share.text('my text title', 'This is my text to share with other applications.', 'text/plain');

Share file:

final ByteData bytes = await rootBundle.load('assets/image1.png');
await Share.file('esys image', 'esys.png', bytes.buffer.asUint8List(), 'image/png', text: 'My optional text.');

Share files:

final ByteData bytes1 = await rootBundle.load('assets/image1.png');
final ByteData bytes2 = await rootBundle.load('assets/image2.png');
final ByteData bytes3 = await rootBundle.load('assets/addresses.csv');

await Share.files(
    'esys images',
    {
        'esys.png': bytes1.buffer.asUint8List(),
        'bluedan.png': bytes2.buffer.asUint8List(),
        'addresses.csv': bytes3.buffer.asUint8List(),
    },
    '*/*',
    text: 'My optional text.');

Share file from url:

var request = await HttpClient().getUrl(Uri.parse('https://shop.esys.eu/media/image/6f/8f/af/amlog_transport-berwachung.jpg'));
var response = await request.close();
Uint8List bytes = await consolidateHttpClientResponseBytes(response);
await Share.file('ESYS AMLOG', 'amlog.jpg', bytes, 'image/jpg');

Check out the example app in the Repository for further information.

所属分类

依赖

依赖清单 1 项

源码仓库

使用此插件的项目

暂无相关数据。