From 5d00bbf77e1d2899e870320271afed8fca613a17 Mon Sep 17 00:00:00 2001 From: dankito Date: Fri, 4 Oct 2024 01:26:10 +0200 Subject: [PATCH] Only showing account selection box if there are any SEPA accounts --- .../ui/screens/CreateEpcQrCodeScreen.kt | 48 ++++++++++--------- 1 file changed, 25 insertions(+), 23 deletions(-) diff --git a/composeApp/src/commonMain/kotlin/net/codinux/banking/ui/screens/CreateEpcQrCodeScreen.kt b/composeApp/src/commonMain/kotlin/net/codinux/banking/ui/screens/CreateEpcQrCodeScreen.kt index e4c6c15..18b6f2e 100644 --- a/composeApp/src/commonMain/kotlin/net/codinux/banking/ui/screens/CreateEpcQrCodeScreen.kt +++ b/composeApp/src/commonMain/kotlin/net/codinux/banking/ui/screens/CreateEpcQrCodeScreen.kt @@ -101,32 +101,34 @@ fun CreateEpcQrCodeScreen(onClosed: () -> Unit) { } - Select( - "Für Konto", - accountsWithIban, - selectedAccount, - { account -> - selectedAccount = account + if (accountsWithIban.size > 1) { + Select( + "Für Konto", + accountsWithIban, + selectedAccount, + { account -> + selectedAccount = account - if (account != null) { - iban = account.iban ?: "" - bic = banks.firstOrNull { it.id == selectedAccount?.bankId }?.bic ?: "" - receiverName = account.accountHolderName + if (account != null) { + iban = account.iban ?: "" + bic = banks.firstOrNull { it.id == selectedAccount?.bankId }?.bic ?: "" + receiverName = account.accountHolderName - amountFocus.requestFocus() - } - }, - { account -> account?.displayName ?: "" }, - leadingIcon = bankOfSelectedAccount?.let { { BankIcon(bankOfSelectedAccount) } }, - dropDownItemContent = { account -> - Row(verticalAlignment = Alignment.CenterVertically) { - BankIcon(banks.firstOrNull { it.id == account?.bankId }, Modifier.padding(end = 6.dp)) + amountFocus.requestFocus() + } + }, + { account -> account?.displayName ?: "" }, + leadingIcon = bankOfSelectedAccount?.let { { BankIcon(bankOfSelectedAccount) } }, + dropDownItemContent = { account -> + Row(verticalAlignment = Alignment.CenterVertically) { + BankIcon(banks.firstOrNull { it.id == account?.bankId }, Modifier.padding(end = 6.dp)) - Text(account?.displayName ?: "") - } - }, - modifier = Modifier.fillMaxWidth().padding(top = 16.dp, bottom = 8.dp) - ) + Text(account?.displayName ?: "") + } + }, + modifier = Modifier.fillMaxWidth().padding(top = 16.dp, bottom = 8.dp) + ) + } OutlinedTextField( label = { Text("Empfänger*in") },