FocusNode class

A representation of a node in the focus tree.

Implementers

Constructors

FocusNode({required String id})
Creates a new FocusNode with the given id.

Properties

children → List<FocusNode>
The children focus nodes nested under this node.
final
hasFocus → bool
Whether this node currently has focus.
no setter
hashCode → int
The hash code for this object.
no setterinherited
hasPrimaryFocus → bool
Whether this node has primary focus, meaning it is focused and none of its children are.
no setter
id → String
Unique identifier of the focus node (useful for debugging).
final
isFocused → bool
Whether this node currently holds focus.
no setter
onFocusChange ↔ void Function(bool hasFocus)?
Callback executed when this focus node gains or loses focus.
getter/setter pair
onKeyEvent ↔ bool Function(KeyEvent event)?
Callback executed when a key event hits this node. Return true to consume the keypress and prevent it from bubbling.
getter/setter pair
parent ↔ FocusNode?
The parent focus node, if any.
getter/setter pair
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited

Methods

addChild(FocusNode child) → void
Adds a child focus node to this branch.
bubbleKeyEvent(KeyEvent event) → bool
Bubbles the event up the parent chain starting from the focused leaf.
dispose() → void
Disposes of the focus node, detaching it from the tree.
findFocusedLeaf() → FocusNode?
Traverses down the focused path to find the deeply focused leaf node.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
removeChild(FocusNode child) → void
Removes a child focus node from this branch.
requestFocus() → void
Request focus for this specific node.
toString() → String
A string representation of this object.
inherited
unfocus() → void
Removes focus from this node.

Operators

operator ==(Object other) → bool
The equality operator.
inherited