@@ -7,6 +7,7 @@ import 'package:gsy_github_app_flutter/common/utils/EventUtils.dart';
77import 'package:gsy_github_app_flutter/common/utils/NavigatorUtils.dart' ;
88import 'package:gsy_github_app_flutter/widget/GSYCardItem.dart' ;
99import 'package:gsy_github_app_flutter/widget/GSYUserIconWidget.dart' ;
10+ import 'package:gsy_github_app_flutter/common/model/Notification.dart' as Model;
1011
1112/**
1213 * 事件Item
@@ -27,23 +28,23 @@ class EventItem extends StatelessWidget {
2728 Widget des = (eventViewModel.actionDes == null || eventViewModel.actionDes.length == 0 )
2829 ? new Container ()
2930 : new Container (
30- child: new Text (
31- eventViewModel.actionDes,
32- style: GSYConstant .subSmallText,
33- maxLines: 3 ,
34- ),
35- margin: new EdgeInsets .only (top: 6.0 , bottom: 2.0 ),
36- alignment: Alignment .topLeft);
31+ child: new Text (
32+ eventViewModel.actionDes,
33+ style: GSYConstant .subSmallText,
34+ maxLines: 3 ,
35+ ),
36+ margin: new EdgeInsets .only (top: 6.0 , bottom: 2.0 ),
37+ alignment: Alignment .topLeft);
3738
3839 Widget userImage = (needImage)
3940 ? new GSYUserIconWidget (
40- padding: const EdgeInsets .only (top: 0.0 , right: 5.0 , left: 0.0 ),
41- width: 30.0 ,
42- height: 30.0 ,
43- image: eventViewModel.actionUserPic,
44- onPressed: () {
45- NavigatorUtils .goPerson (context, eventViewModel.actionUser);
46- })
41+ padding: const EdgeInsets .only (top: 0.0 , right: 5.0 , left: 0.0 ),
42+ width: 30.0 ,
43+ height: 30.0 ,
44+ image: eventViewModel.actionUserPic,
45+ onPressed: () {
46+ NavigatorUtils .goPerson (context, eventViewModel.actionUser);
47+ })
4748 : Container ();
4849 return new Container (
4950 child: new GSYCardItem (
@@ -79,7 +80,6 @@ class EventViewModel {
7980 String actionDes;
8081 String actionTime;
8182 String actionTarget;
82- var eventMap;
8383
8484 EventViewModel .fromEventMap (Event event) {
8585 actionTime = CommonUtils .getNewsTimeStr (event.createdAt);
@@ -97,13 +97,12 @@ class EventViewModel {
9797 actionTarget = eventMap.commit.message;
9898 }
9999
100- EventViewModel .fromNotify (eventMap) {
101- actionTime = CommonUtils .getNewsTimeStr (DateTime .parse (eventMap["updated_at" ]));
102- actionUser = eventMap["repository" ]["full_name" ];
103- String type = eventMap["subject" ]["type" ];
104- String status = eventMap["unread" ] ? GSYStrings .notify_unread : GSYStrings .notify_readed;
105- actionDes = eventMap["reason" ] + "${GSYStrings .notify_type }:$type ,${GSYStrings .notify_status }:$status " ;
106- actionTarget = eventMap["subject" ]["title" ];
107- this .eventMap = eventMap;
100+ EventViewModel .fromNotify (Model .Notification eventMap) {
101+ actionTime = CommonUtils .getNewsTimeStr (eventMap.updateAt);
102+ actionUser = eventMap.repository.fullName;
103+ String type = eventMap.subject.type;
104+ String status = eventMap.unread ? GSYStrings .notify_unread : GSYStrings .notify_readed;
105+ actionDes = eventMap.reason + "${GSYStrings .notify_type }:$type ,${GSYStrings .notify_status }:$status " ;
106+ actionTarget = eventMap.subject.title;
108107 }
109108}
0 commit comments