2

I am working on a UI where I have 3 checks in the same container. I am able to achieve only one condition but not able to the second one or third one.

here is what I want to achieve in UI

till now I have created a container where I have made a column and included all things and used a bool variable which changes when I click the text and it reverts back when I click the close button.

But now the problem is How can I use 3 conditions in the same column?

my code till now

bool makePayment = false;

 makePayment ? Column( crossAxisAlignment:
                                          children: [                                                  
                                                  const Text('Quick actions'),
                                                  const SizedBox(),
                                                   Row(),
                                                     Row()
                                                   ])  : Column()

2 Answers 2

1

you could use a lot of condition in the same way as you did just the question will be more complicated , example :

A.isNumber ? do1 : A.isAlpha? do2 : A.isSymbol ? do3 : do4
Sign up to request clarification or add additional context in comments.

4 Comments

Or you can use a switch
@Ahmad I have already used your logic but what happens is if I press make payment and then I press close button is working but for the same logic I am implementing for withdrawmoney and close button then makePayement button not working
where's the code for the close button
in close button I am changing the values like this makePayment = !makePayment;
1

You can use else-if into your column children.

  • The Syntax is
Column(
    children: <Widget>[
        if(your condition) ...[
            //YOUR CODE
        ] else if(your condition) ...[
            //YOUR CODE
        ] else ...[
            //YOUR CODE
        ]
    ]
)

3 Comments

@Megaphish If working fine for makePayment but not working for withdrawMoney button
then create condition on clicking your make payment, withdraw money and add to wallet as per your UI, and then in column section display the UI into column section with else if loop. I think that will work. And also check code syntax.
this is the syntax of else if loop. I didn't show your code. so, it's better that now you learn the else if loop. Use it as your way. It's also applicable in row's children section. Hope you can understand

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.