This commit is contained in:
Hamza-Ayed
2024-05-31 01:25:20 +03:00
parent 93adf15874
commit efec9eb6a2
8 changed files with 509 additions and 503 deletions

View File

@@ -2,8 +2,9 @@ import 'package:flutter/material.dart';
class AppColor {
static const Color primaryColor = Colors.black; // Slightly softer red
static const Color secondaryColor = Colors.white;
static const Color accentColor = Color(0xFFD81F26); // Google Green
static const Color secondaryColor = Color.fromARGB(255, 255, 255, 255);
static const Color accentColor =
Color.fromARGB(255, 185, 169, 169); // Google Green
static const Color backgroundColor =
Color(0xFFF5F5F5); // Light grey background
static const Color redColor = Color(0xFFEA4335); // Google Red

View File

@@ -81,8 +81,8 @@ class RegisterController extends GetxController {
'token': randomNumber.toString(),
});
// await smsEgyptController.sendSmsEgypt(
// phoneController.text.toString(), randomNumber.toString());
await smsEgyptController.sendSmsEgypt(
phoneController.text.toString(), randomNumber.toString());
isSent = true;
isLoading = false;
update();

View File

@@ -22,7 +22,7 @@ void launchCommunication(
url = 'tel:$contactInfo';
break;
case 'sms':
url = 'sms:$contactInfo?body=$encodedMessage';
url = 'sms:$contactInfo&body=$encodedMessage';
break;
case 'whatsapp':
url =
@@ -58,8 +58,10 @@ void launchCommunication(
return;
}
if (await canLaunch(url)) {
await launch(url);
print('Launching URL: $url'); // Add this line for debugging
if (await canLaunchUrl(Uri.parse(url))) {
await launchUrl(Uri.parse(url));
} else {
print('Could not launch $url');
}

View File

@@ -4,6 +4,8 @@ class MyTranslation extends Translations {
@override
Map<String, Map<String, String>> get keys => {
"ar": {
'The driver waiting you in picked location .':
"السائق ينتظرك في موقع الركوب.",
'About Us': "نبذة عنا",
"Most Secure Methods": "أساليب الأمان الأكثر فاعلية",
"In-App VOIP Calls": "مكالمات VOIP داخل التطبيق",

View File

@@ -13,497 +13,497 @@ import '../../../controller/home/map_passenger_controller.dart';
GetBuilder<MapPassengerController> buttomSheetMapPage() {
Get.put(PaymentController());
return GetBuilder<MapPassengerController>(
builder: (controller) => controller.isBottomSheetShown &&
controller.rideConfirm == false
? Positioned(
left: 5,
bottom: 0,
right: 5,
child: Column(
children: [
Row(
mainAxisAlignment: MainAxisAlignment.end,
children: [
double.parse(box.read(BoxName.passengerWalletTotal)) <
0 &&
controller.data.isNotEmpty
? Container(
decoration: AppStyle.boxDecoration.copyWith(
color: AppColor.redColor.withOpacity(.5)),
height: 50,
width: Get.width * .94,
child: Padding(
padding:
const EdgeInsets.symmetric(horizontal: 8),
child: Text(
'Your trip cost is'.tr +
' ${controller.totalCostPassenger.toStringAsFixed(2)} '
'But you have a negative salary of'
.tr +
'${double.parse(box.read(BoxName.passengerWalletTotal)).toStringAsFixed(2)}'
' in your'
.tr +
' ${AppInformation.appName}'
' wallet due to a previous trip.'
.tr,
style: AppStyle.subtitle,
),
))
: const SizedBox(),
],
),
const SizedBox(
height: 5,
),
AnimatedContainer(
// clipBehavior: Clip.antiAliasWithSaveLayer,
curve: Curves.easeInCirc,
onEnd: () {
controller.height = 250;
},
height: controller.heightBottomSheetShown,
duration: const Duration(seconds: 2),
child: Column(
children: [
controller.data.isEmpty
? const SizedBox()
: Container(
// width: Get.width * .9,
height: 100,
decoration: BoxDecoration(
color: AppColor.secondaryColor,
boxShadow: [
const BoxShadow(
color: AppColor.accentColor,
offset: Offset(2, 2)),
BoxShadow(
color: AppColor.accentColor
.withOpacity(.4),
offset: const Offset(-2, -2))
],
borderRadius: const BorderRadius.all(
Radius.circular(15))),
child: ListView.builder(
scrollDirection: Axis.horizontal,
itemCount: controller
.dataCarsLocationByPassenger.length -
1,
itemBuilder:
(BuildContext context, int index) {
return Container(
color: controller.gender == 'Female'
? const Color.fromARGB(
255, 246, 52, 181)
: AppColor.secondaryColor,
width: Get.width,
child: Row(
mainAxisAlignment:
MainAxisAlignment.spaceBetween,
children: [
SizedBox(
width: Get.width * .15,
child: Padding(
padding:
const EdgeInsets.all(8.0),
child: Image.asset(
'assets/images/jeep.png',
width: 50,
fit: BoxFit.fill,
repeat: ImageRepeat.repeatX,
),
),
),
SizedBox(
width: Get.width * .55,
child: Column(
crossAxisAlignment:
CrossAxisAlignment.start,
mainAxisAlignment:
MainAxisAlignment.spaceEvenly,
children: [
Text(
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,
),
// Text(
// '${'You will be thier in'.tr} ${DateFormat('h:mm a').format(controller.newTime)}',
// style: AppStyle.subtitle,
// ),
Text(
'${'Your trip distance is'.tr} ${controller.distance.toStringAsFixed(2)} ${'KM'.tr}',
style: AppStyle.subtitle,
)
],
),
),
SizedBox(
width: Get.width * .2,
child: Padding(
padding: const EdgeInsets.only(
right: 5, left: 5),
child: Column(
crossAxisAlignment:
CrossAxisAlignment.center,
children: [
Container(
width: Get.width * .14,
height: Get.height * .06,
decoration: BoxDecoration(
color: AppColor
.secondaryColor,
shape:
BoxShape.rectangle,
border: Border.all(
width: 2,
color: AppColor
.greenColor)),
child: Center(
child: Text(
'${'Fee is'.tr} \n${controller.totalPassenger.toStringAsFixed(2)}',
style:
AppStyle.subtitle,
),
),
),
controller.promoTaken
? const Icon(
Icons
.filter_vintage_rounded,
color:
AppColor.redColor,
)
: const SizedBox(
height: 0,
)
],
),
),
),
],
),
);
},
),
),
const SizedBox(
height: 5,
),
Container(
// height: 130,
decoration: BoxDecoration(
color: AppColor.secondaryColor,
boxShadow: [
const BoxShadow(
color: AppColor.accentColor,
offset: Offset(2, 2)),
BoxShadow(
color: AppColor.accentColor.withOpacity(.4),
offset: const Offset(-2, -2))
],
borderRadius:
const BorderRadius.all(Radius.circular(15))),
child: controller.data.isEmpty
? const SizedBox()
: Center(
child: Padding(
padding: const EdgeInsets.symmetric(
horizontal: 5),
child: Column(
children: [
Row(
children: [
const Icon(
Icons.location_on,
color: AppColor.redColor,
),
const SizedBox(
width: 10,
),
Text(
'From : '.tr,
style: AppStyle.subtitle,
),
Text(
controller.data[0]
['start_address']
.toString(),
style: AppStyle.subtitle,
)
],
),
Row(
children: [
const Icon(Icons
.location_searching_rounded),
const SizedBox(
width: 10,
),
Text(
'To : '.tr,
style: AppStyle.subtitle,
),
Text(
controller.data[0]['end_address'],
style: AppStyle.subtitle,
),
],
),
const Divider(
color: AppColor.accentColor,
thickness: 1,
height: 2,
indent: 1,
),
SizedBox(
height: 40,
child: Row(
mainAxisAlignment:
MainAxisAlignment.center,
children: [
Container(
decoration: BoxDecoration(
color:
AppColor.secondaryColor,
borderRadius:
BorderRadius.circular(12),
// border: Border.all(),
),
child: Row(
children: [
Icon(
Icons.monetization_on,
color: Colors.green[400],
),
InkWell(
onTap: () async {
controller
.changeCashConfirmPageShown();
Get.find<
PaymentController>()
.getPassengerWallet();
},
child: GetBuilder<
PaymentController>(
builder: (paymentController) =>
paymentController
.isCashChecked
? Text(
'CASH',
style: AppStyle
.title,
)
: Text(
'${AppInformation.appName} Wallet',
style: AppStyle
.title,
),
),
),
],
),
),
const SizedBox(
width: 40,
),
GetBuilder<PaymentController>(
builder:
(paymentController) =>
Container(
decoration:
BoxDecoration(
color: AppColor
.secondaryColor,
borderRadius:
BorderRadius
.circular(
12),
),
child: Row(
children: [
Icon(
Icons
.qr_code_2_rounded,
color: Colors
.green[
400],
),
InkWell(
onTap: () {
if (controller
.promoTaken ==
false) {
Get.defaultDialog(
title: 'Add Promo'.tr,
titleStyle: AppStyle.title,
content: Column(
children: [
SizedBox(
width: Get.width * .7,
child: TextFormField(
controller: controller.promo,
decoration: InputDecoration(
labelText: 'Promo Code'.tr,
hintText: 'Enter promo code'.tr,
labelStyle: AppStyle.subtitle,
hintStyle: AppStyle.subtitle,
border: OutlineInputBorder(
borderRadius: BorderRadius.circular(10),
),
filled: true,
fillColor: Colors.grey[200],
focusedBorder: OutlineInputBorder(
borderSide: const BorderSide(
color: AppColor.primaryColor,
width: 2.0,
),
borderRadius: BorderRadius.circular(10),
),
errorBorder: OutlineInputBorder(
borderSide: const BorderSide(
color: Colors.red,
width: 2.0,
),
borderRadius: BorderRadius.circular(10),
),
enabledBorder: OutlineInputBorder(
borderSide: const BorderSide(
color: Colors.grey,
width: 1.0,
),
borderRadius: BorderRadius.circular(10),
),
),
),
),
MyElevatedButton(
title: 'Add Promo'.tr,
onPressed: () async {
controller.applyPromoCodeToPassenger();
},
)
],
));
} else {
Get.snackbar(
'You have promo!'
.tr,
'',
backgroundColor:
AppColor.redColor);
}
},
child: Text(
'Add Promo'
.tr,
style: AppStyle
.title,
),
),
],
),
)),
],
),
),
SizedBox(
width: Get.width * .95,
child: Row(
mainAxisAlignment:
MainAxisAlignment.center,
children: [
controller.isCashSelectedBeforeConfirmRide ==
false
? MyElevatedButton(
title: 'Next'.tr,
onPressed: () {
controller
.changeCashConfirmPageShown();
},
)
:
// controller.isPassengerChosen ==
// false
// ? MyElevatedButton(
// title: 'Next'.tr,
// onPressed: () {
// controller
// .onChangedPassengersChoose();
// Get.defaultDialog(
// barrierDismissible:
// false,
// title:
// 'How Many Passengers?'
// .tr,
// titleStyle:
// AppStyle
// .title,
// content:
// Column(
// children: [
// Text(
// 'Allowed up to 4 Passengers.'
// .tr,
// style: AppStyle
// .title,
// ),
// SizedBox(
// height:
// 200, // Set the desired height here
// child:
// CupertinoPicker(
// itemExtent:
// 32,
// onSelectedItemChanged:
// (index) {
// controller.onChangedPassengerCount(index +
// 1);
// },
// children: [
// Text('1 Passenger'.tr),
// Text('2 Passengers'.tr),
// Text('3 Passengers'.tr),
// Text('4 Passengers'.tr),
// ],
// ),
// ),
// MyElevatedButton(
// title:
// 'Back',
// onPressed:
// () =>
// Get.back(),
// )
// ],
// ),
// );
// },
// )
// :
MyElevatedButton(
title: 'Confirm Selection'
.tr,
onPressed: () {
controller
.confirmRideForFirstDriver();
},
),
],
),
)
],
),
),
),
),
],
),
),
],
),
)
: const SizedBox());
builder: (controller) =>
controller.isBottomSheetShown && controller.rideConfirm == false
? const Positioned(
left: 5,
bottom: 0,
right: 5,
child: Column(
// children: [
// Row(
// mainAxisAlignment: MainAxisAlignment.end,
// children: [
// double.parse(box.read(BoxName.passengerWalletTotal)) <
// 0 &&
// controller.data.isNotEmpty
// ? Container(
// decoration: AppStyle.boxDecoration
// .copyWith(color: AppColor.redColor),
// height: 50,
// width: Get.width * .94,
// child: Padding(
// padding:
// const EdgeInsets.symmetric(horizontal: 8),
// child: Text(
// 'Your trip cost is'.tr +
// ' ${controller.totalCostPassenger.toStringAsFixed(2)} '
// 'But you have a negative salary of'
// .tr +
// '${double.parse(box.read(BoxName.passengerWalletTotal)).toStringAsFixed(2)}'
// ' in your'
// .tr +
// ' ${AppInformation.appName}'
// ' wallet due to a previous trip.'
// .tr,
// style: AppStyle.subtitle,
// ),
// ))
// : const SizedBox(),
// ],
// ),
// const SizedBox(
// height: 5,
// ),
// AnimatedContainer(
// // clipBehavior: Clip.antiAliasWithSaveLayer,
// curve: Curves.easeInCirc,
// onEnd: () {
// controller.height = 250;
// },
// height: controller.heightBottomSheetShown,
// duration: const Duration(seconds: 2),
// child: Column(
// children: [
// controller.data.isEmpty
// ? const SizedBox()
// : Container(
// // width: Get.width * .9,
// height: 100,
// decoration: BoxDecoration(
// color: AppColor.secondaryColor,
// boxShadow: [
// const BoxShadow(
// color: AppColor.accentColor,
// offset: Offset(2, 2)),
// BoxShadow(
// color: AppColor.accentColor
// .withOpacity(.4),
// offset: const Offset(-2, -2))
// ],
// borderRadius: const BorderRadius.all(
// Radius.circular(15))),
// child: ListView.builder(
// scrollDirection: Axis.horizontal,
// itemCount: controller
// .dataCarsLocationByPassenger.length -
// 1,
// itemBuilder:
// (BuildContext context, int index) {
// return Container(
// color: controller.gender == 'Female'
// ? const Color.fromARGB(
// 255, 246, 52, 181)
// : AppColor.secondaryColor,
// width: Get.width,
// child: Row(
// mainAxisAlignment:
// MainAxisAlignment.spaceBetween,
// children: [
// SizedBox(
// width: Get.width * .15,
// child: Padding(
// padding:
// const EdgeInsets.all(8.0),
// child: Image.asset(
// 'assets/images/jeep.png',
// width: 50,
// fit: BoxFit.fill,
// repeat: ImageRepeat.repeatX,
// ),
// ),
// ),
// SizedBox(
// width: Get.width * .55,
// child: Column(
// crossAxisAlignment:
// CrossAxisAlignment.start,
// mainAxisAlignment:
// MainAxisAlignment.spaceEvenly,
// children: [
// Text(
// 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,
// ),
// // Text(
// // '${'You will be thier in'.tr} ${DateFormat('h:mm a').format(controller.newTime)}',
// // style: AppStyle.subtitle,
// // ),
// Text(
// '${'Your trip distance is'.tr} ${controller.distance.toStringAsFixed(2)} ${'KM'.tr}',
// style: AppStyle.subtitle,
// )
// ],
// ),
// ),
// SizedBox(
// width: Get.width * .2,
// child: Padding(
// padding: const EdgeInsets.only(
// right: 5, left: 5),
// child: Column(
// crossAxisAlignment:
// CrossAxisAlignment.center,
// children: [
// Container(
// width: Get.width * .14,
// height: Get.height * .06,
// decoration: BoxDecoration(
// color: AppColor
// .secondaryColor,
// shape:
// BoxShape.rectangle,
// border: Border.all(
// width: 2,
// color: AppColor
// .greenColor)),
// child: Center(
// child: Text(
// '${'Fee is'.tr} \n${controller.totalPassenger.toStringAsFixed(2)}',
// style:
// AppStyle.subtitle,
// ),
// ),
// ),
// controller.promoTaken
// ? const Icon(
// Icons
// .filter_vintage_rounded,
// color:
// AppColor.redColor,
// )
// : const SizedBox(
// height: 0,
// )
// ],
// ),
// ),
// ),
// ],
// ),
// );
// },
// ),
// ),
// const SizedBox(
// height: 5,
// ),
// Container(
// // height: 130,
// decoration: BoxDecoration(
// color: AppColor.secondaryColor,
// boxShadow: [
// const BoxShadow(
// color: AppColor.accentColor,
// offset: Offset(2, 2)),
// BoxShadow(
// color: AppColor.accentColor.withOpacity(.4),
// offset: const Offset(-2, -2))
// ],
// borderRadius:
// const BorderRadius.all(Radius.circular(15))),
// child: controller.data.isEmpty
// ? const SizedBox()
// : Center(
// child: Padding(
// padding: const EdgeInsets.symmetric(
// horizontal: 5),
// child: Column(
// children: [
// Row(
// children: [
// const Icon(
// Icons.location_on,
// color: AppColor.redColor,
// ),
// const SizedBox(
// width: 10,
// ),
// Text(
// 'From : '.tr,
// style: AppStyle.subtitle,
// ),
// Text(
// controller.data[0]
// ['start_address']
// .toString(),
// style: AppStyle.subtitle,
// )
// ],
// ),
// Row(
// children: [
// const Icon(Icons
// .location_searching_rounded),
// const SizedBox(
// width: 10,
// ),
// Text(
// 'To : '.tr,
// style: AppStyle.subtitle,
// ),
// Text(
// controller.data[0]['end_address'],
// style: AppStyle.subtitle,
// ),
// ],
// ),
// const Divider(
// color: AppColor.accentColor,
// thickness: 1,
// height: 2,
// indent: 1,
// ),
// SizedBox(
// height: 40,
// child: Row(
// mainAxisAlignment:
// MainAxisAlignment.center,
// children: [
// Container(
// decoration: BoxDecoration(
// color:
// AppColor.secondaryColor,
// borderRadius:
// BorderRadius.circular(12),
// // border: Border.all(),
// ),
// child: Row(
// children: [
// Icon(
// Icons.monetization_on,
// color: Colors.green[400],
// ),
// InkWell(
// onTap: () async {
// controller
// .changeCashConfirmPageShown();
// Get.find<
// PaymentController>()
// .getPassengerWallet();
// },
// child: GetBuilder<
// PaymentController>(
// builder: (paymentController) =>
// paymentController
// .isCashChecked
// ? Text(
// 'CASH',
// style: AppStyle
// .title,
// )
// : Text(
// '${AppInformation.appName} Wallet',
// style: AppStyle
// .title,
// ),
// ),
// ),
// ],
// ),
// ),
// const SizedBox(
// width: 40,
// ),
// GetBuilder<PaymentController>(
// builder:
// (paymentController) =>
// Container(
// decoration:
// BoxDecoration(
// color: AppColor
// .secondaryColor,
// borderRadius:
// BorderRadius
// .circular(
// 12),
// ),
// child: Row(
// children: [
// Icon(
// Icons
// .qr_code_2_rounded,
// color: Colors
// .green[
// 400],
// ),
// InkWell(
// onTap: () {
// if (controller
// .promoTaken ==
// false) {
// Get.defaultDialog(
// title: 'Add Promo'.tr,
// titleStyle: AppStyle.title,
// content: Column(
// children: [
// SizedBox(
// width: Get.width * .7,
// child: TextFormField(
// controller: controller.promo,
// decoration: InputDecoration(
// labelText: 'Promo Code'.tr,
// hintText: 'Enter promo code'.tr,
// labelStyle: AppStyle.subtitle,
// hintStyle: AppStyle.subtitle,
// border: OutlineInputBorder(
// borderRadius: BorderRadius.circular(10),
// ),
// filled: true,
// fillColor: Colors.grey[200],
// focusedBorder: OutlineInputBorder(
// borderSide: const BorderSide(
// color: AppColor.primaryColor,
// width: 2.0,
// ),
// borderRadius: BorderRadius.circular(10),
// ),
// errorBorder: OutlineInputBorder(
// borderSide: const BorderSide(
// color: Colors.red,
// width: 2.0,
// ),
// borderRadius: BorderRadius.circular(10),
// ),
// enabledBorder: OutlineInputBorder(
// borderSide: const BorderSide(
// color: Colors.grey,
// width: 1.0,
// ),
// borderRadius: BorderRadius.circular(10),
// ),
// ),
// ),
// ),
// MyElevatedButton(
// title: 'Add Promo'.tr,
// onPressed: () async {
// controller.applyPromoCodeToPassenger();
// },
// )
// ],
// ));
// } else {
// Get.snackbar(
// 'You have promo!'
// .tr,
// '',
// backgroundColor:
// AppColor.redColor);
// }
// },
// child: Text(
// 'Add Promo'
// .tr,
// style: AppStyle
// .title,
// ),
// ),
// ],
// ),
// )),
// ],
// ),
// ),
// SizedBox(
// width: Get.width * .95,
// child: Row(
// mainAxisAlignment:
// MainAxisAlignment.center,
// children: [
// controller.isCashSelectedBeforeConfirmRide ==
// false
// ? MyElevatedButton(
// title: 'Next'.tr,
// onPressed: () {
// controller
// .changeCashConfirmPageShown();
// },
// )
// :
// // controller.isPassengerChosen ==
// // false
// // ? MyElevatedButton(
// // title: 'Next'.tr,
// // onPressed: () {
// // controller
// // .onChangedPassengersChoose();
// // Get.defaultDialog(
// // barrierDismissible:
// // false,
// // title:
// // 'How Many Passengers?'
// // .tr,
// // titleStyle:
// // AppStyle
// // .title,
// // content:
// // Column(
// // children: [
// // Text(
// // 'Allowed up to 4 Passengers.'
// // .tr,
// // style: AppStyle
// // .title,
// // ),
// // SizedBox(
// // height:
// // 200, // Set the desired height here
// // child:
// // CupertinoPicker(
// // itemExtent:
// // 32,
// // onSelectedItemChanged:
// // (index) {
// // controller.onChangedPassengerCount(index +
// // 1);
// // },
// // children: [
// // Text('1 Passenger'.tr),
// // Text('2 Passengers'.tr),
// // Text('3 Passengers'.tr),
// // Text('4 Passengers'.tr),
// // ],
// // ),
// // ),
// // MyElevatedButton(
// // title:
// // 'Back',
// // onPressed:
// // () =>
// // Get.back(),
// // )
// // ],
// // ),
// // );
// // },
// // )
// // :
// MyElevatedButton(
// title: 'Confirm Selection'
// .tr,
// onPressed: () {
// controller
// .confirmRideForFirstDriver();
// },
// ),
// ],
// ),
// )
// ],
// ),
// ),
// ),
// ),
// ],
// ),
// ),
// ],
),
)
: const SizedBox());
}
class Details extends StatelessWidget {

View File

@@ -465,7 +465,7 @@ class BurcMoney extends StatelessWidget {
if (passengerWallet < 0.0) // Use if statement for clarity
Container(
decoration: AppStyle.boxDecoration.copyWith(
color: AppColor.redColor.withOpacity(.5),
color: AppColor.redColor.withOpacity(.3),
),
height: 50,
width: Get.width,

View File

@@ -279,9 +279,10 @@ class RideBeginPassenger extends StatelessWidget {
.toString();
// phoneNumber = phoneNumber.replaceAll('0', '');
print(phoneNumber); // Output: 798583061
var phone =
// '+${box.read(BoxName.countryCode)}${box.read(BoxName.sosPhonePassenger)}';
'${box.read(BoxName.sosPhonePassenger)}';
var phone = box.read(BoxName.countryCode) ==
'Egypt'
? '+2${box.read(BoxName.sosPhonePassenger)}'
: '+962${box.read(BoxName.sosPhonePassenger)}';
controller.sendWhatsapp(phone);
}
},

View File

@@ -102,7 +102,7 @@ class TimerToPassengerFromDriver extends StatelessWidget {
child: Column(
children: [
Text(
'The driver waitting you in picked location .'.tr,
'The driver waiting you in picked location .'.tr,
style: AppStyle.title,
textAlign: TextAlign.center,
),