ListNavigator constructor
Creates a new list navigation state.
itemCount is the total number of items in the list.
maxVisible is the viewport size (how many items can be shown at once).
initialIndex is the starting selection (defaults to 0).
Implementation
ListNavigator({
required int itemCount,
required int maxVisible,
int initialIndex = 0,
}) : _itemCount = max(0, itemCount),
_maxVisible = max(1, maxVisible),
_selectedIndex = 0,
_scrollOffset = 0 {
// Clamp initial index to valid range
_selectedIndex = itemCount > 0 ? initialIndex.clamp(0, itemCount - 1) : 0;
_adjustScroll();
}