disabled method

Widget disabled(
  1. bool isDisabled, {
  2. double opacity = 0.5,
})

Disable this widget visually + interaction

Implementation

Widget disabled(bool isDisabled, {double opacity = 0.5}) {
  if (!isDisabled) return this;

  return IgnorePointer(
    ignoring: true,
    child: Opacity(opacity: opacity, child: this),
  );
}