feat: hide owner of user page repos if same

This commit is contained in:
Rongjian Zhang 2019-03-09 03:16:22 +08:00
parent c300113b8a
commit 9bdb01e04c
2 changed files with 15 additions and 9 deletions

View File

@ -79,13 +79,17 @@ class _UserScreenState extends State<UserScreen> {
}
return ListGroup(
title: Text(
title,
style: TextStyle(fontSize: 16),
),
items: items,
itemBuilder: (item, _) => RepoItem(item),
);
title: Text(
title,
style: TextStyle(fontSize: 16),
),
items: items,
itemBuilder: (item, _) {
return RepoItem(
item,
showOwner: item['owner']['login'] != widget.login,
);
});
}
Widget _buildEmail(payload) {

View File

@ -6,8 +6,9 @@ import 'link.dart';
class RepoItem extends StatelessWidget {
final Map<String, dynamic> payload;
final bool showOwner;
RepoItem(this.payload);
RepoItem(this.payload, {this.showOwner = true});
IconData _buildIconData() {
if (payload['isPrivate']) {
@ -34,7 +35,8 @@ class RepoItem extends StatelessWidget {
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
Text(
payload['owner']['login'] + '/' + payload['name'],
(showOwner ? (payload['owner']['login'] + '/') : '') +
payload['name'],
style: TextStyle(fontWeight: FontWeight.w600, fontSize: 15),
),
Padding(padding: EdgeInsets.only(top: 6)),