页面跳转代码写在setState方法里面无效
bottomNavigationBar: BottomNavigationBar(
type: BottomNavigationBarType.fixed,
currentIndex: _currentIndex,
onTap: (index) {
setState(() {
_contentPagerController.jumpToPage(index);
_currentIndex = index;
});
},为什么 _contentPagerController.jumpToPage(index); 必须要写在setState方法外面, 写在里就变得无效了呢