ScrollablePositionedList class

A scrollable list of widgets similar to ListView, except scroll control and position reporting is based on index rather than pixel offset.

ScrollablePositionedList lays out children in the same way as ListView.

The list can be displayed with the item at initialScrollIndex positioned at a particular initialAlignment.

The itemScrollController can be used to scroll or jump to particular items in the list. The itemPositionsNotifier can be used to get a list of items currently laid out by the list.

The scrollOffsetListener can be used to get updates about scroll position changes.

All other parameters are the same as specified in ListView.

Inheritance

Constructors

ScrollablePositionedList.builder({required int itemCount, required IndexedWidgetBuilder itemBuilder, Key? key, ItemScrollController? itemScrollController, bool shrinkWrap = false, ItemPositionsListener? itemPositionsListener, ScrollOffsetListener? scrollOffsetListener, int initialScrollIndex = 0, double initialAlignment = 0, Axis scrollDirection = Axis.vertical, bool reverse = false, ScrollPhysics? physics, int? semanticChildCount, EdgeInsets? padding, bool addSemanticIndexes = true, bool addAutomaticKeepAlives = true, bool addRepaintBoundaries = true, double? minCacheExtent})
Create a ScrollablePositionedList whose items are provided by itemBuilder.
const
ScrollablePositionedList.separated({required int itemCount, required IndexedWidgetBuilder itemBuilder, required IndexedWidgetBuilder? separatorBuilder, Key? key, bool shrinkWrap = false, ItemScrollController? itemScrollController, ItemPositionsListener? itemPositionsListener, ScrollOffsetListener? scrollOffsetListener, int initialScrollIndex = 0, double initialAlignment = 0, Axis scrollDirection = Axis.vertical, bool reverse = false, ScrollPhysics? physics, int? semanticChildCount, EdgeInsets? padding, bool addSemanticIndexes = true, bool addAutomaticKeepAlives = true, bool addRepaintBoundaries = true, double? minCacheExtent})
Create a ScrollablePositionedList whose items are provided by itemBuilder and separators provided by separatorBuilder.
const

Properties

addAutomaticKeepAlives bool
Whether to wrap each child in an AutomaticKeepAlive.
final
addRepaintBoundaries bool
Whether to wrap each child in a RepaintBoundary.
final
addSemanticIndexes bool
Whether to wrap each child in an IndexedSemantics.
final
hashCode int
The hash code for this object.
no setterinherited
initialAlignment double
Determines where the leading edge of the item at initialScrollIndex should be placed.
final
initialScrollIndex int
Index of an item to initially align within the viewport.
final
itemBuilder IndexedWidgetBuilder
Called to build children for the list with 0 <= index < itemCount.
final
itemCount int
Number of items the itemBuilder can produce.
final
itemPositionsNotifier → ItemPositionsNotifier?
Notifier that reports the items laid out in the list after each frame.
final
itemScrollController ItemScrollController?
Controller for jumping or scrolling to an item.
final
key Key?
Controls how one widget replaces another widget in the tree.
finalinherited
minCacheExtent double?
The minimum cache extent used by the underlying scroll lists. See ScrollView.cacheExtent.
final
padding EdgeInsets?
The amount of space by which to inset the children.
final
physics ScrollPhysics?
How the scroll view should respond to user input.
final
reverse bool
Whether the view 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 scrolls.
final
scrollOffsetNotifier → ScrollOffsetNotifier?
Notifier that reports the changes to the scroll offset.
final
semanticChildCount int?
The number of children that will contribute semantic information.
final
separatorBuilder IndexedWidgetBuilder?
Called to build separators for between each item in the list. Called with 0 <= index < itemCount - 1.
final
shrinkWrap bool
{@template flutter.widgets.scroll_view.shrinkWrap} Whether the extent of the scroll view in the scrollDirection should be determined by the contents being viewed.
final

Methods

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