GridNavigator constructor
Creates a grid navigation with fixed column count.
itemCount is the total number of items.
columns is the number of columns (must be >= 1).
initialIndex is the starting focus (defaults to 0).
Implementation
GridNavigator({
required int itemCount,
required int columns,
int initialIndex = 0,
}) : _itemCount = max(0, itemCount),
_columns = max(1, columns),
_focusedIndex = 0 {
_focusedIndex = _itemCount > 0 ? initialIndex.clamp(0, _itemCount - 1) : 0;
}