MorphFlight class
One flight: the tag -> shuttle -> target trio. Lives from launch to close finalization. A repeated showMorph on the same tag does not create a new flight - it retargets this one, which makes interruption free for the caller.
Properties
- appliedDragOffset → Offset
-
The displacement to apply to the container this frame: the raw
offset plus the armed "lean toward home" cue, all faded by
progress so it vanishes exactly at the handoff latch - the swap
back to the home widget happens at zero offset.
no setter
- barrierDismissible → bool
-
Whether scrim taps and Esc dismiss the flight.
final
- builder → MorphContentBuilder
-
Builds the target content.
final
-
closed
→ Future<
Object?> -
Completes when the flight finalizes (landed or aborted), with the
result of the close that landed it - the overlay counterpart of
awaiting showDialog. A dismissal (scrim tap, Esc, back) closes
with null; in route mode the value passed to Navigator.pop rides
here too.
no setter
- controller ↔ MorphController
-
The single spring every visual property derives from.
latefinal
- dragOffset → Offset
-
The raw finger displacement of the container, in overlay px.
no setter
- frameTicks → Listenable
-
One subscription point for everything that renders a flight frame:
the value spring and the displacement channel merged. The shuttle
and the skin listen HERE, so a new co-driver of the frame never
needs a second subscription seam.
latefinal
- hashCode → int
-
The hash code for this object.
no setterinherited
- impactAxis → Offset
-
The impact axis for the landing bump: from the target toward home.
no setter
- isAirborne → bool
-
The content lives in the shuttle: from takeoff to the handoff
latch. For that whole span the source widget is hidden, and its
mass (for the liquid skin) should follow the shuttle instead of
sitting at home.
no setter
- isDragArmed → bool
-
Distance-based preview of the release heuristic: true when letting
go RIGHT NOW would commit the close (a fast fling can still commit
from closer). Watch it during dragBy for haptics or custom cues -
the built-in visual cue (morphDragArm) rides the same threshold.
no setter
- isDragging → bool
-
true between beginDrag and endDrag.
no setter
- isFinished → bool
-
Whether the flight has finalized.
no setter
- isLanding → bool
-
Landing: the latch has fired, the content is back in the widget,
and the spring is playing out the residual undershoot (the bump)
on the live button.
no setter
- isOpenOrOpening → bool
-
Whether the flight targets the open state.
no setter
- lastTargetRect ↔ Rect
-
The current target rect, refreshed by the shuttle every frame.
getter/setter pair
- maxScrimOpacity → double
-
Scrim opacity in the fully open state.
final
- onDismissRequested ↔ VoidCallback?
-
The declarative close route: when set, a scrim tap or Esc does not
close the flight itself but asks the state owner - who flips state,
and close() arrives from above. State down, events up.
getter/setter pair
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- scope → MorphScopeState
-
The scope this flight is registered in.
final
- scrimColor → Color
-
Scrim hue; its own opacity composes with the animated scrim
opacity.
final
- semanticLabel ↔ String?
-
Accessibility name of the opened overlay: it scopes and names the
semantic route, so screen readers announce the opening. null keeps
the overlay unnamed (still scoped).
getter/setter pair
- shadowColor → Color
-
Shadow color of the flying surface, opacity included.
final
- sourceRect ↔ Rect
-
The source rect in overlay coordinates; engine-written every
frame, read-only for apps.
getter/setter pair
- sourceSnapshot → Image?
-
The captured pixel ghost, when MorphTag.snapshotGhost is set.
no setter
- tag → MorphTagState
-
The source tag the flight departs from and lands into.
final
- tagId → Object
-
The source tag's id.
no setter
- target → MorphTargetSpec
-
The destination description; its rect is re-read every frame.
final
Methods
-
abort(
) → void - Tears the flight down without animation.
-
beginDrag(
) → void - Starts finger ownership of the container displacement. The morph value is untouched: grabbing a still-opening overlay lets it keep materializing while it follows the hand.
-
close(
{double? velocity, Object? result}) → void - Retargets the spring toward closed; from rest the close velocity hint scales with the flight's pixel travel so a far close lands heavier.
-
dragBy(
Offset delta) → void - Feeds a pointer delta 1:1: the whole container - surface, shadow, content, shared elements - moves as one rigid body.
-
endDrag(
Offset velocityPerSecond, {bool? commit}) → void -
Releases the finger. The displacement always springs back to zero
with the carried velocity; whether the close flight plays too is
decided by momentum projection (morphProjectValue per axis)
against morphDragCommitDistance / morphDragCommitVelocity -
or forced either way with
commit. -
markNeedsBuild(
) → void - Rebuilds the shuttle's content subtree from the current builder closure. Overlay content does not follow its owner's build on its own (an OverlayEntry is an island): a state owner whose open content derives from that state calls this after setState - MorphAnchor does it on every rebuild.
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
open(
{double? velocity}) → void - Retargets the spring toward open, inserting the shuttle if needed.
-
requestDismiss(
) → void - Routes a dismissal through onDismissRequested when set, otherwise calls close - the single funnel for scrim taps, Esc and back.
-
toggle(
) → void - close when open or opening, open otherwise.
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited
Static Methods
-
launch(
BuildContext context, {required Object from, required MorphTargetSpec target, required MorphContentBuilder builder, MorphMotion? motion, bool barrierDismissible = true, double maxScrimOpacity = 0.45, Color scrimColor = Colors.black, Color shadowColor = const Color(0x99000000), VoidCallback? onDismissRequested, String? semanticLabel, bool routeMode = false, OverlayState? overlay}) → MorphFlight -
Launches (or retargets) the flight for
from. Prefer the showMorph* entry points: they also resolve MorphTheme defaults, this method does not.