1
0
mirror of https://github.com/git-touch/git-touch synced 2025-02-21 14:01:02 +01:00

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( return ListGroup(
title: Text( title: Text(
title, title,
style: TextStyle(fontSize: 16), style: TextStyle(fontSize: 16),
), ),
items: items, items: items,
itemBuilder: (item, _) => RepoItem(item), itemBuilder: (item, _) {
); return RepoItem(
item,
showOwner: item['owner']['login'] != widget.login,
);
});
} }
Widget _buildEmail(payload) { Widget _buildEmail(payload) {

View File

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