230 lines
9.0 KiB
Dart
230 lines
9.0 KiB
Dart
import 'package:Tripz/views/home/HomePage/contact_us.dart';
|
|
import 'package:flutter/foundation.dart';
|
|
import 'package:flutter/material.dart';
|
|
import 'package:flutter_font_icons/flutter_font_icons.dart';
|
|
import 'package:get/get.dart';
|
|
import 'package:get/get_rx/src/rx_typedefs/rx_typedefs.dart';
|
|
import 'package:Tripz/constant/style.dart';
|
|
import 'package:Tripz/views/home/my_wallet/passenger_wallet.dart';
|
|
import 'package:Tripz/views/home/profile/complaint_page.dart';
|
|
import 'package:Tripz/views/home/profile/order_history.dart';
|
|
import 'package:Tripz/views/home/profile/promos_passenger_page.dart';
|
|
import 'package:Tripz/views/home/profile/taarif_page.dart';
|
|
import 'package:url_launcher/url_launcher.dart';
|
|
|
|
import '../../../constant/colors.dart';
|
|
import '../../../controller/home/map_passenger_controller.dart';
|
|
import '../../notification/notification_page.dart';
|
|
import '../setting_page.dart';
|
|
import '../profile/passenger_profile_page.dart';
|
|
|
|
class MapMenuWidget extends StatelessWidget {
|
|
const MapMenuWidget({super.key});
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return GetBuilder<MapPassengerController>(
|
|
builder: (controller) => Stack(
|
|
children: [
|
|
// Top Menu Bar
|
|
Positioned(
|
|
top: 10, // Adjust as needed
|
|
left: 0,
|
|
right: 0,
|
|
child: SafeArea(
|
|
child: Padding(
|
|
padding: const EdgeInsets.symmetric(horizontal: 20),
|
|
child: Row(
|
|
mainAxisAlignment: MainAxisAlignment.spaceAround,
|
|
children: [
|
|
// GestureDetector(
|
|
// onTap: controller.getDrawerMenu,
|
|
// child: Container(
|
|
// padding: const EdgeInsets.all(10),
|
|
// decoration: AppStyle.boxDecoration
|
|
// .copyWith(color: AppColor.blueColor),
|
|
// child: const Icon(Icons.menu, color: Colors.white),
|
|
// ),
|
|
// ),
|
|
if (controller.heightMenuBool)
|
|
Expanded(
|
|
child: AnimatedContainer(
|
|
duration: const Duration(milliseconds: 300),
|
|
height: 50, // Fixed height for the top menu
|
|
margin: const EdgeInsets.only(left: 10),
|
|
decoration: AppStyle.boxDecoration
|
|
.copyWith(color: AppColor.blueColor),
|
|
child: Row(
|
|
mainAxisAlignment: MainAxisAlignment.spaceAround,
|
|
children: [
|
|
IconButton(
|
|
onPressed: () {
|
|
Get.to(
|
|
() => const NotificationPage(),
|
|
transition: Transition.circularReveal,
|
|
);
|
|
},
|
|
icon: const Icon(Icons.notifications,
|
|
color: Colors.white),
|
|
),
|
|
IconButton(
|
|
onPressed: () {
|
|
Get.to(() => PassengerProfilePage(),
|
|
transition: Transition.zoom);
|
|
},
|
|
icon: const Icon(Icons.person,
|
|
color: Colors.white),
|
|
),
|
|
IconButton(
|
|
onPressed: () {
|
|
Get.to(() => const SettingPage(),
|
|
transition: Transition.downToUp,
|
|
curve: Curves.easeInOutExpo);
|
|
},
|
|
icon: const Icon(Icons.settings,
|
|
color: Colors.white),
|
|
),
|
|
],
|
|
),
|
|
),
|
|
),
|
|
],
|
|
),
|
|
),
|
|
),
|
|
),
|
|
// Side Drawer (Main Menu)
|
|
Positioned(
|
|
top: 80, // Adjust as needed
|
|
left: 10,
|
|
child: AnimatedContainer(
|
|
duration: const Duration(milliseconds: 300),
|
|
width: controller.widthMenu,
|
|
constraints: const BoxConstraints(
|
|
maxWidth: 250), // Add max width constraint
|
|
|
|
child: ClipRRect(
|
|
borderRadius: BorderRadius.circular(15),
|
|
child: Material(
|
|
color: Colors.white, // Background color of the drawer
|
|
child: Column(
|
|
mainAxisSize: MainAxisSize.min,
|
|
children: [
|
|
IconMainPageMap(
|
|
onTap: () {
|
|
Get.to(() => const PassengerWallet());
|
|
},
|
|
title: 'My Wallet'.tr,
|
|
icon: Icons.wallet,
|
|
),
|
|
IconMainPageMap(
|
|
onTap: () async {
|
|
Get.to(() => const OrderHistory());
|
|
},
|
|
title: 'Order History'.tr,
|
|
icon: Icons.history,
|
|
),
|
|
IconMainPageMap(
|
|
onTap: () {
|
|
Get.to(() => ContactUsPage());
|
|
},
|
|
title: "Contact Us".tr,
|
|
icon: Icons.contact_page,
|
|
),
|
|
IconMainPageMap(
|
|
onTap: () async {
|
|
final String driverAppUrl;
|
|
if (defaultTargetPlatform == TargetPlatform.android) {
|
|
driverAppUrl =
|
|
'https://play.google.com/store/apps/details?id=your_android_driver_app_id'; // Replace with your driver app's Play Store URL
|
|
} else if (defaultTargetPlatform ==
|
|
TargetPlatform.iOS) {
|
|
driverAppUrl =
|
|
'https://apps.apple.com/app/your_ios_driver_app_id'; // Replace with your driver app's App Store ID
|
|
} else {
|
|
// Handle other platforms or unknown platform (optional)
|
|
return;
|
|
}
|
|
|
|
try {
|
|
final Uri url = Uri.parse(driverAppUrl);
|
|
if (await canLaunchUrl(url)) {
|
|
await launchUrl(url);
|
|
} else {
|
|
Get.snackbar(
|
|
'Error',
|
|
'Could not launch driver app store.',
|
|
snackPosition: SnackPosition.BOTTOM,
|
|
);
|
|
}
|
|
} catch (e) {
|
|
debugPrint('Error launching URL: $e');
|
|
Get.snackbar(
|
|
'Error',
|
|
'Could not open the link.',
|
|
snackPosition: SnackPosition.BOTTOM,
|
|
);
|
|
}
|
|
},
|
|
title: 'Driver'.tr,
|
|
icon: WeatherIcons.wi_moon_14,
|
|
),
|
|
IconMainPageMap(
|
|
onTap: () {
|
|
Get.to(() => ComplaintPage());
|
|
},
|
|
title: 'Complaint'.tr,
|
|
icon: Icons.feedback,
|
|
),
|
|
IconMainPageMap(
|
|
onTap: () {
|
|
Get.to(() => const PromosPassengerPage());
|
|
},
|
|
title: 'Promos'.tr,
|
|
icon: Icons.monetization_on,
|
|
),
|
|
],
|
|
),
|
|
),
|
|
),
|
|
),
|
|
),
|
|
],
|
|
),
|
|
);
|
|
}
|
|
}
|
|
|
|
class IconMainPageMap extends StatelessWidget {
|
|
const IconMainPageMap({
|
|
super.key,
|
|
required this.title,
|
|
required this.onTap,
|
|
required this.icon,
|
|
});
|
|
|
|
final String title;
|
|
final IconData icon;
|
|
final Callback onTap;
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return InkWell(
|
|
onTap: onTap,
|
|
child: Padding(
|
|
padding: const EdgeInsets.symmetric(vertical: 10, horizontal: 1),
|
|
child: Row(
|
|
children: [
|
|
Icon(icon, size: 24),
|
|
const SizedBox(width: 16),
|
|
Text(
|
|
title.tr,
|
|
style: AppStyle.subtitle,
|
|
),
|
|
],
|
|
),
|
|
),
|
|
);
|
|
}
|
|
}
|