From a2d752aca1b1195a3559a8c28a50ec523c07c5e4 Mon Sep 17 00:00:00 2001 From: dankito Date: Fri, 4 Oct 2024 07:45:06 +0200 Subject: [PATCH] Displaying max allowed characters --- .../ui/screens/CreateEpcQrCodeScreen.kt | 25 +++++++++++++------ 1 file changed, 18 insertions(+), 7 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 401e347..9e9c17a 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 @@ -20,6 +20,7 @@ import net.codinux.banking.ui.composables.tan.ImageSizeControls import net.codinux.banking.ui.config.Colors import net.codinux.banking.ui.config.DI import net.codinux.banking.ui.extensions.ImeNext +import net.codinux.banking.ui.forms.CaptionText import net.codinux.banking.ui.forms.OutlinedTextField import net.codinux.banking.ui.forms.Select import net.codinux.banking.ui.model.Config.NewLine @@ -140,6 +141,8 @@ fun CreateEpcQrCodeScreen(onClosed: () -> Unit) { keyboardOptions = KeyboardOptions.ImeNext ) + CaptionText("${receiverName.length} / 70") + OutlinedTextField( label = { Text("IBAN") }, value = iban, @@ -156,13 +159,17 @@ fun CreateEpcQrCodeScreen(onClosed: () -> Unit) { keyboardOptions = KeyboardOptions.ImeNext ) - OutlinedTextField( - label = { Text("Betrag (optional)") }, - value = amount, - onValueChange = { amount = it }, - modifier = Modifier.fillMaxWidth().padding(vertical = 8.dp).focusRequester(amountFocus), - keyboardOptions = KeyboardOptions.ImeNext - ) + Row(Modifier.fillMaxWidth(), verticalAlignment = Alignment.CenterVertically) { + OutlinedTextField( + label = { Text("Betrag (optional)") }, + value = amount, + onValueChange = { amount = it }, + modifier = Modifier.weight(1f).padding(vertical = 8.dp).focusRequester(amountFocus), + keyboardOptions = KeyboardOptions.ImeNext + ) + + Text(DI.formatUtil.formatCurrency("EUR"), Modifier.padding(start = 4.dp)) // Euro is currently the only supported currency + } OutlinedTextField( label = { Text("Verwendungszweck (optional)") }, @@ -172,6 +179,8 @@ fun CreateEpcQrCodeScreen(onClosed: () -> Unit) { keyboardOptions = KeyboardOptions.ImeNext ) + CaptionText("${reference.length} / 140") + // not exposing it to user as it's a) not displayed by most apps and b) may causes overflow of used QR code library // OutlinedTextField( // label = { Text("Information für den Nutzer (optional)") }, @@ -180,6 +189,8 @@ fun CreateEpcQrCodeScreen(onClosed: () -> Unit) { // modifier = Modifier.fillMaxWidth().padding(vertical = 8.dp), // keyboardOptions = KeyboardOptions.ImeNext // ) +// +// CaptionText("${informationForUser.length} / 70") } } } \ No newline at end of file