Initial commit

This commit is contained in:
Hamza-Ayed
2024-10-12 19:19:26 +03:00
parent 2e3ce78fe8
commit aca697578d
41 changed files with 2976 additions and 1188 deletions

View File

@@ -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,
),
),
),
],
),
),
],
);
});
);
},
);
}
}