The prototype states an explicit system rule (t4 line 40): "opaque list surface #102532, glass only in the chrome and in the active card." PluriGlassSurface backs nearly every card/row in the app, but always rendered translucent + blurred (glassSurface, blur 18) — the listSurface token (#102532) existed since WU1 but was only ever used at reduced alpha, never opaquely. Add a `glass` flag to PluriGlassSurface, defaulting to false: an opaque listSurface fill with no BackdropFilter. Chrome (MiniReproductor) and the active/now-playing card (Escuchar's hero, when a station is playing) opt into the old translucent look via `glass: true` — every other of the ~26 call sites needs no change and now renders opaquely. Also fix the card radius: the prototype's dominant card radius is 18 (t4 lines 512, 613, 715, 133); radiusMd was 22, a systematic +4px drift across every card that defaults to it. Retune TarjetaEmisora's own radius ternary so its compact (row) variant uses the dominant row radius, 14, instead of inheriting the card radius. S3+S4, Tier 1 visual-fidelity pass (audit id 2521).
66 lines
2.7 KiB
Dart
66 lines
2.7 KiB
Dart
import 'package:flutter/material.dart';
|
|
import 'package:flutter_test/flutter_test.dart';
|
|
import 'package:pluriwave/tema/pluriwave_tokens.dart';
|
|
|
|
/// Design ADR-1: 3 new colour fields join the existing PluriWaveTokens
|
|
/// extension (colours belong here because they must participate in lerp).
|
|
/// Dedicated file under test/tema/ so the WU1 verify command
|
|
/// (`flutter test test/tema/ ...`) discovers it; the single pre-existing
|
|
/// PluriWaveTokens assertion inside pluriwave_foundations_test.dart is left
|
|
/// untouched.
|
|
void main() {
|
|
group('PluriWaveTokens — redesign colours', () {
|
|
test('dark keeps the pre-existing base palette', () {
|
|
expect(PluriWaveTokens.dark.deepViolet, const Color(0xFF07121A));
|
|
// S4 (Tier 1 visual fidelity): the prototype's dominant card radius
|
|
// is 18 (t4 lines 512, 613, 715, 133) — radiusMd used to be 22, a
|
|
// systematic +4px drift across every card that defaults to it.
|
|
expect(PluriWaveTokens.dark.radiusMd, 18);
|
|
expect(PluriWaveTokens.dark.spacingMd, 16);
|
|
});
|
|
|
|
test(
|
|
'dark exposes listSurface and liveGreen de-literalised from theme.dart',
|
|
() {
|
|
// Design ADR-1: these match the theme's previous raw literals
|
|
// (surfaceContainerLow / secondary) exactly, so promoting them to
|
|
// named tokens keeps rendered output byte-identical.
|
|
expect(PluriWaveTokens.dark.listSurface, const Color(0xFF102532));
|
|
expect(PluriWaveTokens.dark.liveGreen, const Color(0xFF7EE4C2));
|
|
},
|
|
);
|
|
|
|
test('dark exposes offlineAccent per the proposal (#E8879A)', () {
|
|
expect(PluriWaveTokens.dark.offlineAccent, const Color(0xFFE8879A));
|
|
});
|
|
|
|
test('copyWith overrides only the new colour fields', () {
|
|
final overridden = PluriWaveTokens.dark.copyWith(
|
|
listSurface: Colors.black,
|
|
liveGreen: Colors.black,
|
|
offlineAccent: Colors.black,
|
|
);
|
|
expect(overridden.listSurface, Colors.black);
|
|
expect(overridden.liveGreen, Colors.black);
|
|
expect(overridden.offlineAccent, Colors.black);
|
|
// Untouched fields keep their original value.
|
|
expect(overridden.deepViolet, PluriWaveTokens.dark.deepViolet);
|
|
});
|
|
|
|
test('lerp interpolates listSurface, liveGreen and offlineAccent', () {
|
|
const a = PluriWaveTokens.dark;
|
|
final b = a.copyWith(
|
|
listSurface: Colors.white,
|
|
liveGreen: Colors.white,
|
|
offlineAccent: Colors.white,
|
|
);
|
|
|
|
final mid = a.lerp(b, 0.5);
|
|
|
|
expect(mid.listSurface, Color.lerp(a.listSurface, Colors.white, 0.5));
|
|
expect(mid.liveGreen, Color.lerp(a.liveGreen, Colors.white, 0.5));
|
|
expect(mid.offlineAccent, Color.lerp(a.offlineAccent, Colors.white, 0.5));
|
|
});
|
|
});
|
|
}
|