作业首页和机器状态的数据
This commit is contained in:
@@ -6,7 +6,13 @@ import 'package:maibu_satabot_v2/core/router/route_paths.dart';
|
||||
import 'package:webview_flutter/webview_flutter.dart';
|
||||
|
||||
class DjPage extends StatefulWidget {
|
||||
const DjPage({super.key});
|
||||
/// 从横屏页(如「地图与区域编辑」)push 进来时为 true:
|
||||
/// 退出统一用 pop 回来源页。若用 context.go() 整栈替换,
|
||||
/// 来源页 await push 的 Future 永不完成,横屏恢复不会执行,
|
||||
/// 页面会被锁死在竖屏。首页进入时保持原 go() 行为。
|
||||
final bool exitToPop;
|
||||
|
||||
const DjPage({super.key, this.exitToPop = false});
|
||||
|
||||
@override
|
||||
State<DjPage> createState() => _DjPageState();
|
||||
@@ -41,6 +47,11 @@ class _DjPageState extends State<DjPage> {
|
||||
final page = data["page"];
|
||||
|
||||
if (action == "navigate") {
|
||||
// 编辑器入口:H5 发出任何跳转都视为「场站已选好」,pop 回横屏编辑页
|
||||
if (widget.exitToPop) {
|
||||
if (context.canPop()) context.pop();
|
||||
return;
|
||||
}
|
||||
if (page == "gaode") {
|
||||
_openGaode();
|
||||
}
|
||||
@@ -66,7 +77,12 @@ class _DjPageState extends State<DjPage> {
|
||||
leading: IconButton(
|
||||
icon: const Icon(Icons.arrow_back, color: Colors.white),
|
||||
onPressed: () {
|
||||
context.go(RoutePaths.home);
|
||||
// 编辑器入口:pop 回来源页(触发对方 await 完成→恢复横屏)
|
||||
if (widget.exitToPop && context.canPop()) {
|
||||
context.pop();
|
||||
} else {
|
||||
context.go(RoutePaths.home);
|
||||
}
|
||||
},
|
||||
),
|
||||
title: Text(AppLocalizations.of(context).translate('route_planning.title'), style: const TextStyle(color: Colors.white)),
|
||||
|
||||
Reference in New Issue
Block a user