From ae2146f4279604049fd3249bc3719ee8ead3fbf9 Mon Sep 17 00:00:00 2001 From: Alex Wallen Date: Thu, 6 Apr 2023 16:15:02 -1000 Subject: [PATCH] [feat] add theme for snackbar (#2194) * feat: add default snackbar theme * fix: since FlowyText overrides textTheme, supply color to widget --- .../lib/workspace/application/appearance.dart | 56 ++++++++++--------- ...settings_file_customize_location_view.dart | 1 + 2 files changed, 32 insertions(+), 25 deletions(-) diff --git a/frontend/appflowy_flutter/lib/workspace/application/appearance.dart b/frontend/appflowy_flutter/lib/workspace/application/appearance.dart index 4c8f8ea80a..a88db56714 100644 --- a/frontend/appflowy_flutter/lib/workspace/application/appearance.dart +++ b/frontend/appflowy_flutter/lib/workspace/application/appearance.dart @@ -210,6 +210,32 @@ class AppearanceSettingsState with _$AppearanceSettingsState { ? appTheme.lightTheme : appTheme.darkTheme; + final colorScheme = ColorScheme( + brightness: brightness, + primary: theme.primary, + onPrimary: theme.onPrimary, + primaryContainer: theme.main2, + onPrimaryContainer: _white, + // page title hover color + secondary: theme.hoverBG1, + onSecondary: theme.shader1, + // setting value hover color + secondaryContainer: theme.selector, + onSecondaryContainer: theme.topbarBg, + tertiary: theme.shader7, + tertiaryContainer: theme.questionBubbleBG, + background: theme.surface, + onBackground: theme.text, + surface: theme.surface, + // text&icon color when it is hovered + onSurface: theme.hoverFG, + onError: theme.shader7, + error: theme.red, + outline: theme.shader4, + surfaceVariant: theme.sidebarBg, + shadow: theme.shadow, + ); + return ThemeData( brightness: brightness, textTheme: _getTextTheme(fontFamily: fontFamily, fontColor: theme.text), @@ -227,6 +253,10 @@ class AppearanceSettingsState with _$AppearanceSettingsState { ), ), scaffoldBackgroundColor: theme.surface, + snackBarTheme: SnackBarThemeData( + backgroundColor: colorScheme.primary, + contentTextStyle: TextStyle(color: colorScheme.onSurface), + ), scrollbarTheme: ScrollbarThemeData( thumbColor: MaterialStateProperty.all(theme.shader3), thickness: MaterialStateProperty.resolveWith((states) { @@ -254,31 +284,7 @@ class AppearanceSettingsState with _$AppearanceSettingsState { highlightColor: theme.main1, indicatorColor: theme.main1, cardColor: theme.input, - colorScheme: ColorScheme( - brightness: brightness, - primary: theme.primary, - onPrimary: theme.onPrimary, - primaryContainer: theme.main2, - onPrimaryContainer: _white, - // page title hover color - secondary: theme.hoverBG1, - onSecondary: theme.shader1, - // setting value hover color - secondaryContainer: theme.selector, - onSecondaryContainer: theme.topbarBg, - tertiary: theme.shader7, - tertiaryContainer: theme.questionBubbleBG, - background: theme.surface, - onBackground: theme.text, - surface: theme.surface, - // text&icon color when it is hovered - onSurface: theme.hoverFG, - onError: theme.shader7, - error: theme.red, - outline: theme.shader4, - surfaceVariant: theme.sidebarBg, - shadow: theme.shadow, - ), + colorScheme: colorScheme, extensions: [ AFThemeExtension( warning: theme.yellow, diff --git a/frontend/appflowy_flutter/lib/workspace/presentation/settings/widgets/settings_file_customize_location_view.dart b/frontend/appflowy_flutter/lib/workspace/presentation/settings/widgets/settings_file_customize_location_view.dart index 8390b2a8af..d807f0c4e2 100644 --- a/frontend/appflowy_flutter/lib/workspace/presentation/settings/widgets/settings_file_customize_location_view.dart +++ b/frontend/appflowy_flutter/lib/workspace/presentation/settings/widgets/settings_file_customize_location_view.dart @@ -52,6 +52,7 @@ class SettingsFileLocationCustomzierState SnackBar( content: FlowyText( LocaleKeys.settings_files_pathCopiedSnackbar.tr(), + color: Theme.of(context).colorScheme.onSurface, ), ), );