This commit is contained in:
Hamza-Ayed
2024-03-21 02:09:52 +03:00
parent ad062d9ad7
commit 045f7e20f0
46 changed files with 2767 additions and 877 deletions

View File

@@ -0,0 +1,284 @@
import 'package:SEFER/constant/colors.dart';
import 'package:SEFER/constant/style.dart';
import 'package:SEFER/controller/home/map_passenger_controller.dart';
import 'package:SEFER/main.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:get/get.dart';
import '../../../constant/box_name.dart';
class ApplyOrderWidget extends StatelessWidget {
const ApplyOrderWidget({super.key});
@override
Widget build(BuildContext context) {
return GetBuilder<MapPassengerController>(builder: (controller) {
if (controller.statusRide == 'Apply') {
double _height = 250;
return Positioned(
bottom: 0,
left: 0,
right: 0,
child: Container(
decoration: AppStyle.boxDecoration1,
height: _height,
child: ListView(
children: [
Text.rich(
TextSpan(
children: [
TextSpan(
text: '${'The driver accept your order for'.tr} ',
style: AppStyle.title,
),
TextSpan(
text: controller.totalPassenger.toStringAsFixed(2),
style: AppStyle.title.copyWith(
fontWeight: FontWeight.bold,
// fontSize: 22,
color: AppColor.redColor,
),
),
TextSpan(
text: ' ${'LE'.tr}',
style: AppStyle.title,
),
],
),
textAlign: TextAlign.center,
),
Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
const SizedBox(
width: 10,
),
Container(
height: 200,
width: Get.width * .9,
decoration: AppStyle.boxDecoration1,
child: Column(
children: [
Row(
mainAxisAlignment: MainAxisAlignment.end,
children: [
Text(
// 'Comfort',
box.read(BoxName.carType
.toString()), //car type fro box after selected
style: AppStyle.title,
),
const SizedBox(
width: 10,
),
],
),
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Image.asset(
'assets/images/blob.png',
width: 100,
),
Column(
children: [
Text(
// 'Toyota Camry',
controller.model.toString(),
style: AppStyle.title,
),
Text(
// 'ر ل 2323',
controller.licensePlate.toString(),
style: AppStyle.title,
),
],
),
Text(
// 'Black',
controller.carColor,
style: AppStyle.title,
),
const SizedBox(
width: 10,
),
],
),
Padding(
padding: const EdgeInsets.symmetric(horizontal: 10),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
CircleAvatar(
radius: 30,
backgroundImage: NetworkImage(
// '',
// ),
'https://ride.mobile-app.store/portrate_captain_image/${controller.driverId}.jpg'),
),
Column(
children: [
Text(
// 'fadi ahmad',
controller.firstName,
style: AppStyle.title,
),
Text(
// '⭐ 4.8',
'${controller.driverRate}',
style: AppStyle.title,
),
],
),
IconButton(
onPressed: () {},
icon: const Icon(
Icons.message,
color: AppColor.blueColor,
size: 35,
),
),
IconButton(
onPressed: () {
HapticFeedback.heavyImpact();
},
icon: const Icon(
Icons.call,
color: AppColor.greenColor,
size: 35,
),
),
],
),
),
controller.isDriverArrivePassenger
? DriverArrivePassengerAndWaitMinute()
: const TimeDriverToPassenger()
],
),
),
const SizedBox(
width: 10,
),
],
)
],
),
),
);
} else {
return const SizedBox();
}
});
}
}
class DriverArrivePassengerAndWaitMinute extends StatelessWidget {
const DriverArrivePassengerAndWaitMinute({
super.key,
});
@override
Widget build(BuildContext context) {
return GetBuilder<MapPassengerController>(builder: (controller) {
return Stack(
children: [
LinearProgressIndicator(
backgroundColor: AppColor.accentColor,
color: controller.remainingTimeDriverWaitPassenger5Minute < 60
? AppColor.redColor
: AppColor.greenColor,
minHeight: 30,
borderRadius: BorderRadius.circular(15),
value:
controller.progressTimerDriverWaitPassenger5Minute.toDouble(),
),
Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Text(
'The driver waitting you in picked location .'.tr,
style: AppStyle.title,
textAlign: TextAlign.center,
),
const SizedBox(
width: 20,
),
Text(
controller.stringRemainingTimeDriverWaitPassenger5Minute,
style: AppStyle.title,
),
],
)
],
);
});
}
}
class TimeDriverToPassenger extends StatelessWidget {
const TimeDriverToPassenger({
super.key,
});
@override
Widget build(BuildContext context) {
return GetBuilder<MapPassengerController>(builder: (controller) {
return controller.isDriverInPassengerWay == false ||
controller.timeToPassengerFromDriverAfterApplied > 0
? Container(
decoration: AppStyle.boxDecoration1,
child: Padding(
padding: const EdgeInsets.symmetric(horizontal: 4, vertical: 1),
child: Stack(
children: [
Container(
decoration: AppStyle.boxDecoration1,
width: Get.width * .7,
height: 35,
// color: AppColor.yellowColor,
),
Stack(
children: [
LinearProgressIndicator(
backgroundColor: AppColor.accentColor,
color: controller
.remainingTimeToPassengerFromDriverAfterApplied <
60
? AppColor.redColor
: AppColor.greenColor,
minHeight: 25,
borderRadius: BorderRadius.circular(15),
value: controller
.progressTimerToPassengerFromDriverAfterApplied
.toDouble(),
),
Center(
child: Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Text(
'The driver on your way'.tr,
textAlign: TextAlign.center,
),
const SizedBox(
width: 20,
),
Text(
controller.stringRemainingTimeToPassenger,
style: AppStyle.title,
),
],
),
)
],
),
],
),
),
)
: const SizedBox();
});
}
}

View File

