MorphOverlayManager class
Centralized overlay lifecycle manager for card → fullscreen transitions.
Manages a single OverlayEntry that morphs from a captured source rect to fullscreen. Handles:
- Rect capture from a BuildContext or explicit Rect
- OverlayEntry insertion and removal
- Back button integration via PopScope/Navigator
- Scrim and background scale
Use MorphOverlayManager.of(context) when your morph widget and the
destination widget are in separate subtrees, otherwise prefer MorphingCard
directly.
Example
final manager = MorphOverlayManager(vsync: this);
// On tap:
manager.show(
context: context,
collapsedBuilder: (context, progress) => ProductTile(product),
expandedBuilder: (context, progress) => ProductDetail(product),
);
// On dismiss:
manager.hide();
Constructors
- MorphOverlayManager({required TickerProvider vsync, double borderRadius = 16.0, double maxElevation = 16.0, double scrimOpacity = 0.5, Duration expandDuration = const Duration(milliseconds: 420), Duration? collapseDuration, Curve expandCurve = Curves.easeInOutCubic, Curve collapseCurve = Curves.easeInOutCubic})
Properties
- controller → MorphController
-
no setter
- hashCode → int
-
The hash code for this object.
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
dispose(
) → void - Dispose the manager and its controller.
-
hide(
) → void - Collapse and remove the overlay.
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
show(
{required BuildContext context, required Widget collapsedBuilder(BuildContext, double), required Widget expandedBuilder(BuildContext, double), Rect? sourceRect}) → void - Insert the morph overlay rooted at the BuildContext.
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited