This commit is contained in:
Hamza Aleghwairyeen
2024-04-26 18:23:45 +03:00
parent a9c570cab7
commit dcf02cc36d
22 changed files with 600 additions and 344 deletions

View File

@@ -165,80 +165,91 @@ class ApplyOrderWidget extends StatelessWidget {
Get.defaultDialog(
title: 'Select one message'.tr,
titleStyle: AppStyle.title,
content: Column(
children: [
InkWell(
onTap: () {
FirebaseMessagesController()
.sendNotificationToAnyWithoutData(
'message From passenger',
'Hello, I\'m at the agreed-upon location'
.tr,
controller.driverToken);
Get.back();
},
child: Container(
decoration:
AppStyle.boxDecoration1,
child: Padding(
padding:
const EdgeInsets.all(10),
child: Text(
'Hello, I\'m at the agreed-upon location'
.tr,
style: AppStyle.title,
content: Container(
height: Get.height * .5,
child: Column(
mainAxisAlignment:
MainAxisAlignment.spaceEvenly,
children: [
InkWell(
onTap: () {
FirebaseMessagesController()
.sendNotificationToAnyWithoutData(
'message From passenger',
'Hello, I\'m at the agreed-upon location'
.tr,
controller
.driverToken);
Get.back();
},
child: Container(
decoration:
AppStyle.boxDecoration1,
child: Padding(
padding:
const EdgeInsets.all(
10),
child: Text(
'Hello, I\'m at the agreed-upon location'
.tr,
style: AppStyle.title,
),
),
),
),
),
InkWell(
onTap: () {
FirebaseMessagesController()
.sendNotificationToAnyWithoutData(
'message From passenger',
'My location is correct. You can search for me using the navigation app'
.tr,
controller.driverToken);
Get.back();
},
child: Container(
decoration:
AppStyle.boxDecoration1,
child: Padding(
padding:
const EdgeInsets.all(10),
child: Text(
'My location is correct. You can search for me using the navigation app'
.tr,
style: AppStyle.title,
InkWell(
onTap: () {
FirebaseMessagesController()
.sendNotificationToAnyWithoutData(
'message From passenger',
'My location is correct. You can search for me using the navigation app'
.tr,
controller
.driverToken);
Get.back();
},
child: Container(
decoration:
AppStyle.boxDecoration1,
child: Padding(
padding:
const EdgeInsets.all(
10),
child: Text(
'My location is correct. You can search for me using the navigation app'
.tr,
style: AppStyle.title,
),
),
),
),
),
InkWell(
onTap: () {
FirebaseMessagesController()
.sendNotificationToAnyWithoutData(
'message From passenger',
'I\'m waiting for you'
.tr,
controller.driverToken);
Get.back();
},
child: Container(
decoration:
AppStyle.boxDecoration1,
child: Padding(
padding:
const EdgeInsets.all(10),
child: Text(
'I\'m waiting for you'.tr,
style: AppStyle.title,
InkWell(
onTap: () {
FirebaseMessagesController()
.sendNotificationToAnyWithoutData(
'message From passenger',
'I\'m waiting for you'
.tr,
controller
.driverToken);
Get.back();
},
child: Container(
decoration:
AppStyle.boxDecoration1,
child: Padding(
padding:
const EdgeInsets.all(
10),
child: Text(
'I\'m waiting for you'.tr,
style: AppStyle.title,
),
),
),
),
),
],
],
),
));
},
icon: const Icon(

View File

@@ -27,7 +27,7 @@ List<CarType> carTypes = [
image: 'assets/images/blob.png'),
CarType(
carType: 'Speed',
carDetail: 'Better for long trips choice'.tr,
carDetail: 'Closest & Cheapest'.tr,
image: 'assets/images/carspeed.png'),
CarType(
carType: 'Delivery',
@@ -72,6 +72,7 @@ class CarDetailsTypeToChoose extends StatelessWidget {
final carType = carTypes[index];
return ListTile(
title: Container(
width: Get.width,
decoration: BoxDecoration(
color: AppColor.secondaryColor,
borderRadius: const BorderRadius.all(
@@ -92,11 +93,11 @@ class CarDetailsTypeToChoose extends StatelessWidget {
children: [
Image.asset(
carType.image,
width: 60,
height: 60,
width: 50,
height: 50,
),
SizedBox(
width: Get.width * .5,
width: Get.width * .4,
child: Column(
children: [
Text(
@@ -131,7 +132,10 @@ class CarDetailsTypeToChoose extends StatelessWidget {
style: AppStyle.title
.copyWith(fontSize: 20),
),
carType.carType == 'Comfort'
carType.carType == 'Comfort' &&
(mapPassengerController
.totalPassengerSpeed >
20)
? Row(
children: [
Container(
@@ -142,7 +146,7 @@ class CarDetailsTypeToChoose extends StatelessWidget {
style: AppStyle.subtitle
.copyWith(
color: AppColor
.secondaryColor),
.greenColor),
)),
const SizedBox(
width: 10,
@@ -153,15 +157,50 @@ class CarDetailsTypeToChoose extends StatelessWidget {
.toStringAsFixed(2),
style:
AppStyle.title.copyWith(
color: AppColor.redColor,
decoration: TextDecoration
.lineThrough, // Strikethrough line
),
)
],
)
: const SizedBox(
width: 3,
),
: carType.carType == 'Speed' &&
(mapPassengerController
.totalPassengerSpeed >
20)
? Row(
children: [
Container(
decoration: AppStyle
.boxDecoration1,
child: Text(
'-10%',
style: AppStyle
.subtitle
.copyWith(
color: AppColor
.greenColor),
)),
const SizedBox(
width: 10,
),
Text(
mapPassengerController
.totalPassengerSpeedDiscount
.toStringAsFixed(2),
style: AppStyle.title
.copyWith(
color:
AppColor.redColor,
decoration: TextDecoration
.lineThrough, // Strikethrough line
),
)
],
)
: const SizedBox(
width: 3,
),
],
),
const SizedBox(

View File

@@ -26,147 +26,68 @@ GetBuilder<MapPassengerController> formSearchPlacesDestenation() {
padding: const EdgeInsets.all(6),
child: Column(
children: [
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Container(
width: Get.width * .8,
height: 40,
decoration: const BoxDecoration(
color: AppColor.secondaryColor),
child: TextField(
decoration: InputDecoration(
border: const OutlineInputBorder(
borderRadius: BorderRadius.only(),
gapPadding: 4,
borderSide: BorderSide(
color: AppColor.redColor,
width: 2,
)),
suffixIcon: const Icon(Icons.search),
hintText: controller.hintTextDestinationPoint,
hintStyle: AppStyle.title,
hintMaxLines: 1,
prefixIcon: IconButton(
onPressed: () {
controller.placeDestinationController.clear();
controller.clearPlacesDestination();
},
icon: Icon(
Icons.clear,
color: Colors.red[300],
),
),
),
controller: controller.placeDestinationController,
onChanged: (value) {
if (controller
.placeDestinationController.text.length >
5) {
controller.getPlaces();
controller.changeHeightPlaces();
}
Container(
width: Get.width * .9,
height: 40,
decoration:
const BoxDecoration(color: AppColor.secondaryColor),
child: TextField(
decoration: InputDecoration(
border: const OutlineInputBorder(
borderRadius: BorderRadius.only(),
gapPadding: 4,
borderSide: BorderSide(
color: AppColor.redColor,
width: 2,
)),
suffixIcon: const Icon(Icons.search),
hintText: controller.hintTextDestinationPoint,
hintStyle: AppStyle.title,
hintMaxLines: 1,
prefixIcon: IconButton(
onPressed: () {
controller.placeDestinationController.clear();
controller.clearPlacesDestination();
},
// onEditingComplete: () => controller.changeHeight(),
icon: Icon(
Icons.clear,
color: Colors.red[300],
),
),
),
IconButton(
onPressed: () {
controller: controller.placeDestinationController,
onChanged: (value) {
if (controller
.placeDestinationController.text.length >
5) {
controller.getPlaces();
controller.changeHeightPlaces();
}
},
// onEditingComplete: () => controller.changeHeight(),
),
),
const SizedBox(
height: 10,
),
Container(
decoration: AppStyle.boxDecoration1,
child: InkWell(
onTap: () {
controller.changeMainBottomMenuMap();
controller.changePickerShown();
},
icon: const Icon(
Icons.map_outlined,
color: AppColor.greenColor,
child: Padding(
padding: const EdgeInsets.symmetric(
horizontal: 20, vertical: 4),
child: Text(
'Pick from map'.tr,
style: AppStyle.headTitle2,
),
),
),
// IconButton(
// onPressed: () async {
// List recentLocations = await sql.getCustomQuery('''
// SELECT * FROM ${TableName.recentLocations}
// ORDER BY id DESC
// LIMIT 4
// ''');
// Get.defaultDialog(
// title: 'Latest Recent Trip'.tr,
// content: recentLocations.isEmpty
// ? Center(
// child: Column(
// mainAxisAlignment:
// MainAxisAlignment.center,
// children: [
// const Icon(
// Icons.hourglass_empty_rounded,
// size: 99,
// color: AppColor.primaryColor,
// ),
// Text(
// 'You Dont Have Any places yet !'.tr,
// style: AppStyle.title,
// ),
// ],
// ),
// )
// : SizedBox(
// height: Get.width * .5,
// width: Get.width * .8,
// child: ListView.builder(
// itemCount: recentLocations.length,
// itemBuilder:
// (BuildContext context, int index) {
// return Row(
// mainAxisAlignment:
// MainAxisAlignment.spaceBetween,
// children: [
// TextButton(
// onPressed: () async {
// Get.back();
// controller
// .convertHintTextDestinationNewPlacesFromRecent(
// recentLocations,
// index);
// },
// child: Text(
// recentLocations[index]
// ['name'],
// style: AppStyle.title,
// ),
// ),
// IconButton(
// onPressed: () async {
// await sql.deleteData(
// TableName.placesFavorite,
// recentLocations[index]
// ['id']);
// Get.back();
// // ignore: use_build_context_synchronously
// Toast.show(
// context,
// '${'You are Delete'.tr} ${recentLocations[index]['name']} ${'from your list'.tr}',
// AppColor.redColor);
// // Get.snackbar('Deleted'.tr,
// // '${'You are Delete'.tr} ${favoritePlaces[index]['name']} from your list',
// // backgroundColor:
// // AppColor.accentColor);
// },
// icon: const Icon(
// Icons.favorite_outlined),
// ),
// ],
// );
// },
// ),
// ),
// );
// // controller.changeMainBottomMenuMap();
// // controller.changePickerShown();
// },
// icon: const Icon(
// Icons.recent_actors,
// color: AppColor.blueColor,
// ),
// ),
],
)),
const SizedBox(
height: 10,
),
SizedBox(
height: 50,
@@ -211,13 +132,14 @@ GetBuilder<MapPassengerController> formSearchPlacesDestenation() {
color: AppColor.greenColor.withOpacity(.4),
border: Border.all()),
child: Text(
'Work : ${box.read(BoxName.addWork).toString() == 'addWork' ? 'Add Work' : box.read(BoxName.addWork).toString().split(',')[0] + box.read(BoxName.addWork).toString().split(',')[1]} '),
'${'Work :'.tr} ${box.read(BoxName.addWork).toString() == 'addWork' ? 'Add Work' : box.read(BoxName.addWork).toString().split(',')[0] + box.read(BoxName.addWork).toString().split(',')[1]} '),
),
),
InkWell(
onLongPress: () {
Get.defaultDialog(
title: 'Do you want to change Home location',
title:
'Do you want to change Home location'.tr,
middleText: '',
confirm: MyElevatedButton(
title: 'Yes'.tr,
@@ -259,7 +181,7 @@ GetBuilder<MapPassengerController> formSearchPlacesDestenation() {
),
)
],
),
), //
),
// controller.placesDestination.isEmpty
// ? InkWell(
@@ -296,10 +218,18 @@ GetBuilder<MapPassengerController> formSearchPlacesDestenation() {
controller.changeHeightPlaces();
controller.passengerLocation = controller.newMyLocation;
controller.myDestination = LatLng(
double.parse(
res['geometry']['location']['lat'].toString()),
double.parse(
res['geometry']['location']['lng'].toString()));
controller.convertHintTextDestinationNewPlaces(index);
controller.placesDestination = [];
controller.placeDestinationController.clear();
controller.changeMainBottomMenuMap();
controller.passengerStartLocationFromMap = true;
controller.isPickerShown = true;
},
child: Padding(
padding: const EdgeInsets.symmetric(horizontal: 10),

View File

@@ -350,6 +350,8 @@ class GoogleMapPassengerWidget extends StatelessWidget {
}
if (controller.startLocationFromMap == true) {
controller.newStartPointLocation = position.target;
} else if (controller.passengerStartLocationFromMap == true) {
controller.newStartPointLocation = position.target;
}
controller.newMyLocation = position.target;

View File

@@ -1,11 +1,14 @@
import 'package:SEFER/constant/style.dart';
import 'package:SEFER/controller/functions/crud.dart';
import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:google_maps_flutter/google_maps_flutter.dart';
import 'package:path/path.dart' as path;
import '../../../constant/colors.dart';
import '../../../constant/links.dart';
import '../../../controller/functions/audio_record1.dart';
import '../../../controller/functions/tts.dart';
import '../../../controller/functions/upload_image.dart';
import '../../../controller/home/map_passenger_controller.dart';
GetBuilder<MapPassengerController> leftMainMenuIcons() {
@@ -83,77 +86,85 @@ GetBuilder<MapPassengerController> leftMainMenuIcons() {
const SizedBox(
height: 5,
),
AnimatedContainer(
duration: const Duration(microseconds: 200),
width: controller.widthMapTypeAndTraffic,
decoration: BoxDecoration(
color: AppColor.secondaryColor,
border: Border.all(),
borderRadius: BorderRadius.circular(15)),
child: IconButton(
onPressed: () async {
await Get.find<AudioRecorderController>().stopRecording();
},
icon: const Icon(
Icons.voice_chat,
size: 29,
),
),
),
AnimatedContainer(
duration: const Duration(microseconds: 200),
width: controller.widthMapTypeAndTraffic,
decoration: BoxDecoration(
color: AppColor.secondaryColor,
border: Border.all(),
borderRadius: BorderRadius.circular(15)),
child: IconButton(
onPressed: () async {
// AC credentials = AC();
// String apiKey = AK.payPalSecret;
// String convertedStringN = credentials.c(
// credentials.c(credentials.c(apiKey, cs), cC), cn);
// print('Converted v: $convertedStringN');
// String retrievedStringS = credentials.r(
// credentials.r(credentials.r(convertedStringN, cn), cC),
// cs);
// print('Retrieved String: $retrievedStringS');
// //
// if (retrievedStringS == apiKey) {
// print('same');
// }
// print(box.read(BoxName.passengerWalletTotal));
// print(box.read(BoxName.name));
// print(box.read(BoxName.phone));
// print(box.read(BoxName.email));
// await Get.find<PaymentController>()
// .payWithPayMob(context, '1100', 'EGP');
// Initiates a payment with a card using the FlutterPaymob instance
// NotificationController()
// .showNotification('Order', 'hi this is', 'tone1');
// Get.to(() => DriverCallPage());
// print(controller.carLocationsModels);
// controller.getKazanPercent();
// PassengerCallPage(
// channelName: '',
// token: '',
// remoteID: '',
// )
// Get.to(() => const CallPage());
// print(box.read(BoxName.lang));
await Get.find<AudioRecorderController>().startRecording();
},
icon: Icon(
Get.put(AudioRecorderController()).isRecording
? Icons.stop
: Icons.start,
size: 29,
),
),
),
// AnimatedContainer(
// duration: const Duration(microseconds: 200),
// width: controller.widthMapTypeAndTraffic,
// decoration: BoxDecoration(
// color: AppColor.secondaryColor,
// border: Border.all(),
// borderRadius: BorderRadius.circular(15)),
// child: IconButton(
// onPressed: () async {
// await Get.find<AudioRecorderController>().stopRecording();
// },
// icon: const Icon(
// Icons.voice_chat,
// size: 29,
// ),
// ),
// ),
// AnimatedContainer(
// duration: const Duration(microseconds: 200),
// width: controller.widthMapTypeAndTraffic,
// decoration: BoxDecoration(
// color: AppColor.secondaryColor,
// border: Border.all(),
// borderRadius: BorderRadius.circular(15)),
// child: IconButton(
// onPressed: () async {
// await CRUD().allMethodForAI(
// 'name,fullName,address,idNumber,cardId,dob',
// AppLink.uploadEgypt,
// 'idFront');
//
// // await ImageController().choosImage(
// // 'https://api.sefer.live/sefer/uploadEgypt.php',
// // 'FrontId');
// // AC credentials = AC();
// // String apiKey = AK.payPalSecret;
// // String convertedStringN = credentials.c(
// // credentials.c(credentials.c(apiKey, cs), cC), cn);
// // print('Converted v: $convertedStringN');
//
// // String retrievedStringS = credentials.r(
// // credentials.r(credentials.r(convertedStringN, cn), cC),
// // cs);
// // print('Retrieved String: $retrievedStringS');
// // //
// // if (retrievedStringS == apiKey) {
// // print('same');
// // }
//
// // print(box.read(BoxName.passengerWalletTotal));
// // print(box.read(BoxName.name));
// // print(box.read(BoxName.phone));
// // print(box.read(BoxName.email));
// // await Get.find<PaymentController>()
// // .payWithPayMob(context, '1100', 'EGP');
// // Initiates a payment with a card using the FlutterPaymob instance
//
// // NotificationController()
// // .showNotification('Order', 'hi this is', 'tone1');
// // Get.to(() => DriverCallPage());
// // print(controller.carLocationsModels);
// // controller.getKazanPercent();
// // PassengerCallPage(
// // channelName: '',
// // token: '',
// // remoteID: '',
// // )
// // Get.to(() => const CallPage());
// // print(box.read(BoxName.lang));
// await Get.find<AudioRecorderController>().startRecording();
// },
// icon: Icon(
// Get.put(AudioRecorderController()).isRecording
// ? Icons.stop
// : Icons.start,
// size: 29,
// ),
// ),
// ),
],
);
})),

View File

@@ -6,6 +6,7 @@ import 'package:SEFER/controller/home/map_passenger_controller.dart';
import 'package:SEFER/main.dart';
import 'package:SEFER/views/home/map_widget.dart/form_search_places_destenation.dart';
import 'package:SEFER/views/widgets/elevated_btn.dart';
import 'package:google_maps_flutter/google_maps_flutter.dart';
import '../../../constant/colors.dart';
import '../../../constant/table_names.dart';
@@ -78,18 +79,18 @@ class MainBottomMenuMap extends StatelessWidget {
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,
),
),
// controller.isMainBottomMenuMap
// ? const SizedBox()
// : InkWell(
// onTap: () async {
// controller.getCurrentLocationFormString();
// },
// child: Text(
// 'From :'.tr +
// ' ${controller.currentLocationString}'.tr,
// style: AppStyle.subtitle,
// ),
// ),
controller.isMainBottomMenuMap
? const SizedBox()
: Column(
@@ -204,7 +205,27 @@ class MainBottomMenuMap extends StatelessWidget {
onPressed: () async {
controller.clearPolyline();
controller.data = [];
if (controller.startLocationFromMap == true) {
if (controller.passengerStartLocationFromMap == true) {
controller.newMyLocation = controller.newStartPointLocation;
controller.changeMainBottomMenuMap();
await controller.getMap(
'${controller.newStartPointLocation.latitude},${controller.newStartPointLocation.longitude}',
'${controller.myDestination.latitude},${controller.myDestination.longitude}',
);
controller.currentLocationToFormPlaces = false;
controller.placesDestination = [];
// controller.isCancelRidePageShown = true;
controller.clearPlacesStart();
controller.clearPlacesDestination();
controller.passengerStartLocationFromMap = false;
controller.isPickerShown = false;
// controller.showBottomSheet1();
// Get.back();
controller.showBottomSheet1();
// controller.hintTextStartPoint =
// '${controller.newStartPointLocation.latitude.toStringAsFixed(4)} , ${controller.newStartPointLocation.longitude.toStringAsFixed(4)}';
} else if (controller.startLocationFromMap == true) {
controller.newMyLocation = controller.newStartPointLocation;
controller.hintTextStartPoint =
'${controller.newStartPointLocation.latitude.toStringAsFixed(4)} , ${controller.newStartPointLocation.longitude.toStringAsFixed(4)}';
@@ -232,16 +253,36 @@ class MainBottomMenuMap extends StatelessWidget {
} else {
controller.hintTextDestinationPoint =
'${controller.newMyLocation.latitude.toStringAsFixed(4)} , ${controller.newMyLocation.longitude.toStringAsFixed(4)}';
controller.newMyLocation = controller.newMyLocation;
controller.myDestination = controller.newMyLocation;
controller.isPickerShown = false;
controller.changeMainBottomMenuMap();
controller.passengerStartLocationFromMap = true;
controller.isPickerShown = true;
await controller.mapController?.animateCamera(CameraUpdate.newLatLng(
LatLng(controller.passengerLocation.latitude,
controller.passengerLocation.longitude)));
Get.defaultDialog(
title: 'Destination selected'.tr,
titleStyle: AppStyle.title,
content: Text(
'Now select start pick'.tr,
style: AppStyle.title,
),
confirm: MyElevatedButton(
title: 'OK'.tr,
onPressed: () {
Get.back();
}));
}
controller.placesDestination = [];
controller.placeDestinationController.clear();
controller.showBottomSheet1();
Get.back();
controller.showBottomSheet1();
// Get.back();
// controller.showBottomSheet1();
controller.changeMainBottomMenuMap();
},
child: Row(
@@ -261,7 +302,9 @@ class MainBottomMenuMap extends StatelessWidget {
),
),
Text(
"Click here point".tr,
controller.passengerStartLocationFromMap
? 'Pick your ride location on the map - Tap to confirm'.tr
: "Click here point".tr,
style: AppStyle.title,
),
],

View File

@@ -0,0 +1,29 @@
import 'package:SEFER/constant/style.dart';
import 'package:SEFER/controller/home/map_passenger_controller.dart';
import 'package:flutter/material.dart';
import 'package:get/get.dart';
class PassengerRideLocationWidget extends StatelessWidget {
const PassengerRideLocationWidget({super.key});
@override
Widget build(BuildContext context) {
return GetBuilder<MapPassengerController>(
builder: (mapPassengerController) {
return mapPassengerController.isPassengerRideLocationWidget
? Positioned(
bottom: 1,
right: 1,
left: 1,
child: Container(
height: Get.height * .2,
decoration: AppStyle.boxDecoration1,
child: Center(
child: Text('Choose ride location'.tr),
),
),
)
: const SizedBox();
});
}
}