From 2122ede7ab9f2bacef747c7c054d06393d65fe2f Mon Sep 17 00:00:00 2001 From: WinXaito Date: Thu, 3 Mar 2022 13:30:39 +0100 Subject: [PATCH 1/4] Fix disabled color foreground on FilledButton --- lib/src/controls/inputs/buttons/filled_button.dart | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/src/controls/inputs/buttons/filled_button.dart b/lib/src/controls/inputs/buttons/filled_button.dart index 3577f3436..cabb4762e 100644 --- a/lib/src/controls/inputs/buttons/filled_button.dart +++ b/lib/src/controls/inputs/buttons/filled_button.dart @@ -36,6 +36,7 @@ class FilledButton extends Button { return ButtonStyle(backgroundColor: ButtonState.resolveWith((states) { return backgroundColor(theme, states); }), foregroundColor: ButtonState.resolveWith((states) { + if (states.isDisabled) return theme.disabledColor; return backgroundColor(theme, states).basedOnLuminance(); })); } From 58571a3ed49603e844eb8c67afa0578aab08fab5 Mon Sep 17 00:00:00 2001 From: WinXaito Date: Thu, 3 Mar 2022 13:33:36 +0100 Subject: [PATCH 2/4] Update changelog --- CHANGELOG.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 340b426f9..32f0f4091 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,9 @@ Date format: DD/MM/YYYY +## [3.9.2] [dd/mm/yyyy] + +- Fix: [#207](https://github.com/bdlukaa/fluent_ui/pull/207) FilledButton disabled foreground + ## [3.9.1] - Input Update - [25/02/2022] - `TextBox` updates: ([#179](https://github.com/bdlukaa/fluent_ui/pull/179)) From a3f928fe59bd041c9f4329bdbe871b30a110ea6f Mon Sep 17 00:00:00 2001 From: WinXaito Date: Mon, 7 Mar 2022 10:15:05 +0100 Subject: [PATCH 3/4] Add FilledButton in example app --- example/lib/screens/inputs.dart | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/example/lib/screens/inputs.dart b/example/lib/screens/inputs.dart index 9f987143a..408040685 100644 --- a/example/lib/screens/inputs.dart +++ b/example/lib/screens/inputs.dart @@ -139,6 +139,11 @@ class _InputsPageState extends State { }, ), spacer, + FilledButton( + child: const Text('Filled Button'), + onPressed: disabled ? null : () => print('pressed filled button'), + ), + spacer, IconButton( icon: const Icon(FluentIcons.add), onPressed: disabled ? null : () => print('pressed icon button'), From 65bd0fa3da054e83e67ce0009d6b09881e88bddd Mon Sep 17 00:00:00 2001 From: WinXaito Date: Mon, 7 Mar 2022 10:25:27 +0100 Subject: [PATCH 4/4] Update disabled colors --- lib/src/controls/inputs/buttons/filled_button.dart | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/lib/src/controls/inputs/buttons/filled_button.dart b/lib/src/controls/inputs/buttons/filled_button.dart index cabb4762e..cbffaa64d 100644 --- a/lib/src/controls/inputs/buttons/filled_button.dart +++ b/lib/src/controls/inputs/buttons/filled_button.dart @@ -36,14 +36,20 @@ class FilledButton extends Button { return ButtonStyle(backgroundColor: ButtonState.resolveWith((states) { return backgroundColor(theme, states); }), foregroundColor: ButtonState.resolveWith((states) { - if (states.isDisabled) return theme.disabledColor; + if (states.isDisabled) { + return theme.brightness.isDark ? theme.disabledColor : Colors.white; + } return backgroundColor(theme, states).basedOnLuminance(); })); } static Color backgroundColor(ThemeData theme, Set states) { if (states.isDisabled) { - return ButtonThemeData.buttonColor(theme.brightness, states); + if (theme.brightness.isDark) { + return const Color(0xFF434343); + } else { + return const Color(0xFFBFBFBF); + } } else if (states.isPressing) { if (theme.brightness.isDark) { return theme.accentColor.darker;