moveDown method
Move selection down by n rows.
Implementation
void moveDown(int n) {
_cursor = (_cursor + n).clamp(0, _rows.length - 1);
updateViewport();
if (_end == _rows.length && _viewport.yOffset > 0) {
_viewport = _viewport.copyWith(
yOffset: (_viewport.yOffset - n).clamp(1, _viewport.height ?? 0),
);
} else if (_cursor > (_end - _start) ~/ 2 && _viewport.yOffset > 0) {
_viewport = _viewport.copyWith(
yOffset: (_viewport.yOffset - n).clamp(1, _cursor),
);
} else if (_viewport.yOffset > 1) {
// Keep current offset
} else if (_cursor > (_viewport.yOffset + (_viewport.height ?? 0) - 1)) {
_viewport = _viewport.copyWith(
yOffset: (_viewport.yOffset + 1).clamp(0, 1),
);
}
}