Skip to content

Commit b7c3ca1

Browse files
committed
issue detail title
1 parent a3e860c commit b7c3ca1

8 files changed

Lines changed: 76 additions & 63 deletions

File tree

‎lib/common/utils/EventUtils.dart‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,7 @@ class EventUtils {
155155
break;
156156
case 'IssueCommentEvent':
157157
case 'IssuesEvent':
158-
NavigatorUtils.goIssueDetail(context, owner, repositoryName, event["payload"]["issue"]["number"].toString(), needRightIcon: true);
158+
NavigatorUtils.goIssueDetail(context, owner, repositoryName, event["payload"]["issue"]["number"].toString(), needRightLocalIcon: true);
159159
break;
160160
default:
161161
if (fullName.toLowerCase() == currentRepository.toLowerCase()) {

‎lib/common/utils/NavigatorUtils.dart‎

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -48,15 +48,15 @@ class NavigatorUtils {
4848
}
4949

5050
///issue详情
51-
static Future<Null> goIssueDetail(BuildContext context, String userName, String reposName, String num, {bool needRightIcon = false}) {
51+
static Future<Null> goIssueDetail(BuildContext context, String userName, String reposName, String num, {bool needRightLocalIcon = false}) {
5252
return Navigator.push(
5353
context,
5454
new MaterialPageRoute(
5555
builder: (context) => new IssueDetailPage(
5656
userName,
5757
reposName,
5858
num,
59-
needRightIcon: needRightIcon,
59+
needHomeIcon: needRightLocalIcon,
6060
)));
6161
}
6262

@@ -98,6 +98,4 @@ class NavigatorUtils {
9898
static Future<Null> goSearchPage(BuildContext context) {
9999
return Navigator.push(context, new MaterialPageRoute(builder: (context) => new SearchPage()));
100100
}
101-
102-
103101
}

‎lib/page/HomePage.dart‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ class HomePage extends StatelessWidget {
5252
title: GSYTitleBar(
5353
GSYStrings.app_name,
5454
iconData: GSYICons.MAIN_SEARCH,
55-
needRightIcon: true,
55+
needRightLocalIcon: true,
5656
onPressed: () {
5757
NavigatorUtils.goSearchPage(context);
5858
},

‎lib/page/IssueDetailPage.dart‎

Lines changed: 66 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
11
import 'package:flutter/material.dart';
22
import 'package:fluttertoast/fluttertoast.dart';
33
import 'package:gsy_github_app_flutter/common/dao/IssueDao.dart';
4+
import 'package:gsy_github_app_flutter/common/net/Address.dart';
45
import 'package:gsy_github_app_flutter/common/style/GSYStyle.dart';
56
import 'package:gsy_github_app_flutter/common/utils/CommonUtils.dart';
67
import 'package:gsy_github_app_flutter/common/utils/NavigatorUtils.dart';
8+
import 'package:gsy_github_app_flutter/widget/GSYCommonOptionWidget.dart';
79
import 'package:gsy_github_app_flutter/widget/GSYFlexButton.dart';
810
import 'package:gsy_github_app_flutter/widget/GSYListState.dart';
911
import 'package:gsy_github_app_flutter/widget/GSYPullLoadWidget.dart';
@@ -23,12 +25,12 @@ class IssueDetailPage extends StatefulWidget {
2325

2426
final String issueNum;
2527

26-
final bool needRightIcon;
28+
final bool needHomeIcon;
2729

28-
IssueDetailPage(this.userName, this.reposName, this.issueNum, {this.needRightIcon = false});
30+
IssueDetailPage(this.userName, this.reposName, this.issueNum, {this.needHomeIcon = false});
2931

3032
@override
31-
_IssueDetailPageState createState() => _IssueDetailPageState(issueNum, userName, reposName, needRightIcon);
33+
_IssueDetailPageState createState() => _IssueDetailPageState(issueNum, userName, reposName, needHomeIcon);
3234
}
3335

3436
// ignore: mixin_inherits_from_not_object
@@ -43,7 +45,7 @@ class _IssueDetailPageState extends GSYListState<IssueDetailPage> {
4345

4446
bool headerStatus = false;
4547

46-
bool needRightIcon = false;
48+
bool needHomeIcon = false;
4749

4850
IssueHeaderViewModel issueHeaderViewModel = new IssueHeaderViewModel();
4951

@@ -53,11 +55,12 @@ class _IssueDetailPageState extends GSYListState<IssueDetailPage> {
5355

5456
TextEditingController issueInfoCommitValueControl = new TextEditingController();
5557

56-
_IssueDetailPageState(this.issueNum, this.userName, this.reposName, this.needRightIcon);
58+
_IssueDetailPageState(this.issueNum, this.userName, this.reposName, this.needHomeIcon);
5759

5860
_renderEventItem(index) {
5961
if (index == 0) {
60-
return new IssueHeaderItem(issueHeaderViewModel, onPressed: () {});
62+
return new IssueHeaderItem(issueHeaderViewModel, onPressed: () {
63+
});
6164
}
6265
IssueItemViewModel issueItemViewModel = pullLoadWidgetControl.dataList[index - 1];
6366
return new IssueItem(
@@ -128,11 +131,13 @@ class _IssueDetailPageState extends GSYListState<IssueDetailPage> {
128131
context,
129132
GSYStrings.issue_edit_issue,
130133
null,
131-
(contentValue) {
134+
(contentValue) {
132135
contentData = contentValue;
133136
},
134-
() {
135-
if (contentData == null || contentData.trim().length == 0) {
137+
() {
138+
if (contentData == null || contentData
139+
.trim()
140+
.length == 0) {
136141
Fluttertoast.showToast(msg: GSYStrings.issue_edit_issue_content_not_be_null);
137142
return;
138143
}
@@ -168,18 +173,22 @@ class _IssueDetailPageState extends GSYListState<IssueDetailPage> {
168173
CommonUtils.showEditDialog(
169174
context,
170175
GSYStrings.issue_edit_issue,
171-
(titleValue) {
176+
(titleValue) {
172177
title = titleValue;
173178
},
174-
(contentValue) {
179+
(contentValue) {
175180
content = contentValue;
176181
},
177-
() {
178-
if (title == null || title.trim().length == 0) {
182+
() {
183+
if (title == null || title
184+
.trim()
185+
.length == 0) {
179186
Fluttertoast.showToast(msg: GSYStrings.issue_edit_issue_title_not_be_null);
180187
return;
181188
}
182-
if (content == null || content.trim().length == 0) {
189+
if (content == null || content
190+
.trim()
191+
.length == 0) {
183192
Fluttertoast.showToast(msg: GSYStrings.issue_edit_issue_content_not_be_null);
184193
return;
185194
}
@@ -203,7 +212,9 @@ class _IssueDetailPageState extends GSYListState<IssueDetailPage> {
203212
CommonUtils.showEditDialog(context, GSYStrings.issue_reply_issue, null, (replyContent) {
204213
content = replyContent;
205214
}, () {
206-
if (content == null || content.trim().length == 0) {
215+
if (content == null || content
216+
.trim()
217+
.length == 0) {
207218
Fluttertoast.showToast(msg: GSYStrings.issue_edit_issue_content_not_be_null);
208219
return;
209220
}
@@ -221,40 +232,41 @@ class _IssueDetailPageState extends GSYListState<IssueDetailPage> {
221232
List<Widget> bottomWidget = (!headerStatus)
222233
? []
223234
: <Widget>[
224-
new FlatButton(
225-
onPressed: () {
226-
_replyIssue();
227-
},
228-
child: new Text(GSYStrings.issue_reply, style: GSYConstant.smallText),
229-
),
230-
new Container(width: 0.3, height: 30.0, color: Color(GSYColors.subLightTextColor)),
231-
new FlatButton(
232-
onPressed: () {
233-
_editIssue();
234-
},
235-
child: new Text(GSYStrings.issue_edit, style: GSYConstant.smallText),
236-
),
237-
new Container(width: 0.3, height: 30.0, color: Color(GSYColors.subLightTextColor)),
238-
new FlatButton(
239-
onPressed: () {
240-
CommonUtils.showLoadingDialog(context);
241-
IssueDao.editIssueDao(userName, reposName, issueNum, {"state": (issueHeaderViewModel.state == "closed") ? 'open' : 'closed'}).then((result) {
242-
_getHeaderInfo();
243-
Navigator.pop(context);
244-
});
245-
},
246-
child: new Text((issueHeaderViewModel.state == 'closed') ? GSYStrings.issue_open : GSYStrings.issue_close, style: GSYConstant.smallText)),
247-
new Container(width: 0.3, height: 30.0, color: Color(GSYColors.subLightTextColor)),
248-
new FlatButton(
249-
onPressed: () {
250-
CommonUtils.showLoadingDialog(context);
251-
IssueDao.lockIssueDao(userName, reposName, issueNum, issueHeaderViewModel.locked).then((result) {
252-
_getHeaderInfo();
253-
Navigator.pop(context);
254-
});
255-
},
256-
child: new Text((issueHeaderViewModel.locked) ? GSYStrings.issue_unlock : GSYStrings.issue_lock, style: GSYConstant.smallText)),
257-
];
235+
new FlatButton(
236+
onPressed: () {
237+
_replyIssue();
238+
},
239+
child: new Text(GSYStrings.issue_reply, style: GSYConstant.smallText),
240+
),
241+
new Container(width: 0.3, height: 30.0, color: Color(GSYColors.subLightTextColor)),
242+
new FlatButton(
243+
onPressed: () {
244+
_editIssue();
245+
},
246+
child: new Text(GSYStrings.issue_edit, style: GSYConstant.smallText),
247+
),
248+
new Container(width: 0.3, height: 30.0, color: Color(GSYColors.subLightTextColor)),
249+
new FlatButton(
250+
onPressed: () {
251+
CommonUtils.showLoadingDialog(context);
252+
IssueDao.editIssueDao(userName, reposName, issueNum, {"state": (issueHeaderViewModel.state == "closed") ? 'open' : 'closed'}).then((
253+
result) {
254+
_getHeaderInfo();
255+
Navigator.pop(context);
256+
});
257+
},
258+
child: new Text((issueHeaderViewModel.state == 'closed') ? GSYStrings.issue_open : GSYStrings.issue_close, style: GSYConstant.smallText)),
259+
new Container(width: 0.3, height: 30.0, color: Color(GSYColors.subLightTextColor)),
260+
new FlatButton(
261+
onPressed: () {
262+
CommonUtils.showLoadingDialog(context);
263+
IssueDao.lockIssueDao(userName, reposName, issueNum, issueHeaderViewModel.locked).then((result) {
264+
_getHeaderInfo();
265+
Navigator.pop(context);
266+
});
267+
},
268+
child: new Text((issueHeaderViewModel.locked) ? GSYStrings.issue_unlock : GSYStrings.issue_lock, style: GSYConstant.smallText)),
269+
];
258270
return bottomWidget;
259271
}
260272

@@ -280,12 +292,15 @@ class _IssueDetailPageState extends GSYListState<IssueDetailPage> {
280292
@override
281293
Widget build(BuildContext context) {
282294
super.build(context); // See AutomaticKeepAliveClientMixin.
295+
String url = Address.hostWeb + userName + "/" + reposName + "/issues/" + issueNum;
296+
Widget widget = (needHomeIcon) ? null : new GSYCommonOptionWidget(url);
283297
return new Scaffold(
284298
persistentFooterButtons: _getBottomWidget(),
285299
appBar: new AppBar(
286300
title: GSYTitleBar(
287301
reposName,
288-
needRightIcon: needRightIcon,
302+
rightWidget: widget,
303+
needRightLocalIcon: needHomeIcon,
289304
iconData: GSYICons.HOME,
290305
onPressed: () {
291306
NavigatorUtils.goReposDetail(context, userName, reposName);
@@ -294,7 +309,7 @@ class _IssueDetailPageState extends GSYListState<IssueDetailPage> {
294309
),
295310
body: GSYPullLoadWidget(
296311
pullLoadWidgetControl,
297-
(BuildContext context, int index) => _renderEventItem(index),
312+
(BuildContext context, int index) => _renderEventItem(index),
298313
handleRefresh,
299314
onLoadMore,
300315
refreshKey: refreshIndicatorKey,

‎lib/page/NotifyPage.dart‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ class _NotifyPageState extends GSYListState<NotifyPage> {
4141
String number = tmp[tmp.length - 1];
4242
String userName = eventMap["repository"]["owner"]["login"];
4343
String reposName = eventMap["repository"]["name"];
44-
NavigatorUtils.goIssueDetail(context, userName, reposName, number, needRightIcon: true).then((res) {
44+
NavigatorUtils.goIssueDetail(context, userName, reposName, number, needRightLocalIcon: true).then((res) {
4545
showRefreshLoading();
4646
});
4747
}
@@ -85,7 +85,7 @@ class _NotifyPageState extends GSYListState<NotifyPage> {
8585
title: GSYTitleBar(
8686
GSYStrings.notify_title,
8787
iconData: GSYICons.NOTIFY_ALL_READ,
88-
needRightIcon: true,
88+
needRightLocalIcon: true,
8989
onPressed: () {
9090
CommonUtils.showLoadingDialog(context);
9191
UserDao.setAllNotificationAsReadDao().then((res) {

‎lib/page/PersonPage.dart‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import 'package:gsy_github_app_flutter/common/style/GSYStyle.dart';
1111
import 'package:gsy_github_app_flutter/common/utils/CommonUtils.dart';
1212
import 'package:gsy_github_app_flutter/common/utils/NavigatorUtils.dart';
1313
import 'package:gsy_github_app_flutter/widget/EventItem.dart';
14-
import 'package:gsy_github_app_flutter/widget/GSYComonOptionWidget.dart';
14+
import 'package:gsy_github_app_flutter/widget/GSYCommonOptionWidget.dart';
1515
import 'package:gsy_github_app_flutter/widget/GSYListState.dart';
1616
import 'package:gsy_github_app_flutter/widget/GSYPullLoadWidget.dart';
1717
import 'package:gsy_github_app_flutter/widget/GSYTitleBar.dart';

‎lib/widget/GSYTitleBar.dart‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,17 +12,17 @@ class GSYTitleBar extends StatelessWidget {
1212

1313
final VoidCallback onPressed;
1414

15-
final bool needRightIcon;
15+
final bool needRightLocalIcon;
1616

1717
final Widget rightWidget;
1818

19-
GSYTitleBar(this.title, {this.iconData, this.onPressed, this.needRightIcon = false, this.rightWidget});
19+
GSYTitleBar(this.title, {this.iconData, this.onPressed, this.needRightLocalIcon = false, this.rightWidget});
2020

2121
@override
2222
Widget build(BuildContext context) {
2323
Widget widget = rightWidget;
2424
if (rightWidget == null) {
25-
widget = (needRightIcon)
25+
widget = (needRightLocalIcon)
2626
? new IconButton(
2727
icon: new Icon(
2828
iconData,

0 commit comments

Comments
 (0)