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.
107 lines
3.4 KiB
107 lines
3.4 KiB
import 'package:cached_network_image/cached_network_image.dart';
|
|
import 'package:dating_touchme_app/generated/assets.dart';
|
|
import 'package:flutter/material.dart';
|
|
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
|
import 'emoji_text_widget.dart';
|
|
|
|
/// 消息通知弹框
|
|
class MessageNotificationDialog extends StatelessWidget {
|
|
final String avatarUrl;
|
|
final String nickName;
|
|
final String messageContent;
|
|
final VoidCallback? onTap;
|
|
|
|
const MessageNotificationDialog({
|
|
super.key,
|
|
required this.avatarUrl,
|
|
required this.nickName,
|
|
required this.messageContent,
|
|
this.onTap,
|
|
});
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return GestureDetector(
|
|
onTap: onTap,
|
|
child: Container(
|
|
margin: EdgeInsets.symmetric(horizontal: 16.w, vertical: 30.h),
|
|
padding: EdgeInsets.symmetric(horizontal: 12.w, vertical: 12.h),
|
|
decoration: BoxDecoration(
|
|
color: Colors.white,
|
|
borderRadius: BorderRadius.circular(12.w),
|
|
boxShadow: [
|
|
BoxShadow(
|
|
color: Colors.black.withOpacity(0.1),
|
|
blurRadius: 8,
|
|
offset: Offset(0, 2.h),
|
|
),
|
|
],
|
|
),
|
|
child: Row(
|
|
children: [
|
|
// 头像
|
|
ClipOval(
|
|
child: avatarUrl.isNotEmpty
|
|
? CachedNetworkImage(
|
|
imageUrl: avatarUrl,
|
|
width: 48.w,
|
|
height: 48.w,
|
|
fit: BoxFit.cover,
|
|
placeholder: (context, url) => Image.asset(
|
|
Assets.imagesUserAvatar,
|
|
width: 48.w,
|
|
height: 48.w,
|
|
fit: BoxFit.cover,
|
|
),
|
|
errorWidget: (context, url, error) => Image.asset(
|
|
Assets.imagesUserAvatar,
|
|
width: 48.w,
|
|
height: 48.w,
|
|
fit: BoxFit.cover,
|
|
),
|
|
)
|
|
: Image.asset(
|
|
Assets.imagesUserAvatar,
|
|
width: 48.w,
|
|
height: 48.w,
|
|
fit: BoxFit.cover,
|
|
),
|
|
),
|
|
SizedBox(width: 12.w),
|
|
// 昵称和内容
|
|
Expanded(
|
|
child: Column(
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
mainAxisSize: MainAxisSize.min,
|
|
children: [
|
|
// 昵称
|
|
Text(
|
|
nickName,
|
|
style: TextStyle(
|
|
fontSize: 15.sp,
|
|
fontWeight: FontWeight.w600,
|
|
color: Color(0xFF333333),
|
|
),
|
|
maxLines: 1,
|
|
overflow: TextOverflow.ellipsis,
|
|
),
|
|
SizedBox(height: 4.h),
|
|
// 消息内容(使用EmojiTextWidget支持emoji显示)
|
|
EmojiTextWidget(
|
|
text: messageContent,
|
|
textStyle: TextStyle(
|
|
fontSize: 13.sp,
|
|
color: Color(0xFF666666),
|
|
),
|
|
emojiSize: 20.w,
|
|
),
|
|
],
|
|
),
|
|
),
|
|
],
|
|
),
|
|
),
|
|
);
|
|
}
|
|
}
|
|
|