getFillPaint method

  1. @override
Paint getFillPaint()
override

Gets the color of the series.

Implementation

@override
Paint getFillPaint() {
  _setSegmentProperties();
  final SegmentProperties bubbleSegmentProperties = _segmentProperties;
  final bool hasPointColor =
      bubbleSegmentProperties.series.pointColorMapper != null;
  if (bubbleSegmentProperties.series.gradient == null) {
    if (bubbleSegmentProperties.color != null) {
      fillPaint = Paint()
        ..color = (bubbleSegmentProperties.currentPoint!.isEmpty ?? false)
            ? bubbleSegmentProperties.series.emptyPointSettings.color
            : ((hasPointColor &&
                    bubbleSegmentProperties.currentPoint!.pointColorMapper !=
                        null)
                ? bubbleSegmentProperties.currentPoint!.pointColorMapper!
                : bubbleSegmentProperties.color!)
        ..style = PaintingStyle.fill;
    }
  } else {
    fillPaint = getLinearGradientPaint(
        bubbleSegmentProperties.series.gradient!,
        bubbleSegmentProperties.currentPoint!.region!,
        SeriesHelper.getSeriesRendererDetails(
                bubbleSegmentProperties.seriesRenderer)
            .stateProperties
            .requireInvertedAxis);
  }
  assert(bubbleSegmentProperties.series.opacity >= 0,
      'The opacity value of the bubble series should be greater than or equal to 0.');
  assert(bubbleSegmentProperties.series.opacity <= 1,
      'The opacity value of the bubble series should be less than or equal to 1.');
  if (fillPaint?.color != null) {
    fillPaint!.color = (bubbleSegmentProperties.series.opacity < 1 &&
            fillPaint!.color != Colors.transparent)
        ? fillPaint!.color.withOpacity(bubbleSegmentProperties.series.opacity)
        : fillPaint!.color;
  }
  bubbleSegmentProperties.defaultFillColor = fillPaint;
  setShader(_segmentProperties, fillPaint!);
  return fillPaint!;
}