Skip to content

Commit 812b44f

Browse files
committed
增加fork仓库跳转到原仓库
1 parent e9d4592 commit 812b44f

File tree

3 files changed

+33
-10
lines changed

3 files changed

+33
-10
lines changed

lib/common/style/GSYStyle.dart

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,12 @@ class GSYConstant {
114114
fontSize: smallTextSize,
115115
);
116116

117+
static const actionLightSmallText = TextStyle(
118+
color: Color(GSYColors.actionBlue),
119+
fontSize: smallTextSize,
120+
);
121+
122+
117123
static const miLightSmallText = TextStyle(
118124
color: Color(GSYColors.miWhite),
119125
fontSize: smallTextSize,
@@ -299,6 +305,9 @@ class GSYStrings {
299305
static const String repos_tab_issue_open = "打开";
300306
static const String repos_tab_issue_closed = "关闭";
301307
static const String repos_option_release = "版本";
308+
static const String repos_fork_at = "Fork于 ";
309+
static const String repos_create_at = "创建于 ";
310+
static const String repos_last_commit = "最后提交于 ";
302311
static const String repos_all_issue_count = "所有Issue数:";
303312
static const String repos_open_issue_count = "开启Issue数:";
304313
static const String repos_close_issue_count = "关闭Issue数:";

lib/widget/ReposHeaderItem.dart

Lines changed: 23 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -43,10 +43,10 @@ class ReposHeaderItem extends StatelessWidget {
4343
@override
4444
Widget build(BuildContext context) {
4545
String createStr = reposHeaderViewModel.repositoryIsFork
46-
? "Frok at " + " " + reposHeaderViewModel.repositoryParentName + '\n'
47-
: "Create at " + " " + reposHeaderViewModel.created_at + "\n";
46+
? GSYStrings.repos_fork_at + reposHeaderViewModel.repositoryParentName + '\n'
47+
: GSYStrings.repos_create_at + reposHeaderViewModel.created_at + "\n";
4848

49-
String updateStr = "Last commit at " + reposHeaderViewModel.push_at;
49+
String updateStr = GSYStrings.repos_last_commit + reposHeaderViewModel.push_at;
5050

5151
String infoText = createStr + ((reposHeaderViewModel.push_at != null) ? updateStr : '');
5252

@@ -112,9 +112,21 @@ class ReposHeaderItem extends StatelessWidget {
112112

113113
///创建状态
114114
new Container(
115-
child: new Text(infoText, style: GSYConstant.subLightSmallText),
116-
margin: new EdgeInsets.only(top: 6.0, bottom: 2.0, right: 5.0),
117-
alignment: Alignment.topRight),
115+
margin: new EdgeInsets.only(top: 6.0, bottom: 2.0, right: 5.0),
116+
alignment: Alignment.topRight,
117+
child: new RawMaterialButton(
118+
onPressed: () {
119+
if (reposHeaderViewModel.repositoryIsFork) {
120+
NavigatorUtils.goReposDetail(context, reposHeaderViewModel.repositoryParentUser, reposHeaderViewModel.repositoryName);
121+
}
122+
},
123+
materialTapTargetSize: MaterialTapTargetSize.shrinkWrap,
124+
padding: const EdgeInsets.all(0.0),
125+
constraints: const BoxConstraints(minWidth: 0.0, minHeight: 0.0),
126+
child: new Text(infoText,
127+
style: reposHeaderViewModel.repositoryIsFork ? GSYConstant.actionLightSmallText : GSYConstant.subLightSmallText),
128+
),
129+
),
118130
new Divider(
119131
color: Color(GSYColors.subTextColor),
120132
),
@@ -135,6 +147,7 @@ class ReposHeaderItem extends StatelessWidget {
135147
userName: reposHeaderViewModel.ownerName, reposName: reposHeaderViewModel.repositoryName);
136148
},
137149
),
150+
138151
///fork状态
139152
new Container(width: 0.3, height: 25.0, color: Color(GSYColors.subLightTextColor)),
140153
_getBottomItem(
@@ -145,6 +158,7 @@ class ReposHeaderItem extends StatelessWidget {
145158
userName: reposHeaderViewModel.ownerName, reposName: reposHeaderViewModel.repositoryName);
146159
},
147160
),
161+
148162
///订阅状态
149163
new Container(width: 0.3, height: 25.0, color: Color(GSYColors.subLightTextColor)),
150164
_getBottomItem(
@@ -155,6 +169,7 @@ class ReposHeaderItem extends StatelessWidget {
155169
userName: reposHeaderViewModel.ownerName, reposName: reposHeaderViewModel.repositoryName);
156170
},
157171
),
172+
158173
///issue状态
159174
new Container(width: 0.3, height: 25.0, color: Color(GSYColors.subLightTextColor)),
160175
_getBottomItem(
@@ -207,6 +222,7 @@ class ReposHeaderViewModel {
207222
String repositoryDes = "---";
208223
String repositoryLastActivity = "";
209224
String repositoryParentName = "";
225+
String repositoryParentUser = "";
210226
String created_at = "";
211227
String push_at = "";
212228
String license = "";
@@ -240,6 +256,7 @@ class ReposHeaderViewModel {
240256
this.repositoryIsFork = map.fork;
241257
this.license = map.license != null ? map.license.name : "";
242258
this.repositoryParentName = map.parent != null ? map.parent.fullName : null;
259+
this.repositoryParentUser = map.parent != null ? map.parent.owner.login : null;
243260
this.created_at = CommonUtils.getNewsTimeStr(map.createdAt);
244261
this.push_at = CommonUtils.getNewsTimeStr(map.pushedAt);
245262
}

lib/widget/UserHeader.dart

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -199,10 +199,7 @@ class UserHeaderItem extends StatelessWidget {
199199
child: new GSYIConText(
200200
GSYICons.USER_ITEM_LINK,
201201
userInfo.blog ?? GSYStrings.nothing_now,
202-
TextStyle(
203-
color: (userInfo.blog == null) ? Color(GSYColors.subLightTextColor) : Color(GSYColors.actionBlue),
204-
fontSize: GSYConstant.smallTextSize,
205-
),
202+
(userInfo.blog == null) ? GSYConstant.subLightSmallText : GSYConstant.actionLightSmallText,
206203
Color(GSYColors.subLightTextColor),
207204
10.0,
208205
padding: 3.0,

0 commit comments

Comments
 (0)