1/25/2
This commit is contained in:
@@ -1,12 +1,11 @@
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
import 'package:get/get.dart';
|
||||
import 'package:ride/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/secure_storage.dart';
|
||||
import '../../../controller/functions/toast.dart';
|
||||
import '../../../controller/home/payment/credit_card_controller.dart';
|
||||
import '../../../controller/payment/payment_controller.dart';
|
||||
import '../../../main.dart';
|
||||
@@ -28,154 +27,28 @@ class PassengerWallet extends StatelessWidget {
|
||||
body: [
|
||||
GetBuilder<PaymentController>(
|
||||
builder: (controller) => Column(
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
children: [
|
||||
Column(
|
||||
children: [
|
||||
Column(
|
||||
children: [
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
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(10),
|
||||
child:
|
||||
box.read(BoxName.passengerWalletTotal) == null
|
||||
? Text(
|
||||
'${'You Dont Have Any amount in'.tr} ${AppInformation.appName}${'Wallet!'.tr}',
|
||||
style: AppStyle.title,
|
||||
)
|
||||
: Text(
|
||||
'${'You Have'.tr} ${box.read(BoxName.passengerWalletTotal).toString()} JD in ${AppInformation.appName} Wallet',
|
||||
style: AppStyle.title,
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
const SizedBox(
|
||||
height: 30,
|
||||
),
|
||||
const MyCreditCardWidget(),
|
||||
const SizedBox(
|
||||
height: 10,
|
||||
),
|
||||
// GetBuilder<CreditCardController>(
|
||||
// builder: (creditCardController) => Row(
|
||||
// mainAxisAlignment: MainAxisAlignment.center,
|
||||
// children: [
|
||||
// MyElevatedButton(
|
||||
// title: 'Save Credit Card'.tr,
|
||||
// onPressed: () async {
|
||||
// if (controller.formKey.currentState!
|
||||
// .validate()) {
|
||||
// SecureStorage().saveData(
|
||||
// BoxName.cardNumber,
|
||||
// creditCardController
|
||||
// .cardNumberController.text);
|
||||
// SecureStorage().saveData(
|
||||
// BoxName.cardHolderName,
|
||||
// creditCardController
|
||||
// .cardHolderNameController.text);
|
||||
// SecureStorage().saveData(
|
||||
// BoxName.cvvCode,
|
||||
// creditCardController
|
||||
// .cvvCodeController.text);
|
||||
// SecureStorage().saveData(
|
||||
// BoxName.expiryDate,
|
||||
// creditCardController
|
||||
// .expiryDateController.text);
|
||||
// }
|
||||
// },
|
||||
// ),
|
||||
// ],
|
||||
// )),
|
||||
// // MyElevatedButton(
|
||||
// title: 'Charge your Wallet',
|
||||
// onPressed: () {
|
||||
// Get.defaultDialog(
|
||||
// title: 'Choose amount you will Charge?'.tr,
|
||||
// content: Column(
|
||||
// crossAxisAlignment: CrossAxisAlignment.center,
|
||||
// children: [
|
||||
// Row(
|
||||
// children: [
|
||||
// Radio(
|
||||
// value: 10,
|
||||
// groupValue: controller.selectedAmount,
|
||||
// onChanged: (value) {
|
||||
// controller.selectedAmount =
|
||||
// value as String?;
|
||||
// },
|
||||
// ),
|
||||
// Text('10 and get 4% discount'.tr),
|
||||
// ],
|
||||
// ),
|
||||
// Row(
|
||||
// children: [
|
||||
// Radio(
|
||||
// value: 20,
|
||||
// groupValue: controller.selectedAmount,
|
||||
// onChanged: (value) {
|
||||
// controller.selectedAmount =
|
||||
// value as String?;
|
||||
// },
|
||||
// ),
|
||||
// Text('20 and get 6% discount'.tr),
|
||||
// ],
|
||||
// ),
|
||||
// Row(
|
||||
// children: [
|
||||
// Radio(
|
||||
// value: 40,
|
||||
// groupValue: controller.selectedAmount,
|
||||
// onChanged: (value) {
|
||||
// controller.selectedAmount =
|
||||
// value as String?;
|
||||
// },
|
||||
// ),
|
||||
// Text('40 and get 8% discount'.tr),
|
||||
// ],
|
||||
// ),
|
||||
// Row(
|
||||
// children: [
|
||||
// Radio(
|
||||
// value: 100,
|
||||
// groupValue: controller.selectedAmount,
|
||||
// onChanged: (value) {
|
||||
// controller.selectedAmount =
|
||||
// value as String?;
|
||||
// },
|
||||
// ),
|
||||
// Text('100 and get 11% discount'.tr),
|
||||
// ],
|
||||
// ),
|
||||
// ],
|
||||
// ));
|
||||
// },
|
||||
// )
|
||||
],
|
||||
),
|
||||
],
|
||||
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);
|
||||
},
|
||||
),
|
||||
],
|
||||
),
|
||||
)
|
||||
],
|
||||
),
|
||||
),
|
||||
@@ -187,11 +60,11 @@ class PassengerWallet extends StatelessWidget {
|
||||
: const SizedBox()),
|
||||
GetBuilder<PaymentController>(
|
||||
builder: (controller) => Positioned(
|
||||
bottom: Get.height * .3,
|
||||
left: Get.width * .3,
|
||||
right: Get.width * .3,
|
||||
bottom: Get.height * .2,
|
||||
left: Get.width * .2,
|
||||
right: Get.width * .2,
|
||||
child: MyElevatedButton(
|
||||
title: 'Show Promos'.tr,
|
||||
title: 'Show Promos to Charge'.tr,
|
||||
onPressed: () {
|
||||
controller.changePromoSheetDialogue();
|
||||
},
|
||||
@@ -202,3 +75,60 @@ class PassengerWallet extends StatelessWidget {
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
class CardSeferWallet extends StatelessWidget {
|
||||
const CardSeferWallet({
|
||||
super.key,
|
||||
});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Row(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
Container(
|
||||
width: Get.width * .85,
|
||||
height: Get.height * .3,
|
||||
decoration: BoxDecoration(
|
||||
color: AppColor.deepPurpleAccent,
|
||||
borderRadius: const BorderRadius.all(Radius.circular(12)),
|
||||
gradient: const LinearGradient(
|
||||
colors: [AppColor.blueColor, AppColor.primaryColor]),
|
||||
),
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
|
||||
children: [
|
||||
Row(
|
||||
children: [
|
||||
Text(
|
||||
'${AppInformation.appName} Wallet',
|
||||
style: AppStyle.headTitle
|
||||
.copyWith(color: AppColor.primaryColor),
|
||||
)
|
||||
],
|
||||
),
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
Text(
|
||||
'${box.read(BoxName.passengerWalletTotal)} \$' ?? '0.0 \$',
|
||||
style: AppStyle.headTitle2,
|
||||
)
|
||||
],
|
||||
),
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.end,
|
||||
children: [
|
||||
Text(
|
||||
box.read(BoxName.name),
|
||||
style: AppStyle.title,
|
||||
)
|
||||
],
|
||||
)
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -125,6 +125,7 @@ class PassengerWalletDialoge extends StatelessWidget {
|
||||
)),
|
||||
const Spacer(),
|
||||
MyElevatedButton(
|
||||
kolor: AppColor.blueColor,
|
||||
title: 'Pay with Your PayPal'.tr,
|
||||
onPressed: () {
|
||||
if (controller.selectedAmount != 0) {
|
||||
|
||||
53
lib/views/home/my_wallet/payment_history_passenger_page.dart
Normal file
53
lib/views/home/my_wallet/payment_history_passenger_page.dart
Normal file
@@ -0,0 +1,53 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:ride/constant/colors.dart';
|
||||
import 'package:ride/constant/style.dart';
|
||||
import 'package:ride/controller/payment/passenger_wallet_history_controller.dart';
|
||||
import 'package:ride/views/widgets/my_scafold.dart';
|
||||
import 'package:ride/views/widgets/mycircular.dart';
|
||||
|
||||
class PaymentHistoryPassengerPage extends StatelessWidget {
|
||||
const PaymentHistoryPassengerPage({super.key});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
Get.put(PassengerWalletHistoryController());
|
||||
return MyScafolld(
|
||||
title: 'Payment History'.tr,
|
||||
body: [
|
||||
GetBuilder<PassengerWalletHistoryController>(
|
||||
builder: (controller) => controller.isLoading
|
||||
? const MyCircularProgressIndicator()
|
||||
: 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: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
Text(
|
||||
list['balance'],
|
||||
style: AppStyle.title,
|
||||
),
|
||||
Text(
|
||||
list['created_at'],
|
||||
style: AppStyle.title,
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
},
|
||||
),
|
||||
)
|
||||
],
|
||||
isleading: true);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user