自习室优化ok
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
import 'package:app/config/theme/base/app_theme_ext.dart';
|
||||
import 'package:app/global/theme/base/app_theme_ext.dart';
|
||||
import 'package:app/pages/student/home/viewmodel/s_home_vm.dart';
|
||||
import 'package:app/widgets/version/version_dialog.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import 'package:app/config/theme/base/app_theme_ext.dart';
|
||||
import 'package:app/global/theme/base/app_theme_ext.dart';
|
||||
import 'package:cached_network_image/cached_network_image.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import 'package:app/config/theme/base/app_theme_ext.dart';
|
||||
import 'package:app/global/theme/base/app_theme_ext.dart';
|
||||
import 'package:app/pages/student/home/viewmodel/s_home_vm.dart';
|
||||
import 'package:app/router/route_paths.dart';
|
||||
import 'package:app/utils/permission.dart';
|
||||
|
||||
@@ -1,6 +1,11 @@
|
||||
import 'package:app/pages/student/room/viewmodel/stu_room_vm.dart';
|
||||
import 'package:app/providers/user_store.dart';
|
||||
import 'package:app/utils/time.dart';
|
||||
import 'package:app/widgets/base/button/index.dart';
|
||||
import 'package:app/widgets/base/dialog/config_dialog.dart';
|
||||
import 'package:app/widgets/room/board/board_manager.dart';
|
||||
import 'package:app/widgets/room/core/count_down_vm.dart';
|
||||
import 'package:app/widgets/room/other_widget.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:go_router/go_router.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
@@ -18,6 +23,8 @@ class TopBar extends StatelessWidget implements PreferredSizeWidget {
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final vm = context.watch<StuRoomVM>();
|
||||
final userStore = context.read<UserStore>();
|
||||
return AppBar(
|
||||
foregroundColor: Colors.white,
|
||||
titleTextStyle: const TextStyle(color: Colors.white, fontSize: 18),
|
||||
@@ -58,16 +65,38 @@ class TopBar extends StatelessWidget implements PreferredSizeWidget {
|
||||
Text(vm.roomInfo!.roomName),
|
||||
Text(
|
||||
formatSeconds(vm.studyTime),
|
||||
style: const TextStyle(fontSize: 12, color: Colors.white24),
|
||||
style: const TextStyle(
|
||||
fontSize: 12,
|
||||
color: Colors.white24,
|
||||
),
|
||||
),
|
||||
],
|
||||
);
|
||||
},
|
||||
),
|
||||
actions: [
|
||||
IconButton(
|
||||
onPressed: onOther,
|
||||
icon: Icon(showOther ? RemixIcons.team_fill : RemixIcons.team_line),
|
||||
ActionButton(
|
||||
icon: showOther ? RemixIcons.team_fill : RemixIcons.team_line,
|
||||
text: showOther ? "隐藏学生" : '显示学生',
|
||||
onTap: onOther,
|
||||
),
|
||||
Visibility(
|
||||
visible: vm.roomInfo.roomStatus == 1,
|
||||
child: ActionButton(
|
||||
color: Theme.of(context).primaryColor,
|
||||
icon: RemixIcons.artboard_line,
|
||||
text: "进入白板",
|
||||
onTap: () {
|
||||
final boardManager = BoardManager();
|
||||
final vm = context.read<StuRoomVM>();
|
||||
boardManager.showBoardDialog(
|
||||
context,
|
||||
uid: userStore.userInfo!.name,
|
||||
roomId: vm.roomInfo.id,
|
||||
isTeacher: true,
|
||||
);
|
||||
},
|
||||
),
|
||||
),
|
||||
],
|
||||
);
|
||||
|
||||
@@ -52,13 +52,13 @@ class TeacherVideo extends StatelessWidget {
|
||||
),
|
||||
),
|
||||
Positioned(
|
||||
top: 0,
|
||||
left: 0,
|
||||
top: 30,
|
||||
left: 10,
|
||||
child: Container(
|
||||
width: 150,
|
||||
width: 200,
|
||||
color: Colors.black,
|
||||
child: AspectRatio(
|
||||
aspectRatio: 1 / 1.2,
|
||||
aspectRatio: 16 / 9,
|
||||
child: AgoraVideoView(
|
||||
controller: VideoViewController(
|
||||
rtcEngine: vm.engine!,
|
||||
@@ -80,4 +80,4 @@ class TeacherVideo extends StatelessWidget {
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import 'dart:async';
|
||||
|
||||
import 'package:agora_rtc_engine/agora_rtc_engine.dart';
|
||||
import 'package:app/config/config.dart';
|
||||
import 'package:app/global/config.dart';
|
||||
import 'package:app/data/models/meeting_room_dto.dart';
|
||||
import 'package:app/request/dto/room/room_list_item_dto.dart';
|
||||
import 'package:app/request/dto/room/room_info_dto.dart';
|
||||
@@ -138,8 +138,9 @@ class StuRoomVM extends ChangeNotifier {
|
||||
|
||||
///学生人员变化事件,(如加入、退出、掉线)
|
||||
void onStudentChange(List<RoomUserDto> list) {
|
||||
final lineList = list.where((t) => t.online == 1);
|
||||
List<RoomUserDto> newList = [];
|
||||
for (var t in list) {
|
||||
for (var t in lineList) {
|
||||
//设置老师
|
||||
if (t.userType == 2) {
|
||||
teacherInfo = t;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import 'package:app/config/theme/base/app_theme_ext.dart';
|
||||
import 'package:app/global/theme/base/app_theme_ext.dart';
|
||||
import 'package:app/widgets/version/version_dialog.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
@@ -13,7 +13,7 @@ class THomePage extends StatelessWidget {
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
showUpdateDialog(context);
|
||||
// showUpdateDialog(context);
|
||||
return ChangeNotifierProvider(
|
||||
create: (_) => HomeViewModel(),
|
||||
child: const _HomeView(),
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import 'package:app/config/theme/base/app_theme_ext.dart';
|
||||
import 'package:app/global/theme/base/app_theme_ext.dart';
|
||||
import 'package:app/providers/user_store.dart';
|
||||
import 'package:app/router/route_paths.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
@@ -1,7 +1,9 @@
|
||||
import 'package:app/global/theme/theme.dart';
|
||||
import 'package:app/providers/user_store.dart';
|
||||
import 'package:app/utils/time.dart';
|
||||
import 'package:app/widgets/base/button/index.dart';
|
||||
import 'package:app/widgets/base/config/config.dart';
|
||||
import 'package:app/widgets/base/dialog/config_dialog.dart';
|
||||
import 'package:app/widgets/room/board/board_manager.dart';
|
||||
import 'package:app/widgets/room/other_widget.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_easyloading/flutter_easyloading.dart';
|
||||
import 'package:go_router/go_router.dart';
|
||||
@@ -17,6 +19,7 @@ class TopBar extends StatelessWidget implements PreferredSizeWidget {
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final userStore = context.read<UserStore>();
|
||||
final vm = context.watch<TchRoomVM>();
|
||||
|
||||
return AppBar(
|
||||
@@ -49,28 +52,35 @@ class TopBar extends StatelessWidget implements PreferredSizeWidget {
|
||||
],
|
||||
),
|
||||
actions: [
|
||||
_actionButton(
|
||||
context,
|
||||
ActionButton(
|
||||
icon: RemixIcons.video_on_ai_line,
|
||||
title: "关闭全部",
|
||||
onPressed: () {
|
||||
text: "关闭全部",
|
||||
onTap: () {
|
||||
_closeAll(context, StudentAction.camera);
|
||||
},
|
||||
),
|
||||
_actionButton(
|
||||
context,
|
||||
ActionButton(
|
||||
icon: RemixIcons.volume_up_line,
|
||||
title: "全部静音",
|
||||
onPressed: () {
|
||||
text: "全部静音",
|
||||
onTap: () {
|
||||
_closeAll(context, StudentAction.speaker);
|
||||
},
|
||||
),
|
||||
Container(
|
||||
margin: EdgeInsets.only(right: 15),
|
||||
child: Button(
|
||||
text: "白板",
|
||||
textStyle: TextStyle(fontSize: 14),
|
||||
onPressed: (){},
|
||||
Visibility(
|
||||
visible: vm.roomInfo.roomStatus == 1,
|
||||
child: ActionButton(
|
||||
text: "打开白板",
|
||||
color: Theme.of(context).primaryColor,
|
||||
icon: RemixIcons.artboard_line,
|
||||
onTap: () {
|
||||
final boardManager = BoardManager();
|
||||
boardManager.showBoardDialog(
|
||||
context,
|
||||
uid: userStore.userInfo!.name,
|
||||
roomId: vm.roomInfo.id,
|
||||
isTeacher: true,
|
||||
);
|
||||
},
|
||||
),
|
||||
),
|
||||
Consumer<TchRoomVM>(
|
||||
@@ -78,11 +88,11 @@ class TopBar extends StatelessWidget implements PreferredSizeWidget {
|
||||
if (vm.roomInfo.roomStatus != 1) {
|
||||
return SizedBox();
|
||||
}
|
||||
return Button(
|
||||
type: ThemeType.danger,
|
||||
textStyle: TextStyle(fontSize: 14),
|
||||
return ActionButton(
|
||||
icon: RemixIcons.close_line,
|
||||
color: context.danger,
|
||||
text: "结束自习室",
|
||||
onPressed: () {
|
||||
onTap: () {
|
||||
showDialog(
|
||||
context: context,
|
||||
builder: (_) {
|
||||
@@ -103,12 +113,15 @@ class TopBar extends StatelessWidget implements PreferredSizeWidget {
|
||||
);
|
||||
},
|
||||
),
|
||||
SizedBox(width: 10),
|
||||
],
|
||||
);
|
||||
}
|
||||
|
||||
Widget _infoItem(BuildContext context, {required String title, required IconData icon}) {
|
||||
Widget _infoItem(
|
||||
BuildContext context, {
|
||||
required String title,
|
||||
required IconData icon,
|
||||
}) {
|
||||
return Row(
|
||||
children: [
|
||||
Icon(icon, color: Colors.white54, size: 14),
|
||||
@@ -118,32 +131,6 @@ class TopBar extends StatelessWidget implements PreferredSizeWidget {
|
||||
);
|
||||
}
|
||||
|
||||
Widget _actionButton(
|
||||
BuildContext context, {
|
||||
required IconData icon,
|
||||
required String title,
|
||||
required VoidCallback onPressed,
|
||||
}) {
|
||||
return Container(
|
||||
padding: EdgeInsets.symmetric(horizontal: 10, vertical: 5),
|
||||
margin: EdgeInsets.only(right: 15),
|
||||
decoration: BoxDecoration(
|
||||
color: Color(0xff4a4f4f),
|
||||
borderRadius: BorderRadius.circular(8),
|
||||
),
|
||||
child: InkWell(
|
||||
onTap: onPressed,
|
||||
child: Row(
|
||||
children: [
|
||||
Icon(icon, size: 16),
|
||||
SizedBox(width: 8),
|
||||
Text(title, style: TextStyle(fontSize: 14)),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
void _closeAll(BuildContext context, StudentAction action) {
|
||||
final vm = context.read<TchRoomVM>();
|
||||
String content = (action == StudentAction.camera) ? '是否关闭所有学生的摄像头?' : '是否关闭所有学生的扬声器?';
|
||||
|
||||
@@ -176,7 +176,13 @@ class TchRoomVM extends ChangeNotifier {
|
||||
|
||||
///学生人员变化事件,(如加入、退出、掉线)
|
||||
void onStudentChange(List<RoomUserDto> list) {
|
||||
_students = list.where((t) => t.userType != 2).toList();
|
||||
_students = list.where((t) => t.userType != 2 && t.online == 1).toList();
|
||||
if (activeSId != 0) {
|
||||
final it = _students.where((t) => t.userId == activeSId).firstOrNull;
|
||||
if (it == null) {
|
||||
activeSId = 0;
|
||||
}
|
||||
}
|
||||
// 如果当前没有学生,则选择第一个
|
||||
if (activeSId == 0 && _students.isNotEmpty) {
|
||||
activeSId = _students.first.userId;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import 'package:agora_rtc_engine/agora_rtc_engine.dart';
|
||||
import 'package:app/config/config.dart';
|
||||
import 'package:app/global/config.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
import 'package:wakelock_plus/wakelock_plus.dart';
|
||||
@@ -109,13 +109,13 @@ class _ContentViewState extends State<ContentView> {
|
||||
engine: _engine,
|
||||
),
|
||||
Positioned(
|
||||
top: 0,
|
||||
left: 0,
|
||||
top: 10,
|
||||
right: 10,
|
||||
child: Container(
|
||||
width: 150,
|
||||
width: 200,
|
||||
color: Colors.black,
|
||||
child: AspectRatio(
|
||||
aspectRatio: 1 / 1.2,
|
||||
aspectRatio: 16 / 9,
|
||||
child: AgoraVideoView(
|
||||
controller: VideoViewController(
|
||||
rtcEngine: _engine!,
|
||||
@@ -128,21 +128,24 @@ class _ContentViewState extends State<ContentView> {
|
||||
],
|
||||
),
|
||||
),
|
||||
SizedBox(
|
||||
width: 300,
|
||||
child: ListView.separated(
|
||||
itemBuilder: (_, index) {
|
||||
var item = otherStudents.elementAt(index);
|
||||
return SizedBox(
|
||||
height: 250,
|
||||
child: StudentItem(
|
||||
user: item,
|
||||
engine: _engine,
|
||||
),
|
||||
);
|
||||
},
|
||||
separatorBuilder: (_, __) => SizedBox(height: 15),
|
||||
itemCount: otherStudents.length,
|
||||
Visibility(
|
||||
visible: otherStudents.isNotEmpty,
|
||||
child: SizedBox(
|
||||
width: 300,
|
||||
child: ListView.separated(
|
||||
itemBuilder: (_, index) {
|
||||
var item = otherStudents.elementAt(index);
|
||||
return SizedBox(
|
||||
height: 250,
|
||||
child: StudentItem(
|
||||
user: item,
|
||||
engine: _engine,
|
||||
),
|
||||
);
|
||||
},
|
||||
separatorBuilder: (_, __) => SizedBox(height: 15),
|
||||
itemCount: otherStudents.length,
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
|
||||
@@ -26,9 +26,10 @@ class StudentItem extends StatefulWidget {
|
||||
|
||||
class _StudentItemState extends State<StudentItem> {
|
||||
///打开文件列表
|
||||
void _openFileList() {
|
||||
void _openFileList({required String name}) {
|
||||
showFileDialog(
|
||||
context,
|
||||
name: name,
|
||||
isUpload: false,
|
||||
files: widget.user.filesList,
|
||||
);
|
||||
@@ -160,7 +161,12 @@ class _StudentItemState extends State<StudentItem> {
|
||||
);
|
||||
},
|
||||
),
|
||||
_actionItem(icon: RemixIcons.file_list_3_fill, onTap: _openFileList),
|
||||
_actionItem(
|
||||
icon: RemixIcons.file_list_3_fill,
|
||||
onTap: (){
|
||||
_openFileList(name: widget.user.userName);
|
||||
},
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
|
||||
Reference in New Issue
Block a user