Files
tripz/lib/views/home/map_widget.dart/left_main_menu_icons.dart
Hamza-Ayed 63681f104c 25-1/4/1
2025-01-04 21:58:13 +03:00

114 lines
3.9 KiB
Dart

import 'package:SEFER/main.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/box_name.dart';
import '../../../constant/colors.dart';
import '../../../constant/table_names.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: box.read(BoxName.lang) != 'ar' ? Get.width * .2 : null,
right: box.read(BoxName.lang) != 'ar'
? Get.width * .2
: null, // Adjust left position for better spacing
child: Row(
mainAxisAlignment:
MainAxisAlignment.spaceAround, // 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.telescope,
// onPressed: () async {
// final result = await sql.getCustomQuery('''
// SELECT * FROM ${TableName.recentLocations} ORDER BY createdAt DESC
// ''');
// },
// tooltip: 'Recent Locations', // More descriptive tooltip
// ),
],
),
),
);
}
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
),
);
}