Files
tripz/lib/views/home/map_widget.dart/left_main_menu_icons.dart
Hamza-Ayed 801f26eb18 25-4-29/1
2025-04-29 15:36:15 +03:00

172 lines
5.8 KiB
Dart

import 'dart:io';
import 'package:Tripz/constant/links.dart';
import 'package:Tripz/controller/auth/login_controller.dart';
import 'package:Tripz/controller/functions/crud.dart';
import 'package:Tripz/controller/functions/sms_controller.dart';
import 'package:Tripz/views/widgets/error_snakbar.dart';
import 'package:flutter/services.dart';
import 'package:Tripz/constant/box_name.dart';
import 'package:Tripz/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 'package:jwt_decoder/jwt_decoder.dart';
import 'package:secure_string_operations/secure_string_operations.dart';
import '../../../constant/char_map.dart';
import '../../../constant/colors.dart';
import '../../../constant/info.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';
import '../../../controller/payment/paymob/paymob_response.dart';
import '../../../print.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 {
// bool isTokenExpired = JwtDecoder.isExpired(X
// .r(X.r(X.r(box.read(BoxName.jwt), cn), cC), cs)
// .toString()
// .split(AppInformation.addd)[0]);
// if (isTokenExpired) {
// Log.print(
// 'isTokenExpired loginUsingCredentials: ${isTokenExpired}');
// await LoginController().getJWT();
// }
// var res = await CRUD().get(
// link: 'https://server.sefer.click/sefer.click/sefer/test.php',
// payload: {
// 'email': box.read(BoxName.email).toString(),
// 'id': box.read(BoxName.passengerID).toString(),
// "platform": Platform.isAndroid ? 'android' : 'ios',
// "appName": AppInformation.appName,
// });
// Log.print('res: ${res}');
// var s = EncryptionHelper.instance.encryptData('Female');
Log.print('s: ${box.read(BoxName.hmac)}');
},
// uDG41L0K5vrem0eh87ZAf9leTrDUW0+twVRHQIQtxOWn4L6J5seU9x1tnRUUbGBb
// uDG41L0K5vrem0eh87ZAf9leTrDUW0+twVRHQIQtxOU=
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
),
);
}