简体   繁体   中英

How to show a widget based on a variable in flutter?

I have a bool variable and I want to show different widgets based on that variable, for example, I want to hide the floating button when the bottom sheet is shown. how can I do that?

当您不想要显示任何内容时,实际上可以在flutter中为脚手架的floatActionButton属性分配null:

floatingActionButton: isBottomSheetVisible ? null : FloatingActionButton()

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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM