- 需要动态切换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。