|
1 | 1 | import 'package:flutter/material.dart'; |
| 2 | +import 'package:gsy_github_app_flutter/common/model/Repository.dart'; |
2 | 3 | import 'package:gsy_github_app_flutter/common/style/GSYStyle.dart'; |
3 | 4 | import 'package:gsy_github_app_flutter/common/utils/CommonUtils.dart'; |
4 | 5 | import 'package:gsy_github_app_flutter/common/utils/NavigatorUtils.dart'; |
@@ -185,23 +186,23 @@ class ReposHeaderViewModel { |
185 | 186 |
|
186 | 187 | ReposHeaderViewModel(); |
187 | 188 |
|
188 | | - ReposHeaderViewModel.fromHttpMap(reposName, ownerName, map) { |
| 189 | + ReposHeaderViewModel.fromHttpMap(ownerName, reposName, Repository map) { |
189 | 190 | this.ownerName = ownerName; |
190 | | - this.ownerPic = map["owner"]["avatar_url"]; |
| 191 | + this.ownerPic = map.owner.avatar_url; |
191 | 192 | this.repositoryName = reposName; |
192 | | - this.repositoryStar = map["watchers_count"] != null ? map["watchers_count"].toString() : ""; |
193 | | - this.repositoryFork = map["forks_count"] != null ? map["forks_count"].toString() : ""; |
194 | | - this.repositoryWatch = map["subscribers_count"] != null ? map["subscribers_count"].toString() : ""; |
195 | | - this.repositoryIssue = map["open_issues_count"] != null ? map["open_issues_count"].toString() : ""; |
196 | | - this.repositoryIssueClose = map["closed_issues_count"] != null ? map["closed_issues_count"].toString() : ""; |
197 | | - this.repositoryIssueAll = map["all_issues_count"] != null ? map["all_issues_count"].toString() : ""; |
198 | | - this.repositorySize = ((map["size"] / 1024.0)).toString().substring(0, 3) + "M"; |
199 | | - this.repositoryType = map["language"]; |
200 | | - this.repositoryDes = map["description"]; |
201 | | - this.repositoryIsFork = map["fork"]; |
202 | | - this.license = map["license"] != null ? map["license"]["name"] : ""; |
203 | | - this.repositoryParentName = map["parent"] != null ? map["parent"]["full_name"] : null; |
204 | | - this.created_at = CommonUtils.getNewsTimeStr(DateTime.parse(map["created_at"])); |
205 | | - this.push_at = CommonUtils.getNewsTimeStr(DateTime.parse(map["pushed_at"])); |
| 193 | + this.repositoryStar = map.watchersCount != null ? map.watchersCount.toString() : ""; |
| 194 | + this.repositoryFork = map.forksCount != null ? map.forksCount.toString() : ""; |
| 195 | + this.repositoryWatch = map.subscribersCount != null ? map.subscribersCount.toString() : ""; |
| 196 | + this.repositoryIssue = map.openIssuesCount != null ? map.openIssuesCount.toString() : ""; |
| 197 | + //this.repositoryIssueClose = map.closedIssuesCount != null ? map.closed_issues_count.toString() : ""; |
| 198 | + //this.repositoryIssueAll = map.all_issues_count != null ? map.all_issues_count.toString() : ""; |
| 199 | + this.repositorySize = ((map.size / 1024.0)).toString().substring(0, 3) + "M"; |
| 200 | + this.repositoryType = map.language; |
| 201 | + this.repositoryDes = map.description; |
| 202 | + this.repositoryIsFork = map.fork; |
| 203 | + this.license = map.license != null ? map.license.name : ""; |
| 204 | + this.repositoryParentName = map.parent != null ? map.parent.fullName : null; |
| 205 | + this.created_at = CommonUtils.getNewsTimeStr(map.createdAt); |
| 206 | + this.push_at = CommonUtils.getNewsTimeStr(map.pushedAt); |
206 | 207 | } |
207 | 208 | } |
0 commit comments