This commit is contained in:
Hamza-Ayed
2023-12-03 10:35:27 +03:00
parent e095cf564a
commit 2501292424
50 changed files with 1841 additions and 730 deletions

2
.gitignore vendored
View File

@@ -45,7 +45,7 @@ app.*.map.json
/android/gradle.properties
# Environment-specific files
.env.
.env
lib/env/env.dart
lib/env/env.g.dart
lib/constant/api_keys.json

View File

@@ -55,8 +55,8 @@ android {
// For more information, see: https://docs.flutter.dev/deployment/android#reviewing-the-gradle-build-configuration.
minSdkVersion 23
targetSdkVersion flutter.targetSdkVersion
versionCode 11
versionName '1.1.1'
versionCode 12
versionName '1.1.6'
}
signingConfigs {

Binary file not shown.

Before

Width:  |  Height:  |  Size: 10 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 25 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 37 KiB

View File

@@ -1,7 +1,7 @@
import 'package:ride/env/env.dart';
class AppLink {
static final String server = Env.serverPHP; //Env.serverPHP;
static final String server = Env.serverPHP;
static String googleMapsLink = 'https://maps.googleapis.com/maps/api/';
static String llama = 'https://api.llama-api.com/chat/completions';
@@ -13,6 +13,7 @@ class AppLink {
//=======================Wallet===================
static String wallet = '$server/ride/passengerWallet/';
static String walletDriver = '$server/ride/driverWallet/';
static String getAllPassengerTransaction =
"$wallet/getAllPassengerTransaction.php";
static String getWalletByPassenger = "$wallet/getWalletByPassenger.php";
@@ -21,6 +22,12 @@ class AppLink {
static String deletePassengersWallet = "$wallet/delete.php";
static String updatePassengersWallet = "$wallet/update.php";
static String getWalletByDriver = "$walletDriver/getWalletByDriver.php";
static String getDriversWallet = "$walletDriver/get.php";
static String addDriversWallet = "$walletDriver/add.php";
static String deleteDriversWallet = "$walletDriver/delete.php";
static String updateDriversWallet = "$walletDriver/update.php";
//=======================promo===================ride.mobile-app.store/ride/promo/get.php
static String promo = '$server/ride/promo';
static String getPassengersPromo = "$promo/get.php";
@@ -44,8 +51,17 @@ class AppLink {
//-----------------DriverPayment------------------
static String addDriverpayment = "$ride/payment/add.php";
static String addDriverPaymentPoints = "$ride/driverPayment/add.php";
static String getDriverPaymentPoints = "$ride/driverWallet/get.php";
static String getDriverpaymentToday = "$ride/payment/get.php";
static String getAllPayment = "$ride/payment/getAllPayment.php";
static String getAllPaymentFromRide = "$ride/payment/getAllPayment.php";
//-----------------Driver NotificationCaptain------------------
static String addNotificationCaptain = "$ride/notificationCaptain/add.php";
static String getNotificationCaptain = "$ride/notificationCaptain/get.php";
static String updateNotificationCaptain =
"$ride/notificationCaptain/update.php";
static String deleteNotificationCaptain =
"$ride/notificationCaptain/delete.php";
//-----------------Api Key------------------
static String addApiKey = "$ride/apiKey/add.php";
static String getApiKey = "$ride/apiKey/get.php";
@@ -56,6 +72,14 @@ class AppLink {
static String addFeedBack = "$ride/feedBack/add.php";
static String getFeedBack = "$ride/feedBack/get.php";
static String updateFeedBack = "$ride/feedBack/updateFeedBack.php";
//-----------------Help Center------------------
static String addhelpCenter = "$ride/helpCenter/add.php";
static String gethelpCenter = "$ride/helpCenter/get.php";
static String getByIdhelpCenter = "$ride/helpCenter/getById.php";
static String updatehelpCenter = "$ride/helpCenter/update.php";
static String deletehelpCenter = "$ride/helpCenter/delete.php";
//-----------------license------------------
static String addLicense = "$ride/license/add.php";
static String getLicense = "$ride/license/get.php";
@@ -63,8 +87,7 @@ class AppLink {
//-----------------RegisrationCar------------------
static String addRegisrationCar = "$ride/RegisrationCar/add.php";
static String getRegisrationCar = "$ride/RegisrationCar/get.php";
static String updateRegisrationCar =
"$ride/RegisrationCar/updateFeedBack.php";
static String updateRegisrationCar = "$ride/RegisrationCar/update.php";
//-----------------DriverOrder------------------

View File

@@ -3,4 +3,5 @@ class TableName {
static const String carLocations = "carLocations";
static const String driverOrdersRefuse = "driverOrdersRefuse";
static const String faceDetectTimes = "faceDetectTimes";
static const String captainNotification = "captainNotification";
}

View File

@@ -0,0 +1,56 @@
import 'dart:convert';
import 'package:get/get.dart';
import 'package:ride/constant/style.dart';
import 'package:ride/constant/table_names.dart';
import 'package:ride/views/widgets/elevated_btn.dart';
import '../../../constant/box_name.dart';
import '../../../constant/links.dart';
import '../../../main.dart';
import '../../functions/crud.dart';
class NotificationCaptainController extends GetxController {
bool isloading = false;
Map notificationData = {};
getNotifications() async {
isloading = true;
update();
var res = await CRUD().get(
link: AppLink.getNotificationCaptain,
payload: {'driverID': box.read(BoxName.driverID)});
if (res == "failure") {
// print(res);
Get.defaultDialog(
title: 'There is no notification yet'.tr,
titleStyle: AppStyle.title,
middleText: '',
confirm: MyElevatedButton(
title: 'Back',
onPressed: () {
Get.back();
Get.back();
}));
}
notificationData = jsonDecode(res);
// sql.insertData(notificationData['message'], TableName.captainNotification);
// print(notificationData);
isloading = false;
update();
}
updateNotification(String id) async {
await CRUD().post(
link: AppLink.updateNotificationCaptain,
payload: {'isShown': true, 'id': id},
);
}
@override
void onInit() {
getNotifications();
super.onInit();
}
}

View File

@@ -12,6 +12,7 @@ import 'package:ride/views/auth/captin/login_captin.dart';
import 'package:ride/views/auth/captin/verify_email_captain.dart';
import '../../../views/auth/captin/ai_page.dart';
import '../../../views/auth/captin/car_license_page.dart';
import '../../../views/auth/verify_email_page.dart';
class RegisterCaptainController extends GetxController {
@@ -76,7 +77,7 @@ class RegisterCaptainController extends GetxController {
});
if (res != 'failure') {
Get.offAll(() => LoginCaptin());
Get.to(() => CarLicensePage());
}
}
@@ -105,7 +106,7 @@ class RegisterCaptainController extends GetxController {
update();
}
void addLisence() async {
Future addLisence() async {
getFromController();
var res = await CRUD().post(link: AppLink.addLicense, payload: {
'name': name,
@@ -114,7 +115,7 @@ class RegisterCaptainController extends GetxController {
'address': address,
'height': height,
'postalCode': postalCode,
'sex': sex == 'M' ? 'Male' : 'Female',
'sex': sex,
'stateCode': stateCode,
'expireDate': expireDate,
'dateOfBirth': dob,
@@ -152,11 +153,11 @@ class RegisterCaptainController extends GetxController {
isLoading = false;
update();
if (jsonDecode(res)['status'] == 'success') {
// Get.to(() => AiPage()); //todo replace this
Get.offAll(() => LoginCaptin()); //todo replace this
}
}
void register() async {
Future register() async {
getFromController();
if (formKey.currentState!.validate()) {
isLoading = true;
@@ -171,11 +172,11 @@ class RegisterCaptainController extends GetxController {
'site': address,
'birthdate': dob,
});
print(jsonDecode(res));
isLoading = false;
update();
if (jsonDecode(res)['status'] == 'success') {
print('sdfffffffffff');
box.write(BoxName.driverID, jsonDecode(res)['message']);
box.write(BoxName.dobDriver, dob);
box.write(BoxName.sexDriver, sex);
box.write(BoxName.phoneDriver, phoneController.text);

View File

@@ -108,7 +108,7 @@ class FirebaseMessagesController extends GetxController {
var myList = jsonDecode(myListString) as List<dynamic>;
driverToken = myList[14].toString();
update();
print('driverToken==============' + driverToken.toString());
print('driverToken==============$driverToken');
Get.to(() => OrderRequestPage(), arguments: {
'myListString': myListString,
'DriverList': myList,
@@ -191,12 +191,13 @@ class FirebaseMessagesController extends GetxController {
Get.snackbar('RideIsBegin', '', backgroundColor: AppColor.greenColor);
// mapController.driverArrivePassenger();
update();
} else if (message.notification!.title!.contains('isRideFinished')) {
MapPassengerController mapController =
Get.find<MapPassengerController>();
} else if (message.notification!.title!
.contains('Captain Finish Trip')) {
// MapPassengerController mapController =
// Get.find<MapPassengerController>();
Get.snackbar('Ride Finished'.tr, '',
backgroundColor: AppColor.greenColor);
mapController.isRideFinished = true;
// mapController.isRideFinished = true;//todo fix that for dfinish ride in passenger app
update();
}
}
@@ -311,8 +312,8 @@ class FirebaseMessagesController extends GetxController {
Get.find<MapPassengerController>();
mapController.rideConfirm = false;
update();
print('-----------------------------rideConfirm===' +
mapController.rideConfirm.toString());
print(
'-----------------------------rideConfirm===${mapController.rideConfirm}');
var myList = jsonDecode(passengerList) as List<dynamic>;
driverID = myList[2].toString();

View File

@@ -26,13 +26,13 @@ class CRUD {
// 'Basic ${base64Encode(utf8.encode(basicAuthCredentials.toString()))}',
},
);
// print("-----request----" + response.request.toString());
print("-----request----" + response.request.toString());
// print("-----headers-----" + response.headers.toString());
// print("-----payload-----" + payload.toString());
print("-----payload-----" + payload.toString());
if (response.statusCode == 200) {
var jsonData = jsonDecode(response.body);
if (jsonData['status'] == 'success') {
// print(jsonData);
print(jsonData);
return response.body;
}
@@ -148,17 +148,17 @@ class CRUD {
'Basic ${base64Encode(utf8.encode(AK.basicAuthCredentials))}',
},
);
//print(response.request);
print(response.request);
//print(payload);
var jsonData = jsonDecode(response.body);
if (response.statusCode == 200) {
if (jsonData['status'] == 'success') {
Get.snackbar(
jsonData['status'],
jsonData['message'],
);
//print(response.body);
// Get.snackbar(
// jsonData['status'],
// jsonData['message'],
// );
// print(response.body);
return response.body;
}
}
@@ -192,10 +192,10 @@ class CRUD {
if (response.statusCode == 200) {
if (jsonData['status'] == 'success') {
Get.back();
Get.snackbar(
jsonData['status'],
jsonData['message'],
);
// Get.snackbar(
// jsonData['status'],
// jsonData['message'],
// );
return response.body;
}

View File

@@ -10,13 +10,13 @@ import 'package:ride/constant/api_key.dart';
import 'package:ride/constant/box_name.dart';
import 'package:ride/constant/colors.dart';
import 'package:ride/constant/info.dart';
import 'package:ride/constant/links.dart';
import 'package:ride/constant/style.dart';
import 'package:ride/constant/table_names.dart';
import 'package:ride/main.dart';
import 'package:ride/views/widgets/elevated_btn.dart';
import '../../views/auth/captin/car_license_page.dart';
import '../../constant/links.dart';
import '../auth/captin/register_captin_controller.dart';
import 'launch.dart';
//
@@ -227,6 +227,7 @@ class ScanDocumentsByApi extends GetxController {
late Uint8List imageSignature;
late Uint8List imageDocumentFrontSide;
XFile? image;
XFile? imagePortraitFile;
XFile? imageFace;
late File tempFile;
late String imagePath;
@@ -327,6 +328,7 @@ class ScanDocumentsByApi extends GetxController {
await tempFile.writeAsBytes(imagePortrait);
imagePath = tempFile.path;
// imagePortraitFile=File(imagePath) ;
update();
} else {
// Handle error or provide a default value
@@ -446,7 +448,7 @@ class ScanDocumentsByApi extends GetxController {
},
)) //
: Get.defaultDialog(
barrierDismissible: false,
// barrierDismissible: false,
title: 'Image detecting result is '.tr,
titleStyle: AppStyle.title,
content: Column(
@@ -478,47 +480,59 @@ class ScanDocumentsByApi extends GetxController {
: MyElevatedButton(
title: 'Next'.tr,
onPressed: () async {
await uploadImage(
tempFile, AppLink.uploadImagePortrate);
Get.to(() => CarLicensePage());
RegisterCaptainController registerCaptainController =
Get.put(RegisterCaptainController());
await registerCaptainController.register();
await registerCaptainController.addLisence();
await uploadImagePortrate();
// Get.to(() => CarLicensePage());
},
// {
// await uploadImage(
// tempFile, AppLink.uploadImagePortrate);
// Get.to(() => CarLicensePage());
// },
kolor: AppColor.greenColor,
));
} else {
print(response.reasonPhrase);
}
}
// Todo upload images and fields
Future<String> uploadImage(File imageFile, String link) async {
String? basicAuthCredentials =
await storage.read(key: BoxName.basicAuthCredentials);
// Todo upload images and fields
Future<String> uploadImagePortrate() async {
isLoading = true;
update();
var request = http.MultipartRequest(
'POST',
Uri.parse(link), //AppLink.uploadImage
Uri.parse(AppLink.uploadImagePortrate),
);
// Attach the image file to the request
request.files.add(
await http.MultipartFile.fromPath('image', imageFile.path),
); // Add the headers to the request
request.headers.addAll({
"Content-Type": "application/x-www-form-urlencoded",
'Authorization':
'Basic ${base64Encode(utf8.encode(basicAuthCredentials.toString()))}',
});
http.MultipartFile.fromBytes('image', imagePortrait),
);
request.headers.addAll({
"Content-Type": "multipart/form-data",
'Authorization':
'Basic ${base64Encode(utf8.encode(AK.basicAuthCredentials))}',
});
request.fields['driverID'] =
'bnbn'; // box.read(BoxName.driverID).toString();
// Add the driverID to the request
request.fields['driverID'] = box.read(BoxName.driverID);
// Send the request
var response = await request.send();
// Read the response
var responseData = await response.stream.toBytes();
var responseString = String.fromCharCodes(responseData);
// scannedText = responseString;
isLoading = false;
update();
// Return the link received from the server
// Print the response string
print(responseString);
return responseString;
}

View File

@@ -0,0 +1,93 @@
import 'dart:convert';
import 'package:flutter/material.dart';
import 'package:get/get.dart';
import '../../../../constant/box_name.dart';
import '../../../../constant/links.dart';
import '../../../../constant/style.dart';
import '../../../../main.dart';
import '../../../../views/widgets/elevated_btn.dart';
import '../../../functions/crud.dart';
class HelpController extends GetxController {
bool isLoading = false;
final formKey = GlobalKey<FormState>();
final helpQuestionController = TextEditingController();
Map helpQuestionDate = {};
Map helpQuestionRepleyDate = {};
String status = '';
String qustion = '';
late int indexQuestion = 0;
getindex(int i, String qustion1) async {
indexQuestion = i;
qustion = qustion1;
update();
}
void addHelpQuestion() async {
isLoading = true;
update();
var res = await CRUD().post(link: AppLink.addhelpCenter, payload: {
'driverID': box.read(BoxName.driverID).toString(),
'helpQuestion': helpQuestionController.text
});
var d = jsonDecode(res);
// print(d);
isLoading = false;
update();
if (d['status'].toString() == 'success') {
getHelpQuestion();
// Get.snackbar('Feedback data saved successfully'.tr, '',
// backgroundColor: AppColor.greenColor,
// snackPosition: SnackPosition.BOTTOM);
}
}
void getHelpQuestion() async {
isLoading = true;
update();
var res = await CRUD().get(link: AppLink.gethelpCenter, payload: {
'driverID': box.read(BoxName.driverID).toString(),
});
if (res == "failure") {
// print(res);
Get.defaultDialog(
title: 'There is no help Question here'.tr,
titleStyle: AppStyle.title,
middleText: '',
confirm: MyElevatedButton(
title: 'Back',
onPressed: () {
Get.back();
Get.back();
}));
}
helpQuestionDate = jsonDecode(res);
isLoading = false;
update();
}
Future getHelpRepley(String id) async {
isLoading = true;
update();
var res = await CRUD().get(link: AppLink.getByIdhelpCenter, payload: {
'id': id,
});
print(res);
if (res == "failure") {
status = 'not yet';
isLoading = false;
update();
}
helpQuestionRepleyDate = jsonDecode(res);
isLoading = false;
update();
}
@override
void onInit() {
getHelpQuestion();
super.onInit();
}
}

View File

@@ -186,7 +186,7 @@ class HomeCaptainController extends GetxController {
getAllPayment() async {
var res = await CRUD().get(
link: AppLink.getAllPayment,
link: AppLink.getAllPaymentFromRide,
payload: {'driverID': box.read(BoxName.driverID).toString()});
data = jsonDecode(res);

View File

@@ -198,12 +198,26 @@ class MapDriverController extends GetxController {
'passengerID': passengerId,
'driverID': box.read(BoxName.driverID).toString(),
});
await CRUD().post(link: AppLink.updateRides, payload: {
'id': rideId,
'rideTimeStart': DateTime.now().toString(),
'status': 'Begin'
});
rideIsBeginPassengerTimer();
double pointsSubstraction = 0;
pointsSubstraction = double.parse(paymentAmount) * -100;
var res = await CRUD().post(link: AppLink.addDriversWallet, payload: {
'paymentID': 'rideId$rideId',
'amount': (pointsSubstraction).toString(),
'paymentMethod': paymentMethod,
'driverID': box.read(BoxName.driverID).toString(),
});
var d = jsonDecode(res);
print('...................');
print(d);
print('...................');
// FirebaseMessagesController().sendNotificationToAnyWithoutData(
// 'RideIsBegin', box.read(BoxName.name).toString(), tokenPassenger);
}
@@ -225,8 +239,10 @@ class MapDriverController extends GetxController {
'passengerId': passengerId,
'driverId': driverId
});
// FirebaseMessagesController().sendNotificationToAnyWithoutData(
// 'isRideFinished', box.read(BoxName.name).toString(), tokenPassenger);
FirebaseMessagesController().sendNotificationToAnyWithoutData(
'Captain Finish Trip',
box.read(BoxName.name).toString(),
tokenPassenger);
}
String canelString = '';

View File

@@ -347,7 +347,7 @@ class MapPassengerController extends GetxController {
}
void delayAndFetchRideStatus(String rideId) {
Timer(const Duration(seconds: 1), () async {
Timer(const Duration(milliseconds: 200), () async {
if (shouldFetch) {
// print('shouldFetch is =$shouldFetch');
var res = await CRUD()
@@ -357,13 +357,18 @@ class MapPassengerController extends GetxController {
print(decod['data']);
if (decod['data'].toString() == 'Apply') {
shouldFetch = false; // Stop further fetches
// rideConfirm = false;
rideConfirm = false;
update();
startTimer();
} else if (decod['data'].toString() == 'Refused') {
if (dataCarsLocationByPassenger.length > carsOrder) {
carsOrder++;
update();
carsOrder = carsOrder + 1;
update();
print(dataCarsLocationByPassenger['message'].length);
print(dataCarsLocationByPassenger['message']);
print(carsOrder);
if (carsOrder < dataCarsLocationByPassenger['message'].length) {
print('55555555555555555555');
changeConfirmRide();
} else {
Get.defaultDialog(
@@ -374,7 +379,7 @@ class MapPassengerController extends GetxController {
onPressed: () => Get.offAll(const MapPagePassenger()),
));
// cancelRide();
cancelRideAfterRejectFromAll();
}
} else {
delayAndFetchRideStatus(
@@ -548,6 +553,26 @@ class MapPassengerController extends GetxController {
update();
}
Future<void> cancelRideAfterRejectFromAll() async {
clearPlaces();
clearPolyline();
data = [];
await CRUD().post(link: AppLink.updateDriverOrder, payload: {
"order_id": rideId.toString(), // Convert to String
"status": 'Cancel'
});
rideConfirm = false;
shouldFetch = false;
isPassengerChosen = false;
isCashConfirmPageShown = false;
isCashSelectedBeforeConfirmRide = false;
timeToPassengerFromDriverAfterApplied = 0;
changeCancelRidePageShow();
remainingTime = 0;
update();
}
Future cancelRide() async {
print("rideConfirm=$rideConfirm");
@@ -558,8 +583,9 @@ class MapPassengerController extends GetxController {
changeCancelRidePageShow();
rideConfirm = false;
shouldFetch = false;
isCashSelectedBeforeConfirmRide = false;
isCashConfirmPageShown = false;
isPassengerChosen = false;
isCashSelectedBeforeConfirmRide = false;
timeToPassengerFromDriverAfterApplied = 0;
update();
} else {
@@ -573,6 +599,7 @@ class MapPassengerController extends GetxController {
rideConfirm = false;
shouldFetch = false;
isPassengerChosen = false;
isCashConfirmPageShown = false;
isCashSelectedBeforeConfirmRide = false;
timeToPassengerFromDriverAfterApplied = 0;
changeCancelRidePageShow();

View File

@@ -0,0 +1,73 @@
import 'dart:convert';
import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:ride/constant/box_name.dart';
import 'package:ride/constant/links.dart';
import 'package:ride/controller/functions/crud.dart';
import 'package:ride/main.dart';
class CaptainWalletController extends GetxController {
bool isLoading = false;
Map walletDate = {};
Map walletDriverPointsDate = {};
final formKey = GlobalKey<FormState>();
String totalAmount = '0';
String totalPoints = '0';
Future getCaptainWalletFromRide() async {
isLoading = true;
update();
var res = await CRUD().get(
link: AppLink.getAllPaymentFromRide,
payload: {'driverID': box.read(BoxName.driverID)},
);
walletDate = jsonDecode(res);
totalAmount = walletDate['message'][0]['total_amount'].toString() == null
? '0'
: walletDate['message'][0]['total_amount'];
isLoading = false;
update();
}
Future getCaptainWalletFromBuyPoints() async {
isLoading = true;
update();
var res = await CRUD().get(
link: AppLink.getDriverPaymentPoints,
payload: {'driverID': box.read(BoxName.driverID)},
);
walletDriverPointsDate = jsonDecode(res);
totalPoints =
walletDriverPointsDate['message'][0]['total_amount'].toString();
isLoading = false;
update();
}
late String paymentID;
Future addDriverPayment(String paymentMethod, amount) async {
var res = await CRUD().post(link: AppLink.addDriverPaymentPoints, payload: {
'driverID': box.read(BoxName.driverID).toString(),
'amount': amount.toString(),
'payment_method': paymentMethod.toString(),
});
var d = jsonDecode(res);
paymentID = d['message'].toString();
// print(paymentID);
}
Future addDriverWallet(String paymentMethod, point) async {
await CRUD().post(link: AppLink.addDriversWallet, payload: {
'driverID': box.read(BoxName.driverID).toString(),
'paymentID': paymentID.toString(),
'amount': point,
'paymentMethod': paymentMethod.toString(),
});
}
@override
void onInit() {
getCaptainWalletFromRide();
getCaptainWalletFromBuyPoints();
super.onInit();
}
}

View File

@@ -19,11 +19,6 @@ class CreditCardController extends GetxController {
String? expiryDate = await SecureStorage().readData(BoxName.expiryDate);
String? cvvCode = await SecureStorage().readData(BoxName.cvvCode);
print('cardNumber: $cardNumber');
print('cardHolderName: $cardHolderName');
print('expiryDate: $expiryDate');
print('cvvCode: $cvvCode');
if (cvvCode != null && cvvCode.isNotEmpty) {
final maskedCardNumber = DigitObscuringFormatter()
.formatEditUpdate(
@@ -32,8 +27,6 @@ class CreditCardController extends GetxController {
)
.text;
print('maskedCardNumber: $maskedCardNumber');
cardNumberController.text = maskedCardNumber;
cardHolderNameController.text = cardHolderName ?? '';
expiryDateController.text = expiryDate ?? '';

View File

@@ -5,7 +5,6 @@ import 'package:flutter_paypal/flutter_paypal.dart';
import 'package:flutter_stripe/flutter_stripe.dart';
import 'package:get/get.dart';
import 'package:local_auth/local_auth.dart';
import 'package:ride/constant/credential.dart';
import 'package:ride/controller/home/map_passenger_controller.dart';
import '../../constant/box_name.dart';
@@ -53,16 +52,51 @@ class PaymentController extends GetxController {
update();
}
void onChangedPaymentMethodWallet(bool? value) {
isWalletChecked = !isWalletChecked;
isWalletChecked ? isCashChecked = false : isCashChecked = true;
addPassengerWallet() async {
isLoading = true;
update();
// double sallaryAccountNowBeforeAdding =
// double.parse(box.read(BoxName.passengerWalletTotal).toString());
await CRUD().post(link: AppLink.addPassengersWallet, payload: {
'passenger_id': box.read(BoxName.passengerID).toString(),
'balance': selectedAmount.toString()
}).then((value) {
getPassengerWallet();
// sallaryAccountNowBeforeAdding = sallaryAccountNowBeforeAdding +
// double.parse(selectedAmount.toString());
// box.write(BoxName.passengerWalletTotal, sallaryAccountNowBeforeAdding);
});
isLoading = false;
update();
}
void onChangedPaymentMethodWallet(bool? value) {
if (box.read(BoxName.passengerWalletTotal) == null ||
double.parse(box.read(BoxName.passengerWalletTotal).toString()) <
totalPassenger) {
isWalletChecked = false;
isWalletChecked ? isCashChecked = true : isCashChecked = true;
update();
} else {
isWalletChecked = !isWalletChecked;
isWalletChecked ? isCashChecked = false : isCashChecked = true;
update();
}
}
void onChangedPaymentMethodCash(bool? value) {
isCashChecked = !isCashChecked;
isCashChecked ? isWalletChecked = false : isWalletChecked = true;
update();
if (box.read(BoxName.passengerWalletTotal) == null ||
double.parse(box.read(BoxName.passengerWalletTotal)) < totalPassenger) {
isWalletChecked = false;
isCashChecked = !isCashChecked;
isCashChecked ? isWalletChecked = false : isWalletChecked = false;
update();
} else {
isCashChecked = !isCashChecked;
isCashChecked ? isWalletChecked = false : isWalletChecked = true;
update();
}
}
void applyPromoCodeToPassenger() async {
@@ -120,6 +154,72 @@ class PaymentController extends GetxController {
}
}
Future<void> initializePaymentSheet(String clientSecret) async {
await Stripe.instance.initPaymentSheet(
paymentSheetParameters: SetupPaymentSheetParameters(
// intentConfiguration: IntentConfiguration.fromJson({}),
// applePay: const PaymentSheetApplePay(merchantCountryCode: 'US'),
// googlePay: const PaymentSheetGooglePay(merchantCountryCode: 'US'),
paymentIntentClientSecret: clientSecret,
merchantDisplayName: 'Sefer',
billingDetails: BillingDetails(
name: box.read(BoxName.nameDriver) == null
? box.read(BoxName.name).toString()
: box.read(BoxName.nameDriver).toString(),
email: box.read(BoxName.emailDriver) == null
? box.read(BoxName.email).toString()
: box.read(BoxName.emailDriver).toString(),
phone: box.read(BoxName.phoneDriver) == null
? box.read(BoxName.phone).toString()
: box.read(BoxName.phoneDriver).toString(),
address: const Address(
city: 'city',
country: 'United States',
line1: '',
line2: '',
postalCode: '12345',
state: 'Boston')),
allowsDelayedPaymentMethods: true,
customerEphemeralKeySecret: Stripe.merchantIdentifier,
appearance: const PaymentSheetAppearance(
shapes: PaymentSheetShape(borderRadius: 12),
colors: PaymentSheetAppearanceColors(
background: AppColor.secondaryColor,
),
),
billingDetailsCollectionConfiguration:
const BillingDetailsCollectionConfiguration(
name: CollectionMode.always,
phone: CollectionMode.always,
email: CollectionMode.always,
),
),
);
}
Future<String> getClientSecret(String amount, currency) async {
var res = await CRUD().postStripe(
link: 'https://api.stripe.com/v1/payment_intents',
payload: {'amount': amount, 'currency': currency},
);
// Convert the res object to a JSON object
final jsonResponse = jsonDecode(res);
print(jsonResponse);
// Check if the client_secret property exists and is not null
if (jsonResponse.containsKey('client_secret') &&
jsonResponse['client_secret'] != null) {
// Return the client_secret property
return jsonResponse['client_secret'] as String;
} else {
throw Exception('Failed to fetch client secret');
}
}
Future<void> configure3dSecureFuture() async {
await Stripe.instance.openApplePaySetup();
}
Future<void> makePaymentPayPal(BuildContext context) async {
try {
// Check if local authentication is available
@@ -189,12 +289,7 @@ class PaymentController extends GetxController {
note: "Contact us for any questions on your order.",
onSuccess: (Map params) async {
print("onSuccess: $params");
await CRUD()
.post(link: AppLink.addPassengersWallet, payload: {
'passenger_id':
box.read(BoxName.passengerID).toString(),
'balance': selectedAmount.toString()
});
addPassengerWallet();
changePromoSheetDialogue();
await getPassengerWallet();
},
@@ -223,44 +318,6 @@ class PaymentController extends GetxController {
}
}
Future<void> initializePaymentSheet(String clientSecret) async {
await Stripe.instance.initPaymentSheet(
paymentSheetParameters: SetupPaymentSheetParameters(
paymentIntentClientSecret: clientSecret,
merchantDisplayName: 'Sefer',
billingDetails: BillingDetails(
name: box.read(BoxName.nameDriver).toString(),
email: box.read(BoxName.emailDriver).toString(),
phone: box.read(BoxName.phoneDriver).toString(),
),
billingDetailsCollectionConfiguration:
const BillingDetailsCollectionConfiguration(
name: CollectionMode.always,
phone: CollectionMode.always,
email: CollectionMode.always,
)),
);
}
Future<String> getClientSecret(String amount, currency) async {
var res = await CRUD().postStripe(
link: 'https://api.stripe.com/v1/payment_intents',
payload: {'amount': amount, 'currency': currency},
);
// Convert the res object to a JSON object
final jsonResponse = jsonDecode(res);
print(jsonResponse);
// Check if the client_secret property exists and is not null
if (jsonResponse.containsKey('client_secret') &&
jsonResponse['client_secret'] != null) {
// Return the client_secret property
return jsonResponse['client_secret'] as String;
} else {
throw Exception('Failed to fetch client secret');
}
}
@override
void onInit() {
getPassengerWallet();

View File

@@ -0,0 +1,41 @@
import 'dart:convert';
import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:ride/constant/box_name.dart';
import 'package:ride/constant/links.dart';
import 'package:ride/controller/functions/crud.dart';
import 'package:ride/main.dart';
class CaptainProfileController extends GetxController {
bool isLoading = false;
TextEditingController vin = TextEditingController();
TextEditingController color = TextEditingController();
TextEditingController make = TextEditingController();
TextEditingController model = TextEditingController();
TextEditingController year = TextEditingController();
TextEditingController expirationDate = TextEditingController();
Future updateFields() async {
var res = await CRUD().post(link: AppLink.updateRegisrationCar, payload: {
'driverID': box.read(BoxName.driverID),
'vin': vin.text,
'color': color.text,
'model': model.text,
'make': make.text,
'year': year.text,
'expirationDate': expirationDate.text,
});
if (jsonDecode(res)['status'] == 'success') {
box.write(BoxName.vin, vin.text);
box.write(BoxName.color, color.text);
box.write(BoxName.model, model.text);
box.write(BoxName.make, make.text);
box.write(BoxName.year, year.text);
box.write(BoxName.expirationDate, expirationDate.text);
Get.back();
}
}
}

View File

@@ -21,7 +21,8 @@ class DbSql {
path,
version: 1,
onCreate: (db, version) async {
await db.execute('''
await db.execute(
'''
CREATE TABLE IF NOT EXISTS ${TableName.carLocations}(
id INTEGER PRIMARY KEY AUTOINCREMENT,
driver_id TEXT,
@@ -31,7 +32,8 @@ class DbSql {
updated_at TEXT
)
''');
await db.execute('''
await db.execute(
'''
CREATE TABLE IF NOT EXISTS ${TableName.placesFavorite}(
id INTEGER PRIMARY KEY AUTOINCREMENT,
latitude REAL,
@@ -40,7 +42,8 @@ class DbSql {
rate TEXT
)
''');
await db.execute('''
await db.execute(
'''
CREATE TABLE IF NOT EXISTS ${TableName.driverOrdersRefuse}(
id INTEGER PRIMARY KEY AUTOINCREMENT,
order_id TEXT,
@@ -48,12 +51,20 @@ class DbSql {
driver_id TEXT
)
''');
await db.execute('''
await db.execute(
'''
CREATE TABLE IF NOT EXISTS ${TableName.faceDetectTimes}(
id INTEGER PRIMARY KEY AUTOINCREMENT,
faceDetectTimes INTEGER
)
''');
await db.execute(
'''
CREATE TABLE IF NOT EXISTS ${TableName.captainNotification}(
id INTEGER PRIMARY KEY AUTOINCREMENT,
faceDetectTimes INTEGER
)
''');
},
);
}

View File

@@ -1,6 +1,5 @@
import 'package:flutter/material.dart';
import 'package:flutter_rating_bar/flutter_rating_bar.dart';
import 'package:geolocator/geolocator.dart';
import 'package:get/get.dart';
import 'package:ride/constant/colors.dart';
import 'package:ride/views/widgets/elevated_btn.dart';

View File

@@ -1,8 +1,12 @@
import 'dart:io';
import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:ride/constant/colors.dart';
import 'package:ride/constant/links.dart';
import 'package:ride/constant/style.dart';
import 'package:ride/constant/table_names.dart';
import 'package:ride/controller/auth/captin/register_captin_controller.dart';
import 'package:ride/controller/functions/ocr_controller.dart';
import 'package:ride/main.dart';
import 'package:ride/views/auth/captin/car_license_page.dart';
@@ -12,8 +16,9 @@ import 'package:ride/views/widgets/mycircular.dart';
class AiPage extends StatelessWidget {
ScanDocumentsByApi scanDocumentsByApi = Get.put(ScanDocumentsByApi());
RegisterCaptainController registerCaptainController =
Get.put(RegisterCaptainController());
AiPage({super.key});
@override
Widget build(BuildContext context) {
return MyScafolld(
@@ -198,8 +203,14 @@ class AiPage extends StatelessWidget {
.toString() ==
'Same'
? MyElevatedButton(
onPressed: () =>
Get.to(() => CarLicensePage()),
onPressed: () async {
await registerCaptainController
.register();
await registerCaptainController
.addLisence();
// await scanDocumentsByApi
// .uploadImagePortrate();
},
title:
'Go to next step\nscan Car License.'
.tr,

View File

@@ -2,10 +2,8 @@ import 'dart:io';
import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:ride/constant/api_key.dart';
import 'package:ride/env/env.dart';
import 'package:ride/controller/functions/ocr_controller.dart';
import '../../../constant/box_name.dart';
import '../../../constant/style.dart';
import '../../../controller/auth/captin/ml_google_doc.dart';
import '../../../controller/auth/captin/register_captin_controller.dart';
@@ -21,6 +19,7 @@ class CarLicensePage extends StatelessWidget {
@override
Widget build(BuildContext context) {
Get.find<ScanDocumentsByApi>().uploadImagePortrate();
return MyScafolld(
title: 'Car License Card'.tr,
body: [
@@ -42,19 +41,20 @@ class CarLicensePage extends StatelessWidget {
Positioned(
top: 50,
child: SizedBox(
height: Get.height * .7,
height: Get.height * .6,
width: Get.width,
child: buildImageWithBoundingBoxes(),
),
),
Positioned(
bottom: 20,
bottom: Get.height * .2,
left: Get.width * .2,
right: Get.width * .2,
child: MyElevatedButton(
title: 'Register'.tr,
onPressed: () async {
registerCaptainController.addLisence();
// registerCaptainController.addLisence();
// registerCaptainController.register();
registerCaptainController.addRegisrationCarForDriver(
carRegistrationRecognizerController.extracted['vin'],
carRegistrationRecognizerController.extracted['make'],
@@ -67,7 +67,6 @@ class CarLicensePage extends StatelessWidget {
carRegistrationRecognizerController
.extracted['registration_date'],
);
registerCaptainController.register();
},
)),
],

View File

@@ -148,10 +148,13 @@ class LoginCaptin extends StatelessWidget {
'Please enter your phone number.'.tr,
),
validator: (value) {
if (value!.isEmpty ||
(value.length > 6)) {
if (value!.isEmpty) {
return 'Please enter Your Password.'.tr;
}
if (value.length < 6) {
return 'Password must br at least 6 character.'
.tr;
}
return null;
},
),
@@ -261,88 +264,91 @@ class LoginCaptin extends StatelessWidget {
Padding agreedPage() {
return Padding(
padding: const EdgeInsets.all(16),
child: Column(
children: [
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Image.asset(
'assets/images/notepad.png',
width: Get.width * .2,
),
SizedBox(
width: Get.width * .7,
child: Text(
'Accept Ride\'s Terms & Review Privacy Notice'.tr,
style: AppStyle.headtitle2,
),
),
],
),
const SizedBox(
height: 30,
),
RichText(
text: TextSpan(
text:
'By selecting "I Agree" below, I have reviewed and agree to the Terms of Use and acknowledge the ',
style: AppStyle.title,
children: <TextSpan>[
TextSpan(
text: 'Privacy Notice',
style: const TextStyle(
decoration: TextDecoration.underline,
color: AppColor.blueColor),
recognizer: TapGestureRecognizer()
..onTap = () {
Get.defaultDialog(
title: ''.tr,
content: const SizedBox(
height: 400,
width: 400,
child: SingleChildScrollView(
child: HtmlWidget(AppInformation.privacyPolicy),
),
));
}),
const TextSpan(
text: '. I am at least 18 years of age.',
),
],
),
),
const SizedBox(
height: 100,
),
GetBuilder<LoginController>(
builder: (controller) => Column(
child: SingleChildScrollView(
child: Column(
children: [
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Row(
children: [
Checkbox.adaptive(
autofocus: true,
tristate: true,
splashRadius: 25,
activeColor: AppColor.primaryColor,
value: controller.isAgreeTerms,
onChanged: (value) => controller.changeAgreeTerm(),
),
Text(
'I Agree'.tr,
style: controller.isAgreeTerms
? AppStyle.title
: AppStyle.title
.copyWith(color: AppColor.accentColor),
),
],
Image.asset(
'assets/images/notepad.png',
width: Get.width * .2,
),
SizedBox(
width: Get.width * .7,
child: Text(
'Accept Ride\'s Terms & Review Privacy Notice'.tr,
style: AppStyle.headtitle2,
),
),
MyElevatedButton(
title: 'Submit'.tr,
onPressed: () => controller.saveAgreementTerms()),
],
),
)
],
const SizedBox(
height: 30,
),
RichText(
text: TextSpan(
text:
'By selecting "I Agree" below, I have reviewed and agree to the Terms of Use and acknowledge the ',
style: AppStyle.title,
children: <TextSpan>[
TextSpan(
text: 'Privacy Notice',
style: const TextStyle(
decoration: TextDecoration.underline,
color: AppColor.blueColor),
recognizer: TapGestureRecognizer()
..onTap = () {
Get.defaultDialog(
title: ''.tr,
content: const SizedBox(
height: 400,
width: 400,
child: SingleChildScrollView(
child:
HtmlWidget(AppInformation.privacyPolicy),
),
));
}),
const TextSpan(
text: '. I am at least 18 years of age.',
),
],
),
),
const SizedBox(
height: 100,
),
GetBuilder<LoginController>(
builder: (controller) => Column(
children: [
Row(
children: [
Checkbox.adaptive(
autofocus: true,
tristate: true,
splashRadius: 25,
activeColor: AppColor.primaryColor,
value: controller.isAgreeTerms,
onChanged: (value) => controller.changeAgreeTerm(),
),
Text(
'I Agree'.tr,
style: controller.isAgreeTerms
? AppStyle.title
: AppStyle.title
.copyWith(color: AppColor.accentColor),
),
],
),
MyElevatedButton(
title: 'Submit'.tr,
onPressed: () => controller.saveAgreementTerms()),
],
),
)
],
),
),
);
}

View File

@@ -250,11 +250,11 @@ class RegisterCaptin extends StatelessWidget {
MyElevatedButton(
title: 'Next'.tr,
onPressed: () => controller.nextToAIDetection()),
MyElevatedButton(
//todo remove it for test
title: 'Car registration ai '.tr,
kolor: AppColor.blueColor,
onPressed: () => Get.to(() => CarLicensePage())),
// MyElevatedButton(
// //todo remove it for test
// title: 'Car registration ai '.tr,
// kolor: AppColor.blueColor,
// onPressed: () => Get.to(() => CarLicensePage())),
// controller.isloading
// ? const MyCircularProgressIndicator()

View File

@@ -1,5 +1,7 @@
import 'package:animated_text_kit/animated_text_kit.dart';
import 'package:flutter/gestures.dart';
import 'package:flutter/material.dart';
import 'package:flutter_widget_from_html/flutter_widget_from_html.dart';
import 'package:get/get.dart';
import 'package:ride/constant/box_name.dart';
import 'package:ride/constant/colors.dart';
@@ -9,6 +11,7 @@ import 'package:ride/views/auth/captin/login_captin.dart';
import 'package:ride/views/widgets/elevated_btn.dart';
import 'package:ride/views/widgets/my_scafold.dart';
import '../../constant/info.dart';
import '../../controller/auth/login_controller.dart';
import '../widgets/mycircular.dart';
import 'register_page.dart';
@@ -138,10 +141,13 @@ class LoginPage extends StatelessWidget {
'Please enter your phone number.'.tr,
),
validator: (value) {
if (value!.isEmpty ||
(value.length > 6)) {
if (value!.isEmpty) {
return 'Please enter Your Password.'.tr;
}
if (value.length < 6) {
return 'Password must br at least 6 character.'
.tr;
}
return null;
},
),
@@ -202,64 +208,91 @@ class LoginPage extends StatelessWidget {
Padding agreedPage() {
return Padding(
padding: const EdgeInsets.all(16),
child: Column(
children: [
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Image.asset(
'assets/images/notepad.png',
width: Get.width * .2,
),
SizedBox(
width: Get.width * .7,
child: Text(
'Accept Ride\'s Terms & Review Privacy Notice'.tr,
style: AppStyle.headtitle2,
),
),
],
),
const SizedBox(
height: 30,
),
Text(
'By selecting "I Agree" below, I have reviewed and agree to the Terms of Use and acknowledge the Privacy Notice. I am at least 18 years of age.'
.tr,
style: AppStyle.title,
),
const SizedBox(
height: 100,
),
GetBuilder<LoginController>(
builder: (controller) => Column(
child: SingleChildScrollView(
child: Column(
children: [
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Row(
children: [
Checkbox.adaptive(
autofocus: true,
tristate: true,
splashRadius: 25,
activeColor: AppColor.primaryColor,
value: controller.isAgreeTerms,
onChanged: (value) => controller.changeAgreeTerm(),
),
Text(
'I Agree'.tr,
style: controller.isAgreeTerms
? AppStyle.title
: AppStyle.title
.copyWith(color: AppColor.accentColor),
),
],
Image.asset(
'assets/images/notepad.png',
width: Get.width * .2,
),
SizedBox(
width: Get.width * .7,
child: Text(
'Accept Ride\'s Terms & Review Privacy Notice'.tr,
style: AppStyle.headtitle2,
),
),
MyElevatedButton(
title: 'Submit'.tr,
onPressed: () => controller.saveAgreementTerms())
],
),
)
],
const SizedBox(
height: 30,
),
RichText(
text: TextSpan(
text:
'By selecting "I Agree" below, I have reviewed and agree to the Terms of Use and acknowledge the ',
style: AppStyle.title,
children: <TextSpan>[
TextSpan(
text: 'Privacy Notice',
style: const TextStyle(
decoration: TextDecoration.underline,
color: AppColor.blueColor),
recognizer: TapGestureRecognizer()
..onTap = () {
Get.defaultDialog(
title: ''.tr,
content: const SizedBox(
height: 400,
width: 400,
child: SingleChildScrollView(
child:
HtmlWidget(AppInformation.privacyPolicy),
),
));
}),
const TextSpan(
text: '. I am at least 18 years of age.',
),
],
),
),
const SizedBox(
height: 100,
),
GetBuilder<LoginController>(
builder: (controller) => Column(
children: [
Row(
children: [
Checkbox.adaptive(
autofocus: true,
tristate: true,
splashRadius: 25,
activeColor: AppColor.primaryColor,
value: controller.isAgreeTerms,
onChanged: (value) => controller.changeAgreeTerm(),
),
Text(
'I Agree'.tr,
style: controller.isAgreeTerms
? AppStyle.title
: AppStyle.title
.copyWith(color: AppColor.accentColor),
),
],
),
MyElevatedButton(
title: 'Submit'.tr,
onPressed: () => controller.saveAgreementTerms()),
],
),
)
],
),
),
);
}

View File

@@ -156,9 +156,13 @@ class RegisterPage extends StatelessWidget {
hintText: 'Enter your Password'.tr,
),
validator: (value) {
if (value!.isEmpty || (value.length > 6)) {
if (value!.isEmpty) {
return 'Please enter Your Password.'.tr;
}
if (value.length < 6) {
return 'Password must br at least 6 character.'
.tr;
}
return null;
},
),

View File

@@ -1,12 +1,12 @@
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/auth/captin/history_captain.dart';
import 'package:ride/views/home/Captin/history/history_details_page.dart';
import 'package:ride/views/widgets/elevated_btn.dart';
import 'package:ride/views/widgets/my_scafold.dart';
import 'package:ride/views/widgets/mycircular.dart';
import '../../../../constant/colors.dart';
import '../../../../constant/style.dart';
import '../../../../controller/auth/captin/history_captain.dart';
import '../../../widgets/elevated_btn.dart';
import '../../../widgets/my_scafold.dart';
import '../../../widgets/mycircular.dart';
class HistoryCaptain extends StatelessWidget {
const HistoryCaptain({super.key});

View File

@@ -41,7 +41,7 @@ class DrawerCaptain extends StatelessWidget {
title: const Text('Wallet'),
onTap: () {
// Handle wallet item tap
Get.to(() => const WaletCaptain(), transition: Transition.native);
Get.to(() => WaletCaptain(), transition: Transition.native);
},
),
ListTile(
@@ -76,7 +76,7 @@ class DrawerCaptain extends StatelessWidget {
title: const Text('Helping Center'),
onTap: () {
// Handle helping center item tap
Get.to(() => const HelpCaptain(), transition: Transition.size);
Get.to(() => HelpCaptain(), transition: Transition.size);
},
),
ListTile(

View File

@@ -1,15 +1,155 @@
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/captin/help/help_controller.dart';
import 'package:ride/views/home/Captin/home_captain/help_details_replay_page.dart';
import 'package:ride/views/widgets/my_scafold.dart';
import '../../../widgets/elevated_btn.dart';
import '../../../widgets/mycircular.dart';
class HelpCaptain extends StatelessWidget {
const HelpCaptain({super.key});
HelpCaptain({super.key});
@override
Widget build(BuildContext context) {
Get.put(HelpController());
return MyScafolld(
title: 'Helping Page'.tr,
body: [],
body: [
Positioned(
top: Get.height * .025,
right: 20,
left: 20,
child: Card(
color: AppColor.yellowColor,
child: Padding(
padding: const EdgeInsets.all(8.0),
child: Text(
'If you need any help or have question this is right site to do that and your welcome'
.tr,
style: AppStyle.title,
),
),
),
),
Positioned(
top: Get.height * .15,
right: 20,
left: 20,
child: Card(
elevation: 3,
color: AppColor.secondaryColor,
child: Padding(
padding: const EdgeInsets.all(8.0),
child: GetBuilder<HelpController>(
builder: (helpController) => Form(
key: helpController.formKey,
child: Column(
children: [
TextFormField(
controller: helpController.helpQuestionController,
decoration: const InputDecoration(
border: OutlineInputBorder(),
hintText: 'Enter your Question here',
labelText: 'Question',
),
validator: (value) {
if (value == null || value.isEmpty) {
return 'Please enter your Question.';
}
return null;
},
),
const SizedBox(height: 20),
helpController.isLoading
? const MyCircularProgressIndicator()
: MyElevatedButton(
onPressed: () {
if (helpController.formKey.currentState!
.validate()) {
helpController.addHelpQuestion();
// Clear the feedback form
helpController.formKey.currentState!
.reset();
}
},
title: 'Submit Question'.tr,
),
],
)),
),
)),
),
Positioned(
bottom: 3,
right: 8,
left: 8,
child: GetBuilder<HelpController>(
builder: (helpController) => Container(
height: Get.height * .63,
decoration: AppStyle.boxDecoration,
child: ListView.builder(
itemCount:
helpController.helpQuestionDate['message'].length,
itemBuilder: (BuildContext context, int index) {
var list =
helpController.helpQuestionDate['message'][index];
return Padding(
padding: const EdgeInsets.all(3),
child: Container(
decoration: BoxDecoration(
border: Border.all(
color: AppColor.greenColor,
width: 3,
),
borderRadius: BorderRadius.circular(11)),
// elevation: 3,
// color: AppColor.greenColor,
child: GestureDetector(
onTap: () {
print(list['id']);
helpController.getindex(
list['id'], list['helpQuestion']);
helpController
.getHelpRepley(list['id'].toString());
Get.to(
() => const HelpDetailsReplayPage(),
);
},
child: Padding(
padding: const EdgeInsets.all(2),
child: Row(
mainAxisAlignment:
MainAxisAlignment.spaceBetween,
children: [
SizedBox(
width: Get.width * .6,
child: Text(
list['helpQuestion'],
style: AppStyle.title,
),
),
SizedBox(
width: Get.width * .3,
child: Text(
list['datecreated'],
style: AppStyle.subtitle,
),
),
],
),
),
),
),
);
},
),
)),
)
],
isleading: true,
);
}

View File

@@ -0,0 +1,83 @@
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/views/widgets/mycircular.dart';
import '../../../../controller/home/captin/help/help_controller.dart';
import '../../../widgets/my_scafold.dart';
class HelpDetailsReplayPage extends StatelessWidget {
const HelpDetailsReplayPage({super.key});
@override
Widget build(BuildContext context) {
Get.find<HelpController>();
return GetBuilder<HelpController>(
builder: (helpController) => MyScafolld(
title: 'Help Details'.tr,
body: [
helpController.isLoading
? const MyCircularProgressIndicator()
: Column(
children: [
Padding(
padding: const EdgeInsets.symmetric(horizontal: 10),
child: Row(
mainAxisAlignment: MainAxisAlignment.start,
children: [
Card(
elevation: 3,
child: Container(
width: Get.width * .66,
color: Colors.transparent,
child: Padding(
padding: const EdgeInsets.all(8.0),
child: Text(
helpController.qustion,
style: AppStyle.title,
),
),
),
),
]),
),
Row(
mainAxisAlignment: MainAxisAlignment.end,
children: [
Card(
elevation: 3,
child: Container(
color: Colors.transparent,
width: Get.width * .66,
child: Padding(
padding: const EdgeInsets.all(8.0),
child: helpController.status ==
'not yet' ||
helpController
.helpQuestionRepleyDate[
'message']['replay']
.toString() ==
'not yet'
? Text(
'No Response yet.'.tr,
style: AppStyle.title,
)
: Text(
helpController
.helpQuestionRepleyDate[
'message']['replay']
.toString(),
style: AppStyle.title,
),
),
),
),
]),
],
)
],
isleading: true,
));
}
}

View File

@@ -15,8 +15,6 @@ import '../../../../controller/home/captin/widget/connect.dart';
import '../../../../controller/home/captin/widget/left_menu_map_captain.dart';
import '../../../../main.dart';
import '../../../widgets/circle_container.dart';
import '../../../widgets/elevated_btn.dart';
import '../text_scanner.dart';
class HomeCaptain extends StatelessWidget {
HomeCaptain({super.key});

View File

@@ -24,7 +24,7 @@ class PassengerInfoWindow extends StatelessWidget {
? Stack(
children: [
Positioned(
bottom: 6,
bottom: 50,
left: 8,
child: AnimatedContainer(
duration: const Duration(milliseconds: 300),
@@ -37,33 +37,35 @@ class PassengerInfoWindow extends StatelessWidget {
crossAxisAlignment: CrossAxisAlignment.start,
children: [
DefaultTextStyle(
style: AppStyle.title,
child: AnimatedTextKit(
animatedTexts: [
ScaleAnimatedText(
'Go to passenger Location now'.tr,
),
WavyAnimatedText(
'Go to passenger Location now'.tr),
FlickerAnimatedText(
'Go to passenger Location now'.tr),
WavyAnimatedText(
'Go to passenger Location now'.tr),
],
isRepeatingAnimation: true,
onTap: () {
// print("Tap Event");
},
),
),
style: AppStyle.title,
child: Text(
'Go to passenger Location now'.tr,
style: AppStyle.title
.copyWith(color: AppColor.greenColor),
)
// AnimatedTextKit(
// animatedTexts: [
// ScaleAnimatedText(
// 'Go to passenger Location now'.tr,
// ),
// WavyAnimatedText(
// 'Go to passenger Location now'.tr),
// FlickerAnimatedText(
// 'Go to passenger Location now'.tr),
// WavyAnimatedText(
// 'Go to passenger Location now'.tr),
// ],
// isRepeatingAnimation: true,
// onTap: () {
// // print("Tap Event");
// },
// ),
),
Row(
children: [
Text('Duration of the Ride is '.tr,
style: AppStyle.title),
Text(
controller.duration.toString() +
' ' +
'Minute'.tr,
Text('${controller.duration} ${'Minute'.tr}',
style: AppStyle.title),
],
),
@@ -72,7 +74,7 @@ class PassengerInfoWindow extends StatelessWidget {
Text('Distance of the Ride is '.tr,
style: AppStyle.title),
Text(
controller.distance.toString() + ' ' + 'KM'.tr,
'${controller.distance} ${'KM'.tr}',
style: AppStyle.title,
),
],
@@ -107,8 +109,7 @@ class PassengerInfoWindow extends StatelessWidget {
launchCommunication(
'whatsapp',
controller.phone.toString(),
'Hello this is Captain'.tr +
' ${box.read(BoxName.nameDriver)}');
'${'Hello this is Captain'.tr} ${box.read(BoxName.nameDriver)}');
},
icon: const Icon(
Icons.whatshot,
@@ -119,8 +120,7 @@ class PassengerInfoWindow extends StatelessWidget {
launchCommunication(
'sms',
controller.phone.toString(),
'Hello this is Captain'.tr +
' ${box.read(BoxName.nameDriver)}');
'${'Hello this is Captain'.tr} ${box.read(BoxName.nameDriver)}');
},
icon: const Icon(
Icons.sms_rounded,
@@ -131,8 +131,7 @@ class PassengerInfoWindow extends StatelessWidget {
launchCommunication(
'email',
controller.phone.toString(),
'Hello this is Captain'.tr +
' ${box.read(BoxName.nameDriver)}');
'${'Hello this is Captain'.tr} ${box.read(BoxName.nameDriver)}');
},
icon: const Icon(
Icons.email,

View File

@@ -204,7 +204,8 @@ class OrderRequestPage extends StatelessWidget {
'driverId': myList[18].toString(),
'durationOfRideValue': myList[19].toString(),
'paymentAmount': myList[3].toString(),
'paymentMethod': myList[13].toString(),
'paymentMethod':
myList[13].toString() == 'true' ? 'visa' : 'cash'
});
},
),

View File

@@ -39,7 +39,7 @@ class MapPagePassenger extends StatelessWidget {
buttomSheetMapPage(),
hexagonClipper(),
const CancelRidePageShow(),
const CashConfirmPageShown(),
CashConfirmPageShown(),
const PaymentMethodPage(),
timerForCancelTripFromPassenger(),
// const DriverTimeArrivePassengerPage(),

View File

@@ -334,81 +334,82 @@ GetBuilder<MapPassengerController> buttomSheetMapPage() {
width: Get.width * .95,
child: Row(
mainAxisAlignment:
MainAxisAlignment.spaceBetween,
MainAxisAlignment.center,
children: [
TextButton(
onPressed: () {
Get.defaultDialog(
barrierDismissible: false,
title:
'How Many Passengers?'.tr,
titleStyle: AppStyle.title,
content: Column(
children: [
Text(
'Allowed up to 4 Passengers.'
.tr,
style: AppStyle.title,
),
SizedBox(
height:
200, // Set the desired height here
child: CupertinoPicker(
itemExtent: 32,
onSelectedItemChanged:
(index) {
controller
.onChangedPassengerCount(
index + 1);
},
children: [
Text(
'1 Passenger'.tr),
Text('2 Passengers'
.tr),
Text('3 Passengers'
.tr),
Text('4 Passengers'
.tr),
],
),
),
MyElevatedButton(
title: 'Back',
onPressed: () =>
Get.back(),
)
],
),
);
},
child: Row(
mainAxisAlignment:
MainAxisAlignment
.spaceBetween,
children: [
Text('How Many Passengers?'.tr,
style: AppStyle.title),
const SizedBox(
width: 10,
),
Container(
decoration: BoxDecoration(
border: Border.all()),
child: Padding(
padding:
const EdgeInsets.all(
3.0),
child: Text(
controller
.selectedPassengerCount
.toString(),
style: AppStyle.title),
),
),
],
),
),
// TextButton(
// onPressed: () {
// Get.defaultDialog(
// barrierDismissible: false,
// title:
// 'How Many Passengers?'.tr,
// titleStyle: AppStyle.title,
// content: Column(
// children: [
// Text(
// 'Allowed up to 4 Passengers.'
// .tr,
// style: AppStyle.title,
// ),
// SizedBox(
// height:
// 200, // Set the desired height here
// child: CupertinoPicker(
// itemExtent: 32,
// onSelectedItemChanged:
// (index) {
// controller
// .onChangedPassengerCount(
// index + 1);
// },
// children: [
// Text(
// '1 Passenger'.tr),
// Text('2 Passengers'
// .tr),
// Text('3 Passengers'
// .tr),
// Text('4 Passengers'
// .tr),
// ],
// ),
// ),
// MyElevatedButton(
// title: 'Back',
// onPressed: () =>
// Get.back(),
// )
// ],
// ),
// );
// },
// child: Row(
// mainAxisAlignment:
// MainAxisAlignment
// .spaceBetween,
// children: [
// Text('How Many Passengers?'.tr,
// style: AppStyle.title),
// const SizedBox(
// width: 10,
// ),
// Container(
// decoration: BoxDecoration(
// border: Border.all()),
// child: Padding(
// padding:
// const EdgeInsets.all(
// 3.0),
// child: Text(
// controller
// .selectedPassengerCount
// .toString(),
// style: AppStyle.title),
// ),
// ),
// ],
// ),
// ),
controller.isCashSelectedBeforeConfirmRide ==
false
? MyElevatedButton(

View File

@@ -2,17 +2,20 @@ import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:ride/constant/box_name.dart';
import 'package:ride/constant/style.dart';
import 'package:ride/views/home/my_wallet/passenger_wallet.dart';
import '../../../constant/colors.dart';
import '../../../controller/home/map_passenger_controller.dart';
import '../../../controller/payment/payment_controller.dart';
import '../../../main.dart';
import '../../widgets/elevated_btn.dart';
import '../my_wallet/passenger_wallet_dialoge.dart';
class CashConfirmPageShown extends StatelessWidget {
const CashConfirmPageShown({
CashConfirmPageShown({
super.key,
});
PaymentController paymentController = Get.put(PaymentController());
@override
Widget build(BuildContext context) {
return GetBuilder<MapPassengerController>(
@@ -39,11 +42,11 @@ class CashConfirmPageShown extends StatelessWidget {
'Payment Method'.tr,
style: AppStyle.title.copyWith(fontSize: 22),
),
IconButton(
onPressed: () =>
controller.changeCashConfirmPageShown(),
icon: const Icon(Icons.close),
),
// IconButton(
// onPressed: () =>
// controller.changeCashConfirmPageShown(),
// icon: const Icon(Icons.close),
// ),
],
),
GetBuilder<PaymentController>(
@@ -123,16 +126,38 @@ class CashConfirmPageShown extends StatelessWidget {
height: 2,
indent: 1,
),
// controller.cardNumber == null ||
// controller.cardNumber!.isEmpty
// ? MyElevatedButton(
// title: 'Add Payment Method'.tr,
// onPressed: () {
// controller.changePaymentMethodPageShown();
// CreditCardController().openPayment();
// },
// )
// : const SizedBox()
// GetBuilder<PaymentController>(
// builder: (paymentController) =>
// (paymentController.isWalletChecked == false &&
// paymentController.isCashChecked == true
// ? MyElevatedButton(
// title: 'Next'.tr,
// onPressed: () {
// controller.changeCashConfirmPageShown();
// },
// )
// : const SizedBox())),
GetBuilder<PaymentController>(
builder: (paymentController) => (box
.read(BoxName.passengerWalletTotal) ==
null ||
double.parse(box
.read(BoxName.passengerWalletTotal)) <
controller.totalPassenger)
? MyElevatedButton(
title: 'To use Wallet charge it'.tr,
onPressed: () {
Get.to(() => const PassengerWallet());
},
kolor: AppColor.redColor,
)
: MyElevatedButton(
title: 'Next'.tr,
onPressed: () {
controller.changeCashConfirmPageShown();
},
), // Add a fallback widget if none of the conditions are met
)
],
),
),

View File

@@ -4,6 +4,7 @@ import 'package:get/get.dart';
import 'package:ride/constant/box_name.dart';
import 'package:ride/controller/functions/secure_storage.dart';
import 'package:ride/controller/home/payment/credit_card_controller.dart';
import 'package:ride/main.dart';
import 'package:ride/views/widgets/elevated_btn.dart';
import '../../../constant/colors.dart';
@@ -76,7 +77,7 @@ class PaymentMethodPage extends StatelessWidget {
const SizedBox(
height: 10,
),
const CreditCardWidget(),
const MyCreditCardWidget(),
const Spacer(),
GetBuilder<CreditCardController>(
builder: (controller) => Row(
@@ -115,8 +116,8 @@ class PaymentMethodPage extends StatelessWidget {
}
}
class CreditCardWidget extends StatelessWidget {
const CreditCardWidget({
class MyCreditCardWidget extends StatelessWidget {
const MyCreditCardWidget({
super.key,
});
@@ -125,11 +126,20 @@ class CreditCardWidget extends StatelessWidget {
Get.put(CreditCardController());
return GetBuilder<CreditCardController>(
builder: (controller) => Container(
height: Get.height * .3,
height: Get.height * .35,
width: Get.width * .9,
decoration: const BoxDecoration(
color: AppColor.secondaryColor,
borderRadius: BorderRadius.all(Radius.circular(15)),
gradient: LinearGradient(colors: [
AppColor.secondaryColor,
// AppColor.blueColor,
// AppColor.greenColor,
AppColor.accentColor,
// AppColor.primaryColor,
// AppColor.redColor,
// AppColor.yellowColor
]),
boxShadow: [
BoxShadow(
spreadRadius: 3,
@@ -148,7 +158,7 @@ class CreditCardWidget extends StatelessWidget {
child: Padding(
padding: const EdgeInsets.all(8.0),
child: Column(
mainAxisAlignment: MainAxisAlignment.spaceAround,
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
SizedBox(
child: Row(
@@ -156,22 +166,33 @@ class CreditCardWidget extends StatelessWidget {
getCardIcon(controller.cardNumberController
.text), // Dynamic credit card icon
SizedBox(
width: Get.width * .1,
width: Get.width * .03,
),
SizedBox(
width: Get.width * .6,
width: Get.width * .25,
child: Text(
'Card Number',
style: AppStyle.title,
),
),
SizedBox(
width: Get.width * .03,
),
SizedBox(
width: Get.width * .4,
height: 70,
child: TextFormField(
maxLength: 16,
keyboardType: TextInputType.number,
controller: controller.cardNumberController,
style: const TextStyle(
color: AppColor.blueColor,
fontFamily: 'digital-counter-7',
fontWeight: FontWeight.bold),
decoration: const InputDecoration(
helperStyle: TextStyle(
fontFamily: 'digital-counter-7'),
labelText: 'Card Number',
// labelText: 'Card Number',
),
inputFormatters: [DigitObscuringFormatter()],
validator: (value) {
@@ -190,19 +211,30 @@ class CreditCardWidget extends StatelessWidget {
children: [
const Icon(Icons.person),
SizedBox(
width: Get.width * .1,
width: Get.width * .03,
),
SizedBox(
width: Get.width * .6,
width: Get.width * .25,
child: Text(
'Holder Name',
style: AppStyle.title,
),
),
SizedBox(
width: Get.width * .03,
),
SizedBox(
width: Get.width * .3,
child: SizedBox(
height: 50,
// height: 50,
child: TextFormField(
style: AppStyle.title,
keyboardType: TextInputType.text,
// maxLength: 16,
controller: controller.cardHolderNameController,
decoration: const InputDecoration(
labelText: 'Cardholder Name'),
// labelText: 'Cardholder Name',
),
validator: (value) {
if (value!.isEmpty) {
return 'Please enter the cardholder name'
@@ -224,28 +256,40 @@ class CreditCardWidget extends StatelessWidget {
children: [
const Icon(Icons.date_range_outlined),
SizedBox(
width: Get.width * .1,
width: Get.width * .03,
),
SizedBox(
width: Get.width * .2,
child: SizedBox(
height: 60,
child: TextFormField(
keyboardType: TextInputType.datetime,
controller:
controller.expiryDateController,
decoration: const InputDecoration(
labelText: 'Expiry Date'),
validator: (value) {
if (value!.isEmpty) {
return 'Please enter the expiry date'
.tr;
}
return null;
},
Column(
children: [
SizedBox(
width: Get.width * .2,
child: Text(
'Expiry Date',
style: AppStyle.subtitle,
),
),
),
)
SizedBox(
width: Get.width * .1,
child: SizedBox(
height: 60,
child: TextFormField(
maxLength: 4,
keyboardType: TextInputType.datetime,
controller:
controller.expiryDateController,
style: AppStyle.title,
decoration: const InputDecoration(),
validator: (value) {
if (value!.isEmpty) {
return 'Please enter the expiry date'
.tr;
}
return null;
},
),
),
)
],
),
],
),
),
@@ -257,50 +301,76 @@ class CreditCardWidget extends StatelessWidget {
SizedBox(
width: Get.width * .021,
),
SizedBox(
width: Get.width * .2,
child: SizedBox(
height: 60,
child: TextFormField(
obscureText: true,
keyboardType: TextInputType.number,
style: const TextStyle(
fontFamily: 'digital-counter-7'),
maxLength: 3,
controller: controller.cvvCodeController,
decoration: const InputDecoration(
labelText: 'CVV Code'),
validator: (value) {
if (value!.isEmpty &&
value.length != 3) {
return 'Please enter the CVV code'.tr;
}
return null;
},
Column(
children: [
SizedBox(
width: Get.width * .2,
child: Text(
'CVV Code',
style: AppStyle.subtitle,
),
),
),
SizedBox(
width: Get.width * .2,
child: SizedBox(
height: 60,
child: TextFormField(
obscureText: true,
keyboardType: TextInputType.number,
style: const TextStyle(
color: AppColor.primaryColor,
fontFamily: 'digital-counter-7'),
maxLength: 3,
controller:
controller.cvvCodeController,
decoration: const InputDecoration(
// labelText: 'CVV Code',
),
validator: (value) {
if (value!.isEmpty &&
value.length != 3) {
return 'Please enter the CVV code'
.tr;
}
return null;
},
),
),
),
],
)
],
),
),
],
),
// MyElevatedButton(
// title: 'Save'.tr,
// onPressed: () {
// if (controller.formKey.currentState!.validate()) {
// final creditCard = CreditCardModel(
// cardNumber: controller.cardNumberController.text,
// cardHolderName:
// controller.cardHolderNameController.text,
// expiryDate: controller.expiryDateController.text,
// cvvCode: controller.cvvCodeController.text,
// );
// // Process the credit card details
// // You can use GetX to handle the logic here
// }
// },
// ),
MyElevatedButton(
title: 'Save'.tr,
onPressed: () {
if (controller.formKey.currentState!.validate()) {
// final creditCard = CreditCardModel(
// cardNumber: controller.cardNumberController.text,
// cardHolderName:
// controller.cardHolderNameController.text,
// expiryDate: controller.expiryDateController.text,
// cvvCode: controller.cvvCodeController.text,
// );
// Process the credit card details
// You can use GetX to handle the logic here
if (controller.formKey.currentState!.validate()) {
SecureStorage().saveData(BoxName.cardNumber,
controller.cardNumberController.text);
SecureStorage().saveData(BoxName.cardHolderName,
controller.cardHolderNameController.text);
SecureStorage().saveData(BoxName.cvvCode,
controller.cvvCodeController.text);
SecureStorage().saveData(BoxName.expiryDate,
controller.expiryDateController.text);
}
}
},
),
],
),
))));

View File

@@ -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()
],
);
}

View 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()),
);
}
}

View 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,
),
],
),
)),
);
}
}

View File

@@ -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,
);
}

View File

@@ -1,88 +1,151 @@
import 'package:cached_network_image/cached_network_image.dart';
import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:path/path.dart';
import 'package:ride/constant/box_name.dart';
import 'package:ride/constant/style.dart';
import 'package:ride/controller/profile/captain_profile_controller.dart';
import 'package:ride/env/env.dart';
import 'package:ride/main.dart';
import 'package:ride/views/widgets/elevated_btn.dart';
import 'package:ride/views/widgets/my_scafold.dart';
import '../../widgets/my_textField.dart';
class ProfileCaptain extends StatelessWidget {
const ProfileCaptain({super.key});
@override
Widget build(BuildContext context) {
Get.put(CaptainProfileController());
return MyScafolld(
title: 'My Profile'.tr,
body: [
Padding(
padding: const EdgeInsets.all(16.0),
child: SingleChildScrollView(
child: Center(
child: Column(
crossAxisAlignment: CrossAxisAlignment.center,
children: [
CircleAvatar(
radius: Get.width * 0.26,
backgroundColor: Colors.white,
backgroundImage: CachedNetworkImageProvider(
"${Env.serverPHP}/card_image/${box.read(BoxName.driverID)}.jpg",
),
title: 'My Profile'.tr,
body: [
GetBuilder<CaptainProfileController>(
builder: (controller) => Padding(
padding: const EdgeInsets.all(16.0),
child: SingleChildScrollView(
child: Center(
child: Column(
crossAxisAlignment: CrossAxisAlignment.center,
children: [
CircleAvatar(
radius: Get.width * 0.26,
backgroundColor: Colors.white,
backgroundImage: CachedNetworkImageProvider(
"${Env.serverPHP}/card_image/${box.read(BoxName.driverID)}.jpg",
),
),
const SizedBox(height: 8.0),
Text(
box.read(BoxName.nameDriver) +
' ' +
box.read(BoxName.lastNameDriver).toString(),
style: AppStyle.title),
const SizedBox(height: 8.0),
Text('Email is :${box.read(BoxName.emailDriver)}',
style: AppStyle.title),
const SizedBox(height: 8.0),
Text('Phone Number is :${box.read(BoxName.phoneDriver)}',
style: AppStyle.title),
const SizedBox(height: 8.0),
Text('Date of Birth is :${box.read(BoxName.dobDriver)}',
style: AppStyle.title),
const SizedBox(height: 8.0),
Text('Sex is :${box.read(BoxName.sexDriver)}',
style: AppStyle.title),
const SizedBox(height: 8.0),
const Divider(
// height: 2,
endIndent: 1,
indent: 2,
thickness: 2,
),
const SizedBox(height: 8.0),
Text('Car Details'.tr, style: AppStyle.headtitle2),
const SizedBox(height: 8.0),
Text('VIN is :${box.read(BoxName.vin)}',
style: AppStyle.title),
const SizedBox(height: 8.0),
Text('Color is :${box.read(BoxName.color)}',
style: AppStyle.title),
const SizedBox(height: 8.0),
Text('Make is :${box.read(BoxName.make)}',
style: AppStyle.title),
const SizedBox(height: 8.0),
Text('Model is :${box.read(BoxName.model)}',
style: AppStyle.title),
const SizedBox(height: 8.0),
Text('Year is :${box.read(BoxName.year)}',
style: AppStyle.title),
const SizedBox(height: 8.0),
Text(
'Expiration Date :${box.read(BoxName.expirationDate)}',
style: AppStyle.title),
const SizedBox(height: 8.0),
],
),
const SizedBox(height: 8.0),
Text(
box.read(BoxName.nameDriver) +
' ' +
box.read(BoxName.lastNameDriver).toString(),
style: AppStyle.title),
const SizedBox(height: 8.0),
Text('Email is :${box.read(BoxName.emailDriver)}',
style: AppStyle.title),
const SizedBox(height: 8.0),
Text('Phone Number is :${box.read(BoxName.phoneDriver)}',
style: AppStyle.title),
const SizedBox(height: 8.0),
Text('Date of Birth is :${box.read(BoxName.dobDriver)}',
style: AppStyle.title),
const SizedBox(height: 8.0),
Text('Sex is :${box.read(BoxName.sexDriver)}',
style: AppStyle.title),
const SizedBox(height: 8.0),
const Divider(
// height: 2,
endIndent: 1,
indent: 2,
thickness: 2,
),
const SizedBox(height: 8.0),
Text('Car Details'.tr, style: AppStyle.headtitle2),
const SizedBox(height: 8.0),
Text('VIN is :${box.read(BoxName.vin)}',
style: AppStyle.title),
const SizedBox(height: 8.0),
Text('Color is :${box.read(BoxName.color)}',
style: AppStyle.title),
const SizedBox(height: 8.0),
Text('Make is :${box.read(BoxName.make)}',
style: AppStyle.title),
const SizedBox(height: 8.0),
Text('Model is :${box.read(BoxName.model)}',
style: AppStyle.title),
const SizedBox(height: 8.0),
Text('Year is :${box.read(BoxName.year)}',
style: AppStyle.title),
const SizedBox(height: 8.0),
Text('Expiration Date :${box.read(BoxName.expirationDate)}',
style: AppStyle.title),
const SizedBox(height: 8.0),
],
),
),
),
)
],
isleading: true,
action: GetBuilder<CaptainProfileController>(
builder: (controller) => IconButton(
onPressed: () {
Get.defaultDialog(
title: 'Edit Your data',
titleStyle: AppStyle.title,
content: SizedBox(
height: Get.height * .4,
child: SingleChildScrollView(
child: Column(
children: [
MyTextForm(
controller: controller.vin,
hint: 'write vin for your car',
label: 'VIN',
type: TextInputType.emailAddress,
),
MyTextForm(
controller: controller.color,
hint: 'write Color for your car',
label: 'Color',
type: TextInputType.emailAddress,
),
MyTextForm(
controller: controller.make,
hint: 'write Make for your car',
label: 'Make',
type: TextInputType.emailAddress,
),
MyTextForm(
controller: controller.model,
hint: 'write Model for your car',
label: 'Model',
type: TextInputType.emailAddress,
),
MyTextForm(
controller: controller.year,
hint: 'write Year for your car',
label: 'Year',
type: TextInputType.number,
),
MyTextForm(
controller: controller.expirationDate,
hint: 'write Expiration Date for your car',
label: 'Expiration Date',
type: TextInputType.datetime),
MyElevatedButton(
title: 'Update'.tr,
onPressed: () => controller.updateFields())
],
),
),
));
},
icon: const Icon(Icons.edit),
),
),
],
isleading: true,
);
));
}
}

View File

@@ -1,15 +1,73 @@
import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:ride/constant/style.dart';
import 'package:ride/controller/auth/captin/notification_captain_controller.dart';
import 'package:ride/views/widgets/elevated_btn.dart';
import 'package:ride/views/widgets/my_scafold.dart';
import 'package:ride/views/widgets/mycircular.dart';
class NotificationCaptain extends StatelessWidget {
const NotificationCaptain({super.key});
@override
Widget build(BuildContext context) {
Get.put(NotificationCaptainController());
return MyScafolld(
title: 'Notifications'.tr,
body: [],
body: [
GetBuilder<NotificationCaptainController>(
builder: (notificationCaptainController) =>
notificationCaptainController.isloading
? const MyCircularProgressIndicator()
: SafeArea(
child: ListView.builder(
itemCount: notificationCaptainController
.notificationData['message'].length,
itemBuilder: (BuildContext context, int index) {
if (notificationCaptainController
.notificationData['message'] ==
"No notification data found") {
Get.defaultDialog();
}
var res = notificationCaptainController
.notificationData['message'][index];
return Card(
elevation: 4,
child: ListTile(
onTap: () {
Get.defaultDialog(
title: res['title'],
titleStyle: AppStyle.title,
content: SizedBox(
width: Get.width * .8,
height: Get.height * .4,
child: Text(
res['body'],
style: AppStyle.title,
),
),
confirm: MyElevatedButton(
title: 'Ok',
onPressed: () {
//todo sql readen
}));
},
leading:
const Icon(Icons.notification_important),
title: Text(
res['title'],
style: AppStyle.title,
),
subtitle: Text(
res['body'],
style: AppStyle.subtitle,
),
),
);
},
),
))
],
isleading: true,
);
}

View File

@@ -42,6 +42,17 @@ class MyScafolld extends StatelessWidget {
style: AppStyle.title.copyWith(fontSize: 30),
),
),
body: SafeArea(child: Stack(children: body)));
body: SafeArea(
child: SingleChildScrollView(
child: Column(
mainAxisAlignment: MainAxisAlignment.start,
children: [
SizedBox(
height: Get.height,
width: Get.width,
child: Stack(children: body))
],
),
)));
}
}

View File

@@ -0,0 +1,53 @@
import 'package:flutter/material.dart';
import 'package:get/get.dart';
import '../../constant/colors.dart';
class MyTextForm extends StatelessWidget {
const MyTextForm({
super.key,
required this.controller,
required this.label,
required this.hint,
required this.type,
});
final TextEditingController controller;
final String label, hint;
final TextInputType type;
@override
Widget build(BuildContext context) {
return Padding(
padding: const EdgeInsets.only(bottom: 10),
child: SizedBox(
width: Get.width * .8,
child: TextFormField(
keyboardType: type,
cursorColor: AppColor.accentColor,
controller: controller,
decoration: InputDecoration(
focusedBorder: OutlineInputBorder(
borderSide: const BorderSide(
color: AppColor.primaryColor,
width: 2.0,
),
borderRadius: BorderRadius.circular(10),
),
focusColor: AppColor.accentColor,
fillColor: AppColor.accentColor,
border: const OutlineInputBorder(
borderRadius: BorderRadius.all(Radius.circular(12))),
labelText: label.tr,
hintText: hint.tr,
),
validator: (value) {
if (value!.isEmpty || value.length != 10) {
return 'Please enter $label.'.tr;
}
return null;
},
),
),
);
}
}

View File

@@ -31,7 +31,6 @@ dependencies:
custom_searchable_dropdown: ^2.1.1
animated_text_kit: ^4.2.2
flutter_secure_storage: ^9.0.0
# credit_card_scanner: ^1.0.5
geolocator: ^10.0.0
flutter_paypal: ^0.2.0
flutter_launcher_icons: ^0.13.1