CandleLightController class

Drives a CandleLight from outside its subtree.

Pass a controller to CandleLight.controller and then update its fields or call its methods to command the flame. The widget animates to the new state (spring physics for position, cross-fade for ignite / extinguish, instant for radius).

When the user interacts with the widget in CandleLightInteraction.grab or CandleLightInteraction.twoFinger mode, the controller is kept in sync so external listeners observe the live target.

final controller = CandleLightController();

CandleLight(
  controller: controller,
  child: myReader,
);

// Move the flame to a specific word:
controller.position = wordRect.center;

// Blow out when the screen dims:
controller.blowOut();
Inheritance

Constructors

CandleLightController({Offset? initialPosition, double initialRadius = 160, bool initiallyLit = true})
Creates a controller with the given initial target state.

Properties

hashCode → int
The hash code for this object.
no setterinherited
hasListeners → bool
Whether any listeners are currently registered.
no setterinherited
isLit → bool
Whether the candle is currently burning.
no setter
position ↔ Offset
Target position for the flame. Writing a new value causes the widget to spring-animate toward it.
getter/setter pair
radius ↔ double
Target radius of the light pool, in logical pixels. Writing a new value applies instantly (no ease) — if you want an animated resize, drive radius yourself with a Tween or AnimationController.
getter/setter pair
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited

Methods

addListener(VoidCallback listener) → void
Register a closure to be called when the object changes.
inherited
blowOut() → void
Extinguishes the flame. Emits a smoke burst in the widget. No-op if already out.
dispose() → void
Discards any resources used by the object.
inherited
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
notifyListeners() → void
Call all the registered listeners.
inherited
relight() → void
Re-ignites the flame. No-op if already lit.
removeListener(VoidCallback listener) → void
Remove a previously registered closure from the list of closures that are notified when the object changes.
inherited
toString() → String
A string representation of this object.
inherited

Operators

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