From 47b2555dc598dfa636ad31dfd24923aee21af41d Mon Sep 17 00:00:00 2001 From: Brenno de Winter Date: Thu, 11 Jun 2026 14:27:24 +0200 Subject: [PATCH] Fix blank consent screen: drop nested MaterialApp The consent gate wrapped ConsentDialog in a second MaterialApp with no localizationsDelegates. That started a fresh Localizations scope without the AppLocalizations delegate, so context.l10n inside the dialog resolved to nothing and the consent screen rendered with no text. Render the consent screen as a plain Scaffold inside the app's existing MaterialApp, which already supplies both the theme and the localization delegates. Text now renders in all languages. Co-Authored-By: Claude Opus 4.8 --- lib/app.dart | 21 ++++++++------------- 1 file changed, 8 insertions(+), 13 deletions(-) diff --git a/lib/app.dart b/lib/app.dart index 4a72f5c..aff7caa 100644 --- a/lib/app.dart +++ b/lib/app.dart @@ -62,23 +62,18 @@ class _ConsentGate extends ConsumerWidget { final consent = ref.watch(consentProvider); if (consent.isLoading) { - return Scaffold( - body: Center( - child: const CircularProgressIndicator(), - ), + return const Scaffold( + body: Center(child: CircularProgressIndicator()), ); } if (!consent.hasAccepted) { - return MaterialApp( - title: 'OciDeck', - theme: ThemeData.light(), - debugShowCheckedModeBanner: false, - home: Scaffold( - body: Center( - child: ConsentDialog(), - ), - ), + // Plain Scaffold inside the app's existing MaterialApp — that one already + // supplies the theme and the AppLocalizations delegate, so context.l10n + // resolves here. A nested MaterialApp would start a fresh Localizations + // scope without our delegate and the consent text would render blank. + return const Scaffold( + body: Center(child: ConsentDialog()), ); }