FocusNode constructor
- {String? debugLabel,
- FocusOnKeyCallback? onKey,
- FocusOnKeyEventCallback? onKeyEvent,
- bool skipTraversal = false,
- bool canRequestFocus = true,
- bool descendantsAreFocusable = true,
- bool descendantsAreTraversable = true}
Creates a focus node.
The debugLabel
is ignored on release builds.
To receive key events that focuses on this node, pass a listener to onKeyEvent
.
The onKey
is a legacy API based on RawKeyEvent and will be deprecated
in the future.
Implementation
FocusNode({
String? debugLabel,
this.onKey,
this.onKeyEvent,
bool skipTraversal = false,
bool canRequestFocus = true,
bool descendantsAreFocusable = true,
bool descendantsAreTraversable = true,
}) : _skipTraversal = skipTraversal,
_canRequestFocus = canRequestFocus,
_descendantsAreFocusable = descendantsAreFocusable,
_descendantsAreTraversable = descendantsAreTraversable {
// Set it via the setter so that it does nothing on release builds.
this.debugLabel = debugLabel;
if (kFlutterMemoryAllocationsEnabled) {
ChangeNotifier.maybeDispatchObjectCreation(this);
}
}