底部部件

This commit is contained in:
tanlinxing 2024-08-21 17:38:18 +08:00
parent b0769fe37d
commit 7d9626fafb
3 changed files with 196 additions and 84 deletions

View File

@ -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}

View File

@ -1,6 +1,10 @@
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/controller.dart';
ScenceMapController mapController = Get.put(ScenceMapController());
class IconContainer extends StatefulWidget {
@override
@ -10,22 +14,35 @@ class IconContainer extends StatefulWidget {
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,
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 _handleTap(IconData icon, VoidCallback onTap) {
void _handleTap1(IconData icon, VoidCallback onTap) {
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();
Future.delayed(Duration(milliseconds: 200), () {
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,
children: [
Container(
width: 36,
width: 42,
decoration: BoxDecoration(
color: Colors.transparent,
border: Border.all(
@ -52,27 +69,53 @@ class _IconContainerState extends State<IconContainer> {
),
child: Column(
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.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, () {
_automChange(Icons.place, () {
// place
}),
],
@ -87,7 +130,7 @@ class _IconContainerState extends State<IconContainer> {
mainAxisSize: MainAxisSize.min,
children: [
Container(
height: 36,
height: 42,
decoration: BoxDecoration(
color: Colors.transparent,
border: Border.all(
@ -98,27 +141,57 @@ class _IconContainerState extends State<IconContainer> {
),
child: Row(
children: [
_buildIcon(Icons.article, () {
_singleChange(Icons.article, () {
mapcontroller.scale = 1.0;
mapcontroller.rotation.value = 0.0;
mapcontroller.updateCount.value++;
}),
_buildIcon(Icons.speed, () {
_singleChange(Icons.speed, () {
// speed
}),
_buildIcon(Icons.thermostat, () {
_singleChange(Icons.thermostat, () {
// thermostat
}),
_buildIcon(Icons.zoom_in, () {
// zoom_in
_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++;
}),
_buildIcon(Icons.zoom_out, () {
// zoom_out
_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++;
}),
_buildIcon(Icons.refresh, () {
// refresh
_automChange(Icons.refresh, () {
mapcontroller.scale = 1.0;
mapcontroller.rotation.value = 0.0;
mapcontroller.updateCount.value++;
}),
_buildIcon(Icons.place, () {
_automChange(Icons.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(
width: 30,
height: 30,
width: 33,
height: 33,
margin: EdgeInsets.symmetric(vertical: 2.0),
decoration: BoxDecoration(
color: _iconColors[icon],
@ -145,9 +219,31 @@ class _IconContainerState extends State<IconContainer> {
icon,
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),
),
);
}
}

View File

@ -7,7 +7,7 @@ import 'package:flutter/widgets.dart';
import 'package:get/get.dart';
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 'iconContainer.dart';
import "controller.dart";
@ -33,6 +33,8 @@ class PassTrack extends StatefulWidget {
}
class _PasstrackState extends State<PassTrack> {
final GlobalKey<PopupMenuButtonState<int>> _popupMenuKey =
GlobalKey<PopupMenuButtonState<int>>();
final controller = Get.put(PassTrackController("WXLMB", "cp_orad"));
String str = "播放";
int sWidth = 0;
@ -109,7 +111,7 @@ class _PasstrackState extends State<PassTrack> {
},
),
Positioned(
width: isPortrait ? size.width * .63 : size.width * .42,
width: isPortrait ? size.width * .63 : size.width * .41,
left: isPortrait ? 190 : 200,
bottom: 30,
child: Container(
@ -158,10 +160,16 @@ class _PasstrackState extends State<PassTrack> {
),
),
const SizedBox(width: 5),
Container(
width: 82,
GestureDetector(
onTap: () {
// PopupMenuButton
final dynamic state = _popupMenuKey.currentState;
state.showButtonMenu();
},
child: Container(
width: 70,
height: 35,
padding: const EdgeInsets.symmetric(horizontal: 1.0),
padding: const EdgeInsets.symmetric(horizontal: 6.0),
decoration: BoxDecoration(
color: const Color.fromARGB(255, 255, 255, 255),
border: Border.all(color: Colors.black),
@ -169,14 +177,15 @@ class _PasstrackState extends State<PassTrack> {
child: Row(
mainAxisSize: MainAxisSize.min,
children: [
Center(
child: Text(
Text(
"$speed X",
style: const TextStyle(
fontSize: 11, color: Colors.black),
),
),
PopupMenuButton<int>(
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)),
@ -185,6 +194,12 @@ class _PasstrackState extends State<PassTrack> {
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>(
@ -195,8 +210,9 @@ class _PasstrackState extends State<PassTrack> {
}).toList();
},
),
],
),
],
)),
),
const SizedBox(width: 12),
Column(