paint method

void paint (Canvas canvas, Rect rect)

Paints the thumb onto the given canvas in the given rectangle.

Consider using radius and extension when deciding how large a rectangle to use for the thumb.

Implementation

void paint(Canvas canvas, Rect rect) {
  final RRect rrect = RRect.fromRectAndRadius(
    rect,
    Radius.circular(rect.shortestSide / 2.0),
  );

  canvas.drawRRect(rrect, _shadowPaint);
  canvas.drawRRect(rrect.shift(const Offset(0.0, 3.0)), _shadowPaint);
  canvas.drawRRect(rrect, Paint()..color = color);
}