This commit is contained in:
Hamza Aleghwairyeen
2024-04-13 00:55:09 +03:00
parent 4e35874f2b
commit a02965fac9
11 changed files with 142 additions and 42 deletions

View File

@@ -61,7 +61,7 @@ class HomeCaptainController extends GetxController {
void goToWalletFromConnect() { void goToWalletFromConnect() {
Get.back(); Get.back();
Get.back(); Get.back();
Get.to(() => WaletCaptain()); Get.to(() => WalletCaptain());
} }
void changeRideId() { void changeRideId() {

View File

@@ -20,7 +20,9 @@ class CaptainWalletController extends GetxController {
payFromBudget() async { payFromBudget() async {
if (formKey.currentState!.validate()) { if (formKey.currentState!.validate()) {
var pointFromBudget = int.parse((amountFromBudgetController.text)) * 100; var pointFromBudget = box.read(BoxName.countryCode) == 'Jordan'
? int.parse((amountFromBudgetController.text)) * 100
: int.parse((amountFromBudgetController.text));
await addDriverPayment('fromBudgetToPoints', await addDriverPayment('fromBudgetToPoints',
int.parse((amountFromBudgetController.text)) * -1); int.parse((amountFromBudgetController.text)) * -1);

View File

@@ -436,6 +436,9 @@ class MyTranslation extends Translations {
'Your trip cost is': 'تبلغ تكلفة رحلتك', 'Your trip cost is': 'تبلغ تكلفة رحلتك',
'you have a negative balance of': 'ولكن لديك رصيد سلبي قدره', 'you have a negative balance of': 'ولكن لديك رصيد سلبي قدره',
' in your': 'في محفظتك', ' in your': 'في محفظتك',
'Exclusive offers and discounts always with the Sefer app':
'عروض حصرية وتخفيضات دائمة مع تطبيق سفر',
'Please go to Car Driver': 'توجه إلى سائق السيارة',
' wallet due to a previous trip.': 'بسبب رحلة سابقة', ' wallet due to a previous trip.': 'بسبب رحلة سابقة',
'Submit Question': "طرح السؤال", 'Submit Question': "طرح السؤال",
'Please enter your Question.': "الرجاء إدخال سؤالك.", 'Please enter your Question.': "الرجاء إدخال سؤالك.",
@@ -496,7 +499,6 @@ class MyTranslation extends Translations {
'حتا لو مفيش كارت SIM, متخفش! تقدر تكلم سواقك بمنتهى البساطة عن طريق التطبيق بتاعنا. احنا بنستخدم تكنولوجيا حديثة عشان نحافظ على خصوصيتك.', 'حتا لو مفيش كارت SIM, متخفش! تقدر تكلم سواقك بمنتهى البساطة عن طريق التطبيق بتاعنا. احنا بنستخدم تكنولوجيا حديثة عشان نحافظ على خصوصيتك.',
'This ride type allows changes, but the price may increase': 'This ride type allows changes, but the price may increase':
'ده نوع الرحلات بيسمح بالتغيير بس السعر ممكن يزيد ', 'ده نوع الرحلات بيسمح بالتغيير بس السعر ممكن يزيد ',
'Cost Of Trip IS ': "تكلفة الرحلة هي ",
'message From passenger': '‏رسالة من الراكب', 'message From passenger': '‏رسالة من الراكب',
'Select one message': "‏اختر رسالة", 'Select one message': "‏اختر رسالة",
'My location is correct. You can search for me using the navigation app': 'My location is correct. You can search for me using the navigation app':
@@ -511,9 +513,9 @@ class MyTranslation extends Translations {
"الرجاء المساعدة! اتصل بي في أقرب وقت ممكن.", "الرجاء المساعدة! اتصل بي في أقرب وقت ممكن.",
'Share Trip Details': "مشاركة تفاصيل الرحلة", 'Share Trip Details': "مشاركة تفاصيل الرحلة",
'Car Plate is ': '‏رقم اللوحة', 'Car Plate is ': '‏رقم اللوحة',
'the 300 points equal 30 L.E for you \nSo go and gain your money': 'the 300 points equal 300 L.E for you \nSo go and gain your money':
'اربح 30 جنيه ! كل 300 نقطة تمنحك 30 جنيه. اذهب واستفد من نقاطك!', 'اربح 300 جنيه ! كل 300 نقطة تمنحك 300 جنيه. اذهب واستفد من نقاطك!',
'the 300 points equal 30 L.E': 'the 300 points equal 300 L.E':
'الـ 300 نقطة تساوي 30 جنيه بالنسبة لك ', 'الـ 300 نقطة تساوي 30 جنيه بالنسبة لك ',
'No ride found yet': '‏لا يوجد طلبات متوفرة حاليا', 'No ride found yet': '‏لا يوجد طلبات متوفرة حاليا',
'Accept Order': "‏اقبل الطلب", 'Accept Order': "‏اقبل الطلب",
@@ -538,10 +540,7 @@ class MyTranslation extends Translations {
"Qatar": "قطر", "Qatar": "قطر",
"Bahrain": "البحرين", "Bahrain": "البحرين",
"Kuwait": "الكويت", "Kuwait": "الكويت",
'Your trip cost is': "تكلفة رحلتك هي",
'But you have a negative salary of': "لكن لديك راتب سلبي بقيمة", 'But you have a negative salary of': "لكن لديك راتب سلبي بقيمة",
' in your': "في",
' wallet due to a previous trip.': "المحفظة بسبب رحلة سابقة.",
'Promo Code': "كود ترويجي", 'Promo Code': "كود ترويجي",
'Your trip distance is': "مسافة رحلتك هي", 'Your trip distance is': "مسافة رحلتك هي",
'Enter promo code': "أدخل كود ترويجي", 'Enter promo code': "أدخل كود ترويجي",

View File

@@ -1,4 +1,5 @@
import 'dart:convert'; import 'dart:convert';
import 'package:SEFER/constant/api_key.dart';
import 'package:http/http.dart' as http; import 'package:http/http.dart' as http;
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_paypal/flutter_paypal.dart'; import 'package:flutter_paypal/flutter_paypal.dart';
@@ -197,6 +198,7 @@ class PaymentController extends GetxController {
name: CollectionMode.automatic, name: CollectionMode.automatic,
phone: CollectionMode.automatic, phone: CollectionMode.automatic,
email: CollectionMode.automatic, email: CollectionMode.automatic,
// address: CollectionMode.automatic,
), ),
), ),
); );
@@ -248,10 +250,8 @@ class PaymentController extends GetxController {
MaterialPageRoute( MaterialPageRoute(
builder: (BuildContext context) => UsePaypal( builder: (BuildContext context) => UsePaypal(
sandboxMode: true, sandboxMode: true,
clientId: clientId: AK.payPalClientIdLive,
"AWj9MdPaA5Djpx8gOkvBn2qhP-3KvfB6W-l8USTsm19Xi2NhkNkE9QzosOvTPTsKjCMNffgpqStUA1-x", secretKey: AK.payPalSecretLive,
secretKey:
"EKkasSl9O61lrfrbaJfXp1B-CIs2Rv71J0WPouxxugi38DsWaMhWpovJxN2ftYPQ0l6v9eoBvnyWkemp",
returnURL: AppInformation.website, returnURL: AppInformation.website,
cancelURL: "${AppInformation.website}/cancel", cancelURL: "${AppInformation.website}/cancel",
transactions: [ transactions: [

View File

@@ -83,6 +83,15 @@ class RateDriverFromPassenger extends StatelessWidget {
), ),
), ),
), ),
const SizedBox(
height: 10,
),
Text(
'Exclusive offers and discounts always with the Sefer app'
.tr,
style: AppStyle.title
.copyWith(color: AppColor.redColor),
)
], ],
), ),
)), )),

View File

@@ -39,6 +39,31 @@ class RatePassenger extends StatelessWidget {
'${'Total price from '.tr}${Get.find<MapDriverController>().passengerName}', '${'Total price from '.tr}${Get.find<MapDriverController>().passengerName}',
style: AppStyle.title, style: AppStyle.title,
), ),
Container(
decoration: BoxDecoration(
border: Border.all(
width: 2,
color: AppColor.redColor,
)),
child: Padding(
padding: const EdgeInsets.all(4),
child: Text(
(double.parse(controller.price.toString()) *
.12 +
double.parse(
controller.price.toString()))
.toStringAsFixed(2),
style: AppStyle.number.copyWith(
color: AppColor.redColor,
textBaseline: TextBaseline.ideographic,
decoration: TextDecoration.lineThrough,
decorationColor: AppColor.redColor),
),
),
),
const SizedBox(
height: 10,
),
Container( Container(
decoration: BoxDecoration( decoration: BoxDecoration(
border: Border.all( border: Border.all(
@@ -53,6 +78,15 @@ class RatePassenger extends StatelessWidget {
), ),
), ),
), ),
const SizedBox(
height: 10,
),
Text(
'Exclusive offers and discounts always with the Sefer app'
.tr,
style: AppStyle.title
.copyWith(color: AppColor.redColor),
)
], ],
)), )),
), ),

