GlassMorphController class
A Flutter-idiomatic controller for iOS 27 liquid glass morph animations.
Encapsulates the calibrated open/close springs, elapsed phase clock for
parallel trigger recoil (~183 ms peak) and centered wide-trigger
contraction/splash (MagicMorphView #2), and LiquidMorphState computation.
- Inheritance
-
- Object
- ChangeNotifier
- GlassMorphController
Constructors
- GlassMorphController({required TickerProvider vsync, MorphSpeed speed = MorphSpeed.normal, MorphStyle style = MorphStyle.teardrop})
- Creates a GlassMorphController.
Properties
- animation → AnimationController
-
The underlying AnimationController.
no setter
- closeStartProgress → double
-
Animation progress (
0.0 – 1.0) captured at the start of the current close phase (1.0when closing from settled open).no setter - disableAnimations → bool
-
Whether reduced-motion override is currently active.
no setter
- hasHandedOff → bool
-
Whether the closing platter spring has reached/crossed
0.0(~280 msat MorphSpeed.normal), signaling that the floating platter has finished collapsing into the trigger.no setter - hashCode → int
-
The hash code for this object.
no setterinherited
- hasListeners → bool
-
Whether any listeners are currently registered.
no setterinherited
- isClosing → bool
-
Whether the controller is in the closing phase.
no setter
- isShowing → bool
-
Whether the morph lifecycle is currently active.
no setter
- openStartProgress → double
-
Animation progress (
0.0 – 1.0) captured at the start of the current open phase (0.0when opening from rest).no setter - phaseElapsedSeconds → double
-
Elapsed time in seconds within the current open/close phase, scaled by
speedMultiplier (
0.0when disableAnimations is active).no setter - phaseStartTriggerWidth → double
-
Trigger width progress (
0.0 – 1.0) captured at the start of the current open/close phase. Used with LiquidMorphPhysics.closeTriggerWidthForElapsed to evaluate the close width spring at an offset time.no setter - recoilHalfTravelPx ↔ double
-
Half-saturation travel (px) of the close trigger recoil, see
LiquidMorphPhysics.defaultRecoilHalfTravelPx (proportional kick, the
default) and LiquidMorphPhysics.menuRecoilHalfTravelPx (near-constant
~17 pxnative menu kick, used byGlassMenu).getter/setter pair - runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- speed ↔ MorphSpeed
-
Speed profile for the morph animation.
getter/setter pair
- speedMultiplier → double
-
Frequency multiplier of the current speed relative to MorphSpeed.normal.
no setter
- status → AnimationStatus
-
Current AnimationStatus of the underlying controller.
no setter
- style → MorphStyle
-
Visual shape style of the morph transition.
final
- value → double
-
The raw, unclamped spring simulation value.
no setter
- velocity → double
-
Instantaneous velocity of the spring simulation.
no setter
- verticalOnlyRecoil ↔ bool
-
When
true, restricts close trigger recoil strictly to the vertical axis (triggerPushDx == 0.0whenever vertical travel is non-zero), matching native iOS 27MagicMorphView#2 (tx = 0.0) on side-aligned menus.getter/setter pair
Methods
-
addListener(
VoidCallback listener) → void -
Register a closure to be called when the object changes.
inherited
-
close(
) → void -
Closes the morph animation with the calibrated iOS 27 platter collapse,
parallel
~183 mstrigger recoil, and centered wide-trigger splash. -
computeState(
{required double finalDx, required double finalDy, double horizontalOffset = 0.0, double verticalOffset = 0.0, double scaleDelta = 1.0, bool? adaptiveDamping, bool? isClosing}) → LiquidMorphState - Computes the current LiquidMorphState for the given layout geometry.
-
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(
) → void - Opens the morph animation from the current position.
-
removeListener(
VoidCallback listener) → void -
Remove a previously registered closure from the list of closures that are
notified when the object changes.
inherited
-
reset(
) → void -
Immediately resets the controller to its resting closed state (
0.0). -
setDisableAnimations(
bool disableAnimations) → void - Updates the reduced-motion override.
-
setSpeed(
MorphSpeed speed) → void - Updates the speed profile on a live controller (takes effect on the next open or close call).
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited
Static Methods
-
computeCornerRadius(
{required Size currentSize, required double triggerRadius, required double targetRadius, required double progress}) → double -
Computes a monotonic corner radius that never balloons above
max(triggerRadius, targetRadius). -
computeScaleDelta(
{required Size sourceSize, required Size targetSize}) → double -
Computes the geometric scale ratio
√(targetArea / sourceArea).