flutter tabbar切换监听及索引获取
参考:https://www.jianshu.com/p/f1347e658fa6
定义
late TabController _controller;
在 void initState()中监听
tabController = TabController(length: tabs.length, vsync: this) ..addListener(() { // or (tabController.indexIsChanging) if (!tabController.indexIsChanging) { // print("监听切换tab ${tabController.index} "); // 打印索引 } });