This commit is contained in:
Hamza-Ayed
2024-06-25 15:08:56 +03:00
parent 9c73af74bb
commit 0407d37e9d
16 changed files with 513 additions and 493 deletions

View File

@@ -30,6 +30,8 @@ class BoxName {
static const String passengerID = "pasengerID";
static const String phone = "phone";
static const String phoneDriver = "phoneDriver";
static const String bankCodeDriver = "bankCodeDriver";
static const String accountBankNumberDriver = "accountBankNumberDriver";
static const String dobDriver = "dobDriver";
static const String sexDriver = "sexDriver";
static const String lastNameDriver = "lastNameDriver";

View File

@@ -3,6 +3,10 @@ import 'package:flutter/material.dart';
class AppColor {
static const Color primaryColor = Color(0xFF1DA1F2);
static const Color writeColor = Color(0xff222359);
static const Color bronze = Color(0xFFCD7F32);
static const Color goldenBronze = Color(0xFFB87333); // Golden bronze color
static const Color gold = Color(0xFFD4AF37);
static const Color secondaryColor = Colors.white;
static const Color accentColor = Colors.grey;
static const Color greyColor = Colors.grey;

View File

@@ -132,6 +132,10 @@ class LoginCaptinController extends GetxController {
box.write(BoxName.phoneVerified,
jsonDecoeded['data'][0]['is_verified'].toString());
box.write(BoxName.phoneDriver, jsonDecoeded['data'][0]['phone']);
box.write(
BoxName.bankCodeDriver, jsonDecoeded['data'][0]['bankCode']);
box.write(BoxName.accountBankNumberDriver,
jsonDecoeded['data'][0]['accountBank']);
box.write(
BoxName.nameDriver,
'${jsonDecoeded['data'][0]['first_name']}'

View File

@@ -1,8 +1,5 @@
import 'dart:async';
import 'dart:convert';
import 'dart:math' as math;
import 'dart:math' show cos;
import 'package:SEFER/constant/table_names.dart';
import 'package:SEFER/controller/home/captin/home_captain_controller.dart';
import 'package:flutter/material.dart';
import 'package:geolocator/geolocator.dart';
@@ -523,10 +520,8 @@ class MapDriverController extends GetxController {
}
double pointsSubtraction = 0;
pointsSubtraction = double.parse(paymentAmount) *
(-1) *
double.parse(kazan) /
100; // for Egypt /100
pointsSubtraction =
double.parse(paymentAmount) * (-1) * double.parse(kazan);
var paymentToken2 =
await generateTokenDriver((pointsSubtraction).toStringAsFixed(0));
var res = await CRUD().post(link: AppLink.addDriversWalletPoints, payload: {

View File

@@ -14,6 +14,7 @@ import 'package:SEFER/main.dart';
class CaptainWalletController extends GetxController {
bool isLoading = false;
final formKeyTransfer = GlobalKey<FormState>();
final formKeyAccount = GlobalKey<FormState>();
Map walletDate = {};
Map walletDateVisa = {};
Map walletDriverPointsDate = {};
@@ -24,6 +25,8 @@ class CaptainWalletController extends GetxController {
final amountFromBudgetController = TextEditingController();
final newDriverPhoneController = TextEditingController();
final phoneWallet = TextEditingController();
final cardBank = TextEditingController();
final bankCode = TextEditingController();
payFromBudget() async {
if (formKey.currentState!.validate()) {
@@ -198,7 +201,10 @@ class CaptainWalletController extends GetxController {
await CRUD().post(link: AppLink.addDriversWalletPoints, payload: {
'driverID': amountToNewDriverMap[0]['id'].toString(),
'paymentID': paymentID.toString(),
'amount': (int.parse(amountFromBudgetController.text) - 5).toString(),
'amount': ((int.parse(amountFromBudgetController.text) - 5) / .08)
.toStringAsFixed(
0), // this will convert buddget to poitns by kazan .08
'token': paymentToken,
'paymentMethod': paymentMethod2.toString(),
});

View File

@@ -4,7 +4,18 @@ class MyTranslation extends Translations {
@override
Map<String, Map<String, String>> get keys => {
"ar": {
"You don't have enough money in your SEFER wallet":
"Please enter a valid card 16-digit number.":
"الرجاء إدخال رقم بطاقة صحيح مكون من 16 رقمًا.",
"Insert card number": "أدخل رقم البطاقة",
"Bank account added successfully": "تمت إضافة الحساب البنكي بنجاح",
"Updated successfully": "تم التحديث بنجاح",
"Create Wallet to receive your money": "أنشئ محفظة لاستقبال أموالك",
"Insert Account Bank": "أدخل رقم حسابك البنكي",
"Insert Card Bank Details to Receive Your Visa Money Weekly":
"أدخل تفاصيل بطاقتك البنكية لاستقبال راتبك عبر فيزا كل أسبوع",
"Select Name of Your Bank": "اختر اسم بنكك",
"Create Wallet to receive your money"
"You don't have enough money in your SEFER wallet":
"لا يوجد رصيد كافٍ في محفظة SEFER الخاصة بك ",
"You have transferred to your wallet from": "لقد حولت إلى محفظتك من",
'Transfer': "تحويل",
@@ -87,8 +98,8 @@ class MyTranslation extends Translations {
'This amount for all trip I get from Passengers and Collected For me in':
'هذا المبلغ لجميع الرحلات التي أحصل عليها من الركاب والمجموعة لي في',
'Total Budget from trips is ': 'إجمالي الميزانية من الرحلات هو ',
'You can buy Points to let you online\nby this list below':
'يمكنك سداد المديونية من هذه القائمة',
"You can purchase a budget to enable online access through the options listed below.":
'يمكنك ‏إضافة رصيد من هذه القائمة',
'You can buy points from your budget':
'يمكنك سداد المديونية من حسابك',
"expiration_date": "تاريخ الانتهاء",
@@ -648,11 +659,12 @@ class MyTranslation extends Translations {
"Please help! Contact me as soon as possible.":
"من فضلك ساعدني! تواصل معي في أقرب وقت ممكن.",
"Share Trip Details": "شارك تفاصيل الرحلة",
"Car Plate is": "لوحة السيارة",
"the 300 points equal 300 L.E for you":
"الـ 300 نقطة تعادل 300 جنيه مصري بالنسبة لك",
"Car Plate is": "لوحة السيارة", 'L.E': 'جنيه',
"the 3000 points equal 3000 L.E for you":
"الـ 3000 نقطة تعادل 3000 جنيه مصري بالنسبة لك",
"So go and gain your money": "انطلق واكسب مالك",
"the 300 points equal 300 L.E": "الـ 300 نقطة تساوي 300 جنيه مصري",
"the 3000 points equal 3000 L.E":
"الـ 3000 نقطة تساوي 3000 جنيه مصري",
"The payment was not approved. Please try again.":
"لم يتم الموافقة على الدفع. يرجى المحاولة مرة أخرى.",
"Payment Failed": "تعذرت عملية الدفع",
@@ -676,8 +688,8 @@ class MyTranslation extends Translations {
' is ON for this month': ' لهذا الشهر ',
"Origin": "الأصل",
"Destination": "مكان الوصول",
'the 300 points equal 300 L.E for you \nSo go and gain your money':
"ال300 نقطة تعادل 300 ج.م لك، فاذهب واكسب مالك.",
'the 3000 points equal 3000 L.E for you \nSo go and gain your money':
"ال3000 نقطة تعادل 3000 ج.م لك، فاذهب واكسب مالك.",
"Driver Name": "اسم السائق",
"Driver Car Plate": "لوحة سيارة السائق",
"Available for rides": "‏الرحلات المتوفرة",
@@ -1423,18 +1435,18 @@ class MyTranslation extends Translations {
"Konumum doğru. Navigasyon uygulamasını kullanarak beni arayabilirsiniz",
"Share Trip Details": "Seni bekliyorum",
"Car Plate is": "Merhaba, kararlaştırılan yerdeyim",
"the 300 points equal 300 L.E for you":
"the 3000 points equal 3000 L.E for you":
"Hızın 100 km/s'yi aştığını fark ettik. Lütfen güvenliğiniz için yavaşlayın. Kendinizi güvende hissetmiyorsanız yolculuk bilgilerinizi bir kişiyle paylaşabilir veya kırmızı sos düğmesini kullanarak polisi arayabilirsiniz.",
"So go and gain your money": "Uyarı: Hız algılandı!",
"the 300 points equal 300 L.E":
"the 3000 points equal 3000 L.E":
"Lütfen yardım edin! En kısa sürede benimle iletişime geçin.",
"The payment was not approved. Please try again.":
"Yolculuk bilgilerini paylaşın",
"Payment Failed": "Araç Plakası:",
"Error": "300 puan sizin için 300 L.E.' ye eşittir",
"Error": "3000 puan sizin için 3000 L.E.' ye eşittir",
"An error occurred during the payment process.":
"Öyleyse git ve paranı kazan",
"The payment was approved.": "300 puan 300 L.E.' ye eşittir.",
"The payment was approved.": "3000 puan 3000 L.E.' ye eşittir.",
"Payment Successful": "Ödeme onaylanmadı. Please try again later.",
"No ride found yet": "Ödeme Başarısız",
"Accept Order": "Error",
@@ -2220,10 +2232,10 @@ class MyTranslation extends Translations {
"Aide-moi s'il te plaît. Contactez-moi dès que possible.",
"Share Trip Details": "Partagez les détails de la",
"Car Plate is": "Le numéro d'immatriculation ?",
"the 300 points equal 300 L.E for you":
"300 points équivaut à 300 EGP pour vous",
"the 3000 points equal 3000 L.E for you":
"3000 points équivaut à 3000 EGP pour vous",
"So go and gain your money": "Gagnez de l'argent",
"the 300 points equal 300 L.E": "300 points équivaut à 300 EGP",
"the 3000 points equal 3000 L.E": "3000 points équivaut à 3000 EGP",
"The payment was not approved. Please try again.":
"Paiement non approuvé. Réessayer",
"Payment Failed": "Échec du paiement",
@@ -3020,10 +3032,10 @@ class MyTranslation extends Translations {
"Aide-moi s'il te plaît. Contactez-moi dès que possible.",
"Share Trip Details": "Partagez les détails de la",
"Car Plate is": "Le numéro d'immatriculation ?",
"the 300 points equal 300 L.E for you":
"300 points équivaut à 300 EGP pour vous",
"the 3000 points equal 3000 L.E for you":
"3000 points équivaut à 3000 EGP pour vous",
"So go and gain your money": "Gagnez de l'argent",
"the 300 points equal 300 L.E": "300 points équivaut à 300 EGP",
"the 3000 points equal 3000 L.E": "3000 points équivaut à 3000 EGP",
"The payment was not approved. Please try again.":
"Paiement non approuvé. Réessayer",
"Payment Failed": "Échec du paiement",
@@ -3817,10 +3829,10 @@ class MyTranslation extends Translations {
"Aide-moi s'il te plaît. Contactez-moi dès que possible.",
"Share Trip Details": "Partagez les détails de la",
"Car Plate is": "Le numéro d'immatriculation ?",
"the 300 points equal 300 L.E for you":
"300 points équivaut à 300 EGP pour vous",
"the 3000 points equal 3000 L.E for you":
"3000 points équivaut à 3000 EGP pour vous",
"So go and gain your money": "Gagnez de l'argent",
"the 300 points equal 300 L.E": "300 points équivaut à 300 EGP",
"the 3000 points equal 3000 L.E": "3000 points équivaut à 3000 EGP",
"The payment was not approved. Please try again.":
"Paiement non approuvé. Réessayer",
"Payment Failed": "Échec du paiement",
@@ -4615,10 +4627,10 @@ class MyTranslation extends Translations {
"Aide-moi s'il te plaît. Contactez-moi dès que possible.",
"Share Trip Details": "Partagez les détails de la",
"Car Plate is": "Le numéro d'immatriculation ?",
"the 300 points equal 300 L.E for you":
"300 points équivaut à 300 EGP pour vous",
"the 3000 points equal 3000 L.E for you":
"3000 points équivaut à 3000 EGP pour vous",
"So go and gain your money": "Gagnez de l'argent",
"the 300 points equal 300 L.E": "300 points équivaut à 300 EGP",
"the 3000 points equal 3000 L.E": "3000 points équivaut à 3000 EGP",
"The payment was not approved. Please try again.":
"Paiement non approuvé. Réessayer",
"Payment Failed": "Échec du paiement",
@@ -5418,10 +5430,10 @@ class MyTranslation extends Translations {
"Aide-moi s'il te plaît. Contactez-moi dès que possible.",
"Share Trip Details": "Partagez les détails de la",
"Car Plate is": "Le numéro d'immatriculation ?",
"the 300 points equal 300 L.E for you":
"300 points équivaut à 300 EGP pour vous",
"the 3000 points equal 3000 L.E for you":
"3000 points équivaut à 3000 EGP pour vous",
"So go and gain your money": "Gagnez de l'argent",
"the 300 points equal 300 L.E": "300 points équivaut à 300 EGP",
"the 3000 points equal 3000 L.E": "3000 points équivaut à 3000 EGP",
"The payment was not approved. Please try again.":
"Paiement non approuvé. Réessayer",
"Payment Failed": "Échec du paiement",
@@ -6204,10 +6216,10 @@ class MyTranslation extends Translations {
"कृपया मेरी मदद करें! जितनी जल्दी हो सके मुझसे संपर्क करें।",
"Share Trip Details": "ट्रिप का ब्यौरा दें",
"Car Plate is": "कार के चारों ओर ले आओ।",
"the 300 points equal 300 L.E for you":
"300 अंक आपके लिए 300 EGP के बराबर है",
"the 3000 points equal 3000 L.E for you":
"3000 अंक आपके लिए 3000 EGP के बराबर है",
"So go and gain your money": "अपने पैसे कमाने के लिए आगे बढ़ें",
"the 300 points equal 300 L.E": "300 points बराबर है: 300 EGP",
"the 3000 points equal 3000 L.E": "3000 points बराबर है: 3000 EGP",
"The payment was not approved. Please try again.":
"भुगतान मंज़ूर नहीं किया गया। फिर से कोशिश करें",
"Payment Failed": "भुगतान नहीं हो सका",
@@ -6983,10 +6995,11 @@ class MyTranslation extends Translations {
"لطفأ ، کمکم کن. در اسرع وقت با من تماس بگیرید.",
"Share Trip Details": "جزئیات سفر را به اشتراک بگذارید",
"Car Plate is": "پلاک اتومبیل",
"the 300 points equal 300 L.E for you":
"300 امتیاز برای شما معادل 300 پوند مصر است",
"the 3000 points equal 3000 L.E for you":
"3000 امتیاز برای شما معادل 3000 پوند مصر است",
"So go and gain your money": "برو جلو و پولت را در بیاور",
"the 300 points equal 300 L.E": "300 امتیاز معادل 300 پوند مصر است",
"the 3000 points equal 3000 L.E":
"3000 امتیاز معادل 3000 پوند مصر است",
"The payment was not approved. Please try again.":
"پرداخت تایید نشد سعی مجدد",
"Payment Failed": "پرداخت ناموفق",
@@ -7706,9 +7719,9 @@ class MyTranslation extends Translations {
"Please help! Contact me as soon as possible.": "請幫幫我!請盡快與我聯絡。",
"Share Trip Details": "提供行程詳細資訊",
"Car Plate is": "車牌號碼",
"the 300 points equal 300 L.E for you": "300分等於300 EGP",
"the 3000 points equal 3000 L.E for you": "3000分等於3000 EGP",
"So go and gain your money": "開始賺取收入",
"the 300 points equal 300 L.E": "300分等於300 EGP",
"the 3000 points equal 3000 L.E": "3000分等於3000 EGP",
"The payment was not approved. Please try again.": "付款未批準。請再試一次。",
"Payment Failed": "付款失敗",
"Error": "錯誤",

View File

@@ -1,45 +0,0 @@
import 'dart:convert';
import 'package:SEFER/constant/style.dart';
import 'package:SEFER/views/widgets/elevated_btn.dart';
import 'package:get/get.dart';
import 'package:SEFER/constant/box_name.dart';
import 'package:SEFER/constant/links.dart';
import 'package:SEFER/controller/functions/crud.dart';
import 'package:SEFER/main.dart';
class PassengerWalletHistoryController extends GetxController {
bool isLoading = false;
List archive = [];
getArchivePayment() async {
isLoading = true;
update();
var res = await CRUD().get(
link: AppLink.getPassengerWalletArchive,
payload: {'passenger_id': box.read(BoxName.passengerID)});
if (res != 'failure') {
archive = jsonDecode(res)['message'];
isLoading = false;
update();
} else {
Get.defaultDialog(
barrierDismissible: false,
title: 'No wallet record found'.tr,
titleStyle: AppStyle.title,
middleText: '',
confirm: MyElevatedButton(
title: 'OK'.tr,
onPressed: () {
Get.back();
Get.back();
}));
}
}
@override
void onInit() {
getArchivePayment();
super.onInit();
}
}

View File

@@ -50,7 +50,7 @@ class SplashScreen extends StatelessWidget {
TypewriterAnimatedText(
'Welcome to ${AppInformation.appName}',
textStyle:
AppStyle.headTitle2.copyWith(color: AppColor.greenColor),
AppStyle.headTitle2.copyWith(color: AppColor.writeColor),
speed: const Duration(milliseconds: 200),
),
], isRepeatingAnimation: true),

View File

@@ -40,7 +40,7 @@ class DrawerCaptain extends StatelessWidget {
_buildDrawerItem(
icon: Icons.person,
text: 'Profile'.tr,
onTap: () => Get.to(() => const ProfileCaptain(),
onTap: () => Get.to(() => ProfileCaptain(),
transition: Transition.rightToLeftWithFade),
),
_buildDivider(),

View File

@@ -0,0 +1,51 @@
import 'package:flutter/material.dart';
import 'package:get/get.dart';
class BankController extends GetxController {
String selectedBank = '';
Map<String, String> bankNames = {
'CIB Bank'.tr: 'CIB',
'National Bank of Egypt'.tr: 'NBE',
'QNB Al Ahli'.tr: 'QNB',
'Bank Misr'.tr: 'BM',
// Add other bank full names and short names here
};
@override
void onInit() {
super.onInit();
selectedBank = bankNames.values.first;
}
void updateSelectedBank(String? bankShortName) {
selectedBank = bankShortName ?? '';
update();
}
List<DropdownMenuItem<String>> getDropdownItems() {
return bankNames.keys.map<DropdownMenuItem<String>>((bankFullName) {
return DropdownMenuItem<String>(
value: bankNames[bankFullName],
child: Text(bankFullName),
);
}).toList();
}
}
class BankDropdown extends StatelessWidget {
final BankController bankController = Get.put(BankController());
@override
Widget build(BuildContext context) {
return GetBuilder<BankController>(
init: bankController,
builder: (controller) {
return DropdownButton<String>(
value: controller.selectedBank,
onChanged: controller.updateSelectedBank,
items: controller.getDropdownItems(),
);
},
);
}
}

View File

@@ -152,17 +152,20 @@ class CardSeferWalletDriver extends StatelessWidget {
color: AppColor.deepPurpleAccent,
borderRadius: const BorderRadius.all(Radius.circular(12)),
gradient: const LinearGradient(
colors: [AppColor.blueColor, AppColor.primaryColor]),
colors: [AppColor.greyColor, AppColor.writeColor]),
),
child: Column(
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
children: [
Row(
children: [
Text(
'${AppInformation.appName} Wallet',
style: AppStyle.headTitle
.copyWith(color: AppColor.primaryColor),
Padding(
padding: const EdgeInsets.symmetric(horizontal: 10),
child: Text(
'${AppInformation.appName} Wallet',
style: AppStyle.headTitle
.copyWith(color: AppColor.writeColor),
),
)
],
),

View File

@@ -1,61 +0,0 @@
import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:SEFER/constant/colors.dart';
import 'package:SEFER/constant/style.dart';
import 'package:SEFER/controller/payment/passenger_wallet_history_controller.dart';
import 'package:SEFER/views/widgets/my_scafold.dart';
import 'package:SEFER/views/widgets/mycircular.dart';
class PaymentHistoryPassengerPage extends StatelessWidget {
const PaymentHistoryPassengerPage({super.key});
@override
Widget build(BuildContext context) {
Get.put(PassengerWalletHistoryController());
return MyScafolld(
title: 'Payment History'.tr,
body: [
GetBuilder<PassengerWalletHistoryController>(
builder: (controller) => controller.isLoading
? const MyCircularProgressIndicator()
: controller.archive.isEmpty
? Center(
child: Text(
'No wallet record found'.tr,
style: AppStyle.title,
),
)
: ListView.builder(
itemCount: controller.archive.length,
itemBuilder: (BuildContext context, int index) {
var list = controller.archive[index];
return Padding(
padding: const EdgeInsets.all(4),
child: Container(
decoration: BoxDecoration(
color: double.parse(list['balance']) < 0
? AppColor.redColor.withOpacity(.4)
: AppColor.greenColor.withOpacity(.4)),
child: Row(
mainAxisAlignment:
MainAxisAlignment.spaceBetween,
children: [
Text(
list['balance'],
style: AppStyle.title,
),
Text(
list['created_at'],
style: AppStyle.title,
),
],
),
),
);
},
),
)
],
isleading: true);
}
}

View File

@@ -97,30 +97,43 @@ class PointsCaptain extends StatelessWidget {
child: Padding(
padding: const EdgeInsets.symmetric(horizontal: 3, vertical: 8),
child: Container(
width: Get.width * .22,
height: Get.width * .22,
margin: const EdgeInsets.all(4),
decoration: BoxDecoration(
color: kolor,
border: Border.all(color: AppColor.accentColor),
borderRadius: BorderRadius.circular(12),
shape: BoxShape.rectangle,
width: Get.width * .22,
height: Get.width * .22,
margin: const EdgeInsets.all(4),
decoration: BoxDecoration(
gradient: LinearGradient(
colors: [
kolor.withOpacity(0.3),
kolor,
kolor.withOpacity(0.7),
kolor,
],
begin: Alignment.topLeft,
end: Alignment.bottomRight,
),
child: Center(
child: Column(
children: [
Text(
'$countPoint ${'Point'.tr}',
style: AppStyle.subtitle,
),
Text(
'$pricePoint ${box.read(BoxName.countryCode) == 'Jordan' ? 'JOD'.tr : 'LE'.tr}',
style: AppStyle.title,
textAlign: TextAlign.center,
),
],
),
)),
border: Border.all(color: AppColor.accentColor),
borderRadius: BorderRadius.circular(12),
shape: BoxShape.rectangle,
),
child: Center(
child: Column(
mainAxisAlignment: MainAxisAlignment.spaceAround,
children: [
Text(
'$countPoint ${box.read(BoxName.countryCode) == 'Jordan' ? 'JOD'.tr : 'L.E'.tr}',
style: AppStyle.subtitle
.copyWith(color: AppColor.secondaryColor),
),
Text(
'$pricePoint ${box.read(BoxName.countryCode) == 'Jordan' ? 'JOD'.tr : 'L.E'.tr}',
style:
AppStyle.title.copyWith(color: AppColor.secondaryColor),
textAlign: TextAlign.center,
),
],
),
),
),
),
);
}

View File

@@ -1,5 +1,8 @@
import 'package:SEFER/constant/links.dart';
import 'package:SEFER/controller/functions/crud.dart';
import 'package:SEFER/controller/functions/tts.dart';
import 'package:SEFER/controller/home/payment/paymob_payout.dart';
import 'package:SEFER/views/home/my_wallet/bank_account_egypt.dart';
import 'package:SEFER/views/home/my_wallet/payment_history_driver_page.dart';
import 'package:flutter/material.dart';
import 'package:get/get.dart';
@@ -48,19 +51,19 @@ class WalletCaptain extends StatelessWidget {
0 &&
double.parse(
captainWalletController.totalPoints) >
-300
-3000
? AppColor.yellowColor
: double.parse(
captainWalletController.totalPoints) <
-300
-3000
? AppColor.redColor
: AppColor.greenColor,
// ),
child: InkWell(
onTap: () {
Get.snackbar(
'the 300 points equal 300 L.E'.tr,
'the 300 points equal 300 L.E for you \nSo go and gain your money'
'the 3000 points equal 3000 L.E'.tr,
'the 3000 points equal 3000 L.E for you \nSo go and gain your money'
.tr,
backgroundColor: AppColor.greenColor,
snackPosition: SnackPosition.BOTTOM,
@@ -83,7 +86,7 @@ class WalletCaptain extends StatelessWidget {
),
double.parse(captainWalletController.totalPoints
.toString()) <
-300
-3000
? MyElevatedButton(
title: 'Charge your Account'.tr,
onPressed: () {})
@@ -110,7 +113,7 @@ class WalletCaptain extends StatelessWidget {
decoration: BoxDecoration(
border: Border.all(
width: 2,
color: AppColor.redColor)),
color: AppColor.writeColor)),
child: GestureDetector(
onTap: () {
Get.snackbar(
@@ -159,7 +162,7 @@ class WalletCaptain extends StatelessWidget {
decoration: BoxDecoration(
border: Border.all(
width: 2,
color: AppColor.greenColor)),
color: AppColor.writeColor)),
child: Padding(
padding: const EdgeInsets.all(2),
child: InkWell(
@@ -276,47 +279,47 @@ class WalletCaptain extends StatelessWidget {
height: 10,
),
Padding(
padding: const EdgeInsets.all(8.0),
child: Container(
decoration: AppStyle.boxDecoration,
child: Column(
children: [
Text(
'You can buy Points to let you online\nby this list below'
.tr,
textAlign: TextAlign.center,
style: AppStyle.title,
),
const Divider(
indent: 30,
endIndent: 30,
color: AppColor.accentColor,
thickness: 3,
),
const SizedBox(
height: 10,
),
Container(
padding: const EdgeInsets.all(8.0),
child: Container(
decoration: AppStyle.boxDecoration,
child: Column(children: [
Text(
"You can purchase a budget to enable online access through the options listed below."
.tr,
textAlign: TextAlign.center,
style: AppStyle.title,
),
const Divider(
indent: 30,
endIndent: 30,
color: AppColor.accentColor,
thickness: 3,
),
const SizedBox(
height: 10,
),
Container(
decoration: AppStyle.boxDecoration,
height: Get.height * .19,
child: ListView(
scrollDirection: Axis.horizontal,
children: [
PointsCaptain(
kolor: AppColor.blueColor,
kolor: AppColor.greyColor,
pricePoint:
box.read(BoxName.countryCode) ==
'Jordan'
? 5
: 100,
: 80,
countPoint:
box.read(BoxName.countryCode) ==
'Jordan'
? '300'
: '100',
? '3000'
: '1000',
),
PointsCaptain(
kolor: Colors.green,
kolor: AppColor
.bronze, // Bronze color for medium value
pricePoint:
box.read(BoxName.countryCode) ==
'Jordan'
@@ -326,10 +329,11 @@ class WalletCaptain extends StatelessWidget {
box.read(BoxName.countryCode) ==
'Jordan'
? '1040'
: '210',
: '2500',
),
PointsCaptain(
kolor: Colors.amberAccent,
kolor: AppColor
.goldenBronze, // Golden bronze color for higher value
pricePoint:
box.read(BoxName.countryCode) ==
'Jordan'
@@ -338,11 +342,12 @@ class WalletCaptain extends StatelessWidget {
countPoint:
box.read(BoxName.countryCode) ==
'Jordan'
? '2300'
: '450',
? '23000'
: '5100',
),
PointsCaptain(
kolor: AppColor.yellowColor,
kolor: AppColor
.gold, // Gold color for highest value
pricePoint:
box.read(BoxName.countryCode) ==
'Jordan'
@@ -352,14 +357,12 @@ class WalletCaptain extends StatelessWidget {
box.read(BoxName.countryCode) ==
'Jordan'
? '55000'
: '1200',
: '130000',
),
],
)),
],
),
),
),
),
),
]))),
const SizedBox(
height: 30,
),
@@ -374,10 +377,11 @@ class WalletCaptain extends StatelessWidget {
title:
'Create Wallet to receive your money',
onPressed: () async {
PaymentController paymentController =
Get.find<PaymentController>();
paymentController
.createConnectAccount();
box.read(BoxName.countryCode) == 'Egypt'
? addBankCodeEgypt(
captainWalletController)
: Get.find<PaymentController>()
.createConnectAccount();
}),
],
)
@@ -440,6 +444,49 @@ class WalletCaptain extends StatelessWidget {
}
}
Future<dynamic> addBankCodeEgypt(
CaptainWalletController captainWalletController) {
return Get.defaultDialog(
title: "Insert Account Bank".tr,
content: Form(
key: captainWalletController.formKeyAccount,
child: Column(
children: [
Text("Insert Card Bank Details to Receive Your Visa Money Weekly"
.tr),
MyTextForm(
controller: captainWalletController.cardBank,
label: "Insert card number".tr,
hint: '4123 4567 8910 1235',
type: TextInputType.number),
const SizedBox(
height: 10,
),
BankDropdown()
],
)),
confirm: MyElevatedButton(
title: 'Ok'.tr,
onPressed: () async {
if (captainWalletController.formKeyAccount.currentState!
.validate()) {
Get.back();
var res =
await CRUD().post(link: AppLink.updateAccountBank, payload: {
"bankCode": Get.find<BankController>().selectedBank.toString(),
"accountBank": captainWalletController.cardBank.text.toString(),
"id": box.read(BoxName.driverID).toString()
});
print('res: ${res}');
if (res != 'failure') {
Get.snackbar(
'updated succses'.tr, 'bank account added succesfly',
backgroundColor: AppColor.greenColor);
}
}
}));
}
class MyDropDown1 extends StatelessWidget {
@override
Widget build(BuildContext context) {

View File

@@ -1,13 +1,16 @@
import 'package:SEFER/constant/style.dart';
import 'package:SEFER/controller/home/payment/captain_wallet_controller.dart';
import 'package:SEFER/views/widgets/mycircular.dart';
import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:SEFER/controller/profile/captain_profile_controller.dart';
import 'package:SEFER/views/widgets/my_scafold.dart';
class ProfileCaptain extends StatelessWidget {
const ProfileCaptain({super.key});
import '../my_wallet/walet_captain.dart';
class ProfileCaptain extends StatelessWidget {
ProfileCaptain({super.key});
CaptainWalletController captainWalletController = CaptainWalletController();
@override
Widget build(BuildContext context) {
Get.put(CaptainProfileController());
@@ -21,43 +24,77 @@ class ProfileCaptain extends StatelessWidget {
child: Center(
child: controller.isLoading
? const MyCircularProgressIndicator()
: DriverProfileCard(
driverId:
controller.captainProfileData['driverID'] ?? '',
name: controller.captainProfileData['first_name'] +
' ' +
(controller.captainProfileData['last_name'] ?? ''),
phoneNumber:
controller.captainProfileData['phone'] ?? '',
email: controller.captainProfileData['email'] ?? '',
birthdate:
controller.captainProfileData['birthdate'] ?? '',
gender: controller.captainProfileData['gender'] ?? '',
education:
controller.captainProfileData['education'] ?? '',
carMake: controller.captainProfileData['make'] ?? '',
carModel: controller.captainProfileData['model'] ?? '',
carPlate:
controller.captainProfileData['car_plate'] ?? '',
carColor: controller.captainProfileData['color'] ?? '',
vin: controller.captainProfileData['vin'] ?? '',
registrationDate: controller
.captainProfileData['registration_date'] ??
'',
expirationDate:
controller.captainProfileData['expiration_date'] ??
'',
ratingCount:
controller.captainProfileData['ratingCount'] ?? 0,
ratingDriver:
controller.captainProfileData['ratingDriver'] !=
null
? double.tryParse(controller
.captainProfileData['ratingDriver']
.toString()) ??
0
: null,
age: controller.captainProfileData['age'] ?? 0,
: Column(
children: [
Container(
decoration: AppStyle.boxDecoration1,
child: InkWell(
onTap: () async {
addBankCodeEgypt(captainWalletController);
},
child: Padding(
padding: const EdgeInsets.all(8.0),
child: Text(
'Add bank Account'.tr,
style: AppStyle.title,
),
),
),
),
SizedBox(
height: Get.height * .8,
child: DriverProfileCard(
driverId:
controller.captainProfileData['driverID'] ??
'',
name: controller
.captainProfileData['first_name'] +
' ' +
(controller.captainProfileData['last_name'] ??
''),
phoneNumber:
controller.captainProfileData['phone'] ?? '',
email:
controller.captainProfileData['email'] ?? '',
birthdate:
controller.captainProfileData['birthdate'] ??
'',
gender:
controller.captainProfileData['gender'] ?? '',
education:
controller.captainProfileData['education'] ??
'',
carMake:
controller.captainProfileData['make'] ?? '',
carModel:
controller.captainProfileData['model'] ?? '',
carPlate:
controller.captainProfileData['car_plate'] ??
'',
carColor:
controller.captainProfileData['color'] ?? '',
vin: controller.captainProfileData['vin'] ?? '',
registrationDate: controller.captainProfileData[
'registration_date'] ??
'',
expirationDate: controller
.captainProfileData['expiration_date'] ??
'',
ratingCount: controller
.captainProfileData['ratingCount'] ??
0,
ratingDriver: controller
.captainProfileData['ratingDriver'] !=
null
? double.tryParse(controller
.captainProfileData['ratingDriver']
.toString()) ??
0
: null,
age: controller.captainProfileData['age'] ?? 0,
),
),
],
),
),
),
@@ -65,63 +102,6 @@ class ProfileCaptain extends StatelessWidget {
)
],
isleading: true,
// action: GetBuilder<CaptainProfileController>(
// builder: (controller) => IconButton(
// onPressed: () {
// Get.defaultDialog(
// title: 'Edit Your data'.tr,
// titleStyle: AppStyle.title,
// content: SizedBox(
// height: Get.height * .4,
// child: SingleChildScrollView(
// child: Column(
// children: [
// MyTextForm(
// controller: controller.vin,
// hint: 'write vin for your car'.tr,
// label: 'VIN'.tr,
// type: TextInputType.emailAddress,
// ),
// MyTextForm(
// controller: controller.color,
// hint: 'write Color for your car'.tr,
// label: 'Color'.tr,
// type: TextInputType.emailAddress,
// ),
// MyTextForm(
// controller: controller.make,
// hint: 'write Make for your car'.tr,
// label: 'Make'.tr,
// type: TextInputType.emailAddress,
// ),
// MyTextForm(
// controller: controller.model,
// hint: 'write Model for your car'.tr,
// label: 'Model'.tr,
// type: TextInputType.emailAddress,
// ),
// MyTextForm(
// controller: controller.year,
// hint: 'write Year for your car'.tr,
// label: 'Year'.tr,
// type: TextInputType.number,
// ),
// MyTextForm(
// controller: controller.expirationDate,
// hint: 'write Expiration Date for your car'.tr,
// label: 'Expiration Date'.tr,
// type: TextInputType.datetime),
// MyElevatedButton(
// title: 'Update'.tr,
// onPressed: () => controller.updateFields())
// ],
// ),
// ),
// ));
// },
// icon: const Icon(Icons.edit),
// ),
// )
);
}
}
@@ -167,175 +147,178 @@ class DriverProfileCard extends StatelessWidget {
@override
Widget build(BuildContext context) {
return Card(
elevation: 8,
return Container(
// elevation: 8,
decoration: AppStyle.boxDecoration1,
margin: const EdgeInsets.all(16),
child: Padding(
padding: const EdgeInsets.all(16),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
style: AppStyle.title,
name,
),
const SizedBox(height: 8),
Row(
children: [
const Icon(Icons.phone),
const SizedBox(width: 8),
Text(style: AppStyle.title, phoneNumber),
],
),
const SizedBox(height: 8),
Row(
children: [
const Icon(Icons.calendar_today),
const SizedBox(width: 8),
Text(
style: AppStyle.title,
'${'birthdate'.tr} : $birthdate',
),
],
),
const SizedBox(height: 8),
Row(
children: [
const Icon(Icons.wc),
const SizedBox(width: 8),
Text(
style: AppStyle.title,
'${'gender'.tr} : $gender',
),
],
),
const SizedBox(height: 8),
Row(
children: [
const Icon(Icons.school),
const SizedBox(width: 8),
Text(
style: AppStyle.title,
'${'education'.tr} : $education',
),
],
),
const SizedBox(height: 8),
Row(
children: [
const Icon(Icons.car_repair),
const SizedBox(width: 8),
Text(
style: AppStyle.title,
'${'Make'.tr} : $carMake',
),
],
),
const SizedBox(height: 8),
Row(
children: [
const Icon(Icons.model_training),
const SizedBox(width: 8),
Text(
style: AppStyle.title,
'${'car_model'.tr} : $carModel',
),
],
),
const SizedBox(height: 8),
Row(
children: [
const Icon(Icons.drive_eta),
const SizedBox(width: 8),
Text(
style: AppStyle.title,
'${'car_plate'.tr} : $carPlate',
),
],
),
const SizedBox(height: 8),
Row(
children: [
const Icon(Icons.color_lens),
const SizedBox(width: 8),
Text(
style: AppStyle.title,
'${'car_color'.tr} : $carColor',
),
],
),
const SizedBox(height: 8),
Row(
children: [
const Icon(Icons.confirmation_number),
const SizedBox(width: 8),
Text(
style: AppStyle.title,
'${'vin'.tr} : $vin',
),
],
),
const SizedBox(height: 8),
Row(
children: [
const Icon(Icons.calendar_today),
const SizedBox(width: 8),
Text(
style: AppStyle.title,
'${'registration_date'.tr} : $registrationDate',
),
],
),
const SizedBox(height: 8),
Row(
children: [
const Icon(Icons.calendar_today),
const SizedBox(width: 8),
Text(
style: AppStyle.title,
'${'expiration_date'.tr} : $expirationDate',
),
],
),
const SizedBox(height: 8),
Row(
children: [
const Icon(Icons.star),
const SizedBox(width: 8),
Text(
style: AppStyle.title,
'${'rating_count'.tr} : $ratingCount',
),
],
),
const SizedBox(height: 8),
Row(
children: [
const Icon(Icons.star_rate),
const SizedBox(width: 8),
ratingDriver != null
? Text(
style: AppStyle.title,
'${'rating_driver'.tr} : $ratingDriver',
)
: Text(
style: AppStyle.title,
'${'rating_driver'.tr} : 0',
),
],
),
const SizedBox(height: 8),
Row(
children: [
const Icon(Icons.person),
const SizedBox(width: 8),
Text(
style: AppStyle.title,
'${'age'.tr} : $age',
),
],
),
],
child: SingleChildScrollView(
child: Padding(
padding: const EdgeInsets.all(16),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
style: AppStyle.title,
name,
),
const SizedBox(height: 8),
Row(
children: [
const Icon(Icons.phone),
const SizedBox(width: 8),
Text(style: AppStyle.title, phoneNumber),
],
),
const SizedBox(height: 8),
Row(
children: [
const Icon(Icons.calendar_today),
const SizedBox(width: 8),
Text(
style: AppStyle.title,
'${'birthdate'.tr} : $birthdate',
),
],
),
const SizedBox(height: 8),
Row(
children: [
const Icon(Icons.wc),
const SizedBox(width: 8),
Text(
style: AppStyle.title,
'${'gender'.tr} : $gender',
),
],
),
const SizedBox(height: 8),
Row(
children: [
const Icon(Icons.school),
const SizedBox(width: 8),
Text(
style: AppStyle.title,
'${'education'.tr} : $education',
),
],
),
const SizedBox(height: 8),
Row(
children: [
const Icon(Icons.car_repair),
const SizedBox(width: 8),
Text(
style: AppStyle.title,
'${'Make'.tr} : $carMake',
),
],
),
const SizedBox(height: 8),
Row(
children: [
const Icon(Icons.model_training),
const SizedBox(width: 8),
Text(
style: AppStyle.title,
'${'car_model'.tr} : $carModel',
),
],
),
const SizedBox(height: 8),
Row(
children: [
const Icon(Icons.drive_eta),
const SizedBox(width: 8),
Text(
style: AppStyle.title,
'${'car_plate'.tr} : $carPlate',
),
],
),
const SizedBox(height: 8),
Row(
children: [
const Icon(Icons.color_lens),
const SizedBox(width: 8),
Text(
style: AppStyle.title,
'${'car_color'.tr} : $carColor',
),
],
),
const SizedBox(height: 8),
Row(
children: [
const Icon(Icons.confirmation_number),
const SizedBox(width: 8),
Text(
style: AppStyle.title,
'${'vin'.tr} : $vin',
),
],
),
const SizedBox(height: 8),
Row(
children: [
const Icon(Icons.calendar_today),
const SizedBox(width: 8),
Text(
style: AppStyle.title,
'${'registration_date'.tr} : $registrationDate',
),
],
),
const SizedBox(height: 8),
Row(
children: [
const Icon(Icons.calendar_today),
const SizedBox(width: 8),
Text(
style: AppStyle.title,
'${'expiration_date'.tr} : $expirationDate',
),
],
),
const SizedBox(height: 8),
Row(
children: [
const Icon(Icons.star),
const SizedBox(width: 8),
Text(
style: AppStyle.title,
'${'rating_count'.tr} : $ratingCount',
),
],
),
const SizedBox(height: 8),
Row(
children: [
const Icon(Icons.star_rate),
const SizedBox(width: 8),
ratingDriver != null
? Text(
style: AppStyle.title,
'${'rating_driver'.tr} : $ratingDriver',
)
: Text(
style: AppStyle.title,
'${'rating_driver'.tr} : 0',
),
],
),
const SizedBox(height: 8),
Row(
children: [
const Icon(Icons.person),
const SizedBox(width: 8),
Text(
style: AppStyle.title,
'${'age'.tr} : $age',
),
],
),
],
),
),
),
);

View File

@@ -7,7 +7,7 @@ import 'package:get_storage/get_storage.dart';
import '../../constant/colors.dart';
class MyTextForm extends StatelessWidget {
const MyTextForm({
MyTextForm({
super.key,
required this.controller,
required this.label,
@@ -47,6 +47,11 @@ class MyTextForm extends StatelessWidget {
if (value!.isEmpty) {
return '${'Please enter'.tr} $label.'.tr;
}
if (label.contains("Insert card number".tr)) {
if (value.length != 16) {
return "Please enter a valid card 16-digit number.".tr;
}
}
if (type == TextInputType.emailAddress) {
if (!value.contains('@')) {