Focus class

A widget that manages a FocusNode to allow keyboard focus tracking and traversal in the widget tree.

Inheritance
Implementers

Constructors

Focus({Key? key, required Widget child, FocusNode? focusNode, bool autofocus = false, bool onKeyEvent(KeyEvent event)?, void onFocusChange(bool hasFocus)?})
Creates a new Focus widget.
const

Properties

autofocus → bool
Whether this focus node should automatically request focus when mounted.
final
child → Widget
The child subtree that this focus widget hosts.
final
focusNode → FocusNode?
The focus node that represents the focus handle.
final
hashCode → int
The hash code for this object.
no setterinherited
key → Key?
The optional key for this widget.
finalinherited
onFocusChange → void Function(bool hasFocus)?
Callback executed when this focus node gains or loses focus.
final
onKeyEvent → bool Function(KeyEvent event)?
Callback executed when a key event hits this node.
final
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited

Methods

createElement() → Element
Creates an Element to manage this widget's location in the tree.
inherited
createState() → State<Focus>
Creates the mutable state for this widget at a given location in the tree.
override
getIntrinsicHeight(int width) → int
Computes the intrinsic height of this widget under the given width constraint.
inherited
getIntrinsicWidth(int height) → int
Computes the intrinsic width of this widget under the given height constraint.
inherited
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() → String
A string representation of this object.
inherited

Operators

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

Static Methods

of(BuildContext context) → FocusNode?
Finds the nearest ancestor FocusNode in the widget tree.