抽屉
This commit is contained in:
parent
84c403ae26
commit
0006b0eefe
File diff suppressed because one or more lines are too long
@ -30,6 +30,8 @@ class CustomAppBar extends StatelessWidget implements PreferredSizeWidget {
|
||||
return const Text("桩点:", style: textStyle);
|
||||
} else if (_currentIndex.value == 1) {
|
||||
return const Text("设备:", style: textStyle);
|
||||
} else if (_currentIndex.value == 2) {
|
||||
return const Text("任务管理", style: textStyle);
|
||||
} else {
|
||||
return const Text("系统:", style: textStyle);
|
||||
}
|
||||
@ -134,23 +136,23 @@ class CustomAppBar extends StatelessWidget implements PreferredSizeWidget {
|
||||
const SizedBox(
|
||||
width: 10,
|
||||
),
|
||||
UnconstrainedBox(
|
||||
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),
|
||||
),
|
||||
onTap: () => Scaffold.of(context).openEndDrawer(),
|
||||
),
|
||||
),
|
||||
),
|
||||
)
|
||||
// UnconstrainedBox(
|
||||
// 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),
|
||||
// ),
|
||||
// onTap: () => Scaffold.of(context).openEndDrawer(),
|
||||
// ),
|
||||
// ),
|
||||
// ),
|
||||
// )
|
||||
],
|
||||
)
|
||||
: const Text(""),
|
||||
|
@ -1,5 +1,23 @@
|
||||
import 'package:get/get.dart';
|
||||
import 'package:scence_map/controllers/controller.dart';
|
||||
|
||||
class AppController extends GetxController {
|
||||
final RxBool isDarkMode = false.obs;
|
||||
var currentIndex = 0.obs;
|
||||
|
||||
@override
|
||||
void onInit() {
|
||||
super.onInit();
|
||||
// 获取 AnotherController 的实例
|
||||
final mapcontroller = Get.find<ScenceMapController>();
|
||||
|
||||
// 绑定 currentIndex
|
||||
ever(currentIndex, (value) {
|
||||
mapcontroller.currentIndex.value = value;
|
||||
});
|
||||
|
||||
ever(mapcontroller.currentIndex, (value) {
|
||||
currentIndex.value = value;
|
||||
});
|
||||
}
|
||||
}
|
||||
|
@ -30,7 +30,8 @@ class GnssController extends GetxController {
|
||||
var _dy = 0.0;
|
||||
Timer? timer;
|
||||
checkDistance() {
|
||||
if (DateTime.now().millisecondsSinceEpoch - aimcontroller.lastManualTapTime <
|
||||
if (DateTime.now().millisecondsSinceEpoch -
|
||||
aimcontroller.lastManualTapTime <
|
||||
30000 ||
|
||||
DateTime.now().millisecondsSinceEpoch - aimcontroller.lastCloseTapTime <
|
||||
30000) {
|
||||
@ -41,7 +42,8 @@ class GnssController extends GetxController {
|
||||
if (aimcontroller.selectedPilePoint == null) {
|
||||
return;
|
||||
}
|
||||
var offset = Offset(aimcontroller.selectedPilePoint!.x, aimcontroller.selectedPilePoint!.y);
|
||||
var offset = Offset(
|
||||
aimcontroller.selectedPilePoint!.x, aimcontroller.selectedPilePoint!.y);
|
||||
if (mapController.calculateDistance(pilerCenterPoint, offset) < 1.9) {
|
||||
if (!aimcontroller.isCardVisible.value) {
|
||||
print("距离小于1m");
|
||||
@ -92,18 +94,28 @@ class GnssController extends GetxController {
|
||||
var dx = device.x - aimcontroller.selectedPilePoint!.x;
|
||||
var dy = device.y - aimcontroller.selectedPilePoint!.y;
|
||||
var distance = sqrt(dx * dx + dy * dy);
|
||||
if (distance > 20) {
|
||||
dx = (aimcontroller.selectedPilePoint!.x - device.x) / (distance / 20);
|
||||
dy = (aimcontroller.selectedPilePoint!.y - device.y) / (distance / 20);
|
||||
if (distance > 2) {
|
||||
dx = (aimcontroller.selectedPilePoint!.x - device.x) /
|
||||
(distance / 2);
|
||||
dy = (aimcontroller.selectedPilePoint!.y - device.y) /
|
||||
(distance / 2);
|
||||
device.x = aimcontroller.selectedPilePoint!.x + dx;
|
||||
device.y = aimcontroller.selectedPilePoint!.y + dy;
|
||||
}
|
||||
_dx = -dx / 50;
|
||||
_dy = -dy / 50;
|
||||
_dx = -dx / 10;
|
||||
_dy = -dy / 10;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
// if ((aimcontroller.selectedPilePoint!.x - device.x).abs() > _dx.abs()) {
|
||||
device.x += _dx;
|
||||
device.y += _dy;
|
||||
// } else {
|
||||
// device.x = aimcontroller.selectedPilePoint!.x;
|
||||
// device.y = aimcontroller.selectedPilePoint!.y;
|
||||
// }
|
||||
|
||||
// device.x += 0.05;
|
||||
// device.y += 0.05;
|
||||
device.rotation = device.rotation + pi / 180; // 确保旋转角度在0-360度之间
|
||||
|
107
lib/main.dart
107
lib/main.dart
@ -1,6 +1,7 @@
|
||||
import 'package:cpnav/controllers/appcontroller.dart';
|
||||
import 'package:cpnav/controllers/gnss_Controller.dart';
|
||||
import 'package:cpnav/pages/setting/child_pages/antenna/antenna_setting.dart';
|
||||
import 'package:cpnav/pages/task/task_page.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
import 'package:get/get.dart';
|
||||
@ -9,8 +10,9 @@ import 'package:scence_map/controllers/plumController.dart';
|
||||
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/pile/rightDra/pileGenerate.dart';
|
||||
// import 'pages/pile/rightDra/pileGenerate.dart';
|
||||
import 'pages/real/index.dart';
|
||||
import 'pages/setting/child_pages/XyChange/connect.dart';
|
||||
import 'pages/setting/setting_page.dart';
|
||||
@ -26,6 +28,7 @@ void main() async {
|
||||
Get.put(AimPointerController());
|
||||
Get.put(GnssController());
|
||||
Get.put(AntennaController());
|
||||
Get.put(AppController());
|
||||
LoginPrefs loginPrefs = LoginPrefs();
|
||||
String value =
|
||||
await loginPrefs.init(); // await 关键字必须用在异步方法中 await等待异步方法执行完毕 异步方法必须用变量接收
|
||||
@ -61,13 +64,13 @@ class MyHomePage extends StatefulWidget {
|
||||
class _MyHomePageState extends State<MyHomePage> {
|
||||
late bool isPortrait;
|
||||
late double appBarHeight = 34.0;
|
||||
final _currentIndex = 0.obs;
|
||||
|
||||
final List<Widget> _pages = [
|
||||
Real(),
|
||||
RealView(),
|
||||
Container(
|
||||
color: Colors.blue,
|
||||
PassTrack(
|
||||
date: '',
|
||||
),
|
||||
TaskManagePage(),
|
||||
HistoryRecord(),
|
||||
SettingPortrait()
|
||||
];
|
||||
@ -78,17 +81,17 @@ class _MyHomePageState extends State<MyHomePage> {
|
||||
return Scaffold(
|
||||
resizeToAvoidBottomInset: false,
|
||||
drawerEdgeDragWidth: 0.0, // 禁止通过滑动打开drawer
|
||||
endDrawer: _currentIndex.value == 1
|
||||
? Drawer(
|
||||
width: size.width * .8,
|
||||
child: const PileGenerate(),
|
||||
)
|
||||
: null,
|
||||
// endDrawer: appcontroller.currentIndex.value == 1
|
||||
// ? Drawer(
|
||||
// width: size.width * .8,
|
||||
// child: const PileGenerate(),
|
||||
// )
|
||||
// : null,
|
||||
appBar: PreferredSize(
|
||||
preferredSize: Size.fromHeight(appBarHeight),
|
||||
child: CustomAppBar(
|
||||
appBarHeight: 56,
|
||||
currentIndex: _currentIndex,
|
||||
currentIndex: appcontroller.currentIndex,
|
||||
),
|
||||
),
|
||||
body: OrientationBuilder(
|
||||
@ -102,7 +105,7 @@ class _MyHomePageState extends State<MyHomePage> {
|
||||
crossAxisAlignment: CrossAxisAlignment.stretch,
|
||||
children: [
|
||||
Expanded(
|
||||
child: _pages[_currentIndex.value],
|
||||
child: _pages[appcontroller.currentIndex.value],
|
||||
),
|
||||
const VerticalDivider(
|
||||
width: 1, // 设置高度为1
|
||||
@ -123,11 +126,11 @@ class _MyHomePageState extends State<MyHomePage> {
|
||||
IconButton(
|
||||
onPressed: () {
|
||||
setState(() {
|
||||
_currentIndex.value = 0;
|
||||
appcontroller.currentIndex.value = 0;
|
||||
});
|
||||
},
|
||||
icon: const Icon(Icons.date_range_rounded),
|
||||
color: _currentIndex.value == 0
|
||||
color: appcontroller.currentIndex.value == 0
|
||||
? const Color.fromARGB(255, 60, 95, 123)
|
||||
: Colors.grey,
|
||||
),
|
||||
@ -137,10 +140,12 @@ class _MyHomePageState extends State<MyHomePage> {
|
||||
'实时',
|
||||
style: TextStyle(
|
||||
fontSize: 12,
|
||||
color: _currentIndex.value == 0
|
||||
? const Color.fromARGB(
|
||||
255, 60, 95, 123)
|
||||
: Colors.grey,
|
||||
color:
|
||||
appcontroller.currentIndex.value ==
|
||||
0
|
||||
? const Color.fromARGB(
|
||||
255, 60, 95, 123)
|
||||
: Colors.grey,
|
||||
),
|
||||
),
|
||||
),
|
||||
@ -156,11 +161,11 @@ class _MyHomePageState extends State<MyHomePage> {
|
||||
IconButton(
|
||||
onPressed: () {
|
||||
setState(() {
|
||||
_currentIndex.value = 1;
|
||||
appcontroller.currentIndex.value = 1;
|
||||
});
|
||||
},
|
||||
icon: const Icon(Icons.map_outlined),
|
||||
color: _currentIndex.value == 1
|
||||
color: appcontroller.currentIndex.value == 1
|
||||
? const Color.fromARGB(255, 60, 95, 123)
|
||||
: Colors.grey,
|
||||
),
|
||||
@ -170,10 +175,12 @@ class _MyHomePageState extends State<MyHomePage> {
|
||||
'桩点',
|
||||
style: TextStyle(
|
||||
fontSize: 12,
|
||||
color: _currentIndex.value == 1
|
||||
? const Color.fromARGB(
|
||||
255, 60, 95, 123)
|
||||
: Colors.grey,
|
||||
color:
|
||||
appcontroller.currentIndex.value ==
|
||||
1
|
||||
? const Color.fromARGB(
|
||||
255, 60, 95, 123)
|
||||
: Colors.grey,
|
||||
),
|
||||
),
|
||||
),
|
||||
@ -185,11 +192,11 @@ class _MyHomePageState extends State<MyHomePage> {
|
||||
IconButton(
|
||||
onPressed: () {
|
||||
setState(() {
|
||||
_currentIndex.value = 2;
|
||||
appcontroller.currentIndex.value = 2;
|
||||
});
|
||||
},
|
||||
icon: const Icon(Icons.my_location_sharp),
|
||||
color: _currentIndex.value == 2
|
||||
color: appcontroller.currentIndex.value == 2
|
||||
? const Color.fromARGB(255, 60, 95, 123)
|
||||
: Colors.grey,
|
||||
),
|
||||
@ -199,10 +206,12 @@ class _MyHomePageState extends State<MyHomePage> {
|
||||
'任务',
|
||||
style: TextStyle(
|
||||
fontSize: 12,
|
||||
color: _currentIndex.value == 2
|
||||
? const Color.fromARGB(
|
||||
255, 60, 95, 123)
|
||||
: Colors.grey,
|
||||
color:
|
||||
appcontroller.currentIndex.value ==
|
||||
2
|
||||
? const Color.fromARGB(
|
||||
255, 60, 95, 123)
|
||||
: Colors.grey,
|
||||
),
|
||||
),
|
||||
),
|
||||
@ -214,12 +223,12 @@ class _MyHomePageState extends State<MyHomePage> {
|
||||
IconButton(
|
||||
onPressed: () {
|
||||
setState(() {
|
||||
_currentIndex.value = 3;
|
||||
appcontroller.currentIndex.value = 3;
|
||||
});
|
||||
},
|
||||
icon:
|
||||
const Icon(Icons.table_chart_outlined),
|
||||
color: _currentIndex.value == 3
|
||||
color: appcontroller.currentIndex.value == 3
|
||||
? const Color.fromARGB(255, 60, 95, 123)
|
||||
: Colors.grey,
|
||||
),
|
||||
@ -229,10 +238,12 @@ class _MyHomePageState extends State<MyHomePage> {
|
||||
'历史',
|
||||
style: TextStyle(
|
||||
fontSize: 12,
|
||||
color: _currentIndex.value == 3
|
||||
? const Color.fromARGB(
|
||||
255, 60, 95, 123)
|
||||
: Colors.grey,
|
||||
color:
|
||||
appcontroller.currentIndex.value ==
|
||||
3
|
||||
? const Color.fromARGB(
|
||||
255, 60, 95, 123)
|
||||
: Colors.grey,
|
||||
),
|
||||
),
|
||||
),
|
||||
@ -244,11 +255,11 @@ class _MyHomePageState extends State<MyHomePage> {
|
||||
IconButton(
|
||||
onPressed: () {
|
||||
setState(() {
|
||||
_currentIndex.value = 4;
|
||||
appcontroller.currentIndex.value = 4;
|
||||
});
|
||||
},
|
||||
icon: const Icon(Icons.settings),
|
||||
color: _currentIndex.value == 4
|
||||
color: appcontroller.currentIndex.value == 4
|
||||
? const Color.fromARGB(255, 60, 95, 123)
|
||||
: Colors.grey,
|
||||
),
|
||||
@ -258,10 +269,12 @@ class _MyHomePageState extends State<MyHomePage> {
|
||||
'设置',
|
||||
style: TextStyle(
|
||||
fontSize: 12,
|
||||
color: _currentIndex.value == 4
|
||||
? const Color.fromARGB(
|
||||
255, 60, 95, 123)
|
||||
: Colors.grey,
|
||||
color:
|
||||
appcontroller.currentIndex.value ==
|
||||
4
|
||||
? const Color.fromARGB(
|
||||
255, 60, 95, 123)
|
||||
: Colors.grey,
|
||||
),
|
||||
),
|
||||
),
|
||||
@ -282,7 +295,7 @@ class _MyHomePageState extends State<MyHomePage> {
|
||||
children: [
|
||||
Expanded(
|
||||
flex: 12,
|
||||
child: _pages[_currentIndex.value],
|
||||
child: _pages[appcontroller.currentIndex.value],
|
||||
),
|
||||
// VerticalDivider(),
|
||||
Expanded(
|
||||
@ -291,10 +304,10 @@ class _MyHomePageState extends State<MyHomePage> {
|
||||
height: 48,
|
||||
child: BottomNavigationBar(
|
||||
type: BottomNavigationBarType.fixed,
|
||||
currentIndex: _currentIndex.value,
|
||||
currentIndex: appcontroller.currentIndex.value,
|
||||
onTap: (index) {
|
||||
setState(() {
|
||||
_currentIndex.value = index;
|
||||
appcontroller.currentIndex.value = index;
|
||||
});
|
||||
},
|
||||
items: const [
|
||||
@ -305,7 +318,7 @@ class _MyHomePageState extends State<MyHomePage> {
|
||||
icon: Icon(Icons.map_outlined), label: "计划"),
|
||||
BottomNavigationBarItem(
|
||||
icon: Icon(Icons.my_location_sharp),
|
||||
label: "对点"),
|
||||
label: "任务"),
|
||||
BottomNavigationBarItem(
|
||||
icon: Icon(Icons.table_chart_outlined),
|
||||
label: "历史"),
|
||||
|
@ -3,7 +3,7 @@ import 'package:get/get.dart';
|
||||
import 'package:scence_map/record_entity.dart';
|
||||
|
||||
class AimPointerController extends GetxController {
|
||||
var isNomal = true.obs;
|
||||
// var isNomal = true.obs;
|
||||
//左下圆
|
||||
var sightOffset = const Offset(3, 3).obs;
|
||||
var sightOffsetInit = const Offset(0, 0).obs;
|
||||
@ -18,8 +18,8 @@ class AimPointerController extends GetxController {
|
||||
var plot = 2.0.obs;
|
||||
var scale = 0.75.obs;
|
||||
var cardWidth = 0.0.obs;
|
||||
var left = 0.0.obs;
|
||||
var top = 0.0.obs;
|
||||
var x = 0.0.obs;
|
||||
var y = 0.0.obs;
|
||||
var positionUpdate = 0.obs;
|
||||
|
||||
int lastManualTapTime = 0;
|
||||
|
@ -2,9 +2,9 @@ import 'dart:async';
|
||||
import 'dart:math';
|
||||
import 'dart:ui' as ui;
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/scheduler.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:scence_map/controllers/controller.dart';
|
||||
import '../../controllers/appcontroller.dart';
|
||||
import '../../controllers/gnss_Controller.dart';
|
||||
import '../../service/pile/device_type.dart';
|
||||
import 'aimpointController.dart';
|
||||
@ -25,7 +25,7 @@ class AimPointer extends GetView<AimPointerController> {
|
||||
double rectWidth = size.width;
|
||||
|
||||
final deviceType = getDeviceType(context);
|
||||
|
||||
final appcontroller = Get.put(AppController());
|
||||
if (orientation == Orientation.landscape) {
|
||||
rectWidth = size.width / 2 - 60;
|
||||
if (deviceType == DeviceType.mobile) {
|
||||
@ -49,157 +49,154 @@ class AimPointer extends GetView<AimPointerController> {
|
||||
|
||||
borderRadius: BorderRadius.circular(4.0), // 可以根据需要调整圆角半径
|
||||
),
|
||||
child: Stack(
|
||||
children: [
|
||||
Container(
|
||||
width: rectWidth,
|
||||
height: rectWidth,
|
||||
decoration: BoxDecoration(
|
||||
border: Border.all(
|
||||
color: isDarkMode ? Colors.white : Colors.black),
|
||||
borderRadius:
|
||||
BorderRadius.all(Radius.circular(rectWidth / 2)),
|
||||
),
|
||||
child: Stack(
|
||||
children: [
|
||||
CustomPaint(
|
||||
//绘制瞄准器
|
||||
size: Size(rectWidth, rectWidth),
|
||||
painter: DrawAxis(aimcontroller, 0, 0, isDarkMode),
|
||||
child: Stack(
|
||||
children: [
|
||||
Positioned(
|
||||
top: 20,
|
||||
left: 20,
|
||||
child: Obx(() {
|
||||
return TextButton(
|
||||
child: Text(
|
||||
"${aimcontroller.plot.value}m",
|
||||
style: const TextStyle(fontSize: 20),
|
||||
),
|
||||
onPressed: () {
|
||||
if (aimcontroller.plot.value == 1) {
|
||||
aimcontroller.plot.value = 2;
|
||||
} else {
|
||||
aimcontroller.plot.value = 1;
|
||||
}
|
||||
aimcontroller.update();
|
||||
},
|
||||
);
|
||||
})),
|
||||
Positioned(
|
||||
top: 25,
|
||||
right: 10,
|
||||
child: TextButton(
|
||||
child: Text(
|
||||
"垂直度:$gradienter°",
|
||||
style: const TextStyle(fontSize: 20),
|
||||
),
|
||||
onPressed: () {},
|
||||
)),
|
||||
Positioned(
|
||||
right: 0,
|
||||
top: 0,
|
||||
child: IconButton(
|
||||
icon: const Icon(Icons.close),
|
||||
child: Container(
|
||||
width: rectWidth,
|
||||
height: rectWidth,
|
||||
decoration: BoxDecoration(
|
||||
border:
|
||||
Border.all(color: isDarkMode ? Colors.white : Colors.black),
|
||||
borderRadius: BorderRadius.all(Radius.circular(rectWidth / 2)),
|
||||
),
|
||||
child: Stack(
|
||||
children: [
|
||||
CustomPaint(
|
||||
//绘制瞄准器
|
||||
size: Size(rectWidth, rectWidth),
|
||||
painter: DrawAxis(aimcontroller, 0, 0, isDarkMode),
|
||||
child: Stack(
|
||||
children: [
|
||||
Positioned(
|
||||
top: 20,
|
||||
left: 20,
|
||||
child: Obx(() {
|
||||
return TextButton(
|
||||
child: Text(
|
||||
"${aimcontroller.plot.value}m",
|
||||
style: const TextStyle(fontSize: 20),
|
||||
),
|
||||
onPressed: () {
|
||||
// 关闭按钮的回调函数
|
||||
aimcontroller.isCardVisible.value = false;
|
||||
aimcontroller.lastCloseTapTime =
|
||||
DateTime.now().millisecondsSinceEpoch;
|
||||
if (aimcontroller.plot.value == 1) {
|
||||
aimcontroller.plot.value = 2;
|
||||
} else {
|
||||
aimcontroller.plot.value = 1;
|
||||
}
|
||||
aimcontroller.update();
|
||||
},
|
||||
);
|
||||
})),
|
||||
Positioned(
|
||||
right: 0,
|
||||
top: 0,
|
||||
child: IconButton(
|
||||
icon: const Icon(Icons.close),
|
||||
onPressed: () {
|
||||
// 关闭按钮的回调函数
|
||||
aimcontroller.isCardVisible.value = false;
|
||||
aimcontroller.lastCloseTapTime =
|
||||
DateTime.now().millisecondsSinceEpoch;
|
||||
},
|
||||
),
|
||||
),
|
||||
Positioned(
|
||||
top: 30,
|
||||
right: 10,
|
||||
child: TextButton(
|
||||
child: Text(
|
||||
"垂直度:$gradienter°",
|
||||
style: const TextStyle(fontSize: 20),
|
||||
),
|
||||
),
|
||||
Obx(() {
|
||||
var pixel2MeterRatio =
|
||||
aimcontroller.plot.value * 2 / rectWidth;
|
||||
if (aimcontroller.selectedPilePoint != null)
|
||||
gnsscontroller.device.update.value;
|
||||
if (aimcontroller.selectedPilePoint != null) {
|
||||
var dx = (gnsscontroller.device.x -
|
||||
aimcontroller.selectedPilePoint!.x);
|
||||
var dy = (gnsscontroller.device.y -
|
||||
aimcontroller.selectedPilePoint!.y);
|
||||
onPressed: () {},
|
||||
)),
|
||||
Obx(() {
|
||||
var pixel2MeterRatio =
|
||||
aimcontroller.plot.value * 2 / rectWidth;
|
||||
if (aimcontroller.selectedPilePoint != null)
|
||||
gnsscontroller.device.update.value;
|
||||
if (aimcontroller.selectedPilePoint != null) {
|
||||
var dx = (gnsscontroller.device.x -
|
||||
aimcontroller.selectedPilePoint!.x);
|
||||
var dy = (gnsscontroller.device.y -
|
||||
aimcontroller.selectedPilePoint!.y);
|
||||
// if (dx * dy < 0) {
|
||||
// aimcontroller.top.value = dx *
|
||||
// cos(mapcontroller.rotation.value) +
|
||||
// dy * sin(mapcontroller.rotation.value);
|
||||
// aimcontroller.left.value = -dx *
|
||||
// sin(mapcontroller.rotation.value) +
|
||||
// dy * cos(mapcontroller.rotation.value);
|
||||
// }
|
||||
aimcontroller.x.value =
|
||||
dx * cos(-mapcontroller.rotation.value) +
|
||||
dy * sin(-mapcontroller.rotation.value);
|
||||
aimcontroller.y.value =
|
||||
-dx * sin(-mapcontroller.rotation.value) +
|
||||
dy * cos(-mapcontroller.rotation.value);
|
||||
// aimcontroller.positionUpdate.value++;
|
||||
print("dx:$dx,dy:$dy");
|
||||
print(
|
||||
"left:${aimcontroller.x.value},top:${aimcontroller.y.value}");
|
||||
}
|
||||
|
||||
aimcontroller.top.value = dx *
|
||||
cos(mapcontroller.rotation.value) +
|
||||
dy * sin(mapcontroller.rotation.value);
|
||||
aimcontroller.left.value = -dx *
|
||||
sin(mapcontroller.rotation.value) +
|
||||
dy * cos(mapcontroller.rotation.value);
|
||||
// aimcontroller.positionUpdate.value++;
|
||||
print("dx:$dx,dy:$dy");
|
||||
print(
|
||||
"left:${aimcontroller.left.value},top:${aimcontroller.top.value}");
|
||||
}
|
||||
return Positioned(
|
||||
left: rectWidth / 2 -
|
||||
30 +
|
||||
aimcontroller.y.value / pixel2MeterRatio,
|
||||
top: rectWidth / 2 -
|
||||
30 -
|
||||
aimcontroller.x.value / pixel2MeterRatio,
|
||||
child: Transform(
|
||||
transform: Matrix4.identity()
|
||||
..rotateZ(gnsscontroller.device.rotation +
|
||||
pi / 2 +
|
||||
mapcontroller.rotation.value),
|
||||
alignment: FractionalOffset.center,
|
||||
child: Stack(
|
||||
alignment: Alignment.center,
|
||||
children: [
|
||||
SizedBox(
|
||||
width: 60.0, // 设置图像的宽度
|
||||
height: 60.0, // 设置图像的高度
|
||||
child: Image.asset(
|
||||
"images/navi_pointer.png",
|
||||
errorBuilder:
|
||||
(context, error, stackTrace) {
|
||||
return Text('无法加载图片');
|
||||
},
|
||||
),
|
||||
),
|
||||
|
||||
return Positioned(
|
||||
left: rectWidth / 2 -
|
||||
30 +
|
||||
aimcontroller.left.value /
|
||||
pixel2MeterRatio,
|
||||
top: rectWidth / 2 -
|
||||
30 -
|
||||
aimcontroller.top.value /
|
||||
pixel2MeterRatio,
|
||||
// left: 70,
|
||||
// top: 70,
|
||||
child: Transform(
|
||||
transform: Matrix4.identity()
|
||||
..rotateZ(
|
||||
gnsscontroller.device.rotation +
|
||||
pi / 2 +
|
||||
mapcontroller.rotation.value),
|
||||
alignment: FractionalOffset.center,
|
||||
child: Stack(
|
||||
alignment: Alignment.center,
|
||||
children: [
|
||||
SizedBox(
|
||||
width: 60.0, // 设置图像的宽度
|
||||
height: 60.0, // 设置图像的高度
|
||||
child: Image.asset(
|
||||
"images/navi_pointer.png",
|
||||
errorBuilder: (context, error,
|
||||
stackTrace) {
|
||||
return Text('无法加载图片');
|
||||
},
|
||||
),
|
||||
),
|
||||
// Obx(() {
|
||||
// Offset offset = controller.xy2Screen(
|
||||
// gnsscontroller.pilerCenter.X, gnsscontroller.pilerCenter.Y);
|
||||
|
||||
// Obx(() {
|
||||
// Offset offset = controller.xy2Screen(
|
||||
// gnsscontroller.pilerCenter.X, gnsscontroller.pilerCenter.Y);
|
||||
|
||||
// return Positioned(
|
||||
// left: offset.dx,
|
||||
// top: offset.dy,
|
||||
// child: Transform(
|
||||
// transform: Matrix4.identity()
|
||||
// ..rotateZ(-controller.rotation.value),
|
||||
// child: Column(
|
||||
// children: [Text("设备:${item.name}")],
|
||||
// ),
|
||||
// ),
|
||||
// );
|
||||
// }),
|
||||
],
|
||||
)));
|
||||
})
|
||||
],
|
||||
))
|
||||
],
|
||||
)),
|
||||
],
|
||||
),
|
||||
// return Positioned(
|
||||
// left: offset.dx,
|
||||
// top: offset.dy,
|
||||
// child: Transform(
|
||||
// transform: Matrix4.identity()
|
||||
// ..rotateZ(-controller.rotation.value),
|
||||
// child: Column(
|
||||
// children: [Text("设备:${item.name}")],
|
||||
// ),
|
||||
// ),
|
||||
// );
|
||||
// }),
|
||||
],
|
||||
)));
|
||||
})
|
||||
],
|
||||
))
|
||||
],
|
||||
)),
|
||||
),
|
||||
),
|
||||
const SizedBox(
|
||||
width: 5,
|
||||
height: 5,
|
||||
),
|
||||
const Expanded(
|
||||
child: Text(""),
|
||||
),
|
||||
// const SizedBox(
|
||||
// width: 5,
|
||||
// height: 5,
|
||||
// ),
|
||||
// const Expanded(
|
||||
// child: Text(""),
|
||||
// ),
|
||||
];
|
||||
if (isPortrait) {
|
||||
return Column(
|
||||
@ -229,7 +226,7 @@ class DrawAxis extends CustomPainter {
|
||||
Icons.arrow_left,
|
||||
Icons.arrow_right
|
||||
];
|
||||
List<Offset> iconOffset = [];
|
||||
// List<Offset> iconOffset = [];
|
||||
|
||||
List<String> text = ["", "", "", ""]; //['前移', '后移', '左移', '右移'];
|
||||
@override
|
||||
@ -241,8 +238,8 @@ class DrawAxis extends CustomPainter {
|
||||
|
||||
double rectWidth = (size.height / 2 - 5).roundToDouble();
|
||||
aimcontroller.cardWidth.value = rectWidth;
|
||||
if (!aimcontroller.isNomal.value) {
|
||||
} else {}
|
||||
// if (!aimcontroller.isNomal.value) {
|
||||
// } else {}
|
||||
|
||||
path.moveTo(0, rectWidth + 5);
|
||||
path.lineTo(size.height, rectWidth + 5);
|
||||
@ -282,9 +279,8 @@ class DrawAxis extends CustomPainter {
|
||||
canvas.translate(-(rectWidth + 5), -(rectWidth + 5));
|
||||
|
||||
canvas.translate(rectWidth + 5, rectWidth + 5);
|
||||
if (aimcontroller.selectedPilePoint != null) {
|
||||
drawPoint(canvas);
|
||||
}
|
||||
|
||||
drawPoint(canvas);
|
||||
|
||||
// // 绘制水平仪
|
||||
// double x = real.tiltX.value; //
|
||||
@ -314,7 +310,7 @@ class DrawAxis extends CustomPainter {
|
||||
|
||||
drawPoint(Canvas canvas) {
|
||||
canvas.drawCircle(Offset.zero, 20,
|
||||
Paint()..color = const Color.fromARGB(255, 139, 33, 33));
|
||||
Paint()..color = const ui.Color.fromARGB(129, 139, 33, 33));
|
||||
// drawText(canvas, pos - const Offset(20, 10), i, false);
|
||||
}
|
||||
|
||||
@ -367,25 +363,23 @@ class SightGview extends StatelessWidget {
|
||||
// 正确计算初始偏移量:当前手指位置与卡片当前位置之间的差值
|
||||
aimcontroller.sightInit.value =
|
||||
details.localFocalPoint - aimcontroller.sightOffset.value;
|
||||
//
|
||||
//
|
||||
//
|
||||
print(
|
||||
'aimcontroller.isCardVisible: ${aimcontroller.isCardVisible.value}');
|
||||
},
|
||||
onScaleUpdate: (details) {
|
||||
// 使用初始偏移量来更新卡片的位置
|
||||
aimcontroller.sightOffset.value =
|
||||
details.localFocalPoint - aimcontroller.sightInit.value;
|
||||
},
|
||||
child: Container(
|
||||
decoration: const BoxDecoration(color: Colors.transparent),
|
||||
child: Stack(children: [
|
||||
Card(
|
||||
color: Colors.transparent,
|
||||
elevation: 5.0,
|
||||
child: AimPointer(),
|
||||
),
|
||||
]))))));
|
||||
child: Stack(children: [
|
||||
Container(
|
||||
decoration:
|
||||
const BoxDecoration(color: Colors.transparent),
|
||||
child: Stack(children: [
|
||||
Card(
|
||||
color: Colors.transparent,
|
||||
elevation: 5.0,
|
||||
child: AimPointer(),
|
||||
),
|
||||
]))
|
||||
])))));
|
||||
}
|
||||
}
|
||||
|
@ -1,250 +0,0 @@
|
||||
import 'package:cpnav/pages/pass_track/view.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/widgets.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:scence_map/controllers/controller.dart';
|
||||
|
||||
|
||||
ScenceMapController mapController = Get.put(ScenceMapController());
|
||||
|
||||
class IconContainer extends StatefulWidget {
|
||||
@override
|
||||
_IconContainerState createState() => _IconContainerState();
|
||||
}
|
||||
|
||||
class _IconContainerState extends State<IconContainer> {
|
||||
final Map<IconData, Color> _iconColors = {
|
||||
Icons.article: Colors.green,
|
||||
Icons.speed: const Color.fromARGB(255, 166, 182, 149),
|
||||
Icons.thermostat: const Color.fromARGB(255, 166, 182, 149),
|
||||
Icons.zoom_in: const Color.fromARGB(255, 166, 182, 149),
|
||||
Icons.zoom_out: const Color.fromARGB(255, 166, 182, 149),
|
||||
Icons.refresh: const Color.fromARGB(255, 166, 182, 149),
|
||||
Icons.place: const Color.fromARGB(255, 166, 182, 149),
|
||||
};
|
||||
IconData? _selectedIcon;
|
||||
|
||||
void _handleTap1(IconData icon, VoidCallback onTap) {
|
||||
setState(() {
|
||||
_selectedIcon = icon;
|
||||
_iconColors.forEach((key, value) {
|
||||
_iconColors[key] = key == icon
|
||||
? Colors.green // 点击后变浅的颜色
|
||||
: const Color.fromARGB(255, 166, 182, 149); // 其他图标恢复原色
|
||||
});
|
||||
});
|
||||
onTap();
|
||||
}
|
||||
|
||||
void _handleTap2(IconData icon, VoidCallback onTap) {
|
||||
setState(() {
|
||||
_iconColors[icon] = Colors.green; // 点击后变浅的颜色
|
||||
});
|
||||
onTap();
|
||||
Future.delayed(Duration(milliseconds: 200), () {
|
||||
setState(() {
|
||||
_iconColors[icon] = const Color.fromARGB(255, 166, 182, 149); // 恢复原色
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
var isPortrait = MediaQuery.of(context).orientation == Orientation.portrait;
|
||||
return isPortrait
|
||||
? Positioned(
|
||||
right: 10,
|
||||
bottom: 130,
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
Container(
|
||||
width: 42,
|
||||
decoration: BoxDecoration(
|
||||
color: Colors.transparent,
|
||||
border: Border.all(
|
||||
color: Color.fromARGB(255, 54, 52, 52),
|
||||
width: 1.0,
|
||||
),
|
||||
borderRadius: BorderRadius.circular(5.0),
|
||||
),
|
||||
child: Column(
|
||||
children: [
|
||||
_singleChange(Icons.article, () {}),
|
||||
_singleChange(Icons.speed, () {
|
||||
// 处理 speed 图标的点击事件
|
||||
}),
|
||||
_singleChange(Icons.thermostat, () {
|
||||
// 处理 thermostat 图标的点击事件
|
||||
}),
|
||||
_automChange(Icons.zoom_in, () {
|
||||
mapcontroller.scale = mapcontroller.scale * 0.5;
|
||||
if (mapcontroller.scale < 0.2) {
|
||||
mapcontroller.scale = 0.2;
|
||||
const snackBar = SnackBar(
|
||||
content: Text("当前已到放大比例极限"),
|
||||
backgroundColor: Colors.red,
|
||||
duration: Duration(seconds: 1),
|
||||
);
|
||||
|
||||
ScaffoldMessenger.of(context).showSnackBar(snackBar);
|
||||
}
|
||||
|
||||
mapcontroller.rotation.value = 0.0;
|
||||
mapcontroller.updateCount.value++;
|
||||
}),
|
||||
_automChange(Icons.zoom_out, () {
|
||||
mapcontroller.scale = mapcontroller.scale / 0.5;
|
||||
|
||||
if (mapcontroller.scale > 200) {
|
||||
mapcontroller.scale = 200;
|
||||
// 提示最大比例
|
||||
const snackBar = SnackBar(
|
||||
content: Text("当前已到缩小比例极限"),
|
||||
backgroundColor: Colors.red,
|
||||
duration: Duration(seconds: 1),
|
||||
);
|
||||
|
||||
ScaffoldMessenger.of(context).showSnackBar(snackBar);
|
||||
}
|
||||
|
||||
mapcontroller.rotation.value = 0.0;
|
||||
mapcontroller.updateCount.value++;
|
||||
}),
|
||||
_automChange(Icons.refresh, () {
|
||||
mapcontroller.scale = 1.0;
|
||||
mapcontroller.rotation.value = 0.0;
|
||||
mapcontroller.updateCount.value++;
|
||||
}),
|
||||
_automChange(Icons.place, () {
|
||||
// 处理 place 图标的点击事件
|
||||
}),
|
||||
],
|
||||
),
|
||||
)
|
||||
],
|
||||
))
|
||||
: Positioned(
|
||||
right: 10,
|
||||
bottom: 15,
|
||||
child: Row(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
Container(
|
||||
height: 42,
|
||||
decoration: BoxDecoration(
|
||||
color: Colors.transparent,
|
||||
border: Border.all(
|
||||
color: Color.fromARGB(255, 54, 52, 52),
|
||||
width: 1.0,
|
||||
),
|
||||
borderRadius: BorderRadius.circular(5.0),
|
||||
),
|
||||
child: Row(
|
||||
children: [
|
||||
_singleChange(Icons.article, () {
|
||||
mapcontroller.scale = 1.0;
|
||||
mapcontroller.rotation.value = 0.0;
|
||||
mapcontroller.updateCount.value++;
|
||||
}),
|
||||
_singleChange(Icons.speed, () {
|
||||
// 处理 speed 图标的点击事件
|
||||
}),
|
||||
_singleChange(Icons.thermostat, () {
|
||||
// 处理 thermostat 图标的点击事件
|
||||
}),
|
||||
_automChange(Icons.zoom_in, () {
|
||||
mapcontroller.scale = mapcontroller.scale * 0.5;
|
||||
if (mapcontroller.scale < 0.2) {
|
||||
mapcontroller.scale = 0.2;
|
||||
const snackBar = SnackBar(
|
||||
content: Text("当前已到放大比例极限"),
|
||||
backgroundColor: Colors.red,
|
||||
duration: Duration(seconds: 1),
|
||||
);
|
||||
|
||||
ScaffoldMessenger.of(context).showSnackBar(snackBar);
|
||||
}
|
||||
|
||||
mapcontroller.rotation.value = 0.0;
|
||||
mapcontroller.updateCount.value++;
|
||||
}),
|
||||
_automChange(Icons.zoom_out, () {
|
||||
mapcontroller.scale = mapcontroller.scale / 0.5;
|
||||
|
||||
if (mapcontroller.scale > 200) {
|
||||
mapcontroller.scale = 200;
|
||||
// 提示最大比例
|
||||
const snackBar = SnackBar(
|
||||
content: Text("当前已到缩小比例极限"),
|
||||
backgroundColor: Colors.red,
|
||||
duration: Duration(seconds: 1),
|
||||
);
|
||||
|
||||
ScaffoldMessenger.of(context).showSnackBar(snackBar);
|
||||
}
|
||||
|
||||
mapcontroller.rotation.value = 0.0;
|
||||
mapcontroller.updateCount.value++;
|
||||
}),
|
||||
_automChange(Icons.refresh, () {
|
||||
mapcontroller.scale = 1.0;
|
||||
mapcontroller.rotation.value = 0.0;
|
||||
mapcontroller.updateCount.value++;
|
||||
}),
|
||||
_automChange(Icons.place, () {
|
||||
// 处理 place 图标的点击事件
|
||||
}),
|
||||
],
|
||||
),
|
||||
)
|
||||
],
|
||||
));
|
||||
}
|
||||
|
||||
//前三个单选
|
||||
Widget _singleChange(IconData icon, VoidCallback onTap) {
|
||||
return Container(
|
||||
width: 33,
|
||||
height: 33,
|
||||
margin: EdgeInsets.symmetric(vertical: 2.0),
|
||||
decoration: BoxDecoration(
|
||||
color: _iconColors[icon],
|
||||
border: Border.all(
|
||||
color: Colors.white,
|
||||
),
|
||||
borderRadius: BorderRadius.circular(5.0),
|
||||
),
|
||||
child: InkWell(
|
||||
child: Icon(
|
||||
icon,
|
||||
color: Colors.white,
|
||||
),
|
||||
onTap: () => _handleTap1(icon, onTap),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
//后三个自动恢复
|
||||
Widget _automChange(IconData icon, VoidCallback onTap) {
|
||||
return Container(
|
||||
width: 33,
|
||||
height: 33,
|
||||
margin: EdgeInsets.symmetric(vertical: 2.0),
|
||||
decoration: BoxDecoration(
|
||||
color: _iconColors[icon],
|
||||
border: Border.all(
|
||||
color: Colors.white,
|
||||
),
|
||||
borderRadius: BorderRadius.circular(5.0),
|
||||
),
|
||||
child: InkWell(
|
||||
child: Icon(
|
||||
icon,
|
||||
color: Colors.white,
|
||||
),
|
||||
onTap: () => _handleTap2(icon, onTap),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
@ -14,18 +14,8 @@ import 'package:syncfusion_flutter_sliders/sliders.dart';
|
||||
|
||||
import '../aim_point/aimpointController.dart';
|
||||
import '../real/realDataCard.dart';
|
||||
import 'iconContainer.dart';
|
||||
import "controller.dart";
|
||||
|
||||
// import '../login_in/connect/bluetooth_page.dart';
|
||||
// import '../login_in/connect/config.dart';
|
||||
// import '../login_in/connect/connect_type.dart';
|
||||
// import '../login_in/getx/blue_tooth.dart';
|
||||
// import '../setting/antenna_setting.dart';
|
||||
// import '../setting/person_details.dart';
|
||||
// import '../setting/wifi_page.dart';
|
||||
// import '../setting/xy_change.dart';
|
||||
|
||||
ScenceMapController mapcontroller = Get.put(ScenceMapController());
|
||||
|
||||
class PassTrack extends StatefulWidget {
|
||||
@ -106,8 +96,6 @@ class _PasstrackState extends State<PassTrack> {
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final size = MediaQuery.of(context).size;
|
||||
var isPortrait = MediaQuery.of(context).orientation == Orientation.portrait;
|
||||
return OrientationBuilder(builder: (context, orientation) {
|
||||
return Stack(
|
||||
children: [
|
||||
@ -125,151 +113,8 @@ class _PasstrackState extends State<PassTrack> {
|
||||
aimcontroller.selectedPilePoint = selectedPilePoint;
|
||||
},
|
||||
),
|
||||
Positioned(
|
||||
width: isPortrait ? size.width * .63 : size.width * .41,
|
||||
left: isPortrait ? 190 : 200,
|
||||
bottom: 30,
|
||||
child: Container(
|
||||
padding: const EdgeInsets.only(bottom: 5),
|
||||
child: SfRangeSlider(
|
||||
min: 0.0,
|
||||
max: maxLength,
|
||||
values: _rangevalues,
|
||||
showTicks: false,
|
||||
showLabels: false,
|
||||
enableTooltip: true,
|
||||
minorTicksPerInterval: 1,
|
||||
stepSize: 1,
|
||||
onChanged: (SfRangeValues values) {
|
||||
setState(() {
|
||||
_rangevalues = SfRangeValues(values.start.roundToDouble(),
|
||||
values.end.roundToDouble());
|
||||
});
|
||||
},
|
||||
),
|
||||
),
|
||||
),
|
||||
Positioned(
|
||||
left: isPortrait ? 190 : 200,
|
||||
bottom: 0,
|
||||
child: Row(
|
||||
children: [
|
||||
const SizedBox(width: 18),
|
||||
SizedBox(
|
||||
width: 74,
|
||||
child: ElevatedButton(
|
||||
style: ButtonStyle(
|
||||
backgroundColor: MaterialStateProperty.all<Color?>(
|
||||
str == "播放" ? Colors.blue : Colors.red,
|
||||
),
|
||||
),
|
||||
onPressed: () {
|
||||
setState(() {
|
||||
str = str == "播放" ? "暂停" : "播放";
|
||||
});
|
||||
},
|
||||
child: Text(
|
||||
str,
|
||||
style: const TextStyle(fontSize: 12, color: Colors.black),
|
||||
),
|
||||
),
|
||||
),
|
||||
const SizedBox(width: 5),
|
||||
GestureDetector(
|
||||
onTap: () {
|
||||
// 触发 PopupMenuButton 的点击事件
|
||||
final dynamic state = _popupMenuKey.currentState;
|
||||
state.showButtonMenu();
|
||||
},
|
||||
child: Container(
|
||||
width: 70,
|
||||
height: 35,
|
||||
padding: const EdgeInsets.symmetric(horizontal: 6.0),
|
||||
decoration: BoxDecoration(
|
||||
color: const Color.fromARGB(255, 255, 255, 255),
|
||||
border: Border.all(color: Colors.black),
|
||||
),
|
||||
child: Row(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
Text(
|
||||
"$speed X",
|
||||
style: const TextStyle(
|
||||
fontSize: 11, color: Colors.black),
|
||||
),
|
||||
Container(
|
||||
width: 25,
|
||||
child: PopupMenuButton<int>(
|
||||
key: _popupMenuKey,
|
||||
padding: const EdgeInsets.all(1.0),
|
||||
icon: const Icon(Icons.arrow_drop_up,
|
||||
color: Color.fromARGB(255, 47, 48, 47)),
|
||||
onSelected: (int value) {
|
||||
setState(() {
|
||||
speed = value;
|
||||
});
|
||||
},
|
||||
// style: ButtonStyle(
|
||||
// minimumSize: MaterialStateProperty.all<Size>(
|
||||
// Size(48, 48)), // 设置最小点击区域
|
||||
// tapTargetSize: MaterialTapTargetSize
|
||||
// .shrinkWrap, // 设置点击区域大小
|
||||
// ),
|
||||
itemBuilder: (BuildContext context) {
|
||||
return speedList.map((int speed) {
|
||||
return PopupMenuItem<int>(
|
||||
height: 30,
|
||||
value: speed,
|
||||
child: Text("$speed X速度"),
|
||||
);
|
||||
}).toList();
|
||||
},
|
||||
),
|
||||
),
|
||||
],
|
||||
)),
|
||||
),
|
||||
const SizedBox(width: 12),
|
||||
Column(
|
||||
children: [
|
||||
const Text("此处遍数:0"),
|
||||
StreamBuilder<DateTime>(
|
||||
stream: Stream.periodic(
|
||||
const Duration(seconds: 1), (_) => DateTime.now()),
|
||||
builder: (context, snapshot) {
|
||||
if (snapshot.hasData) {
|
||||
final dateTime = snapshot.data!.toLocal();
|
||||
final formattedDate =
|
||||
"${dateTime.year % 100}-${dateTime.month.toString().padLeft(2, '0')}-${dateTime.day.toString().padLeft(2, '0')}";
|
||||
final formattedTime =
|
||||
"${dateTime.hour.toString().padLeft(2, '0')}:${dateTime.minute.toString().padLeft(2, '0')}:${dateTime.second.toString().padLeft(2, '0')}";
|
||||
return Text(
|
||||
"$formattedDate $formattedTime",
|
||||
style: const TextStyle(
|
||||
fontSize: 16,
|
||||
fontWeight: FontWeight.bold,
|
||||
),
|
||||
);
|
||||
} else {
|
||||
return const Text(
|
||||
"加载中...",
|
||||
style: TextStyle(
|
||||
fontSize: 16, fontWeight: FontWeight.bold),
|
||||
);
|
||||
}
|
||||
},
|
||||
),
|
||||
],
|
||||
)
|
||||
],
|
||||
),
|
||||
),
|
||||
IconContainer(),
|
||||
SightGview(),
|
||||
RealDataShow(),
|
||||
// CustomPaint(
|
||||
// painter: BorderPainter(controller),
|
||||
// ),
|
||||
],
|
||||
);
|
||||
});
|
||||
@ -354,25 +199,6 @@ class BorderPainter extends CustomPainter {
|
||||
|
||||
drawDashedLine(canvas, pilerCenter, screenPos, dashedPaint);
|
||||
}
|
||||
|
||||
//
|
||||
//
|
||||
//
|
||||
// if (!controller.isCardVisible.value) {
|
||||
// if (controller.calculateDistance(pilerCenterPoint, offset) < 0.9) {
|
||||
// print("距离小于1m");
|
||||
// controller.isCardVisible.value = !controller.isCardVisible.value;
|
||||
// } else {
|
||||
// print("距离大于1m");
|
||||
// }
|
||||
// } else {
|
||||
// if (controller.calculateDistance(pilerCenterPoint, offset) > 1.1) {
|
||||
// print("距离大于1m");
|
||||
// controller.isCardVisible.value = controller.isCardVisible.value;
|
||||
// } else {
|
||||
// print("距禽小于1m");
|
||||
// }
|
||||
// }
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -9,6 +9,7 @@ import 'package:get/get.dart';
|
||||
|
||||
import '../../../models/pilePoint/hyrecorditem.dart';
|
||||
import '../../pass_track/view.dart';
|
||||
import '../../task/task_page.dart';
|
||||
import 'draw_pile.dart';
|
||||
|
||||
class RealView extends StatefulWidget {
|
||||
@ -194,15 +195,17 @@ class _RealViewState extends State<RealView> {
|
||||
return Stack(
|
||||
children: [
|
||||
Obx(() => AbsorbPointer(
|
||||
absorbing: controller.isGenerate.value
|
||||
? true
|
||||
: false, //设置CenterLayout 内的GestureDetector 不生效
|
||||
// child: const ScenceMapView(
|
||||
// children: [],
|
||||
// ),
|
||||
child: PassTrack(
|
||||
date: '',
|
||||
))),
|
||||
absorbing: controller.isGenerate.value
|
||||
? true
|
||||
: false, //设置CenterLayout 内的GestureDetector 不生效
|
||||
// child: const ScenceMapView(
|
||||
// children: [],
|
||||
// ),
|
||||
child:TaskPage(), // 任务页面
|
||||
// PassTrack(
|
||||
// date: '',
|
||||
// )
|
||||
)),
|
||||
center,
|
||||
back,
|
||||
],
|
||||
|
@ -5,7 +5,6 @@ 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';
|
||||
@ -72,7 +71,10 @@ class PileGenerate extends GetView<PlumDataController> {
|
||||
controller.isGenerate.value = true,
|
||||
controller.checkValue.value = "checkPile",
|
||||
controller.isDirect.value = false,
|
||||
Navigator.pop(context)
|
||||
// controller.checkValue.value = "checkDirection",
|
||||
// controller.isDirect.value = true,
|
||||
// controller.centerXY.value =
|
||||
// Offset(centerPointX, centerPointY),
|
||||
}),
|
||||
const SizedBox(
|
||||
width: 10,
|
||||
|
192
lib/pages/task/task_page.dart
Normal file
192
lib/pages/task/task_page.dart
Normal file
@ -0,0 +1,192 @@
|
||||
import 'package:cpnav/main.dart';
|
||||
import 'package:cpnav/pages/pile/rightDra/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/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/pileNav/view.dart';
|
||||
|
||||
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)),
|
||||
),
|
||||
),
|
||||
),
|
||||
]),
|
||||
],
|
||||
),
|
||||
),
|
||||
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)),
|
||||
)
|
||||
])))
|
||||
])),
|
||||
));
|
||||
}
|
||||
}
|
||||
|
||||
final controller = Get.put(PassTrackController("TEST", "pile_cm"));
|
||||
|
||||
class TaskPage extends StatelessWidget {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final size = MediaQuery.of(context).size;
|
||||
MediaQueryData mediaQueryData =
|
||||
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(
|
||||
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: Icon(
|
||||
Icons.settings_outlined,
|
||||
size: 35,
|
||||
color: appcontroller.isDarkMode.value
|
||||
? Colors.white70
|
||||
: const Color.fromARGB(200, 29, 28, 28),
|
||||
),
|
||||
onTap: () => Scaffold.of(context).openEndDrawer(),
|
||||
),
|
||||
),
|
||||
),
|
||||
)
|
||||
],
|
||||
),
|
||||
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: Icon(
|
||||
Icons.settings_outlined,
|
||||
size: 35,
|
||||
color: appcontroller.isDarkMode.value
|
||||
? Colors.white70
|
||||
: const Color.fromARGB(200, 29, 28, 28),
|
||||
),
|
||||
onTap: () => Scaffold.of(context).openEndDrawer(),
|
||||
),
|
||||
),
|
||||
),
|
||||
)
|
||||
],
|
||||
),
|
||||
body: Row(
|
||||
children: children,
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
@ -14,7 +14,7 @@ class BaseService {
|
||||
//创建client实例
|
||||
final _client = http.Client();
|
||||
final String token =
|
||||
"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc1IiOjAsInJvbGVJZHMiOlsiODMiXSwidXNlcm5hbWUiOiJseWNzIiwidXNlcklkIjozNTYsIlBWIjoyLCJvcmciOiJhIiwiaWF0IjoxNzI0MDI5MzcwLCJleHAiOjE3MjUzMjUzNzB9.w24n7SSTXz3vnRNqKmt2zht_xbXR-iQ1EnreBIWqYNU";
|
||||
"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc1IiOjAsInJvbGVJZHMiOlsiODMiXSwidXNlcm5hbWUiOiJseWNzIiwidXNlcklkIjozNTYsIlBWIjoyLCJvcmciOiJhIiwiaWF0IjoxNzI1MzQzNTg3LCJleHAiOjE3MjY2Mzk1ODd9.Zh7sdBXWfNPjYrnc-uMBMrd93sAT3yqQF7WXrHvdzJs";
|
||||
|
||||
// String baseUrl = "http://192.168.1.189:8001";//本地
|
||||
String baseUrl = "http://1.82.251.83:8001"; //线上
|
||||
|
Loading…
Reference in New Issue
Block a user