Skip to content

Commit 30a095f

Browse files
committed
fix title url
1 parent bc20b90 commit 30a095f

12 files changed

Lines changed: 121 additions & 104 deletions

‎RECORD.md‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,3 +39,8 @@ flutter 的跨平台见兼容性意外的话,得益于flutter engine,skia的
3939
### dialog上黄色线
4040
https://stackoverflow.com/questions/47114639/yellow-lines-under-text-widgets-in-flutter
4141
Dialog中,没使用Scaffold ,导致文本有黄色溢出线提示,可以使用Material ,color或者type为透明
42+
43+
44+
###
45+
46+
hotload很有优势。

‎lib/common/style/GSYStyle.dart‎

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -209,6 +209,10 @@ class GSYStrings {
209209
static const String welcomeMessage = "Welcome To Flutter";
210210

211211
static const String app_name = "GSYGithubAppFlutter";
212+
213+
static const String app_default_share_url = "https://github.com/CarGuo/GithubAppFlutter";
214+
215+
212216
static const String app_ok = "确定";
213217
static const String app_cancel = "取消";
214218
static const String app_empty = "目前什么也没有哟";
@@ -227,7 +231,7 @@ class GSYStrings {
227231
static const String option_copy = "复制链接";
228232
static const String option_share = "分享";
229233
static const String option_web_launcher_error = "url异常";
230-
static const String option_share_title = "分享自GitHubFlutterApp: ";
234+
static const String option_share_title = "分享自GSYGitHubFlutter: ";
231235
static const String option_share_copy_success = "已经复制到粘贴板";
232236

233237
static const String login_text = "登录";

‎lib/common/utils/NavigatorUtils.dart‎

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -53,8 +53,15 @@ class NavigatorUtils {
5353
}
5454

5555
///仓库版本列表
56-
static Future<Null> goReleasePage(BuildContext context, String userName, String reposName) {
57-
return Navigator.push(context, new MaterialPageRoute(builder: (context) => new ReleasePage(userName, reposName)));
56+
static Future<Null> goReleasePage(BuildContext context, String userName, String reposName, String htmlUrl) {
57+
return Navigator.push(
58+
context,
59+
new MaterialPageRoute(
60+
builder: (context) => new ReleasePage(
61+
userName,
62+
reposName,
63+
htmlUrl,
64+
)));
5865
}
5966

6067
///issue详情
@@ -85,8 +92,7 @@ class NavigatorUtils {
8592
}
8693

8794
///文件代码详情
88-
static gotoCodeDetailPage(BuildContext context,
89-
{String title, String userName, String reposName, String path, String data, String branch, String htmlUrl}) {
95+
static gotoCodeDetailPage(BuildContext context, {String title, String userName, String reposName, String path, String data, String branch, String htmlUrl}) {
9096
Navigator.push(
9197
context,
9298
new MaterialPageRoute(

‎lib/page/CodeDetailPage.dart‎

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
import 'package:flutter/material.dart';
22
import 'package:flutter_spinkit/flutter_spinkit.dart';
33
import 'package:gsy_github_app_flutter/common/dao/ReposDao.dart';
4-
import 'package:gsy_github_app_flutter/common/net/Address.dart';
54
import 'package:gsy_github_app_flutter/common/style/GSYStyle.dart';
65
import 'package:gsy_github_app_flutter/widget/GSYCommonOptionWidget.dart';
76
import 'package:gsy_github_app_flutter/widget/GSYMarkdownWidget.dart';
@@ -31,8 +30,7 @@ class CodeDetailPage extends StatefulWidget {
3130
CodeDetailPage({this.title, this.userName, this.reposName, this.path, this.data, this.branch, this.htmlUrl});
3231

3332
@override
34-
_CodeDetailPageState createState() =>
35-
_CodeDetailPageState(this.title, this.userName, this.reposName, this.path, this.data, this.branch, this.htmlUrl);
33+
_CodeDetailPageState createState() => _CodeDetailPageState(this.title, this.userName, this.reposName, this.path, this.data, this.branch, this.htmlUrl);
3634
}
3735

3836
class _CodeDetailPageState extends State<CodeDetailPage> {
@@ -46,10 +44,12 @@ class _CodeDetailPageState extends State<CodeDetailPage> {
4644

4745
final String htmlUrl;
4846

49-
String data;
50-
5147
final String title;
5248

49+
final OptionControl titleOptionControl = new OptionControl();
50+
51+
String data;
52+
5353
_CodeDetailPageState(this.title, this.userName, this.reposName, this.path, this.data, this.branch, this.htmlUrl);
5454

5555
@override
@@ -60,6 +60,9 @@ class _CodeDetailPageState extends State<CodeDetailPage> {
6060
if (res != null && res.result) {
6161
setState(() {
6262
data = res.data;
63+
if (htmlUrl != null) {
64+
titleOptionControl.url = htmlUrl;
65+
}
6366
});
6467
}
6568
});
@@ -68,11 +71,6 @@ class _CodeDetailPageState extends State<CodeDetailPage> {
6871

6972
@override
7073
Widget build(BuildContext context) {
71-
String currentBranch = ((branch == null) ? "" : ("/" + branch));
72-
String url = htmlUrl;
73-
if (htmlUrl == null) {
74-
url = Address.hostWeb + userName + "/" + reposName + "/blob" + currentBranch + path;
75-
}
7674
Widget widget = (data == null)
7775
? new Center(
7876
child: new Container(
@@ -98,7 +96,7 @@ class _CodeDetailPageState extends State<CodeDetailPage> {
9896
appBar: new AppBar(
9997
title: GSYTitleBar(
10098
title,
101-
rightWidget: new GSYCommonOptionWidget(url),
99+
rightWidget: new GSYCommonOptionWidget(titleOptionControl),
102100
needRightLocalIcon: false,
103101
),
104102
),

‎lib/page/CommonListPage.dart‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ class _CommonListPageState extends GSYListState<CommonListPage> {
4545
_CommonListPageState(this.title, this.showType, this.dataType, this.userName, this.reposName);
4646

4747
_renderItem(index) {
48-
if(pullLoadWidgetControl.dataList == 0) {
48+
if(pullLoadWidgetControl.dataList.length == 0) {
4949
return null;
5050
}
5151
var data = pullLoadWidgetControl.dataList[index];

‎lib/page/IssueDetailPage.dart‎

Lines changed: 52 additions & 60 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ import 'package:flutter/material.dart';
22
import 'package:fluttertoast/fluttertoast.dart';
33
import 'package:gsy_github_app_flutter/common/dao/IssueDao.dart';
44
import 'package:gsy_github_app_flutter/common/model/Issue.dart';
5-
import 'package:gsy_github_app_flutter/common/net/Address.dart';
65
import 'package:gsy_github_app_flutter/common/style/GSYStyle.dart';
76
import 'package:gsy_github_app_flutter/common/utils/CommonUtils.dart';
87
import 'package:gsy_github_app_flutter/common/utils/NavigatorUtils.dart';
@@ -54,14 +53,15 @@ class _IssueDetailPageState extends GSYListState<IssueDetailPage> {
5453

5554
TextEditingController issueInfoValueControl = new TextEditingController();
5655

57-
TextEditingController issueInfoCommitValueControl = new TextEditingController();
56+
final TextEditingController issueInfoCommitValueControl = new TextEditingController();
57+
58+
final OptionControl titleOptionControl = new OptionControl();
5859

5960
_IssueDetailPageState(this.issueNum, this.userName, this.reposName, this.needHomeIcon);
6061

6162
_renderEventItem(index) {
6263
if (index == 0) {
63-
return new IssueHeaderItem(issueHeaderViewModel, onPressed: () {
64-
});
64+
return new IssueHeaderItem(issueHeaderViewModel, onPressed: () {});
6565
}
6666
Issue issue = pullLoadWidgetControl.dataList[index - 1];
6767
return new IssueItem(
@@ -116,8 +116,10 @@ class _IssueDetailPageState extends GSYListState<IssueDetailPage> {
116116
_getHeaderInfo() async {
117117
var res = await IssueDao.getIssueInfoDao(userName, reposName, issueNum);
118118
if (res != null && res.result) {
119+
Issue issue = res.data;
119120
setState(() {
120-
issueHeaderViewModel = IssueHeaderViewModel.fromMap(res.data);
121+
issueHeaderViewModel = IssueHeaderViewModel.fromMap(issue);
122+
titleOptionControl.url = issue.htmlUrl;
121123
headerStatus = true;
122124
});
123125
}
@@ -132,13 +134,11 @@ class _IssueDetailPageState extends GSYListState<IssueDetailPage> {
132134
context,
133135
GSYStrings.issue_edit_issue,
134136
null,
135-
(contentValue) {
137+
(contentValue) {
136138
contentData = contentValue;
137139
},
138-
() {
139-
if (contentData == null || contentData
140-
.trim()
141-
.length == 0) {
140+
() {
141+
if (contentData == null || contentData.trim().length == 0) {
142142
Fluttertoast.showToast(msg: GSYStrings.issue_edit_issue_content_not_be_null);
143143
return;
144144
}
@@ -174,22 +174,18 @@ class _IssueDetailPageState extends GSYListState<IssueDetailPage> {
174174
CommonUtils.showEditDialog(
175175
context,
176176
GSYStrings.issue_edit_issue,
177-
(titleValue) {
177+
(titleValue) {
178178
title = titleValue;
179179
},
180-
(contentValue) {
180+
(contentValue) {
181181
content = contentValue;
182182
},
183-
() {
184-
if (title == null || title
185-
.trim()
186-
.length == 0) {
183+
() {
184+
if (title == null || title.trim().length == 0) {
187185
Fluttertoast.showToast(msg: GSYStrings.issue_edit_issue_title_not_be_null);
188186
return;
189187
}
190-
if (content == null || content
191-
.trim()
192-
.length == 0) {
188+
if (content == null || content.trim().length == 0) {
193189
Fluttertoast.showToast(msg: GSYStrings.issue_edit_issue_content_not_be_null);
194190
return;
195191
}
@@ -213,9 +209,7 @@ class _IssueDetailPageState extends GSYListState<IssueDetailPage> {
213209
CommonUtils.showEditDialog(context, GSYStrings.issue_reply_issue, null, (replyContent) {
214210
content = replyContent;
215211
}, () {
216-
if (content == null || content
217-
.trim()
218-
.length == 0) {
212+
if (content == null || content.trim().length == 0) {
219213
Fluttertoast.showToast(msg: GSYStrings.issue_edit_issue_content_not_be_null);
220214
return;
221215
}
@@ -233,41 +227,40 @@ class _IssueDetailPageState extends GSYListState<IssueDetailPage> {
233227
List<Widget> bottomWidget = (!headerStatus)
234228
? []
235229
: <Widget>[
236-
new FlatButton(
237-
onPressed: () {
238-
_replyIssue();
239-
},
240-
child: new Text(GSYStrings.issue_reply, style: GSYConstant.smallText),
241-
),
242-
new Container(width: 0.3, height: 30.0, color: Color(GSYColors.subLightTextColor)),
243-
new FlatButton(
244-
onPressed: () {
245-
_editIssue();
246-
},
247-
child: new Text(GSYStrings.issue_edit, style: GSYConstant.smallText),
248-
),
249-
new Container(width: 0.3, height: 30.0, color: Color(GSYColors.subLightTextColor)),
250-
new FlatButton(
251-
onPressed: () {
252-
CommonUtils.showLoadingDialog(context);
253-
IssueDao.editIssueDao(userName, reposName, issueNum, {"state": (issueHeaderViewModel.state == "closed") ? 'open' : 'closed'}).then((
254-
result) {
255-
_getHeaderInfo();
256-
Navigator.pop(context);
257-
});
258-
},
259-
child: new Text((issueHeaderViewModel.state == 'closed') ? GSYStrings.issue_open : GSYStrings.issue_close, style: GSYConstant.smallText)),
260-
new Container(width: 0.3, height: 30.0, color: Color(GSYColors.subLightTextColor)),
261-
new FlatButton(
262-
onPressed: () {
263-
CommonUtils.showLoadingDialog(context);
264-
IssueDao.lockIssueDao(userName, reposName, issueNum, issueHeaderViewModel.locked).then((result) {
265-
_getHeaderInfo();
266-
Navigator.pop(context);
267-
});
268-
},
269-
child: new Text((issueHeaderViewModel.locked) ? GSYStrings.issue_unlock : GSYStrings.issue_lock, style: GSYConstant.smallText)),
270-
];
230+
new FlatButton(
231+
onPressed: () {
232+
_replyIssue();
233+
},
234+
child: new Text(GSYStrings.issue_reply, style: GSYConstant.smallText),
235+
),
236+
new Container(width: 0.3, height: 30.0, color: Color(GSYColors.subLightTextColor)),
237+
new FlatButton(
238+
onPressed: () {
239+
_editIssue();
240+
},
241+
child: new Text(GSYStrings.issue_edit, style: GSYConstant.smallText),
242+
),
243+
new Container(width: 0.3, height: 30.0, color: Color(GSYColors.subLightTextColor)),
244+
new FlatButton(
245+
onPressed: () {
246+
CommonUtils.showLoadingDialog(context);
247+
IssueDao.editIssueDao(userName, reposName, issueNum, {"state": (issueHeaderViewModel.state == "closed") ? 'open' : 'closed'}).then((result) {
248+
_getHeaderInfo();
249+
Navigator.pop(context);
250+
});
251+
},
252+
child: new Text((issueHeaderViewModel.state == 'closed') ? GSYStrings.issue_open : GSYStrings.issue_close, style: GSYConstant.smallText)),
253+
new Container(width: 0.3, height: 30.0, color: Color(GSYColors.subLightTextColor)),
254+
new FlatButton(
255+
onPressed: () {
256+
CommonUtils.showLoadingDialog(context);
257+
IssueDao.lockIssueDao(userName, reposName, issueNum, issueHeaderViewModel.locked).then((result) {
258+
_getHeaderInfo();
259+
Navigator.pop(context);
260+
});
261+
},
262+
child: new Text((issueHeaderViewModel.locked) ? GSYStrings.issue_unlock : GSYStrings.issue_lock, style: GSYConstant.smallText)),
263+
];
271264
return bottomWidget;
272265
}
273266

@@ -293,8 +286,7 @@ class _IssueDetailPageState extends GSYListState<IssueDetailPage> {
293286
@override
294287
Widget build(BuildContext context) {
295288
super.build(context); // See AutomaticKeepAliveClientMixin.
296-
String url = Address.hostWeb + userName + "/" + reposName + "/issues/" + issueNum;
297-
Widget widget = (needHomeIcon) ? null : new GSYCommonOptionWidget(url);
289+
Widget widget = (needHomeIcon) ? null : new GSYCommonOptionWidget(titleOptionControl);
298290
return new Scaffold(
299291
persistentFooterButtons: _getBottomWidget(),
300292
appBar: new AppBar(
@@ -310,7 +302,7 @@ class _IssueDetailPageState extends GSYListState<IssueDetailPage> {
310302
),
311303
body: GSYPullLoadWidget(
312304
pullLoadWidgetControl,
313-
(BuildContext context, int index) => _renderEventItem(index),
305+
(BuildContext context, int index) => _renderEventItem(index),
314306
handleRefresh,
315307
onLoadMore,
316308
refreshKey: refreshIndicatorKey,

‎lib/page/PersonPage.dart‎

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ import 'package:gsy_github_app_flutter/common/dao/ReposDao.dart';
77
import 'package:gsy_github_app_flutter/common/dao/UserDao.dart';
88
import 'package:gsy_github_app_flutter/common/model/Event.dart';
99
import 'package:gsy_github_app_flutter/common/model/User.dart';
10-
import 'package:gsy_github_app_flutter/common/net/Address.dart';
1110
import 'package:gsy_github_app_flutter/common/style/GSYStyle.dart';
1211
import 'package:gsy_github_app_flutter/common/utils/CommonUtils.dart';
1312
import 'package:gsy_github_app_flutter/common/utils/EventUtils.dart';
@@ -47,7 +46,7 @@ class _PersonState extends GSYListState<PersonPage> {
4746

4847
User userInfo = User.empty();
4948

50-
String launchUrl = "";
49+
final OptionControl titleOptionControl = new OptionControl();
5150

5251
_PersonState(this.userName);
5352

@@ -63,6 +62,7 @@ class _PersonState extends GSYListState<PersonPage> {
6362
userInfo = userResult.data;
6463
setState(() {
6564
userInfo = userResult.data;
65+
titleOptionControl.url = userInfo.html_url;
6666
});
6767
} else {
6868
return null;
@@ -72,7 +72,6 @@ class _PersonState extends GSYListState<PersonPage> {
7272
pullLoadWidgetControl.dataList.clear();
7373
setState(() {
7474
pullLoadWidgetControl.dataList.addAll(res.data);
75-
launchUrl = Address.hostWeb + userInfo.login;
7675
});
7776
}
7877
resolveDataResult(res);
@@ -149,7 +148,7 @@ class _PersonState extends GSYListState<PersonPage> {
149148
appBar: new AppBar(
150149
title: GSYTitleBar(
151150
(userInfo != null && userInfo.login != null) ? userInfo.login : "",
152-
rightWidget: GSYCommonOptionWidget(launchUrl),
151+
rightWidget: GSYCommonOptionWidget(titleOptionControl),
153152
)),
154153
floatingActionButton: new FloatingActionButton(
155154
child: new Text(focus),

‎lib/page/PushDetailPage.dart‎

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ import 'dart:io';
44
import 'package:flutter/material.dart';
55
import 'package:gsy_github_app_flutter/common/dao/ReposDao.dart';
66
import 'package:gsy_github_app_flutter/common/model/PushCommit.dart';
7-
import 'package:gsy_github_app_flutter/common/net/Address.dart';
87
import 'package:gsy_github_app_flutter/common/style/GSYStyle.dart';
98
import 'package:gsy_github_app_flutter/common/utils/CommonUtils.dart';
109
import 'package:gsy_github_app_flutter/common/utils/NavigatorUtils.dart';
@@ -47,6 +46,8 @@ class _PushDetailPageState extends GSYListState<PushDetailPage> {
4746

4847
PushHeaderViewModel pushHeaderViewModel = new PushHeaderViewModel();
4948

49+
final OptionControl titleOptionControl = new OptionControl();
50+
5051
_PushDetailPageState(this.sha, this.userName, this.reposName, this.needHomeIcon);
5152

5253
@override
@@ -65,6 +66,7 @@ class _PushDetailPageState extends GSYListState<PushDetailPage> {
6566
pushHeaderViewModel = PushHeaderViewModel.forMap(pushCommit);
6667
pullLoadWidgetControl.dataList.addAll(pushCommit.files);
6768
pullLoadWidgetControl.needLoadMore = false;
69+
titleOptionControl.url = pushCommit.htmlUrl;
6870
});
6971
}
7072
}
@@ -119,8 +121,7 @@ class _PushDetailPageState extends GSYListState<PushDetailPage> {
119121
@override
120122
Widget build(BuildContext context) {
121123
super.build(context); // See AutomaticKeepAliveClientMixin.
122-
String url = Address.hostWeb + userName + "/" + reposName + "/commits/" + sha;
123-
Widget widget = (needHomeIcon) ? null : new GSYCommonOptionWidget(url);
124+
Widget widget = (needHomeIcon) ? null : new GSYCommonOptionWidget(titleOptionControl);
124125
return new Scaffold(
125126
appBar: new AppBar(
126127
title: GSYTitleBar(

0 commit comments

Comments
 (0)