Skip to content

Commit

Permalink
feat: add topics to repo screen
Browse files Browse the repository at this point in the history
  • Loading branch information
pd4d10 committed Sep 26, 2019
1 parent b958ddf commit 3f2b9ed
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 1 deletion.
8 changes: 8 additions & 0 deletions lib/screens/repository.dart
Expand Up @@ -108,6 +108,14 @@ class RepositoryScreen extends StatelessWidget {
name
spdxId
}
repositoryTopics(first: 100) {
nodes {
url
topic {
name
}
}
}
}
}
''');
Expand Down
26 changes: 25 additions & 1 deletion lib/widgets/repository_item.dart
Expand Up @@ -94,6 +94,30 @@ class RepositoryItem extends StatelessWidget {
);
}

Widget _buildTopics() {
// TODO: link
return Wrap(
spacing: 4,
runSpacing: 4,
children: (payload['repositoryTopics']['nodes'] as List).map((node) {
return Container(
padding: EdgeInsets.symmetric(vertical: 4, horizontal: 8),
decoration: BoxDecoration(
color: PrimerColors.blue000,
borderRadius: BorderRadius.all(Radius.circular(4)),
),
child: Text(
node['topic']['name'],
style: TextStyle(
fontSize: 12,
color: PrimerColors.blue500,
),
),
);
}).toList(),
);
}

@override
Widget build(BuildContext context) {
var widget = Container(
Expand Down Expand Up @@ -135,7 +159,7 @@ class RepositoryItem extends StatelessWidget {
color: PrimerColors.gray700,
fontSize: inRepoScreen ? 15 : 14),
),
if (!inRepoScreen) _buildStatus(),
if (inRepoScreen) _buildTopics() else _buildStatus(),
]),
),
),
Expand Down

0 comments on commit 3f2b9ed

Please sign in to comment.