4 changed files with 441 additions and 14 deletions
Split View
Diff Options
-
31lib/controller/message/conversation_controller.dart
-
220lib/im/im_manager.dart
-
97lib/pages/main/main_page.dart
-
107lib/widget/message/message_notification_dialog.dart
@ -0,0 +1,107 @@ |
|||
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'; |
|||
|
|||
/// 消息通知弹框 |
|||
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), |
|||
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), |
|||
// 消息内容 |
|||
Text( |
|||
messageContent, |
|||
style: TextStyle( |
|||
fontSize: 13.sp, |
|||
color: Color(0xFF666666), |
|||
), |
|||
maxLines: 2, |
|||
overflow: TextOverflow.ellipsis, |
|||
), |
|||
], |
|||
), |
|||
), |
|||
], |
|||
), |
|||
), |
|||
); |
|||
} |
|||
} |
|||
|
|||
Write
Preview
Loading…
Cancel
Save