View File

@@ -127,7 +127,7 @@ class DrawerCaptain extends StatelessWidget {
), ),
onTap: () { onTap: () {
// Handle wallet item tap // Handle wallet item tap
Get.to(() => WaletCaptain(), transition: Transition.native); Get.to(() => WalletCaptain(), transition: Transition.native);
}, },
), ),
ListTile( ListTile(

View File

@@ -116,7 +116,7 @@ class PassengerInfoWindow extends StatelessWidget {
children: [ children: [
Container( Container(
decoration: AppStyle.boxDecoration1, decoration: AppStyle.boxDecoration1,
width: Get.width * .25, width: Get.width * .22,
child: Padding( child: Padding(
padding: const EdgeInsets.all(4.0), padding: const EdgeInsets.all(4.0),
child: Text( child: Text(
@@ -131,7 +131,7 @@ class PassengerInfoWindow extends StatelessWidget {
width: 16.0), // Add spacing between sections width: 16.0), // Add spacing between sections
Container( Container(
decoration: AppStyle.boxDecoration1, decoration: AppStyle.boxDecoration1,
width: Get.width * .27, width: Get.width * .22,
child: Padding( child: Padding(
padding: const EdgeInsets.all(4), padding: const EdgeInsets.all(4),
child: Text( child: Text(

View File

@@ -417,13 +417,7 @@ class Burc extends StatelessWidget {
.tr), .tr),
icon: const Icon(Icons.headphones)), icon: const Icon(Icons.headphones)),
Text( Text(
'you have a negative balance of'.tr + '${'you have a negative balance of'.tr}${'${passengerWallet.toStringAsFixed(2)}\n${' in your'.tr}'} ${AppInformation.appName}${' wallet due to a previous trip.'.tr}',
'${passengerWallet.toStringAsFixed(2)}\n'
' in your'
.tr +
' ${AppInformation.appName}'
' wallet due to a previous trip.'
.tr,
textAlign: TextAlign.center, textAlign: TextAlign.center,
style: AppStyle.subtitle, style: AppStyle.subtitle,
), ),

View File

@@ -5,6 +5,9 @@ import 'package:SEFER/constant/style.dart';
import 'package:SEFER/controller/home/payment/captain_wallet_controller.dart'; import 'package:SEFER/controller/home/payment/captain_wallet_controller.dart';
import 'package:SEFER/controller/payment/payment_controller.dart'; import 'package:SEFER/controller/payment/payment_controller.dart';
import '../../../constant/box_name.dart';
import '../../../main.dart';
class PointsCaptain extends StatelessWidget { class PointsCaptain extends StatelessWidget {
PaymentController paymentController = Get.put(PaymentController()); PaymentController paymentController = Get.put(PaymentController());
CaptainWalletController captainWalletController = CaptainWalletController captainWalletController =
@@ -24,7 +27,9 @@ class PointsCaptain extends StatelessWidget {
Widget build(BuildContext context) { Widget build(BuildContext context) {
return InkWell( return InkWell(
onTap: () async { onTap: () async {
await paymentController.makePaymentStripe(pricePoint, 'USD', () async { await paymentController.makePaymentStripe(pricePoint,
box.read(BoxName.countryCode) == 'Jordan' ? 'jod' : 'egp',
() async {
await captainWalletController.addDriverPayment('visa', pricePoint); await captainWalletController.addDriverPayment('visa', pricePoint);
await captainWalletController.addDriverWallet('visa', countPoint); await captainWalletController.addDriverWallet('visa', countPoint);
await captainWalletController.getCaptainWalletFromBuyPoints(); await captainWalletController.getCaptainWalletFromBuyPoints();
@@ -48,7 +53,7 @@ class PointsCaptain extends StatelessWidget {
style: AppStyle.subtitle, style: AppStyle.subtitle,
), ),
Text( Text(
'$pricePoint\$', '$pricePoint ${box.read(BoxName.countryCode) == 'Jordan' ? 'JOD'.tr : 'LE'.tr}',
style: AppStyle.title, style: AppStyle.title,
), ),
], ],

View File

@@ -1,3 +1,4 @@
import 'package:SEFER/controller/functions/tts.dart';
import 'package:SEFER/views/home/my_wallet/payment_history_driver_page.dart'; import 'package:SEFER/views/home/my_wallet/payment_history_driver_page.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:get/get.dart'; import 'package:get/get.dart';
@@ -17,8 +18,8 @@ import 'package:path/path.dart';
import '../../widgets/my_scafold.dart'; import '../../widgets/my_scafold.dart';
import 'points_captain.dart'; import 'points_captain.dart';
class WaletCaptain extends StatelessWidget { class WalletCaptain extends StatelessWidget {
WaletCaptain({super.key}); WalletCaptain({super.key});
CaptainWalletController captainWalletController = CaptainWalletController captainWalletController =
Get.put(CaptainWalletController()); Get.put(CaptainWalletController());
@override @override
@@ -55,8 +56,8 @@ class WaletCaptain extends StatelessWidget {
child: InkWell( child: InkWell(
onTap: () { onTap: () {
Get.snackbar( Get.snackbar(
'the 300 points equal 30 L.E'.tr, 'the 300 points equal 300 L.E'.tr,
'the 300 points equal 30 L.E for you \nSo go and gain your money' 'the 300 points equal 300 L.E for you \nSo go and gain your money'
.tr, .tr,
backgroundColor: AppColor.greenColor, backgroundColor: AppColor.greenColor,
snackPosition: SnackPosition.BOTTOM, snackPosition: SnackPosition.BOTTOM,
@@ -109,13 +110,23 @@ class WaletCaptain extends StatelessWidget {
child: GestureDetector( child: GestureDetector(
onTap: () { onTap: () {
Get.snackbar( Get.snackbar(
icon: InkWell(
onTap: () async {
await Get.find<
TextToSpeechController>()
.speakText(
'This amount for all trip I get from Passengers'
.tr);
},
child: const Icon(
Icons.headphones)),
'${'Total Amount:'.tr} ${captainWalletController.totalAmount}\$', '${'Total Amount:'.tr} ${captainWalletController.totalAmount}\$',
'This amount for all trip I get from Passengers' 'This amount for all trip I get from Passengers'
.tr, .tr,
duration: duration:
const Duration(seconds: 6), const Duration(seconds: 6),
backgroundColor: backgroundColor:
AppColor.deepPurpleAccent, AppColor.yellowColor,
snackPosition: SnackPosition.BOTTOM, snackPosition: SnackPosition.BOTTOM,
); );
}, },
@@ -150,6 +161,19 @@ class WaletCaptain extends StatelessWidget {
child: InkWell( child: InkWell(
onTap: () { onTap: () {
Get.snackbar( Get.snackbar(
icon: InkWell(
onTap: () async {
await Get.find<
TextToSpeechController>()
.speakText(
'This amount for all trip I get from Passengers and Collected For me in'
.tr +
' SAFAR Wallet'.tr,
);
},
child: const Icon(
Icons.headphones),
),
'${'Total Amount:'.tr} ${captainWalletController.totalAmountVisa}\$', '${'Total Amount:'.tr} ${captainWalletController.totalAmountVisa}\$',
'This amount for all trip I get from Passengers and Collected For me in' 'This amount for all trip I get from Passengers and Collected For me in'
.tr + .tr +
@@ -158,7 +182,7 @@ class WaletCaptain extends StatelessWidget {
duration: duration:
const Duration(seconds: 6), const Duration(seconds: 6),
backgroundColor: backgroundColor:
AppColor.deepPurpleAccent, AppColor.redColor,
snackPosition: snackPosition:
SnackPosition.BOTTOM, SnackPosition.BOTTOM,
); );
@@ -178,15 +202,16 @@ class WaletCaptain extends StatelessWidget {
onPressed: () { onPressed: () {
Get.defaultDialog( Get.defaultDialog(
title: 'Pay from my budget'.tr, title: 'Pay from my budget'.tr,
titleStyle: AppStyle.title,
content: Form( content: Form(
key: captainWalletController.formKey, key: captainWalletController.formKey,
child: MyTextForm( child: MyTextForm(
controller: captainWalletController controller: captainWalletController
.amountFromBudgetController, .amountFromBudgetController,
label: label:
'${'You have in account'.tr} ${captainWalletController.totalAmount}', '${'You have in account'.tr} ${captainWalletController.totalAmountVisa}',
hint: hint:
'${'You have in account'.tr} ${captainWalletController.totalAmount}', '${'You have in account'.tr} ${captainWalletController.totalAmountVisa}',
type: TextInputType.number, type: TextInputType.number,
), ),
), ),
@@ -199,7 +224,7 @@ class WaletCaptain extends StatelessWidget {
.text) < .text) <
double.parse( double.parse(
captainWalletController captainWalletController
.totalAmount)) { .totalAmountVisa)) {
await captainWalletController await captainWalletController
.payFromBudget(); .payFromBudget();
} else { } else {
@@ -258,23 +283,55 @@ class WaletCaptain extends StatelessWidget {
children: [ children: [
PointsCaptain( PointsCaptain(
kolor: AppColor.blueColor, kolor: AppColor.blueColor,
pricePoint: 5.6, pricePoint:
countPoint: '300', box.read(BoxName.countryCode) ==
'Jordan'
? 5
: 100,
countPoint:
box.read(BoxName.countryCode) ==
'Jordan'
? '300'
: '100',
), ),
PointsCaptain( PointsCaptain(
kolor: Colors.green, kolor: Colors.green,
pricePoint: 11.2, pricePoint:
countPoint: '1040', box.read(BoxName.countryCode) ==
'Jordan'
? 10
: 200,
countPoint:
box.read(BoxName.countryCode) ==
'Jordan'
? '1040'
: '210',
), ),
PointsCaptain( PointsCaptain(
kolor: Colors.amberAccent, kolor: Colors.amberAccent,
pricePoint: 22.4, pricePoint:
countPoint: '2100', box.read(BoxName.countryCode) ==
'Jordan'
? 22
: 400,
countPoint:
box.read(BoxName.countryCode) ==
'Jordan'
? '2300'
: '440',
), ),
PointsCaptain( PointsCaptain(
kolor: AppColor.yellowColor, kolor: AppColor.yellowColor,
pricePoint: 56, pricePoint:
countPoint: '52000', box.read(BoxName.countryCode) ==
'Jordan'
? 50
: 1000,
countPoint:
box.read(BoxName.countryCode) ==
'Jordan'
? '55000'
: '1200',
), ),
], ],
)), )),