頁面跳轉(zhuǎn)代碼寫在setState方法里面無效
bottomNavigationBar:?BottomNavigationBar( ??type:?BottomNavigationBarType.fixed, ??currentIndex:?_currentIndex, ??onTap:?(index)?{ ????setState(()?{ ??????_contentPagerController.jumpToPage(index); ??????_currentIndex?=?index; ????}); ??},
為什么 _contentPagerController.jumpToPage(index); 必須要寫在setState方法外面,?寫在里就變得無效了呢