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