12/3/1
This commit is contained in:
@@ -334,81 +334,82 @@ GetBuilder<MapPassengerController> buttomSheetMapPage() {
|
||||
width: Get.width * .95,
|
||||
child: Row(
|
||||
mainAxisAlignment:
|
||||
MainAxisAlignment.spaceBetween,
|
||||
MainAxisAlignment.center,
|
||||
children: [
|
||||
TextButton(
|
||||
onPressed: () {
|
||||
Get.defaultDialog(
|
||||
barrierDismissible: false,
|
||||
title:
|
||||
'How Many Passengers?'.tr,
|
||||
titleStyle: AppStyle.title,
|
||||
content: Column(
|
||||
children: [
|
||||
Text(
|
||||
'Allowed up to 4 Passengers.'
|
||||
.tr,
|
||||
style: AppStyle.title,
|
||||
),
|
||||
SizedBox(
|
||||
height:
|
||||
200, // Set the desired height here
|
||||
child: CupertinoPicker(
|
||||
itemExtent: 32,
|
||||
onSelectedItemChanged:
|
||||
(index) {
|
||||
controller
|
||||
.onChangedPassengerCount(
|
||||
index + 1);
|
||||
},
|
||||
children: [
|
||||
Text(
|
||||
'1 Passenger'.tr),
|
||||
Text('2 Passengers'
|
||||
.tr),
|
||||
Text('3 Passengers'
|
||||
.tr),
|
||||
Text('4 Passengers'
|
||||
.tr),
|
||||
],
|
||||
),
|
||||
),
|
||||
MyElevatedButton(
|
||||
title: 'Back',
|
||||
onPressed: () =>
|
||||
Get.back(),
|
||||
)
|
||||
],
|
||||
),
|
||||
);
|
||||
},
|
||||
child: Row(
|
||||
mainAxisAlignment:
|
||||
MainAxisAlignment
|
||||
.spaceBetween,
|
||||
children: [
|
||||
Text('How Many Passengers?'.tr,
|
||||
style: AppStyle.title),
|
||||
const SizedBox(
|
||||
width: 10,
|
||||
),
|
||||
Container(
|
||||
decoration: BoxDecoration(
|
||||
border: Border.all()),
|
||||
child: Padding(
|
||||
padding:
|
||||
const EdgeInsets.all(
|
||||
3.0),
|
||||
child: Text(
|
||||
controller
|
||||
.selectedPassengerCount
|
||||
.toString(),
|
||||
style: AppStyle.title),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
// TextButton(
|
||||
// onPressed: () {
|
||||
// Get.defaultDialog(
|
||||
// barrierDismissible: false,
|
||||
// title:
|
||||
// 'How Many Passengers?'.tr,
|
||||
// titleStyle: AppStyle.title,
|
||||
// content: Column(
|
||||
// children: [
|
||||
// Text(
|
||||
// 'Allowed up to 4 Passengers.'
|
||||
// .tr,
|
||||
// style: AppStyle.title,
|
||||
// ),
|
||||
// SizedBox(
|
||||
// height:
|
||||
// 200, // Set the desired height here
|
||||
// child: CupertinoPicker(
|
||||
// itemExtent: 32,
|
||||
// onSelectedItemChanged:
|
||||
// (index) {
|
||||
// controller
|
||||
// .onChangedPassengerCount(
|
||||
// index + 1);
|
||||
// },
|
||||
// children: [
|
||||
// Text(
|
||||
// '1 Passenger'.tr),
|
||||
// Text('2 Passengers'
|
||||
// .tr),
|
||||
// Text('3 Passengers'
|
||||
// .tr),
|
||||
// Text('4 Passengers'
|
||||
// .tr),
|
||||
// ],
|
||||
// ),
|
||||
// ),
|
||||
// MyElevatedButton(
|
||||
// title: 'Back',
|
||||
// onPressed: () =>
|
||||
// Get.back(),
|
||||
// )
|
||||
// ],
|
||||
// ),
|
||||
// );
|
||||
// },
|
||||
// child: Row(
|
||||
// mainAxisAlignment:
|
||||
// MainAxisAlignment
|
||||
// .spaceBetween,
|
||||
// children: [
|
||||
// Text('How Many Passengers?'.tr,
|
||||
// style: AppStyle.title),
|
||||
// const SizedBox(
|
||||
// width: 10,
|
||||
// ),
|
||||
// Container(
|
||||
// decoration: BoxDecoration(
|
||||
// border: Border.all()),
|
||||
// child: Padding(
|
||||
// padding:
|
||||
// const EdgeInsets.all(
|
||||
// 3.0),
|
||||
// child: Text(
|
||||
// controller
|
||||
// .selectedPassengerCount
|
||||
// .toString(),
|
||||
// style: AppStyle.title),
|
||||
// ),
|
||||
// ),
|
||||
// ],
|
||||
// ),
|
||||
// ),
|
||||
|
||||
controller.isCashSelectedBeforeConfirmRide ==
|
||||
false
|
||||
? MyElevatedButton(
|
||||
|
||||
@@ -2,17 +2,20 @@ import 'package:flutter/material.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:ride/constant/box_name.dart';
|
||||
import 'package:ride/constant/style.dart';
|
||||
import 'package:ride/views/home/my_wallet/passenger_wallet.dart';
|
||||
|
||||
import '../../../constant/colors.dart';
|
||||
import '../../../controller/home/map_passenger_controller.dart';
|
||||
import '../../../controller/payment/payment_controller.dart';
|
||||
import '../../../main.dart';
|
||||
import '../../widgets/elevated_btn.dart';
|
||||
import '../my_wallet/passenger_wallet_dialoge.dart';
|
||||
|
||||
class CashConfirmPageShown extends StatelessWidget {
|
||||
const CashConfirmPageShown({
|
||||
CashConfirmPageShown({
|
||||
super.key,
|
||||
});
|
||||
|
||||
PaymentController paymentController = Get.put(PaymentController());
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return GetBuilder<MapPassengerController>(
|
||||
@@ -39,11 +42,11 @@ class CashConfirmPageShown extends StatelessWidget {
|
||||
'Payment Method'.tr,
|
||||
style: AppStyle.title.copyWith(fontSize: 22),
|
||||
),
|
||||
IconButton(
|
||||
onPressed: () =>
|
||||
controller.changeCashConfirmPageShown(),
|
||||
icon: const Icon(Icons.close),
|
||||
),
|
||||
// IconButton(
|
||||
// onPressed: () =>
|
||||
// controller.changeCashConfirmPageShown(),
|
||||
// icon: const Icon(Icons.close),
|
||||
// ),
|
||||
],
|
||||
),
|
||||
GetBuilder<PaymentController>(
|
||||
@@ -123,16 +126,38 @@ class CashConfirmPageShown extends StatelessWidget {
|
||||
height: 2,
|
||||
indent: 1,
|
||||
),
|
||||
// controller.cardNumber == null ||
|
||||
// controller.cardNumber!.isEmpty
|
||||
// ? MyElevatedButton(
|
||||
// title: 'Add Payment Method'.tr,
|
||||
// onPressed: () {
|
||||
// controller.changePaymentMethodPageShown();
|
||||
// CreditCardController().openPayment();
|
||||
// },
|
||||
// )
|
||||
// : const SizedBox()
|
||||
// GetBuilder<PaymentController>(
|
||||
// builder: (paymentController) =>
|
||||
// (paymentController.isWalletChecked == false &&
|
||||
// paymentController.isCashChecked == true
|
||||
// ? MyElevatedButton(
|
||||
// title: 'Next'.tr,
|
||||
// onPressed: () {
|
||||
// controller.changeCashConfirmPageShown();
|
||||
// },
|
||||
// )
|
||||
// : const SizedBox())),
|
||||
GetBuilder<PaymentController>(
|
||||
builder: (paymentController) => (box
|
||||
.read(BoxName.passengerWalletTotal) ==
|
||||
null ||
|
||||
double.parse(box
|
||||
.read(BoxName.passengerWalletTotal)) <
|
||||
controller.totalPassenger)
|
||||
? MyElevatedButton(
|
||||
title: 'To use Wallet charge it'.tr,
|
||||
onPressed: () {
|
||||
Get.to(() => const PassengerWallet());
|
||||
},
|
||||
kolor: AppColor.redColor,
|
||||
)
|
||||
: MyElevatedButton(
|
||||
title: 'Next'.tr,
|
||||
onPressed: () {
|
||||
controller.changeCashConfirmPageShown();
|
||||
},
|
||||
), // Add a fallback widget if none of the conditions are met
|
||||
)
|
||||
],
|
||||
),
|
||||
),
|
||||
|
||||
@@ -4,6 +4,7 @@ import 'package:get/get.dart';
|
||||
import 'package:ride/constant/box_name.dart';
|
||||
import 'package:ride/controller/functions/secure_storage.dart';
|
||||
import 'package:ride/controller/home/payment/credit_card_controller.dart';
|
||||
import 'package:ride/main.dart';
|
||||
import 'package:ride/views/widgets/elevated_btn.dart';
|
||||
|
||||
import '../../../constant/colors.dart';
|
||||
@@ -76,7 +77,7 @@ class PaymentMethodPage extends StatelessWidget {
|
||||
const SizedBox(
|
||||
height: 10,
|
||||
),
|
||||
const CreditCardWidget(),
|
||||
const MyCreditCardWidget(),
|
||||
const Spacer(),
|
||||
GetBuilder<CreditCardController>(
|
||||
builder: (controller) => Row(
|
||||
@@ -115,8 +116,8 @@ class PaymentMethodPage extends StatelessWidget {
|
||||
}
|
||||
}
|
||||
|
||||
class CreditCardWidget extends StatelessWidget {
|
||||
const CreditCardWidget({
|
||||
class MyCreditCardWidget extends StatelessWidget {
|
||||
const MyCreditCardWidget({
|
||||
super.key,
|
||||
});
|
||||
|
||||
@@ -125,11 +126,20 @@ class CreditCardWidget extends StatelessWidget {
|
||||
Get.put(CreditCardController());
|
||||
return GetBuilder<CreditCardController>(
|
||||
builder: (controller) => Container(
|
||||
height: Get.height * .3,
|
||||
height: Get.height * .35,
|
||||
width: Get.width * .9,
|
||||
decoration: const BoxDecoration(
|
||||
color: AppColor.secondaryColor,
|
||||
borderRadius: BorderRadius.all(Radius.circular(15)),
|
||||
gradient: LinearGradient(colors: [
|
||||
AppColor.secondaryColor,
|
||||
// AppColor.blueColor,
|
||||
// AppColor.greenColor,
|
||||
AppColor.accentColor,
|
||||
// AppColor.primaryColor,
|
||||
// AppColor.redColor,
|
||||
// AppColor.yellowColor
|
||||
]),
|
||||
boxShadow: [
|
||||
BoxShadow(
|
||||
spreadRadius: 3,
|
||||
@@ -148,7 +158,7 @@ class CreditCardWidget extends StatelessWidget {
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.all(8.0),
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceAround,
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
SizedBox(
|
||||
child: Row(
|
||||
@@ -156,22 +166,33 @@ class CreditCardWidget extends StatelessWidget {
|
||||
getCardIcon(controller.cardNumberController
|
||||
.text), // Dynamic credit card icon
|
||||
SizedBox(
|
||||
width: Get.width * .1,
|
||||
width: Get.width * .03,
|
||||
),
|
||||
SizedBox(
|
||||
width: Get.width * .6,
|
||||
width: Get.width * .25,
|
||||
child: Text(
|
||||
'Card Number',
|
||||
style: AppStyle.title,
|
||||
),
|
||||
),
|
||||
SizedBox(
|
||||
width: Get.width * .03,
|
||||
),
|
||||
SizedBox(
|
||||
width: Get.width * .4,
|
||||
height: 70,
|
||||
child: TextFormField(
|
||||
maxLength: 16,
|
||||
keyboardType: TextInputType.number,
|
||||
controller: controller.cardNumberController,
|
||||
style: const TextStyle(
|
||||
color: AppColor.blueColor,
|
||||
fontFamily: 'digital-counter-7',
|
||||
fontWeight: FontWeight.bold),
|
||||
decoration: const InputDecoration(
|
||||
helperStyle: TextStyle(
|
||||
fontFamily: 'digital-counter-7'),
|
||||
labelText: 'Card Number',
|
||||
// labelText: 'Card Number',
|
||||
),
|
||||
inputFormatters: [DigitObscuringFormatter()],
|
||||
validator: (value) {
|
||||
@@ -190,19 +211,30 @@ class CreditCardWidget extends StatelessWidget {
|
||||
children: [
|
||||
const Icon(Icons.person),
|
||||
SizedBox(
|
||||
width: Get.width * .1,
|
||||
width: Get.width * .03,
|
||||
),
|
||||
SizedBox(
|
||||
width: Get.width * .6,
|
||||
width: Get.width * .25,
|
||||
child: Text(
|
||||
'Holder Name',
|
||||
style: AppStyle.title,
|
||||
),
|
||||
),
|
||||
SizedBox(
|
||||
width: Get.width * .03,
|
||||
),
|
||||
SizedBox(
|
||||
width: Get.width * .3,
|
||||
child: SizedBox(
|
||||
height: 50,
|
||||
// height: 50,
|
||||
child: TextFormField(
|
||||
style: AppStyle.title,
|
||||
keyboardType: TextInputType.text,
|
||||
// maxLength: 16,
|
||||
controller: controller.cardHolderNameController,
|
||||
decoration: const InputDecoration(
|
||||
labelText: 'Cardholder Name'),
|
||||
// labelText: 'Cardholder Name',
|
||||
),
|
||||
validator: (value) {
|
||||
if (value!.isEmpty) {
|
||||
return 'Please enter the cardholder name'
|
||||
@@ -224,28 +256,40 @@ class CreditCardWidget extends StatelessWidget {
|
||||
children: [
|
||||
const Icon(Icons.date_range_outlined),
|
||||
SizedBox(
|
||||
width: Get.width * .1,
|
||||
width: Get.width * .03,
|
||||
),
|
||||
SizedBox(
|
||||
width: Get.width * .2,
|
||||
child: SizedBox(
|
||||
height: 60,
|
||||
child: TextFormField(
|
||||
keyboardType: TextInputType.datetime,
|
||||
controller:
|
||||
controller.expiryDateController,
|
||||
decoration: const InputDecoration(
|
||||
labelText: 'Expiry Date'),
|
||||
validator: (value) {
|
||||
if (value!.isEmpty) {
|
||||
return 'Please enter the expiry date'
|
||||
.tr;
|
||||
}
|
||||
return null;
|
||||
},
|
||||
Column(
|
||||
children: [
|
||||
SizedBox(
|
||||
width: Get.width * .2,
|
||||
child: Text(
|
||||
'Expiry Date',
|
||||
style: AppStyle.subtitle,
|
||||
),
|
||||
),
|
||||
),
|
||||
)
|
||||
SizedBox(
|
||||
width: Get.width * .1,
|
||||
child: SizedBox(
|
||||
height: 60,
|
||||
child: TextFormField(
|
||||
maxLength: 4,
|
||||
keyboardType: TextInputType.datetime,
|
||||
controller:
|
||||
controller.expiryDateController,
|
||||
style: AppStyle.title,
|
||||
decoration: const InputDecoration(),
|
||||
validator: (value) {
|
||||
if (value!.isEmpty) {
|
||||
return 'Please enter the expiry date'
|
||||
.tr;
|
||||
}
|
||||
return null;
|
||||
},
|
||||
),
|
||||
),
|
||||
)
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
@@ -257,50 +301,76 @@ class CreditCardWidget extends StatelessWidget {
|
||||
SizedBox(
|
||||
width: Get.width * .021,
|
||||
),
|
||||
SizedBox(
|
||||
width: Get.width * .2,
|
||||
child: SizedBox(
|
||||
height: 60,
|
||||
child: TextFormField(
|
||||
obscureText: true,
|
||||
keyboardType: TextInputType.number,
|
||||
style: const TextStyle(
|
||||
fontFamily: 'digital-counter-7'),
|
||||
maxLength: 3,
|
||||
controller: controller.cvvCodeController,
|
||||
decoration: const InputDecoration(
|
||||
labelText: 'CVV Code'),
|
||||
validator: (value) {
|
||||
if (value!.isEmpty &&
|
||||
value.length != 3) {
|
||||
return 'Please enter the CVV code'.tr;
|
||||
}
|
||||
return null;
|
||||
},
|
||||
Column(
|
||||
children: [
|
||||
SizedBox(
|
||||
width: Get.width * .2,
|
||||
child: Text(
|
||||
'CVV Code',
|
||||
style: AppStyle.subtitle,
|
||||
),
|
||||
),
|
||||
),
|
||||
SizedBox(
|
||||
width: Get.width * .2,
|
||||
child: SizedBox(
|
||||
height: 60,
|
||||
child: TextFormField(
|
||||
obscureText: true,
|
||||
keyboardType: TextInputType.number,
|
||||
style: const TextStyle(
|
||||
color: AppColor.primaryColor,
|
||||
fontFamily: 'digital-counter-7'),
|
||||
maxLength: 3,
|
||||
controller:
|
||||
controller.cvvCodeController,
|
||||
decoration: const InputDecoration(
|
||||
// labelText: 'CVV Code',
|
||||
),
|
||||
validator: (value) {
|
||||
if (value!.isEmpty &&
|
||||
value.length != 3) {
|
||||
return 'Please enter the CVV code'
|
||||
.tr;
|
||||
}
|
||||
return null;
|
||||
},
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
)
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
// MyElevatedButton(
|
||||
// title: 'Save'.tr,
|
||||
// onPressed: () {
|
||||
// if (controller.formKey.currentState!.validate()) {
|
||||
// final creditCard = CreditCardModel(
|
||||
// cardNumber: controller.cardNumberController.text,
|
||||
// cardHolderName:
|
||||
// controller.cardHolderNameController.text,
|
||||
// expiryDate: controller.expiryDateController.text,
|
||||
// cvvCode: controller.cvvCodeController.text,
|
||||
// );
|
||||
// // Process the credit card details
|
||||
// // You can use GetX to handle the logic here
|
||||
// }
|
||||
// },
|
||||
// ),
|
||||
MyElevatedButton(
|
||||
title: 'Save'.tr,
|
||||
onPressed: () {
|
||||
if (controller.formKey.currentState!.validate()) {
|
||||
// final creditCard = CreditCardModel(
|
||||
// cardNumber: controller.cardNumberController.text,
|
||||
// cardHolderName:
|
||||
// controller.cardHolderNameController.text,
|
||||
// expiryDate: controller.expiryDateController.text,
|
||||
// cvvCode: controller.cvvCodeController.text,
|
||||
// );
|
||||
// Process the credit card details
|
||||
// You can use GetX to handle the logic here
|
||||
|
||||
if (controller.formKey.currentState!.validate()) {
|
||||
SecureStorage().saveData(BoxName.cardNumber,
|
||||
controller.cardNumberController.text);
|
||||
SecureStorage().saveData(BoxName.cardHolderName,
|
||||
controller.cardHolderNameController.text);
|
||||
SecureStorage().saveData(BoxName.cvvCode,
|
||||
controller.cvvCodeController.text);
|
||||
SecureStorage().saveData(BoxName.expiryDate,
|
||||
controller.expiryDateController.text);
|
||||
}
|
||||
}
|
||||
},
|
||||
),
|
||||
],
|
||||
),
|
||||
))));
|
||||
|
||||
Reference in New Issue
Block a user