11import 'package:flutter/material.dart' ;
22import 'package:gsy_github_app_flutter/common/dao/IssueDao.dart' ;
3+ import 'package:gsy_github_app_flutter/common/style/GSYStyle.dart' ;
4+ import 'package:gsy_github_app_flutter/common/utils/CommonUtils.dart' ;
35import 'package:gsy_github_app_flutter/widget/GSYListState.dart' ;
46import 'package:gsy_github_app_flutter/widget/GSYPullLoadWidget.dart' ;
57import 'package:gsy_github_app_flutter/widget/IssueHeaderItem.dart' ;
@@ -33,6 +35,8 @@ class _IssueDetailPageState extends GSYListState<IssueDetailPage> {
3335
3436 int selectIndex = 0 ;
3537
38+ bool headerStatus = false ;
39+
3640 IssueHeaderViewModel issueHeaderViewModel = new IssueHeaderViewModel ();
3741
3842 _IssueDetailPageState (this .issueNum, this .userName, this .reposName);
@@ -52,16 +56,56 @@ class _IssueDetailPageState extends GSYListState<IssueDetailPage> {
5256
5357 _getDataLogic () async {
5458 if (page <= 1 ) {
55- var res = await IssueDao .getIssueInfoDao (userName, reposName, issueNum);
56- if (res != null && res.result) {
57- setState (() {
58- issueHeaderViewModel = res.data;
59- });
60- }
59+ _getHeaderInfo ();
6160 }
6261 return await IssueDao .getIssueCommentDao (userName, reposName, issueNum, page: page);
6362 }
6463
64+ _getHeaderInfo () async {
65+ var res = await IssueDao .getIssueInfoDao (userName, reposName, issueNum);
66+ if (res != null && res.result) {
67+ setState (() {
68+ issueHeaderViewModel = res.data;
69+ headerStatus = true ;
70+ });
71+ }
72+ }
73+
74+ _getBottomWidget () {
75+ List <Widget > bottomWidget = (headerStatus)
76+ ? []
77+ : < Widget > [
78+ new FlatButton (
79+ onPressed: () {
80+ CommonUtils .showLoadingDialog (context);
81+ /*return ReposDao.doRepositoryStarDao(userName, reposName, bottomStatusModel.star).then((result) {
82+ _getHeaderInfo();
83+ Navigator.pop(context);
84+ });*/
85+ },
86+ child: new Text (GSYStrings .issue_reply, style: GSYConstant .smallText)),
87+ new Container (width: 0.3 , height: 30.0 , color: Color (GSYColors .subLightTextColor)),
88+ new FlatButton (
89+ onPressed: () {
90+ CommonUtils .showLoadingDialog (context);
91+ /*return ReposDao.doRepositoryWatchDao(userName, reposName, bottomStatusModel.watch).then((result) {
92+ _refresh();
93+ Navigator.pop(context);
94+ });*/
95+ },
96+ child: new Text (GSYStrings .issue_edit, style: GSYConstant .smallText)),
97+ new Container (width: 0.3 , height: 30.0 , color: Color (GSYColors .subLightTextColor)),
98+ new FlatButton (
99+ onPressed: () {},
100+ child: new Text ((issueHeaderViewModel.state == 'closed' ) ? GSYStrings .issue_open : GSYStrings .issue_close, style: GSYConstant .smallText)),
101+ new Container (width: 0.3 , height: 30.0 , color: Color (GSYColors .subLightTextColor)),
102+ new FlatButton (
103+ onPressed: () {},
104+ child: new Text ((issueHeaderViewModel.locked) ? GSYStrings .issue_unlock : GSYStrings .issue_lock, style: GSYConstant .smallText)),
105+ ];
106+ return bottomWidget;
107+ }
108+
65109 @override
66110 bool get wantKeepAlive => true ;
67111
@@ -85,6 +129,7 @@ class _IssueDetailPageState extends GSYListState<IssueDetailPage> {
85129 Widget build (BuildContext context) {
86130 super .build (context); // See AutomaticKeepAliveClientMixin.
87131 return new Scaffold (
132+ persistentFooterButtons: _getBottomWidget (),
88133 appBar: new AppBar (
89134 title: new Text (
90135 reposName,
0 commit comments