M3ECarouselView class

A Material Design carousel widget.

The M3ECarouselView presents a scrollable list of items, each of which can dynamically change size based on the chosen layout.

Inheritance

Constructors

M3ECarouselView({Key? key, EdgeInsets? padding, Color? backgroundColor, double? elevation, ShapeBorder? shape, Clip? itemClipBehavior, WidgetStateProperty<Color?>? overlayColor, bool itemSnapping = false, double shrinkExtent = 0.0, M3ECarouselController? controller, Axis scrollDirection = Axis.horizontal, bool reverse = false, ValueChanged<int>? onTap, M3EHapticFeedback haptic = M3EHapticFeedback.none, bool enableSplash = true, bool infinite = false, ScrollPhysics? physics, required double itemExtent, required List<Widget> children, ValueChanged<int>? onIndexChanged, ValueChanged<M3ECarouselChangeDetails>? onChange})
Creates a Material Design carousel.
const
M3ECarouselView.builder({Key? key, EdgeInsets? padding, Color? backgroundColor, double? elevation, ShapeBorder? shape, Clip? itemClipBehavior, WidgetStateProperty<Color?>? overlayColor, bool itemSnapping = false, double shrinkExtent = 0.0, M3ECarouselController? controller, Axis scrollDirection = Axis.horizontal, bool reverse = false, ValueChanged<int>? onTap, M3EHapticFeedback haptic = M3EHapticFeedback.none, bool enableSplash = true, required double itemExtent, required NullableIndexedWidgetBuilder? itemBuilder, int? itemCount, ValueChanged<int>? onIndexChanged, ValueChanged<M3ECarouselChangeDetails>? onChange, bool infinite = false, ScrollPhysics? physics})
Creates a scrollable carousel with fixed-sized items created on demand.
const
M3ECarouselView.weighted({Key? key, EdgeInsets? padding, Color? backgroundColor, double? elevation, ShapeBorder? shape, Clip? itemClipBehavior, WidgetStateProperty<Color?>? overlayColor, bool itemSnapping = false, double shrinkExtent = 0.0, M3ECarouselController? controller, Axis scrollDirection = Axis.horizontal, bool reverse = false, bool consumeMaxWeight = true, ValueChanged<int>? onTap, M3EHapticFeedback haptic = M3EHapticFeedback.none, bool enableSplash = true, bool infinite = false, ScrollPhysics? physics, required List<int> flexWeights, required List<Widget> children, ValueChanged<int>? onIndexChanged, ValueChanged<M3ECarouselChangeDetails>? onChange})
Creates a scrollable list where the size of each child widget is dynamically determined by the provided flexWeights.
const
M3ECarouselView.weightedBuilder({Key? key, EdgeInsets? padding, Color? backgroundColor, double? elevation, ShapeBorder? shape, Clip? itemClipBehavior, WidgetStateProperty<Color?>? overlayColor, bool itemSnapping = false, double shrinkExtent = 0.0, M3ECarouselController? controller, Axis scrollDirection = Axis.horizontal, bool reverse = false, bool consumeMaxWeight = true, ValueChanged<int>? onTap, M3EHapticFeedback haptic = M3EHapticFeedback.none, bool enableSplash = true, required List<int> flexWeights, required NullableIndexedWidgetBuilder? itemBuilder, int? itemCount, ValueChanged<int>? onIndexChanged, ValueChanged<M3ECarouselChangeDetails>? onChange, bool infinite = false, ScrollPhysics? physics})
Creates a scrollable carousel with weighted items created on demand.
const

Properties

backgroundColor → Color?
The background color for each carousel item.
final
children → List<Widget>
The child widgets for the carousel.
final
consumeMaxWeight → bool
Whether the collapsed items are allowed to expand to the max size.
final
controller → M3ECarouselController?
An object that can be used to control the position to which this scroll view is scrolled.
final
elevation → double?
The z-coordinate of each carousel item.
final
enableSplash → bool
Determines whether an InkWell will cover each Carousel item.
final
flexWeights → List<int>?
The weights that each visible child should occupy in the viewport.
final
haptic → M3EHapticFeedback
Haptic intensity on item tap. Defaults to M3EHapticFeedback.none.
final
hashCode → int
The hash code for this object.
no setterinherited
infinite → bool
Whether the carousel should loop infinitely.
final
itemBuilder → NullableIndexedWidgetBuilder?
Called to build carousel item on demand.
final
itemClipBehavior → Clip?
The clip behavior for each carousel item.
final
itemCount → int?
The number of items in the carousel.
final
itemExtent → double?
The extent the children are forced to have in the main axis.
final
itemSnapping → bool
Whether the carousel should keep scrolling to the next/previous items to maintain the original layout.
final
key → Key?
Controls how one widget replaces another widget in the tree.
finalinherited
onChange → ValueChanged<M3ECarouselChangeDetails>?
Called when the leading or focal item index changes.
final
onIndexChanged → ValueChanged<int>?
A callback invoked when the leading item changes.
final
onTap → ValueChanged<int>?
Called when one of the children is tapped.
final
overlayColor → WidgetStateProperty<Color?>?
The highlight color to indicate the carousel items are in pressed, hovered or focused states.
final
padding → EdgeInsets?
The amount of space to surround each carousel item with.
final
physics → ScrollPhysics?
The scrollPhysics to apply to the carousel layout.
final
reverse → bool
Whether the carousel list scrolls in the reading direction.
final
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
scrollDirection → Axis
The Axis along which the scroll view's offset increases with each item.
final
shape → ShapeBorder?
The shape of each carousel item's Material.
final
shrinkExtent → double
The minimum allowable extent (size) in the main axis for carousel items during scrolling transitions.
final

Methods

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