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

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, 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)})

Properties

background Color
List background
final
curve Curve
Animation curve
final
duration int
Animation duration in milliseconds (ms)
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
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 is Axis.horizontal, height if Axis.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
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
scrollDirection Axis
ListView's scrollDirection
final
updateOnScroll bool
Calls onItemFocus (if it exists) when ScrollUpdateNotification fires
final
hashCode int
The hash code for this object. [...]
@nonVirtual, read-only, inherited
runtimeType Type
A representation of the runtime type of the object.
read-only, inherited

Methods

createState() ScrollSnapListState
Creates the mutable state for this widget at a given location in the tree. [...]
override
createElement() StatefulElement
Creates a StatefulElement to manage this widget's location in the tree. [...]
inherited
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