参考: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} "); // 打印索引 } });
标签:tabController,TabController,监听,索引,indexIsChanging,tabbar,flutter From: https://www.cnblogs.com/lude1994/p/16971785.html