把视频页提出来

This commit is contained in:
fuenmao 2024-12-09 11:13:11 +08:00
parent 19c98c5173
commit 4a0d84ee00
3 changed files with 235 additions and 21 deletions

View File

@ -427,8 +427,11 @@ class MeetingMainLogic extends GetxController with RequestToolMixin{
muteLocalVideoStream(false);
//
startPreview();
//
state.floating.value?.open(state.context.value!);
//
if(state.pageIndex.value == 0){
//
state.floating.value?.open(state.context.value!);
}
changePageState(1);
}
}else{

View File

@ -33,6 +33,8 @@ class MeetingMainState {
/// 012
late RxInt pageState = 0.obs;
/// pageview指示器
late RxInt pageIndex = 0.obs;
///
late RxString roomNumber = "".obs;

View File

@ -8,6 +8,7 @@ import 'package:flutter_floating/floating/floating.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:get/get.dart';
import 'package:liquid_progress_indicator_v2/liquid_progress_indicator.dart';
import 'package:preload_page_view/preload_page_view.dart';
import 'package:wgshare/common/store/user_store.dart';
import 'package:wgshare/pages/metting/share/meeting_main_share_view.dart';
import 'package:wgshare/pages/metting/video/meeting_main_video_view.dart';
@ -223,25 +224,55 @@ class MeetingMainPageState extends State<MeetingMainPage> {
Visibility(
visible: state.pageState.value == 1,
child: null != state.rctEngine.value
? MeetingMainVideoComponent(
rtcEngine: state.rctEngine.value!,
channelId: state.roomNumber.value,
isOpenCamera: state.isOpenCamera.value,
remoteUid: state.remoteUid.value,
users: state.cacheUsers.value
.where((user) =>
user.enableCamera == true)
.toList(),
onHangUpTap: () {
logic.hangUpVideo();
},
onPageViewIndexChange: (index) {
if(index == 0){
state.floating.value?.open(context);
}else{
state.floating.value?.close();
}
},
? Stack(
alignment: Alignment.center,
children: [
PreloadPageView.builder(
preloadPagesCount: 2,
itemCount: 2,
itemBuilder: (BuildContext context, int position) => returnPage(position),
controller: PreloadPageController(initialPage: 0),
onPageChanged: (int position) {
state.pageIndex.value = position;
if(state.isSpeak.value == true && state.isOpenCamera.value == true){
if(position == 0){
state.floating.value?.open(context);
}else{
state.floating.value?.close();
}
}
},
),
/// pageview
Positioned(
bottom: 16,
child: Row(
children: [
Container(
width: 8.w,
height: 8.h,
margin: const EdgeInsets.only(right: 6),
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(8),
color: state.pageIndex.value == 0
? ColorUtil.Color_255_255_255
: ColorUtil.Color_108_108_108),
),
Container(
width: 8.w,
height: 8.h,
margin: const EdgeInsets.only(left: 6),
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(8),
color: state.pageIndex.value == 1
? ColorUtil.Color_255_255_255
: ColorUtil.Color_108_108_108),
)
],
),
),
],
)
: Container()),
@ -1440,4 +1471,182 @@ class MeetingMainPageState extends State<MeetingMainPage> {
],
);
}
///
Widget returnPage(int position){
var pageList = [];
///
pageList.add(Stack(
alignment: Alignment.center,
children: [
state.remoteUid.value != ""
? AgoraVideoView(
controller: VideoViewController(
rtcEngine: state.rctEngine.value!,
canvas: VideoCanvas(uid: int.tryParse(state.remoteUid.value), setupMode: VideoViewSetupMode.videoViewSetupAdd)
),
)
: const CircularProgressIndicator(),
Positioned(
bottom: 110,
child: GestureDetector(
child: Image.asset(
'assets/images/meeting_main_hang_up.png',
width: 50.w,
height: 50.h,
),
onTap: () {
},
),
),
Positioned(
top: 16,
right: 16,
child: Container(
height: 30,
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(8),
color: ColorUtil.Color_0_0_0_96),
padding: const EdgeInsets.only(left: 12, right: 12),
child: Row(
children: [
Text(
'正在讲话:',
style: TextStyle(
fontSize: 10.sp,
color: ColorUtil.Color_185_184_184),
),
Image.asset(
'assets/images/meeting_main_speak2.png',
width: 20.w,
height: 20.h,
),
Text(
'晓晓',
style: TextStyle(
fontSize: 10.sp,
color: ColorUtil.Color_185_184_184),
)
],
),
),
),
],
));
/// gridview
pageList.add(Container(
color: ColorUtil.Color_57_57_57,
child: GridView.builder(
gridDelegate: const SliverGridDelegateWithFixedCrossAxisCount(
crossAxisCount: 2,
childAspectRatio: 0.8,
crossAxisSpacing: 0),
itemCount: state.cacheUsers.value.where((user) => user.enableCamera == true).toList().length,
itemBuilder: (BuildContext ctx, index) {
return Stack(
children: [
state.cacheUsers.value[index].uid ==
UserStore.to.userInfoEntity.value!.uid
? AgoraVideoView(
controller: VideoViewController(
rtcEngine: state.rctEngine.value!,
canvas: const VideoCanvas(uid: 0, setupMode: VideoViewSetupMode.videoViewSetupAdd)
),
)
: AgoraVideoView(
controller: VideoViewController.remote(
rtcEngine: state.rctEngine.value!,
canvas: VideoCanvas(
uid: int.tryParse(
state.cacheUsers.value[index].uid), setupMode: VideoViewSetupMode.videoViewSetupAdd),
connection: RtcConnection(
channelId: state.roomNumber.value),
),
),
Positioned(
left: 4,
bottom: 4,
child: Row(
children: [
Visibility(
visible: state.cacheUsers.value[index].uid == UserStore.to.userInfoEntity.value!.uid,
child: Image.asset(
'assets/images/meeting_main_own.png',
width: 24.w,
height: 24.h,
),
),
Container(
height: 20,
margin: const EdgeInsets.only(left: 4),
padding:
const EdgeInsets.only(left: 4, right: 4),
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(2),
color: ColorUtil.Color_0_0_0_96),
child: state.cacheUsers.value[index].enableMicr == true
? Row(
mainAxisAlignment:
MainAxisAlignment.center,
crossAxisAlignment:
CrossAxisAlignment.center,
children: [
SizedBox(
width: 20.w,
height: 20.h,
child: LiquidCustomProgressIndicator(
value:
state.cacheUsers.value[index]
.volume ??
0.0,
valueColor:
const AlwaysStoppedAnimation(
ColorUtil
.Color_2_177_136),
backgroundColor:
ColorUtil.Color_255_255_255,
direction: Axis.vertical,
shapePath: ViewSvgPath
.getMicrpphonePath()),
),
Text(
state.cacheUsers.value[index].userName,
style: TextStyle(
fontSize: 12.sp,
color: ColorUtil
.Color_255_255_255),
)
],
)
: Row(
mainAxisAlignment:
MainAxisAlignment.center,
crossAxisAlignment:
CrossAxisAlignment.center,
children: [
Image.asset(
'assets/images/meeting_main_microphone_open.png',
width: 20.w,
height: 20.h,
),
Text(
state.cacheUsers.value[index].userName,
style: TextStyle(
fontSize: 12.sp,
color: ColorUtil
.Color_255_255_255),
)
],
),
)
],
),
)
],
);
}),
));
return pageList[position];
}
}