MorphingOverlay<T extends Object> class
A contextual overlay morph container with an integrated card carousel.
When an item is selected via OverlayMorphController, it morphs from the tapped widget's position into a centered floating card. In the card state, the user can swipe horizontally between items (carousel). Dragging up expands to fullscreen; dragging down (or tapping the scrim) dismisses.
Pair with MorphingSource to capture tap origin rects.
Usage
MorphingOverlay<Product>(
controller: controller,
items: products,
cardBuilder: (context, item, progress) => ProductCard(item),
detailBuilder: (context, item, progress) => ProductDetail(item),
child: GridView.builder(
itemBuilder: (context, index) {
return MorphingSource<Product>(
controller: controller,
item: products[index],
itemIndex: index,
child: ProductTile(products[index]),
);
},
),
)
- Inheritance
-
- Object
- DiagnosticableTree
- Widget
- StatefulWidget
- MorphingOverlay
Constructors
-
MorphingOverlay({Key? key, required OverlayMorphController controller, required List<
T> items, required Widget cardBuilder(BuildContext context, T item, double progress), required Widget detailBuilder(BuildContext context, T item, double progress), Widget backgroundBuilder(BuildContext context, double progress)?, double maxRadius = 16.0, double maxElevation = 16.0, Color? surfaceColor, Color? scrimColor, bool enableBlur = true, VoidCallback? onDismissed, Widget titleBuilder(BuildContext context, T item)?, Widget thumbnailBuilder(BuildContext context, T item, int index, bool isActive)?, double thumbnailSize = 52.0, double thumbnailSpacing = 12.0, EdgeInsets thumbnailPadding = const EdgeInsets.symmetric(horizontal: 16.0), Color? thumbnailActiveBorderColor, required Widget child}) -
const
Properties
- backgroundBuilder → Widget Function(BuildContext context, double progress)?
-
Optional custom background builder (receives combined progress).
final
- cardBuilder → Widget Function(BuildContext context, T item, double progress)
-
Builds card-mode content.
progressis the expand progress (0→1).final - child → Widget
-
Background content (typically a grid/list with MorphingSource items).
final
- controller → OverlayMorphController
-
final
- detailBuilder → Widget Function(BuildContext context, T item, double progress)
-
Builds fullscreen detail content.
progressis the expand progress.final - enableBlur → bool
-
final
- hashCode → int
-
The hash code for this object.
no setterinherited
-
items
→ List<
T> -
All items available in the carousel.
final
- key → Key?
-
Controls how one widget replaces another widget in the tree.
finalinherited
- maxElevation → double
-
final
- maxRadius → double
-
final
- onDismissed → VoidCallback?
-
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- scrimColor → Color?
-
final
- surfaceColor → Color?
-
final
- thumbnailActiveBorderColor → Color?
-
final
- thumbnailBuilder → Widget Function(BuildContext context, T item, int index, bool isActive)?
-
Optional builder for circular thumbnails in the overlay.
final
- thumbnailPadding → EdgeInsets
-
final
- thumbnailSize → double
-
final
- thumbnailSpacing → double
-
final
- titleBuilder → Widget Function(BuildContext context, T item)?
-
Optional builder for a title/header shown in the overlay.
final
Methods
-
createElement(
) → StatefulElement -
Creates a StatefulElement to manage this widget's location in the tree.
inherited
-
createState(
) → State< MorphingOverlay< T> > -
Creates the mutable state for this widget at a given location in the tree.
override
-
debugDescribeChildren(
) → List< DiagnosticsNode> -
Returns a list of DiagnosticsNode objects describing this node's
children.
inherited
-
debugFillProperties(
DiagnosticPropertiesBuilder properties) → void -
Add additional properties associated with the node.
inherited
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toDiagnosticsNode(
{String? name, DiagnosticsTreeStyle? style}) → DiagnosticsNode -
Returns a debug representation of the object that is used by debugging
tools and by DiagnosticsNode.toStringDeep.
inherited
-
toString(
{DiagnosticLevel minLevel = DiagnosticLevel.info}) → String -
A string representation of this object.
inherited
-
toStringDeep(
{String prefixLineOne = '', String? prefixOtherLines, DiagnosticLevel minLevel = DiagnosticLevel.debug, int wrapWidth = 65}) → String -
Returns a string representation of this node and its descendants.
inherited
-
toStringShallow(
{String joiner = ', ', DiagnosticLevel minLevel = DiagnosticLevel.debug}) → String -
Returns a one-line detailed description of the object.
inherited
-
toStringShort(
) → String -
A short, textual description of this widget.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited