So I know that I can give Icons and perform actions when tapped in my app bar but I dont know to toggle the widget just below the app bar.
I tried Position widget but it didn't work for me.
Would appreciate if Anyone could help me just to toggle the box(dont need help with anything inside the box)
You can use ternary operator to get a function like that.
create a bool like
bool isOpen
and show you widget like
isOpen?YourWidget:null
the above code will check if isOpen
is true. If it is true, it'll show YourWidget()
. else it'll show nothing.
You can use SetState()
to toggle between these.
To know more about ternary operator and how to use it to conditionally show/hide Flutter widgets, take a look at Here
Use preferred size widget at the bottom property off app bar
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.