ListView<T> class

A scrollable list of selectable items with keyboard navigation.

Supports custom selectedBuilder and unselectedBuilder for rendering each item. Arrow keys navigate, Enter/Space selects.

Inheritance

Constructors

ListView({Key? key, required List<T> items, Widget selectedBuilder(T item)?, Widget unselectedBuilder(T item)?, int initialSelectedIndex = 0, void onItemSelected(int index, T item)?, bool wrapAroundNavigation = false, ScrollController? controller, int? itemExtent})
Creates a ListView with the given items and optional builders.
const

Properties

controller ScrollController?
An optional external scroll controller.
final
hashCode int
The hash code for this object.
no setterinherited
initialSelectedIndex int
The index of the item initially selected.
final
itemExtent int?
An optional fixed height for each item row.
final
items List<T>
The list of items to display.
final
key Key?
Controls how one widget replaces another in the tree.
finalinherited
onItemSelected → void Function(int index, T item)?
A callback invoked when the user presses Enter or Space on an item.
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
selectedBuilder Widget Function(T item)
A builder that creates the widget for the currently selected item.
final
unselectedBuilder Widget Function(T item)
A builder that creates the widget for unselected items.
final
wrapAroundNavigation bool
Whether navigation wraps around at the top and bottom of the list.
final

Methods

createElement() StatefulElement
Creates the Element for this widget.
inherited
createState() State<ListView<T>>
Creates the mutable state for this widget.
override
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited