|
|
@ -1,5 +1,7 @@ |
|
|
import 'dart:io'; |
|
|
import 'dart:io'; |
|
|
import 'dart:async'; |
|
|
import 'dart:async'; |
|
|
|
|
|
import 'package:cached_network_image/cached_network_image.dart'; |
|
|
|
|
|
import 'package:dating_touchme_app/extension/ex_widget.dart'; |
|
|
import 'package:dating_touchme_app/rtc/rtm_manager.dart'; |
|
|
import 'package:dating_touchme_app/rtc/rtm_manager.dart'; |
|
|
import 'package:flutter/widgets.dart'; |
|
|
import 'package:flutter/widgets.dart'; |
|
|
import 'package:flutter/material.dart'; |
|
|
import 'package:flutter/material.dart'; |
|
|
@ -11,13 +13,17 @@ import 'package:im_flutter_sdk/im_flutter_sdk.dart'; |
|
|
import 'package:video_thumbnail/video_thumbnail.dart'; |
|
|
import 'package:video_thumbnail/video_thumbnail.dart'; |
|
|
import 'package:path_provider/path_provider.dart'; |
|
|
import 'package:path_provider/path_provider.dart'; |
|
|
import 'package:flutter_smart_dialog/flutter_smart_dialog.dart'; |
|
|
import 'package:flutter_smart_dialog/flutter_smart_dialog.dart'; |
|
|
|
|
|
import '../controller/discover/room_controller.dart'; |
|
|
import '../controller/message/conversation_controller.dart'; |
|
|
import '../controller/message/conversation_controller.dart'; |
|
|
import '../controller/message/chat_controller.dart'; |
|
|
import '../controller/message/chat_controller.dart'; |
|
|
import '../controller/global.dart'; |
|
|
import '../controller/global.dart'; |
|
|
|
|
|
import '../controller/overlay_controller.dart'; |
|
|
import '../generated/assets.dart'; |
|
|
import '../generated/assets.dart'; |
|
|
|
|
|
import '../pages/discover/live_room_page.dart'; |
|
|
import '../pages/mine/login_page.dart'; |
|
|
import '../pages/mine/login_page.dart'; |
|
|
import '../pages/message/chat_page.dart'; |
|
|
import '../pages/message/chat_page.dart'; |
|
|
import '../network/user_api.dart'; |
|
|
import '../network/user_api.dart'; |
|
|
|
|
|
import '../rtc/rtc_manager.dart'; |
|
|
import '../widget/message/message_notification_dialog.dart'; |
|
|
import '../widget/message/message_notification_dialog.dart'; |
|
|
import '../widget/message/video_call_invite_dialog.dart'; |
|
|
import '../widget/message/video_call_invite_dialog.dart'; |
|
|
import '../pages/message/video_call_page.dart'; |
|
|
import '../pages/message/video_call_page.dart'; |
|
|
@ -234,7 +240,6 @@ class IMManager { |
|
|
if(message.body.type == MessageType.CUSTOM){ |
|
|
if(message.body.type == MessageType.CUSTOM){ |
|
|
final body = message.body as EMCustomMessageBody; |
|
|
final body = message.body as EMCustomMessageBody; |
|
|
if(body.event == "live_room_invite"){ |
|
|
if(body.event == "live_room_invite"){ |
|
|
print(23232323232); |
|
|
|
|
|
SmartDialog.show( |
|
|
SmartDialog.show( |
|
|
alignment: Alignment.center, |
|
|
alignment: Alignment.center, |
|
|
maskColor: Colors.black.withOpacity(0.5), |
|
|
maskColor: Colors.black.withOpacity(0.5), |
|
|
@ -270,10 +275,32 @@ class IMManager { |
|
|
Positioned( |
|
|
Positioned( |
|
|
left: 38.5.w, |
|
|
left: 38.5.w, |
|
|
top: 0, |
|
|
top: 0, |
|
|
child: Image.asset( |
|
|
|
|
|
Assets.imagesUserAvatar, |
|
|
|
|
|
width: 100.w, |
|
|
|
|
|
height: 100.w, |
|
|
|
|
|
|
|
|
child: ClipRRect( |
|
|
|
|
|
borderRadius: BorderRadius.all(Radius.circular(100.w)), |
|
|
|
|
|
child: CachedNetworkImage( |
|
|
|
|
|
imageUrl: "${ body.params?["coverImage"] ?? ""}?x-oss-process=image/format,webp/resize,w_240", |
|
|
|
|
|
|
|
|
|
|
|
width: 100.w, |
|
|
|
|
|
height: 100.w, |
|
|
|
|
|
fit: BoxFit.cover, |
|
|
|
|
|
placeholder: (context, url) => Container( |
|
|
|
|
|
color: Colors.white38, |
|
|
|
|
|
child: Center( |
|
|
|
|
|
child: CircularProgressIndicator( |
|
|
|
|
|
strokeWidth: 1.w, |
|
|
|
|
|
color: Colors.grey, |
|
|
|
|
|
), |
|
|
|
|
|
), |
|
|
|
|
|
), |
|
|
|
|
|
errorWidget: (context, url, error) => |
|
|
|
|
|
Image.asset( |
|
|
|
|
|
Assets.imagesUserAvatar, |
|
|
|
|
|
|
|
|
|
|
|
width: 100.w, |
|
|
|
|
|
height: 100.w, |
|
|
|
|
|
fit: BoxFit.cover, |
|
|
|
|
|
), |
|
|
|
|
|
), |
|
|
), |
|
|
), |
|
|
), |
|
|
), |
|
|
Positioned( |
|
|
Positioned( |
|
|
@ -288,7 +315,7 @@ class IMManager { |
|
|
), |
|
|
), |
|
|
SizedBox(height: 10.w,), |
|
|
SizedBox(height: 10.w,), |
|
|
Text( |
|
|
Text( |
|
|
"开心的橘子", |
|
|
|
|
|
|
|
|
body.params?["anchorName"] ?? "", |
|
|
style: TextStyle( |
|
|
style: TextStyle( |
|
|
fontSize: 18.w, |
|
|
fontSize: 18.w, |
|
|
), |
|
|
), |
|
|
@ -297,7 +324,7 @@ class IMManager { |
|
|
Row( |
|
|
Row( |
|
|
mainAxisAlignment: MainAxisAlignment.center, |
|
|
mainAxisAlignment: MainAxisAlignment.center, |
|
|
children: [ |
|
|
children: [ |
|
|
if(false) Container( |
|
|
|
|
|
|
|
|
if(body.params?["genderCode"] == "1") Container( |
|
|
width: 33.w, |
|
|
width: 33.w, |
|
|
height: 13.w, |
|
|
height: 13.w, |
|
|
margin: EdgeInsets.only(right: 6.w), |
|
|
margin: EdgeInsets.only(right: 6.w), |
|
|
@ -315,7 +342,7 @@ class IMManager { |
|
|
), |
|
|
), |
|
|
SizedBox(width: 2.w,), |
|
|
SizedBox(width: 2.w,), |
|
|
Text( |
|
|
Text( |
|
|
"19", |
|
|
|
|
|
|
|
|
body.params?["age"] ?? "", |
|
|
style: TextStyle( |
|
|
style: TextStyle( |
|
|
fontSize: 11.w, |
|
|
fontSize: 11.w, |
|
|
color: const Color.fromRGBO(255, 66, 236, 1) |
|
|
color: const Color.fromRGBO(255, 66, 236, 1) |
|
|
@ -324,7 +351,7 @@ class IMManager { |
|
|
], |
|
|
], |
|
|
), |
|
|
), |
|
|
), |
|
|
), |
|
|
Container( |
|
|
|
|
|
|
|
|
if(body.params?["genderCode"] == "0") Container( |
|
|
width: 33.w, |
|
|
width: 33.w, |
|
|
height: 13.w, |
|
|
height: 13.w, |
|
|
margin: EdgeInsets.only(right: 6.w), |
|
|
margin: EdgeInsets.only(right: 6.w), |
|
|
@ -342,7 +369,7 @@ class IMManager { |
|
|
), |
|
|
), |
|
|
SizedBox(width: 2.w,), |
|
|
SizedBox(width: 2.w,), |
|
|
Text( |
|
|
Text( |
|
|
"19", |
|
|
|
|
|
|
|
|
body.params?["age"] ?? "", |
|
|
style: TextStyle( |
|
|
style: TextStyle( |
|
|
fontSize: 11.w, |
|
|
fontSize: 11.w, |
|
|
color: const Color.fromRGBO(120, 140, 255, 1) |
|
|
color: const Color.fromRGBO(120, 140, 255, 1) |
|
|
@ -358,7 +385,7 @@ class IMManager { |
|
|
color: const Color.fromRGBO(245, 247, 255, 1) |
|
|
color: const Color.fromRGBO(245, 247, 255, 1) |
|
|
), |
|
|
), |
|
|
child: Text( |
|
|
child: Text( |
|
|
"北京", |
|
|
|
|
|
|
|
|
body.params?["provinceName"] ?? "", |
|
|
style: TextStyle( |
|
|
style: TextStyle( |
|
|
fontSize: 12.w, |
|
|
fontSize: 12.w, |
|
|
fontWeight: FontWeight.w400 |
|
|
fontWeight: FontWeight.w400 |
|
|
@ -408,7 +435,12 @@ class IMManager { |
|
|
) |
|
|
) |
|
|
], |
|
|
], |
|
|
), |
|
|
), |
|
|
), |
|
|
|
|
|
|
|
|
).onTap(() { |
|
|
|
|
|
// 隐藏键盘 |
|
|
|
|
|
FocusScope.of(context).unfocus(); |
|
|
|
|
|
// 隐藏 overlay |
|
|
|
|
|
SmartDialog.dismiss(); |
|
|
|
|
|
}), |
|
|
Container( |
|
|
Container( |
|
|
width: 128.w, |
|
|
width: 128.w, |
|
|
height: 40.w, |
|
|
height: 40.w, |
|
|
@ -434,7 +466,44 @@ class IMManager { |
|
|
) |
|
|
) |
|
|
], |
|
|
], |
|
|
), |
|
|
), |
|
|
), |
|
|
|
|
|
|
|
|
).onTap(() async { |
|
|
|
|
|
|
|
|
|
|
|
// 隐藏键盘 |
|
|
|
|
|
FocusScope.of(context).unfocus(); |
|
|
|
|
|
// 隐藏 overlay |
|
|
|
|
|
SmartDialog.dismiss(); |
|
|
|
|
|
// 获取当前直播间ID |
|
|
|
|
|
final currentChannelId = RTCManager.instance.currentChannelId; |
|
|
|
|
|
// 隐藏小窗口 |
|
|
|
|
|
if (Get.isRegistered<OverlayController>()) { |
|
|
|
|
|
final overlayController = Get.find<OverlayController>(); |
|
|
|
|
|
overlayController.hide(); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// 获取 RoomController |
|
|
|
|
|
final roomController = Get.isRegistered<RoomController>() |
|
|
|
|
|
? Get.find<RoomController>() |
|
|
|
|
|
: Get.put(RoomController()); |
|
|
|
|
|
|
|
|
|
|
|
// 如果频道ID一致,取消小窗口并进入直播间 |
|
|
|
|
|
if (currentChannelId != null && currentChannelId == body.params?["channelId"]) { |
|
|
|
|
|
// 如果当前不在 LiveRoomPage,则导航到 LiveRoomPage |
|
|
|
|
|
final currentRoute = Get.currentRoute; |
|
|
|
|
|
if (currentRoute != '/LiveRoomPage' && !currentRoute.contains('LiveRoomPage')) { |
|
|
|
|
|
Get.to(() => const LiveRoomPage(id: 0)); |
|
|
|
|
|
} |
|
|
|
|
|
return; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// 如果不一致,退出当前直播间并进入新的直播间 |
|
|
|
|
|
if (currentChannelId != null && currentChannelId.isNotEmpty) { |
|
|
|
|
|
// 退出当前直播间 |
|
|
|
|
|
await roomController.leaveChannel(); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// 加入新的直播间 |
|
|
|
|
|
await roomController.joinChannel(body.params?["channelId"] ?? ""); |
|
|
|
|
|
}), |
|
|
], |
|
|
], |
|
|
) |
|
|
) |
|
|
], |
|
|
], |
|
|
|