FocusManager class

Manages the focus tree.

The focus tree keeps track of which FocusNode is the user's current keyboard focus. The widget that owns the FocusNode often listens for keyboard events.

The focus manager is responsible for holding the FocusScopeNode that is the root of the focus tree and tracking which FocusNode has the overall focus.

The FocusManager is held by the WidgetsBinding as WidgetsBinding.focusManager. The FocusManager is rarely accessed directly. Instead, to find the FocusScopeNode for a given BuildContext, use FocusScope.of.

The FocusManager knows nothing about FocusNodes other than the one that is currently focused. If a FocusScopeNode is removed, then the FocusManager will attempt to focus the next FocusScopeNode in the focus tree that it maintains, but if the current focus in that FocusScopeNode is null, it will stop there, and no FocusNode will have focus.

See also:

Mixed in types

Constructors

FocusManager()
Creates an object that manages the focus tree. [...]

Properties

primaryFocus FocusNode
The node that currently has the primary focus.
read-only
rootScope FocusScopeNode
The root FocusScopeNode in the focus tree. [...]
final
hashCode int
The hash code for this object. [...]
read-only, inherited
runtimeType Type
A representation of the runtime type of the object.
read-only, inherited

Methods

debugDescribeChildren() List<DiagnosticsNode>
Returns a list of DiagnosticsNode objects describing this node's children. [...]
override
debugFillProperties(DiagnosticPropertiesBuilder properties) → void
Add additional properties associated with the node. [...]
override
noSuchMethod(Invocation invocation) → dynamic
Invoked when a non-existent method or property is accessed. [...]
inherited
toDiagnosticsNode({String name, DiagnosticsTreeStyle style }) DiagnosticsNode
Returns a debug representation of the object that is used by debugging tools and by DiagnosticsNode.toStringDeep. [...]
inherited
toString({DiagnosticLevel minLevel: DiagnosticLevel.debug }) String
Returns a string representation of this object.
inherited
toStringDeep({String prefixLineOne: '', String prefixOtherLines, DiagnosticLevel minLevel: DiagnosticLevel.debug }) String
Returns a string representation of this node and its descendants. [...]
inherited
toStringShallow({String joiner: ', ', DiagnosticLevel minLevel: DiagnosticLevel.debug }) String
Returns a one-line detailed description of the object. [...]
inherited
toStringShort() String
A brief description of this object, usually just the runtimeType and the hashCode. [...]
inherited

Operators

operator ==(dynamic other) bool
The equality operator. [...]
inherited