状态更改后,Flutter Redux不会重建小部件

时间:2019-08-07 07:27:22

标签: flutter flutter-redux

在flutter redux中,我调度了一个动作,该动作转到reducer并更改其值。但这不会更改小部件,我的意思是不会重新构建小部件。如果我做了一些代码更改,然后我可以看到由于代码更改而重新构建了新状态。这意味着获取更改中的值,但未重建窗口小部件。

import win32com.client

outlook = win32com.client.Dispatch('outlook.application')
mail = outlook.CreateItem(0)
mail.To = "my@mail.com"
mail.Subject = "Test"
mail.Body = "Mail"

mail.Send()

此打印显示正确的数据。

我的减速器是

void change(){
  print(store.state.isEmail); // initial state true
  store.dispatch(ChangeBool(1, false)); // dispatching to false
  print(store.state.isEmail); // new value is false now 
}

在我的州立课堂上,我就是这样

return state.copywith(
     isEmail: action.option
 );

这是AppState({this.demoState, this.myMatches, this.bottomNavigationState, this.amricanoMatches, this.americanoRanks, this.homePageData, this.tournamentData, this.isEmail, this.isPin, this.isReset }); AppState copywith({demoState, myMatches, bottomNavigationState, amricanoMatches, americanoRanks, homePageData, tournamentData, isEmail, isPin, isReset }){ return AppState( myMatches : myMatches ?? this.myMatches, demoState: demoState ?? this.demoState, bottomNavigationState: bottomNavigationState ?? this.bottomNavigationState, amricanoMatches: amricanoMatches ?? this.amricanoMatches, americanoRanks: americanoRanks ?? this.americanoRanks, homePageData: homePageData ?? this.homePageData, tournamentData: tournamentData ?? this.tournamentData, isEmail: isEmail ?? this.isEmail, // THIS IS THE ONE GETTING CHANGED isPin: isPin ?? this.isPin, isReset: isReset ?? this.isReset, );

有什么想法吗? 谢谢。

0 个答案:

没有答案