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() {
Get.back();
Get.back();
Get.to(() => WaletCaptain());
Get.to(() => WalletCaptain());
}
void changeRideId() {

View File

@@ -20,7 +20,9 @@ class CaptainWalletController extends GetxController {
payFromBudget() async {
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',
int.parse((amountFromBudgetController.text)) * -1);

View File

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

View File

@@ -1,4 +1,5 @@
import 'dart:convert';
import 'package:SEFER/constant/api_key.dart';
import 'package:http/http.dart' as http;
import 'package:flutter/material.dart';
import 'package:flutter_paypal/flutter_paypal.dart';
@@ -197,6 +198,7 @@ class PaymentController extends GetxController {
name: CollectionMode.automatic,
phone: CollectionMode.automatic,
email: CollectionMode.automatic,
// address: CollectionMode.automatic,
),
),
);
@@ -248,10 +250,8 @@ class PaymentController extends GetxController {
MaterialPageRoute(
builder: (BuildContext context) => UsePaypal(
sandboxMode: true,
clientId:
"AWj9MdPaA5Djpx8gOkvBn2qhP-3KvfB6W-l8USTsm19Xi2NhkNkE9QzosOvTPTsKjCMNffgpqStUA1-x",
secretKey:
"EKkasSl9O61lrfrbaJfXp1B-CIs2Rv71J0WPouxxugi38DsWaMhWpovJxN2ftYPQ0l6v9eoBvnyWkemp",
clientId: AK.payPalClientIdLive,
secretKey: AK.payPalSecretLive,
returnURL: AppInformation.website,
cancelURL: "${AppInformation.website}/cancel",
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}',
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(
decoration: BoxDecoration(
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: () {
// Handle wallet item tap
Get.to(() => WaletCaptain(), transition: Transition.native);
Get.to(() => WalletCaptain(), transition: Transition.native);
},
),
ListTile(

View File

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

View File

@@ -417,13 +417,7 @@ class Burc extends StatelessWidget {
.tr),
icon: const Icon(Icons.headphones)),
Text(
'you have a negative balance of'.tr +
'${passengerWallet.toStringAsFixed(2)}\n'
' in your'
.tr +
' ${AppInformation.appName}'
' wallet due to a previous trip.'
.tr,
'${'you have a negative balance of'.tr}${'${passengerWallet.toStringAsFixed(2)}\n${' in your'.tr}'} ${AppInformation.appName}${' wallet due to a previous trip.'.tr}',
textAlign: TextAlign.center,
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/payment/payment_controller.dart';
import '../../../constant/box_name.dart';
import '../../../main.dart';
class PointsCaptain extends StatelessWidget {
PaymentController paymentController = Get.put(PaymentController());
CaptainWalletController captainWalletController =
@@ -24,7 +27,9 @@ class PointsCaptain extends StatelessWidget {
Widget build(BuildContext context) {
return InkWell(
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.addDriverWallet('visa', countPoint);
await captainWalletController.getCaptainWalletFromBuyPoints();
@@ -48,7 +53,7 @@ class PointsCaptain extends StatelessWidget {
style: AppStyle.subtitle,
),
Text(
'$pricePoint\$',
'$pricePoint ${box.read(BoxName.countryCode) == 'Jordan' ? 'JOD'.tr : 'LE'.tr}',
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:flutter/material.dart';
import 'package:get/get.dart';
@@ -17,8 +18,8 @@ import 'package:path/path.dart';
import '../../widgets/my_scafold.dart';
import 'points_captain.dart';
class WaletCaptain extends StatelessWidget {
WaletCaptain({super.key});
class WalletCaptain extends StatelessWidget {
WalletCaptain({super.key});
CaptainWalletController captainWalletController =
Get.put(CaptainWalletController());
@override
@@ -55,8 +56,8 @@ class WaletCaptain extends StatelessWidget {
child: InkWell(
onTap: () {
Get.snackbar(
'the 300 points equal 30 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'.tr,
'the 300 points equal 300 L.E for you \nSo go and gain your money'
.tr,
backgroundColor: AppColor.greenColor,
snackPosition: SnackPosition.BOTTOM,
@@ -109,13 +110,23 @@ class WaletCaptain extends StatelessWidget {
child: GestureDetector(
onTap: () {
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}\$',
'This amount for all trip I get from Passengers'
.tr,
duration:
const Duration(seconds: 6),
backgroundColor:
AppColor.deepPurpleAccent,
AppColor.yellowColor,
snackPosition: SnackPosition.BOTTOM,
);
},
@@ -150,6 +161,19 @@ class WaletCaptain extends StatelessWidget {
child: InkWell(
onTap: () {
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}\$',
'This amount for all trip I get from Passengers and Collected For me in'
.tr +
@@ -158,7 +182,7 @@ class WaletCaptain extends StatelessWidget {
duration:
const Duration(seconds: 6),
backgroundColor:
AppColor.deepPurpleAccent,
AppColor.redColor,
snackPosition:
SnackPosition.BOTTOM,
);
@@ -178,15 +202,16 @@ class WaletCaptain extends StatelessWidget {
onPressed: () {
Get.defaultDialog(
title: 'Pay from my budget'.tr,
titleStyle: AppStyle.title,
content: Form(
key: captainWalletController.formKey,
child: MyTextForm(
controller: captainWalletController
.amountFromBudgetController,
label:
'${'You have in account'.tr} ${captainWalletController.totalAmount}',
'${'You have in account'.tr} ${captainWalletController.totalAmountVisa}',
hint:
'${'You have in account'.tr} ${captainWalletController.totalAmount}',
'${'You have in account'.tr} ${captainWalletController.totalAmountVisa}',
type: TextInputType.number,
),
),
@@ -199,7 +224,7 @@ class WaletCaptain extends StatelessWidget {
.text) <
double.parse(
captainWalletController
.totalAmount)) {
.totalAmountVisa)) {
await captainWalletController
.payFromBudget();
} else {
@@ -258,23 +283,55 @@ class WaletCaptain extends StatelessWidget {
children: [
PointsCaptain(
kolor: AppColor.blueColor,
pricePoint: 5.6,
countPoint: '300',
pricePoint:
box.read(BoxName.countryCode) ==
'Jordan'
? 5
: 100,
countPoint:
box.read(BoxName.countryCode) ==
'Jordan'
? '300'
: '100',
),
PointsCaptain(
kolor: Colors.green,
pricePoint: 11.2,
countPoint: '1040',
pricePoint:
box.read(BoxName.countryCode) ==
'Jordan'
? 10
: 200,
countPoint:
box.read(BoxName.countryCode) ==
'Jordan'
? '1040'
: '210',
),
PointsCaptain(
kolor: Colors.amberAccent,
pricePoint: 22.4,
countPoint: '2100',
pricePoint:
box.read(BoxName.countryCode) ==
'Jordan'
? 22
: 400,
countPoint:
box.read(BoxName.countryCode) ==
'Jordan'
? '2300'
: '440',
),
PointsCaptain(
kolor: AppColor.yellowColor,
pricePoint: 56,
countPoint: '52000',
pricePoint:
box.read(BoxName.countryCode) ==
'Jordan'
? 50
: 1000,
countPoint:
box.read(BoxName.countryCode) ==
'Jordan'
? '55000'
: '1200',
),
],
)),