forked from CarGuo/gsy_github_app_flutter
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrelease_item.dart
More file actions
62 lines (54 loc) · 1.8 KB
/
Copy pathrelease_item.dart
File metadata and controls
62 lines (54 loc) · 1.8 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
import 'package:flutter/material.dart';
import 'package:gsy_github_app_flutter/common/model/Release.dart';
import 'package:gsy_github_app_flutter/common/style/gsy_style.dart';
import 'package:gsy_github_app_flutter/common/utils/common_utils.dart';
import 'package:gsy_github_app_flutter/widget/gsy_card_item.dart';
/**
* 版本TagItem
* Created by guoshuyu
* Date: 2018-07-30
*/
class ReleaseItem extends StatelessWidget {
final ReleaseItemViewModel releaseItemViewModel;
final GestureTapCallback onPressed;
final GestureLongPressCallback onLongPress;
ReleaseItem(this.releaseItemViewModel, {this.onPressed, this.onLongPress}) : super();
@override
Widget build(BuildContext context) {
return new Container(
child: new GSYCardItem(
child: new InkWell(
onTap: onPressed,
onLongPress: onLongPress,
child: new Padding(
padding: new EdgeInsets.only(left: 10.0, top: 15.0, right: 10.0, bottom: 15.0),
child: new Row(
children: <Widget>[
new Expanded(child: new Text(releaseItemViewModel.actionTitle, style: GSYConstant.smallTextBold)),
new Container(child: new Text(releaseItemViewModel.actionTime ?? "", style: GSYConstant.smallSubText)),
],
),
),
),
),
);
}
}
class ReleaseItemViewModel {
String actionTime;
String actionTitle;
String actionMode;
String actionTarget;
String actionTargetHtml;
String body;
ReleaseItemViewModel();
ReleaseItemViewModel.fromMap(Release map) {
if (map.publishedAt != null) {
actionTime = CommonUtils.getNewsTimeStr(map.publishedAt);
}
actionTitle = map.name ?? map.tagName;
actionTarget = map.targetCommitish;
actionTargetHtml = map.bodyHtml;
body = map.body ?? "";
}
}