|
1 | 1 | import 'package:flutter/material.dart'; |
| 2 | +import 'package:gsy_github_app_flutter/common/model/CommitFile.dart'; |
| 3 | +import 'package:gsy_github_app_flutter/common/model/PushCommit.dart'; |
2 | 4 | import 'package:gsy_github_app_flutter/common/style/GSYStyle.dart'; |
3 | 5 | import 'package:gsy_github_app_flutter/common/utils/CommonUtils.dart'; |
4 | 6 | import 'package:gsy_github_app_flutter/common/utils/NavigatorUtils.dart'; |
5 | 7 | import 'package:gsy_github_app_flutter/widget/GSYCardItem.dart'; |
6 | 8 | import 'package:gsy_github_app_flutter/widget/GSYIConText.dart'; |
7 | 9 | import 'package:gsy_github_app_flutter/widget/GSYUserIconWidget.dart'; |
8 | | -import 'package:gsy_github_app_flutter/widget/PushCoedItem.dart'; |
9 | 10 |
|
10 | 11 | /** |
11 | 12 | * 提交详情的头 |
@@ -105,28 +106,26 @@ class PushHeaderViewModel { |
105 | 106 | String editCount = "---"; |
106 | 107 | String addCount = "---"; |
107 | 108 | String deleteCount = "---"; |
108 | | - List<PushCodeItemViewModel> files = new List(); |
109 | 109 |
|
110 | 110 | PushHeaderViewModel(); |
111 | 111 |
|
112 | | - PushHeaderViewModel.forMap(pushMap) { |
| 112 | + PushHeaderViewModel.forMap(PushCommit pushMap) { |
113 | 113 | String name = "---"; |
114 | 114 | String pic = "---"; |
115 | | - if (pushMap["committer"] != null) { |
116 | | - name = pushMap["committer"]["login"]; |
117 | | - } else if (pushMap["commit"] != null && pushMap["commit"]["author"] != null) { |
118 | | - name = pushMap["commit"]["author"]["name"]; |
| 115 | + if (pushMap.committer != null) { |
| 116 | + name = pushMap.committer.login; |
| 117 | + } else if (pushMap.commit != null && pushMap.commit.author != null) { |
| 118 | + name = pushMap.commit.author.name; |
119 | 119 | } |
120 | | - if (pushMap["committer"] != null && pushMap["committer"]["avatar_url"] != null) { |
121 | | - pic = pushMap["committer"]["avatar_url"]; |
| 120 | + if (pushMap.committer != null && pushMap.committer.avatar_url != null) { |
| 121 | + pic = pushMap.committer.avatar_url; |
122 | 122 | } |
123 | 123 | actionUser = name; |
124 | 124 | actionUserPic = pic; |
125 | | - pushDes = "Push at " + pushMap["commit"]["message"]; |
126 | | - pushTime = CommonUtils.getNewsTimeStr(DateTime.parse(pushMap["commit"]["committer"]["date"])); |
127 | | - ; |
128 | | - editCount = pushMap["files"].length.toString() + ""; |
129 | | - addCount = pushMap["stats"]["additions"].toString() + ""; |
130 | | - deleteCount = pushMap["stats"]["deletions"].toString() + ""; |
| 125 | + pushDes = "Push at " + pushMap.commit.message; |
| 126 | + pushTime = CommonUtils.getNewsTimeStr(pushMap.commit.committer.date); |
| 127 | + editCount = pushMap.files.length.toString() + ""; |
| 128 | + addCount = pushMap.stats.additions.toString() + ""; |
| 129 | + deleteCount = pushMap.stats.deletions.toString() + ""; |
131 | 130 | } |
132 | 131 | } |
0 commit comments