-
Notifications
You must be signed in to change notification settings - Fork 141
/
Copy pathcommit_item.dart
73 lines (72 loc) · 2.14 KB
/
commit_item.dart
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
63
64
65
66
67
68
69
70
71
72
73
import 'package:antd_mobile/antd_mobile.dart';
import 'package:flutter/widgets.dart';
import 'package:git_touch/utils/utils.dart';
import 'package:git_touch/widgets/avatar.dart';
import 'package:timeago/timeago.dart' as timeago;
class CommitItem extends StatelessWidget {
const CommitItem({
required this.url,
required this.avatarUrl,
required this.avatarLink,
required this.message,
required this.author,
required this.createdAt,
this.widgets,
});
final String? url;
final String? avatarUrl;
final String? avatarLink;
final String? message;
final String? author;
final DateTime? createdAt;
final List<Widget>? widgets;
@override
Widget build(BuildContext context) {
return AntListItem(
onClick: () {
context.pushUrl(url!);
},
child: Row(
children: <Widget>[
if (avatarUrl != null) ...[
Avatar(url: avatarUrl, linkUrl: avatarLink),
const SizedBox(width: 10),
],
Expanded(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
Text(
message!,
style: TextStyle(
fontSize: 17,
color: AntTheme.of(context).colorText,
),
overflow: TextOverflow.ellipsis,
maxLines: 1,
),
const SizedBox(height: 4),
Row(
children: <Widget>[
Text(author!,
style: TextStyle(
fontSize: 15,
color: AntTheme.of(context).colorPrimary)),
Text(
' committed ${timeago.format(createdAt!)}',
style: TextStyle(
color: AntTheme.of(context).colorTextSecondary,
fontSize: 15,
),
),
if (widgets != null) ...widgets!,
],
)
],
),
)
],
),
);
}
}