feat: 静态页面开发完成
This commit is contained in:
21
lib/app.dart
21
lib/app.dart
@@ -14,14 +14,27 @@ class ZhinianApp extends ConsumerWidget {
|
||||
final router = ref.watch(routerProvider);
|
||||
final settings = ref.watch(settingsProvider);
|
||||
|
||||
final platformBrightness = MediaQuery.platformBrightnessOf(context);
|
||||
final isDark = switch (settings.themeMode) {
|
||||
AppThemeMode.light => false,
|
||||
AppThemeMode.dark => true,
|
||||
AppThemeMode.system => platformBrightness == Brightness.dark,
|
||||
};
|
||||
AppColors.applyMode(isDark);
|
||||
|
||||
return MaterialApp.router(
|
||||
title: '智念管理',
|
||||
title: '智念商家端',
|
||||
debugShowCheckedModeBanner: false,
|
||||
theme: AppTheme.lightTheme,
|
||||
darkTheme: AppTheme.darkTheme,
|
||||
themeMode: settings.flutterThemeMode,
|
||||
theme: AppTheme.theme,
|
||||
routerConfig: router,
|
||||
locale: settings.locale,
|
||||
// Pages read AppColors.* statics directly; without a key, Router won't
|
||||
// rebuild descendants on a pure theme toggle. Keying by mode forces the
|
||||
// whole subtree to remount so every page picks up the new colors.
|
||||
builder: (context, child) => KeyedSubtree(
|
||||
key: ValueKey<bool>(isDark),
|
||||
child: child ?? const SizedBox.shrink(),
|
||||
),
|
||||
localizationsDelegates: const [
|
||||
AppLocalizations.delegate,
|
||||
GlobalMaterialLocalizations.delegate,
|
||||
|
||||
Reference in New Issue
Block a user