previousFocus method

void previousFocus()

Moves focus to the previous focusable node in the scope.

Implementation

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