fix(chrome): retire PluriScreenHeader, it has no equivalent in the prototype

PluriScreenHeader was a 38-radius glass hero: an aurora banner at 24%
opacity, a black-to-transparent scrim, two radial orbs, a 120px app-mark
watermark and a 56px tri-gradient glyph badge. None of it is in the
prototype (t4) -- every root's title is plain text in its own 56px
row, which PluriRootHeader (S1) already provides. Delete the class
(and its now-orphaned _Orb helper) and its four call sites (Buscar,
Favoritos x2, Alarmas, Ajustes landed with S8).

Two of those call sites carried the hero's only functional bit besides
the title, so PluriRootHeader gains an `actions` slot (rendered before
the shared bedtime button) to keep them reachable:
  - Alarmas' create-alarm button (FilledButton.tonalIcon, unchanged
    shape, just relocated)
  - Buscar's filters entry point (the same tappable PluriStatusPill,
    just relocated)
Every other retired trailing pill (Ajustes' "Secure" status,
Favoritos' collection-count badges, Alarmas' alarm-count badge) was
purely decorative and matches the prototype by simply disappearing.

S2, Tier 1 visual-fidelity pass (audit id 2521).
This commit is contained in:
2026-07-29 21:29:49 +02:00
parent 7ebe0b77a4
commit 97e38becfe
8 changed files with 268 additions and 282 deletions
@@ -0,0 +1,173 @@
import 'dart:io';
import 'package:flutter/material.dart';
import 'package:flutter_test/flutter_test.dart';
import 'package:pluriwave/estado/estado_alarmas.dart';
import 'package:pluriwave/estado/estado_busqueda.dart';
import 'package:pluriwave/estado/estado_ecualizador.dart';
import 'package:pluriwave/estado/estado_grabacion.dart';
import 'package:pluriwave/estado/estado_idioma.dart';
import 'package:pluriwave/estado/estado_radio.dart';
import 'package:pluriwave/l10n/gen/app_localizations.dart';
import 'package:pluriwave/pantallas/pantalla_ajustes.dart';
import 'package:pluriwave/pantallas/pantalla_alarmas.dart';
import 'package:pluriwave/pantallas/pantalla_buscar.dart';
import 'package:pluriwave/pantallas/pantalla_favoritos.dart';
import 'package:pluriwave/servicios/servicio_alarmas.dart';
import 'package:pluriwave/widgets/pluri_root_header.dart';
import 'package:provider/provider.dart';
import 'package:shared_preferences/shared_preferences.dart';
import '../helpers/fakes.dart';
import '../helpers/fakes_alarmas.dart';
/// S2 (Tier 1 visual fidelity): `PluriScreenHeader` — a 38-radius glass
/// hero with an aurora banner, a black scrim, two radial orbs, a 120px
/// watermark and a tri-gradient glyph badge — is not in the prototype at
/// all (`t4` never draws it). It is retired from all 4 roots that used it;
/// each root's ONLY title chrome is now `PluriRootHeader` (S1). Its
/// subtitle text was the one thing the hero rendered that nothing else on
/// these screens does — its absence is this suite's signal that the hero
/// is really gone, since the class itself is deleted and can no longer be
/// referenced by type from a test.
///
/// Pre-existing project constraint (see `pantalla_ajustes_test.dart`):
/// PluriGlassSurface paints a background over ListTile's ink layer, which
/// Flutter flags as a warning-level assertion, not a correctness bug.
void _suppressListTileInkAssertion() {
final original = FlutterError.onError;
FlutterError.onError = (details) {
if (details.exceptionAsString().contains(
'ListTile background color or ink splashes may be invisible',
)) {
return;
}
original?.call(details);
};
addTearDown(() => FlutterError.onError = original);
}
void main() {
setUp(() {
SharedPreferences.setMockInitialValues({});
});
Future<File> archivoCustomVacio() async => File(
'${Directory.current.path}/test/fixtures/emisoras_custom_vacio.json',
);
EstadoRadio crearEstadoRadio() => EstadoRadio(
audio: FakeServicioAudio(),
favoritos: FakeServicioFavoritos(),
radio: FakeServicioRadio(),
servicioEcualizador: FakeServicioEcualizador(),
servicioGrabacion: FakeServicioGrabacionRadioInactiva(),
resolverArchivoCustom: archivoCustomVacio,
iniciarAutomaticamente: false,
);
Widget testApp(EstadoRadio estado, Widget body, {EstadoAlarmas? alarmas}) {
return MultiProvider(
providers: [
ChangeNotifierProvider<EstadoRadio>.value(value: estado),
ListenableProvider<EstadoEcualizador>.value(value: estado.ecualizador),
ListenableProvider<EstadoGrabacion>.value(value: estado.grabacion),
ListenableProvider<EstadoBusqueda>.value(value: estado.busqueda),
ChangeNotifierProvider<EstadoIdioma>.value(value: EstadoIdioma()),
if (alarmas != null)
ChangeNotifierProvider<EstadoAlarmas>.value(value: alarmas),
],
child: MaterialApp(
locale: const Locale('en'),
localizationsDelegates: AppLocalizations.localizationsDelegates,
supportedLocales: AppLocalizations.supportedLocales,
home: Scaffold(body: body),
),
);
}
void setLargeSurface(WidgetTester tester) {
tester.view.physicalSize = const Size(1440, 3200);
tester.view.devicePixelRatio = 1.0;
addTearDown(tester.view.resetPhysicalSize);
addTearDown(tester.view.resetDevicePixelRatio);
}
Future<void> pumpStable(WidgetTester tester) async {
await tester.pump();
await tester.pump(const Duration(milliseconds: 100));
}
testWidgets(
'Buscar: the retired hero subtitle is gone, PluriRootHeader is the '
'only header, and the filters entry point is still reachable',
(tester) async {
setLargeSurface(tester);
final estado = crearEstadoRadio();
addTearDown(estado.dispose);
final l10n = await AppLocalizations.delegate.load(const Locale('en'));
await tester.pumpWidget(testApp(estado, const PantallaBuscar()));
await pumpStable(tester);
expect(find.text(l10n.searchScreenSubtitle), findsNothing);
expect(find.byType(PluriRootHeader), findsOneWidget);
expect(find.text(l10n.searchFiltersLabel), findsWidgets);
},
);
testWidgets('Favoritos (empty state): the retired hero subtitle is gone', (
tester,
) async {
setLargeSurface(tester);
final estado = crearEstadoRadio();
addTearDown(estado.dispose);
final l10n = await AppLocalizations.delegate.load(const Locale('en'));
await tester.pumpWidget(testApp(estado, const PantallaFavoritos()));
await pumpStable(tester);
expect(find.text(l10n.favoritesHeaderSubtitle), findsNothing);
expect(find.byType(PluriRootHeader), findsOneWidget);
});
testWidgets(
'Alarmas: the retired hero subtitle is gone, and the create-alarm '
'action is still reachable',
(tester) async {
setLargeSurface(tester);
final estado = crearEstadoRadio();
final alarmas = EstadoAlarmas(
servicio: ServicioAlarmas(reloj: () => DateTime(2026, 6, 1, 6, 0)),
android: FakePuertoAlarmasAndroid(),
iniciarAutomaticamente: false,
);
addTearDown(estado.dispose);
addTearDown(alarmas.dispose);
final l10n = await AppLocalizations.delegate.load(const Locale('en'));
await tester.pumpWidget(
testApp(estado, const PantallaAlarmas(), alarmas: alarmas),
);
await pumpStable(tester);
expect(find.text(l10n.alarmScreenSubtitle), findsNothing);
expect(find.byType(PluriRootHeader), findsOneWidget);
expect(find.text(l10n.createAlarmAction), findsOneWidget);
},
);
testWidgets('Ajustes: the retired hero subtitle is gone', (tester) async {
_suppressListTileInkAssertion();
setLargeSurface(tester);
final estado = crearEstadoRadio();
addTearDown(estado.dispose);
final l10n = await AppLocalizations.delegate.load(const Locale('en'));
await tester.pumpWidget(testApp(estado, const PantallaAjustes()));
await pumpStable(tester);
expect(find.text(l10n.settingsSubtitle), findsNothing);
expect(find.byType(PluriRootHeader), findsOneWidget);
});
}
+5 -5
View File
@@ -6,6 +6,7 @@ import 'package:pluriwave/estado/estado_alarmas.dart';
import 'package:pluriwave/estado/estado_busqueda.dart';
import 'package:pluriwave/estado/estado_ecualizador.dart';
import 'package:pluriwave/estado/estado_grabacion.dart';
import 'package:pluriwave/estado/estado_idioma.dart';
import 'package:pluriwave/estado/estado_radio.dart';
import 'package:pluriwave/l10n/gen/app_localizations.dart';
import 'package:pluriwave/pantallas/pantalla_ajustes.dart';
@@ -24,11 +25,9 @@ import '../helpers/fakes_alarmas.dart';
/// S1 (Tier 1 visual fidelity): `app.dart`'s `PluriWaveScaffold(appBar:
/// AppBar(...))` is gone — every root now draws its own [PluriRootHeader]
/// instead, matching the prototype (no screen in `t4` shows a global
/// `AppBar`). Each root still ALSO carries its pre-existing
/// `PluriScreenHeader` hero (S2 in this same Tier 1 batch replaces that
/// separately), so title assertions below are scoped to [PluriRootHeader]'s
/// own subtree — the title string itself still appears twice on screen
/// until S2 lands.
/// `AppBar`). [PluriRootHeader]'s own title text is asserted via
/// `find.descendant` throughout — see `pluri_screen_header_retired_test.dart`
/// for S2's separate assertion that the old glass-hero subtitle is gone.
///
/// Pre-existing project constraint (see `pantalla_ajustes_test.dart`):
/// PluriGlassSurface paints a background over ListTile's ink layer, which
@@ -72,6 +71,7 @@ void main() {
ListenableProvider<EstadoEcualizador>.value(value: estado.ecualizador),
ListenableProvider<EstadoGrabacion>.value(value: estado.grabacion),
ListenableProvider<EstadoBusqueda>.value(value: estado.busqueda),
ChangeNotifierProvider<EstadoIdioma>.value(value: EstadoIdioma()),
if (alarmas != null)
ChangeNotifierProvider<EstadoAlarmas>.value(value: alarmas),
],