inDirection method
Focuses the next widget in the given direction in the focus scope that
contains the given currentNode.
This should determine what the next node to receive focus in the given
direction should be by inspecting the node tree, and then calling
FocusNode.requestFocus on the node that has been selected.
Returns true if it successfully found a node and requested focus.
Implementation
@override
bool inDirection(FocusNode currentNode, TraversalDirection direction) {
final scope = currentNode.nearestScope;
if (scope == null) {
return super.inDirection(currentNode, direction);
}
final rowEnds =
!_isVertical(direction) &&
_isRemote(currentNode) &&
!_hasTargetInBand(scope, direction);
if (!rowEnds && super.inDirection(currentNode, direction)) {
return true;
}
final found = _findOutside(scope, currentNode.rect, direction);
if (found == null) {
return false;
}
_focusAcross(scope, found, direction);
return true;
}