12/3/1
This commit is contained in:
168
lib/views/home/my_wallet/passenger_wallet_dialoge.dart
Normal file
168
lib/views/home/my_wallet/passenger_wallet_dialoge.dart
Normal file
@@ -0,0 +1,168 @@
|
||||
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/functions/toast.dart';
|
||||
import 'package:ride/controller/payment/payment_controller.dart';
|
||||
import 'package:ride/views/widgets/elevated_btn.dart';
|
||||
|
||||
class PassengerWalletDialoge extends StatelessWidget {
|
||||
const PassengerWalletDialoge({
|
||||
super.key,
|
||||
});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return GetBuilder<PaymentController>(
|
||||
builder: (controller) => Positioned(
|
||||
top: Get.height * .2,
|
||||
right: Get.width * .15,
|
||||
left: Get.width * .15,
|
||||
bottom: Get.height * .2,
|
||||
child: controller.isPromoSheetDialogue
|
||||
? 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(6),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
children: [
|
||||
GestureDetector(
|
||||
onTap: () {
|
||||
controller.updateSelectedAmount(10);
|
||||
},
|
||||
child: Row(
|
||||
children: [
|
||||
Radio(
|
||||
value: 10,
|
||||
groupValue: controller.selectedAmount,
|
||||
onChanged: (value) {
|
||||
controller.updateSelectedAmount(value as int);
|
||||
},
|
||||
),
|
||||
Text(
|
||||
'10 and get 4% discount'.tr,
|
||||
style: AppStyle.title,
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
GestureDetector(
|
||||
onTap: () {
|
||||
controller.updateSelectedAmount(20);
|
||||
},
|
||||
child: Row(
|
||||
children: [
|
||||
Radio(
|
||||
value: 20,
|
||||
groupValue: controller.selectedAmount,
|
||||
onChanged: (value) {
|
||||
controller
|
||||
.updateSelectedAmount(value as int);
|
||||
},
|
||||
),
|
||||
Text(
|
||||
'20 and get 6% discount'.tr,
|
||||
style: AppStyle.title,
|
||||
),
|
||||
],
|
||||
)),
|
||||
GestureDetector(
|
||||
onTap: () {
|
||||
controller.updateSelectedAmount(40);
|
||||
},
|
||||
child: Row(
|
||||
children: [
|
||||
Radio(
|
||||
value: 40,
|
||||
groupValue: controller.selectedAmount,
|
||||
onChanged: (value) {
|
||||
controller
|
||||
.updateSelectedAmount(value as int);
|
||||
},
|
||||
),
|
||||
Text(
|
||||
'40 and get 8% discount'.tr,
|
||||
style: AppStyle.title,
|
||||
),
|
||||
],
|
||||
)),
|
||||
GestureDetector(
|
||||
onTap: () {
|
||||
controller.updateSelectedAmount(100);
|
||||
},
|
||||
child: Row(
|
||||
children: [
|
||||
Radio(
|
||||
value: 100,
|
||||
groupValue: controller.selectedAmount,
|
||||
onChanged: (value) {
|
||||
controller
|
||||
.updateSelectedAmount(value as int);
|
||||
},
|
||||
),
|
||||
Text(
|
||||
'100 and get 11% discount'.tr,
|
||||
style: AppStyle.title,
|
||||
),
|
||||
],
|
||||
)),
|
||||
const Spacer(),
|
||||
MyElevatedButton(
|
||||
title: 'Pay with Your PayPal'.tr,
|
||||
onPressed: () {
|
||||
if (controller.selectedAmount != 0) {
|
||||
controller.makePaymentPayPal(context);
|
||||
} else {
|
||||
Toast.show(
|
||||
context,
|
||||
'You will choose one of above !'.tr,
|
||||
AppColor.redColor);
|
||||
}
|
||||
},
|
||||
),
|
||||
MyElevatedButton(
|
||||
title: 'Pay with Credit Card'.tr,
|
||||
onPressed: () {
|
||||
if (controller.selectedAmount != 0) {
|
||||
controller.makePaymentStripe(
|
||||
controller.selectedAmount as int,
|
||||
'USD',
|
||||
() => controller.addPassengerWallet());
|
||||
} else {
|
||||
Toast.show(
|
||||
context,
|
||||
'You will choose one of above !'.tr,
|
||||
AppColor.redColor);
|
||||
}
|
||||
}),
|
||||
MyElevatedButton(
|
||||
title: 'Cancel'.tr,
|
||||
kolor: AppColor.redColor,
|
||||
onPressed: () {
|
||||
controller.changePromoSheetDialogue();
|
||||
},
|
||||
),
|
||||
],
|
||||
),
|
||||
))
|
||||
: const SizedBox()),
|
||||
);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user