fix(inicio): add the favourites count badge and plain-text Ver todas

Tier 4 visual fidelity, audit 1.11/1.12 (t4 line 80): a pill badge next
to "Tus emisoras" now shows the TOTAL favorite count (not the 8-capped
grid size), and "Ver todas" is plain 12px/w800 brand-teal text instead
of a Material TextButton with its own padding and splash.

Item 1.4 (hero art radius) was already fixed as a side effect of an
earlier commit — no change needed here.
This commit is contained in:
2026-07-30 12:36:27 +02:00
parent 56123ea51b
commit 163241d4a1
2 changed files with 136 additions and 10 deletions
+70
View File
@@ -334,6 +334,76 @@ void main() {
expect(find.byKey(const ValueKey('escuchar-hero-meta')), findsNothing);
},
);
testWidgets('visual fidelity (audit 1.11): a count badge sits next to "Tus '
'emisoras", showing the TOTAL favorite count, not the 8-capped grid '
'size', (tester) async {
_setLargeSurfaceSize(tester);
final favoritos = FakeServicioFavoritos();
final estado = EstadoRadio(
audio: FakeServicioAudio(),
favoritos: favoritos,
radio: FakeServicioRadio(),
servicioEcualizador: FakeServicioEcualizador(),
servicioGrabacion: FakeServicioGrabacionRadio(),
resolverArchivoCustom: _archivoCustomVacio,
iniciarAutomaticamente: false,
);
addTearDown(estado.dispose);
await tester.runAsync(estado.inicializar);
for (var i = 0; i < 11; i++) {
await favoritos.agregar(
emisoraDemo(uuid: 'badge-$i', nombre: 'Badge Estacion $i'),
);
}
await estado.cargarFavoritos();
await tester.pumpWidget(
_conProviders(estado, _testApp(const PantallaInicio())),
);
await _pumpStableFrame(tester);
expect(
find.text('11'),
findsOneWidget,
reason:
'prototype t4 line 80: the badge reflects how many favorites '
'exist, even though the grid below caps display at 8',
);
});
testWidgets(
'visual fidelity (audit 1.12): "Ver todas" renders as plain brand-teal '
'text, not a Material TextButton',
(tester) async {
_setLargeSurfaceSize(tester);
final favoritos = FakeServicioFavoritos();
final estado = EstadoRadio(
audio: FakeServicioAudio(),
favoritos: favoritos,
radio: FakeServicioRadio(),
servicioEcualizador: FakeServicioEcualizador(),
servicioGrabacion: FakeServicioGrabacionRadio(),
resolverArchivoCustom: _archivoCustomVacio,
iniciarAutomaticamente: false,
);
addTearDown(estado.dispose);
await tester.runAsync(estado.inicializar);
await favoritos.agregar(emisoraDemo(uuid: 'f1', nombre: 'Favorita Uno'));
await estado.cargarFavoritos();
await tester.pumpWidget(
_conProviders(estado, _testApp(const PantallaInicio())),
);
await _pumpStableFrame(tester);
expect(find.byType(TextButton), findsNothing);
final texto = tester.widget<Text>(find.text('Ver todas'));
expect(texto.style?.fontSize, 12);
expect(texto.style?.fontWeight, FontWeight.w800);
expect(texto.style?.color, const Color(0xFF21D4D9));
},
);
}
/// Mirrors the app.dart wiring: EstadoRadio owns the domain notifiers and