抽屉修改
This commit is contained in:
parent
0006b0eefe
commit
ce3cc92ad7
File diff suppressed because one or more lines are too long
21
lib/pages/pile/pileGenerateCard/pileGenerController.dart
Normal file
21
lib/pages/pile/pileGenerateCard/pileGenerController.dart
Normal file
@ -0,0 +1,21 @@
|
||||
import 'package:get/get.dart';
|
||||
|
||||
class PileGenerController extends GetxController {
|
||||
var isPileCardVisible = false.obs; // 控制生成桩点的卡片是否可见
|
||||
var isRealViewCardVisible = false.obs; // 控制生成桩点的卡片是否可见
|
||||
@override
|
||||
void onInit() {
|
||||
super.onInit();
|
||||
// 监听 isRealViewCardVisible 的变化
|
||||
ever(isRealViewCardVisible, (bool isVisible) {
|
||||
if (isVisible) {
|
||||
isPileCardVisible.value = false;
|
||||
}
|
||||
});
|
||||
ever(isPileCardVisible, (bool isVisible) {
|
||||
if (isVisible) {
|
||||
isRealViewCardVisible.value = false;
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
341
lib/pages/pile/pileGenerateCard/pileGenerate.dart
Normal file
341
lib/pages/pile/pileGenerateCard/pileGenerate.dart
Normal file
@ -0,0 +1,341 @@
|
||||
import 'dart:math';
|
||||
|
||||
import 'package:cpnav/service/pile_cm.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
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 'pileGenerController.dart';
|
||||
|
||||
final ScenceMapController mapController = Get.find<ScenceMapController>();
|
||||
final PlumDataController controller = Get.find<PlumDataController>();
|
||||
|
||||
class PileGenerate extends StatefulWidget {
|
||||
const PileGenerate({super.key});
|
||||
|
||||
@override
|
||||
_PileGenerateState createState() => _PileGenerateState();
|
||||
}
|
||||
|
||||
class _PileGenerateState extends State<PileGenerate> {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
double titleTextWidth = 90;
|
||||
double inputLength = 120;
|
||||
FocusNode xFocus = FocusNode();
|
||||
FocusNode yFocus = FocusNode();
|
||||
FocusNode directionFocus = FocusNode();
|
||||
FocusNode pileSpaceFocus = FocusNode();
|
||||
FocusNode pileWidthFocus = FocusNode();
|
||||
DeviceType deviceType = getDeviceType(context);
|
||||
double fontSize = 16;
|
||||
if (deviceType == DeviceType.mobile) {
|
||||
fontSize = 16;
|
||||
} else {
|
||||
fontSize = 20;
|
||||
}
|
||||
double centerPointX = controller.centerXY.value.dx;
|
||||
double centerPointY = controller.centerXY.value.dy;
|
||||
|
||||
final size = MediaQuery.of(context).size;
|
||||
return OrientationBuilder(builder: ((context, orientation) {
|
||||
return Scaffold(
|
||||
appBar: AppBar(
|
||||
title: const Text("桩点生成"),
|
||||
toolbarHeight: 30,
|
||||
leading: IconButton(
|
||||
icon: Icon(Icons.close),
|
||||
onPressed: () {
|
||||
setState(() {
|
||||
pilecontroller.isPileCardVisible.value = false;
|
||||
pilecontroller.isRealViewCardVisible.value = false;
|
||||
});
|
||||
},
|
||||
),
|
||||
),
|
||||
body: SizedBox(
|
||||
height: size.height,
|
||||
child: Stack(
|
||||
children: [
|
||||
SingleChildScrollView(
|
||||
child: AlignWrapWidget(
|
||||
children: [
|
||||
Row(
|
||||
children: [
|
||||
const Text('地图显示:'),
|
||||
Obx(() => Switch(
|
||||
value: controller.isMap.value,
|
||||
onChanged: ((value) {
|
||||
controller.isMap.value = !controller.isMap.value;
|
||||
}))),
|
||||
],
|
||||
),
|
||||
AlignWrapWidget(
|
||||
children: [
|
||||
ElevatedButton(
|
||||
child: const Text("夯锤坐标"),
|
||||
onPressed: () => {controller.isDirect.value = false},
|
||||
),
|
||||
const SizedBox(
|
||||
width: 10,
|
||||
),
|
||||
ElevatedButton(
|
||||
child: const Text("桩点坐标"),
|
||||
onPressed: () => {
|
||||
controller.isGenerate.value = true,
|
||||
controller.checkValue.value = "checkPile",
|
||||
controller.isDirect.value = false,
|
||||
pilecontroller.isPileCardVisible.value = false,
|
||||
}),
|
||||
const SizedBox(
|
||||
width: 10,
|
||||
),
|
||||
ElevatedButton(
|
||||
child: const Text("方向设置"),
|
||||
onPressed: () => {
|
||||
controller.isGenerate.value = true,
|
||||
controller.checkValue.value = "checkDirection",
|
||||
controller.isDirect.value = true,
|
||||
controller.centerXY.value =
|
||||
Offset(centerPointX, centerPointY),
|
||||
pilecontroller.isPileCardVisible.value = false,
|
||||
}),
|
||||
],
|
||||
),
|
||||
Row(children: [
|
||||
FixedWidthTextWidget(width: titleTextWidth, text: "X:"),
|
||||
inputText(
|
||||
inputLength: inputLength,
|
||||
value: centerPointX.toString(),
|
||||
fontsize: fontSize,
|
||||
focusNode: yFocus,
|
||||
onChanged: (value) => value.isNotEmpty
|
||||
? centerPointY = double.parse(value)
|
||||
: '')
|
||||
]),
|
||||
Row(children: [
|
||||
FixedWidthTextWidget(width: titleTextWidth, text: "Y:"),
|
||||
inputText(
|
||||
inputLength: inputLength,
|
||||
value: centerPointY.toString(),
|
||||
fontsize: fontSize,
|
||||
focusNode: xFocus,
|
||||
onChanged: (value) => value.isNotEmpty
|
||||
? centerPointX = double.parse(value)
|
||||
: '')
|
||||
]),
|
||||
Row(children: [
|
||||
FixedWidthTextWidget(width: titleTextWidth, text: "方向(°):"),
|
||||
inputText(
|
||||
inputLength: inputLength,
|
||||
value: controller.direction.toString(),
|
||||
fontsize: fontSize,
|
||||
focusNode: directionFocus,
|
||||
keyboardType: 0,
|
||||
onChanged: (value) {
|
||||
if (value.isNotEmpty) {
|
||||
controller.direction.value = double.parse(value);
|
||||
// bug 值修改后 绘制没有变化
|
||||
controller.angle.value =
|
||||
controller.direction.value * pi / 180;
|
||||
}
|
||||
})
|
||||
]),
|
||||
Row(children: [
|
||||
FixedWidthTextWidget(
|
||||
width: titleTextWidth + 10, text: "夯点间距(m):"),
|
||||
inputText(
|
||||
inputLength: inputLength - 10,
|
||||
fontsize: fontSize,
|
||||
value: controller.space.toString(),
|
||||
focusNode: pileSpaceFocus,
|
||||
onChanged: (value) => {
|
||||
value.isNotEmpty
|
||||
? controller.space.value = double.parse(value)
|
||||
: '',
|
||||
})
|
||||
]),
|
||||
Row(children: [
|
||||
FixedWidthTextWidget(
|
||||
width: titleTextWidth + 10, text: "宽度(m):"),
|
||||
inputText(
|
||||
inputLength: inputLength - 10,
|
||||
fontsize: fontSize,
|
||||
value: controller.pileWidth.toString(),
|
||||
focusNode: pileWidthFocus,
|
||||
onChanged: (value) => {
|
||||
value.isNotEmpty
|
||||
? controller.pileWidth.value =
|
||||
double.parse(value)
|
||||
: '',
|
||||
})
|
||||
]),
|
||||
Row(children: [
|
||||
const Icon(
|
||||
Icons.tips_and_updates_outlined,
|
||||
color: Colors.red,
|
||||
),
|
||||
Text(
|
||||
controller.isPileId.value
|
||||
? '选中桩点:${controller.checkName.value}'
|
||||
: ' 未选中桩点',
|
||||
style: TextStyle(
|
||||
color: !controller.isPileId.value
|
||||
? Colors.red
|
||||
: Colors.black),
|
||||
)
|
||||
]),
|
||||
],
|
||||
)),
|
||||
Positioned(
|
||||
bottom: 10,
|
||||
child: Row(
|
||||
children: [
|
||||
TextButton(
|
||||
child: const Text('取消'),
|
||||
onPressed: () {
|
||||
controller.isGenerate.value = false;
|
||||
controller.isDirect.value = false;
|
||||
controller.isSave.value = false;
|
||||
// 执行取消的逻辑
|
||||
},
|
||||
),
|
||||
TextButton(
|
||||
child: const Text('确定'),
|
||||
onPressed: () {
|
||||
// 执行确定的逻辑
|
||||
var dx = (controller.canvasSize.width) / 2;
|
||||
var dy = (controller.canvasSize.height) / 2;
|
||||
var rotation = mapController.rotation.value;
|
||||
for (int i = 0; i < controller.plumList.length; i++) {
|
||||
Offset item = controller.plumList[i];
|
||||
|
||||
var dx1 = ((item.dx - dx) * cos(rotation) +
|
||||
(item.dy - dy) * sin(rotation));
|
||||
var dy1 = -(item.dx - dx) * sin(rotation) +
|
||||
(item.dy - dy) * cos(rotation);
|
||||
dx1 = double.parse(
|
||||
(dx1 * 1000 / 1000).toStringAsFixed(3));
|
||||
dy1 = double.parse(
|
||||
(dy1 * 1000 / 1000).toStringAsFixed(3));
|
||||
Offset xy = mapController.ScreenCenter2xy(dx1, dy1);
|
||||
PilePoint pilePoint = PilePoint(
|
||||
x: xy.dx,
|
||||
y: xy.dy,
|
||||
times: 0,
|
||||
id: i + 1,
|
||||
radius: 0.3);
|
||||
mapController.pilePoints.add(pilePoint);
|
||||
}
|
||||
controller.isGenerate.value = false;
|
||||
controller.isDirect.value = false;
|
||||
controller.isSave.value = true;
|
||||
controller.centerXY.value =
|
||||
Offset(centerPointX, centerPointY);
|
||||
},
|
||||
),
|
||||
],
|
||||
))
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
}));
|
||||
}
|
||||
}
|
||||
|
||||
final PileGenerController pilecontroller = Get.put(PileGenerController());
|
||||
|
||||
//卡片
|
||||
class PileGenerateCard extends StatelessWidget {
|
||||
const PileGenerateCard();
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final Size size = MediaQuery.of(context).size;
|
||||
MediaQueryData mediaQueryData =
|
||||
MediaQueryData.fromView(WidgetsBinding.instance.window); //获取当前屏幕信息
|
||||
final orientation = mediaQueryData.orientation; //获得设备方向
|
||||
double rectWidth = size.width;
|
||||
final deviceType = getDeviceType(context);
|
||||
if (orientation == Orientation.landscape) {
|
||||
rectWidth = size.width / 2;
|
||||
if (deviceType == DeviceType.mobile) {
|
||||
rectWidth = size.height - 130;
|
||||
}
|
||||
} else {
|
||||
rectWidth = size.height / 2;
|
||||
if (deviceType == DeviceType.mobile) {
|
||||
rectWidth = size.width - 5;
|
||||
}
|
||||
}
|
||||
|
||||
return Obx(() => Visibility(
|
||||
visible: pilecontroller.isPileCardVisible.value,
|
||||
child: Positioned(
|
||||
right: 0,
|
||||
top: 0,
|
||||
width: rectWidth - 30,
|
||||
height: rectWidth + 45,
|
||||
child: Stack(children: [
|
||||
Container(
|
||||
decoration: const BoxDecoration(color: Colors.transparent),
|
||||
child: Stack(children: [
|
||||
Card(
|
||||
color: Colors.transparent,
|
||||
elevation: 5.0,
|
||||
child: PileGenerate(),
|
||||
),
|
||||
]))
|
||||
]))));
|
||||
}
|
||||
}
|
||||
|
||||
//卡片
|
||||
class PileGenerateCard1 extends StatelessWidget {
|
||||
const PileGenerateCard1();
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final Size size = MediaQuery.of(context).size;
|
||||
MediaQueryData mediaQueryData =
|
||||
MediaQueryData.fromView(WidgetsBinding.instance.window); //获取当前屏幕信息
|
||||
final orientation = mediaQueryData.orientation; //获得设备方向
|
||||
double rectWidth = size.width;
|
||||
final deviceType = getDeviceType(context);
|
||||
if (orientation == Orientation.landscape) {
|
||||
rectWidth = size.width / 2;
|
||||
if (deviceType == DeviceType.mobile) {
|
||||
rectWidth = size.height - 130;
|
||||
}
|
||||
} else {
|
||||
rectWidth = size.height / 2;
|
||||
if (deviceType == DeviceType.mobile) {
|
||||
rectWidth = size.width - 5;
|
||||
}
|
||||
}
|
||||
|
||||
return Obx(() => Visibility(
|
||||
visible: pilecontroller.isRealViewCardVisible.value,
|
||||
child: Positioned(
|
||||
right: 0,
|
||||
top: 0,
|
||||
width: rectWidth - 30,
|
||||
height: rectWidth + 45,
|
||||
child: Stack(children: [
|
||||
Container(
|
||||
decoration: const BoxDecoration(color: Colors.transparent),
|
||||
child: Stack(children: [
|
||||
Card(
|
||||
color: Colors.transparent,
|
||||
elevation: 5.0,
|
||||
child: PileGenerate(),
|
||||
),
|
||||
]))
|
||||
]))));
|
||||
}
|
||||
}
|
165
lib/pages/pile/pileGenerateCard/pilePointTable.dart
Normal file
165
lib/pages/pile/pileGenerateCard/pilePointTable.dart
Normal file
@ -0,0 +1,165 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:scence_map/controllers/controller.dart';
|
||||
|
||||
class PilePointTable extends StatefulWidget {
|
||||
final List<PilePoint> pilePoints;
|
||||
final Function(List<PilePoint>) onUpdate;
|
||||
|
||||
PilePointTable({required this.pilePoints, required this.onUpdate});
|
||||
|
||||
@override
|
||||
_PilePointTableState createState() => _PilePointTableState();
|
||||
}
|
||||
|
||||
class _PilePointTableState extends State<PilePointTable> {
|
||||
List<bool> _selected = [];
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
_selected = List<bool>.filled(widget.pilePoints.length, false);
|
||||
}
|
||||
|
||||
void _deleteSelected() {
|
||||
setState(() {
|
||||
widget.pilePoints
|
||||
.removeWhere((point) => _selected[widget.pilePoints.indexOf(point)]);
|
||||
_selected = List<bool>.filled(widget.pilePoints.length, false);
|
||||
widget.onUpdate(widget.pilePoints);
|
||||
});
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
appBar: AppBar(
|
||||
title: Text('桩点列表'),
|
||||
actions: [
|
||||
IconButton(
|
||||
icon: Icon(Icons.delete),
|
||||
onPressed: _deleteSelected,
|
||||
),
|
||||
],
|
||||
),
|
||||
body: SingleChildScrollView(
|
||||
scrollDirection: Axis.vertical,
|
||||
child: Table(
|
||||
border: const TableBorder(
|
||||
verticalInside: BorderSide(color: Colors.grey, width: 1.0),
|
||||
horizontalInside: BorderSide(color: Colors.grey, width: 1.0),
|
||||
),
|
||||
columnWidths: const {
|
||||
0: IntrinsicColumnWidth(),
|
||||
1: IntrinsicColumnWidth(),
|
||||
2: IntrinsicColumnWidth(),
|
||||
3: IntrinsicColumnWidth(),
|
||||
},
|
||||
children: [
|
||||
const TableRow(
|
||||
children: [
|
||||
Center(child: Text('选择')),
|
||||
Center(child: Text('ID')),
|
||||
Center(child: Text('X')),
|
||||
Center(child: Text('Y')),
|
||||
],
|
||||
),
|
||||
...List<TableRow>.generate(
|
||||
widget.pilePoints.length,
|
||||
(index) => TableRow(
|
||||
children: [
|
||||
TableCell(
|
||||
verticalAlignment: TableCellVerticalAlignment.middle,
|
||||
child: Padding(
|
||||
padding: EdgeInsets.symmetric(horizontal: 12.0),
|
||||
child: Checkbox(
|
||||
value: _selected[index],
|
||||
onChanged: (bool? value) {
|
||||
setState(() {
|
||||
_selected[index] = value ?? false;
|
||||
});
|
||||
},
|
||||
),
|
||||
),
|
||||
),
|
||||
TableCell(
|
||||
verticalAlignment: TableCellVerticalAlignment.middle,
|
||||
child: Padding(
|
||||
padding: EdgeInsets.symmetric(horizontal: 12.0),
|
||||
child: Text(widget.pilePoints[index].id.toString()),
|
||||
),
|
||||
),
|
||||
TableCell(
|
||||
verticalAlignment: TableCellVerticalAlignment.middle,
|
||||
child: Padding(
|
||||
padding: EdgeInsets.symmetric(horizontal: 12.0),
|
||||
child: GestureDetector(
|
||||
onTap: () => _editPilePoint(context, index, 'x'),
|
||||
child:
|
||||
Text(widget.pilePoints[index].x.toString()),
|
||||
),
|
||||
),
|
||||
),
|
||||
TableCell(
|
||||
verticalAlignment: TableCellVerticalAlignment.middle,
|
||||
child: Padding(
|
||||
padding: EdgeInsets.symmetric(horizontal: 12.0),
|
||||
child: GestureDetector(
|
||||
onTap: () => _editPilePoint(context, index, 'y'),
|
||||
child:
|
||||
Text(widget.pilePoints[index].y.toString()),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
void _editPilePoint(BuildContext context, int index, String field) {
|
||||
TextEditingController controller = TextEditingController(
|
||||
text: field == 'x'
|
||||
? widget.pilePoints[index].x.toString()
|
||||
: widget.pilePoints[index].y.toString(),
|
||||
);
|
||||
|
||||
showDialog(
|
||||
context: context,
|
||||
builder: (context) {
|
||||
return AlertDialog(
|
||||
title: Text('编辑桩点'),
|
||||
content: TextField(
|
||||
controller: controller,
|
||||
keyboardType: TextInputType.number,
|
||||
decoration: InputDecoration(labelText: field == 'x' ? 'X' : 'Y'),
|
||||
),
|
||||
actions: [
|
||||
TextButton(
|
||||
onPressed: () {
|
||||
setState(() {
|
||||
if (field == 'x') {
|
||||
widget.pilePoints[index].x = double.parse(controller.text);
|
||||
} else {
|
||||
widget.pilePoints[index].y = double.parse(controller.text);
|
||||
}
|
||||
widget.onUpdate(widget.pilePoints);
|
||||
});
|
||||
Navigator.of(context).pop();
|
||||
},
|
||||
child: Text('保存'),
|
||||
),
|
||||
TextButton(
|
||||
onPressed: () {
|
||||
Navigator.of(context).pop();
|
||||
},
|
||||
child: Text('取消'),
|
||||
),
|
||||
],
|
||||
);
|
||||
},
|
||||
);
|
||||
}
|
||||
}
|
@ -107,10 +107,6 @@ class DrawDirection extends CustomPainter {
|
||||
}
|
||||
}
|
||||
|
||||
// if (plumList.isNotEmpty) {
|
||||
// controller.plumList.value = plumList;
|
||||
// // controller.update();
|
||||
// }
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -3,6 +3,7 @@ import 'dart:math';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:scence_map/controllers/controller.dart';
|
||||
import 'package:scence_map/controllers/plumController.dart';
|
||||
import 'package:scence_map/record_entity.dart';
|
||||
|
||||
import 'package:scence_map/scence_map.dart';
|
||||
import 'package:get/get.dart';
|
||||
@ -10,6 +11,7 @@ import 'package:get/get.dart';
|
||||
import '../../../models/pilePoint/hyrecorditem.dart';
|
||||
import '../../pass_track/view.dart';
|
||||
import '../../task/task_page.dart';
|
||||
import '../pileGenerateCard/pileGenerate.dart';
|
||||
import 'draw_pile.dart';
|
||||
|
||||
class RealView extends StatefulWidget {
|
||||
@ -52,16 +54,16 @@ class _RealViewState extends State<RealView> {
|
||||
Offset sc2xy = scenceMapController.screen2xy0(details.localPosition);
|
||||
controller.centerXY.value = sc2xy;
|
||||
|
||||
HyRecordItem? checkPoint =
|
||||
RecordEntity? checkPoint =
|
||||
scenceMapController.pointInfo(controller.centerXY.value);
|
||||
|
||||
if (checkPoint != null) {
|
||||
controller.isPileId.value = true;
|
||||
controller.checkName.value = checkPoint.tpId.toString();
|
||||
// controller.checkName.value = checkPoint.tpId.toString();
|
||||
} else {
|
||||
controller.isPileId.value = false;
|
||||
controller.checkName.value = "未找到";
|
||||
}
|
||||
Scaffold.of(context).openEndDrawer();
|
||||
}
|
||||
}
|
||||
|
||||
@ -186,8 +188,8 @@ class _RealViewState extends State<RealView> {
|
||||
),
|
||||
child: const Icon(Icons.keyboard_return),
|
||||
onPressed: () {
|
||||
Scaffold.of(context).openEndDrawer();
|
||||
controller.isDirect.value = false;
|
||||
pilecontroller.isRealViewCardVisible.value = true;
|
||||
controller.isDirect.value = true;
|
||||
},
|
||||
),
|
||||
));
|
||||
@ -201,13 +203,14 @@ class _RealViewState extends State<RealView> {
|
||||
// child: const ScenceMapView(
|
||||
// children: [],
|
||||
// ),
|
||||
child:TaskPage(), // 任务页面
|
||||
// PassTrack(
|
||||
// date: '',
|
||||
// )
|
||||
child: TaskPage(), // 任务页面
|
||||
// PassTrack(
|
||||
// date: '',
|
||||
// )
|
||||
)),
|
||||
center,
|
||||
back,
|
||||
PileGenerateCard1()
|
||||
],
|
||||
);
|
||||
}
|
||||
|
@ -1,232 +0,0 @@
|
||||
import 'dart:math';
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
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';
|
||||
|
||||
final ScenceMapController mapController = Get.find<ScenceMapController>();
|
||||
|
||||
class PileGenerate extends GetView<PlumDataController> {
|
||||
const PileGenerate({super.key});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
double titleTextWidth = 90;
|
||||
double inputLength = 120;
|
||||
FocusNode xFocus = FocusNode();
|
||||
FocusNode yFocus = FocusNode();
|
||||
FocusNode directionFocus = FocusNode();
|
||||
FocusNode pileSpaceFocus = FocusNode();
|
||||
FocusNode pileWidthFocus = FocusNode();
|
||||
DeviceType deviceType = getDeviceType(context);
|
||||
double fontSize = 16;
|
||||
if (deviceType == DeviceType.mobile) {
|
||||
fontSize = 16;
|
||||
} else {
|
||||
fontSize = 20;
|
||||
}
|
||||
double centerPointX = controller.centerXY.value.dx;
|
||||
double centerPointY = controller.centerXY.value.dy;
|
||||
|
||||
final size = MediaQuery.of(context).size;
|
||||
return Scaffold(
|
||||
appBar: AppBar(
|
||||
title: const Text("桩点生成"),
|
||||
toolbarHeight: 30,
|
||||
),
|
||||
body: SizedBox(
|
||||
height: size.height,
|
||||
child: Stack(
|
||||
children: [
|
||||
SingleChildScrollView(
|
||||
child: AlignWrapWidget(
|
||||
children: [
|
||||
Row(
|
||||
children: [
|
||||
const Text('地图显示:'),
|
||||
Obx(() => Switch(
|
||||
value: controller.isMap.value,
|
||||
onChanged: ((value) {
|
||||
controller.isMap.value = !controller.isMap.value;
|
||||
}))),
|
||||
],
|
||||
),
|
||||
AlignWrapWidget(
|
||||
children: [
|
||||
ElevatedButton(
|
||||
child: const Text("夯锤坐标"),
|
||||
onPressed: () => {controller.isDirect.value = false},
|
||||
),
|
||||
const SizedBox(
|
||||
width: 10,
|
||||
),
|
||||
ElevatedButton(
|
||||
child: const Text("桩点坐标"),
|
||||
onPressed: () => {
|
||||
controller.isGenerate.value = true,
|
||||
controller.checkValue.value = "checkPile",
|
||||
controller.isDirect.value = false,
|
||||
// controller.checkValue.value = "checkDirection",
|
||||
// controller.isDirect.value = true,
|
||||
// controller.centerXY.value =
|
||||
// Offset(centerPointX, centerPointY),
|
||||
}),
|
||||
const SizedBox(
|
||||
width: 10,
|
||||
),
|
||||
ElevatedButton(
|
||||
child: const Text("方向设置"),
|
||||
onPressed: () => {
|
||||
controller.isGenerate.value = true,
|
||||
controller.checkValue.value = "checkDirection",
|
||||
controller.isDirect.value = true,
|
||||
controller.centerXY.value =
|
||||
Offset(centerPointX, centerPointY),
|
||||
Navigator.pop(context)
|
||||
}),
|
||||
],
|
||||
),
|
||||
Row(children: [
|
||||
FixedWidthTextWidget(width: titleTextWidth, text: "X:"),
|
||||
inputText(
|
||||
inputLength: inputLength,
|
||||
value: centerPointX.toString(),
|
||||
fontsize: fontSize,
|
||||
focusNode: yFocus,
|
||||
onChanged: (value) => value.isNotEmpty
|
||||
? centerPointY = double.parse(value)
|
||||
: '')
|
||||
]),
|
||||
Row(children: [
|
||||
FixedWidthTextWidget(width: titleTextWidth, text: "Y:"),
|
||||
inputText(
|
||||
inputLength: inputLength,
|
||||
value: centerPointY.toString(),
|
||||
fontsize: fontSize,
|
||||
focusNode: xFocus,
|
||||
onChanged: (value) => value.isNotEmpty
|
||||
? centerPointX = double.parse(value)
|
||||
: '')
|
||||
]),
|
||||
Row(children: [
|
||||
FixedWidthTextWidget(width: titleTextWidth, text: "方向(°):"),
|
||||
inputText(
|
||||
inputLength: inputLength,
|
||||
value: controller.direction.toString(),
|
||||
fontsize: fontSize,
|
||||
focusNode: directionFocus,
|
||||
keyboardType: 0,
|
||||
onChanged: (value) {
|
||||
if (value.isNotEmpty) {
|
||||
controller.direction.value = double.parse(value);
|
||||
// bug 值修改后 绘制没有变化
|
||||
controller.angle.value =
|
||||
controller.direction.value * pi / 180;
|
||||
}
|
||||
})
|
||||
]),
|
||||
Row(children: [
|
||||
FixedWidthTextWidget(
|
||||
width: titleTextWidth + 10, text: "夯点间距(m):"),
|
||||
inputText(
|
||||
inputLength: inputLength - 10,
|
||||
fontsize: fontSize,
|
||||
value: controller.space.toString(),
|
||||
focusNode: pileSpaceFocus,
|
||||
onChanged: (value) => {
|
||||
value.isNotEmpty
|
||||
? controller.space.value = double.parse(value)
|
||||
: '',
|
||||
})
|
||||
]),
|
||||
Row(children: [
|
||||
FixedWidthTextWidget(
|
||||
width: titleTextWidth + 10, text: "宽度(m):"),
|
||||
inputText(
|
||||
inputLength: inputLength - 10,
|
||||
fontsize: fontSize,
|
||||
value: controller.pileWidth.toString(),
|
||||
focusNode: pileWidthFocus,
|
||||
onChanged: (value) => {
|
||||
value.isNotEmpty
|
||||
? controller.pileWidth.value =
|
||||
double.parse(value)
|
||||
: '',
|
||||
})
|
||||
]),
|
||||
Row(children: [
|
||||
const Icon(
|
||||
Icons.tips_and_updates_outlined,
|
||||
color: Colors.red,
|
||||
),
|
||||
Text(
|
||||
controller.isPileId.value
|
||||
? '选中桩点:${controller.checkName.value}'
|
||||
: ' 未选中桩点',
|
||||
style: TextStyle(
|
||||
color: !controller.isPileId.value
|
||||
? Colors.red
|
||||
: Colors.black),
|
||||
)
|
||||
]),
|
||||
],
|
||||
)),
|
||||
Positioned(
|
||||
bottom: 10,
|
||||
child: Row(
|
||||
children: [
|
||||
TextButton(
|
||||
child: const Text('取消'),
|
||||
onPressed: () {
|
||||
controller.isGenerate.value = false;
|
||||
controller.isDirect.value = false;
|
||||
controller.isSave.value = false;
|
||||
// 执行取消的逻辑
|
||||
Navigator.of(context).pop();
|
||||
},
|
||||
),
|
||||
TextButton(
|
||||
child: const Text('确定'),
|
||||
onPressed: () {
|
||||
// 执行确定的逻辑
|
||||
var dx = (controller.canvasSize.width) / 2;
|
||||
var dy = (controller.canvasSize.height) / 2;
|
||||
var rotation = mapController.rotation.value;
|
||||
for (int i = 0; i < controller.plumList.length; i++) {
|
||||
Offset item = controller.plumList[i];
|
||||
|
||||
var dx1 = (item.dx - dx) * cos(rotation) +
|
||||
(item.dy - dy) * sin(rotation);
|
||||
var dy1 = -(item.dx - dx) * sin(rotation) +
|
||||
(item.dy - dy) * cos(rotation);
|
||||
Offset xy = mapController.ScreenCenter2xy(dx1, dy1);
|
||||
PilePoint pilePoint = PilePoint(
|
||||
x: xy.dx,
|
||||
y: xy.dy,
|
||||
state: 0,
|
||||
id: i + 1,
|
||||
radius: 0.3);
|
||||
mapController.pilePoints.add(pilePoint);
|
||||
}
|
||||
controller.isGenerate.value = false;
|
||||
controller.isDirect.value = false;
|
||||
controller.isSave.value = true;
|
||||
controller.centerXY.value =
|
||||
Offset(centerPointX, centerPointY);
|
||||
|
||||
Navigator.of(context).pop();
|
||||
},
|
||||
),
|
||||
],
|
||||
))
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
@ -1,99 +1,106 @@
|
||||
import 'package:cpnav/main.dart';
|
||||
import 'package:cpnav/pages/pile/rightDra/pileGenerate.dart';
|
||||
import 'package:cpnav/pages/pile/pileGenerateCard/pileGenerate.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:get/get_connect/http/src/utils/utils.dart';
|
||||
import 'package:scence_map/controllers/controller.dart';
|
||||
import 'package:scence_map/record_entity.dart';
|
||||
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';
|
||||
|
||||
final ScenceMapController mapcontroller = Get.put(ScenceMapController());
|
||||
|
||||
class TaskManagePage extends StatelessWidget {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final size = MediaQuery.of(context).size;
|
||||
|
||||
return Center(
|
||||
child: Container(
|
||||
width: size.width * 0.8,
|
||||
height: size.height * 0.18,
|
||||
decoration: BoxDecoration(
|
||||
border: Border.all(color: Colors.black),
|
||||
borderRadius: BorderRadius.circular(10),
|
||||
),
|
||||
child: SingleChildScrollView(
|
||||
child: Row(children: [
|
||||
SizedBox(width: 16),
|
||||
Icon(Icons.task, size: 50, color: Color.fromARGB(164, 75, 73, 73)),
|
||||
SizedBox(width: 16),
|
||||
Container(
|
||||
width: size.width * 0.4,
|
||||
child: const Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
SizedBox(height: 5),
|
||||
Text(
|
||||
'任务',
|
||||
style: TextStyle(fontSize: 24, fontWeight: FontWeight.bold),
|
||||
),
|
||||
Row(children: [
|
||||
Expanded(
|
||||
child: TextField(
|
||||
keyboardType: TextInputType.emailAddress,
|
||||
decoration: InputDecoration(
|
||||
labelText: "任务:",
|
||||
hintText: "",
|
||||
// prefixIcon: Icon(Icons.email),
|
||||
border: InputBorder.none, //隐藏下划线
|
||||
labelStyle: TextStyle(
|
||||
fontSize: 16, color: Color.fromARGB(164, 75, 73, 73)),
|
||||
),
|
||||
),
|
||||
),
|
||||
SizedBox(width: 5),
|
||||
Expanded(
|
||||
child: TextField(
|
||||
keyboardType: TextInputType.emailAddress,
|
||||
decoration: InputDecoration(
|
||||
labelText: "桩点数:",
|
||||
hintText: "0",
|
||||
// prefixIcon: Icon(Icons.email),
|
||||
border: InputBorder.none, //隐藏下划线
|
||||
labelStyle: TextStyle(
|
||||
fontSize: 16, color: Color.fromARGB(164, 75, 73, 73)),
|
||||
),
|
||||
),
|
||||
),
|
||||
]),
|
||||
],
|
||||
),
|
||||
return OrientationBuilder(builder: ((context, orientation) {
|
||||
return Center(
|
||||
child: Container(
|
||||
width: size.width * 0.8,
|
||||
height: size.height * 0.18,
|
||||
decoration: BoxDecoration(
|
||||
border: Border.all(color: Colors.black),
|
||||
borderRadius: BorderRadius.circular(10),
|
||||
),
|
||||
SizedBox(width: 150),
|
||||
Container(
|
||||
alignment: Alignment.centerLeft,
|
||||
child: Container(
|
||||
child: Row(children: [
|
||||
const Text(
|
||||
'编辑',
|
||||
style: TextStyle(
|
||||
fontSize: 14, color: Color.fromARGB(164, 75, 73, 73)),
|
||||
),
|
||||
SizedBox(width: 12),
|
||||
InkWell(
|
||||
onTap: () {
|
||||
Navigator.push(
|
||||
context,
|
||||
MaterialPageRoute(builder: (context) => RealView()),
|
||||
);
|
||||
},
|
||||
child: const Icon(Icons.arrow_forward_ios,
|
||||
size: 30, color: Color.fromARGB(164, 75, 73, 73)),
|
||||
)
|
||||
])))
|
||||
])),
|
||||
));
|
||||
child: SingleChildScrollView(
|
||||
child: Row(children: [
|
||||
SizedBox(width: 16),
|
||||
Icon(Icons.task, size: 50, color: Color.fromARGB(164, 75, 73, 73)),
|
||||
SizedBox(width: 16),
|
||||
Container(
|
||||
width: size.width * 0.4,
|
||||
child: const Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
SizedBox(height: 5),
|
||||
Text(
|
||||
'任务',
|
||||
style: TextStyle(fontSize: 24, fontWeight: FontWeight.bold),
|
||||
),
|
||||
Row(children: [
|
||||
Expanded(
|
||||
child: TextField(
|
||||
keyboardType: TextInputType.emailAddress,
|
||||
decoration: InputDecoration(
|
||||
labelText: "任务:",
|
||||
hintText: "",
|
||||
// prefixIcon: Icon(Icons.email),
|
||||
border: InputBorder.none, //隐藏下划线
|
||||
labelStyle: TextStyle(
|
||||
fontSize: 16,
|
||||
color: Color.fromARGB(164, 75, 73, 73)),
|
||||
),
|
||||
),
|
||||
),
|
||||
SizedBox(width: 5),
|
||||
Expanded(
|
||||
child: TextField(
|
||||
keyboardType: TextInputType.emailAddress,
|
||||
decoration: InputDecoration(
|
||||
labelText: "桩点数:",
|
||||
hintText: "0",
|
||||
// prefixIcon: Icon(Icons.email),
|
||||
border: InputBorder.none, //隐藏下划线
|
||||
labelStyle: TextStyle(
|
||||
fontSize: 16,
|
||||
color: Color.fromARGB(164, 75, 73, 73)),
|
||||
),
|
||||
),
|
||||
),
|
||||
]),
|
||||
],
|
||||
),
|
||||
),
|
||||
SizedBox(width: 150),
|
||||
Container(
|
||||
alignment: Alignment.centerLeft,
|
||||
child: Container(
|
||||
child: Row(children: [
|
||||
const Text(
|
||||
'编辑',
|
||||
style: TextStyle(
|
||||
fontSize: 14, color: Color.fromARGB(164, 75, 73, 73)),
|
||||
),
|
||||
SizedBox(width: 12),
|
||||
InkWell(
|
||||
onTap: () {
|
||||
Navigator.push(
|
||||
context,
|
||||
MaterialPageRoute(builder: (context) => RealView()),
|
||||
);
|
||||
},
|
||||
child: const Icon(Icons.arrow_forward_ios,
|
||||
size: 30, color: Color.fromARGB(164, 75, 73, 73)),
|
||||
)
|
||||
])))
|
||||
])),
|
||||
));
|
||||
}));
|
||||
}
|
||||
}
|
||||
|
||||
@ -107,27 +114,18 @@ class TaskPage extends StatelessWidget {
|
||||
MediaQueryData.fromView(WidgetsBinding.instance.window); //获取当前屏幕信息
|
||||
final orientation = mediaQueryData.orientation; //获得设备方向
|
||||
bool isPortrait = Orientation.portrait == orientation ? true : false;
|
||||
List<Widget> children = [
|
||||
Expanded(
|
||||
child: ScenceMapView(
|
||||
children: [],
|
||||
onUpdate: (Offset center, double scale, double rotation) {
|
||||
print("center:$center scale:$scale rotation:$rotation");
|
||||
},
|
||||
forGroundPainter: BorderPainter(controller),
|
||||
onUpdatePilePoint:
|
||||
(RecordEntity? selectedPilePoint, double scale, double rotation) {
|
||||
print(
|
||||
"selectedPilePoint:$selectedPilePoint scale:$scale rotation:$rotation");
|
||||
},
|
||||
),
|
||||
),
|
||||
];
|
||||
if (isPortrait) {
|
||||
return Scaffold(
|
||||
|
||||
return Scaffold(
|
||||
endDrawer: Drawer(
|
||||
width: size.width * .8,
|
||||
child: const PileGenerate(),
|
||||
width: size.width * .5,
|
||||
child: PilePointTable(
|
||||
pilePoints: mapcontroller.pilePoints,
|
||||
onUpdate: (updatedPilePoints) {
|
||||
// 这里可以处理更新后的桩点列表
|
||||
print("生成桩点$updatedPilePoints,");
|
||||
mapController.recordList.add(updatedPilePoints as RecordEntity);
|
||||
},
|
||||
),
|
||||
),
|
||||
appBar: AppBar(
|
||||
title: Text('任务页面'),
|
||||
@ -136,39 +134,38 @@ class TaskPage extends StatelessWidget {
|
||||
child: SizedBox(
|
||||
height: 30,
|
||||
child: Builder(
|
||||
builder: (context) => InkWell(
|
||||
child: Icon(
|
||||
Icons.settings_outlined,
|
||||
size: 35,
|
||||
color: appcontroller.isDarkMode.value
|
||||
? Colors.white70
|
||||
: const Color.fromARGB(200, 29, 28, 28),
|
||||
builder: (context) => Obx(
|
||||
() => InkWell(
|
||||
child: Icon(
|
||||
Icons.close,
|
||||
size: 35,
|
||||
color: appcontroller.isDarkMode.value
|
||||
? Colors.white70
|
||||
: const Color.fromARGB(200, 29, 28, 28),
|
||||
),
|
||||
onTap: () => Scaffold.of(context).openEndDrawer(),
|
||||
),
|
||||
onTap: () => Scaffold.of(context).openEndDrawer(),
|
||||
|
||||
// Navigator.push(
|
||||
// context,
|
||||
// MaterialPageRoute(
|
||||
// builder: (context) => PilePointTable(
|
||||
// pilePoints: mapcontroller.pilePoints,
|
||||
// onUpdate: (updatedPilePoints) {
|
||||
// // 这里可以处理更新后的桩点列表
|
||||
// print("生成桩点$updatedPilePoints,");
|
||||
// },
|
||||
// ),
|
||||
// )),
|
||||
),
|
||||
),
|
||||
),
|
||||
)
|
||||
],
|
||||
),
|
||||
body: Column(
|
||||
children: children,
|
||||
),
|
||||
);
|
||||
} else {
|
||||
return Scaffold(
|
||||
endDrawer: Drawer(
|
||||
width: size.width * .8,
|
||||
child: const PileGenerate(),
|
||||
),
|
||||
appBar: AppBar(
|
||||
title: Text('任务页面'),
|
||||
actions: [
|
||||
),
|
||||
UnconstrainedBox(
|
||||
child: SizedBox(
|
||||
height: 30,
|
||||
child: Builder(
|
||||
builder: (context) => InkWell(
|
||||
child: Obx(
|
||||
() => InkWell(
|
||||
child: Icon(
|
||||
Icons.settings_outlined,
|
||||
size: 35,
|
||||
@ -176,17 +173,30 @@ class TaskPage extends StatelessWidget {
|
||||
? Colors.white70
|
||||
: const Color.fromARGB(200, 29, 28, 28),
|
||||
),
|
||||
onTap: () => Scaffold.of(context).openEndDrawer(),
|
||||
onTap: () => pilecontroller.isPileCardVisible.value = true,
|
||||
),
|
||||
),
|
||||
),
|
||||
)
|
||||
),
|
||||
],
|
||||
),
|
||||
body: Row(
|
||||
children: children,
|
||||
),
|
||||
);
|
||||
}
|
||||
body: Stack(
|
||||
children: [
|
||||
ScenceMapView(
|
||||
children: [],
|
||||
onUpdate: (Offset center, double scale, double rotation) {
|
||||
print("center:$center scale:$scale rotation:$rotation");
|
||||
},
|
||||
forGroundPainter: BorderPainter(controller),
|
||||
onUpdatePilePoint: (RecordEntity? selectedPilePoint, double scale,
|
||||
double rotation) {
|
||||
print(
|
||||
"selectedPilePoint:$selectedPilePoint scale:$scale rotation:$rotation");
|
||||
},
|
||||
),
|
||||
// ),
|
||||
if (pilecontroller.isPileCardVisible.value) PileGenerateCard(),
|
||||
],
|
||||
));
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user