merge_images 1.0.3

  • Readme
  • Changelog
  • Example
  • Installing
  • 78

merge_images in flutter #

中文文档

Intro #

Merge images (Image stitching) in vertical or horizontal direction. Preview

Features #

  • Support vertical and horizontal direction.
  • Provide a helper to merge images in code and get a result image, and a widget to automatically merge and show images.
  • Automatically scale the image to fit other images (fit width in vertical, and height in horizontal).

Usage #

ImagesMergeHelper

Use this helper to merge images in code.

ui.Image image = await ImagesMergeHelper.margeImages(
[assetImage1,assetImage2,providerImage],///required,images list
   fit: true,///scale image to fit others
   direction: Axis.vertical,///direction of images
   backgroundColor: Colors.black26);///background color

Besides, it provider some functions to do image format conversion:

///ui.Image to Uint8List
Uint8List bytes = await ImagesMergeHelper.imageToUint8List(image);
///ui.Image to File
File file = await ImagesMergeHelper.imageToFile(image);
///Uint8List to ui.Image
ui.Image image = await ImagesMergeHelper.uint8ListToImage(imageBytes);
///file to ui.Image
ui.Image image = await ImagesMergeHelper.loadImageFromFile(file);
///asset to ui.Image
ui.Image image = await ImagesMergeHelper.loadImageFromAsset(assetPath);
///ImageProvider to ui.Image
ui.Image image = await ImagesMergeHelper.loadImageFromProvider(imageProvider);

ImageMerge

Use this widget to automatically merge and show images.

ImagesMerge(
  imageList,///required,images list
  direction: Axis.vertical,///direction
  backgroundColor: Colors.black26,///background color
  fit: false,///scale image to fit others
  controller: captureController,///controller to get screen shot
),

Besides, the widget was wrapped with RepaintBoundary, you can simply passing an instance of CaptureController and get the screen shot by calling capture().

///get capture of widget by RepaintBoundary
 getCapture() async{
  Uint8List bytes = await captureController.capture();
  }

LICENSE #

MIT License

[0.0.1] #

  • initial release

[1.0.0] #

  • resolve dependency, format code

[1.0.1] #

  • remove unused files

[1.0.2] #

  • update ImagesMergeHelper

[1.0.3] #

  • fix bugs of ImagesMergeHelper

example/lib/main.dart

import 'package:example/helper_page.dart';
import 'package:example/widget_page.dart';
import 'package:flutter/material.dart';

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

class MyApp extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Flutter Demo',
      theme: ThemeData(
        primarySwatch: Colors.blue,
      ),
      home: MyHomePage(title: 'Example Home 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> {
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: Text(widget.title),
      ),
      body: Center(
        child: Column(
          mainAxisAlignment: MainAxisAlignment.center,
          children: <Widget>[
            RaisedButton(
                onPressed: _toWidget,
                child: Text(
                  "ImagesMerge Widget",
                  style: Theme.of(context).textTheme.title,
                )),
            SizedBox(
              height: 30,
            ),
            RaisedButton(
                onPressed: _toHelper,
                child: Text(
                  "ImagesMerge Helper",
                  style: Theme.of(context).textTheme.title,
                )),
          ],
        ),
      ),
    );
  }

  _toWidget() {
    Navigator.push(context,
        MaterialPageRoute(builder: (context) => ImagesMergeWidgetPage()));
  }

  _toHelper() {
    Navigator.push(context,
        MaterialPageRoute(builder: (context) => ImagesMergeHelperPage()));
  }
}

Use this package as a library

1. Depend on it

Add this to your package's pubspec.yaml file:


dependencies:
  merge_images: ^1.0.3

2. Install it

You can install packages from the command line:

with Flutter:


$ flutter pub get

Alternatively, your editor might support flutter pub get. Check the docs for your editor to learn more.

3. Import it

Now in your Dart code, you can use:


import 'package:merge_images/merge_images.dart';
  
Popularity:
Describes how popular the package is relative to other packages. [more]
56
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]
78
Learn more about scoring.

We analyzed this package on Jul 11, 2020, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.8.4
  • pana: 0.13.14
  • Flutter: 1.17.5

Analysis suggestions

Package does not support Flutter platform android

Because:

  • package:merge_images/merge_images.dart that imports:
  • package:merge_images/src/images_merge_helper.dart that imports:
  • package:path_provider/path_provider.dart that imports:
  • package:path_provider_linux/path_provider_linux.dart that declares support for platforms: linux

Package does not support Flutter platform ios

Because:

  • package:merge_images/merge_images.dart that imports:
  • package:merge_images/src/images_merge_helper.dart that imports:
  • package:path_provider/path_provider.dart that imports:
  • package:path_provider_linux/path_provider_linux.dart that declares support for platforms: linux

Package does not support Flutter platform macos

Because:

  • package:merge_images/merge_images.dart that imports:
  • package:merge_images/src/images_merge_helper.dart that imports:
  • package:path_provider/path_provider.dart that imports:
  • package:path_provider_linux/path_provider_linux.dart that declares support for platforms: linux

Package does not support Flutter platform web

Because:

  • package:merge_images/merge_images.dart that imports:
  • package:merge_images/src/images_merge_helper.dart that imports:
  • package:path_provider/path_provider.dart that declares support for platforms: android, ios, linux, macos

Package does not support Flutter platform windows

Because:

  • package:merge_images/merge_images.dart that imports:
  • package:merge_images/src/images_merge_helper.dart that imports:
  • package:path_provider/path_provider.dart that declares support for platforms: android, ios, linux, macos

Package not compatible with SDK dart

Because:

  • merge_images that is a package requiring null.

Health suggestions

Format lib/src/images_merge_helper.dart.

Run flutter format to format lib/src/images_merge_helper.dart.

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.1.0 <3.0.0
flutter 0.0.0
path_provider ^1.4.0 1.6.11
Transitive dependencies
collection 1.14.12 1.14.13
file 5.2.1
intl 0.16.1
meta 1.1.8 1.2.2
path 1.7.0
path_provider_linux 0.0.1+2
path_provider_macos 0.0.4+3
path_provider_platform_interface 1.0.2
platform 2.2.1
plugin_platform_interface 1.0.2
process 3.0.13
sky_engine 0.0.99
typed_data 1.1.6 1.2.0
vector_math 2.0.8 2.1.0-nullsafety
xdg_directories 0.1.0
Dev dependencies
flutter_test