From 8d79bfc15d176e7916866731259c1b0f175b38ee Mon Sep 17 00:00:00 2001 From: dankito Date: Mon, 9 Sep 2024 23:04:21 +0200 Subject: [PATCH] Focusing bank autocomplete box on start --- .../net/codinux/banking/ui/dialogs/AddAccountDialog.kt | 8 ++++++++ 1 file changed, 8 insertions(+) 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 bf4853a..542d0c2 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 @@ -45,6 +45,8 @@ fun AddAccountDialog( val disabledColor: Color = MaterialTheme.colors.onSurface.copy(ContentAlpha.disabled) + val bankAutocompleteFocus = remember { FocusRequester() } + val loginNameFocus = remember { FocusRequester() } var isAddingAccount by remember { mutableStateOf(false) } @@ -97,6 +99,7 @@ fun AddAccountDialog( AutocompleteTextField( label = "Bank (Suche mit Name, Ort, BIC oder Bankleitzahl)", value = enteredBankSearchQuery, + textFieldFocus = bankAutocompleteFocus, onEnteredTextChanged = { enteredBankSearchQuery = it }, onSelectedItemChanged = { selectedBank = it @@ -166,4 +169,9 @@ fun AddAccountDialog( } } } + + + LaunchedEffect(bankAutocompleteFocus) { + bankAutocompleteFocus.requestFocus() + } } \ No newline at end of file