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)),
|
||||
),
|
||||
],
|
||||
),
|
||||
)
|
||||
],
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}),
|
||||
],
|
||||
},
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user