MorphingCardCarousel<T> class

A centered morphing card carousel with:

  • Horizontal sliding cards (swipe left/right)
  • Vertical fullscreen morph (drag up to expand, down to collapse)
  • Circular thumbnail selector strip
  • Deterministic animation driven by a single AnimationController

Usage

MorphingCardCarousel<Product>(
  items: products,
  controller: controller,
  cardBuilder: (context, item, progress, index, isActive) {
    return ProductCard(item: item);
  },
  fullscreenBuilder: (context, item, progress) {
    return ProductDetail(item: item);
  },
  thumbnailBuilder: (context, item, isActive) {
    return Image.network(item.thumbnailUrl, fit: BoxFit.cover);
  },
  backgroundBuilder: (context, progress, index) {
    return const GradientBackground();
  },
)
Inheritance

Constructors

MorphingCardCarousel({Key? key, required List<T> items, CardCarouselController? controller, required Widget cardBuilder(BuildContext context, T item, double verticalProgress, int index, bool isActive), required Widget fullscreenBuilder(BuildContext context, T item, double verticalProgress), required Widget thumbnailBuilder(BuildContext context, T item, bool isActive), Widget backgroundBuilder(BuildContext context, double verticalProgress, int index)?, double cardWidthFraction = 0.85, double cardHeightFraction = 0.75, double maxRadius = 28.0, double maxElevation = 12.0, Color? surfaceColor, double thumbnailSize = 56.0, double thumbnailSpacing = 12.0, Color? thumbnailActiveBorderColor, EdgeInsets thumbnailPadding = const EdgeInsets.symmetric(horizontal: 16.0, vertical: 12.0), ValueChanged<int>? onIndexChanged, ValueChanged<CardCarouselState>? onStateChanged})
const

Properties

backgroundBuilder Widget Function(BuildContext context, double verticalProgress, int index)?
Builds the background. If null, a default dark background is used.
final
cardBuilder Widget Function(BuildContext context, T item, double verticalProgress, int index, bool isActive)
Builds card-mode content for each item.
final
cardHeightFraction double
Card height as fraction of screen height (0.0–1.0).
final
cardWidthFraction double
Card width as fraction of screen width (0.0–1.0).
final
controller CardCarouselController?
External controller. If null, the widget creates its own.
final
fullscreenBuilder Widget Function(BuildContext context, T item, double verticalProgress)
Builds fullscreen-mode content for the active item.
final
hashCode int
The hash code for this object.
no setterinherited
items List<T>
List of data items to display.
final
key Key?
Controls how one widget replaces another widget in the tree.
finalinherited
maxElevation double
Maximum elevation when card is collapsed.
final
maxRadius double
Maximum corner radius when card is collapsed.
final
onIndexChanged ValueChanged<int>?
Called when the active index changes.
final
onStateChanged ValueChanged<CardCarouselState>?
Called when the carousel state changes.
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
surfaceColor Color?
Card surface color. Defaults to theme surface.
final
thumbnailActiveBorderColor Color?
Border color for active thumbnail.
final
thumbnailBuilder Widget Function(BuildContext context, T item, bool isActive)
Builds each circular thumbnail in the selector bar.
final
thumbnailPadding EdgeInsets
Padding around the thumbnail bar.
final
thumbnailSize double
Thumbnail circle size.
final
thumbnailSpacing double
Space between thumbnails.
final

Methods

createElement() StatefulElement
Creates a StatefulElement to manage this widget's location in the tree.
inherited
createState() State<MorphingCardCarousel<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