class ConversationCell extends StatelessWidget {
ConversationCell({required this.conversation});
final ConversationData conversation;
@override
Widget build(BuildContext context) {
return Container(
height: 60,
color: Colors.white,
child: Stack(
children: [
Align(
alignment: Alignment.center,
child: Container(
child: Row(
crossAxisAlignment: CrossAxisAlignment.center,
children: [
const SizedBox(
width: 12,
),
// 圆角
Container(
width: 48,
height: 48,
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(4),
image: DecorationImage(
// 网络图片
image: NetworkImage(conversation.avatar),
),
),
),
const SizedBox(
width: 12,
),
Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
const SizedBox(height: 12),
Text(
conversation.nick,
maxLines: 1,
style: const TextStyle(
fontSize: 14,
fontWeight: FontWeight.w500,
),
),
Container(
// 限制宽度
width: UIConfig.screenWidth(context) * 0.7,
child: Text(
conversation.lastestMessage,
maxLines: 1,
// 缩略样式
overflow: TextOverflow.ellipsis,
style: const TextStyle(
fontSize: 12,
fontWeight: FontWeight.w400,
),
),
)
],
),
],
),
),
),
// 分割线
Align(
alignment: Alignment.bottomCenter,
child: Container(
margin: const EdgeInsets.only(left: 70),
height: 0.5,
color: Colors.grey,
),
),
],
),
);
}
}