focusNext method

bool focusNext()

Move focus to the next focusable node in widget-tree order.

Walks the element subtree rooted at rootScope depth-first, collecting every attached FocusNode that can request focus, then moves to the node after the current primaryFocus (wrapping at the end). Returns true when focus was actually moved.

Implementation

bool focusNext() {
  final current = _primaryFocus;
  if (current == null) {
    final first = rootScope.traversalPolicy.findFirstFocus(rootScope);
    if (first == null) return false;
    first.requestFocus();
    return true;
  }
  return _policyFor(current).next(current);
}