Skip to content

Commit

Permalink
Disable the button when the keys is not informed
Browse files Browse the repository at this point in the history
make the invalid text use the default font
  • Loading branch information
greenart7c3 committed Dec 11, 2024
1 parent f5c2186 commit 105e7da
Showing 1 changed file with 14 additions and 8 deletions.
22 changes: 14 additions & 8 deletions app/src/main/java/com/greenart7c3/nostrsigner/ui/LoginScreen.kt
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -993,13 +998,6 @@ fun LoginPage(
},
),
)
if (errorMessage.isNotBlank()) {
Text(
text = errorMessage,
color = MaterialTheme.colorScheme.error,
style = MaterialTheme.typography.bodySmall,
)
}

if (needsPassword.value) {
OutlinedTextField(
Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit 105e7da

Please sign in to comment.