パッケージ、リポジトリ、アプリカテゴリを検索

パッケージ詳細v1.0.6

share_files_and_screenshot_widgets

このパッケージを使用すると、CSV、MP4、PNGなど任意の種類のファイルを共有でき、必要なウィジェットのスクリーンショットを撮影して画像として返すだけでなく、画像形式で直接共有することもできます。

AndroidiOS
30日間ダウンロード
215
いいね数
78
Pub ポイント
120

パッケージをインストール

flutter pub add share_files_and_screenshot_widgets

パッケージ概要

公開情報に基づく選定ガイドです。参考としてご利用ください。

任意のウィジェットのスクリーンショットをキャプチャして画像として共有するか、CSV、MP4、PNGなどのさまざまなファイルタイプを直接共有できるFlutterパッケージです。スクリーンキャプチャとファイル共有機能を統合することで、アプリ内でのコンテンツ共有プロセスを簡素化します。このパッケージはAndroidおよびiOSの両方で動作し、視覚的またはデータベースのコンテンツを迅速に共有する必要があるアプリに最適です。クリーンなDartインターフェースを通じてネイティブプラットフォーム機能を利用しています。

用途

  • カスタムUIプレビューの共有
  • 画像スクリーンショットとしてデータをエクスポートする
  • CSVや動画などのファイルを配布する
  • ソーシャルメディア共有機能の統合
  • ユーザー生成コンテンツの共有を有効にする

主な機能

  • ウィジェットのスクリーンショットを画像としてキャプチャする
  • 複数のファイル形式を直接共有
  • クロスプラットフォーム対応(AndroidおよびiOS)
  • スクリーンショットおよび共有アクションのためのシンプルな API
  • 組み込みの画像エクスポート機能

適している対象

  • ビジュアルコンテンツ共有が必要なアプリ
  • データ可視化ツール
  • 教育またはプレゼンテーションアプリ
  • ソーシャル共有機能
  • プロトタイピングとデモアプリ

注意事項

  • Android および iOS で適切な権限が必要です
  • 大きなウィジェットサイズに対応する必要がある可能性があります
  • サポートされているファイル形式に制限されています
  • プラットフォーム固有の動作は異なる場合があります
  • 複雑なウィジェットによるパフォーマンスへの潜在的影響

元の README

関連するソースリポジトリの README 原文のスナップショットです。最新の内容はリポジトリをご覧ください。

share_files_and_screenshot_widgets

This pub lets you share any kind of files (csv, mp4, png etc), take screenshot of the widgets you want and return as Image and share them directly as well in the form of an image.

Usage

Example

To use this package :

  • add the dependency to your [pubspec.yaml] file.
  dependencies:
    flutter:
      sdk: flutter
    share_files_and_screenshot_widgets:
How to use
Take ScreenShot of Widgets
//define
GlobalKey previewContainer = new GlobalKey();

//wrap your widget with
RepaintBoundary(
  key: previewContainer,
  child: YourWidget()
),

//call this function for taking screenshot
ShareFilesAndScreenshotWidgets()
    .takeScreenshot(previewContainer, originalSize)
    .then((Image value) {
  setState(() {
    _image = value;
  });
});
Directly Share ScreenShot of Widgets
//define
GlobalKey previewContainer = new GlobalKey();

//wrap your widget with
RepaintBoundary(
  key: previewContainer,
  child: YourWidget()
),

//call this function for sharing screenshot
ShareFilesAndScreenshotWidgets().shareScreenshot(
  previewContainer,
  originalSize,
  "Title",
  "Name.png",
  "image/png",
  text: "This is the caption!");
Share Any Type of File
ByteData bytes =
    await rootBundle.load('assets/example.jpg');
Uint8List list = bytes.buffer.asUint8List();
ShareFilesAndScreenshotWidgets().shareFile(
    "Title", "Name.jpg", list, "image/jpg",
    text: "This is the caption!");
ByteData bytes =
    await rootBundle.load('assets/example.mp4');
Uint8List list = bytes.buffer.asUint8List();
ShareFilesAndScreenshotWidgets().shareFile(
    "Title", "Name.mp4", list, "video/mp4",
    text: "This is the caption!");
ByteData bytes =
    await rootBundle.load('assets/example.mp3');
Uint8List list = bytes.buffer.asUint8List();
ShareFilesAndScreenshotWidgets().shareFile(
    "Title", "Name.mp3", list, "audio/mp3",
    text: "This is the caption!");

License

Copyright 2020 Jay Mehta

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

    http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

Getting Started

This project is a starting point for a Dart package, a library module containing code that can be shared easily across multiple Flutter or Dart projects.

For help getting started with Flutter, view our online documentation, which offers tutorials, samples, guidance on mobile development, and a full API reference.

Example

As time based...

