signature 1.0.3

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

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';

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

// CLEAR CANVAS
_signatureCanvas.clear();

// EXPORT BYTES (EXPORTING FORMAT IS PNG)
_signatureCanvas.exportBytes();

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

//EXPORTED POINTS CAN BE USED TO INITIALIZE PREVIOUS STATE VIA CONSTRUCTOR
var _signatureCanvas = Signature(
  points: exportedPoints,
  width: 300,
  height: 300,
  backgroundColor: Colors.lightBlueAccent,
);

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

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/lib/main.dart

import 'dart:ui';

import 'package:flutter/material.dart';
import 'package:signature/signature.dart';

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

class MyApp extends StatefulWidget {
  @override
  _MyAppState createState() => _MyAppState();
}

class _MyAppState extends State<MyApp> {
  var _signatureCanvas = Signature(
    height: 300,
    backgroundColor: Colors.lightBlueAccent,
  );

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: Builder(
        builder: (context) => Scaffold(
              body: Column(
                mainAxisAlignment: MainAxisAlignment.center,
                children: <Widget>[
                  //SIGNATURE CANVAS
                  _signatureCanvas,
                  //OK AND CLEAR BUTTONS
                  Container(
                      decoration: const BoxDecoration(
                        color: Colors.black,
                      ),
                      child: Row(
                        mainAxisAlignment: MainAxisAlignment.spaceEvenly,
                        mainAxisSize: MainAxisSize.max,
                        children: <Widget>[
                          //SHOW EXPORTED IMAGE IN NEW ROUTE
                          IconButton(
                            icon: const Icon(Icons.check),
                            color: Colors.blue,
                            onPressed: () async {
                              var data = await _signatureCanvas.exportBytes();
                              Navigator.of(context).push(
                                MaterialPageRoute(
                                  builder: (BuildContext context) {
                                    return Scaffold(
                                      appBar: AppBar(),
                                      body: Container(
                                        color: Colors.grey[300],
                                        child: Image.memory(data),
                                      ),
                                    );
                                  },
                                ),
                              );
                            },
                          ),
                          //CLEAR CANVAS
                          IconButton(
                            icon: const Icon(Icons.clear),
                            color: Colors.blue,
                            onPressed: () {
                              setState(() {
                                return _signatureCanvas.clear();
                              });
                            },
                          ),
                        ],
                      )),
                ],
              ),
            ),
      ),
    );
  }
}

Use this package as a library

1. Depend on it

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


dependencies:
  signature: ^1.0.3

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:signature/signature.dart';
  
Version Uploaded Documentation Archive
1.0.3 Oct 23, 2018 Go to the documentation of signature 1.0.3 Download signature 1.0.3 archive
1.0.2 Oct 23, 2018 Go to the documentation of signature 1.0.2 Download signature 1.0.2 archive
1.0.1 Oct 23, 2018 Go to the documentation of signature 1.0.1 Download signature 1.0.1 archive
1.0.0 Oct 23, 2018 Go to the documentation of signature 1.0.0 Download signature 1.0.0 archive
Popularity:
Describes how popular the package is relative to other packages. [more]
65
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]
82
Learn more about scoring.

We analyzed this package on Nov 14, 2018, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.0.0
  • pana: 0.12.6
  • Flutter: 0.11.3

Platforms

Detected platforms: Flutter

References Flutter, and has no conflicting libraries.

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
meta 1.1.6
sky_engine 0.0.99
typed_data 1.1.6
vector_math 2.0.8
Dev dependencies
flutter_test