Files
tripz/lib/views/home/my_wallet/passenger_wallet.dart
Hamza-Ayed a65e7e5562 9/17/1
2024-09-17 00:57:13 +03:00

185 lines
6.7 KiB
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/home/payment/credit_card_controller.dart';
import '../../../controller/payment/payment_controller.dart';
import '../../../main.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<PaymentController>(
builder: (controller) => Column(
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.center,
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);
},
),
],
),
)
],
),
),
GetBuilder<PaymentController>(
builder: (controller) => controller.isPromoSheetDialogue
? Container(
color: AppColor.accentColor.withOpacity(.91),
)
: const SizedBox()),
GetBuilder<PaymentController>(
builder: (controller) => Positioned(
bottom: Get.height * .2,
left: Get.width * .2,
right: Get.width * .2,
child: Column(
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.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);
},
),
cancel: MyElevatedButton(
title: 'Cancel'.tr,
kolor: AppColor.redColor,
onPressed: () {
Get.back();
}));
})
],
),
)),
const PassengerWalletDialog(),
],
);
}
}
class CardSeferWallet extends StatelessWidget {
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,
]),
),
child: Column(
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
children: [
Padding(
padding: const EdgeInsets.all(8.0),
child: Row(
children: [
Text(
'${AppInformation.appName} Wallet',
style: AppStyle.headTitle
.copyWith(color: AppColor.writeColor),
)
],
),
),
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,
)
],
),
)
],
),
),
],
);
});
}
}