Class

UndoState

Controls the undo and redo history for a TextFieldState.

Source set: Common
public class UndoState internal constructor(private val state: TextFieldState)

Controls the undo and redo history for a TextFieldState.

Properties

canUndo

Source set: Common
public val canUndo: Boolean

Whether an undo action can currently be performed.

If this value is false, calling undo is a no-op. This property is backed by snapshot state and will cause recomposition when its value changes.

canRedo

Source set: Common
public val canRedo: Boolean

Whether a redo action can currently be performed.

If this value is false, calling redo is a no-op. This property is backed by snapshot state and will cause recomposition when its value changes.

Functions

undo

Source set: Common
public fun undo()

Reverts the latest edit action or a group of actions that are merged together.

If canUndo is false, this is a no-op. Calling it repeatedly continues undoing previous actions.

redo

Source set: Common
public fun redo()

Re-applies a change that was previously reverted via undo.

If canRedo is false, this is a no-op.

clearHistory

Source set: Common
public fun clearHistory()

Clears all undo and redo history up to this point.

Calling this sets both canUndo and canRedo to false.

Jetpack Compose beyond MaterialFree components, screens and templates for apps that don’t look like Google’s. Copy them into your app, or let your coding agent add them.Browse for free

Content updated: