feat: 增加分辨率修改

This commit is contained in:
2026-07-21 11:05:40 +08:00
parent 9e5ac91e46
commit 341dce249f
25 changed files with 646 additions and 6 deletions

View File

@@ -47,6 +47,16 @@ class _ControllerHomeState extends State<ControllerHome> {
String _stats = '';
double _videoAspect = 16 / 9;
/// 分辨率预设width 为长边像素0 表示被控端原生分辨率;
/// height 传 0由被控端按屏幕宽高比计算fps 传 0沿用当前帧率
int _selectedResolution = 0;
final List<Map<String, Object>> _resolutionOptions = const [
{'label': '原始', 'width': 0, 'height': 0, 'fps': 0},
{'label': '1080P', 'width': 1920, 'height': 0, 'fps': 0},
{'label': '720P', 'width': 1280, 'height': 0, 'fps': 0},
{'label': '480P', 'width': 854, 'height': 0, 'fps': 0},
];
@override
void initState() {
super.initState();
@@ -320,6 +330,29 @@ class _ControllerHomeState extends State<ControllerHome> {
),
),
),
Positioned(
bottom: 16,
left: 16,
child: CupertinoSegmentedControl<int>(
groupValue: _selectedResolution,
children: <int, Widget>{
for (int i = 0; i < _resolutionOptions.length; i++)
i: Padding(
padding: const EdgeInsets.symmetric(horizontal: 10, vertical: 6),
child: Text(_resolutionOptions[i]['label'] as String),
),
},
onValueChanged: (int idx) {
setState(() => _selectedResolution = idx);
final o = _resolutionOptions[idx];
_controller?.sendResolutionChange(
o['width'] as int,
o['height'] as int,
o['fps'] as int,
);
},
),
),
],
),
);