updateState method

  1. @mustCallSuper
  2. @protected
  3. @override
void updateState()
override

Implementation

@mustCallSuper
@protected
@override
void updateState() {
  if (isDisabled) {
    setState(
      _isSelected ? ButtonState.disabledAndSelected : ButtonState.disabled,
    );
    return;
  }
  if (isPressed) {
    setState(
      _isSelected ? ButtonState.downAndSelected : ButtonState.down,
    );
    return;
  }
  if (isHovered) {
    setState(
      _isSelected ? ButtonState.hoverAndSelected : ButtonState.hover,
    );
    return;
  }
  setState(
    _isSelected ? ButtonState.upAndSelected : ButtonState.up,
  );
}