onPaint method
Draws segment in series bounds.
Implementation
@override
void onPaint(Canvas canvas) {
_setSegmentProperties();
final SegmentProperties bubbleSegmentProperties = _segmentProperties;
bubbleSegmentProperties.segmentRect = RRect.fromRectAndRadius(
bubbleSegmentProperties.currentPoint!.region!, Radius.zero);
final SeriesRendererDetails seriesRendererDetails =
SeriesHelper.getSeriesRendererDetails(
bubbleSegmentProperties.seriesRenderer);
if (seriesRendererDetails.stateProperties.renderingDetails.widgetNeedUpdate == true &&
seriesRendererDetails.reAnimate == false &&
seriesRendererDetails
.stateProperties.renderingDetails.isLegendToggled ==
false &&
seriesRendererDetails.stateProperties.oldSeriesRenderers.isNotEmpty ==
true &&
bubbleSegmentProperties.oldSeriesRenderer != null &&
SeriesHelper.getSeriesRendererDetails(
bubbleSegmentProperties.oldSeriesRenderer!)
.segments
.isNotEmpty ==
true &&
SeriesHelper.getSeriesRendererDetails(
bubbleSegmentProperties.oldSeriesRenderer!)
.segments[0] is BubbleSegment &&
bubbleSegmentProperties.series.animationDuration > 0 &&
bubbleSegmentProperties.oldPoint != null) {
final BubbleSegment currentSegment =
seriesRendererDetails.segments[currentSegmentIndex!] as BubbleSegment;
final SegmentProperties seriesSegmentProperties =
SegmentHelper.getSegmentProperties(currentSegment);
final SeriesRendererDetails oldSeriesDetails =
SeriesHelper.getSeriesRendererDetails(
seriesSegmentProperties.oldSeriesRenderer!);
final BubbleSegment? oldSegment =
(oldSeriesDetails.segments.length - 1 >= currentSegmentIndex! == true)
? oldSeriesDetails.segments[currentSegmentIndex!]
as BubbleSegment?
: null;
animateBubbleSeries(
canvas,
_centerX,
_centerY,
oldSegment?._centerX,
oldSegment?._centerY,
oldSegment?._size,
animationFactor,
_radius,
strokePaint!,
fillPaint!,
bubbleSegmentProperties.seriesRenderer);
} else {
canvas.drawCircle(
Offset(_centerX, _centerY), _radius * animationFactor, fillPaint!);
canvas.drawCircle(
Offset(_centerX, _centerY), _radius * animationFactor, strokePaint!);
}
}