onPaint method
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;
}
RRect? paintRRect;
if (series.parent!.isLegendToggled &&
_oldSegmentRect != null &&
series.animationType != AnimationType.loading) {
paintRRect = performLegendToggleAnimation(
series, segmentRect!, _oldSegmentRect!, series.borderRadius);
} else {
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);
}
}