fix(ajustes): stop settings row titles from wrapping and cutting off
FilaAjuste's title Text had no maxLines/overflow, and neither did its trailing current-value Text. An unbounded value (e.g. a real station name in "Emisora preferida") let the trailing Row claim unbounded width, squeezing the title down until it wrapped across several lines that the row's fixed height then cut short. Constrain the title to a single ellipsized line and cap the trailing value's width the same way. FilaAjuste backs all 12 settings rows, so every row is protected, not just the one that happened to expose it.
This commit is contained in:
@@ -98,6 +98,75 @@ void main() {
|
||||
},
|
||||
);
|
||||
|
||||
testWidgets(
|
||||
'issue 5 (feedback-pruebas): a long trailing value does not squeeze the '
|
||||
'title into wrapping across multiple lines -- the title stays on ONE '
|
||||
'line, ellipsizing instead',
|
||||
(tester) async {
|
||||
const titulo = 'Emisora preferida';
|
||||
const valorLargo = 'Radio Nacional Clasica Internacional FM Stereo HD';
|
||||
|
||||
await tester.pumpWidget(
|
||||
host(
|
||||
SizedBox(
|
||||
width: 360,
|
||||
child: FilaAjuste(
|
||||
icon: Icons.radio_rounded,
|
||||
titulo: titulo,
|
||||
valor: valorLargo,
|
||||
onTap: () {},
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
await tester.pump();
|
||||
|
||||
expect(
|
||||
tester.takeException(),
|
||||
isNull,
|
||||
reason: 'a squeezed row must not overflow either',
|
||||
);
|
||||
|
||||
final tituloWidget = tester.widget<Text>(find.text(titulo));
|
||||
expect(
|
||||
tituloWidget.maxLines,
|
||||
1,
|
||||
reason: 'issue 5: the title must be constrained to a single line',
|
||||
);
|
||||
expect(tituloWidget.overflow, TextOverflow.ellipsis);
|
||||
|
||||
// Measured, not just `find.text` (a wrapped-but-still-present Text
|
||||
// would still satisfy a bare `find.text` match, per the known
|
||||
// "find.text can't catch visual wrap" trap) -- compare the rendered
|
||||
// height against the SAME style/width rendered with a title that is
|
||||
// guaranteed to fit on one line.
|
||||
final alturaConValorLargo = tester.getSize(find.text(titulo)).height;
|
||||
|
||||
await tester.pumpWidget(
|
||||
host(
|
||||
SizedBox(
|
||||
width: 360,
|
||||
child: FilaAjuste(
|
||||
icon: Icons.radio_rounded,
|
||||
titulo: titulo,
|
||||
onTap: () {},
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
await tester.pump();
|
||||
final alturaReferencia = tester.getSize(find.text(titulo)).height;
|
||||
|
||||
expect(
|
||||
alturaConValorLargo,
|
||||
closeTo(alturaReferencia, 1.0),
|
||||
reason:
|
||||
'the title rendered taller with a long value present -- it '
|
||||
'wrapped instead of staying on a single ellipsized line',
|
||||
);
|
||||
},
|
||||
);
|
||||
|
||||
testWidgets(
|
||||
'visual fidelity (audit S10): GrupoAjustes insets its row divider by '
|
||||
'47px, not full-bleed (t4 line 516)',
|
||||
|
||||
Reference in New Issue
Block a user