fish-redux BottomNavigationBar调用点击方法的时候,下面BottomNavigationBarItem如何改变为选中状态

9gm1akwq  于 2021-12-26  发布在  Java
关注(0)|答案(1)|浏览(542)

如题,我在BottomNavigationBar调用了一个点击方法,代码如下
bottomNavigationBar: BottomNavigationBar( backgroundColor: Colors.white, unselectedItemColor: Colors.black54, elevation: 1, selectedItemColor: Colors.deepOrange, type: BottomNavigationBarType.fixed, onTap: (currentIndex) { dispatch(EntranceActionCreator.onChangeIndexAction(currentIndex)); },

Action:
static Action onChangeIndexAction(int index) { return Action(EntranceAction.changeIndexAction, payload: index); }

Effect:
void _onChangeIndexAction(Action action, Context<EntranceState> ctx) { println("buildEffect---changeIndex"); int selectedIndex = action.payload; ctx.state.mainPageController.jumpToPage(selectedIndex); }

Reducer:
EntranceState _onAction(EntranceState state, Action action) { final EntranceState newState = state.clone(); newState.selectedIndex = action.payload; return newState; }
打过断点,应该是没刷新,请问需要如何解决

smdncfj3

smdncfj31#

reducer 没有被执行。所以不会rebuid。

相关问题