From 5d1f664208ede4f3a01fccf45eb6bf587a6d82e1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=8E=8B=E5=AD=90=E8=B4=A4?= Date: Thu, 22 Jan 2026 18:19:02 +0800 Subject: [PATCH] =?UTF-8?q?=E6=8E=92=E7=89=88=E6=96=B0=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/pages/discover/live_room_page.dart | 4 +- lib/rtc/rtc_manager.dart | 15 +- .../live/live_room_anchor_showcase.dart | 191 +------------- .../live/live_room_invitation_list.dart | 235 ++++++++++++++++++ lib/widget/live/live_room_user_header.dart | 121 ++++----- .../live/live_room_user_profile_dialog.dart | 74 ++++-- 6 files changed, 370 insertions(+), 270 deletions(-) create mode 100644 lib/widget/live/live_room_invitation_list.dart diff --git a/lib/pages/discover/live_room_page.dart b/lib/pages/discover/live_room_page.dart index 1707778..4386789 100644 --- a/lib/pages/discover/live_room_page.dart +++ b/lib/pages/discover/live_room_page.dart @@ -346,8 +346,8 @@ class _LiveRoomPageState extends State { }), SizedBox(height: 7.w), LiveRoomAnchorShowcase(), - SizedBox(height: 5.w), - const LiveRoomActiveSpeaker(), + // SizedBox(height: 5.w), + // const LiveRoomActiveSpeaker(), SizedBox(height: 9.w), Expanded(child: const LiveRoomNoticeChatPanel()), // 根据键盘状态显示/隐藏 LiveRoomActionBar diff --git a/lib/rtc/rtc_manager.dart b/lib/rtc/rtc_manager.dart index d65474e..b837c9d 100644 --- a/lib/rtc/rtc_manager.dart +++ b/lib/rtc/rtc_manager.dart @@ -479,6 +479,19 @@ class RTCManager { ), ); print('正在加入频道:$channelId,UID:$uid,类型:$rtcType'); + + await _engine?.enableContentInspect( + enabled: true, + config: ContentInspectConfig( + modules: [ + ContentInspectModule( + type: ContentInspectType.contentInspectImageModeration, + interval: 10 + ) + ], + moduleCount: 1 + ) + ); } /// 离开频道 @@ -579,7 +592,7 @@ class RTCManager { } } - void _handleRemoteUserJoined(int remoteUid) { + void _handleRemoteUserJoined(int remoteUid) async { print('用户已加入频道:$remoteUid'); if (_remoteUserIds.contains(remoteUid)) return; _remoteUserIds.add(remoteUid); diff --git a/lib/widget/live/live_room_anchor_showcase.dart b/lib/widget/live/live_room_anchor_showcase.dart index 74dc601..01cbf5c 100644 --- a/lib/widget/live/live_room_anchor_showcase.dart +++ b/lib/widget/live/live_room_anchor_showcase.dart @@ -12,6 +12,8 @@ import 'package:flutter_smart_dialog/flutter_smart_dialog.dart'; import 'package:get/get.dart'; import 'package:tdesign_flutter/tdesign_flutter.dart'; +import 'live_room_invitation_list.dart'; + class LiveRoomAnchorShowcase extends StatefulWidget { const LiveRoomAnchorShowcase({super.key}); @@ -19,17 +21,10 @@ class LiveRoomAnchorShowcase extends StatefulWidget { State createState() => _LiveRoomAnchorShowcaseState(); } -class _LiveRoomAnchorShowcaseState extends State with TickerProviderStateMixin { +class _LiveRoomAnchorShowcaseState extends State { final RTCManager _rtcManager = RTCManager.instance; final RoomController _roomController = Get.find(); - TabController? _tabController; - - @override - void initState() { - super.initState(); - _tabController = TabController(length: 3, vsync: this); - } @override Widget build(BuildContext context) { @@ -396,185 +391,7 @@ class _LiveRoomAnchorShowcaseState extends State with Ti // return LiveRoomGuestListDialog( // initialTab: isMaleSeat ? 1 : 0, // 0: 女嘉宾, 1: 男嘉宾 // ); - return Material( - borderRadius: BorderRadius.vertical(top: Radius.circular(9.w)), - child: Container( - height: 500.w, - padding: EdgeInsets.symmetric(vertical: 10.w), - child: Column( - children: [ - Container( - height: 42.w, - decoration: BoxDecoration( - ), - child: TDTabBar( - backgroundColor: Colors.transparent, - tabs: [ - TDTab(text: '房间内'), - TDTab(text: '上麦过'), - TDTab(text: '好友'), - ], - controller: _tabController, - showIndicator: true, - onTap: (int i) async { - - }, - ), - ), - Expanded( - child: Container( - padding: EdgeInsets.all(10.w), - child: Column( - children: [ - Expanded( - child: SingleChildScrollView( - child: Column( - children: [ - Container( - margin: EdgeInsets.symmetric(vertical: 10.w), - child: Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - Row( - children: [ - Image.asset( - Assets.imagesUserAvatar, - width: 40.w, - height: 40.w, - ), - SizedBox(width: 5.w,), - Column( - children: [ - Text( - "开心", - style: TextStyle( - fontSize: 12.w - ), - ), - Text( - "22岁", - style: TextStyle( - fontSize: 12.w, - color: const Color.fromRGBO(121, 121, 121, 1) - ), - ), - ], - ) - ], - ), - - Checkbox( - value: false, - onChanged: (value) { - - }, - activeColor: const Color.fromRGBO(117, 98, 249, 1), - side: const BorderSide(color: Colors.grey), - shape: const CircleBorder(), - materialTapTargetSize: MaterialTapTargetSize.shrinkWrap, - ), - ], - ), - ), - Container( - margin: EdgeInsets.symmetric(vertical: 10.w), - child: Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - Row( - children: [ - Image.asset( - Assets.imagesUserAvatar, - width: 40.w, - height: 40.w, - ), - SizedBox(width: 5.w,), - Column( - children: [ - Text( - "开心", - style: TextStyle( - fontSize: 12.w - ), - ), - Text( - "22岁", - style: TextStyle( - fontSize: 12.w, - color: const Color.fromRGBO(121, 121, 121, 1) - ), - ), - ], - ) - ], - ), - - Checkbox( - value: false, - onChanged: (value) { - - }, - activeColor: const Color.fromRGBO(117, 98, 249, 1), - side: const BorderSide(color: Colors.grey), - shape: const CircleBorder(), - materialTapTargetSize: MaterialTapTargetSize.shrinkWrap, - ), - ], - ), - ), - ], - ), - ), - ) - ], - ), - ), - ), - - Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - Container( - width: 170.w, - height: 42.w, - decoration: BoxDecoration( - borderRadius: BorderRadius.all(Radius.circular(42.w)), - color: const Color.fromRGBO(237, 237, 237, 1) - ), - child: Center( - child: Text( - "取消", - style: TextStyle( - fontSize: 14.w, - fontWeight: FontWeight.w500 - ), - ), - ), - ), - Container( - width: 170.w, - height: 42.w, - decoration: BoxDecoration( - borderRadius: BorderRadius.all(Radius.circular(42.w)), - color: const Color.fromRGBO(117, 98, 249, 1) - ), - child: Center( - child: Text( - "确认", - style: TextStyle( - fontSize: 14.w, - color: Colors.white, - fontWeight: FontWeight.w500 - ), - ), - ), - ) - ], - ) - ], - ), - ), - ); + return LiveRoomInvitationList(); }, ); } diff --git a/lib/widget/live/live_room_invitation_list.dart b/lib/widget/live/live_room_invitation_list.dart new file mode 100644 index 0000000..1d95a09 --- /dev/null +++ b/lib/widget/live/live_room_invitation_list.dart @@ -0,0 +1,235 @@ +import 'package:dating_touchme_app/controller/discover/room_controller.dart'; +import 'package:dating_touchme_app/extension/ex_widget.dart'; +import 'package:dating_touchme_app/generated/assets.dart'; +import 'package:flutter/material.dart'; +import 'package:flutter_screenutil/flutter_screenutil.dart'; +import 'package:flutter_smart_dialog/flutter_smart_dialog.dart'; +import 'package:get/get.dart'; +import 'package:tdesign_flutter/tdesign_flutter.dart'; + +class LiveRoomInvitationList extends StatefulWidget { + const LiveRoomInvitationList({super.key}); + + @override + State createState() => _LiveRoomInvitationListState(); +} + +class _LiveRoomInvitationListState extends State with TickerProviderStateMixin { + + + TabController? _tabController; + + + final RoomController _roomController = Get.find(); + + @override + void initState() { + super.initState(); + _tabController = TabController(length: 3, vsync: this); + } + + @override + Widget build(BuildContext context) { + return Material( + borderRadius: BorderRadius.vertical(top: Radius.circular(9.w)), + child: Container( + height: 500.w, + padding: EdgeInsets.symmetric(vertical: 10.w), + child: Column( + children: [ + Container( + height: 42.w, + decoration: BoxDecoration( + ), + child: TDTabBar( + backgroundColor: Colors.transparent, + tabs: [ + TDTab(text: '房间内'), + TDTab(text: '上麦过'), + TDTab(text: '好友'), + ], + controller: _tabController, + showIndicator: true, + onTap: (int i) async { + + }, + ), + ), + Expanded( + child: Container( + padding: EdgeInsets.all(10.w), + child: Column( + children: [ + Expanded( + child: SingleChildScrollView( + child: Column( + children: [ + Container( + margin: EdgeInsets.symmetric(vertical: 10.w), + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Row( + children: [ + Image.asset( + Assets.imagesUserAvatar, + width: 40.w, + height: 40.w, + ), + SizedBox(width: 5.w,), + Column( + children: [ + Text( + "开心", + style: TextStyle( + fontSize: 12.w + ), + ), + Text( + "22岁", + style: TextStyle( + fontSize: 12.w, + color: const Color.fromRGBO(121, 121, 121, 1) + ), + ), + ], + ) + ], + ), + + Checkbox( + value: false, + onChanged: (value) { + + }, + activeColor: const Color.fromRGBO(117, 98, 249, 1), + side: const BorderSide(color: Colors.grey), + shape: const CircleBorder(), + materialTapTargetSize: MaterialTapTargetSize.shrinkWrap, + ), + ], + ), + ), + Container( + margin: EdgeInsets.symmetric(vertical: 10.w), + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Row( + children: [ + Image.asset( + Assets.imagesUserAvatar, + width: 40.w, + height: 40.w, + ), + SizedBox(width: 5.w,), + Column( + children: [ + Text( + "开心", + style: TextStyle( + fontSize: 12.w + ), + ), + Text( + "22岁", + style: TextStyle( + fontSize: 12.w, + color: const Color.fromRGBO(121, 121, 121, 1) + ), + ), + ], + ) + ], + ), + + Checkbox( + value: false, + onChanged: (value) { + + }, + activeColor: const Color.fromRGBO(117, 98, 249, 1), + side: const BorderSide(color: Colors.grey), + shape: const CircleBorder(), + materialTapTargetSize: MaterialTapTargetSize.shrinkWrap, + ), + ], + ), + ), + ], + ), + ), + ) + ], + ), + ), + ), + + Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Container( + width: 170.w, + height: 42.w, + decoration: BoxDecoration( + borderRadius: BorderRadius.all(Radius.circular(42.w)), + color: const Color.fromRGBO(237, 237, 237, 1) + ), + child: Center( + child: Text( + "取消", + style: TextStyle( + fontSize: 14.w, + fontWeight: FontWeight.w500 + ), + ), + ), + ), + Container( + width: 170.w, + height: 42.w, + decoration: BoxDecoration( + borderRadius: BorderRadius.all(Radius.circular(42.w)), + color: const Color.fromRGBO(117, 98, 249, 1) + ), + child: Center( + child: Text( + "确认", + style: TextStyle( + fontSize: 14.w, + color: Colors.white, + fontWeight: FontWeight.w500 + ), + ), + ), + ).onTap(() { + _roomController.setDialogDismiss(true); + SmartDialog.show( + alignment: Alignment.center, + maskColor: Colors.black.withOpacity(0.5), + onDismiss: () { + _roomController.setDialogDismiss(false); + }, + builder: (context) { + // return LiveRoomGuestListDialog( + // initialTab: isMaleSeat ? 1 : 0, // 0: 女嘉宾, 1: 男嘉宾 + // ); + return Material( + child: Container( + width: 200.w, + height: 200.w, + color: Colors.white, + ), + ); + }, + ); + }) + ], + ) + ], + ), + ), + ); + } +} + diff --git a/lib/widget/live/live_room_user_header.dart b/lib/widget/live/live_room_user_header.dart index 199614a..915d8e1 100644 --- a/lib/widget/live/live_room_user_header.dart +++ b/lib/widget/live/live_room_user_header.dart @@ -100,51 +100,18 @@ class LiveRoomUserHeader extends StatelessWidget { null; return Container( - width: 100.w, + width: 110.w, margin: EdgeInsets.only(left: 160.w), + padding: EdgeInsets.symmetric(horizontal: 10.w), decoration: BoxDecoration( color: Colors.black.withAlpha(80), borderRadius: BorderRadius.all(Radius.circular(10.w)), ), child: Column( + crossAxisAlignment: CrossAxisAlignment.start, children: [ SizedBox(height: 15.w), // 只有当有嘉宾在连麦时才显示"解除连麦"选项 - if (hasGuests) - GestureDetector( - onTap: () { - // 关闭设置弹窗 - SmartDialog.dismiss(); - // 弹出解除连麦对话框 - roomController.setDialogDismiss(true); - SmartDialog.show( - onDismiss: (){ - roomController.setDialogDismiss(false); - }, - builder: (context) { - return DisconnectMicDialog(); - }, - ); - }, - child: Row( - mainAxisAlignment: MainAxisAlignment.center, - children: [ - Image.asset( - Assets.imagesMicOff, - width: 15.w, - ), - SizedBox(width: 5.w), - Text( - '解除连麦', - style: TextStyle( - color: Colors.white, - fontSize: 13.sp, - ), - ), - ], - ), - ), - if (hasGuests) SizedBox(height: 15.w), GestureDetector( onTap: () async { // 隐藏键盘 @@ -174,8 +141,8 @@ class LiveRoomUserHeader extends StatelessWidget { Text( "在麦用户", style: TextStyle( - fontSize: 16.w, - fontWeight: FontWeight.w700 + fontSize: 16.w, + fontWeight: FontWeight.w700 ), ), Expanded( @@ -200,14 +167,14 @@ class LiveRoomUserHeader extends StatelessWidget { Text( "开心", style: TextStyle( - fontSize: 12.w + fontSize: 12.w ), ), Text( "22岁", style: TextStyle( fontSize: 12.w, - color: const Color.fromRGBO(121, 121, 121, 1) + color: const Color.fromRGBO(121, 121, 121, 1) ), ), ], @@ -246,14 +213,14 @@ class LiveRoomUserHeader extends StatelessWidget { Text( "开心", style: TextStyle( - fontSize: 12.w + fontSize: 12.w ), ), Text( "22岁", style: TextStyle( fontSize: 12.w, - color: const Color.fromRGBO(121, 121, 121, 1) + color: const Color.fromRGBO(121, 121, 121, 1) ), ), ], @@ -325,25 +292,61 @@ class LiveRoomUserHeader extends StatelessWidget { }, ); }, - child: Row( - mainAxisAlignment: MainAxisAlignment.center, - children: [ - Image.asset( - Assets.imagesExitRoom, - width: 15.w, - ), - SizedBox(width: 5.w), - Text( - '连麦管理', - style: TextStyle( - color: Colors.white, - fontSize: 13.sp, + child: Row( + mainAxisAlignment: MainAxisAlignment.start, + children: [ + Image.asset( + Assets.imagesMicOff, + width: 15.w, ), - ), - ], + SizedBox(width: 5.w), + Text( + '踢出直播间', + style: TextStyle( + color: Colors.white, + fontSize: 13.sp, + ), + ), + ], + ), ), - ), SizedBox(height: 15.w), + if (hasGuests) + GestureDetector( + onTap: () { + // 关闭设置弹窗 + SmartDialog.dismiss(); + // 弹出解除连麦对话框 + roomController.setDialogDismiss(true); + SmartDialog.show( + onDismiss: (){ + roomController.setDialogDismiss(false); + }, + builder: (context) { + return DisconnectMicDialog(); + }, + ); + }, + child: Row( + mainAxisAlignment: MainAxisAlignment.start, + children: [ + Image.asset( + Assets.imagesMicOff, + width: 15.w, + ), + SizedBox(width: 5.w), + Text( + '解除连麦', + style: TextStyle( + color: Colors.white, + fontSize: 13.sp, + ), + ), + ], + ), + ), + if (hasGuests) SizedBox(height: 15.w), + GestureDetector( onTap: () async { await roomController.leaveChannel(); @@ -362,7 +365,7 @@ class LiveRoomUserHeader extends StatelessWidget { }); }, child: Row( - mainAxisAlignment: MainAxisAlignment.center, + mainAxisAlignment: MainAxisAlignment.start, children: [ Image.asset( Assets.imagesExitRoom, diff --git a/lib/widget/live/live_room_user_profile_dialog.dart b/lib/widget/live/live_room_user_profile_dialog.dart index ff8afb3..068a7ef 100644 --- a/lib/widget/live/live_room_user_profile_dialog.dart +++ b/lib/widget/live/live_room_user_profile_dialog.dart @@ -32,17 +32,67 @@ void showUserProfileDialog( topRight: Radius.circular(20.w), ), ), - height: 200.w, + height: 230.w, margin: EdgeInsets.only(top: 40.w), padding: EdgeInsets.symmetric(horizontal: 15.w), child: Column( mainAxisSize: MainAxisSize.min, children: [ - SizedBox(height: 10.w), + SizedBox(height: 10.w,), + Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + SizedBox(width: 110.w,), + if(isHost) Container( + width: 90.w, + height: 30.w, + margin: EdgeInsets.only(right: 10.w), + decoration: BoxDecoration( + borderRadius: BorderRadius.all(Radius.circular(9.w)), + color: Colors.red, + ), + child: Center( + child: Text( + "邀请上麦", + style: TextStyle( + color: Colors.white + ), + ), + ), + ), + + if(isHost) Container( + width: 90.w, + height: 30.w, + margin: EdgeInsets.only(right: 10.w), + decoration: BoxDecoration( + borderRadius: BorderRadius.all(Radius.circular(9.w)), + color: Colors.red, + ), + child: Center( + child: Text( + "踢出房间", + style: TextStyle( + color: Colors.white + ), + ), + ), + ), + GestureDetector( + onTap: () => SmartDialog.dismiss(), + child: Icon( + Icons.close, + size: 24.w, + color: const Color.fromRGBO(153, 153, 153, 1), + ), + ), + ], + ), + SizedBox(height: 10.w,), // 用户头像和信息 Row( children: [ - SizedBox(width: 110.w), + SizedBox(width: 30.w), // 用户名和标签 Expanded( child: Column( @@ -71,14 +121,6 @@ void showUserProfileDialog( ], ), ), - GestureDetector( - onTap: () => SmartDialog.dismiss(), - child: Icon( - Icons.close, - size: 24.w, - color: const Color.fromRGBO(153, 153, 153, 1), - ), - ), ], ), SizedBox(height: 25.w), @@ -135,16 +177,6 @@ void showUserProfileDialog( SmartDialog.dismiss(); onShowGiftPopup(); }), - if(isHost) Container( - width: 1.w, - height: 12.w, - color: const Color.fromRGBO(229, 229, 229, 1), - margin: EdgeInsets.symmetric(horizontal: 15.w), - ), - if(isHost) _buildActionLink('邀请上麦', () { - SmartDialog.dismiss(); - onShowGiftPopup(); - }), ], ), ],