DoNothingAction class
An Action that doesn't perform any action when invoked.
Attaching a DoNothingAction to an Actions.actions mapping is a way to disable an action defined by a widget higher in the widget hierarchy.
If consumesKey returns false, then not only will this action do nothing,
but it will stop the propagation of the key event used to trigger it to
other widgets in the focus chain and tell the embedding that the key wasn't
handled, allowing text input fields or other non-Flutter elements to receive
that key event. The return value of consumesKey can be set via the
consumesKey
argument to the constructor.
This action can be bound to any Intent.
See also:
- DoNothingIntent, which is an intent that can be bound to a KeySet in a Shortcuts widget to do nothing.
- DoNothingAndStopPropagationIntent, which is an intent that can be bound to a KeySet in a Shortcuts widget to do nothing and also stop key event propagation to other key handlers in the focus chain.
Constructors
- DoNothingAction({bool consumesKey = true})
- Creates a DoNothingAction.
Properties
-
callingAction
→ Action<
Intent> ? -
The Action overridden by this Action.
no setterinherited
- hashCode → int
-
The hash code for this object.
no setterinherited
- intentType → Type
-
Gets the type of intent this action responds to.
no setterinherited
- isActionEnabled → bool
-
Whether this Action is inherently enabled.
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
addActionListener(
ActionListenerCallback listener) → void -
Register a callback to listen for changes to the state of this action.
inherited
-
consumesKey(
Intent intent) → bool -
Indicates whether this action should treat key events mapped to this
action as being "handled" when it is invoked via the key event.
override
-
debugFillProperties(
DiagnosticPropertiesBuilder properties) → void -
Add additional properties associated with the node.
inherited
-
invoke(
Intent intent) → void -
Called when the action is to be performed.
override
-
isEnabled(
Intent intent) → bool -
Returns true if the action is enabled and is ready to be invoked.
inherited
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
notifyActionListeners(
) → void -
Call all the registered listeners.
inherited
-
removeActionListener(
ActionListenerCallback listener) → void -
Remove a previously registered closure from the list of closures that are
notified when the object changes.
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
-
toKeyEventResult(
Intent intent, covariant Object? invokeResult) → KeyEventResult -
Converts the result of invoke of this action to a KeyEventResult.
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