SpoilerController class

A base controller that manages a "spoiler" effect, which involves:

  1. A set of "particles" (positions, movement, lifespan).
  2. An optional fade animation (a radial reveal or cover based on _fadeCenter).
  3. Regular particle updates (re-spawning or random movement).

This class does not handle wave animations (see SpoilerSpotsController for that).

USAGE:

Inheritance
Implementers

Constructors

SpoilerController({required TickerProvider vsync})
Creates a new SpoilerController.

Properties

hashCode int
The hash code for this object.
no setterinherited
hasListeners bool
Whether any listeners are currently registered.
no setterinherited
isEnabled bool
True if the spoiler effect is currently on (particles + fade).
no setter
isFading bool
True if the fade animation is active.
no setter
isInitialized bool
True if the active drawer has content to render.
no setter
particles List<Particle>
Particle list exposed for consumers like SpoilerSpotsController.
no setter
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
spoilerBounds Rect
The bounding rectangle for the spoiler region.
no setter

Methods

addListener(VoidCallback listener) → void
Register a closure to be called when the object changes.
inherited
createClipPath(Size size) Path
A path function that clips only the circular fade area if there’s a non-zero fade radius.
createSplashPathMaskClipper(Size size) Path
disable() → void
Turn off the spoiler effect: fade from 1→0, then stop the animation entirely.
dispose() → void
Discards any resources used by the object. After this is called, the object is not in a usable state and should be discarded (calls to addListener will throw after the object is disposed).
override
drawParticles(Canvas canvas) → void
Draws the current set of particles.
enable() → void
Turn on the spoiler effect: show the fade from 0→1 (if configured), and restart the particle animation.
initializeParticles(Path path, SpoilerConfig config, {List<Rect>? rects}) → void
Initializes the particle system with necessary bounds and configuration.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
notifyListeners() → void
Call all the registered listeners.
inherited
removeListener(VoidCallback listener) → void
Remove a previously registered closure from the list of closures that are notified when the object changes.
inherited
setFadeCenter(Offset fadeCenter) → void
toggle(Offset fadeOffset) bool
Toggle the spoiler effect on/off. Optional fadeOffset for the radial center.
toString() String
A string representation of this object.
inherited
updateConfiguration(SpoilerConfig config) → void

Operators

operator ==(Object other) bool
The equality operator.
inherited