12/3/1
This commit is contained in:
@@ -1,21 +1,19 @@
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
import 'package:get/get.dart';
|
||||
import 'package:ride/constant/links.dart';
|
||||
import 'package:ride/constant/style.dart';
|
||||
import 'package:ride/controller/functions/crud.dart';
|
||||
import 'package:ride/controller/functions/toast.dart';
|
||||
import 'package:ride/controller/payment/payment_controller.dart';
|
||||
import 'package:ride/views/widgets/my_scafold.dart';
|
||||
import 'package:flutter_paypal/flutter_paypal.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';
|
||||
import '../../widgets/elevated_btn.dart';
|
||||
import '../../widgets/my_scafold.dart';
|
||||
import '../map_widget.dart/payment_method.page.dart';
|
||||
import 'passenger_wallet_dialoge.dart';
|
||||
|
||||
class PassengerWallet extends StatelessWidget {
|
||||
const PassengerWallet({super.key});
|
||||
@@ -62,14 +60,11 @@ class PassengerWallet extends StatelessWidget {
|
||||
child:
|
||||
box.read(BoxName.passengerWalletTotal) == null
|
||||
? Text(
|
||||
'You Dont Have Any amount in'.tr +
|
||||
' ${AppInformation.appName}' +
|
||||
'Wallet!'.tr,
|
||||
'${'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',
|
||||
'${'You Have'.tr} ${box.read(BoxName.passengerWalletTotal).toString()} JD in ${AppInformation.appName} Wallet',
|
||||
style: AppStyle.title,
|
||||
),
|
||||
),
|
||||
@@ -79,7 +74,7 @@ class PassengerWallet extends StatelessWidget {
|
||||
const SizedBox(
|
||||
height: 30,
|
||||
),
|
||||
const CreditCardWidget(),
|
||||
const MyCreditCardWidget(),
|
||||
const SizedBox(
|
||||
height: 10,
|
||||
),
|
||||
@@ -202,158 +197,7 @@ class PassengerWallet extends StatelessWidget {
|
||||
},
|
||||
),
|
||||
)),
|
||||
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',
|
||||
() => Get.snackbar('Hi', ''));
|
||||
} 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()),
|
||||
)
|
||||
PassengerWalletDialoge()
|
||||
],
|
||||
);
|
||||
}
|
||||
|
||||
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()),
|
||||
);
|
||||
}
|
||||
}
|
||||
58
lib/views/home/my_wallet/points_captain.dart
Normal file
58
lib/views/home/my_wallet/points_captain.dart
Normal file
@@ -0,0 +1,58 @@
|
||||
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/home/payment/captain_wallet_controller.dart';
|
||||
import 'package:ride/controller/payment/payment_controller.dart';
|
||||
|
||||
class PointsCaptain extends StatelessWidget {
|
||||
PaymentController paymentController = Get.put(PaymentController());
|
||||
CaptainWalletController captainWalletController =
|
||||
Get.put(CaptainWalletController());
|
||||
|
||||
PointsCaptain({
|
||||
super.key,
|
||||
required this.kolor,
|
||||
required this.countPoint,
|
||||
required this.pricePoint,
|
||||
});
|
||||
final Color kolor;
|
||||
final String countPoint;
|
||||
int pricePoint;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return InkWell(
|
||||
onTap: () async {
|
||||
await paymentController.makePaymentStripe(pricePoint, 'USD', () async {
|
||||
await captainWalletController.addDriverPayment('visa', pricePoint);
|
||||
await captainWalletController.addDriverWallet('visa', countPoint);
|
||||
});
|
||||
},
|
||||
child: Container(
|
||||
width: Get.width * .2,
|
||||
height: Get.width * .2,
|
||||
margin: const EdgeInsets.all(4),
|
||||
decoration: BoxDecoration(
|
||||
color: kolor,
|
||||
border: Border.all(color: AppColor.accentColor),
|
||||
borderRadius: BorderRadius.circular(12),
|
||||
shape: BoxShape.rectangle,
|
||||
),
|
||||
child: Center(
|
||||
child: Column(
|
||||
children: [
|
||||
Text(
|
||||
'$countPoint Point',
|
||||
style: AppStyle.subtitle,
|
||||
),
|
||||
Text(
|
||||
'$pricePoint\$',
|
||||
style: AppStyle.title,
|
||||
),
|
||||
],
|
||||
),
|
||||
)),
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -1,16 +1,97 @@
|
||||
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/home/payment/captain_wallet_controller.dart';
|
||||
import 'package:ride/controller/home/payment/credit_card_controller.dart';
|
||||
import 'package:ride/views/home/map_widget.dart/payment_method.page.dart';
|
||||
import 'package:ride/views/widgets/mycircular.dart';
|
||||
|
||||
import '../../../controller/payment/payment_controller.dart';
|
||||
import '../../widgets/my_scafold.dart';
|
||||
import 'points_captain.dart';
|
||||
|
||||
class WaletCaptain extends StatelessWidget {
|
||||
const WaletCaptain({super.key});
|
||||
|
||||
WaletCaptain({super.key});
|
||||
CaptainWalletController captainWalletController =
|
||||
Get.put(CaptainWalletController());
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
Get.put(CreditCardController());
|
||||
return MyScafolld(
|
||||
title: 'Wallet'.tr,
|
||||
body: [],
|
||||
title: 'Captain Wallet'.tr,
|
||||
body: [
|
||||
GetBuilder<CaptainWalletController>(
|
||||
builder: (captainWalletController) => captainWalletController
|
||||
.isLoading
|
||||
? const MyCircularProgressIndicator()
|
||||
: Padding(
|
||||
padding: const EdgeInsets.all(20),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Card(
|
||||
elevation: 4,
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 4),
|
||||
child: Text(
|
||||
'Total Points is ${captainWalletController.totalPoints} 💎',
|
||||
style: AppStyle.headtitle2,
|
||||
),
|
||||
),
|
||||
),
|
||||
Card(
|
||||
elevation: 4,
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 4),
|
||||
child: Text(
|
||||
'Total Budget from trips is ${captainWalletController.totalAmount}\$',
|
||||
style: AppStyle.title,
|
||||
),
|
||||
),
|
||||
),
|
||||
Text(
|
||||
'You can buy Points to let you online\nby this list below'
|
||||
.tr,
|
||||
style: AppStyle.title,
|
||||
),
|
||||
const Divider(
|
||||
indent: 30,
|
||||
endIndent: 30,
|
||||
color: AppColor.accentColor,
|
||||
thickness: 3,
|
||||
),
|
||||
Container(
|
||||
decoration: AppStyle.boxDecoration,
|
||||
height: Get.height * .120,
|
||||
child: Row(
|
||||
children: [
|
||||
PointsCaptain(
|
||||
kolor: AppColor.blueColor,
|
||||
pricePoint: 5,
|
||||
countPoint: '500',
|
||||
),
|
||||
PointsCaptain(
|
||||
kolor: Colors.green,
|
||||
pricePoint: 10,
|
||||
countPoint: '1040',
|
||||
),
|
||||
PointsCaptain(
|
||||
kolor: Colors.amberAccent,
|
||||
pricePoint: 20,
|
||||
countPoint: '2100',
|
||||
),
|
||||
PointsCaptain(
|
||||
kolor: AppColor.yellowColor,
|
||||
pricePoint: 50,
|
||||
countPoint: '50400',
|
||||
),
|
||||
],
|
||||
)),
|
||||
],
|
||||
),
|
||||
))
|
||||
],
|
||||
isleading: true,
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user