63 lines
2.2 KiB
Dart
Executable File
63 lines
2.2 KiB
Dart
Executable File
import 'package:sefer_driver/constant/colors.dart';
|
|
import 'package:sefer_driver/constant/style.dart';
|
|
import 'package:sefer_driver/controller/home/captin/map_driver_controller.dart';
|
|
import 'package:flutter/material.dart';
|
|
import 'package:flutter_font_icons/flutter_font_icons.dart';
|
|
import 'package:get/get.dart';
|
|
import 'package:url_launcher/url_launcher.dart';
|
|
|
|
class GoogleMapApp extends StatelessWidget {
|
|
const GoogleMapApp({super.key});
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return GetBuilder<MapDriverController>(
|
|
builder: (mapDriverController) {
|
|
if (!mapDriverController.isRideStarted) return const SizedBox();
|
|
|
|
// REMOVED: Positioned wrapper
|
|
return Material(
|
|
elevation: 8,
|
|
shadowColor: Colors.black26,
|
|
borderRadius: BorderRadius.circular(30),
|
|
color: Colors.white,
|
|
child: InkWell(
|
|
borderRadius: BorderRadius.circular(30),
|
|
onTap: () async {
|
|
var endLat =
|
|
mapDriverController.latLngPassengerDestination.latitude;
|
|
var endLng =
|
|
mapDriverController.latLngPassengerDestination.longitude;
|
|
String url = 'google.navigation:q=$endLat,$endLng';
|
|
|
|
if (await canLaunchUrl(Uri.parse(url))) {
|
|
await launchUrl(Uri.parse(url));
|
|
} else {
|
|
String webUrl =
|
|
'https://www.google.com/maps/dir/?api=1&destination=$endLat,$endLng';
|
|
if (await canLaunchUrl(Uri.parse(webUrl))) {
|
|
await launchUrl(Uri.parse(webUrl));
|
|
}
|
|
}
|
|
},
|
|
child: Container(
|
|
padding: const EdgeInsets.symmetric(horizontal: 20, vertical: 12),
|
|
decoration: BoxDecoration(
|
|
color: Colors.blueAccent,
|
|
borderRadius: BorderRadius.circular(30),
|
|
border: Border.all(
|
|
color: AppColor.blueColor.withOpacity(0.2), width: 1),
|
|
),
|
|
child: const Icon(
|
|
MaterialCommunityIcons.google_maps,
|
|
size: 28,
|
|
color: AppColor.secondaryColor,
|
|
),
|
|
),
|
|
),
|
|
);
|
|
},
|
|
);
|
|
}
|
|
}
|