drawBarShadow method

  1. @visibleForTesting
void drawBarShadow(
  1. CanvasWrapper canvasWrapper,
  2. Path barPath,
  3. LineChartBarData barData
)

draw the main bar line's shadow by the barPath

Implementation

@visibleForTesting
void drawBarShadow(
  CanvasWrapper canvasWrapper,
  Path barPath,
  LineChartBarData barData,
) {
  if (!barData.show || barData.shadow.color.opacity == 0.0) {
    return;
  }

  _barPaint
    ..strokeCap = barData.isStrokeCapRound ? StrokeCap.round : StrokeCap.butt
    ..strokeJoin =
        barData.isStrokeJoinRound ? StrokeJoin.round : StrokeJoin.miter
    ..color = barData.shadow.color
    ..shader = null
    ..strokeWidth = barData.barWidth
    ..color = barData.shadow.color
    ..maskFilter = MaskFilter.blur(
      BlurStyle.normal,
      Utils().convertRadiusToSigma(barData.shadow.blurRadius),
    );

  barPath = barPath.toDashedPath(barData.dashArray);

  barPath = barPath.shift(barData.shadow.offset);

  canvasWrapper.drawPath(
    barPath,
    _barPaint,
  );
}