ReorderableCarousel class
A carousel that can be re-ordered by dragging the elements around.
- Inheritance
-
- Object
- DiagnosticableTree
- Widget
- StatefulWidget
- ReorderableCarousel
Constructors
-
ReorderableCarousel({required int numItems, required FutureOr<
bool?> addItemAt(int index), required Widget itemBuilder(double itemWidth, int index, bool isSelected), required void onReorder(int oldIndex, int newIndex), void onItemSelected(int selectedIndex)?, double itemWidthFraction = 3, int? maxNumberItems, Widget draggedItemBuilder(double itemWidth, int index)?, Duration scrollToDuration = const Duration(milliseconds: 350), Curve scrollToCurve = Curves.linear, Key? key}) -
Creates a new ReorderableCarousel
const
Properties
-
addItemAt
→ FutureOr<
bool?> Function(int index) -
Callback for when the user presses the "+" button. The given index
indicates where the new item should be inserted at.
final
- draggedItemBuilder → (Widget Function(double itemWidth, int index)?)
-
Builder that's called when the item at
index
is being dragged.final - hashCode → int
-
The hash code for this object.
no setterinherited
- itemBuilder → Widget Function(double itemWidth, int index, bool isSelected)
-
Builder for creating the items of the carousel.
itemWidth
indicates the maximum amount of width alloted for the itemfinal - itemWidthFraction → double
-
The fraction of the available width of the screen that the item will take
up.
The item's width will be calculated like so (a LayoutBuilder is used):
constraints.maxWidth / [itemWidthFraction]
final - key → Key?
-
Controls how one widget replaces another widget in the tree.
finalinherited
- maxNumberItems → int?
-
The maximum number of items allowed in the carousel. If not set the
+
icons will never disappear.final - numItems → int
-
The number of items in the carousel.
final
- onItemSelected → (void Function(int selectedIndex)?)
-
Called whenever a new item is selected.
final
- onReorder → void Function(int oldIndex, int newIndex)
-
Called after the items have been reordered. Both
oldIndex
andnewIndex
will be > 0 and < numItemsfinal - runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- scrollToCurve → Curve
-
Animation Curve used for scrolling to the next selected item.
final
- scrollToDuration → Duration
-
The duration for scrolling to the next selected item.
final
Methods
-
createElement(
) → StatefulElement -
Creates a StatefulElement to manage this widget's location in the tree.
inherited
-
createState(
) → _ReorderableCarouselState -
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}) → 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