Nat Strangerweather

    Nat Strangerweather

    2 years ago
    Is there a tutorial for custom radio buttons? I got a kind reply here but I have not managed to understand how it is supposed to work. 😥
    Anna-Chiara Bellini [G]

    Anna-Chiara Bellini [G]

    2 years ago
    You don't need to do anything to manage the "deselect something when something else is selected", that's the mental shift you need to make in declarative frameworks. All you need to do is make sure that, to each BoxCards, you pass a "selected" value that is true when you want it selected, false otherwise. If you see the code snippet in the answer to your previous post, the only remembered state is the index of the radiobutton that you want selected. then you pass a parameter
    selected
    (True or False) to each invocation of the BoxCards composable. All the code is going to be re-executed as needed, so you don't have to worry about state transitions. Hope this makes sense?
    Nat Strangerweather

    Nat Strangerweather

    1 year ago
    @Anna-Chiara Bellini [G] Thank you for the explanation, yes, it does make sense! 👍🙂
    Anna-Chiara Bellini [G]

    Anna-Chiara Bellini [G]

    1 year ago
    Glad to hear that 🙂 Feel free to ask more questions if you get stuck!