import 'package:SEFER/views/widgets/my_dialog.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:get/get.dart'; import 'package:SEFER/views/home/my_wallet/payment_history_passenger_page.dart'; import '../../../constant/box_name.dart'; import '../../../constant/colors.dart'; import '../../../constant/info.dart'; import '../../../constant/style.dart'; 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'; import 'passenger_wallet_dialoge.dart'; class PassengerWallet extends StatelessWidget { const PassengerWallet({super.key}); @override Widget build(BuildContext context) { Get.put(PaymentController()); Get.put(CreditCardController()); return MyScafolld( title: 'My Wallet'.tr, isleading: true, body: [ GetBuilder( builder: (controller) => Column( mainAxisAlignment: MainAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.stretch, children: [ const CardSeferWallet(), const SizedBox( height: 20, ), Padding( 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()}'); }, ), ) ], ), ), GetBuilder( builder: (controller) => controller.isPromoSheetDialogue ? Container( color: AppColor.accentColor.withOpacity(.91), ) : const SizedBox()), GetBuilder( builder: (controller) => Positioned( bottom: Get.height * .2, left: Get.width * .2, right: Get.width * .2, child: Column( crossAxisAlignment: CrossAxisAlignment.stretch, children: [ MyElevatedButton( title: 'Show Promos to Charge'.tr, onPressed: () { controller.changePromoSheetDialogue(); }, ), const SizedBox( height: 20, ), MyElevatedButton( kolor: AppColor.deepPurpleAccent, title: "Add wallet phone you use".tr, onPressed: () { 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, placeholder: 'Insert Wallet phone number'.tr, keyboardType: TextInputType.phone, padding: const EdgeInsets.symmetric( vertical: 12, horizontal: 10), ), ), ], ), actions: [ CupertinoDialogAction( child: Text('Cancel'.tr, style: const TextStyle( color: CupertinoColors .destructiveRed)), onPressed: () { 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 ); }) ], ), )), const PassengerWalletDialog(), ], ); } } class CardSeferWallet extends StatelessWidget { const CardSeferWallet({super.key}); @override Widget build(BuildContext context) { return GetBuilder( 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.spaceBetween, crossAxisAlignment: CrossAxisAlignment.start, children: [ // Wallet Title Text( '${AppInformation.appName} Wallet', style: AppStyle.headTitle.copyWith( color: CupertinoColors.label, fontSize: 20, fontWeight: FontWeight.bold, ), ), // 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, ), ), ), ], ), ), ); }, ); } }