Files
tripz/lib/views/home/map_widget.dart/left_main_menu_icons.dart
Hamza-Ayed f217b5a34f 25-1/28/1
2025-01-28 01:03:39 +03:00

122 lines
4.4 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/encrypt_decrypt.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 {
// final plainText = 'Hello, Safar App!';
// debugPrint('Plain Text: $plainText');
// // Encrypt the data
// final encryptedData = encryptionHelper.encryptData(plainText);
// debugPrint('Encrypted: $encryptedData');
// // Decrypt the data
// final decryptedData = encryptionHelper
// .decryptData(encryptedData); // Use the encryptedData variable
// debugPrint('Decrypted: $decryptedData');
// //kVb4a+11Scs9jQWwzeVfx0PxSDiPWDCuMI/RWYxafMU=
// //kVb4a+11Scs9jQWwzeVfx0PxSDiPWDCuMI/RWYxafMU=
// },
// 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
),
);
}