shape method

Apply custom shape to button

Equivalent to

TextButton(
  shape: MaterialStateProperty.resolveWith<T>((states) {
    if (states.contains(MaterialState.disabled)) return disabled;
    if (states.contains(MaterialState.dragged)) return dragged;
    if (states.contains(MaterialState.error)) return error;
    if (states.contains(MaterialState.focused)) return focused;
    if (states.contains(MaterialState.hovered)) return hovered;
    if (states.contains(MaterialState.pressed)) return pressed;
    if (states.contains(MaterialState.selected)) return selected;

    return base;
  });
)

Implementation

NikuButton shape({
  RoundedRectangleBorder? base,
  RoundedRectangleBorder? disabled,
  RoundedRectangleBorder? dragged,
  RoundedRectangleBorder? error,
  RoundedRectangleBorder? focused,
  RoundedRectangleBorder? hovered,
  RoundedRectangleBorder? pressed,
  RoundedRectangleBorder? selected,
}) {
  this._shape.update(
        base: base,
        disabled: disabled,
        dragged: dragged,
        error: error,
        focused: focused,
        hovered: hovered,
        pressed: pressed,
        selected: selected,
      );

  return this;
}