onPaint method
Draws segment in series bounds.
Implementation
@override
void onPaint(Canvas canvas) {
if (points.isEmpty || segmentRect == null) {
return;
}
final RRect? paintRRect =
RRect.lerp(_oldSegmentRect, segmentRect, animationFactor);
Paint paint = getFillPaint();
if (paint.color != Colors.transparent && !_isSameValue) {
canvas.drawRRect(paintRRect!, paint);
}
paint = getStrokePaint();
if (paint.color != Colors.transparent && paint.strokeWidth > 0) {
Path strokePath;
if (_isSameValue) {
strokePath = Path()..addRRect(paintRRect!);
} else {
strokePath = strokePathFromRRect(paintRRect, paint.strokeWidth);
}
drawDashes(canvas, series.dashArray, paint, path: strokePath);
final Offset start =
Offset.lerp(_oldPoints[0], points[0], animationFactor)!;
final Offset end =
Offset.lerp(_oldPoints[1], points[1], animationFactor)!;
drawDashes(canvas, series.dashArray, paint, start: start, end: end);
final Offset start2 =
Offset.lerp(_oldPoints[2], points[2], animationFactor)!;
final Offset end2 =
Offset.lerp(_oldPoints[3], points[3], animationFactor)!;
drawDashes(canvas, series.dashArray, paint, start: start2, end: end2);
}
}