Repository navigation
Expand file tree
/
Copy pathNavigatorUtils.dart
More file actions
196 lines (178 loc) · 6.48 KB
/
Copy pathNavigatorUtils.dart
File metadata and controls
196 lines (178 loc) · 6.48 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
import 'dart:async';
import 'dart:io';
import 'package:flutter/material.dart';
import 'package:gsy_github_app_flutter/page/CodeDetailPage.dart';
import 'package:gsy_github_app_flutter/page/CodeDetailPageWeb.dart';
import 'package:gsy_github_app_flutter/page/CommonListPage.dart';
import 'package:gsy_github_app_flutter/page/GSYWebView.dart';
import 'package:gsy_github_app_flutter/page/HomePage.dart';
import 'package:gsy_github_app_flutter/page/IssueDetailPage.dart';
import 'package:gsy_github_app_flutter/page/LoginPage.dart';
import 'package:gsy_github_app_flutter/page/NotifyPage.dart';
import 'package:gsy_github_app_flutter/page/PersonPage.dart';
import 'package:gsy_github_app_flutter/page/PhotoViewPage.dart';
import 'package:gsy_github_app_flutter/page/PushDetailPage.dart';
import 'package:gsy_github_app_flutter/page/ReleasePage.dart';
import 'package:gsy_github_app_flutter/page/RepositoryDetailPage.dart';
import 'package:gsy_github_app_flutter/page/SearchPage.dart';
import 'package:gsy_github_app_flutter/page/UserProfilePage.dart';
/**
* 导航栏
* Created by guoshuyu
* Date: 2018-07-16
*/
class NavigatorUtils {
///替换
static pushReplacementNamed(BuildContext context, String routeName) {
Navigator.pushReplacementNamed(context, routeName);
}
///切换无参数页面
static pushNamed(BuildContext context, String routeName) {
Navigator.pushNamed(context, routeName);
}
///主页
static goHome(BuildContext context) {
Navigator.pushReplacementNamed(context, HomePage.sName);
}
///登录页
static goLogin(BuildContext context) {
Navigator.pushReplacementNamed(context, LoginPage.sName);
}
///个人中心
static goPerson(BuildContext context, String userName) {
Navigator.push(context, new MaterialPageRoute(builder: (context) => new PersonPage(userName)));
}
///仓库详情
static Future<Null> goReposDetail(BuildContext context, String userName, String reposName) {
return Navigator.push(context, new MaterialPageRoute(builder: (context) => new RepositoryDetailPage(userName, reposName)));
}
///仓库版本列表
static Future<Null> goReleasePage(BuildContext context, String userName, String reposName, String releaseUrl, String tagUrl) {
return Navigator.push(
context,
new MaterialPageRoute(
builder: (context) => new ReleasePage(
userName,
reposName,
releaseUrl,
tagUrl,
)));
}
///issue详情
static Future<Null> goIssueDetail(BuildContext context, String userName, String reposName, String num, {bool needRightLocalIcon = false}) {
return Navigator.push(
context,
new MaterialPageRoute(
builder: (context) => new IssueDetailPage(
userName,
reposName,
num,
needHomeIcon: needRightLocalIcon,
)));
}
///通用列表
static gotoCommonList(BuildContext context, String title, String showType, String dataType, {String userName, String reposName}) {
Navigator.push(
context,
new MaterialPageRoute(
builder: (context) => new CommonListPage(
title,
showType,
dataType,
userName: userName,
reposName: reposName,
)));
}
///文件代码详情
static gotoCodeDetailPage(BuildContext context,
{String title, String userName, String reposName, String path, String data, String branch, String htmlUrl}) {
Navigator.push(
context,
new MaterialPageRoute(
builder: (context) => new CodeDetailPage(
title: title,
userName: userName,
reposName: reposName,
path: path,
data: data,
branch: branch,
htmlUrl: htmlUrl,
)));
}
///仓库详情通知
static Future<Null> goNotifyPage(BuildContext context) {
return Navigator.push(context, new MaterialPageRoute(builder: (context) => new NotifyPage()));
}
///搜索
static Future<Null> goSearchPage(BuildContext context) {
return Navigator.push(context, new MaterialPageRoute(builder: (context) => new SearchPage()));
}
///提交详情
static Future<Null> goPushDetailPage(BuildContext context, String userName, String reposName, String sha, bool needHomeIcon) {
return Navigator.push(
context,
new MaterialPageRoute(
builder: (context) => new PushDetailPage(
sha,
userName,
reposName,
needHomeIcon: needHomeIcon,
)));
}
///全屏Web页面
static Future<Null> goGSYWebView(BuildContext context, String url, String title) {
return Navigator.push(
context,
new MaterialPageRoute(
builder: (context) => new GSYWebView(url, title),
),
);
}
///文件代码详情Web
static gotoCodeDetailPageWeb(BuildContext context,
{String title, String userName, String reposName, String path, String data, String branch, String htmlUrl}) {
Navigator.push(
context,
new MaterialPageRoute(
builder: (context) => new CodeDetailPageWeb(
title: title,
userName: userName,
reposName: reposName,
path: path,
data: data,
branch: branch,
htmlUrl: htmlUrl,
)));
}
///根据平台跳转文件代码详情Web
static gotoCodeDetailPlatform(BuildContext context,
{String title, String userName, String reposName, String path, String data, String branch, String htmlUrl}) {
if (Platform.isIOS) {
NavigatorUtils.gotoCodeDetailPage(
context,
title: title,
reposName: reposName,
userName: userName,
path: path,
branch: branch,
);
} else {
NavigatorUtils.gotoCodeDetailPageWeb(
context,
title: title,
reposName: reposName,
userName: userName,
path: path,
branch: branch,
);
}
}
///图片预览
static gotoPhotoViewPage(BuildContext context, String url) {
Navigator.push(context, new MaterialPageRoute(builder: (context) => new PhotoViewPage(url)));
}
///用户配置
static gotoUserProfileInfo(BuildContext context) {
Navigator.push(context, new MaterialPageRoute(builder: (context) => new UserProfileInfo()));
}
}