feat: glossy tile rendering and per-season theme colors
Introduces candy-gloss tile rendering (diagonal gradient + glass highlight + optional glow) via a shared paintGlossyTile() in tile_painter.dart, applied to board filled-cells and tray/drag-overlay pieces. Adds ThemeColors to palette.dart for UI-layer season color resolution, and activeThemeProvider for one-call access to the active season's theme. Regenerates the game_screen golden to reflect the new look.
This commit is contained in:
@@ -0,0 +1,47 @@
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
Color lighten(Color c, double amount) => Color.lerp(c, Colors.white, amount)!;
|
||||
Color darken(Color c, double amount) => Color.lerp(c, Colors.black, amount)!;
|
||||
|
||||
/// Candy-gloss tile: diagonal gradient body, glass top highlight, optional
|
||||
/// colored glow (used for gems and clear flashes). Shared by the board,
|
||||
/// tray, and drag overlay so every tile in the game matches.
|
||||
void paintGlossyTile(
|
||||
Canvas canvas,
|
||||
Rect rect,
|
||||
Color color, {
|
||||
double radiusFactor = 0.18,
|
||||
double glow = 0,
|
||||
}) {
|
||||
final radius = Radius.circular(rect.width * radiusFactor);
|
||||
final rrect = RRect.fromRectAndRadius(rect, radius);
|
||||
|
||||
if (glow > 0) {
|
||||
final glowPaint = Paint()
|
||||
..color = color.withValues(alpha: 0.55 * glow)
|
||||
..maskFilter =
|
||||
MaskFilter.blur(BlurStyle.normal, rect.width * 0.28 * glow);
|
||||
canvas.drawRRect(rrect.inflate(rect.width * 0.05), glowPaint);
|
||||
}
|
||||
|
||||
final body = Paint()
|
||||
..shader = LinearGradient(
|
||||
begin: Alignment.topLeft,
|
||||
end: Alignment.bottomRight,
|
||||
colors: [lighten(color, 0.28), color, darken(color, 0.22)],
|
||||
stops: const [0.0, 0.45, 1.0],
|
||||
).createShader(rect);
|
||||
canvas.drawRRect(rrect, body);
|
||||
|
||||
final highlight = Paint()..color = Colors.white.withValues(alpha: 0.30);
|
||||
final hl = Rect.fromLTWH(
|
||||
rect.left + rect.width * 0.10,
|
||||
rect.top + rect.height * 0.07,
|
||||
rect.width * 0.80,
|
||||
rect.height * 0.30,
|
||||
);
|
||||
canvas.drawRRect(
|
||||
RRect.fromRectAndRadius(hl, Radius.circular(rect.width * 0.12)),
|
||||
highlight,
|
||||
);
|
||||
}
|
||||
Reference in New Issue
Block a user