Hey all, why is this coming up as a val?
# compose
b
Hey all, why is this coming up as a val?
j
IIRC in Kotlin, function parameters are always immutable references
👍 4
b
ty
I am trying to show a circular spinner once I click on the Log In button but nothing is happening
it’s always in the if block no matter how many times I click the Log in button
j
What happens if the login fails due to a connection issue?
Without looking closely at your code, I get the sense you are creating some source of truth issues.
I'd suggest you consider re-reading the sections on "unidirectional data flow" and "state hoisting" and ensure you are following those principles
b
Right now there is no connection, I am just trying to make the UI work. Switching the button to a spinner onClick
I was going to worry about that later
I just don’t know why this condition isn’t working
k
The Compose way is for the "caller" of
LoginButton
to provide a lambda that is called in your
onClick
. It is the caller's responsibility to update the source of truth for the state, not this composable.
This is a "flattened" example of this - but in the real app the state would be managed outside of this composable function, and this function would get the current state and a lambda to call in
onCheckedChange
(where the lambda updates the state and that causes recomposition of your composable)
b
ty, I will look this up
a
Please confirm if
isDisplayed
is a state variable