This commit is contained in:
Hamza-Ayed
2024-06-28 19:09:55 +03:00
parent 715726a52d
commit 6fb79baab4
17 changed files with 332 additions and 315 deletions

View File

@@ -55,8 +55,8 @@ android {
// For more information, see: https://docs.flutter.dev/deployment/android#reviewing-the-gradle-build-configuration. // For more information, see: https://docs.flutter.dev/deployment/android#reviewing-the-gradle-build-configuration.
minSdkVersion 23 minSdkVersion 23
targetSdkVersion flutter.targetSdkVersion targetSdkVersion flutter.targetSdkVersion
versionCode 36 versionCode 40
versionName '1.5.36' versionName '1.5.40'
// manifestPlaceholders = [mapsApiKey: 'android/app/src/main/AndroidManifest.xml'] // manifestPlaceholders = [mapsApiKey: 'android/app/src/main/AndroidManifest.xml']
} }

View File

@@ -1,16 +1,18 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"> <manifest xmlns:android="http://schemas.android.com/apk/res/android">
<uses-permission android:name="android.permission.RECORD_AUDIO" /> <uses-permission android:name="android.permission.RECORD_AUDIO" />
<!-- Optional: Add this permission if you want to use bluetooth telephony device like headset/earbuds (min SDK: 23) --> <!-- Optional: Add this permission if you want to use bluetooth telephony device like
headset/earbuds (min SDK: 23) -->
<uses-permission android:name="android.permission.MODIFY_AUDIO_SETTINGS" /> <uses-permission android:name="android.permission.MODIFY_AUDIO_SETTINGS" />
<!-- Optional: Add this permission if you want to save your recordings in public folders --> <!-- Optional: Add this permission if you want to save your recordings in public folders -->
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" /> <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.ACCESS_BACKGROUND_LOCATION"/> <uses-permission android:name="android.permission.ACCESS_BACKGROUND_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"/> <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/> <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.FOREGROUND_SERVICE"/> <uses-permission android:name="android.permission.FOREGROUND_SERVICE" />
<uses-permission android:name="android.permission.USE_BIOMETRIC"/> <uses-permission android:name="android.permission.FOREGROUND_SERVICE_MEDIA_PROJECTION" />
<uses-permission android:name="android.permission.USE_BIOMETRIC" />
<uses-permission android:name="android.permission.VIBRATE" /> <uses-permission android:name="android.permission.VIBRATE" />
<!-- Permissions required by the SDK --> <!-- Permissions required by the SDK -->
@@ -32,27 +34,34 @@
<uses-feature android:name="android.hardware.camera.autofocus" /> <uses-feature android:name="android.hardware.camera.autofocus" />
<application android:label="SEFER" android:name="${applicationName}" android:icon="@mipmap/launcher_icon"> <application android:label="SEFER" android:name="${applicationName}"
<activity android:name=".MainActivity" android:exported="true" android:launchMode="singleTop" android:theme="@style/LaunchTheme" android:configChanges="orientation|keyboardHidden|keyboard|screenSize|smallestScreenSize|locale|layoutDirection|fontScale|screenLayout|density|uiMode" android:hardwareAccelerated="true" android:windowSoftInputMode="adjustResize"> android:icon="@mipmap/launcher_icon">
<activity android:name=".MainActivity" android:exported="true" android:launchMode="singleTop"
android:theme="@style/LaunchTheme"
android:configChanges="orientation|keyboardHidden|keyboard|screenSize|smallestScreenSize|locale|layoutDirection|fontScale|screenLayout|density|uiMode"
android:hardwareAccelerated="true" android:windowSoftInputMode="adjustResize">
<!-- Specifies an Android theme to apply to this Activity as soon as <!-- Specifies an Android theme to apply to this Activity as soon as
the Android process has started. This theme is visible to the user the Android process has started. This theme is visible to the user
while the Flutter UI initializes. After that, this theme continues while the Flutter UI initializes. After that, this theme continues
to determine the Window background behind the Flutter UI. --> to determine the Window background behind the Flutter UI. -->
<meta-data android:name="io.flutter.embedding.android.NormalTheme" android:resource="@style/NormalTheme"/> <meta-data android:name="io.flutter.embedding.android.NormalTheme"
android:resource="@style/NormalTheme" />
<intent-filter> <intent-filter>
<action android:name="android.intent.action.MAIN"/> <action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER"/> <category android:name="android.intent.category.LAUNCHER" />
</intent-filter> </intent-filter>
</activity> </activity>
<meta-data android:name="com.google.android.geo.API_KEY" android:value="@string/api_key"/> <meta-data android:name="com.google.android.geo.API_KEY" android:value="@string/api_key" />
<meta-data android:name="com.google.firebase.messaging.default_notification_channel_id" android:value="@string/default_notification_channel_id"/> <meta-data android:name="com.google.firebase.messaging.default_notification_channel_id"
<meta-data android:name="com.android.application.versionCode" android:value="1"/> android:value="@string/default_notification_channel_id" />
<meta-data android:name="com.android.application.versionCode" android:value="1" />
<!-- Don't delete the meta-data below. <!-- Don't delete the meta-data below.
This is used by the Flutter tool to generate GeneratedPluginRegistrant.java --> This is used by the Flutter tool to generate GeneratedPluginRegistrant.java -->
<meta-data android:name="flutterEmbedding" android:value="2"/> <meta-data android:name="flutterEmbedding" android:value="2" />
<activity android:name="com.yalantis.ucrop.UCropActivity" android:screenOrientation="portrait" android:theme="@style/Theme.AppCompat.Light.NoActionBar"/> <activity android:name="com.yalantis.ucrop.UCropActivity" android:screenOrientation="portrait"
android:theme="@style/Theme.AppCompat.Light.NoActionBar" />
</application> </application>
<uses-permission android:name="android.permission.INTERNET"/> <uses-permission android:name="android.permission.INTERNET" />
</manifest> </manifest>

