moveDown method
void
moveDown()
Moves focus down by one row with wrapping.
Maintains the same column position when possible. Wraps from bottom row to top row.
Implementation
void moveDown() {
if (_itemCount == 0) return;
final col = _focusedIndex % _columns;
var row = _focusedIndex ~/ _columns;
final totalRows = rows;
// Try each row below, wrapping around
for (var i = 0; i < totalRows; i++) {
row = (row + 1) % totalRows;
final candidate = row * _columns + col;
if (candidate < _itemCount) {
_focusedIndex = candidate;
return;
}
}
}