getStrokePaint method

  1. @override
Paint getStrokePaint()
override

Gets the stroke color of the series.

Implementation

@override
Paint getStrokePaint() {
  _setSegmentProperties();

  final Paint strokePaint = Paint();
  assert(_segmentProperties.series.opacity >= 0 == true,
      'The opacity value of the fast line series should be greater than or equal to 0.');
  assert(_segmentProperties.series.opacity <= 1 == true,
      'The opacity value of the fast line series should be less than or equal to 1.');
  if (_segmentProperties.series.gradient == null) {
    if (_segmentProperties.strokeColor != null) {
      strokePaint.color = (_segmentProperties.series.opacity < 1 == true &&
              _segmentProperties.strokeColor != Colors.transparent)
          ? _segmentProperties.strokeColor!
              .withOpacity(_segmentProperties.series.opacity)
          : _segmentProperties.strokeColor!;
    }
  } else {
    final SeriesRendererDetails seriesRendererDetails =
        SeriesHelper.getSeriesRendererDetails(
            _segmentProperties.seriesRenderer);
    strokePaint.shader = _segmentProperties.series.gradient!
        .createShader(seriesRendererDetails.segmentPath!.getBounds());
  }
  strokePaint.strokeWidth = _segmentProperties.strokeWidth!;
  strokePaint.style = PaintingStyle.stroke;
  strokePaint.strokeCap = StrokeCap.round;
  _segmentProperties.defaultStrokeColor = strokePaint;
  setShader(_segmentProperties, strokePaint);
  return strokePaint;
}