canRequestFocus property

bool canRequestFocus
final

If true, this widget may request the primary focus.

Defaults to true. Set to false if you want the FocusNode this widget manages to do nothing when requestFocus is called on it. Does not affect the children of this node, and FocusNode.hasFocus can still return true if this node is the ancestor of the primary focus.

This is different than skipTraversal because skipTraversal still allows the widget to be focused, just not traversed to.

Setting canRequestFocus to false implies that the widget will also be skipped for traversal purposes.

See also:

  • DefaultFocusTraversal, a widget that sets the traversal policy for its descendants.
  • FocusTraversalPolicy, a class that can be extended to describe a traversal policy.

Implementation

final bool canRequestFocus