You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
70 lines
2.0 KiB
70 lines
2.0 KiB
import 'package:dating_touchme_app/generated/assets.dart';
|
|
import 'package:dating_touchme_app/model/live/live_chat_message.dart';
|
|
import 'package:flutter/material.dart';
|
|
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
|
|
|
class LiveRoomChatItem extends StatelessWidget {
|
|
const LiveRoomChatItem({
|
|
super.key,
|
|
required this.message,
|
|
});
|
|
|
|
final LiveChatMessage message;
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return Container(
|
|
width: 260.w,
|
|
margin: EdgeInsets.only(bottom: 15.w),
|
|
child: Row(
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
children: [
|
|
// 头像
|
|
ClipOval(
|
|
child: message.avatar != null && message.avatar!.isNotEmpty
|
|
? Image.network(
|
|
message.avatar!,
|
|
width: 25.w,
|
|
height: 25.w,
|
|
fit: BoxFit.cover,
|
|
errorBuilder: (context, error, stackTrace) {
|
|
return Image.asset(
|
|
Assets.imagesUserAvatar,
|
|
width: 25.w,
|
|
height: 25.w,
|
|
);
|
|
},
|
|
)
|
|
: Image.asset(
|
|
Assets.imagesUserAvatar,
|
|
width: 25.w,
|
|
height: 25.w,
|
|
),
|
|
),
|
|
SizedBox(width: 10.w),
|
|
// 消息内容
|
|
Expanded(
|
|
child: RichText(
|
|
text: TextSpan(
|
|
children: [
|
|
TextSpan(
|
|
text: "${message.userName}:",
|
|
style: TextStyle(
|
|
fontSize: 11.w,
|
|
color: const Color.fromRGBO(155, 138, 246, 1),
|
|
),
|
|
),
|
|
TextSpan(
|
|
text: message.content,
|
|
style: TextStyle(fontSize: 11.w, color: Colors.white),
|
|
),
|
|
],
|
|
),
|
|
),
|
|
),
|
|
],
|
|
),
|
|
);
|
|
}
|
|
}
|
|
|