paintFront method

  1. @override
void paintFront(
  1. Canvas canvas,
  2. WheelFrameGeometry geometry
)
override

Paints the part of the frame in front of the slices.

Implementation

@override
void paintFront(Canvas canvas, WheelFrameGeometry geometry) {
  final g = geometry;
  final double inner = _inner(g);
  final double band = g.outer - inner;
  if (shadow) WheelFrame.paintSliceShadow(canvas, g, strength: 0.4);

  // Polished gold: bright and dark streaks sweeping round the ring.
  final Rect bounds = g.circle(g.outer);
  canvas.drawPath(
    g.ring(inner, g.outer),
    Paint()
      ..shader = SweepGradient(
        colors: [
          _light, goldColor, _dark, goldColor, _light, goldColor, //
          _dark, goldColor, _light,
        ],
      ).createShader(bounds),
  );

  if (band > 0) {
    // A raised lip on each edge and a groove through the middle.
    final Paint lip = Paint()
      ..style = PaintingStyle.stroke
      ..strokeWidth = band * 0.14
      ..shader = LinearGradient(
        begin: Alignment.topLeft,
        end: Alignment.bottomRight,
        colors: [_light, goldColor, _dark],
      ).createShader(bounds);
    canvas.drawCircle(g.center, g.outer - band * 0.07, lip);
    canvas.drawCircle(g.center, inner + band * 0.07, lip);
    canvas.drawCircle(
      g.center,
      inner + band * 0.5,
      Paint()
        ..style = PaintingStyle.stroke
        ..strokeWidth = max(1.0, band * 0.04)
        ..color = _dark.withValues(alpha: 0.6),
    );
    _paintJewels(canvas, g, inner, band);
  }

  // A fine dark line where the gold meets the slices.
  canvas.drawCircle(
    g.center,
    inner,
    Paint()
      ..style = PaintingStyle.stroke
      ..strokeWidth = max(1.0, g.radius * 0.006)
      ..color = const Color(0x66000000),
  );
}