test(ui): small-phone overflow guard; fix Home clipping on small screens
Adds test/ui/small_screen_overflow_test.dart: pumps the full screens at a 320x568 (iPhone-SE-class) viewport in the longest-text locales (es/pt/ast); a RenderFlex overflow fails the test, so a clipped title or save button is caught. It found — and this fixes — a real bug: the Home menu (a fixed, non-scrolling Center>Column) clipped ~80px on small phones in every locale. Home is now wrapped in LayoutBuilder + SingleChildScrollView + ConstrainedBox(minHeight: maxHeight): centered when it fits, scrolls when it doesn't, never clipped. Also makes the test harness faithful: wrapScreen/wrapDetail now map the locale through materialLocaleFor (ast->es) exactly like the app, so Asturian screens don't throw on MaterialLocalizations (AppBar tooltips) — that had masqueraded as an overflow. Scope notes in the test: full screens only (modal bottom sheets get an unbounded height in widget tests -> false huge overflow; they already scroll their body), and the variety-detail screen is skipped (its ~2px hit is on a DISPOSED/DEFUNCT RenderFlex — a transient during the cubit rebuild, not the stable layout).
This commit is contained in:
parent
70fb7a463c
commit
8315d20f73
3 changed files with 133 additions and 6 deletions
|
|
@ -40,10 +40,18 @@ class HomeScreen extends StatelessWidget {
|
|||
body: Stack(
|
||||
children: [
|
||||
const Positioned.fill(child: _SeedWatermark()),
|
||||
Center(
|
||||
child: ConstrainedBox(
|
||||
constraints: const BoxConstraints(maxWidth: 440),
|
||||
child: Padding(
|
||||
// Scroll when the menu doesn't fit a short screen (small phones), so
|
||||
// the market card / buttons are never clipped; stays centered when it
|
||||
// does fit.
|
||||
LayoutBuilder(
|
||||
builder: (context, constraints) => SingleChildScrollView(
|
||||
child: ConstrainedBox(
|
||||
constraints:
|
||||
BoxConstraints(minHeight: constraints.maxHeight),
|
||||
child: Center(
|
||||
child: ConstrainedBox(
|
||||
constraints: const BoxConstraints(maxWidth: 440),
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.fromLTRB(24, 24, 24, 32),
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
|
|
@ -109,6 +117,9 @@ class HomeScreen extends StatelessWidget {
|
|||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue