作业首页和机器状态的数据
This commit is contained in:
@@ -9,12 +9,13 @@ import '../theme/pv_hud_theme.dart';
|
||||
|
||||
/// 页面设置面板(底部弹出,遮罩半透明可透视下方视频,边调边看效果)。
|
||||
///
|
||||
/// 纯展示 + 回调:所有设置状态由 PvControlPage 持有。当前四项:
|
||||
/// 纯展示 + 回调:所有设置状态由 PvControlPage 持有。当前五项:
|
||||
/// - 视频源:以太网 RTSP / HDMI(USB 采集卡) / WebRTC,切换即重建对应链路 cubit;
|
||||
/// - 视频展示:完整显示(不裁画面、可能留黑边)/ 铺满屏幕(无黑边、裁掉边缘);
|
||||
/// - 模拟障碍物信息:真实推送未接入前手动触发,开启 = 相当于收到机器告警推送,
|
||||
/// 预警横幅 + AR 障碍框 + 屏幕四周泛红**同时**显示;
|
||||
/// - 倒车影像:开启后左栏后视卡叠加倒车引导线效果(模拟倒车挡)。
|
||||
/// - 倒车影像:开启后左栏后视卡叠加倒车引导线效果(模拟倒车挡);
|
||||
/// - 遥控摇杆(仅手动控制 HUD 显示):关闭后隐藏左右两个方向摇杆与回中按钮。
|
||||
///
|
||||
/// 皮肤两套(由 [light] 选择):普通态大屏沿用原深蓝面板;手动控制全屏视图
|
||||
/// (HUD)用近白玻璃卡,与其上的顶栏 / 侧栏 / 底部条保持同一视觉体系。
|
||||
@@ -25,10 +26,12 @@ class PvSettingsSheet extends StatelessWidget {
|
||||
required this.videoFit,
|
||||
required this.simObstacle,
|
||||
required this.simReverse,
|
||||
required this.showJoysticks,
|
||||
required this.onVideoSourceChanged,
|
||||
required this.onVideoFitChanged,
|
||||
required this.onSimObstacleChanged,
|
||||
required this.onSimReverseChanged,
|
||||
required this.onShowJoysticksChanged,
|
||||
this.light = false,
|
||||
});
|
||||
|
||||
@@ -36,10 +39,15 @@ class PvSettingsSheet extends StatelessWidget {
|
||||
final PvVideoFit videoFit;
|
||||
final bool simObstacle;
|
||||
final bool simReverse;
|
||||
|
||||
/// 是否显示左右两个方向摇杆(仅手动控制 HUD 有摇杆,设置面板可关掉)。
|
||||
final bool showJoysticks;
|
||||
|
||||
final ValueChanged<PvVideoSource> onVideoSourceChanged;
|
||||
final ValueChanged<PvVideoFit> onVideoFitChanged;
|
||||
final ValueChanged<bool> onSimObstacleChanged;
|
||||
final ValueChanged<bool> onSimReverseChanged;
|
||||
final ValueChanged<bool> onShowJoysticksChanged;
|
||||
|
||||
/// 是否套用 HUD 浅色玻璃皮肤(默认 false = 普通态大屏的深色皮肤,与改造前一致)。
|
||||
final bool light;
|
||||
@@ -65,14 +73,16 @@ class PvSettingsSheet extends StatelessWidget {
|
||||
final skin = _skin;
|
||||
// 横屏可用高度有限:最大高度限幅 + 可滚动防底部裁切;
|
||||
// 视频源行用 Wrap,窄屏 / 大字体下药丸自动换行不溢出。
|
||||
final maxH = MediaQuery.sizeOf(context).height * 0.72;
|
||||
// 限幅放宽到 0.86:多一行开关后旧值会把最后一行压到手势条下面。
|
||||
final maxH = MediaQuery.sizeOf(context).height * 0.86;
|
||||
return ConstrainedBox(
|
||||
constraints: BoxConstraints(maxHeight: maxH),
|
||||
child: SingleChildScrollView(
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.fromLTRB(18, 0, 18, 12),
|
||||
// 底部留白加大:面板整体往上抬,不贴着屏幕底边
|
||||
padding: const EdgeInsets.fromLTRB(16, 0, 16, 18),
|
||||
child: Container(
|
||||
padding: const EdgeInsets.fromLTRB(14, 4, 10, 8),
|
||||
padding: const EdgeInsets.fromLTRB(12, 2, 8, 6),
|
||||
decoration: BoxDecoration(
|
||||
color: skin.panel,
|
||||
borderRadius: BorderRadius.circular(16),
|
||||
@@ -83,11 +93,11 @@ class PvSettingsSheet extends StatelessWidget {
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
// 标题行 + 关闭
|
||||
// 标题行 + 关闭(比原尺寸小一号,给下面的开关行腾高度)
|
||||
Row(
|
||||
children: [
|
||||
Icon(Icons.settings_outlined, color: skin.accent, size: 18),
|
||||
const SizedBox(width: 8),
|
||||
Icon(Icons.settings_outlined, color: skin.accent, size: 16),
|
||||
const SizedBox(width: 6),
|
||||
Text(
|
||||
tr.translate('pv_control.nav_settings'),
|
||||
style: PvType.cardTitle.copyWith(
|
||||
@@ -99,19 +109,19 @@ class PvSettingsSheet extends StatelessWidget {
|
||||
icon: Icon(
|
||||
Icons.close,
|
||||
color: skin.textSecondary,
|
||||
size: 20,
|
||||
size: 18,
|
||||
),
|
||||
visualDensity: VisualDensity.compact,
|
||||
padding: EdgeInsets.zero,
|
||||
constraints:
|
||||
const BoxConstraints(minWidth: 32, minHeight: 32),
|
||||
const BoxConstraints(minWidth: 28, minHeight: 28),
|
||||
onPressed: () => Navigator.of(context).pop(),
|
||||
),
|
||||
],
|
||||
),
|
||||
// 视频源(Wrap:空间不够自动换第二行)
|
||||
Wrap(
|
||||
spacing: 8,
|
||||
spacing: 6,
|
||||
runSpacing: 2,
|
||||
crossAxisAlignment: WrapCrossAlignment.center,
|
||||
children: [
|
||||
@@ -128,9 +138,9 @@ class PvSettingsSheet extends StatelessWidget {
|
||||
],
|
||||
),
|
||||
// 视频展示(适配方式)+ 一句取舍说明
|
||||
const SizedBox(height: 6),
|
||||
const SizedBox(height: 4),
|
||||
Wrap(
|
||||
spacing: 8,
|
||||
spacing: 6,
|
||||
runSpacing: 2,
|
||||
crossAxisAlignment: WrapCrossAlignment.center,
|
||||
children: [
|
||||
@@ -152,7 +162,7 @@ class PvSettingsSheet extends StatelessWidget {
|
||||
),
|
||||
],
|
||||
),
|
||||
const SizedBox(height: 4),
|
||||
const SizedBox(height: 2),
|
||||
_switchTile(
|
||||
icon: Icons.warning_amber_rounded,
|
||||
iconColor: simObstacle ? skin.danger : skin.textTertiary,
|
||||
@@ -169,6 +179,17 @@ class PvSettingsSheet extends StatelessWidget {
|
||||
value: simReverse,
|
||||
onChanged: onSimReverseChanged,
|
||||
),
|
||||
// 摇杆开关:新版远程遥控的设置面板里始终可见。
|
||||
// 大屏页本身没有摇杆,这个开关预设的是「全屏手动控制」里的显示与否,
|
||||
// 进 HUD 后立即生效(淡出淡入不需要重启页面)。
|
||||
_switchTile(
|
||||
icon: Icons.gamepad_outlined,
|
||||
iconColor: showJoysticks ? skin.accent : skin.textTertiary,
|
||||
title: tr.translate('pv_control.set_show_joysticks'),
|
||||
subtitle: tr.translate('pv_control.set_show_joysticks_sub'),
|
||||
value: showJoysticks,
|
||||
onChanged: onShowJoysticksChanged,
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
@@ -190,10 +211,10 @@ class PvSettingsSheet extends StatelessWidget {
|
||||
behavior: HitTestBehavior.opaque,
|
||||
child: AnimatedContainer(
|
||||
duration: const Duration(milliseconds: 180),
|
||||
padding: const EdgeInsets.symmetric(horizontal: 12, vertical: 6),
|
||||
padding: const EdgeInsets.symmetric(horizontal: 10, vertical: 4),
|
||||
decoration: BoxDecoration(
|
||||
color: selected ? skin.accentSoft : skin.inner,
|
||||
borderRadius: BorderRadius.circular(20),
|
||||
borderRadius: BorderRadius.circular(16),
|
||||
border: Border.all(
|
||||
color: selected ? skin.accent : skin.border,
|
||||
),
|
||||
@@ -222,11 +243,11 @@ class PvSettingsSheet extends StatelessWidget {
|
||||
return InkWell(
|
||||
onTap: () => onChanged(!value),
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.symmetric(vertical: 4),
|
||||
padding: const EdgeInsets.symmetric(vertical: 2),
|
||||
child: Row(
|
||||
children: [
|
||||
Icon(icon, size: 20, color: iconColor),
|
||||
const SizedBox(width: 10),
|
||||
Icon(icon, size: 18, color: iconColor),
|
||||
const SizedBox(width: 8),
|
||||
Expanded(
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
@@ -245,11 +266,13 @@ class PvSettingsSheet extends StatelessWidget {
|
||||
],
|
||||
),
|
||||
),
|
||||
// Switch 自身禁用手势,统一走整行 onTap,避免两套状态
|
||||
// Switch 自身禁用手势,统一走整行 onTap,避免两套状态;
|
||||
// shrinkWrap 去掉默认 48dp 点按区,视觉上跟着整体缩一号
|
||||
IgnorePointer(
|
||||
child: Switch(
|
||||
value: value,
|
||||
onChanged: (_) {},
|
||||
materialTapTargetSize: MaterialTapTargetSize.shrinkWrap,
|
||||
activeThumbColor: skin.switchActiveThumb,
|
||||
activeTrackColor: skin.switchActiveTrack,
|
||||
inactiveThumbColor: skin.switchInactiveThumb,
|
||||
|
||||
Reference in New Issue
Block a user