DirectionalFocusTraversalPolicyMixin mixin
A mixin class that provides an implementation for finding a node in a particular direction.
This can be mixed in to other FocusTraversalPolicy implementations that only want to implement new next/previous policies.
Since hysteresis in the navigation order is undesirable, this implementation maintains a stack of previous locations that have been visited on the policy data for the affected FocusScopeNode. If the previous direction was the opposite of the current direction, then the this policy will request focus on the previously focused node. Change to another direction other than the current one or its opposite will clear the stack.
For instance, if the focus moves down, down, down, and then up, up, up, it will follow the same path through the widgets in both directions. However, if it moves down, down, down, left, right, and then up, up, up, it may not follow the same path on the way up as it did on the way down, since changing the axis of motion resets the history.
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.
- 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.
- Superclass Constraints
- Implemented by
Constructors
Properties
- hashCode → int
-
The hash code for this object. [...]
read-only, inherited
- runtimeType → Type
-
A representation of the runtime type of the object.
read-only, inherited
Methods
-
invalidateScopeData(
FocusScopeNode node ) → void -
Clears the data associated with the given FocusScopeNode for this object. [...]
override
-
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. [...]override -
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. [...]override -
inDirection(
FocusNode currentNode, TraversalDirection direction ) → bool -
Focuses the next widget in the given
direction
in the FocusScope that contains thecurrentNode
. [...]@mustCallSuper, override -
findFirstFocus(
FocusNode currentNode ) → FocusNode -
Returns the node that should receive focus if focus is traversing
forwards, and there is no current focus. [...]
inherited
-
findLastFocus(
FocusNode currentNode ) → FocusNode -
Returns the node that should receive focus if focus is traversing
backwards, and there is no current focus. [...]
inherited
-
next(
FocusNode currentNode ) → bool -
Focuses the next widget in the focus scope that contains the given
currentNode
. [...]inherited -
previous(
FocusNode currentNode ) → bool -
Focuses the previous widget in the focus scope that contains the given
currentNode
. [...]inherited -
sortDescendants(
Iterable< FocusNode> descendants,FocusNode currentNode ) → Iterable< FocusNode> -
Sorts the given
descendants
into focus order. [...]@protected, inherited -
toString(
{DiagnosticLevel minLevel: DiagnosticLevel.info} ) → String -
Returns a string representation of this object.
inherited
-
noSuchMethod(
Invocation invocation ) → dynamic -
Invoked when a non-existent method or property is accessed. [...]
inherited
-
toStringShort(
) → String -
A brief description of this object, usually just the runtimeType and the
hashCode. [...]
inherited
-
toDiagnosticsNode(
{String name, DiagnosticsTreeStyle style} ) → DiagnosticsNode -
Returns a debug representation of the object that is used by debugging
tools and by DiagnosticsNode.toStringDeep. [...]
inherited
-
debugFillProperties(
DiagnosticPropertiesBuilder properties ) → void -
Add additional properties associated with the node. [...]
@mustCallSuper, @protected, inherited
Operators
-
operator ==(
Object other ) → bool -
The equality operator. [...]
inherited