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).
79 lines
2.4 KiB
Dart
79 lines
2.4 KiB
Dart
import 'dart:ui';
|
|
|
|
import 'package:flutter/material.dart';
|
|
|
|
import '../tema/pluriwave_theme.dart';
|
|
|
|
/// S3+S4 (Tier 1 visual fidelity): the prototype's own system rule (`t4`
|
|
/// line 40, verbatim) — "Superficie de lista opaca #102532, cristal solo en
|
|
/// el cromo y en la tarjeta activa" ("Opaque list surface #102532, glass
|
|
/// only in the chrome and in the active card"). This primitive backs nearly
|
|
/// every card/row in the app, so [glass] defaults to `false`: an OPAQUE
|
|
/// [PluriWaveTokens.listSurface] fill, no blur. Pass `glass: true` for the
|
|
/// rule's two named exceptions — chrome (e.g. `MiniReproductor`) and the
|
|
/// active/now-playing card (Escuchar's `_EscucharHero`) — to keep the
|
|
/// original translucent, blurred look there.
|
|
class PluriGlassSurface extends StatelessWidget {
|
|
const PluriGlassSurface({
|
|
super.key,
|
|
required this.child,
|
|
this.padding = const EdgeInsets.all(16),
|
|
this.borderRadius,
|
|
this.blurSigma = 18,
|
|
this.glowColor,
|
|
this.glass = false,
|
|
});
|
|
|
|
final Widget child;
|
|
final EdgeInsetsGeometry padding;
|
|
final BorderRadius? borderRadius;
|
|
final double blurSigma;
|
|
final Color? glowColor;
|
|
|
|
/// See class doc — `false` (opaque `listSurface`) is the system default.
|
|
final bool glass;
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
final t = context.pluriTokens;
|
|
final radius = borderRadius ?? BorderRadius.circular(t.radiusMd);
|
|
final decoratedChild = DecoratedBox(
|
|
decoration: BoxDecoration(
|
|
color: glass ? t.glassSurface : t.listSurface,
|
|
borderRadius: radius,
|
|
border: Border.all(
|
|
color: glass ? t.glassBorder : Colors.white.withValues(alpha: 0.07),
|
|
),
|
|
boxShadow:
|
|
glass
|
|
? [
|
|
BoxShadow(
|
|
color: glowColor ?? t.glowColor.withValues(alpha: 0.12),
|
|
blurRadius: 30,
|
|
spreadRadius: -14,
|
|
offset: const Offset(0, 18),
|
|
),
|
|
]
|
|
: null,
|
|
),
|
|
child: Padding(padding: padding, child: child),
|
|
);
|
|
|
|
if (!glass) {
|
|
return RepaintBoundary(
|
|
child: ClipRRect(borderRadius: radius, child: decoratedChild),
|
|
);
|
|
}
|
|
|
|
return RepaintBoundary(
|
|
child: ClipRRect(
|
|
borderRadius: radius,
|
|
child: BackdropFilter(
|
|
filter: ImageFilter.blur(sigmaX: blurSigma, sigmaY: blurSigma),
|
|
child: decoratedChild,
|
|
),
|
|
),
|
|
);
|
|
}
|
|
}
|