FocusScope class

A specialized widget to manage focus navigation traversal.

Inheritance

Constructors

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

Properties

autofocus bool
Whether this focus node should automatically request focus when mounted.
finalinherited
child Widget
The child subtree that this focus widget hosts.
finalinherited
focusNode FocusNode?
The focus node that represents the focus handle.
finalinherited
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.
finalinherited
onKeyEvent bool Function(KeyEvent event)?
Callback executed when a key event hits this node.
finalinherited
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) FocusScopeNode?
Walks up Context to obtain the closest FocusScopeNode.
override