FocusController class
Controls which focusable widget is currently focused.
Constructors
Properties
- focusedId → String?
-
The currently focused ID, if any.
no setter
- hasFocus → bool
-
Returns true when any widget is focused.
no setter
- hashCode → int
-
The hash code for this object.
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- trapId → String?
-
The ID of the current focus trap, if any.
no setter
Methods
-
addListener(
FocusListener listener) → void - Adds a listener that fires when focus changes.
-
clearFocus(
) → bool - Clears focus. Returns true when focus changed.
-
isDescendant(
String id, String ancestorId) → bool -
Returns true if
idisancestorIdor one of its descendants. -
isFocused(
String id, {bool searchPath = false}) → bool -
Returns true when
idmatches the current focus. -
next(
) → void - Moves focus to the next focusable widget.
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
previous(
) → void - Moves focus to the previous focusable widget.
-
register(
String id, {String? parentId, bool focusable = true}) → void - Registers a parent-child relationship for focus IDs to support bubbling.
-
removeListener(
FocusListener listener) → void - Removes a previously added listener.
-
requestFocus(
String id) → bool -
Requests focus for
id. Returns true when focus changed. -
setTrap(
String? id) → void - Sets or clears the focus trap.
-
toString(
) → String -
A string representation of this object.
inherited
-
unregister(
String id) → void - Unregisters a focus ID.
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited