morphing_surface library
Spatial morphing system for Flutter — entry point for the core engine, MorphingCard, MorphingSurface, and overlay manager.
Quick Start
import 'package:morphing_sheet/morphing_surface.dart';
// ── Option 1: MorphingCard ──────────────────────────────────────
MorphingCard(
collapsedBuilder: (context, progress) => ProductCard(product),
expandedBuilder: (context, progress) => ProductDetailPage(product),
duration: const Duration(milliseconds: 450),
dragToCollapse: true,
)
// ── Option 2: MorphOverlayManager (more control) ────────────────
final manager = MorphOverlayManager(vsync: this);
// On tap:
manager.show(
context: context,
collapsedBuilder: (ctx, p) => ProductTile(product),
expandedBuilder: (ctx, p) => ProductDetail(product),
);
// On back/dismiss:
manager.hide();
// ── Option 3: MorphEngine (pure math, use in custom widgets) ────
final rect = MorphEngine.morphRect(progress, startRect, endRect);
final radius = MorphEngine.morphRadius(progress, startRadius: 16);
final elevation = MorphEngine.morphElevation(progress);
Classes
- MorphController
- Unified animation controller for any morph transition.
- MorphDragController
- Enhanced drag physics controller for morph transitions.
- MorphEngine
- Unified pure-function interpolation engine for all morph transitions.
- MorphingCard
- Flagship card → fullscreen morph widget inspired by Material Container Transform.
- MorphingFrame
- A wrapper widget that scales its child when a MorphingCard or MorphOverlayManager within its subtree is active.
- MorphingSurface
- Base surface widget that renders an animated morphing container.
- MorphOrigin
- Captures the source geometry for a morph transition.
- MorphOverlayManager
- Centralized overlay lifecycle manager for card → fullscreen transitions.
- A tag-based shared element that animates individually during a morph transition.
- MorphState
- Immutable snapshot of a morph transition's state.
Enums
- MorphOriginType
- The semantic origin type for a morph transition.
- MorphPhase
- Unified discrete phases for any morph transition.