底部部件
This commit is contained in:
parent
b0769fe37d
commit
7d9626fafb
@ -1 +1 @@
|
|||||||
{"info":"This is a generated file; do not edit or check into version control.","plugins":{"ios":[{"name":"path_provider_foundation","path":"C:\\\\Users\\\\Administrator\\\\AppData\\\\Local\\\\Pub\\\\Cache\\\\hosted\\\\pub.dev\\\\path_provider_foundation-2.4.0\\\\","shared_darwin_source":true,"native_build":true,"dependencies":[]}],"android":[{"name":"path_provider_android","path":"C:\\\\Users\\\\Administrator\\\\AppData\\\\Local\\\\Pub\\\\Cache\\\\hosted\\\\pub.dev\\\\path_provider_android-2.2.10\\\\","native_build":true,"dependencies":[]}],"macos":[{"name":"path_provider_foundation","path":"C:\\\\Users\\\\Administrator\\\\AppData\\\\Local\\\\Pub\\\\Cache\\\\hosted\\\\pub.dev\\\\path_provider_foundation-2.4.0\\\\","shared_darwin_source":true,"native_build":true,"dependencies":[]}],"linux":[{"name":"path_provider_linux","path":"C:\\\\Users\\\\Administrator\\\\AppData\\\\Local\\\\Pub\\\\Cache\\\\hosted\\\\pub.dev\\\\path_provider_linux-2.2.1\\\\","native_build":false,"dependencies":[]}],"windows":[{"name":"path_provider_windows","path":"C:\\\\Users\\\\Administrator\\\\AppData\\\\Local\\\\Pub\\\\Cache\\\\hosted\\\\pub.dev\\\\path_provider_windows-2.3.0\\\\","native_build":false,"dependencies":[]}],"web":[]},"dependencyGraph":[{"name":"path_provider","dependencies":["path_provider_android","path_provider_foundation","path_provider_linux","path_provider_windows"]},{"name":"path_provider_android","dependencies":[]},{"name":"path_provider_foundation","dependencies":[]},{"name":"path_provider_linux","dependencies":[]},{"name":"path_provider_windows","dependencies":[]}],"date_created":"2024-08-20 16:40:54.130946","version":"3.24.0","swift_package_manager_enabled":false}
|
{"info":"This is a generated file; do not edit or check into version control.","plugins":{"ios":[{"name":"path_provider_foundation","path":"C:\\\\Users\\\\Administrator\\\\AppData\\\\Local\\\\Pub\\\\Cache\\\\hosted\\\\pub.dev\\\\path_provider_foundation-2.4.0\\\\","shared_darwin_source":true,"native_build":true,"dependencies":[]}],"android":[{"name":"path_provider_android","path":"C:\\\\Users\\\\Administrator\\\\AppData\\\\Local\\\\Pub\\\\Cache\\\\hosted\\\\pub.dev\\\\path_provider_android-2.2.10\\\\","native_build":true,"dependencies":[]}],"macos":[{"name":"path_provider_foundation","path":"C:\\\\Users\\\\Administrator\\\\AppData\\\\Local\\\\Pub\\\\Cache\\\\hosted\\\\pub.dev\\\\path_provider_foundation-2.4.0\\\\","shared_darwin_source":true,"native_build":true,"dependencies":[]}],"linux":[{"name":"path_provider_linux","path":"C:\\\\Users\\\\Administrator\\\\AppData\\\\Local\\\\Pub\\\\Cache\\\\hosted\\\\pub.dev\\\\path_provider_linux-2.2.1\\\\","native_build":false,"dependencies":[]}],"windows":[{"name":"path_provider_windows","path":"C:\\\\Users\\\\Administrator\\\\AppData\\\\Local\\\\Pub\\\\Cache\\\\hosted\\\\pub.dev\\\\path_provider_windows-2.3.0\\\\","native_build":false,"dependencies":[]}],"web":[]},"dependencyGraph":[{"name":"path_provider","dependencies":["path_provider_android","path_provider_foundation","path_provider_linux","path_provider_windows"]},{"name":"path_provider_android","dependencies":[]},{"name":"path_provider_foundation","dependencies":[]},{"name":"path_provider_linux","dependencies":[]},{"name":"path_provider_windows","dependencies":[]}],"date_created":"2024-08-21 11:28:19.723327","version":"3.24.0","swift_package_manager_enabled":false}
|
@ -1,6 +1,10 @@
|
|||||||
import 'package:cpnav/pages/pass_track/view.dart';
|
import 'package:cpnav/pages/pass_track/view.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter/widgets.dart';
|
import 'package:flutter/widgets.dart';
|
||||||
|
import 'package:get/get.dart';
|
||||||
|
import 'package:scence_map/controller.dart';
|
||||||
|
|
||||||
|
ScenceMapController mapController = Get.put(ScenceMapController());
|
||||||
|
|
||||||
class IconContainer extends StatefulWidget {
|
class IconContainer extends StatefulWidget {
|
||||||
@override
|
@override
|
||||||
@ -10,22 +14,35 @@ class IconContainer extends StatefulWidget {
|
|||||||
class _IconContainerState extends State<IconContainer> {
|
class _IconContainerState extends State<IconContainer> {
|
||||||
final Map<IconData, Color> _iconColors = {
|
final Map<IconData, Color> _iconColors = {
|
||||||
Icons.article: Colors.green,
|
Icons.article: Colors.green,
|
||||||
Icons.speed: Colors.green,
|
Icons.speed: const Color.fromARGB(255, 166, 182, 149),
|
||||||
Icons.thermostat: Colors.green,
|
Icons.thermostat: const Color.fromARGB(255, 166, 182, 149),
|
||||||
Icons.zoom_in: Colors.green,
|
Icons.zoom_in: const Color.fromARGB(255, 166, 182, 149),
|
||||||
Icons.zoom_out: Colors.green,
|
Icons.zoom_out: const Color.fromARGB(255, 166, 182, 149),
|
||||||
Icons.refresh: Colors.green,
|
Icons.refresh: const Color.fromARGB(255, 166, 182, 149),
|
||||||
Icons.place: Colors.green,
|
Icons.place: const Color.fromARGB(255, 166, 182, 149),
|
||||||
};
|
};
|
||||||
|
IconData? _selectedIcon;
|
||||||
|
|
||||||
void _handleTap(IconData icon, VoidCallback onTap) {
|
void _handleTap1(IconData icon, VoidCallback onTap) {
|
||||||
setState(() {
|
setState(() {
|
||||||
_iconColors[icon] = const Color.fromARGB(255, 166, 182, 149); // 点击后变浅的颜色
|
_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();
|
onTap();
|
||||||
Future.delayed(Duration(milliseconds: 200), () {
|
Future.delayed(Duration(milliseconds: 200), () {
|
||||||
setState(() {
|
setState(() {
|
||||||
_iconColors[icon] = Colors.green; // 恢复原色
|
_iconColors[icon] = const Color.fromARGB(255, 166, 182, 149); // 恢复原色
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@ -41,7 +58,7 @@ class _IconContainerState extends State<IconContainer> {
|
|||||||
mainAxisSize: MainAxisSize.min,
|
mainAxisSize: MainAxisSize.min,
|
||||||
children: [
|
children: [
|
||||||
Container(
|
Container(
|
||||||
width: 36,
|
width: 42,
|
||||||
decoration: BoxDecoration(
|
decoration: BoxDecoration(
|
||||||
color: Colors.transparent,
|
color: Colors.transparent,
|
||||||
border: Border.all(
|
border: Border.all(
|
||||||
@ -52,27 +69,53 @@ class _IconContainerState extends State<IconContainer> {
|
|||||||
),
|
),
|
||||||
child: Column(
|
child: Column(
|
||||||
children: [
|
children: [
|
||||||
_buildIcon(Icons.article, () {
|
_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.scale = 1.0;
|
||||||
mapcontroller.rotation.value = 0.0;
|
mapcontroller.rotation.value = 0.0;
|
||||||
mapcontroller.updateCount.value++;
|
mapcontroller.updateCount.value++;
|
||||||
}),
|
}),
|
||||||
_buildIcon(Icons.speed, () {
|
_automChange(Icons.place, () {
|
||||||
// 处理 speed 图标的点击事件
|
|
||||||
}),
|
|
||||||
_buildIcon(Icons.thermostat, () {
|
|
||||||
// 处理 thermostat 图标的点击事件
|
|
||||||
}),
|
|
||||||
_buildIcon(Icons.zoom_in, () {
|
|
||||||
// 处理 zoom_in 图标的点击事件
|
|
||||||
}),
|
|
||||||
_buildIcon(Icons.zoom_out, () {
|
|
||||||
// 处理 zoom_out 图标的点击事件
|
|
||||||
}),
|
|
||||||
_buildIcon(Icons.refresh, () {
|
|
||||||
// 处理 refresh 图标的点击事件
|
|
||||||
}),
|
|
||||||
_buildIcon(Icons.place, () {
|
|
||||||
// 处理 place 图标的点击事件
|
// 处理 place 图标的点击事件
|
||||||
}),
|
}),
|
||||||
],
|
],
|
||||||
@ -87,7 +130,7 @@ class _IconContainerState extends State<IconContainer> {
|
|||||||
mainAxisSize: MainAxisSize.min,
|
mainAxisSize: MainAxisSize.min,
|
||||||
children: [
|
children: [
|
||||||
Container(
|
Container(
|
||||||
height: 36,
|
height: 42,
|
||||||
decoration: BoxDecoration(
|
decoration: BoxDecoration(
|
||||||
color: Colors.transparent,
|
color: Colors.transparent,
|
||||||
border: Border.all(
|
border: Border.all(
|
||||||
@ -98,27 +141,57 @@ class _IconContainerState extends State<IconContainer> {
|
|||||||
),
|
),
|
||||||
child: Row(
|
child: Row(
|
||||||
children: [
|
children: [
|
||||||
_buildIcon(Icons.article, () {
|
_singleChange(Icons.article, () {
|
||||||
mapcontroller.scale = 1.0;
|
mapcontroller.scale = 1.0;
|
||||||
mapcontroller.rotation.value = 0.0;
|
mapcontroller.rotation.value = 0.0;
|
||||||
mapcontroller.updateCount.value++;
|
mapcontroller.updateCount.value++;
|
||||||
}),
|
}),
|
||||||
_buildIcon(Icons.speed, () {
|
_singleChange(Icons.speed, () {
|
||||||
// 处理 speed 图标的点击事件
|
// 处理 speed 图标的点击事件
|
||||||
}),
|
}),
|
||||||
_buildIcon(Icons.thermostat, () {
|
_singleChange(Icons.thermostat, () {
|
||||||
// 处理 thermostat 图标的点击事件
|
// 处理 thermostat 图标的点击事件
|
||||||
}),
|
}),
|
||||||
_buildIcon(Icons.zoom_in, () {
|
_automChange(Icons.zoom_in, () {
|
||||||
// 处理 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++;
|
||||||
}),
|
}),
|
||||||
_buildIcon(Icons.zoom_out, () {
|
_automChange(Icons.zoom_out, () {
|
||||||
// 处理 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++;
|
||||||
}),
|
}),
|
||||||
_buildIcon(Icons.refresh, () {
|
_automChange(Icons.refresh, () {
|
||||||
// 处理 refresh 图标的点击事件
|
mapcontroller.scale = 1.0;
|
||||||
|
mapcontroller.rotation.value = 0.0;
|
||||||
|
mapcontroller.updateCount.value++;
|
||||||
}),
|
}),
|
||||||
_buildIcon(Icons.place, () {
|
_automChange(Icons.place, () {
|
||||||
// 处理 place 图标的点击事件
|
// 处理 place 图标的点击事件
|
||||||
}),
|
}),
|
||||||
],
|
],
|
||||||
@ -128,10 +201,11 @@ class _IconContainerState extends State<IconContainer> {
|
|||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
Widget _buildIcon(IconData icon, VoidCallback onTap) {
|
//前三个单选
|
||||||
|
Widget _singleChange(IconData icon, VoidCallback onTap) {
|
||||||
return Container(
|
return Container(
|
||||||
width: 30,
|
width: 33,
|
||||||
height: 30,
|
height: 33,
|
||||||
margin: EdgeInsets.symmetric(vertical: 2.0),
|
margin: EdgeInsets.symmetric(vertical: 2.0),
|
||||||
decoration: BoxDecoration(
|
decoration: BoxDecoration(
|
||||||
color: _iconColors[icon],
|
color: _iconColors[icon],
|
||||||
@ -145,9 +219,31 @@ class _IconContainerState extends State<IconContainer> {
|
|||||||
icon,
|
icon,
|
||||||
color: Colors.white,
|
color: Colors.white,
|
||||||
),
|
),
|
||||||
onTap: () => _handleTap(icon, onTap),
|
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),
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -7,7 +7,7 @@ import 'package:flutter/widgets.dart';
|
|||||||
import 'package:get/get.dart';
|
import 'package:get/get.dart';
|
||||||
import 'package:scence_map/controller.dart';
|
import 'package:scence_map/controller.dart';
|
||||||
import 'package:scence_map/scence_map.dart';
|
import 'package:scence_map/scence_map.dart';
|
||||||
import 'package:bottom_picker/bottom_picker.dart';
|
|
||||||
import 'package:syncfusion_flutter_sliders/sliders.dart';
|
import 'package:syncfusion_flutter_sliders/sliders.dart';
|
||||||
import 'iconContainer.dart';
|
import 'iconContainer.dart';
|
||||||
import "controller.dart";
|
import "controller.dart";
|
||||||
@ -33,6 +33,8 @@ class PassTrack extends StatefulWidget {
|
|||||||
}
|
}
|
||||||
|
|
||||||
class _PasstrackState extends State<PassTrack> {
|
class _PasstrackState extends State<PassTrack> {
|
||||||
|
final GlobalKey<PopupMenuButtonState<int>> _popupMenuKey =
|
||||||
|
GlobalKey<PopupMenuButtonState<int>>();
|
||||||
final controller = Get.put(PassTrackController("WXLMB", "cp_orad"));
|
final controller = Get.put(PassTrackController("WXLMB", "cp_orad"));
|
||||||
String str = "播放";
|
String str = "播放";
|
||||||
int sWidth = 0;
|
int sWidth = 0;
|
||||||
@ -109,7 +111,7 @@ class _PasstrackState extends State<PassTrack> {
|
|||||||
},
|
},
|
||||||
),
|
),
|
||||||
Positioned(
|
Positioned(
|
||||||
width: isPortrait ? size.width * .63 : size.width * .42,
|
width: isPortrait ? size.width * .63 : size.width * .41,
|
||||||
left: isPortrait ? 190 : 200,
|
left: isPortrait ? 190 : 200,
|
||||||
bottom: 30,
|
bottom: 30,
|
||||||
child: Container(
|
child: Container(
|
||||||
@ -158,45 +160,59 @@ class _PasstrackState extends State<PassTrack> {
|
|||||||
),
|
),
|
||||||
),
|
),
|
||||||
const SizedBox(width: 5),
|
const SizedBox(width: 5),
|
||||||
Container(
|
GestureDetector(
|
||||||
width: 82,
|
onTap: () {
|
||||||
height: 35,
|
// 触发 PopupMenuButton 的点击事件
|
||||||
padding: const EdgeInsets.symmetric(horizontal: 1.0),
|
final dynamic state = _popupMenuKey.currentState;
|
||||||
decoration: BoxDecoration(
|
state.showButtonMenu();
|
||||||
color: const Color.fromARGB(255, 255, 255, 255),
|
},
|
||||||
border: Border.all(color: Colors.black),
|
child: Container(
|
||||||
),
|
width: 70,
|
||||||
child: Row(
|
height: 35,
|
||||||
mainAxisSize: MainAxisSize.min,
|
padding: const EdgeInsets.symmetric(horizontal: 6.0),
|
||||||
children: [
|
decoration: BoxDecoration(
|
||||||
Center(
|
color: const Color.fromARGB(255, 255, 255, 255),
|
||||||
child: Text(
|
border: Border.all(color: Colors.black),
|
||||||
"$speed X",
|
|
||||||
style: const TextStyle(
|
|
||||||
fontSize: 11, color: Colors.black),
|
|
||||||
),
|
|
||||||
),
|
),
|
||||||
PopupMenuButton<int>(
|
child: Row(
|
||||||
padding: const EdgeInsets.all(1.0),
|
mainAxisSize: MainAxisSize.min,
|
||||||
icon: const Icon(Icons.arrow_drop_up,
|
children: [
|
||||||
color: Color.fromARGB(255, 47, 48, 47)),
|
Text(
|
||||||
onSelected: (int value) {
|
"$speed X",
|
||||||
setState(() {
|
style: const TextStyle(
|
||||||
speed = value;
|
fontSize: 11, color: Colors.black),
|
||||||
});
|
),
|
||||||
},
|
Container(
|
||||||
itemBuilder: (BuildContext context) {
|
width: 25,
|
||||||
return speedList.map((int speed) {
|
child: PopupMenuButton<int>(
|
||||||
return PopupMenuItem<int>(
|
key: _popupMenuKey,
|
||||||
height: 30,
|
padding: const EdgeInsets.all(1.0),
|
||||||
value: speed,
|
icon: const Icon(Icons.arrow_drop_up,
|
||||||
child: Text("$speed X速度"),
|
color: Color.fromARGB(255, 47, 48, 47)),
|
||||||
);
|
onSelected: (int value) {
|
||||||
}).toList();
|
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),
|
const SizedBox(width: 12),
|
||||||
Column(
|
Column(
|
||||||
|
Loading…
Reference in New Issue
Block a user