painter2 1.0.1

  • README.md
  • CHANGELOG.md
  • Example
  • Installing
  • Versions
  • 81

painter2 #

A simple flutter widget to paint with your fingers.

Features #

The widget supports:

  • Changing fore- and background color
  • Setting an image as background
  • Changing the thickness of lines you draw
  • Exporting your painting as png
  • Undo/Redo drawing a line
  • Clear the whole drawing

Installation #

In your pubspec.yaml file within your Flutter Project:

dependencies:
  painter2: any

Then import it:

import 'package:painter2/painter2.dart';

Use it #

In order to use this plugin, first create a controller:

PainterController controller = PainterController();
controller.thickness = 5.0; // Set thickness of your brush. Defaults to 1.0
controller.backgroundColor = Colors.green; // Background color is ignores if you set a background image
controller.backgroundImage = Image.network(...); // Sets a background image. You can load images as you would normally do: From an asset, from the network, from memory...

That controller will handle all properties of your drawing space.

Then, to display the painting area, create an inline Painter object and give it a reference to your previously created controller:

Painter(controller)

By exporting the painting as PNG, you will get an Uint8List object which represents the bytes of the png final file:

await controller.exportAsPNGBytes();

The library does not handle saving the final image anywhere.

Example #

For a full example take a look at the example project. Here is a short recording showing it. Note that the color picker is an external dependency which is only required for the example.

demo!

1.0.1 #

  • Removed unnecessary code

1.0.0 #

  • Added support to use background images (see the example project for more details)

0.0.1 #

  • Added redo functionality to original painter plugin
  • Updated code

example/README.md

painter2_example #

Demonstrates how to use the painter2 plugin.

Getting Started #

This project is a starting point for a Flutter application.

A few resources to get you started if this is your first Flutter project:

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

Use this package as a library

1. Depend on it

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


dependencies:
  painter2: ^1.0.1

2. Install it

You can install packages from the command line:

with Flutter:


$ flutter packages get

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

3. Import it

Now in your Dart code, you can use:


import 'package:painter2/painter2.dart';
  
Version Uploaded Documentation Archive
1.0.1 Feb 11, 2019 Go to the documentation of painter2 1.0.1 Download painter2 1.0.1 archive
1.0.0 Feb 11, 2019 Go to the documentation of painter2 1.0.0 Download painter2 1.0.0 archive
0.0.1 Feb 10, 2019 Go to the documentation of painter2 0.0.1 Download painter2 0.0.1 archive
Popularity:
Describes how popular the package is relative to other packages. [more]
62
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]
81
Learn more about scoring.

We analyzed this package on Apr 16, 2019, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.2.0
  • pana: 0.12.14
  • Flutter: 1.4.7

Platforms

Detected platforms: Flutter

References Flutter, and has no conflicting libraries.

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.1.0 <3.0.0
flutter 0.0.0
Transitive dependencies
collection 1.14.11
meta 1.1.6 1.1.7
sky_engine 0.0.99
typed_data 1.1.6
vector_math 2.0.8