From db6f4a3a11bdb3065456d109505dba51870f6a73 Mon Sep 17 00:00:00 2001 From: freetlab Date: Thu, 30 Jul 2026 22:22:50 +0200 Subject: [PATCH] fix(alarma-sonando): put the date line below the hero time The prototype's order is pill (t4:415-416), then 7:30 at 88px (t4:417), then "Lunes, 3 de agosto" at 14px (t4:419). An earlier pass rendered the date between the pill and the time and cited "t4 line 419" as its justification -- but that line number is where the date SITS in the source, which is exactly why it comes last. Both the code and the test encoded the same misreading, so the test passed while the screen was wrong. --- lib/pantallas/pantalla_alarma_sonando.dart | 41 ++++++++++--------- .../pantalla_alarma_sonando_tier5_test.dart | 20 +++++---- 2 files changed, 35 insertions(+), 26 deletions(-) diff --git a/lib/pantallas/pantalla_alarma_sonando.dart b/lib/pantallas/pantalla_alarma_sonando.dart index 0ce1d67..b476d32 100644 --- a/lib/pantallas/pantalla_alarma_sonando.dart +++ b/lib/pantallas/pantalla_alarma_sonando.dart @@ -225,25 +225,6 @@ class _PantallaAlarmaSonandoState extends State { tokens: tokens, ), const SizedBox(height: 22), - // Audit 9.4 (t4 line 419): "Lunes, 3 de agosto" between - // the pill and the hero time -- never rendered before. - // Purely additive: a new sibling Text, touching neither - // the pill above nor the hero time below. - Text( - fechaLargaConDiaSemana( - Localizations.localeOf(context).toString(), - DateTime.now(), - ), - textAlign: TextAlign.center, - style: TextStyle( - fontSize: 14, - fontWeight: FontWeight.w600, - color: Theme.of( - context, - ).colorScheme.onSurface.withValues(alpha: 0.6), - ), - ), - const SizedBox(height: 6), FittedBox( fit: BoxFit.scaleDown, child: Text( @@ -261,6 +242,28 @@ class _PantallaAlarmaSonandoState extends State { ), ), const SizedBox(height: 6), + // Audit 9.4: the date line goes BELOW the hero time. The + // prototype's order is pill (t4:415-416) -> 7:30 at 88px + // (t4:417) -> "Lunes, 3 de agosto" at 14px (t4:419). An + // earlier pass placed it between the pill and the time + // and cited "t4 line 419" for it — that line number is + // where the date SITS in the source, which is precisely + // why it comes last, not first. + Text( + fechaLargaConDiaSemana( + Localizations.localeOf(context).toString(), + DateTime.now(), + ), + textAlign: TextAlign.center, + style: TextStyle( + fontSize: 14, + fontWeight: FontWeight.w600, + color: Theme.of( + context, + ).colorScheme.onSurface.withValues(alpha: 0.6), + ), + ), + const SizedBox(height: 6), Text( localizedAlarmName(l10n, alarma.nombre), textAlign: TextAlign.center, diff --git a/test/pantallas/pantalla_alarma_sonando_tier5_test.dart b/test/pantallas/pantalla_alarma_sonando_tier5_test.dart index f3277ab..93f6dbf 100644 --- a/test/pantallas/pantalla_alarma_sonando_tier5_test.dart +++ b/test/pantallas/pantalla_alarma_sonando_tier5_test.dart @@ -99,8 +99,8 @@ void main() { SharedPreferences.setMockInitialValues({}); }); - testWidgets('visual fidelity (audit 9.4): the date line renders between the ' - 'schedule pill and the hero time (t4:419)', (tester) async { + testWidgets('visual fidelity (audit 9.4): the date line renders BELOW the ' + 'hero time (t4:415-419: pill, then 7:30, then the date)', (tester) async { await _montarPantalla(tester); final localeTag = @@ -111,16 +111,22 @@ void main() { expect(find.text(esperado), findsOneWidget); - // Order: pill above the date line, date line above the hero time. + // Order: pill, then the hero time, then the date line. This test used + // to assert date-before-time and cited "t4:419" for it — but 419 is + // simply the source line the date occupies, and in the prototype it + // comes AFTER the 88px time on line 417. The citation refuted the + // assertion it was supporting. final pillY = tester .getBottomLeft(find.byKey(const ValueKey('ringing-schedule-pill'))) .dy; - final dateY = tester.getTopLeft(find.text(esperado)).dy; final timeY = - tester.getTopLeft(find.byKey(const ValueKey('ringing-hero-time'))).dy; - expect(pillY <= dateY, isTrue); - expect(dateY <= timeY, isTrue); + tester + .getBottomLeft(find.byKey(const ValueKey('ringing-hero-time'))) + .dy; + final dateY = tester.getTopLeft(find.text(esperado)).dy; + expect(pillY <= timeY, isTrue, reason: 'pill sits above the time'); + expect(timeY <= dateY, isTrue, reason: 'the date sits below the time'); // Regression guard: pumpAndSettle must still complete (purely // additive static text, no new animation).