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:
vjrj 2026-07-11 00:53:44 +02:00
parent 70fb7a463c
commit 8315d20f73
3 changed files with 133 additions and 6 deletions

View file

@ -10,6 +10,7 @@ import 'package:tane/db/database.dart';
import 'package:tane/i18n/strings.g.dart';
import 'package:tane/security/secret_store.dart';
import 'package:tane/services/onboarding_store.dart';
import 'package:tane/app.dart' show materialLocaleFor;
import 'package:tane/state/inventory_cubit.dart';
import 'package:tane/state/variety_detail_cubit.dart';
import 'package:tane/ui/variety_detail_screen.dart';
@ -69,7 +70,7 @@ Widget wrapScreen({
child: BlocProvider(
create: (_) => InventoryCubit(repository),
child: MaterialApp(
locale: locale.flutterLocale,
locale: materialLocaleFor(locale.flutterLocale),
supportedLocales: AppLocaleUtils.supportedLocales,
localizationsDelegates: const [
GlobalMaterialLocalizations.delegate,
@ -103,7 +104,7 @@ Widget wrapDetail({
child: BlocProvider(
create: (_) => VarietyDetailCubit(repository, varietyId),
child: MaterialApp(
locale: locale.flutterLocale,
locale: materialLocaleFor(locale.flutterLocale),
supportedLocales: AppLocaleUtils.supportedLocales,
localizationsDelegates: const [
GlobalMaterialLocalizations.delegate,