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
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
import 'package:flutter/material.dart';
import 'package:gmalpha_flutter/model/message/message.dart';
class MessageItem extends StatelessWidget {
final Message message;
VoidCallback onPressed;
MessageItem({Key key, this.message, this.onPressed}) : super(key: key);
@override
Widget build(BuildContext context) {
var thumbImg = new Container(
width: 42,
height: 42,
decoration: BoxDecoration(
shape: BoxShape.circle,
image: new DecorationImage(
image: new NetworkImage(message.icon),
)
),
);
var contentImg = new Container(
width: 48,
height: 48,
decoration: BoxDecoration(
image: new DecorationImage(
image: new NetworkImage(message.repliedContent.content),
)
),
);
var titleRow = new Row (
children: <Widget>[
new Row (
mainAxisAlignment: MainAxisAlignment.start,
children: <Widget>[
Text(message.name, style: TextStyle(color: Color(0xff323232), fontWeight: FontWeight.bold, fontSize: 13)),
new Padding (
padding: EdgeInsets.only(left: 8, right: 8),
child: Text('评论了你', style: TextStyle(color: Color(0xff323232), fontSize: 13)),
)
],
),
],
);
String timeStr() {
DateTime dateTime = DateTime.fromMicrosecondsSinceEpoch((message.time*1000*1000).toInt(), isUtc: false);
String time = dateTime.toString();
time = time.substring("yyyy-".length, "yyyy-MM-dd".length);
return time;
}
var contenRow = new Row (
mainAxisAlignment: MainAxisAlignment.start,
children: <Widget>[
new Expanded(
child: new Text(message.content, maxLines: 2, textAlign: TextAlign.start, overflow: TextOverflow.ellipsis, style: TextStyle(color: Color(0xff323232), fontSize: 13, )),
)
],
// mainAxisSize: ,
// children: <Widget>[
// ],
// padding: EdgeInsets.only(right: ),
// mainAxisAlignment: MainAxisAlignment.start,
);
var timeRow = new Row(
children: <Widget>[
new Text(timeStr(), maxLines: 1, overflow: TextOverflow.ellipsis, style: TextStyle(color: Color(0xff8e8e8e), fontSize: 10, )),
],
);
return new GestureDetector(
onTap: onPressed,
// onTap: timeStr(),
child: new Container(
child: new Column(
children: <Widget>[
new Row(
children: <Widget>[
new Padding(
padding: const EdgeInsets.only(left: 16, top: 20),
child: new Container(
child: new Center(
child: thumbImg,
),
),
),
new Expanded(
flex: 1,
child: new Padding(
padding: const EdgeInsets.only(left: 10,right: 10, top: 10, bottom: 10),
child: new Column(
mainAxisAlignment: MainAxisAlignment.start,
children: <Widget>[
titleRow,
// Text(message.content, maxLines: 2, textAlign: TextAlign.left, overflow: TextOverflow.ellipsis, style: TextStyle(color: Color(0xff323232), fontSize: 13, )),
contenRow,
timeRow,
],
),
),
),
new Padding(
padding: const EdgeInsets.only(right: 16),
child: new Container(
child: new Center(
child: contentImg,
),
),
)
],
)
],
),
),
);
}
}