paintSegments method

  1. @override
void paintSegments(
  1. PaintingContext context,
  2. Offset offset
)
override

Implementation

@override
void paintSegments(PaintingContext context, Offset offset) {
  if (parent != null && parent!.render != SeriesRender.normal) {
    return;
  }
  if (segments.isNotEmpty) {
    context.canvas.save();
    context.canvas.clipRect(paintBounds);
    if (canFindLinearVisibleIndexes) {
      if (visibleIndexes.isNotEmpty) {
        final int start = visibleIndexes[0];
        final int end = visibleIndexes[1];
        final int segmentsCount = segments.length;
        for (int i = start; i <= end && i > -1; i++) {
          if (i < segmentsCount) {
            final ChartSegment segment = segments[i];
            segment.animationFactor = segmentAnimationFactor;
            segment.onPaint(context.canvas);
          }
        }
      }
    } else {
      for (final int index in visibleIndexes) {
        final ChartSegment segment = segments[index];
        segment.animationFactor = segmentAnimationFactor;
        segment.onPaint(context.canvas);
      }
    }
    context.canvas.restore();
  }
}