128 lines
4.0 KiB
Dart
128 lines
4.0 KiB
Dart
import 'package:flutter/services.dart';
|
|
import 'package:flutter/material.dart';
|
|
import 'package:flutter_font_icons/flutter_font_icons.dart';
|
|
import 'package:get/get.dart';
|
|
import 'package:google_maps_flutter/google_maps_flutter.dart';
|
|
import '../../../constant/colors.dart';
|
|
import '../../../controller/functions/tts.dart';
|
|
import '../../../controller/home/map_passenger_controller.dart';
|
|
import '../../../controller/home/vip_waitting_page.dart';
|
|
|
|
GetBuilder<MapPassengerController> leftMainMenuIcons() {
|
|
Get.put(TextToSpeechController());
|
|
return GetBuilder<MapPassengerController>(
|
|
builder: (controller) => Positioned(
|
|
top: Get.height * .008,
|
|
left: Get.width * .16,
|
|
right: Get.width * .16, // Adjust left position for better spacing
|
|
child: Row(
|
|
mainAxisAlignment: MainAxisAlignment.center, // Distribute space evenly
|
|
children: [
|
|
_buildIconButtonWithAnimation(
|
|
controller: controller,
|
|
icon: Icons.satellite_alt,
|
|
onPressed: () => controller.changeMapType(),
|
|
tooltip: 'Toggle Map Type', // Add tooltips for better UX
|
|
),
|
|
const SizedBox(width: 8), // Consistent spacing
|
|
_buildIconButtonWithAnimation(
|
|
controller: controller,
|
|
icon: Icons.streetview_sharp,
|
|
onPressed: () => controller.changeMapTraffic(),
|
|
tooltip: 'Toggle Traffic',
|
|
),
|
|
const SizedBox(width: 8),
|
|
_buildIconButtonWithAnimation(
|
|
controller: controller,
|
|
icon: Icons.location_on,
|
|
onPressed: () {
|
|
controller.mapController?.animateCamera(
|
|
CameraUpdate.newLatLng(
|
|
LatLng(
|
|
controller.passengerLocation.latitude,
|
|
controller.passengerLocation.longitude,
|
|
),
|
|
),
|
|
);
|
|
},
|
|
tooltip: 'Go to My Location',
|
|
),
|
|
const SizedBox(width: 8),
|
|
_buildIconButtonWithAnimation(
|
|
controller: controller,
|
|
icon: Octicons.watch,
|
|
onPressed: () => Get.to(() => VipWaittingPage()),
|
|
tooltip: 'VIP Waiting Page', // More descriptive tooltip
|
|
),
|
|
// const SizedBox(width: 8),
|
|
_buildIconButtonWithAnimation(
|
|
controller: controller,
|
|
icon: Octicons.screen_full,
|
|
onPressed: () async {
|
|
Get.to(() => TestPage());
|
|
},
|
|
tooltip: 'Recent Locations', // More descriptive tooltip
|
|
),
|
|
],
|
|
),
|
|
),
|
|
);
|
|
}
|
|
|
|
class TestPage extends StatelessWidget {
|
|
const TestPage({
|
|
super.key,
|
|
});
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return Scaffold(
|
|
appBar: AppBar(),
|
|
body: Center(
|
|
child: TextButton(
|
|
onPressed: () async {},
|
|
child: Text(
|
|
"Text Button",
|
|
),
|
|
),
|
|
),
|
|
);
|
|
}
|
|
}
|
|
|
|
Widget _buildIconButtonWithAnimation({
|
|
required MapPassengerController controller,
|
|
required IconData icon,
|
|
required VoidCallback onPressed,
|
|
String? tooltip,
|
|
}) {
|
|
return AnimatedContainer(
|
|
duration: const Duration(milliseconds: 200),
|
|
width: controller.widthMapTypeAndTraffic,
|
|
decoration: BoxDecoration(
|
|
color: AppColor.primaryColor,
|
|
border: Border.all(color: Colors.grey.shade400), // More subtle border
|
|
borderRadius: BorderRadius.circular(12), // Slightly less rounded
|
|
boxShadow: [
|
|
// Add a subtle shadow for depth
|
|
BoxShadow(
|
|
color: Colors.black.withOpacity(0.1),
|
|
spreadRadius: 0.5,
|
|
blurRadius: 3,
|
|
offset: const Offset(0, 1),
|
|
),
|
|
],
|
|
),
|
|
child: IconButton(
|
|
onPressed: onPressed,
|
|
icon: Icon(
|
|
icon,
|
|
size: 24, // Slightly smaller icon for a cleaner look
|
|
color: Colors.white, // Ensure good contrast
|
|
),
|
|
tooltip: tooltip,
|
|
splashRadius: 24, // Adjust splash radius for better feedback
|
|
),
|
|
);
|
|
}
|