@@ -2,11 +2,11 @@ import 'dart:async';
22
33import 'package:flutter/material.dart' ;
44import 'package:flutter_redux/flutter_redux.dart' ;
5- import 'package:gsy_github_app_flutter/common/model/User .dart' ;
5+ import 'package:gsy_github_app_flutter/common/dao/EventDao .dart' ;
66import 'package:gsy_github_app_flutter/common/redux/GSYState.dart' ;
7- import 'package:gsy_github_app_flutter/common/redux/UserRedux.dart' ;
87import 'package:gsy_github_app_flutter/widget/EventItem.dart' ;
98import 'package:gsy_github_app_flutter/widget/GSYPullLoadWidget.dart' ;
9+ import 'package:redux/redux.dart' ;
1010
1111class DynamicPage extends StatefulWidget {
1212 @override
@@ -24,7 +24,7 @@ class _DynamicPageState extends State<DynamicPage> {
2424 return null ;
2525 }
2626
27- bool _onNotifycation <Notification >(Notification notify) {
27+ bool _onNotification <Notification >(Notification notify) {
2828 if (notify is ! OverscrollNotification ) {
2929 return true ;
3030 }
@@ -34,21 +34,22 @@ class _DynamicPageState extends State<DynamicPage> {
3434 return true ;
3535 }
3636
37+ @override
38+ void didChangeDependencies () {
39+ Store <GSYState > store = StoreProvider .of (context);
40+ EventDao .getEventReceived (store);
41+ super .didChangeDependencies ();
42+ }
43+
3744 @override
3845 Widget build (BuildContext context) {
3946 return new StoreBuilder <GSYState >(
4047 builder: (context, store) {
41- new Future .delayed (const Duration (seconds: 2 ), () {
42- User user = store.state.userInfo;
43- user.login = "new login" ;
44- user.name = "new name" ;
45- store.dispatch (new UpdateUserAction (user));
46- });
4748 return GSYPullLoadWidget (
4849 pullLoadWidgetControl,
4950 (BuildContext context, int index) => new EventItem (),
5051 _handleRefresh,
51- _onNotifycation );
52+ _onNotification );
5253 },
5354 );
5455 }
0 commit comments