9/21/1
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
import 'package:SEFER/print.dart';
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:get/get.dart';
|
||||
|
||||
@@ -20,23 +21,15 @@ class CardSeferWalletDriver extends StatelessWidget {
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Row(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
GetBuilder<CaptainWalletController>(builder: (captainWalletController) {
|
||||
return InkWell(
|
||||
return Center(
|
||||
child: GetBuilder<CaptainWalletController>(
|
||||
builder: (captainWalletController) {
|
||||
return GestureDetector(
|
||||
onTap: () async {
|
||||
final now = DateTime.now();
|
||||
DateTime? lastRequestTime =
|
||||
box.read(BoxName.lastTimeCaptainWalletCashOut);
|
||||
|
||||
// if (lastRequestTime == null ||
|
||||
// now.difference(lastRequestTime).inHours >= 24) {
|
||||
// // Update the last request time to now
|
||||
// lastRequestTime = now;
|
||||
// await box.write(
|
||||
// BoxName.lastTimeCaptainWalletCashOut, lastRequestTime);
|
||||
// box.write(BoxName.cvvCode, 1111);
|
||||
if (double.parse(
|
||||
Get.find<CaptainWalletController>().totalAmountVisa) >=
|
||||
20) {
|
||||
@@ -45,40 +38,37 @@ class CardSeferWalletDriver extends StatelessWidget {
|
||||
title: 'Do you want to collect your earnings?'.tr,
|
||||
titleStyle: AppStyle.title,
|
||||
content: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
children: [
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
const Icon(Icons.account_balance_wallet,
|
||||
color: AppColor.primaryColor),
|
||||
const SizedBox(width: 10),
|
||||
Text(
|
||||
'Total wallet is '.tr,
|
||||
style: AppStyle.title,
|
||||
),
|
||||
const SizedBox(
|
||||
width: 5,
|
||||
'Total wallet: '.tr,
|
||||
style: AppStyle.title.copyWith(fontSize: 16),
|
||||
),
|
||||
Text(
|
||||
Get.find<CaptainWalletController>()
|
||||
.totalAmountVisa,
|
||||
style: AppStyle.number,
|
||||
'${Get.find<CaptainWalletController>().totalAmountVisa} \$',
|
||||
style: AppStyle.number.copyWith(fontSize: 16),
|
||||
),
|
||||
],
|
||||
),
|
||||
const SizedBox(
|
||||
height: 5,
|
||||
),
|
||||
const SizedBox(height: 20),
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
Text(
|
||||
'Wallet Type'.tr,
|
||||
style: AppStyle.title,
|
||||
),
|
||||
const SizedBox(
|
||||
width: 5,
|
||||
'Wallet Type: '.tr,
|
||||
style: AppStyle.title.copyWith(fontSize: 16),
|
||||
),
|
||||
const SizedBox(width: 10),
|
||||
MyDropDown1(),
|
||||
],
|
||||
),
|
||||
const SizedBox(height: 20),
|
||||
Form(
|
||||
key: captainWalletController.formKey,
|
||||
child: MyTextForm(
|
||||
@@ -87,7 +77,7 @@ class CardSeferWalletDriver extends StatelessWidget {
|
||||
hint: "Enter your wallet number".tr,
|
||||
type: TextInputType.phone,
|
||||
),
|
||||
)
|
||||
),
|
||||
],
|
||||
),
|
||||
confirm: MyElevatedButton(
|
||||
@@ -104,9 +94,6 @@ class CardSeferWalletDriver extends StatelessWidget {
|
||||
.totalAmountVisa) -
|
||||
5)
|
||||
.toStringAsFixed(0);
|
||||
// .dropdownValue
|
||||
// .toString());
|
||||
// .toString());
|
||||
await Get.put(PaymobPayout()).payToWalletDriverAll(
|
||||
amountAfter5LE,
|
||||
Get.find<PaymobPayout>().dropdownValue.toString(),
|
||||
@@ -124,88 +111,108 @@ class CardSeferWalletDriver extends StatelessWidget {
|
||||
kolor: AppColor.greenColor,
|
||||
),
|
||||
cancel: MyElevatedButton(
|
||||
title: 'cancel'.tr,
|
||||
title: 'Cancel'.tr,
|
||||
onPressed: () {
|
||||
Get.back();
|
||||
},
|
||||
kolor: AppColor.redColor,
|
||||
));
|
||||
} else {
|
||||
{
|
||||
Get.snackbar(
|
||||
'${'The Amount is less than'.tr}${box.read(BoxName.countryCode) == 'Egypt' ? '20' : '20'}',
|
||||
'',
|
||||
backgroundColor: AppColor.yellowColor);
|
||||
}
|
||||
// Replacing Get.snackbar with CupertinoAlertDialog
|
||||
showCupertinoDialog(
|
||||
context: context,
|
||||
builder: (BuildContext context) {
|
||||
return CupertinoAlertDialog(
|
||||
title: Text("Alert".tr),
|
||||
content: Text(
|
||||
'${'The Amount is less than'.tr}${box.read(BoxName.countryCode) == 'Egypt' ? '20' : '20'}',
|
||||
),
|
||||
actions: <Widget>[
|
||||
CupertinoDialogAction(
|
||||
isDefaultAction: true,
|
||||
child: Text("OK".tr),
|
||||
onPressed: () {
|
||||
Navigator.of(context).pop(); // Close the dialog
|
||||
},
|
||||
),
|
||||
],
|
||||
);
|
||||
},
|
||||
);
|
||||
}
|
||||
// } else {
|
||||
// // Optionally show a message or handle the throttling case
|
||||
// final hoursLeft = 24 - now.difference(lastRequestTime).inHours;
|
||||
// Get.snackbar(
|
||||
// '${'Please wait'.tr} $hoursLeft ${"hours before trying again.".tr}',
|
||||
// '');
|
||||
// }
|
||||
},
|
||||
child: Container(
|
||||
width: Get.width * .85,
|
||||
height: Get.height * .2,
|
||||
height: Get.height * .22,
|
||||
decoration: BoxDecoration(
|
||||
color: AppColor.deepPurpleAccent,
|
||||
borderRadius: const BorderRadius.all(Radius.circular(12)),
|
||||
gradient: const LinearGradient(colors: [
|
||||
AppColor.greyColor,
|
||||
AppColor.greyColor,
|
||||
AppColor.secondaryColor,
|
||||
AppColor.writeColor
|
||||
]),
|
||||
borderRadius: BorderRadius.circular(15),
|
||||
gradient: LinearGradient(
|
||||
colors: [
|
||||
AppColor.secondaryColor.withOpacity(0.85),
|
||||
AppColor.primaryColor.withOpacity(0.85),
|
||||
],
|
||||
begin: Alignment.topLeft,
|
||||
end: Alignment.bottomRight,
|
||||
),
|
||||
boxShadow: [
|
||||
BoxShadow(
|
||||
color: Colors.black.withOpacity(0.15),
|
||||
blurRadius: 10,
|
||||
offset: const Offset(0, 5),
|
||||
),
|
||||
],
|
||||
),
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
|
||||
children: [
|
||||
Row(
|
||||
children: [
|
||||
Padding(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 10),
|
||||
child: Text(
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.all(16.0),
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
Text(
|
||||
'${AppInformation.appName} Wallet',
|
||||
style: AppStyle.headTitle
|
||||
.copyWith(color: AppColor.writeColor),
|
||||
),
|
||||
)
|
||||
],
|
||||
),
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
Text(
|
||||
'${Get.find<CaptainWalletController>().totalAmountVisa}\$' ??
|
||||
'0.0 \$',
|
||||
style: AppStyle.headTitle2,
|
||||
)
|
||||
],
|
||||
),
|
||||
Padding(
|
||||
padding: const EdgeInsets.all(8.0),
|
||||
child: Row(
|
||||
const Icon(Icons.account_balance_wallet,
|
||||
color: AppColor.writeColor, size: 24),
|
||||
],
|
||||
),
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
Text(
|
||||
'${Get.find<CaptainWalletController>().totalAmountVisa}\$' ??
|
||||
'0.0 \$',
|
||||
style: AppStyle.headTitle2.copyWith(
|
||||
color: AppColor.writeColor, fontSize: 28),
|
||||
),
|
||||
],
|
||||
),
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
Text(
|
||||
box.read(BoxName.nameDriver),
|
||||
style: AppStyle.title,
|
||||
style: AppStyle.title.copyWith(
|
||||
color: AppColor.writeColor.withOpacity(0.9)),
|
||||
),
|
||||
Text(
|
||||
"Cash Out".tr,
|
||||
style: AppStyle.title,
|
||||
)
|
||||
style: AppStyle.title.copyWith(
|
||||
color: AppColor.writeColor.withOpacity(0.9)),
|
||||
),
|
||||
],
|
||||
),
|
||||
)
|
||||
],
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}),
|
||||
],
|
||||
},
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,6 +3,7 @@ import 'package:SEFER/views/widgets/elevated_btn.dart';
|
||||
import 'package:SEFER/views/widgets/my_scafold.dart';
|
||||
import 'package:SEFER/views/widgets/my_textField.dart';
|
||||
import 'package:SEFER/views/widgets/mycircular.dart';
|
||||
import 'package:SEFER/views/widgets/mydialoug.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:get/get.dart';
|
||||
|
||||
@@ -105,11 +106,28 @@ class TransferBudgetPage extends StatelessWidget {
|
||||
? MyElevatedButton(
|
||||
title: 'Transfer'.tr,
|
||||
onPressed: () async {
|
||||
await captainWalletController
|
||||
.addTransferDriversWallet(
|
||||
'TransferFrom',
|
||||
'TransferTo',
|
||||
);
|
||||
if (double.parse(
|
||||
captainWalletController
|
||||
.amountFromBudgetController
|
||||
.text) <
|
||||
double.parse(
|
||||
captainWalletController
|
||||
.totalAmountVisa) -
|
||||
5) {
|
||||
await captainWalletController
|
||||
.addTransferDriversWallet(
|
||||
'TransferFrom',
|
||||
'TransferTo',
|
||||
);
|
||||
} else {
|
||||
MyDialog().getDialog(
|
||||
"You dont have money in your Wallet"
|
||||
.tr,
|
||||
"You dont have money in your Wallet or you should less transfer 5 LE to activate"
|
||||
.tr, () {
|
||||
Get.back();
|
||||
});
|
||||
}
|
||||
})
|
||||
: const SizedBox()
|
||||
],
|
||||
|
||||
@@ -5,6 +5,7 @@ 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:SEFER/views/widgets/mydialoug.dart';
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:SEFER/constant/box_name.dart';
|
||||
@@ -48,7 +49,6 @@ class WalletCaptain extends StatelessWidget {
|
||||
children: [
|
||||
const SizedBox(),
|
||||
Container(
|
||||
// decoration: AppStyle.boxDecoration1.copyWith(
|
||||
color: double.parse(captainWalletController
|
||||
.totalPoints
|
||||
.toString()) <
|
||||
@@ -63,16 +63,27 @@ class WalletCaptain extends StatelessWidget {
|
||||
-3000
|
||||
? AppColor.redColor
|
||||
: AppColor.greenColor,
|
||||
// ),
|
||||
child: InkWell(
|
||||
onTap: () {
|
||||
Get.snackbar(
|
||||
'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,
|
||||
duration: const Duration(seconds: 4),
|
||||
showCupertinoDialog(
|
||||
context: context,
|
||||
builder: (BuildContext context) {
|
||||
return CupertinoAlertDialog(
|
||||
title: Text('Info'.tr),
|
||||
content: Text(
|
||||
'The 3000 points equal 3000 L.E for you \nSo go and gain your money'
|
||||
.tr,
|
||||
),
|
||||
actions: <Widget>[
|
||||
CupertinoDialogAction(
|
||||
child: Text("OK".tr),
|
||||
onPressed: () {
|
||||
Navigator.of(context).pop();
|
||||
},
|
||||
),
|
||||
],
|
||||
);
|
||||
},
|
||||
);
|
||||
},
|
||||
child: Padding(
|
||||
@@ -86,437 +97,127 @@ class WalletCaptain extends StatelessWidget {
|
||||
),
|
||||
),
|
||||
),
|
||||
const SizedBox(
|
||||
height: 10,
|
||||
),
|
||||
double.parse(captainWalletController.totalPoints
|
||||
.toString()) <
|
||||
-3000
|
||||
? MyElevatedButton(
|
||||
title: 'Charge your Account'.tr,
|
||||
onPressed: () {})
|
||||
: const SizedBox(),
|
||||
const SizedBox(
|
||||
height: 10,
|
||||
),
|
||||
const SizedBox(height: 10),
|
||||
if (double.parse(captainWalletController.totalPoints
|
||||
.toString()) <
|
||||
-3000)
|
||||
CupertinoButton.filled(
|
||||
child: Text('Charge your Account'.tr),
|
||||
onPressed: () {
|
||||
// Add your charge account logic here
|
||||
},
|
||||
),
|
||||
const SizedBox(height: 10),
|
||||
const CardSeferWalletDriver(),
|
||||
Card(
|
||||
elevation: 4,
|
||||
elevation: 8,
|
||||
shape: RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.circular(16),
|
||||
),
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 4),
|
||||
padding: const EdgeInsets.all(16),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Row(
|
||||
mainAxisAlignment:
|
||||
MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
Text(
|
||||
'Total Budget from trips is '.tr,
|
||||
style: AppStyle.title,
|
||||
),
|
||||
Container(
|
||||
decoration: BoxDecoration(
|
||||
border: Border.all(
|
||||
width: 2,
|
||||
color: AppColor.writeColor)),
|
||||
child: GestureDetector(
|
||||
onTap: () {
|
||||
Log.print(
|
||||
'captainWalletController.totalAmount: ${captainWalletController.totalAmount}');
|
||||
Get.snackbar(
|
||||
icon: InkWell(
|
||||
onTap: () async {
|
||||
await Get.put(
|
||||
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.yellowColor,
|
||||
snackPosition: SnackPosition.BOTTOM,
|
||||
);
|
||||
},
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.all(2),
|
||||
child: Text(
|
||||
'${captainWalletController.totalAmount}\$'),
|
||||
),
|
||||
),
|
||||
)
|
||||
],
|
||||
),
|
||||
const SizedBox(
|
||||
height: 10,
|
||||
),
|
||||
Row(
|
||||
mainAxisAlignment:
|
||||
MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
Text(
|
||||
'Total Budget from trips by\nCredit card is '
|
||||
_buildBudgetRow(
|
||||
title: 'Total Budget from trips is '.tr,
|
||||
amount: captainWalletController.totalAmount,
|
||||
onTap: () {
|
||||
Get.snackbar(
|
||||
icon: InkWell(
|
||||
onTap: () async {
|
||||
await Get.put(
|
||||
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,
|
||||
style: AppStyle.title,
|
||||
),
|
||||
Container(
|
||||
decoration: BoxDecoration(
|
||||
border: Border.all(
|
||||
width: 2,
|
||||
color: AppColor.writeColor)),
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.all(2),
|
||||
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 +
|
||||
' ${AppInformation.appName} Wallet'
|
||||
.tr,
|
||||
duration:
|
||||
const Duration(seconds: 6),
|
||||
backgroundColor:
|
||||
AppColor.redColor,
|
||||
snackPosition:
|
||||
SnackPosition.BOTTOM,
|
||||
);
|
||||
},
|
||||
child: Text(
|
||||
'${captainWalletController.totalAmountVisa}\$'),
|
||||
),
|
||||
))
|
||||
],
|
||||
),
|
||||
const SizedBox(
|
||||
height: 10,
|
||||
),
|
||||
MyElevatedButton(
|
||||
title:
|
||||
'You can buy points from your budget'.tr,
|
||||
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.totalAmountVisa}',
|
||||
hint:
|
||||
'${'You have in account'.tr} ${captainWalletController.totalAmountVisa}',
|
||||
type: TextInputType.number,
|
||||
),
|
||||
),
|
||||
confirm: MyElevatedButton(
|
||||
title: 'Pay'.tr,
|
||||
onPressed: () async {
|
||||
if (double.parse(
|
||||
captainWalletController
|
||||
.amountFromBudgetController
|
||||
.text) <
|
||||
double.parse(
|
||||
captainWalletController
|
||||
.totalAmountVisa)) {
|
||||
await captainWalletController
|
||||
.payFromBudget();
|
||||
} else {
|
||||
Get.back();
|
||||
Get.snackbar(
|
||||
'Your Budget less than needed'
|
||||
.tr,
|
||||
'',
|
||||
duration: const Duration(
|
||||
seconds: 3),
|
||||
backgroundColor:
|
||||
AppColor.redColor,
|
||||
snackPosition:
|
||||
SnackPosition.BOTTOM,
|
||||
);
|
||||
}
|
||||
}),
|
||||
cancel: MyElevatedButton(
|
||||
title: 'Cancel'.tr,
|
||||
onPressed: () {
|
||||
Get.back();
|
||||
}));
|
||||
duration: const Duration(seconds: 6),
|
||||
backgroundColor: AppColor.yellowColor,
|
||||
snackPosition: SnackPosition.BOTTOM,
|
||||
);
|
||||
},
|
||||
),
|
||||
MyElevatedButton(
|
||||
title: 'Transfer budget'.tr,
|
||||
onPressed: () {
|
||||
if (double.parse(captainWalletController
|
||||
.totalAmountVisa) >
|
||||
15) {
|
||||
Get.to(
|
||||
() => const TransferBudgetPage());
|
||||
} else {
|
||||
Get.snackbar(
|
||||
"You don't have enough money in your SEFER wallet"
|
||||
.tr,
|
||||
'');
|
||||
}
|
||||
})
|
||||
const SizedBox(height: 16),
|
||||
_buildBudgetRow(
|
||||
title:
|
||||
'Total Budget from trips by\nCredit card is '
|
||||
.tr,
|
||||
amount:
|
||||
captainWalletController.totalAmountVisa,
|
||||
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 +
|
||||
' ${AppInformation.appName} Wallet'
|
||||
.tr,
|
||||
duration: const Duration(seconds: 6),
|
||||
backgroundColor: AppColor.redColor,
|
||||
snackPosition: SnackPosition.BOTTOM,
|
||||
);
|
||||
},
|
||||
),
|
||||
const SizedBox(height: 16),
|
||||
_buildBuyPointsButton(captainWalletController),
|
||||
const SizedBox(height: 16),
|
||||
_buildTransferBudgetButton(
|
||||
captainWalletController),
|
||||
const SizedBox(height: 16),
|
||||
_buildPurchaseInstructions(),
|
||||
const SizedBox(height: 8),
|
||||
_buildPointsOptions(),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
const SizedBox(
|
||||
height: 10,
|
||||
),
|
||||
Padding(
|
||||
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.greyColor,
|
||||
pricePoint:
|
||||
box.read(BoxName.countryCode) ==
|
||||
'Jordan'
|
||||
? 5
|
||||
: 80,
|
||||
countPoint:
|
||||
box.read(BoxName.countryCode) ==
|
||||
'Jordan'
|
||||
? '3000'
|
||||
: '1000',
|
||||
),
|
||||
PointsCaptain(
|
||||
kolor: AppColor
|
||||
.bronze, // Bronze color for medium value
|
||||
pricePoint:
|
||||
box.read(BoxName.countryCode) ==
|
||||
'Jordan'
|
||||
? 10
|
||||
: 200,
|
||||
countPoint:
|
||||
box.read(BoxName.countryCode) ==
|
||||
'Jordan'
|
||||
? '1040'
|
||||
: '2500',
|
||||
),
|
||||
PointsCaptain(
|
||||
kolor: AppColor
|
||||
.goldenBronze, // Golden bronze color for higher value
|
||||
pricePoint:
|
||||
box.read(BoxName.countryCode) ==
|
||||
'Jordan'
|
||||
? 22
|
||||
: 400,
|
||||
countPoint:
|
||||
box.read(BoxName.countryCode) ==
|
||||
'Jordan'
|
||||
? '23000'
|
||||
: '5100',
|
||||
),
|
||||
PointsCaptain(
|
||||
kolor: AppColor
|
||||
.gold, // Gold color for highest value
|
||||
pricePoint:
|
||||
box.read(BoxName.countryCode) ==
|
||||
'Jordan'
|
||||
? 50
|
||||
: 1000,
|
||||
countPoint:
|
||||
box.read(BoxName.countryCode) ==
|
||||
'Jordan'
|
||||
? '55000'
|
||||
: '130000',
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
]))),
|
||||
const SizedBox(
|
||||
height: 30,
|
||||
),
|
||||
box
|
||||
.read(BoxName.accountIdStripeConnect)
|
||||
.toString()
|
||||
.isEmpty
|
||||
? Row(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
MyElevatedButton(
|
||||
title:
|
||||
'Create Wallet to receive your money',
|
||||
onPressed: () async {
|
||||
box.read(BoxName.countryCode) == 'Egypt'
|
||||
? addBankCodeEgypt(
|
||||
captainWalletController)
|
||||
: Get.find<PaymentController>()
|
||||
.createConnectAccount();
|
||||
}),
|
||||
],
|
||||
)
|
||||
: const SizedBox(
|
||||
height: 30,
|
||||
),
|
||||
|
||||
GetBuilder<CaptainWalletController>(
|
||||
builder: (captainWalletController) {
|
||||
return InkWell(
|
||||
onTap: () {
|
||||
MyDialog().getDialog(
|
||||
'Morning Promo'.tr,
|
||||
"this is count of your all trips in the morning promo today from 7:00am-10:00am"
|
||||
.tr, () {
|
||||
Get.back();
|
||||
});
|
||||
},
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.all(8.0),
|
||||
child: Row(
|
||||
children: [
|
||||
SizedBox(
|
||||
width: Get.width * .9,
|
||||
// height: Get.height * .1,
|
||||
// decoration: AppStyle.boxDecoration,
|
||||
child: Stack(
|
||||
children: [
|
||||
LinearProgressIndicator(
|
||||
minHeight: 35,
|
||||
color: AppColor.blueColor,
|
||||
borderRadius:
|
||||
BorderRadius.circular(12),
|
||||
backgroundColor: AppColor.accentColor
|
||||
.withOpacity(.5),
|
||||
value: double.parse(
|
||||
captainWalletController
|
||||
.walletDate['message'][0]
|
||||
['morning_count']
|
||||
.toString()) /
|
||||
5,
|
||||
),
|
||||
Row(
|
||||
mainAxisAlignment:
|
||||
MainAxisAlignment.center,
|
||||
children: <Widget>[
|
||||
Text(
|
||||
'Morning Promo Rides'.tr,
|
||||
style: AppStyle.title,
|
||||
),
|
||||
const SizedBox(
|
||||
width: 20,
|
||||
),
|
||||
Text(
|
||||
'${captainWalletController.walletDate['message'][0]['morning_count']} / 5',
|
||||
style: AppStyle.title,
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
)
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
}),
|
||||
GetBuilder<CaptainWalletController>(
|
||||
builder: (captainWalletController) {
|
||||
return InkWell(
|
||||
onTap: () {
|
||||
MyDialog().getDialog(
|
||||
'Afternoon Promo'.tr,
|
||||
"this is count of your all trips in the Afternoon promo today from 3:00pm-6:00 pm"
|
||||
.tr, () {
|
||||
Get.back();
|
||||
});
|
||||
},
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.all(8.0),
|
||||
child: Row(
|
||||
children: [
|
||||
SizedBox(
|
||||
width: Get.width * .9,
|
||||
// height: Get.height * .1,
|
||||
// decoration: AppStyle.boxDecoration,
|
||||
child: Stack(
|
||||
children: [
|
||||
LinearProgressIndicator(
|
||||
minHeight: 35,
|
||||
color: AppColor.blueColor,
|
||||
borderRadius:
|
||||
BorderRadius.circular(12),
|
||||
backgroundColor: AppColor.accentColor
|
||||
.withOpacity(.5),
|
||||
value: double.parse(
|
||||
captainWalletController
|
||||
.walletDate['message'][0]
|
||||
['afternoon_count']
|
||||
.toString()) /
|
||||
5,
|
||||
),
|
||||
Row(
|
||||
mainAxisAlignment:
|
||||
MainAxisAlignment.center,
|
||||
children: <Widget>[
|
||||
Text(
|
||||
'Afternoon Promo Rides'.tr,
|
||||
style: AppStyle.title,
|
||||
),
|
||||
const SizedBox(
|
||||
width: 20,
|
||||
),
|
||||
Text(
|
||||
'${captainWalletController.walletDate['message'][0]['afternoon_count']} / 5',
|
||||
style: AppStyle.title,
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
)
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
}),
|
||||
|
||||
builder: (captainWalletController) {
|
||||
return Column(
|
||||
children: [
|
||||
_buildPromoCard(
|
||||
title: 'Morning Promo'.tr,
|
||||
count: captainWalletController
|
||||
.walletDate['message'][0]
|
||||
['morning_count'],
|
||||
maxCount: 5,
|
||||
description:
|
||||
"this is count of your all trips in the morning promo today from 7:00am-10:00am"
|
||||
.tr,
|
||||
),
|
||||
const SizedBox(
|
||||
height: 16), // Add space between the cards
|
||||
_buildPromoCard(
|
||||
title: 'Afternoon Promo'.tr,
|
||||
count: captainWalletController
|
||||
.walletDate['message'][0]
|
||||
['afternoon_count'],
|
||||
maxCount: 5,
|
||||
description:
|
||||
"this is count of your all trips in the Afternoon promo today from 3:00pm-6:00 pm"
|
||||
.tr,
|
||||
),
|
||||
],
|
||||
);
|
||||
},
|
||||
),
|
||||
Padding(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 10),
|
||||
child: Row(
|
||||
@@ -570,6 +271,205 @@ class WalletCaptain extends StatelessWidget {
|
||||
child: const Icon(Icons.refresh)),
|
||||
);
|
||||
}
|
||||
|
||||
// Helper methods for better structure
|
||||
Widget _buildBudgetRow(
|
||||
{required String title,
|
||||
required String amount,
|
||||
required VoidCallback onTap}) {
|
||||
return Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
Expanded(
|
||||
child: Text(
|
||||
title,
|
||||
style: AppStyle.title,
|
||||
),
|
||||
),
|
||||
Container(
|
||||
decoration: BoxDecoration(
|
||||
border: Border.all(width: 2, color: AppColor.writeColor),
|
||||
borderRadius: BorderRadius.circular(12),
|
||||
),
|
||||
child: GestureDetector(
|
||||
onTap: onTap,
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.all(8),
|
||||
child: Text(
|
||||
'$amount\$',
|
||||
style:
|
||||
const TextStyle(fontSize: 18, fontWeight: FontWeight.bold),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
);
|
||||
}
|
||||
|
||||
Widget _buildPromoCard(
|
||||
{required String title,
|
||||
required int count,
|
||||
required int maxCount,
|
||||
required String description}) {
|
||||
return InkWell(
|
||||
onTap: () {
|
||||
MyDialog().getDialog(title, description, () {
|
||||
Get.back();
|
||||
});
|
||||
},
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.all(8.0),
|
||||
child: Row(
|
||||
children: [
|
||||
SizedBox(
|
||||
width: Get.width * .9,
|
||||
child: Stack(
|
||||
children: [
|
||||
LinearProgressIndicator(
|
||||
minHeight: 35,
|
||||
color: AppColor.blueColor,
|
||||
borderRadius: BorderRadius.circular(12),
|
||||
backgroundColor: AppColor.accentColor.withOpacity(.5),
|
||||
value: count / maxCount,
|
||||
),
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: <Widget>[
|
||||
Text(
|
||||
title,
|
||||
style: AppStyle.title,
|
||||
),
|
||||
const SizedBox(width: 20),
|
||||
Text(
|
||||
'$count / $maxCount',
|
||||
style: AppStyle.title,
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Widget _buildBuyPointsButton(CaptainWalletController controller) {
|
||||
return MyElevatedButton(
|
||||
title: 'You can buy points from your budget'.tr,
|
||||
onPressed: () {
|
||||
Get.defaultDialog(
|
||||
title: 'Pay from my budget'.tr,
|
||||
content: Form(
|
||||
key: controller.formKey,
|
||||
child: MyTextForm(
|
||||
controller: controller.amountFromBudgetController,
|
||||
label:
|
||||
'${'You have in account'.tr} ${controller.totalAmountVisa}',
|
||||
hint: '${'You have in account'.tr} ${controller.totalAmountVisa}',
|
||||
type: TextInputType.number,
|
||||
),
|
||||
),
|
||||
confirm: MyElevatedButton(
|
||||
title: 'Pay'.tr,
|
||||
onPressed: () async {
|
||||
if (double.parse(controller.amountFromBudgetController.text) <
|
||||
double.parse(controller.totalAmountVisa)) {
|
||||
await controller.payFromBudget();
|
||||
} else {
|
||||
Get.back();
|
||||
Get.snackbar('Your Budget less than needed'.tr, '',
|
||||
duration: const Duration(seconds: 3),
|
||||
backgroundColor: AppColor.redColor,
|
||||
snackPosition: SnackPosition.BOTTOM);
|
||||
}
|
||||
},
|
||||
),
|
||||
cancel: MyElevatedButton(
|
||||
title: 'Cancel'.tr,
|
||||
onPressed: () {
|
||||
Get.back();
|
||||
},
|
||||
),
|
||||
);
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
Widget _buildTransferBudgetButton(CaptainWalletController controller) {
|
||||
return MyElevatedButton(
|
||||
title: 'Transfer budget'.tr,
|
||||
onPressed: () {
|
||||
if (double.parse(controller.totalAmountVisa) > 15) {
|
||||
Get.to(() => const TransferBudgetPage());
|
||||
} else {
|
||||
Get.snackbar(
|
||||
"You don't have enough money in your SEFER wallet".tr, '');
|
||||
}
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
Widget _buildPurchaseInstructions() {
|
||||
return Padding(
|
||||
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),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Widget _buildPointsOptions() {
|
||||
return Container(
|
||||
height: Get.height * 0.19,
|
||||
child: ListView(
|
||||
scrollDirection: Axis.horizontal,
|
||||
children: [
|
||||
PointsCaptain(
|
||||
kolor: AppColor.greyColor,
|
||||
pricePoint: box.read(BoxName.countryCode) == 'Jordan' ? 5 : 80,
|
||||
countPoint:
|
||||
box.read(BoxName.countryCode) == 'Jordan' ? '3000' : '1000',
|
||||
),
|
||||
PointsCaptain(
|
||||
kolor: AppColor.bronze,
|
||||
pricePoint: box.read(BoxName.countryCode) == 'Jordan' ? 10 : 200,
|
||||
countPoint:
|
||||
box.read(BoxName.countryCode) == 'Jordan' ? '1040' : '2500',
|
||||
),
|
||||
PointsCaptain(
|
||||
kolor: AppColor.goldenBronze,
|
||||
pricePoint: box.read(BoxName.countryCode) == 'Jordan' ? 22 : 400,
|
||||
countPoint:
|
||||
box.read(BoxName.countryCode) == 'Jordan' ? '23000' : '5100',
|
||||
),
|
||||
PointsCaptain(
|
||||
kolor: AppColor.gold,
|
||||
pricePoint: box.read(BoxName.countryCode) == 'Jordan' ? 50 : 1000,
|
||||
countPoint:
|
||||
box.read(BoxName.countryCode) == 'Jordan' ? '55000' : '130000',
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
Future<dynamic> addBankCodeEgypt(
|
||||
|
||||
Reference in New Issue
Block a user