🐛 Fix No CupertinoLocalizations found

This commit is contained in:
LittleSheep 2025-04-26 13:37:03 +08:00
parent a564e4ee0a
commit 4af64ae89b

View File

@ -38,9 +38,7 @@ void main() async {
path: 'assets/i18n', path: 'assets/i18n',
fallbackLocale: Locale('en', 'US'), fallbackLocale: Locale('en', 'US'),
useFallbackTranslations: true, useFallbackTranslations: true,
child: Overlay( child: IslandApp(),
initialEntries: [OverlayEntry(builder: (_) => IslandApp())],
),
), ),
), ),
), ),
@ -70,12 +68,21 @@ class IslandApp extends HookConsumerWidget {
themeMode: ThemeMode.system, themeMode: ThemeMode.system,
routerConfig: _appRouter.config(), routerConfig: _appRouter.config(),
supportedLocales: context.supportedLocales, supportedLocales: context.supportedLocales,
localizationsDelegates: [...context.localizationDelegates], localizationsDelegates: [
...context.localizationDelegates,
], // this contains the cupertino one
locale: context.locale, locale: context.locale,
builder: (context, child) { builder: (context, child) {
return WindowScaffold( return Overlay(
router: _appRouter, initialEntries: [
child: child ?? const SizedBox.shrink(), OverlayEntry(
builder:
(_) => WindowScaffold(
router: _appRouter,
child: child ?? const SizedBox.shrink(),
),
),
],
); );
}, },
); );