-
Notifications
You must be signed in to change notification settings - Fork 197
/
friend_card.dart
89 lines (81 loc) · 2.21 KB
/
friend_card.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
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
import 'package:flutter/material.dart';
class FriendCard extends StatelessWidget {
final FriendViewModel data;
const FriendCard({
Key key,
this.data,
}) : super(key: key);
@override
Widget build(BuildContext context) {
return Container(
color: Colors.white,
padding: EdgeInsets.all(15),
child: Row(
children: <Widget>[
ClipRRect(
borderRadius: BorderRadius.circular(4),
child: Image.network(
this.data.userImgUrl,
width: 40,
height: 40,
),
),
Padding(padding: EdgeInsets.only(left: 15)),
Expanded(
child: Column(
crossAxisAlignment: CrossAxisAlignment.stretch,
children: <Widget>[
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: <Widget>[
Text(
this.data.userName,
style: TextStyle(
fontSize: 18,
fontWeight: FontWeight.w500,
color: Color(0xFF333333),
),
),
Text(
this.data.msgTime,
style: TextStyle(
fontSize: 13,
color: Color(0xFF999999),
),
)
],
),
Padding(padding: EdgeInsets.only(top: 2)),
Text(
this.data.msgContent,
maxLines: 1,
overflow: TextOverflow.ellipsis,
style: TextStyle(
fontSize: 15,
color: Color(0xFF999999),
),
),
],
),
),
],
),
);
}
}
class FriendViewModel {
/// 用户昵称
final String userName;
/// 用户头像
final String userImgUrl;
/// 消息内容
final String msgContent;
/// 消息收到时间
final String msgTime;
const FriendViewModel({
this.userName,
this.userImgUrl,
this.msgContent,
this.msgTime,
});
}