paintSliceShadow static method

void paintSliceShadow(
  1. Canvas canvas,
  2. WheelFrameGeometry geometry, {
  3. double strength = 0.33,
})

Paints a soft shadow on the outer edge of the slices, so they look set into the frame.

Implementation

static void paintSliceShadow(Canvas canvas, WheelFrameGeometry geometry,
    {double strength = 0.33}) {
  final double r = geometry.sliceRadius;
  if (r <= 0) return;
  final double start = max(0.0, (r - geometry.radius * 0.09) / r);
  final Color dark = Color.fromRGBO(0, 0, 0, strength);
  canvas.drawCircle(
    geometry.center,
    r,
    Paint()
      ..shader = RadialGradient(
        colors: [const Color(0x00000000), const Color(0x00000000), dark],
        stops: [0.0, start, 1.0],
      ).createShader(geometry.circle(r)),
  );
}