Colton Idle
09/20/2021, 12:53 AMColton Idle
09/20/2021, 12:53 AMvar first by remember { mutableStateOf("") }
var last by remember { mutableStateOf("") }
TextField(
value = first,
onValueChange = { first = it },
label = { Text("First name") }) //<==== Should have a next button that focuses next textField
TextField(
value = last,
onValueChange = { last = it },
label = { Text("Last name") }) //<==== Should have a done button that triggers the button below
Button({ /*Do something */}) {}
Is there an easy way to just set a column as being a form and to keep going to the next field?Luis
09/20/2021, 1:55 AMLuis
09/20/2021, 1:55 AMTextField(
value = uiState.email,
onValueChange = viewModel::updateEmail,
placeholder = { Text("Email") },
singleLine = true,
keyboardOptions = KeyboardOptions(imeAction = ImeAction.Next),
keyboardActions = KeyboardActions(
onNext = { focusManager.moveFocus(FocusDirection.Down) }
),
modifier = Modifier.fillMaxWidth()
)
TextField(
value = uiState.password,
onValueChange = viewModel::updatePassword,
placeholder = { Text("Password") },
singleLine = true,
keyboardActions = KeyboardActions(
onDone = { viewModel.login() }
),
modifier = Modifier.fillMaxWidth()
)
Luis
09/20/2021, 1:56 AMonDone
keyboard action for the password just calls the same method the button would callColton Idle
09/20/2021, 2:16 AMLuis
09/20/2021, 2:35 AMLocalFocusManager
that you can use, val focusManager = LocalFocusManager.current
Colton Idle
09/20/2021, 2:38 AMColton Idle
09/20/2021, 3:28 AM