底部部件

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: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),
), ),
); );
} }
} }

View File

@ -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,10 +160,16 @@ class _PasstrackState extends State<PassTrack> {
), ),
), ),
const SizedBox(width: 5), const SizedBox(width: 5),
Container( GestureDetector(
width: 82, onTap: () {
// PopupMenuButton
final dynamic state = _popupMenuKey.currentState;
state.showButtonMenu();
},
child: Container(
width: 70,
height: 35, height: 35,
padding: const EdgeInsets.symmetric(horizontal: 1.0), padding: const EdgeInsets.symmetric(horizontal: 6.0),
decoration: BoxDecoration( decoration: BoxDecoration(
color: const Color.fromARGB(255, 255, 255, 255), color: const Color.fromARGB(255, 255, 255, 255),
border: Border.all(color: Colors.black), border: Border.all(color: Colors.black),
@ -169,14 +177,15 @@ class _PasstrackState extends State<PassTrack> {
child: Row( child: Row(
mainAxisSize: MainAxisSize.min, mainAxisSize: MainAxisSize.min,
children: [ children: [
Center( Text(
child: Text(
"$speed X", "$speed X",
style: const TextStyle( style: const TextStyle(
fontSize: 11, color: Colors.black), fontSize: 11, color: Colors.black),
), ),
), Container(
PopupMenuButton<int>( width: 25,
child: PopupMenuButton<int>(
key: _popupMenuKey,
padding: const EdgeInsets.all(1.0), padding: const EdgeInsets.all(1.0),
icon: const Icon(Icons.arrow_drop_up, icon: const Icon(Icons.arrow_drop_up,
color: Color.fromARGB(255, 47, 48, 47)), color: Color.fromARGB(255, 47, 48, 47)),
@ -185,6 +194,12 @@ class _PasstrackState extends State<PassTrack> {
speed = value; speed = value;
}); });
}, },
// style: ButtonStyle(
// minimumSize: MaterialStateProperty.all<Size>(
// Size(48, 48)), //
// tapTargetSize: MaterialTapTargetSize
// .shrinkWrap, //
// ),
itemBuilder: (BuildContext context) { itemBuilder: (BuildContext context) {
return speedList.map((int speed) { return speedList.map((int speed) {
return PopupMenuItem<int>( return PopupMenuItem<int>(
@ -195,8 +210,9 @@ class _PasstrackState extends State<PassTrack> {
}).toList(); }).toList();
}, },
), ),
],
), ),
],
)),
), ),
const SizedBox(width: 12), const SizedBox(width: 12),
Column( Column(