Skip to content

Commit 83dd371

Browse files
committed
注释
1 parent c2f9f4f commit 83dd371

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

lib/common/redux/ThemeRedux.dart

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,16 +7,22 @@ import 'package:redux/redux.dart';
77
* Date: 2018-07-16
88
*/
99

10+
///通过 flutter_redux 的 combineReducers,实现 Reducer 方法
1011
final ThemeDataReducer = combineReducers<ThemeData>([
12+
///将 Action 、处理 Action 的方法、State 绑定
1113
TypedReducer<ThemeData, RefreshThemeDataAction>(_refresh),
1214
]);
1315

16+
///定义处理 Action 行为的方法,返回新的 State
1417
ThemeData _refresh(ThemeData themeData, action) {
1518
themeData = action.themeData;
1619
return themeData;
1720
}
1821

22+
///定义一个 Action 类
23+
///将该 Action 在 Reducer 中与处理该Action的方法绑定
1924
class RefreshThemeDataAction {
25+
2026
final ThemeData themeData;
2127

2228
RefreshThemeDataAction(this.themeData);

lib/main.dart

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,11 @@ void main() {
2323
}
2424

2525
class 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(),

0 commit comments

Comments
 (0)