1
This commit is contained in:
@@ -1,3 +1,5 @@
|
||||
import 'package:agora_rtc_engine/agora_rtc_engine.dart';
|
||||
import 'package:app/pages/teacher/room/viewmodel/type.dart';
|
||||
import 'package:app/request/dto/room/room_user_dto.dart';
|
||||
import 'package:app/widgets/room/file_drawer.dart';
|
||||
import 'package:app/widgets/room/video_surface.dart';
|
||||
@@ -5,14 +7,16 @@ import 'package:flutter/material.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
import 'package:remixicon/remixicon.dart';
|
||||
|
||||
import '../viewmodel/students_view_model.dart';
|
||||
import '../viewmodel/tch_room_vm.dart';
|
||||
|
||||
class StudentItem extends StatefulWidget {
|
||||
final RoomUserDto user;
|
||||
final RtcEngine? engine;
|
||||
|
||||
const StudentItem({
|
||||
super.key,
|
||||
required this.user,
|
||||
this.engine,
|
||||
});
|
||||
|
||||
@override
|
||||
@@ -27,12 +31,16 @@ class _StudentItemState extends State<StudentItem> {
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final vm = context.read<StudentsViewModel>();
|
||||
final vm = context.read<TchRoomVM>();
|
||||
//摄像头是否开启
|
||||
bool isCameraOpen = widget.user.cameraStatus == 1;
|
||||
|
||||
///麦克风是否开启
|
||||
bool isMicOpen = widget.user.microphoneStatus == 1;
|
||||
|
||||
///声音是否开启
|
||||
bool isSpeakerOpen = widget.user.speekerStatus == 1;
|
||||
|
||||
return ClipRRect(
|
||||
borderRadius: BorderRadius.circular(10),
|
||||
child: Container(
|
||||
@@ -44,6 +52,13 @@ class _StudentItemState extends State<StudentItem> {
|
||||
width: double.infinity,
|
||||
child: Stack(
|
||||
children: [
|
||||
if (widget.engine != null)
|
||||
AgoraVideoView(
|
||||
controller: VideoViewController(
|
||||
rtcEngine: widget.engine!,
|
||||
canvas: VideoCanvas(uid: widget.user.rtcUid),
|
||||
),
|
||||
),
|
||||
// VideoSurface(),
|
||||
Positioned(
|
||||
bottom: 0,
|
||||
@@ -95,14 +110,35 @@ class _StudentItemState extends State<StudentItem> {
|
||||
_actionItem(
|
||||
icon: isCameraOpen ? RemixIcons.video_on_fill : RemixIcons.video_off_fill,
|
||||
isActive: isCameraOpen,
|
||||
onTap: () {
|
||||
vm.closeStudentAction(
|
||||
uId: widget.user.userId,
|
||||
action: StudentAction.camera,
|
||||
);
|
||||
},
|
||||
),
|
||||
_actionItem(
|
||||
icon: isMicOpen ? RemixIcons.mic_fill : RemixIcons.mic_off_fill,
|
||||
isActive: isMicOpen,
|
||||
onTap: () {
|
||||
vm.closeStudentAction(
|
||||
uId: widget.user.userId,
|
||||
action: StudentAction.microphone,
|
||||
);
|
||||
},
|
||||
),
|
||||
_actionItem(
|
||||
icon: isSpeakerOpen
|
||||
? RemixIcons.volume_up_fill
|
||||
: RemixIcons.volume_mute_fill,
|
||||
isActive: isSpeakerOpen,
|
||||
onTap: () {
|
||||
vm.closeStudentAction(
|
||||
uId: widget.user.userId,
|
||||
action: StudentAction.speaker,
|
||||
);
|
||||
},
|
||||
),
|
||||
// _actionItem(
|
||||
// icon: RemixIcons.volume_mute_fill,
|
||||
// ),
|
||||
_actionItem(icon: RemixIcons.file_list_3_fill, onTap: _openFileList),
|
||||
],
|
||||
),
|
||||
|
||||
Reference in New Issue
Block a user