Initial commit
This commit is contained in:
@@ -1,3 +1,5 @@
|
||||
import 'package:SEFER/views/widgets/my_dialog.dart';
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
import 'package:get/get.dart';
|
||||
@@ -10,6 +12,8 @@ import '../../../controller/functions/toast.dart';
|
||||
import '../../../controller/home/payment/credit_card_controller.dart';
|
||||
import '../../../controller/payment/payment_controller.dart';
|
||||
import '../../../main.dart';
|
||||
import '../../../models/model/painter_copoun.dart';
|
||||
import '../../../print.dart';
|
||||
import '../../widgets/elevated_btn.dart';
|
||||
import '../../widgets/my_scafold.dart';
|
||||
import '../../widgets/my_textField.dart';
|
||||
@@ -29,25 +33,49 @@ class PassengerWallet extends StatelessWidget {
|
||||
GetBuilder<PaymentController>(
|
||||
builder: (controller) => Column(
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
crossAxisAlignment: CrossAxisAlignment.stretch,
|
||||
children: [
|
||||
const CardSeferWallet(),
|
||||
const SizedBox(
|
||||
height: 20,
|
||||
),
|
||||
Padding(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 30),
|
||||
child: Row(
|
||||
children: [
|
||||
MyElevatedButton(
|
||||
kolor: AppColor.blueColor,
|
||||
title: 'Payment History'.tr,
|
||||
onPressed: () {
|
||||
Get.to(() => const PaymentHistoryPassengerPage(),
|
||||
transition: Transition.size);
|
||||
},
|
||||
),
|
||||
],
|
||||
padding:
|
||||
const EdgeInsets.symmetric(horizontal: 80, vertical: 10),
|
||||
child: MyElevatedButton(
|
||||
kolor: AppColor.blueColor,
|
||||
title: 'Payment History'.tr,
|
||||
onPressed: () {
|
||||
Get.to(() => const PaymentHistoryPassengerPage(),
|
||||
transition: Transition.size);
|
||||
},
|
||||
),
|
||||
),
|
||||
Padding(
|
||||
padding:
|
||||
const EdgeInsets.symmetric(horizontal: 80, vertical: 10),
|
||||
child: MyElevatedButton(
|
||||
kolor: AppColor.yellowColor,
|
||||
title: 'Bounus gift'.tr,
|
||||
onPressed: () {
|
||||
Get.dialog(
|
||||
AlertDialog(
|
||||
contentPadding: EdgeInsets
|
||||
.zero, // Removes the padding around the content
|
||||
content: SizedBox(
|
||||
width: 300, // Match the width of PromoBanner
|
||||
// height: 250, // Match the height of PromoBanner
|
||||
child: PromoBanner(
|
||||
promoCode: box.read(BoxName.promo),
|
||||
discountPercentage: box.read(BoxName.discount),
|
||||
validity: box.read(BoxName.validity),
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
Log.print(
|
||||
'box.read(BoxName.isGiftToken).toString(): ${box.read(BoxName.isGiftToken).toString()}');
|
||||
},
|
||||
),
|
||||
)
|
||||
],
|
||||
@@ -65,6 +93,7 @@ class PassengerWallet extends StatelessWidget {
|
||||
left: Get.width * .2,
|
||||
right: Get.width * .2,
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.stretch,
|
||||
children: [
|
||||
MyElevatedButton(
|
||||
title: 'Show Promos to Charge'.tr,
|
||||
@@ -79,36 +108,58 @@ class PassengerWallet extends StatelessWidget {
|
||||
kolor: AppColor.deepPurpleAccent,
|
||||
title: "Add wallet phone you use".tr,
|
||||
onPressed: () {
|
||||
Get.defaultDialog(
|
||||
barrierDismissible: false,
|
||||
title: 'Insert Wallet phone number'.tr,
|
||||
content: Form(
|
||||
key: controller.formKey,
|
||||
child: MyTextForm(
|
||||
Get.dialog(
|
||||
CupertinoAlertDialog(
|
||||
title: Text('Insert Wallet phone number'.tr),
|
||||
content: Column(
|
||||
children: [
|
||||
const SizedBox(height: 10),
|
||||
Form(
|
||||
key: controller.formKey,
|
||||
child: CupertinoTextField(
|
||||
controller:
|
||||
controller.walletphoneController,
|
||||
label: 'Insert Wallet phone number'.tr,
|
||||
hint: 'Insert Wallet phone number'.tr,
|
||||
type: TextInputType.phone)),
|
||||
confirm: MyElevatedButton(
|
||||
kolor: AppColor.greenColor,
|
||||
title: 'OK'.tr,
|
||||
onPressed: () async {
|
||||
Get.back();
|
||||
box.write(BoxName.phoneWallet,
|
||||
controller.walletphoneController.text);
|
||||
Toast.show(
|
||||
context,
|
||||
'Phone Wallet Saved Successfully'.tr,
|
||||
AppColor.greenColor);
|
||||
},
|
||||
placeholder:
|
||||
'Insert Wallet phone number'.tr,
|
||||
keyboardType: TextInputType.phone,
|
||||
padding: const EdgeInsets.symmetric(
|
||||
vertical: 12, horizontal: 10),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
cancel: MyElevatedButton(
|
||||
title: 'Cancel'.tr,
|
||||
kolor: AppColor.redColor,
|
||||
actions: <Widget>[
|
||||
CupertinoDialogAction(
|
||||
child: Text('Cancel'.tr,
|
||||
style: const TextStyle(
|
||||
color: CupertinoColors
|
||||
.destructiveRed)),
|
||||
onPressed: () {
|
||||
Get.back();
|
||||
}));
|
||||
Get.back(); // Dismiss the dialog
|
||||
},
|
||||
),
|
||||
CupertinoDialogAction(
|
||||
child: Text('OK'.tr,
|
||||
style: const TextStyle(
|
||||
color:
|
||||
CupertinoColors.activeGreen)),
|
||||
onPressed: () async {
|
||||
Get.back(); // Close the dialog
|
||||
box.write(
|
||||
BoxName.phoneWallet,
|
||||
controller
|
||||
.walletphoneController.text);
|
||||
Toast.show(
|
||||
context,
|
||||
'Phone Wallet Saved Successfully'.tr,
|
||||
AppColor.greenColor);
|
||||
},
|
||||
),
|
||||
],
|
||||
),
|
||||
barrierDismissible:
|
||||
false, // Set to prevent dismissing by tapping outside
|
||||
);
|
||||
})
|
||||
],
|
||||
),
|
||||
@@ -120,70 +171,71 @@ class PassengerWallet extends StatelessWidget {
|
||||
}
|
||||
|
||||
class CardSeferWallet extends StatelessWidget {
|
||||
const CardSeferWallet({
|
||||
super.key,
|
||||
});
|
||||
const CardSeferWallet({super.key});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return GetBuilder<PaymentController>(builder: (paymentController) {
|
||||
return Row(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
Container(
|
||||
width: Get.width * .85,
|
||||
height: Get.height * .3,
|
||||
decoration: BoxDecoration(
|
||||
color: AppColor.twitterColor.withOpacity(.8),
|
||||
borderRadius: const BorderRadius.all(Radius.circular(12)),
|
||||
gradient: const LinearGradient(colors: [
|
||||
AppColor.redColor,
|
||||
AppColor.yellowColor,
|
||||
AppColor.yellowColor,
|
||||
]),
|
||||
),
|
||||
return GetBuilder<PaymentController>(
|
||||
builder: (paymentController) {
|
||||
return Container(
|
||||
width: Get.width * 0.9,
|
||||
height: Get.height * 0.25,
|
||||
margin: const EdgeInsets.all(16.0),
|
||||
decoration: BoxDecoration(
|
||||
color: CupertinoColors.extraLightBackgroundGray,
|
||||
borderRadius: BorderRadius.circular(12),
|
||||
boxShadow: [
|
||||
BoxShadow(
|
||||
color: Colors.black.withOpacity(0.1),
|
||||
offset: const Offset(0, 10),
|
||||
blurRadius: 20,
|
||||
),
|
||||
],
|
||||
),
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.all(16.0),
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Padding(
|
||||
padding: const EdgeInsets.all(8.0),
|
||||
child: Row(
|
||||
children: [
|
||||
Text(
|
||||
'${AppInformation.appName} Wallet',
|
||||
style: AppStyle.headTitle
|
||||
.copyWith(color: AppColor.writeColor),
|
||||
)
|
||||
],
|
||||
// Wallet Title
|
||||
Text(
|
||||
'${AppInformation.appName} Wallet',
|
||||
style: AppStyle.headTitle.copyWith(
|
||||
color: CupertinoColors.label,
|
||||
fontSize: 20,
|
||||
fontWeight: FontWeight.bold,
|
||||
),
|
||||
),
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
Text(
|
||||
'${box.read(BoxName.passengerWalletTotal)} \$' ??
|
||||
'0.0 \$',
|
||||
style: AppStyle.headTitle2,
|
||||
)
|
||||
],
|
||||
),
|
||||
Padding(
|
||||
padding: const EdgeInsets.all(8.0),
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.end,
|
||||
children: [
|
||||
Text(
|
||||
box.read(BoxName.name),
|
||||
style: AppStyle.title,
|
||||
)
|
||||
],
|
||||
|
||||
// Wallet Balance
|
||||
Center(
|
||||
child: Text(
|
||||
'${box.read(BoxName.passengerWalletTotal) ?? '0.0'} ${'LE'.tr}',
|
||||
style: AppStyle.headTitle2.copyWith(
|
||||
color: CupertinoColors.label,
|
||||
fontSize: 36,
|
||||
fontWeight: FontWeight.w600,
|
||||
),
|
||||
),
|
||||
)
|
||||
),
|
||||
|
||||
// User Name (Bottom Right)
|
||||
Align(
|
||||
alignment: Alignment.bottomRight,
|
||||
child: Text(
|
||||
box.read(BoxName.name),
|
||||
style: AppStyle.title.copyWith(
|
||||
color: CupertinoColors.secondaryLabel,
|
||||
fontSize: 16,
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
);
|
||||
});
|
||||
);
|
||||
},
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import 'package:SEFER/constant/box_name.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:SEFER/constant/box_name.dart';
|
||||
import 'package:SEFER/constant/colors.dart';
|
||||
import 'package:SEFER/constant/style.dart';
|
||||
import 'package:SEFER/controller/functions/toast.dart';
|
||||
@@ -8,7 +8,6 @@ import 'package:SEFER/controller/payment/payment_controller.dart';
|
||||
import 'package:SEFER/views/widgets/elevated_btn.dart';
|
||||
|
||||
import '../../../main.dart';
|
||||
import '../../widgets/my_textField.dart';
|
||||
|
||||
class PassengerWalletDialog extends StatelessWidget {
|
||||
const PassengerWalletDialog({
|
||||
@@ -19,294 +18,198 @@ class PassengerWalletDialog extends StatelessWidget {
|
||||
Widget build(BuildContext context) {
|
||||
return GetBuilder<PaymentController>(
|
||||
builder: (controller) => Positioned(
|
||||
top: Get.height * .1,
|
||||
right: Get.width * .15,
|
||||
left: Get.width * .15,
|
||||
bottom: Get.height * .1,
|
||||
child: controller.isPromoSheetDialogue
|
||||
? Container(
|
||||
decoration: const BoxDecoration(
|
||||
borderRadius: BorderRadius.all(Radius.circular(12)),
|
||||
color: AppColor.secondaryColor,
|
||||
boxShadow: [
|
||||
BoxShadow(
|
||||
color: AppColor.accentColor,
|
||||
offset: Offset(-1, -1),
|
||||
blurRadius: 0,
|
||||
spreadRadius: 0,
|
||||
blurStyle: BlurStyle.normal),
|
||||
BoxShadow(
|
||||
color: AppColor.accentColor,
|
||||
offset: Offset(3, 3),
|
||||
blurRadius: 1,
|
||||
spreadRadius: 0,
|
||||
blurStyle: BlurStyle.normal)
|
||||
]),
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.all(6),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
children: [
|
||||
GestureDetector(
|
||||
onTap: () {
|
||||
controller.updateSelectedAmount(10);
|
||||
},
|
||||
child: Row(
|
||||
children: [
|
||||
Radio(
|
||||
value: box.read(BoxName.countryCode) == 'Egypt'
|
||||
? 100
|
||||
: 10,
|
||||
groupValue: controller.selectedAmount,
|
||||
onChanged: (value) {
|
||||
controller.updateSelectedAmount(value as int);
|
||||
},
|
||||
),
|
||||
Text(
|
||||
box.read(BoxName.countryCode) == 'Egypt'
|
||||
? '100 ${'LE'.tr}'.tr
|
||||
: '10 ${'JOD'.tr}'.tr,
|
||||
style: AppStyle.title,
|
||||
),
|
||||
],
|
||||
top: Get.height * .1,
|
||||
right: Get.width * .15,
|
||||
left: Get.width * .15,
|
||||
bottom: Get.height * .1,
|
||||
child: controller.isPromoSheetDialogue
|
||||
? CupertinoActionSheet(
|
||||
title: Text('Select Payment Amount'.tr),
|
||||
actions: [
|
||||
CupertinoActionSheetAction(
|
||||
onPressed: () {
|
||||
controller.updateSelectedAmount(
|
||||
box.read(BoxName.countryCode) == 'Egypt' ? 100 : 10,
|
||||
);
|
||||
showPaymentOptions(context, controller);
|
||||
},
|
||||
child: Text(
|
||||
box.read(BoxName.countryCode) == 'Egypt'
|
||||
? '100 ${'LE'.tr}'
|
||||
: '10 ${'JOD'.tr}',
|
||||
),
|
||||
),
|
||||
CupertinoActionSheetAction(
|
||||
onPressed: () {
|
||||
controller.updateSelectedAmount(
|
||||
box.read(BoxName.countryCode) == 'Egypt' ? 200 : 20,
|
||||
);
|
||||
showPaymentOptions(context, controller);
|
||||
},
|
||||
child: Text(
|
||||
box.read(BoxName.countryCode) == 'Egypt'
|
||||
? '200 ${'LE'.tr} = 205 ${'LE'.tr}'
|
||||
: '20 ${'JOD'.tr}',
|
||||
),
|
||||
),
|
||||
CupertinoActionSheetAction(
|
||||
onPressed: () {
|
||||
controller.updateSelectedAmount(
|
||||
box.read(BoxName.countryCode) == 'Egypt' ? 400 : 40,
|
||||
);
|
||||
showPaymentOptions(context, controller);
|
||||
},
|
||||
child: Text(
|
||||
box.read(BoxName.countryCode) == 'Egypt'
|
||||
? '400 ${'LE'.tr} = 415 ${'LE'.tr}'
|
||||
: '40 ${'JOD'.tr}',
|
||||
),
|
||||
),
|
||||
CupertinoActionSheetAction(
|
||||
onPressed: () {
|
||||
controller.updateSelectedAmount(
|
||||
box.read(BoxName.countryCode) == 'Egypt' ? 1000 : 50,
|
||||
);
|
||||
showPaymentOptions(context, controller);
|
||||
},
|
||||
child: Text(
|
||||
box.read(BoxName.countryCode) == 'Egypt'
|
||||
? '1000 ${'LE'.tr} = 1100 ${'LE'.tr}'
|
||||
: '50 ${'JOD'.tr}',
|
||||
),
|
||||
),
|
||||
],
|
||||
cancelButton: CupertinoActionSheetAction(
|
||||
onPressed: () {
|
||||
controller.changePromoSheetDialogue();
|
||||
},
|
||||
child: Text('Cancel'.tr),
|
||||
),
|
||||
)
|
||||
: const SizedBox(),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
void showPaymentOptions(BuildContext context, PaymentController controller) {
|
||||
showCupertinoModalPopup(
|
||||
context: context,
|
||||
builder: (context) => CupertinoActionSheet(
|
||||
title: Text('Payment Options'.tr),
|
||||
actions: [
|
||||
box.read(BoxName.countryCode) == 'Egypt'
|
||||
? CupertinoActionSheetAction(
|
||||
child: Text('💳 Pay with Credit Card'.tr),
|
||||
onPressed: () {
|
||||
if (controller.selectedAmount != 0) {
|
||||
controller.payWithPayMob(
|
||||
context,
|
||||
controller.selectedAmount.toString(),
|
||||
box.read(BoxName.countryCode) == 'Egypt' ? 'EGP' : 'JOD',
|
||||
() async {
|
||||
await controller.addPassengerWallet();
|
||||
controller.changePromoSheetDialogue();
|
||||
await controller.getPassengerWallet();
|
||||
},
|
||||
);
|
||||
} else {
|
||||
Toast.show(context, '⚠️ You need to choose an amount!'.tr,
|
||||
AppColor.redColor);
|
||||
}
|
||||
},
|
||||
)
|
||||
: const SizedBox(),
|
||||
box.read(BoxName.countryCode) != 'Egypt'
|
||||
? CupertinoActionSheetAction(
|
||||
child: Text('Pay with PayPal'.tr),
|
||||
onPressed: () {
|
||||
if (controller.selectedAmount != 0) {
|
||||
controller.makePaymentPayPal(context);
|
||||
} else {
|
||||
Toast.show(context, 'You will choose one of above!'.tr,
|
||||
AppColor.redColor);
|
||||
}
|
||||
},
|
||||
)
|
||||
: const SizedBox(),
|
||||
box.read(BoxName.phoneWallet) != null
|
||||
? CupertinoActionSheetAction(
|
||||
child: Text('💰 Pay with Wallet'.tr),
|
||||
onPressed: () {
|
||||
if (controller.selectedAmount != 0) {
|
||||
controller.payWithPayMobWallet(
|
||||
context,
|
||||
controller.selectedAmount.toString(),
|
||||
box.read(BoxName.countryCode) == 'Egypt' ? 'EGP' : 'JOD',
|
||||
() async {
|
||||
await controller.addPassengerWallet();
|
||||
controller.changePromoSheetDialogue();
|
||||
await controller.getPassengerWallet();
|
||||
},
|
||||
);
|
||||
} else {
|
||||
Toast.show(context, '⚠️ You need to choose an amount!'.tr,
|
||||
AppColor.redColor);
|
||||
}
|
||||
},
|
||||
)
|
||||
: CupertinoActionSheetAction(
|
||||
child: Text('Add wallet phone you use'.tr),
|
||||
onPressed: () {
|
||||
Get.dialog(
|
||||
CupertinoAlertDialog(
|
||||
title: Text('Insert Wallet phone number'.tr),
|
||||
content: Column(
|
||||
children: [
|
||||
const SizedBox(height: 10),
|
||||
CupertinoTextField(
|
||||
controller: controller.walletphoneController,
|
||||
placeholder: 'Insert Wallet phone number'.tr,
|
||||
keyboardType: TextInputType.phone,
|
||||
padding: const EdgeInsets.symmetric(
|
||||
vertical: 12,
|
||||
horizontal: 10,
|
||||
),
|
||||
),
|
||||
),
|
||||
GestureDetector(
|
||||
onTap: () {
|
||||
controller.updateSelectedAmount(20);
|
||||
},
|
||||
child: Row(
|
||||
children: [
|
||||
Radio(
|
||||
value:
|
||||
box.read(BoxName.countryCode) == 'Egypt'
|
||||
? 210
|
||||
: 20,
|
||||
groupValue: controller.selectedAmount,
|
||||
onChanged: (value) {
|
||||
controller
|
||||
.updateSelectedAmount(value as int);
|
||||
},
|
||||
),
|
||||
Text(
|
||||
box.read(BoxName.countryCode) == 'Egypt'
|
||||
? '${'200 ${'LE'.tr} '.tr} = 205 ${'LE'.tr}'
|
||||
: '20 ${'JOD'.tr}'.tr,
|
||||
style: AppStyle.title,
|
||||
),
|
||||
],
|
||||
)),
|
||||
GestureDetector(
|
||||
onTap: () {
|
||||
controller.updateSelectedAmount(40);
|
||||
},
|
||||
child: Row(
|
||||
children: [
|
||||
Radio(
|
||||
value:
|
||||
box.read(BoxName.countryCode) == 'Egypt'
|
||||
? 415
|
||||
: 40,
|
||||
groupValue: controller.selectedAmount,
|
||||
onChanged: (value) {
|
||||
controller
|
||||
.updateSelectedAmount(value as int);
|
||||
},
|
||||
),
|
||||
Text(
|
||||
box.read(BoxName.countryCode) == 'Egypt'
|
||||
? '${'400 ${'LE'.tr} '.tr} = 415 ${'LE'.tr}'
|
||||
: '40 ${'JOD'.tr}'.tr,
|
||||
style: AppStyle.title,
|
||||
),
|
||||
],
|
||||
)),
|
||||
GestureDetector(
|
||||
onTap: () {
|
||||
controller.updateSelectedAmount(100);
|
||||
},
|
||||
child: Row(
|
||||
children: [
|
||||
Radio(
|
||||
value:
|
||||
box.read(BoxName.countryCode) == 'Egypt'
|
||||
? 1100
|
||||
: 50,
|
||||
groupValue: controller.selectedAmount,
|
||||
onChanged: (value) {
|
||||
controller
|
||||
.updateSelectedAmount(value as int);
|
||||
},
|
||||
),
|
||||
Text(
|
||||
box.read(BoxName.countryCode) == 'Egypt'
|
||||
? '${'1000 ${'LE'.tr} '.tr} = 1100 ${'LE'.tr}'
|
||||
: '50 ${'JOD'.tr}'.tr,
|
||||
style: AppStyle.title,
|
||||
),
|
||||
],
|
||||
)),
|
||||
const Spacer(),
|
||||
box.read(BoxName.countryCode) == 'Egypt'
|
||||
? const SizedBox()
|
||||
: MyElevatedButton(
|
||||
kolor: AppColor.blueColor,
|
||||
title: '${'Pay with Your'.tr} PayPal',
|
||||
onPressed: () {
|
||||
if (controller.selectedAmount != 0) {
|
||||
controller.makePaymentPayPal(context);
|
||||
} else {
|
||||
Toast.show(
|
||||
context,
|
||||
'You will choose one of above !'.tr,
|
||||
AppColor.redColor);
|
||||
}
|
||||
},
|
||||
),
|
||||
box.read(BoxName.countryCode) == 'Egypt'
|
||||
? box.read(BoxName.phoneWallet) != null
|
||||
? Column(
|
||||
children: [
|
||||
MyElevatedButton(
|
||||
title: '💳 Pay with Credit Card'.tr,
|
||||
onPressed: () {
|
||||
if (controller.selectedAmount != 0) {
|
||||
controller.payWithPayMob(
|
||||
context,
|
||||
controller.selectedAmount
|
||||
.toString(), // Convert int to double
|
||||
box.read(BoxName.countryCode) ==
|
||||
'Egypt'
|
||||
? 'EGP'
|
||||
: 'JOD',
|
||||
() async {
|
||||
await controller
|
||||
.addPassengerWallet();
|
||||
controller
|
||||
.changePromoSheetDialogue();
|
||||
await controller
|
||||
.getPassengerWallet();
|
||||
},
|
||||
);
|
||||
} else {
|
||||
Toast.show(
|
||||
context,
|
||||
'⚠️ You need to choose an amount!'
|
||||
.tr,
|
||||
AppColor.redColor,
|
||||
);
|
||||
}
|
||||
},
|
||||
),
|
||||
// Add some spacing between buttons
|
||||
MyElevatedButton(
|
||||
kolor: AppColor.yellowColor,
|
||||
title: '💰 Pay with Wallet'.tr,
|
||||
onPressed: () {
|
||||
if (controller.selectedAmount != 0) {
|
||||
controller.payWithPayMobWallet(
|
||||
context,
|
||||
controller.selectedAmount
|
||||
.toString(), // Convert int to double
|
||||
box.read(BoxName.countryCode) ==
|
||||
'Egypt'
|
||||
? 'EGP'
|
||||
: 'JOD',
|
||||
() async {
|
||||
await controller
|
||||
.addPassengerWallet();
|
||||
controller
|
||||
.changePromoSheetDialogue();
|
||||
await controller
|
||||
.getPassengerWallet();
|
||||
},
|
||||
);
|
||||
} else {
|
||||
Toast.show(
|
||||
context,
|
||||
'⚠️ You need to choose an amount!'
|
||||
.tr,
|
||||
AppColor.redColor,
|
||||
);
|
||||
}
|
||||
},
|
||||
),
|
||||
],
|
||||
)
|
||||
: MyElevatedButton(
|
||||
title: 'Pay with Credit Card'.tr,
|
||||
onPressed: () {
|
||||
if (controller.selectedAmount != 0) {
|
||||
controller.makePaymentStripe(
|
||||
controller.selectedAmount!
|
||||
.toDouble(), // Convert int to double
|
||||
box.read(BoxName.countryCode) !=
|
||||
'Egypt'
|
||||
? 'usd'
|
||||
: 'jod', () {
|
||||
controller.addPassengerWallet();
|
||||
controller.changePromoSheetDialogue();
|
||||
controller.getPassengerWallet();
|
||||
});
|
||||
} else {
|
||||
Toast.show(
|
||||
context,
|
||||
'You will choose one of above !'.tr,
|
||||
AppColor.redColor);
|
||||
}
|
||||
})
|
||||
: MyElevatedButton(
|
||||
kolor: AppColor.deepPurpleAccent,
|
||||
title: "Add wallet phone you use".tr,
|
||||
onPressed: () {
|
||||
Get.defaultDialog(
|
||||
barrierDismissible: false,
|
||||
title: 'Insert Wallet phone number'.tr,
|
||||
content: Form(
|
||||
key: controller.formKey,
|
||||
child: MyTextForm(
|
||||
controller: controller
|
||||
.walletphoneController,
|
||||
label:
|
||||
'Insert Wallet phone number'
|
||||
.tr,
|
||||
hint: 'Insert Wallet phone number'
|
||||
.tr,
|
||||
type: TextInputType.phone)),
|
||||
confirm: MyElevatedButton(
|
||||
kolor: AppColor.greenColor,
|
||||
title: 'OK'.tr,
|
||||
onPressed: () async {
|
||||
Get.back();
|
||||
box.write(
|
||||
BoxName.phoneWallet,
|
||||
controller
|
||||
.walletphoneController.text);
|
||||
Toast.show(
|
||||
context,
|
||||
'Phone Wallet Saved Successfully'
|
||||
.tr,
|
||||
AppColor.greenColor);
|
||||
},
|
||||
),
|
||||
cancel: MyElevatedButton(
|
||||
title: 'Cancel'.tr,
|
||||
kolor: AppColor.redColor,
|
||||
onPressed: () {
|
||||
Get.back();
|
||||
}));
|
||||
}),
|
||||
MyElevatedButton(
|
||||
title: 'Cancel'.tr,
|
||||
kolor: AppColor.redColor,
|
||||
],
|
||||
),
|
||||
actions: [
|
||||
CupertinoDialogAction(
|
||||
child: Text('Cancel'.tr,
|
||||
style: const TextStyle(
|
||||
color: CupertinoColors.destructiveRed)),
|
||||
onPressed: () {
|
||||
controller.changePromoSheetDialogue();
|
||||
Get.back();
|
||||
},
|
||||
),
|
||||
CupertinoDialogAction(
|
||||
child: Text('OK'.tr,
|
||||
style: const TextStyle(
|
||||
color: CupertinoColors.activeGreen)),
|
||||
onPressed: () async {
|
||||
Get.back();
|
||||
box.write(BoxName.phoneWallet,
|
||||
controller.walletphoneController.text);
|
||||
Toast.show(
|
||||
context,
|
||||
'Phone Wallet Saved Successfully'.tr,
|
||||
AppColor.greenColor);
|
||||
},
|
||||
),
|
||||
],
|
||||
),
|
||||
))
|
||||
: const SizedBox()),
|
||||
);
|
||||
}
|
||||
barrierDismissible: false,
|
||||
);
|
||||
},
|
||||
),
|
||||
],
|
||||
cancelButton: CupertinoActionSheetAction(
|
||||
child: Text('Cancel'.tr),
|
||||
onPressed: () {
|
||||
controller.changePromoSheetDialogue();
|
||||
},
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:SEFER/constant/colors.dart';
|
||||
@@ -17,7 +18,7 @@ class PaymentHistoryPassengerPage extends StatelessWidget {
|
||||
body: [
|
||||
GetBuilder<PassengerWalletHistoryController>(
|
||||
builder: (controller) => controller.isLoading
|
||||
? const MyCircularProgressIndicator()
|
||||
? const MyCircularProgressIndicator() // iOS-style loading indicator
|
||||
: controller.archive.isEmpty
|
||||
? Center(
|
||||
child: Text(
|
||||
@@ -25,37 +26,33 @@ class PaymentHistoryPassengerPage extends StatelessWidget {
|
||||
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: Padding(
|
||||
padding: const EdgeInsets.all(8.0),
|
||||
child: Row(
|
||||
mainAxisAlignment:
|
||||
MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
Text(
|
||||
list['balance'],
|
||||
style: AppStyle.title,
|
||||
),
|
||||
Text(
|
||||
list['created_at'],
|
||||
style: AppStyle.title,
|
||||
),
|
||||
],
|
||||
: CupertinoListSection.insetGrouped(
|
||||
children: List.generate(
|
||||
controller.archive.length,
|
||||
(index) {
|
||||
var list = controller.archive[index];
|
||||
return CupertinoListTile(
|
||||
backgroundColor: double.parse(list['balance']) < 0
|
||||
? AppColor.redColor.withOpacity(.2)
|
||||
: AppColor.greenColor.withOpacity(.2),
|
||||
title: Text(
|
||||
list['balance'],
|
||||
style: AppStyle.title.copyWith(
|
||||
color: CupertinoColors.black,
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
},
|
||||
additionalInfo: Text(
|
||||
list['created_at'],
|
||||
style: AppStyle.title.copyWith(
|
||||
fontSize: 12,
|
||||
color: CupertinoColors.systemGrey,
|
||||
),
|
||||
),
|
||||
padding: const EdgeInsets.symmetric(
|
||||
vertical: 8, horizontal: 16),
|
||||
);
|
||||
},
|
||||
),
|
||||
),
|
||||
)
|
||||
],
|
||||
|
||||
Reference in New Issue
Block a user