FocusManager class abstract
Manages focus state and hierarchy for a set of FocusNodes.
Constructors
Properties
- changed ← FocusCallback?
-
Set a callback to be invoked when focus changes.
Pass null to remove the callback.
no getter
- hashCode → int
-
The hash code for this object.
no setterinherited
- nativePointerAddress → int?
-
Get the native pointer address for this focus manager.
Used internally for sharing focus managers across FFI boundaries.
Returns null on platforms that don't support this (e.g., web).
no setter
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- scrollIntoView ← ScrollIntoViewCallback?
-
Set a callback to be invoked when focus changes to an element in a
Dart-mounted artboard (root artboard with no native host).
This allows Dart to handle scrolling the focused element into view.
Pass null to remove the callback.
no getter
Methods
-
addChild(
FocusNode? parent, FocusNode child) → void -
Add a child node to the hierarchy.
If
parentis null, the child is added as a root node. -
clearFocus(
) → void - Clear the current focus.
-
dispose(
) → void - Dispose of this focus manager and release native resources.
-
dropFocusIfFocusTargetHidden(
) → void - Clear focus if the current target is hidden.
-
focusDown(
) → bool - Move focus to the nearest focusable node below. Returns true if focus was moved.
-
focusLeft(
) → bool - Move focus to the nearest focusable node to the left. Returns true if focus was moved.
-
focusNext(
) → bool - Move focus to the next focusable node. Returns true if focus was moved.
-
focusPrevious(
) → bool - Move focus to the previous focusable node. Returns true if focus was moved.
-
focusRight(
) → bool - Move focus to the nearest focusable node to the right. Returns true if focus was moved.
-
focusUp(
) → bool - Move focus to the nearest focusable node above. Returns true if focus was moved.
-
hasFocus(
FocusNode node) → bool - Check if the given node or any of its descendants has focus.
-
hasPrimaryFocus(
FocusNode node) → bool - Check if the given node is the primary focus.
-
isFocusInArtboard(
int artboardPtr) → bool -
Check if the primary focus is inside the given artboard (or a nested
artboard within it). Returns true if the focused element's artboard is
the given artboard or a descendant of it.
artboardPtrshould be a native artboard pointer address. -
keyInput(
int key, int modifiers, bool isPressed, bool isRepeat) → bool - Route key input to the focused node. Returns true if the input was handled.
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
primaryFocusArtboardPtr(
) → int? - Get the root native artboard pointer address that contains the primary focus. This walks up the nested artboard chain to find the topmost artboard. Returns null if there is no focus or the focusable has no artboard.
-
primaryFocusBounds(
) → ({double maxX, double maxY, double minX, double minY})? - Get the world bounds of the primary focus node. Returns null if there is no focus or the focused node has no bounds. Bounds are in root artboard space.
-
primaryFocusImmediateArtboardPtr(
) → int? - Get the immediate native artboard pointer address that contains the primary focus. Unlike primaryFocusArtboardPtr, this does NOT walk up the nested artboard chain - it returns the direct parent artboard. This can be compared against MountedArtboard native pointer addresses to find which NestedArtboard hosts the focused element.
-
removeChild(
FocusNode child) → void - Remove a child node from the hierarchy. The child knows its own parent, so no parent parameter is needed.
-
setFocus(
FocusNode node) → void - Set focus to the given node.
-
textInput(
String text) → bool - Route text input to the focused node. Returns true if the input was handled.
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited
Static Methods
-
make(
) → FocusManager - Create a new FocusManager.