getFillPaint method

  1. @override
Paint getFillPaint()
override

Gets the color of the series.

Implementation

@override
Paint getFillPaint() {
  final SegmentProperties segmentProperties =
      SegmentHelper.getSegmentProperties(this);
  final CartesianChartPoint<dynamic>? currentPoint =
      segmentProperties.currentPoint;
  final bool hasPointColor =
      segmentProperties.series.pointColorMapper != null;

  /// Get and set the paint options for waterfall series.
  if (segmentProperties.series.gradient == null) {
    fillPaint = Paint()
      ..color = ((hasPointColor && currentPoint!.pointColorMapper != null)
          ? currentPoint.pointColorMapper
          : currentPoint!.isIntermediateSum!
              ? segmentProperties.intermediateSumColor ??
                  segmentProperties.color!
              : currentPoint.isTotalSum!
                  ? segmentProperties.totalSumColor ??
                      segmentProperties.color!
                  : currentPoint.yValue < 0 == true
                      ? segmentProperties.negativePointsColor ??
                          segmentProperties.color!
                      : segmentProperties.color!)!
      ..style = PaintingStyle.fill;
  } else {
    fillPaint = getLinearGradientPaint(
        segmentProperties.series.gradient!,
        segmentProperties.currentPoint!.region!,
        segmentProperties.stateProperties.requireInvertedAxis);
  }
  assert(segmentProperties.series.opacity >= 0 == true,
      'The opacity value of the waterfall series should be greater than or equal to 0.');
  assert(segmentProperties.series.opacity <= 1 == true,
      'The opacity value of the waterfall 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!;
}