GridView<T> class

A scrollable grid of selectable items with keyboard navigation.

Uses selectedBuilder and unselectedBuilder to customize the appearance of items. Supports arrow-key navigation and Enter to select.

Inheritance

Constructors

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

Properties

crossAxisCount int
The number of columns in the grid.
final
crossAxisSpacing int
The horizontal spacing between columns.
final
hashCode int
The hash code for this object.
no setterinherited
initialSelectedIndex int
The index of the initially selected item.
final
items List<T>
The list of data items to display in the grid.
final
key Key?
Controls how one widget replaces another in the tree.
finalinherited
mainAxisSpacing int
The vertical spacing between rows.
final
onItemSelected → void Function(int index, T item)?
Called when the user activates a selected item.
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
selectedBuilder Widget Function(T item)
Builder for the currently selected item's appearance.
final
unselectedBuilder Widget Function(T item)
Builder for unselected items' appearance.
final
wrapAroundNavigation bool
Whether navigation wraps around at grid boundaries.
final

Methods

createElement() StatefulElement
Creates the Element for this widget.
inherited
createState() State<GridView<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