This commit is contained in:
Hamza-Ayed
2024-05-29 16:09:37 +03:00
parent 058fb67a41
commit 4af52f4392
44 changed files with 9509 additions and 2044 deletions

View File

@@ -34,6 +34,10 @@ class PointsCaptain extends StatelessWidget {
titleStyle: AppStyle.title,
content: Column(
children: [
Text(
'${'you can buy '.tr}$countPoint ${'LE'.tr}${'by '.tr}${'$pricePoint'.tr}',
style: AppStyle.title,
),
MyElevatedButton(
title: '💳 Pay with Credit Card'.tr,
onPressed: () async {
@@ -55,7 +59,7 @@ class PointsCaptain extends StatelessWidget {
),
// Add some spacing between buttons
MyElevatedButton(
kolor: AppColor.yellowColor,
kolor: AppColor.redColor,
title: '💰 Pay with Wallet'.tr,
onPressed: () async {
Get.back();
@@ -86,30 +90,34 @@ class PointsCaptain extends StatelessWidget {
await captainWalletController.getCaptainWalletFromBuyPoints();
});
},
child: Container(
width: Get.width * .22,
height: Get.width * .15,
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'.tr}',
style: AppStyle.subtitle,
),
Text(
'$pricePoint ${box.read(BoxName.countryCode) == 'Jordan' ? 'JOD'.tr : 'LE'.tr}',
style: AppStyle.title,
),
],
child: Padding(
padding: const EdgeInsets.symmetric(horizontal: 3, vertical: 8),
child: Container(
width: Get.width * .22,
height: Get.width * .22,
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'.tr}',
style: AppStyle.subtitle,
),
Text(
'$pricePoint ${box.read(BoxName.countryCode) == 'Jordan' ? 'JOD'.tr : 'LE'.tr}',
style: AppStyle.title,
textAlign: TextAlign.center,
),
],
),
)),
),
);
}
}

View File

