158 lines
6.8 KiB
Dart
158 lines
6.8 KiB
Dart
import 'package:flutter/material.dart';
|
|
import 'package:get/get.dart';
|
|
import 'package:ride/constant/box_name.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/controller/payment/payment_controller.dart';
|
|
import 'package:ride/main.dart';
|
|
import 'package:ride/views/widgets/elevated_btn.dart';
|
|
import 'package:ride/views/widgets/mycircular.dart';
|
|
|
|
import '../../widgets/my_scafold.dart';
|
|
import 'points_captain.dart';
|
|
|
|
class WaletCaptain extends StatelessWidget {
|
|
WaletCaptain({super.key});
|
|
CaptainWalletController captainWalletController =
|
|
Get.put(CaptainWalletController());
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
Get.put(CreditCardController());
|
|
return MyScafolld(
|
|
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: [
|
|
const SizedBox(),
|
|
Container(
|
|
decoration: AppStyle.boxDecoration.copyWith(
|
|
color: double.parse(
|
|
captainWalletController.totalPoints) <
|
|
100
|
|
? AppColor.redColor
|
|
: AppColor.greenColor,
|
|
),
|
|
child: Padding(
|
|
padding: const EdgeInsets.symmetric(horizontal: 4),
|
|
child: Text(
|
|
'Total Points is ${captainWalletController.totalPoints.toString()} 💎',
|
|
style: AppStyle.headTitle2,
|
|
),
|
|
),
|
|
),
|
|
const SizedBox(
|
|
height: 10,
|
|
),
|
|
double.parse(captainWalletController.totalPoints
|
|
.toString()) <
|
|
100
|
|
? MyElevatedButton(
|
|
title: 'Charge your Account', onPressed: () {})
|
|
: const SizedBox(),
|
|
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',
|
|
),
|
|
],
|
|
)),
|
|
const SizedBox(
|
|
height: 30,
|
|
),
|
|
box
|
|
.read(BoxName.accountIdStripeConnect)
|
|
.toString()
|
|
.isEmpty
|
|
? Row(
|
|
mainAxisAlignment: MainAxisAlignment.center,
|
|
children: [
|
|
MyElevatedButton(
|
|
title:
|
|
'Create Wallet to recive your money',
|
|
onPressed: () async {
|
|
PaymentController paymentController =
|
|
Get.find<PaymentController>();
|
|
paymentController
|
|
.createConnectAccount();
|
|
}),
|
|
],
|
|
)
|
|
: const SizedBox(
|
|
height: 30,
|
|
),
|
|
// TextButton(
|
|
// onPressed: () async {
|
|
// PaymentController paymentController =
|
|
// Get.put(PaymentController());
|
|
// await paymentController.createTransactionToCaptain(
|
|
// '1000',
|
|
// box.read(BoxName.accountIdStripeConnect));
|
|
// },
|
|
// child: const Text(
|
|
// "Pay to Captain",
|
|
// ),
|
|
// )
|
|
],
|
|
),
|
|
))
|
|
],
|
|
isleading: true,
|
|
action: InkWell(
|
|
onTap: () {
|
|
captainWalletController.getCaptainWalletFromBuyPoints();
|
|
},
|
|
child: const Icon(Icons.refresh)),
|
|
);
|
|
}
|
|
}
|