FocusTraversalPolicy class Null safety
An object used to specify a focus traversal policy used for configuring a FocusTraversalGroup widget.
The focus traversal policy is what determines which widget is "next", "previous", or in a direction from the widget associated with the currently focused FocusNode (usually a Focus widget).
One of the pre-defined subclasses may be used, or define a custom policy to create a unique focus order.
When defining your own, your subclass should implement sortDescendants to provide the order in which you would like the descendants to be traversed.
See also:
- FocusNode, for a description of the focus system.
- FocusTraversalGroup, a widget that groups together and imposes a traversal policy on the Focus nodes below it in the widget hierarchy.
- FocusNode, which is affected by the traversal policy.
- WidgetOrderTraversalPolicy, a policy that relies on the widget creation order to describe the order of traversal.
- ReadingOrderTraversalPolicy, a policy that describes the order as the natural "reading order" for the current Directionality.
- OrderedTraversalPolicy, a policy that describes the order explicitly using FocusTraversalOrder widgets.
- DirectionalFocusTraversalPolicyMixin a mixin class that implements focus traversal in a direction.
- Mixed in types
- Implementers
- Annotations
Constructors
- FocusTraversalPolicy()
-
Abstract const constructor. This constructor enables subclasses to provide
const constructors so that they can be used in const expressions.
const
Properties
- hashCode → int
-
The hash code for this object.
read-onlyinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
read-onlyinherited
Methods
-
changedScope(
{FocusNode? node, FocusScopeNode? oldScope}) → void -
This is called whenever the given
node
is re-parented into a new scope, so that the policy has a chance to update or invalidate any cached data that it maintains per scope about the node.mustCallSuper">@mustCallSuper -
debugFillProperties(
DiagnosticPropertiesBuilder properties) → void - Add additional properties associated with the node.
-
findFirstFocus(
FocusNode currentNode) → FocusNode? - Returns the node that should receive focus if focus is traversing forwards, and there is no current focus.
-
findFirstFocusInDirection(
FocusNode currentNode, TraversalDirection direction) → FocusNode? -
Returns the first node in the given
direction
that should receive focus if there is no current focus in the scope to which thecurrentNode
belongs. -
findLastFocus(
FocusNode currentNode) → FocusNode - Returns the node that should receive focus if focus is traversing backwards, and there is no current focus.
-
inDirection(
FocusNode currentNode, TraversalDirection direction) → bool -
Focuses the next widget in the given
direction
in the focus scope that contains the givencurrentNode
. -
invalidateScopeData(
FocusScopeNode node) → void -
Clears the data associated with the given FocusScopeNode for this object.
mustCallSuper">@mustCallSuperprotected">@protected
-
next(
FocusNode currentNode) → bool -
Focuses the next widget in the focus scope that contains the given
currentNode
. -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a non-existent method or property is accessed.
inherited
-
previous(
FocusNode currentNode) → bool -
Focuses the previous widget in the focus scope that contains the given
currentNode
. -
sortDescendants(
Iterable< FocusNode> descendants, FocusNode currentNode) → Iterable<FocusNode> -
Sorts the given
descendants
into focus order.protected">@protected -
toDiagnosticsNode(
{String? name, DiagnosticsTreeStyle? style}) → DiagnosticsNode -
Returns a debug representation of the object that is used by debugging
tools and by DiagnosticsNode.toStringDeep.
inherited
-
toString(
{DiagnosticLevel minLevel = DiagnosticLevel.info}) → String -
A string representation of this object.
inherited
-
toStringShort(
) → String -
A brief description of this object, usually just the runtimeType and the
hashCode.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited