9/21/1
This commit is contained in:
@@ -146,6 +146,10 @@ class AppLink {
|
|||||||
static String checkPhoneNumberISVerfiedDriver =
|
static String checkPhoneNumberISVerfiedDriver =
|
||||||
"$auth/checkPhoneNumberISVerfiedDriver.php";
|
"$auth/checkPhoneNumberISVerfiedDriver.php";
|
||||||
|
|
||||||
|
//-----------------healthInsuranceProvider------------------
|
||||||
|
static String addHealthInsuranceProvider = "$server/driver_assurance/add.php";
|
||||||
|
static String getHealthInsuranceProvider = "$server/driver_assurance/get.php";
|
||||||
|
|
||||||
//-----------------Feed Back------------------
|
//-----------------Feed Back------------------
|
||||||
static String addFeedBack = "$ride/feedBack/add.php";
|
static String addFeedBack = "$ride/feedBack/add.php";
|
||||||
static String getFeedBack = "$ride/feedBack/get.php";
|
static String getFeedBack = "$ride/feedBack/get.php";
|
||||||
|
|||||||
66
lib/controller/home/captin/help/assurance_controller.dart
Normal file
66
lib/controller/home/captin/help/assurance_controller.dart
Normal file
@@ -0,0 +1,66 @@
|
|||||||
|
import 'dart:convert';
|
||||||
|
|
||||||
|
import 'package:SEFER/constant/box_name.dart';
|
||||||
|
import 'package:SEFER/constant/links.dart';
|
||||||
|
import 'package:SEFER/controller/functions/crud.dart';
|
||||||
|
import 'package:SEFER/main.dart';
|
||||||
|
import 'package:get/get.dart';
|
||||||
|
|
||||||
|
import '../../../../constant/colors.dart';
|
||||||
|
|
||||||
|
class AssuranceHealthController extends GetxController {
|
||||||
|
bool isLoading = false;
|
||||||
|
Map tripCount = {};
|
||||||
|
|
||||||
|
Future getTripCountByCaptain() async {
|
||||||
|
var res = await CRUD().get(link: AppLink.getTripCountByCaptain, payload: {
|
||||||
|
"driver_id": box.read(BoxName.driverID).toString(),
|
||||||
|
});
|
||||||
|
if (res != 'failure') {
|
||||||
|
tripCount = jsonDecode(res)['message'];
|
||||||
|
update();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Future<void> addDriverHealthAssurance({
|
||||||
|
String? driverId,
|
||||||
|
String? assured,
|
||||||
|
required String healthInsuranceProvider,
|
||||||
|
}) async {
|
||||||
|
// Define the URL to your PHP backend
|
||||||
|
|
||||||
|
// Data to be sent to the backend
|
||||||
|
Map<String, String> data = {
|
||||||
|
"driver_id": box.read(BoxName.driverID).toString(),
|
||||||
|
"assured": '1',
|
||||||
|
"health_insurance_provider": healthInsuranceProvider,
|
||||||
|
};
|
||||||
|
|
||||||
|
try {
|
||||||
|
// Send the POST request to your backend
|
||||||
|
var response = await CRUD()
|
||||||
|
.post(link: AppLink.addHealthInsuranceProvider, payload: data);
|
||||||
|
|
||||||
|
if (response != 'failure') {
|
||||||
|
// Handle success (e.g., show a success message)
|
||||||
|
print("Health assurance data saved successfully");
|
||||||
|
Get.snackbar(
|
||||||
|
"Success".tr,
|
||||||
|
"You have successfully opted for health insurance.".tr,
|
||||||
|
backgroundColor: AppColor.greenColor,
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
// Handle failure (e.g., show an error message)
|
||||||
|
print("Failed to save health assurance data");
|
||||||
|
Get.snackbar(
|
||||||
|
"Error".tr,
|
||||||
|
"Please enter a health insurance status.".tr,
|
||||||
|
backgroundColor: AppColor.redColor,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
} catch (e) {
|
||||||
|
// Handle any errors
|
||||||
|
print("Error: $e");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -8,6 +8,28 @@ class MyTranslation extends Translations {
|
|||||||
'إذا كنت بحاجة إلى أي مساعدة أو لديك أي أسئلة، فهذا هو المكان المناسب لذلك. أهلاً وسهلاً بك!',
|
'إذا كنت بحاجة إلى أي مساعدة أو لديك أي أسئلة، فهذا هو المكان المناسب لذلك. أهلاً وسهلاً بك!',
|
||||||
'ID Mismatch': "عدم تطابق الرقم التعريفي",
|
'ID Mismatch': "عدم تطابق الرقم التعريفي",
|
||||||
"face detect": "كشف الوجه",
|
"face detect": "كشف الوجه",
|
||||||
|
"Would you like to proceed with health insurance?":
|
||||||
|
"هل ترغب في الاستمرار مع التأمين الصحي؟",
|
||||||
|
"Confirmation": "تأكيد",
|
||||||
|
"Enter Health Insurance Provider": "أدخل مزود التأمين الصحي",
|
||||||
|
"Yes": "نعم",
|
||||||
|
"No": "لا",
|
||||||
|
"You need to complete 500 trips": "يجب عليك إكمال 500 رحلة",
|
||||||
|
"Please enter a valid insurance provider":
|
||||||
|
"الرجاء إدخال مزود تأمين صالح",
|
||||||
|
"Opted out": "اختيار عدم الاستمرار",
|
||||||
|
"You have chosen not to proceed with health insurance.":
|
||||||
|
"لقد اخترت عدم الاستمرار مع التأمين الصحي.",
|
||||||
|
"Do you have a disease for a long time?":
|
||||||
|
"هل لديك مرض منذ فترة طويلة؟",
|
||||||
|
|
||||||
|
"When you complete 500 trips, you will be eligible for exclusive health insurance offers.":
|
||||||
|
"عند إكمال 500 رحلة، ستكون مؤهلاً للحصول على عروض حصرية للتأمين الصحي.",
|
||||||
|
"We have partnered with health insurance providers to offer you special health coverage. Complete 500 trips and receive a 20% discount on health insurance premiums.":
|
||||||
|
"لقد عقدنا شراكة مع مزودي التأمين الصحي لتقديم تغطية صحية خاصة لك. أكمل 500 رحلة واحصل على خصم 20% على أقساط التأمين الصحي.",
|
||||||
|
"Show health insurance providers near me":
|
||||||
|
"اعرض مزودي التأمين الصحي القريبين مني",
|
||||||
|
"Health Insurance": "التأمين الصحي",
|
||||||
'An error occurred while saving driver data':
|
'An error occurred while saving driver data':
|
||||||
"حدث خطأ أثناء حفظ بيانات السائق",
|
"حدث خطأ أثناء حفظ بيانات السائق",
|
||||||
"Face Detection Result": "نتيجة كشف الوجه",
|
"Face Detection Result": "نتيجة كشف الوجه",
|
||||||
@@ -127,6 +149,17 @@ class MyTranslation extends Translations {
|
|||||||
"Afternoon Promo Rides": "رحلات بونص بعد الظهر",
|
"Afternoon Promo Rides": "رحلات بونص بعد الظهر",
|
||||||
"Heading your way now. Please be ready.":
|
"Heading your way now. Please be ready.":
|
||||||
"في طريقي إليك الآن. يرجى الاستعداد.",
|
"في طريقي إليك الآن. يرجى الاستعداد.",
|
||||||
|
"Alert": "تنبيه",
|
||||||
|
"You have successfully opted for health insurance.":
|
||||||
|
"لقد اخترت التأمين الصحي بنجاح.",
|
||||||
|
"Please enter a health insurance status.":
|
||||||
|
"يرجى إدخال حالة التأمين الصحي",
|
||||||
|
"The 3000 points equal 3000 L.E for you \nSo go and gain your money":
|
||||||
|
"3000 نقطة تساوي 3000 جنيه لك \nلذا اذهب واحصل على أموالك",
|
||||||
|
"Info": "معلومات",
|
||||||
|
"You dont have money in your Wallet": "ليس لديك أموال في محفظتك",
|
||||||
|
"You dont have money in your Wallet or you should less transfer 5 LE to activate":
|
||||||
|
"ليس لديك أموال في محفظتك أو يجب عليك تحويل 5 جنيهات على الأقل لتفعيل الحساب",
|
||||||
"Approaching your area. Should be there in 3 minutes.":
|
"Approaching your area. Should be there in 3 minutes.":
|
||||||
"اقترب من منطقتك. يجب أن أكون هناك خلال 3 دقائق.",
|
"اقترب من منطقتك. يجب أن أكون هناك خلال 3 دقائق.",
|
||||||
"There's heavy traffic here. Can you suggest an alternate pickup point?":
|
"There's heavy traffic here. Can you suggest an alternate pickup point?":
|
||||||
|
|||||||
227
lib/views/home/Captin/assurance_health_page.dart
Normal file
227
lib/views/home/Captin/assurance_health_page.dart
Normal file
@@ -0,0 +1,227 @@
|
|||||||
|
import 'package:SEFER/constant/box_name.dart';
|
||||||
|
import 'package:SEFER/main.dart';
|
||||||
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:get/get.dart';
|
||||||
|
|
||||||
|
import '../../../constant/colors.dart';
|
||||||
|
import '../../../controller/home/captin/help/assurance_controller.dart';
|
||||||
|
|
||||||
|
import 'package:flutter/cupertino.dart';
|
||||||
|
|
||||||
|
class AssuranceHealthPage extends StatelessWidget {
|
||||||
|
AssuranceHealthPage({super.key});
|
||||||
|
AssuranceHealthController assuranceHealthController =
|
||||||
|
Get.put(AssuranceHealthController());
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
return CupertinoPageScaffold(
|
||||||
|
navigationBar: CupertinoNavigationBar(
|
||||||
|
middle: Text("Health Insurance".tr),
|
||||||
|
),
|
||||||
|
child: SafeArea(
|
||||||
|
child: Padding(
|
||||||
|
padding: const EdgeInsets.all(8.0),
|
||||||
|
child: GetBuilder<AssuranceHealthController>(
|
||||||
|
builder: (assuranceHealthController) {
|
||||||
|
return Column(
|
||||||
|
children: [
|
||||||
|
Text(
|
||||||
|
"When you complete 500 trips, you will be eligible for exclusive health insurance offers."
|
||||||
|
.tr,
|
||||||
|
textAlign: TextAlign.center,
|
||||||
|
style: CupertinoTheme.of(context).textTheme.navTitleTextStyle,
|
||||||
|
),
|
||||||
|
const SizedBox(height: 10),
|
||||||
|
Row(
|
||||||
|
mainAxisAlignment: MainAxisAlignment.spaceAround,
|
||||||
|
children: [
|
||||||
|
CupertinoButton.filled(
|
||||||
|
child: Text("Show My Trip Count".tr),
|
||||||
|
onPressed: () async {
|
||||||
|
assuranceHealthController.getTripCountByCaptain();
|
||||||
|
},
|
||||||
|
),
|
||||||
|
_buildTripCountAvatar(
|
||||||
|
assuranceHealthController.tripCount['count'] == null
|
||||||
|
? '0'
|
||||||
|
: assuranceHealthController.tripCount['count']
|
||||||
|
.toString(),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
const SizedBox(height: 10),
|
||||||
|
Container(
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
color: CupertinoColors.systemGrey6,
|
||||||
|
borderRadius: BorderRadius.circular(10),
|
||||||
|
),
|
||||||
|
child: Padding(
|
||||||
|
padding: const EdgeInsets.all(14),
|
||||||
|
child: Text(
|
||||||
|
"We have partnered with health insurance providers to offer you special health coverage. Complete 500 trips and receive a 20% discount on health insurance premiums."
|
||||||
|
.tr,
|
||||||
|
style: CupertinoTheme.of(context)
|
||||||
|
.textTheme
|
||||||
|
.textStyle
|
||||||
|
.copyWith(fontWeight: FontWeight.w600),
|
||||||
|
textAlign: TextAlign.center,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
const SizedBox(height: 10),
|
||||||
|
CupertinoButton.filled(
|
||||||
|
disabledColor: AppColor.blueColor,
|
||||||
|
padding:
|
||||||
|
const EdgeInsets.symmetric(horizontal: 20, vertical: 15),
|
||||||
|
borderRadius: BorderRadius.circular(12),
|
||||||
|
child: Text(
|
||||||
|
"Would you like to proceed with health insurance?".tr,
|
||||||
|
style: const TextStyle(
|
||||||
|
fontSize: 16, fontWeight: FontWeight.bold),
|
||||||
|
),
|
||||||
|
onPressed: () async {
|
||||||
|
// Show confirmation dialog before proceeding
|
||||||
|
showCupertinoDialog(
|
||||||
|
context: context,
|
||||||
|
builder: (BuildContext context) {
|
||||||
|
// Variable to store the health insurance provider chosen by the driver
|
||||||
|
TextEditingController providerController =
|
||||||
|
TextEditingController();
|
||||||
|
|
||||||
|
return CupertinoAlertDialog(
|
||||||
|
title: Text(
|
||||||
|
"Confirmation".tr,
|
||||||
|
style: const TextStyle(
|
||||||
|
fontWeight: FontWeight.bold, fontSize: 18),
|
||||||
|
),
|
||||||
|
content: Column(
|
||||||
|
children: [
|
||||||
|
Text(
|
||||||
|
"Would you like to proceed with health insurance?"
|
||||||
|
.tr,
|
||||||
|
style: const TextStyle(fontSize: 14),
|
||||||
|
),
|
||||||
|
const SizedBox(height: 20),
|
||||||
|
CupertinoTextField(
|
||||||
|
controller: providerController,
|
||||||
|
placeholder:
|
||||||
|
"Do you have a disease for a long time?".tr,
|
||||||
|
padding: const EdgeInsets.all(12),
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
border: Border.all(
|
||||||
|
color: CupertinoColors.systemGrey,
|
||||||
|
width: 1),
|
||||||
|
borderRadius: BorderRadius.circular(8),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
actions: <Widget>[
|
||||||
|
CupertinoDialogAction(
|
||||||
|
isDefaultAction: true,
|
||||||
|
child: Text(
|
||||||
|
"Yes".tr,
|
||||||
|
style: const TextStyle(
|
||||||
|
color: CupertinoColors.activeBlue),
|
||||||
|
),
|
||||||
|
onPressed: () async {
|
||||||
|
// Ensure the provider name is not empty
|
||||||
|
if (providerController.text.isNotEmpty) {
|
||||||
|
// Call the function to insert data into the database
|
||||||
|
await assuranceHealthController
|
||||||
|
.addDriverHealthAssurance(
|
||||||
|
healthInsuranceProvider:
|
||||||
|
providerController.text,
|
||||||
|
);
|
||||||
|
|
||||||
|
// Close the dialog and navigate to a success screen or show a snackbar
|
||||||
|
Navigator.of(context).pop();
|
||||||
|
} else {
|
||||||
|
// Show an alert if the provider name is empty
|
||||||
|
showCupertinoDialog(
|
||||||
|
context: context,
|
||||||
|
builder: (_) => CupertinoAlertDialog(
|
||||||
|
title: Text("Error".tr),
|
||||||
|
content: Text(
|
||||||
|
"Do you have a disease for a long time?"
|
||||||
|
.tr),
|
||||||
|
actions: [
|
||||||
|
CupertinoDialogAction(
|
||||||
|
child: Text("OK".tr),
|
||||||
|
onPressed: () =>
|
||||||
|
Navigator.of(context).pop(),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
),
|
||||||
|
CupertinoDialogAction(
|
||||||
|
child: Text(
|
||||||
|
"No".tr,
|
||||||
|
style: const TextStyle(
|
||||||
|
color: CupertinoColors.destructiveRed),
|
||||||
|
),
|
||||||
|
onPressed: () {
|
||||||
|
Navigator.of(context)
|
||||||
|
.pop(); // Just close the dialog
|
||||||
|
// Optionally show feedback if the driver opts out
|
||||||
|
Get.snackbar(
|
||||||
|
"Opted out".tr,
|
||||||
|
"You have chosen not to proceed with health insurance."
|
||||||
|
.tr,
|
||||||
|
backgroundColor:
|
||||||
|
CupertinoColors.systemGrey);
|
||||||
|
},
|
||||||
|
),
|
||||||
|
],
|
||||||
|
);
|
||||||
|
},
|
||||||
|
);
|
||||||
|
},
|
||||||
|
),
|
||||||
|
],
|
||||||
|
);
|
||||||
|
}),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
Widget _buildTripCountAvatar(String count) {
|
||||||
|
return Container(
|
||||||
|
width: 80,
|
||||||
|
height: 80,
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
shape: BoxShape.circle,
|
||||||
|
gradient: const RadialGradient(
|
||||||
|
colors: [
|
||||||
|
Color(0xFF42A5F5),
|
||||||
|
Color(0xFF1976D2),
|
||||||
|
], // Health theme colors
|
||||||
|
center: Alignment.center,
|
||||||
|
radius: 0.8,
|
||||||
|
),
|
||||||
|
boxShadow: [
|
||||||
|
BoxShadow(
|
||||||
|
color: CupertinoColors.black.withOpacity(0.2),
|
||||||
|
blurRadius: 8,
|
||||||
|
offset: const Offset(0, 4),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
child: Center(
|
||||||
|
child: Text(
|
||||||
|
count,
|
||||||
|
style: const TextStyle(
|
||||||
|
fontSize: 22,
|
||||||
|
fontWeight: FontWeight.bold,
|
||||||
|
color: CupertinoColors.white,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -19,6 +19,7 @@ import 'package:SEFER/views/notification/notification_captain.dart';
|
|||||||
|
|
||||||
import '../../../../constant/colors.dart';
|
import '../../../../constant/colors.dart';
|
||||||
import '../../../../controller/functions/upload_image.dart';
|
import '../../../../controller/functions/upload_image.dart';
|
||||||
|
import '../assurance_health_page.dart';
|
||||||
import '../maintain_center_page.dart';
|
import '../maintain_center_page.dart';
|
||||||
import 'package:flutter/cupertino.dart';
|
import 'package:flutter/cupertino.dart';
|
||||||
|
|
||||||
@@ -86,6 +87,13 @@ class CupertinoDrawerCaptain extends StatelessWidget {
|
|||||||
onTap: () => Get.to(() => MaintainCenterPage()),
|
onTap: () => Get.to(() => MaintainCenterPage()),
|
||||||
),
|
),
|
||||||
_buildDivider(),
|
_buildDivider(),
|
||||||
|
_buildDrawerItem(
|
||||||
|
icon:
|
||||||
|
CupertinoIcons.heart, // Updated icon to represent health
|
||||||
|
text: "Health Insurance".tr, // Updated English text
|
||||||
|
onTap: () => Get.to(() => AssuranceHealthPage()),
|
||||||
|
),
|
||||||
|
_buildDivider(),
|
||||||
_buildDrawerItem(
|
_buildDrawerItem(
|
||||||
icon: CupertinoIcons.mail,
|
icon: CupertinoIcons.mail,
|
||||||
text: "Contact Us".tr,
|
text: "Contact Us".tr,
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
import 'package:SEFER/print.dart';
|
import 'package:SEFER/print.dart';
|
||||||
|
import 'package:flutter/cupertino.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:get/get.dart';
|
import 'package:get/get.dart';
|
||||||
|
|
||||||
@@ -20,23 +21,15 @@ class CardSeferWalletDriver extends StatelessWidget {
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return Row(
|
return Center(
|
||||||
mainAxisAlignment: MainAxisAlignment.center,
|
child: GetBuilder<CaptainWalletController>(
|
||||||
children: [
|
builder: (captainWalletController) {
|
||||||
GetBuilder<CaptainWalletController>(builder: (captainWalletController) {
|
return GestureDetector(
|
||||||
return InkWell(
|
|
||||||
onTap: () async {
|
onTap: () async {
|
||||||
final now = DateTime.now();
|
final now = DateTime.now();
|
||||||
DateTime? lastRequestTime =
|
DateTime? lastRequestTime =
|
||||||
box.read(BoxName.lastTimeCaptainWalletCashOut);
|
box.read(BoxName.lastTimeCaptainWalletCashOut);
|
||||||
|
|
||||||
// if (lastRequestTime == null ||
|
|
||||||
// now.difference(lastRequestTime).inHours >= 24) {
|
|
||||||
// // Update the last request time to now
|
|
||||||
// lastRequestTime = now;
|
|
||||||
// await box.write(
|
|
||||||
// BoxName.lastTimeCaptainWalletCashOut, lastRequestTime);
|
|
||||||
// box.write(BoxName.cvvCode, 1111);
|
|
||||||
if (double.parse(
|
if (double.parse(
|
||||||
Get.find<CaptainWalletController>().totalAmountVisa) >=
|
Get.find<CaptainWalletController>().totalAmountVisa) >=
|
||||||
20) {
|
20) {
|
||||||
@@ -45,40 +38,37 @@ class CardSeferWalletDriver extends StatelessWidget {
|
|||||||
title: 'Do you want to collect your earnings?'.tr,
|
title: 'Do you want to collect your earnings?'.tr,
|
||||||
titleStyle: AppStyle.title,
|
titleStyle: AppStyle.title,
|
||||||
content: Column(
|
content: Column(
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.center,
|
||||||
children: [
|
children: [
|
||||||
Row(
|
Row(
|
||||||
mainAxisAlignment: MainAxisAlignment.center,
|
mainAxisAlignment: MainAxisAlignment.center,
|
||||||
children: [
|
children: [
|
||||||
|
const Icon(Icons.account_balance_wallet,
|
||||||
|
color: AppColor.primaryColor),
|
||||||
|
const SizedBox(width: 10),
|
||||||
Text(
|
Text(
|
||||||
'Total wallet is '.tr,
|
'Total wallet: '.tr,
|
||||||
style: AppStyle.title,
|
style: AppStyle.title.copyWith(fontSize: 16),
|
||||||
),
|
|
||||||
const SizedBox(
|
|
||||||
width: 5,
|
|
||||||
),
|
),
|
||||||
Text(
|
Text(
|
||||||
Get.find<CaptainWalletController>()
|
'${Get.find<CaptainWalletController>().totalAmountVisa} \$',
|
||||||
.totalAmountVisa,
|
style: AppStyle.number.copyWith(fontSize: 16),
|
||||||
style: AppStyle.number,
|
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
const SizedBox(
|
const SizedBox(height: 20),
|
||||||
height: 5,
|
|
||||||
),
|
|
||||||
Row(
|
Row(
|
||||||
mainAxisAlignment: MainAxisAlignment.center,
|
mainAxisAlignment: MainAxisAlignment.center,
|
||||||
children: [
|
children: [
|
||||||
Text(
|
Text(
|
||||||
'Wallet Type'.tr,
|
'Wallet Type: '.tr,
|
||||||
style: AppStyle.title,
|
style: AppStyle.title.copyWith(fontSize: 16),
|
||||||
),
|
|
||||||
const SizedBox(
|
|
||||||
width: 5,
|
|
||||||
),
|
),
|
||||||
|
const SizedBox(width: 10),
|
||||||
MyDropDown1(),
|
MyDropDown1(),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
|
const SizedBox(height: 20),
|
||||||
Form(
|
Form(
|
||||||
key: captainWalletController.formKey,
|
key: captainWalletController.formKey,
|
||||||
child: MyTextForm(
|
child: MyTextForm(
|
||||||
@@ -87,7 +77,7 @@ class CardSeferWalletDriver extends StatelessWidget {
|
|||||||
hint: "Enter your wallet number".tr,
|
hint: "Enter your wallet number".tr,
|
||||||
type: TextInputType.phone,
|
type: TextInputType.phone,
|
||||||
),
|
),
|
||||||
)
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
confirm: MyElevatedButton(
|
confirm: MyElevatedButton(
|
||||||
@@ -104,9 +94,6 @@ class CardSeferWalletDriver extends StatelessWidget {
|
|||||||
.totalAmountVisa) -
|
.totalAmountVisa) -
|
||||||
5)
|
5)
|
||||||
.toStringAsFixed(0);
|
.toStringAsFixed(0);
|
||||||
// .dropdownValue
|
|
||||||
// .toString());
|
|
||||||
// .toString());
|
|
||||||
await Get.put(PaymobPayout()).payToWalletDriverAll(
|
await Get.put(PaymobPayout()).payToWalletDriverAll(
|
||||||
amountAfter5LE,
|
amountAfter5LE,
|
||||||
Get.find<PaymobPayout>().dropdownValue.toString(),
|
Get.find<PaymobPayout>().dropdownValue.toString(),
|
||||||
@@ -124,88 +111,108 @@ class CardSeferWalletDriver extends StatelessWidget {
|
|||||||
kolor: AppColor.greenColor,
|
kolor: AppColor.greenColor,
|
||||||
),
|
),
|
||||||
cancel: MyElevatedButton(
|
cancel: MyElevatedButton(
|
||||||
title: 'cancel'.tr,
|
title: 'Cancel'.tr,
|
||||||
onPressed: () {
|
onPressed: () {
|
||||||
Get.back();
|
Get.back();
|
||||||
},
|
},
|
||||||
kolor: AppColor.redColor,
|
kolor: AppColor.redColor,
|
||||||
));
|
));
|
||||||
} else {
|
} else {
|
||||||
{
|
// Replacing Get.snackbar with CupertinoAlertDialog
|
||||||
Get.snackbar(
|
showCupertinoDialog(
|
||||||
'${'The Amount is less than'.tr}${box.read(BoxName.countryCode) == 'Egypt' ? '20' : '20'}',
|
context: context,
|
||||||
'',
|
builder: (BuildContext context) {
|
||||||
backgroundColor: AppColor.yellowColor);
|
return CupertinoAlertDialog(
|
||||||
}
|
title: Text("Alert".tr),
|
||||||
|
content: Text(
|
||||||
|
'${'The Amount is less than'.tr}${box.read(BoxName.countryCode) == 'Egypt' ? '20' : '20'}',
|
||||||
|
),
|
||||||
|
actions: <Widget>[
|
||||||
|
CupertinoDialogAction(
|
||||||
|
isDefaultAction: true,
|
||||||
|
child: Text("OK".tr),
|
||||||
|
onPressed: () {
|
||||||
|
Navigator.of(context).pop(); // Close the dialog
|
||||||
|
},
|
||||||
|
),
|
||||||
|
],
|
||||||
|
);
|
||||||
|
},
|
||||||
|
);
|
||||||
}
|
}
|
||||||
// } else {
|
|
||||||
// // Optionally show a message or handle the throttling case
|
|
||||||
// final hoursLeft = 24 - now.difference(lastRequestTime).inHours;
|
|
||||||
// Get.snackbar(
|
|
||||||
// '${'Please wait'.tr} $hoursLeft ${"hours before trying again.".tr}',
|
|
||||||
// '');
|
|
||||||
// }
|
|
||||||
},
|
},
|
||||||
child: Container(
|
child: Container(
|
||||||
width: Get.width * .85,
|
width: Get.width * .85,
|
||||||
height: Get.height * .2,
|
height: Get.height * .22,
|
||||||
decoration: BoxDecoration(
|
decoration: BoxDecoration(
|
||||||
color: AppColor.deepPurpleAccent,
|
borderRadius: BorderRadius.circular(15),
|
||||||
borderRadius: const BorderRadius.all(Radius.circular(12)),
|
gradient: LinearGradient(
|
||||||
gradient: const LinearGradient(colors: [
|
colors: [
|
||||||
AppColor.greyColor,
|
AppColor.secondaryColor.withOpacity(0.85),
|
||||||
AppColor.greyColor,
|
AppColor.primaryColor.withOpacity(0.85),
|
||||||
AppColor.secondaryColor,
|
],
|
||||||
AppColor.writeColor
|
begin: Alignment.topLeft,
|
||||||
]),
|
end: Alignment.bottomRight,
|
||||||
|
),
|
||||||
|
boxShadow: [
|
||||||
|
BoxShadow(
|
||||||
|
color: Colors.black.withOpacity(0.15),
|
||||||
|
blurRadius: 10,
|
||||||
|
offset: const Offset(0, 5),
|
||||||
|
),
|
||||||
|
],
|
||||||
),
|
),
|
||||||
child: Column(
|
child: Padding(
|
||||||
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
|
padding: const EdgeInsets.all(16.0),
|
||||||
children: [
|
child: Column(
|
||||||
Row(
|
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
|
||||||
children: [
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
Padding(
|
children: [
|
||||||
padding: const EdgeInsets.symmetric(horizontal: 10),
|
Row(
|
||||||
child: Text(
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||||
|
children: [
|
||||||
|
Text(
|
||||||
'${AppInformation.appName} Wallet',
|
'${AppInformation.appName} Wallet',
|
||||||
style: AppStyle.headTitle
|
style: AppStyle.headTitle
|
||||||
.copyWith(color: AppColor.writeColor),
|
.copyWith(color: AppColor.writeColor),
|
||||||
),
|
),
|
||||||
)
|
const Icon(Icons.account_balance_wallet,
|
||||||
],
|
color: AppColor.writeColor, size: 24),
|
||||||
),
|
],
|
||||||
Row(
|
),
|
||||||
mainAxisAlignment: MainAxisAlignment.center,
|
Row(
|
||||||
children: [
|
mainAxisAlignment: MainAxisAlignment.center,
|
||||||
Text(
|
children: [
|
||||||
'${Get.find<CaptainWalletController>().totalAmountVisa}\$' ??
|
Text(
|
||||||
'0.0 \$',
|
'${Get.find<CaptainWalletController>().totalAmountVisa}\$' ??
|
||||||
style: AppStyle.headTitle2,
|
'0.0 \$',
|
||||||
)
|
style: AppStyle.headTitle2.copyWith(
|
||||||
],
|
color: AppColor.writeColor, fontSize: 28),
|
||||||
),
|
),
|
||||||
Padding(
|
],
|
||||||
padding: const EdgeInsets.all(8.0),
|
),
|
||||||
child: Row(
|
Row(
|
||||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||||
children: [
|
children: [
|
||||||
Text(
|
Text(
|
||||||
box.read(BoxName.nameDriver),
|
box.read(BoxName.nameDriver),
|
||||||
style: AppStyle.title,
|
style: AppStyle.title.copyWith(
|
||||||
|
color: AppColor.writeColor.withOpacity(0.9)),
|
||||||
),
|
),
|
||||||
Text(
|
Text(
|
||||||
"Cash Out".tr,
|
"Cash Out".tr,
|
||||||
style: AppStyle.title,
|
style: AppStyle.title.copyWith(
|
||||||
)
|
color: AppColor.writeColor.withOpacity(0.9)),
|
||||||
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
)
|
],
|
||||||
],
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
}),
|
},
|
||||||
],
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ import 'package:SEFER/views/widgets/elevated_btn.dart';
|
|||||||
import 'package:SEFER/views/widgets/my_scafold.dart';
|
import 'package:SEFER/views/widgets/my_scafold.dart';
|
||||||
import 'package:SEFER/views/widgets/my_textField.dart';
|
import 'package:SEFER/views/widgets/my_textField.dart';
|
||||||
import 'package:SEFER/views/widgets/mycircular.dart';
|
import 'package:SEFER/views/widgets/mycircular.dart';
|
||||||
|
import 'package:SEFER/views/widgets/mydialoug.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:get/get.dart';
|
import 'package:get/get.dart';
|
||||||
|
|
||||||
@@ -105,11 +106,28 @@ class TransferBudgetPage extends StatelessWidget {
|
|||||||
? MyElevatedButton(
|
? MyElevatedButton(
|
||||||
title: 'Transfer'.tr,
|
title: 'Transfer'.tr,
|
||||||
onPressed: () async {
|
onPressed: () async {
|
||||||
await captainWalletController
|
if (double.parse(
|
||||||
.addTransferDriversWallet(
|
captainWalletController
|
||||||
'TransferFrom',
|
.amountFromBudgetController
|
||||||
'TransferTo',
|
.text) <
|
||||||
);
|
double.parse(
|
||||||
|
captainWalletController
|
||||||
|
.totalAmountVisa) -
|
||||||
|
5) {
|
||||||
|
await captainWalletController
|
||||||
|
.addTransferDriversWallet(
|
||||||
|
'TransferFrom',
|
||||||
|
'TransferTo',
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
MyDialog().getDialog(
|
||||||
|
"You dont have money in your Wallet"
|
||||||
|
.tr,
|
||||||
|
"You dont have money in your Wallet or you should less transfer 5 LE to activate"
|
||||||
|
.tr, () {
|
||||||
|
Get.back();
|
||||||
|
});
|
||||||
|
}
|
||||||
})
|
})
|
||||||
: const SizedBox()
|
: const SizedBox()
|
||||||
],
|
],
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ import 'package:SEFER/controller/home/payment/paymob_payout.dart';
|
|||||||
import 'package:SEFER/views/home/my_wallet/bank_account_egypt.dart';
|
import 'package:SEFER/views/home/my_wallet/bank_account_egypt.dart';
|
||||||
import 'package:SEFER/views/home/my_wallet/payment_history_driver_page.dart';
|
import 'package:SEFER/views/home/my_wallet/payment_history_driver_page.dart';
|
||||||
import 'package:SEFER/views/widgets/mydialoug.dart';
|
import 'package:SEFER/views/widgets/mydialoug.dart';
|
||||||
|
import 'package:flutter/cupertino.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:get/get.dart';
|
import 'package:get/get.dart';
|
||||||
import 'package:SEFER/constant/box_name.dart';
|
import 'package:SEFER/constant/box_name.dart';
|
||||||
@@ -48,7 +49,6 @@ class WalletCaptain extends StatelessWidget {
|
|||||||
children: [
|
children: [
|
||||||
const SizedBox(),
|
const SizedBox(),
|
||||||
Container(
|
Container(
|
||||||
// decoration: AppStyle.boxDecoration1.copyWith(
|
|
||||||
color: double.parse(captainWalletController
|
color: double.parse(captainWalletController
|
||||||
.totalPoints
|
.totalPoints
|
||||||
.toString()) <
|
.toString()) <
|
||||||
@@ -63,16 +63,27 @@ class WalletCaptain extends StatelessWidget {
|
|||||||
-3000
|
-3000
|
||||||
? AppColor.redColor
|
? AppColor.redColor
|
||||||
: AppColor.greenColor,
|
: AppColor.greenColor,
|
||||||
// ),
|
|
||||||
child: InkWell(
|
child: InkWell(
|
||||||
onTap: () {
|
onTap: () {
|
||||||
Get.snackbar(
|
showCupertinoDialog(
|
||||||
'the 3000 points equal 3000 L.E'.tr,
|
context: context,
|
||||||
'the 3000 points equal 3000 L.E for you \nSo go and gain your money'
|
builder: (BuildContext context) {
|
||||||
.tr,
|
return CupertinoAlertDialog(
|
||||||
backgroundColor: AppColor.greenColor,
|
title: Text('Info'.tr),
|
||||||
snackPosition: SnackPosition.BOTTOM,
|
content: Text(
|
||||||
duration: const Duration(seconds: 4),
|
'The 3000 points equal 3000 L.E for you \nSo go and gain your money'
|
||||||
|
.tr,
|
||||||
|
),
|
||||||
|
actions: <Widget>[
|
||||||
|
CupertinoDialogAction(
|
||||||
|
child: Text("OK".tr),
|
||||||
|
onPressed: () {
|
||||||
|
Navigator.of(context).pop();
|
||||||
|
},
|
||||||
|
),
|
||||||
|
],
|
||||||
|
);
|
||||||
|
},
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
child: Padding(
|
child: Padding(
|
||||||
@@ -86,437 +97,127 @@ class WalletCaptain extends StatelessWidget {
|
|||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
const SizedBox(
|
const SizedBox(height: 10),
|
||||||
height: 10,
|
if (double.parse(captainWalletController.totalPoints
|
||||||
),
|
.toString()) <
|
||||||
double.parse(captainWalletController.totalPoints
|
-3000)
|
||||||
.toString()) <
|
CupertinoButton.filled(
|
||||||
-3000
|
child: Text('Charge your Account'.tr),
|
||||||
? MyElevatedButton(
|
onPressed: () {
|
||||||
title: 'Charge your Account'.tr,
|
// Add your charge account logic here
|
||||||
onPressed: () {})
|
},
|
||||||
: const SizedBox(),
|
),
|
||||||
const SizedBox(
|
const SizedBox(height: 10),
|
||||||
height: 10,
|
|
||||||
),
|
|
||||||
const CardSeferWalletDriver(),
|
const CardSeferWalletDriver(),
|
||||||
Card(
|
Card(
|
||||||
elevation: 4,
|
elevation: 8,
|
||||||
|
shape: RoundedRectangleBorder(
|
||||||
|
borderRadius: BorderRadius.circular(16),
|
||||||
|
),
|
||||||
child: Padding(
|
child: Padding(
|
||||||
padding: const EdgeInsets.symmetric(horizontal: 4),
|
padding: const EdgeInsets.all(16),
|
||||||
child: Column(
|
child: Column(
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
children: [
|
children: [
|
||||||
Row(
|
_buildBudgetRow(
|
||||||
mainAxisAlignment:
|
title: 'Total Budget from trips is '.tr,
|
||||||
MainAxisAlignment.spaceBetween,
|
amount: captainWalletController.totalAmount,
|
||||||
children: [
|
onTap: () {
|
||||||
Text(
|
Get.snackbar(
|
||||||
'Total Budget from trips is '.tr,
|
icon: InkWell(
|
||||||
style: AppStyle.title,
|
onTap: () async {
|
||||||
),
|
await Get.put(
|
||||||
Container(
|
TextToSpeechController())
|
||||||
decoration: BoxDecoration(
|
.speakText(
|
||||||
border: Border.all(
|
'This amount for all trip I get from Passengers'
|
||||||
width: 2,
|
.tr);
|
||||||
color: AppColor.writeColor)),
|
},
|
||||||
child: GestureDetector(
|
child: const Icon(Icons.headphones)),
|
||||||
onTap: () {
|
'${'Total Amount:'.tr} ${captainWalletController.totalAmount}\$',
|
||||||
Log.print(
|
'This amount for all trip I get from Passengers'
|
||||||
'captainWalletController.totalAmount: ${captainWalletController.totalAmount}');
|
|
||||||
Get.snackbar(
|
|
||||||
icon: InkWell(
|
|
||||||
onTap: () async {
|
|
||||||
await Get.put(
|
|
||||||
TextToSpeechController())
|
|
||||||
.speakText(
|
|
||||||
'This amount for all trip I get from Passengers'
|
|
||||||
.tr);
|
|
||||||
},
|
|
||||||
child: const Icon(
|
|
||||||
Icons.headphones)),
|
|
||||||
'${'Total Amount:'.tr} ${captainWalletController.totalAmount}\$',
|
|
||||||
'This amount for all trip I get from Passengers'
|
|
||||||
.tr,
|
|
||||||
duration:
|
|
||||||
const Duration(seconds: 6),
|
|
||||||
backgroundColor:
|
|
||||||
AppColor.yellowColor,
|
|
||||||
snackPosition: SnackPosition.BOTTOM,
|
|
||||||
);
|
|
||||||
},
|
|
||||||
child: Padding(
|
|
||||||
padding: const EdgeInsets.all(2),
|
|
||||||
child: Text(
|
|
||||||
'${captainWalletController.totalAmount}\$'),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
)
|
|
||||||
],
|
|
||||||
),
|
|
||||||
const SizedBox(
|
|
||||||
height: 10,
|
|
||||||
),
|
|
||||||
Row(
|
|
||||||
mainAxisAlignment:
|
|
||||||
MainAxisAlignment.spaceBetween,
|
|
||||||
children: [
|
|
||||||
Text(
|
|
||||||
'Total Budget from trips by\nCredit card is '
|
|
||||||
.tr,
|
.tr,
|
||||||
style: AppStyle.title,
|
duration: const Duration(seconds: 6),
|
||||||
),
|
backgroundColor: AppColor.yellowColor,
|
||||||
Container(
|
snackPosition: SnackPosition.BOTTOM,
|
||||||
decoration: BoxDecoration(
|
);
|
||||||
border: Border.all(
|
|
||||||
width: 2,
|
|
||||||
color: AppColor.writeColor)),
|
|
||||||
child: Padding(
|
|
||||||
padding: const EdgeInsets.all(2),
|
|
||||||
child: InkWell(
|
|
||||||
onTap: () {
|
|
||||||
Get.snackbar(
|
|
||||||
icon: InkWell(
|
|
||||||
onTap: () async {
|
|
||||||
await Get.find<
|
|
||||||
TextToSpeechController>()
|
|
||||||
.speakText(
|
|
||||||
'This amount for all trip I get from Passengers and Collected For me in'
|
|
||||||
.tr +
|
|
||||||
' SAFAR Wallet'.tr,
|
|
||||||
);
|
|
||||||
},
|
|
||||||
child: const Icon(
|
|
||||||
Icons.headphones),
|
|
||||||
),
|
|
||||||
'${'Total Amount:'.tr} ${captainWalletController.totalAmountVisa}\$',
|
|
||||||
'This amount for all trip I get from Passengers and Collected For me in'
|
|
||||||
.tr +
|
|
||||||
' ${AppInformation.appName} Wallet'
|
|
||||||
.tr,
|
|
||||||
duration:
|
|
||||||
const Duration(seconds: 6),
|
|
||||||
backgroundColor:
|
|
||||||
AppColor.redColor,
|
|
||||||
snackPosition:
|
|
||||||
SnackPosition.BOTTOM,
|
|
||||||
);
|
|
||||||
},
|
|
||||||
child: Text(
|
|
||||||
'${captainWalletController.totalAmountVisa}\$'),
|
|
||||||
),
|
|
||||||
))
|
|
||||||
],
|
|
||||||
),
|
|
||||||
const SizedBox(
|
|
||||||
height: 10,
|
|
||||||
),
|
|
||||||
MyElevatedButton(
|
|
||||||
title:
|
|
||||||
'You can buy points from your budget'.tr,
|
|
||||||
onPressed: () {
|
|
||||||
Get.defaultDialog(
|
|
||||||
title: 'Pay from my budget'.tr,
|
|
||||||
titleStyle: AppStyle.title,
|
|
||||||
content: Form(
|
|
||||||
key: captainWalletController.formKey,
|
|
||||||
child: MyTextForm(
|
|
||||||
controller: captainWalletController
|
|
||||||
.amountFromBudgetController,
|
|
||||||
label:
|
|
||||||
'${'You have in account'.tr} ${captainWalletController.totalAmountVisa}',
|
|
||||||
hint:
|
|
||||||
'${'You have in account'.tr} ${captainWalletController.totalAmountVisa}',
|
|
||||||
type: TextInputType.number,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
confirm: MyElevatedButton(
|
|
||||||
title: 'Pay'.tr,
|
|
||||||
onPressed: () async {
|
|
||||||
if (double.parse(
|
|
||||||
captainWalletController
|
|
||||||
.amountFromBudgetController
|
|
||||||
.text) <
|
|
||||||
double.parse(
|
|
||||||
captainWalletController
|
|
||||||
.totalAmountVisa)) {
|
|
||||||
await captainWalletController
|
|
||||||
.payFromBudget();
|
|
||||||
} else {
|
|
||||||
Get.back();
|
|
||||||
Get.snackbar(
|
|
||||||
'Your Budget less than needed'
|
|
||||||
.tr,
|
|
||||||
'',
|
|
||||||
duration: const Duration(
|
|
||||||
seconds: 3),
|
|
||||||
backgroundColor:
|
|
||||||
AppColor.redColor,
|
|
||||||
snackPosition:
|
|
||||||
SnackPosition.BOTTOM,
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}),
|
|
||||||
cancel: MyElevatedButton(
|
|
||||||
title: 'Cancel'.tr,
|
|
||||||
onPressed: () {
|
|
||||||
Get.back();
|
|
||||||
}));
|
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
MyElevatedButton(
|
const SizedBox(height: 16),
|
||||||
title: 'Transfer budget'.tr,
|
_buildBudgetRow(
|
||||||
onPressed: () {
|
title:
|
||||||
if (double.parse(captainWalletController
|
'Total Budget from trips by\nCredit card is '
|
||||||
.totalAmountVisa) >
|
.tr,
|
||||||
15) {
|
amount:
|
||||||
Get.to(
|
captainWalletController.totalAmountVisa,
|
||||||
() => const TransferBudgetPage());
|
onTap: () {
|
||||||
} else {
|
Get.snackbar(
|
||||||
Get.snackbar(
|
icon: InkWell(
|
||||||
"You don't have enough money in your SEFER wallet"
|
onTap: () async {
|
||||||
.tr,
|
await Get.find<
|
||||||
'');
|
TextToSpeechController>()
|
||||||
}
|
.speakText(
|
||||||
})
|
'This amount for all trip I get from Passengers and Collected For me in'
|
||||||
|
.tr +
|
||||||
|
' SAFAR Wallet'.tr,
|
||||||
|
);
|
||||||
|
},
|
||||||
|
child: const Icon(Icons.headphones),
|
||||||
|
),
|
||||||
|
'${'Total Amount:'.tr} ${captainWalletController.totalAmountVisa}\$',
|
||||||
|
'This amount for all trip I get from Passengers and Collected For me in'
|
||||||
|
.tr +
|
||||||
|
' ${AppInformation.appName} Wallet'
|
||||||
|
.tr,
|
||||||
|
duration: const Duration(seconds: 6),
|
||||||
|
backgroundColor: AppColor.redColor,
|
||||||
|
snackPosition: SnackPosition.BOTTOM,
|
||||||
|
);
|
||||||
|
},
|
||||||
|
),
|
||||||
|
const SizedBox(height: 16),
|
||||||
|
_buildBuyPointsButton(captainWalletController),
|
||||||
|
const SizedBox(height: 16),
|
||||||
|
_buildTransferBudgetButton(
|
||||||
|
captainWalletController),
|
||||||
|
const SizedBox(height: 16),
|
||||||
|
_buildPurchaseInstructions(),
|
||||||
|
const SizedBox(height: 8),
|
||||||
|
_buildPointsOptions(),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
const SizedBox(
|
|
||||||
height: 10,
|
|
||||||
),
|
|
||||||
Padding(
|
|
||||||
padding: const EdgeInsets.all(8.0),
|
|
||||||
child: Container(
|
|
||||||
decoration: AppStyle.boxDecoration,
|
|
||||||
child: Column(children: [
|
|
||||||
Text(
|
|
||||||
"You can purchase a budget to enable online access through the options listed 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.greyColor,
|
|
||||||
pricePoint:
|
|
||||||
box.read(BoxName.countryCode) ==
|
|
||||||
'Jordan'
|
|
||||||
? 5
|
|
||||||
: 80,
|
|
||||||
countPoint:
|
|
||||||
box.read(BoxName.countryCode) ==
|
|
||||||
'Jordan'
|
|
||||||
? '3000'
|
|
||||||
: '1000',
|
|
||||||
),
|
|
||||||
PointsCaptain(
|
|
||||||
kolor: AppColor
|
|
||||||
.bronze, // Bronze color for medium value
|
|
||||||
pricePoint:
|
|
||||||
box.read(BoxName.countryCode) ==
|
|
||||||
'Jordan'
|
|
||||||
? 10
|
|
||||||
: 200,
|
|
||||||
countPoint:
|
|
||||||
box.read(BoxName.countryCode) ==
|
|
||||||
'Jordan'
|
|
||||||
? '1040'
|
|
||||||
: '2500',
|
|
||||||
),
|
|
||||||
PointsCaptain(
|
|
||||||
kolor: AppColor
|
|
||||||
.goldenBronze, // Golden bronze color for higher value
|
|
||||||
pricePoint:
|
|
||||||
box.read(BoxName.countryCode) ==
|
|
||||||
'Jordan'
|
|
||||||
? 22
|
|
||||||
: 400,
|
|
||||||
countPoint:
|
|
||||||
box.read(BoxName.countryCode) ==
|
|
||||||
'Jordan'
|
|
||||||
? '23000'
|
|
||||||
: '5100',
|
|
||||||
),
|
|
||||||
PointsCaptain(
|
|
||||||
kolor: AppColor
|
|
||||||
.gold, // Gold color for highest value
|
|
||||||
pricePoint:
|
|
||||||
box.read(BoxName.countryCode) ==
|
|
||||||
'Jordan'
|
|
||||||
? 50
|
|
||||||
: 1000,
|
|
||||||
countPoint:
|
|
||||||
box.read(BoxName.countryCode) ==
|
|
||||||
'Jordan'
|
|
||||||
? '55000'
|
|
||||||
: '130000',
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
),
|
|
||||||
]))),
|
|
||||||
const SizedBox(
|
|
||||||
height: 30,
|
|
||||||
),
|
|
||||||
box
|
|
||||||
.read(BoxName.accountIdStripeConnect)
|
|
||||||
.toString()
|
|
||||||
.isEmpty
|
|
||||||
? Row(
|
|
||||||
mainAxisAlignment: MainAxisAlignment.center,
|
|
||||||
children: [
|
|
||||||
MyElevatedButton(
|
|
||||||
title:
|
|
||||||
'Create Wallet to receive your money',
|
|
||||||
onPressed: () async {
|
|
||||||
box.read(BoxName.countryCode) == 'Egypt'
|
|
||||||
? addBankCodeEgypt(
|
|
||||||
captainWalletController)
|
|
||||||
: Get.find<PaymentController>()
|
|
||||||
.createConnectAccount();
|
|
||||||
}),
|
|
||||||
],
|
|
||||||
)
|
|
||||||
: const SizedBox(
|
|
||||||
height: 30,
|
|
||||||
),
|
|
||||||
|
|
||||||
GetBuilder<CaptainWalletController>(
|
GetBuilder<CaptainWalletController>(
|
||||||
builder: (captainWalletController) {
|
builder: (captainWalletController) {
|
||||||
return InkWell(
|
return Column(
|
||||||
onTap: () {
|
children: [
|
||||||
MyDialog().getDialog(
|
_buildPromoCard(
|
||||||
'Morning Promo'.tr,
|
title: 'Morning Promo'.tr,
|
||||||
"this is count of your all trips in the morning promo today from 7:00am-10:00am"
|
count: captainWalletController
|
||||||
.tr, () {
|
.walletDate['message'][0]
|
||||||
Get.back();
|
['morning_count'],
|
||||||
});
|
maxCount: 5,
|
||||||
},
|
description:
|
||||||
child: Padding(
|
"this is count of your all trips in the morning promo today from 7:00am-10:00am"
|
||||||
padding: const EdgeInsets.all(8.0),
|
.tr,
|
||||||
child: Row(
|
),
|
||||||
children: [
|
const SizedBox(
|
||||||
SizedBox(
|
height: 16), // Add space between the cards
|
||||||
width: Get.width * .9,
|
_buildPromoCard(
|
||||||
// height: Get.height * .1,
|
title: 'Afternoon Promo'.tr,
|
||||||
// decoration: AppStyle.boxDecoration,
|
count: captainWalletController
|
||||||
child: Stack(
|
.walletDate['message'][0]
|
||||||
children: [
|
['afternoon_count'],
|
||||||
LinearProgressIndicator(
|
maxCount: 5,
|
||||||
minHeight: 35,
|
description:
|
||||||
color: AppColor.blueColor,
|
"this is count of your all trips in the Afternoon promo today from 3:00pm-6:00 pm"
|
||||||
borderRadius:
|
.tr,
|
||||||
BorderRadius.circular(12),
|
),
|
||||||
backgroundColor: AppColor.accentColor
|
],
|
||||||
.withOpacity(.5),
|
);
|
||||||
value: double.parse(
|
},
|
||||||
captainWalletController
|
),
|
||||||
.walletDate['message'][0]
|
|
||||||
['morning_count']
|
|
||||||
.toString()) /
|
|
||||||
5,
|
|
||||||
),
|
|
||||||
Row(
|
|
||||||
mainAxisAlignment:
|
|
||||||
MainAxisAlignment.center,
|
|
||||||
children: <Widget>[
|
|
||||||
Text(
|
|
||||||
'Morning Promo Rides'.tr,
|
|
||||||
style: AppStyle.title,
|
|
||||||
),
|
|
||||||
const SizedBox(
|
|
||||||
width: 20,
|
|
||||||
),
|
|
||||||
Text(
|
|
||||||
'${captainWalletController.walletDate['message'][0]['morning_count']} / 5',
|
|
||||||
style: AppStyle.title,
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
)
|
|
||||||
],
|
|
||||||
),
|
|
||||||
),
|
|
||||||
);
|
|
||||||
}),
|
|
||||||
GetBuilder<CaptainWalletController>(
|
|
||||||
builder: (captainWalletController) {
|
|
||||||
return InkWell(
|
|
||||||
onTap: () {
|
|
||||||
MyDialog().getDialog(
|
|
||||||
'Afternoon Promo'.tr,
|
|
||||||
"this is count of your all trips in the Afternoon promo today from 3:00pm-6:00 pm"
|
|
||||||
.tr, () {
|
|
||||||
Get.back();
|
|
||||||
});
|
|
||||||
},
|
|
||||||
child: Padding(
|
|
||||||
padding: const EdgeInsets.all(8.0),
|
|
||||||
child: Row(
|
|
||||||
children: [
|
|
||||||
SizedBox(
|
|
||||||
width: Get.width * .9,
|
|
||||||
// height: Get.height * .1,
|
|
||||||
// decoration: AppStyle.boxDecoration,
|
|
||||||
child: Stack(
|
|
||||||
children: [
|
|
||||||
LinearProgressIndicator(
|
|
||||||
minHeight: 35,
|
|
||||||
color: AppColor.blueColor,
|
|
||||||
borderRadius:
|
|
||||||
BorderRadius.circular(12),
|
|
||||||
backgroundColor: AppColor.accentColor
|
|
||||||
.withOpacity(.5),
|
|
||||||
value: double.parse(
|
|
||||||
captainWalletController
|
|
||||||
.walletDate['message'][0]
|
|
||||||
['afternoon_count']
|
|
||||||
.toString()) /
|
|
||||||
5,
|
|
||||||
),
|
|
||||||
Row(
|
|
||||||
mainAxisAlignment:
|
|
||||||
MainAxisAlignment.center,
|
|
||||||
children: <Widget>[
|
|
||||||
Text(
|
|
||||||
'Afternoon Promo Rides'.tr,
|
|
||||||
style: AppStyle.title,
|
|
||||||
),
|
|
||||||
const SizedBox(
|
|
||||||
width: 20,
|
|
||||||
),
|
|
||||||
Text(
|
|
||||||
'${captainWalletController.walletDate['message'][0]['afternoon_count']} / 5',
|
|
||||||
style: AppStyle.title,
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
)
|
|
||||||
],
|
|
||||||
),
|
|
||||||
),
|
|
||||||
);
|
|
||||||
}),
|
|
||||||
|
|
||||||
Padding(
|
Padding(
|
||||||
padding: const EdgeInsets.symmetric(horizontal: 10),
|
padding: const EdgeInsets.symmetric(horizontal: 10),
|
||||||
child: Row(
|
child: Row(
|
||||||
@@ -570,6 +271,205 @@ class WalletCaptain extends StatelessWidget {
|
|||||||
child: const Icon(Icons.refresh)),
|
child: const Icon(Icons.refresh)),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Helper methods for better structure
|
||||||
|
Widget _buildBudgetRow(
|
||||||
|
{required String title,
|
||||||
|
required String amount,
|
||||||
|
required VoidCallback onTap}) {
|
||||||
|
return Row(
|
||||||
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||||
|
children: [
|
||||||
|
Expanded(
|
||||||
|
child: Text(
|
||||||
|
title,
|
||||||
|
style: AppStyle.title,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
Container(
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
border: Border.all(width: 2, color: AppColor.writeColor),
|
||||||
|
borderRadius: BorderRadius.circular(12),
|
||||||
|
),
|
||||||
|
child: GestureDetector(
|
||||||
|
onTap: onTap,
|
||||||
|
child: Padding(
|
||||||
|
padding: const EdgeInsets.all(8),
|
||||||
|
child: Text(
|
||||||
|
'$amount\$',
|
||||||
|
style:
|
||||||
|
const TextStyle(fontSize: 18, fontWeight: FontWeight.bold),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
Widget _buildPromoCard(
|
||||||
|
{required String title,
|
||||||
|
required int count,
|
||||||
|
required int maxCount,
|
||||||
|
required String description}) {
|
||||||
|
return InkWell(
|
||||||
|
onTap: () {
|
||||||
|
MyDialog().getDialog(title, description, () {
|
||||||
|
Get.back();
|
||||||
|
});
|
||||||
|
},
|
||||||
|
child: Padding(
|
||||||
|
padding: const EdgeInsets.all(8.0),
|
||||||
|
child: Row(
|
||||||
|
children: [
|
||||||
|
SizedBox(
|
||||||
|
width: Get.width * .9,
|
||||||
|
child: Stack(
|
||||||
|
children: [
|
||||||
|
LinearProgressIndicator(
|
||||||
|
minHeight: 35,
|
||||||
|
color: AppColor.blueColor,
|
||||||
|
borderRadius: BorderRadius.circular(12),
|
||||||
|
backgroundColor: AppColor.accentColor.withOpacity(.5),
|
||||||
|
value: count / maxCount,
|
||||||
|
),
|
||||||
|
Row(
|
||||||
|
mainAxisAlignment: MainAxisAlignment.center,
|
||||||
|
children: <Widget>[
|
||||||
|
Text(
|
||||||
|
title,
|
||||||
|
style: AppStyle.title,
|
||||||
|
),
|
||||||
|
const SizedBox(width: 20),
|
||||||
|
Text(
|
||||||
|
'$count / $maxCount',
|
||||||
|
style: AppStyle.title,
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
Widget _buildBuyPointsButton(CaptainWalletController controller) {
|
||||||
|
return MyElevatedButton(
|
||||||
|
title: 'You can buy points from your budget'.tr,
|
||||||
|
onPressed: () {
|
||||||
|
Get.defaultDialog(
|
||||||
|
title: 'Pay from my budget'.tr,
|
||||||
|
content: Form(
|
||||||
|
key: controller.formKey,
|
||||||
|
child: MyTextForm(
|
||||||
|
controller: controller.amountFromBudgetController,
|
||||||
|
label:
|
||||||
|
'${'You have in account'.tr} ${controller.totalAmountVisa}',
|
||||||
|
hint: '${'You have in account'.tr} ${controller.totalAmountVisa}',
|
||||||
|
type: TextInputType.number,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
confirm: MyElevatedButton(
|
||||||
|
title: 'Pay'.tr,
|
||||||
|
onPressed: () async {
|
||||||
|
if (double.parse(controller.amountFromBudgetController.text) <
|
||||||
|
double.parse(controller.totalAmountVisa)) {
|
||||||
|
await controller.payFromBudget();
|
||||||
|
} else {
|
||||||
|
Get.back();
|
||||||
|
Get.snackbar('Your Budget less than needed'.tr, '',
|
||||||
|
duration: const Duration(seconds: 3),
|
||||||
|
backgroundColor: AppColor.redColor,
|
||||||
|
snackPosition: SnackPosition.BOTTOM);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
),
|
||||||
|
cancel: MyElevatedButton(
|
||||||
|
title: 'Cancel'.tr,
|
||||||
|
onPressed: () {
|
||||||
|
Get.back();
|
||||||
|
},
|
||||||
|
),
|
||||||
|
);
|
||||||
|
},
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
Widget _buildTransferBudgetButton(CaptainWalletController controller) {
|
||||||
|
return MyElevatedButton(
|
||||||
|
title: 'Transfer budget'.tr,
|
||||||
|
onPressed: () {
|
||||||
|
if (double.parse(controller.totalAmountVisa) > 15) {
|
||||||
|
Get.to(() => const TransferBudgetPage());
|
||||||
|
} else {
|
||||||
|
Get.snackbar(
|
||||||
|
"You don't have enough money in your SEFER wallet".tr, '');
|
||||||
|
}
|
||||||
|
},
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
Widget _buildPurchaseInstructions() {
|
||||||
|
return Padding(
|
||||||
|
padding: const EdgeInsets.all(8.0),
|
||||||
|
child: Container(
|
||||||
|
decoration: AppStyle.boxDecoration,
|
||||||
|
child: Column(
|
||||||
|
children: [
|
||||||
|
Text(
|
||||||
|
"You can purchase a budget to enable online access through the options listed below."
|
||||||
|
.tr,
|
||||||
|
textAlign: TextAlign.center,
|
||||||
|
style: AppStyle.title,
|
||||||
|
),
|
||||||
|
const Divider(
|
||||||
|
indent: 30,
|
||||||
|
endIndent: 30,
|
||||||
|
color: AppColor.accentColor,
|
||||||
|
thickness: 3),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
Widget _buildPointsOptions() {
|
||||||
|
return Container(
|
||||||
|
height: Get.height * 0.19,
|
||||||
|
child: ListView(
|
||||||
|
scrollDirection: Axis.horizontal,
|
||||||
|
children: [
|
||||||
|
PointsCaptain(
|
||||||
|
kolor: AppColor.greyColor,
|
||||||
|
pricePoint: box.read(BoxName.countryCode) == 'Jordan' ? 5 : 80,
|
||||||
|
countPoint:
|
||||||
|
box.read(BoxName.countryCode) == 'Jordan' ? '3000' : '1000',
|
||||||
|
),
|
||||||
|
PointsCaptain(
|
||||||
|
kolor: AppColor.bronze,
|
||||||
|
pricePoint: box.read(BoxName.countryCode) == 'Jordan' ? 10 : 200,
|
||||||
|
countPoint:
|
||||||
|
box.read(BoxName.countryCode) == 'Jordan' ? '1040' : '2500',
|
||||||
|
),
|
||||||
|
PointsCaptain(
|
||||||
|
kolor: AppColor.goldenBronze,
|
||||||
|
pricePoint: box.read(BoxName.countryCode) == 'Jordan' ? 22 : 400,
|
||||||
|
countPoint:
|
||||||
|
box.read(BoxName.countryCode) == 'Jordan' ? '23000' : '5100',
|
||||||
|
),
|
||||||
|
PointsCaptain(
|
||||||
|
kolor: AppColor.gold,
|
||||||
|
pricePoint: box.read(BoxName.countryCode) == 'Jordan' ? 50 : 1000,
|
||||||
|
countPoint:
|
||||||
|
box.read(BoxName.countryCode) == 'Jordan' ? '55000' : '130000',
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<dynamic> addBankCodeEgypt(
|
Future<dynamic> addBankCodeEgypt(
|
||||||
|
|||||||
Reference in New Issue
Block a user