okaymak
09/29/2022, 11:55 AMTextField
? I basically want the TextField
to be just for input and without selection, magnifier, copy or paste.Stylianos Gakis
09/29/2022, 1:35 PMTextField
would normally do. It most likely gives you more control to achieve what you want over the normal TextField
okaymak
09/29/2022, 1:46 PMBasicTextField
, but that doesn’t give me more control. I even tried to wrap it in a DisableSelection
but that apparently only works for Text
.Stylianos Gakis
09/29/2022, 1:50 PMStylianos Gakis
09/29/2022, 1:52 PMAle Stamato
09/29/2022, 3:14 PMAle Stamato
09/29/2022, 3:15 PMCompositionLocalProvider(
LocalTextToolbar provides CustomTextToolbar()
) {
var text by remember { mutableStateOf("") }
BasicTextField(value = text, onValueChange = { text = it })
}
import androidx.compose.ui.platform.TextToolbar
import androidx.compose.ui.platform.TextToolbarStatus
class CustomTextToolbar : TextToolbar {
override fun hide() {}
override val status: TextToolbarStatus = TextToolbarStatus.Hidden
override fun showMenu(
rect: androidx.compose.ui.geometry.Rect,
onCopyRequested: (() -> Unit)?,
onPasteRequested: (() -> Unit)?,
onCutRequested: (() -> Unit)?,
onSelectAllRequested: (() -> Unit)?
) {
}
}
Ale Stamato
09/29/2022, 3:16 PMokaymak
09/30/2022, 8:00 AMTextToolbar
. Hiding the handle by making the color transparent works, but it also makes the cursor disappear on first focus.Ale Stamato
09/30/2022, 11:40 AMokaymak
09/30/2022, 11:43 AM