ListWidget class

A scrollable list of string items.

Example usage:

final listWidget = ListWidget(
  ['Item 1', 'Item 2', 'Item 3'],
  selectedIndex: 1,
  selectedStyle: Style(modifiers: Modifier.reverse),
);
Inheritance

Constructors

ListWidget(List<String> items, {int selectedIndex = 0, Style itemStyle = Style.empty, Style selectedStyle = const Style(modifiers: Modifier.reverse)})
Creates a ListWidget to display a selectable list of items.

Properties

hashCode int
The hash code for this object.
no setterinherited
items List<String>
The items to display in the list.
final
itemStyle Style
The style applied to unselected items.
final
key Key?
The optional key for this widget.
finalinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
scrollOffset int
The current scroll offset, representing the index of the first visible item.
getter/setter pair
selectedIndex int
The currently selected item index.
getter/setter pair
selectedStyle Style
The style applied to the selected item.
final

Methods

adjustScroll(int viewportHeight) → void
Updates scroll offset based on selected index to keep selection visible.
createElement() Element
Creates an Element to manage this widget's location in the tree.
inherited
getIntrinsicHeight(int width) int
Computes the intrinsic height of this widget under the given width constraint.
inherited
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
render(Buffer buffer, Rect area) → void
Renders the widget onto the provided buffer within the specified area.
override
toString() String
A string representation of this object.
inherited

Operators

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