作业首页和机器状态的数据
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
import 'dart:math' as math;
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:maibu_satabot_v2/core/localization/app_localizations.dart';
|
||||
import 'package:maibu_satabot_v2/features/remote_control/presentation/widgets/webrtc/webrtc_local_player.dart';
|
||||
|
||||
import '../models/pv_telemetry.dart';
|
||||
@@ -64,14 +65,14 @@ class PvVideoArea extends StatelessWidget {
|
||||
),
|
||||
|
||||
// ② 顶部左侧:实时视频 + 分辨率/帧率
|
||||
Positioned(left: 14, top: 12, child: _buildTopLeftBadge()),
|
||||
Positioned(left: 14, top: 12, child: _buildTopLeftBadge(context)),
|
||||
|
||||
// ③ 顶部中间:障碍物预警
|
||||
if (telemetry.obstacleAlert)
|
||||
Positioned(left: 0, right: 0, top: 10, child: _buildObstacleBanner()),
|
||||
|
||||
// ④ 顶部右侧:网络状态
|
||||
Positioned(right: 14, top: 12, child: _buildNetworkBadge()),
|
||||
Positioned(right: 14, top: 12, child: _buildNetworkBadge(context)),
|
||||
|
||||
// ⑤ 右侧工具按钮列
|
||||
if (showSideTools)
|
||||
@@ -112,7 +113,7 @@ class PvVideoArea extends StatelessWidget {
|
||||
return _VideoPlaceholder();
|
||||
}
|
||||
|
||||
Widget _buildTopLeftBadge() {
|
||||
Widget _buildTopLeftBadge(BuildContext context) {
|
||||
return Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
@@ -120,9 +121,11 @@ class PvVideoArea extends StatelessWidget {
|
||||
children: [
|
||||
const Icon(Icons.circle, size: 8, color: PvColors.danger),
|
||||
const SizedBox(width: 5),
|
||||
const Text(
|
||||
'实时视频',
|
||||
style: TextStyle(
|
||||
Text(
|
||||
AppLocalizations.of(
|
||||
context,
|
||||
).translate('pv_control.realtime_video'),
|
||||
style: const TextStyle(
|
||||
color: PvColors.textPrimary,
|
||||
fontSize: 12,
|
||||
fontWeight: FontWeight.w700,
|
||||
@@ -146,8 +149,9 @@ class PvVideoArea extends StatelessWidget {
|
||||
|
||||
Widget _buildObstacleBanner() => const _ObstacleBannerPill();
|
||||
|
||||
Widget _buildNetworkBadge() {
|
||||
Widget _buildNetworkBadge(BuildContext context) {
|
||||
final ok = telemetry.networkNormal;
|
||||
final l10n = AppLocalizations.of(context);
|
||||
return Container(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 10, vertical: 5),
|
||||
decoration: BoxDecoration(
|
||||
@@ -163,7 +167,9 @@ class PvVideoArea extends StatelessWidget {
|
||||
Icon(Icons.wifi, size: 14, color: ok ? PvColors.online : PvColors.warning),
|
||||
const SizedBox(width: 4),
|
||||
Text(
|
||||
ok ? '网络良好' : '网络异常',
|
||||
ok
|
||||
? l10n.translate('pv_control.network_good')
|
||||
: l10n.translate('pv_control.network_bad'),
|
||||
style: TextStyle(
|
||||
fontSize: 10,
|
||||
fontWeight: FontWeight.w600,
|
||||
@@ -202,13 +208,18 @@ class _VideoPlaceholder extends StatelessWidget {
|
||||
Widget build(BuildContext context) {
|
||||
return Container(
|
||||
color: Colors.black87,
|
||||
child: const Center(
|
||||
child: Center(
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
Icon(Icons.videocam_off, size: 48, color: Colors.white38),
|
||||
SizedBox(height: 8),
|
||||
Text('视频未加载', style: TextStyle(color: Colors.white54, fontSize: 12)),
|
||||
const Icon(Icons.videocam_off, size: 48, color: Colors.white38),
|
||||
const SizedBox(height: 8),
|
||||
Text(
|
||||
AppLocalizations.of(
|
||||
context,
|
||||
).translate('pv_control.video_not_loaded'),
|
||||
style: const TextStyle(color: Colors.white54, fontSize: 12),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
@@ -276,9 +287,11 @@ class _ObstacleBannerPillState extends State<_ObstacleBannerPill>
|
||||
const SizedBox(width: 7),
|
||||
const Icon(Icons.warning_rounded, color: Colors.white, size: 16),
|
||||
const SizedBox(width: 5),
|
||||
const Text(
|
||||
'障碍物预警',
|
||||
style: TextStyle(
|
||||
Text(
|
||||
AppLocalizations.of(
|
||||
context,
|
||||
).translate('pv_control.obstacle_alert'),
|
||||
style: const TextStyle(
|
||||
color: Colors.white,
|
||||
fontSize: 14,
|
||||
fontWeight: FontWeight.w800,
|
||||
|
||||
Reference in New Issue
Block a user