File tree Expand file tree Collapse file tree 2 files changed +8
-1
lines changed Expand file tree Collapse file tree 2 files changed +8
-1
lines changed Original file line number Diff line number Diff line change @@ -7,16 +7,22 @@ import 'package:redux/redux.dart';
77 * Date: 2018-07-16
88 */
99
10+ ///通过 flutter_redux 的 combineReducers,实现 Reducer 方法
1011final ThemeDataReducer = combineReducers <ThemeData >([
12+ ///将 Action 、处理 Action 的方法、State 绑定
1113 TypedReducer <ThemeData , RefreshThemeDataAction >(_refresh),
1214]);
1315
16+ ///定义处理 Action 行为的方法,返回新的 State
1417ThemeData _refresh (ThemeData themeData, action) {
1518 themeData = action.themeData;
1619 return themeData;
1720}
1821
22+ ///定义一个 Action 类
23+ ///将该 Action 在 Reducer 中与处理该Action的方法绑定
1924class RefreshThemeDataAction {
25+
2026 final ThemeData themeData;
2127
2228 RefreshThemeDataAction (this .themeData);
Original file line number Diff line number Diff line change @@ -23,10 +23,11 @@ void main() {
2323}
2424
2525class FlutterReduxApp extends StatelessWidget {
26- /// 创建Store,引用 GSYState 中的 appReducer 创建 Reducer
26+ /// 创建Store,引用 GSYState 中的 appReducer 实现 Reducer 方法
2727 /// initialState 初始化 State
2828 final store = new Store <GSYState >(
2929 appReducer,
30+ ///初始化数据
3031 initialState: new GSYState (
3132 userInfo: User .empty (),
3233 eventList: new List (),
You can’t perform that action at this time.
0 commit comments