• MarchMore's avatar
    Removed "if" on resolving text color at "SnackBarAction" (#120050) · 0588b925
    MarchMore authored
    * 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"
    0588b925
snack_bar_test.dart 101 KB