From 8f466a9a370fa03505e2e9c4d7575360c58cb5c1 Mon Sep 17 00:00:00 2001 From: 55nknown Date: Mon, 27 Feb 2023 15:21:35 +0100 Subject: [PATCH] design fix --- filcnaplo/lib/theme/colors/colors.dart | 2 +- filcnaplo/lib/theme/theme.dart | 45 ++++++++++++++++---------- 2 files changed, 29 insertions(+), 18 deletions(-) diff --git a/filcnaplo/lib/theme/colors/colors.dart b/filcnaplo/lib/theme/colors/colors.dart index aa31400..26684e1 100644 --- a/filcnaplo/lib/theme/colors/colors.dart +++ b/filcnaplo/lib/theme/colors/colors.dart @@ -9,7 +9,7 @@ import 'package:flutter/material.dart'; class AppColors { static ThemeAppColors of(BuildContext context) => fromBrightness(Theme.of(context).brightness); - static fromBrightness(Brightness brightness) { + static ThemeAppColors fromBrightness(Brightness brightness) { if (Platform.isAndroid || Platform.isIOS) { switch (brightness) { case Brightness.light: diff --git a/filcnaplo/lib/theme/theme.dart b/filcnaplo/lib/theme/theme.dart index 34573a0..28b769c 100644 --- a/filcnaplo/lib/theme/theme.dart +++ b/filcnaplo/lib/theme/theme.dart @@ -35,9 +35,9 @@ class AppTheme { } Color backgroundColor = - accentColor == AccentColor.custom ? settings.customBackgroundColor : _paletteBackgroundLight(palette) ?? lightColors.background; + (accentColor == AccentColor.custom ? settings.customBackgroundColor : _paletteBackgroundLight(palette)) ?? lightColors.background; Color highlightColor = - accentColor == AccentColor.custom ? settings.customHighlightColor : _paletteHighlightLight(palette) ?? lightColors.highlight; + (accentColor == AccentColor.custom ? settings.customHighlightColor : _paletteHighlightLight(palette)) ?? lightColors.highlight; return ThemeData( brightness: Brightness.light, @@ -46,15 +46,20 @@ class AppTheme { scaffoldBackgroundColor: backgroundColor, primaryColor: lightColors.filc, dividerColor: const Color(0x00000000), - colorScheme: ColorScheme.fromSwatch( - accentColor: accent, - backgroundColor: highlightColor, + colorScheme: ColorScheme( + primary: accent, + onPrimary: (accent.computeLuminance() > 0.5 ? Colors.black : Colors.white).withOpacity(.9), + secondary: accent, + onSecondary: (accent.computeLuminance() > 0.5 ? Colors.black : Colors.white).withOpacity(.9), + background: highlightColor, + onBackground: Colors.black.withOpacity(.9), brightness: Brightness.light, - cardColor: highlightColor, - errorColor: lightColors.red, - primaryColorDark: lightColors.filc, + error: lightColors.red, + onError: Colors.white.withOpacity(.9), + surface: highlightColor, + onSurface: Colors.black.withOpacity(.9), ), - shadowColor: highlightColor.withOpacity(.5), //lightColors.shadow, + shadowColor: lightColors.shadow.withOpacity(.5), appBarTheme: AppBarTheme(backgroundColor: backgroundColor), indicatorColor: accent, iconTheme: IconThemeData(color: lightColors.text.withOpacity(.75)), @@ -97,8 +102,9 @@ class AppTheme { } Color backgroundColor = - accentColor == AccentColor.custom ? settings.customBackgroundColor : _paletteBackgroundDark(palette) ?? darkColors.background; - Color highlightColor = accentColor == AccentColor.custom ? settings.customHighlightColor : _paletteHighlightDark(palette) ?? darkColors.highlight; + (accentColor == AccentColor.custom ? settings.customBackgroundColor : _paletteBackgroundDark(palette)) ?? darkColors.background; + Color highlightColor = + (accentColor == AccentColor.custom ? settings.customHighlightColor : _paletteHighlightDark(palette)) ?? darkColors.highlight; return ThemeData( brightness: Brightness.dark, @@ -107,13 +113,18 @@ class AppTheme { scaffoldBackgroundColor: backgroundColor, primaryColor: darkColors.filc, dividerColor: const Color(0x00000000), - colorScheme: ColorScheme.fromSwatch( - accentColor: accent, - backgroundColor: highlightColor, + colorScheme: ColorScheme( + primary: accent, + onPrimary: (accent.computeLuminance() > 0.5 ? Colors.black : Colors.white).withOpacity(.9), + secondary: accent, + onSecondary: (accent.computeLuminance() > 0.5 ? Colors.black : Colors.white).withOpacity(.9), + background: highlightColor, + onBackground: Colors.white.withOpacity(.9), brightness: Brightness.dark, - cardColor: highlightColor, - errorColor: darkColors.red, - primaryColorDark: darkColors.filc, + error: darkColors.red, + onError: Colors.black.withOpacity(.9), + surface: highlightColor, + onSurface: Colors.white.withOpacity(.9), ), shadowColor: highlightColor.withOpacity(.5), //darkColors.shadow, appBarTheme: AppBarTheme(backgroundColor: backgroundColor),