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.
 
 
 
 
 

163 lines
5.5 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 'package:get/get.dart';
/// 视频通话邀请弹框
class VideoCallInviteDialog extends StatelessWidget {
final String avatarUrl;
final String nickName;
final String? callType;
final String? channelId;
final VoidCallback? onTap; // 点击弹框主体区域(只跳转,不接通)
final VoidCallback? onAccept; // 点击接通按钮(接通并跳转)
final VoidCallback? onReject; // 点击挂断按钮(拒绝)
const VideoCallInviteDialog({
super.key,
required this.avatarUrl,
required this.nickName,
this.callType,
this.channelId,
this.onTap,
this.onAccept,
this.onReject,
});
@override
Widget build(BuildContext context) {
Get.log('VideoCallInviteDialog$callType');
return GestureDetector(
onTap: onTap,
child: Container(
margin: EdgeInsets.symmetric(horizontal: 16.w, vertical: 30.h),
padding: EdgeInsets.all(16.w),
decoration: BoxDecoration(
color: Colors.black.withOpacity(0.9),
borderRadius: BorderRadius.circular(16.w),
boxShadow: [
BoxShadow(
color: Colors.black.withOpacity(0.3),
blurRadius: 12,
offset: Offset(0, 4.h),
),
],
),
child: Row(
children: [
// 左侧:头像和昵称、文案
Expanded(
child: Row(
children: [
// 头像
ClipOval(
child: avatarUrl.isNotEmpty
? CachedNetworkImage(
imageUrl: avatarUrl,
width: 56.w,
height: 56.w,
fit: BoxFit.cover,
placeholder: (context, url) => Image.asset(
Assets.imagesUserAvatar,
width: 56.w,
height: 56.w,
fit: BoxFit.cover,
),
errorWidget: (context, url, error) => Image.asset(
Assets.imagesUserAvatar,
width: 56.w,
height: 56.w,
fit: BoxFit.cover,
),
)
: Image.asset(
Assets.imagesUserAvatar,
width: 56.w,
height: 56.w,
fit: BoxFit.cover,
),
),
SizedBox(width: 12.w),
// 昵称和文案
Expanded(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisSize: MainAxisSize.min,
children: [
// 昵称
Text(
nickName,
style: TextStyle(
fontSize: 16.sp,
fontWeight: FontWeight.w600,
color: Colors.white,
),
maxLines: 1,
overflow: TextOverflow.ellipsis,
),
SizedBox(height: 4.h),
// 邀请文案
Text(
'邀请你${callType == 'video' ? '视频' : '语音'}通话',
style: TextStyle(
fontSize: 13.sp,
color: Colors.white.withOpacity(0.8),
),
),
],
),
),
],
),
),
SizedBox(width: 12.w),
// 右侧:接通和挂断按钮
Row(
children: [
// 挂断按钮
GestureDetector(
onTap: onReject,
behavior: HitTestBehavior.opaque,
child: Container(
width: 44.w,
height: 44.w,
decoration: BoxDecoration(
color: Colors.red,
shape: BoxShape.circle,
),
child: Icon(
Icons.call_end,
color: Colors.white,
size: 24.w,
),
),
),
SizedBox(width: 12.w),
// 接通按钮
GestureDetector(
onTap: onAccept,
behavior: HitTestBehavior.opaque,
child: Container(
width: 44.w,
height: 44.w,
decoration: BoxDecoration(
color: Colors.green,
shape: BoxShape.circle,
),
child: Icon(
Icons.call,
color: Colors.white,
size: 24.w,
),
),
),
],
),
],
),
),
);
}
}