signature 3.0.0

  • Readme
  • Changelog
  • Example
  • Installing
  • 96

signature #

pub package

A Flutter plugin providing performance optimized signature canvas with ability to set custom style, boundaries and initial state. This is native flutter implementation, so it supports all platforms.

Why #

In time of creation of this plugin, there was no available solution that had:

  • required performance on wide range of devices
  • ability to set canvas boundaries
  • ability to initialize using previously saved state

Usage #

To use this plugin, add signature as a dependency in your pubspec.yaml file.

Example #

// IMPORT PACKAGE
import 'package:signature/signature.dart';

// Initialise a controller. It will contains signature points, stroke width and pen color.
// It will allow you to interact with the widget
final SignatureController _controller = SignatureController(penStrokeWidth: 5, penColor: Colors.red);

// INITIALIZE. RESULT IS A WIDGET, SO IT CAN BE DIRECTLY USED IN BUILD METHOD 
var _signatureCanvas = Signature(
  controller: _controller,
  width: 300,
  height: 300,
  backgroundColor: Colors.lightBlueAccent,
);

// CLEAR CANVAS
_controller.clear();

// EXPORT BYTES AS PNG
// The exported image will be limited to the drawn area
_controller.toPngBytes();

// isEmpty/isNotEmpty CAN BE USED TO CHECK IF SIGNATURE HAS BEEN PROVIDED
_controller.isNotEmpty; //true if signature has been provided
_controller.isEmpty; //true if signature has NOT been provided

// EXPORT POINTS (2D POINTS ROUGHLY REPRESENTING WHAT IS VISIBLE ON CANVAS)
var exportedPoints = _controller.points;

//EXPORTED POINTS CAN BE USED TO INITIALIZE PREVIOUS CONTROLLER
final SignatureController _controller = SignatureController(points: exportedPoints);


Contribution and Support #

  • Contributions are welcome!
  • If you want to contribute code please create a PR
  • If you find a bug or want a feature, please fill an issue

3.0.0 #

  • Merged awesome controller implementation from jeanmatthieud that solves many bugs in cases where widget is not available (braking change)
  • Fixed problems when writing too fast
  • Fixed conflict between scrolling scroll container and drawing the signature

Migration from 2.x.x:

  • You have to provide SignatureController and use it to manipulate with data instead using widget itself. Api is almost same but it is now split between Signature widget and SignatureController.
  • See updated example.

2.0.1 #

  • Fixed null pointer in case that future was resolved after widget has been removed from tree on slower devices

2.0.0 #

  • Migration from android.support packages to androidx packages that allows this library to be used with flutter projects that use androidx. If you need to stay on android.support for whatever reason, don't upgrade as it may break your build. See more.

1.1.0 #

  • Fixed breaking change in Picture.toImage in latest flutter
  • New properties isEmpty and isNotEmpty at Signature class for validation purposes

1.0.3 #

  • fixed bug where canvas was not writable in case of specific boundary setup

1.0.2 #

  • removed debug statements and cleanup

1.0.1 #

  • README modifications and code reformat

1.0.0 #

  • Initial release

example/README.md

signature_example #

Demonstrates how to use the signature plugin.

Getting Started #

For help getting started with Flutter, view our online documentation.

Use this package as a library

1. Depend on it

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


dependencies:
  signature: ^3.0.0

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

We analyzed this package on Jan 21, 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

Health suggestions

Fix lib/signature.dart. (-0.50 points)

Analysis of lib/signature.dart reported 1 hint:

line 2 col 8: Unused import: 'dart:math'.

Format lib/generated/i18n.dart.

Run flutter format to format lib/generated/i18n.dart.

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.0.0-dev.68.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
Dev dependencies
flutter_test