Skip to main content

UndoManager

Struct UndoManager 

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

A low-level interface to the system’s undo manager.

To receive events from the system undo manager, create an UndoManagerClient and set it as the client on UndoManager.

The set_undo_state method can be used to update the system’s undo manager using the can_undo and can_redo parameters.

When the system undo or redo button is tapped, the current UndoManagerClient will receive UndoManagerClient::handle_platform_undo with an UndoDirection representing whether the event is “undo” or “redo”.

Currently, only iOS has an UndoManagerPlugin implemented on the engine side. On iOS, this can be used to listen to the keyboard undo/redo buttons and the undo/redo gestures.

See also:

Dart’s UndoManager._instance is instance, the App’s singleton.

Implementations§

Source§

impl UndoManager

Source

pub fn instance(app: &mut App) -> Handle<UndoManager>

Dart’s UndoManager._instance.

Source

pub fn set_client(app: &mut App, client: Option<AnyUndoManagerClient>)

Receive undo and redo events from the system’s UndoManager.

Setting the client will cause UndoManagerClient::handle_platform_undo to be called when a system undo or redo is triggered, such as by tapping the undo/redo keyboard buttons or using the 3-finger swipe gestures.

Source

pub fn client(app: &mut App) -> Option<AnyUndoManagerClient>

Return the current UndoManagerClient.

Source

pub fn set_undo_state(_app: &mut App, _can_undo: bool, _can_redo: bool)

Set the current state of the system UndoManager. [can_undo] and [can_redo] control the respective “undo” and “redo” buttons of the system UndoManager.

Empty: there is no method channel.

Source

pub fn handle_platform_undo(app: &mut App, direction: UndoDirection)

Flutter UndoManagerClient.handleUndo: the host asked for undo or redo.

Trait Implementations§

Source§

impl Default for UndoManager

Source§

fn default() -> Self

Returns the “default value” for a type. Read more

Auto Trait Implementations§

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>

Source§

impl<T> WasmNotSend for T
where T: Send,

Source§

impl<T> WasmNotSendSync for T

Source§

impl<T> WasmNotSync for T
where T: Sync,