页面UI替换1远程遥控和各项弹窗和作业主页面和子页面+路径规划的主页面重构等
This commit is contained in:
@@ -5,6 +5,7 @@ import 'package:maibu_satabot_v2/core/localization/app_localizations.dart';
|
||||
import '../models/pv_video_fit.dart';
|
||||
import '../models/pv_video_source.dart';
|
||||
import '../theme/pv_colors.dart';
|
||||
import '../theme/pv_hud_theme.dart';
|
||||
|
||||
/// 页面设置面板(底部弹出,遮罩半透明可透视下方视频,边调边看效果)。
|
||||
///
|
||||
@@ -14,6 +15,9 @@ import '../theme/pv_colors.dart';
|
||||
/// - 模拟障碍物信息:真实推送未接入前手动触发,开启 = 相当于收到机器告警推送,
|
||||
/// 预警横幅 + AR 障碍框 + 屏幕四周泛红**同时**显示;
|
||||
/// - 倒车影像:开启后左栏后视卡叠加倒车引导线效果(模拟倒车挡)。
|
||||
///
|
||||
/// 皮肤两套(由 [light] 选择):普通态大屏沿用原深蓝面板;手动控制全屏视图
|
||||
/// (HUD)用近白玻璃卡,与其上的顶栏 / 侧栏 / 底部条保持同一视觉体系。
|
||||
class PvSettingsSheet extends StatelessWidget {
|
||||
const PvSettingsSheet({
|
||||
super.key,
|
||||
@@ -25,6 +29,7 @@ class PvSettingsSheet extends StatelessWidget {
|
||||
required this.onVideoFitChanged,
|
||||
required this.onSimObstacleChanged,
|
||||
required this.onSimReverseChanged,
|
||||
this.light = false,
|
||||
});
|
||||
|
||||
final PvVideoSource videoSource;
|
||||
@@ -36,6 +41,9 @@ class PvSettingsSheet extends StatelessWidget {
|
||||
final ValueChanged<bool> onSimObstacleChanged;
|
||||
final ValueChanged<bool> onSimReverseChanged;
|
||||
|
||||
/// 是否套用 HUD 浅色玻璃皮肤(默认 false = 普通态大屏的深色皮肤,与改造前一致)。
|
||||
final bool light;
|
||||
|
||||
/// 视频源选项:顺序与文案按需求固定(以太网 RTSP 源、HDMI、WebRTC)。
|
||||
static const List<(PvVideoSource, String)> _sources = [
|
||||
(PvVideoSource.localRtsp, 'pv_control.set_source_rtsp'),
|
||||
@@ -49,9 +57,12 @@ class PvSettingsSheet extends StatelessWidget {
|
||||
(PvVideoFit.cover, 'pv_control.set_fit_cover'),
|
||||
];
|
||||
|
||||
_SheetSkin get _skin => light ? _SheetSkin.light : _SheetSkin.dark;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final tr = AppLocalizations.of(context);
|
||||
final skin = _skin;
|
||||
// 横屏可用高度有限:最大高度限幅 + 可滚动防底部裁切;
|
||||
// 视频源行用 Wrap,窄屏 / 大字体下药丸自动换行不溢出。
|
||||
final maxH = MediaQuery.sizeOf(context).height * 0.72;
|
||||
@@ -63,9 +74,10 @@ class PvSettingsSheet extends StatelessWidget {
|
||||
child: Container(
|
||||
padding: const EdgeInsets.fromLTRB(14, 4, 10, 8),
|
||||
decoration: BoxDecoration(
|
||||
color: PvColors.card,
|
||||
color: skin.panel,
|
||||
borderRadius: BorderRadius.circular(16),
|
||||
border: Border.all(color: PvColors.cardBorder),
|
||||
border: Border.all(color: skin.border),
|
||||
boxShadow: skin.panelShadow,
|
||||
),
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
@@ -74,21 +86,19 @@ class PvSettingsSheet extends StatelessWidget {
|
||||
// 标题行 + 关闭
|
||||
Row(
|
||||
children: [
|
||||
const Icon(
|
||||
Icons.settings_outlined,
|
||||
color: PvColors.accentBright,
|
||||
size: 18,
|
||||
),
|
||||
Icon(Icons.settings_outlined, color: skin.accent, size: 18),
|
||||
const SizedBox(width: 8),
|
||||
Text(
|
||||
tr.translate('pv_control.nav_settings'),
|
||||
style: PvType.cardTitle,
|
||||
style: PvType.cardTitle.copyWith(
|
||||
color: skin.textPrimary,
|
||||
),
|
||||
),
|
||||
const Spacer(),
|
||||
IconButton(
|
||||
icon: const Icon(
|
||||
icon: Icon(
|
||||
Icons.close,
|
||||
color: PvColors.textSecondary,
|
||||
color: skin.textSecondary,
|
||||
size: 20,
|
||||
),
|
||||
visualDensity: VisualDensity.compact,
|
||||
@@ -107,7 +117,7 @@ class PvSettingsSheet extends StatelessWidget {
|
||||
children: [
|
||||
Text(
|
||||
tr.translate('pv_control.set_video_source'),
|
||||
style: PvType.label,
|
||||
style: PvType.label.copyWith(color: skin.textSecondary),
|
||||
),
|
||||
for (final (src, label) in _sources)
|
||||
_pill(
|
||||
@@ -126,7 +136,7 @@ class PvSettingsSheet extends StatelessWidget {
|
||||
children: [
|
||||
Text(
|
||||
tr.translate('pv_control.set_video_fit'),
|
||||
style: PvType.label,
|
||||
style: PvType.label.copyWith(color: skin.textSecondary),
|
||||
),
|
||||
for (final (fitMode, label) in _fits)
|
||||
_pill(
|
||||
@@ -138,17 +148,14 @@ class PvSettingsSheet extends StatelessWidget {
|
||||
videoFit == PvVideoFit.contain
|
||||
? tr.translate('pv_control.set_fit_contain_hint')
|
||||
: tr.translate('pv_control.set_fit_cover_hint'),
|
||||
style: PvType.caption.copyWith(
|
||||
color: PvColors.textTertiary,
|
||||
),
|
||||
style: PvType.caption.copyWith(color: skin.textTertiary),
|
||||
),
|
||||
],
|
||||
),
|
||||
const SizedBox(height: 4),
|
||||
_switchTile(
|
||||
icon: Icons.warning_amber_rounded,
|
||||
iconColor:
|
||||
simObstacle ? PvColors.danger : PvColors.textTertiary,
|
||||
iconColor: simObstacle ? skin.danger : skin.textTertiary,
|
||||
title: tr.translate('pv_control.set_sim_obstacle'),
|
||||
subtitle: tr.translate('pv_control.set_sim_obstacle_sub'),
|
||||
value: simObstacle,
|
||||
@@ -156,8 +163,7 @@ class PvSettingsSheet extends StatelessWidget {
|
||||
),
|
||||
_switchTile(
|
||||
icon: Icons.directions_car,
|
||||
iconColor:
|
||||
simReverse ? PvColors.accentBright : PvColors.textTertiary,
|
||||
iconColor: simReverse ? skin.accent : skin.textTertiary,
|
||||
title: tr.translate('pv_control.set_sim_reverse'),
|
||||
subtitle: tr.translate('pv_control.set_sim_reverse_sub'),
|
||||
value: simReverse,
|
||||
@@ -171,13 +177,14 @@ class PvSettingsSheet extends StatelessWidget {
|
||||
);
|
||||
}
|
||||
|
||||
/// 药丸选项:选中态青色描边 + 填充,与 HUD 预设档位风格一致(视频源 / 视频展示共用)。
|
||||
/// 药丸选项:选中态强调色描边 + 浅底,与当前皮肤同体系(视频源 / 视频展示共用)。
|
||||
/// 左右间距由外层 Wrap 的 spacing 提供,此处只留纵向呼吸。
|
||||
Widget _pill({
|
||||
required String label,
|
||||
required bool selected,
|
||||
required VoidCallback onTap,
|
||||
}) {
|
||||
final skin = _skin;
|
||||
return GestureDetector(
|
||||
onTap: onTap,
|
||||
behavior: HitTestBehavior.opaque,
|
||||
@@ -185,20 +192,16 @@ class PvSettingsSheet extends StatelessWidget {
|
||||
duration: const Duration(milliseconds: 180),
|
||||
padding: const EdgeInsets.symmetric(horizontal: 12, vertical: 6),
|
||||
decoration: BoxDecoration(
|
||||
color: selected
|
||||
? PvColors.accent.withValues(alpha: 0.20)
|
||||
: PvColors.cardInner,
|
||||
color: selected ? skin.accentSoft : skin.inner,
|
||||
borderRadius: BorderRadius.circular(20),
|
||||
border: Border.all(
|
||||
color: selected ? PvColors.accent : PvColors.cardBorder,
|
||||
color: selected ? skin.accent : skin.border,
|
||||
),
|
||||
),
|
||||
child: Text(
|
||||
label,
|
||||
style: PvType.body.copyWith(
|
||||
color: selected
|
||||
? PvColors.accentBright
|
||||
: PvColors.textSecondary,
|
||||
color: selected ? skin.accentText : skin.textSecondary,
|
||||
fontWeight: selected ? FontWeight.w700 : FontWeight.w400,
|
||||
),
|
||||
),
|
||||
@@ -215,6 +218,7 @@ class PvSettingsSheet extends StatelessWidget {
|
||||
required bool value,
|
||||
required ValueChanged<bool> onChanged,
|
||||
}) {
|
||||
final skin = _skin;
|
||||
return InkWell(
|
||||
onTap: () => onChanged(!value),
|
||||
child: Padding(
|
||||
@@ -227,10 +231,16 @@ class PvSettingsSheet extends StatelessWidget {
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text(title, style: PvType.cardTitle),
|
||||
Text(
|
||||
title,
|
||||
style: PvType.cardTitle.copyWith(color: skin.textPrimary),
|
||||
),
|
||||
Text(
|
||||
subtitle,
|
||||
style: PvType.caption.copyWith(height: 1.3),
|
||||
style: PvType.caption.copyWith(
|
||||
color: skin.textSecondary,
|
||||
height: 1.3,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
@@ -240,8 +250,10 @@ class PvSettingsSheet extends StatelessWidget {
|
||||
child: Switch(
|
||||
value: value,
|
||||
onChanged: (_) {},
|
||||
activeThumbColor: PvColors.accentBright,
|
||||
activeTrackColor: PvColors.accent.withValues(alpha: 0.35),
|
||||
activeThumbColor: skin.switchActiveThumb,
|
||||
activeTrackColor: skin.switchActiveTrack,
|
||||
inactiveThumbColor: skin.switchInactiveThumb,
|
||||
inactiveTrackColor: skin.switchInactiveTrack,
|
||||
),
|
||||
),
|
||||
],
|
||||
@@ -250,3 +262,83 @@ class PvSettingsSheet extends StatelessWidget {
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
/// 设置面板两套皮肤取色:`light` = 手动控制 HUD 的浅色玻璃卡,
|
||||
/// `dark` = 普通态大屏的深蓝面板(数值与改造前完全一致)。
|
||||
class _SheetSkin {
|
||||
const _SheetSkin({
|
||||
required this.panel,
|
||||
required this.inner,
|
||||
required this.border,
|
||||
required this.accent,
|
||||
required this.accentSoft,
|
||||
required this.accentText,
|
||||
required this.textPrimary,
|
||||
required this.textSecondary,
|
||||
required this.textTertiary,
|
||||
required this.danger,
|
||||
required this.switchActiveThumb,
|
||||
required this.switchActiveTrack,
|
||||
this.switchInactiveThumb,
|
||||
this.switchInactiveTrack,
|
||||
this.panelShadow,
|
||||
});
|
||||
|
||||
/// 面板底 / 药丸未选中底 / 描边
|
||||
final Color panel;
|
||||
final Color inner;
|
||||
final Color border;
|
||||
|
||||
/// 强调色(图标、选中描边)/ 选中浅底 / 选中文字
|
||||
final Color accent;
|
||||
final Color accentSoft;
|
||||
final Color accentText;
|
||||
|
||||
final Color textPrimary;
|
||||
final Color textSecondary;
|
||||
final Color textTertiary;
|
||||
final Color danger;
|
||||
|
||||
final Color switchActiveThumb;
|
||||
final Color switchActiveTrack;
|
||||
final Color? switchInactiveThumb;
|
||||
final Color? switchInactiveTrack;
|
||||
|
||||
/// 面板投影(深色皮肤保持无投影)
|
||||
final List<BoxShadow>? panelShadow;
|
||||
|
||||
static const dark = _SheetSkin(
|
||||
panel: PvColors.card,
|
||||
inner: PvColors.cardInner,
|
||||
border: PvColors.cardBorder,
|
||||
accent: PvColors.accent,
|
||||
accentSoft: Color(0x3322D3EE), // accent @ 20%
|
||||
accentText: PvColors.accentBright,
|
||||
textPrimary: PvColors.textPrimary,
|
||||
textSecondary: PvColors.textSecondary,
|
||||
textTertiary: PvColors.textTertiary,
|
||||
danger: PvColors.danger,
|
||||
switchActiveThumb: PvColors.accentBright,
|
||||
switchActiveTrack: Color(0x5922D3EE), // accent @ 35%
|
||||
);
|
||||
|
||||
static const light = _SheetSkin(
|
||||
panel: PvHudColors.panelSolid,
|
||||
inner: PvHudColors.pill,
|
||||
border: PvHudColors.border,
|
||||
accent: PvHudColors.blue,
|
||||
accentSoft: PvHudColors.blueBg,
|
||||
accentText: PvHudColors.blue,
|
||||
textPrimary: PvHudColors.textPrimary,
|
||||
textSecondary: PvHudColors.textSecondary,
|
||||
textTertiary: PvHudColors.textTertiary,
|
||||
danger: PvHudColors.danger,
|
||||
switchActiveThumb: Colors.white,
|
||||
switchActiveTrack: Color(0xFF2F6BFF),
|
||||
switchInactiveThumb: Colors.white,
|
||||
switchInactiveTrack: Color(0xFFDDE4EC),
|
||||
panelShadow: [
|
||||
BoxShadow(color: Color(0x1F0E2233), blurRadius: 24, offset: Offset(0, 8)),
|
||||
],
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user