applyDisabledEffect method
Wraps the current widget with an AnimatedOpacity to visually indicate
whether the widget is enabled or disabled.
If isDisabled is true, the opacity is set to disabledOpacity, indicating a disabled state;
otherwise, the opacity is set to 1, indicating an enabled state.
The animation duration is set to 120 milliseconds for a smooth transition.
Implementation
Widget applyDisabledEffect(
bool isDisabled, [
double disabledOpacity = 0.5,
bool? ignoringPointer,
]) {
return IgnorePointer(
ignoring: ignoringPointer ?? isDisabled,
child: AnimatedOpacity(
duration: const Duration(milliseconds: 120),
opacity: isDisabled ? disabledOpacity : 1,
child: this,
),
);
}