// lib/ui/branding/feature_graphic_painter.dart
import 'package:flutter/material.dart';

import 'app_icon_painter.dart';

/// Paints the Play feature graphic (1024×500): navy field, the brand blocks on
/// the left, wordmark + tagline on the right.
class FeatureGraphic {
  static void paint(Canvas canvas, Size size) {
    final rect = Offset.zero & size;
    AppIconMark.paintBackground(canvas, rect);

    // Blocks on the left, vertically centered.
    canvas.save();
    final blockArea = size.height * 0.74;
    canvas.translate(size.height * 0.16, (size.height - blockArea) / 2);
    AppIconMark.paintBlocks(canvas, blockArea, groupFraction: 0.92);
    canvas.restore();

    // Text column begins just right of the blocks; kept within the 1024 width.
    final textLeft = size.height * 0.94;
    void text(String s, double dy, double fontSize, Color c) {
      final tp = TextPainter(
        text: TextSpan(
          text: s,
          style: TextStyle(
            color: c,
            fontSize: fontSize,
            fontFamily: 'TitanOne',
            letterSpacing: 0.5,
          ),
        ),
        textDirection: TextDirection.ltr,
      )..layout(maxWidth: size.width - textLeft - size.height * 0.06);
      tp.paint(canvas, Offset(textLeft, dy));
    }

    text('Block Seasons', size.height * 0.33, 56, Colors.white);
    text('A new season of blocks,\nevery few weeks.', size.height * 0.56, 22,
        const Color(0xFFB9C4E6));
  }
}