import 'dart:typed_data';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'dart:ui';
import 'package:share_files_and_screenshot_widgets/share_files_and_screenshot_widgets.dart';

void main() {
  runApp(MyApp());
}

class MyApp extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      debugShowCheckedModeBanner: false,
      title: 'Flutter ScreenShot Demo',
      theme: ThemeData(
        primarySwatch: Colors.deepOrange,
        visualDensity: VisualDensity.adaptivePlatformDensity,
      ),
      home: MyHomePage(title: 'Flutter Demo ScreenShot Page'),
    );
  }
}

class MyHomePage extends StatefulWidget {
  MyHomePage({Key key, this.title}) : super(key: key);

  final String title;

  @override
  _MyHomePageState createState() => _MyHomePageState();
}

class _MyHomePageState extends State<MyHomePage> {
  Image _image;

  GlobalKey previewContainer = new GlobalKey();
  int originalSize = 800;

  @override
  Widget build(BuildContext context) {
    return Scaffold(
        appBar: AppBar(
          title: Text(widget.title),
        ),
        body: SingleChildScrollView(
          child: Center(
            child: Column(
              mainAxisAlignment: MainAxisAlignment.spaceEvenly,
              children: [
                RepaintBoundary(
                  key: previewContainer,
                  child: Container(
                    decoration: BoxDecoration(
                        border: Border.all(width: 1.5),
                        borderRadius: BorderRadius.circular(20),
                        color: Colors.deepPurple),
                    padding: EdgeInsets.all(15),
                    margin: EdgeInsets.all(20),
                    width: MediaQuery.of(context).size.width - 40,
                    height: MediaQuery.of(context).size.height,
                    child: Column(
                      mainAxisAlignment: MainAxisAlignment.spaceEvenly,
                      children: [
                        Text(
                          "This is a picture.",
                          style: TextStyle(
                              fontSize: 20,
                              fontWeight: FontWeight.bold,
                              color: Colors.white),
                        ),
                        Image.asset("assets/example.jpg"),
                        Text(
                          "There’s something so whimsical about these beautiful images that incorporate bokeh. It’s almost as if they could be from a different, magical world. We’ve loved watching the submissions fly in for our bokeh-themed Photo Quest by Meyer-Optik-Görlitz and selected 30+ of our favourites beautiful images to ignite your creative spark! The three lucky winners of this Quest are going to receive an incredible prize courtesy of master lens-crafters Meyer-Optik.",
                          style: TextStyle(color: Colors.white),
                        ),
                      ],
                    ),
                  ),
                ),
                Column(
                  mainAxisAlignment: MainAxisAlignment.spaceEvenly,
                  children: [
                    Container(
                      child: RaisedButton(
                          child: Text("Take Screenshot!"),
                          onPressed: () {
                            ShareFilesAndScreenshotWidgets()
                                .takeScreenshot(previewContainer, originalSize)
                                .then((Image value) {
                              setState(() {
                                _image = value;
                              });
                            });
                          }),
                    ),
                    Container(
                        child: RaisedButton(
                            child: Text("Share Screenshot!"),
                            onPressed: () {
                              ShareFilesAndScreenshotWidgets().shareScreenshot(
                                  previewContainer,
                                  originalSize,
                                  "Title",
                                  "Name.png",
                                  "image/png",
                                  text: "This is the caption!");
                            })),
                    Container(
                        child: RaisedButton(
                            child: Text("Share Image!"),
                            onPressed: () async {
                              ByteData bytes =
                                  await rootBundle.load('assets/example.jpg');
                              Uint8List list = bytes.buffer.asUint8List();
                              ShareFilesAndScreenshotWidgets().shareFile(
                                  "Title", "Name.jpg", list, "image/jpg",
                                  text: "This is the caption!");
                            })),
                    Container(
                        child: RaisedButton(
                            child: Text("Share Video!"),
                            onPressed: () async {
                              ByteData bytes =
                                  await rootBundle.load('assets/example.mp4');
                              Uint8List list = bytes.buffer.asUint8List();
                              ShareFilesAndScreenshotWidgets().shareFile(
                                  "Title", "Name.mp4", list, "video/mp4",
                                  text: "This is the caption!");
                            })),
                    Container(
                        child: RaisedButton(
                            child: Text("Share Audio!"),
                            onPressed: () async {
                              ByteData bytes =
                                  await rootBundle.load('assets/example.mp3');
                              Uint8List list = bytes.buffer.asUint8List();
                              ShareFilesAndScreenshotWidgets().shareFile(
                                  "Title", "Name.mp3", list, "audio/mp3",
                                  text: "This is the caption!");
                            })),
                  ],
                ),
                _image != null ? _image : Center()
              ],
            ),
          ),
        ));
  }
}

カテゴリー

依存関係

依存関係一覧 1 件

ソースリポジトリ

このパッケージを使用しているプロジェクト

データはまだありません。