fix: star and fork count 0 case

This commit is contained in:
Rongjian Zhang 2019-03-02 19:05:22 +08:00
parent c06179e109
commit ec1d995660
1 changed files with 9 additions and 6 deletions

View File

@ -60,17 +60,20 @@ class _TrendingScreenState extends State<TrendingScreen> {
?.replaceAll(RegExp(r'</g-emoji>'), ''), ?.replaceAll(RegExp(r'</g-emoji>'), ''),
'stargazers': { 'stargazers': {
'totalCount': item.children[3] 'totalCount': item.children[3]
.querySelectorAll('a')[0] .querySelector('.octicon-star')
?.parent
?.innerHtml ?.innerHtml
?.replaceFirst(RegExp(r'^[\s\S]*svg>'), '') ?.replaceFirst(RegExp(r'^[\s\S]*svg>'), '')
?.trim() ?.trim()
}, },
'forks': { 'forks': {
'totalCount': item.children[3] 'totalCount': item
.querySelectorAll('a')[1] .querySelector('.octicon-repo-forked')
?.innerHtml ?.parent
?.replaceFirst(RegExp(r'^[\s\S]*svg>'), '') ?.innerHtml
?.trim(), ?.replaceFirst(RegExp(r'^[\s\S]*svg>'), '')
?.trim() ??
0,
}, },
'primaryLanguage': lang, 'primaryLanguage': lang,
'isPrivate': false, 'isPrivate': false,