toggle method

bool toggle(
  1. Offset fadeOffset
)

Toggle the spoiler effect on/off. Optional fadeOffset for the radial center.

Implementation

bool toggle(Offset fadeOffset) {
  // If we’re mid-fade, skip to avoid partial toggles.
  if ((_config.enableFadeAnimation && isFading) ||
      !_spoilerPath.contains(fadeOffset)) {
    return false;
  }

  // Record the offset from which the radial fade expands.
  _fadeCenter = fadeOffset;

  onEnabledChanged(!_isEnabled);

  return true;
}