PositionedList class

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

PositionedList lays out children in the same way as ListView.

The list can be displayed with the item at positionIndex positioned at a particular alignment. See ItemScrollController.jumpTo for an explanation of alignment.

All other parameters are the same as specified in ListView.

Inheritance

Constructors

PositionedList({Key? key, required int itemCount, required IndexedWidgetBuilder itemBuilder, IndexedWidgetBuilder? separatorBuilder, ScrollController? controller, ItemPositionsNotifier? itemPositionsNotifier, int positionedIndex = 0, double alignment = 0, Axis scrollDirection = Axis.vertical, bool reverse = false, bool shrinkWrap = false, ScrollPhysics? physics, EdgeInsets? padding, double? cacheExtent, int? semanticChildCount, bool addSemanticIndexes = true, bool addRepaintBoundaries = true, bool addAutomaticKeepAlives = true, ChildIndexGetter? findChildIndexCallback, ScrollViewKeyboardDismissBehavior keyboardDismissBehavior = ScrollViewKeyboardDismissBehavior.manual})
Create a PositionedList.
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
alignment double
Determines where the leading edge of the item at positionedIndex should be placed.
final
cacheExtent double?
final
controller ScrollController?
An object that can be used to control the position to which this scroll view is scrolled.
final
findChildIndexCallback ChildIndexGetter?
Called to find the new index of a child based on its key in case of reordering.
final
hashCode int
The hash code for this object.
no setterinherited
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
key Key?
Controls how one widget replaces another widget in the tree.
finalinherited
keyboardDismissBehavior ScrollViewKeyboardDismissBehavior
Defines how this ScrollView will dismiss the keyboard automatically.
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
positionedIndex int
Index of an item to initially align to a position within the viewport defined by alignment.
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
semanticChildCount int?
The number of children that will contribute semantic information.
final
separatorBuilder IndexedWidgetBuilder?
If not null, 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