paint method
void
paint(
- Canvas canvas,
- Size size,
- WorldToScreen worldToScreen,
- ScreenToWorld screenToWorld,
- double scale,
override
Implementation
@override
void paint(
Canvas canvas,
Size size,
WorldToScreen worldToScreen,
ScreenToWorld screenToWorld,
double scale,
) {
if (worldPoints.length < 2) return;
final strokePaint = Paint()
..color = color
..strokeWidth = strokeWidth
..style = PaintingStyle.stroke
..strokeCap = cap
..strokeJoin = StrokeJoin.round;
final strokePath = Path()
..moveTo(
worldToScreen(worldPoints[0].dx, worldPoints[0].dy).dx,
worldToScreen(worldPoints[0].dx, worldPoints[0].dy).dy,
);
for (int i = 1; i < worldPoints.length; i++) {
final currentScreenPoint = worldToScreen(
worldPoints[i].dx,
worldPoints[i].dy,
);
strokePath.lineTo(currentScreenPoint.dx, currentScreenPoint.dy);
}
canvas.drawPath(strokePath, strokePaint);
}