getHighlightColor method

Color getHighlightColor (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:

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;
  }

  assert(false);
  return Colors.transparent;
}