signature_pad_flutter 1.0.0

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

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.0.0

2. Install it

You can install packages from the command line:

with pub:


$ pub get

with Flutter:


$ flutter pub get

Alternatively, your editor might support pub get or 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_pad_flutter/signature_pad_flutter.dart';
  
Version Uploaded Documentation Archive
1.3.0 Jan 23, 2019 Go to the documentation of signature_pad_flutter 1.3.0 Download signature_pad_flutter 1.3.0 archive
1.2.0 Aug 21, 2018 Go to the documentation of signature_pad_flutter 1.2.0 Download signature_pad_flutter 1.2.0 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]
74
Health:
Code health derived from static analysis. [more]
--
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
--
Overall:
Weighted score of the above. [more]
37
Learn more about scoring.

The package version is not analyzed, because it does not support Dart 2. Until this is resolved, the package will receive a health and maintenance score of 0.

Analysis 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://dart.dev/dart-2#migration.

Maintenance issues and suggestions

Make sure dartdoc successfully runs on your package's source files. (-10 points)

Dependencies were not resolved.

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=1.23.0 <2.0.0