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 <noreply@anthropic.com>
This commit is contained in:
parent
56932a2dda
commit
47b2555dc5
1 changed files with 8 additions and 13 deletions
21
lib/app.dart
21
lib/app.dart
|
|
@ -62,23 +62,18 @@ class _ConsentGate extends ConsumerWidget {
|
||||||
final consent = ref.watch(consentProvider);
|
final consent = ref.watch(consentProvider);
|
||||||
|
|
||||||
if (consent.isLoading) {
|
if (consent.isLoading) {
|
||||||
return Scaffold(
|
return const Scaffold(
|
||||||
body: Center(
|
body: Center(child: CircularProgressIndicator()),
|
||||||
child: const CircularProgressIndicator(),
|
|
||||||
),
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!consent.hasAccepted) {
|
if (!consent.hasAccepted) {
|
||||||
return MaterialApp(
|
// Plain Scaffold inside the app's existing MaterialApp — that one already
|
||||||
title: 'OciDeck',
|
// supplies the theme and the AppLocalizations delegate, so context.l10n
|
||||||
theme: ThemeData.light(),
|
// resolves here. A nested MaterialApp would start a fresh Localizations
|
||||||
debugShowCheckedModeBanner: false,
|
// scope without our delegate and the consent text would render blank.
|
||||||
home: Scaffold(
|
return const Scaffold(
|
||||||
body: Center(
|
body: Center(child: ConsentDialog()),
|
||||||
child: ConsentDialog(),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue