任务页面
This commit is contained in:
parent
fd81e94c4d
commit
ece7aa270c
File diff suppressed because one or more lines are too long
@ -8,7 +8,7 @@ class AppController extends GetxController {
|
||||
@override
|
||||
void onInit() {
|
||||
super.onInit();
|
||||
// 获取 AnotherController 的实例
|
||||
|
||||
final mapcontroller = Get.find<ScenceMapController>();
|
||||
|
||||
// 绑定 currentIndex
|
||||
|
@ -11,7 +11,7 @@ import 'appbar.dart';
|
||||
import 'pages/aim_point/aimpointController.dart';
|
||||
import 'pages/history/history_record.dart';
|
||||
import 'pages/pass_track/view.dart';
|
||||
import 'pages/pile/pileNav/view.dart';
|
||||
import 'pages/task/pile/pileNav/view.dart';
|
||||
// import 'pages/pile/rightDra/pileGenerate.dart';
|
||||
import 'pages/real/index.dart';
|
||||
import 'pages/setting/child_pages/XyChange/connect.dart';
|
||||
|
@ -1,6 +1,7 @@
|
||||
//字体
|
||||
import 'package:bottom_picker/resources/arrays.dart';
|
||||
import 'package:cpnav/controllers/gnss_Controller.dart';
|
||||
import 'package:cpnav/main.dart';
|
||||
import 'package:cpnav/pages/aim_point/aimpoint_page.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/rendering.dart';
|
||||
@ -104,7 +105,9 @@ class _PasstrackState extends State<PassTrack> {
|
||||
onUpdate: (Offset center, double scale, double rotation) {
|
||||
print("center:$center scale:$scale rotation:$rotation");
|
||||
},
|
||||
forGroundPainter: BorderPainter(controller),
|
||||
forGroundPainter: appcontroller.currentIndex.value == 1
|
||||
? BorderPainter(controller)
|
||||
: null,
|
||||
onUpdatePilePoint: (RecordEntity? selectedPilePoint, double scale,
|
||||
double rotation) {
|
||||
print(
|
||||
|
@ -6,13 +6,16 @@ import 'package:get/get.dart';
|
||||
import 'package:scence_map/controllers/controller.dart';
|
||||
import 'package:scence_map/controllers/plumController.dart';
|
||||
|
||||
import '../../../service/pile/device_type.dart';
|
||||
import '../../../service/pile/input.dart';
|
||||
import '../../../service/pile/public_widget.dart';
|
||||
import '../../../../service/pile/device_type.dart';
|
||||
import '../../../../service/pile/input.dart';
|
||||
import '../../../../service/pile/public_widget.dart';
|
||||
import '../../task_page.dart';
|
||||
import '../../taskcontroller.dart';
|
||||
import 'pileGenerController.dart';
|
||||
|
||||
final ScenceMapController mapController = Get.find<ScenceMapController>();
|
||||
final PlumDataController controller = Get.find<PlumDataController>();
|
||||
final TaskController taskcontroller = Get.put(TaskController());
|
||||
|
||||
class PileGenerate extends StatefulWidget {
|
||||
const PileGenerate({super.key});
|
||||
@ -22,6 +25,14 @@ class PileGenerate extends StatefulWidget {
|
||||
}
|
||||
|
||||
class _PileGenerateState extends State<PileGenerate> {
|
||||
late StepDialogManager _showStepDialog;
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
_showStepDialog = StepDialogManager(context);
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
double titleTextWidth = 90;
|
||||
@ -90,6 +101,11 @@ class _PileGenerateState extends State<PileGenerate> {
|
||||
controller.checkValue.value = "checkPile",
|
||||
controller.isDirect.value = false,
|
||||
pilecontroller.isPileCardVisible.value = false,
|
||||
if (!taskcontroller.isDialogShown[1])
|
||||
{
|
||||
_showStepDialog.showStepDialog(1),
|
||||
taskcontroller.isDialogShown[1] = true
|
||||
}
|
||||
}),
|
||||
const SizedBox(
|
||||
width: 10,
|
||||
@ -103,6 +119,11 @@ class _PileGenerateState extends State<PileGenerate> {
|
||||
controller.centerXY.value =
|
||||
Offset(centerPointX, centerPointY),
|
||||
pilecontroller.isPileCardVisible.value = false,
|
||||
if (!taskcontroller.isDialogShown[3])
|
||||
{
|
||||
_showStepDialog.showStepDialog(3),
|
||||
taskcontroller.isDialogShown[3] = true
|
||||
}
|
||||
}),
|
||||
],
|
||||
),
|
||||
@ -227,6 +248,7 @@ class _PileGenerateState extends State<PileGenerate> {
|
||||
id: i + 1,
|
||||
radius: 0.3);
|
||||
mapController.pilePoints.add(pilePoint);
|
||||
|
||||
}
|
||||
controller.isGenerate.value = false;
|
||||
controller.isDirect.value = false;
|
@ -8,12 +8,15 @@ import 'package:scence_map/record_entity.dart';
|
||||
import 'package:scence_map/scence_map.dart';
|
||||
import 'package:get/get.dart';
|
||||
|
||||
import '../../../models/pilePoint/hyrecorditem.dart';
|
||||
import '../../pass_track/view.dart';
|
||||
import '../../task/task_page.dart';
|
||||
import '../../../../models/pilePoint/hyrecorditem.dart';
|
||||
import '../../../pass_track/view.dart';
|
||||
import '../../task_page.dart';
|
||||
import '../../taskcontroller.dart';
|
||||
import '../pileGenerateCard/pileGenerate.dart';
|
||||
import 'draw_pile.dart';
|
||||
|
||||
final TaskController taskcontroller = Get.put(TaskController());
|
||||
|
||||
class RealView extends StatefulWidget {
|
||||
const RealView({super.key});
|
||||
|
||||
@ -25,6 +28,7 @@ class _RealViewState extends State<RealView> {
|
||||
final ScenceMapController scenceMapController =
|
||||
Get.put(ScenceMapController());
|
||||
final controller = Get.find<PlumDataController>();
|
||||
late StepDialogManager _showStepDialog;
|
||||
@override
|
||||
void dispose() {
|
||||
super.dispose();
|
||||
@ -34,7 +38,7 @@ class _RealViewState extends State<RealView> {
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
// scenceMapController.disableMove.value = false;
|
||||
_showStepDialog = StepDialogManager(context);
|
||||
scenceMapController.update();
|
||||
isInit = true;
|
||||
}
|
||||
@ -56,7 +60,7 @@ class _RealViewState extends State<RealView> {
|
||||
|
||||
RecordEntity? checkPoint =
|
||||
scenceMapController.pointInfo(controller.centerXY.value);
|
||||
|
||||
|
||||
if (checkPoint != null) {
|
||||
controller.isPileId.value = true;
|
||||
// controller.checkName.value = checkPoint.tpId.toString();
|
||||
@ -190,6 +194,11 @@ class _RealViewState extends State<RealView> {
|
||||
onPressed: () {
|
||||
pilecontroller.isRealViewCardVisible.value = true;
|
||||
controller.isDirect.value = true;
|
||||
if (!taskcontroller.isDialogShown[3]) {
|
||||
_showStepDialog.showStepDialog(3);
|
||||
|
||||
taskcontroller.isDialogShown[3] = true;
|
||||
}
|
||||
},
|
||||
),
|
||||
));
|
@ -1,5 +1,5 @@
|
||||
import 'package:cpnav/main.dart';
|
||||
import 'package:cpnav/pages/pile/pileGenerateCard/pileGenerate.dart';
|
||||
import 'package:cpnav/pages/task/pile/pileGenerateCard/pileGenerate.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:get/get_connect/http/src/utils/utils.dart';
|
||||
@ -9,8 +9,9 @@ import 'package:scence_map/scence_map.dart';
|
||||
import '../aim_point/aimpoint_page.dart';
|
||||
import '../pass_track/controller.dart';
|
||||
import '../pass_track/view.dart';
|
||||
import '../pile/pileGenerateCard/pilePointTable.dart';
|
||||
import '../pile/pileNav/view.dart';
|
||||
import 'pile/pileGenerateCard/pilePointTable.dart';
|
||||
import 'pile/pileNav/view.dart';
|
||||
import 'taskcontroller.dart';
|
||||
|
||||
final ScenceMapController mapcontroller = Get.put(ScenceMapController());
|
||||
|
||||
@ -105,8 +106,23 @@ class TaskManagePage extends StatelessWidget {
|
||||
}
|
||||
|
||||
final controller = Get.put(PassTrackController("TEST", "pile_cm"));
|
||||
final TaskController taskcontroller = Get.put(TaskController());
|
||||
|
||||
// class TaskPage extends StatelessWidget {
|
||||
class TaskPage extends StatefulWidget {
|
||||
@override
|
||||
_TaskPageState createState() => _TaskPageState();
|
||||
}
|
||||
|
||||
class _TaskPageState extends State<TaskPage> {
|
||||
late StepDialogManager _showStepDialog;
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
_showStepDialog = StepDialogManager(context);
|
||||
}
|
||||
|
||||
class TaskPage extends StatelessWidget {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final size = MediaQuery.of(context).size;
|
||||
@ -123,7 +139,71 @@ class TaskPage extends StatelessWidget {
|
||||
onUpdate: (updatedPilePoints) {
|
||||
// 这里可以处理更新后的桩点列表
|
||||
print("生成桩点$updatedPilePoints,");
|
||||
mapController.recordList.add(updatedPilePoints as RecordEntity);
|
||||
updatedPilePoints.forEach((updatedPilePoint) {
|
||||
// 查找 recordList 中对应的 RecordEntity
|
||||
RecordEntity? recordEntity =
|
||||
mapController.recordList.firstWhere(
|
||||
(record) => record.id == updatedPilePoint.id,
|
||||
orElse: () => RecordEntity(
|
||||
id: -1, // 使用一个无效的 id 表示未找到
|
||||
tid: 0,
|
||||
startTime: DateTime.now(),
|
||||
endTime: DateTime.now(),
|
||||
pileId: 0,
|
||||
name: '',
|
||||
times: 0,
|
||||
lat: 0.0,
|
||||
lng: 0.0,
|
||||
x: 0.0,
|
||||
y: 0.0,
|
||||
h: 0.0,
|
||||
totalFlow: 0.0,
|
||||
titlXavg: 0.0,
|
||||
titlYavg: 0.0,
|
||||
current1Avg: 0.0,
|
||||
current2Avg: 0.0,
|
||||
quality: 0,
|
||||
reason: '',
|
||||
remark: '',
|
||||
depth: 0,
|
||||
speed: 0.0,
|
||||
),
|
||||
);
|
||||
|
||||
if (recordEntity.id != -1) {
|
||||
// 更新 RecordEntity 的属性
|
||||
recordEntity.x = updatedPilePoint.x;
|
||||
recordEntity.y = updatedPilePoint.y;
|
||||
// 其他属性的更新
|
||||
} else {
|
||||
// 如果找不到对应的 RecordEntity,则添加新的
|
||||
recordEntity = RecordEntity(
|
||||
id: updatedPilePoint.id,
|
||||
tid: 0,
|
||||
startTime: DateTime.now(),
|
||||
endTime: DateTime.now(),
|
||||
pileId: 0,
|
||||
name: '',
|
||||
times: 0,
|
||||
lat: 0.0,
|
||||
lng: 0.0,
|
||||
x: updatedPilePoint.x,
|
||||
y: updatedPilePoint.y,
|
||||
h: 0.0,
|
||||
totalFlow: 0.0,
|
||||
titlXavg: 0.0,
|
||||
titlYavg: 0.0,
|
||||
current1Avg: 0.0,
|
||||
current2Avg: 0.0,
|
||||
quality: 0,
|
||||
reason: '',
|
||||
remark: '',
|
||||
depth: 0,
|
||||
speed: 0.0,
|
||||
);
|
||||
mapController.recordList.add(recordEntity);
|
||||
}
|
||||
});
|
||||
},
|
||||
),
|
||||
),
|
||||
@ -145,18 +225,6 @@ class TaskPage extends StatelessWidget {
|
||||
),
|
||||
onTap: () => Scaffold.of(context).openEndDrawer(),
|
||||
),
|
||||
|
||||
// Navigator.push(
|
||||
// context,
|
||||
// MaterialPageRoute(
|
||||
// builder: (context) => PilePointTable(
|
||||
// pilePoints: mapcontroller.pilePoints,
|
||||
// onUpdate: (updatedPilePoints) {
|
||||
// // 这里可以处理更新后的桩点列表
|
||||
// print("生成桩点$updatedPilePoints,");
|
||||
// },
|
||||
// ),
|
||||
// )),
|
||||
),
|
||||
),
|
||||
),
|
||||
@ -164,17 +232,23 @@ class TaskPage extends StatelessWidget {
|
||||
UnconstrainedBox(
|
||||
child: SizedBox(
|
||||
height: 30,
|
||||
child: Obx(
|
||||
() => InkWell(
|
||||
child: Icon(
|
||||
child: InkWell(
|
||||
child: Obx(
|
||||
() => Icon(
|
||||
Icons.settings_outlined,
|
||||
size: 35,
|
||||
color: appcontroller.isDarkMode.value
|
||||
? Colors.white70
|
||||
: const Color.fromARGB(200, 29, 28, 28),
|
||||
),
|
||||
onTap: () => pilecontroller.isPileCardVisible.value = true,
|
||||
),
|
||||
onTap: () {
|
||||
pilecontroller.isPileCardVisible.value = true;
|
||||
if (!taskcontroller.isDialogShown[0]) {
|
||||
_showStepDialog.showStepDialog(0);
|
||||
taskcontroller.isDialogShown[0] = true;
|
||||
}
|
||||
},
|
||||
),
|
||||
),
|
||||
),
|
||||
@ -187,7 +261,9 @@ class TaskPage extends StatelessWidget {
|
||||
onUpdate: (Offset center, double scale, double rotation) {
|
||||
print("center:$center scale:$scale rotation:$rotation");
|
||||
},
|
||||
forGroundPainter: BorderPainter(controller),
|
||||
forGroundPainter: appcontroller.currentIndex.value == 1
|
||||
? BorderPainter(controller)
|
||||
: null,
|
||||
onUpdatePilePoint: (RecordEntity? selectedPilePoint, double scale,
|
||||
double rotation) {
|
||||
print(
|
||||
@ -200,3 +276,40 @@ class TaskPage extends StatelessWidget {
|
||||
));
|
||||
}
|
||||
}
|
||||
|
||||
//对话框
|
||||
class StepDialogManager {
|
||||
final BuildContext context;
|
||||
final List<String> _stepTexts = [
|
||||
'点击屏幕即可确定桩点中心。',
|
||||
'这是步骤 2 的提示对话框。',
|
||||
'这是步骤 3 的提示对话框。',
|
||||
'点击方向设置按钮和输入宽度值可设置桩点范围。',
|
||||
'手指在屏幕上拖动可确定桩点范围'
|
||||
];
|
||||
|
||||
StepDialogManager(this.context);
|
||||
|
||||
void showStepDialog(int step) {
|
||||
showDialog(
|
||||
context: context,
|
||||
builder: (BuildContext context) {
|
||||
return AlertDialog(
|
||||
title: Text('步骤提示'),
|
||||
content: Text(_stepTexts[step]),
|
||||
actions: <Widget>[
|
||||
TextButton(
|
||||
child: Text('确定'),
|
||||
onPressed: () {
|
||||
Navigator.of(context).pop();
|
||||
for (int i = 0; i < taskcontroller.isDialogShown.length; i++) {
|
||||
taskcontroller.isDialogShown[i] = false;
|
||||
}
|
||||
},
|
||||
),
|
||||
],
|
||||
);
|
||||
},
|
||||
);
|
||||
}
|
||||
}
|
||||
|
5
lib/pages/task/taskcontroller.dart
Normal file
5
lib/pages/task/taskcontroller.dart
Normal file
@ -0,0 +1,5 @@
|
||||
import 'package:get/get.dart';
|
||||
|
||||
class TaskController extends GetxController {
|
||||
List<bool> isDialogShown = [false, false, false, false, false].obs;
|
||||
}
|
Loading…
Reference in New Issue
Block a user