Function

toTextFieldBuffer

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

TextFieldStateApplyOutputTransformation

@Suppress("UNUSED_VARIABLE")
@Sampled
@Composable
fun TextFieldStateApplyOutputTransformation() {
    val state = TextFieldState("Hello, World")
    val outputTransformation = OutputTransformation { insert(0, "> ") }

    val buffer = state.toTextFieldBuffer()
    with(outputTransformation) { buffer.transformOutput() }

    val transformedText = buffer.asCharSequence()
    val transformedSelection = buffer.selection
}
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: