import 'package:sefer_driver/constant/style.dart'; import 'package:sefer_driver/views/widgets/elevated_btn.dart'; import 'package:sefer_driver/views/widgets/my_scafold.dart'; import 'package:sefer_driver/views/widgets/my_textField.dart'; import 'package:sefer_driver/views/widgets/mycircular.dart'; import 'package:sefer_driver/views/widgets/mydialoug.dart'; import 'package:flutter/material.dart'; import 'package:get/get.dart'; import '../../../controller/home/payment/captain_wallet_controller.dart'; class TransferBudgetPage extends StatelessWidget { const TransferBudgetPage({super.key}); @override Widget build(BuildContext context) { Get.put(CaptainWalletController()); return MyScafolld( title: "Transfer budget".tr, body: [ GetBuilder( builder: (captainWalletController) { return Padding( padding: const EdgeInsets.all(8.0), child: Container( decoration: AppStyle.boxDecoration1, height: Get.height * .7, width: double.infinity, child: Form( key: captainWalletController.formKeyTransfer, child: Column( children: [ const SizedBox( height: 20, ), MyTextForm( controller: captainWalletController .newDriverPhoneController, label: 'phone number of driver'.tr, hint: 'phone number of driver', type: TextInputType.phone), MyTextForm( controller: captainWalletController .amountFromBudgetController, label: 'insert amount'.tr, hint: '${'You have in account'.tr} ${captainWalletController.totalAmountVisa}', type: TextInputType.number), captainWalletController.isNewTransfer ? const MyCircularProgressIndicator() : captainWalletController .amountToNewDriverMap.isEmpty ? MyElevatedButton( title: 'Next'.tr, onPressed: () async { await captainWalletController .detectNewDriverFromMyBudget(); }) : const SizedBox(), captainWalletController.amountToNewDriverMap.isNotEmpty ? Padding( padding: const EdgeInsets.all(8.0), child: Column( children: [ Container( width: double.maxFinite, decoration: AppStyle.boxDecoration1, child: Text( 'Name :'.tr + captainWalletController .amountToNewDriverMap[0]['name'] .toString(), textAlign: TextAlign.center, style: AppStyle.title, ), ), const SizedBox( height: 5, ), Container( width: double.maxFinite, decoration: AppStyle.boxDecoration1, child: Text( "${"NationalID".tr} ${captainWalletController.amountToNewDriverMap[0]['national_number']}", style: AppStyle.title, textAlign: TextAlign.center, ), ), const SizedBox( height: 5, ), Container( width: double.maxFinite, decoration: AppStyle.boxDecoration1, child: Text( "${"amount".tr} ${captainWalletController.amountFromBudgetController.text} ${'LE'.tr}", style: AppStyle.title, textAlign: TextAlign.center, ), ), const SizedBox( height: 15, ), captainWalletController .amountToNewDriverMap.isNotEmpty ? MyElevatedButton( title: 'Transfer'.tr, onPressed: () async { 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() ], ), ) : const SizedBox() ], )), ), ); }), ], isleading: true); } }