ListView class

A scrollable list of child widgets.

Inheritance

Constructors

ListView({Key? key, required List<Widget> children, int selectedIndex = 0, int? hoveredIndex, Style itemStyle = Style.empty, Style selectedStyle = const Style(modifiers: Modifier.reverse), Style? hoveredStyle, bool showScrollbar = false, void onSelect(int)?, void onHover(int?)?})
Creates a ListView containing the specified children.
ListView.fromStrings(List<String> items, {Key? key, int selectedIndex = 0, int? hoveredIndex, Style itemStyle = Style.empty, Style selectedStyle = const Style(modifiers: Modifier.reverse), Style? hoveredStyle, bool showScrollbar = false, void onSelect(int)?, void onHover(int?)?})
Creates a ListView from a list of raw string items.
factory
ListView.raw({Key? key, required List<String> lines, int selectedIndex = 0, int? hoveredIndex, Style itemStyle = Style.empty, Style selectedStyle = const Style(modifiers: Modifier.reverse), Style? hoveredStyle, bool showScrollbar = false, void onSelect(int)?, void onHover(int?)?})
Creates a high-performance ListView that bypasses the element tree for raw lines.
factory

Properties

children → List<Widget>
The child widgets inside the list.
final
hashCode → int
The hash code for this object.
no setterinherited
hoveredStyle → Style?
The style applied to the hovered list item, if any.
final
initialHoveredIndex → int?
The initially hovered item index.
final
initialSelectedIndex → int
The initially selected item index.
final
itemStyle → Style
The style applied to unselected list items.
final
key → Key?
The optional key for this widget.
finalinherited
onHover → void Function(int?)?
Callback when an item is hovered by mouse.
final
onSelect → void Function(int)?
Callback when an item is selected by mouse click or other interaction.
final
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
selectedStyle → Style
The style applied to the currently selected list item.
final
showScrollbar → bool
Whether to render a vertical scrollbar on the right edge.
final

Methods

createElement() → Element
Creates an Element to manage this widget's location in the tree.
override
getIntrinsicHeight(int width) → int
Computes the intrinsic height of this widget under the given width constraint.
inherited
getIntrinsicWidth(int height) → int
Computes the intrinsic width of this widget under the given height constraint.
inherited
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