@@ -1,4 +1,5 @@
import 'package:SEFER/controller/functions/tts.dart';
import 'package:SEFER/controller/home/captin/map_driver_controller.dart';
import 'package:SEFER/views/home/my_wallet/payment_history_driver_page.dart';
import 'package:flutter/material.dart';
import 'package:get/get.dart';
@@ -14,8 +15,10 @@ import 'package:SEFER/views/widgets/my_textField.dart';
import 'package:SEFER/views/widgets/mycircular.dart';
import 'package:path/path.dart';
import '../../../controller/payment/driver_payment_controller.dart';
import '../../widgets/my_scafold.dart';
import 'points_captain.dart';
import 'weekly_payment_page.dart';
class WalletCaptain extends StatelessWidget {
WalletCaptain({super.key});
@@ -23,7 +26,7 @@ class WalletCaptain extends StatelessWidget {
Get.put(CaptainWalletController());
@override
Widget build(BuildContext context) {
// Get.put(MapPassengerController());
Get.put(MapDriverController()).totalPassenger = '0';
return MyScafolld(
title: 'Driver Wallet'.tr,
body: [
@@ -38,20 +41,20 @@ class WalletCaptain extends StatelessWidget {
children: [
const SizedBox(),
Container(
decoration: AppStyle.boxDecoration.copyWith(
color: double.parse(captainWalletController
.totalPoints) <
0 &&
double.parse(captainWalletController
.totalPoints) >
-300
? AppColor.yellowColor
: double.parse(captainWalletController
.totalPoints) <
-300
? AppColor.redColor
: AppColor.greenColor,
),
// decoration: AppStyle.boxDecoration1.copyWith(
color: double.parse(
captainWalletController.totalPoints) <
0 &&
double.parse(
captainWalletController.totalPoints) >
-300
? AppColor.yellowColor
: double.parse(
captainWalletController.totalPoints) <
-300
? AppColor.redColor
: AppColor.greenColor,
// ),
child: InkWell(
onTap: () {
Get.snackbar(
@@ -69,6 +72,7 @@ class WalletCaptain extends StatelessWidget {
child: Text(
'${'Total Points is'.tr} ${captainWalletController.totalPoints.toString()} 💎',
style: AppStyle.headTitle2,
textAlign: TextAlign.center,
),
),
),
@@ -111,8 +115,8 @@ class WalletCaptain extends StatelessWidget {
Get.snackbar(
icon: InkWell(
onTap: () async {
await Get.find<
TextToSpeechController>()
await Get.put(
TextToSpeechController())
.speakText(
'This amount for all trip I get from Passengers'
.tr);
@@ -255,86 +259,89 @@ class WalletCaptain extends StatelessWidget {
const SizedBox(
height: 10,
),
Container(
decoration: AppStyle.boxDecoration,
child: Column(
children: [
Text(
'You can buy Points to let you online\nby this list below'
.tr,
textAlign: TextAlign.center,
style: AppStyle.title,
),
const Divider(
indent: 30,
endIndent: 30,
color: AppColor.accentColor,
thickness: 3,
),
const SizedBox(
height: 10,
),
Container(
decoration: AppStyle.boxDecoration,
height: Get.height * .1,
child: ListView(
scrollDirection: Axis.horizontal,
children: [
PointsCaptain(
kolor: AppColor.blueColor,
pricePoint:
box.read(BoxName.countryCode) ==
'Jordan'
? 5
: 100,
countPoint:
box.read(BoxName.countryCode) ==
'Jordan'
? '300'
: '100',
),
PointsCaptain(
kolor: Colors.green,
pricePoint:
box.read(BoxName.countryCode) ==
'Jordan'
? 10
: 200,
countPoint:
box.read(BoxName.countryCode) ==
'Jordan'
? '1040'
: '210',
),
PointsCaptain(
kolor: Colors.amberAccent,
pricePoint:
box.read(BoxName.countryCode) ==
'Jordan'
? 22
: 400,
countPoint:
box.read(BoxName.countryCode) ==
'Jordan'
? '2300'
: '450',
),
PointsCaptain(
kolor: AppColor.yellowColor,
pricePoint:
box.read(BoxName.countryCode) ==
'Jordan'
? 50
: 1000,
countPoint:
box.read(BoxName.countryCode) ==
'Jordan'
? '55000'
: '1200',
),
],
)),
],
Padding(
padding: const EdgeInsets.all(8.0),
child: Container(
decoration: AppStyle.boxDecoration,
child: Column(
children: [
Text(
'You can buy Points to let you online\nby this list below'
.tr,
textAlign: TextAlign.center,
style: AppStyle.title,
),
const Divider(
indent: 30,
endIndent: 30,
color: AppColor.accentColor,
thickness: 3,
),
const SizedBox(
height: 10,
),
Container(
decoration: AppStyle.boxDecoration,
height: Get.height * .19,
child: ListView(
scrollDirection: Axis.horizontal,
children: [
PointsCaptain(
kolor: AppColor.blueColor,
pricePoint:
box.read(BoxName.countryCode) ==
'Jordan'
? 5
: 100,
countPoint:
box.read(BoxName.countryCode) ==
'Jordan'
? '300'
: '100',
),
PointsCaptain(
kolor: Colors.green,
pricePoint:
box.read(BoxName.countryCode) ==
'Jordan'
? 10
: 200,
countPoint:
box.read(BoxName.countryCode) ==
'Jordan'
? '1040'
: '210',
),
PointsCaptain(
kolor: Colors.amberAccent,
pricePoint:
box.read(BoxName.countryCode) ==
'Jordan'
? 22
: 400,
countPoint:
box.read(BoxName.countryCode) ==
'Jordan'
? '2300'
: '450',
),
PointsCaptain(
kolor: AppColor.yellowColor,
pricePoint:
box.read(BoxName.countryCode) ==
'Jordan'
? 50
: 1000,
countPoint:
box.read(BoxName.countryCode) ==
'Jordan'
? '55000'
: '1200',
),
],
)),
],
),
),
),
const SizedBox(
@@ -362,17 +369,30 @@ class WalletCaptain extends StatelessWidget {
height: 30,
),
Padding(
padding: const EdgeInsets.symmetric(horizontal: 30),
padding: const EdgeInsets.symmetric(horizontal: 10),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceAround,
children: [
MyElevatedButton(
kolor: AppColor.blueColor,
title: 'Payment History'.tr,
onPressed: () {
onPressed: () async {
await Get.put(DriverWalletHistoryController())
.getArchivePayment();
Get.to(() => const PaymentHistoryDriverPage(),
transition: Transition.size);
},
),
MyElevatedButton(
kolor: AppColor.blueColor,
title: 'Weekly Budget'.tr,
onPressed: () async {
await Get.put(DriverWalletHistoryController())
.getWeekllyArchivePayment();
Get.to(() => const WeeklyPaymentPage(),
transition: Transition.size);
},
),
],
),
),

View File

@@ -0,0 +1,96 @@
import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:SEFER/constant/colors.dart';
import 'package:SEFER/constant/style.dart';
import 'package:SEFER/views/widgets/my_scafold.dart';
import 'package:SEFER/views/widgets/mycircular.dart';
import '../../../controller/payment/driver_payment_controller.dart';
class WeeklyPaymentPage extends StatelessWidget {
const WeeklyPaymentPage({super.key});
@override
Widget build(BuildContext context) {
Get.put(DriverWalletHistoryController());
return MyScafolld(
title: 'Payment History'.tr,
body: [
GetBuilder<DriverWalletHistoryController>(
builder: (controller) => controller.isLoading
? const MyCircularProgressIndicator()
: Column(
children: [
Container(
width: Get.width * .8,
decoration: AppStyle.boxDecoration1,
child: Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Container(
decoration: AppStyle.boxDecoration1,
child: Text(
controller.weeklyList[0]['totalAmount']
.toString(),
style: AppStyle.title,
),
),
Text(
' Total weekly points is '.tr,
style: AppStyle.title,
),
],
),
),
const SizedBox(
height: 10,
),
SizedBox(
height: Get.height * .8,
child: ListView.builder(
itemCount: controller.weeklyList.length,
itemBuilder: (BuildContext context, int index) {
var list = controller.weeklyList[index];
return Padding(
padding: const EdgeInsets.all(2.0),
child: Container(
decoration: AppStyle.boxDecoration1,
child: Padding(
padding: const EdgeInsets.all(4),
child: Row(
mainAxisAlignment:
MainAxisAlignment.spaceBetween,
children: [
Text(
list['amount'],
style: AppStyle.title,
),
Text(
list['dateUpdated'],
style: AppStyle.title,
),
Card(
elevation: 2,
color: list['paymentMethod'] == 'visa'
? AppColor.blueColor
: AppColor.secondaryColor,
child: Text(
list['paymentMethod'],
style: AppStyle.title,
),
),
],
),
),
),
);
},
),
),
],
),
)
],
isleading: true);
}
}