View File

@@ -21,7 +21,7 @@
<key>CFBundlePackageType</key> <key>CFBundlePackageType</key>
<string>APPL</string> <string>APPL</string>
<key>CFBundleShortVersionString</key> <key>CFBundleShortVersionString</key>
<string>36</string> <string>37</string>
<key>CFBundleSignature</key> <key>CFBundleSignature</key>
<string>????</string> <string>????</string>
<key>CFBundleURLTypes</key> <key>CFBundleURLTypes</key>
@@ -36,7 +36,7 @@
</dict> </dict>
</array> </array>
<key>CFBundleVersion</key> <key>CFBundleVersion</key>
<string>4.0.36</string> <string>4.0.37</string>
<key>FirebaseAppDelegateProxyEnabled</key> <key>FirebaseAppDelegateProxyEnabled</key>
<string>NO</string> <string>NO</string>
<key>GMSApiKey</key> <key>GMSApiKey</key>

View File

@@ -18,7 +18,7 @@ import 'package:location/location.dart';
import '../../firebase/firbase_messge.dart'; import '../../firebase/firbase_messge.dart';
class LoginCaptinController extends GetxController { class LoginDriverController extends GetxController {
final formKey = GlobalKey<FormState>(); final formKey = GlobalKey<FormState>();
TextEditingController emailController = TextEditingController(); TextEditingController emailController = TextEditingController();
TextEditingController phoneController = TextEditingController(); TextEditingController phoneController = TextEditingController();
@@ -110,7 +110,7 @@ class LoginCaptinController extends GetxController {
} }
} }
loginFromSignInGoogle(String driverID, email) async { loginUsingCredentials(String driverID, email) async {
isloading = true; isloading = true;
update(); update();
var res = await CRUD().get(link: AppLink.loginFromGoogleCaptin, payload: { var res = await CRUD().get(link: AppLink.loginFromGoogleCaptin, payload: {

View File

@@ -124,13 +124,13 @@ class RegisterCaptainController extends GetxController {
sendVerifications() async { sendVerifications() async {
var res = await CRUD().post(link: AppLink.verifyEmail, payload: { var res = await CRUD().post(link: AppLink.verifyEmail, payload: {
'email': emailController.text.isEmpty 'email': emailController.text.isEmpty
? Get.find<LoginCaptinController>().emailController.text.toString() ? Get.find<LoginDriverController>().emailController.text.toString()
: emailController.text, : emailController.text,
'token': verifyCode.text, 'token': verifyCode.text,
}); });
if (res != 'failure') { if (res != 'failure') {
if (Get.find<LoginCaptinController>().emailController.text.toString() != if (Get.find<LoginDriverController>().emailController.text.toString() !=
'') { '') {
Get.offAll(() => HomeCaptain()); Get.offAll(() => HomeCaptain());
} else { } else {

View File

@@ -41,7 +41,7 @@ class GoogleSignInHelper {
if (googleUser != null) { if (googleUser != null) {
await _handleSignUp(googleUser); await _handleSignUp(googleUser);
// if (box.read(BoxName.countryCode) == 'Egypt') { // if (box.read(BoxName.countryCode) == 'Egypt') {
await Get.find<LoginCaptinController>().loginFromSignInGoogle( await Get.find<LoginDriverController>().loginUsingCredentials(
box.read(BoxName.driverID).toString(), box.read(BoxName.driverID).toString(),
box.read(BoxName.emailDriver).toString(), box.read(BoxName.emailDriver).toString(),
); );

View File

@@ -18,7 +18,7 @@ class SmsEgyptController extends GetxController {
"password": AK.smsPasswordEgypt, //'E)Pu=an/@Z', "password": AK.smsPasswordEgypt, //'E)Pu=an/@Z',
"message": "${AppInformation.appName} app code is $otp\ncopy it to app", "message": "${AppInformation.appName} app code is $otp\ncopy it to app",
"language": box.read(BoxName.lang) == 'en' ? "e" : 'r', "language": box.read(BoxName.lang) == 'en' ? "e" : 'r',
"sender": "SEFER EGY", // todo add sefer sender name "sender": "Sefer Egy", // todo add sefer sender name
"receiver": "2$phone" "receiver": "2$phone"
}); });
@@ -30,7 +30,7 @@ class SmsEgyptController extends GetxController {
if (res.statusCode == 200) { if (res.statusCode == 200) {
Get.defaultDialog( Get.defaultDialog(
title: 'You will recieve code in sms message'.tr, title: 'You will receive code in sms message'.tr,
middleText: '', middleText: '',
confirm: MyElevatedButton( confirm: MyElevatedButton(
title: 'OK'.tr, title: 'OK'.tr,

View File

@@ -19,7 +19,7 @@ class HelpController extends GetxController {
String status = ''; String status = '';
String qustion = ''; String qustion = '';
late int indexQuestion = 0; late int indexQuestion = 0;
getindex(int i, String qustion1) async { getIndex(int i, String qustion1) async {
indexQuestion = i; indexQuestion = i;
qustion = qustion1; qustion = qustion1;
update(); update();
@@ -56,12 +56,22 @@ class HelpController extends GetxController {
title: 'There is no help Question here'.tr, title: 'There is no help Question here'.tr,
titleStyle: AppStyle.title, titleStyle: AppStyle.title,
middleText: '', middleText: '',
confirm: MyElevatedButton( confirm: Column(
title: 'Back'.tr, mainAxisAlignment: MainAxisAlignment.spaceAround,
onPressed: () { children: [
Get.back(); MyElevatedButton(
Get.back(); title: 'Add Question'.tr,
})); onPressed: () {
Get.back();
}),
MyElevatedButton(
title: 'Back'.tr,
onPressed: () {
Get.back();
Get.back();
}),
],
));
} }
helpQuestionDate = jsonDecode(res); helpQuestionDate = jsonDecode(res);
isLoading = false; isLoading = false;

View File

@@ -54,7 +54,7 @@ class SplashScreenController extends GetxController
: box.read(BoxName.emailDriver) != null && : box.read(BoxName.emailDriver) != null &&
box.read(BoxName.phoneDriver) != null && box.read(BoxName.phoneDriver) != null &&
box.read(BoxName.phoneVerified) == '1' box.read(BoxName.phoneVerified) == '1'
? await Get.put(LoginCaptinController()).loginFromSignInGoogle( ? await Get.put(LoginDriverController()).loginUsingCredentials(
box.read(BoxName.driverID).toString(), box.read(BoxName.driverID).toString(),
box.read(BoxName.emailDriver)) box.read(BoxName.emailDriver))
: Get.off(() => LoginCaptin()); : Get.off(() => LoginCaptin());

View File

@@ -4,6 +4,7 @@ class MyTranslation extends Translations {
@override @override
Map<String, Map<String, String>> get keys => { Map<String, Map<String, String>> get keys => {
"ar": { "ar": {
'Add Question': '',
"Please enter a valid card 16-digit number.": "Please enter a valid card 16-digit number.":
"الرجاء إدخال رقم بطاقة صحيح مكون من 16 رقمًا.", "الرجاء إدخال رقم بطاقة صحيح مكون من 16 رقمًا.",
"Insert card number": "أدخل رقم البطاقة", "Insert card number": "أدخل رقم البطاقة",
@@ -115,7 +116,7 @@ class MyTranslation extends Translations {
"birthdate": "تاريخ ميلاد", "birthdate": "تاريخ ميلاد",
"Approve Driver Documents": "الموافقة على مستندات الشريك السائق", "Approve Driver Documents": "الموافقة على مستندات الشريك السائق",
"Total Budget is": "الميزانية الإجمالية", "Total Budget is": "الميزانية الإجمالية",
"You will recieve code in sms message": "You will receive code in sms message":
"ستتلقى الرمز في رسالة نصية قصيرة", "ستتلقى الرمز في رسالة نصية قصيرة",
"Please enter": "الرجاء إدخال", "Please enter": "الرجاء إدخال",
"We need your phone number to contact you and to help you receive orders.": "We need your phone number to contact you and to help you receive orders.":

View File

@@ -89,7 +89,7 @@ class RateController extends GetxController {
'Wallet Added', 'Wallet Added',
'Wallet Added'.tr, 'Wallet Added'.tr,
Get.find<MapDriverController>().tokenPassenger); Get.find<MapDriverController>().tokenPassenger);
walletChecked == 'true'; walletChecked = 'true';
update(); update();
} }
}); });

View File

@@ -110,19 +110,20 @@ class RatePassenger extends StatelessWidget {
Form( Form(
key: controller.formKey, key: controller.formKey,
child: MyTextForm( child: MyTextForm(
controller: controller:
controller.passengerPayAmount, controller.passengerPayAmount,
label: "passenger amount to me".tr, label: "passenger amount to me".tr,
hint: "passenger amount to me".tr, hint: "passenger amount to me".tr,
type: const TextInputType type: const TextInputType
.numberWithOptions( .numberWithOptions(decimal: true),
decimal: true)), ),
), ),
MyElevatedButton( MyElevatedButton(
title: "Press here".tr, title: "Press here".tr,
onPressed: () { onPressed: () {
controller.addPassengerWallet(); controller.addPassengerWallet();
}) },
)
], ],
), ),
), ),
@@ -139,10 +140,11 @@ class RatePassenger extends StatelessWidget {
textAlign: TextAlign.center, textAlign: TextAlign.center,
), ),
MyElevatedButton( MyElevatedButton(
title: "Press here".tr, title: "Press here".tr,
onPressed: () { onPressed: () {
controller.passengerWantPay(); controller.passengerWantPay();
}) },
)
], ],
), ),
) )

View File

@@ -25,9 +25,9 @@ class LoginCaptin extends StatelessWidget {
final AuthController authController = Get.put(AuthController()); final AuthController authController = Get.put(AuthController());
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
Get.put(LoginCaptinController()); Get.put(LoginDriverController());
// Get.put(LocationBackgroundController()); // Get.put(LocationBackgroundController());
return GetBuilder<LoginCaptinController>( return GetBuilder<LoginDriverController>(
builder: (controller) => MyScafolld( builder: (controller) => MyScafolld(
title: 'Login Driver'.tr, title: 'Login Driver'.tr,
isleading: false, isleading: false,
@@ -221,8 +221,8 @@ class LoginCaptin extends StatelessWidget {
box.write(BoxName.driverID, user.uid); box.write(BoxName.driverID, user.uid);
box.write( box.write(
BoxName.emailDriver, user.email); BoxName.emailDriver, user.email);
Get.find<LoginCaptinController>() Get.find<LoginDriverController>()
.loginFromSignInGoogle( .loginUsingCredentials(
box.read(BoxName.driverID).toString(), box.read(BoxName.driverID).toString(),
box box
.read(BoxName.emailDriver) .read(BoxName.emailDriver)
@@ -347,7 +347,7 @@ class LoginCaptin extends StatelessWidget {
const SizedBox( const SizedBox(
height: 100, height: 100,
), ),
GetBuilder<LoginCaptinController>( GetBuilder<LoginDriverController>(
builder: (controller) => Column( builder: (controller) => Column(
children: [ children: [
Row( Row(
@@ -381,7 +381,7 @@ class LoginCaptin extends StatelessWidget {
} }
locationPermissionDialog() { locationPermissionDialog() {
return GetBuilder<LoginCaptinController>(builder: (controller) { return GetBuilder<LoginDriverController>(builder: (controller) {
return Padding( return Padding(
padding: const EdgeInsets.all(16), padding: const EdgeInsets.all(16),
child: Container( child: Container(

View File

@@ -79,7 +79,7 @@ class CountryPicker extends StatelessWidget {
MyElevatedButton( MyElevatedButton(
title: 'Select Country'.tr, // Use translated text for button title: 'Select Country'.tr, // Use translated text for button
onPressed: () { onPressed: () {
Get.find<LoginCaptinController>().saveCountryCode(controller Get.find<LoginDriverController>().saveCountryCode(controller
.selectedCountry .selectedCountry
.toString()); // No conversion needed .toString()); // No conversion needed
box.write( box.write(
@@ -98,8 +98,8 @@ class CountryPicker extends StatelessWidget {
class CountryPickerFromSetting extends StatelessWidget { class CountryPickerFromSetting extends StatelessWidget {
final ProfileController controller = Get.put(ProfileController()); final ProfileController controller = Get.put(ProfileController());
final LoginCaptinController loginController = final LoginDriverController loginController =
Get.put(LoginCaptinController()); Get.put(LoginDriverController());
final List<String> countryOptions = [ final List<String> countryOptions = [
'Jordan', 'Jordan',

View File

@@ -1,5 +1,4 @@
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter/widgets.dart';
import 'package:get/get.dart'; import 'package:get/get.dart';
import 'package:SEFER/constant/colors.dart'; import 'package:SEFER/constant/colors.dart';
import 'package:SEFER/constant/style.dart'; import 'package:SEFER/constant/style.dart';
@@ -105,12 +104,7 @@ class HelpCaptain extends StatelessWidget {
return helpController return helpController
.helpQuestionDate['message'].length == .helpQuestionDate['message'].length ==
0 0
? Center( ? SizedBox()
child: Text(
'text',
style: AppStyle.title,
),
)
: Padding( : Padding(
padding: const EdgeInsets.all(3), padding: const EdgeInsets.all(3),
child: Container( child: Container(
@@ -125,7 +119,7 @@ class HelpCaptain extends StatelessWidget {
// color: AppColor.greenColor, // color: AppColor.greenColor,
child: GestureDetector( child: GestureDetector(
onTap: () { onTap: () {
helpController.getindex( helpController.getIndex(
list['id'], list['helpQuestion']); list['id'], list['helpQuestion']);
helpController.getHelpRepley( helpController.getHelpRepley(
list['id'].toString()); list['id'].toString());

View File

@@ -20,35 +20,35 @@ GetBuilder<HomeCaptainController> leftMainMenuCaptainIcons() {
left: 6, left: 6,
child: Column( child: Column(
children: [ children: [
AnimatedContainer( // AnimatedContainer(
duration: const Duration(microseconds: 200), // duration: const Duration(microseconds: 200),
width: controller.widthMapTypeAndTraffic, // width: controller.widthMapTypeAndTraffic,
decoration: BoxDecoration( // decoration: BoxDecoration(
border: Border.all(color: AppColor.blueColor), // border: Border.all(color: AppColor.blueColor),
color: AppColor.secondaryColor, // color: AppColor.secondaryColor,
borderRadius: BorderRadius.circular(15)), // borderRadius: BorderRadius.circular(15)),
child: IconButton( // child: IconButton(
onPressed: () { // onPressed: () {
AC credentials = AC(); // AC credentials = AC();
String apiKey = '4601103'; // String apiKey = '4601103';
String convertedStringN = credentials.c( // String convertedStringN = credentials.c(
credentials.c(credentials.c(apiKey, cs), cC), cn); // credentials.c(credentials.c(apiKey, cs), cC), cn);
print(convertedStringN); // print(convertedStringN);
String retrievedStringS = credentials.r( // String retrievedStringS = credentials.r(
credentials.r(credentials.r(convertedStringN, cn), cC), // credentials.r(credentials.r(convertedStringN, cn), cC),
cs); // cs);
print(retrievedStringS); // print(retrievedStringS);
// // //
if (retrievedStringS == apiKey) { // if (retrievedStringS == apiKey) {
print('same'); // print('same');
} // }
}, // },
icon: const Icon( // icon: const Icon(
FontAwesome.map_signs, // FontAwesome.map_signs,
size: 24, // size: 24,
color: Colors.black, // color: Colors.black,
)), // )),
), // ),
const SizedBox( const SizedBox(
height: 5, height: 5,
), ),

View File

@@ -32,229 +32,230 @@ class AvailableRidesPage extends StatelessWidget {
? const MyCircularProgressIndicator() ? const MyCircularProgressIndicator()
: Padding( : Padding(
padding: const EdgeInsets.all(8.0), padding: const EdgeInsets.all(8.0),
child: rideAvailableController child: ListView.builder(
.rideAvailableMap['message'].length == itemCount: rideAvailableController
1 && .rideAvailableMap['message'].length,
rideAvailableController.rideAvailableMap['message'] itemBuilder: (BuildContext context, int index) {
[0]['start_location'] == var list = rideAvailableController
null .rideAvailableMap['message'][index];
? Center( return Container(
child: Text( width: Get.width * .9,
'No ride found yet'.tr, decoration: AppStyle.boxDecoration1,
style: AppStyle.headTitle2, child: Column(
), mainAxisAlignment: MainAxisAlignment.spaceAround,
) children: [
: ListView.builder( Row(
itemCount: rideAvailableController mainAxisAlignment:
.rideAvailableMap['message'].length, MainAxisAlignment.spaceBetween,
itemBuilder: (BuildContext context, int index) { children: [
var list = rideAvailableController Text(
.rideAvailableMap['message'][index]; '🟢 ',
return Container( style: AppStyle.subtitle,
width: Get.width * .9, ),
decoration: AppStyle.boxDecoration1, SizedBox(
child: Column( height: Get.height * .06,
width: Get.width * .8,
child: Text(
'${list['startName']}',
style: AppStyle.subtitle,
),
),
],
),
Row(
mainAxisAlignment:
MainAxisAlignment.spaceBetween,
children: [
Text(
'🔴 ',
style: AppStyle.subtitle,
),
SizedBox(
height: Get.height * .06,
width: Get.width * .8,
child: Text(
'${list['endName']}',
style: AppStyle.subtitle,
),
),
],
),
const SizedBox(height: 4),
Row(
mainAxisAlignment: mainAxisAlignment:
MainAxisAlignment.spaceAround, MainAxisAlignment.spaceAround,
children: [ children: [
Text( Text('${'Price: '.tr}${list['price']} \$'),
' ${list['start_location']}',
style: AppStyle.title,
),
Text(
'${list['end_location']}',
style: AppStyle.title,
),
const SizedBox(height: 4), const SizedBox(height: 4),
Row( Text(
mainAxisAlignment: '${list['carType']}',
MainAxisAlignment.spaceAround, style: AppStyle.title
children: [ .copyWith(color: AppColor.greenColor),
Text(
'${'Price: '.tr}${list['price']} \$'),
const SizedBox(height: 4),
Text(
'${list['carType']}',
style: AppStyle.title.copyWith(
color: AppColor.greenColor),
),
],
), ),
Row(
mainAxisAlignment:
MainAxisAlignment.spaceAround,
children: [
Text('📈 ${list['passengerRate']}',
style: AppStyle.title),
MyElevatedButton(
title: 'Accept'.tr,
onPressed: () async {
box.write(
BoxName.statusDriverLocation,
'on');
var res = await CRUD().post(
link: AppLink
.updateStausFromSpeed,
payload: {
'id': list['id'],
'rideTimeStart':
DateTime.now().toString(),
'status': 'Apply',
'driver_id': box
.read(BoxName.driverID),
});
// .then((value) {
// var json = jsonDecode(res);
if (res == "failure") {
Get.defaultDialog(
title:
"This ride is already taken by another driver."
.tr,
middleText: '',
titleStyle: AppStyle.title,
middleTextStyle:
AppStyle.title,
confirm: MyElevatedButton(
title: 'Ok'.tr,
onPressed: () {
Get.back();
Get.back();
Get.back();
}));
} else if (jsonDecode(
res)['status'] ==
"success") {
List<String> bodyToPassenger = [
box
.read(BoxName.driverID)
.toString(),
box
.read(BoxName.nameDriver)
.toString(),
box
.read(BoxName.tokenDriver)
.toString(),
];
await CRUD().postFromDialogue(
link: AppLink.addDriverOrder,
payload: {
'driver_id': box
.read(BoxName.driverID),
// box.read(BoxName.driverID).toString(),
'order_id': list['id'],
'status': 'Apply'
});
await CRUD().post(
link: AppLink.updateRides,
payload: {
'id': list['id'],
'driverGoToPassengerTime':
DateTime.now()
.toString(),
'status': 'Applied'
});
FirebaseMessagesController()
.sendNotificationToPassengerToken(
'Apply Ride',
'your ride is applied'.tr,
// arguments['DriverList'][9].toString(),
list['passengerToken']
.toString(),
// box.read(BoxName.tokenDriver).toString(),
bodyToPassenger,
);
Get.back();
Get.to(
() =>
PassengerLocationMapPage(),
arguments: {
'passengerLocation':
list['start_location']
.toString(),
'passengerDestination':
list['end_location']
.toString(),
'Duration': list['duration']
.toString(),
'totalCost': list['price']
.toString(),
'Distance': list['distance']
.toString(),
'name': list['first_name']
.toString(),
'phone': list['phone']
.toString(),
'email': list['email']
.toString(),
'WalletChecked':
list['payment_method']
.toString(),
'tokenPassenger':
list['passengerToken']
.toString(),
'direction':
'https://www.google.com/maps/dir/${list['start_location']}/${list['end_location']}/',
'DurationToPassenger':
list['duration']
.toString(),
'rideId':
list['id'].toString(),
'passengerId':
list['passenger_id']
.toString(),
'driverId': box
.read(BoxName.driverID)
.toString(),
'durationOfRideValue':
list['duration']
.toString(),
'paymentAmount':
list['price']
.toString(),
'paymentMethod':
'cash'.toString() == //todo fix payment method
'true'
? 'visa'
: 'cash',
'isHaveSteps':
'startEnd'.toString(),
'step0': ''.toString(),
'step1': ''.toString(),
'step2': ''.toString(),
'step3': ''.toString(),
'step4': ''.toString(),
'passengerWalletBurc':
list['bruc'].toString(),
'timeOfOrder':
DateTime.now()
.toString(),
'totalPassenger':
list['price']
.toString(),
'carType': list['carType']
.toString(),
'kazan': Get.find<
HomeCaptainController>()
.kazan
.toString(),
});
}
},
kolor: AppColor.greenColor,
),
Text(
'📍 ${list['distance']} ${'KM'.tr}',
style: AppStyle.title.copyWith(
color: AppColor.greenColor),
),
],
)
], ],
), ),
); Row(
}), mainAxisAlignment:
MainAxisAlignment.spaceAround,
children: [
Text('📈 ${list['passengerRate']}',
style: AppStyle.title),
MyElevatedButton(
title: 'Accept'.tr,
onPressed: () async {
box.write(
BoxName.statusDriverLocation, 'on');
var res = await CRUD().post(
link: AppLink.updateStausFromSpeed,
payload: {
'id': list['id'],
'rideTimeStart':
DateTime.now().toString(),
'status': 'Apply',
'driver_id':
box.read(BoxName.driverID),
});
// .then((value) {
// var json = jsonDecode(res);
if (res == "failure") {
Get.defaultDialog(
title:
"This ride is already taken by another driver."
.tr,
middleText: '',
titleStyle: AppStyle.title,
middleTextStyle: AppStyle.title,
confirm: MyElevatedButton(
title: 'Ok'.tr,
onPressed: () {
Get.back();
Get.back();
Get.back();
}));
} else if (jsonDecode(res)['status'] ==
"success") {
List<String> bodyToPassenger = [
box
.read(BoxName.driverID)
.toString(),
box
.read(BoxName.nameDriver)
.toString(),
box
.read(BoxName.tokenDriver)
.toString(),
];
await CRUD().postFromDialogue(
link: AppLink.addDriverOrder,
payload: {
'driver_id':
box.read(BoxName.driverID),
// box.read(BoxName.driverID).toString(),
'order_id': list['id'],
'status': 'Apply'
});
await CRUD().post(
link: AppLink.updateRides,
payload: {
'id': list['id'],
'DriverIsGoingToPassenger':
DateTime.now().toString(),
'status': 'Applied'
});
FirebaseMessagesController()
.sendNotificationToPassengerToken(
'Apply Ride',
'your ride is applied'.tr,
// arguments['DriverList'][9].toString(),
list['passengerToken'].toString(),
// box.read(BoxName.tokenDriver).toString(),
bodyToPassenger,
);
Get.back();
Get.to(
() => PassengerLocationMapPage(),
arguments: {
'passengerLocation':
list['start_location']
.toString(),
'passengerDestination':
list['end_location']
.toString(),
'Duration':
list['duration'].toString(),
'totalCost':
list['price'].toString(),
'Distance':
list['distance'].toString(),
'name': list['first_name']
.toString(),
'phone':
list['phone'].toString(),
'email':
list['email'].toString(),
'WalletChecked':
list['payment_method']
.toString(),
'tokenPassenger':
list['passengerToken']
.toString(),
'direction':
'https://www.google.com/maps/dir/${list['start_location']}/${list['end_location']}/',
'DurationToPassenger':
list['duration'].toString(),
'rideId': list['id'].toString(),
'passengerId':
list['passenger_id']
.toString(),
'driverId': box
.read(BoxName.driverID)
.toString(),
'durationOfRideValue':
list['duration'].toString(),
'paymentAmount':
list['price'].toString(),
'paymentMethod':
'cash'.toString() == //todo fix payment method
'true'
? 'visa'
: 'cash',
'isHaveSteps':
'startEnd'.toString(),
'step0': ''.toString(),
'step1': ''.toString(),
'step2': ''.toString(),
'step3': ''.toString(),
'step4': ''.toString(),
'passengerWalletBurc':
list['bruc'].toString(),
'timeOfOrder':
DateTime.now().toString(),
'totalPassenger':
list['price'].toString(),
'carType':
list['carType'].toString(),
'kazan': Get.find<
HomeCaptainController>()
.kazan
.toString(),
});
}
},
kolor: AppColor.greenColor,
),
Text(
'📍 ${list['distance']} ${'KM'.tr}',
style: AppStyle.title
.copyWith(color: AppColor.greenColor),
),
],
)
],
),
);
}),
) )
], ],
isleading: true); isleading: true);