自主任务接口接入和bug修复和工作记录页面
This commit is contained in:
@@ -1,337 +1,110 @@
|
||||
import 'dart:async';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
import 'package:latlong2/latlong.dart';
|
||||
import 'package:maibu_satabot_v2/components/capsule_toast.dart';
|
||||
import 'package:maibu_satabot_v2/core/app/app_user_cubit.dart';
|
||||
import 'package:maibu_satabot_v2/core/di/injection.dart';
|
||||
import 'package:maibu_satabot_v2/features/home/presentation/widgets/map/geoserver_suzhou_layer.dart';
|
||||
import 'package:maibu_satabot_v2/core/localization/app_localizations.dart';
|
||||
import 'package:maibu_satabot_v2/features/regions/domain/entities/region_draft.dart';
|
||||
import 'package:maibu_satabot_v2/features/regions/presentation/cubit/region_list_cubit.dart';
|
||||
import 'package:maibu_satabot_v2/features/regions/presentation/widgets/region_list_panel.dart';
|
||||
import 'package:maibu_satabot_v2/features/v2/device_list/presentation/pages/route_editor_page_v2.dart';
|
||||
import 'package:maibu_satabot_v2/features/v2/device_list/presentation/widgets/autonomous/work_ui.dart';
|
||||
import 'package:maibu_satabot_v2/features/v2/site/presentation/cubit/site_cubit.dart';
|
||||
import 'package:maibu_satabot_v2/features/v2/work/presentation/widgets/work_phone_ui.dart';
|
||||
|
||||
/// 作业区域管理(W03)——作业首页「区域管理」入口进入。
|
||||
///
|
||||
/// 竖屏单页:区域卡片列表(缩略图 + 面积 + 边界点数),
|
||||
/// 右上「新建」、「编辑」都进入横屏「地图与区域编辑」去画边界。
|
||||
///
|
||||
/// 本页为演示页:区域数据是写死的示例,不读写真实地块;
|
||||
/// 只有「进入编辑器」是真实跳转,其余动作只做界面反馈。
|
||||
/// 区域管理使用真实场站分区列表;新增和修改都进入同一地图编辑器。
|
||||
class WorkAreaPageV2 extends StatefulWidget {
|
||||
const WorkAreaPageV2({super.key});
|
||||
|
||||
static Route<void> route() =>
|
||||
MaterialPageRoute<void>(builder: (_) => const WorkAreaPageV2());
|
||||
|
||||
@override
|
||||
State<WorkAreaPageV2> createState() => _WorkAreaPageV2State();
|
||||
}
|
||||
|
||||
/// 一条演示区域
|
||||
class _DemoArea {
|
||||
const _DemoArea({
|
||||
required this.name,
|
||||
required this.kind,
|
||||
required this.area,
|
||||
required this.points,
|
||||
required this.robot,
|
||||
required this.enabled,
|
||||
});
|
||||
|
||||
final String name;
|
||||
|
||||
/// 作业区 / 禁行区 / 障碍区
|
||||
final String kind;
|
||||
final String area;
|
||||
final int points;
|
||||
final String robot;
|
||||
final bool enabled;
|
||||
}
|
||||
|
||||
class _WorkAreaPageV2State extends State<WorkAreaPageV2> {
|
||||
static const Color _navy = kWtNavy;
|
||||
static const Color _gray = kWtGray;
|
||||
static const Color _border = kWtBorder;
|
||||
static const Color _green = Color(0xFF00B42A);
|
||||
static const Color _red = Color(0xFFF0483E);
|
||||
static const Color _orange = Color(0xFFEE9A2E);
|
||||
late final RegionListCubit _regions = sl<RegionListCubit>();
|
||||
final List<StreamSubscription<dynamic>> _subscriptions = [];
|
||||
bool _opening = false;
|
||||
|
||||
static const List<String> _filters = <String>['全部区域', '作业区', '禁行区', '障碍区'];
|
||||
int _filter = 0;
|
||||
Object get _scope => (
|
||||
sl<AppUserCubit>().state.user?.userId ?? '',
|
||||
sl<SiteCubit>().state.selectedSite?.id ?? 0,
|
||||
);
|
||||
|
||||
static const List<_DemoArea> _areas = <_DemoArea>[
|
||||
_DemoArea(
|
||||
name: 'A 区 · 主草坪',
|
||||
kind: '作业区',
|
||||
area: '3 240 m²',
|
||||
points: 12,
|
||||
robot: '山东01号机',
|
||||
enabled: true,
|
||||
),
|
||||
_DemoArea(
|
||||
name: 'B 区 · 东侧草坪',
|
||||
kind: '作业区',
|
||||
area: '2 860 m²',
|
||||
points: 9,
|
||||
robot: '山东02号机',
|
||||
enabled: true,
|
||||
),
|
||||
_DemoArea(
|
||||
name: 'C 区 · 苗圃',
|
||||
kind: '作业区',
|
||||
area: '640 m²',
|
||||
points: 14,
|
||||
robot: '山东01号机',
|
||||
enabled: false,
|
||||
),
|
||||
_DemoArea(
|
||||
name: '水池禁行区',
|
||||
kind: '禁行区',
|
||||
area: '186 m²',
|
||||
points: 6,
|
||||
robot: '全部设备',
|
||||
enabled: true,
|
||||
),
|
||||
_DemoArea(
|
||||
name: '工具房障碍',
|
||||
kind: '障碍区',
|
||||
area: '42 m²',
|
||||
points: 4,
|
||||
robot: '全部设备',
|
||||
enabled: true,
|
||||
),
|
||||
];
|
||||
|
||||
void _toast(String text) => CapsuleToast.show(text, showCheck: false);
|
||||
|
||||
LatLng get _center {
|
||||
final site = sl<SiteCubit>().state.selectedSite;
|
||||
return stationLayerCenter(site?.siteMapName) ??
|
||||
const LatLng(31.083296, 120.840355);
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
_subscriptions.add(
|
||||
sl<SiteCubit>().stream
|
||||
.map((s) => s.selectedSite?.id)
|
||||
.distinct()
|
||||
.listen((_) => _reload()),
|
||||
);
|
||||
_subscriptions.add(
|
||||
sl<AppUserCubit>().stream
|
||||
.map((s) => s.user?.userId)
|
||||
.distinct()
|
||||
.listen((_) => _reload()),
|
||||
);
|
||||
unawaited(_reload());
|
||||
}
|
||||
|
||||
List<_DemoArea> get _visible {
|
||||
if (_filter == 0) return _areas;
|
||||
final String kind = _filters[_filter];
|
||||
return _areas.where((a) => a.kind == kind).toList();
|
||||
}
|
||||
Future<void> _reload({bool force = false}) => _regions.load(
|
||||
siteId: sl<SiteCubit>().state.selectedSite?.id,
|
||||
ownerId: sl<AppUserCubit>().state.user?.userId,
|
||||
force: force,
|
||||
);
|
||||
|
||||
/// 进入横屏「地图与区域编辑」画边界;返回后把方向还给竖屏
|
||||
Future<void> _openEditor() async {
|
||||
await Navigator.of(context).push(RouteEditorPageV2.route(deviceSn: ''));
|
||||
await SystemChrome.setPreferredOrientations([DeviceOrientation.portraitUp]);
|
||||
await SystemChrome.setEnabledSystemUIMode(SystemUiMode.edgeToEdge);
|
||||
}
|
||||
|
||||
Color _kindColor(String kind) {
|
||||
switch (kind) {
|
||||
case '禁行区':
|
||||
return _red;
|
||||
case '障碍区':
|
||||
return _orange;
|
||||
default:
|
||||
return _green;
|
||||
Future<void> _openEditor([RegionDraft? region]) async {
|
||||
if (_opening || _scope != _regions.scopeKey) return;
|
||||
setState(() => _opening = true);
|
||||
try {
|
||||
await Navigator.of(context).push(
|
||||
RouteEditorPageV2.route(initialRegion: region, startRegionEditor: true),
|
||||
);
|
||||
} finally {
|
||||
await SystemChrome.setPreferredOrientations([
|
||||
DeviceOrientation.portraitUp,
|
||||
]);
|
||||
await SystemChrome.setEnabledSystemUIMode(SystemUiMode.edgeToEdge);
|
||||
if (mounted) {
|
||||
setState(() => _opening = false);
|
||||
await _reload(force: true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final areas = _visible;
|
||||
return WorkPhoneScaffold(
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.stretch,
|
||||
children: [
|
||||
WorkPhoneTopBar(
|
||||
title: '区域管理',
|
||||
onBack: () => Navigator.of(context).maybePop(),
|
||||
trailing: WorkSquareButton(
|
||||
icon: Icons.add_rounded,
|
||||
label: '新建',
|
||||
primary: true,
|
||||
onTap: _openEditor,
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 12),
|
||||
const WorkPageHeading(
|
||||
title: '作业区域管理',
|
||||
subtitle: '在地图和区域编辑里画出作业区、禁行区与障碍区',
|
||||
),
|
||||
const SizedBox(height: 12),
|
||||
WorkFilterRow(
|
||||
items: _filters,
|
||||
index: _filter,
|
||||
onChanged: (i) => setState(() => _filter = i),
|
||||
),
|
||||
const SizedBox(height: 12),
|
||||
Expanded(
|
||||
child: areas.isEmpty
|
||||
? _buildEmpty()
|
||||
: ListView.separated(
|
||||
padding: const EdgeInsets.only(bottom: 8),
|
||||
itemCount: areas.length,
|
||||
separatorBuilder: (_, _) => const SizedBox(height: 10),
|
||||
itemBuilder: (context, i) => _buildAreaCard(areas[i]),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
void dispose() {
|
||||
for (final subscription in _subscriptions) {
|
||||
unawaited(subscription.cancel());
|
||||
}
|
||||
unawaited(_regions.close());
|
||||
super.dispose();
|
||||
}
|
||||
|
||||
Widget _buildEmpty() {
|
||||
return Center(
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
Container(
|
||||
width: 56,
|
||||
height: 56,
|
||||
decoration: const BoxDecoration(
|
||||
color: Colors.white,
|
||||
shape: BoxShape.circle,
|
||||
),
|
||||
child: const Icon(Icons.layers_outlined, size: 26, color: kWtMuted),
|
||||
),
|
||||
const SizedBox(height: 10),
|
||||
const Text(
|
||||
'该类型下还没有区域',
|
||||
style: TextStyle(fontSize: 12.5, color: _gray),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
// ===== 区域卡 =====
|
||||
Widget _buildAreaCard(_DemoArea a) {
|
||||
final Color kindColor = _kindColor(a.kind);
|
||||
return Container(
|
||||
padding: const EdgeInsets.all(10),
|
||||
decoration: BoxDecoration(
|
||||
color: Colors.white,
|
||||
borderRadius: BorderRadius.circular(16),
|
||||
border: Border.all(color: _border),
|
||||
),
|
||||
child: Row(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
// 左侧缩略图:作业区叠区域块,禁行/障碍只留底图
|
||||
SizedBox(
|
||||
width: 92,
|
||||
child: WorkMapThumb(
|
||||
center: _center,
|
||||
width: 92,
|
||||
height: 70,
|
||||
radius: 10,
|
||||
zoom: 17.8,
|
||||
showAreas: a.kind == '作业区',
|
||||
showRoute: a.kind == '作业区',
|
||||
showRobot: false,
|
||||
),
|
||||
),
|
||||
const SizedBox(width: 10),
|
||||
Expanded(
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Row(
|
||||
children: [
|
||||
Expanded(
|
||||
child: Text(
|
||||
a.name,
|
||||
maxLines: 1,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
style: const TextStyle(
|
||||
fontSize: 14,
|
||||
fontWeight: FontWeight.w800,
|
||||
color: _navy,
|
||||
),
|
||||
),
|
||||
),
|
||||
const SizedBox(width: 6),
|
||||
Container(
|
||||
padding: const EdgeInsets.symmetric(
|
||||
horizontal: 7,
|
||||
vertical: 2,
|
||||
),
|
||||
decoration: BoxDecoration(
|
||||
color: kindColor.withValues(alpha: 0.12),
|
||||
borderRadius: BorderRadius.circular(999),
|
||||
),
|
||||
child: Text(
|
||||
a.kind,
|
||||
style: TextStyle(
|
||||
fontSize: 10,
|
||||
fontWeight: FontWeight.w700,
|
||||
color: kindColor,
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
const SizedBox(height: 5),
|
||||
Text(
|
||||
'${a.area} · ${a.points} 个边界点',
|
||||
style: const TextStyle(fontSize: 11.5, color: _gray),
|
||||
),
|
||||
const SizedBox(height: 3),
|
||||
Text(
|
||||
'适用:${a.robot}',
|
||||
maxLines: 1,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
style: const TextStyle(fontSize: 11, color: kWtHint),
|
||||
),
|
||||
const SizedBox(height: 8),
|
||||
Row(
|
||||
children: [
|
||||
if (!a.enabled)
|
||||
Container(
|
||||
padding: const EdgeInsets.symmetric(
|
||||
horizontal: 7,
|
||||
vertical: 2,
|
||||
),
|
||||
decoration: BoxDecoration(
|
||||
color: kWtLocked,
|
||||
borderRadius: BorderRadius.circular(999),
|
||||
),
|
||||
child: const Text(
|
||||
'已停用',
|
||||
style: TextStyle(fontSize: 9.5, color: kWtMuted),
|
||||
),
|
||||
),
|
||||
const Spacer(),
|
||||
_smallAction('查看', () => _toast('区域详情接口未接入(演示)')),
|
||||
const SizedBox(width: 8),
|
||||
_smallAction('编辑', _openEditor, primary: true),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Widget _smallAction(String text, VoidCallback onTap, {bool primary = false}) {
|
||||
return GestureDetector(
|
||||
onTap: onTap,
|
||||
behavior: HitTestBehavior.opaque,
|
||||
child: Container(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 10, vertical: 5),
|
||||
decoration: BoxDecoration(
|
||||
color: primary ? kWtSoftBlue : kWtSegBg,
|
||||
borderRadius: BorderRadius.circular(9),
|
||||
border: Border.all(color: primary ? kWtBlue : _border),
|
||||
@override
|
||||
Widget build(BuildContext context) => WorkPhoneScaffold(
|
||||
child: Column(
|
||||
children: [
|
||||
WorkPhoneTopBar(
|
||||
title: AppLocalizations.of(context).translate('work_v2.area.title'),
|
||||
onBack: () => Navigator.of(context).maybePop(),
|
||||
),
|
||||
child: Text(
|
||||
text,
|
||||
style: TextStyle(
|
||||
fontSize: 10.5,
|
||||
fontWeight: FontWeight.w700,
|
||||
color: primary ? kWtBlue : kWtGray2,
|
||||
const SizedBox(height: 12),
|
||||
Expanded(
|
||||
child: AbsorbPointer(
|
||||
absorbing: _opening,
|
||||
child: RegionListPanel(
|
||||
cubit: _regions,
|
||||
currentScope: () => _scope,
|
||||
onCreate: () => _openEditor(),
|
||||
onEdit: _openEditor,
|
||||
onSelect: _openEditor,
|
||||
onRefresh: _reload,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -5,7 +5,9 @@ import 'package:flutter_map/flutter_map.dart';
|
||||
import 'package:latlong2/latlong.dart';
|
||||
import 'package:maibu_satabot_v2/components/capsule_toast.dart';
|
||||
import 'package:maibu_satabot_v2/core/di/injection.dart';
|
||||
import 'package:maibu_satabot_v2/core/localization/app_localizations.dart';
|
||||
import 'package:maibu_satabot_v2/features/home/presentation/widgets/map/geoserver_suzhou_layer.dart';
|
||||
import 'package:maibu_satabot_v2/features/home/presentation/widgets/map/app_base_map_layer.dart';
|
||||
import 'package:maibu_satabot_v2/features/v2/device_list/presentation/pages/route_editor_page_v2.dart';
|
||||
import 'package:maibu_satabot_v2/features/v2/site/presentation/cubit/site_cubit.dart';
|
||||
|
||||
@@ -42,19 +44,32 @@ class _WorkMapPageV2State extends State<WorkMapPageV2> {
|
||||
static const Color _forbid = Color(0xFFFF5C5C);
|
||||
static const Color _routeLine = Color(0xFF00E5C0);
|
||||
|
||||
static const String _esriUrl =
|
||||
'https://server.arcgisonline.com/ArcGIS/rest/services/World_Imagery/MapServer/tile/{z}/{y}/{x}';
|
||||
|
||||
/// 图层筛选:0 全部 / 1 作业区 / 2 机器人 / 3 禁行区 / 4 路线
|
||||
static const List<String> _layers = <String>[
|
||||
'全部图层',
|
||||
'作业区',
|
||||
'机器人',
|
||||
'禁行区',
|
||||
'路线',
|
||||
static const List<String> _layerKeys = <String>[
|
||||
'all',
|
||||
'area',
|
||||
'robot',
|
||||
'forbidden',
|
||||
'route',
|
||||
];
|
||||
int _layer = 0;
|
||||
|
||||
/// 图层代码 -> 当前语言文案
|
||||
String _layerLabel(AppLocalizations l10n, String key) {
|
||||
switch (key) {
|
||||
case 'all':
|
||||
return l10n.translate('work_v2.map.layer_all');
|
||||
case 'area':
|
||||
return l10n.translate('work_v2.map.layer_area');
|
||||
case 'robot':
|
||||
return l10n.translate('work_v2.map.layer_robot');
|
||||
case 'forbidden':
|
||||
return l10n.translate('work_v2.map.layer_forbidden');
|
||||
default:
|
||||
return l10n.translate('work_v2.map.layer_route');
|
||||
}
|
||||
}
|
||||
|
||||
late final LatLng _center = _resolveCenter();
|
||||
late final _DemoGeometry _geo = _DemoGeometry(_center);
|
||||
|
||||
@@ -128,6 +143,7 @@ class _WorkMapPageV2State extends State<WorkMapPageV2> {
|
||||
|
||||
// ===== 顶栏 =====
|
||||
Widget _buildTopBar() {
|
||||
final l10n = AppLocalizations.of(context);
|
||||
return Row(
|
||||
children: [
|
||||
_squareButton(
|
||||
@@ -136,9 +152,9 @@ class _WorkMapPageV2State extends State<WorkMapPageV2> {
|
||||
onTap: () => Navigator.of(context).maybePop(),
|
||||
),
|
||||
const SizedBox(width: 10),
|
||||
const Text(
|
||||
'作业地图',
|
||||
style: TextStyle(
|
||||
Text(
|
||||
l10n.translate('work_v2.map.title'),
|
||||
style: const TextStyle(
|
||||
fontSize: 18,
|
||||
fontWeight: FontWeight.w800,
|
||||
color: _navy,
|
||||
@@ -148,7 +164,7 @@ class _WorkMapPageV2State extends State<WorkMapPageV2> {
|
||||
_squareButton(
|
||||
Icons.description_outlined,
|
||||
size: 18,
|
||||
onTap: () => _toast('作业记录入口未接入(演示)'),
|
||||
onTap: () => _toast(l10n.translate('work_v2.map.toast_record_todo')),
|
||||
),
|
||||
],
|
||||
);
|
||||
@@ -177,25 +193,26 @@ class _WorkMapPageV2State extends State<WorkMapPageV2> {
|
||||
|
||||
// ===== 标题区 =====
|
||||
Widget _buildHeader() {
|
||||
final l10n = AppLocalizations.of(context);
|
||||
return Row(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
const Expanded(
|
||||
Expanded(
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text(
|
||||
'作业地图',
|
||||
style: TextStyle(
|
||||
l10n.translate('work_v2.map.title'),
|
||||
style: const TextStyle(
|
||||
fontSize: 24,
|
||||
fontWeight: FontWeight.w800,
|
||||
color: _navy,
|
||||
),
|
||||
),
|
||||
SizedBox(height: 5),
|
||||
const SizedBox(height: 5),
|
||||
Text(
|
||||
'机器人、区域和任务在同一张场站地图上',
|
||||
style: TextStyle(fontSize: 12, color: _gray),
|
||||
l10n.translate('work_v2.map.subtitle'),
|
||||
style: const TextStyle(fontSize: 12, color: _gray),
|
||||
),
|
||||
],
|
||||
),
|
||||
@@ -207,9 +224,9 @@ class _WorkMapPageV2State extends State<WorkMapPageV2> {
|
||||
color: _greenBg,
|
||||
borderRadius: BorderRadius.circular(999),
|
||||
),
|
||||
child: const Text(
|
||||
'3台在线',
|
||||
style: TextStyle(
|
||||
child: Text(
|
||||
l10n.translate('work_v2.map.online_count').replaceAll('%s', '3'),
|
||||
style: const TextStyle(
|
||||
fontSize: 11,
|
||||
fontWeight: FontWeight.w700,
|
||||
color: _green,
|
||||
@@ -222,11 +239,12 @@ class _WorkMapPageV2State extends State<WorkMapPageV2> {
|
||||
|
||||
// ===== 图层筛选 =====
|
||||
Widget _buildLayerChips() {
|
||||
final l10n = AppLocalizations.of(context);
|
||||
return SizedBox(
|
||||
height: 32,
|
||||
child: ListView.separated(
|
||||
scrollDirection: Axis.horizontal,
|
||||
itemCount: _layers.length,
|
||||
itemCount: _layerKeys.length,
|
||||
separatorBuilder: (_, _) => const SizedBox(width: 8),
|
||||
itemBuilder: (context, index) {
|
||||
final selected = _layer == index;
|
||||
@@ -245,7 +263,7 @@ class _WorkMapPageV2State extends State<WorkMapPageV2> {
|
||||
),
|
||||
),
|
||||
child: Text(
|
||||
_layers[index],
|
||||
_layerLabel(l10n, _layerKeys[index]),
|
||||
style: TextStyle(
|
||||
fontSize: 12.5,
|
||||
fontWeight: selected ? FontWeight.w700 : FontWeight.w500,
|
||||
@@ -292,9 +310,11 @@ class _WorkMapPageV2State extends State<WorkMapPageV2> {
|
||||
color: Colors.white.withValues(alpha: 0.92),
|
||||
borderRadius: BorderRadius.circular(8),
|
||||
),
|
||||
child: const Text(
|
||||
'正射影像 · 山东场站',
|
||||
style: TextStyle(
|
||||
child: Text(
|
||||
AppLocalizations.of(
|
||||
context,
|
||||
).translate('work_v2.map.basemap_label'),
|
||||
style: const TextStyle(
|
||||
fontSize: 11,
|
||||
fontWeight: FontWeight.w700,
|
||||
color: _navy,
|
||||
@@ -310,7 +330,11 @@ class _WorkMapPageV2State extends State<WorkMapPageV2> {
|
||||
children: [
|
||||
_mapFloatButton(
|
||||
Icons.layers_outlined,
|
||||
onTap: () => _toast('图层设置与顶部筛选联动(演示)'),
|
||||
onTap: () => _toast(
|
||||
AppLocalizations.of(
|
||||
context,
|
||||
).translate('work_v2.map.toast_layer_todo'),
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 8),
|
||||
_mapFloatButton(Icons.place_outlined, onTap: _resetView),
|
||||
@@ -365,12 +389,8 @@ class _WorkMapPageV2State extends State<WorkMapPageV2> {
|
||||
),
|
||||
),
|
||||
children: [
|
||||
TileLayer(
|
||||
urlTemplate: _esriUrl,
|
||||
userAgentPackageName: 'com.maibu.maibu_satabot_v2',
|
||||
minZoom: 0,
|
||||
maxZoom: 19,
|
||||
),
|
||||
// 底图:中文=ESRI,非中文=Google(不可达自动回退 ESRI)
|
||||
const AppBaseMapLayer(maxZoom: 22),
|
||||
// 地块边界(白色细线,跟随作业区一起显隐)
|
||||
if (_showAreas)
|
||||
PolylineLayer(
|
||||
@@ -457,10 +477,13 @@ class _WorkMapPageV2State extends State<WorkMapPageV2> {
|
||||
/// 定位按钮:把视图拉回场站中心(本页不接实时定位推送)
|
||||
void _resetView() {
|
||||
_map.move(_center, 18);
|
||||
_toast('已回到场站中心(演示)');
|
||||
_toast(
|
||||
AppLocalizations.of(context).translate('work_v2.map.toast_center_reset'),
|
||||
);
|
||||
}
|
||||
|
||||
Widget _buildTaskCard() {
|
||||
final l10n = AppLocalizations.of(context);
|
||||
return Container(
|
||||
padding: const EdgeInsets.fromLTRB(14, 12, 14, 12),
|
||||
decoration: BoxDecoration(
|
||||
@@ -480,12 +503,12 @@ class _WorkMapPageV2State extends State<WorkMapPageV2> {
|
||||
children: [
|
||||
Row(
|
||||
children: [
|
||||
const Expanded(
|
||||
Expanded(
|
||||
child: Text(
|
||||
'A区 · 自主割草',
|
||||
l10n.translate('work_v2.demo_task_zone_a'),
|
||||
maxLines: 1,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
style: TextStyle(
|
||||
style: const TextStyle(
|
||||
fontSize: 15,
|
||||
fontWeight: FontWeight.w800,
|
||||
color: _navy,
|
||||
@@ -510,22 +533,30 @@ class _WorkMapPageV2State extends State<WorkMapPageV2> {
|
||||
],
|
||||
),
|
||||
const SizedBox(height: 4),
|
||||
const Text(
|
||||
'设备:山东01号机 · 任务执行中',
|
||||
Text(
|
||||
l10n
|
||||
.translate('work_v2.map.task_device')
|
||||
.replaceAll('%s', l10n.translate('work_v2.demo_robot_1')),
|
||||
maxLines: 1,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
style: TextStyle(fontSize: 12, color: _gray),
|
||||
style: const TextStyle(fontSize: 12, color: _gray),
|
||||
),
|
||||
const SizedBox(height: 10),
|
||||
Row(
|
||||
children: [
|
||||
_cardButton('管理区域', primary: false, onTap: _openAreaEditor),
|
||||
_cardButton(
|
||||
l10n.translate('work_v2.map.manage_area'),
|
||||
primary: false,
|
||||
onTap: _openAreaEditor,
|
||||
),
|
||||
const SizedBox(width: 8),
|
||||
Expanded(
|
||||
child: _cardButton(
|
||||
'进入作业中心',
|
||||
l10n.translate('work_v2.enter_work_center'),
|
||||
primary: true,
|
||||
onTap: () => _toast('作业中心需从设备详情进入(演示)'),
|
||||
onTap: () => _toast(
|
||||
l10n.translate('work_v2.map.toast_work_center_todo'),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,10 +1,12 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:maibu_satabot_v2/components/capsule_toast.dart';
|
||||
import 'package:maibu_satabot_v2/core/localization/app_localizations.dart';
|
||||
import 'package:maibu_satabot_v2/features/v2/device_list/presentation/widgets/autonomous/work_ui.dart';
|
||||
import 'package:maibu_satabot_v2/features/v2/work/presentation/pages/work_plan_create_page_v2.dart';
|
||||
import 'package:maibu_satabot_v2/features/v2/work/presentation/pages/work_report_page_v2.dart';
|
||||
import 'package:maibu_satabot_v2/features/v2/work/presentation/widgets/work_phone_ui.dart';
|
||||
|
||||
/// 任务列表与计划(W07)——作业首页「作业计划」入口进入。
|
||||
/// 任务列表与计划(W07)——作业首页「下发作业计划」入口进入。
|
||||
///
|
||||
/// 竖屏单页:按日期分组的时间线,每张卡是一段作业计划,
|
||||
/// 顶部筛选用状态过滤,右上日历与「+ 新建计划」为演示入口。
|
||||
@@ -52,11 +54,16 @@ class _DemoDay {
|
||||
const _DemoDay({
|
||||
required this.label,
|
||||
required this.date,
|
||||
required this.weekday,
|
||||
required this.plans,
|
||||
});
|
||||
|
||||
/// today / tomorrow / yesterday
|
||||
final String label;
|
||||
|
||||
/// 月-日,星期通过 weekday 的代码取文案
|
||||
final String date;
|
||||
final String weekday;
|
||||
final List<_DemoPlan> plans;
|
||||
}
|
||||
|
||||
@@ -68,77 +75,80 @@ class _WorkPlanPageV2State extends State<WorkPlanPageV2> {
|
||||
static const Color _orange = Color(0xFFEE9A2E);
|
||||
static const Color _red = Color(0xFFF0483E);
|
||||
|
||||
static const List<String> _filters = <String>['全部', '执行中', '待执行', '已完成'];
|
||||
/// 筛选顺序:全部 / 执行中 / 待执行 / 已完成
|
||||
int _filter = 0;
|
||||
|
||||
static const List<_DemoDay> _days = <_DemoDay>[
|
||||
_DemoDay(
|
||||
label: '今天',
|
||||
date: '10-27 周二',
|
||||
label: 'today',
|
||||
date: '10-27',
|
||||
weekday: 'tue',
|
||||
plans: <_DemoPlan>[
|
||||
_DemoPlan(
|
||||
time: '08:00',
|
||||
title: 'A区 · 自主割草',
|
||||
zone: 'A 区 · 主草坪',
|
||||
robot: '山东01号机',
|
||||
routeName: 'A区路线01',
|
||||
title: 'work_v2.demo_task_zone_a',
|
||||
zone: 'work_v2.area.demo_zone_a',
|
||||
robot: 'work_v2.demo_robot_1',
|
||||
routeName: 'work_v2.demo_route_a1',
|
||||
status: _PlanStatus.running,
|
||||
progress: 0.68,
|
||||
),
|
||||
_DemoPlan(
|
||||
time: '14:30',
|
||||
title: 'C区 · 苗圃修剪',
|
||||
zone: 'C 区 · 苗圃',
|
||||
robot: '山东02号机',
|
||||
routeName: 'C区覆盖01',
|
||||
title: 'work_v2.demo_task_c_trim',
|
||||
zone: 'work_v2.area.demo_zone_c',
|
||||
robot: 'work_v2.demo_robot_2',
|
||||
routeName: 'work_v2.route_lib.demo_route_c_cov',
|
||||
status: _PlanStatus.pending,
|
||||
progress: 0,
|
||||
),
|
||||
],
|
||||
),
|
||||
_DemoDay(
|
||||
label: '明天',
|
||||
date: '10-28 周三',
|
||||
label: 'tomorrow',
|
||||
date: '10-28',
|
||||
weekday: 'wed',
|
||||
plans: <_DemoPlan>[
|
||||
_DemoPlan(
|
||||
time: '08:00',
|
||||
title: 'B区 · 清晨割草',
|
||||
zone: 'B 区 · 东侧草坪',
|
||||
robot: '山东02号机',
|
||||
routeName: 'B区路线01',
|
||||
title: 'work_v2.demo_zone_b_task',
|
||||
zone: 'work_v2.area.demo_zone_b',
|
||||
robot: 'work_v2.demo_robot_2',
|
||||
routeName: 'work_v2.demo_route_b1',
|
||||
status: _PlanStatus.pending,
|
||||
progress: 0,
|
||||
),
|
||||
_DemoPlan(
|
||||
time: '16:00',
|
||||
title: '全场 · 沿边修整',
|
||||
zone: '全场',
|
||||
robot: '山东03号机',
|
||||
routeName: 'B区沿边01',
|
||||
title: 'work_v2.demo_task_all_edge',
|
||||
zone: 'work_v2.area.demo_zone_all',
|
||||
robot: 'work_v2.demo_robot_3',
|
||||
routeName: 'work_v2.route_lib.demo_route_b_edge',
|
||||
status: _PlanStatus.pending,
|
||||
progress: 0,
|
||||
),
|
||||
],
|
||||
),
|
||||
_DemoDay(
|
||||
label: '昨天',
|
||||
date: '10-26 周一',
|
||||
label: 'yesterday',
|
||||
date: '10-26',
|
||||
weekday: 'mon',
|
||||
plans: <_DemoPlan>[
|
||||
_DemoPlan(
|
||||
time: '08:00',
|
||||
title: 'B区 · 清晨割草',
|
||||
zone: 'B 区 · 东侧草坪',
|
||||
robot: '山东02号机',
|
||||
routeName: 'B区路线01',
|
||||
title: 'work_v2.demo_zone_b_task',
|
||||
zone: 'work_v2.area.demo_zone_b',
|
||||
robot: 'work_v2.demo_robot_2',
|
||||
routeName: 'work_v2.demo_route_b1',
|
||||
status: _PlanStatus.done,
|
||||
progress: 1,
|
||||
),
|
||||
_DemoPlan(
|
||||
time: '09:10',
|
||||
title: 'C区 · 雨后补割',
|
||||
zone: 'C 区 · 苗圃',
|
||||
robot: '山东01号机',
|
||||
routeName: 'C区覆盖01',
|
||||
title: 'work_v2.demo_task_c_retry',
|
||||
zone: 'work_v2.area.demo_zone_c',
|
||||
robot: 'work_v2.demo_robot_1',
|
||||
routeName: 'work_v2.route_lib.demo_route_c_cov',
|
||||
status: _PlanStatus.aborted,
|
||||
progress: 0.42,
|
||||
),
|
||||
@@ -146,6 +156,14 @@ class _WorkPlanPageV2State extends State<WorkPlanPageV2> {
|
||||
),
|
||||
];
|
||||
|
||||
/// 顶部筛选文案(顺序:全部 / 执行中 / 待执行 / 已完成)
|
||||
List<String> _filterLabels(AppLocalizations l10n) => <String>[
|
||||
l10n.translate('work_v2.plan.filter_all'),
|
||||
l10n.translate('work_v2.plan.status_running'),
|
||||
l10n.translate('work_v2.plan.status_pending'),
|
||||
l10n.translate('work_v2.plan.status_done'),
|
||||
];
|
||||
|
||||
void _toast(String text) => CapsuleToast.show(text, showCheck: false);
|
||||
|
||||
/// 当前筛选下的分组(分组内无匹配则整组隐藏)
|
||||
@@ -160,7 +178,14 @@ class _WorkPlanPageV2State extends State<WorkPlanPageV2> {
|
||||
for (final day in _days) {
|
||||
final plans = day.plans.where((p) => p.status == want).toList();
|
||||
if (plans.isNotEmpty) {
|
||||
out.add(_DemoDay(label: day.label, date: day.date, plans: plans));
|
||||
out.add(
|
||||
_DemoDay(
|
||||
label: day.label,
|
||||
date: day.date,
|
||||
weekday: day.weekday,
|
||||
plans: plans,
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
return out;
|
||||
@@ -168,58 +193,63 @@ class _WorkPlanPageV2State extends State<WorkPlanPageV2> {
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final l10n = AppLocalizations.of(context);
|
||||
final days = _visible;
|
||||
return WorkPhoneScaffold(
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.stretch,
|
||||
children: [
|
||||
WorkPhoneTopBar(
|
||||
title: '作业计划',
|
||||
title: l10n.translate('work_v2.plan.title'),
|
||||
onBack: () => Navigator.of(context).maybePop(),
|
||||
trailing: Row(
|
||||
children: [
|
||||
WorkSquareButton(
|
||||
icon: Icons.calendar_month_outlined,
|
||||
size: 17,
|
||||
onTap: () => _toast('日历视图接口未接入(演示)'),
|
||||
onTap: () =>
|
||||
_toast(l10n.translate('work_v2.plan.toast_calendar_todo')),
|
||||
),
|
||||
const SizedBox(width: 8),
|
||||
WorkSquareButton(
|
||||
icon: Icons.add_rounded,
|
||||
label: '新建',
|
||||
label: l10n.translate('work_v2.plan.new'),
|
||||
primary: true,
|
||||
onTap: () => _toast('任务编排接口未接入(演示)'),
|
||||
onTap: () =>
|
||||
Navigator.of(
|
||||
context,
|
||||
).push(WorkPlanCreatePageV2.route()),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 12),
|
||||
const WorkPageHeading(
|
||||
title: '任务列表与计划',
|
||||
subtitle: '按日期排布作业任务,执行中的任务会实时推进进度',
|
||||
WorkPageHeading(
|
||||
title: l10n.translate('work_v2.plan.page_title'),
|
||||
subtitle: l10n.translate('work_v2.plan.page_subtitle'),
|
||||
),
|
||||
const SizedBox(height: 12),
|
||||
WorkFilterRow(
|
||||
items: _filters,
|
||||
items: _filterLabels(l10n),
|
||||
index: _filter,
|
||||
onChanged: (i) => setState(() => _filter = i),
|
||||
),
|
||||
const SizedBox(height: 12),
|
||||
Expanded(
|
||||
child: days.isEmpty
|
||||
? _buildEmpty()
|
||||
? _buildEmpty(l10n)
|
||||
: ListView(
|
||||
padding: const EdgeInsets.only(bottom: 8),
|
||||
children: [
|
||||
for (final day in days) ...[
|
||||
_buildDayHeader(day),
|
||||
_buildDayHeader(l10n, day),
|
||||
const SizedBox(height: 8),
|
||||
for (var i = 0; i < day.plans.length; i++)
|
||||
Padding(
|
||||
padding: EdgeInsets.only(
|
||||
bottom: i == day.plans.length - 1 ? 0 : 10,
|
||||
),
|
||||
child: _buildPlanCard(day.plans[i]),
|
||||
child: _buildPlanCard(l10n, day.plans[i]),
|
||||
),
|
||||
const SizedBox(height: 14),
|
||||
],
|
||||
@@ -231,7 +261,7 @@ class _WorkPlanPageV2State extends State<WorkPlanPageV2> {
|
||||
);
|
||||
}
|
||||
|
||||
Widget _buildEmpty() {
|
||||
Widget _buildEmpty(AppLocalizations l10n) {
|
||||
return Center(
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
@@ -250,9 +280,9 @@ class _WorkPlanPageV2State extends State<WorkPlanPageV2> {
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 10),
|
||||
const Text(
|
||||
'暂无该状态的作业计划',
|
||||
style: TextStyle(fontSize: 12.5, color: _gray),
|
||||
Text(
|
||||
l10n.translate('work_v2.plan.empty'),
|
||||
style: const TextStyle(fontSize: 12.5, color: _gray),
|
||||
),
|
||||
],
|
||||
),
|
||||
@@ -260,8 +290,8 @@ class _WorkPlanPageV2State extends State<WorkPlanPageV2> {
|
||||
}
|
||||
|
||||
// ===== 日期分组头 =====
|
||||
Widget _buildDayHeader(_DemoDay day) {
|
||||
final bool today = day.label == '今天';
|
||||
Widget _buildDayHeader(AppLocalizations l10n, _DemoDay day) {
|
||||
final bool today = day.label == 'today';
|
||||
return Row(
|
||||
children: [
|
||||
Container(
|
||||
@@ -274,7 +304,7 @@ class _WorkPlanPageV2State extends State<WorkPlanPageV2> {
|
||||
),
|
||||
const SizedBox(width: 7),
|
||||
Text(
|
||||
day.label,
|
||||
l10n.translate('work_v2.plan.day_${day.label}'),
|
||||
style: TextStyle(
|
||||
fontSize: 13.5,
|
||||
fontWeight: FontWeight.w800,
|
||||
@@ -282,10 +312,15 @@ class _WorkPlanPageV2State extends State<WorkPlanPageV2> {
|
||||
),
|
||||
),
|
||||
const SizedBox(width: 6),
|
||||
Text(day.date, style: const TextStyle(fontSize: 11, color: _gray)),
|
||||
Text(
|
||||
'${day.date} ${l10n.translate('work_v2.plan.weekday_${day.weekday}')}',
|
||||
style: const TextStyle(fontSize: 11, color: _gray),
|
||||
),
|
||||
const Spacer(),
|
||||
Text(
|
||||
'${day.plans.length} 个任务',
|
||||
l10n
|
||||
.translate('work_v2.plan.task_count')
|
||||
.replaceAll('%s', '${day.plans.length}'),
|
||||
style: const TextStyle(fontSize: 10.5, color: kWtHint),
|
||||
),
|
||||
],
|
||||
@@ -293,12 +328,28 @@ class _WorkPlanPageV2State extends State<WorkPlanPageV2> {
|
||||
}
|
||||
|
||||
// ===== 计划卡 =====
|
||||
Widget _buildPlanCard(_DemoPlan p) {
|
||||
Widget _buildPlanCard(AppLocalizations l10n, _DemoPlan p) {
|
||||
final (Color color, Color bg, String label) = switch (p.status) {
|
||||
_PlanStatus.running => (kWtBlue, kWtSoftBlue, '执行中'),
|
||||
_PlanStatus.pending => (_orange, kWtWarnBg, '待执行'),
|
||||
_PlanStatus.done => (_green, kWtGreenBg, '已完成'),
|
||||
_PlanStatus.aborted => (_red, const Color(0xFFFDECEB), '已中止'),
|
||||
_PlanStatus.running => (
|
||||
kWtBlue,
|
||||
kWtSoftBlue,
|
||||
l10n.translate('work_v2.plan.status_running'),
|
||||
),
|
||||
_PlanStatus.pending => (
|
||||
_orange,
|
||||
kWtWarnBg,
|
||||
l10n.translate('work_v2.plan.status_pending'),
|
||||
),
|
||||
_PlanStatus.done => (
|
||||
_green,
|
||||
kWtGreenBg,
|
||||
l10n.translate('work_v2.plan.status_done'),
|
||||
),
|
||||
_PlanStatus.aborted => (
|
||||
_red,
|
||||
const Color(0xFFFDECEB),
|
||||
l10n.translate('work_v2.plan.status_aborted'),
|
||||
),
|
||||
};
|
||||
|
||||
return Container(
|
||||
@@ -336,9 +387,9 @@ class _WorkPlanPageV2State extends State<WorkPlanPageV2> {
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 1),
|
||||
const Text(
|
||||
'开始',
|
||||
style: TextStyle(fontSize: 8.5, color: kWtHint),
|
||||
Text(
|
||||
l10n.translate('work_v2.plan.start'),
|
||||
style: const TextStyle(fontSize: 8.5, color: kWtHint),
|
||||
),
|
||||
],
|
||||
),
|
||||
@@ -352,7 +403,7 @@ class _WorkPlanPageV2State extends State<WorkPlanPageV2> {
|
||||
children: [
|
||||
Expanded(
|
||||
child: Text(
|
||||
p.title,
|
||||
l10n.translate(p.title),
|
||||
maxLines: 1,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
style: const TextStyle(
|
||||
@@ -385,7 +436,7 @@ class _WorkPlanPageV2State extends State<WorkPlanPageV2> {
|
||||
),
|
||||
const SizedBox(height: 4),
|
||||
Text(
|
||||
'${p.zone} · ${p.robot}',
|
||||
'${l10n.translate(p.zone)} · ${l10n.translate(p.robot)}',
|
||||
maxLines: 1,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
style: const TextStyle(fontSize: 11, color: _gray),
|
||||
@@ -417,7 +468,7 @@ class _WorkPlanPageV2State extends State<WorkPlanPageV2> {
|
||||
const SizedBox(width: 3),
|
||||
Expanded(
|
||||
child: Text(
|
||||
p.routeName,
|
||||
l10n.translate(p.routeName),
|
||||
maxLines: 1,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
style: const TextStyle(fontSize: 10.5, color: kWtHint),
|
||||
@@ -440,24 +491,32 @@ class _WorkPlanPageV2State extends State<WorkPlanPageV2> {
|
||||
// 已结束的计划:直接看这一票的单次作业报告
|
||||
Navigator.of(
|
||||
context,
|
||||
).push(WorkReportPageV2.route(taskName: p.title));
|
||||
).push(
|
||||
WorkReportPageV2.route(
|
||||
taskName: l10n.translate(p.title),
|
||||
),
|
||||
);
|
||||
} else {
|
||||
_toast('计划详情接口未接入(演示)');
|
||||
_toast(l10n.translate('work_v2.plan.toast_detail_todo'));
|
||||
}
|
||||
},
|
||||
behavior: HitTestBehavior.opaque,
|
||||
child: const Row(
|
||||
child: Row(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
Text(
|
||||
'详情',
|
||||
style: TextStyle(
|
||||
l10n.translate('work_v2.plan.detail'),
|
||||
style: const TextStyle(
|
||||
fontSize: 10.5,
|
||||
fontWeight: FontWeight.w700,
|
||||
color: kWtBlue,
|
||||
),
|
||||
),
|
||||
Icon(Icons.chevron_right_rounded, size: 15, color: kWtBlue),
|
||||
const Icon(
|
||||
Icons.chevron_right_rounded,
|
||||
size: 15,
|
||||
color: kWtBlue,
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:maibu_satabot_v2/components/capsule_toast.dart';
|
||||
import 'package:maibu_satabot_v2/core/localization/app_localizations.dart';
|
||||
import 'package:maibu_satabot_v2/features/v2/device_list/presentation/widgets/autonomous/work_ui.dart';
|
||||
import 'package:maibu_satabot_v2/features/v2/work/presentation/pages/work_report_page_v2.dart';
|
||||
import 'package:maibu_satabot_v2/features/v2/work/presentation/widgets/work_phone_ui.dart';
|
||||
@@ -48,13 +49,13 @@ class _WorkRecordPageV2State extends State<WorkRecordPageV2> {
|
||||
static const Color _green = Color(0xFF00B42A);
|
||||
static const Color _abort = Color(0xFFF0483E);
|
||||
|
||||
static const List<String> _filters = <String>['全部', '已完成', '已中止', '本周'];
|
||||
/// 筛选顺序:全部 / 已完成 / 已中止 / 本周
|
||||
int _filter = 0;
|
||||
|
||||
static const List<_DemoRecord> _records = <_DemoRecord>[
|
||||
_DemoRecord(
|
||||
title: 'B区 · 清晨割草',
|
||||
robot: '山东02号机',
|
||||
title: 'work_v2.demo_zone_b_task',
|
||||
robot: 'work_v2.demo_robot_2',
|
||||
date: '2026-10-26 08:00',
|
||||
area: '2 860 m²',
|
||||
duration: '2 h 42 min',
|
||||
@@ -62,8 +63,8 @@ class _WorkRecordPageV2State extends State<WorkRecordPageV2> {
|
||||
coverage: '98.6%',
|
||||
),
|
||||
_DemoRecord(
|
||||
title: 'A区 · 定点巡检',
|
||||
robot: '山东01号机',
|
||||
title: 'work_v2.demo_task_a_inspect',
|
||||
robot: 'work_v2.demo_robot_1',
|
||||
date: '2026-10-25 16:20',
|
||||
area: '1 240 m²',
|
||||
duration: '1 h 05 min',
|
||||
@@ -71,8 +72,8 @@ class _WorkRecordPageV2State extends State<WorkRecordPageV2> {
|
||||
coverage: '97.2%',
|
||||
),
|
||||
_DemoRecord(
|
||||
title: 'C区 · 雨后补割',
|
||||
robot: '山东01号机',
|
||||
title: 'work_v2.demo_task_c_retry',
|
||||
robot: 'work_v2.demo_robot_1',
|
||||
date: '2026-10-25 09:10',
|
||||
area: '640 m²',
|
||||
duration: '0 h 38 min',
|
||||
@@ -80,8 +81,8 @@ class _WorkRecordPageV2State extends State<WorkRecordPageV2> {
|
||||
coverage: '42.5%',
|
||||
),
|
||||
_DemoRecord(
|
||||
title: 'A区 · 自主割草',
|
||||
robot: '山东02号机',
|
||||
title: 'work_v2.demo_task_zone_a',
|
||||
robot: 'work_v2.demo_robot_2',
|
||||
date: '2026-10-24 14:00',
|
||||
area: '3 120 m²',
|
||||
duration: '3 h 12 min',
|
||||
@@ -89,8 +90,8 @@ class _WorkRecordPageV2State extends State<WorkRecordPageV2> {
|
||||
coverage: '99.1%',
|
||||
),
|
||||
_DemoRecord(
|
||||
title: 'D区 · 边界修整',
|
||||
robot: '山东03号机',
|
||||
title: 'work_v2.demo_task_d_edge',
|
||||
robot: 'work_v2.demo_robot_3',
|
||||
date: '2026-10-23 10:30',
|
||||
area: '980 m²',
|
||||
duration: '1 h 12 min',
|
||||
@@ -99,6 +100,14 @@ class _WorkRecordPageV2State extends State<WorkRecordPageV2> {
|
||||
),
|
||||
];
|
||||
|
||||
/// 顶部筛选文案(顺序:全部 / 已完成 / 已中止 / 本周)
|
||||
List<String> _filterLabels(AppLocalizations l10n) => <String>[
|
||||
l10n.translate('work_v2.record.filter_all'),
|
||||
l10n.translate('work_v2.record.filter_done'),
|
||||
l10n.translate('work_v2.record.filter_aborted'),
|
||||
l10n.translate('work_v2.record.filter_week'),
|
||||
];
|
||||
|
||||
void _toast(String text) => CapsuleToast.show(text, showCheck: false);
|
||||
|
||||
/// 当前筛选下要显示的记录
|
||||
@@ -117,47 +126,54 @@ class _WorkRecordPageV2State extends State<WorkRecordPageV2> {
|
||||
}
|
||||
|
||||
void _openReport(_DemoRecord r) {
|
||||
Navigator.of(context).push(WorkReportPageV2.route(taskName: r.title));
|
||||
Navigator.of(context).push(
|
||||
WorkReportPageV2.route(
|
||||
taskName: AppLocalizations.of(context).translate(r.title),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final l10n = AppLocalizations.of(context);
|
||||
final records = _visible;
|
||||
return WorkPhoneScaffold(
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.stretch,
|
||||
children: [
|
||||
WorkPhoneTopBar(
|
||||
title: '作业记录',
|
||||
title: l10n.translate('work_v2.record.title'),
|
||||
onBack: () => Navigator.of(context).maybePop(),
|
||||
trailing: WorkSquareButton(
|
||||
icon: Icons.file_download_outlined,
|
||||
size: 17,
|
||||
onTap: () => _toast('批量导出接口未接入(演示)'),
|
||||
onTap: () =>
|
||||
_toast(l10n.translate('work_v2.record.toast_export_todo')),
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 12),
|
||||
const WorkPageHeading(
|
||||
title: '作业记录',
|
||||
subtitle: '按月归档每一次作业,点开可查看单次作业报告',
|
||||
WorkPageHeading(
|
||||
title: l10n.translate('work_v2.record.title'),
|
||||
subtitle: l10n.translate('work_v2.record.page_subtitle'),
|
||||
),
|
||||
const SizedBox(height: 12),
|
||||
_buildSummary(),
|
||||
_buildSummary(l10n),
|
||||
const SizedBox(height: 12),
|
||||
WorkFilterRow(
|
||||
items: _filters,
|
||||
items: _filterLabels(l10n),
|
||||
index: _filter,
|
||||
onChanged: (i) => setState(() => _filter = i),
|
||||
),
|
||||
const SizedBox(height: 12),
|
||||
Expanded(
|
||||
child: records.isEmpty
|
||||
? _buildEmpty()
|
||||
? _buildEmpty(l10n)
|
||||
: ListView.separated(
|
||||
padding: const EdgeInsets.only(bottom: 8),
|
||||
itemCount: records.length,
|
||||
separatorBuilder: (_, _) => const SizedBox(height: 10),
|
||||
itemBuilder: (context, i) => _buildRecordCard(records[i]),
|
||||
itemBuilder: (context, i) =>
|
||||
_buildRecordCard(l10n, records[i]),
|
||||
),
|
||||
),
|
||||
],
|
||||
@@ -166,7 +182,7 @@ class _WorkRecordPageV2State extends State<WorkRecordPageV2> {
|
||||
}
|
||||
|
||||
// ===== 本月汇总 =====
|
||||
Widget _buildSummary() {
|
||||
Widget _buildSummary(AppLocalizations l10n) {
|
||||
return Container(
|
||||
padding: const EdgeInsets.fromLTRB(14, 12, 14, 12),
|
||||
decoration: BoxDecoration(
|
||||
@@ -189,9 +205,9 @@ class _WorkRecordPageV2State extends State<WorkRecordPageV2> {
|
||||
children: [
|
||||
Row(
|
||||
children: [
|
||||
const Text(
|
||||
'本月作业',
|
||||
style: TextStyle(
|
||||
Text(
|
||||
l10n.translate('work_v2.record.summary_title'),
|
||||
style: const TextStyle(
|
||||
fontSize: 13,
|
||||
fontWeight: FontWeight.w700,
|
||||
color: Colors.white,
|
||||
@@ -217,10 +233,19 @@ class _WorkRecordPageV2State extends State<WorkRecordPageV2> {
|
||||
),
|
||||
const SizedBox(height: 12),
|
||||
Row(
|
||||
children: const [
|
||||
_SummaryCell(value: '18', label: '作业次数'),
|
||||
_SummaryCell(value: '4.6', label: '累计面积(亩)'),
|
||||
_SummaryCell(value: '21.3', label: '作业时长(h)'),
|
||||
children: [
|
||||
_SummaryCell(
|
||||
value: '18',
|
||||
label: l10n.translate('work_v2.record.summary_count'),
|
||||
),
|
||||
_SummaryCell(
|
||||
value: '4.6',
|
||||
label: l10n.translate('work_v2.record.summary_area'),
|
||||
),
|
||||
_SummaryCell(
|
||||
value: '21.3',
|
||||
label: l10n.translate('work_v2.record.summary_hours'),
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
@@ -228,7 +253,7 @@ class _WorkRecordPageV2State extends State<WorkRecordPageV2> {
|
||||
);
|
||||
}
|
||||
|
||||
Widget _buildEmpty() {
|
||||
Widget _buildEmpty(AppLocalizations l10n) {
|
||||
return Center(
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
@@ -247,9 +272,9 @@ class _WorkRecordPageV2State extends State<WorkRecordPageV2> {
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 10),
|
||||
const Text(
|
||||
'该筛选下暂无作业记录',
|
||||
style: TextStyle(fontSize: 12.5, color: _gray),
|
||||
Text(
|
||||
l10n.translate('work_v2.record.empty'),
|
||||
style: const TextStyle(fontSize: 12.5, color: _gray),
|
||||
),
|
||||
],
|
||||
),
|
||||
@@ -257,7 +282,7 @@ class _WorkRecordPageV2State extends State<WorkRecordPageV2> {
|
||||
}
|
||||
|
||||
// ===== 记录卡 =====
|
||||
Widget _buildRecordCard(_DemoRecord r) {
|
||||
Widget _buildRecordCard(AppLocalizations l10n, _DemoRecord r) {
|
||||
final Color statusColor = r.done ? _green : _abort;
|
||||
final Color statusBg = r.done
|
||||
? const Color(0xFFE8F8EC)
|
||||
@@ -280,7 +305,7 @@ class _WorkRecordPageV2State extends State<WorkRecordPageV2> {
|
||||
children: [
|
||||
Expanded(
|
||||
child: Text(
|
||||
r.title,
|
||||
l10n.translate(r.title),
|
||||
maxLines: 1,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
style: const TextStyle(
|
||||
@@ -301,7 +326,9 @@ class _WorkRecordPageV2State extends State<WorkRecordPageV2> {
|
||||
borderRadius: BorderRadius.circular(999),
|
||||
),
|
||||
child: Text(
|
||||
r.done ? '已完成' : '已中止',
|
||||
r.done
|
||||
? l10n.translate('work_v2.plan.status_done')
|
||||
: l10n.translate('work_v2.plan.status_aborted'),
|
||||
style: TextStyle(
|
||||
fontSize: 10.5,
|
||||
fontWeight: FontWeight.w700,
|
||||
@@ -313,7 +340,7 @@ class _WorkRecordPageV2State extends State<WorkRecordPageV2> {
|
||||
),
|
||||
const SizedBox(height: 5),
|
||||
Text(
|
||||
'${r.robot} · ${r.date}',
|
||||
'${l10n.translate(r.robot)} · ${r.date}',
|
||||
maxLines: 1,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
style: const TextStyle(fontSize: 11.5, color: _gray),
|
||||
@@ -336,9 +363,9 @@ class _WorkRecordPageV2State extends State<WorkRecordPageV2> {
|
||||
),
|
||||
),
|
||||
const SizedBox(width: 6),
|
||||
const Text(
|
||||
'报告',
|
||||
style: TextStyle(
|
||||
Text(
|
||||
l10n.translate('work_v2.record.report'),
|
||||
style: const TextStyle(
|
||||
fontSize: 11.5,
|
||||
fontWeight: FontWeight.w700,
|
||||
color: kWtBlue,
|
||||
|
||||
@@ -2,6 +2,7 @@ import 'package:flutter/material.dart';
|
||||
import 'package:latlong2/latlong.dart';
|
||||
import 'package:maibu_satabot_v2/components/capsule_toast.dart';
|
||||
import 'package:maibu_satabot_v2/core/di/injection.dart';
|
||||
import 'package:maibu_satabot_v2/core/localization/app_localizations.dart';
|
||||
import 'package:maibu_satabot_v2/features/home/presentation/widgets/map/geoserver_suzhou_layer.dart';
|
||||
import 'package:maibu_satabot_v2/features/v2/device_list/presentation/widgets/autonomous/work_ui.dart';
|
||||
import 'package:maibu_satabot_v2/features/v2/site/presentation/cubit/site_cubit.dart';
|
||||
@@ -14,12 +15,12 @@ import 'package:maibu_satabot_v2/features/v2/work/presentation/widgets/work_phon
|
||||
/// 本页为演示页:所有数字都是写死的示例值,不查询真实作业记录,
|
||||
/// 也不做 PDF 导出(点了只提示「导出接口未接入」)。
|
||||
class WorkReportPageV2 extends StatelessWidget {
|
||||
const WorkReportPageV2({super.key, this.taskName = 'B区 · 清晨割草'});
|
||||
const WorkReportPageV2({super.key, this.taskName});
|
||||
|
||||
/// 从记录列表带进来的任务名,仅用于标题展示
|
||||
final String taskName;
|
||||
/// 从记录列表带进来的任务名,仅用于标题展示;为空时用当前语言的演示任务名
|
||||
final String? taskName;
|
||||
|
||||
static Route<void> route({String taskName = 'B区 · 清晨割草'}) {
|
||||
static Route<void> route({String? taskName}) {
|
||||
return MaterialPageRoute<void>(
|
||||
builder: (_) => WorkReportPageV2(taskName: taskName),
|
||||
);
|
||||
@@ -41,17 +42,19 @@ class WorkReportPageV2 extends StatelessWidget {
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final l10n = AppLocalizations.of(context);
|
||||
return WorkPhoneScaffold(
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.stretch,
|
||||
children: [
|
||||
WorkPhoneTopBar(
|
||||
title: '作业报告',
|
||||
title: l10n.translate('work_v2.report.title'),
|
||||
onBack: () => Navigator.of(context).maybePop(),
|
||||
trailing: WorkSquareButton(
|
||||
icon: Icons.ios_share_rounded,
|
||||
size: 17,
|
||||
onTap: () => _toast('分享接口未接入(演示)'),
|
||||
onTap: () =>
|
||||
_toast(l10n.translate('work_v2.report.toast_share_todo')),
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 12),
|
||||
@@ -59,17 +62,17 @@ class WorkReportPageV2 extends StatelessWidget {
|
||||
child: ListView(
|
||||
padding: const EdgeInsets.only(bottom: 8),
|
||||
children: [
|
||||
_buildHeader(),
|
||||
_buildHeader(l10n),
|
||||
const SizedBox(height: 12),
|
||||
_buildMapCard(),
|
||||
_buildMapCard(l10n),
|
||||
const SizedBox(height: 12),
|
||||
_buildMetrics(),
|
||||
_buildMetrics(l10n),
|
||||
const SizedBox(height: 12),
|
||||
_buildInfoCard(),
|
||||
_buildInfoCard(l10n),
|
||||
const SizedBox(height: 12),
|
||||
_buildEventCard(),
|
||||
_buildEventCard(l10n),
|
||||
const SizedBox(height: 14),
|
||||
_buildActions(context),
|
||||
_buildActions(context, l10n),
|
||||
],
|
||||
),
|
||||
),
|
||||
@@ -79,7 +82,7 @@ class WorkReportPageV2 extends StatelessWidget {
|
||||
}
|
||||
|
||||
// ===== 标题区:任务名 + 完成状态 =====
|
||||
Widget _buildHeader() {
|
||||
Widget _buildHeader(AppLocalizations l10n) {
|
||||
return Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
@@ -87,7 +90,7 @@ class WorkReportPageV2 extends StatelessWidget {
|
||||
children: [
|
||||
Expanded(
|
||||
child: Text(
|
||||
taskName,
|
||||
taskName ?? l10n.translate('work_v2.demo_zone_b_task'),
|
||||
maxLines: 1,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
style: const TextStyle(
|
||||
@@ -104,9 +107,9 @@ class WorkReportPageV2 extends StatelessWidget {
|
||||
color: _greenBg,
|
||||
borderRadius: BorderRadius.circular(999),
|
||||
),
|
||||
child: const Text(
|
||||
'已完成',
|
||||
style: TextStyle(
|
||||
child: Text(
|
||||
l10n.translate('work_v2.plan.status_done'),
|
||||
style: const TextStyle(
|
||||
fontSize: 11,
|
||||
fontWeight: FontWeight.w700,
|
||||
color: _green,
|
||||
@@ -116,23 +119,25 @@ class WorkReportPageV2 extends StatelessWidget {
|
||||
],
|
||||
),
|
||||
const SizedBox(height: 6),
|
||||
const Text(
|
||||
'2026-10-26 08:00 — 10:42 · 山东02号机',
|
||||
style: TextStyle(fontSize: 12, color: _gray),
|
||||
Text(
|
||||
l10n
|
||||
.translate('work_v2.report.time_subtitle')
|
||||
.replaceAll('%s', l10n.translate('work_v2.demo_robot_2')),
|
||||
style: const TextStyle(fontSize: 12, color: _gray),
|
||||
),
|
||||
],
|
||||
);
|
||||
}
|
||||
|
||||
// ===== 轨迹缩略图 =====
|
||||
Widget _buildMapCard() {
|
||||
Widget _buildMapCard(AppLocalizations l10n) {
|
||||
return Stack(
|
||||
children: [
|
||||
WorkMapThumb(
|
||||
center: _center,
|
||||
height: 158,
|
||||
radius: 16,
|
||||
badgeText: '实际作业轨迹',
|
||||
badgeText: l10n.translate('work_v2.report.trace_badge'),
|
||||
showAreas: true,
|
||||
showRoute: true,
|
||||
showRobot: false,
|
||||
@@ -146,14 +151,14 @@ class WorkReportPageV2 extends StatelessWidget {
|
||||
color: Colors.white.withValues(alpha: 0.94),
|
||||
borderRadius: BorderRadius.circular(8),
|
||||
),
|
||||
child: const Row(
|
||||
child: Row(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
Icon(Icons.timeline_rounded, size: 13, color: kWtBlue),
|
||||
SizedBox(width: 4),
|
||||
const Icon(Icons.timeline_rounded, size: 13, color: kWtBlue),
|
||||
const SizedBox(width: 4),
|
||||
Text(
|
||||
'轨迹回放',
|
||||
style: TextStyle(
|
||||
l10n.translate('work_v2.report.trace_replay'),
|
||||
style: const TextStyle(
|
||||
fontSize: 10.5,
|
||||
fontWeight: FontWeight.w700,
|
||||
color: kWtNavy,
|
||||
@@ -168,12 +173,12 @@ class WorkReportPageV2 extends StatelessWidget {
|
||||
}
|
||||
|
||||
// ===== 4 个关键指标(2×2:竖屏宽度放不下四列) =====
|
||||
Widget _buildMetrics() {
|
||||
const metrics = <(String, String, String)>[
|
||||
('作业面积', '2 860', 'm²'),
|
||||
('作业时长', '2 h 42', 'min'),
|
||||
('覆盖率', '98.6', '%'),
|
||||
('耗电', '34', '%'),
|
||||
Widget _buildMetrics(AppLocalizations l10n) {
|
||||
final metrics = <(String, String, String)>[
|
||||
(l10n.translate('work_v2.report.metric_area'), '2 860', 'm²'),
|
||||
(l10n.translate('work_v2.report.metric_duration'), '2 h 42', 'min'),
|
||||
(l10n.translate('work_v2.report.metric_coverage'), '98.6', '%'),
|
||||
(l10n.translate('work_v2.report.metric_power'), '34', '%'),
|
||||
];
|
||||
return Column(
|
||||
children: [
|
||||
@@ -242,13 +247,24 @@ class WorkReportPageV2 extends StatelessWidget {
|
||||
}
|
||||
|
||||
// ===== 作业信息 =====
|
||||
Widget _buildInfoCard() {
|
||||
const rows = <(String, String)>[
|
||||
('作业区域', 'B区 · 东侧草坪'),
|
||||
('作业路线', 'B区路线01 · 往复式'),
|
||||
('执行设备', '山东02号机'),
|
||||
('开始时间', '2026-10-26 08:00'),
|
||||
('结束时间', '2026-10-26 10:42'),
|
||||
Widget _buildInfoCard(AppLocalizations l10n) {
|
||||
final rows = <(String, String)>[
|
||||
(
|
||||
l10n.translate('work_v2.report.info_zone'),
|
||||
l10n.translate('work_v2.area.demo_zone_b'),
|
||||
),
|
||||
(
|
||||
l10n.translate('work_v2.report.info_route'),
|
||||
l10n
|
||||
.translate('work_v2.report.demo_route_pattern')
|
||||
.replaceAll('%s', l10n.translate('work_v2.demo_route_b1')),
|
||||
),
|
||||
(
|
||||
l10n.translate('work_v2.report.info_device'),
|
||||
l10n.translate('work_v2.demo_robot_2'),
|
||||
),
|
||||
(l10n.translate('work_v2.report.info_start'), '2026-10-26 08:00'),
|
||||
(l10n.translate('work_v2.report.info_end'), '2026-10-26 10:42'),
|
||||
];
|
||||
return Container(
|
||||
padding: const EdgeInsets.fromLTRB(14, 12, 14, 6),
|
||||
@@ -260,9 +276,9 @@ class WorkReportPageV2 extends StatelessWidget {
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
const Text(
|
||||
'作业信息',
|
||||
style: TextStyle(
|
||||
Text(
|
||||
l10n.translate('work_v2.report.info_title'),
|
||||
style: const TextStyle(
|
||||
fontSize: 14,
|
||||
fontWeight: FontWeight.w800,
|
||||
color: _navy,
|
||||
@@ -302,12 +318,30 @@ class WorkReportPageV2 extends StatelessWidget {
|
||||
}
|
||||
|
||||
// ===== 过程节点 =====
|
||||
Widget _buildEventCard() {
|
||||
const events = <(String, String, String)>[
|
||||
('08:00', '任务下发成功', '设备已接受任务并原地自检'),
|
||||
('08:06', '进入 B 区开始作业', '沿 B区路线01 往复推进'),
|
||||
('09:58', '中途补充割草高度', '人工干预:割草高度 45 → 50 mm'),
|
||||
('10:42', '作业完成并返航', '回到充电桩,剩余电量 66%'),
|
||||
Widget _buildEventCard(AppLocalizations l10n) {
|
||||
final events = <(String, String, String)>[
|
||||
(
|
||||
'08:00',
|
||||
l10n.translate('work_v2.report.event1_title'),
|
||||
l10n.translate('work_v2.report.event1_desc'),
|
||||
),
|
||||
(
|
||||
'08:06',
|
||||
l10n.translate('work_v2.report.event2_title'),
|
||||
l10n
|
||||
.translate('work_v2.report.event2_desc')
|
||||
.replaceAll('%s', l10n.translate('work_v2.demo_route_b1')),
|
||||
),
|
||||
(
|
||||
'09:58',
|
||||
l10n.translate('work_v2.report.event3_title'),
|
||||
l10n.translate('work_v2.report.event3_desc'),
|
||||
),
|
||||
(
|
||||
'10:42',
|
||||
l10n.translate('work_v2.report.event4_title'),
|
||||
l10n.translate('work_v2.report.event4_desc'),
|
||||
),
|
||||
];
|
||||
return Container(
|
||||
padding: const EdgeInsets.fromLTRB(14, 12, 14, 12),
|
||||
@@ -319,9 +353,9 @@ class WorkReportPageV2 extends StatelessWidget {
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
const Text(
|
||||
'过程记录',
|
||||
style: TextStyle(
|
||||
Text(
|
||||
l10n.translate('work_v2.report.event_title'),
|
||||
style: const TextStyle(
|
||||
fontSize: 14,
|
||||
fontWeight: FontWeight.w800,
|
||||
color: _navy,
|
||||
@@ -422,7 +456,7 @@ class WorkReportPageV2 extends StatelessWidget {
|
||||
}
|
||||
|
||||
// ===== 底部动作 =====
|
||||
Widget _buildActions(BuildContext context) {
|
||||
Widget _buildActions(BuildContext context, AppLocalizations l10n) {
|
||||
return Row(
|
||||
children: [
|
||||
Expanded(
|
||||
@@ -437,9 +471,9 @@ class WorkReportPageV2 extends StatelessWidget {
|
||||
borderRadius: BorderRadius.circular(14),
|
||||
border: Border.all(color: _border),
|
||||
),
|
||||
child: const Text(
|
||||
'返回记录',
|
||||
style: TextStyle(
|
||||
child: Text(
|
||||
l10n.translate('work_v2.report.back_to_records'),
|
||||
style: const TextStyle(
|
||||
fontSize: 13.5,
|
||||
fontWeight: FontWeight.w700,
|
||||
color: _navy,
|
||||
@@ -451,7 +485,8 @@ class WorkReportPageV2 extends StatelessWidget {
|
||||
const SizedBox(width: 10),
|
||||
Expanded(
|
||||
child: GestureDetector(
|
||||
onTap: () => _toast('报告导出接口未接入(演示)'),
|
||||
onTap: () =>
|
||||
_toast(l10n.translate('work_v2.report.toast_export_todo')),
|
||||
behavior: HitTestBehavior.opaque,
|
||||
child: Container(
|
||||
height: 46,
|
||||
@@ -462,9 +497,9 @@ class WorkReportPageV2 extends StatelessWidget {
|
||||
),
|
||||
borderRadius: BorderRadius.circular(14),
|
||||
),
|
||||
child: const Text(
|
||||
'导出报告',
|
||||
style: TextStyle(
|
||||
child: Text(
|
||||
l10n.translate('work_v2.report.export'),
|
||||
style: const TextStyle(
|
||||
fontSize: 13.5,
|
||||
fontWeight: FontWeight.w700,
|
||||
color: Colors.white,
|
||||
|
||||
@@ -3,7 +3,14 @@ import 'package:flutter/services.dart';
|
||||
import 'package:latlong2/latlong.dart';
|
||||
import 'package:maibu_satabot_v2/components/capsule_toast.dart';
|
||||
import 'package:maibu_satabot_v2/core/di/injection.dart';
|
||||
import 'package:maibu_satabot_v2/core/localization/app_localizations.dart';
|
||||
import 'package:maibu_satabot_v2/features/autonomous_work/domain/entities/work_session_models.dart';
|
||||
import 'package:maibu_satabot_v2/features/autonomous_work/domain/repositories/autonomous_work_gateway.dart';
|
||||
import 'package:maibu_satabot_v2/features/home/presentation/widgets/map/geoserver_suzhou_layer.dart';
|
||||
import 'package:maibu_satabot_v2/features/v2/device_list/presentation/bloc/robot_list_bloc.dart';
|
||||
import 'package:maibu_satabot_v2/features/v2/device_list/presentation/bloc/robot_list_event.dart';
|
||||
import 'package:maibu_satabot_v2/features/v2/device_list/presentation/bloc/robot_list_state.dart';
|
||||
import 'package:maibu_satabot_v2/features/v2/device_list/presentation/pages/robot_autonomous_work_page_v2.dart';
|
||||
import 'package:maibu_satabot_v2/features/v2/device_list/presentation/pages/route_editor_page_v2.dart';
|
||||
import 'package:maibu_satabot_v2/features/v2/device_list/presentation/widgets/autonomous/work_ui.dart';
|
||||
import 'package:maibu_satabot_v2/features/v2/site/presentation/cubit/site_cubit.dart';
|
||||
@@ -11,11 +18,12 @@ import 'package:maibu_satabot_v2/features/v2/work/presentation/widgets/work_phon
|
||||
|
||||
/// 路线库(W05)——作业首页「路线库」入口进入。
|
||||
///
|
||||
/// 竖屏单页:按作业区归档的覆盖路线,卡片上直给长度 / 预估时长 / 间距,
|
||||
/// 「新建路线」「编辑」都进入横屏「地图与区域编辑」绘制。
|
||||
/// 竖屏单页:展示**当前选中场站下的所有路线**,数据不写死,
|
||||
/// 与自主作业中心右侧抽屉「路线库」同源,都走 [AutonomousWorkGateway.loadRoutes]
|
||||
/// (A 环境即作业记录 selectBySiteId,B 环境由对应实现决定)。
|
||||
///
|
||||
/// 本页为演示页:路线是写死的示例,不读真实路线数据;
|
||||
/// 「应用到任务」只做界面反馈,不写全局任务状态。
|
||||
/// 点选一条路线 → 进入横屏「自主作业中心」,进页即选中该路线并画线;
|
||||
/// 「新建路线」「编辑」进入横屏「地图与区域编辑」绘制。
|
||||
class WorkRouteLibraryPageV2 extends StatefulWidget {
|
||||
const WorkRouteLibraryPageV2({super.key});
|
||||
|
||||
@@ -26,95 +34,81 @@ class WorkRouteLibraryPageV2 extends StatefulWidget {
|
||||
State<WorkRouteLibraryPageV2> createState() => _WorkRouteLibraryPageV2State();
|
||||
}
|
||||
|
||||
/// 一条演示路线
|
||||
class _DemoRoute {
|
||||
const _DemoRoute({
|
||||
required this.name,
|
||||
required this.kind,
|
||||
required this.zone,
|
||||
required this.length,
|
||||
required this.duration,
|
||||
required this.spacing,
|
||||
required this.used,
|
||||
});
|
||||
|
||||
final String name;
|
||||
|
||||
/// 覆盖 / 返航 / 沿边
|
||||
final String kind;
|
||||
final String zone;
|
||||
final String length;
|
||||
final String duration;
|
||||
final String spacing;
|
||||
|
||||
/// 最近使用时间,空表示未使用
|
||||
final String used;
|
||||
}
|
||||
|
||||
class _WorkRouteLibraryPageV2State extends State<WorkRouteLibraryPageV2> {
|
||||
static const Color _navy = kWtNavy;
|
||||
static const Color _gray = kWtGray;
|
||||
static const Color _border = kWtBorder;
|
||||
static const Color _cyan = Color(0xFF00B8A8);
|
||||
static const Color _orange = Color(0xFFEE9A2E);
|
||||
|
||||
static const List<String> _filters = <String>['全部路线', '覆盖路线', '返航路线', '沿边路线'];
|
||||
static const List<String> _filterKeys = <String>[
|
||||
'all',
|
||||
'return',
|
||||
// 暂时注释:页面只保留「全部路线 + 返航路线」两个分栏,需要时恢复
|
||||
// 'coverage',
|
||||
// 'custom',
|
||||
];
|
||||
int _filter = 0;
|
||||
|
||||
static const List<_DemoRoute> _routes = <_DemoRoute>[
|
||||
_DemoRoute(
|
||||
name: 'A区路线01',
|
||||
kind: '覆盖路线',
|
||||
zone: 'A 区 · 主草坪',
|
||||
length: '486 m',
|
||||
duration: '42 min',
|
||||
spacing: '0.9 m',
|
||||
used: '今天 08:12',
|
||||
),
|
||||
_DemoRoute(
|
||||
name: 'B区路线01',
|
||||
kind: '覆盖路线',
|
||||
zone: 'B 区 · 东侧草坪',
|
||||
length: '392 m',
|
||||
duration: '35 min',
|
||||
spacing: '0.9 m',
|
||||
used: '今天 08:00',
|
||||
),
|
||||
_DemoRoute(
|
||||
name: 'B区沿边01',
|
||||
kind: '沿边路线',
|
||||
zone: 'B 区 · 东侧草坪',
|
||||
length: '164 m',
|
||||
duration: '14 min',
|
||||
spacing: '0.6 m',
|
||||
used: '昨天 16:40',
|
||||
),
|
||||
_DemoRoute(
|
||||
name: 'C区覆盖01',
|
||||
kind: '覆盖路线',
|
||||
zone: 'C 区 · 苗圃',
|
||||
length: '128 m',
|
||||
duration: '11 min',
|
||||
spacing: '0.7 m',
|
||||
used: '',
|
||||
),
|
||||
_DemoRoute(
|
||||
name: '全场返航路线',
|
||||
kind: '返航路线',
|
||||
zone: '全场',
|
||||
length: '96 m',
|
||||
duration: '9 min',
|
||||
spacing: '—',
|
||||
used: '今天 10:42',
|
||||
),
|
||||
];
|
||||
late final AutonomousWorkGateway _gateway = sl<AutonomousWorkGateway>();
|
||||
|
||||
/// 路线颜色(覆盖青绿 / 返航橙 / 沿边蓝)
|
||||
static const Map<String, Color> _kindColors = <String, Color>{
|
||||
'覆盖路线': _cyan,
|
||||
'返航路线': _orange,
|
||||
'沿边路线': kWtBlue,
|
||||
};
|
||||
List<WorkRouteOption> _routes = const <WorkRouteOption>[];
|
||||
bool _loading = true;
|
||||
String? _error;
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
_load();
|
||||
}
|
||||
|
||||
/// 拉取当前场站下的所有路线:与自主作业抽屉面板同一链路
|
||||
/// (resolveScope → siteId → loadRoutes),页面不直接依赖任何接口。
|
||||
Future<void> _load() async {
|
||||
setState(() {
|
||||
_loading = true;
|
||||
_error = null;
|
||||
});
|
||||
final scope = await _gateway.resolveScope(deviceId: '');
|
||||
final siteId = scope.siteId;
|
||||
if (!mounted) return;
|
||||
if (siteId == null) {
|
||||
setState(() {
|
||||
_loading = false;
|
||||
_error = AppLocalizations.of(
|
||||
context,
|
||||
).translate('work_v2.route_lib.no_site');
|
||||
});
|
||||
return;
|
||||
}
|
||||
final result = await _gateway.loadRoutes(siteId: siteId);
|
||||
if (!mounted) return;
|
||||
final routes = result.data ?? const <WorkRouteOption>[];
|
||||
setState(() {
|
||||
_loading = false;
|
||||
_routes = routes;
|
||||
_error = routes.isEmpty
|
||||
? (result.error ??
|
||||
AppLocalizations.of(
|
||||
context,
|
||||
).translate('work_v2.route_lib.empty_site'))
|
||||
: null;
|
||||
});
|
||||
}
|
||||
|
||||
/// 路线类型代码 -> 当前语言文案
|
||||
String _kindLabel(AppLocalizations l10n, String key) {
|
||||
switch (key) {
|
||||
case 'all':
|
||||
return l10n.translate('work_v2.route_lib.filter_all');
|
||||
case 'return':
|
||||
return l10n.translate('work_v2.route_lib.kind_return');
|
||||
case 'coverage':
|
||||
// 卡片角标仍在用覆盖/自定义文案,只是筛选分栏暂时注释
|
||||
return l10n.translate('work_v2.route_lib.kind_coverage');
|
||||
default:
|
||||
return l10n.translate('work_v2.route_lib.kind_custom');
|
||||
}
|
||||
}
|
||||
|
||||
void _toast(String text) => CapsuleToast.show(text, showCheck: false);
|
||||
|
||||
@@ -124,64 +118,127 @@ class _WorkRouteLibraryPageV2State extends State<WorkRouteLibraryPageV2> {
|
||||
const LatLng(31.083296, 120.840355);
|
||||
}
|
||||
|
||||
List<_DemoRoute> get _visible {
|
||||
/// 按分栏过滤:返航为预留项(作业记录接口暂无返航类型数据,选中显示空态);
|
||||
/// 覆盖/自定义模式过滤逻辑保留,恢复 _filterKeys 对应分栏即可重新生效
|
||||
List<WorkRouteOption> get _visible {
|
||||
if (_filter == 0) return _routes;
|
||||
final String kind = _filters[_filter];
|
||||
return _routes.where((r) => r.kind == kind).toList();
|
||||
final String kind = _filterKeys[_filter];
|
||||
if (kind == 'return') return const <WorkRouteOption>[];
|
||||
final bool wantCoverage = kind == 'coverage';
|
||||
return _routes.where((r) => r.coverageMode == wantCoverage).toList();
|
||||
}
|
||||
|
||||
/// 进入横屏「地图与区域编辑」画路线;返回后把方向还给竖屏
|
||||
/// 进入横屏「地图与区域编辑」画路线;返回后把方向还给竖屏并刷新列表
|
||||
Future<void> _openEditor() async {
|
||||
await Navigator.of(context).push(RouteEditorPageV2.route(deviceSn: ''));
|
||||
await SystemChrome.setPreferredOrientations([DeviceOrientation.portraitUp]);
|
||||
await SystemChrome.setEnabledSystemUIMode(SystemUiMode.edgeToEdge);
|
||||
if (mounted) _load();
|
||||
}
|
||||
|
||||
/// 选中一条路线 → 进入横屏自主作业中心,进页即选中该路线并画线。
|
||||
///
|
||||
/// 设备取 RobotListBloc 已加载的真实设备(与作业首页「自主作业」入口同口径);
|
||||
/// 尚未加载过就先拉一次列表,本次提示稍后再进(不拿占位设备凑数)。
|
||||
Future<void> _useRoute(WorkRouteOption route) async {
|
||||
final l10n = AppLocalizations.of(context);
|
||||
final bloc = sl<RobotListBloc>();
|
||||
final state = bloc.state;
|
||||
if (state is! RobotListLoaded || state.robots.isEmpty) {
|
||||
bloc.add(
|
||||
RobotListLoadData(siteId: sl<SiteCubit>().state.selectedSite?.id),
|
||||
);
|
||||
_toast(l10n.translate('work_v2.toast_loading_devices'));
|
||||
return;
|
||||
}
|
||||
await Navigator.of(context).push(
|
||||
MaterialPageRoute<void>(
|
||||
builder: (_) => RobotAutonomousWorkPageV2(
|
||||
robot: state.robots.first,
|
||||
initialRoute: route,
|
||||
),
|
||||
),
|
||||
);
|
||||
await SystemChrome.setPreferredOrientations([DeviceOrientation.portraitUp]);
|
||||
await SystemChrome.setEnabledSystemUIMode(SystemUiMode.edgeToEdge);
|
||||
// 作业中心里可能新建/更换过路线,返回后刷新
|
||||
if (mounted) _load();
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final l10n = AppLocalizations.of(context);
|
||||
final routes = _visible;
|
||||
return WorkPhoneScaffold(
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.stretch,
|
||||
children: [
|
||||
WorkPhoneTopBar(
|
||||
title: '路线库',
|
||||
title: l10n.translate('work_v2.route_lib.title'),
|
||||
onBack: () => Navigator.of(context).maybePop(),
|
||||
trailing: WorkSquareButton(
|
||||
icon: Icons.add_rounded,
|
||||
label: '新建',
|
||||
label: l10n.translate('work_v2.route_lib.new'),
|
||||
primary: true,
|
||||
onTap: _openEditor,
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 12),
|
||||
const WorkPageHeading(
|
||||
title: '路线库',
|
||||
subtitle: '按作业区归档覆盖路线,可直接应用到新的作业任务',
|
||||
WorkPageHeading(
|
||||
title: l10n.translate('work_v2.route_lib.title'),
|
||||
subtitle: l10n.translate('work_v2.route_lib.page_subtitle'),
|
||||
),
|
||||
const SizedBox(height: 12),
|
||||
WorkFilterRow(
|
||||
items: _filters,
|
||||
items: _filterKeys.map((k) => _kindLabel(l10n, k)).toList(),
|
||||
index: _filter,
|
||||
onChanged: (i) => setState(() => _filter = i),
|
||||
),
|
||||
const SizedBox(height: 12),
|
||||
Expanded(
|
||||
child: routes.isEmpty
|
||||
? _buildEmpty()
|
||||
: ListView.separated(
|
||||
padding: const EdgeInsets.only(bottom: 8),
|
||||
itemCount: routes.length,
|
||||
separatorBuilder: (_, _) => const SizedBox(height: 10),
|
||||
itemBuilder: (context, i) => _buildRouteCard(routes[i]),
|
||||
),
|
||||
),
|
||||
Expanded(child: _buildBody(l10n, routes)),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Widget _buildEmpty() {
|
||||
Widget _buildBody(AppLocalizations l10n, List<WorkRouteOption> routes) {
|
||||
if (_loading) {
|
||||
return const Center(child: CircularProgressIndicator(strokeWidth: 2));
|
||||
}
|
||||
final error = _error;
|
||||
if (error != null) {
|
||||
return Center(
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
Text(
|
||||
error,
|
||||
textAlign: TextAlign.center,
|
||||
style: const TextStyle(fontSize: 12.5, color: _gray),
|
||||
),
|
||||
const SizedBox(height: 12),
|
||||
_smallAction(
|
||||
l10n.translate('work_v2.route_lib.reload'),
|
||||
_load,
|
||||
primary: true,
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
if (routes.isEmpty) return _buildEmpty(l10n);
|
||||
return RefreshIndicator(
|
||||
onRefresh: _load,
|
||||
child: ListView.separated(
|
||||
padding: const EdgeInsets.only(bottom: 8),
|
||||
itemCount: routes.length,
|
||||
separatorBuilder: (_, _) => const SizedBox(height: 10),
|
||||
itemBuilder: (context, i) => _buildRouteCard(l10n, routes[i]),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Widget _buildEmpty(AppLocalizations l10n) {
|
||||
return Center(
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
@@ -200,9 +257,9 @@ class _WorkRouteLibraryPageV2State extends State<WorkRouteLibraryPageV2> {
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 10),
|
||||
const Text(
|
||||
'该类型下还没有路线',
|
||||
style: TextStyle(fontSize: 12.5, color: _gray),
|
||||
Text(
|
||||
l10n.translate('work_v2.route_lib.empty'),
|
||||
style: const TextStyle(fontSize: 12.5, color: _gray),
|
||||
),
|
||||
],
|
||||
),
|
||||
@@ -210,136 +267,145 @@ class _WorkRouteLibraryPageV2State extends State<WorkRouteLibraryPageV2> {
|
||||
}
|
||||
|
||||
// ===== 路线卡 =====
|
||||
Widget _buildRouteCard(_DemoRoute r) {
|
||||
final Color kindColor = _kindColors[r.kind] ?? kWtBlue;
|
||||
return Container(
|
||||
decoration: BoxDecoration(
|
||||
color: Colors.white,
|
||||
Widget _buildRouteCard(AppLocalizations l10n, WorkRouteOption r) {
|
||||
final bool coverage = r.coverageMode;
|
||||
final Color kindColor = coverage ? _cyan : kWtBlue;
|
||||
final String kindLabel = _kindLabel(
|
||||
l10n,
|
||||
coverage ? 'coverage' : 'custom',
|
||||
);
|
||||
final subtitle = r.metaText ?? r.planModeLabel ?? '路线 #${r.id}';
|
||||
final imageUrl = r.imageUrl;
|
||||
final String enterLabel = l10n.translate('work_v2.enter_work_center');
|
||||
return Material(
|
||||
color: Colors.white,
|
||||
borderRadius: BorderRadius.circular(16),
|
||||
child: InkWell(
|
||||
// 点选路线 → 进入自主作业中心(进页即选中并画线)
|
||||
onTap: () => _useRoute(r),
|
||||
borderRadius: BorderRadius.circular(16),
|
||||
border: Border.all(color: _border),
|
||||
),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.stretch,
|
||||
children: [
|
||||
// 顶部缩略图:叠一层路线示意
|
||||
Stack(
|
||||
child: Container(
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: BorderRadius.circular(16),
|
||||
border: Border.all(color: _border),
|
||||
),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.stretch,
|
||||
children: [
|
||||
WorkMapThumb(
|
||||
center: _center,
|
||||
height: 96,
|
||||
radius: 16,
|
||||
zoom: 17.6,
|
||||
showAreas: r.kind != '返航路线',
|
||||
showRoute: true,
|
||||
showRobot: false,
|
||||
),
|
||||
Positioned(
|
||||
left: 10,
|
||||
top: 10,
|
||||
child: Container(
|
||||
padding: const EdgeInsets.symmetric(
|
||||
horizontal: 8,
|
||||
vertical: 3,
|
||||
),
|
||||
decoration: BoxDecoration(
|
||||
color: kindColor,
|
||||
borderRadius: BorderRadius.circular(7),
|
||||
),
|
||||
child: Text(
|
||||
r.kind,
|
||||
style: const TextStyle(
|
||||
fontSize: 10,
|
||||
fontWeight: FontWeight.w700,
|
||||
color: Colors.white,
|
||||
// 顶部缩略图:优先作业截图(同自主作业抽屉列表项),无图回退场站底图
|
||||
Stack(
|
||||
children: [
|
||||
if (imageUrl != null && imageUrl.isNotEmpty)
|
||||
ClipRRect(
|
||||
borderRadius: BorderRadius.circular(16),
|
||||
child: Image.network(
|
||||
imageUrl,
|
||||
height: 96,
|
||||
fit: BoxFit.cover,
|
||||
width: double.infinity,
|
||||
errorBuilder:
|
||||
(context, error, stackTrace) => _mapThumb(),
|
||||
),
|
||||
)
|
||||
else
|
||||
_mapThumb(),
|
||||
Positioned(
|
||||
left: 10,
|
||||
top: 10,
|
||||
child: Container(
|
||||
padding: const EdgeInsets.symmetric(
|
||||
horizontal: 8,
|
||||
vertical: 3,
|
||||
),
|
||||
decoration: BoxDecoration(
|
||||
color: kindColor,
|
||||
borderRadius: BorderRadius.circular(7),
|
||||
),
|
||||
child: Text(
|
||||
kindLabel,
|
||||
style: const TextStyle(
|
||||
fontSize: 10,
|
||||
fontWeight: FontWeight.w700,
|
||||
color: Colors.white,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
Padding(
|
||||
padding: const EdgeInsets.fromLTRB(13, 10, 13, 11),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text(
|
||||
r.name,
|
||||
maxLines: 1,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
style: const TextStyle(
|
||||
fontSize: 14.5,
|
||||
fontWeight: FontWeight.w800,
|
||||
color: _navy,
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 4),
|
||||
Text(
|
||||
subtitle,
|
||||
maxLines: 1,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
style: const TextStyle(fontSize: 11.5, color: _gray),
|
||||
),
|
||||
const SizedBox(height: 10),
|
||||
Row(
|
||||
children: [
|
||||
Expanded(
|
||||
child: Text(
|
||||
enterLabel,
|
||||
maxLines: 1,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
style: const TextStyle(
|
||||
fontSize: 11,
|
||||
fontWeight: FontWeight.w600,
|
||||
color: kWtHint,
|
||||
),
|
||||
),
|
||||
),
|
||||
_smallAction(
|
||||
l10n.translate('work_v2.route_lib.edit'),
|
||||
_openEditor,
|
||||
),
|
||||
const SizedBox(width: 8),
|
||||
_smallAction(
|
||||
enterLabel,
|
||||
() => _useRoute(r),
|
||||
primary: true,
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
Padding(
|
||||
padding: const EdgeInsets.fromLTRB(13, 10, 13, 11),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Row(
|
||||
children: [
|
||||
Expanded(
|
||||
child: Text(
|
||||
r.name,
|
||||
maxLines: 1,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
style: const TextStyle(
|
||||
fontSize: 14.5,
|
||||
fontWeight: FontWeight.w800,
|
||||
color: _navy,
|
||||
),
|
||||
),
|
||||
),
|
||||
if (r.used.isNotEmpty)
|
||||
Text(
|
||||
'最近 ${r.used}',
|
||||
style: const TextStyle(fontSize: 10, color: kWtHint),
|
||||
),
|
||||
],
|
||||
),
|
||||
const SizedBox(height: 4),
|
||||
Text(
|
||||
r.zone,
|
||||
maxLines: 1,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
style: const TextStyle(fontSize: 11.5, color: _gray),
|
||||
),
|
||||
const SizedBox(height: 9),
|
||||
Row(
|
||||
children: [
|
||||
_metaItem(Icons.straighten_rounded, r.length),
|
||||
const SizedBox(width: 14),
|
||||
_metaItem(Icons.schedule_rounded, r.duration),
|
||||
const SizedBox(width: 14),
|
||||
_metaItem(Icons.space_bar_rounded, r.spacing),
|
||||
],
|
||||
),
|
||||
const SizedBox(height: 10),
|
||||
Row(
|
||||
children: [
|
||||
const Spacer(),
|
||||
_smallAction('编辑', _openEditor),
|
||||
const SizedBox(width: 8),
|
||||
_smallAction(
|
||||
'应用到任务',
|
||||
() => _toast('任务编排接口未接入(演示)'),
|
||||
primary: true,
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Widget _metaItem(IconData icon, String text) {
|
||||
return Row(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
Icon(icon, size: 12.5, color: kWtHint),
|
||||
const SizedBox(width: 3),
|
||||
Text(
|
||||
text,
|
||||
style: const TextStyle(
|
||||
fontSize: 11,
|
||||
fontWeight: FontWeight.w600,
|
||||
color: kWtGray2,
|
||||
),
|
||||
),
|
||||
],
|
||||
);
|
||||
}
|
||||
/// 无作业截图时的占位缩略图:只展示场站底图,不画演示路线
|
||||
Widget _mapThumb() => WorkMapThumb(
|
||||
center: _center,
|
||||
height: 96,
|
||||
radius: 16,
|
||||
showRoute: false,
|
||||
showRobot: false,
|
||||
);
|
||||
|
||||
Widget _smallAction(String text, VoidCallback onTap, {bool primary = false}) {
|
||||
Widget _smallAction(
|
||||
String text,
|
||||
VoidCallback onTap, {
|
||||
bool primary = false,
|
||||
}) {
|
||||
return GestureDetector(
|
||||
onTap: onTap,
|
||||
behavior: HitTestBehavior.opaque,
|
||||
|
||||
Reference in New Issue
Block a user