ScrollSnapList class
A ListView widget that able to "snap" or focus to an item whenever user scrolls.
Allows unrestricted scroll speed. Snap/focus event done on every ScrollEndNotification
.
Contains ScrollNotification
widget, so might be incompatible with other scroll notification.
- Inheritance
- Object
- DiagnosticableTree
- Widget
- StatefulWidget
- ScrollSnapList
Constructors
- ScrollSnapList({Color background, @required Widget itemBuilder(BuildContext, int), ScrollController listController, Curve curve: Curves.ease, int duration: 500, double endOfListTolerance, bool focusOnItemTap: true, void focusToItem(int), int itemCount, @required double itemSize, Key key, Key listViewKey, EdgeInsetsGeometry margin, @required void onItemFocus(int), Function onReachEnd, EdgeInsetsGeometry padding, bool reverse: false, bool updateOnScroll, double initialIndex, Axis scrollDirection: Axis.horizontal, bool dynamicItemSize: false, double dynamicSizeEquation(double distance), double dynamicItemOpacity, SelectedItemAnchor selectedItemAnchor: SelectedItemAnchor.MIDDLE})
Properties
- background → Color
-
List background
final
- curve → Curve
-
Animation curve
final
- duration → int
-
Animation duration in milliseconds (ms)
final
- dynamicItemOpacity → double
-
Custom Opacity of items off center
final
- dynamicItemSize → bool
-
Scale item's size depending on distance to center
final
- dynamicSizeEquation → double Function(double distance)
-
Custom equation to determine dynamic item scaling calculation [...]
final
- endOfListTolerance → double
-
Pixel tolerance to trigger onReachEnd.
Default is itemSize/2
final
- focusOnItemTap → bool
-
Focus to an item when user tap on it. Inactive if the list-item have its own onTap detector (use state-key to help focusing instead).
final
- focusToItem → void Function(int)
-
Method to manually trigger focus to an item. Call with help of
GlobalKey<ScrollSnapListState>
.final - hashCode → int
-
The hash code for this object. [...]
@nonVirtual, read-only, inherited
- initialIndex → double
-
An optional initial position which will not snap until after the first drag
final
- itemBuilder → Widget Function(BuildContext, int)
-
Widget builder.
final
- itemCount → int
-
Number of item in this list
final
- itemSize → double
-
Composed of the size of each item + its margin/padding.
Size used is width if
scrollDirection
isAxis.horizontal
, height ifAxis.vertical
. [...]final - key → Key
-
Global key that's used to call
focusToItem
method to manually trigger focus event.final - listController → ScrollController
-
Allows external controller
final
- listViewKey → Key
-
Global key that passed to child ListView. Can be used for PageStorageKey
final
- margin → EdgeInsetsGeometry
-
Container's margin
final
- onItemFocus → void Function(int)
-
Callback function when list snaps/focuses to an item
final
- onReachEnd → Function
-
Callback function when user reach end of list. [...]
final
- padding → EdgeInsetsGeometry
-
Container's padding
final
- reverse → bool
-
Reverse scrollDirection
final
- runtimeType → Type
-
A representation of the runtime type of the object.
read-only, inherited
- scrollDirection → Axis
-
ListView's scrollDirection
final
- selectedItemAnchor → SelectedItemAnchor
-
Anchor location for selected item in the list
final
- updateOnScroll → bool
-
Calls onItemFocus (if it exists) when ScrollUpdateNotification fires
final
Methods
-
createElement(
) → StatefulElement -
Creates a StatefulElement to manage this widget's location in the tree. [...]
inherited
-
createState(
) → ScrollSnapListState -
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. [...]
@protected, inherited
-
debugFillProperties(
DiagnosticPropertiesBuilder properties) → void -
Add additional properties associated with the node. [...]
inherited
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a non-existent 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 -
Returns 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. [...]
@nonVirtual, inherited