From 105e7dab7b4ed0d511872797ff3b327e8c1eadc8 Mon Sep 17 00:00:00 2001 From: greenart7c3 Date: Wed, 11 Dec 2024 07:31:35 -0300 Subject: [PATCH] Disable the button when the keys is not informed make the invalid text use the default font --- .../greenart7c3/nostrsigner/ui/LoginScreen.kt | 22 ++++++++++++------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/app/src/main/java/com/greenart7c3/nostrsigner/ui/LoginScreen.kt b/app/src/main/java/com/greenart7c3/nostrsigner/ui/LoginScreen.kt index dfd9b6a..555ba24 100644 --- a/app/src/main/java/com/greenart7c3/nostrsigner/ui/LoginScreen.kt +++ b/app/src/main/java/com/greenart7c3/nostrsigner/ui/LoginScreen.kt @@ -927,7 +927,12 @@ fun LoginPage( .padding(vertical = 20.dp), shape = RoundedCornerShape(18.dp), value = key.value, - onValueChange = { key.value = it }, + onValueChange = { + key.value = it + if (errorMessage.isNotEmpty()) { + errorMessage = "" + } + }, keyboardOptions = KeyboardOptions( autoCorrectEnabled = false, keyboardType = KeyboardType.Password, @@ -993,13 +998,6 @@ fun LoginPage( }, ), ) - if (errorMessage.isNotBlank()) { - Text( - text = errorMessage, - color = MaterialTheme.colorScheme.error, - style = MaterialTheme.typography.bodySmall, - ) - } if (needsPassword.value) { OutlinedTextField( @@ -1077,7 +1075,15 @@ fun LoginPage( ) } + if (errorMessage.isNotBlank()) { + Text( + text = errorMessage, + color = MaterialTheme.colorScheme.error, + ) + } + AmberButton( + enabled = key.value.text.isNotBlank() && !(needsPassword.value && password.value.text.isBlank()), onClick = { if (key.value.text.isBlank()) { errorMessage = context.getString(R.string.key_is_required)