getHighlightColor method
- MaterialButton button
The color of the overlay that appears when the button
is pressed.
Returns the button's MaterialButton.highlightColor if it is non-null. Otherwise the highlight color depends on getTextTheme:
- ButtonTextTheme.normal, ButtonTextTheme.accent: returns the
value of the
highlightColor
constructor parameter if it is non-null, otherwise the value of getTextColor with opacity 0.16. - ButtonTextTheme.primary, returns Colors.transparent.
Implementation
Color getHighlightColor(MaterialButton button) {
if (button.highlightColor != null) {
return button.highlightColor!;
}
switch (getTextTheme(button)) {
case ButtonTextTheme.normal:
case ButtonTextTheme.accent:
return _highlightColor ?? getTextColor(button).withOpacity(0.16);
case ButtonTextTheme.primary:
return Colors.transparent;
}
}