I am trying to change the width of a container dynamically. I have four containers in a row. I hide other three when a user selects a value (taps on a filter icon having bool value). The problem is that when I hide the other three (using visibility), the remaining container takes the space of full row.
What I want is this:
Keep the default width of the container when the bool value is true, else take 1/4 value of the device width using media query.
Thanks in Advance!
Regards
2
Answers
Try use
Flexible
widget and setflex:
for widget childExample:
This might point you in the right direction:
However, the better solution might be to set each Row’s child width to 1/4 of the overall width: