- 需要动态切换app board显示。
- 添加
showUpBar
属性控制显示app bar,默认为true
。 - 点击导航事件时,通过
setState
调整showAppBar
属性。 - 当点击"发现"时,
index
为0,则showAppBar
为true
;点击其他项目时为false
。 - 在
scaffold
中根据showAppBar
的值决定是否显示app bar。 - 保存文件并在模拟器上测试:点击"发现"显示应用栏,点击其他则隐藏,切换回"发现"则重新显示。
showUpBar
属性控制显示app bar,默认为true
。setState
调整showAppBar
属性。index
为0,则showAppBar
为true
;点击其他项目时为false
。scaffold
中根据showAppBar
的值决定是否显示app bar。