@@ -87,7 +87,8 @@ GetBuilder<MapPassengerController> buttomSheetMapPage() {
child: ListView.builder(
scrollDirection: Axis.horizontal,
itemCount: controller
.dataCarsLocationByPassenger.length,
.dataCarsLocationByPassenger.length -
1,
itemBuilder:
(BuildContext context, int index) {
return Container(
@@ -122,8 +123,8 @@ GetBuilder<MapPassengerController> buttomSheetMapPage() {
MainAxisAlignment.spaceEvenly,
children: [
Text(
controller.hours > 1
? '${'Your Ride Duration is '.tr}${controller.hours} H and ${controller.minutes} m'
controller.hours > 0
? '${'Your Ride Duration is '.tr}${controller.hours} ${'H and'.tr} ${controller.minutes} ${'m'.tr}'
: '${'Your Ride Duration is '.tr} ${controller.minutes} m',
style: AppStyle.subtitle,
),
@@ -132,7 +133,7 @@ GetBuilder<MapPassengerController> buttomSheetMapPage() {
// style: AppStyle.subtitle,
// ),
Text(
'${'Your trip distance is'.tr} ${controller.distance.toStringAsFixed(2)} KM',
'${'Your trip distance is'.tr} ${controller.distance.toStringAsFixed(2)} ${'KM'.tr}',
style: AppStyle.subtitle,
)
],
@@ -486,7 +487,7 @@ GetBuilder<MapPassengerController> buttomSheetMapPage() {
.tr,
onPressed: () {
controller
.changeConfirmRide();
.confirmRideForFirstDriver();
},
),
],

View File

@@ -0,0 +1,222 @@
import 'package:SEFER/constant/box_name.dart';
import 'package:SEFER/constant/colors.dart';
import 'package:SEFER/constant/style.dart';
import 'package:SEFER/main.dart';
import 'package:SEFER/views/widgets/elevated_btn.dart';
import 'package:flutter/material.dart';
import 'package:get/get.dart';
import '../../../controller/home/map_passenger_controller.dart';
class CarType {
final String carType;
final String carDetail;
final String image;
bool isSelected = false; // Track selection state
CarType(
{required this.carType, required this.carDetail, required this.image});
}
List<CarType> carTypes = [
CarType(
carType: 'Comfort'.tr,
carDetail: 'Comfort choice'.tr,
image: 'assets/images/blob.png'),
CarType(
carType: 'Speed'.tr,
carDetail: 'Better for long trips choice'.tr,
image: 'assets/images/carspeed.png'),
CarType(
carType: 'Delivery'.tr,
carDetail: 'Delivery service'.tr,
image: 'assets/images/moto.png'),
];
class CarDetailsTypeToChoose extends StatelessWidget {
const CarDetailsTypeToChoose({super.key});
@override
Widget build(BuildContext context) {
return GetBuilder<MapPassengerController>(
builder: (mapPassengerController) {
return mapPassengerController.data.isNotEmpty &&
mapPassengerController.isBottomSheetShown &&
mapPassengerController.rideConfirm == false
? Positioned(
bottom: 0,
left: 5,
right: 5,
child: Container(
decoration: const BoxDecoration(
color: Color.fromARGB(255, 255, 255, 255),
borderRadius: BorderRadius.only(
topLeft: Radius.circular(8),
topRight: Radius.circular(8),
),
),
height: Get.height * .4,
child: Column(
children: [
SizedBox(
height: Get.height * .3,
child: ListView.builder(
itemCount: carTypes.length,
itemBuilder: (context, index) {
final carType = carTypes[index];
return ListTile(
title: Container(
decoration: BoxDecoration(
color: AppColor.secondaryColor,
borderRadius: const BorderRadius.all(
Radius.circular(20)),
boxShadow: [
carType.isSelected
? const BoxShadow(
spreadRadius: 3,
blurStyle: BlurStyle.solid,
color: AppColor.accentColor,
blurRadius: 3,
offset: Offset(1, 3))
: const BoxShadow(),
]),
child: Row(
mainAxisAlignment:
MainAxisAlignment.spaceBetween,
children: [
Image.asset(
carType.image,
width: 60,
height: 60,
),
SizedBox(
width: Get.width * .5,
child: Column(
children: [
Text(
carType.carType,
style: AppStyle.title.copyWith(
fontWeight: FontWeight.bold,
fontSize: 20),
),
Text(
carType.carDetail,
style: AppStyle.subtitle,
),
],
),
),
Column(
children: [
Text(
carType.carType == 'Comfort'
? mapPassengerController
.totalPassengerComfort
.toStringAsFixed(2)
: carType.carType == 'Speed'
? mapPassengerController
.totalPassenger
.toStringAsFixed(2)
: mapPassengerController
.totalPassengerMotoDelivery
.toStringAsFixed(2),
style: AppStyle.title
.copyWith(fontSize: 20),
),
carType.carType == 'Comfort'
? Row(
children: [
Container(
decoration:
const BoxDecoration(
color: AppColor
.greenColor,
borderRadius:
BorderRadius
.all(Radius
.circular(
5))),
child: Text(
'-12%',
style: AppStyle.subtitle
.copyWith(
color: AppColor
.secondaryColor),
)),
const SizedBox(
width: 10,
),
Text(
mapPassengerController
.totalPassengerComfortDiscount
.toStringAsFixed(2),
style:
AppStyle.title.copyWith(
decoration: TextDecoration
.lineThrough, // Strikethrough line
),
)
],
)
: const SizedBox(
width: 3,
),
],
),
const SizedBox(
width: 4,
)
],
),
),
selected: mapPassengerController.selectedIndex ==
index, // Set selected based on index
selectedColor:
Colors.blue, // Color for selected item
onTap: () {
mapPassengerController.selectCarFromList(index);
},
);
},
),
),
MyElevatedButton(
title: 'Next'.tr,
onPressed: () {
if (mapPassengerController.selectedIndex != -1) {
// Get.snackbar('You should select one'.tr, '',
// backgroundColor: AppColor.greenColor);
if (mapPassengerController.selectedIndex == 0) {
box.write(BoxName.carType, 'Comfort');
mapPassengerController.totalPassenger =
mapPassengerController.totalPassengerComfort;
} else if (mapPassengerController.selectedIndex ==
1) {
box.write(BoxName.carType, 'Speed');
} else if (mapPassengerController.selectedIndex ==
2) {
box.write(BoxName.carType, 'Delivery');
mapPassengerController.totalPassenger =
mapPassengerController
.totalPassengerMotoDelivery;
}
mapPassengerController.isBottomSheetShown = false;
mapPassengerController.update();
mapPassengerController.changeCashConfirmPageShown();
// mapPassengerController.confirmRideForFirstDriver();
} else {
Get.snackbar('You should select one'.tr, '',
backgroundColor: AppColor.redColor);
}
})
],
),
),
)
: const SizedBox();
// ;
});
}
}

View File

@@ -102,8 +102,12 @@ class CashConfirmPageShown extends StatelessWidget {
width: 20,
),
InkWell(
onTap: () =>
controller.changeCashConfirmPageShown(),
onTap: () {
controller.changeCashConfirmPageShown();
controller.isSearchingWindow = true;
controller.confirmRideForFirstDriver();
controller.update();
},
child: Text(
'CASH',
style: AppStyle.title,
@@ -161,6 +165,9 @@ class CashConfirmPageShown extends StatelessWidget {
paymentController.isWalletChecked = false;
paymentController.update();
controller.changeCashConfirmPageShown();
controller.isSearchingWindow = true;
controller.confirmRideForFirstDriver();
controller.update();
},
),
],
@@ -169,6 +176,8 @@ class CashConfirmPageShown extends StatelessWidget {
title: 'Next'.tr,
onPressed: () {
controller.changeCashConfirmPageShown();
controller.confirmRideForFirstDriver();
controller.update();
},
), // Add a fallback widget if none of the conditions are met
)

View File

@@ -103,6 +103,12 @@ GetBuilder<MapPassengerController> formSearchPlacesStart() {
// controller.myLocation =
// controller.newStartPointLocation;
// }
await sql.insertData({
'latitude': res['geometry']['location']['lat'],
'longitude': res['geometry']['location']['lng'],
'name': res['name'].toString(),
'rate': res['rating'].toString(),
}, TableName.recentLocations);
controller.convertHintTextStartNewPlaces(index);
controller.currentLocationString = res['name'];

View File

@@ -19,306 +19,321 @@ class GoogleMapPassengerWidget extends StatelessWidget {
return GetBuilder<MapPassengerController>(
builder: (controller) => controller.isLoading
? const MyCircularProgressIndicator()
: GoogleMap(
onMapCreated: controller.onMapCreated,
cameraTargetBounds: CameraTargetBounds(controller.boundsdata),
minMaxZoomPreference: const MinMaxZoomPreference(6, 18),
onLongPress: (argument) {
Get.defaultDialog(
title: 'Are you want to go to this site'.tr,
content: Column(
children: [
Text('${argument.latitude},${argument.longitude}'),
],
),
confirm: MyElevatedButton(
title: 'Ok'.tr,
onPressed: () async {
controller.clearPolyline();
if (controller.dataCarsLocationByPassenger != null) {
await controller.getMap(
'${controller.passengerLocation.latitude},${controller.passengerLocation.longitude}',
'${argument.latitude.toString()},${argument.longitude.toString()}');
: Positioned(
bottom: Get.height * .2,
top: 0,
left: 0,
right: 0,
child: GoogleMap(
onMapCreated: controller.onMapCreated,
cameraTargetBounds: CameraTargetBounds(controller.boundsdata),
minMaxZoomPreference: const MinMaxZoomPreference(6, 18),
onLongPress: (argument) {
Get.defaultDialog(
title: 'Are you want to go to this site'.tr,
content: Column(
children: [
Text('${argument.latitude},${argument.longitude}'),
],
),
confirm: MyElevatedButton(
title: 'Ok'.tr,
onPressed: () async {
controller.clearPolyline();
if (controller.dataCarsLocationByPassenger != null) {
await controller.getMap(
'${controller.passengerLocation.latitude},${controller.passengerLocation.longitude}',
'${argument.latitude.toString()},${argument.longitude.toString()}');
Get.back();
controller.bottomSheet();
controller.showBottomSheet1();
} else {
Get.back();
Get.snackbar(
'We Are Sorry That we dont have cars in your Location!'
.tr,
'',
colorText: AppColor.redColor,
duration: const Duration(seconds: 11),
instantInit: true,
snackPosition: SnackPosition.TOP,
titleText: Text(
'Error'.tr,
style: const TextStyle(color: AppColor.redColor),
),
messageText: Text(
Get.back();
controller.bottomSheet();
controller.showBottomSheet1();
} else {
Get.back();
Get.snackbar(
'We Are Sorry That we dont have cars in your Location!'
.tr,
style: AppStyle.title,
),
icon: const Icon(Icons.error),
shouldIconPulse: true,
maxWidth: double.infinity,
margin: const EdgeInsets.all(16),
padding: const EdgeInsets.all(16),
borderRadius: 8,
borderColor: AppColor.redColor,
borderWidth: 2,
backgroundColor: AppColor.secondaryColor,
leftBarIndicatorColor: AppColor.redColor,
boxShadows: [
BoxShadow(
color: Colors.black.withOpacity(0.25),
blurRadius: 4,
spreadRadius: 2,
offset: const Offset(0, 4),
'',
colorText: AppColor.redColor,
duration: const Duration(seconds: 11),
instantInit: true,
snackPosition: SnackPosition.TOP,
titleText: Text(
'Error'.tr,
style:
const TextStyle(color: AppColor.redColor),
),
],
backgroundGradient: const LinearGradient(
colors: [AppColor.redColor, AppColor.accentColor],
begin: Alignment.topLeft,
end: Alignment.bottomRight,
),
// mainButton: TextButton(
// onPressed: () {
// controller.getCarsLocationByPassenger();
// },
// child: Text(
// 'Try Again'.tr,
// style: const TextStyle(
// color: AppColor.secondaryColor),
// ),
// ),
onTap: (GetSnackBar snackBar) {
// Do something when the snackbar is tapped.
},
isDismissible: true,
showProgressIndicator: false,
dismissDirection: DismissDirection.up,
progressIndicatorController: null,
progressIndicatorBackgroundColor:
Colors.transparent,
progressIndicatorValueColor: null,
snackStyle: SnackStyle.GROUNDED,
forwardAnimationCurve: Curves.easeInToLinear,
reverseAnimationCurve: Curves.easeInOut,
animationDuration:
const Duration(milliseconds: 4000),
barBlur: 8,
overlayBlur: 0,
snackbarStatus: null,
overlayColor:
AppColor.primaryColor.withOpacity(0.5),
userInputForm: null,
);
}
messageText: Text(
'We Are Sorry That we dont have cars in your Location!'
.tr,
style: AppStyle.title,
),
icon: const Icon(Icons.error),
shouldIconPulse: true,
maxWidth: double.infinity,
margin: const EdgeInsets.all(16),
padding: const EdgeInsets.all(16),
borderRadius: 8,
borderColor: AppColor.redColor,
borderWidth: 2,
backgroundColor: AppColor.secondaryColor,
leftBarIndicatorColor: AppColor.redColor,
boxShadows: [
BoxShadow(
color: Colors.black.withOpacity(0.25),
blurRadius: 4,
spreadRadius: 2,
offset: const Offset(0, 4),
),
],
backgroundGradient: const LinearGradient(
colors: [
AppColor.redColor,
AppColor.accentColor
],
begin: Alignment.topLeft,
end: Alignment.bottomRight,
),
// mainButton: TextButton(
// onPressed: () {
// controller.getCarsLocationByPassenger();
// },
// child: Text(
// 'Try Again'.tr,
// style: const TextStyle(
// color: AppColor.secondaryColor),
// ),
// ),
onTap: (GetSnackBar snackBar) {
// Do something when the snackbar is tapped.
},
isDismissible: true,
showProgressIndicator: false,
dismissDirection: DismissDirection.up,
progressIndicatorController: null,
progressIndicatorBackgroundColor:
Colors.transparent,
progressIndicatorValueColor: null,
snackStyle: SnackStyle.GROUNDED,
forwardAnimationCurve: Curves.easeInToLinear,
reverseAnimationCurve: Curves.easeInOut,
animationDuration:
const Duration(milliseconds: 4000),
barBlur: 8,
overlayBlur: 0,
snackbarStatus: null,
overlayColor:
AppColor.primaryColor.withOpacity(0.5),
userInputForm: null,
);
}
//
}),
);
},
//
}),
);
},
onTap: (argument) {
controller.hidePlaces();
onTap: (argument) {
controller.hidePlaces();
// controller.changeBottomSheetShown();
// controller.bottomSheet();
},
initialCameraPosition: CameraPosition(
target: controller.passengerLocation,
zoom: 15,
),
markers: {
for (var carLocation in controller.carsLocationByPassenger)
Marker(
// controller.changeBottomSheetShown();
// controller.bottomSheet();
},
initialCameraPosition: CameraPosition(
target: controller.passengerLocation,
zoom: 15,
),
markers: {
// controller.carMarkerAplied,
for (var carLocation in controller.carsLocationByPassenger)
Marker(
// anchor: const Offset(4, 4),
position: carLocation,
icon: controller.carIcon,
markerId: MarkerId(carLocation.toString())),
for (var carLocation
in controller.driverCarsLocationToPassengerAfterApplied)
Marker(
// anchor: const Offset(4, 4),
position: carLocation,
icon: controller.carIcon,
markerId: MarkerId(carLocation.toString())),
for (int i = 1;
i < controller.coordinatesWithoutEmpty.length - 1;
i++)
Marker(
// anchor: const Offset(4, 4),
markerId: MarkerId(carLocation.toString()),
rotation: controller.angleDegrees,
), ///////////////////
// controller.carMarrkerAplied,
for (var carLocation
in controller.driverCarsLocationToPassengerAfterApplied)
Marker(
// anchor: const Offset(4, 4),
position: carLocation,
icon: controller.carIcon,
markerId: MarkerId(carLocation.toString())),
for (int i = 1;
i < controller.coordinatesWithoutEmpty.length - 1;
i++)
Marker(
// anchor: const Offset(4, 4),
position: LatLng(
double.parse(controller.coordinatesWithoutEmpty[i]
.split(',')[0]),
double.parse(controller.coordinatesWithoutEmpty[i]
.split(',')[1])),
icon: controller.tripIcon,
markerId: MarkerId(
controller.coordinatesWithoutEmpty[i].toString())),
if (controller.isMarkersShown)
Marker(
markerId: MarkerId('MyLocation'.tr),
position: controller.newStartPointLocation,
draggable: true,
icon: controller.startIcon,
),
if (controller.isMarkersShown)
Marker(
markerId: MarkerId('Destination'.tr),
position: controller.myDestination,
draggable: true,
icon: controller.endIcon,
),
if (controller.haveSteps)
Marker(
markerId: MarkerId('StartSteps'.tr),
position: LatLng(
double.parse(controller.coordinatesWithoutEmpty[i]
.split(',')[0]),
double.parse(controller.coordinatesWithoutEmpty[i]
.split(',')[1])),
icon: controller.tripIcon,
markerId: MarkerId(
controller.coordinatesWithoutEmpty[i].toString())),
if (controller.isMarkersShown)
Marker(
markerId: MarkerId('MyLocation'.tr),
position: controller.newStartPointLocation,
draggable: true,
icon: controller.startIcon,
double.parse(
controller.placesCoordinate[0].split(',')[0]),
double.parse(
controller.placesCoordinate[0].split(',')[1])),
draggable: true,
icon: controller.startIcon,
),
if (controller.haveSteps)
Marker(
markerId: MarkerId('EndSteps'.tr),
position: controller.latestPosition,
draggable: true,
icon: controller.endIcon,
),
},
polylines: {
Polyline(
zIndex: 2,
consumeTapEvents: true,
geodesic: true,
endCap: Cap.buttCap,
startCap: Cap.buttCap,
visible: true,
polylineId: const PolylineId('route'),
points: controller.polylineCoordinates,
color: AppColor.primaryColor,
width: 5,
),
if (controller.isMarkersShown)
Marker(
markerId: MarkerId('Destination'.tr),
position: controller.myDestination,
draggable: true,
icon: controller.endIcon,
Polyline(
zIndex: 1,
consumeTapEvents: true,
geodesic: true,
endCap: Cap.buttCap,
startCap: Cap.buttCap,
visible: true,
polylineId: const PolylineId('route0'),
points: controller.polylineCoordinatesPointsAll[0],
color: AppColor.blueColor,
width: 5,
),
if (controller.haveSteps)
Marker(
markerId: MarkerId('StartSteps'.tr),
position: LatLng(
double.parse(
controller.placesCoordinate[0].split(',')[0]),
double.parse(
controller.placesCoordinate[0].split(',')[1])),
draggable: true,
icon: controller.startIcon,
Polyline(
zIndex: 2,
consumeTapEvents: true,
geodesic: true,
endCap: Cap.buttCap,
startCap: Cap.buttCap,
visible: true,
polylineId: const PolylineId('route1'),
points: controller.polylineCoordinatesPointsAll[1],
color: AppColor.yellowColor,
width: 5,
),
if (controller.haveSteps)
Marker(
markerId: MarkerId('EndSteps'.tr),
position: controller.latestPosition,
draggable: true,
icon: controller.endIcon,
Polyline(
zIndex: 2,
consumeTapEvents: true,
geodesic: true,
endCap: Cap.buttCap,
startCap: Cap.buttCap,
visible: true,
polylineId: const PolylineId('route2'),
points: controller.polylineCoordinatesPointsAll[2],
color: AppColor.greenColor,
width: 5,
),
},
polylines: {
Polyline(
zIndex: 2,
consumeTapEvents: true,
geodesic: true,
endCap: Cap.buttCap,
startCap: Cap.buttCap,
visible: true,
polylineId: const PolylineId('route'),
points: controller.polylineCoordinates,
color: AppColor.primaryColor,
width: 5,
),
Polyline(
zIndex: 2,
consumeTapEvents: true,
geodesic: true,
endCap: Cap.buttCap,
startCap: Cap.buttCap,
visible: true,
polylineId: const PolylineId('route3'),
points: controller.polylineCoordinatesPointsAll[2],
color: AppColor.deepPurpleAccent,
width: 5,
),
// Polyline(
// zIndex: 2,
// consumeTapEvents: true,
// geodesic: true,
// endCap: Cap.buttCap,
// startCap: Cap.buttCap,
// visible: true,
// polylineId: PolylineId('g'),
// points: [
// LatLng(controller.southwest.latitude,
// controller.southwest.longitude),
// LatLng(controller.northeast.latitude,
// controller.northeast.longitude)
// ],
// color: AppColor.primaryColor,
// width: 5,
// ),
},
// circles: {
// Circle(
// circleId: const CircleId('kk'),
// center: controller.mylocation,
// radius: 60,
// fillColor: AppColor.primaryColor,)
// },
Polyline(
zIndex: 1,
consumeTapEvents: true,
geodesic: true,
endCap: Cap.buttCap,
startCap: Cap.buttCap,
visible: true,
polylineId: const PolylineId('route0'),
points: controller.polylineCoordinatesPointsAll[0],
color: AppColor.blueColor,
width: 5,
),
Polyline(
zIndex: 2,
consumeTapEvents: true,
geodesic: true,
endCap: Cap.buttCap,
startCap: Cap.buttCap,
visible: true,
polylineId: const PolylineId('route1'),
points: controller.polylineCoordinatesPointsAll[1],
color: AppColor.yellowColor,
width: 5,
),
Polyline(
zIndex: 2,
consumeTapEvents: true,
geodesic: true,
endCap: Cap.buttCap,
startCap: Cap.buttCap,
visible: true,
polylineId: const PolylineId('route2'),
points: controller.polylineCoordinatesPointsAll[2],
color: AppColor.greenColor,
width: 5,
),
Polyline(
zIndex: 2,
consumeTapEvents: true,
geodesic: true,
endCap: Cap.buttCap,
startCap: Cap.buttCap,
visible: true,
polylineId: const PolylineId('route3'),
points: controller.polylineCoordinatesPointsAll[2],
color: AppColor.deepPurpleAccent,
width: 5,
),
// Polyline(
// zIndex: 2,
// consumeTapEvents: true,
// geodesic: true,
// endCap: Cap.buttCap,
// startCap: Cap.buttCap,
// visible: true,
// polylineId: PolylineId('g'),
// points: [
// LatLng(controller.southwest.latitude,
// controller.southwest.longitude),
// LatLng(controller.northeast.latitude,
// controller.northeast.longitude)
// ],
// color: AppColor.primaryColor,
// width: 5,
// ),
},
// circles: {
// Circle(
// circleId: const CircleId('kk'),
// center: controller.mylocation,
// radius: 60,
// fillColor: AppColor.primaryColor,)
// },
circles: <Circle>{
Circle(
circleId: const CircleId('circle_id'),
center: controller.passengerLocation,
radius: 100,
fillColor: Colors.blue.withOpacity(0.3),
strokeColor: Colors.blue,
strokeWidth: 2,
),
},
circles: <Circle>{
Circle(
circleId: const CircleId('circle_id'),
center: controller.passengerLocation,
radius: 100,
fillColor: Colors.blue.withOpacity(0.3),
strokeColor: Colors.blue,
strokeWidth: 2,
),
},
mapType:
controller.mapType ? MapType.satellite : MapType.normal,
myLocationButtonEnabled: true,
// liteModeEnabled: true, tiltGesturesEnabled: false,
mapType: controller.mapType ? MapType.satellite : MapType.normal,
myLocationButtonEnabled: true,
// liteModeEnabled: true, tiltGesturesEnabled: false,
// indoorViewEnabled: true,
trafficEnabled: controller.mapTrafficON,
buildingsEnabled: true,
mapToolbarEnabled: true,
onCameraMove: (position) {
int waypointsLength =
Get.find<WayPointController>().wayPoints.length;
int index = controller.wayPointIndex;
if (waypointsLength > 0) {
controller.placesCoordinate[index] =
'${position.target.latitude.toString()},${position.target.longitude}';
}
if (controller.startLocationFromMap == true) {
controller.newStartPointLocation = position.target;
}
controller.newMyLocation = position.target;
// indoorViewEnabled: true,
trafficEnabled: controller.mapTrafficON,
buildingsEnabled: true,
mapToolbarEnabled: true,
onCameraMove: (position) {
int waypointsLength =
Get.find<WayPointController>().wayPoints.length;
int index = controller.wayPointIndex;
if (waypointsLength > 0) {
controller.placesCoordinate[index] =
'${position.target.latitude.toString()},${position.target.longitude}';
}
if (controller.startLocationFromMap == true) {
controller.newStartPointLocation = position.target;
}
controller.newMyLocation = position.target;
// print('my' + controller.mylocation.toString());
// print('new' + controller.newMylocation.toString());
},
myLocationEnabled: true,
// liteModeEnabled: true,
// print('my' + controller.mylocation.toString());
// print('new' + controller.newMylocation.toString());
},
myLocationEnabled: true,
// liteModeEnabled: true,
),
),
);
}

View File

@@ -114,14 +114,15 @@ GetBuilder<MapPassengerController> leftMainMenuIcons() {
onPressed: () {
// NotificationController()
// .showNotification('Order', 'hi this is', 'tone1');
Get.to(() => DriverCallPage());
// Get.to(() => DriverCallPage());
print(controller.polylineCoordinates.toString());
// PassengerCallPage(
// channelName: '',
// token: '',
// remoteID: '',
// )
// Get.to(() => const CallPage());
print(box.read(BoxName.lang));
// print(box.read(BoxName.lang));
},
icon: const Icon(
Icons.call,

View File

@@ -10,6 +10,7 @@ import 'package:SEFER/views/widgets/elevated_btn.dart';
import '../../../constant/colors.dart';
import '../../../constant/table_names.dart';
import '../../../controller/functions/toast.dart';
import '../../../controller/functions/tts.dart';
import 'form_search_start.dart';
class MainBottomMenuMap extends StatelessWidget {
@@ -23,298 +24,313 @@ class MainBottomMenuMap extends StatelessWidget {
bottom: 3,
left: 5,
right: 5,
child: AnimatedContainer(
duration: const Duration(milliseconds: 500),
height: controller.mainBottomMenuMapHeight,
decoration: AppStyle.boxDecoration,
child: SingleChildScrollView(
child: Column(
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.center,
children: [
Padding(
padding: const EdgeInsets.all(15),
child: InkWell(
onTap: () => controller.changeMainBottomMenuMap(),
child: Container(
width: Get.width * .8,
height: Get.height * .1,
decoration: const BoxDecoration(
boxShadow: [
BoxShadow(
color: AppColor.accentColor,
blurRadius: 5,
offset: Offset(2, 4)),
BoxShadow(
color: AppColor.accentColor,
blurRadius: 5,
offset: Offset(-2, -2))
],
color: AppColor.secondaryColor,
borderRadius: BorderRadius.all(
Radius.elliptical(15, 30),
),
),
child: DefaultTextStyle(
style: AppStyle.title,
child: Center(
child: controller.isPickerShown
? TextButton(
onPressed: () async {
controller.clearPolyline();
controller.data = [];
if (controller
.startLocationFromMap ==
true) {
controller.newMyLocation =
controller
.newStartPointLocation;
controller.hintTextStartPoint =
'${controller.newStartPointLocation.latitude.toStringAsFixed(4)} , ${controller.newStartPointLocation.longitude.toStringAsFixed(4)}';
controller.startLocationFromMap =
false;
controller.isPickerShown = false;
} else if (controller
.workLocationFromMap ==
true) {
controller
.hintTextDestinationPoint =
'To Work'.tr;
box.write(BoxName.addWork,
'${controller.newMyLocation.latitude.toStringAsFixed(4)} , ${controller.newMyLocation.longitude.toStringAsFixed(4)}');
controller.newMyLocation =
controller.newMyLocation;
controller.isPickerShown = false;
controller.workLocationFromMap =
false;
Toast.show(
context,
'Work Saved'.tr,
AppColor.greenColor);
} else if (controller
.homeLocationFromMap ==
true) {
controller
.hintTextDestinationPoint =
'To Home'.tr;
box.write(BoxName.addHome,
'${controller.newMyLocation.latitude.toStringAsFixed(4)} , ${controller.newMyLocation.longitude.toStringAsFixed(4)}');
controller.newMyLocation =
controller.newMyLocation;
controller.isPickerShown = false;
controller.homeLocationFromMap =
false;
controller.update();
Toast.show(
context,
'Home Saved'.tr,
AppColor.greenColor);
} else {
controller
.hintTextDestinationPoint =
'${controller.newMyLocation.latitude.toStringAsFixed(4)} , ${controller.newMyLocation.longitude.toStringAsFixed(4)}';
controller.newMyLocation =
controller.newMyLocation;
controller.isPickerShown = false;
}
child: GestureDetector(
onVerticalDragUpdate: (DragUpdateDetails details) {
// Update the size of the GestureDetector based on the user's finger position.
controller.placesDestination = [];
controller
.placeDestinationController
.clear();
controller.showBottomSheet1();
Get.back();
controller.showBottomSheet1();
controller
.changeMainBottomMenuMap();
},
child: Row(
children: [
IconButton(
onPressed: () {
controller
.changeMainBottomMenuMap();
},
icon: controller
.isMainBottomMenuMap
? const Icon(
Icons
.arrow_circle_up_rounded,
size: 35,
)
: const Icon(
Icons
.arrow_circle_down_rounded,
size: 35,
),
),
Text(
"Click here point".tr,
style: AppStyle.title,
),
],
),
)
: Row(
mainAxisAlignment:
MainAxisAlignment.spaceEvenly,
children: [
IconButton(
onPressed: () {
controller
.changeMainBottomMenuMap();
},
icon:
controller.isMainBottomMenuMap
? const Icon(
Icons.ads_click,
size: 35,
)
: const Icon(
Icons
.arrow_circle_down_rounded,
size: 35,
),
),
Column(
mainAxisAlignment:
MainAxisAlignment.center,
children: [
SizedBox(
height: 30,
child: Text(
'${'Where to'.tr} ${box.read(BoxName.name)}')),
Row(
mainAxisAlignment:
MainAxisAlignment.center,
children: [
controller.noCarString ==
false
? Text(
'Nearest Car for you about '
.tr)
: Container(
decoration:
BoxDecoration(
borderRadius:
BorderRadius
.circular(
12),
color: AppColor
.redColor,
),
child: Padding(
padding:
const EdgeInsets
.all(6),
child: Text(
'No Car in your site. Sorry!'
.tr,
style: AppStyle
.title
.copyWith(
color: AppColor
.secondaryColor),
),
),
),
controller.noCarString ==
false
? Container(
decoration: BoxDecoration(
border: Border.all(
color: AppColor
.redColor,
width: 3)),
child: Padding(
padding:
const EdgeInsets
.all(4),
child: Text((controller
.nearestCar !=
null
? controller
.durationByPassenger
.toString()
: 'N/A')),
),
)
: const SizedBox(),
],
)
],
),
],
// _height = details.globalPosition.dy;
controller.changeMainBottomMenuMap();
},
child: AnimatedContainer(
duration: const Duration(milliseconds: 500),
height: controller.mainBottomMenuMapHeight,
decoration: AppStyle.boxDecoration,
child: SingleChildScrollView(
child: Column(
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.center,
children: [
controller.isMainBottomMenuMap
? Padding(
padding: const EdgeInsets.all(15),
child: InkWell(
onTap: () =>
controller.changeMainBottomMenuMap(),
child: Container(
width: Get.width * .8,
height: Get.height * .1,
decoration: AppStyle.boxDecoration1,
child: DefaultTextStyle(
style: AppStyle.title,
child: Center(
child: controller.isPickerShown
? clickPointPosition(
controller, context)
: whereWidgetsmall(controller),
),
)),
),
)),
),
),
controller.isMainBottomMenuMap
? const FavioratePlacesDialogu()
: const SizedBox(),
controller.isMainBottomMenuMap
? const SizedBox()
: InkWell(
onTap: () async {
controller.getCurrentLocationFormString();
},
child: Text(
'From :'.tr +
' ${controller.currentLocationString}'.tr,
style: AppStyle.subtitle,
)
: IconButton(
onPressed: () {
controller.changeMainBottomMenuMap();
},
icon: controller.isMainBottomMenuMap
? const Icon(
Icons.ads_click,
size: 35,
)
: const Icon(
Icons.arrow_circle_down_rounded,
size: 35,
),
),
),
controller.isMainBottomMenuMap
? const SizedBox()
: Column(
children: [
controller.currentLocationToFormPlaces
? const SizedBox()
: formSearchPlacesStart(),
formSearchPlacesDestenation(),
const SizedBox(
height: 10,
controller.isMainBottomMenuMap
? recentPlacesWidget(controller)
: const SizedBox(),
controller.isMainBottomMenuMap
? const SizedBox()
: InkWell(
onTap: () async {
controller.getCurrentLocationFormString();
},
child: Text(
'From :'.tr +
' ${controller.currentLocationString}'.tr,
style: AppStyle.subtitle,
),
MyElevatedButton(
title: 'Get Details of Trip'.tr,
onPressed: () async {
controller.changeMainBottomMenuMap();
await controller.getMap(
'${controller.newStartPointLocation.latitude},${controller.newStartPointLocation.longitude}',
'${controller.newMyLocation.latitude},${controller.newMyLocation.longitude}',
);
controller.currentLocationToFormPlaces =
false;
controller.placesDestination = [];
// controller.isCancelRidePageShown = true;
controller.clearPlacesStart();
controller.clearPlacesDestination();
controller.showBottomSheet1();
Get.back();
controller.showBottomSheet1();
}),
TextButton(
onPressed: () {
controller.changeMainBottomMenuMap();
controller.changeWayPointSheet();
},
child: Text(
"If you want add stop click here".tr,
style: AppStyle.title,
),
controller.isMainBottomMenuMap
? const SizedBox()
: Column(
children: [
controller.currentLocationToFormPlaces
? const SizedBox()
: formSearchPlacesStart(),
formSearchPlacesDestenation(),
const SizedBox(
height: 10,
),
),
],
)
],
MyElevatedButton(
title: 'Get Details of Trip'.tr,
onPressed: () async {
controller.changeMainBottomMenuMap();
await controller.getMap(
'${controller.newStartPointLocation.latitude},${controller.newStartPointLocation.longitude}',
'${controller.newMyLocation.latitude},${controller.newMyLocation.longitude}',
);
controller.currentLocationToFormPlaces =
false;
controller.placesDestination = [];
// controller.isCancelRidePageShown = true;
controller.clearPlacesStart();
controller.clearPlacesDestination();
controller.showBottomSheet1();
Get.back();
controller.showBottomSheet1();
}),
TextButton(
onPressed: () {
controller.changeMainBottomMenuMap();
controller.changeWayPointSheet();
},
child: Text(
"If you want add stop click here".tr,
style: AppStyle.title,
),
),
],
)
],
),
),
),
),
));
}
SizedBox recentPlacesWidget(MapPassengerController controller) {
final textToSpeechController = Get.put(TextToSpeechController());
return SizedBox(
height: 50,
child: ListView.builder(
itemCount: controller.recentPlaces.length,
scrollDirection: Axis.horizontal,
itemBuilder: (BuildContext context, int index) {
return TextButton(
onPressed: () {
Get.defaultDialog(
title: 'Are you want to go this site'.tr,
titleStyle: AppStyle.title,
middleText: '',
content: IconButton(
onPressed: () {
textToSpeechController
.speakText('Are you want to go this site'.tr);
},
icon: const Icon(
Icons.headphones,
size: 45,
),
),
confirm: MyElevatedButton(
title: 'Yes'.tr,
onPressed: () async {
await controller.getLocation();
await controller.getMap(
'${controller.passengerLocation.latitude},${controller.passengerLocation.longitude}',
'${controller.recentPlaces[index]['latitude']},${controller.recentPlaces[index]['longitude']}',
);
// controller.changePickerShown();
controller.showBottomSheet1();
// controller.showBottomSheet1();
Get.back();
},
));
},
child: Container(
decoration: AppStyle.boxDecoration1,
child: Padding(
padding: const EdgeInsets.all(2),
child: Text(
controller.recentPlaces[index]['name'],
style: AppStyle.title,
),
),
),
);
},
),
);
}
TextButton clickPointPosition(
MapPassengerController controller, BuildContext context) {
return TextButton(
onPressed: () async {
controller.clearPolyline();
controller.data = [];
if (controller.startLocationFromMap == true) {
controller.newMyLocation = controller.newStartPointLocation;
controller.hintTextStartPoint =
'${controller.newStartPointLocation.latitude.toStringAsFixed(4)} , ${controller.newStartPointLocation.longitude.toStringAsFixed(4)}';
controller.startLocationFromMap = false;
controller.isPickerShown = false;
} else if (controller.workLocationFromMap == true) {
controller.hintTextDestinationPoint = 'To Work'.tr;
box.write(BoxName.addWork,
'${controller.newMyLocation.latitude.toStringAsFixed(4)} , ${controller.newMyLocation.longitude.toStringAsFixed(4)}');
controller.newMyLocation = controller.newMyLocation;
controller.isPickerShown = false;
controller.workLocationFromMap = false;
Get.snackbar('Work Saved'.tr, '',
backgroundColor: AppColor.greenColor);
} else if (controller.homeLocationFromMap == true) {
controller.hintTextDestinationPoint = 'To Home'.tr;
box.write(BoxName.addHome,
'${controller.newMyLocation.latitude.toStringAsFixed(4)} , ${controller.newMyLocation.longitude.toStringAsFixed(4)}');
controller.newMyLocation = controller.newMyLocation;
controller.isPickerShown = false;
controller.homeLocationFromMap = false;
controller.update();
Get.snackbar('Home Saved'.tr, '',
backgroundColor: AppColor.greenColor);
} else {
controller.hintTextDestinationPoint =
'${controller.newMyLocation.latitude.toStringAsFixed(4)} , ${controller.newMyLocation.longitude.toStringAsFixed(4)}';
controller.newMyLocation = controller.newMyLocation;
controller.isPickerShown = false;
}
controller.placesDestination = [];
controller.placeDestinationController.clear();
controller.showBottomSheet1();
Get.back();
controller.showBottomSheet1();
controller.changeMainBottomMenuMap();
},
child: Row(
children: [
IconButton(
onPressed: () {
controller.changeMainBottomMenuMap();
},
icon: controller.isMainBottomMenuMap
? const Icon(
Icons.arrow_circle_up_rounded,
size: 35,
)
: const Icon(
Icons.arrow_circle_down_rounded,
size: 35,
),
),
Text(
"Click here point".tr,
style: AppStyle.title,
),
],
),
);
}
Row whereWidgetsmall(MapPassengerController controller) {
return Row(
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
children: [
IconButton(
onPressed: () {
controller.changeMainBottomMenuMap();
},
icon: controller.isMainBottomMenuMap
? const Icon(
Icons.ads_click,
size: 35,
)
: const Icon(
Icons.arrow_circle_down_rounded,
size: 35,
),
),
Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
SizedBox(
height: 30,
child: Text('${'Where to'.tr} ${box.read(BoxName.name)}')),
Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
controller.noCarString == false
? Text('Nearest Car for you about '.tr)
: Container(
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(12),
color: AppColor.redColor,
),
child: Padding(
padding: const EdgeInsets.all(6),
child: Text(
'No Car in your site. Sorry!'.tr,
style: AppStyle.title
.copyWith(color: AppColor.secondaryColor),
),
),
),
controller.noCarString == false
? Container(
decoration: BoxDecoration(
border:
Border.all(color: AppColor.redColor, width: 3)),
child: Padding(
padding: const EdgeInsets.all(4),
child: Text((controller.nearestCar != null
? controller.nearestDistance.toStringAsFixed(0)
: 'N/A')),
),
)
: const SizedBox(),
],
)
],
),
],
);
}
}
class FavioratePlacesDialogu extends StatelessWidget {

View File

@@ -0,0 +1,211 @@
import 'dart:async';
import 'package:SEFER/constant/colors.dart';
import 'package:SEFER/constant/style.dart';
import 'package:SEFER/controller/home/map_passenger_controller.dart';
import 'package:SEFER/views/widgets/elevated_btn.dart';
import 'package:SEFER/views/widgets/my_textField.dart';
import 'package:flutter/material.dart';
import 'package:get/get.dart';
class SearchingCaptainWindow extends StatelessWidget {
const SearchingCaptainWindow({super.key});
@override
Widget build(BuildContext context) {
return GetBuilder<MapPassengerController>(
builder: (mapPassengerController) {
return mapPassengerController.isSearchingWindow
? Positioned(
bottom: 0,
left: 0,
right: 0,
child: Container(
decoration: AppStyle.boxDecoration1,
height: Get.height * .2,
child: Column(
// Use Stack for overlapping widgets
children: [
// Text elements
SizedBox(
width: Get.width * .7,
child: const LinearProgressIndicator(
minHeight: 6,
backgroundColor: AppColor.yellowColor,
color: AppColor.secondaryColor,
),
),
Text(
'We search nearst Driver to you'.tr,
style: AppStyle.headTitle2,
),
Text(
'please wait till driver accept your order'.tr,
style: AppStyle.title,
), // Timer logic
_buildTimer(mapPassengerController),
],
),
),
)
: const SizedBox();
},
);
}
}
Widget _buildTimer(MapPassengerController mapPassengerController) {
// Start timer at 0
Timer? timer;
return StreamBuilder<int>(
// Use StreamBuilder for timer updates
stream: Stream.periodic(const Duration(seconds: 1))
.map((_) => ++mapPassengerController.currentTimeSearchingCaptainWindow),
initialData: 0,
builder: (context, snapshot) {
if (snapshot.hasData && snapshot.data! > 30) {
timer?.cancel(); // Cancel timer after 60 seconds
return GestureDetector(
onTap: () {
Get.defaultDialog(
barrierDismissible: false,
title: "Increase Your Trip Fee (Optional)".tr,
titleStyle: AppStyle.title,
content: Column(
children: [
Text(
"We haven't found any drivers yet. Consider increasing your trip fee to make your offer more attractive to drivers."
.tr,
style: AppStyle.title,
textAlign: TextAlign.center,
),
Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
IconButton(
onPressed: () {
mapPassengerController.increasFeeFromPassenger.text =
(mapPassengerController.totalPassenger + 3)
.toStringAsFixed(1);
// mapPassengerController.increasFeeFromPassenger.text =
// mapPassengerController.totalPassenger
// .toStringAsFixed(1);
mapPassengerController.update();
},
icon: Column(
children: [
Text(
'3',
style: AppStyle.number,
),
Container(
decoration: const BoxDecoration(
shape: BoxShape.circle,
color: AppColor.greenColor),
child: const Icon(
Icons.arrow_circle_up,
size: 30,
color: AppColor.secondaryColor,
),
),
],
),
),
SizedBox(
width: 100,
child: Form(
key: mapPassengerController.increasFeeFormKey,
child: MyTextForm(
controller: mapPassengerController
.increasFeeFromPassenger,
label: mapPassengerController.totalPassenger
.toStringAsFixed(2),
hint: mapPassengerController.totalPassenger
.toStringAsFixed(2),
type: TextInputType.number),
),
),
IconButton(
onPressed: () {
// if ((double.parse(mapPassengerController
// .increasFeeFromPassenger.text) >
// totalPassenger)) {}
mapPassengerController.increasFeeFromPassenger.text =
(mapPassengerController.totalPassenger - 3)
.toStringAsFixed(1);
// mapPassengerController.increasFeeFromPassenger.text =
// mapPassengerController.totalPassenger
// .toStringAsFixed(1);
mapPassengerController.update();
},
icon: Column(
children: [
Text(
'3',
style: AppStyle.number,
),
Container(
decoration: const BoxDecoration(
shape: BoxShape.circle,
color: AppColor.redColor),
child: const Icon(
Icons.arrow_drop_down_circle_outlined,
size: 30,
color: AppColor.secondaryColor,
),
),
],
),
),
],
)
],
),
actions: [
MyElevatedButton(
title: "No, thanks",
onPressed: () {
Get.back();
}),
MyElevatedButton(
title: "Increase Fee".tr,
onPressed: () {
mapPassengerController.increaseFeeByPassengerAndReOrder();
})
],
);
},
child: Text(
"No accepted orders? Try raising your trip fee to attract riders."
.tr,
style: AppStyle.title.copyWith(color: AppColor.blueColor),
),
);
}
// Update progress for circular indicator (0.0 to 1.0)
final double progress =
snapshot.data!.toDouble() / 30.0; // Normalize progress
return Stack(
children: [
Center(
child: CircularProgressIndicator(
value: progress, // Use calculated progress
color: AppColor.blueColor,
backgroundColor: AppColor.yellowColor,
),
),
Center(
child: Text(
'${snapshot.data} ', // Display elapsed time
style: AppStyle.title.copyWith(
color: AppColor.greenColor), // Adjust color for timer
),
)
],
);
},
);
}

View File

@@ -76,7 +76,7 @@ class TimerToPassengerFromDriver extends StatelessWidget {
title: 'You can cancel trip'.tr,
onPressed: () async {
await controller
.calculateDistanceBetweenPassengerAndDriverBeforecancelRide();
.calculateDistanceBetweenPassengerAndDriverBeforeCancelRide();
})
: const SizedBox()
],