So I have this function that checks if EditText fields are empty:
private fun isFullForm(): Boolean {
return when {
company.text.isEmpty() or username.text.isEmpty() or password.text.isEmpty()
-> return false
else -> return true
}
}
And I this button block that uses that function to make it clickable:
button("Login") {
textSize = 26f
val fields = listOf<EditText>(company, username, password)
fields.forEach { it.textChangedListener { isClickable = isFullForm() } }
onClick {
//handleLogin(ctx)
Snackbar.make(this@verticalLayout, "Login Handled",
Snackbar.LENGTH_SHORT).show()
}
}
But the function doesn’t seem to be updating the isClickable variable. Any idea what I’m doing wrong?