SpoilerSpotsController class
A specialized SpoilerController that adds "wave" animations to the spoiler particles.
This controller periodically spawns waves from random points within the spoiler bounds. Each wave can animate any particles within its radius, giving a dynamic, expanding “ripple” effect. For each wave:
- A random origin inside spoilerBounds is selected.
- Particles within a chosen radius move outward or to random offsets.
- When the wave animation completes, it disposes its own AnimationController.
The frequency and concurrency of waves is governed by:
- A periodic timer firing every second (by default).
- Randomized delayed timers for each wave (up to 3 per second).
- WidgetSpoilerConfig.maxActiveWaves limiting simultaneous waves.
- Inheritance
-
- Object
- ChangeNotifier
- SpoilerController
- SpoilerSpotsController
Constructors
- SpoilerSpotsController.new({required TickerProvider vsync})
- Creates a new wave-enabled spoiler controller.
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 setterinherited
- isFading → bool
-
True if the fade animation is active.
no setterinherited
- isInitialized → bool
-
True if we have at least one particle.
no setterinherited
-
particles
→ List<
Particle> -
Internal list of active particles in the spoiler region.
finalinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- spoilerBounds → Rect
-
The bounding rectangle for the spoiler region.
no setterinherited
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.
inherited
-
createSplashPathMaskClipper(
Size size) → Path -
inherited
-
disable(
) → void -
Turn off the spoiler effect: fade from 1→0, then stop the animation entirely.
inherited
-
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 via
canvas.drawRawAtlas
.inherited -
enable(
) → void -
Turn on the spoiler effect: show the fade from 0→1 (if configured),
and restart the particle animation.
inherited
-
initializeParticles(
Path path, SpoilerConfig config) → void -
Sets up the spoiler region, the bounding path, and initializes all particles.
If
config.isEnabled
is true, the spoiler is turned on, and we start the particle animation.inherited -
initParticles(
Rect rect, WidgetSpoilerConfig configuration) → void - Sets up the spoiler’s particles via initializeParticles in the parent, then starts a periodic timer that spawns wave animations every second.
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
notifyListeners(
) → void -
Call all the registered listeners.
inherited
-
onEnabledChanged(
bool value) → void -
Called by toggle after setting
_fadeCenter
. Ifvalue
is true, calls enable. Otherwise, disable.inherited -
removeListener(
VoidCallback listener) → void -
Remove a previously registered closure from the list of closures that are
notified when the object changes.
inherited
-
toggle(
Offset fadeOffset) → bool -
Extends toggle to ensure we don't toggle mid-fade, and re-initialize
wave scheduling if we just enabled.
override
-
toString(
) → String -
A string representation of this object.
inherited
-
updateConfiguration(
SpoilerConfig config) → void -
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited