3

How can I use condition in widget? I did it with empty widget like container() or Text() but when I put empty Widget in row() and give spaceBetween of MainAxisAlignment it takes their own space without any showing. Searching on the internet I think there are only the old info so that's not working anymore (if I am wrong I'm really sorry).

If conditions are not allowed and I do not want to show the widget - How can i do that?

2
  • 1
    Provide more detail also add some code Commented Jul 16, 2019 at 13:27
  • Please write a proper and detailed question. How do I ask a good question? Commented Jul 16, 2019 at 14:04

1 Answer 1

2

If i understand correctly, you want to render Row conditional with size of childrens.

List<Widget> elements = [] Row(children: elements) 

First option is to initiate elements inside your initState(){} method. Another one, if you want to change it dynamically, then you have to know about setState(){} method and how key works, that is optional attribute of all Stateful/Stateless Widgets.

Sign up to request clarification or add additional context in comments.

1 Comment

thank you actually i saw the youtube video about key published by google developer but it's a little bit iffy so... do you now any other site to understand about key?

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.