MorphController class
A single retargetable scalar spring from which all derived morph values are computed. An interruption (open during close and vice versa) is a new SpringSimulation starting from the old one's current value and velocity: the velocity carry-over automatically makes the interruption consistent for every derived property.
- Inheritance
-
- Object
- ChangeNotifier
- MorphController
Constructors
- MorphController({required TickerProvider vsync, MorphMotion motion = .normal, VoidCallback? onHandoff})
-
Creates a standalone spring;
onHandofffires once per close, on the first zero crossing.
Properties
-
animation
→ Animation<
double> -
The controller viewed as a standard Animation: derived animations
(Tween.animate, CurvedAnimation) can be built from it - the engine
speaks the framework's protocols.
latefinal
- direction → MorphDirection
-
The current trajectory end the spring targets.
no setter
- disableAnimations ↔ bool
-
Whether reduced motion is active.
getter/setter pair
- effectiveMotion → MorphMotion
-
The profile actually driving simulations: MorphMotion.instant
under reduced motion, motion otherwise.
no setter
- hasHandedOff → bool
-
Whether the handoff latch has fired for the current close.
no setter
- hashCode → int
-
The hash code for this object.
no setterinherited
- hasListeners → bool
-
Whether any listeners are currently registered.
no setterinherited
- isAnimating → bool
-
Whether a simulation is ticking.
no setter
- isClosing → bool
-
Whether a close simulation is in flight.
no setter
- isScrubbing → bool
-
Whether a scrub owns the value (see beginScrub).
no setter
- isShowing → bool
-
true from open() until the spring fully returns to 0: while true,
the overlay must stay in the tree.
no setter
- motion ↔ MorphMotion
-
The configured motion profile.
getter/setter pair
- onHandoff ↔ VoidCallback?
-
The latch: fires exactly once per close, on the first zero
crossing. At that moment the shuttle geometry coincides with the
source widget - a safe point to swap without flicker.
getter/setter pair
- phase → MorphPhase
-
The semantic phase derived from progress; consumers react to
this instead of comparing raw values against magic numbers.
no setter
- progress → double
-
The value for opacity and shape curves: clamped to
[0, 1].no setter - runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- target → double
-
The current retarget destination: 1 open, 0 closed.
no setter
- value → double
-
The raw spring value. May leave
[0, 1]: overshoot above 1 stretches the geometry past the target, undershoot below 0 is the residual bounce that the real widget plays out after handoff.no setter - velocity → double
-
The spring velocity in value units per second.
no setter
Methods
-
addListener(
VoidCallback listener) → void -
Register a closure to be called when the object changes.
inherited
-
beginScrub(
) → void - Gesture driving: the finger directly owns the spring value. The simulation is dropped and frames come from dragUpdate; releasing is an ordinary open()/close() with the gesture velocity - i.e. the same retarget with velocity carry-over.
-
close(
{double? velocity}) → void - Retargets toward 0 on the close motion; from rest the profile's close velocity hint is injected.
-
dispose(
) → void -
Discards any resources used by the object.
override
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
notifyListeners(
) → void -
Call all the registered listeners.
inherited
-
open(
{double? velocity}) → void - Retargets toward 1 on the open motion, carrying velocity over.
-
removeListener(
VoidCallback listener) → void -
Remove a previously registered closure from the list of closures that are
notified when the object changes.
inherited
-
stop(
) → void - Stops the ticker without dispose - for emergency teardown while external listeners may still be subscribed.
-
toString(
) → String -
A string representation of this object.
inherited
-
updateScrub(
double value, {double velocity = 0}) → void - Sets the scrubbed value; ignored outside a scrub.
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited