Focus constructor Null safety
- {Key? key,
- required Widget child,
- FocusNode? focusNode,
- bool autofocus = false,
- ValueChanged<
bool> ? onFocusChange, - FocusOnKeyEventCallback? onKeyEvent,
- FocusOnKeyCallback? onKey,
- bool? canRequestFocus,
- bool? skipTraversal,
- bool? descendantsAreFocusable,
- bool? descendantsAreTraversable,
- bool includeSemantics = true,
- String? debugLabel}
Creates a widget that manages a FocusNode.
The child argument is required and must not be null.
The autofocus argument must not be null.
Implementation
const Focus({
super.key,
required this.child,
this.focusNode,
this.autofocus = false,
this.onFocusChange,
FocusOnKeyEventCallback? onKeyEvent,
FocusOnKeyCallback? onKey,
bool? canRequestFocus,
bool? skipTraversal,
bool? descendantsAreFocusable,
bool? descendantsAreTraversable,
this.includeSemantics = true,
String? debugLabel,
}) : _onKeyEvent = onKeyEvent,
_onKey = onKey,
_canRequestFocus = canRequestFocus,
_skipTraversal = skipTraversal,
_descendantsAreFocusable = descendantsAreFocusable,
_descendantsAreTraversable = descendantsAreTraversable,
_debugLabel = debugLabel,
assert(child != null),
assert(autofocus != null),
assert(includeSemantics != null);