1/25/1
This commit is contained in:
@@ -271,11 +271,7 @@ class FirebaseMessagesController extends GetxController {
|
||||
'notification': <String, dynamic>{
|
||||
'title': title,
|
||||
'body': body,
|
||||
<<<<<<< HEAD
|
||||
'sound': 'tone2.wav'
|
||||
=======
|
||||
'sound': 'tone2.wav'
|
||||
>>>>>>> 158d5dfb356420937651bcd4d22a779f03a12e07
|
||||
},
|
||||
'data': {
|
||||
'passengerList': map,
|
||||
@@ -312,11 +308,7 @@ class FirebaseMessagesController extends GetxController {
|
||||
'notification': <String, dynamic>{
|
||||
'title': title,
|
||||
'body': body,
|
||||
<<<<<<< HEAD
|
||||
'sound': 'tone2.wav'
|
||||
=======
|
||||
'sound': 'tone2.wav'
|
||||
>>>>>>> 158d5dfb356420937651bcd4d22a779f03a12e07
|
||||
},
|
||||
'data': <String, dynamic>{
|
||||
'click_action': 'FLUTTER_NOTIFICATION_CLICK',
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
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))) {
|
||||
launchUrl(Uri.parse(url));
|
||||
} else {
|
||||
@@ -12,22 +13,53 @@ void launchCommunication(
|
||||
String method, String contactInfo, String message) async {
|
||||
String url;
|
||||
|
||||
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('Invalid communication method');
|
||||
return;
|
||||
if (Platform.isIOS) {
|
||||
switch (method) {
|
||||
case 'phone':
|
||||
url = 'tel:$contactInfo';
|
||||
break;
|
||||
|
||||
case 'sms':
|
||||
url = 'sms:$contactInfo?body=$message';
|
||||
break;
|
||||
|
||||
case 'whatsapp':
|
||||
url = 'https://api.whatsapp.com/send?phone=$contactInfo&text=$message';
|
||||
break;
|
||||
|
||||
case 'email':
|
||||
url = 'mailto:$contactInfo?subject=Subject&body=$message';
|
||||
break;
|
||||
|
||||
default:
|
||||
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;
|
||||
}
|
||||
|
||||
if (await canLaunchUrl(Uri.parse(url))) {
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import 'dart:async';
|
||||
import 'dart:convert';
|
||||
import 'dart:io';
|
||||
import 'dart:math' show cos;
|
||||
import 'package:flutter/material.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/views/home/map_page_passenger.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/box_name.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 {
|
||||
for (int i = 0; i <= durationToRide; i++) {
|
||||
await Future.delayed(const Duration(seconds: 1));
|
||||
@@ -962,12 +983,12 @@ class MapPassengerController extends GetxController {
|
||||
// int waypointsLength = Get.find<WayPointController>().wayPoints.length;
|
||||
|
||||
print('isWayPointStopsSheet $wayPointIndex');
|
||||
if (wayPointIndex > 1) {
|
||||
if (wayPointIndex > -1) {
|
||||
isWayPointStopsSheet = true;
|
||||
isWayPointStopsSheetUtilGetMap = true;
|
||||
}
|
||||
isWayPointStopsSheet = !isWayPointStopsSheet;
|
||||
wayPointSheetHeight = isWayPointStopsSheet == false ? 0 : Get.height * .45;
|
||||
wayPointSheetHeight = isWayPointStopsSheet ? Get.height * .45 : 0;
|
||||
// if (heightMenuBool == true) {
|
||||
// getDrawerMenu();
|
||||
// }
|
||||
@@ -1416,26 +1437,26 @@ class MapPassengerController extends GetxController {
|
||||
|
||||
// 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
|
||||
if (distanceOfDestnation <= 5) {
|
||||
if (distanceOfTrip <= 5) {
|
||||
mapController!
|
||||
.animateCamera(CameraUpdate.newLatLngZoom(newStartPointLocation, 14));
|
||||
} else if (distanceOfDestnation > 5 && distanceOfDestnation <= 8) {
|
||||
} else if (distanceOfTrip > 5 && distanceOfTrip <= 8) {
|
||||
mapController!
|
||||
.animateCamera(CameraUpdate.newLatLngZoom(newStartPointLocation, 13));
|
||||
} else if (distanceOfDestnation > 8 && distanceOfDestnation < 16) {
|
||||
.animateCamera(CameraUpdate.newLatLngZoom(newStartPointLocation, 16));
|
||||
} else if (distanceOfTrip > 8 && distanceOfTrip < 16) {
|
||||
mapController!
|
||||
.animateCamera(CameraUpdate.newLatLngZoom(newStartPointLocation, 12));
|
||||
} else if (distanceOfDestnation >= 16 && distanceOfDestnation < 30) {
|
||||
} else if (distanceOfTrip >= 16 && distanceOfTrip < 30) {
|
||||
mapController!
|
||||
.animateCamera(CameraUpdate.newLatLngZoom(newStartPointLocation, 11));
|
||||
} else if (distanceOfDestnation >= 30 && distanceOfDestnation < 100) {
|
||||
} else if (distanceOfTrip >= 30 && distanceOfTrip < 100) {
|
||||
mapController!
|
||||
.animateCamera(CameraUpdate.newLatLngZoom(newStartPointLocation, 10));
|
||||
} else if (distanceOfDestnation >= 100) {
|
||||
} else if (distanceOfTrip >= 100) {
|
||||
mapController!
|
||||
.animateCamera(CameraUpdate.newLatLngZoom(newStartPointLocation, 7));
|
||||
}
|
||||
@@ -1476,9 +1497,9 @@ class MapPassengerController extends GetxController {
|
||||
durationToRide = durationToRide + durationToRide0;
|
||||
print('durationToRide is ${data[0]['duration']['value']}');
|
||||
print('totalStepDurations is $durationToRide');
|
||||
double distanceToRide0 = (data[0]['distance']['value']) / 1000;
|
||||
distanceOfDestnation = distanceOfDestnation + distanceToRide0;
|
||||
print('distanceToRide is $distanceToRide0');
|
||||
print('distanceToRide is ${(data[0]['distance']['value']) / 1000}');
|
||||
distance = distanceOfDestnation + (data[0]['distance']['value']) / 1000;
|
||||
|
||||
print('totalStepdistance is $distanceOfDestnation');
|
||||
update();
|
||||
final points =
|
||||
@@ -1596,11 +1617,11 @@ class MapPassengerController extends GetxController {
|
||||
Future bottomSheet() async {
|
||||
if (data.isNotEmpty) {
|
||||
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);
|
||||
duration = getDistanceFromText(durationText);
|
||||
// distance = getDistanceFromText(distanceText);
|
||||
// duration = getDistanceFromText(durationText);
|
||||
durationToAdd = Duration(seconds: durationToRide);
|
||||
print('durationToRide----- $durationToRide');
|
||||
hours = durationToAdd.inHours;
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:ride/constant/style.dart';
|
||||
|
||||
import '../../constant/colors.dart';
|
||||
|
||||
@@ -25,6 +26,29 @@ ThemeData themeEnglish = ThemeData(
|
||||
bodyMedium:
|
||||
TextStyle(height: 2, color: AppColor.accentColor, fontSize: 14)),
|
||||
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(
|
||||
|
||||
@@ -36,7 +36,7 @@ class HistoryDetailsPage extends StatelessWidget {
|
||||
String mapUrl =
|
||||
'https://www.google.com/maps/dir/${res['start_location']}/${res['end_location']}/';
|
||||
print(mapUrl);
|
||||
launchUrl1(mapUrl);
|
||||
showInBrowser(mapUrl);
|
||||
},
|
||||
child: Text(
|
||||
'Trip on Map Click here'.tr,
|
||||
|
||||
@@ -42,7 +42,7 @@ class OrderRequestPage extends StatelessWidget {
|
||||
String mapUrl =
|
||||
'https://www.google.com/maps/dir/${myList[0]}/${myList[1]}/';
|
||||
print(mapUrl);
|
||||
launchUrl1(mapUrl);
|
||||
showInBrowser(mapUrl);
|
||||
},
|
||||
icon: const Icon(Icons.map),
|
||||
label: myList[20].toString() == 'haveSteps'
|
||||
|
||||
@@ -81,7 +81,7 @@ GetBuilder<MapPassengerController> buttomSheetMapPage() {
|
||||
style: AppStyle.subtitle,
|
||||
),
|
||||
Text(
|
||||
'${'You trip distance is'.tr} ${controller.distance} KM',
|
||||
'${'Your trip distance is'.tr} ${controller.distance.toStringAsFixed(2)} KM',
|
||||
style: AppStyle.subtitle,
|
||||
)
|
||||
],
|
||||
|
||||
@@ -39,6 +39,7 @@ class RideBeginPassenger extends StatelessWidget {
|
||||
),
|
||||
Stack(
|
||||
children: [
|
||||
// StreamCounter(),
|
||||
LinearProgressIndicator(
|
||||
backgroundColor: AppColor.accentColor,
|
||||
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 =
|
||||
'https://www.google.com/maps/dir/${rides['start_location']}/${rides['end_location']}/';
|
||||
// print(mapUrl);
|
||||
launchUrl1(mapUrl);
|
||||
showInBrowser(mapUrl);
|
||||
},
|
||||
child: Text(
|
||||
'Click here to Show it in Map',
|
||||
|
||||
Reference in New Issue
Block a user