4/18/1
This commit is contained in:
@@ -160,7 +160,7 @@ class MyTranslation extends Translations {
|
||||
"Copy this Promo to use it in your Ride!":
|
||||
"انسخ هذا العرض لاستخدامه في رحلتك!",
|
||||
"To change some Settings": "لتغيير بعض الإعدادات",
|
||||
"To change Languge the App": "لتغيير لغة التطبيق",
|
||||
"To change Language the App": "لتغيير لغة التطبيق",
|
||||
"Order Request Page": "صفحة طلب الطلب",
|
||||
"Rouats of Trip": "طرق الرحلة",
|
||||
"Passenger Name is ": "اسم الراكب هو ",
|
||||
@@ -688,6 +688,9 @@ class MyTranslation extends Translations {
|
||||
"إذا كنت تريد أن تفتح تطبيق خرائط جوجل مباشرة عند طلب الخدمة",
|
||||
"You can change the language of the app": "يمكنك تغيير لغة التطبيق",
|
||||
'Your Budget less than needed': 'القيمه المدخله اقل من رصيدك',
|
||||
'You can change the Country to get all features':
|
||||
'يمكنك تغيير البلد للحصول على جميع الميزات',
|
||||
'Change Country': 'تغيير الدولة',
|
||||
},
|
||||
"tr": {
|
||||
"Choose Language": "Dil Seçin",
|
||||
@@ -849,7 +852,7 @@ class MyTranslation extends Translations {
|
||||
"Copy this Promo to use it in your Ride!":
|
||||
"Bu Promosyonu seyahatinizde kullanmak için kopyalayın!",
|
||||
"To change some Settings": "Bazı ayarları değiştirmek için",
|
||||
"To change Languge the App": "Uygulama dilini değiştirmek için",
|
||||
"To change Language the App": "Uygulama dilini değiştirmek için",
|
||||
"Order Request Page": "Sipariş istek sayfası",
|
||||
"Rouats of Trip": "Seyahat yolları",
|
||||
"Passenger Name is ": "Yolcu adı ",
|
||||
|
||||
@@ -496,6 +496,7 @@ class PaymentController extends GetxController {
|
||||
),
|
||||
confirm: MyElevatedButton(
|
||||
title: 'OK'.tr,
|
||||
kolor: AppColor.greenColor,
|
||||
onPressed: () async {
|
||||
Get.back();
|
||||
method();
|
||||
@@ -543,11 +544,13 @@ class PaymentController extends GetxController {
|
||||
barrierDismissible: false,
|
||||
title: 'Payment Successful'.tr,
|
||||
titleStyle: AppStyle.title,
|
||||
// backgroundColor: AppColor.greenColor,
|
||||
content: Text(
|
||||
'The payment was approved.'.tr,
|
||||
style: AppStyle.title,
|
||||
),
|
||||
confirm: MyElevatedButton(
|
||||
kolor: AppColor.greenColor,
|
||||
title: 'OK'.tr,
|
||||
onPressed: () async {
|
||||
Get.back();
|
||||
|
||||
@@ -39,15 +39,67 @@ class PaymobManager extends GetxController {
|
||||
}
|
||||
|
||||
Future<void> payWithPayMob(int amount, String currency) async {
|
||||
String key = await PaymobManager().getPaymentKey(amount, currency);
|
||||
await launchUrl(
|
||||
Uri.parse(
|
||||
'https://accept.paymob.com/api/acceptance/iframes/837992?payment_token=$key'),
|
||||
);
|
||||
// 1. Fetch Payment Key (Assuming PaymobManager is a custom class)
|
||||
String paymentToken;
|
||||
try {
|
||||
paymentToken = await PaymobManager().getPaymentKey(amount, currency);
|
||||
} on Exception catch (e) {
|
||||
// Handle errors gracefully, e.g., display error message to user
|
||||
print("Error fetching payment key: $e");
|
||||
return;
|
||||
}
|
||||
|
||||
// String paymentStatus = await _getStatusAfterPaid();
|
||||
// 2. Prepare Payment Data Payload
|
||||
final Map<String, dynamic> data = {
|
||||
"source": {
|
||||
"identifier": "01010101010", // Replace with actual source identifier
|
||||
"subtype": "WALLET",
|
||||
},
|
||||
"payment_token": paymentToken,
|
||||
};
|
||||
|
||||
// 3. Make Payment Request using Dio
|
||||
final dio = Dio();
|
||||
try {
|
||||
final response = await dio.post(
|
||||
'https://accept.paymob.com/api/acceptance/payments/pay',
|
||||
data: data,
|
||||
);
|
||||
|
||||
// 4. Handle Payment Response
|
||||
if (response.statusCode == 200) {
|
||||
// Payment successful: Process response data (e.g., transaction ID)
|
||||
final paymentData = response.data; // Assuming JSON response
|
||||
print("Payment successful: $paymentData");
|
||||
// Navigate to success screen or display success message
|
||||
} else {
|
||||
// Payment failed: Handle errors (e.g., display error message)
|
||||
print("Payment failed: ${response.statusCode} - ${response.data}");
|
||||
}
|
||||
} on DioError catch (e) {
|
||||
// Handle network or Dio-related errors
|
||||
print("Error making payment request: $e");
|
||||
}
|
||||
}
|
||||
|
||||
// Future<void> payWithPayMob(int amount, String currency) async {
|
||||
// String key = await PaymobManager().getPaymentKey(amount, currency);
|
||||
// await launchUrl(Uri.parse(
|
||||
// // 'https://accept.paymob.com/api/acceptance/iframes/837992?payment_token=$key'),
|
||||
// 'https://accept.paymob.com/api/acceptance/payments/pay'));
|
||||
// print(key);
|
||||
// final dio.Response response = await Dio()
|
||||
// .post('https://accept.paymob.com/api/acceptance/payments/pay', data: {
|
||||
// "source": {
|
||||
// "identifier": "01010101010",
|
||||
// "subtype": "WALLET",
|
||||
// },
|
||||
// "payment_token": key, // token obtained in step 3
|
||||
// });
|
||||
//
|
||||
// // String paymentStatus = await _getStatusAfterPaid();
|
||||
// }
|
||||
|
||||
Future<String> _getStatusAfterPaid() async {
|
||||
print(authanticationToken1);
|
||||
print(orderId1);
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
import 'package:SEFER/controller/functions/location_controller.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:SEFER/constant/colors.dart';
|
||||
@@ -5,6 +6,7 @@ import 'package:SEFER/constant/style.dart';
|
||||
import 'package:SEFER/controller/auth/captin/history_captain.dart';
|
||||
import 'package:SEFER/controller/functions/launch.dart';
|
||||
import 'package:SEFER/views/widgets/my_scafold.dart';
|
||||
import 'package:google_maps_flutter/google_maps_flutter.dart';
|
||||
|
||||
import '../../../widgets/mycircular.dart';
|
||||
|
||||
@@ -20,133 +22,181 @@ class HistoryDetailsPage extends StatelessWidget {
|
||||
GetBuilder<HistoryCaptainController>(
|
||||
builder: (historyCaptainController) {
|
||||
var res = historyCaptainController.historyDetailsData['data'];
|
||||
return Expanded(
|
||||
child: historyCaptainController.isloading
|
||||
? const MyCircularProgressIndicator()
|
||||
: SingleChildScrollView(
|
||||
child: Column(
|
||||
children: [
|
||||
Container(
|
||||
width: Get.width * .8,
|
||||
decoration: BoxDecoration(
|
||||
border: Border.all(
|
||||
color: AppColor.blueColor, width: 2)),
|
||||
child: TextButton(
|
||||
onPressed: () {
|
||||
String mapUrl =
|
||||
'https://www.google.com/maps/dir/${res['start_location']}/${res['end_location']}/';
|
||||
print(mapUrl);
|
||||
showInBrowser(mapUrl);
|
||||
},
|
||||
child: Text(
|
||||
'Trip on Map Click here'.tr,
|
||||
style: AppStyle.title,
|
||||
),
|
||||
return historyCaptainController.isloading
|
||||
? const MyCircularProgressIndicator()
|
||||
: SingleChildScrollView(
|
||||
child: Center(
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
children: [
|
||||
Container(
|
||||
width: Get.width * .8,
|
||||
decoration: BoxDecoration(
|
||||
border: Border.all(
|
||||
color: AppColor.blueColor, width: 2)),
|
||||
child: TextButton(
|
||||
onPressed: () {
|
||||
String mapUrl =
|
||||
'https://www.google.com/maps/dir/${res['start_location']}/${res['end_location']}/';
|
||||
print(mapUrl);
|
||||
showInBrowser(mapUrl);
|
||||
},
|
||||
child: Column(
|
||||
children: [
|
||||
SizedBox(
|
||||
height: Get.height * .2,
|
||||
width: Get.width * .75,
|
||||
child: GoogleMap(
|
||||
initialCameraPosition: CameraPosition(
|
||||
target: Get.find<LocationController>()
|
||||
.myLocation, // Assuming passenger location is available
|
||||
tilt: 80, zoom: 13,
|
||||
),
|
||||
zoomControlsEnabled: true,
|
||||
// liteModeEnabled: true,
|
||||
polylines: {
|
||||
Polyline(
|
||||
zIndex: 2,
|
||||
consumeTapEvents: true,
|
||||
geodesic: true,
|
||||
endCap: Cap.buttCap,
|
||||
startCap: Cap.buttCap,
|
||||
visible: true,
|
||||
polylineId: const PolylineId('route'),
|
||||
points: [
|
||||
LatLng(
|
||||
double.parse(res['start_location']
|
||||
.toString()
|
||||
.split(',')[0]),
|
||||
double.parse(res['start_location']
|
||||
.toString()
|
||||
.split(',')[1]),
|
||||
),
|
||||
LatLng(
|
||||
double.parse(res['end_location']
|
||||
.toString()
|
||||
.split(',')[0]),
|
||||
double.parse(res['end_location']
|
||||
.toString()
|
||||
.split(',')[1]),
|
||||
)
|
||||
],
|
||||
color: AppColor.primaryColor,
|
||||
width: 5,
|
||||
),
|
||||
},
|
||||
),
|
||||
),
|
||||
const SizedBox(
|
||||
height: 10,
|
||||
),
|
||||
Row(
|
||||
mainAxisAlignment:
|
||||
MainAxisAlignment.spaceEvenly,
|
||||
children: [
|
||||
Text(
|
||||
'${'Order ID'.tr} ${res['id']}',
|
||||
style: AppStyle.title,
|
||||
),
|
||||
Text(
|
||||
res['date'].toString(),
|
||||
style: AppStyle.title,
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
const SizedBox(
|
||||
height: 10,
|
||||
),
|
||||
Row(
|
||||
),
|
||||
const SizedBox(
|
||||
height: 10,
|
||||
),
|
||||
Container(
|
||||
width: Get.width * .8,
|
||||
decoration: BoxDecoration(
|
||||
border: Border.all(
|
||||
color: AppColor.greenColor, width: 2)),
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
|
||||
children: [
|
||||
Text(
|
||||
'${'Order ID'.tr} ${res['id']}',
|
||||
'${'Price is'.tr} ${res['price_for_driver']}',
|
||||
style: AppStyle.title,
|
||||
),
|
||||
Text(
|
||||
res['date'].toString(),
|
||||
'${'Distance is'.tr} ${res['distance']} KM',
|
||||
style: AppStyle.title,
|
||||
),
|
||||
],
|
||||
),
|
||||
const SizedBox(
|
||||
height: 10,
|
||||
),
|
||||
Container(
|
||||
width: Get.width * .8,
|
||||
decoration: BoxDecoration(
|
||||
border: Border.all(
|
||||
color: AppColor.greenColor, width: 2)),
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
|
||||
children: [
|
||||
Text(
|
||||
'${'Price is'.tr} ${res['price_for_driver']}',
|
||||
style: AppStyle.title,
|
||||
),
|
||||
Text(
|
||||
'${'Distance is'.tr} ${res['distance']} KM',
|
||||
style: AppStyle.title,
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
const SizedBox(
|
||||
height: 10,
|
||||
),
|
||||
Text(
|
||||
'Times of Trip'.tr,
|
||||
style: AppStyle.title,
|
||||
),
|
||||
const SizedBox(
|
||||
height: 10,
|
||||
),
|
||||
Container(
|
||||
width: Get.width * .8,
|
||||
decoration: BoxDecoration(
|
||||
border: Border.all(
|
||||
color: AppColor.redColor, width: 2)),
|
||||
child: Column(
|
||||
children: [
|
||||
Text(
|
||||
'${'Time to Passenger is'.tr} ${res['DriverIsGoingToPassenger']}',
|
||||
style: AppStyle.title,
|
||||
),
|
||||
Text(
|
||||
'${'TimeStart is'.tr} ${res['rideTimeStart']}',
|
||||
style: AppStyle.title,
|
||||
),
|
||||
Text(
|
||||
'${'Time Finish is'.tr} ${res['rideTimeFinish']}',
|
||||
style: AppStyle.title,
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
const SizedBox(
|
||||
height: 10,
|
||||
),
|
||||
Container(
|
||||
width: Get.width * .8,
|
||||
decoration: BoxDecoration(
|
||||
border: Border.all(
|
||||
color: AppColor.greenColor, width: 2)),
|
||||
child: Center(
|
||||
child: Text(
|
||||
'${'Passenger Name is'.tr} ${res['first_name']} ${res['last_name']} ',
|
||||
),
|
||||
const SizedBox(
|
||||
height: 10,
|
||||
),
|
||||
Text(
|
||||
'Times of Trip'.tr,
|
||||
style: AppStyle.title,
|
||||
),
|
||||
const SizedBox(
|
||||
height: 10,
|
||||
),
|
||||
Container(
|
||||
width: Get.width * .8,
|
||||
decoration: BoxDecoration(
|
||||
border: Border.all(
|
||||
color: AppColor.redColor, width: 2)),
|
||||
child: Column(
|
||||
children: [
|
||||
Text(
|
||||
'${'Time to Passenger is'.tr} ${res['DriverIsGoingToPassenger']}',
|
||||
style: AppStyle.title,
|
||||
),
|
||||
),
|
||||
),
|
||||
const SizedBox(
|
||||
height: 10,
|
||||
),
|
||||
Container(
|
||||
width: Get.width * .8,
|
||||
decoration: BoxDecoration(
|
||||
border: Border.all(
|
||||
color: AppColor.yellowColor, width: 2)),
|
||||
child: Center(
|
||||
child: Text(
|
||||
'${'Status is'.tr} ${res['status']}',
|
||||
Text(
|
||||
'${'TimeStart is'.tr} ${res['rideTimeStart']}',
|
||||
style: AppStyle.title,
|
||||
),
|
||||
Text(
|
||||
'${'Time Finish is'.tr} ${res['rideTimeFinish']}',
|
||||
style: AppStyle.title,
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
const SizedBox(
|
||||
height: 10,
|
||||
),
|
||||
Container(
|
||||
width: Get.width * .8,
|
||||
decoration: BoxDecoration(
|
||||
border: Border.all(
|
||||
color: AppColor.greenColor, width: 2)),
|
||||
child: Center(
|
||||
child: Text(
|
||||
'${'Passenger Name is'.tr} ${res['first_name']} ${res['last_name']} ',
|
||||
style: AppStyle.title,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
));
|
||||
),
|
||||
const SizedBox(
|
||||
height: 10,
|
||||
),
|
||||
Container(
|
||||
width: Get.width * .8,
|
||||
decoration: BoxDecoration(
|
||||
border: Border.all(
|
||||
color: AppColor.yellowColor, width: 2)),
|
||||
child: Center(
|
||||
child: Text(
|
||||
'${'Status is'.tr} ${res['status']}',
|
||||
style: AppStyle.title,
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
})
|
||||
],
|
||||
isleading: true,
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import 'package:SEFER/constant/colors.dart';
|
||||
import 'package:SEFER/controller/profile/setting_controller.dart';
|
||||
import 'package:SEFER/views/home/profile/passenger_profile_page.dart';
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_font_icons/flutter_font_icons.dart';
|
||||
@@ -25,13 +26,30 @@ class SettingsCaptain extends StatelessWidget {
|
||||
'Language'.tr,
|
||||
style: AppStyle.headTitle2,
|
||||
),
|
||||
subtitle: Text('ou can change the language of the app'.tr),
|
||||
subtitle: Text('You can change the language of the app'.tr),
|
||||
onTap: () => Get.to(const Language()),
|
||||
),
|
||||
const Divider(
|
||||
endIndent: 44,
|
||||
indent: 44,
|
||||
),
|
||||
ListTile(
|
||||
leading: const Icon(Icons.place_outlined),
|
||||
title: Text(
|
||||
'Change Country'.tr,
|
||||
style: AppStyle.headTitle2,
|
||||
),
|
||||
subtitle:
|
||||
Text('You can change the Country to get all features'.tr),
|
||||
onTap: () => Get.to(MyScafolld(
|
||||
title: 'Change Country'.tr,
|
||||
body: [CountryPickerFromSetting()],
|
||||
isleading: true)),
|
||||
),
|
||||
const Divider(
|
||||
endIndent: 44,
|
||||
indent: 44,
|
||||
),
|
||||
ListTile(
|
||||
leading: const Icon(
|
||||
MaterialCommunityIcons.map_marker_radius,
|
||||
|
||||
@@ -5,6 +5,8 @@ import 'package:SEFER/constant/style.dart';
|
||||
import 'package:SEFER/views/lang/languages.dart';
|
||||
import 'package:SEFER/views/widgets/my_scafold.dart';
|
||||
|
||||
import 'profile/passenger_profile_page.dart';
|
||||
|
||||
class HomePage extends StatelessWidget {
|
||||
const HomePage({super.key});
|
||||
|
||||
@@ -16,47 +18,57 @@ class HomePage extends StatelessWidget {
|
||||
body: [
|
||||
Column(
|
||||
children: [
|
||||
Padding(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 20, vertical: 10),
|
||||
child: ListTile(
|
||||
title: Text(
|
||||
'Settings'.tr,
|
||||
style: AppStyle.title,
|
||||
),
|
||||
subtitle: Text('To change some Settings'.tr),
|
||||
trailing: const Icon(
|
||||
Icons.arrow_forward_ios,
|
||||
size: 30,
|
||||
color: AppColor.primaryColor,
|
||||
),
|
||||
leading: const Icon(
|
||||
Icons.settings,
|
||||
color: AppColor.primaryColor,
|
||||
),
|
||||
// Padding(
|
||||
// padding: const EdgeInsets.symmetric(horizontal: 20, vertical: 10),
|
||||
// child: ListTile(
|
||||
// title: Text(
|
||||
// 'Settings'.tr,
|
||||
// style: AppStyle.headTitle2,
|
||||
// ),
|
||||
// subtitle: Text('To change some Settings'.tr),
|
||||
// trailing: const Icon(
|
||||
// Icons.arrow_forward_ios,
|
||||
// size: 30,
|
||||
// color: AppColor.primaryColor,
|
||||
// ),
|
||||
// leading: const Icon(
|
||||
// Icons.settings,
|
||||
// color: AppColor.primaryColor,
|
||||
// ),
|
||||
// ),
|
||||
// ),
|
||||
ListTile(
|
||||
onTap: () {
|
||||
Get.to(() => const Language());
|
||||
},
|
||||
title: Text(
|
||||
'Language'.tr,
|
||||
style: AppStyle.headTitle2,
|
||||
),
|
||||
subtitle: Text('To change Language the App'.tr),
|
||||
trailing: const Icon(
|
||||
Icons.arrow_forward_ios,
|
||||
size: 30,
|
||||
color: AppColor.primaryColor,
|
||||
),
|
||||
leading: const Icon(
|
||||
Icons.language_sharp,
|
||||
color: AppColor.primaryColor,
|
||||
),
|
||||
),
|
||||
Padding(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 20, vertical: 10),
|
||||
child: ListTile(
|
||||
onTap: () {
|
||||
Get.to(() => const Language());
|
||||
},
|
||||
title: Text(
|
||||
'Language'.tr,
|
||||
style: AppStyle.title,
|
||||
),
|
||||
subtitle: Text('To change Languge the App'.tr),
|
||||
trailing: const Icon(
|
||||
Icons.arrow_forward_ios,
|
||||
size: 30,
|
||||
color: AppColor.primaryColor,
|
||||
),
|
||||
leading: const Icon(
|
||||
Icons.language_sharp,
|
||||
color: AppColor.primaryColor,
|
||||
),
|
||||
ListTile(
|
||||
leading: const Icon(Icons.place_outlined),
|
||||
title: Text(
|
||||
'Change Country'.tr,
|
||||
style: AppStyle.headTitle2,
|
||||
),
|
||||
)
|
||||
subtitle:
|
||||
Text('You can change the Country to get all features'.tr),
|
||||
onTap: () => Get.to(MyScafolld(
|
||||
title: 'Change Country'.tr,
|
||||
body: [CountryPickerFromSetting()],
|
||||
isleading: true)),
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
|
||||
@@ -113,7 +113,7 @@ GetBuilder<MapPassengerController> leftMainMenuIcons() {
|
||||
borderRadius: BorderRadius.circular(15)),
|
||||
child: IconButton(
|
||||
onPressed: () async {
|
||||
// await PaymobManager().payWithPayMob(100, 'EGP');
|
||||
await PaymobManager().payWithPayMob(100, 'EGP');
|
||||
// await Get.find<PaymentController>()
|
||||
// .payWithPayMob(context, '1100', 'EGP');
|
||||
// Initiates a payment with a card using the FlutterPaymob instance
|
||||
|
||||
@@ -82,52 +82,55 @@ class CardSeferWallet extends StatelessWidget {
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Row(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
Container(
|
||||
width: Get.width * .85,
|
||||
height: Get.height * .3,
|
||||
decoration: BoxDecoration(
|
||||
color: AppColor.deepPurpleAccent,
|
||||
borderRadius: const BorderRadius.all(Radius.circular(12)),
|
||||
gradient: const LinearGradient(
|
||||
colors: [AppColor.blueColor, AppColor.primaryColor]),
|
||||
return GetBuilder<PaymentController>(builder: (paymentController) {
|
||||
return Row(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
Container(
|
||||
width: Get.width * .85,
|
||||
height: Get.height * .3,
|
||||
decoration: BoxDecoration(
|
||||
color: AppColor.deepPurpleAccent,
|
||||
borderRadius: const BorderRadius.all(Radius.circular(12)),
|
||||
gradient: const LinearGradient(
|
||||
colors: [AppColor.blueColor, AppColor.primaryColor]),
|
||||
),
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
|
||||
children: [
|
||||
Row(
|
||||
children: [
|
||||
Text(
|
||||
'${AppInformation.appName} Wallet',
|
||||
style: AppStyle.headTitle
|
||||
.copyWith(color: AppColor.primaryColor),
|
||||
)
|
||||
],
|
||||
),
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
Text(
|
||||
'${box.read(BoxName.passengerWalletTotal)} \$' ??
|
||||
'0.0 \$',
|
||||
style: AppStyle.headTitle2,
|
||||
)
|
||||
],
|
||||
),
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.end,
|
||||
children: [
|
||||
Text(
|
||||
box.read(BoxName.name),
|
||||
style: AppStyle.title,
|
||||
)
|
||||
],
|
||||
)
|
||||
],
|
||||
),
|
||||
),
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
|
||||
children: [
|
||||
Row(
|
||||
children: [
|
||||
Text(
|
||||
'${AppInformation.appName} Wallet',
|
||||
style: AppStyle.headTitle
|
||||
.copyWith(color: AppColor.primaryColor),
|
||||
)
|
||||
],
|
||||
),
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
Text(
|
||||
'${box.read(BoxName.passengerWalletTotal)} \$' ?? '0.0 \$',
|
||||
style: AppStyle.headTitle2,
|
||||
)
|
||||
],
|
||||
),
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.end,
|
||||
children: [
|
||||
Text(
|
||||
box.read(BoxName.name),
|
||||
style: AppStyle.title,
|
||||
)
|
||||
],
|
||||
)
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
);
|
||||
],
|
||||
);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -64,7 +64,7 @@ class PassengerWalletDialoge extends StatelessWidget {
|
||||
Text(
|
||||
box.read(BoxName.countryCode) == 'Egypt'
|
||||
? '100 ${'LE'.tr}'.tr
|
||||
: '10\$ and get 3% discount',
|
||||
: '10 ${'JOD'.tr}'.tr,
|
||||
style: AppStyle.title,
|
||||
),
|
||||
],
|
||||
|
||||
@@ -37,26 +37,29 @@ class OrderHistory extends StatelessWidget {
|
||||
itemCount: orderHistoryController
|
||||
.orderHistoryListPassenger.length,
|
||||
itemBuilder: (BuildContext context, int index) {
|
||||
final rides = orderHistoryController
|
||||
.orderHistoryListPassenger[index];
|
||||
// Use integer index here
|
||||
final rides =
|
||||
orderHistoryController.orderHistoryListPassenger[
|
||||
index]; // Access data using index
|
||||
|
||||
return Padding(
|
||||
padding: const EdgeInsets.all(8.0),
|
||||
child: Container(
|
||||
decoration: AppStyle.boxDecoration1,
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.all(8.0),
|
||||
child: Row(
|
||||
mainAxisAlignment:
|
||||
MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
InkWell(
|
||||
onTap: () {
|
||||
String mapUrl =
|
||||
'https://www.google.com/maps/dir/${rides['start_location']}/${rides['end_location']}/';
|
||||
// print(mapUrl);
|
||||
showInBrowser(mapUrl);
|
||||
},
|
||||
child: SizedBox(
|
||||
child: InkWell(
|
||||
onTap: () {
|
||||
String mapUrl =
|
||||
'https://www.google.com/maps/dir/${rides['start_location']}/${rides['end_location']}/';
|
||||
// print(mapUrl);
|
||||
showInBrowser(mapUrl);
|
||||
},
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.all(8.0),
|
||||
child: Column(
|
||||
mainAxisAlignment:
|
||||
MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
SizedBox(
|
||||
height: Get.height * .2,
|
||||
width: Get.width * .75,
|
||||
child: GoogleMap(
|
||||
@@ -66,6 +69,8 @@ class OrderHistory extends StatelessWidget {
|
||||
.passengerLocation, // Assuming passenger location is available
|
||||
zoom: 15,
|
||||
),
|
||||
zoomControlsEnabled: true,
|
||||
liteModeEnabled: true,
|
||||
polylines: {
|
||||
Polyline(
|
||||
zIndex: 2,
|
||||
@@ -78,15 +83,25 @@ class OrderHistory extends StatelessWidget {
|
||||
const PolylineId('route'),
|
||||
points: [
|
||||
LatLng(
|
||||
rides['start_location']
|
||||
['latitude'],
|
||||
rides['start_location']
|
||||
['longitude']),
|
||||
double.parse(
|
||||
rides['start_location']
|
||||
.toString()
|
||||
.split(',')[0]),
|
||||
double.parse(
|
||||
rides['start_location']
|
||||
.toString()
|
||||
.split(',')[1]),
|
||||
),
|
||||
LatLng(
|
||||
rides['end_location']
|
||||
['latitude'],
|
||||
rides['end_location']
|
||||
['longitude']),
|
||||
double.parse(
|
||||
rides['end_location']
|
||||
.toString()
|
||||
.split(',')[0]),
|
||||
double.parse(
|
||||
rides['end_location']
|
||||
.toString()
|
||||
.split(',')[1]),
|
||||
)
|
||||
],
|
||||
color: AppColor.primaryColor,
|
||||
width: 5,
|
||||
@@ -94,32 +109,35 @@ class OrderHistory extends StatelessWidget {
|
||||
},
|
||||
),
|
||||
),
|
||||
),
|
||||
Column(
|
||||
children: [
|
||||
Text(
|
||||
rides['date'],
|
||||
style: AppStyle.subtitle,
|
||||
),
|
||||
Text(
|
||||
rides['time'],
|
||||
style: AppStyle.subtitle,
|
||||
),
|
||||
Text(
|
||||
rides['status'],
|
||||
style: rides['status'] != 'Canceled'.tr
|
||||
? AppStyle.subtitle.copyWith(
|
||||
color: AppColor.greenColor)
|
||||
: AppStyle.subtitle.copyWith(
|
||||
color: AppColor.redColor),
|
||||
),
|
||||
Text(
|
||||
'${'Price is'.tr} ${rides['price']}',
|
||||
style: AppStyle.subtitle,
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
Row(
|
||||
mainAxisAlignment:
|
||||
MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
Text(
|
||||
rides['date'],
|
||||
style: AppStyle.subtitle,
|
||||
),
|
||||
Text(
|
||||
rides['time'],
|
||||
style: AppStyle.subtitle,
|
||||
),
|
||||
Text(
|
||||
rides['status'],
|
||||
style: rides['status'] !=
|
||||
'Canceled'.tr
|
||||
? AppStyle.subtitle.copyWith(
|
||||
color: AppColor.greenColor)
|
||||
: AppStyle.subtitle.copyWith(
|
||||
color: AppColor.redColor),
|
||||
),
|
||||
Text(
|
||||
'${'Price is'.tr} ${rides['price']}',
|
||||
style: AppStyle.subtitle,
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
|
||||
@@ -363,8 +363,10 @@ class CountryPicker extends StatelessWidget {
|
||||
Get.find<LoginController>().saveCountryCode(controller
|
||||
.selectedCountry
|
||||
.toString()); // No conversion needed
|
||||
box.write(BoxName.countryCode,
|
||||
box.write(
|
||||
BoxName.countryCode, //
|
||||
controller.selectedCountry); // Already saved in English
|
||||
Get.snackbar(controller.selectedCountry.toString().tr, '');
|
||||
Get.off(LoginPage());
|
||||
},
|
||||
)
|
||||
@@ -373,3 +375,80 @@ class CountryPicker extends StatelessWidget {
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
class CountryPickerFromSetting extends StatelessWidget {
|
||||
final ProfileController controller = Get.put(ProfileController());
|
||||
final LoginController loginController = Get.put(LoginController());
|
||||
|
||||
final List<String> countryOptions = [
|
||||
'Jordan',
|
||||
'USA',
|
||||
'Egypt',
|
||||
'Turkey',
|
||||
'Saudi Arabia',
|
||||
'Qatar',
|
||||
'Bahrain',
|
||||
'Kuwait',
|
||||
];
|
||||
|
||||
CountryPickerFromSetting({Key? key}) : super(key: key);
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return GetBuilder<ProfileController>(builder: (controller) {
|
||||
return ListView(
|
||||
children: [
|
||||
const SizedBox(
|
||||
height: 20,
|
||||
),
|
||||
Text("Select Your Country".tr),
|
||||
// const SizedBox(
|
||||
// height: 20,
|
||||
// ),
|
||||
Padding(
|
||||
padding: const EdgeInsets.all(10),
|
||||
child: Text(
|
||||
"To ensure you receive the most accurate information for your location, please select your country below. This will help tailor the app experience and content to your country."
|
||||
.tr),
|
||||
),
|
||||
SizedBox(
|
||||
height: 200,
|
||||
child: CupertinoPicker(
|
||||
itemExtent: 32,
|
||||
onSelectedItemChanged: (int index) {
|
||||
controller.setCountry(countryOptions[index]);
|
||||
box.write(BoxName.countryCode,
|
||||
countryOptions[index]); // Save in English
|
||||
},
|
||||
children: List.generate(
|
||||
countryOptions.length,
|
||||
(index) => Center(
|
||||
child: Text(
|
||||
countryOptions[index]
|
||||
.tr, // Display translated if not English
|
||||
style: AppStyle.title,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
|
||||
MyElevatedButton(
|
||||
title: 'Select Country'.tr, // Use translated text for button
|
||||
onPressed: () async {
|
||||
loginController.saveCountryCode(controller.selectedCountry
|
||||
.toString()); // No conversion needed
|
||||
box.write(
|
||||
BoxName.countryCode, //
|
||||
controller.selectedCountry); // Already saved in English
|
||||
Get.snackbar(controller.selectedCountry.toString().tr, '',
|
||||
backgroundColor: AppColor.greenColor);
|
||||
// Get.back();//
|
||||
// Get.back();
|
||||
},
|
||||
)
|
||||
],
|
||||
);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user