✨ Login & create an account
This commit is contained in:
@ -1,5 +1,7 @@
|
||||
import 'dart:io';
|
||||
|
||||
import 'package:easy_localization/easy_localization.dart' hide TextDirection;
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/foundation.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
||||
@ -12,6 +14,7 @@ import 'package:shared_preferences/shared_preferences.dart';
|
||||
|
||||
void main() async {
|
||||
WidgetsFlutterBinding.ensureInitialized();
|
||||
await EasyLocalization.ensureInitialized();
|
||||
final prefs = await SharedPreferences.getInstance();
|
||||
|
||||
if (!kIsWeb && (Platform.isMacOS || Platform.isLinux || Platform.isWindows)) {
|
||||
@ -27,26 +30,44 @@ void main() async {
|
||||
runApp(
|
||||
ProviderScope(
|
||||
overrides: [sharedPreferencesProvider.overrideWithValue(prefs)],
|
||||
child: IslandApp(),
|
||||
child: Directionality(
|
||||
textDirection: TextDirection.ltr,
|
||||
child: EasyLocalization(
|
||||
supportedLocales: [Locale('en', 'US')],
|
||||
path: 'assets/i18n',
|
||||
fallbackLocale: Locale('en', 'US'),
|
||||
useFallbackTranslations: true,
|
||||
child: Overlay(
|
||||
initialEntries: [OverlayEntry(builder: (_) => IslandApp())],
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
class IslandApp extends ConsumerWidget {
|
||||
IslandApp({super.key});
|
||||
final _appRouter = AppRouter();
|
||||
|
||||
final _appRouter = AppRouter();
|
||||
class IslandApp extends ConsumerWidget {
|
||||
const IslandApp({super.key});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context, WidgetRef ref) {
|
||||
final theme = ref.watch(themeProvider);
|
||||
|
||||
return MaterialApp.router(
|
||||
theme: theme?.light,
|
||||
darkTheme: theme?.dark,
|
||||
themeMode: ThemeMode.system,
|
||||
routerConfig: _appRouter.config(),
|
||||
supportedLocales: context.supportedLocales,
|
||||
localizationsDelegates: [...context.localizationDelegates],
|
||||
locale: context.locale,
|
||||
builder: (context, child) {
|
||||
return WindowScaffold(child: child ?? const SizedBox.shrink());
|
||||
return WindowScaffold(
|
||||
router: _appRouter,
|
||||
child: child ?? const SizedBox.shrink(),
|
||||
);
|
||||
},
|
||||
);
|
||||
}
|
||||
|
Reference in New Issue
Block a user