getSplashColor method

Color getSplashColor(
  1. MaterialButton button
)

The color of the ink "splash" overlay that appears when the (enabled) button is tapped.

Returns the button's MaterialButton.splashColor if it is non-null.

Otherwise, returns the value of the splashColor constructor parameter it is non-null.

Otherwise, returns the value of the splashColor constructor parameter if it is non-null and getTextTheme is not ButtonTextTheme.primary.

Otherwise, returns getTextColor with an opacity of 0.12.

Implementation

Color getSplashColor(MaterialButton button) {
  if (button.splashColor != null) {
    return button.splashColor!;
  }

  if (_splashColor != null) {
    switch (getTextTheme(button)) {
      case ButtonTextTheme.normal:
      case ButtonTextTheme.accent:
        return _splashColor;
      case ButtonTextTheme.primary:
        break;
    }
  }

  return getTextColor(button).withOpacity(0.12);
}