moveFocus method

void moveFocus(
  1. int delta
)

Move the keyboard cursor by delta rows through the visible list.

Implementation

void moveFocus(int delta) {
  final rows = visibleRows();
  if (rows.isEmpty) return;
  final cur = focused;
  var idx = rows.indexWhere((r) => r.node.id == cur);
  if (idx < 0) idx = delta > 0 ? -1 : rows.length;
  final next = (idx + delta).clamp(0, rows.length - 1);
  _focused = rows[next].node.id;
  notifyListeners();
}