onPaint method

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

Draws segment in series bounds.

Implementation

@override
void onPaint(Canvas canvas) {
  if (segmentRect == null) {
    return;
  }

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

  Paint paint = getFillPaint();
  if (paint.color != Colors.transparent) {
    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);
  }
}