Skip to content

Commit

Permalink
fix(github): empty repo (no ref)
Browse files Browse the repository at this point in the history
closes #99
  • Loading branch information
pd4d10 committed Oct 6, 2020
1 parent e47980d commit 3002c07
Showing 1 changed file with 23 additions and 24 deletions.
47 changes: 23 additions & 24 deletions lib/screens/gh_repo.dart
Expand Up @@ -250,16 +250,15 @@ class GhRepoScreen extends StatelessWidget {
Text(numberFormat.format(repo.pullRequests.totalCount)),
url: '/github/$owner/$name/pulls',
),
TableViewItem(
leftIconData: Octicons.history,
text: Text('Commits'),
rightWidget: Text((ref.target as GhRepoCommit)
.history
?.totalCount
.toString()),
url: '/github/$owner/$name/commits',
),
if (ref != null) ...[
TableViewItem(
leftIconData: Octicons.history,
text: Text('Commits'),
rightWidget: Text(
((ref.target as GhRepoCommit).history?.totalCount ?? 0)
.toString()),
url: '/github/$owner/$name/commits',
),
if (repo.refs != null)
TableViewItem(
leftIconData: Octicons.git_branch,
Expand Down Expand Up @@ -289,22 +288,22 @@ class GhRepoScreen extends StatelessWidget {
);
},
),
TableViewItem(
leftIconData: Octicons.organization,
text: Text('Contributors'),
rightWidget: FutureBuilder<String>(
future: context
.read<AuthModel>()
.ghClient
.getJSON('/repos/$owner/$name/stats/contributors')
.then((v) => v.length.toString()),
builder: (context, snapshot) {
return Text(snapshot.data ?? '');
},
),
url: '/github/$owner/$name/contributors',
)
],
TableViewItem(
leftIconData: Octicons.organization,
text: Text('Contributors'),
rightWidget: FutureBuilder<String>(
future: context
.read<AuthModel>()
.ghClient
.getJSON('/repos/$owner/$name/stats/contributors')
.then((v) => v.length.toString()),
builder: (context, snapshot) {
return Text(snapshot.data ?? '');
},
),
url: '/github/$owner/$name/contributors',
)
],
),
FutureBuilder<String>(
Expand Down

0 comments on commit 3002c07

Please sign in to comment.