Passing focus on to loginName after selecting a bank
This commit is contained in:
parent
8fde7985d8
commit
131d08cc93
|
@ -9,6 +9,8 @@ import androidx.compose.material.icons.filled.Clear
|
|||
import androidx.compose.runtime.*
|
||||
import androidx.compose.ui.Alignment
|
||||
import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.focus.FocusRequester
|
||||
import androidx.compose.ui.focus.focusRequester
|
||||
import androidx.compose.ui.graphics.Color
|
||||
import androidx.compose.ui.text.input.ImeAction
|
||||
import androidx.compose.ui.text.style.TextOverflow
|
||||
|
@ -43,6 +45,8 @@ fun AddAccountDialog(
|
|||
|
||||
val disabledColor: Color = MaterialTheme.colors.onSurface.copy(ContentAlpha.disabled)
|
||||
|
||||
val loginNameFocus = remember { FocusRequester() }
|
||||
|
||||
var isAddingAccount by remember { mutableStateOf(false) }
|
||||
|
||||
var addAccountJob: Job? = null
|
||||
|
@ -96,7 +100,10 @@ fun AddAccountDialog(
|
|||
label = "Bank (Suche mit Name, Bankleitzahl oder Ort)",
|
||||
value = enteredBankSearchQuery,
|
||||
onEnteredTextChanged = { enteredBankSearchQuery = it },
|
||||
onSelectedItemChanged = { selectedBank = it },
|
||||
onSelectedItemChanged = {
|
||||
selectedBank = it
|
||||
loginNameFocus.requestFocus()
|
||||
},
|
||||
getItemTitle = { bank -> bank.name },
|
||||
fetchSuggestions = { query -> bankingService.findBanks(query) }
|
||||
) { bank ->
|
||||
|
@ -144,7 +151,7 @@ fun AddAccountDialog(
|
|||
value = loginName,
|
||||
onValueChange = { loginName = it },
|
||||
label = { Text("Login Name") },
|
||||
modifier = Modifier.fillMaxWidth(),
|
||||
modifier = Modifier.fillMaxWidth().focusRequester(loginNameFocus),
|
||||
keyboardOptions = KeyboardOptions(imeAction = ImeAction.Next)
|
||||
)
|
||||
|
||||
|
|
Loading…
Reference in New Issue