11/25/1
This commit is contained in:
@@ -9,8 +9,9 @@ import 'package:ride/constant/links.dart';
|
||||
import 'package:ride/controller/functions/crud.dart';
|
||||
import 'package:ride/controller/functions/secure_storage.dart';
|
||||
import 'package:ride/main.dart';
|
||||
import 'package:ride/views/auth/captin/verify_email_captain.dart';
|
||||
import 'package:ride/views/auth/verify_email_page.dart';
|
||||
import 'package:ride/views/home/Captin/home_captin.dart';
|
||||
import 'package:ride/views/home/Captin/home_captain/home_captin.dart';
|
||||
import 'package:ride/views/home/map_page_passenger.dart';
|
||||
|
||||
class LoginCaptinController extends GetxController {
|
||||
@@ -82,7 +83,7 @@ class LoginCaptinController extends GetxController {
|
||||
'email': emailController.text,
|
||||
'token': randomNumber.toString(),
|
||||
}).then((value) => print(value));
|
||||
Get.to(() => VerifyEmailPage());
|
||||
Get.to(() => VerifyEmailCaptainPage());
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
@@ -1,10 +1,11 @@
|
||||
import 'dart:convert';
|
||||
import 'dart:io';
|
||||
import 'dart:ui';
|
||||
|
||||
import 'package:get/get.dart';
|
||||
import 'package:google_mlkit_text_recognition/google_mlkit_text_recognition.dart';
|
||||
import 'package:image_cropper/image_cropper.dart';
|
||||
import 'package:image_picker/image_picker.dart';
|
||||
import 'package:ride/constant/colors.dart';
|
||||
import 'package:ride/controller/functions/llama_ai.dart';
|
||||
|
||||
class CarRegistrationRecognizerController extends GetxController {
|
||||
@override
|
||||
@@ -15,7 +16,6 @@ class CarRegistrationRecognizerController extends GetxController {
|
||||
|
||||
// The ImagePicker instance
|
||||
final ImagePicker _imagePicker = ImagePicker();
|
||||
Map extractedData = {};
|
||||
|
||||
// The GoogleMlKit TextRecognizer instance
|
||||
final TextRecognizer _textRecognizer = TextRecognizer();
|
||||
@@ -24,47 +24,57 @@ class CarRegistrationRecognizerController extends GetxController {
|
||||
String? scannedText;
|
||||
String? jsonOutput;
|
||||
final List<Map<String, dynamic>> lines = [];
|
||||
Map extracted = {};
|
||||
XFile? image;
|
||||
Map decode = {};
|
||||
CroppedFile? croppedFile;
|
||||
// Picks an image from the camera or gallery and extracts the text
|
||||
final List<Map<String, dynamic>> extractedTextWithCoordinates = [];
|
||||
|
||||
Future<void> scanText() async {
|
||||
// Pick an image from the camera or gallery
|
||||
image = await _imagePicker.pickImage(source: ImageSource.gallery);
|
||||
update();
|
||||
|
||||
// If no image was picked, return
|
||||
if (image == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Convert the XFile object to an InputImage object
|
||||
final InputImage inputImage = InputImage.fromFile(File(image!.path));
|
||||
// Crop the image
|
||||
croppedFile = await ImageCropper().cropImage(
|
||||
sourcePath: image!.path,
|
||||
aspectRatioPresets: [
|
||||
CropAspectRatioPreset.square,
|
||||
CropAspectRatioPreset.ratio3x2,
|
||||
CropAspectRatioPreset.original,
|
||||
CropAspectRatioPreset.ratio4x3,
|
||||
CropAspectRatioPreset.ratio16x9
|
||||
],
|
||||
uiSettings: [
|
||||
AndroidUiSettings(
|
||||
toolbarTitle: 'Cropper',
|
||||
toolbarColor: AppColor.blueColor,
|
||||
toolbarWidgetColor: AppColor.yellowColor,
|
||||
initAspectRatio: CropAspectRatioPreset.original,
|
||||
lockAspectRatio: false),
|
||||
IOSUiSettings(
|
||||
title: 'Cropper',
|
||||
),
|
||||
],
|
||||
);
|
||||
|
||||
// If no cropped image was obtained, return
|
||||
if (croppedFile == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Convert the cropped file to an InputImage object
|
||||
final InputImage inputImage = InputImage.fromFile(File(croppedFile!.path));
|
||||
|
||||
// Recognize the text in the image
|
||||
final RecognizedText recognizedText =
|
||||
await _textRecognizer.processImage(inputImage);
|
||||
scannedText = recognizedText.text;
|
||||
final Map<String, dynamic> extractedData = {};
|
||||
|
||||
for (TextBlock block in recognizedText.blocks) {
|
||||
for (TextLine line in block.lines) {
|
||||
final String lineText = line.text;
|
||||
final Rect lineBoundingBox = line.boundingBox!;
|
||||
|
||||
extractedTextWithCoordinates.add({
|
||||
'text': lineText,
|
||||
'boundingBox': {
|
||||
'left': lineBoundingBox.left,
|
||||
'top': lineBoundingBox.top,
|
||||
'width': lineBoundingBox.width,
|
||||
'height': lineBoundingBox.height,
|
||||
},
|
||||
});
|
||||
}
|
||||
update();
|
||||
}
|
||||
|
||||
print(jsonEncode(extractedTextWithCoordinates));
|
||||
|
||||
// Extract the scanned text line by line
|
||||
final List<Map<String, dynamic>> lines = [];
|
||||
@@ -73,15 +83,20 @@ class CarRegistrationRecognizerController extends GetxController {
|
||||
i.toString(): recognizedText.blocks[i].text,
|
||||
});
|
||||
}
|
||||
// print(jsonEncode(lines));
|
||||
|
||||
// Convert the list of lines to a JSON string
|
||||
jsonOutput = jsonEncode(extractedData);
|
||||
decode = jsonDecode(jsonOutput!);
|
||||
String result = lines.map((map) => map.values.first.toString()).join(' ');
|
||||
// print(result.length);
|
||||
if (result.length > 2200) {
|
||||
result = result.substring(0, 2200);
|
||||
}
|
||||
// print('jsonOutput------------------------------');
|
||||
// print(result);
|
||||
Map result2 = await LlamaAi().getCarRegistrationData(result);
|
||||
|
||||
// Assign the result to the extracted variable
|
||||
extracted = result2;
|
||||
|
||||
print('extracted is ' + extracted.toString());
|
||||
update();
|
||||
print('jsonOutput------------------------------');
|
||||
print(decode);
|
||||
// print(jsonEncode(lines));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -12,7 +12,7 @@ import 'package:ride/views/auth/captin/verify_email_captain.dart';
|
||||
import '../../../views/auth/captin/ai_page.dart';
|
||||
import '../../../views/auth/verify_email_page.dart';
|
||||
|
||||
class RegisterCaptinController extends GetxController {
|
||||
class RegisterCaptainController extends GetxController {
|
||||
final formKey = GlobalKey<FormState>();
|
||||
|
||||
TextEditingController emailController = TextEditingController();
|
||||
@@ -125,6 +125,27 @@ class RegisterCaptinController extends GetxController {
|
||||
}
|
||||
}
|
||||
|
||||
void addRegisrationCarForDriver(String vin, make, model, year, color, owner,
|
||||
expirationDate, registrationDate) async {
|
||||
getFromController();
|
||||
var res = await CRUD().post(link: AppLink.addRegisrationCar, payload: {
|
||||
'vin': vin,
|
||||
'make': make,
|
||||
'model': model,
|
||||
'year': year,
|
||||
'expirationDate': expirationDate,
|
||||
'color': color,
|
||||
'owner': owner,
|
||||
'registrationDate': registrationDate,
|
||||
});
|
||||
print(jsonDecode(res));
|
||||
isLoading = false;
|
||||
update();
|
||||
if (jsonDecode(res)['status'] == 'success') {
|
||||
// Get.to(() => AiPage()); //todo replace this
|
||||
}
|
||||
}
|
||||
|
||||
void register() async {
|
||||
getFromController();
|
||||
if (formKey.currentState!.validate()) {
|
||||
|
||||
@@ -10,10 +10,9 @@ import '../../constant/box_name.dart';
|
||||
import '../../constant/colors.dart';
|
||||
import '../../constant/links.dart';
|
||||
import '../../constant/style.dart';
|
||||
import '../../env/env.dart';
|
||||
import '../../main.dart';
|
||||
import '../../views/home/profile/promos_passenger_page.dart';
|
||||
import '../../views/orderCaptin/order_request_page.dart';
|
||||
import '../../views/home/Captin/orderCaptin/order_request_page.dart';
|
||||
import '../../views/widgets/elevated_btn.dart';
|
||||
import '../functions/crud.dart';
|
||||
import '../functions/launch.dart';
|
||||
@@ -413,7 +412,7 @@ class FirebaseMessagesController extends GetxController {
|
||||
'notification': <String, dynamic>{
|
||||
'title': title,
|
||||
'body': body,
|
||||
'sound': 'true'
|
||||
'sound': 'assets/notify.mp3'
|
||||
},
|
||||
'priority': 'high',
|
||||
'data': <String, dynamic>{
|
||||
@@ -471,7 +470,7 @@ class FirebaseMessagesController extends GetxController {
|
||||
'notification': <String, dynamic>{
|
||||
'title': title,
|
||||
'body': body,
|
||||
'sound': 'true'
|
||||
'sound': 'assets/notify.mp3'
|
||||
},
|
||||
'data': {
|
||||
'passengerList': map,
|
||||
@@ -508,7 +507,7 @@ class FirebaseMessagesController extends GetxController {
|
||||
'notification': <String, dynamic>{
|
||||
'title': title,
|
||||
'body': body,
|
||||
'sound': 'true'
|
||||
'sound': 'assets/notify.mp3'
|
||||
},
|
||||
'data': <String, dynamic>{
|
||||
'click_action': 'FLUTTER_NOTIFICATION_CLICK',
|
||||
@@ -547,7 +546,7 @@ class FirebaseMessagesController extends GetxController {
|
||||
'notification': <String, dynamic>{
|
||||
'title': title,
|
||||
'body': body,
|
||||
'sound': 'true'
|
||||
'sound': 'assets/notify.mp3'
|
||||
},
|
||||
'data': {
|
||||
'DriverList': data,
|
||||
|
||||
@@ -59,7 +59,42 @@ class CRUD {
|
||||
{
|
||||
"role": "user",
|
||||
"content":
|
||||
"Extract the desired information from the following passage as json decoded like vin,make,made,color,owner and all you find in this:\n\n$payload"
|
||||
"Extract the desired information from the following passage as json decoded like vin,make,made,year,expiration_date,color,owner,registration_date just in this:\n\n$payload"
|
||||
}
|
||||
],
|
||||
"temperature": 0.9
|
||||
});
|
||||
var response = await http.post(
|
||||
url,
|
||||
body: data,
|
||||
headers: headers,
|
||||
);
|
||||
|
||||
if (response.statusCode == 200) {
|
||||
return response.body;
|
||||
}
|
||||
return response.statusCode;
|
||||
}
|
||||
|
||||
Future<dynamic> getChatGPT({
|
||||
required String link,
|
||||
required String payload,
|
||||
}) async {
|
||||
var url = Uri.parse(
|
||||
link,
|
||||
);
|
||||
var headers = {
|
||||
'Content-Type': 'application/json',
|
||||
'Authorization':
|
||||
'Bearer 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'
|
||||
};
|
||||
var data = json.encode({
|
||||
"model": "gpt-3.5-turbo",
|
||||
"messages": [
|
||||
{
|
||||
"role": "user",
|
||||
"content":
|
||||
"Extract the desired information from the following passage as json decoded like vin,make,made,year,expiration_date,color,owner,registration_date just in this:\n\n$payload"
|
||||
}
|
||||
],
|
||||
"temperature": 0.9
|
||||
|
||||
@@ -4,18 +4,21 @@ import 'package:ride/constant/links.dart';
|
||||
import 'package:ride/controller/functions/crud.dart';
|
||||
|
||||
class LlamaAi {
|
||||
Future getExractionData(String input) async {
|
||||
Future<Map> getCarRegistrationData(String input) async {
|
||||
print(true);
|
||||
|
||||
Map exrtatDataFinal = {};
|
||||
String oneLine = input.replaceAll('\n', ' ');
|
||||
var res = await CRUD().getLlama(link: AppLink.llama, payload: oneLine);
|
||||
var decod = jsonDecode(res);
|
||||
// print(decod['choices'][0]['message']['content']);
|
||||
extractDataFromJsonString(decod['choices'][0]['message']['content']);
|
||||
// print(decod);
|
||||
exrtatDataFinal = jsonDecode(
|
||||
extractDataFromJsonString(decod['choices'][0]['message']['content']));
|
||||
// print(jsonEncode(exrtatDataFinal));
|
||||
print(false);
|
||||
return exrtatDataFinal;
|
||||
}
|
||||
|
||||
Map<String, dynamic> extractDataFromJsonString(String jsonString) {
|
||||
String extractDataFromJsonString(String jsonString) {
|
||||
// Remove any leading or trailing whitespace from the string
|
||||
jsonString = jsonString.trim();
|
||||
|
||||
@@ -25,10 +28,11 @@ class LlamaAi {
|
||||
final jsonSubstring = jsonString.substring(startIndex, endIndex + 1);
|
||||
|
||||
// Parse the JSON substring into a Map
|
||||
final jsonData = json.decode(jsonSubstring);
|
||||
final jsonData = jsonDecode(jsonSubstring);
|
||||
|
||||
// Return the extracted data
|
||||
print(jsonData);
|
||||
return jsonData;
|
||||
|
||||
// print(jsonEncode(jsonData));
|
||||
return jsonEncode(jsonData);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -8,12 +8,14 @@ import 'package:image_picker/image_picker.dart';
|
||||
import 'package:http/http.dart' as http;
|
||||
import 'package:path/path.dart' as path;
|
||||
import 'package:path_provider/path_provider.dart' as path_provider;
|
||||
import 'package:ride/constant/api_key.dart';
|
||||
import 'package:ride/constant/box_name.dart';
|
||||
import 'package:ride/constant/colors.dart';
|
||||
import 'package:ride/constant/credential.dart';
|
||||
import 'package:ride/constant/info.dart';
|
||||
import 'package:ride/constant/style.dart';
|
||||
import 'package:ride/constant/table_names.dart';
|
||||
import 'package:ride/env/env.dart';
|
||||
import 'package:ride/main.dart';
|
||||
import 'package:ride/views/widgets/elevated_btn.dart';
|
||||
|
||||
@@ -284,9 +286,11 @@ class ScanDocumentsByApi extends GetxController {
|
||||
///
|
||||
|
||||
Future<void> scanDocumentsByApi() async {
|
||||
String? visionApi = await storage.read(key: BoxName.visionApi);
|
||||
// String? visionApi = await storage.read(key: BoxName.visionApi);
|
||||
// String? visionApi = AK.visionApi;
|
||||
// Pick an image from the camera or gallery
|
||||
image = await imagePicker.pickImage(source: ImageSource.camera);
|
||||
// print(visionApi);
|
||||
image = await imagePicker.pickImage(source: ImageSource.camera); //
|
||||
|
||||
// If no image was picked, return
|
||||
if (image == null) {
|
||||
@@ -295,7 +299,7 @@ class ScanDocumentsByApi extends GetxController {
|
||||
|
||||
isLoading = true;
|
||||
update();
|
||||
var headers = {'X-BLOBR-KEY': visionApi.toString()};
|
||||
var headers = {'X-BLOBR-KEY': AK.visionApi};
|
||||
var request = http.MultipartRequest('POST',
|
||||
Uri.parse('https://api.faceonlive.com/j2y3q25y1b6maif1/api/iddoc'));
|
||||
request.files.add(await http.MultipartFile.fromPath('image', image!.path));
|
||||
@@ -399,7 +403,7 @@ class ScanDocumentsByApi extends GetxController {
|
||||
|
||||
Map res = {};
|
||||
Future matchFaceApi() async {
|
||||
String? visionApi = await storage.read(key: BoxName.visionApi);
|
||||
// String? visionApi = await storage.read(key: BoxName.visionApi);
|
||||
imageFace = await imagePicker.pickImage(
|
||||
source: ImageSource.camera,
|
||||
preferredCameraDevice: CameraDevice.front,
|
||||
@@ -411,13 +415,13 @@ class ScanDocumentsByApi extends GetxController {
|
||||
}
|
||||
final imageFile = File(imageFace!.path);
|
||||
// Uint8List imageBytes = await imageFile.readAsBytes();
|
||||
var headers = {'X-BLOBR-KEY': visionApi.toString()};
|
||||
var headers = {'X-BLOBR-KEY': AK.visionApi};
|
||||
var request = http.MultipartRequest(
|
||||
'POST',
|
||||
Uri.parse(
|
||||
'https://api.faceonlive.com/sntzbspfsdupgid1/api/face_compare'));
|
||||
request.files
|
||||
.add(await http.MultipartFile.fromPath('image1', imageFace!.path));
|
||||
.add(await http.MultipartFile.fromPath('image1', imageFile.path));
|
||||
request.files.add(await http.MultipartFile.fromPath('image2', imagePath));
|
||||
request.headers.addAll(headers);
|
||||
|
||||
|
||||
@@ -1,12 +1,17 @@
|
||||
import 'dart:convert';
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:google_maps_flutter/google_maps_flutter.dart';
|
||||
import 'package:ride/constant/box_name.dart';
|
||||
import 'package:ride/controller/home/captin/order_request_controller.dart';
|
||||
import 'dart:async';
|
||||
|
||||
import '../../../constant/links.dart';
|
||||
import '../../../constant/style.dart';
|
||||
import '../../../constant/table_names.dart';
|
||||
import '../../../main.dart';
|
||||
import '../../../views/widgets/elevated_btn.dart';
|
||||
import '../../functions/crud.dart';
|
||||
import '../../functions/location_controller.dart';
|
||||
|
||||
@@ -21,6 +26,7 @@ class HomeCaptainController extends GetxController {
|
||||
String totalMoneyInSEFER = '0';
|
||||
String totalDurationToday = '0';
|
||||
Timer? timer;
|
||||
String countRefuse = '0';
|
||||
bool mapType = false;
|
||||
bool mapTrafficON = false;
|
||||
double widthMapTypeAndTraffic = 50;
|
||||
@@ -55,6 +61,52 @@ class HomeCaptainController extends GetxController {
|
||||
update();
|
||||
}
|
||||
|
||||
void getRefusedOrderByCaptain() async {
|
||||
DateTime today = DateTime.now();
|
||||
int todayDay = today.day;
|
||||
|
||||
String driverId = box.read(BoxName.driverID).toString();
|
||||
|
||||
String customQuery = '''
|
||||
SELECT COUNT(*) AS count
|
||||
FROM ${TableName.driverOrdersRefuse}
|
||||
WHERE driver_id = '$driverId'
|
||||
AND created_at LIKE '%$todayDay%'
|
||||
''';
|
||||
|
||||
try {
|
||||
List<Map<String, dynamic>> results =
|
||||
await sql.getCustomQuery(customQuery);
|
||||
countRefuse = results[0]['count'].toString();
|
||||
update();
|
||||
if (int.parse(countRefuse) > 3) {
|
||||
locationController.stopLocationUpdates();
|
||||
activeStartTime = null;
|
||||
activeTimer?.cancel();
|
||||
savePeriod(activeDuration);
|
||||
activeDuration = Duration.zero;
|
||||
update();
|
||||
Get.defaultDialog(
|
||||
// backgroundColor: CupertinoColors.destructiveRed,
|
||||
barrierDismissible: false,
|
||||
title: 'You Are Stopped For this Day !'.tr,
|
||||
content: Text(
|
||||
'You Refused 3 Rides this Day that is the reason \nSee you Tomorrow!'
|
||||
.tr,
|
||||
style: AppStyle.title,
|
||||
),
|
||||
confirm: MyElevatedButton(
|
||||
title: 'Ok , See you Tomorrow'.tr,
|
||||
onPressed: () {
|
||||
Get.back();
|
||||
Get.back();
|
||||
}));
|
||||
}
|
||||
} catch (e) {
|
||||
print('Error executing custom query: $e');
|
||||
}
|
||||
}
|
||||
|
||||
void changeMapType() {
|
||||
mapType = !mapType;
|
||||
// heightButtomSheetShown = isButtomSheetShown == true ? 240 : 0;
|
||||
@@ -110,6 +162,7 @@ class HomeCaptainController extends GetxController {
|
||||
getPaymentToday();
|
||||
getAllPayment();
|
||||
startPeriodicExecution();
|
||||
getRefusedOrderByCaptain();
|
||||
super.onInit();
|
||||
}
|
||||
|
||||
|
||||
@@ -12,7 +12,7 @@ import '../../../constant/colors.dart';
|
||||
import '../../../constant/links.dart';
|
||||
import '../../../main.dart';
|
||||
import '../../../views/Rate/rate_passenger.dart';
|
||||
import '../../../views/home/Captin/home_captin.dart';
|
||||
import '../../../views/home/Captin/home_captain/home_captin.dart';
|
||||
import '../../firebase/firbase_messge.dart';
|
||||
import '../../functions/crud.dart';
|
||||
import '../../functions/location_controller.dart';
|
||||
@@ -49,8 +49,8 @@ class MapDriverController extends GetxController {
|
||||
double progress = 0;
|
||||
double progressToPassenger = 0;
|
||||
bool isRideBegin = false;
|
||||
int progressTimerToShowPassengerInfoWindowFromDriver = 15;
|
||||
int remainingTimeToShowPassengerInfoWindowFromDriver = 15;
|
||||
int progressTimerToShowPassengerInfoWindowFromDriver = 20;
|
||||
int remainingTimeToShowPassengerInfoWindowFromDriver = 20;
|
||||
int remainingTimeToPassenger = 60;
|
||||
bool isDriverNearPassengerStart = false;
|
||||
GoogleMapController? mapController;
|
||||
@@ -60,7 +60,7 @@ class MapDriverController extends GetxController {
|
||||
double progressTimerRideBegin = 0;
|
||||
late Timer timer;
|
||||
String? mapAPIKEY;
|
||||
|
||||
final zones = <Zone>[];
|
||||
void onMapCreated(GoogleMapController controller) {
|
||||
LocationController locationController = Get.find<LocationController>();
|
||||
myLocation = locationController.myLocation;
|
||||
|
||||
@@ -8,14 +8,15 @@ import 'package:ride/views/widgets/elevated_btn.dart';
|
||||
import '../../../constant/box_name.dart';
|
||||
import '../../../constant/table_names.dart';
|
||||
import '../../functions/crud.dart';
|
||||
import '../../functions/location_controller.dart';
|
||||
|
||||
class OrderRequestController extends GetxController {
|
||||
double progress = 0;
|
||||
int duration = 15;
|
||||
int duration = 20;
|
||||
int remainingTime = 0;
|
||||
String countRefuse = '0';
|
||||
bool applied = false;
|
||||
|
||||
final locationController = Get.put(LocationController());
|
||||
@override
|
||||
void onInit() {
|
||||
getRefusedOrderByCaptain();
|
||||
@@ -47,6 +48,7 @@ class OrderRequestController extends GetxController {
|
||||
countRefuse = results[0]['count'].toString();
|
||||
update();
|
||||
if (int.parse(countRefuse) > 3) {
|
||||
locationController.stopLocationUpdates();
|
||||
Get.defaultDialog(
|
||||
// backgroundColor: CupertinoColors.destructiveRed,
|
||||
barrierDismissible: false,
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:get/get.dart';
|
||||
|
||||
import '../../../../constant/style.dart';
|
||||
import '../../../../views/widgets/elevated_btn.dart';
|
||||
import '../home_captain_controller.dart';
|
||||
import '../order_request_controller.dart';
|
||||
|
||||
@@ -19,7 +21,23 @@ class ConnectWidget extends StatelessWidget {
|
||||
int.parse(orderRequestController.countRefuse) > 3
|
||||
? CupertinoButton(
|
||||
child: Text('You are Stopped'.tr),
|
||||
onPressed: () {},
|
||||
onPressed: () {
|
||||
Get.defaultDialog(
|
||||
// backgroundColor: CupertinoColors.destructiveRed,
|
||||
barrierDismissible: false,
|
||||
title: 'You Are Stopped For this Day !'.tr,
|
||||
content: Text(
|
||||
'You Refused 3 Rides this Day that is the reason \nSee you Tomorrow!'
|
||||
.tr,
|
||||
style: AppStyle.title,
|
||||
),
|
||||
confirm: MyElevatedButton(
|
||||
title: 'Ok , See you Tomorrow'.tr,
|
||||
onPressed: () {
|
||||
Get.back();
|
||||
Get.back();
|
||||
}));
|
||||
},
|
||||
color: CupertinoColors.destructiveRed,
|
||||
)
|
||||
: CupertinoButton(
|
||||
|
||||
@@ -13,6 +13,24 @@ GetBuilder<HomeCaptainController> leftMainMenuCaptainIcons() {
|
||||
left: 6,
|
||||
child: Column(
|
||||
children: [
|
||||
AnimatedContainer(
|
||||
duration: const Duration(microseconds: 200),
|
||||
width: controller.widthMapTypeAndTraffic,
|
||||
decoration: BoxDecoration(
|
||||
border: Border.all(),
|
||||
color: AppColor.secondaryColor,
|
||||
borderRadius: BorderRadius.circular(15)),
|
||||
child: IconButton(
|
||||
onPressed: () {},
|
||||
icon: const Icon(
|
||||
FontAwesome.map_signs,
|
||||
size: 24,
|
||||
color: Colors.black,
|
||||
)),
|
||||
),
|
||||
const SizedBox(
|
||||
height: 5,
|
||||
),
|
||||
AnimatedContainer(
|
||||
duration: const Duration(microseconds: 200),
|
||||
width: controller.widthMapTypeAndTraffic,
|
||||
|
||||
@@ -6,6 +6,7 @@ import 'package:get/get.dart';
|
||||
import 'package:google_maps_flutter/google_maps_flutter.dart';
|
||||
import 'package:google_polyline_algorithm/google_polyline_algorithm.dart';
|
||||
import 'package:location/location.dart';
|
||||
import 'package:ride/views/home/map_page_passenger.dart';
|
||||
import '../../constant/api_key.dart';
|
||||
import '../../constant/box_name.dart';
|
||||
import '../../constant/info.dart';
|
||||
@@ -359,9 +360,21 @@ class MapPassengerController extends GetxController {
|
||||
update();
|
||||
startTimer();
|
||||
} else if (decod['data'].toString() == 'Refused') {
|
||||
carsOrder++;
|
||||
update();
|
||||
changeConfirmRide();
|
||||
if (dataCarsLocationByPassenger.length > carsOrder) {
|
||||
carsOrder++;
|
||||
update();
|
||||
changeConfirmRide();
|
||||
} else {
|
||||
Get.defaultDialog(
|
||||
title: 'There no Captain Aplly your order sorry for that '.tr,
|
||||
middleText: 'try next time .',
|
||||
confirm: MyElevatedButton(
|
||||
title: 'Back',
|
||||
onPressed: () => Get.offAll(const MapPagePassenger()),
|
||||
));
|
||||
|
||||
// cancelRide();
|
||||
}
|
||||
} else {
|
||||
delayAndFetchRideStatus(
|
||||
rideId); // Repeat the delay and fetch operation
|
||||
@@ -443,8 +456,11 @@ class MapPassengerController extends GetxController {
|
||||
noCarString = false;
|
||||
dataCarsLocationByPassenger = jsonDecode(res);
|
||||
// print(dataCarsLocationByPassenger);
|
||||
// if (dataCarsLocationByPassenger.length > carsOrder) {
|
||||
driverId = dataCarsLocationByPassenger['message'][carsOrder]['driver_id']
|
||||
.toString();
|
||||
// }
|
||||
|
||||
// print('driverId==============$driverId');
|
||||
for (var i = 0; i < dataCarsLocationByPassenger['message'].length; i++) {
|
||||
carsLocationByPassenger.add(LatLng(
|
||||
|
||||
@@ -8,7 +8,7 @@ import '../../constant/box_name.dart';
|
||||
import '../../main.dart';
|
||||
import '../../onbording_page.dart';
|
||||
import '../../views/auth/captin/login_captin.dart';
|
||||
import '../../views/home/Captin/home_captin.dart';
|
||||
import '../../views/home/Captin/home_captain/home_captin.dart';
|
||||
import '../../views/home/map_page_passenger.dart';
|
||||
|
||||
class SplashScreenController extends GetxController
|
||||
|
||||
@@ -6,7 +6,7 @@ import 'package:ride/constant/style.dart';
|
||||
import 'package:ride/controller/functions/crud.dart';
|
||||
import 'package:ride/controller/home/map_passenger_controller.dart';
|
||||
import 'package:ride/main.dart';
|
||||
import 'package:ride/views/home/Captin/home_captin.dart';
|
||||
import 'package:ride/views/home/Captin/home_captain/home_captin.dart';
|
||||
import 'package:ride/views/home/map_page_passenger.dart';
|
||||
import 'package:ride/views/widgets/elevated_btn.dart';
|
||||
|
||||
|
||||
Reference in New Issue
Block a user