getFillPaint method

  1. @override
Paint getFillPaint()
override

Gets the color of the series.

Implementation

@override
Paint getFillPaint() {
  final SegmentProperties segmentProperties =
      SegmentHelper.getSegmentProperties(this);
  fillPaint = Paint();
  if (segmentProperties.series.gradient == null) {
    if (segmentProperties.color != null) {
      fillPaint!.color = segmentProperties.color!;
      fillPaint!.style = PaintingStyle.fill;
    }
  } else {
    // ignore: unnecessary_null_comparison
    fillPaint = (segmentProperties.pathRect != null)
        ? getLinearGradientPaint(
            segmentProperties.series.gradient!,
            segmentProperties.pathRect!,
            segmentProperties.stateProperties.requireInvertedAxis)
        : fillPaint;
  }
  assert(segmentProperties.series.opacity >= 0 == true,
      'The opacity value of the the step area series should be greater than or equal to 0.');
  assert(segmentProperties.series.opacity <= 1 == true,
      'The opacity value of the the step area series should be less than or equal to 1.');
  fillPaint!.color = (segmentProperties.series.opacity < 1 == true &&
          fillPaint!.color != Colors.transparent)
      ? fillPaint!.color.withOpacity(segmentProperties.series.opacity)
      : fillPaint!.color;
  segmentProperties.defaultFillColor = fillPaint;
  setShader(segmentProperties, fillPaint!);
  return fillPaint!;
}