抽屉
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);
|
return const Text("桩点:", style: textStyle);
|
||||||
} else if (_currentIndex.value == 1) {
|
} else if (_currentIndex.value == 1) {
|
||||||
return const Text("设备:", style: textStyle);
|
return const Text("设备:", style: textStyle);
|
||||||
|
} else if (_currentIndex.value == 2) {
|
||||||
|
return const Text("任务管理", style: textStyle);
|
||||||
} else {
|
} else {
|
||||||
return const Text("系统:", style: textStyle);
|
return const Text("系统:", style: textStyle);
|
||||||
}
|
}
|
||||||
@ -134,23 +136,23 @@ class CustomAppBar extends StatelessWidget implements PreferredSizeWidget {
|
|||||||
const SizedBox(
|
const SizedBox(
|
||||||
width: 10,
|
width: 10,
|
||||||
),
|
),
|
||||||
UnconstrainedBox(
|
// UnconstrainedBox(
|
||||||
child: SizedBox(
|
// child: SizedBox(
|
||||||
height: 30,
|
// height: 30,
|
||||||
child: Builder(
|
// child: Builder(
|
||||||
builder: (context) => InkWell(
|
// builder: (context) => InkWell(
|
||||||
child: Icon(
|
// child: Icon(
|
||||||
Icons.settings_outlined,
|
// Icons.settings_outlined,
|
||||||
size: 35,
|
// size: 35,
|
||||||
color: appcontroller.isDarkMode.value
|
// color: appcontroller.isDarkMode.value
|
||||||
? Colors.white70
|
// ? Colors.white70
|
||||||
: const Color.fromARGB(200, 29, 28, 28),
|
// : const Color.fromARGB(200, 29, 28, 28),
|
||||||
),
|
// ),
|
||||||
onTap: () => Scaffold.of(context).openEndDrawer(),
|
// onTap: () => Scaffold.of(context).openEndDrawer(),
|
||||||
),
|
// ),
|
||||||
),
|
// ),
|
||||||
),
|
// ),
|
||||||
)
|
// )
|
||||||
],
|
],
|
||||||
)
|
)
|
||||||
: const Text(""),
|
: const Text(""),
|
||||||
|
@ -1,5 +1,23 @@
|
|||||||
import 'package:get/get.dart';
|
import 'package:get/get.dart';
|
||||||
|
import 'package:scence_map/controllers/controller.dart';
|
||||||
|
|
||||||
class AppController extends GetxController {
|
class AppController extends GetxController {
|
||||||
final RxBool isDarkMode = false.obs;
|
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;
|
var _dy = 0.0;
|
||||||
Timer? timer;
|
Timer? timer;
|
||||||
checkDistance() {
|
checkDistance() {
|
||||||
if (DateTime.now().millisecondsSinceEpoch - aimcontroller.lastManualTapTime <
|
if (DateTime.now().millisecondsSinceEpoch -
|
||||||
|
aimcontroller.lastManualTapTime <
|
||||||
30000 ||
|
30000 ||
|
||||||
DateTime.now().millisecondsSinceEpoch - aimcontroller.lastCloseTapTime <
|
DateTime.now().millisecondsSinceEpoch - aimcontroller.lastCloseTapTime <
|
||||||
30000) {
|
30000) {
|
||||||
@ -41,7 +42,8 @@ class GnssController extends GetxController {
|
|||||||
if (aimcontroller.selectedPilePoint == null) {
|
if (aimcontroller.selectedPilePoint == null) {
|
||||||
return;
|
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 (mapController.calculateDistance(pilerCenterPoint, offset) < 1.9) {
|
||||||
if (!aimcontroller.isCardVisible.value) {
|
if (!aimcontroller.isCardVisible.value) {
|
||||||
print("距离小于1m");
|
print("距离小于1m");
|
||||||
@ -92,18 +94,28 @@ class GnssController extends GetxController {
|
|||||||
var dx = device.x - aimcontroller.selectedPilePoint!.x;
|
var dx = device.x - aimcontroller.selectedPilePoint!.x;
|
||||||
var dy = device.y - aimcontroller.selectedPilePoint!.y;
|
var dy = device.y - aimcontroller.selectedPilePoint!.y;
|
||||||
var distance = sqrt(dx * dx + dy * dy);
|
var distance = sqrt(dx * dx + dy * dy);
|
||||||
if (distance > 20) {
|
if (distance > 2) {
|
||||||
dx = (aimcontroller.selectedPilePoint!.x - device.x) / (distance / 20);
|
dx = (aimcontroller.selectedPilePoint!.x - device.x) /
|
||||||
dy = (aimcontroller.selectedPilePoint!.y - device.y) / (distance / 20);
|
(distance / 2);
|
||||||
|
dy = (aimcontroller.selectedPilePoint!.y - device.y) /
|
||||||
|
(distance / 2);
|
||||||
device.x = aimcontroller.selectedPilePoint!.x + dx;
|
device.x = aimcontroller.selectedPilePoint!.x + dx;
|
||||||
device.y = aimcontroller.selectedPilePoint!.y + dy;
|
device.y = aimcontroller.selectedPilePoint!.y + dy;
|
||||||
}
|
}
|
||||||
_dx = -dx / 50;
|
_dx = -dx / 10;
|
||||||
_dy = -dy / 50;
|
_dy = -dy / 10;
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// if ((aimcontroller.selectedPilePoint!.x - device.x).abs() > _dx.abs()) {
|
||||||
device.x += _dx;
|
device.x += _dx;
|
||||||
device.y += _dy;
|
device.y += _dy;
|
||||||
|
// } else {
|
||||||
|
// device.x = aimcontroller.selectedPilePoint!.x;
|
||||||
|
// device.y = aimcontroller.selectedPilePoint!.y;
|
||||||
|
// }
|
||||||
|
|
||||||
// device.x += 0.05;
|
// device.x += 0.05;
|
||||||
// device.y += 0.05;
|
// device.y += 0.05;
|
||||||
device.rotation = device.rotation + pi / 180; // 确保旋转角度在0-360度之间
|
device.rotation = device.rotation + pi / 180; // 确保旋转角度在0-360度之间
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
import 'package:cpnav/controllers/appcontroller.dart';
|
import 'package:cpnav/controllers/appcontroller.dart';
|
||||||
import 'package:cpnav/controllers/gnss_Controller.dart';
|
import 'package:cpnav/controllers/gnss_Controller.dart';
|
||||||
import 'package:cpnav/pages/setting/child_pages/antenna/antenna_setting.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/material.dart';
|
||||||
import 'package:flutter/services.dart';
|
import 'package:flutter/services.dart';
|
||||||
import 'package:get/get.dart';
|
import 'package:get/get.dart';
|
||||||
@ -9,8 +10,9 @@ import 'package:scence_map/controllers/plumController.dart';
|
|||||||
import 'appbar.dart';
|
import 'appbar.dart';
|
||||||
import 'pages/aim_point/aimpointController.dart';
|
import 'pages/aim_point/aimpointController.dart';
|
||||||
import 'pages/history/history_record.dart';
|
import 'pages/history/history_record.dart';
|
||||||
|
import 'pages/pass_track/view.dart';
|
||||||
import 'pages/pile/pileNav/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/real/index.dart';
|
||||||
import 'pages/setting/child_pages/XyChange/connect.dart';
|
import 'pages/setting/child_pages/XyChange/connect.dart';
|
||||||
import 'pages/setting/setting_page.dart';
|
import 'pages/setting/setting_page.dart';
|
||||||
@ -26,6 +28,7 @@ void main() async {
|
|||||||
Get.put(AimPointerController());
|
Get.put(AimPointerController());
|
||||||
Get.put(GnssController());
|
Get.put(GnssController());
|
||||||
Get.put(AntennaController());
|
Get.put(AntennaController());
|
||||||
|
Get.put(AppController());
|
||||||
LoginPrefs loginPrefs = LoginPrefs();
|
LoginPrefs loginPrefs = LoginPrefs();
|
||||||
String value =
|
String value =
|
||||||
await loginPrefs.init(); // await 关键字必须用在异步方法中 await等待异步方法执行完毕 异步方法必须用变量接收
|
await loginPrefs.init(); // await 关键字必须用在异步方法中 await等待异步方法执行完毕 异步方法必须用变量接收
|
||||||
@ -61,13 +64,13 @@ class MyHomePage extends StatefulWidget {
|
|||||||
class _MyHomePageState extends State<MyHomePage> {
|
class _MyHomePageState extends State<MyHomePage> {
|
||||||
late bool isPortrait;
|
late bool isPortrait;
|
||||||
late double appBarHeight = 34.0;
|
late double appBarHeight = 34.0;
|
||||||
final _currentIndex = 0.obs;
|
|
||||||
final List<Widget> _pages = [
|
final List<Widget> _pages = [
|
||||||
Real(),
|
Real(),
|
||||||
RealView(),
|
PassTrack(
|
||||||
Container(
|
date: '',
|
||||||
color: Colors.blue,
|
|
||||||
),
|
),
|
||||||
|
TaskManagePage(),
|
||||||
HistoryRecord(),
|
HistoryRecord(),
|
||||||
SettingPortrait()
|
SettingPortrait()
|
||||||
];
|
];
|
||||||
@ -78,17 +81,17 @@ class _MyHomePageState extends State<MyHomePage> {
|
|||||||
return Scaffold(
|
return Scaffold(
|
||||||
resizeToAvoidBottomInset: false,
|
resizeToAvoidBottomInset: false,
|
||||||
drawerEdgeDragWidth: 0.0, // 禁止通过滑动打开drawer
|
drawerEdgeDragWidth: 0.0, // 禁止通过滑动打开drawer
|
||||||
endDrawer: _currentIndex.value == 1
|
// endDrawer: appcontroller.currentIndex.value == 1
|
||||||
? Drawer(
|
// ? Drawer(
|
||||||
width: size.width * .8,
|
// width: size.width * .8,
|
||||||
child: const PileGenerate(),
|
// child: const PileGenerate(),
|
||||||
)
|
// )
|
||||||
: null,
|
// : null,
|
||||||
appBar: PreferredSize(
|
appBar: PreferredSize(
|
||||||
preferredSize: Size.fromHeight(appBarHeight),
|
preferredSize: Size.fromHeight(appBarHeight),
|
||||||
child: CustomAppBar(
|
child: CustomAppBar(
|
||||||
appBarHeight: 56,
|
appBarHeight: 56,
|
||||||
currentIndex: _currentIndex,
|
currentIndex: appcontroller.currentIndex,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
body: OrientationBuilder(
|
body: OrientationBuilder(
|
||||||
@ -102,7 +105,7 @@ class _MyHomePageState extends State<MyHomePage> {
|
|||||||
crossAxisAlignment: CrossAxisAlignment.stretch,
|
crossAxisAlignment: CrossAxisAlignment.stretch,
|
||||||
children: [
|
children: [
|
||||||
Expanded(
|
Expanded(
|
||||||
child: _pages[_currentIndex.value],
|
child: _pages[appcontroller.currentIndex.value],
|
||||||
),
|
),
|
||||||
const VerticalDivider(
|
const VerticalDivider(
|
||||||
width: 1, // 设置高度为1
|
width: 1, // 设置高度为1
|
||||||
@ -123,11 +126,11 @@ class _MyHomePageState extends State<MyHomePage> {
|
|||||||
IconButton(
|
IconButton(
|
||||||
onPressed: () {
|
onPressed: () {
|
||||||
setState(() {
|
setState(() {
|
||||||
_currentIndex.value = 0;
|
appcontroller.currentIndex.value = 0;
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
icon: const Icon(Icons.date_range_rounded),
|
icon: const Icon(Icons.date_range_rounded),
|
||||||
color: _currentIndex.value == 0
|
color: appcontroller.currentIndex.value == 0
|
||||||
? const Color.fromARGB(255, 60, 95, 123)
|
? const Color.fromARGB(255, 60, 95, 123)
|
||||||
: Colors.grey,
|
: Colors.grey,
|
||||||
),
|
),
|
||||||
@ -137,7 +140,9 @@ class _MyHomePageState extends State<MyHomePage> {
|
|||||||
'实时',
|
'实时',
|
||||||
style: TextStyle(
|
style: TextStyle(
|
||||||
fontSize: 12,
|
fontSize: 12,
|
||||||
color: _currentIndex.value == 0
|
color:
|
||||||
|
appcontroller.currentIndex.value ==
|
||||||
|
0
|
||||||
? const Color.fromARGB(
|
? const Color.fromARGB(
|
||||||
255, 60, 95, 123)
|
255, 60, 95, 123)
|
||||||
: Colors.grey,
|
: Colors.grey,
|
||||||
@ -156,11 +161,11 @@ class _MyHomePageState extends State<MyHomePage> {
|
|||||||
IconButton(
|
IconButton(
|
||||||
onPressed: () {
|
onPressed: () {
|
||||||
setState(() {
|
setState(() {
|
||||||
_currentIndex.value = 1;
|
appcontroller.currentIndex.value = 1;
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
icon: const Icon(Icons.map_outlined),
|
icon: const Icon(Icons.map_outlined),
|
||||||
color: _currentIndex.value == 1
|
color: appcontroller.currentIndex.value == 1
|
||||||
? const Color.fromARGB(255, 60, 95, 123)
|
? const Color.fromARGB(255, 60, 95, 123)
|
||||||
: Colors.grey,
|
: Colors.grey,
|
||||||
),
|
),
|
||||||
@ -170,7 +175,9 @@ class _MyHomePageState extends State<MyHomePage> {
|
|||||||
'桩点',
|
'桩点',
|
||||||
style: TextStyle(
|
style: TextStyle(
|
||||||
fontSize: 12,
|
fontSize: 12,
|
||||||
color: _currentIndex.value == 1
|
color:
|
||||||
|
appcontroller.currentIndex.value ==
|
||||||
|
1
|
||||||
? const Color.fromARGB(
|
? const Color.fromARGB(
|
||||||
255, 60, 95, 123)
|
255, 60, 95, 123)
|
||||||
: Colors.grey,
|
: Colors.grey,
|
||||||
@ -185,11 +192,11 @@ class _MyHomePageState extends State<MyHomePage> {
|
|||||||
IconButton(
|
IconButton(
|
||||||
onPressed: () {
|
onPressed: () {
|
||||||
setState(() {
|
setState(() {
|
||||||
_currentIndex.value = 2;
|
appcontroller.currentIndex.value = 2;
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
icon: const Icon(Icons.my_location_sharp),
|
icon: const Icon(Icons.my_location_sharp),
|
||||||
color: _currentIndex.value == 2
|
color: appcontroller.currentIndex.value == 2
|
||||||
? const Color.fromARGB(255, 60, 95, 123)
|
? const Color.fromARGB(255, 60, 95, 123)
|
||||||
: Colors.grey,
|
: Colors.grey,
|
||||||
),
|
),
|
||||||
@ -199,7 +206,9 @@ class _MyHomePageState extends State<MyHomePage> {
|
|||||||
'任务',
|
'任务',
|
||||||
style: TextStyle(
|
style: TextStyle(
|
||||||
fontSize: 12,
|
fontSize: 12,
|
||||||
color: _currentIndex.value == 2
|
color:
|
||||||
|
appcontroller.currentIndex.value ==
|
||||||
|
2
|
||||||
? const Color.fromARGB(
|
? const Color.fromARGB(
|
||||||
255, 60, 95, 123)
|
255, 60, 95, 123)
|
||||||
: Colors.grey,
|
: Colors.grey,
|
||||||
@ -214,12 +223,12 @@ class _MyHomePageState extends State<MyHomePage> {
|
|||||||
IconButton(
|
IconButton(
|
||||||
onPressed: () {
|
onPressed: () {
|
||||||
setState(() {
|
setState(() {
|
||||||
_currentIndex.value = 3;
|
appcontroller.currentIndex.value = 3;
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
icon:
|
icon:
|
||||||
const Icon(Icons.table_chart_outlined),
|
const Icon(Icons.table_chart_outlined),
|
||||||
color: _currentIndex.value == 3
|
color: appcontroller.currentIndex.value == 3
|
||||||
? const Color.fromARGB(255, 60, 95, 123)
|
? const Color.fromARGB(255, 60, 95, 123)
|
||||||
: Colors.grey,
|
: Colors.grey,
|
||||||
),
|
),
|
||||||
@ -229,7 +238,9 @@ class _MyHomePageState extends State<MyHomePage> {
|
|||||||
'历史',
|
'历史',
|
||||||
style: TextStyle(
|
style: TextStyle(
|
||||||
fontSize: 12,
|
fontSize: 12,
|
||||||
color: _currentIndex.value == 3
|
color:
|
||||||
|
appcontroller.currentIndex.value ==
|
||||||
|
3
|
||||||
? const Color.fromARGB(
|
? const Color.fromARGB(
|
||||||
255, 60, 95, 123)
|
255, 60, 95, 123)
|
||||||
: Colors.grey,
|
: Colors.grey,
|
||||||
@ -244,11 +255,11 @@ class _MyHomePageState extends State<MyHomePage> {
|
|||||||
IconButton(
|
IconButton(
|
||||||
onPressed: () {
|
onPressed: () {
|
||||||
setState(() {
|
setState(() {
|
||||||
_currentIndex.value = 4;
|
appcontroller.currentIndex.value = 4;
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
icon: const Icon(Icons.settings),
|
icon: const Icon(Icons.settings),
|
||||||
color: _currentIndex.value == 4
|
color: appcontroller.currentIndex.value == 4
|
||||||
? const Color.fromARGB(255, 60, 95, 123)
|
? const Color.fromARGB(255, 60, 95, 123)
|
||||||
: Colors.grey,
|
: Colors.grey,
|
||||||
),
|
),
|
||||||
@ -258,7 +269,9 @@ class _MyHomePageState extends State<MyHomePage> {
|
|||||||
'设置',
|
'设置',
|
||||||
style: TextStyle(
|
style: TextStyle(
|
||||||
fontSize: 12,
|
fontSize: 12,
|
||||||
color: _currentIndex.value == 4
|
color:
|
||||||
|
appcontroller.currentIndex.value ==
|
||||||
|
4
|
||||||
? const Color.fromARGB(
|
? const Color.fromARGB(
|
||||||
255, 60, 95, 123)
|
255, 60, 95, 123)
|
||||||
: Colors.grey,
|
: Colors.grey,
|
||||||
@ -282,7 +295,7 @@ class _MyHomePageState extends State<MyHomePage> {
|
|||||||
children: [
|
children: [
|
||||||
Expanded(
|
Expanded(
|
||||||
flex: 12,
|
flex: 12,
|
||||||
child: _pages[_currentIndex.value],
|
child: _pages[appcontroller.currentIndex.value],
|
||||||
),
|
),
|
||||||
// VerticalDivider(),
|
// VerticalDivider(),
|
||||||
Expanded(
|
Expanded(
|
||||||
@ -291,10 +304,10 @@ class _MyHomePageState extends State<MyHomePage> {
|
|||||||
height: 48,
|
height: 48,
|
||||||
child: BottomNavigationBar(
|
child: BottomNavigationBar(
|
||||||
type: BottomNavigationBarType.fixed,
|
type: BottomNavigationBarType.fixed,
|
||||||
currentIndex: _currentIndex.value,
|
currentIndex: appcontroller.currentIndex.value,
|
||||||
onTap: (index) {
|
onTap: (index) {
|
||||||
setState(() {
|
setState(() {
|
||||||
_currentIndex.value = index;
|
appcontroller.currentIndex.value = index;
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
items: const [
|
items: const [
|
||||||
@ -305,7 +318,7 @@ class _MyHomePageState extends State<MyHomePage> {
|
|||||||
icon: Icon(Icons.map_outlined), label: "计划"),
|
icon: Icon(Icons.map_outlined), label: "计划"),
|
||||||
BottomNavigationBarItem(
|
BottomNavigationBarItem(
|
||||||
icon: Icon(Icons.my_location_sharp),
|
icon: Icon(Icons.my_location_sharp),
|
||||||
label: "对点"),
|
label: "任务"),
|
||||||
BottomNavigationBarItem(
|
BottomNavigationBarItem(
|
||||||
icon: Icon(Icons.table_chart_outlined),
|
icon: Icon(Icons.table_chart_outlined),
|
||||||
label: "历史"),
|
label: "历史"),
|
||||||
|
@ -3,7 +3,7 @@ import 'package:get/get.dart';
|
|||||||
import 'package:scence_map/record_entity.dart';
|
import 'package:scence_map/record_entity.dart';
|
||||||
|
|
||||||
class AimPointerController extends GetxController {
|
class AimPointerController extends GetxController {
|
||||||
var isNomal = true.obs;
|
// var isNomal = true.obs;
|
||||||
//左下圆
|
//左下圆
|
||||||
var sightOffset = const Offset(3, 3).obs;
|
var sightOffset = const Offset(3, 3).obs;
|
||||||
var sightOffsetInit = const Offset(0, 0).obs;
|
var sightOffsetInit = const Offset(0, 0).obs;
|
||||||
@ -18,8 +18,8 @@ class AimPointerController extends GetxController {
|
|||||||
var plot = 2.0.obs;
|
var plot = 2.0.obs;
|
||||||
var scale = 0.75.obs;
|
var scale = 0.75.obs;
|
||||||
var cardWidth = 0.0.obs;
|
var cardWidth = 0.0.obs;
|
||||||
var left = 0.0.obs;
|
var x = 0.0.obs;
|
||||||
var top = 0.0.obs;
|
var y = 0.0.obs;
|
||||||
var positionUpdate = 0.obs;
|
var positionUpdate = 0.obs;
|
||||||
|
|
||||||
int lastManualTapTime = 0;
|
int lastManualTapTime = 0;
|
||||||
|
@ -2,9 +2,9 @@ import 'dart:async';
|
|||||||
import 'dart:math';
|
import 'dart:math';
|
||||||
import 'dart:ui' as ui;
|
import 'dart:ui' as ui;
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter/scheduler.dart';
|
|
||||||
import 'package:get/get.dart';
|
import 'package:get/get.dart';
|
||||||
import 'package:scence_map/controllers/controller.dart';
|
import 'package:scence_map/controllers/controller.dart';
|
||||||
|
import '../../controllers/appcontroller.dart';
|
||||||
import '../../controllers/gnss_Controller.dart';
|
import '../../controllers/gnss_Controller.dart';
|
||||||
import '../../service/pile/device_type.dart';
|
import '../../service/pile/device_type.dart';
|
||||||
import 'aimpointController.dart';
|
import 'aimpointController.dart';
|
||||||
@ -25,7 +25,7 @@ class AimPointer extends GetView<AimPointerController> {
|
|||||||
double rectWidth = size.width;
|
double rectWidth = size.width;
|
||||||
|
|
||||||
final deviceType = getDeviceType(context);
|
final deviceType = getDeviceType(context);
|
||||||
|
final appcontroller = Get.put(AppController());
|
||||||
if (orientation == Orientation.landscape) {
|
if (orientation == Orientation.landscape) {
|
||||||
rectWidth = size.width / 2 - 60;
|
rectWidth = size.width / 2 - 60;
|
||||||
if (deviceType == DeviceType.mobile) {
|
if (deviceType == DeviceType.mobile) {
|
||||||
@ -49,16 +49,13 @@ class AimPointer extends GetView<AimPointerController> {
|
|||||||
|
|
||||||
borderRadius: BorderRadius.circular(4.0), // 可以根据需要调整圆角半径
|
borderRadius: BorderRadius.circular(4.0), // 可以根据需要调整圆角半径
|
||||||
),
|
),
|
||||||
child: Stack(
|
child: Container(
|
||||||
children: [
|
|
||||||
Container(
|
|
||||||
width: rectWidth,
|
width: rectWidth,
|
||||||
height: rectWidth,
|
height: rectWidth,
|
||||||
decoration: BoxDecoration(
|
decoration: BoxDecoration(
|
||||||
border: Border.all(
|
border:
|
||||||
color: isDarkMode ? Colors.white : Colors.black),
|
Border.all(color: isDarkMode ? Colors.white : Colors.black),
|
||||||
borderRadius:
|
borderRadius: BorderRadius.all(Radius.circular(rectWidth / 2)),
|
||||||
BorderRadius.all(Radius.circular(rectWidth / 2)),
|
|
||||||
),
|
),
|
||||||
child: Stack(
|
child: Stack(
|
||||||
children: [
|
children: [
|
||||||
@ -87,16 +84,6 @@ class AimPointer extends GetView<AimPointerController> {
|
|||||||
},
|
},
|
||||||
);
|
);
|
||||||
})),
|
})),
|
||||||
Positioned(
|
|
||||||
top: 25,
|
|
||||||
right: 10,
|
|
||||||
child: TextButton(
|
|
||||||
child: Text(
|
|
||||||
"垂直度:$gradienter°",
|
|
||||||
style: const TextStyle(fontSize: 20),
|
|
||||||
),
|
|
||||||
onPressed: () {},
|
|
||||||
)),
|
|
||||||
Positioned(
|
Positioned(
|
||||||
right: 0,
|
right: 0,
|
||||||
top: 0,
|
top: 0,
|
||||||
@ -110,6 +97,16 @@ class AimPointer extends GetView<AimPointerController> {
|
|||||||
},
|
},
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
Positioned(
|
||||||
|
top: 30,
|
||||||
|
right: 10,
|
||||||
|
child: TextButton(
|
||||||
|
child: Text(
|
||||||
|
"垂直度:$gradienter°",
|
||||||
|
style: const TextStyle(fontSize: 20),
|
||||||
|
),
|
||||||
|
onPressed: () {},
|
||||||
|
)),
|
||||||
Obx(() {
|
Obx(() {
|
||||||
var pixel2MeterRatio =
|
var pixel2MeterRatio =
|
||||||
aimcontroller.plot.value * 2 / rectWidth;
|
aimcontroller.plot.value * 2 / rectWidth;
|
||||||
@ -120,34 +117,36 @@ class AimPointer extends GetView<AimPointerController> {
|
|||||||
aimcontroller.selectedPilePoint!.x);
|
aimcontroller.selectedPilePoint!.x);
|
||||||
var dy = (gnsscontroller.device.y -
|
var dy = (gnsscontroller.device.y -
|
||||||
aimcontroller.selectedPilePoint!.y);
|
aimcontroller.selectedPilePoint!.y);
|
||||||
|
// if (dx * dy < 0) {
|
||||||
aimcontroller.top.value = dx *
|
// aimcontroller.top.value = dx *
|
||||||
cos(mapcontroller.rotation.value) +
|
// cos(mapcontroller.rotation.value) +
|
||||||
dy * sin(mapcontroller.rotation.value);
|
// dy * sin(mapcontroller.rotation.value);
|
||||||
aimcontroller.left.value = -dx *
|
// aimcontroller.left.value = -dx *
|
||||||
sin(mapcontroller.rotation.value) +
|
// sin(mapcontroller.rotation.value) +
|
||||||
dy * cos(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++;
|
// aimcontroller.positionUpdate.value++;
|
||||||
print("dx:$dx,dy:$dy");
|
print("dx:$dx,dy:$dy");
|
||||||
print(
|
print(
|
||||||
"left:${aimcontroller.left.value},top:${aimcontroller.top.value}");
|
"left:${aimcontroller.x.value},top:${aimcontroller.y.value}");
|
||||||
}
|
}
|
||||||
|
|
||||||
return Positioned(
|
return Positioned(
|
||||||
left: rectWidth / 2 -
|
left: rectWidth / 2 -
|
||||||
30 +
|
30 +
|
||||||
aimcontroller.left.value /
|
aimcontroller.y.value / pixel2MeterRatio,
|
||||||
pixel2MeterRatio,
|
|
||||||
top: rectWidth / 2 -
|
top: rectWidth / 2 -
|
||||||
30 -
|
30 -
|
||||||
aimcontroller.top.value /
|
aimcontroller.x.value / pixel2MeterRatio,
|
||||||
pixel2MeterRatio,
|
|
||||||
// left: 70,
|
|
||||||
// top: 70,
|
|
||||||
child: Transform(
|
child: Transform(
|
||||||
transform: Matrix4.identity()
|
transform: Matrix4.identity()
|
||||||
..rotateZ(
|
..rotateZ(gnsscontroller.device.rotation +
|
||||||
gnsscontroller.device.rotation +
|
|
||||||
pi / 2 +
|
pi / 2 +
|
||||||
mapcontroller.rotation.value),
|
mapcontroller.rotation.value),
|
||||||
alignment: FractionalOffset.center,
|
alignment: FractionalOffset.center,
|
||||||
@ -159,8 +158,8 @@ class AimPointer extends GetView<AimPointerController> {
|
|||||||
height: 60.0, // 设置图像的高度
|
height: 60.0, // 设置图像的高度
|
||||||
child: Image.asset(
|
child: Image.asset(
|
||||||
"images/navi_pointer.png",
|
"images/navi_pointer.png",
|
||||||
errorBuilder: (context, error,
|
errorBuilder:
|
||||||
stackTrace) {
|
(context, error, stackTrace) {
|
||||||
return Text('无法加载图片');
|
return Text('无法加载图片');
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
@ -189,17 +188,15 @@ class AimPointer extends GetView<AimPointerController> {
|
|||||||
))
|
))
|
||||||
],
|
],
|
||||||
)),
|
)),
|
||||||
],
|
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
// const SizedBox(
|
||||||
const SizedBox(
|
// width: 5,
|
||||||
width: 5,
|
// height: 5,
|
||||||
height: 5,
|
// ),
|
||||||
),
|
// const Expanded(
|
||||||
const Expanded(
|
// child: Text(""),
|
||||||
child: Text(""),
|
// ),
|
||||||
),
|
|
||||||
];
|
];
|
||||||
if (isPortrait) {
|
if (isPortrait) {
|
||||||
return Column(
|
return Column(
|
||||||
@ -229,7 +226,7 @@ class DrawAxis extends CustomPainter {
|
|||||||
Icons.arrow_left,
|
Icons.arrow_left,
|
||||||
Icons.arrow_right
|
Icons.arrow_right
|
||||||
];
|
];
|
||||||
List<Offset> iconOffset = [];
|
// List<Offset> iconOffset = [];
|
||||||
|
|
||||||
List<String> text = ["", "", "", ""]; //['前移', '后移', '左移', '右移'];
|
List<String> text = ["", "", "", ""]; //['前移', '后移', '左移', '右移'];
|
||||||
@override
|
@override
|
||||||
@ -241,8 +238,8 @@ class DrawAxis extends CustomPainter {
|
|||||||
|
|
||||||
double rectWidth = (size.height / 2 - 5).roundToDouble();
|
double rectWidth = (size.height / 2 - 5).roundToDouble();
|
||||||
aimcontroller.cardWidth.value = rectWidth;
|
aimcontroller.cardWidth.value = rectWidth;
|
||||||
if (!aimcontroller.isNomal.value) {
|
// if (!aimcontroller.isNomal.value) {
|
||||||
} else {}
|
// } else {}
|
||||||
|
|
||||||
path.moveTo(0, rectWidth + 5);
|
path.moveTo(0, rectWidth + 5);
|
||||||
path.lineTo(size.height, 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));
|
||||||
|
|
||||||
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; //
|
// double x = real.tiltX.value; //
|
||||||
@ -314,7 +310,7 @@ class DrawAxis extends CustomPainter {
|
|||||||
|
|
||||||
drawPoint(Canvas canvas) {
|
drawPoint(Canvas canvas) {
|
||||||
canvas.drawCircle(Offset.zero, 20,
|
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);
|
// drawText(canvas, pos - const Offset(20, 10), i, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -367,25 +363,23 @@ class SightGview extends StatelessWidget {
|
|||||||
// 正确计算初始偏移量:当前手指位置与卡片当前位置之间的差值
|
// 正确计算初始偏移量:当前手指位置与卡片当前位置之间的差值
|
||||||
aimcontroller.sightInit.value =
|
aimcontroller.sightInit.value =
|
||||||
details.localFocalPoint - aimcontroller.sightOffset.value;
|
details.localFocalPoint - aimcontroller.sightOffset.value;
|
||||||
//
|
|
||||||
//
|
|
||||||
//
|
|
||||||
print(
|
|
||||||
'aimcontroller.isCardVisible: ${aimcontroller.isCardVisible.value}');
|
|
||||||
},
|
},
|
||||||
onScaleUpdate: (details) {
|
onScaleUpdate: (details) {
|
||||||
// 使用初始偏移量来更新卡片的位置
|
// 使用初始偏移量来更新卡片的位置
|
||||||
aimcontroller.sightOffset.value =
|
aimcontroller.sightOffset.value =
|
||||||
details.localFocalPoint - aimcontroller.sightInit.value;
|
details.localFocalPoint - aimcontroller.sightInit.value;
|
||||||
},
|
},
|
||||||
child: Container(
|
child: Stack(children: [
|
||||||
decoration: const BoxDecoration(color: Colors.transparent),
|
Container(
|
||||||
|
decoration:
|
||||||
|
const BoxDecoration(color: Colors.transparent),
|
||||||
child: Stack(children: [
|
child: Stack(children: [
|
||||||
Card(
|
Card(
|
||||||
color: Colors.transparent,
|
color: Colors.transparent,
|
||||||
elevation: 5.0,
|
elevation: 5.0,
|
||||||
child: AimPointer(),
|
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 '../aim_point/aimpointController.dart';
|
||||||
import '../real/realDataCard.dart';
|
import '../real/realDataCard.dart';
|
||||||
import 'iconContainer.dart';
|
|
||||||
import "controller.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());
|
ScenceMapController mapcontroller = Get.put(ScenceMapController());
|
||||||
|
|
||||||
class PassTrack extends StatefulWidget {
|
class PassTrack extends StatefulWidget {
|
||||||
@ -106,8 +96,6 @@ class _PasstrackState extends State<PassTrack> {
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
final size = MediaQuery.of(context).size;
|
|
||||||
var isPortrait = MediaQuery.of(context).orientation == Orientation.portrait;
|
|
||||||
return OrientationBuilder(builder: (context, orientation) {
|
return OrientationBuilder(builder: (context, orientation) {
|
||||||
return Stack(
|
return Stack(
|
||||||
children: [
|
children: [
|
||||||
@ -125,151 +113,8 @@ class _PasstrackState extends State<PassTrack> {
|
|||||||
aimcontroller.selectedPilePoint = selectedPilePoint;
|
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(),
|
SightGview(),
|
||||||
RealDataShow(),
|
RealDataShow(),
|
||||||
// CustomPaint(
|
|
||||||
// painter: BorderPainter(controller),
|
|
||||||
// ),
|
|
||||||
],
|
],
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
@ -354,25 +199,6 @@ class BorderPainter extends CustomPainter {
|
|||||||
|
|
||||||
drawDashedLine(canvas, pilerCenter, screenPos, dashedPaint);
|
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 '../../../models/pilePoint/hyrecorditem.dart';
|
||||||
import '../../pass_track/view.dart';
|
import '../../pass_track/view.dart';
|
||||||
|
import '../../task/task_page.dart';
|
||||||
import 'draw_pile.dart';
|
import 'draw_pile.dart';
|
||||||
|
|
||||||
class RealView extends StatefulWidget {
|
class RealView extends StatefulWidget {
|
||||||
@ -200,9 +201,11 @@ class _RealViewState extends State<RealView> {
|
|||||||
// child: const ScenceMapView(
|
// child: const ScenceMapView(
|
||||||
// children: [],
|
// children: [],
|
||||||
// ),
|
// ),
|
||||||
child: PassTrack(
|
child:TaskPage(), // 任务页面
|
||||||
date: '',
|
// PassTrack(
|
||||||
))),
|
// date: '',
|
||||||
|
// )
|
||||||
|
)),
|
||||||
center,
|
center,
|
||||||
back,
|
back,
|
||||||
],
|
],
|
||||||
|
@ -5,7 +5,6 @@ import 'package:get/get.dart';
|
|||||||
import 'package:scence_map/controllers/controller.dart';
|
import 'package:scence_map/controllers/controller.dart';
|
||||||
import 'package:scence_map/controllers/plumController.dart';
|
import 'package:scence_map/controllers/plumController.dart';
|
||||||
|
|
||||||
|
|
||||||
import '../../../service/pile/device_type.dart';
|
import '../../../service/pile/device_type.dart';
|
||||||
import '../../../service/pile/input.dart';
|
import '../../../service/pile/input.dart';
|
||||||
import '../../../service/pile/public_widget.dart';
|
import '../../../service/pile/public_widget.dart';
|
||||||
@ -72,7 +71,10 @@ class PileGenerate extends GetView<PlumDataController> {
|
|||||||
controller.isGenerate.value = true,
|
controller.isGenerate.value = true,
|
||||||
controller.checkValue.value = "checkPile",
|
controller.checkValue.value = "checkPile",
|
||||||
controller.isDirect.value = false,
|
controller.isDirect.value = false,
|
||||||
Navigator.pop(context)
|
// controller.checkValue.value = "checkDirection",
|
||||||
|
// controller.isDirect.value = true,
|
||||||
|
// controller.centerXY.value =
|
||||||
|
// Offset(centerPointX, centerPointY),
|
||||||
}),
|
}),
|
||||||
const SizedBox(
|
const SizedBox(
|
||||||
width: 10,
|
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实例
|
//创建client实例
|
||||||
final _client = http.Client();
|
final _client = http.Client();
|
||||||
final String token =
|
final String token =
|
||||||
"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc1IiOjAsInJvbGVJZHMiOlsiODMiXSwidXNlcm5hbWUiOiJseWNzIiwidXNlcklkIjozNTYsIlBWIjoyLCJvcmciOiJhIiwiaWF0IjoxNzI0MDI5MzcwLCJleHAiOjE3MjUzMjUzNzB9.w24n7SSTXz3vnRNqKmt2zht_xbXR-iQ1EnreBIWqYNU";
|
"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc1IiOjAsInJvbGVJZHMiOlsiODMiXSwidXNlcm5hbWUiOiJseWNzIiwidXNlcklkIjozNTYsIlBWIjoyLCJvcmciOiJhIiwiaWF0IjoxNzI1MzQzNTg3LCJleHAiOjE3MjY2Mzk1ODd9.Zh7sdBXWfNPjYrnc-uMBMrd93sAT3yqQF7WXrHvdzJs";
|
||||||
|
|
||||||
// String baseUrl = "http://192.168.1.189:8001";//本地
|
// String baseUrl = "http://192.168.1.189:8001";//本地
|
||||||
String baseUrl = "http://1.82.251.83:8001"; //线上
|
String baseUrl = "http://1.82.251.83:8001"; //线上
|
||||||
|
Loading…
Reference in New Issue
Block a user