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.
This commit is contained in:
2026-07-30 22:22:50 +02:00
parent 3bb92c0536
commit db6f4a3a11
2 changed files with 35 additions and 26 deletions
+22 -19
View File
@@ -225,25 +225,6 @@ class _PantallaAlarmaSonandoState extends State<PantallaAlarmaSonando> {
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<PantallaAlarmaSonando> {
),
),
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,
@@ -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).