OudsPasswordInputState

The editable text state of a password input, including the text itself, the position of the cursor or selection, and the password visibility.

To change the password input contents programmatically, call edit, setTextAndSelectAll, setTextAndPlaceCursorAtEnd, or clearText. Individual parts of the state like text, selection, or composition can be read from any snapshot restart scope like Composable functions. To observe these members from outside a restart scope, use snapshotFlow { passwordInputState.text } or snapshotFlow { passwordInputState.selection }.

When instantiating this class from a composable, use rememberOudsPasswordInputState to automatically save and restore the password input state. For more advanced use cases, pass OudsPasswordInputState.Saver to rememberSaveable.

Constructors

Link copied to clipboard
constructor(initialText: String = "", initialSelection: TextRange = TextRange(initialText.length), initialIsPasswordHidden: Boolean = true)

Creates an instance of OudsPasswordInputState.

Types

Link copied to clipboard
object Companion

Properties

Link copied to clipboard

The current composing range dictated by the IME. If null, there is no composing region.

Link copied to clipboard

Indicates if the password is hidden (masked).

Link copied to clipboard

The current selection range. If the selection is collapsed, it represents cursor location. This value will automatically update when the user enters text or otherwise changes the password input selection range. To change it programmatically, call edit.

Link copied to clipboard

The current text content. This value will automatically update when the user enters text or otherwise changes the password input contents. To change it programmatically, call edit.

Link copied to clipboard

Functions

Link copied to clipboard

Deletes all the text in the state.

Link copied to clipboard
inline fun edit(block: TextFieldBuffer.() -> Unit)

Runs block with a mutable version of the current state. The block can make changes to the text and cursor/selection. See the documentation on TextFieldBuffer for a more detailed description of the available operations.

Link copied to clipboard

Sets the text in this OudsPasswordInputState to text, replacing any text that was previously there, and places the cursor at the end of the new text.

Link copied to clipboard

Sets the text in this OudsPasswordInputState to text, replacing any text that was previously there, and selects all the text.

Link copied to clipboard
open override fun toString(): String
Link copied to clipboard

Creates a temporary, mutable TextFieldBuffer representing the current state of this OudsPasswordInputState.