diff --git a/composeApp/src/commonMain/kotlin/net/codinux/banking/ui/dialogs/AddAccountDialog.kt b/composeApp/src/commonMain/kotlin/net/codinux/banking/ui/dialogs/AddAccountDialog.kt index 703eebb..2cf486b 100644 --- a/composeApp/src/commonMain/kotlin/net/codinux/banking/ui/dialogs/AddAccountDialog.kt +++ b/composeApp/src/commonMain/kotlin/net/codinux/banking/ui/dialogs/AddAccountDialog.kt @@ -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) )