onPaint method

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

Draws segment in series bounds.

Implementation

@override
void onPaint(Canvas canvas) {
  if (series.isTrackVisible) {
    // Draws the tracker bounds.
    super.onPaint(canvas);
  }

  if (segmentRect == null) {
    return;
  }

  final RRect? paintRRect =
      RRect.lerp(_oldSegmentRect, segmentRect, animationFactor);
  if (paintRRect == null) {
    return;
  }

  Paint paint = getFillPaint();
  if (paint.color != Colors.transparent && !paintRRect.isEmpty) {
    canvas.drawRRect(paintRRect, paint);
  }

  paint = getStrokePaint();
  final double strokeWidth = paint.strokeWidth;
  if (paint.color != Colors.transparent && strokeWidth > 0) {
    final Path strokePath = strokePathFromRRect(paintRRect, strokeWidth);
    drawDashes(canvas, series.dashArray, paint, path: strokePath);
  }
}