This repository has been archived by the owner on Feb 22, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 9.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Removed "if" on resolving text color at "SnackBarAction" (#120050)
* Removed "if" on resolving text color at "SnackBarAction" Removed multiple "if" for "resolveForegroundColor" method at "SnackBarAction". At least one of the multiple "if" ("defaults.actionTextColor is MaterialStateColor") led to not applying a custom set color (e.g. MaterialColor "Colors.red") for the action text when using Material 3. The second "if" ("snackBarTheme.actionTextColor is MaterialStateColor") also makes no sense then as the set color of the Theme would lead to the same blocking behaviour of manual color assignment. The last remaining "if" ("widget.textColor is MaterialStateColor") will be unnecessary if the other "if" will be removed, as it will be resolved in the code right afterwards. The three "if" also seems to block the usage of the custom text color or the color at all if the widget is in the "MaterialState.disabled" state. * Adjusted recent modifications to SnackBarAction's text color resolution * Now the "widget.textColor" is checked if it is set. * If it is a MaterialStateColor, it will be used * Otherwise continue with normal resolution (It will be used in the resolution anyways because it's set) * Repeat same steps with "snackBarTheme.actionTextColor" if previous was not set * Repeat same steps with "defaults.actionTextColor" if previous was not set * Reverted the auto formatting changes * Added two test cases to "snack_bar_test" * Test for setting a MaterialColor to a SnackBarAction' label (M3) * Test for setting a MaterialStateColor to a SnackBarAction' label (M3) * Renamed test cases "Snackbar labels can be colored"
- Loading branch information
Showing
2 changed files
with
134 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters