底部部件
This commit is contained in:
parent
de783fa083
commit
b0769fe37d
@ -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-19 18:27:32.051943","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-20 16:40:54.130946","version":"3.24.0","swift_package_manager_enabled":false}
|
@ -1,437 +0,0 @@
|
||||
import 'package:cpnav/pages/pass_track/view.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/widgets.dart';
|
||||
|
||||
class BottomMenu extends StatefulWidget {
|
||||
@override
|
||||
_BottomMenuState createState() => _BottomMenuState();
|
||||
}
|
||||
|
||||
class _BottomMenuState extends State<BottomMenu> {
|
||||
int _selectedIndex = -1;
|
||||
void _temporarilySelectContainer(int index) {
|
||||
setState(() {
|
||||
_selectedIndex = index;
|
||||
});
|
||||
Future.delayed(Duration(milliseconds: 200), () {
|
||||
setState(() {
|
||||
_selectedIndex = -1;
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
@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: 36,
|
||||
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: [
|
||||
Container(
|
||||
width: 30,
|
||||
height: 30,
|
||||
decoration: BoxDecoration(
|
||||
color: Colors.green, // 设置背景颜色为绿色
|
||||
border: Border.all(
|
||||
color: Colors.white, // 设置边框颜色为白色
|
||||
),
|
||||
borderRadius: BorderRadius.circular(5.0), // 可选:设置圆角边框
|
||||
),
|
||||
child: InkWell(
|
||||
child: const Icon(
|
||||
Icons.article,
|
||||
color: Colors.white,
|
||||
),
|
||||
onTap: () {
|
||||
mapcontroller.scale = 1.0;
|
||||
mapcontroller.rotation.value = 0.0;
|
||||
mapcontroller.updateCount.value++;
|
||||
// onUpdate?.call(
|
||||
// mapcontroller.centerXY, 1.0, 0.0);
|
||||
// sight.reset();
|
||||
},
|
||||
),
|
||||
),
|
||||
Container(
|
||||
width: 30,
|
||||
height: 30,
|
||||
decoration: BoxDecoration(
|
||||
color: Colors.green, // 设置背景颜色为绿色
|
||||
border: Border.all(
|
||||
color: Colors.white, // 设置边框颜色为白色
|
||||
),
|
||||
borderRadius: BorderRadius.circular(5.0), // 可选:设置圆角边框
|
||||
),
|
||||
child: InkWell(
|
||||
child: const Icon(
|
||||
Icons.speed,
|
||||
color: Colors.white,
|
||||
),
|
||||
onTap: () {
|
||||
mapcontroller.scale = 1.0;
|
||||
mapcontroller.rotation.value = 0.0;
|
||||
mapcontroller.updateCount.value++;
|
||||
// onUpdate?.call(
|
||||
// mapcontroller.centerXY, 1.0, 0.0);
|
||||
// sight.reset();
|
||||
},
|
||||
),
|
||||
),
|
||||
Container(
|
||||
width: 30,
|
||||
height: 30,
|
||||
decoration: BoxDecoration(
|
||||
color: Colors.green, // 设置背景颜色为绿色
|
||||
border: Border.all(
|
||||
color: Colors.white, // 设置边框颜色为白色
|
||||
),
|
||||
borderRadius: BorderRadius.circular(5.0), // 可选:设置圆角边框
|
||||
),
|
||||
child: InkWell(
|
||||
child: const Icon(
|
||||
Icons.thermostat,
|
||||
color: Colors.white,
|
||||
),
|
||||
onTap: () {
|
||||
mapcontroller.scale = 1.0;
|
||||
mapcontroller.rotation.value = 0.0;
|
||||
mapcontroller.updateCount.value++;
|
||||
// onUpdate?.call(
|
||||
// mapcontroller.centerXY, 1.0, 0.0);
|
||||
// sight.reset();
|
||||
},
|
||||
),
|
||||
),
|
||||
Container(
|
||||
width: 30,
|
||||
height: 30,
|
||||
decoration: BoxDecoration(
|
||||
color: Colors.green, // 设置背景颜色为绿色
|
||||
border: Border.all(
|
||||
color: Colors.white, // 设置边框颜色为白色
|
||||
width: 2.0, // 设置边框宽度
|
||||
),
|
||||
borderRadius: BorderRadius.circular(5.0), // 可选:设置圆角边框
|
||||
),
|
||||
child: InkWell(
|
||||
child: const Icon(
|
||||
Icons.zoom_in,
|
||||
color: Colors.white,
|
||||
),
|
||||
onTap: () {
|
||||
mapcontroller.scale = 1.0;
|
||||
mapcontroller.rotation.value = 0.0;
|
||||
mapcontroller.updateCount.value++;
|
||||
// onUpdate?.call(
|
||||
// mapcontroller.centerXY, 1.0, 0.0);
|
||||
// sight.reset();
|
||||
},
|
||||
),
|
||||
),
|
||||
Container(
|
||||
width: 30,
|
||||
height: 30,
|
||||
decoration: BoxDecoration(
|
||||
color: Colors.green, // 设置背景颜色为绿色
|
||||
border: Border.all(
|
||||
color: Colors.white, // 设置边框颜色为白色
|
||||
width: 2.0, // 设置边框宽度
|
||||
),
|
||||
borderRadius: BorderRadius.circular(5.0), // 可选:设置圆角边框
|
||||
),
|
||||
child: InkWell(
|
||||
child: const Icon(
|
||||
Icons.zoom_out,
|
||||
color: Colors.white,
|
||||
),
|
||||
onTap: () {
|
||||
mapcontroller.scale = 1.0;
|
||||
mapcontroller.rotation.value = 0.0;
|
||||
mapcontroller.updateCount.value++;
|
||||
// onUpdate?.call(
|
||||
// mapcontroller.centerXY, 1.0, 0.0);
|
||||
// sight.reset();
|
||||
},
|
||||
),
|
||||
),
|
||||
Container(
|
||||
width: 30,
|
||||
height: 30,
|
||||
decoration: BoxDecoration(
|
||||
color: Colors.green, // 设置背景颜色为绿色
|
||||
border: Border.all(
|
||||
color: Colors.white, // 设置边框颜色为白色
|
||||
),
|
||||
borderRadius: BorderRadius.circular(5.0), // 可选:设置圆角边框
|
||||
),
|
||||
child: InkWell(
|
||||
child: const Icon(
|
||||
Icons.refresh,
|
||||
color: Colors.white,
|
||||
),
|
||||
onTap: () {
|
||||
mapcontroller.scale = 1.0;
|
||||
mapcontroller.rotation.value = 0.0;
|
||||
mapcontroller.updateCount.value++;
|
||||
// onUpdate?.call(
|
||||
// mapcontroller.centerXY, 1.0, 0.0);
|
||||
// sight.reset();
|
||||
},
|
||||
),
|
||||
),
|
||||
Container(
|
||||
width: 30,
|
||||
height: 30,
|
||||
decoration: BoxDecoration(
|
||||
color: Colors.green, // 设置背景颜色为绿色
|
||||
border: Border.all(
|
||||
color: Colors.white, // 设置边框颜色为白色
|
||||
),
|
||||
borderRadius: BorderRadius.circular(5.0), // 可选:设置圆角边框
|
||||
),
|
||||
child: InkWell(
|
||||
child: const Icon(
|
||||
Icons.place,
|
||||
color: Colors.white,
|
||||
),
|
||||
onTap: () {
|
||||
mapcontroller.scale = 1.0;
|
||||
mapcontroller.rotation.value = 0.0;
|
||||
mapcontroller.updateCount.value++;
|
||||
// onUpdate?.call(
|
||||
// mapcontroller.centerXY, 1.0, 0.0);
|
||||
// sight.reset();
|
||||
},
|
||||
),
|
||||
),
|
||||
]),
|
||||
),
|
||||
],
|
||||
))
|
||||
: Positioned(
|
||||
right: 10,
|
||||
bottom: 15,
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
Container(
|
||||
height: 36,
|
||||
decoration: BoxDecoration(
|
||||
color: Colors.transparent, // 设置背景为透明
|
||||
border: Border.all(
|
||||
color: Color.fromARGB(255, 54, 52, 52),
|
||||
width: 1.0, // 设置边框宽度
|
||||
),
|
||||
borderRadius: BorderRadius.circular(5.0), // 可选:设置圆角边框
|
||||
),
|
||||
child: Center(
|
||||
// 使用 Center 小部件将子容器居中
|
||||
child: Row(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
Container(
|
||||
width: 30,
|
||||
height: 30,
|
||||
decoration: BoxDecoration(
|
||||
color: Colors.green, // 设置背景颜色为绿色
|
||||
border: Border.all(
|
||||
color: Colors.white, // 设置边框颜色为白色
|
||||
),
|
||||
borderRadius:
|
||||
BorderRadius.circular(5.0), // 可选:设置圆角边框
|
||||
),
|
||||
child: InkWell(
|
||||
child: const Icon(
|
||||
Icons.article,
|
||||
color: Colors.white,
|
||||
),
|
||||
onTap: () {
|
||||
mapcontroller.scale = 1.0;
|
||||
mapcontroller.rotation.value = 0.0;
|
||||
mapcontroller.updateCount.value++;
|
||||
// onUpdate?.call(
|
||||
// mapcontroller.centerXY, 1.0, 0.0);
|
||||
// sight.reset();
|
||||
},
|
||||
),
|
||||
),
|
||||
Container(
|
||||
width: 30,
|
||||
height: 30,
|
||||
decoration: BoxDecoration(
|
||||
color: Colors.green, // 设置背景颜色为绿色
|
||||
border: Border.all(
|
||||
color: Colors.white, // 设置边框颜色为白色
|
||||
),
|
||||
borderRadius:
|
||||
BorderRadius.circular(5.0), // 可选:设置圆角边框
|
||||
),
|
||||
child: InkWell(
|
||||
child: const Icon(
|
||||
Icons.speed,
|
||||
color: Colors.white,
|
||||
),
|
||||
onTap: () {
|
||||
mapcontroller.scale = 1.0;
|
||||
mapcontroller.rotation.value = 0.0;
|
||||
mapcontroller.updateCount.value++;
|
||||
// onUpdate?.call(
|
||||
// mapcontroller.centerXY, 1.0, 0.0);
|
||||
// sight.reset();
|
||||
},
|
||||
),
|
||||
),
|
||||
Container(
|
||||
width: 30,
|
||||
height: 30,
|
||||
decoration: BoxDecoration(
|
||||
color: Colors.green, // 设置背景颜色为绿色
|
||||
border: Border.all(
|
||||
color: Colors.white, // 设置边框颜色为白色
|
||||
),
|
||||
borderRadius:
|
||||
BorderRadius.circular(5.0), // 可选:设置圆角边框
|
||||
),
|
||||
child: InkWell(
|
||||
child: const Icon(
|
||||
Icons.thermostat,
|
||||
color: Colors.white,
|
||||
),
|
||||
onTap: () {
|
||||
mapcontroller.scale = 1.0;
|
||||
mapcontroller.rotation.value = 0.0;
|
||||
mapcontroller.updateCount.value++;
|
||||
// onUpdate?.call(
|
||||
// mapcontroller.centerXY, 1.0, 0.0);
|
||||
// sight.reset();
|
||||
},
|
||||
),
|
||||
),
|
||||
Container(
|
||||
width: 30,
|
||||
height: 30,
|
||||
decoration: BoxDecoration(
|
||||
color: Colors.green, // 设置背景颜色为绿色
|
||||
border: Border.all(
|
||||
color: Colors.white, // 设置边框颜色为白色
|
||||
width: 2.0, // 设置边框宽度
|
||||
),
|
||||
borderRadius:
|
||||
BorderRadius.circular(5.0), // 可选:设置圆角边框
|
||||
),
|
||||
child: InkWell(
|
||||
child: const Icon(
|
||||
Icons.zoom_in,
|
||||
color: Colors.white,
|
||||
),
|
||||
onTap: () {
|
||||
mapcontroller.scale = 1.0;
|
||||
mapcontroller.rotation.value = 0.0;
|
||||
mapcontroller.updateCount.value++;
|
||||
// onUpdate?.call(
|
||||
// mapcontroller.centerXY, 1.0, 0.0);
|
||||
// sight.reset();
|
||||
},
|
||||
),
|
||||
),
|
||||
Container(
|
||||
width: 30,
|
||||
height: 30,
|
||||
decoration: BoxDecoration(
|
||||
color: Colors.green, // 设置背景颜色为绿色
|
||||
border: Border.all(
|
||||
color: Colors.white, // 设置边框颜色为白色
|
||||
width: 2.0, // 设置边框宽度
|
||||
),
|
||||
borderRadius:
|
||||
BorderRadius.circular(5.0), // 可选:设置圆角边框
|
||||
),
|
||||
child: InkWell(
|
||||
child: const Icon(
|
||||
Icons.zoom_out,
|
||||
color: Colors.white,
|
||||
),
|
||||
onTap: () {
|
||||
mapcontroller.scale = 1.0;
|
||||
mapcontroller.rotation.value = 0.0;
|
||||
mapcontroller.updateCount.value++;
|
||||
// onUpdate?.call(
|
||||
// mapcontroller.centerXY, 1.0, 0.0);
|
||||
// sight.reset();
|
||||
},
|
||||
),
|
||||
),
|
||||
Container(
|
||||
width: 30,
|
||||
height: 30,
|
||||
decoration: BoxDecoration(
|
||||
color: Colors.green, // 设置背景颜色为绿色
|
||||
border: Border.all(
|
||||
color: Colors.white, // 设置边框颜色为白色
|
||||
),
|
||||
borderRadius:
|
||||
BorderRadius.circular(5.0), // 可选:设置圆角边框
|
||||
),
|
||||
child: InkWell(
|
||||
child: const Icon(
|
||||
Icons.refresh,
|
||||
color: Colors.white,
|
||||
),
|
||||
onTap: () {
|
||||
mapcontroller.scale = 1.0;
|
||||
mapcontroller.rotation.value = 0.0;
|
||||
mapcontroller.updateCount.value++;
|
||||
// onUpdate?.call(
|
||||
// mapcontroller.centerXY, 1.0, 0.0);
|
||||
// sight.reset();
|
||||
},
|
||||
),
|
||||
),
|
||||
Container(
|
||||
width: 30,
|
||||
height: 30,
|
||||
decoration: BoxDecoration(
|
||||
color: Colors.green, // 设置背景颜色为绿色
|
||||
border: Border.all(
|
||||
color: Colors.white, // 设置边框颜色为白色
|
||||
),
|
||||
borderRadius:
|
||||
BorderRadius.circular(5.0), // 可选:设置圆角边框
|
||||
),
|
||||
child: InkWell(
|
||||
child: const Icon(
|
||||
Icons.place,
|
||||
color: Colors.white,
|
||||
),
|
||||
onTap: () {
|
||||
mapcontroller.scale = 1.0;
|
||||
mapcontroller.rotation.value = 0.0;
|
||||
mapcontroller.updateCount.value++;
|
||||
// onUpdate?.call(
|
||||
// mapcontroller.centerXY, 1.0, 0.0);
|
||||
// sight.reset();
|
||||
},
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
));
|
||||
}
|
||||
}
|
153
lib/pages/pass_track/iconContainer.dart
Normal file
153
lib/pages/pass_track/iconContainer.dart
Normal file
@ -0,0 +1,153 @@
|
||||
import 'package:cpnav/pages/pass_track/view.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/widgets.dart';
|
||||
|
||||
class IconContainer extends StatefulWidget {
|
||||
@override
|
||||
_IconContainerState createState() => _IconContainerState();
|
||||
}
|
||||
|
||||
class _IconContainerState extends State<IconContainer> {
|
||||
final Map<IconData, Color> _iconColors = {
|
||||
Icons.article: Colors.green,
|
||||
Icons.speed: Colors.green,
|
||||
Icons.thermostat: Colors.green,
|
||||
Icons.zoom_in: Colors.green,
|
||||
Icons.zoom_out: Colors.green,
|
||||
Icons.refresh: Colors.green,
|
||||
Icons.place: Colors.green,
|
||||
};
|
||||
|
||||
void _handleTap(IconData icon, VoidCallback onTap) {
|
||||
setState(() {
|
||||
_iconColors[icon] = const Color.fromARGB(255, 166, 182, 149); // 点击后变浅的颜色
|
||||
});
|
||||
onTap();
|
||||
Future.delayed(Duration(milliseconds: 200), () {
|
||||
setState(() {
|
||||
_iconColors[icon] = Colors.green; // 恢复原色
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
@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: 36,
|
||||
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: [
|
||||
_buildIcon(Icons.article, () {
|
||||
mapcontroller.scale = 1.0;
|
||||
mapcontroller.rotation.value = 0.0;
|
||||
mapcontroller.updateCount.value++;
|
||||
}),
|
||||
_buildIcon(Icons.speed, () {
|
||||
// 处理 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 图标的点击事件
|
||||
}),
|
||||
],
|
||||
),
|
||||
)
|
||||
],
|
||||
))
|
||||
: Positioned(
|
||||
right: 10,
|
||||
bottom: 15,
|
||||
child: Row(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
Container(
|
||||
height: 36,
|
||||
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: [
|
||||
_buildIcon(Icons.article, () {
|
||||
mapcontroller.scale = 1.0;
|
||||
mapcontroller.rotation.value = 0.0;
|
||||
mapcontroller.updateCount.value++;
|
||||
}),
|
||||
_buildIcon(Icons.speed, () {
|
||||
// 处理 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 图标的点击事件
|
||||
}),
|
||||
],
|
||||
),
|
||||
)
|
||||
],
|
||||
));
|
||||
}
|
||||
|
||||
Widget _buildIcon(IconData icon, VoidCallback onTap) {
|
||||
return Container(
|
||||
width: 30,
|
||||
height: 30,
|
||||
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: () => _handleTap(icon, onTap),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
@ -9,7 +9,7 @@ import 'package:scence_map/controller.dart';
|
||||
import 'package:scence_map/scence_map.dart';
|
||||
import 'package:bottom_picker/bottom_picker.dart';
|
||||
import 'package:syncfusion_flutter_sliders/sliders.dart';
|
||||
import 'bottomMenu.dart';
|
||||
import 'iconContainer.dart';
|
||||
import "controller.dart";
|
||||
// import '../login_in/connect/bluetooth_page.dart';
|
||||
// import '../login_in/connect/config.dart';
|
||||
@ -32,8 +32,6 @@ class PassTrack extends StatefulWidget {
|
||||
State<PassTrack> createState() => _PasstrackState();
|
||||
}
|
||||
|
||||
// FileHandle fileHandle = FileHandle();
|
||||
|
||||
class _PasstrackState extends State<PassTrack> {
|
||||
final controller = Get.put(PassTrackController("WXLMB", "cp_orad"));
|
||||
String str = "播放";
|
||||
@ -42,9 +40,8 @@ class _PasstrackState extends State<PassTrack> {
|
||||
int speed = 50;
|
||||
List<int> speedList = [1, 2, 10, 20, 50, 100, 200, 500];
|
||||
int maxLength = 200;
|
||||
// int _value = 0;
|
||||
SfRangeValues _rangevalues = const SfRangeValues(0.0, 200.0);
|
||||
// late final ScenceMapScaleMoveCallback? onUpdate;
|
||||
|
||||
@override
|
||||
initState() {
|
||||
super.initState();
|
||||
@ -102,6 +99,7 @@ class _PasstrackState extends State<PassTrack> {
|
||||
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: [
|
||||
ScenceMapView(
|
||||
@ -115,13 +113,11 @@ class _PasstrackState extends State<PassTrack> {
|
||||
left: isPortrait ? 190 : 200,
|
||||
bottom: 30,
|
||||
child: Container(
|
||||
padding: EdgeInsets.only(bottom: 5),
|
||||
padding: const EdgeInsets.only(bottom: 5),
|
||||
child: SfRangeSlider(
|
||||
// 双向
|
||||
min: 0.0,
|
||||
max: maxLength,
|
||||
values: _rangevalues,
|
||||
// interval: 5,
|
||||
showTicks: false,
|
||||
showLabels: false,
|
||||
enableTooltip: true,
|
||||
@ -129,8 +125,8 @@ class _PasstrackState extends State<PassTrack> {
|
||||
stepSize: 1,
|
||||
onChanged: (SfRangeValues values) {
|
||||
setState(() {
|
||||
_rangevalues = SfRangeValues(
|
||||
values.start.roundToDouble(), values.end.roundToDouble());
|
||||
_rangevalues = SfRangeValues(values.start.roundToDouble(),
|
||||
values.end.roundToDouble());
|
||||
});
|
||||
},
|
||||
),
|
||||
@ -141,11 +137,9 @@ class _PasstrackState extends State<PassTrack> {
|
||||
bottom: 0,
|
||||
child: Row(
|
||||
children: [
|
||||
const SizedBox(
|
||||
width: 18,
|
||||
),
|
||||
const SizedBox(width: 18),
|
||||
SizedBox(
|
||||
width: 74, // 设置按钮的宽度
|
||||
width: 74,
|
||||
child: ElevatedButton(
|
||||
style: ButtonStyle(
|
||||
backgroundColor: MaterialStateProperty.all<Color?>(
|
||||
@ -154,40 +148,63 @@ class _PasstrackState extends State<PassTrack> {
|
||||
),
|
||||
onPressed: () {
|
||||
setState(() {
|
||||
if (str == "播放") {
|
||||
str = "暂停";
|
||||
} else {
|
||||
str = "播放";
|
||||
}
|
||||
str = str == "播放" ? "暂停" : "播放";
|
||||
});
|
||||
},
|
||||
child: Text(
|
||||
str,
|
||||
style: TextStyle(fontSize: 12, color: Colors.black),
|
||||
)),
|
||||
),
|
||||
const SizedBox(
|
||||
width: 5,
|
||||
),
|
||||
ElevatedButton(
|
||||
style: ButtonStyle(
|
||||
backgroundColor: MaterialStateProperty.all<Color?>(
|
||||
Colors.transparent,
|
||||
style: const TextStyle(fontSize: 12, color: Colors.black),
|
||||
),
|
||||
),
|
||||
onPressed: () {
|
||||
_openSpeedPicker(context, speedList);
|
||||
),
|
||||
const SizedBox(width: 5),
|
||||
Container(
|
||||
width: 82,
|
||||
height: 35,
|
||||
padding: const EdgeInsets.symmetric(horizontal: 1.0),
|
||||
decoration: BoxDecoration(
|
||||
color: const Color.fromARGB(255, 255, 255, 255),
|
||||
border: Border.all(color: Colors.black),
|
||||
),
|
||||
child: Row(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
Center(
|
||||
child: Text(
|
||||
"$speed X",
|
||||
style: const TextStyle(
|
||||
fontSize: 11, color: Colors.black),
|
||||
),
|
||||
),
|
||||
PopupMenuButton<int>(
|
||||
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;
|
||||
});
|
||||
},
|
||||
itemBuilder: (BuildContext context) {
|
||||
return speedList.map((int speed) {
|
||||
return PopupMenuItem<int>(
|
||||
height: 30,
|
||||
value: speed,
|
||||
child: Text("$speed X速度"),
|
||||
);
|
||||
}).toList();
|
||||
},
|
||||
child: Text(speed.toString()),
|
||||
),
|
||||
const SizedBox(
|
||||
width: 15,
|
||||
],
|
||||
),
|
||||
Column(children: [
|
||||
Text("此处遍数:0"),
|
||||
),
|
||||
const SizedBox(width: 12),
|
||||
Column(
|
||||
children: [
|
||||
const Text("此处遍数:0"),
|
||||
StreamBuilder<DateTime>(
|
||||
stream: Stream.periodic(
|
||||
Duration(seconds: 1), (_) => DateTime.now()),
|
||||
const Duration(seconds: 1), (_) => DateTime.now()),
|
||||
builder: (context, snapshot) {
|
||||
if (snapshot.hasData) {
|
||||
final dateTime = snapshot.data!.toLocal();
|
||||
@ -211,50 +228,14 @@ class _PasstrackState extends State<PassTrack> {
|
||||
}
|
||||
},
|
||||
),
|
||||
])
|
||||
],
|
||||
)
|
||||
],
|
||||
),
|
||||
),
|
||||
BottomMenu(),
|
||||
IconContainer()
|
||||
],
|
||||
);
|
||||
}
|
||||
|
||||
void _openSpeedPicker(BuildContext context, List<int> items) {
|
||||
List<Text> list = items.map((speed) => Text("$speed 速度")).toList();
|
||||
showModalBottomSheet(
|
||||
context: context,
|
||||
builder: (BuildContext context) {
|
||||
return Container(
|
||||
width: MediaQuery.of(context).size.width * 0.5, // 设置宽度为屏幕宽度的 80%
|
||||
child: BottomPicker(
|
||||
items: list,
|
||||
pickerTitle: Text('选择播放速度'),
|
||||
titleAlignment: Alignment.center,
|
||||
titlePadding: const EdgeInsets.all(8.0),
|
||||
dismissable: true,
|
||||
onSubmit: (index) {
|
||||
setState(() {
|
||||
speed = items[index];
|
||||
});
|
||||
},
|
||||
bottomPickerTheme: BottomPickerTheme.morningSalad,
|
||||
backgroundColor: Colors.white,
|
||||
pickerTextStyle: const TextStyle(
|
||||
fontSize: 14,
|
||||
color: Colors.black,
|
||||
),
|
||||
itemExtent: 35.0,
|
||||
displayCloseIcon: true,
|
||||
closeIconColor: Colors.black,
|
||||
closeIconSize: 20,
|
||||
layoutOrientation: TextDirection.ltr,
|
||||
buttonAlignment: MainAxisAlignment.end,
|
||||
displaySubmitButton: true,
|
||||
buttonContent: Text("确认"),
|
||||
),
|
||||
);
|
||||
},
|
||||
);
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user