fix(sender): 串流窗口锁定视频比例,关窗即停流,修正文件传输取 IP
- 独立窗口首帧到达后按视频宽高比自动调整并居中;WM_SIZING 锁定比例,最小 320x180 - 去掉 WS_MAXIMIZEBOX 与双击/F11 全屏,只保留关闭与最小化 - 移除停止投屏按钮;WM_DESTROY 通过 ttstd/video 通道回调 windowClosed,Dart 侧下发 stopMirror - 文件传输地址优先取设备局域网 IP,取不到时回退控制通道 peerIp,并在文件页提供可编辑 IP 输入
This commit is contained in:
1 parent
d3ff293877
commit
d8357a8491
8 files changed
+321
-127
No files matched your search
@@ -2,8 +2,8 @@ import 'package:flutter/material.dart';
|
||||
|
||||
/// 串流控制卡片。
|
||||
///
|
||||
/// 主界面不渲染投屏画面,画面统一显示在独立原生窗口里;这里只负责
|
||||
/// 「请求投屏 / 停止投屏」与窗口显隐、状态展示。
|
||||
/// 主界面不渲染投屏画面,画面统一显示在独立原生窗口里;窗口尺寸按视频比例自动适配,
|
||||
/// 关闭窗口即停止投屏,所以这里只保留「请求投屏」一个动作。
|
||||
class MirrorBar extends StatelessWidget {
|
||||
const MirrorBar({
|
||||
super.key,
|
||||
@@ -15,8 +15,6 @@ class MirrorBar extends StatelessWidget {
|
||||
required this.frames,
|
||||
required this.error,
|
||||
required this.onRequest,
|
||||
required this.onStop,
|
||||
required this.onToggleWindow,
|
||||
});
|
||||
|
||||
final bool connected;
|
||||
@@ -28,13 +26,10 @@ class MirrorBar extends StatelessWidget {
|
||||
final String error;
|
||||
|
||||
final VoidCallback onRequest;
|
||||
final VoidCallback onStop;
|
||||
final VoidCallback onToggleWindow;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final theme = Theme.of(context);
|
||||
final status = _statusText();
|
||||
final statusColor = _statusColor(theme);
|
||||
|
||||
return Card(
|
||||
@@ -57,17 +52,13 @@ class MirrorBar extends StatelessWidget {
|
||||
borderRadius: BorderRadius.circular(10),
|
||||
),
|
||||
child: Text(
|
||||
status,
|
||||
_statusText(),
|
||||
style: theme.textTheme.labelSmall?.copyWith(color: statusColor),
|
||||
),
|
||||
),
|
||||
const Spacer(),
|
||||
if (windowOpen)
|
||||
IconButton(
|
||||
tooltip: '显示/隐藏串流窗口',
|
||||
onPressed: onToggleWindow,
|
||||
icon: const Icon(Icons.picture_in_picture_alt),
|
||||
),
|
||||
Text('串流窗口已打开', style: theme.textTheme.labelSmall),
|
||||
],
|
||||
),
|
||||
const SizedBox(height: 4),
|
||||
@@ -78,24 +69,15 @@ class MirrorBar extends StatelessWidget {
|
||||
overflow: TextOverflow.ellipsis,
|
||||
),
|
||||
const SizedBox(height: 12),
|
||||
Row(
|
||||
children: [
|
||||
Expanded(
|
||||
child: FilledButton.icon(
|
||||
onPressed: connected && !busy ? onRequest : null,
|
||||
icon: const Icon(Icons.play_circle_outline),
|
||||
label: const Text('请求投屏'),
|
||||
),
|
||||
SizedBox(
|
||||
width: double.infinity,
|
||||
child: FilledButton.icon(
|
||||
onPressed: connected && !busy && !streaming ? onRequest : null,
|
||||
icon: Icon(
|
||||
streaming ? Icons.cast_connected : Icons.play_circle_outline,
|
||||
),
|
||||
const SizedBox(width: 10),
|
||||
Expanded(
|
||||
child: OutlinedButton.icon(
|
||||
onPressed: onStop,
|
||||
icon: const Icon(Icons.stop_circle_outlined),
|
||||
label: const Text('停止投屏'),
|
||||
),
|
||||
),
|
||||
],
|
||||
label: Text(streaming ? '投屏中 · 关闭窗口即停止' : '请求投屏'),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
@@ -124,9 +106,9 @@ class MirrorBar extends StatelessWidget {
|
||||
if (!connected) return '先在上方连接被控端,再请求投屏';
|
||||
if (streaming) {
|
||||
final size = resolution.isEmpty ? '未知分辨率' : resolution;
|
||||
return '$size · 已接收 $frames 帧 · 画面在独立窗口显示';
|
||||
return '$size · 已接收 $frames 帧 · 关闭独立窗口会立即停止投屏';
|
||||
}
|
||||
if (windowOpen) return '已向被控端发送投屏请求,请在其弹窗中点击「允许」';
|
||||
return '点击「请求投屏」后会弹出独立窗口播放画面';
|
||||
return '点击「请求投屏」会按视频比例弹出独立窗口播放画面';
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user