digital_signature 0.0.1 copy "digital_signature: ^0.0.1" to clipboard
digital_signature: ^0.0.1 copied to clipboard

This library is used to capture a signature through drawing gestures.The widget also allows you to save a signature as an image.

This library is used to capture a signature through drawing gestures. You can use your finger, pen, or mouse on a tablet, touchscreen, etc., to draw your own signature in this SignaturePad widget. The widget also allows you to save a signature as an image.

Usage #

Create a new flutter Project

Open a Flutter project, go to pubspec.yaml file and add the following dependency

       digital_signature: ^0.0.1

Flutter pub get

Inside lib create a new dart file for digital signature

Create a digitalSignature class

Inside this class, we need to define the controller

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: size2, penColor: Colors.white);

PenStrokeWidth – initialize the pen width

PenColor – initialize the pencolor for digital signature

To convert signature to png bytes by using unit8list

late final  Uint8List? signature;

Define Digital signature pad

Center(
child: SizedBox(
height: size300,
width: size350,
child: Signature(
height: size300,
width: size350,
controller: controller,
backgroundColor: Colors.grey,
),
),
),

Export digital signature into png bytes

Future<Uint8List?> exportSignature() async {
final exportController = SignatureController(
penStrokeWidth: size2,
exportBackgroundColor: Colors.white,
penColor: Colors.black,
points: controller.points,
);

final signature = exportController.toPngBytes();

//clean up the memory
exportController.dispose();

return signature;
}

View digital signature In Image view

signature = await exportSignature();

signature!=null?Center(
child: Image.memory(signature!)
):Container()
0
likes
140
pub points
0%
popularity

Publisher

unverified uploader

This library is used to capture a signature through drawing gestures.The widget also allows you to save a signature as an image.

Repository (GitHub)
View/report issues

Documentation

API reference

License

MIT (license)

Dependencies

flutter, flutter_svg, image

More

Packages that depend on digital_signature