draw method
Draws the free-style path on the provided canvas
of size size
.
Implementation
@override
void draw(Canvas canvas, Size size) {
// Create a UI path to draw
final path = Path();
// Start path from the first point
path.moveTo(this.path[0].dx, this.path[0].dy);
path.lineTo(this.path[0].dx, this.path[0].dy);
// Draw a line between each point on the free path
this.path.sublist(1).forEach((point) {
path.lineTo(point.dx, point.dy);
});
// Draw the path on the canvas
canvas.drawPath(path, paint);
}