|
|
|
@ -2,6 +2,7 @@ import 'package:dating_touchme_app/controller/discover/room_controller.dart'; |
|
|
|
import 'package:dating_touchme_app/controller/overlay_controller.dart'; |
|
|
|
import 'package:dating_touchme_app/extension/ex_widget.dart'; |
|
|
|
import 'package:dating_touchme_app/generated/assets.dart'; |
|
|
|
import 'package:dating_touchme_app/model/home/user_info_data.dart'; |
|
|
|
import 'package:dating_touchme_app/model/live/live_chat_message.dart'; |
|
|
|
import 'package:dating_touchme_app/pages/message/chat_page.dart'; |
|
|
|
import 'package:flutter/material.dart'; |
|
|
|
@ -14,6 +15,7 @@ void showUserProfileDialog( |
|
|
|
BuildContext context, |
|
|
|
LiveChatMessage message, |
|
|
|
VoidCallback onShowGiftPopup, |
|
|
|
UserInfoData userData, |
|
|
|
) { |
|
|
|
|
|
|
|
|
|
|
|
@ -33,7 +35,7 @@ void showUserProfileDialog( |
|
|
|
topRight: Radius.circular(20.w), |
|
|
|
), |
|
|
|
), |
|
|
|
height: 230.w, |
|
|
|
height: 210.w, |
|
|
|
margin: EdgeInsets.only(top: 40.w), |
|
|
|
padding: EdgeInsets.symmetric(horizontal: 15.w), |
|
|
|
child: Column( |
|
|
|
@ -41,16 +43,190 @@ void showUserProfileDialog( |
|
|
|
children: [ |
|
|
|
SizedBox(height: 10.w,), |
|
|
|
Row( |
|
|
|
mainAxisAlignment: MainAxisAlignment.end, |
|
|
|
children: [ |
|
|
|
GestureDetector( |
|
|
|
onTap: () => SmartDialog.dismiss(), |
|
|
|
child: Icon( |
|
|
|
Icons.close, |
|
|
|
size: 24.w, |
|
|
|
color: const Color.fromRGBO(153, 153, 153, 1), |
|
|
|
), |
|
|
|
), |
|
|
|
], |
|
|
|
), |
|
|
|
SizedBox(height: 15.w,), |
|
|
|
Row( |
|
|
|
mainAxisAlignment: MainAxisAlignment.center, |
|
|
|
children: [ |
|
|
|
Text( |
|
|
|
message.userName, |
|
|
|
style: TextStyle( |
|
|
|
fontSize: 18.w, |
|
|
|
fontWeight: FontWeight.w600, |
|
|
|
color: const Color.fromRGBO(51, 51, 51, 1), |
|
|
|
), |
|
|
|
) |
|
|
|
], |
|
|
|
), |
|
|
|
Row( |
|
|
|
children: [ |
|
|
|
SizedBox(width: 30.w), |
|
|
|
// 用户名和标签 |
|
|
|
Expanded( |
|
|
|
child: Column( |
|
|
|
crossAxisAlignment: CrossAxisAlignment.start, |
|
|
|
children: [ |
|
|
|
SizedBox(height: 8.w), |
|
|
|
// 标签 |
|
|
|
Center( |
|
|
|
child: Wrap( |
|
|
|
spacing: 6.w, |
|
|
|
runSpacing: 6.w, |
|
|
|
runAlignment: WrapAlignment.center, |
|
|
|
children: [ |
|
|
|
|
|
|
|
if(userData.genderCode == 0) Container( |
|
|
|
width: 33.w, |
|
|
|
height: 13.w, |
|
|
|
decoration: BoxDecoration( |
|
|
|
borderRadius: BorderRadius.all(Radius.circular(13.w)), |
|
|
|
color: const Color.fromRGBO(237, 245, 255, 1) |
|
|
|
), |
|
|
|
child: Row( |
|
|
|
mainAxisAlignment: MainAxisAlignment.center, |
|
|
|
children: [ |
|
|
|
Image.asset( |
|
|
|
Assets.imagesMale, |
|
|
|
width: 8.w, |
|
|
|
height: 8.w, |
|
|
|
), |
|
|
|
SizedBox(width: 2.w,), |
|
|
|
Text( |
|
|
|
"${ |
|
|
|
calculateAge( |
|
|
|
(userData.birthDate != null && userData.birthDate!.isNotEmpty) ? |
|
|
|
(userData.birthDate ?? "") : userData.birthYear != null && userData.birthYear!.isNotEmpty ? |
|
|
|
"${userData.birthYear}-01-01" : "") |
|
|
|
}", |
|
|
|
style: TextStyle( |
|
|
|
fontSize: 11.w, |
|
|
|
color: const Color.fromRGBO(120, 140, 255, 1) |
|
|
|
), |
|
|
|
) |
|
|
|
], |
|
|
|
), |
|
|
|
), |
|
|
|
if(userData.genderCode == 1) Container( |
|
|
|
width: 33.w, |
|
|
|
height: 13.w, |
|
|
|
decoration: BoxDecoration( |
|
|
|
borderRadius: BorderRadius.all(Radius.circular(13.w)), |
|
|
|
color: const Color.fromRGBO(255, 237, 255, 1) |
|
|
|
), |
|
|
|
child: Row( |
|
|
|
mainAxisAlignment: MainAxisAlignment.center, |
|
|
|
children: [ |
|
|
|
Image.asset( |
|
|
|
Assets.imagesFemale, |
|
|
|
width: 8.w, |
|
|
|
height: 8.w, |
|
|
|
), |
|
|
|
SizedBox(width: 2.w,), |
|
|
|
Text( |
|
|
|
"${ |
|
|
|
calculateAge( |
|
|
|
(userData.birthDate != null && userData.birthDate!.isNotEmpty) ? |
|
|
|
(userData.birthDate ?? "") : userData.birthYear != null && userData.birthYear!.isNotEmpty ? |
|
|
|
"${userData.birthYear}-01-01" : "") |
|
|
|
}", |
|
|
|
style: TextStyle( |
|
|
|
fontSize: 11.w, |
|
|
|
color: const Color.fromRGBO(255, 66, 236, 1) |
|
|
|
), |
|
|
|
) |
|
|
|
], |
|
|
|
), |
|
|
|
), |
|
|
|
if(userData.height != null && userData.height != 0) Container( |
|
|
|
width: 33.w, |
|
|
|
height: 13.w, |
|
|
|
decoration: BoxDecoration( |
|
|
|
borderRadius: BorderRadius.all(Radius.circular(13.w)), |
|
|
|
color: const Color.fromRGBO(245, 247, 255, 1) |
|
|
|
), |
|
|
|
child: Center( |
|
|
|
child: Text( |
|
|
|
"${userData.height}", |
|
|
|
style: TextStyle( |
|
|
|
fontSize: 11.w, |
|
|
|
), |
|
|
|
), |
|
|
|
), |
|
|
|
), |
|
|
|
if(userData.provinceName != null && userData.provinceName != "") Container( |
|
|
|
width: 33.w, |
|
|
|
height: 13.w, |
|
|
|
decoration: BoxDecoration( |
|
|
|
borderRadius: BorderRadius.all(Radius.circular(13.w)), |
|
|
|
color: const Color.fromRGBO(245, 247, 255, 1) |
|
|
|
), |
|
|
|
child: Center( |
|
|
|
child: Text( |
|
|
|
"${userData.provinceName}", |
|
|
|
style: TextStyle( |
|
|
|
fontSize: 11.w, |
|
|
|
), |
|
|
|
), |
|
|
|
), |
|
|
|
), |
|
|
|
if(userData.occupation != null && userData.occupation != "") Container( |
|
|
|
width: 33.w, |
|
|
|
height: 13.w, |
|
|
|
decoration: BoxDecoration( |
|
|
|
borderRadius: BorderRadius.all(Radius.circular(13.w)), |
|
|
|
color: const Color.fromRGBO(245, 247, 255, 1) |
|
|
|
), |
|
|
|
child: Center( |
|
|
|
child: Text( |
|
|
|
"${userData.occupation}", |
|
|
|
style: TextStyle( |
|
|
|
fontSize: 11.w, |
|
|
|
), |
|
|
|
), |
|
|
|
), |
|
|
|
), |
|
|
|
], |
|
|
|
), |
|
|
|
), |
|
|
|
], |
|
|
|
), |
|
|
|
), |
|
|
|
], |
|
|
|
), |
|
|
|
SizedBox(height: 10.w,), |
|
|
|
if(isHost) Row( |
|
|
|
mainAxisAlignment: MainAxisAlignment.spaceBetween, |
|
|
|
children: [ |
|
|
|
SizedBox(width: 110.w,), |
|
|
|
if(isHost) Container( |
|
|
|
width: 100.w, |
|
|
|
height: 30.w, |
|
|
|
margin: EdgeInsets.only(right: 10.w), |
|
|
|
if( |
|
|
|
(userData.genderCode == 0 && |
|
|
|
roomController.rtcChannelDetail.value?.maleInfo?.userId != userData.miUserId) || |
|
|
|
(userData.genderCode == 1 && |
|
|
|
roomController.rtcChannelDetail.value?.femaleInfo?.userId != userData.miUserId) |
|
|
|
) Container( |
|
|
|
width: 165.w, |
|
|
|
height: 35.w, |
|
|
|
decoration: BoxDecoration( |
|
|
|
borderRadius: BorderRadius.all(Radius.circular(9.w)), |
|
|
|
borderRadius: BorderRadius.all(Radius.circular(8.w)), |
|
|
|
color: const Color.fromRGBO(253, 43, 84, 1), |
|
|
|
gradient: const LinearGradient( |
|
|
|
colors: [ |
|
|
|
Color.fromRGBO(117, 98, 249, 1), |
|
|
|
Color.fromRGBO(152, 124, 255, 1), |
|
|
|
], |
|
|
|
begin: Alignment.centerLeft, |
|
|
|
end: Alignment.centerRight, |
|
|
|
), |
|
|
|
), |
|
|
|
child: Center( |
|
|
|
child: Text( |
|
|
|
@ -70,19 +246,53 @@ void showUserProfileDialog( |
|
|
|
roomController.setDialogDismiss(false); |
|
|
|
}), |
|
|
|
|
|
|
|
if(isHost) Container( |
|
|
|
width: 81.w, |
|
|
|
height: 30.w, |
|
|
|
margin: EdgeInsets.only(right: 10.w), |
|
|
|
if( |
|
|
|
(userData.genderCode == 0 && |
|
|
|
roomController.rtcChannelDetail.value?.maleInfo?.userId == userData.miUserId) || |
|
|
|
(userData.genderCode == 1 && |
|
|
|
roomController.rtcChannelDetail.value?.femaleInfo?.userId == userData.miUserId) |
|
|
|
) Container( |
|
|
|
width: 165.w, |
|
|
|
height: 35.w, |
|
|
|
decoration: BoxDecoration( |
|
|
|
borderRadius: BorderRadius.all(Radius.circular(9.w)), |
|
|
|
color: const Color.fromRGBO(245, 245, 245, 1), |
|
|
|
borderRadius: BorderRadius.all(Radius.circular(8.w)), |
|
|
|
color: const Color.fromRGBO(253, 43, 84, 1), |
|
|
|
gradient: const LinearGradient( |
|
|
|
colors: [ |
|
|
|
Color.fromRGBO(117, 98, 249, 1), |
|
|
|
Color.fromRGBO(152, 124, 255, 1), |
|
|
|
], |
|
|
|
begin: Alignment.centerLeft, |
|
|
|
end: Alignment.centerRight, |
|
|
|
), |
|
|
|
), |
|
|
|
child: Center( |
|
|
|
child: Text( |
|
|
|
"踢出房间", |
|
|
|
"抱下麦", |
|
|
|
style: TextStyle( |
|
|
|
color: const Color.fromRGBO(144, 144, 144, 1) |
|
|
|
color: Colors.white |
|
|
|
), |
|
|
|
), |
|
|
|
), |
|
|
|
).onTap(() async { |
|
|
|
await roomController.endMic( |
|
|
|
channelId: roomController.rtcChannelDetail.value!.channelId, |
|
|
|
kickingUId: message.uid ?? 0); |
|
|
|
SmartDialog.dismiss(); |
|
|
|
}), |
|
|
|
|
|
|
|
if(userData.isFriend ?? false) Container( |
|
|
|
width: 165.w, |
|
|
|
height: 35.w, |
|
|
|
decoration: BoxDecoration( |
|
|
|
borderRadius: BorderRadius.all(Radius.circular(8 .w)), |
|
|
|
color: const Color.fromRGBO(51, 51, 51, 1), |
|
|
|
), |
|
|
|
child: Center( |
|
|
|
child: Text( |
|
|
|
"提出房间", |
|
|
|
style: TextStyle( |
|
|
|
color: Colors.white |
|
|
|
), |
|
|
|
), |
|
|
|
), |
|
|
|
@ -98,83 +308,26 @@ void showUserProfileDialog( |
|
|
|
SmartDialog.dismiss(); |
|
|
|
roomController.setDialogDismiss(false); |
|
|
|
}), |
|
|
|
GestureDetector( |
|
|
|
onTap: () => SmartDialog.dismiss(), |
|
|
|
child: Icon( |
|
|
|
Icons.close, |
|
|
|
size: 24.w, |
|
|
|
color: const Color.fromRGBO(153, 153, 153, 1), |
|
|
|
if(!(userData.isFriend ?? false)) Container( |
|
|
|
width: 165.w, |
|
|
|
height: 35.w, |
|
|
|
decoration: BoxDecoration( |
|
|
|
borderRadius: BorderRadius.all(Radius.circular(8 .w)), |
|
|
|
color: const Color.fromRGBO(245, 154, 35, 1), |
|
|
|
), |
|
|
|
), |
|
|
|
], |
|
|
|
), |
|
|
|
SizedBox(height: 10.w,), |
|
|
|
// 用户头像和信息 |
|
|
|
Row( |
|
|
|
children: [ |
|
|
|
SizedBox(width: 30.w), |
|
|
|
// 用户名和标签 |
|
|
|
Expanded( |
|
|
|
child: Column( |
|
|
|
crossAxisAlignment: CrossAxisAlignment.start, |
|
|
|
children: [ |
|
|
|
Text( |
|
|
|
message.userName, |
|
|
|
style: TextStyle( |
|
|
|
fontSize: 18.w, |
|
|
|
fontWeight: FontWeight.w600, |
|
|
|
color: const Color.fromRGBO(51, 51, 51, 1), |
|
|
|
), |
|
|
|
), |
|
|
|
SizedBox(height: 8.w), |
|
|
|
// 标签 |
|
|
|
Wrap( |
|
|
|
spacing: 6.w, |
|
|
|
runSpacing: 6.w, |
|
|
|
children: [ |
|
|
|
_buildTag( |
|
|
|
'在线', |
|
|
|
const Color.fromRGBO(198, 246, 213, 1), |
|
|
|
), |
|
|
|
], |
|
|
|
child: Center( |
|
|
|
child: Text( |
|
|
|
"加好友", |
|
|
|
style: TextStyle( |
|
|
|
color: Colors.white |
|
|
|
), |
|
|
|
], |
|
|
|
), |
|
|
|
), |
|
|
|
], |
|
|
|
), |
|
|
|
SizedBox(height: 25.w), |
|
|
|
// 送礼物按钮 |
|
|
|
GestureDetector( |
|
|
|
onTap: () { |
|
|
|
SmartDialog.dismiss(); |
|
|
|
onShowGiftPopup(); |
|
|
|
}, |
|
|
|
child: Container( |
|
|
|
width: double.infinity, |
|
|
|
height: 44.w, |
|
|
|
decoration: BoxDecoration( |
|
|
|
gradient: const LinearGradient( |
|
|
|
colors: [ |
|
|
|
Color.fromRGBO(117, 98, 249, 1), |
|
|
|
Color.fromRGBO(152, 124, 255, 1), |
|
|
|
], |
|
|
|
begin: Alignment.centerLeft, |
|
|
|
end: Alignment.centerRight, |
|
|
|
), |
|
|
|
borderRadius: BorderRadius.circular(22.w), |
|
|
|
), |
|
|
|
child: Center( |
|
|
|
child: Text( |
|
|
|
'送礼物', |
|
|
|
style: TextStyle( |
|
|
|
fontSize: 16.w, |
|
|
|
color: Colors.white, |
|
|
|
fontWeight: FontWeight.w500, |
|
|
|
), |
|
|
|
), |
|
|
|
), |
|
|
|
), |
|
|
|
).onTap(() async { |
|
|
|
SmartDialog.dismiss(); |
|
|
|
onShowGiftPopup(); |
|
|
|
}), |
|
|
|
], |
|
|
|
), |
|
|
|
SizedBox(height: 15.w), |
|
|
|
// 底部操作链接 |
|
|
|
@ -189,11 +342,29 @@ void showUserProfileDialog( |
|
|
|
}), |
|
|
|
Container( |
|
|
|
width: 1.w, |
|
|
|
height: 12.w, |
|
|
|
color: const Color.fromRGBO(229, 229, 229, 1), |
|
|
|
height: 15.w, |
|
|
|
color: const Color.fromRGBO(212, 212, 212, 1), |
|
|
|
margin: EdgeInsets.symmetric(horizontal: 15.w), |
|
|
|
), |
|
|
|
if(!(userData.isFriend ?? false)) _buildActionLink('踢出房间', () async { |
|
|
|
// 解除连麦 |
|
|
|
await roomController.kickingRtcChannelUser( |
|
|
|
channelId: roomController.rtcChannelDetail.value!.channelId, |
|
|
|
kickingUId: message.uid ?? 0); |
|
|
|
|
|
|
|
// 隐藏键盘 |
|
|
|
FocusScope.of(context).unfocus(); |
|
|
|
// 隐藏 overlay |
|
|
|
SmartDialog.dismiss(); |
|
|
|
roomController.setDialogDismiss(false); |
|
|
|
}), |
|
|
|
if(!(userData.isFriend ?? false)) Container( |
|
|
|
width: 1.w, |
|
|
|
height: 15.w, |
|
|
|
color: const Color.fromRGBO(212, 212, 212, 1), |
|
|
|
margin: EdgeInsets.symmetric(horizontal: 15.w), |
|
|
|
), |
|
|
|
_buildActionLink('送礼物加好友', () { |
|
|
|
_buildActionLink('送礼物', () { |
|
|
|
SmartDialog.dismiss(); |
|
|
|
onShowGiftPopup(); |
|
|
|
}), |
|
|
|
@ -203,7 +374,7 @@ void showUserProfileDialog( |
|
|
|
), |
|
|
|
), |
|
|
|
Container( |
|
|
|
margin: EdgeInsets.only(left: 30.w), |
|
|
|
margin: EdgeInsets.only(left: 147.5.w), |
|
|
|
child: ClipOval( |
|
|
|
child: message.avatar != null && message.avatar!.isNotEmpty |
|
|
|
? Image.network( |
|
|
|
@ -255,10 +426,26 @@ Widget _buildActionLink(String text, VoidCallback onTap) { |
|
|
|
child: Text( |
|
|
|
text, |
|
|
|
style: TextStyle( |
|
|
|
fontSize: 12.w, |
|
|
|
color: const Color.fromRGBO(153, 153, 153, 1), |
|
|
|
fontSize: 14.w, |
|
|
|
fontWeight: FontWeight.w500, |
|
|
|
color: const Color.fromRGBO(117, 98, 249, 1), |
|
|
|
), |
|
|
|
), |
|
|
|
); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
int calculateAge(String birthdayStr) { |
|
|
|
final birthday = DateTime.parse(birthdayStr); // 自动识别 1996-1-20 |
|
|
|
final today = DateTime.now(); |
|
|
|
|
|
|
|
int age = today.year - birthday.year; |
|
|
|
|
|
|
|
// 如果今年生日还没过,年龄要减 1 |
|
|
|
if (today.month < birthday.month || |
|
|
|
(today.month == birthday.month && today.day < birthday.day)) { |
|
|
|
age--; |
|
|
|
} |
|
|
|
|
|
|
|
return age; |
|
|
|
} |