fix(buscar): correct the gaps between the filter row and the results

Issue 3 (partial): the results area had no top gap against the filter
row in one state and reused the horizontal constant for a vertical axis
in another. Applies the 3-tier scale properly -- row tier for
background-less placeholders, card tier for card states.

The rest of the app's spacing review is still outstanding.
This commit is contained in:
2026-07-30 20:18:59 +02:00
parent 727e18737a
commit fc866d7ec9
2 changed files with 104 additions and 3 deletions
+73
View File
@@ -15,6 +15,7 @@ import 'package:pluriwave/servicios/servicio_audio.dart';
import 'package:pluriwave/tema/pluriwave_theme.dart';
import 'package:pluriwave/tema/pluriwave_tokens.dart';
import 'package:pluriwave/widgets/fila_emisora_plana.dart';
import 'package:pluriwave/widgets/pluri_layout.dart';
import 'package:pluriwave/widgets/tarjeta_emisora.dart';
import 'package:provider/provider.dart';
import 'package:shared_preferences/shared_preferences.dart';
@@ -835,6 +836,78 @@ void main() {
);
});
testWidgets('issue 3 (feedback-pruebas): the results list uses row-tier '
'horizontal padding (12), not the card-tier constant this "flat, '
'background-less row" was documented as needing but never got', (
tester,
) async {
_setLargeSurfaceSize(tester);
final estado = _crearEstado(
radio: FakeServicioRadio(
busqueda: [emisoraDemo(uuid: 'r-1', nombre: 'Radio Uno')],
),
);
addTearDown(estado.dispose);
await tester.runAsync(estado.inicializar);
await tester.pumpWidget(_conProviders(estado, _testApp()));
await _pumpStableFrame(tester);
await tester.enterText(find.byType(SearchBar), 'radio');
await tester.testTextInput.receiveAction(TextInputAction.done);
await _pumpStableFrame(tester);
final fila = find.byType(FilaEmisoraPlana);
expect(
tester.getTopLeft(fila).dx,
PluriLayout.rowHorizontal,
reason:
'issue 3: background-less rows are row tier (12), not card '
'tier (16)',
);
});
testWidgets('issue 3 (feedback-pruebas): the results list is topped by the '
'standard section gap, not the horizontal-inset constant reused for '
'a vertical axis', (tester) async {
_setLargeSurfaceSize(tester);
final estado = _crearEstado(
radio: FakeServicioRadio(
busqueda: [emisoraDemo(uuid: 'r-1', nombre: 'Radio Uno')],
),
);
addTearDown(estado.dispose);
await tester.runAsync(estado.inicializar);
await tester.pumpWidget(_conProviders(estado, _testApp()));
await _pumpStableFrame(tester);
await tester.enterText(find.byType(SearchBar), 'radio');
await tester.testTextInput.receiveAction(TextInputAction.done);
await _pumpStableFrame(tester);
// Reads the structural padding directly, rather than measuring a
// gap between two rendered widgets — the count row's own height is
// dictated by its taller PopupMenuButton (48dp touch target), so a
// position-based gap measurement against the count TEXT specifically
// would be thrown off by that unrelated vertical centring.
//
// Scoped to `shrinkWrap: true` — the OUTER page ListView is ALSO an
// ancestor of every `FilaEmisoraPlana`, but only `_resultados`'s OWN
// inner `ListView.builder` sets `shrinkWrap`.
final listaResultados = tester.widget<ListView>(
find.byWidgetPredicate((w) => w is ListView && w.shrinkWrap),
);
final padding = listaResultados.padding as EdgeInsets;
expect(
padding.top,
PluriLayout.sectionGap,
reason:
'issue 3: the results list must use the dedicated vertical '
'section gap above its first row, not the horizontal (16) '
'constant reused for a vertical axis',
);
});
testWidgets(
'tapping the favourite toggle on a search result adds it to favorites',
(tester) async {