nextFocus method

void nextFocus()

Moves focus to the next focusable node in the scope.

Implementation

void nextFocus() {
  final chain = _focusableNodes;
  if (chain.isEmpty) return;
  final current = _nodes[_currentIndex];
  final chainIndex = chain.indexOf(current);
  final nextChainIndex = (chainIndex + 1) % chain.length;
  final target = chain[nextChainIndex];
  final targetIndex = _nodes.indexOf(target);
  _setFocusAtIndex(targetIndex);
}