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

@@ -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) {