Initial commit
This commit is contained in:
38
lib/app.dart
Normal file
38
lib/app.dart
Normal file
@@ -0,0 +1,38 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_localizations/flutter_localizations.dart';
|
||||
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
||||
import 'l10n/app_localizations.dart';
|
||||
import 'router.dart';
|
||||
import 'theme.dart';
|
||||
import 'providers/settings_provider.dart';
|
||||
|
||||
class ZhinianApp extends ConsumerWidget {
|
||||
const ZhinianApp({super.key});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context, WidgetRef ref) {
|
||||
final router = ref.watch(routerProvider);
|
||||
final settings = ref.watch(settingsProvider);
|
||||
|
||||
return MaterialApp.router(
|
||||
title: '智念管理',
|
||||
debugShowCheckedModeBanner: false,
|
||||
theme: AppTheme.lightTheme,
|
||||
darkTheme: AppTheme.darkTheme,
|
||||
themeMode: settings.flutterThemeMode,
|
||||
routerConfig: router,
|
||||
locale: settings.locale,
|
||||
localizationsDelegates: const [
|
||||
AppLocalizations.delegate,
|
||||
GlobalMaterialLocalizations.delegate,
|
||||
GlobalWidgetsLocalizations.delegate,
|
||||
GlobalCupertinoLocalizations.delegate,
|
||||
],
|
||||
supportedLocales: const [
|
||||
Locale('zh', 'CN'),
|
||||
Locale('en', 'US'),
|
||||
Locale('th', 'TH'),
|
||||
],
|
||||
);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user