Skip to content

Commit d443e3a

Browse files
committed
增加仓库tag
1 parent 812b44f commit d443e3a

File tree

4 files changed

+63
-6
lines changed

4 files changed

+63
-6
lines changed

VERSION.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,9 @@
1616
### 1.0.7(进行中)
1717
* 增加图片预览
1818
* 修复未读的通知打开提示其他异常
19+
* 增加fork仓库跳转到原仓库
20+
* 增加仓库点击展示 issue 状态信息
21+
* 增加个人状态信息可跳转
1922

2023
### 1.0.6
2124
* trend修改为redux

lib/common/model/Repository.dart

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,8 @@ class Repository extends Object with _$RepositorySerializerMixin {
9393

9494
RepositoryPermissions permissions;
9595

96+
List<String> topics;
97+
9698
///issue总数,不参加序列化
9799
int allIssueCount;
98100

@@ -128,6 +130,7 @@ class Repository extends Object with _$RepositorySerializerMixin {
128130
this.owner,
129131
this.parent,
130132
this.permissions,
133+
this.topics,
131134
);
132135

133136
/// A necessary factory constructor for creating a new User instance

lib/common/model/Repository.g.dart

Lines changed: 8 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

lib/widget/ReposHeaderItem.dart

Lines changed: 49 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -40,16 +40,58 @@ class ReposHeaderItem extends StatelessWidget {
4040
);
4141
}
4242

43-
@override
44-
Widget build(BuildContext context) {
43+
_renderTopicItem(String item) {
44+
return new RawMaterialButton(
45+
onPressed: () {},
46+
materialTapTargetSize: MaterialTapTargetSize.shrinkWrap,
47+
padding: const EdgeInsets.all(0.0),
48+
constraints: const BoxConstraints(minWidth: 0.0, minHeight: 0.0),
49+
child: new Container(
50+
padding: EdgeInsets.only(left: 5.0, right: 5.0, top: 2.5, bottom: 2.5),
51+
decoration: new BoxDecoration(
52+
borderRadius: BorderRadius.all(Radius.circular(4.0)),
53+
color: Colors.white30,
54+
border: new Border.all(color: Colors.white30, width: 0.0),
55+
),
56+
child: new Text(
57+
item,
58+
style: GSYConstant.subLightSmallText,
59+
),
60+
));
61+
}
62+
63+
///话题组控件
64+
_renderTopicGroup() {
65+
if (reposHeaderViewModel.topics == null || reposHeaderViewModel.topics.length == 0) {
66+
return Container();
67+
}
68+
List<Widget> list = new List();
69+
for (String item in reposHeaderViewModel.topics) {
70+
list.add(_renderTopicItem(item));
71+
}
72+
return new Container(
73+
alignment: Alignment.topLeft,
74+
child: Wrap(
75+
spacing: 10.0,
76+
runSpacing: 5.0,
77+
children: list,
78+
),
79+
);
80+
}
81+
82+
///仓库创建和提交状态信息
83+
_getInfoText() {
4584
String createStr = reposHeaderViewModel.repositoryIsFork
4685
? GSYStrings.repos_fork_at + reposHeaderViewModel.repositoryParentName + '\n'
4786
: GSYStrings.repos_create_at + reposHeaderViewModel.created_at + "\n";
4887

4988
String updateStr = GSYStrings.repos_last_commit + reposHeaderViewModel.push_at;
5089

51-
String infoText = createStr + ((reposHeaderViewModel.push_at != null) ? updateStr : '');
90+
return createStr + ((reposHeaderViewModel.push_at != null) ? updateStr : '');
91+
}
5292

93+
@override
94+
Widget build(BuildContext context) {
5395
return new Column(
5496
children: <Widget>[
5597
new GSYCardItem(
@@ -123,7 +165,7 @@ class ReposHeaderItem extends StatelessWidget {
123165
materialTapTargetSize: MaterialTapTargetSize.shrinkWrap,
124166
padding: const EdgeInsets.all(0.0),
125167
constraints: const BoxConstraints(minWidth: 0.0, minHeight: 0.0),
126-
child: new Text(infoText,
168+
child: new Text(_getInfoText(),
127169
style: reposHeaderViewModel.repositoryIsFork ? GSYConstant.actionLightSmallText : GSYConstant.subLightSmallText),
128170
),
129171
),
@@ -190,6 +232,7 @@ class ReposHeaderItem extends StatelessWidget {
190232
),
191233
],
192234
)),
235+
_renderTopicGroup(),
193236
],
194237
),
195238
),
@@ -226,6 +269,7 @@ class ReposHeaderViewModel {
226269
String created_at = "";
227270
String push_at = "";
228271
String license = "";
272+
List<String> topics;
229273
int allIssueCount = 0;
230274
int openIssuesCount = 0;
231275
bool repositoryStared = false;
@@ -243,6 +287,7 @@ class ReposHeaderViewModel {
243287
this.ownerPic = map.owner.avatar_url;
244288
this.repositoryName = reposName;
245289
this.allIssueCount = map.allIssueCount;
290+
this.topics = map.topics;
246291
this.openIssuesCount = map.openIssuesCount;
247292
this.repositoryStar = map.watchersCount != null ? map.watchersCount.toString() : "";
248293
this.repositoryFork = map.forksCount != null ? map.forksCount.toString() : "";

0 commit comments

Comments
 (0)