8-24/1
|
Before Width: | Height: | Size: 38 KiB After Width: | Height: | Size: 32 KiB |
|
Before Width: | Height: | Size: 5.8 KiB After Width: | Height: | Size: 2.8 KiB |
|
Before Width: | Height: | Size: 3.3 KiB After Width: | Height: | Size: 1.7 KiB |
|
Before Width: | Height: | Size: 8.5 KiB After Width: | Height: | Size: 4.2 KiB |
|
Before Width: | Height: | Size: 14 KiB After Width: | Height: | Size: 7.5 KiB |
|
Before Width: | Height: | Size: 21 KiB After Width: | Height: | Size: 11 KiB |
|
Before Width: | Height: | Size: 242 KiB After Width: | Height: | Size: 32 KiB |
|
Before Width: | Height: | Size: 8.8 KiB After Width: | Height: | Size: 4.4 KiB |
|
Before Width: | Height: | Size: 242 KiB After Width: | Height: | Size: 152 KiB |
|
Before Width: | Height: | Size: 10 KiB After Width: | Height: | Size: 5.4 KiB |
|
Before Width: | Height: | Size: 11 KiB After Width: | Height: | Size: 5.8 KiB |
|
Before Width: | Height: | Size: 12 KiB After Width: | Height: | Size: 6.4 KiB |
|
Before Width: | Height: | Size: 14 KiB After Width: | Height: | Size: 7.5 KiB |
|
Before Width: | Height: | Size: 15 KiB After Width: | Height: | Size: 8.2 KiB |
|
Before Width: | Height: | Size: 718 B After Width: | Height: | Size: 489 B |
|
Before Width: | Height: | Size: 17 KiB After Width: | Height: | Size: 9.2 KiB |
|
Before Width: | Height: | Size: 19 KiB After Width: | Height: | Size: 10 KiB |
|
Before Width: | Height: | Size: 1011 B After Width: | Height: | Size: 584 B |
|
Before Width: | Height: | Size: 30 KiB After Width: | Height: | Size: 18 KiB |
|
Before Width: | Height: | Size: 1.7 KiB After Width: | Height: | Size: 923 B |
|
Before Width: | Height: | Size: 2.0 KiB After Width: | Height: | Size: 1021 B |
|
Before Width: | Height: | Size: 2.6 KiB After Width: | Height: | Size: 1.3 KiB |
|
Before Width: | Height: | Size: 3.6 KiB After Width: | Height: | Size: 1.8 KiB |
|
Before Width: | Height: | Size: 38 KiB After Width: | Height: | Size: 32 KiB |
|
Before Width: | Height: | Size: 4.2 KiB After Width: | Height: | Size: 2.1 KiB |
|
Before Width: | Height: | Size: 4.3 KiB After Width: | Height: | Size: 2.2 KiB |
|
Before Width: | Height: | Size: 4.5 KiB After Width: | Height: | Size: 2.2 KiB |
|
Before Width: | Height: | Size: 5.0 KiB After Width: | Height: | Size: 2.5 KiB |
|
Before Width: | Height: | Size: 5.8 KiB After Width: | Height: | Size: 2.8 KiB |
|
Before Width: | Height: | Size: 6.1 KiB After Width: | Height: | Size: 3.1 KiB |
|
Before Width: | Height: | Size: 6.6 KiB After Width: | Height: | Size: 3.3 KiB |
|
Before Width: | Height: | Size: 7.4 KiB After Width: | Height: | Size: 3.7 KiB |
@@ -108,7 +108,5 @@ class LoginController extends GetxController {
|
|||||||
@override
|
@override
|
||||||
void onInit() {
|
void onInit() {
|
||||||
super.onInit();
|
super.onInit();
|
||||||
FirebasMessagesController().requestPermission();
|
|
||||||
// goToMapPage();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -22,52 +22,30 @@ class FirebasMessagesController extends GetxController {
|
|||||||
super.onInit();
|
super.onInit();
|
||||||
// getNotificationSettings();
|
// getNotificationSettings();
|
||||||
getToken();
|
getToken();
|
||||||
getTokens();
|
await getTokens();
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<void> getNotificationSettings() async {
|
Future<void> getNotificationSettings() async {
|
||||||
// Get the current notification settings.
|
// Get the current notification settings
|
||||||
notificationSettings =
|
NotificationSettings? notificationSettings =
|
||||||
await FirebaseMessaging.instance.getNotificationSettings();
|
await FirebaseMessaging.instance.getNotificationSettings();
|
||||||
print('------noti======');
|
print(
|
||||||
print(notificationSettings!.authorizationStatus.toString());
|
'Notification authorization status: ${notificationSettings.authorizationStatus}');
|
||||||
// if (notificationSettings?.authorizationStatus.toString() ==
|
|
||||||
// 'AuthorizationStatus.denied') {
|
// Call the update function if needed
|
||||||
// await Get.defaultDialog(
|
|
||||||
// title: 'AuthorizationStatus',
|
|
||||||
// content: TextButton(
|
|
||||||
// onPressed: () {
|
|
||||||
// requestPermission();
|
|
||||||
// },
|
|
||||||
// child: Text(
|
|
||||||
// "Text Button",
|
|
||||||
// ),
|
|
||||||
// ),
|
|
||||||
// );
|
|
||||||
// }
|
|
||||||
update();
|
update();
|
||||||
}
|
}
|
||||||
|
|
||||||
Future checkAndRequestPermission() async {
|
Future<void> requestFirebaseMessagingPermission() async {
|
||||||
if (notificationSettings!.authorizationStatus ==
|
FirebaseMessaging messaging = FirebaseMessaging.instance;
|
||||||
AuthorizationStatus.denied) {
|
|
||||||
await requestPermission();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Future requestPermission() async {
|
|
||||||
// Check if the platform is Android
|
// Check if the platform is Android
|
||||||
if (Platform.isAndroid) {
|
if (Platform.isAndroid) {
|
||||||
// Request permission for Android
|
// Request permission for Android
|
||||||
fcmToken.requestPermission().then((value) {
|
await messaging.requestPermission();
|
||||||
if (value.authorizationStatus == AuthorizationStatus.denied) {
|
} else if (Platform.isIOS) {
|
||||||
print('dddddddddddddddddddddd');
|
|
||||||
}
|
|
||||||
print(value.authorizationStatus);
|
|
||||||
});
|
|
||||||
} else {
|
|
||||||
// Request permission for iOS
|
// Request permission for iOS
|
||||||
NotificationSettings settings = await fcmToken.requestPermission(
|
NotificationSettings settings = await messaging.requestPermission(
|
||||||
alert: true,
|
alert: true,
|
||||||
announcement: true,
|
announcement: true,
|
||||||
badge: true,
|
badge: true,
|
||||||
@@ -77,7 +55,7 @@ class FirebasMessagesController extends GetxController {
|
|||||||
sound: true,
|
sound: true,
|
||||||
);
|
);
|
||||||
print('User granted permission: ${settings.authorizationStatus}');
|
print('User granted permission: ${settings.authorizationStatus}');
|
||||||
fcmToken.setForegroundNotificationPresentationOptions(
|
messaging.setForegroundNotificationPresentationOptions(
|
||||||
alert: true, badge: true, sound: true);
|
alert: true, badge: true, sound: true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -107,68 +85,42 @@ class FirebasMessagesController extends GetxController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void getToken() async {
|
void getToken() async {
|
||||||
// final SharedPreferences prefs = await SharedPreferences.getInstance();
|
await fcmToken.getToken().then((token) {
|
||||||
await fcmToken.getToken().then(
|
box.write(BoxName.tokenFCM, token);
|
||||||
(token) {
|
print(token);
|
||||||
box.write(BoxName.tokenFCM, token);
|
});
|
||||||
print(box.read(BoxName.tokenFCM).toString());
|
|
||||||
},
|
FirebaseMessaging.onMessage.listen((RemoteMessage message) {
|
||||||
);
|
|
||||||
FirebaseMessaging.onMessage.listen((event) {
|
|
||||||
print(
|
print(
|
||||||
'onMessage: ${event.notification!.title} ${event.notification!.body}');
|
'onMessage: ${message.notification!.title} ${message.notification!.body}');
|
||||||
if (Get.currentRoute == '/') {
|
if (Get.currentRoute == '/') {
|
||||||
// If the app is in the foreground, show a dialog to the user
|
// If the app is in the foreground, show a dialog to the user
|
||||||
if (event.notification!.title.toString().contains('ride')) {
|
if (message.notification!.title!.contains('ride')) {
|
||||||
Get.snackbar('ride', 'message', backgroundColor: AppColor.redColor);
|
Get.snackbar('ride', 'message', backgroundColor: AppColor.redColor);
|
||||||
} else if (event.notification!.title.toString().contains('انذار')) {
|
}
|
||||||
// Get.to(() => const ProfilePage());
|
|
||||||
} else if (event.notification!.title
|
|
||||||
.toString()
|
|
||||||
.contains('تعديل طلبيات')) {}
|
|
||||||
} else if (event.notification!.title.toString().contains('Deleted')) {
|
|
||||||
// LogOutController().removeKeys(prefs);
|
|
||||||
} else {
|
} else {
|
||||||
// If the app is in the background or terminated, show a system tray message
|
// If the app is in the background or terminated, show a system tray message
|
||||||
RemoteNotification? notification = event.notification;
|
RemoteNotification? notification = message.notification;
|
||||||
AndroidNotification? android = event.notification?.android;
|
AndroidNotification? android = message.notification?.android;
|
||||||
// if (notification != null && android != null) {
|
|
||||||
if (notification != null && android != null) {
|
if (notification != null && android != null) {
|
||||||
print(
|
print(
|
||||||
'onMessageOpenedApp: ${notification.title} ${notification.body}');
|
'onMessageOpenedApp: ${notification.title} ${notification.body}');
|
||||||
if (event.notification!.title.toString().contains('ride')) {
|
if (message.notification!.title!.contains('ride')) {
|
||||||
Get.snackbar('ride', 'message', backgroundColor: AppColor.redColor);
|
Get.snackbar('ride', 'message', backgroundColor: AppColor.redColor);
|
||||||
// SendGpsNow().getSiteNotification();
|
// SendGpsNow().getSiteNotification();
|
||||||
} else if (event.notification!.title.toString().contains('انذار')) {
|
|
||||||
// Get.to(() => const ProfilePage());
|
|
||||||
} else if (event.notification!.title
|
|
||||||
.toString()
|
|
||||||
.contains('تعديل طلبيات')) {
|
|
||||||
// Get.to(() => const OrdersDriverPage());
|
|
||||||
} else if (event.notification!.title.toString().contains('Deleted')) {
|
|
||||||
// LogOutController().removeKeys(prefs);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
FirebaseMessaging.onMessageOpenedApp.listen((RemoteMessage event) {
|
|
||||||
|
FirebaseMessaging.onMessageOpenedApp.listen((RemoteMessage message) {
|
||||||
print(
|
print(
|
||||||
'onMessageOpenedApp: ${event.notification!.title} ${event.notification!.body}');
|
'onMessageOpenedApp: ${message.notification!.title} ${message.notification!.body}');
|
||||||
RemoteNotification? notification = event.notification;
|
RemoteNotification? notification = message.notification;
|
||||||
if (notification != null) {
|
if (notification != null) {
|
||||||
print('onMessageOpenedApp: ${notification.title} ${notification.body}');
|
print('onMessageOpenedApp: ${notification.title} ${notification.body}');
|
||||||
|
if (message.notification!.title!.contains('ride')) {
|
||||||
if (event.notification!.title.toString().contains('ride')) {
|
|
||||||
Get.snackbar('ride', 'message', backgroundColor: AppColor.redColor);
|
Get.snackbar('ride', 'message', backgroundColor: AppColor.redColor);
|
||||||
// SendGpsNow().getSiteNotification();
|
|
||||||
} else if (event.notification!.title.toString().contains('انذار')) {
|
|
||||||
// Get.to(() => const ProfilePage());
|
|
||||||
} else if (event.notification!.title
|
|
||||||
.toString()
|
|
||||||
.contains('تعديل طلبيات')) {
|
|
||||||
// Get.to(() => const OrdersDriverPage());
|
|
||||||
} else if (event.notification!.title.toString().contains('Deleted')) {
|
|
||||||
// LogOutController().removeKeys(prefs);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@@ -213,61 +165,61 @@ class FirebasMessagesController extends GetxController {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void sendNotificationToManager(String title, body) async {
|
// void sendNotificationToManager(String title, body) async {
|
||||||
// tokens = box.read(BoxName.tokenManager);
|
// // tokens = box.read(BoxName.tokenManager);
|
||||||
|
|
||||||
for (var i = 0; i < tokens.length; i++) {
|
// for (var i = 0; i < tokens.length; i++) {
|
||||||
http
|
// http
|
||||||
.post(Uri.parse('https://fcm.googleapis.com/fcm/send'),
|
// .post(Uri.parse('https://fcm.googleapis.com/fcm/send'),
|
||||||
headers: <String, String>{
|
// headers: <String, String>{
|
||||||
'Content-Type': 'application/json',
|
// 'Content-Type': 'application/json',
|
||||||
'Authorization': 'key=${AppCredintials.serverAPI}'
|
// 'Authorization': 'key=${AppCredintials.serverAPI}'
|
||||||
},
|
// },
|
||||||
body: jsonEncode({
|
// body: jsonEncode({
|
||||||
'notification': <String, dynamic>{
|
// 'notification': <String, dynamic>{
|
||||||
'title': title,
|
// 'title': title,
|
||||||
'body': body,
|
// 'body': body,
|
||||||
'sound': 'true'
|
// 'sound': 'true'
|
||||||
},
|
// },
|
||||||
'priority': 'high',
|
// 'priority': 'high',
|
||||||
'data': <String, dynamic>{
|
// 'data': <String, dynamic>{
|
||||||
'click_action': 'FLUTTER_NOTIFICATION_CLICK',
|
// 'click_action': 'FLUTTER_NOTIFICATION_CLICK',
|
||||||
'id': '1',
|
// 'id': '1',
|
||||||
'status': 'done'
|
// 'status': 'done'
|
||||||
},
|
// },
|
||||||
'to': tokens[i],
|
// 'to': tokens[i],
|
||||||
}))
|
// }))
|
||||||
.whenComplete(() {})
|
// .whenComplete(() {})
|
||||||
.catchError((e) {
|
// .catchError((e) {
|
||||||
print('sendNotification() error: $e');
|
// print('sendNotification() error: $e');
|
||||||
});
|
// });
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
|
|
||||||
void sendNotificationDriverId(String title, body, token) async {
|
// void sendNotificationDriverId(String title, body, token) async {
|
||||||
http
|
// http
|
||||||
.post(Uri.parse('https://fcm.googleapis.com/fcm/send'),
|
// .post(Uri.parse('https://fcm.googleapis.com/fcm/send'),
|
||||||
headers: <String, String>{
|
// headers: <String, String>{
|
||||||
'Content-Type': 'application/json',
|
// 'Content-Type': 'application/json',
|
||||||
'Authorization': 'key=${AppCredintials.serverAPI}'
|
// 'Authorization': 'key=${AppCredintials.serverAPI}'
|
||||||
},
|
// },
|
||||||
body: jsonEncode({
|
// body: jsonEncode({
|
||||||
'notification': <String, dynamic>{
|
// 'notification': <String, dynamic>{
|
||||||
'title': title,
|
// 'title': title,
|
||||||
'body': body,
|
// 'body': body,
|
||||||
'sound': 'true'
|
// 'sound': 'true'
|
||||||
},
|
// },
|
||||||
'priority': 'high',
|
// 'priority': 'high',
|
||||||
'data': <String, dynamic>{
|
// 'data': <String, dynamic>{
|
||||||
'click_action': 'FLUTTER_NOTIFICATION_CLICK',
|
// 'click_action': 'FLUTTER_NOTIFICATION_CLICK',
|
||||||
'id': '1',
|
// 'id': '1',
|
||||||
'status': 'done'
|
// 'status': 'done'
|
||||||
},
|
// },
|
||||||
'to': token,
|
// 'to': token,
|
||||||
}))
|
// }))
|
||||||
.whenComplete(() {})
|
// .whenComplete(() {})
|
||||||
.catchError((e) {
|
// .catchError((e) {
|
||||||
print('sendNotification() error: $e');
|
// print('sendNotification() error: $e');
|
||||||
});
|
// });
|
||||||
}
|
// }
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -22,10 +22,11 @@ class CRUD {
|
|||||||
},
|
},
|
||||||
);
|
);
|
||||||
// print("--------------" + response.body.toString());
|
// print("--------------" + response.body.toString());
|
||||||
|
// print("--------------" + payload.toString());
|
||||||
if (response.statusCode == 200) {
|
if (response.statusCode == 200) {
|
||||||
var jsonData = jsonDecode(response.body);
|
var jsonData = jsonDecode(response.body);
|
||||||
if (jsonData['status'] == 'success') {
|
if (jsonData['status'] == 'success') {
|
||||||
print(jsonData);
|
// print(jsonData);
|
||||||
return response.body;
|
return response.body;
|
||||||
}
|
}
|
||||||
return jsonData['status'];
|
return jsonData['status'];
|
||||||
|
|||||||
@@ -1,6 +1,8 @@
|
|||||||
|
import 'dart:async';
|
||||||
import 'dart:convert';
|
import 'dart:convert';
|
||||||
import 'dart:math' show sqrt, pi, cos, sin;
|
import 'dart:math' show sqrt, pi, cos, sin;
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:geolocator/geolocator.dart';
|
||||||
import 'package:get/get.dart';
|
import 'package:get/get.dart';
|
||||||
import 'package:google_maps_flutter/google_maps_flutter.dart';
|
import 'package:google_maps_flutter/google_maps_flutter.dart';
|
||||||
import 'package:google_polyline_algorithm/google_polyline_algorithm.dart';
|
import 'package:google_polyline_algorithm/google_polyline_algorithm.dart';
|
||||||
@@ -9,10 +11,9 @@ import 'package:ride/constant/box_name.dart';
|
|||||||
import 'package:ride/constant/credential.dart';
|
import 'package:ride/constant/credential.dart';
|
||||||
import 'package:ride/constant/links.dart';
|
import 'package:ride/constant/links.dart';
|
||||||
import 'package:ride/controller/functions/crud.dart';
|
import 'package:ride/controller/functions/crud.dart';
|
||||||
import 'package:http/http.dart' as http;
|
import 'package:ride/views/widgets/elevated_btn.dart';
|
||||||
import '../../main.dart';
|
import '../../main.dart';
|
||||||
import '../../models/model/locations.dart';
|
import '../../models/model/locations.dart';
|
||||||
import '../firebase/firbase_messge.dart';
|
|
||||||
|
|
||||||
class MapController extends GetxController {
|
class MapController extends GetxController {
|
||||||
bool isloading = true;
|
bool isloading = true;
|
||||||
@@ -27,7 +28,7 @@ class MapController extends GetxController {
|
|||||||
late LatLng newMylocation = const LatLng(32.115295, 36.064773);
|
late LatLng newMylocation = const LatLng(32.115295, 36.064773);
|
||||||
LatLng mydestination = const LatLng(32.115295, 36.064773);
|
LatLng mydestination = const LatLng(32.115295, 36.064773);
|
||||||
final List<LatLng> polylineCoordinates = [];
|
final List<LatLng> polylineCoordinates = [];
|
||||||
final List<LatLng> carsLocationByPassenger = [];
|
List<LatLng> carsLocationByPassenger = [];
|
||||||
BitmapDescriptor markerIcon = BitmapDescriptor.defaultMarker;
|
BitmapDescriptor markerIcon = BitmapDescriptor.defaultMarker;
|
||||||
BitmapDescriptor carIcon = BitmapDescriptor.defaultMarker;
|
BitmapDescriptor carIcon = BitmapDescriptor.defaultMarker;
|
||||||
double height = 150;
|
double height = 150;
|
||||||
@@ -43,14 +44,17 @@ class MapController extends GetxController {
|
|||||||
bool isCancelRidePageShown = false;
|
bool isCancelRidePageShown = false;
|
||||||
bool isCashConfirmPageShown = false;
|
bool isCashConfirmPageShown = false;
|
||||||
bool isPaymentMethodPageShown = false;
|
bool isPaymentMethodPageShown = false;
|
||||||
|
bool rideConfirm = false;
|
||||||
bool isMainBottomMenuMap = true;
|
bool isMainBottomMenuMap = true;
|
||||||
double heightButtomSheetShown = 0;
|
double heightButtomSheetShown = 0;
|
||||||
double cashConfirmPageShown = 250;
|
double cashConfirmPageShown = 250;
|
||||||
double paymentPageShown = Get.height * .6;
|
double paymentPageShown = Get.height * .6;
|
||||||
late final LatLng southwest;
|
late LatLng southwest;
|
||||||
late final LatLng northeast;
|
late LatLng northeast;
|
||||||
List<CarLocationModel> carLocations = <CarLocationModel>[];
|
List<CarLocationModel> carLocations = <CarLocationModel>[];
|
||||||
|
var dataCarsLocationByPassenger;
|
||||||
|
CarLocation? nearestCar;
|
||||||
|
late Timer markerReloadingTimer;
|
||||||
// final mainBottomMenuMap = GlobalKey<AnimatedContainer>();
|
// final mainBottomMenuMap = GlobalKey<AnimatedContainer>();
|
||||||
void changeButtomSheetShown() {
|
void changeButtomSheetShown() {
|
||||||
isButtomSheetShown = !isButtomSheetShown;
|
isButtomSheetShown = !isButtomSheetShown;
|
||||||
@@ -103,24 +107,15 @@ class MapController extends GetxController {
|
|||||||
update();
|
update();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool rideConfirm = false;
|
|
||||||
changeConfirmRide() {
|
changeConfirmRide() {
|
||||||
rideConfirm = true;
|
rideConfirm = true;
|
||||||
|
print('rideConfirm= $rideConfirm');
|
||||||
//TODO add ride and get ride id and details
|
//TODO add ride and get ride id and details
|
||||||
update();
|
update();
|
||||||
}
|
}
|
||||||
|
|
||||||
Future cancelRide() async {
|
Future cancelRide() async {
|
||||||
var payload = {
|
|
||||||
"driverID": "1", // Convert to String
|
|
||||||
"passengerID":
|
|
||||||
box.read(BoxName.pasengerID).toString(), // Convert to String
|
|
||||||
"rideID": "222", // Convert to String
|
|
||||||
"note": cancelNote
|
|
||||||
};
|
|
||||||
|
|
||||||
print(rideConfirm);
|
print(rideConfirm);
|
||||||
print(payload);
|
|
||||||
|
|
||||||
if (rideConfirm == false) {
|
if (rideConfirm == false) {
|
||||||
clearPlaces();
|
clearPlaces();
|
||||||
@@ -134,7 +129,13 @@ class MapController extends GetxController {
|
|||||||
data = [];
|
data = [];
|
||||||
changeCancelRidePageShow();
|
changeCancelRidePageShow();
|
||||||
|
|
||||||
await CRUD().post(link: AppLink.addCancelRide, payload: payload);
|
await CRUD().post(link: AppLink.addCancelRide, payload: {
|
||||||
|
"driverID": "1", // Convert to String
|
||||||
|
"passengerID":
|
||||||
|
box.read(BoxName.pasengerID).toString(), // Convert to String
|
||||||
|
"rideID": "222", // Convert to String
|
||||||
|
"note": cancelNote
|
||||||
|
});
|
||||||
|
|
||||||
update();
|
update();
|
||||||
}
|
}
|
||||||
@@ -244,7 +245,7 @@ class MapController extends GetxController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Configure location accuracy
|
// Configure location accuracy
|
||||||
LocationAccuracy desiredAccuracy = LocationAccuracy.high;
|
// LocationAccuracy desiredAccuracy = LocationAccuracy.high;
|
||||||
|
|
||||||
// Get the current location
|
// Get the current location
|
||||||
LocationData _locationData = await location.getLocation();
|
LocationData _locationData = await location.getLocation();
|
||||||
@@ -263,6 +264,7 @@ class MapController extends GetxController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Future getCarsLocationByPassenger() async {
|
Future getCarsLocationByPassenger() async {
|
||||||
|
carsLocationByPassenger = [];
|
||||||
LatLngBounds bounds =
|
LatLngBounds bounds =
|
||||||
calculateBounds(mylocation.latitude, mylocation.longitude, 10);
|
calculateBounds(mylocation.latitude, mylocation.longitude, 10);
|
||||||
print(
|
print(
|
||||||
@@ -277,15 +279,29 @@ class MapController extends GetxController {
|
|||||||
'northeastLat': northeast.latitude.toString(),
|
'northeastLat': northeast.latitude.toString(),
|
||||||
'northeastLon': northeast.longitude.toString(),
|
'northeastLon': northeast.longitude.toString(),
|
||||||
});
|
});
|
||||||
var data = jsonDecode(res);
|
if (res == 'failure') {
|
||||||
// print(data);
|
Get.defaultDialog(
|
||||||
for (var i = 0; i < data.length; i++) {
|
title: 'No Car in your site.Sorry!',
|
||||||
carsLocationByPassenger.add(LatLng(
|
middleText: '',
|
||||||
double.parse(data['message'][i]['latitude']),
|
confirm: MyElevatedButton(
|
||||||
double.parse(data['message'][i]['longitude'])));
|
title: 'Back',
|
||||||
}
|
onPressed: () {
|
||||||
|
Get.back();
|
||||||
|
markerReloadingTimer.cancel();
|
||||||
|
}));
|
||||||
|
} else {
|
||||||
|
dataCarsLocationByPassenger = jsonDecode(res);
|
||||||
|
// print(dataCarsLocationByPassenger);
|
||||||
|
|
||||||
update();
|
for (var i = 0; i < dataCarsLocationByPassenger['message'].length; i++) {
|
||||||
|
carsLocationByPassenger.add(LatLng(
|
||||||
|
double.parse(dataCarsLocationByPassenger['message'][i]['latitude']),
|
||||||
|
double.parse(
|
||||||
|
dataCarsLocationByPassenger['message'][i]['longitude'])));
|
||||||
|
}
|
||||||
|
|
||||||
|
update();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
LatLngBounds calculateBounds(
|
LatLngBounds calculateBounds(
|
||||||
@@ -315,6 +331,120 @@ class MapController extends GetxController {
|
|||||||
update();
|
update();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// void startMarkerReloading() {
|
||||||
|
// markerReloadingTimer = Timer.periodic(const Duration(seconds: 30), (timer) {
|
||||||
|
// print('timer==============================');
|
||||||
|
// reloadMarkers();
|
||||||
|
// });
|
||||||
|
// }
|
||||||
|
|
||||||
|
late Timer markerReloadingTimer2;
|
||||||
|
late Timer markerReloadingTimer1;
|
||||||
|
late int duration1;
|
||||||
|
void startMarkerReloading() {
|
||||||
|
// Schedule timer 1 to reload markers at a specific time
|
||||||
|
DateTime scheduledTime1 = DateTime.now().add(const Duration(seconds: 30));
|
||||||
|
markerReloadingTimer1 =
|
||||||
|
Timer(scheduledTime1.difference(DateTime.now()), () {
|
||||||
|
print('timer 1 ==============================');
|
||||||
|
reloadMarkers();
|
||||||
|
});
|
||||||
|
|
||||||
|
// Schedule timer 2 to reload markers at a specific time
|
||||||
|
DateTime scheduledTime2 = DateTime.now().add(const Duration(seconds: 60));
|
||||||
|
markerReloadingTimer2 =
|
||||||
|
Timer(scheduledTime2.difference(DateTime.now()), () {
|
||||||
|
print('timer 2 ==============================');
|
||||||
|
reloadMarkers();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
void reloadMarkers() async {
|
||||||
|
await getCarsLocationByPassenger();
|
||||||
|
// Clear existing markers
|
||||||
|
markers.clear();
|
||||||
|
getNearestDriverByPassengerLocation();
|
||||||
|
// Add new markers
|
||||||
|
// Example: Add a marker for each item in a list
|
||||||
|
for (var item in carsLocationByPassenger) {
|
||||||
|
final marker = Marker(
|
||||||
|
infoWindow: InfoWindow(title: '${item.latitude} minutes'),
|
||||||
|
markerId: MarkerId(duration1.toString()),
|
||||||
|
position: LatLng(item.latitude, item.longitude),
|
||||||
|
// Other properties for the marker, such as icon, info window, etc.
|
||||||
|
);
|
||||||
|
markers.add(marker);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Update the map with the new markers
|
||||||
|
mapController?.animateCamera(CameraUpdate.newLatLng(
|
||||||
|
LatLng(mylocation.latitude, mylocation.longitude)));
|
||||||
|
}
|
||||||
|
|
||||||
|
String duratioByPassenger = '';
|
||||||
|
void getNearestDriverByPassengerLocation() async {
|
||||||
|
double nearestDistance = double.infinity;
|
||||||
|
for (var i = 0; i < dataCarsLocationByPassenger['message'].length; i++) {
|
||||||
|
var carLocation = dataCarsLocationByPassenger['message'][i];
|
||||||
|
|
||||||
|
// double distance1 = Geolocator.distanceBetween(
|
||||||
|
// mylocation.latitude,
|
||||||
|
// mylocation.longitude,
|
||||||
|
// double.parse(carLocation['latitude']),
|
||||||
|
// double.parse(carLocation['longitude']),
|
||||||
|
// );
|
||||||
|
// if (distance1 < nearestDistance) {
|
||||||
|
// nearestDistance = distance1;
|
||||||
|
// // nearestCarLocation = carLocation;
|
||||||
|
// nearestCar = CarLocation(
|
||||||
|
// distance: distance1,
|
||||||
|
// id: carLocation['driver_id'],
|
||||||
|
// latitude: double.parse(carLocation['latitude']),
|
||||||
|
// longitude: double.parse(carLocation['longitude']),
|
||||||
|
// );
|
||||||
|
// }
|
||||||
|
|
||||||
|
update();
|
||||||
|
// Make API request to get exact distance and duration
|
||||||
|
String apiUrl =
|
||||||
|
'${AppLink.googleMapsLink}distancematrix/json?destinations=${carLocation['latitude']},${carLocation['longitude']}&origins=${mylocation.latitude},${mylocation.longitude}&units=metric&key=${AppCredintials.mapAPIKEY}';
|
||||||
|
var response = await CRUD().getGoogleApi(link: apiUrl, payload: {});
|
||||||
|
if (response['status'] == "OK") {
|
||||||
|
var data = response;
|
||||||
|
// Extract distance and duration from the response and handle accordingly
|
||||||
|
int distance1 = data['rows'][0]['elements'][0]['distance']['value'];
|
||||||
|
duration1 = data['rows'][0]['elements'][0]['duration']['value'];
|
||||||
|
duratioByPassenger = data['rows'][0]['elements'][0]['duration']['text'];
|
||||||
|
|
||||||
|
if (distance1 < nearestDistance) {
|
||||||
|
nearestDistance = distance1.toDouble();
|
||||||
|
|
||||||
|
nearestCar = CarLocation(
|
||||||
|
distance: distance1.toDouble(),
|
||||||
|
duration: duration1.toDouble(),
|
||||||
|
id: carLocation['driver_id'],
|
||||||
|
latitude: double.parse(carLocation['latitude']),
|
||||||
|
longitude: double.parse(carLocation['longitude']),
|
||||||
|
);
|
||||||
|
update();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Handle the distance and duration as needed
|
||||||
|
else {
|
||||||
|
print(
|
||||||
|
'Failed to retrieve distance and duration: ${response['status']}');
|
||||||
|
// Handle the failure case
|
||||||
|
}
|
||||||
|
}
|
||||||
|
print(nearestCar!.distance);
|
||||||
|
print(nearestCar!.duration);
|
||||||
|
print(nearestCar!.latitude);
|
||||||
|
print(nearestCar!.longitude);
|
||||||
|
print(nearestCar!.id);
|
||||||
|
}
|
||||||
|
|
||||||
|
late LatLngBounds boundsData;
|
||||||
getMap(String origin, destination) async {
|
getMap(String origin, destination) async {
|
||||||
var origin1 = fromString(origin);
|
var origin1 = fromString(origin);
|
||||||
var destination1 = fromString(destination);
|
var destination1 = fromString(destination);
|
||||||
@@ -322,13 +452,15 @@ class MapController extends GetxController {
|
|||||||
mydestination = destination1;
|
mydestination = destination1;
|
||||||
mylocation = origin1;
|
mylocation = origin1;
|
||||||
update();
|
update();
|
||||||
|
await getCarsLocationByPassenger();
|
||||||
|
// print(carsLocationByPassenger);
|
||||||
|
|
||||||
var url =
|
var url =
|
||||||
('${AppLink.googleMapsLink}directions/json?&language=en&avoid=tolls|ferries&destination=$destination&origin=$origin&key=${AppCredintials.mapAPIKEY}');
|
('${AppLink.googleMapsLink}directions/json?&language=en&avoid=tolls|ferries&destination=$destination&origin=$origin&key=${AppCredintials.mapAPIKEY}');
|
||||||
|
|
||||||
var response = await CRUD().getGoogleApi(link: url, payload: {});
|
var response = await CRUD().getGoogleApi(link: url, payload: {});
|
||||||
data = response['routes'][0]['legs'];
|
data = response['routes'][0]['legs'];
|
||||||
|
print(data);
|
||||||
final points =
|
final points =
|
||||||
decodePolyline(response["routes"][0]["overview_polyline"]["points"]);
|
decodePolyline(response["routes"][0]["overview_polyline"]["points"]);
|
||||||
for (int i = 0; i < points.length; i++) {
|
for (int i = 0; i < points.length; i++) {
|
||||||
@@ -345,8 +477,7 @@ class MapController extends GetxController {
|
|||||||
LatLng(bounds['southwest']['lat'], bounds['southwest']['lng']);
|
LatLng(bounds['southwest']['lat'], bounds['southwest']['lng']);
|
||||||
|
|
||||||
// Create the LatLngBounds object
|
// Create the LatLngBounds object
|
||||||
LatLngBounds boundsData =
|
boundsData = LatLngBounds(northeast: northeast, southwest: southwest);
|
||||||
LatLngBounds(northeast: northeast, southwest: southwest);
|
|
||||||
|
|
||||||
// Calculate the zoom level based on the distance and screen size
|
// Calculate the zoom level based on the distance and screen size
|
||||||
|
|
||||||
@@ -376,10 +507,19 @@ class MapController extends GetxController {
|
|||||||
);
|
);
|
||||||
|
|
||||||
polylines.add(polyline);
|
polylines.add(polyline);
|
||||||
|
rideConfirm = false;
|
||||||
update();
|
update();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
showBottomSheet1() async {
|
||||||
|
bottomSheet();
|
||||||
|
isButtomSheetShown = true;
|
||||||
|
heightButtomSheetShown = 250;
|
||||||
|
|
||||||
|
update();
|
||||||
|
}
|
||||||
|
|
||||||
double getDistanceFromText(String distanceText) {
|
double getDistanceFromText(String distanceText) {
|
||||||
// Remove any non-digit characters from the distance text
|
// Remove any non-digit characters from the distance text
|
||||||
String distanceValue = distanceText.replaceAll(RegExp(r'[^0-9.]+'), '');
|
String distanceValue = distanceText.replaceAll(RegExp(r'[^0-9.]+'), '');
|
||||||
@@ -406,6 +546,8 @@ class MapController extends GetxController {
|
|||||||
if (data.isNotEmpty) {
|
if (data.isNotEmpty) {
|
||||||
String distanceText = await data[0]['distance']['text'];
|
String distanceText = await data[0]['distance']['text'];
|
||||||
String durationText = await data[0]['duration']['text'];
|
String durationText = await data[0]['duration']['text'];
|
||||||
|
print(data[0]['duration']['text']);
|
||||||
|
print('=================================');
|
||||||
distance = getDistanceFromText(distanceText);
|
distance = getDistanceFromText(distanceText);
|
||||||
duration = getDistanceFromText(durationText);
|
duration = getDistanceFromText(durationText);
|
||||||
durationToAdd = Duration(minutes: duration.toInt());
|
durationToAdd = Duration(minutes: duration.toInt());
|
||||||
@@ -562,14 +704,29 @@ class MapController extends GetxController {
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
void onInit() async {
|
void onInit() async {
|
||||||
// getPolyLine();
|
|
||||||
// getMap();
|
|
||||||
FirebasMessagesController().requestPermission();
|
|
||||||
await getLocation();
|
await getLocation();
|
||||||
await getCarsLocationByPassenger();
|
await getCarsLocationByPassenger();
|
||||||
|
getNearestDriverByPassengerLocation();
|
||||||
addCustomPicker();
|
addCustomPicker();
|
||||||
addCustomCarIcon();
|
addCustomCarIcon();
|
||||||
|
startMarkerReloading();
|
||||||
|
|
||||||
super.onInit();
|
super.onInit();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
class CarLocation {
|
||||||
|
final int id;
|
||||||
|
final double latitude;
|
||||||
|
final double longitude;
|
||||||
|
double distance;
|
||||||
|
double duration;
|
||||||
|
|
||||||
|
CarLocation({
|
||||||
|
required this.id,
|
||||||
|
required this.latitude,
|
||||||
|
required this.longitude,
|
||||||
|
this.distance = 10000,
|
||||||
|
this.duration = 10000,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|||||||
@@ -40,7 +40,6 @@ class LocaleController extends GetxController {
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
void onInit() {
|
void onInit() {
|
||||||
FirebasMessagesController().requestPermission();
|
|
||||||
String storedLang = box.read(BoxName.lang) ?? "";
|
String storedLang = box.read(BoxName.lang) ?? "";
|
||||||
switch (storedLang) {
|
switch (storedLang) {
|
||||||
case "ar":
|
case "ar":
|
||||||
|
|||||||
@@ -37,12 +37,13 @@ void main() async {
|
|||||||
options: DefaultFirebaseOptions.currentPlatform,
|
options: DefaultFirebaseOptions.currentPlatform,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
LocationPermissions().locationPermissions();
|
|
||||||
|
await FirebasMessagesController().requestFirebaseMessagingPermission();
|
||||||
|
// await FirebasMessagesController().getNotificationSettings();
|
||||||
FirebasMessagesController().getToken();
|
FirebasMessagesController().getToken();
|
||||||
await FirebasMessagesController().getTokens();
|
await FirebasMessagesController().getTokens();
|
||||||
|
LocationPermissions().locationPermissions();
|
||||||
FirebaseMessaging.onBackgroundMessage(backgroundMessageHandler);
|
FirebaseMessaging.onBackgroundMessage(backgroundMessageHandler);
|
||||||
FirebasMessagesController().requestPermission();
|
|
||||||
FirebasMessagesController().getNotificationSettings();
|
|
||||||
|
|
||||||
runApp(const MyApp());
|
runApp(const MyApp());
|
||||||
}
|
}
|
||||||
@@ -57,7 +58,7 @@ class MyApp extends StatelessWidget {
|
|||||||
LocaleController controller = Get.put(LocaleController());
|
LocaleController controller = Get.put(LocaleController());
|
||||||
|
|
||||||
return GetMaterialApp(
|
return GetMaterialApp(
|
||||||
title: 'Ride',
|
title: 'Sefer',
|
||||||
translations: MyTranslation(),
|
translations: MyTranslation(),
|
||||||
debugShowCheckedModeBanner: false,
|
debugShowCheckedModeBanner: false,
|
||||||
locale: controller.language,
|
locale: controller.language,
|
||||||
|
|||||||
@@ -49,8 +49,9 @@ class MapPage extends StatelessWidget {
|
|||||||
'${argument.latitude.toString()},${argument.longitude.toString()}');
|
'${argument.latitude.toString()},${argument.longitude.toString()}');
|
||||||
|
|
||||||
Get.back();
|
Get.back();
|
||||||
controller.changeButtomSheetShown();
|
|
||||||
controller.bottomSheet();
|
controller.bottomSheet();
|
||||||
|
controller.showBottomSheet1();
|
||||||
|
//
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
@@ -69,6 +70,7 @@ class MapPage extends StatelessWidget {
|
|||||||
for (var carLocation
|
for (var carLocation
|
||||||
in controller.carsLocationByPassenger)
|
in controller.carsLocationByPassenger)
|
||||||
Marker(
|
Marker(
|
||||||
|
// anchor: const Offset(4, 4),
|
||||||
position: carLocation,
|
position: carLocation,
|
||||||
icon: controller.carIcon,
|
icon: controller.carIcon,
|
||||||
markerId: MarkerId(carLocation.toString())),
|
markerId: MarkerId(carLocation.toString())),
|
||||||
@@ -149,7 +151,10 @@ class MapPage extends StatelessWidget {
|
|||||||
top: 80,
|
top: 80,
|
||||||
left: 6,
|
left: 6,
|
||||||
child: IconButton(
|
child: IconButton(
|
||||||
onPressed: () => controller.changeMapType(),
|
onPressed: () {
|
||||||
|
controller.changeMapType();
|
||||||
|
controller.reloadMarkers();
|
||||||
|
},
|
||||||
icon: const Icon(
|
icon: const Icon(
|
||||||
Icons.satellite_alt,
|
Icons.satellite_alt,
|
||||||
size: 35,
|
size: 35,
|
||||||
@@ -158,7 +163,7 @@ class MapPage extends StatelessWidget {
|
|||||||
),
|
),
|
||||||
const PickerIconOnMap(),
|
const PickerIconOnMap(),
|
||||||
// PickerAnimtionContainerFormPlaces(),
|
// PickerAnimtionContainerFormPlaces(),
|
||||||
MainBottomMenuMap(),
|
const MainBottomMenuMap(),
|
||||||
const MapMenuWidget(),
|
const MapMenuWidget(),
|
||||||
const MenuIconMapPageWidget(),
|
const MenuIconMapPageWidget(),
|
||||||
buttomSheetMapPage(),
|
buttomSheetMapPage(),
|
||||||
@@ -178,8 +183,8 @@ class MapPage extends StatelessWidget {
|
|||||||
),
|
),
|
||||||
))
|
))
|
||||||
: const SizedBox()),
|
: const SizedBox()),
|
||||||
CashConfirmPageShown(),
|
const CashConfirmPageShown(),
|
||||||
PaymentMethodPage()
|
const PaymentMethodPage()
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -63,15 +63,16 @@ GetBuilder<MapController> formSearchPlaces() {
|
|||||||
title: 'Confirm'.tr,
|
title: 'Confirm'.tr,
|
||||||
onPressed: () {
|
onPressed: () {
|
||||||
controller.clearpolyline();
|
controller.clearpolyline();
|
||||||
|
controller.data = [];
|
||||||
controller.getMap(
|
controller.getMap(
|
||||||
'${controller.mylocation.latitude.toString()},${controller.mylocation.longitude.toString()}',
|
'${controller.mylocation.latitude.toString()},${controller.mylocation.longitude.toString()}',
|
||||||
"${res['geometry']['location']['lat']},${res['geometry']['location']['lng']}");
|
"${res['geometry']['location']['lat']},${res['geometry']['location']['lng']}");
|
||||||
controller.places = [];
|
controller.places = [];
|
||||||
controller.placeController.clear();
|
controller.placeController.clear();
|
||||||
|
|
||||||
|
controller.showBottomSheet1();
|
||||||
Get.back();
|
Get.back();
|
||||||
controller.changeButtomSheetShown();
|
controller.showBottomSheet1();
|
||||||
controller.bottomSheet();
|
|
||||||
controller.changeMainBottomMenuMap();
|
controller.changeMainBottomMenuMap();
|
||||||
}),
|
}),
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -61,31 +61,43 @@ class MainBottomMenuMap extends StatelessWidget {
|
|||||||
Radius.elliptical(15, 30),
|
Radius.elliptical(15, 30),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
child: DefaultTextStyle(
|
child: GestureDetector(
|
||||||
style: AppStyle.title,
|
onTap: () => controller.changeMainBottomMenuMap(),
|
||||||
child: Center(
|
child: DefaultTextStyle(
|
||||||
child: AnimatedTextKit(
|
style: AppStyle.title,
|
||||||
animatedTexts: [
|
child: Center(
|
||||||
ScaleAnimatedText(
|
child: Column(
|
||||||
'${'Where to'.tr} ${box.read(BoxName.name)}'),
|
children: [
|
||||||
WavyAnimatedText(
|
SizedBox(
|
||||||
'${'Where to'.tr} ${box.read(BoxName.name)}'),
|
height: 30,
|
||||||
FlickerAnimatedText(
|
child: AnimatedTextKit(
|
||||||
'${'Where to'.tr} ${box.read(BoxName.name)}'),
|
animatedTexts: [
|
||||||
WavyAnimatedText(
|
ScaleAnimatedText(
|
||||||
'${'Where to'.tr} ${box.read(BoxName.name)}'),
|
'${'Where to'.tr} ${box.read(BoxName.name)}'),
|
||||||
],
|
// WavyAnimatedText(
|
||||||
isRepeatingAnimation: true,
|
// '${'Where to'.tr} ${box.read(BoxName.name)}'),
|
||||||
onTap: () {
|
// FlickerAnimatedText(
|
||||||
print("Tap Event");
|
// '${'Where to'.tr} ${box.read(BoxName.name)}'),
|
||||||
controller.changeMainBottomMenuMap();
|
// WavyAnimatedText(
|
||||||
},
|
// '${'Where to'.tr} ${box.read(BoxName.name)}'),
|
||||||
|
],
|
||||||
|
isRepeatingAnimation: true,
|
||||||
|
onTap: () {
|
||||||
|
print("Tap Event");
|
||||||
|
},
|
||||||
|
),
|
||||||
|
),
|
||||||
|
Text('Nearst Car for you about '.tr +
|
||||||
|
controller.nearestCar!.duration
|
||||||
|
.toString())
|
||||||
|
],
|
||||||
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
)),
|
)),
|
||||||
),
|
),
|
||||||
controller.isMainBottomMenuMap
|
controller.isMainBottomMenuMap
|
||||||
? FavioratePlacesDialogu()
|
? const FavioratePlacesDialogu()
|
||||||
: const SizedBox(),
|
: const SizedBox(),
|
||||||
controller.isMainBottomMenuMap
|
controller.isMainBottomMenuMap
|
||||||
? const SizedBox()
|
? const SizedBox()
|
||||||
@@ -121,9 +133,9 @@ class FavioratePlacesDialogu extends StatelessWidget {
|
|||||||
ScaleAnimatedText(
|
ScaleAnimatedText(
|
||||||
'Favorite Places'.tr,
|
'Favorite Places'.tr,
|
||||||
),
|
),
|
||||||
TyperAnimatedText(
|
// TyperAnimatedText(
|
||||||
'Favorite Places'.tr,
|
// 'Favorite Places'.tr,
|
||||||
),
|
// ),
|
||||||
],
|
],
|
||||||
isRepeatingAnimation: true,
|
isRepeatingAnimation: true,
|
||||||
onTap: () async {
|
onTap: () async {
|
||||||
@@ -165,10 +177,10 @@ class FavioratePlacesDialogu extends StatelessWidget {
|
|||||||
'${controller.mylocation.latitude},${controller.mylocation.longitude}',
|
'${controller.mylocation.latitude},${controller.mylocation.longitude}',
|
||||||
'${favoritePlaces[index]['latitude']},${favoritePlaces[index]['longitude']}',
|
'${favoritePlaces[index]['latitude']},${favoritePlaces[index]['longitude']}',
|
||||||
);
|
);
|
||||||
controller.changePickerShown();
|
// controller.changePickerShown();
|
||||||
controller.changeButtomSheetShown();
|
controller.showBottomSheet1();
|
||||||
controller.bottomSheet();
|
|
||||||
Get.back();
|
Get.back();
|
||||||
|
controller.showBottomSheet1();
|
||||||
},
|
},
|
||||||
child: Text(
|
child: Text(
|
||||||
favoritePlaces[index]['name'],
|
favoritePlaces[index]['name'],
|
||||||
|
|||||||
@@ -9,6 +9,7 @@ import firebase_core
|
|||||||
import firebase_messaging
|
import firebase_messaging
|
||||||
import flutter_local_notifications
|
import flutter_local_notifications
|
||||||
import flutter_secure_storage_macos
|
import flutter_secure_storage_macos
|
||||||
|
import geolocator_apple
|
||||||
import location
|
import location
|
||||||
import path_provider_foundation
|
import path_provider_foundation
|
||||||
import sqflite
|
import sqflite
|
||||||
@@ -19,6 +20,7 @@ func RegisterGeneratedPlugins(registry: FlutterPluginRegistry) {
|
|||||||
FLTFirebaseMessagingPlugin.register(with: registry.registrar(forPlugin: "FLTFirebaseMessagingPlugin"))
|
FLTFirebaseMessagingPlugin.register(with: registry.registrar(forPlugin: "FLTFirebaseMessagingPlugin"))
|
||||||
FlutterLocalNotificationsPlugin.register(with: registry.registrar(forPlugin: "FlutterLocalNotificationsPlugin"))
|
FlutterLocalNotificationsPlugin.register(with: registry.registrar(forPlugin: "FlutterLocalNotificationsPlugin"))
|
||||||
FlutterSecureStoragePlugin.register(with: registry.registrar(forPlugin: "FlutterSecureStoragePlugin"))
|
FlutterSecureStoragePlugin.register(with: registry.registrar(forPlugin: "FlutterSecureStoragePlugin"))
|
||||||
|
GeolocatorPlugin.register(with: registry.registrar(forPlugin: "GeolocatorPlugin"))
|
||||||
LocationPlugin.register(with: registry.registrar(forPlugin: "LocationPlugin"))
|
LocationPlugin.register(with: registry.registrar(forPlugin: "LocationPlugin"))
|
||||||
PathProviderPlugin.register(with: registry.registrar(forPlugin: "PathProviderPlugin"))
|
PathProviderPlugin.register(with: registry.registrar(forPlugin: "PathProviderPlugin"))
|
||||||
SqflitePlugin.register(with: registry.registrar(forPlugin: "SqflitePlugin"))
|
SqflitePlugin.register(with: registry.registrar(forPlugin: "SqflitePlugin"))
|
||||||
|
|||||||
56
pubspec.lock
@@ -296,6 +296,54 @@ packages:
|
|||||||
description: flutter
|
description: flutter
|
||||||
source: sdk
|
source: sdk
|
||||||
version: "0.0.0"
|
version: "0.0.0"
|
||||||
|
geolocator:
|
||||||
|
dependency: "direct main"
|
||||||
|
description:
|
||||||
|
name: geolocator
|
||||||
|
sha256: "9d6eff112971b9f195271834b390fc0e1899a9a6c96225ead72efd5d4aaa80c7"
|
||||||
|
url: "https://pub.dev"
|
||||||
|
source: hosted
|
||||||
|
version: "10.0.0"
|
||||||
|
geolocator_android:
|
||||||
|
dependency: transitive
|
||||||
|
description:
|
||||||
|
name: geolocator_android
|
||||||
|
sha256: "835ff5b4888a2f8eba128996494faf9c5d422785322a81dc0565b99e0f6c379d"
|
||||||
|
url: "https://pub.dev"
|
||||||
|
source: hosted
|
||||||
|
version: "4.2.2"
|
||||||
|
geolocator_apple:
|
||||||
|
dependency: transitive
|
||||||
|
description:
|
||||||
|
name: geolocator_apple
|
||||||
|
sha256: "36527c555f4c425f7d8fa8c7c07d67b78e3ff7590d40448051959e1860c1cfb4"
|
||||||
|
url: "https://pub.dev"
|
||||||
|
source: hosted
|
||||||
|
version: "2.2.7"
|
||||||
|
geolocator_platform_interface:
|
||||||
|
dependency: transitive
|
||||||
|
description:
|
||||||
|
name: geolocator_platform_interface
|
||||||
|
sha256: af4d69231452f9620718588f41acc4cb58312368716bfff2e92e770b46ce6386
|
||||||
|
url: "https://pub.dev"
|
||||||
|
source: hosted
|
||||||
|
version: "4.0.7"
|
||||||
|
geolocator_web:
|
||||||
|
dependency: transitive
|
||||||
|
description:
|
||||||
|
name: geolocator_web
|
||||||
|
sha256: f68a122da48fcfff68bbc9846bb0b74ef651afe84a1b1f6ec20939de4d6860e1
|
||||||
|
url: "https://pub.dev"
|
||||||
|
source: hosted
|
||||||
|
version: "2.1.6"
|
||||||
|
geolocator_windows:
|
||||||
|
dependency: transitive
|
||||||
|
description:
|
||||||
|
name: geolocator_windows
|
||||||
|
sha256: "463045515b08bd83f73e014359c4ad063b902eb3899952cfb784497ae6c6583b"
|
||||||
|
url: "https://pub.dev"
|
||||||
|
source: hosted
|
||||||
|
version: "0.2.0"
|
||||||
get:
|
get:
|
||||||
dependency: "direct main"
|
dependency: "direct main"
|
||||||
description:
|
description:
|
||||||
@@ -805,6 +853,14 @@ packages:
|
|||||||
url: "https://pub.dev"
|
url: "https://pub.dev"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "3.0.7"
|
version: "3.0.7"
|
||||||
|
uuid:
|
||||||
|
dependency: transitive
|
||||||
|
description:
|
||||||
|
name: uuid
|
||||||
|
sha256: "648e103079f7c64a36dc7d39369cabb358d377078a051d6ae2ad3aa539519313"
|
||||||
|
url: "https://pub.dev"
|
||||||
|
source: hosted
|
||||||
|
version: "3.0.7"
|
||||||
vector_math:
|
vector_math:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
|
|||||||
@@ -55,6 +55,7 @@ dependencies:
|
|||||||
animated_text_kit: ^4.2.2
|
animated_text_kit: ^4.2.2
|
||||||
flutter_secure_storage: ^8.0.0
|
flutter_secure_storage: ^8.0.0
|
||||||
credit_card_scanner: ^1.0.5
|
credit_card_scanner: ^1.0.5
|
||||||
|
geolocator: ^10.0.0
|
||||||
|
|
||||||
dev_dependencies:
|
dev_dependencies:
|
||||||
flutter_test:
|
flutter_test:
|
||||||
|
|||||||
@@ -8,6 +8,7 @@
|
|||||||
|
|
||||||
#include <firebase_core/firebase_core_plugin_c_api.h>
|
#include <firebase_core/firebase_core_plugin_c_api.h>
|
||||||
#include <flutter_secure_storage_windows/flutter_secure_storage_windows_plugin.h>
|
#include <flutter_secure_storage_windows/flutter_secure_storage_windows_plugin.h>
|
||||||
|
#include <geolocator_windows/geolocator_windows.h>
|
||||||
#include <url_launcher_windows/url_launcher_windows.h>
|
#include <url_launcher_windows/url_launcher_windows.h>
|
||||||
|
|
||||||
void RegisterPlugins(flutter::PluginRegistry* registry) {
|
void RegisterPlugins(flutter::PluginRegistry* registry) {
|
||||||
@@ -15,6 +16,8 @@ void RegisterPlugins(flutter::PluginRegistry* registry) {
|
|||||||
registry->GetRegistrarForPlugin("FirebaseCorePluginCApi"));
|
registry->GetRegistrarForPlugin("FirebaseCorePluginCApi"));
|
||||||
FlutterSecureStorageWindowsPluginRegisterWithRegistrar(
|
FlutterSecureStorageWindowsPluginRegisterWithRegistrar(
|
||||||
registry->GetRegistrarForPlugin("FlutterSecureStorageWindowsPlugin"));
|
registry->GetRegistrarForPlugin("FlutterSecureStorageWindowsPlugin"));
|
||||||
|
GeolocatorWindowsRegisterWithRegistrar(
|
||||||
|
registry->GetRegistrarForPlugin("GeolocatorWindows"));
|
||||||
UrlLauncherWindowsRegisterWithRegistrar(
|
UrlLauncherWindowsRegisterWithRegistrar(
|
||||||
registry->GetRegistrarForPlugin("UrlLauncherWindows"));
|
registry->GetRegistrarForPlugin("UrlLauncherWindows"));
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,6 +5,7 @@
|
|||||||
list(APPEND FLUTTER_PLUGIN_LIST
|
list(APPEND FLUTTER_PLUGIN_LIST
|
||||||
firebase_core
|
firebase_core
|
||||||
flutter_secure_storage_windows
|
flutter_secure_storage_windows
|
||||||
|
geolocator_windows
|
||||||
url_launcher_windows
|
url_launcher_windows
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
@@ -31,6 +31,11 @@ bool FlutterWindow::OnCreate() {
|
|||||||
this->Show();
|
this->Show();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// Flutter can complete the first frame before the "show window" callback is
|
||||||
|
// registered. The following call ensures a frame is pending to ensure the
|
||||||
|
// window is shown. It is a no-op if the first frame hasn't completed yet.
|
||||||
|
flutter_controller_->ForceRedraw();
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
BIN
windows/runner/resources/playstore.png
Normal file
|
After Width: | Height: | Size: 32 KiB |