signature_pad_flutter 1.1.0

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

signature_pad_flutter

Flutter package for signature_pad

Getting Started

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

For help on editing package code, view the documentation.

[1.0.0] - 7/5/2018.

  • Dart 2 support
  • API support for flutter

example/lib/main.dart

import 'dart:async';

import 'package:flutter/material.dart';
import 'package:signature_pad/signature_pad.dart';
import 'package:signature_pad_flutter/signature_pad_flutter.dart';

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

class MyApp extends StatelessWidget {
  Widget build(BuildContext context) {
    return new MaterialApp(
      home: new Scaffold(
        body: new Container(
          color: Colors.grey[300],
          child: new SafeArea(
            child: Padding(
              padding: const EdgeInsets.all(8.0),
              child: new SignaturePadExample(),
            ),
          ),
        ),
      ),
    );
  }
}

class SignaturePadExample extends StatefulWidget {
  State<StatefulWidget> createState() {
    return new SignaturePadExampleState();
  }
}

class SignaturePadExampleState extends State<SignaturePadExample> {
  SignaturePadController _padController;
  void initState() {
    _padController = new SignaturePadController();
  }

  Widget build(BuildContext context) {
    var signaturePad = new SignaturePadWidget(
      _padController,
      new SignaturePadOptions(
          dotSize: 5.0,
          minWidth: 1.0,
          maxWidth: 4.0,
          penColor: "#000000",
          signatureText: "Signed by Ringo Starr on Jan 1, 1962"),
    );
    return new Container(
      child: new Column(
        mainAxisAlignment: MainAxisAlignment.center,
        children: <Widget>[
          new Row(
            mainAxisAlignment: MainAxisAlignment.center,
            children: [
              new Expanded(
                child: new Container(
                  height: 200.0,
                  child: new Center(
                    child: new AspectRatio(
                      aspectRatio: 3.0 / 1.0,
                      child: new Container(
                        decoration: new BoxDecoration(
                          color: Colors.white,
                          border: new Border.all(),
                        ),
                        child: signaturePad,
                      ),
                    ),
                  ),
                ),
              ),
            ],
          ),
          Padding(
            padding: const EdgeInsets.only(top: 8.0),
            child: new Row(
              mainAxisAlignment: MainAxisAlignment.spaceAround,
              children: <Widget>[
                new RaisedButton(
                  onPressed: _handleClear,
                  child: new Text("Clear"),
                  color: Colors.white,
                  textColor: Colors.black,
                ),
                new RaisedButton(
                  onPressed: _handleSavePng,
                  child: new Text("Save as PNG"),
                  color: Colors.white,
                  textColor: Colors.black,
                ),
              ],
            ),
          ),
        ],
      ),
    );
  }

  void _handleClear() {
    _padController.clear();
  }

  Future _handleSavePng() async {
    var result = await _padController.toPng();
    Navigator.of(context).push(
          new MaterialPageRoute(
            builder: (BuildContext context) {
              return new Scaffold(
                appBar: new AppBar(
                  backgroundColor: Colors.grey[700],
                ),
                backgroundColor: Colors.grey[300],
                body: new Center(
                  child: new Container(
                    decoration: new BoxDecoration(
                      border: new Border.all(),
                      color: Colors.white,
                    ),
                    padding: new EdgeInsets.all(4.0),
                    margin: new EdgeInsets.all(4.0),
                    child: new Image.memory(result),
                  ),
                ),
              );
            },
            fullscreenDialog: true,
          ),
        );
  }
}

Use this package as a library

1. Depend on it

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


dependencies:
  signature_pad_flutter: ^1.1.0

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_pad_flutter/signature_pad_flutter.dart';
  
Version Uploaded Documentation Archive
1.1.0 Jul 6, 2018 Go to the documentation of signature_pad_flutter 1.1.0 Download signature_pad_flutter 1.1.0 archive
1.0.0 Jul 5, 2018 Go to the documentation of signature_pad_flutter 1.0.0 Download signature_pad_flutter 1.0.0 archive
Popularity:
Describes how popular the package is relative to other packages. [more]
53
Health:
Code health derived from static analysis. [more]
99
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
80
Overall:
Weighted score of the above. [more]
72
Learn more about scoring.

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

  • Dart: 2.0.0-dev.69.0
  • pana: 0.11.7
  • Flutter: 0.5.5

Platforms

Detected platforms: Flutter

References Flutter, and has no conflicting libraries.

Issues and suggestions

Support Dart 2 in pubspec.yaml.

The SDK constraint in pubspec.yaml doesn't allow the Dart 2.0.0 release. For information about upgrading it to be Dart 2 compatible, please see https://www.dartlang.org/dart-2#migration.

The description is too short.

Add more detail about the package, what it does and what is its target use case. Try to write at least 60 characters.

Format lib/src/colors.dart.

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

Format lib/src/point.dart.

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

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=1.23.0 <2.0.0
flutter 0.0.0
signature_pad ^2.0.0 2.0.0
stream_transform ^0.0.9 0.0.14+1
Transitive dependencies
collection 1.14.6 1.14.11
meta 1.1.5 1.1.6
sky_engine 0.0.99
typed_data 1.1.5 1.1.6
vector_math 2.0.6 2.0.7
Dev dependencies
test ^0.12.0