- Flutter 桌面端通过 dart:ffi 调用 Rust Core cdylib - 实现 ECDH P-256 密钥协商、HKDF 子密钥派生、AES-256-GCM 控制帧 - Android 被控端用派生密钥做控制帧加密与媒体包 MAC - 新增 libopus JNI 骨架,默认回退 MediaCodec - 新增 aosp/zhanxun/neutral 签名变体与系统 sharedUserId - 本机独立信令服务与设置页开关 - 新增 .gitignore 排除所有编译产物与打包目录
102 lines
3.0 KiB
Dart
102 lines
3.0 KiB
Dart
import 'package:flutter/material.dart';
|
|
|
|
class VideoView extends StatelessWidget {
|
|
const VideoView({
|
|
super.key,
|
|
this.textureId,
|
|
this.connected = false,
|
|
this.resolution = '1920x1080',
|
|
this.pts,
|
|
});
|
|
|
|
final int? textureId;
|
|
final bool connected;
|
|
final String resolution;
|
|
final int? pts;
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
final theme = Theme.of(context);
|
|
return AspectRatio(
|
|
aspectRatio: 16 / 9,
|
|
child: ClipRRect(
|
|
borderRadius: BorderRadius.circular(16),
|
|
child: DecoratedBox(
|
|
decoration: BoxDecoration(
|
|
gradient: LinearGradient(
|
|
colors: [
|
|
theme.colorScheme.surfaceContainerHighest,
|
|
theme.colorScheme.surfaceContainerLowest,
|
|
],
|
|
begin: Alignment.topLeft,
|
|
end: Alignment.bottomRight,
|
|
),
|
|
),
|
|
child: Stack(
|
|
fit: StackFit.expand,
|
|
children: [
|
|
if (textureId != null)
|
|
Texture(textureId: textureId!)
|
|
else
|
|
Column(
|
|
mainAxisAlignment: MainAxisAlignment.center,
|
|
children: [
|
|
Icon(Icons.connected_tv, size: 72, color: theme.colorScheme.primary.withValues(alpha: 0.6)),
|
|
const SizedBox(height: 12),
|
|
Text(connected ? '视频通道已建立' : '等待投屏画面',
|
|
style: theme.textTheme.titleMedium),
|
|
const SizedBox(height: 4),
|
|
Text('H.264/H.265 → External Texture',
|
|
style: theme.textTheme.bodySmall),
|
|
],
|
|
),
|
|
Positioned(
|
|
top: 12,
|
|
left: 12,
|
|
child: _Badge(
|
|
icon: Icons.videocam,
|
|
label: resolution,
|
|
color: connected ? theme.colorScheme.primary : theme.colorScheme.outline,
|
|
),
|
|
),
|
|
if (pts != null)
|
|
Positioned(
|
|
top: 12,
|
|
right: 12,
|
|
child: _Badge(icon: Icons.timer, label: 'PTS $pts', color: theme.colorScheme.outline),
|
|
),
|
|
],
|
|
),
|
|
),
|
|
),
|
|
);
|
|
}
|
|
}
|
|
|
|
class _Badge extends StatelessWidget {
|
|
const _Badge({required this.icon, required this.label, required this.color});
|
|
|
|
final IconData icon;
|
|
final String label;
|
|
final Color color;
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return Container(
|
|
padding: const EdgeInsets.symmetric(horizontal: 10, vertical: 6),
|
|
decoration: BoxDecoration(
|
|
color: Colors.black54,
|
|
borderRadius: BorderRadius.circular(20),
|
|
),
|
|
child: Row(
|
|
mainAxisSize: MainAxisSize.min,
|
|
children: [
|
|
Icon(icon, size: 14, color: color),
|
|
const SizedBox(width: 6),
|
|
Text(label, style: const TextStyle(color: Colors.white, fontSize: 12)),
|
|
],
|
|
),
|
|
);
|
|
}
|
|
}
|