初始化
This commit is contained in:
95
lib/widgets/room/file_drawer.dart
Normal file
95
lib/widgets/room/file_drawer.dart
Normal file
@@ -0,0 +1,95 @@
|
||||
import 'package:app/config/theme/base/app_theme_ext.dart';
|
||||
import 'package:app/widgets/base/button/index.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
import '../common/preview/file_previewer.dart';
|
||||
|
||||
///快捷打开文件弹窗
|
||||
void showFileDialog(
|
||||
BuildContext context, {
|
||||
bool isUpload = true,
|
||||
}) {
|
||||
showGeneralDialog(
|
||||
context: context,
|
||||
barrierDismissible: true,
|
||||
// 点击外部关闭
|
||||
barrierLabel: "RightSheet",
|
||||
pageBuilder: (context, animation, secondaryAnimation) {
|
||||
return FileDrawer(
|
||||
isUpload: isUpload,
|
||||
);
|
||||
},
|
||||
transitionBuilder: (context, animation, secondaryAnimation, child) {
|
||||
final tween = Tween<Offset>(begin: Offset(1, 0), end: Offset(0, 0));
|
||||
return SlideTransition(
|
||||
position: tween.animate(animation),
|
||||
child: child,
|
||||
);
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
///文件弹窗
|
||||
class FileDrawer extends StatefulWidget {
|
||||
final bool isUpload;
|
||||
|
||||
const FileDrawer({super.key, this.isUpload = true});
|
||||
|
||||
@override
|
||||
State<FileDrawer> createState() => _FileDrawerState();
|
||||
}
|
||||
|
||||
class _FileDrawerState extends State<FileDrawer> {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Align(
|
||||
alignment: Alignment.centerRight,
|
||||
child: Container(
|
||||
width: 300,
|
||||
color: Colors.white,
|
||||
padding: EdgeInsets.all(context.pagePadding),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text(
|
||||
'上传文件列表',
|
||||
style: Theme.of(context).textTheme.titleSmall,
|
||||
),
|
||||
Expanded(
|
||||
child: ListView.separated(
|
||||
padding: EdgeInsets.symmetric(vertical: 15),
|
||||
itemBuilder: (_, index) {
|
||||
return InkWell(
|
||||
onTap: () {
|
||||
showFilePreviewer(
|
||||
context,
|
||||
url: "https://doaf.asia/api/assets/1/图/65252305_p0.jpg",
|
||||
);
|
||||
},
|
||||
child: Container(
|
||||
padding: EdgeInsets.symmetric(vertical: 10, horizontal: 10),
|
||||
decoration: BoxDecoration(
|
||||
color: Theme.of(context).colorScheme.surfaceContainer,
|
||||
borderRadius: BorderRadius.circular(5),
|
||||
),
|
||||
child: Text("文件1.png", style: TextStyle(fontSize: 14)),
|
||||
),
|
||||
);
|
||||
},
|
||||
separatorBuilder: (_, __) => SizedBox(height: 15),
|
||||
itemCount: 15,
|
||||
),
|
||||
),
|
||||
Visibility(
|
||||
visible: widget.isUpload,
|
||||
child: Button(
|
||||
text: "上传",
|
||||
onPressed: () {},
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
43
lib/widgets/room/video_surface.dart
Normal file
43
lib/widgets/room/video_surface.dart
Normal file
@@ -0,0 +1,43 @@
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
/// 视频画面显示状态
|
||||
enum VideoState {
|
||||
/// 正常显示视频
|
||||
normal,
|
||||
|
||||
/// 摄像头关闭
|
||||
closed,
|
||||
|
||||
/// 掉线 / 未连接
|
||||
offline,
|
||||
|
||||
/// 加载中(进房、拉流等)
|
||||
loading,
|
||||
|
||||
/// 错误状态(拉流失败等)
|
||||
error,
|
||||
}
|
||||
|
||||
class VideoSurface extends StatelessWidget {
|
||||
final VideoState state;
|
||||
|
||||
const VideoSurface({super.key, this.state = VideoState.normal});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
String stateText = switch (state) {
|
||||
VideoState.closed => "摄像头已关闭",
|
||||
VideoState.offline => "掉线",
|
||||
VideoState.loading => "加载中",
|
||||
VideoState.error => "错误",
|
||||
_ => "未知",
|
||||
};
|
||||
//如果不是正常
|
||||
if (state != VideoState.normal) {
|
||||
return Align(
|
||||
child: Text(stateText, style: TextStyle(color: Colors.white70)),
|
||||
);
|
||||
}
|
||||
return Container();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user