@@ -12,6 +12,7 @@ import 'package:gsy_github_app_flutter/common/redux/UserRedux.dart';
1212import 'package:gsy_github_app_flutter/common/style/GSYStyle.dart' ;
1313import 'package:gsy_github_app_flutter/common/utils/EventUtils.dart' ;
1414import 'package:gsy_github_app_flutter/common/utils/NavigatorUtils.dart' ;
15+ import 'package:gsy_github_app_flutter/widget/BasePersonState.dart' ;
1516import 'package:gsy_github_app_flutter/widget/EventItem.dart' ;
1617import 'package:gsy_github_app_flutter/widget/GSYListState.dart' ;
1718import 'package:gsy_github_app_flutter/widget/GSYPullLoadWidget.dart' ;
@@ -30,38 +31,13 @@ class MyPage extends StatefulWidget {
3031}
3132
3233// ignore: mixin_inherits_from_not_object
33- class _MyPageState extends GSYListState <MyPage > {
34+ class _MyPageState extends BasePersonState <MyPage > {
3435 String beStaredCount = '---' ;
3536
3637 Color notifyColor = const Color (GSYColors .subTextColor);
3738
3839 final List <UserOrg > orgList = new List ();
3940
40- _renderEventItem (Store <GSYState > store, userInfo, index) {
41- if (index == 0 ) {
42- return new UserHeaderItem (
43- userInfo,
44- beStaredCount,
45- store.state.themeData.primaryColor,
46- notifyColor: notifyColor,
47- refreshCallBack: () {
48- _refreshNotify ();
49- },
50- orgList: orgList,
51- );
52- }
53-
54- if (getUserType () == "Organization" ) {
55- return new UserItem (UserItemViewModel .fromMap (pullLoadWidgetControl.dataList[index - 1 ]), onPressed: () {
56- NavigatorUtils .goPerson (context, UserItemViewModel .fromMap (pullLoadWidgetControl.dataList[index - 1 ]).userName);
57- });
58- } else {
59- Event event = pullLoadWidgetControl.dataList[index - 1 ];
60- return new EventItem (EventViewModel .fromEventMap (event), onPressed: () {
61- EventUtils .ActionUtils (context, event, "" );
62- });
63- }
64- }
6541
6642 Store <GSYState > _getStore () {
6743 return StoreProvider .of (context);
@@ -182,7 +158,9 @@ class _MyPageState extends GSYListState<MyPage> {
182158 builder: (context, store) {
183159 return GSYPullLoadWidget (
184160 pullLoadWidgetControl,
185- (BuildContext context, int index) => _renderEventItem (store, store.state.userInfo, index),
161+ (BuildContext context, int index) => renderItem (index, store.state.userInfo, beStaredCount, notifyColor, () {
162+ _refreshNotify ();
163+ }, orgList),
186164 handleRefresh,
187165 onLoadMore,
188166 refreshKey: refreshIndicatorKey,
0 commit comments