onPaint method

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

Draws segment in series bounds.

Implementation

@override
void onPaint(Canvas canvas) {
  _setSegmentProperties();
  final RangeColumnSeries<dynamic, dynamic> series =
      _segmentProperties.series as RangeColumnSeries<dynamic, dynamic>;

  if (_segmentProperties.trackerFillPaint != null && series.isTrackVisible) {
    canvas.drawRRect(
        _segmentProperties.trackRect, _segmentProperties.trackerFillPaint!);
  }

  if (_segmentProperties.trackerStrokePaint != null &&
      series.isTrackVisible) {
    canvas.drawRRect(
        _segmentProperties.trackRect, _segmentProperties.trackerStrokePaint!);
  }

  if (fillPaint != null) {
    (series.animationDuration > 0 &&
            _segmentProperties
                    .stateProperties.renderingDetails.isLegendToggled ==
                false)
        ? animateRangeColumn(
            canvas,
            SeriesHelper.getSeriesRendererDetails(
                _segmentProperties.seriesRenderer),
            fillPaint!,
            segmentRect,
            _segmentProperties.oldPoint != null
                ? _segmentProperties.oldPoint!.region
                : _segmentProperties.oldRegion,
            animationFactor)
        : canvas.drawRRect(segmentRect, fillPaint!);
  }
  if (strokePaint != null) {
    final SeriesRendererDetails seriesRendererDetails =
        SeriesHelper.getSeriesRendererDetails(
            _segmentProperties.seriesRenderer);
    (seriesRendererDetails.dashArray![0] != 0 &&
            seriesRendererDetails.dashArray![1] != 0)
        ? drawDashedLine(canvas, seriesRendererDetails.dashArray!,
            strokePaint!, _segmentProperties.path)
        : (series.animationDuration > 0 &&
                _segmentProperties
                        .stateProperties.renderingDetails.isLegendToggled ==
                    false)
            ? animateRangeColumn(
                canvas,
                SeriesHelper.getSeriesRendererDetails(
                    _segmentProperties.seriesRenderer),
                strokePaint!,
                segmentRect,
                _segmentProperties.oldPoint != null
                    ? _segmentProperties.oldPoint!.region
                    : _segmentProperties.oldRegion,
                animationFactor)
            : canvas.drawRRect(segmentRect, strokePaint!);
  }
}