painter2 1.0.1

  • Readme
  • Changelog
  • Example
  • Installing
  • 86

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:

  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 =; // Background color is ignores if you set a background image
controller.backgroundImage =; // 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:


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.


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


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:

  painter2: ^1.0.1

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:painter2/painter2.dart';
Describes how popular the package is relative to other packages. [more]
Code health derived from static analysis. [more]
Reflects how tidy and up-to-date the package is. [more]
Weighted score of the above. [more]
Learn more about scoring.

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

  • Dart: 2.7.0
  • pana: 0.13.4
  • Flutter: 1.12.13+hotfix.5


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