[pve-devel] [PATCH pve-flutter-frontend 4/9] adapt to material 3 changes for themes

Dominik Csapak d.csapak at proxmox.com
Fri Apr 12 10:04:53 CEST 2024


it's recommended to use fromSeed with what was the primary color
beforehand. With this, all colors are correctly deduced from it (e.g.
outline colors etc.).

But since we then set primaryContainer, we also have to set
onPrimaryContainer, otherwise it's deduced from the original primaryContainer
color that would have been generated.

this fixes the issue of the overly stark contrast of the divider color (which
uses the outline color).

Signed-off-by: Dominik Csapak <d.csapak at proxmox.com>
---
 lib/main.dart | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/lib/main.dart b/lib/main.dart
index 5d49af7..4a56435 100644
--- a/lib/main.dart
+++ b/lib/main.dart
@@ -97,11 +97,13 @@ class MyApp extends StatelessWidget {
         title: 'Proxmox',
         //themeMode: ThemeMode.dark, // comment in/out to test
         theme: ThemeData(
-          colorScheme: const ColorScheme.light(
+          colorScheme: ColorScheme.fromSeed(
+            seedColor: ProxmoxColors.supportBlue,
             brightness: Brightness.light,
             primary: ProxmoxColors.supportBlue,
             onPrimary: Colors.white,
             primaryContainer: ProxmoxColors.blue900,
+            onPrimaryContainer: ProxmoxColors.blue50,
             secondary: ProxmoxColors.orange,
             secondaryContainer: ProxmoxColors.supportLightOrange,
             surface: ProxmoxColors.supportGreyTint50,
@@ -134,11 +136,13 @@ class MyApp extends StatelessWidget {
           ),
         ),
         darkTheme: ThemeData(
-          colorScheme: const ColorScheme.dark(
+          colorScheme: ColorScheme.fromSeed(
+            seedColor: ProxmoxColors.supportBlue,
             brightness: Brightness.dark,
             primary: ProxmoxColors.supportBlue,
             onPrimary: Colors.white,
             primaryContainer: ProxmoxColors.blue800,
+            onPrimaryContainer: ProxmoxColors.blue50,
             surface: ProxmoxColors.greyTint20,
             onSurface: Colors.white,
             secondary: ProxmoxColors.orange,
-- 
2.39.2





More information about the pve-devel mailing list