fix(gl): handle statistics null

This commit is contained in:
Rongjian Zhang 2020-04-05 22:41:51 +08:00
parent a5c1d0f5ba
commit a1984309a9
1 changed files with 14 additions and 12 deletions

View File

@ -114,12 +114,13 @@ class GlProjectScreen extends StatelessWidget {
TableView(
hasIcon: true,
items: [
TableViewItem(
leftIconData: Octicons.code,
text: Text(langs.keys.isEmpty ? 'Code' : langs.keys.first),
rightWidget: Text(filesize(p.statistics.repositorySize)),
url: '/gitlab/projects/$id/tree/${p.defaultBranch}',
),
if (p.statistics != null)
TableViewItem(
leftIconData: Octicons.code,
text: Text(langs.keys.isEmpty ? 'Code' : langs.keys.first),
rightWidget: Text(filesize(p.statistics.repositorySize)),
url: '/gitlab/projects/$id/tree/${p.defaultBranch}',
),
if (p.issuesEnabled)
TableViewItem(
leftIconData: Octicons.issue_opened,
@ -133,12 +134,13 @@ class GlProjectScreen extends StatelessWidget {
text: Text('Merge requests'),
url: '/gitlab/projects/$id/merge_requests?prefix=$prefix',
),
TableViewItem(
leftIconData: Octicons.history,
text: Text('Commits'),
rightWidget: Text(p.statistics.commitCount.toString()),
url: '/gitlab/projects/$id/commits?prefix=$prefix',
),
if (p.statistics != null)
TableViewItem(
leftIconData: Octicons.history,
text: Text('Commits'),
rightWidget: Text(p.statistics.commitCount.toString()),
url: '/gitlab/projects/$id/commits?prefix=$prefix',
),
],
),
CommonStyle.verticalGap,