Browse Source

排版新功能

dev-2.0
王子贤 2 months ago
parent
commit
5d1f664208
6 changed files with 370 additions and 270 deletions
  1. 4
      lib/pages/discover/live_room_page.dart
  2. 15
      lib/rtc/rtc_manager.dart
  3. 191
      lib/widget/live/live_room_anchor_showcase.dart
  4. 235
      lib/widget/live/live_room_invitation_list.dart
  5. 121
      lib/widget/live/live_room_user_header.dart
  6. 74
      lib/widget/live/live_room_user_profile_dialog.dart

4
lib/pages/discover/live_room_page.dart

@ -346,8 +346,8 @@ class _LiveRoomPageState extends State<LiveRoomPage> {
}),
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

15
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);

191
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<LiveRoomAnchorShowcase> createState() => _LiveRoomAnchorShowcaseState();
}
class _LiveRoomAnchorShowcaseState extends State<LiveRoomAnchorShowcase> with TickerProviderStateMixin {
class _LiveRoomAnchorShowcaseState extends State<LiveRoomAnchorShowcase> {
final RTCManager _rtcManager = RTCManager.instance;
final RoomController _roomController = Get.find<RoomController>();
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<LiveRoomAnchorShowcase> 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();
},
);
}

235
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<LiveRoomInvitationList> createState() => _LiveRoomInvitationListState();
}
class _LiveRoomInvitationListState extends State<LiveRoomInvitationList> with TickerProviderStateMixin {
TabController? _tabController;
final RoomController _roomController = Get.find<RoomController>();
@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,
),
);
},
);
})
],
)
],
),
),
);
}
}

121
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,

74
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();
}),
],
),
],

Loading…
Cancel
Save