onPaint method

  1. @override
void onPaint(
  1. Canvas canvas
)
override

Draws segment in series bounds.

Implementation

@override
void onPaint(Canvas canvas) {
  if (points.isEmpty || points.length != 2) {
    return;
  }

  final Paint paint = getStrokePaint();
  if (paint.color == Colors.transparent || paint.strokeWidth < 0) {
    return;
  }

  final Offset start;
  final Offset end;
  if (animationFactor < 1) {
    start = Offset.lerp(_oldPoints[0], points[0], animationFactor)!;
    end = Offset.lerp(_oldPoints[1], points[1], animationFactor)!;
  } else {
    start = points[0];
    end = points[1];
  }

  if (start.isNaN || end.isNaN) {
    return;
  }
  drawDashes(canvas, series.dashArray, paint, start: start, end: end);
}