paint method

  1. @override
void paint(
  1. Canvas canvas,
  2. Size size,
  3. List<CubicPath> paths
)
override

Paints the given paths onto the canvas.

canvas The canvas to draw on. size The size of the canvas. paths A list of CubicPath objects representing the signature to be drawn.

Implementation

@override
void paint(Canvas canvas, Size size, List<CubicPath> paths) {
  final paint = Paint()
    ..color = color
    ..style = PaintingStyle.stroke
    ..strokeCap = StrokeCap.round
    ..strokeJoin = StrokeJoin.round
    ..strokeWidth = width;

  for (final path in paths) {
    if (path.isFilled) {
      canvas.drawPath(PathUtil.toLinePath(path.lines), paint);
    }
  }
}