How to listen for a system button to hide the keyboard in order to remove focus from the input field? Like, for example, in Google Keep.
@Composable
fun PrerequisiteAddScreen() {
var value by remember { mutableStateOf("") }
val focusManager = LocalFocusManager.current
SelectionContainer {
TextField(
value = value,
onValueChange = { value = it },
placeholder = { Text("Enter text") },
keyboardOptions = KeyboardOptions.Default.copy(imeAction = ImeAction.Default, keyboardType = KeyboardType.Text)
)
}
if (...) {
focusManager.clearFocus()
}
}