From c4378ebb67f8fd8e860395f4dd477171a4cb1388 Mon Sep 17 00:00:00 2001 From: Claude Date: Mon, 16 Nov 2026 11:13:09 +0000 Subject: [PATCH] refactor(theme): remove the dynamic_color workaround and the redundant edge-to-edge call dynamic_color 1.9.0 populates the new surface roles of the color scheme, so the surfaceContainer roles copied from a seeded scheme and the deprecated background override are not needed anymore. The application targets the SDK 36, where edge-to-edge is always enabled, so setting the system UI mode is redundant. Refs #613 Co-Authored-By: Claude --- lib/common/ui/theme_utils.dart | 40 ++-------------------------------- lib/main.dart | 5 +---- 2 files changed, 3 insertions(+), 42 deletions(-) diff --git a/lib/common/ui/theme_utils.dart b/lib/common/ui/theme_utils.dart index 4f0df27c..6895176a 100644 --- a/lib/common/ui/theme_utils.dart +++ b/lib/common/ui/theme_utils.dart @@ -60,17 +60,7 @@ class ThemeUtils { ThemeData getLightTheme(ColorScheme? lightDynamicColorScheme, bool dynamicTheming, Font appFont) { final ColorScheme colorScheme; if (dynamicTheming && lightDynamicColorScheme != null) { - // TODO: remove when dynamic_colors is updated to support new roles - // See https://github.com/material-foundation/flutter-packages/issues/582 - final temporaryColorScheme = ColorScheme.fromSeed(seedColor: lightDynamicColorScheme.primary); - - colorScheme = lightDynamicColorScheme.copyWith( - surfaceContainerLowest: temporaryColorScheme.surfaceContainerLowest, - surfaceContainerLow: temporaryColorScheme.surfaceContainerLow, - surfaceContainer: temporaryColorScheme.surfaceContainer, - surfaceContainerHigh: temporaryColorScheme.surfaceContainerHigh, - surfaceContainerHighest: temporaryColorScheme.surfaceContainerHighest, - ); + colorScheme = lightDynamicColorScheme; } else { colorScheme = ColorScheme.fromSeed(seedColor: customPrimaryColor); } @@ -91,33 +81,7 @@ class ThemeUtils { final ColorScheme colorScheme; if (dynamicTheming && darkDynamicColorScheme != null) { - // TODO: remove when dynamic_colors is updated to support new roles - // See https://github.com/material-foundation/flutter-packages/issues/582 - final temporaryColorScheme = ColorScheme.fromSeed( - brightness: Brightness.dark, - seedColor: darkDynamicColorScheme.primary, - ); - - colorScheme = blackTheming - ? darkDynamicColorScheme.copyWith( - // TODO: remove when dynamic_colors is updated to support new roles - // See https://github.com/material-foundation/flutter-packages/issues/582 - // ignore: deprecated_member_use - background: Colors.black, - surface: Colors.black, - surfaceContainerLowest: temporaryColorScheme.surfaceContainerLowest, - surfaceContainerLow: temporaryColorScheme.surfaceContainerLow, - surfaceContainer: temporaryColorScheme.surfaceContainer, - surfaceContainerHigh: temporaryColorScheme.surfaceContainerHigh, - surfaceContainerHighest: temporaryColorScheme.surfaceContainerHighest, - ) - : darkDynamicColorScheme.copyWith( - surfaceContainerLowest: temporaryColorScheme.surfaceContainerLowest, - surfaceContainerLow: temporaryColorScheme.surfaceContainerLow, - surfaceContainer: temporaryColorScheme.surfaceContainer, - surfaceContainerHigh: temporaryColorScheme.surfaceContainerHigh, - surfaceContainerHighest: temporaryColorScheme.surfaceContainerHighest, - ); + colorScheme = blackTheming ? darkDynamicColorScheme.copyWith(surface: Colors.black) : darkDynamicColorScheme; } else { colorScheme = blackTheming ? ColorScheme.fromSeed(brightness: Brightness.dark, seedColor: customPrimaryColor, surface: Colors.black) diff --git a/lib/main.dart b/lib/main.dart index 042e3a01..f96002fd 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -21,10 +21,7 @@ Future main() async { // Keep the splash screen until all initializations are done FlutterNativeSplash.preserve(widgetsBinding: widgetsBinding); - // Display the application behind the system's notifications bar and navigation bar - // See https://github.com/flutter/flutter/issues/40974 - // See https://github.com/flutter/flutter/issues/34678 - await SystemChrome.setEnabledSystemUIMode(SystemUiMode.edgeToEdge); + // The application is already displayed behind the system's notifications bar and navigation bar (edge-to-edge) SystemChrome.setSystemUIOverlayStyle(const SystemUiOverlayStyle(systemNavigationBarColor: Colors.transparent)); // Initialize the utilities