findLastFocus method

FocusNode findLastFocus(
  1. FocusNode currentNode, {
  2. bool ignoreCurrentFocus = false,
})

Returns the node that should receive focus if focus is traversing backwards, and there is no current focus.

The node returned is the one that should receive focus if focus is traversing backwards (i.e. with previous), and there is no current focus in the nearest FocusScopeNode that currentNode belongs to.

If ignoreCurrentFocus is false or not given, this function returns the FocusScopeNode.focusedChild, if set, on the nearest scope of the currentNode, otherwise, returns the last node from sortDescendants, or the given currentNode if there are no descendants.

If ignoreCurrentFocus is true, then the algorithm returns the last node from sortDescendants, or the given currentNode if there are no descendants.

See also:

Implementation

FocusNode findLastFocus(FocusNode currentNode, {bool ignoreCurrentFocus = false}) {
  return _findInitialFocus(currentNode, fromEnd: true, ignoreCurrentFocus: ignoreCurrentFocus);
}