flutter基础布局之 TabBar

主要内容有:TabBar、TabBarView、TabController、TabPageSelector。

It is typically not necessary to nest Scaffolds. For example, in a tabbed UI, where the bottomNavigationBar is a TabBar and the body is a TabBarView, you might be tempted to make each tab bar view a scaffold with a differently titled AppBar. Rather, it would be better to add a listener to the TabController that updates the AppBar

TabController(vsync: tickerProvider, length: tabCount)..addListener(() {if (!tabController.indexIsChanging) {setState(() {// Rebuild the enclosing scaffold with a new AppBar titleappBarTitle = 'Tab ${tabController.index}';});}
})

 


本文来自互联网用户投稿,文章观点仅代表作者本人,不代表本站立场,不承担相关法律责任。如若转载,请注明出处。 如若内容造成侵权/违法违规/事实不符,请点击【内容举报】进行投诉反馈!

相关文章

立即
投稿

微信公众账号

微信扫一扫加关注

返回
顶部