@@ -4,7 +4,6 @@ import 'package:flutter/material.dart';
44import 'package:gsy_github_app_flutter/common/config/Config.dart' ;
55import 'package:gsy_github_app_flutter/common/dao/IssueDao.dart' ;
66import 'package:gsy_github_app_flutter/common/style/GSYStyle.dart' ;
7- import 'package:gsy_github_app_flutter/widget/GSYCardItem.dart' ;
87import 'package:gsy_github_app_flutter/widget/GSYPullLoadWidget.dart' ;
98import 'package:gsy_github_app_flutter/widget/IssueItem.dart' ;
109import 'package:gsy_github_app_flutter/widget/RepositoryIssueListHeader.dart' ;
@@ -27,6 +26,8 @@ class RepositoryDetailIssuePage extends StatefulWidget {
2726
2827// ignore: mixin_inherits_from_not_object
2928class _RepositoryDetailIssuePageState extends State <RepositoryDetailIssuePage > with AutomaticKeepAliveClientMixin {
29+ final GlobalKey <RefreshIndicatorState > _refreshIndicatorKey = new GlobalKey <RefreshIndicatorState >();
30+
3031 final String userName;
3132
3233 final String reposName;
@@ -99,7 +100,9 @@ class _RepositoryDetailIssuePageState extends State<RepositoryDetailIssuePage> w
99100 pullLoadWidgetControl.needHeader = false ;
100101 pullLoadWidgetControl.dataList = dataList;
101102 if (pullLoadWidgetControl.dataList.length == 0 ) {
102- _handleRefresh ();
103+ new Future .delayed (const Duration (seconds: 0 ), () {
104+ _refreshIndicatorKey.currentState.show ().then ((e) {});
105+ });
103106 }
104107 }
105108
@@ -116,10 +119,10 @@ class _RepositoryDetailIssuePageState extends State<RepositoryDetailIssuePage> w
116119 appBar: new AppBar (
117120 leading: new Container (),
118121 flexibleSpace: new Container (
119- padding: new EdgeInsets .only (left: 20.0 , top: 12.0 , right: 20.0 , bottom: 12.0 ),
122+ padding: new EdgeInsets .only (left: 20.0 , top: 12.0 , right: 20.0 , bottom: 12.0 ),
120123 color: Colors .white,
121124 child: new TextField (
122- autofocus: true ,
125+ autofocus: false ,
123126 decoration: new InputDecoration .collapsed (
124127 hintText: GSYStrings .repos_issue_search,
125128 hintStyle: GSYConstant .subSmallText,
@@ -129,9 +132,15 @@ class _RepositoryDetailIssuePageState extends State<RepositoryDetailIssuePage> w
129132 ),
130133 elevation: 0.0 ,
131134 backgroundColor: Color (GSYColors .mainBackgroundColor),
132- bottom: new RepositoryIssueListHeader (),
135+ bottom: new RepositoryIssueListHeader ((selectIndex) {}),
136+ ),
137+ body: GSYPullLoadWidget (
138+ pullLoadWidgetControl,
139+ (BuildContext context, int index) => _renderEventItem (index),
140+ _handleRefresh,
141+ _onLoadMore,
142+ refreshKey: _refreshIndicatorKey,
133143 ),
134- body: GSYPullLoadWidget (pullLoadWidgetControl, (BuildContext context, int index) => _renderEventItem (index), _handleRefresh, _onLoadMore),
135144 );
136145 }
137146}
0 commit comments