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 { // 关闭弹窗