paintPanel method

  1. @override
void paintPanel(
  1. Canvas canvas,
  2. Rect rect
)
override

Paints the panel filling rect.

Implementation

@override
void paintPanel(Canvas canvas, Rect rect) {
  if (rect.isEmpty) return;
  final radius = Radius.circular((rect.shortestSide * 0.08).clamp(4.0, 12.0));
  final window = RRect.fromRectAndRadius(rect, radius);
  canvas
    ..drawRRect(window.inflate(3), Paint()..color = bezel)
    ..drawRRect(window, Paint()..color = panel);
  // Inner shadow: the window sits below the bezel, lit from above.
  final depth = (rect.shortestSide * 0.03).clamp(2.0, 5.0);
  canvas
    ..save()
    ..clipRRect(window)
    ..drawRRect(
      window.shift(Offset(0, depth * 0.8)).inflate(depth * 1.5),
      Paint()
        ..style = PaintingStyle.stroke
        ..strokeWidth = depth * 3
        ..color = Color(vfd ? 0x8C000000 : 0x40000000)
        ..maskFilter = MaskFilter.blur(BlurStyle.normal, depth),
    )
    ..restore();
}