Implement Material 3 dynamic theming
This commit is contained in:
committed by
imshahab
parent
f8976da06d
commit
d67c9be306
@@ -1,4 +1,5 @@
|
||||
import 'package:accessibility_tools/accessibility_tools.dart';
|
||||
import 'package:dynamic_color/dynamic_color.dart';
|
||||
import 'package:flutter/foundation.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_localizations/flutter_localizations.dart';
|
||||
@@ -38,33 +39,36 @@ class App extends HookConsumerWidget with PresLogger {
|
||||
return WindowWrapper(
|
||||
TrayWrapper(
|
||||
ShortcutWrapper(
|
||||
ConnectionWrapper(
|
||||
MaterialApp.router(
|
||||
routerConfig: router,
|
||||
locale: locale.flutterLocale,
|
||||
supportedLocales: AppLocaleUtils.supportedLocales,
|
||||
localizationsDelegates: GlobalMaterialLocalizations.delegates,
|
||||
debugShowCheckedModeBanner: false,
|
||||
themeMode: themeMode.flutterThemeMode,
|
||||
theme: theme.light(),
|
||||
darkTheme: theme.dark(),
|
||||
title: Constants.appName,
|
||||
builder: (context, child) {
|
||||
child = UpgradeAlert(
|
||||
upgrader: upgrader,
|
||||
navigatorKey: router.routerDelegate.navigatorKey,
|
||||
child: child ?? const SizedBox(),
|
||||
);
|
||||
if (kDebugMode && _debugAccessibility) {
|
||||
return AccessibilityTools(
|
||||
checkFontOverflows: true,
|
||||
child: child,
|
||||
ConnectionWrapper(DynamicColorBuilder(
|
||||
builder:
|
||||
(ColorScheme? lightColorScheme, ColorScheme? darkColorScheme) {
|
||||
return MaterialApp.router(
|
||||
routerConfig: router,
|
||||
locale: locale.flutterLocale,
|
||||
supportedLocales: AppLocaleUtils.supportedLocales,
|
||||
localizationsDelegates: GlobalMaterialLocalizations.delegates,
|
||||
debugShowCheckedModeBanner: false,
|
||||
themeMode: themeMode.flutterThemeMode,
|
||||
theme: theme.lightTheme(lightColorScheme),
|
||||
darkTheme: theme.darkTheme(darkColorScheme),
|
||||
title: Constants.appName,
|
||||
builder: (context, child) {
|
||||
child = UpgradeAlert(
|
||||
upgrader: upgrader,
|
||||
navigatorKey: router.routerDelegate.navigatorKey,
|
||||
child: child ?? const SizedBox(),
|
||||
);
|
||||
}
|
||||
return child;
|
||||
},
|
||||
),
|
||||
),
|
||||
if (kDebugMode && _debugAccessibility) {
|
||||
return AccessibilityTools(
|
||||
checkFontOverflows: true,
|
||||
child: child,
|
||||
);
|
||||
}
|
||||
return child;
|
||||
},
|
||||
);
|
||||
},
|
||||
)),
|
||||
),
|
||||
),
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user