Skip to main content

DoNothingAction

Struct DoNothingAction 

Source
pub struct DoNothingAction { /* private fields */ }
Expand description

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 Action::consumes_key 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 Action::consumes_key can be set via the consumes_key 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 key set in a Shortcuts widget to do nothing.
  • DoNothingAndStopPropagationIntent, which is an intent that can be bound to a key set in a Shortcuts widget to do nothing and also stop key event propagation to other key handlers in the focus chain.

Implementations§

Source§

impl DoNothingAction

Source

pub fn new(app: &mut App) -> Ref<DoNothingAction>

Creates a DoNothingAction.

Dart’s optional consumesKey argument defaults to true.

Source

pub fn set_consumes_key(self: Handle<Self>, app: &mut App, consumes_key: bool)

Dart DoNothingAction(consumesKey:).

Trait Implementations§

Source§

impl Action for DoNothingAction

Source§

type Intent = dyn Intent

Dart’s type argument T extends Intent. Read more
Source§

fn action_data(self: Handle<Self>, app: &App) -> &ActionData

Dart’s Action fields, held under the field action (action_accessors!).
Source§

fn action_data_mut(self: Handle<Self>, app: &mut App) -> &mut ActionData

Source§

fn consumes_key(self: Handle<Self>, app: &mut App, _intent: &dyn 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. Read more
Source§

fn invoke( self: Handle<Self>, _app: &mut App, _intent: &dyn Intent, ) -> Option<Rc<dyn Any>>

Called when the action is to be performed. Read more
Source§

fn debug_fill_properties( self: Handle<Self>, app: &App, properties: &mut DiagnosticPropertiesBuilder, )

Dart’s Action.debugFillProperties, from Diagnosticable: an action adds its own fields.
Source§

fn as_action(self: Handle<Self>) -> AnyAction

This action as the erased AnyAction — what to pass where a Dart API takes an Action<Intent>. Read more
Source§

fn intent_type() -> TypeId

Gets the type of intent this action responds to.
Source§

fn calling_action(self: Handle<Self>, app: &App) -> Option<AnyAction>

The Action overridden by this Action. Read more
Source§

fn update_calling_action( self: Handle<Self>, app: &mut App, value: Option<ActionRef>, )

Sets calling_action; overridden by the overridable actions so that the default action sees it too.
Source§

fn is_enabled(self: Handle<Self>, app: &mut App, intent: &Self::Intent) -> bool

Returns true if the action is enabled and is ready to be invoked. Read more
Source§

fn is_action_enabled(self: Handle<Self>, app: &mut App) -> bool

Whether this Action is inherently enabled. Read more
Source§

fn to_key_event_result( self: Handle<Self>, app: &mut App, intent: &Self::Intent, invoke_result: Option<&Rc<dyn Any>>, ) -> KeyEventResult

Converts the result of invoke of this action to a KeyEventResult. Read more
Source§

fn add_action_listener( self: Handle<Self>, app: &mut App, listener: ActionListenerCallback, )

Register a callback to listen for changes to the state of this action. Read more
Source§

fn remove_action_listener( self: Handle<Self>, app: &mut App, listener: &ActionListenerCallback, )

Remove a previously registered closure from the list of closures that are notified when the object changes. Read more
Source§

fn notify_action_listeners(self: Handle<Self>, app: &mut App)

Call all the registered listeners. Read more
Source§

fn make_overridable_action( self: Handle<Self>, app: &mut App, context: BuildContext, ) -> ActionRef

Dart’s Action._makeOverridableAction: the overridable form of this action, which AnyAction::overridable hands back.

Auto Trait Implementations§

§

impl !RefUnwindSafe for DoNothingAction

§

impl !Send for DoNothingAction

§

impl !Sync for DoNothingAction

§

impl !UnwindSafe for DoNothingAction

§

impl Forget for DoNothingAction

§

impl Freeze for DoNothingAction
where *const u8 is !null: Freeze, PhantomData<Rc<dyn Fn(&mut App, AnyAction)>>: Freeze, NonZero<u32>: Freeze, &'static ActionVTable: Freeze, *const RcInner<Keep> is !null: Freeze, PhantomData<RcInner<Keep>>: Freeze,

§

impl Move for DoNothingAction

§

impl Unpin for DoNothingAction
where *const u8 is !null: Unpin, Rc<dyn Fn(&mut App, AnyAction)>: Unpin, NonZero<u32>: Unpin, &'static ActionVTable: Unpin, Rc<Keep>: Unpin,

§

impl UnsafeUnpin for DoNothingAction
where *const u8 is !null: UnsafeUnpin, PhantomData<Rc<dyn Fn(&mut App, AnyAction)>>: UnsafeUnpin, NonZeroU32Inner: UnsafeUnpin, &'static ActionVTable: UnsafeUnpin, *const RcInner<Keep> is !null: UnsafeUnpin, PhantomData<RcInner<Keep>>: UnsafeUnpin,

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> Downcast<T> for T

Source§

fn downcast(&self) -> &T

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> Upcast<T> for T

Source§

fn upcast(&self) -> Option<&T>