From 9b7b3304baea8ceef049bc423c700c3ee36c298a Mon Sep 17 00:00:00 2001 From: Jolie <412895109@qq.com> Date: Wed, 3 Dec 2025 23:10:33 +0800 Subject: [PATCH] =?UTF-8?q?feat(live):=20=E6=A0=B9=E6=8D=AE=E8=BF=9E?= =?UTF-8?q?=E9=BA=A6=E7=8A=B6=E6=80=81=E5=8A=A8=E6=80=81=E6=98=BE=E7=A4=BA?= =?UTF-8?q?=E8=A7=A3=E9=99=A4=E8=BF=9E=E9=BA=A6=E9=80=89=E9=A1=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 新增判断是否有嘉宾在连麦的逻辑 - 仅在有嘉宾连麦时显示“解除连麦”功能 - 调整弹窗布局以适应动态内容 - 优化连麦状态变更时的用户体验 --- lib/widget/live/live_room_user_header.dart | 60 +++++++++++++--------- 1 file changed, 37 insertions(+), 23 deletions(-) diff --git a/lib/widget/live/live_room_user_header.dart b/lib/widget/live/live_room_user_header.dart index 99d2947..348c611 100644 --- a/lib/widget/live/live_room_user_header.dart +++ b/lib/widget/live/live_room_user_header.dart @@ -87,6 +87,13 @@ class LiveRoomUserHeader extends StatelessWidget { SmartDialog.showAttach( targetContext: context, builder: (context) { + // 判断是否有嘉宾在连麦 + final hasGuests = + roomController.rtcChannelDetail.value?.maleInfo != + null || + roomController.rtcChannelDetail.value?.femaleInfo != + null; + return Container( width: 100.w, margin: EdgeInsets.only(left: 160.w), @@ -97,31 +104,38 @@ class LiveRoomUserHeader extends StatelessWidget { child: Column( children: [ SizedBox(height: 15.w), - GestureDetector( - onTap: () { - // 关闭设置弹窗 - SmartDialog.dismiss(); - // 弹出解除连麦对话框 - SmartDialog.show(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) + GestureDetector( + onTap: () { + // 关闭设置弹窗 + SmartDialog.dismiss(); + // 弹出解除连麦对话框 + SmartDialog.show( + 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, + ), + ), + ], + ), ), - ), - SizedBox(height: 15.w), + if (hasGuests) SizedBox(height: 15.w), GestureDetector( onTap: () async { // 关闭弹窗