getSplashColor method

Color getSplashColor (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 and button is a RaisedButton or an OutlineButton.

Otherwise, returns the value of the splashColor constructor parameter if it is non-null and button is a FlatButton 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 && (button is RaisedButton || button is OutlineButton))
    return _splashColor;

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

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