onPaint method

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

Draws segment in series bounds.

Implementation

@override
void onPaint(Canvas canvas) {
  if (points.isEmpty) {
    return;
  }

  final Paint paint = getStrokePaint();
  if (paint.color != Colors.transparent && paint.strokeWidth > 0) {
    Offset start = Offset.lerp(_oldPoints[0], points[0], animationFactor)!;
    Offset end = Offset.lerp(_oldPoints[1], points[1], animationFactor)!;
    drawDashes(canvas, series.dashArray, paint, start: start, end: end);

    start = Offset.lerp(_oldPoints[2], points[2], animationFactor)!;
    end = Offset.lerp(_oldPoints[3], points[3], animationFactor)!;
    drawDashes(canvas, series.dashArray, paint, start: start, end: end);

    start = Offset.lerp(_oldPoints[4], points[4], animationFactor)!;
    end = Offset.lerp(_oldPoints[5], points[5], animationFactor)!;
    drawDashes(canvas, series.dashArray, paint, start: start, end: end);

    if (_isSameValue && series.showIndicationForSameValues) {
      start = Offset.lerp(_oldPoints[6], points[6], animationFactor)!;
      end = Offset.lerp(_oldPoints[7], points[7], animationFactor)!;
      drawDashes(canvas, series.dashArray, paint, start: start, end: end);
    }
  }
}