fix(ajustes): show each settings row's current value
The prototype puts a trailing current-value string on nearly every settings row (t4 lines 512-539, 625 -- "3 guardados", "Alfabetico", "Espanol", "7 . 84 MB"). FilaAjuste only accepted icon/titulo/onTap, so every row was value-blind. Add an optional `valor` slot to FilaAjuste (13px, rgba(242,247,250,.55), rendered before the chevron). Wire 8 of the 12 built rows to state already available at the settings root: equalizer on/off, sleep-timer active, favourite-group count, preferred station name, custom-station count, sort order, recordings count-and-size (FutureBuilder over EstadoGrabacion.listarGrabaciones), and the current language (hoisted pantalla_ajustes_idioma.dart's native-name list to module level so the root can read it without duplicating it). Salida de audio, Musica local, Backup and Info's version are left without a value -- each lacks a low-risk, deterministically-testable data source (see the apply-progress note for the reason per row). Reading EstadoRadio for these values through a root `context.watch` would rebuild the whole settings list -- including the Grabaciones FutureBuilder's disk read -- on every unrelated audio notification; this follows the codebase's existing S4-R5 convention of narrow `context.select` per field instead. Ajustes' own PluriRootHeader/PluriScreenHeader edit (S2 in this same pass) landed in this commit too, since both touched the same header block in pantalla_ajustes.dart at the same time. S8, Tier 1 visual-fidelity pass (audit id 2521).
This commit is contained in:
@@ -0,0 +1,52 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
import 'package:pluriwave/pantallas/ajustes/widgets/fila_ajuste.dart';
|
||||
import 'package:pluriwave/tema/pluriwave_theme.dart';
|
||||
|
||||
/// S8 (Tier 1 visual fidelity): the prototype puts a trailing "current
|
||||
/// value" on nearly every settings row, 13px `rgba(242,247,250,.55)` (t4
|
||||
/// lines 512-539, 625 — "Voz clara", "Alta", "3 guardados", "Alfabético",
|
||||
/// "7 · 84 MB", "Español", "Hoy, 08:12", "200 MB"). `FilaAjuste` used to
|
||||
/// accept only `icon`/`titulo`/`onTap` — no value slot at all.
|
||||
void main() {
|
||||
Widget host(Widget child) {
|
||||
return MaterialApp(
|
||||
theme: PluriWaveTheme.dark(),
|
||||
home: Scaffold(body: child),
|
||||
);
|
||||
}
|
||||
|
||||
testWidgets('renders the trailing value before the chevron when provided', (
|
||||
tester,
|
||||
) async {
|
||||
await tester.pumpWidget(
|
||||
host(
|
||||
FilaAjuste(
|
||||
icon: Icons.language_rounded,
|
||||
titulo: 'Language',
|
||||
valor: 'English',
|
||||
onTap: () {},
|
||||
),
|
||||
),
|
||||
);
|
||||
|
||||
expect(find.text('English'), findsOneWidget);
|
||||
expect(find.byIcon(Icons.chevron_right_rounded), findsOneWidget);
|
||||
});
|
||||
|
||||
testWidgets('renders no trailing value text when valor is omitted '
|
||||
'(unchanged pre-S8 behaviour)', (tester) async {
|
||||
await tester.pumpWidget(
|
||||
host(
|
||||
FilaAjuste(
|
||||
icon: Icons.info_outline_rounded,
|
||||
titulo: 'Info',
|
||||
onTap: () {},
|
||||
),
|
||||
),
|
||||
);
|
||||
|
||||
expect(find.text('Info'), findsOneWidget);
|
||||
expect(find.byIcon(Icons.chevron_right_rounded), findsOneWidget);
|
||||
});
|
||||
}
|
||||
Reference in New Issue
Block a user