diff --git a/wgshare/lib/pages/metting/meeting_main_view.dart b/wgshare/lib/pages/metting/meeting_main_view.dart index e3b66ae..f8b347e 100644 --- a/wgshare/lib/pages/metting/meeting_main_view.dart +++ b/wgshare/lib/pages/metting/meeting_main_view.dart @@ -28,15 +28,13 @@ class MeetingMainPage extends StatefulWidget { } class MeetingMainPageState extends State { - final MeetingMainLogic logic = Get.put(MeetingMainLogic()); final MeetingMainState state = Get.find().state; @override void initState() { super.initState(); - state.floating.value = Floating( - previewFloatingWidget(), + state.floating.value = Floating(previewFloatingWidget(), slideType: FloatingSlideType.onRightAndTop, moveOpacity: 1, isShowLog: false, @@ -87,10 +85,11 @@ class MeetingMainPageState extends State { width: 20.w, height: 20.h, ), - onTap: (){ - if(state.floating.value?.isShowing == true){ + onTap: () { + if (state.floating.value?.isShowing == + true) { state.floating.value?.close(); - }else{ + } else { state.floating.value?.open(context); } }, @@ -236,6 +235,9 @@ class MeetingMainPageState extends State { onHangUpTap: () { logic.hangUpVideo(); }, + onPageViewIndexChange: (index) { + + }, ) : Container()), @@ -1378,22 +1380,22 @@ class MeetingMainPageState extends State { } /// 自己视频预览悬浮窗 - Widget previewFloatingWidget(){ + Widget previewFloatingWidget() { return Stack( children: [ SizedBox( width: 120, height: 150, child: Obx(() => Center( - child: state.isOpenCamera.value == true - ? AgoraVideoView( - controller: VideoViewController( - rtcEngine: state.rctEngine.value!, - canvas: const VideoCanvas(uid: 0), - ), - ) - : const CircularProgressIndicator(), - )), + child: state.isOpenCamera.value == true + ? AgoraVideoView( + controller: VideoViewController( + rtcEngine: state.rctEngine.value!, + canvas: const VideoCanvas(uid: 0), + ), + ) + : const CircularProgressIndicator(), + )), ), Positioned( left: 4, @@ -1408,8 +1410,7 @@ class MeetingMainPageState extends State { Container( height: 15, margin: const EdgeInsets.only(left: 4), - padding: - const EdgeInsets.only(left: 4, right: 4), + padding: const EdgeInsets.only(left: 4, right: 4), decoration: BoxDecoration( borderRadius: BorderRadius.circular(2), color: ColorUtil.Color_0_0_0_96), @@ -1422,11 +1423,9 @@ class MeetingMainPageState extends State { ), SizedBox(width: 4.w),*/ Text( - UserStore - .to.userInfoEntity.value!.userName, + UserStore.to.userInfoEntity.value!.userName, style: TextStyle( - fontSize: 10.sp, - color: ColorUtil.Color_185_184_184), + fontSize: 10.sp, color: ColorUtil.Color_185_184_184), ) ], ), diff --git a/wgshare/lib/pages/metting/video/meeting_main_video_state.dart b/wgshare/lib/pages/metting/video/meeting_main_video_state.dart index de7557b..b4ac889 100644 --- a/wgshare/lib/pages/metting/video/meeting_main_video_state.dart +++ b/wgshare/lib/pages/metting/video/meeting_main_video_state.dart @@ -1,5 +1,9 @@ +import 'package:get/get.dart'; + class MeetingMainVideoState { MeetingMainVideoState() { ///Initialize variables } + + late RxInt pageIndex = 0.obs; } diff --git a/wgshare/lib/pages/metting/video/meeting_main_video_view.dart b/wgshare/lib/pages/metting/video/meeting_main_video_view.dart index 7b60b95..221790d 100644 --- a/wgshare/lib/pages/metting/video/meeting_main_video_view.dart +++ b/wgshare/lib/pages/metting/video/meeting_main_video_view.dart @@ -12,13 +12,15 @@ import 'meeting_main_video_logic.dart'; import 'meeting_main_video_state.dart'; class MeetingMainVideoComponent extends StatefulWidget { - const MeetingMainVideoComponent({super.key, - required this.rtcEngine, - required this.channelId, - required this.isOpenCamera, - required this.remoteUid, - required this.onHangUpTap, - required this.users}); + const MeetingMainVideoComponent( + {super.key, + required this.rtcEngine, + required this.channelId, + required this.isOpenCamera, + required this.remoteUid, + required this.onHangUpTap, + required this.users, + required this.onPageViewIndexChange}); final RtcEngine rtcEngine; final String channelId; @@ -26,13 +28,14 @@ class MeetingMainVideoComponent extends StatefulWidget { final bool isOpenCamera; final List users; final Function onHangUpTap; + final Function onPageViewIndexChange; @override - State createState() => _MeetingMainVideoComponentState(); + State createState() => + _MeetingMainVideoComponentState(); } -class _MeetingMainVideoComponentState extends State with AutomaticKeepAliveClientMixin { - +class _MeetingMainVideoComponentState extends State{ final MeetingMainVideoLogic logic = Get.put(MeetingMainVideoLogic()); final MeetingMainVideoState state = Get.find().state; @@ -52,8 +55,8 @@ class _MeetingMainVideoComponentState extends State w physics: const BouncingScrollPhysics(), pageSnapping: true, onPageChanged: (index) { - // 监听事件 - debugPrint('wgs输出===:$index'); + state.pageIndex.value = index; + widget.onPageViewIndexChange(index); }, children: [ Stack( @@ -61,10 +64,9 @@ class _MeetingMainVideoComponentState extends State w children: [ widget.remoteUid != "" ? AgoraVideoView( - controller: VideoViewController.remote( - rtcEngine: widget.rtcEngine, - canvas: VideoCanvas(uid: int.tryParse(widget.remoteUid)), - connection: RtcConnection(channelId: widget.channelId), + controller: VideoViewController( + rtcEngine: widget.rtcEngine, + canvas: const VideoCanvas(uid: 0) ), ) : const CircularProgressIndicator(), @@ -156,12 +158,12 @@ class _MeetingMainVideoComponentState extends State w color: ColorUtil.Color_0_0_0_96), child: Row( children: [ - *//*Image.asset( + */ /*Image.asset( 'assets/images/meeting_main_microphone_open.png', width: 13.w, height: 14.h, ), - SizedBox(width: 4.w),*//* + SizedBox(width: 4.w),*/ /* Text( UserStore .to.userInfoEntity.value!.userName, @@ -193,22 +195,23 @@ class _MeetingMainVideoComponentState extends State w return Stack( children: [ widget.users[index].uid == - UserStore.to.userInfoEntity.value!.uid + UserStore.to.userInfoEntity.value!.uid ? AgoraVideoView( - controller: VideoViewController( - rtcEngine: widget.rtcEngine, - canvas: const VideoCanvas(uid: 0), - ), - ) + controller: VideoViewController( + rtcEngine: widget.rtcEngine, + canvas: const VideoCanvas(uid: 0) + ), + ) : AgoraVideoView( - controller: VideoViewController.remote( - rtcEngine: widget.rtcEngine, - canvas: VideoCanvas( - uid: int.tryParse(widget.users[index].uid)), - connection: - RtcConnection(channelId: widget.channelId), - ), - ), + controller: VideoViewController.remote( + rtcEngine: widget.rtcEngine, + canvas: VideoCanvas( + uid: int.tryParse( + widget.users[index].uid)), + connection: RtcConnection( + channelId: widget.channelId), + ), + ), Positioned( left: 4, bottom: 4, @@ -217,57 +220,70 @@ class _MeetingMainVideoComponentState extends State w Image.asset( 'assets/images/meeting_main_own.png', width: 24.w, - height: 24 .h, + height: 24.h, ), Container( height: 20, margin: const EdgeInsets.only(left: 4), padding: - const EdgeInsets.only(left: 4, right: 4), + const EdgeInsets.only(left: 4, right: 4), decoration: BoxDecoration( borderRadius: BorderRadius.circular(2), color: ColorUtil.Color_0_0_0_96), child: widget.users[index].enableMicr == true ? Row( - mainAxisAlignment: MainAxisAlignment.center, - crossAxisAlignment: CrossAxisAlignment.center, - children: [ - SizedBox( - width: 20.w, - height: 20.h, - child: LiquidCustomProgressIndicator( - value: widget.users[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( - widget.users[index].userName, - style: TextStyle( - fontSize: 12.sp, - color: ColorUtil.Color_255_255_255), - ) - ], - ) + mainAxisAlignment: + MainAxisAlignment.center, + crossAxisAlignment: + CrossAxisAlignment.center, + children: [ + SizedBox( + width: 20.w, + height: 20.h, + child: LiquidCustomProgressIndicator( + value: + widget.users[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( + widget.users[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( - widget.users[index].userName, - style: TextStyle( - fontSize: 12.sp, - color: ColorUtil.Color_255_255_255), - ) - ], - ), + mainAxisAlignment: + MainAxisAlignment.center, + crossAxisAlignment: + CrossAxisAlignment.center, + children: [ + Image.asset( + 'assets/images/meeting_main_microphone_open.png', + width: 20.w, + height: 20.h, + ), + Text( + widget.users[index].userName, + style: TextStyle( + fontSize: 12.sp, + color: ColorUtil + .Color_255_255_255), + ) + ], + ), ) ], ), @@ -288,7 +304,9 @@ class _MeetingMainVideoComponentState extends State w margin: const EdgeInsets.only(right: 6), decoration: BoxDecoration( borderRadius: BorderRadius.circular(8), - color: ColorUtil.Color_255_255_255), + color: state.pageIndex.value == 0 + ? ColorUtil.Color_255_255_255 + : ColorUtil.Color_108_108_108), ), Container( width: 8.w, @@ -296,7 +314,9 @@ class _MeetingMainVideoComponentState extends State w margin: const EdgeInsets.only(left: 6), decoration: BoxDecoration( borderRadius: BorderRadius.circular(8), - color: ColorUtil.Color_108_108_108), + color: state.pageIndex.value == 1 + ? ColorUtil.Color_255_255_255 + : ColorUtil.Color_108_108_108), ) ], ), @@ -304,8 +324,4 @@ class _MeetingMainVideoComponentState extends State w ], ); } - - @override - bool get wantKeepAlive => true; } -