1/25/1
This commit is contained in:
@@ -271,11 +271,7 @@ class FirebaseMessagesController extends GetxController {
|
|||||||
'notification': <String, dynamic>{
|
'notification': <String, dynamic>{
|
||||||
'title': title,
|
'title': title,
|
||||||
'body': body,
|
'body': body,
|
||||||
<<<<<<< HEAD
|
|
||||||
'sound': 'tone2.wav'
|
'sound': 'tone2.wav'
|
||||||
=======
|
|
||||||
'sound': 'tone2.wav'
|
|
||||||
>>>>>>> 158d5dfb356420937651bcd4d22a779f03a12e07
|
|
||||||
},
|
},
|
||||||
'data': {
|
'data': {
|
||||||
'passengerList': map,
|
'passengerList': map,
|
||||||
@@ -312,11 +308,7 @@ class FirebaseMessagesController extends GetxController {
|
|||||||
'notification': <String, dynamic>{
|
'notification': <String, dynamic>{
|
||||||
'title': title,
|
'title': title,
|
||||||
'body': body,
|
'body': body,
|
||||||
<<<<<<< HEAD
|
|
||||||
'sound': 'tone2.wav'
|
'sound': 'tone2.wav'
|
||||||
=======
|
|
||||||
'sound': 'tone2.wav'
|
|
||||||
>>>>>>> 158d5dfb356420937651bcd4d22a779f03a12e07
|
|
||||||
},
|
},
|
||||||
'data': <String, dynamic>{
|
'data': <String, dynamic>{
|
||||||
'click_action': 'FLUTTER_NOTIFICATION_CLICK',
|
'click_action': 'FLUTTER_NOTIFICATION_CLICK',
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
import 'package:url_launcher/url_launcher.dart';
|
import 'package:url_launcher/url_launcher.dart';
|
||||||
|
import 'dart:io';
|
||||||
|
|
||||||
void launchUrl1(String url) async {
|
void showInBrowser(String url) async {
|
||||||
if (await canLaunchUrl(Uri.parse(url))) {
|
if (await canLaunchUrl(Uri.parse(url))) {
|
||||||
launchUrl(Uri.parse(url));
|
launchUrl(Uri.parse(url));
|
||||||
} else {
|
} else {
|
||||||
@@ -12,21 +13,52 @@ void launchCommunication(
|
|||||||
String method, String contactInfo, String message) async {
|
String method, String contactInfo, String message) async {
|
||||||
String url;
|
String url;
|
||||||
|
|
||||||
|
if (Platform.isIOS) {
|
||||||
switch (method) {
|
switch (method) {
|
||||||
case 'phone':
|
case 'phone':
|
||||||
url = 'tel:$contactInfo';
|
url = 'tel:$contactInfo';
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'sms':
|
case 'sms':
|
||||||
url = 'sms:$contactInfo?body=$message';
|
url = 'sms:$contactInfo?body=$message';
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'whatsapp':
|
case 'whatsapp':
|
||||||
url = 'whatsapp://send?phone=$contactInfo&text=$message';
|
url = 'https://api.whatsapp.com/send?phone=$contactInfo&text=$message';
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'email':
|
case 'email':
|
||||||
url = 'mailto:$contactInfo?subject=Subject&body=$message';
|
url = 'mailto:$contactInfo?subject=Subject&body=$message';
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
print('Invalid communication method');
|
print('Method not supported on iOS');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
} else if (Platform.isAndroid) {
|
||||||
|
switch (method) {
|
||||||
|
case 'phone':
|
||||||
|
url = 'tel:$contactInfo';
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 'sms':
|
||||||
|
url = 'sms:$contactInfo?body=$message';
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 'whatsapp':
|
||||||
|
url = 'whatsapp://send?phone=$contactInfo&text=$message';
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 'email':
|
||||||
|
url = 'mailto:$contactInfo?subject=Subject&body=$message';
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
print('Method not supported on Android');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
print('Platform not supported');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
import 'dart:async';
|
import 'dart:async';
|
||||||
import 'dart:convert';
|
import 'dart:convert';
|
||||||
|
import 'dart:io';
|
||||||
import 'dart:math' show cos;
|
import 'dart:math' show cos;
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter/services.dart';
|
import 'package:flutter/services.dart';
|
||||||
@@ -12,6 +13,7 @@ import 'package:ride/constant/style.dart';
|
|||||||
import 'package:ride/controller/home/points_for_rider_controller.dart';
|
import 'package:ride/controller/home/points_for_rider_controller.dart';
|
||||||
import 'package:ride/views/home/map_page_passenger.dart';
|
import 'package:ride/views/home/map_page_passenger.dart';
|
||||||
import 'package:ride/views/home/map_widget.dart/form_serch_multiy_point.dart';
|
import 'package:ride/views/home/map_widget.dart/form_serch_multiy_point.dart';
|
||||||
|
import 'package:url_launcher/url_launcher.dart';
|
||||||
import '../../constant/api_key.dart';
|
import '../../constant/api_key.dart';
|
||||||
import '../../constant/box_name.dart';
|
import '../../constant/box_name.dart';
|
||||||
import '../../constant/info.dart';
|
import '../../constant/info.dart';
|
||||||
@@ -436,6 +438,25 @@ class MapPassengerController extends GetxController {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Create a StreamController to manage the timer values
|
||||||
|
final timerController = StreamController<int>();
|
||||||
|
|
||||||
|
// Start the timer when the ride begins
|
||||||
|
void beginRideTimer() {
|
||||||
|
// Set up the timer to run every second
|
||||||
|
Timer.periodic(const Duration(seconds: 1), (timer) {
|
||||||
|
// Update the timer value and notify listeners
|
||||||
|
timerController.add(timer.tick);
|
||||||
|
update();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
// Stop the timer when the ride ends
|
||||||
|
void stopRideTimer() {
|
||||||
|
timerController.close();
|
||||||
|
update();
|
||||||
|
}
|
||||||
|
|
||||||
void rideIsBeginPassengerTimer() async {
|
void rideIsBeginPassengerTimer() async {
|
||||||
for (int i = 0; i <= durationToRide; i++) {
|
for (int i = 0; i <= durationToRide; i++) {
|
||||||
await Future.delayed(const Duration(seconds: 1));
|
await Future.delayed(const Duration(seconds: 1));
|
||||||
@@ -962,12 +983,12 @@ class MapPassengerController extends GetxController {
|
|||||||
// int waypointsLength = Get.find<WayPointController>().wayPoints.length;
|
// int waypointsLength = Get.find<WayPointController>().wayPoints.length;
|
||||||
|
|
||||||
print('isWayPointStopsSheet $wayPointIndex');
|
print('isWayPointStopsSheet $wayPointIndex');
|
||||||
if (wayPointIndex > 1) {
|
if (wayPointIndex > -1) {
|
||||||
isWayPointStopsSheet = true;
|
isWayPointStopsSheet = true;
|
||||||
isWayPointStopsSheetUtilGetMap = true;
|
isWayPointStopsSheetUtilGetMap = true;
|
||||||
}
|
}
|
||||||
isWayPointStopsSheet = !isWayPointStopsSheet;
|
isWayPointStopsSheet = !isWayPointStopsSheet;
|
||||||
wayPointSheetHeight = isWayPointStopsSheet == false ? 0 : Get.height * .45;
|
wayPointSheetHeight = isWayPointStopsSheet ? Get.height * .45 : 0;
|
||||||
// if (heightMenuBool == true) {
|
// if (heightMenuBool == true) {
|
||||||
// getDrawerMenu();
|
// getDrawerMenu();
|
||||||
// }
|
// }
|
||||||
@@ -1416,26 +1437,26 @@ class MapPassengerController extends GetxController {
|
|||||||
|
|
||||||
// Calculate the zoom level based on the distance and screen size
|
// Calculate the zoom level based on the distance and screen size
|
||||||
|
|
||||||
double distanceOfDestnation =
|
// getDistanceFromText(data[0]['distance']['text']);
|
||||||
getDistanceFromText(data[0]['distance']['text']);
|
double distanceOfTrip = (data[0]['distance']['value']) / 1000;
|
||||||
|
print('distance is $distanceOfTrip');
|
||||||
// Animate the camera to the adjusted bounds
|
// Animate the camera to the adjusted bounds
|
||||||
if (distanceOfDestnation <= 5) {
|
if (distanceOfTrip <= 5) {
|
||||||
mapController!
|
mapController!
|
||||||
.animateCamera(CameraUpdate.newLatLngZoom(newStartPointLocation, 14));
|
.animateCamera(CameraUpdate.newLatLngZoom(newStartPointLocation, 14));
|
||||||
} else if (distanceOfDestnation > 5 && distanceOfDestnation <= 8) {
|
} else if (distanceOfTrip > 5 && distanceOfTrip <= 8) {
|
||||||
mapController!
|
mapController!
|
||||||
.animateCamera(CameraUpdate.newLatLngZoom(newStartPointLocation, 13));
|
.animateCamera(CameraUpdate.newLatLngZoom(newStartPointLocation, 16));
|
||||||
} else if (distanceOfDestnation > 8 && distanceOfDestnation < 16) {
|
} else if (distanceOfTrip > 8 && distanceOfTrip < 16) {
|
||||||
mapController!
|
mapController!
|
||||||
.animateCamera(CameraUpdate.newLatLngZoom(newStartPointLocation, 12));
|
.animateCamera(CameraUpdate.newLatLngZoom(newStartPointLocation, 12));
|
||||||
} else if (distanceOfDestnation >= 16 && distanceOfDestnation < 30) {
|
} else if (distanceOfTrip >= 16 && distanceOfTrip < 30) {
|
||||||
mapController!
|
mapController!
|
||||||
.animateCamera(CameraUpdate.newLatLngZoom(newStartPointLocation, 11));
|
.animateCamera(CameraUpdate.newLatLngZoom(newStartPointLocation, 11));
|
||||||
} else if (distanceOfDestnation >= 30 && distanceOfDestnation < 100) {
|
} else if (distanceOfTrip >= 30 && distanceOfTrip < 100) {
|
||||||
mapController!
|
mapController!
|
||||||
.animateCamera(CameraUpdate.newLatLngZoom(newStartPointLocation, 10));
|
.animateCamera(CameraUpdate.newLatLngZoom(newStartPointLocation, 10));
|
||||||
} else if (distanceOfDestnation >= 100) {
|
} else if (distanceOfTrip >= 100) {
|
||||||
mapController!
|
mapController!
|
||||||
.animateCamera(CameraUpdate.newLatLngZoom(newStartPointLocation, 7));
|
.animateCamera(CameraUpdate.newLatLngZoom(newStartPointLocation, 7));
|
||||||
}
|
}
|
||||||
@@ -1476,9 +1497,9 @@ class MapPassengerController extends GetxController {
|
|||||||
durationToRide = durationToRide + durationToRide0;
|
durationToRide = durationToRide + durationToRide0;
|
||||||
print('durationToRide is ${data[0]['duration']['value']}');
|
print('durationToRide is ${data[0]['duration']['value']}');
|
||||||
print('totalStepDurations is $durationToRide');
|
print('totalStepDurations is $durationToRide');
|
||||||
double distanceToRide0 = (data[0]['distance']['value']) / 1000;
|
print('distanceToRide is ${(data[0]['distance']['value']) / 1000}');
|
||||||
distanceOfDestnation = distanceOfDestnation + distanceToRide0;
|
distance = distanceOfDestnation + (data[0]['distance']['value']) / 1000;
|
||||||
print('distanceToRide is $distanceToRide0');
|
|
||||||
print('totalStepdistance is $distanceOfDestnation');
|
print('totalStepdistance is $distanceOfDestnation');
|
||||||
update();
|
update();
|
||||||
final points =
|
final points =
|
||||||
@@ -1596,11 +1617,11 @@ class MapPassengerController extends GetxController {
|
|||||||
Future bottomSheet() async {
|
Future bottomSheet() async {
|
||||||
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(data[0]['duration']['text']);
|
||||||
print('=================================');
|
print('=================================');
|
||||||
distance = getDistanceFromText(distanceText);
|
// distance = getDistanceFromText(distanceText);
|
||||||
duration = getDistanceFromText(durationText);
|
// duration = getDistanceFromText(durationText);
|
||||||
durationToAdd = Duration(seconds: durationToRide);
|
durationToAdd = Duration(seconds: durationToRide);
|
||||||
print('durationToRide----- $durationToRide');
|
print('durationToRide----- $durationToRide');
|
||||||
hours = durationToAdd.inHours;
|
hours = durationToAdd.inHours;
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:ride/constant/style.dart';
|
||||||
|
|
||||||
import '../../constant/colors.dart';
|
import '../../constant/colors.dart';
|
||||||
|
|
||||||
@@ -25,6 +26,29 @@ ThemeData themeEnglish = ThemeData(
|
|||||||
bodyMedium:
|
bodyMedium:
|
||||||
TextStyle(height: 2, color: AppColor.accentColor, fontSize: 14)),
|
TextStyle(height: 2, color: AppColor.accentColor, fontSize: 14)),
|
||||||
primarySwatch: Colors.blue,
|
primarySwatch: Colors.blue,
|
||||||
|
dialogTheme: DialogTheme(
|
||||||
|
backgroundColor: AppColor.secondaryColor,
|
||||||
|
contentTextStyle: AppStyle.title,
|
||||||
|
titleTextStyle: AppStyle.title,
|
||||||
|
),
|
||||||
|
appBarTheme: AppBarTheme(
|
||||||
|
elevation: 0,
|
||||||
|
color: AppColor.secondaryColor,
|
||||||
|
centerTitle: true,
|
||||||
|
iconTheme: const IconThemeData(
|
||||||
|
color: AppColor.primaryColor,
|
||||||
|
),
|
||||||
|
toolbarTextStyle: TextTheme(
|
||||||
|
titleSmall: AppStyle.subtitle,
|
||||||
|
headlineSmall: AppStyle.title,
|
||||||
|
titleLarge: AppStyle.headTitle2)
|
||||||
|
.bodyMedium,
|
||||||
|
titleTextStyle: TextTheme(
|
||||||
|
titleSmall: AppStyle.subtitle,
|
||||||
|
headlineSmall: AppStyle.title,
|
||||||
|
titleLarge: AppStyle.headTitle2)
|
||||||
|
.titleLarge,
|
||||||
|
),
|
||||||
);
|
);
|
||||||
|
|
||||||
ThemeData themeArabic = ThemeData(
|
ThemeData themeArabic = ThemeData(
|
||||||
|
|||||||
@@ -36,7 +36,7 @@ class HistoryDetailsPage extends StatelessWidget {
|
|||||||
String mapUrl =
|
String mapUrl =
|
||||||
'https://www.google.com/maps/dir/${res['start_location']}/${res['end_location']}/';
|
'https://www.google.com/maps/dir/${res['start_location']}/${res['end_location']}/';
|
||||||
print(mapUrl);
|
print(mapUrl);
|
||||||
launchUrl1(mapUrl);
|
showInBrowser(mapUrl);
|
||||||
},
|
},
|
||||||
child: Text(
|
child: Text(
|
||||||
'Trip on Map Click here'.tr,
|
'Trip on Map Click here'.tr,
|
||||||
|
|||||||
@@ -42,7 +42,7 @@ class OrderRequestPage extends StatelessWidget {
|
|||||||
String mapUrl =
|
String mapUrl =
|
||||||
'https://www.google.com/maps/dir/${myList[0]}/${myList[1]}/';
|
'https://www.google.com/maps/dir/${myList[0]}/${myList[1]}/';
|
||||||
print(mapUrl);
|
print(mapUrl);
|
||||||
launchUrl1(mapUrl);
|
showInBrowser(mapUrl);
|
||||||
},
|
},
|
||||||
icon: const Icon(Icons.map),
|
icon: const Icon(Icons.map),
|
||||||
label: myList[20].toString() == 'haveSteps'
|
label: myList[20].toString() == 'haveSteps'
|
||||||
|
|||||||
@@ -81,7 +81,7 @@ GetBuilder<MapPassengerController> buttomSheetMapPage() {
|
|||||||
style: AppStyle.subtitle,
|
style: AppStyle.subtitle,
|
||||||
),
|
),
|
||||||
Text(
|
Text(
|
||||||
'${'You trip distance is'.tr} ${controller.distance} KM',
|
'${'Your trip distance is'.tr} ${controller.distance.toStringAsFixed(2)} KM',
|
||||||
style: AppStyle.subtitle,
|
style: AppStyle.subtitle,
|
||||||
)
|
)
|
||||||
],
|
],
|
||||||
|
|||||||
@@ -39,6 +39,7 @@ class RideBeginPassenger extends StatelessWidget {
|
|||||||
),
|
),
|
||||||
Stack(
|
Stack(
|
||||||
children: [
|
children: [
|
||||||
|
// StreamCounter(),
|
||||||
LinearProgressIndicator(
|
LinearProgressIndicator(
|
||||||
backgroundColor: AppColor.accentColor,
|
backgroundColor: AppColor.accentColor,
|
||||||
color: controller.remainingTimeTimerRideBegin < 60
|
color: controller.remainingTimeTimerRideBegin < 60
|
||||||
@@ -200,3 +201,39 @@ class RideBeginPassenger extends StatelessWidget {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
class StreamCounter extends StatelessWidget {
|
||||||
|
const StreamCounter({Key? key}) : super(key: key);
|
||||||
|
|
||||||
|
@override
|
||||||
|
// Build the UI based on the timer value
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
Get.put(MapPassengerController());
|
||||||
|
return GetBuilder<MapPassengerController>(builder: (controller) {
|
||||||
|
return StreamBuilder<int>(
|
||||||
|
initialData: 0,
|
||||||
|
stream: controller.timerController.stream,
|
||||||
|
builder: (context, snapshot) {
|
||||||
|
// Calculate the remaining time based on the current tick
|
||||||
|
final remainingTime = controller.durationToRide - snapshot.data!;
|
||||||
|
|
||||||
|
// Format the remaining time as a string
|
||||||
|
final formattedRemainingTime =
|
||||||
|
'${(remainingTime / 60).floor()}:${(remainingTime % 60).toString().padLeft(2, '0')}';
|
||||||
|
|
||||||
|
// Return the UI widgets based on the remaining time
|
||||||
|
return Column(
|
||||||
|
children: [
|
||||||
|
Text(formattedRemainingTime),
|
||||||
|
// ElevatedButton(
|
||||||
|
// onPressed: () {
|
||||||
|
// // Handle button press here
|
||||||
|
// },
|
||||||
|
// ),
|
||||||
|
],
|
||||||
|
);
|
||||||
|
},
|
||||||
|
);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
@@ -59,7 +59,7 @@ class OrderHistory extends StatelessWidget {
|
|||||||
String mapUrl =
|
String mapUrl =
|
||||||
'https://www.google.com/maps/dir/${rides['start_location']}/${rides['end_location']}/';
|
'https://www.google.com/maps/dir/${rides['start_location']}/${rides['end_location']}/';
|
||||||
// print(mapUrl);
|
// print(mapUrl);
|
||||||
launchUrl1(mapUrl);
|
showInBrowser(mapUrl);
|
||||||
},
|
},
|
||||||
child: Text(
|
child: Text(
|
||||||
'Click here to Show it in Map',
|
'Click here to Show it in Map',
|
||||||
|
|||||||
Reference in New Issue
Block a user