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

@@ -1,3 +1,4 @@
import 'package:SEFER/controller/home/captin/map_driver_controller.dart';
import 'package:flutter/material.dart';
import 'package:flutter_rating_bar/flutter_rating_bar.dart';
import 'package:get/get.dart';
@@ -26,6 +27,35 @@ class RatePassenger extends StatelessWidget {
decoration: AppStyle.boxDecoration,
child: Column(
children: [
Padding(
padding: const EdgeInsets.all(4),
child: Container(
height: Get.height * .25,
decoration: AppStyle.boxDecoration1,
child: Column(
children: [
Text(
'${'Total price from '.tr}${Get.find<MapDriverController>().passengerName}',
style: AppStyle.title,
),
Container(
decoration: BoxDecoration(
border: Border.all(
width: 2,
color: AppColor.greenColor,
)),
child: Padding(
padding: const EdgeInsets.all(4),
child: Text(
Get.find<MapDriverController>()
.totalPassenger,
style: AppStyle.number,
),
),
),
],
)),
),
Center(
child: RatingBar.builder(
initialRating: 0,

View File

@@ -18,6 +18,7 @@ class VerifyEmailPage extends StatelessWidget {
Positioned(
top: 10,
left: 20,
right: 20,
child: Text(
'We sent 5 digit to your Email provided'.tr,
style: AppStyle.title.copyWith(fontSize: 20),

View File

@@ -1,9 +1,12 @@
import 'package:SEFER/constant/style.dart';
import 'package:SEFER/views/widgets/elevated_btn.dart';
import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:SEFER/controller/home/captin/map_driver_controller.dart';
import 'package:SEFER/views/widgets/my_scafold.dart';
import '../../../controller/functions/location_controller.dart';
import '../../Rate/rate_passenger.dart';
import 'mapDriverWidgets/driver_end_ride_bar.dart';
import 'mapDriverWidgets/google_driver_map_page.dart';
import 'mapDriverWidgets/google_map_app.dart';
@@ -25,7 +28,57 @@ class PassengerLocationMapPage extends StatelessWidget {
driverEndRideBar(),
const SosConnect(),
const GoogleMapApp(),
PricesWindow(),
],
isleading: false);
}
}
class PricesWindow extends StatelessWidget {
const PricesWindow({
super.key,
});
@override
Widget build(BuildContext context) {
return GetBuilder<MapDriverController>(builder: (mapDriverController) {
return mapDriverController.isPriceWindow
? Positioned(
bottom: Get.height * 1.2,
// top: Get.height * 3,
left: Get.height * 1,
right: Get.height * 1,
child: Container(
height: Get.height * 3,
decoration: AppStyle.boxDecoration1,
child: Column(
children: [
Container(
decoration: AppStyle.boxDecoration1,
child: Padding(
padding: const EdgeInsets.all(3),
child: Text(
'Total Price is '.tr,
style: AppStyle.headTitle2,
textAlign: TextAlign.center,
),
)),
const SizedBox(
height: 20,
),
MyElevatedButton(
title: 'ok'.tr,
onPressed: () =>
Get.to(() => RatePassenger(), arguments: {
'rideId': mapDriverController.rideId,
'passengerId': mapDriverController.passengerId,
'driverId': mapDriverController.driverId
}))
],
),
),
)
: const SizedBox();
});
}
}

View File

@@ -23,7 +23,7 @@ class CallController extends GetxController {
void onInit() {
super.onInit();
channelName = Get.find<MapDriverController>().rideId; // 'sefer300'; //
remoteUid = int.parse(Get.find<MapDriverController>().phone);
remoteUid = int.parse(Get.find<MapDriverController>().passengerPhone);
uid = int.parse(box.read(BoxName.phoneDriver));
// initAgoraFull();
}
@@ -76,7 +76,7 @@ class CallController extends GetxController {
},
onUserJoined: (RtcConnection connection, int remoteUid, int elapsed) {
// Get.snackbar("Remote user uid:$remoteUid joined the channel", '');
status = '${Get.find<MapDriverController>().name}'
status = '${Get.find<MapDriverController>().passengerName}'
' joined'
.tr
.tr;

View File

@@ -1,4 +1,3 @@
import 'package:SEFER/controller/functions/location_controller.dart';
import 'package:flutter/material.dart';
import 'package:flutter/widgets.dart';
import 'package:flutter_font_icons/flutter_font_icons.dart';
@@ -10,12 +9,10 @@ import 'package:SEFER/controller/firebase/firbase_messge.dart';
import 'package:SEFER/controller/home/captin/map_driver_controller.dart';
import 'package:SEFER/main.dart';
import 'package:SEFER/views/widgets/elevated_btn.dart';
import 'package:url_launcher/url_launcher.dart';
import '../../../../constant/style.dart';
import '../../../../controller/functions/launch.dart';
import '../../../../controller/home/captin/widget/call_page.dart';
import 'google_map_app.dart';
class PassengerInfoWindow extends StatelessWidget {
const PassengerInfoWindow({
@@ -83,7 +80,7 @@ class PassengerInfoWindow extends StatelessWidget {
true;
launchCommunication(
'email',
controller.phone
controller.passengerPhone
.toString(),
'${'Hello this is Driver'.tr} ${box.read(BoxName.nameDriver)}');
},
@@ -155,7 +152,7 @@ class PassengerInfoWindow extends StatelessWidget {
Text('Name of the Passenger is '.tr,
style: AppStyle.title),
Text(
controller.name.toString(),
controller.passengerName.toString(),
style: AppStyle.title,
),
],
@@ -353,49 +350,49 @@ class PassengerInfoWindow extends StatelessWidget {
),
],
)
: controller.remainingTimeToShowPassengerInfoWindowFromDriver > 0 //
? Positioned(
bottom: Get.height * .2,
left: 15,
child: Container(
decoration: AppStyle.boxDecoration,
child: Padding(
padding: const EdgeInsets.all(8.0),
child: Row(
children: [
Stack(
alignment: Alignment.center,
children: [
const CircularProgressIndicator(
backgroundColor: AppColor.redColor,
strokeWidth: 10,
color: AppColor.redColor,
value: 1,
),
CircularProgressIndicator(
value: controller.progress,
// Set the color based on the "isNearEnd" condition
color: AppColor.yellowColor,
),
Text(
'${controller.remainingTimeToShowPassengerInfoWindowFromDriver}',
style: AppStyle.number,
),
],
),
const SizedBox(
width: 10,
),
Text(
'Please Wait If passenger want To Cancel!'.tr,
style: AppStyle.title,
),
],
),
),
),
)
: const SizedBox(),
// : controller.remainingTimeToShowPassengerInfoWindowFromDriver > 0 //
// ? Positioned(
// bottom: Get.height * .2,
// left: 15,
// child: Container(
// decoration: AppStyle.boxDecoration,
// child: Padding(
// padding: const EdgeInsets.all(8.0),
// child: Row(
// children: [
// Stack(
// alignment: Alignment.center,
// children: [
// const CircularProgressIndicator(
// backgroundColor: AppColor.redColor,
// strokeWidth: 10,
// color: AppColor.redColor,
// value: 1,
// ),
// CircularProgressIndicator(
// value: controller.progress,
// // Set the color based on the "isNearEnd" condition
// color: AppColor.yellowColor,
// ),
// Text(
// '${controller.remainingTimeToShowPassengerInfoWindowFromDriver}',
// style: AppStyle.number,
// ),
// ],
// ),
// const SizedBox(
// width: 10,
// ),
// Text(
// 'Please Wait If passenger want To Cancel!'.tr,
// style: AppStyle.title,
// ),
// ],
// ),
// ),
// ),
// )
: const SizedBox(),
);
}
}

View File

@@ -100,7 +100,7 @@ class SosConnect extends StatelessWidget {
launchCommunication(
'whatsapp',
'+962${box.read(BoxName.sosPhoneDriver)}', //todo add number from driver
"${"Hello this is Driver".tr} ${box.read(BoxName.nameDriver)}.${" My current location is:".tr} https://www.google.com/maps/place/${Get.find<LocationController>().myLocation.latitude},${Get.find<LocationController>().myLocation.longitude}${" \nand I have a trip on".tr} ${AppInformation.appName} ${"App \nwith Passenger ".tr}${mapDriverController.name}");
"${"Hello this is Driver".tr} ${box.read(BoxName.nameDriver)}.${" My current location is:".tr} https://www.google.com/maps/place/${Get.find<LocationController>().myLocation.latitude},${Get.find<LocationController>().myLocation.longitude}${" \nand I have a trip on".tr} ${AppInformation.appName} ${"App \nwith Passenger ".tr}${mapDriverController.passengerName}");
}
},
child: const Icon(

View File

@@ -1,3 +1,4 @@
import 'package:SEFER/controller/home/captin/home_captain_controller.dart';
import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:SEFER/constant/box_name.dart';
@@ -5,7 +6,8 @@ import 'package:SEFER/controller/firebase/firbase_messge.dart';
import 'package:SEFER/main.dart';
import 'package:SEFER/views/home/Captin/driver_map_page.dart';
import 'package:SEFER/views/widgets/my_scafold.dart';
import 'package:google_maps_flutter/google_maps_flutter.dart';
import 'dart:math' as math;
import '../../../../constant/colors.dart';
import '../../../../constant/links.dart';
import '../../../../constant/style.dart';
@@ -23,18 +25,93 @@ class OrderRequestPage extends StatelessWidget {
final arguments = Get.arguments;
final myListString = arguments['myListString'];
final myList = arguments['DriverList'];
// final pointsList = arguments['PolylineJson'];
final body = arguments['body'];
Duration durationToAdd = Duration(seconds: int.parse(myList[4]));
int hours = durationToAdd.inHours;
int minutes = (durationToAdd.inMinutes % 60).round();
orderRequestController.startTimer(myList[6].toString(), body.toString());
var coords = myList[0].split(',');
var coordDestination = myList[1].split(',');
// Parse to double
double latPassengerLocation = double.parse(coords[0]);
double lngPassengerLocation = double.parse(coords[1]);
double latPassengerDestination = double.parse(coordDestination[0]);
double lngPassengerDestination = double.parse(coordDestination[1]);
List<LatLng> pointsDirection = [
LatLng(latPassengerLocation, lngPassengerLocation),
LatLng(latPassengerDestination, lngPassengerDestination)
]; // Calculate the midpoint between the two points
// Calculate the minimum and maximum latitude and longitude values
double minLatitude =
math.min(pointsDirection[0].latitude, pointsDirection[1].latitude);
double maxLatitude =
math.max(pointsDirection[0].latitude, pointsDirection[1].latitude);
double minLongitude =
math.min(pointsDirection[0].longitude, pointsDirection[1].longitude);
double maxLongitude =
math.max(pointsDirection[0].longitude, pointsDirection[1].longitude);
// Create a bounding box using the calculated values
LatLngBounds bounds = LatLngBounds(
southwest: LatLng(minLatitude, minLongitude),
northeast: LatLng(maxLatitude, maxLongitude),
);
return MyScafolld(
title: 'Order Request Page'.tr,
title: 'Order Details'.tr,
body: [
Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
// SizedBox(height: 200, child: Text(pointsList.toString())),
// Text(message.notification!.body.toString()),
SizedBox(
height: 200,
child: GoogleMap(
initialCameraPosition: CameraPosition(
zoom: 12,
target: Get.find<HomeCaptainController>().myLocation),
cameraTargetBounds: CameraTargetBounds(bounds),
myLocationButtonEnabled: true,
trafficEnabled: true,
buildingsEnabled: true,
mapToolbarEnabled: true,
myLocationEnabled: true,
markers: {
Marker(
markerId: MarkerId('MyLocation'.tr),
position:
LatLng(latPassengerLocation, lngPassengerLocation),
draggable: true,
icon: BitmapDescriptor.defaultMarkerWithHue(
BitmapDescriptor.hueGreen),
),
Marker(
markerId: MarkerId('Destination'.tr),
position: LatLng(
latPassengerDestination, lngPassengerDestination),
draggable: true,
icon: BitmapDescriptor.defaultMarkerWithHue(
BitmapDescriptor.hueBlue),
),
},
polylines: {
Polyline(
zIndex: 1,
consumeTapEvents: true,
geodesic: true,
endCap: Cap.buttCap,
startCap: Cap.buttCap,
visible: true,
polylineId: const PolylineId('routeOrder'),
points: pointsDirection,
color: AppColor.primaryColor,
width: 2,
),
},
),
),
Padding(
padding: const EdgeInsets.all(8.0),
child: Card(
@@ -201,7 +278,8 @@ class OrderRequestPage extends StatelessWidget {
await CRUD().post(link: AppLink.updateRides, payload: {
'id': myList[16],
'rideTimeStart': DateTime.now().toString(),
'status': 'Apply'
'status': 'Apply',
'driver_id': box.read(BoxName.driverID),
});
// Get.back();
List<String> bodyToPassenger = [
@@ -291,7 +369,8 @@ class OrderRequestPage extends StatelessWidget {
bodyToPassenger,
);
orderRequestController.refuseOrder(
myList[16].toString(), body.toString());
myList[16].toString(),
);
},
kolor: AppColor.redColor,
),

View File

@@ -0,0 +1,370 @@
import 'package:SEFER/controller/home/captin/home_captain_controller.dart';
import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:SEFER/constant/box_name.dart';
import 'package:SEFER/controller/firebase/firbase_messge.dart';
import 'package:SEFER/main.dart';
import 'package:SEFER/views/home/Captin/driver_map_page.dart';
import 'package:SEFER/views/widgets/my_scafold.dart';
import 'package:google_maps_flutter/google_maps_flutter.dart';
import 'dart:math' as math;
import '../../../../constant/colors.dart';
import '../../../../constant/links.dart';
import '../../../../constant/style.dart';
import '../../../../controller/functions/crud.dart';
import '../../../../controller/functions/launch.dart';
import '../../../../controller/home/captin/order_request_controller.dart';
import '../../../widgets/elevated_btn.dart';
class OrderSpeedRequest extends StatelessWidget {
OrderSpeedRequest({super.key});
OrderRequestController orderRequestController =
Get.put(OrderRequestController());
@override
Widget build(BuildContext context) {
final arguments = Get.arguments;
final myListString = arguments['myListString'];
final myList = arguments['DriverList'];
// final pointsList = arguments['PolylineJson'];
final body = arguments['body'];
Duration durationToAdd = Duration(seconds: int.parse(myList[4]));
int hours = durationToAdd.inHours;
int minutes = (durationToAdd.inMinutes % 60).round();
orderRequestController.startTimer(myList[6].toString(), body.toString());
var coords = myList[0].split(',');
var coordDestination = myList[1].split(',');
// Parse to double
double latPassengerLocation = double.parse(coords[0]);
double lngPassengerLocation = double.parse(coords[1]);
double latPassengerDestination = double.parse(coordDestination[0]);
double lngPassengerDestination = double.parse(coordDestination[1]);
List<LatLng> pointsDirection = [
LatLng(latPassengerLocation, lngPassengerLocation),
LatLng(latPassengerDestination, lngPassengerDestination)
]; // Calculate the midpoint between the two points
// Calculate the minimum and maximum latitude and longitude values
double minLatitude =
math.min(pointsDirection[0].latitude, pointsDirection[1].latitude);
double maxLatitude =
math.max(pointsDirection[0].latitude, pointsDirection[1].latitude);
double minLongitude =
math.min(pointsDirection[0].longitude, pointsDirection[1].longitude);
double maxLongitude =
math.max(pointsDirection[0].longitude, pointsDirection[1].longitude);
// Create a bounding box using the calculated values
LatLngBounds bounds = LatLngBounds(
southwest: LatLng(minLatitude, minLongitude),
northeast: LatLng(maxLatitude, maxLongitude),
);
return MyScafolld(
title: 'Order Details Speed'.tr,
body: [
Container(
color: AppColor.accentColor,
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
// SizedBox(height: 200, child: Text(pointsList.toString())),
// Text(message.notification!.body.toString()),
SizedBox(
height: 200,
child: GoogleMap(
initialCameraPosition: CameraPosition(
zoom: 12,
target: Get.find<HomeCaptainController>().myLocation),
cameraTargetBounds: CameraTargetBounds(bounds),
myLocationButtonEnabled: true,
trafficEnabled: true,
buildingsEnabled: true,
mapToolbarEnabled: true,
myLocationEnabled: true,
markers: {
Marker(
markerId: MarkerId('MyLocation'.tr),
position:
LatLng(latPassengerLocation, lngPassengerLocation),
draggable: true,
icon: BitmapDescriptor.defaultMarkerWithHue(
BitmapDescriptor.hueGreen),
),
Marker(
markerId: MarkerId('Destination'.tr),
position: LatLng(
latPassengerDestination, lngPassengerDestination),
draggable: true,
icon: BitmapDescriptor.defaultMarkerWithHue(
BitmapDescriptor.hueBlue),
),
},
polylines: {
Polyline(
zIndex: 1,
consumeTapEvents: true,
geodesic: true,
endCap: Cap.buttCap,
startCap: Cap.buttCap,
visible: true,
polylineId: const PolylineId('routeOrder'),
points: pointsDirection,
color: AppColor.primaryColor,
width: 2,
),
},
),
),
Padding(
padding: const EdgeInsets.all(8.0),
child: Card(
elevation: 3,
color: myList[20].toString() == 'haveSteps'
? AppColor.greenColor
: AppColor.secondaryColor,
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
TextButton.icon(
onPressed: () {
String mapUrl =
'https://www.google.com/maps/dir/${myList[0]}/${myList[1]}/';
print(mapUrl);
showInBrowser(mapUrl);
},
icon: const Icon(Icons.map),
label: myList[20].toString() == 'haveSteps'
? Text(
'Trip has Steps'.tr,
style: AppStyle.title,
)
: Text('Rouats of Trip'.tr,
style: AppStyle.title)),
Container(
color: myList[13].toString() == 'true'
? AppColor.deepPurpleAccent
: AppColor.greenColor,
child: myList[13].toString() ==
'true' //Visa or Cash Method from notify to driver
? Text(
'Visa',
style: AppStyle.title,
)
: Text('Cash', style: AppStyle.title),
)
],
),
),
),
Padding(
padding: const EdgeInsets.all(8.0),
child: RichText(
text: TextSpan(
text: 'Passenger Name is '.tr,
style: AppStyle.title,
children: [
TextSpan(text: myList[8], style: AppStyle.headTitle2),
],
),
),
),
Padding(
padding: const EdgeInsets.all(8.0),
child: RichText(
text: TextSpan(
text: 'Total From Passenger is '.tr,
style: AppStyle.title,
children: [
TextSpan(
text: double.parse(myList[2]).toStringAsFixed(2),
style: AppStyle.headTitle2),
],
),
),
),
Padding(
padding: const EdgeInsets.all(8.0),
child: RichText(
text: TextSpan(
text: 'Duration To Passenger is '.tr,
style: AppStyle.title,
children: [
TextSpan(
text: myList[11].toString(),
style: AppStyle.headTitle2),
],
),
),
),
Padding(
padding: const EdgeInsets.all(8.0),
child: RichText(
text: TextSpan(
text: 'Distance To Passenger is '.tr,
style: AppStyle.title,
children: [
TextSpan(
text: myList[12].toString(),
style: AppStyle.headTitle2),
],
),
),
),
Padding(
padding: const EdgeInsets.all(8.0),
child: Container(
color: AppColor.deepPurpleAccent,
child: RichText(
text: TextSpan(
text: 'Cost Of Trip IS '.tr,
style: AppStyle.title,
children: [
TextSpan(
text: double.parse(myList[26]).toStringAsFixed(2),
style: AppStyle.headTitle2),
],
),
),
),
),
Padding(
padding: const EdgeInsets.all(8.0),
child: RichText(
text: TextSpan(
text: 'Distance from Passenger to destination is '.tr,
style: AppStyle.title,
children: [
TextSpan(
text: myList[5].toString(),
style: AppStyle.headTitle2),
TextSpan(text: ' KM'.tr, style: AppStyle.title),
]),
),
),
Padding(
padding: const EdgeInsets.all(8.0),
child: RichText(
text: TextSpan(
text: 'Duration of Trip is '.tr,
style: AppStyle.title,
children: [
TextSpan(
text: hours > 1
? '${'Your Ride Duration is '.tr}$hours${' H and'.tr} $minutes m'
: '${'Your Ride Duration is '.tr} $minutes m',
style: AppStyle.title),
TextSpan(text: ' Minutes'.tr, style: AppStyle.title),
]),
),
),
Padding(
padding: const EdgeInsets.all(8.0),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
MyElevatedButton(
kolor: AppColor.greenColor,
title: 'Accept Order'.tr,
onPressed: () async {
box.write(BoxName.statusDriverLocation, 'on');
orderRequestController.changeApplied();
await CRUD().postFromDialogue(
link: AppLink.addDriverOrder,
payload: {
'driver_id': box.read(
BoxName.driverID), //myList[6].toString(),
// box.read(BoxName.driverID).toString(),
'order_id':
myList[16].toString(), //body.toString(),
'status': 'Apply'
});
await CRUD()
.post(link: AppLink.updateRides, payload: {
'id': myList[16],
'rideTimeStart': DateTime.now().toString(),
'status': 'Apply',
'driver_id': box.read(BoxName.driverID),
});
// Get.back();
List<String> bodyToPassenger = [
box.read(BoxName.driverID).toString(),
box.read(BoxName.nameDriver).toString(),
box.read(BoxName.tokenDriver).toString(),
];
// print(bodyToPassenger);
FirebaseMessagesController()
.sendNotificationToPassengerToken(
'Apply Ride',
arguments['DriverList'][9].toString(),
arguments['DriverList'][9].toString(),
// box.read(BoxName.tokenDriver).toString(),
bodyToPassenger,
);
Get.back();
Get.to(() => PassengerLocationMapPage(), arguments: {
'passengerLocation': myList[0].toString(),
'passengerDestination': myList[1].toString(),
'Duration': myList[4].toString(),
'totalCost': myList[26].toString(),
'Distance': myList[5].toString(),
'name': myList[8].toString(),
'phone': myList[10].toString(),
'email': myList[28].toString(),
'WalletChecked': myList[13].toString(),
'tokenPassenger': myList[9].toString(),
'direction':
'https://www.google.com/maps/dir/${myList[0]}/${myList[1]}/',
'DurationToPassenger': myList[15].toString(),
'rideId': myList[16].toString(),
'passengerId': myList[7].toString(),
'driverId': myList[18].toString(),
'durationOfRideValue': myList[19].toString(),
'paymentAmount': myList[2].toString(),
'paymentMethod': myList[13].toString() == 'true'
? 'visa'
: 'cash',
'isHaveSteps': myList[20].toString(),
'step0': myList[21].toString(),
'step1': myList[22].toString(),
'step2': myList[23].toString(),
'step3': myList[24].toString(),
'step4': myList[25].toString(),
'passengerWalletBurc': myList[26].toString(),
'timeOfOrder': DateTime.now().toString(),
'totalPassenger': myList[2].toString(),
});
},
),
GetBuilder<OrderRequestController>(
builder: (timerController) {
final isNearEnd =
timerController.remainingTimeSpeed <=
5; // Define a threshold for "near end"
return Stack(
alignment: Alignment.center,
children: [
CircularProgressIndicator(
value: timerController.progressSpeed,
// Set the color based on the "isNearEnd" condition
color: isNearEnd ? Colors.red : Colors.blue,
),
Text(
'${timerController.remainingTimeSpeed}',
style: AppStyle.number,
),
],
);
},
),
],
),
)
],
),
)
],
isleading: true);
}
}

View File

@@ -8,7 +8,9 @@ import '../../views/home/map_widget.dart/cancel_raide_page.dart';
import '../../views/home/map_widget.dart/ride_begin_passenger.dart';
import '../../controller/home/menu_controller.dart';
import 'map_widget.dart/apply_order_widget.dart';
import 'map_widget.dart/buttom_sheet_map_show.dart';
import 'map_widget.dart/car_details_widget_to_go.dart';
import 'map_widget.dart/cash_confirm_bottom_page.dart';
import 'map_widget.dart/driver_card_from_passenger.dart';
import 'map_widget.dart/google_map_passenger_widget.dart';
@@ -18,6 +20,7 @@ import 'map_widget.dart/map_menu_widget.dart';
import 'map_widget.dart/menu_map_page.dart';
import 'map_widget.dart/payment_method.page.dart';
import 'map_widget.dart/points_page_for_rider.dart';
import 'map_widget.dart/searching_captain_window.dart';
import 'map_widget.dart/timer_for_cancell_trip_from_passenger.dart';
import 'map_widget.dart/timer_to_passenger_from_driver.dart';
@@ -41,13 +44,16 @@ class MapPagePassenger extends StatelessWidget {
const MapMenuWidget(),
const MenuIconMapPageWidget(),
buttomSheetMapPage(),
hexagonClipper(),
const CarDetailsTypeToChoose(),
const ApplyOrderWidget(),
// hexagonClipper(),
const CancelRidePageShow(),
CashConfirmPageShown(),
const PaymentMethodPage(),
timerForCancelTripFromPassenger(),
const SearchingCaptainWindow(),
// timerForCancelTripFromPassenger(),
// const DriverTimeArrivePassengerPage(),
const TimerToPassengerFromDriver(),
// const TimerToPassengerFromDriver(),
const RideBeginPassenger(),
cancelRidePage(),
PointsPageForRider()

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()
],

View File

@@ -148,9 +148,9 @@ class PassengerWalletDialoge extends StatelessWidget {
controller.makePaymentStripe(
controller.selectedAmount!
.toDouble(), // Convert int to double
box.read(BoxName.countryCode) == 'Jordan'.tr
? 'USD'
: 'EGP', () {
box.read(BoxName.countryCode) != 'Egypt'.tr
? 'EGP'
: 'USD', () {
controller.addPassengerWallet();
controller.changePromoSheetDialogue();
controller.getPassengerWallet();

View File

@@ -43,19 +43,19 @@ class WaletCaptain extends StatelessWidget {
0 &&
double.parse(captainWalletController
.totalPoints) >
-500
-300
? AppColor.yellowColor
: double.parse(captainWalletController
.totalPoints) <
-500
-300
? AppColor.redColor
: AppColor.greenColor,
),
child: InkWell(
onTap: () {
Get.snackbar(
'the 500 points equal 30 JOD'.tr,
'the 500 points equal 30 JOD for you \nSo go and gain your money'
'the 300 points equal 30 JOD'.tr,
'the 300 points equal 30 JOD for you \nSo go and gain your money'
.tr,
backgroundColor: AppColor.greenColor,
snackPosition: SnackPosition.BOTTOM,
@@ -77,7 +77,7 @@ class WaletCaptain extends StatelessWidget {
),
double.parse(captainWalletController.totalPoints
.toString()) <
-500
-300
? MyElevatedButton(
title: 'Charge your Account'.tr,
onPressed: () {})
@@ -258,7 +258,7 @@ class WaletCaptain extends StatelessWidget {
PointsCaptain(
kolor: AppColor.blueColor,
pricePoint: 5.6,
countPoint: '500',
countPoint: '300',
),
PointsCaptain(
kolor: Colors.green,

View File

@@ -1,5 +1,9 @@
import 'dart:io';
import 'package:flutter/material.dart';
import 'package:SEFER/constant/style.dart';
import 'package:flutter/services.dart';
import 'package:vibration/vibration.dart';
import '../../constant/colors.dart';
@@ -7,11 +11,13 @@ class MyElevatedButton extends StatelessWidget {
final String title;
final VoidCallback onPressed;
final Color kolor;
final int vibrateDuration;
const MyElevatedButton({
Key? key,
required this.title,
required this.onPressed,
this.kolor = AppColor.primaryColor,
this.vibrateDuration = 100,
}) : super(key: key);
@override
@@ -20,7 +26,18 @@ class MyElevatedButton extends StatelessWidget {
style: ButtonStyle(
backgroundColor: MaterialStateProperty.all(kolor),
),
onPressed: onPressed,
onPressed: () async {
// Handle haptic feedback for both iOS and Android
if (Platform.isIOS) {
HapticFeedback.selectionClick();
} else {
Vibration.vibrate(duration: 100);
// Vibrate.vibrateWithPauses(pauses);
}
// Ensure the onPressed callback is called after haptic feedback
onPressed();
},
child: Text(
title,
textAlign: TextAlign.center,