11/27/1
This commit is contained in:
@@ -11,6 +11,9 @@ class BoxName {
|
||||
static const String passengerID = "pasengerID";
|
||||
static const String phone = "phone";
|
||||
static const String phoneDriver = "phoneDriver";
|
||||
static const String dobDriver = "dobDriver";
|
||||
static const String sexDriver = "sexDriver";
|
||||
static const String lastNameDriver = "lastNameDriver";
|
||||
static const String name = "name";
|
||||
static const String nameDriver = "nameDriver";
|
||||
static const String email = "email";
|
||||
@@ -44,4 +47,12 @@ class BoxName {
|
||||
static const String chatGPTkeySefer = 'chatGPTkeySefer';
|
||||
static const String transactionCloude = 'transactionCloude';
|
||||
static const String visionApi = 'visionApi';
|
||||
static const String vin = "vin";
|
||||
static const String make = "make";
|
||||
static const String model = "model";
|
||||
static const String year = "year";
|
||||
static const String expirationDate = "expirationDate";
|
||||
static const String color = "color";
|
||||
static const String owner = "owner";
|
||||
static const String registrationDate = "registrationDate";
|
||||
}
|
||||
|
||||
@@ -1,121 +1,121 @@
|
||||
import 'package:ride/env/env.dart';
|
||||
|
||||
class AppLink {
|
||||
static const String server = 'https://ride.mobile-app.store'; //Env.serverPHP;
|
||||
static const String googleMapsLink = 'https://maps.googleapis.com/maps/api/';
|
||||
static const String llama = 'https://api.llama-api.com/chat/completions';
|
||||
static final String server = Env.serverPHP; //Env.serverPHP;
|
||||
static String googleMapsLink = 'https://maps.googleapis.com/maps/api/';
|
||||
static String llama = 'https://api.llama-api.com/chat/completions';
|
||||
|
||||
static const String test = "$server/test.php";
|
||||
static String test = "$server/test.php";
|
||||
//===============firebase==========================
|
||||
static const String getTokens = "$server/ride/firebase/get.php";
|
||||
static const String addTokens = "$server/ride/firebase/add.php";
|
||||
static const String addTokensDriver = "$server/ride/firebase/addDriver.php";
|
||||
static String getTokens = "$server/ride/firebase/get.php";
|
||||
static String addTokens = "$server/ride/firebase/add.php";
|
||||
static String addTokensDriver = "$server/ride/firebase/addDriver.php";
|
||||
|
||||
//=======================Wallet===================
|
||||
static const String wallet = '$server/ride/passengerWallet/';
|
||||
static const String getAllPassengerTransaction =
|
||||
static String wallet = '$server/ride/passengerWallet/';
|
||||
static String getAllPassengerTransaction =
|
||||
"$wallet/getAllPassengerTransaction.php";
|
||||
static const String getWalletByPassenger = "$wallet/getWalletByPassenger.php";
|
||||
static const String getPassengersWallet = "$wallet/get.php";
|
||||
static const String addPassengersWallet = "$wallet/add.php";
|
||||
static const String deletePassengersWallet = "$wallet/delete.php";
|
||||
static const String updatePassengersWallet = "$wallet/update.php";
|
||||
static String getWalletByPassenger = "$wallet/getWalletByPassenger.php";
|
||||
static String getPassengersWallet = "$wallet/get.php";
|
||||
static String addPassengersWallet = "$wallet/add.php";
|
||||
static String deletePassengersWallet = "$wallet/delete.php";
|
||||
static String updatePassengersWallet = "$wallet/update.php";
|
||||
|
||||
//=======================promo===================ride.mobile-app.store/ride/promo/get.php
|
||||
static const String promo = '$server/ride/promo';
|
||||
static const String getPassengersPromo = "$promo/get.php";
|
||||
static const String getPromoBytody = "$promo/getPromoBytody.php";
|
||||
static const String addPassengersPromo = "$promo/add.php";
|
||||
static const String deletePassengersPromo = "$promo/delete.php";
|
||||
static const String updatePassengersPromo = "$promo/update.php";
|
||||
static String promo = '$server/ride/promo';
|
||||
static String getPassengersPromo = "$promo/get.php";
|
||||
static String getPromoBytody = "$promo/getPromoBytody.php";
|
||||
static String addPassengersPromo = "$promo/add.php";
|
||||
static String deletePassengersPromo = "$promo/delete.php";
|
||||
static String updatePassengersPromo = "$promo/update.php";
|
||||
|
||||
////=======================cancelRide===================
|
||||
static const String ride = '$server/ride';
|
||||
static const String addCancelRideFromPassenger =
|
||||
"$server/ride/cancelRide/add.php";
|
||||
static const String cancelRide = "$server/ride/cancelRide/get.php";
|
||||
static String ride = '$server/ride';
|
||||
static String addCancelRideFromPassenger = "$server/ride/cancelRide/add.php";
|
||||
static String cancelRide = "$server/ride/cancelRide/get.php";
|
||||
//-----------------ridessss------------------
|
||||
static const String addRides = "$ride/rides/add.php";
|
||||
static const String getRides = "$ride/rides/get.php";
|
||||
static const String getRideStatus = "$ride/rides/getRideStatus.php";
|
||||
static const String getRideStatusBegin = "$ride/rides/getRideStatusBegin.php";
|
||||
static const String updateRides = "$ride/rides/update.php";
|
||||
static const String deleteRides = "$ride/rides/delete.php";
|
||||
static String addRides = "$ride/rides/add.php";
|
||||
static String getRides = "$ride/rides/get.php";
|
||||
static String getRideOrderID = "$ride/rides/getRideOrderID.php";
|
||||
static String getRideStatus = "$ride/rides/getRideStatus.php";
|
||||
static String getRideStatusBegin = "$ride/rides/getRideStatusBegin.php";
|
||||
static String updateRides = "$ride/rides/update.php";
|
||||
static String deleteRides = "$ride/rides/delete.php";
|
||||
|
||||
//-----------------DriverPayment------------------
|
||||
static const String addDriverpayment = "$ride/payment/add.php";
|
||||
static const String getDriverpaymentToday = "$ride/payment/get.php";
|
||||
static const String getAllPayment = "$ride/payment/getAllPayment.php";
|
||||
static String addDriverpayment = "$ride/payment/add.php";
|
||||
static String getDriverpaymentToday = "$ride/payment/get.php";
|
||||
static String getAllPayment = "$ride/payment/getAllPayment.php";
|
||||
//-----------------Api Key------------------
|
||||
static const String addApiKey = "$ride/apiKey/add.php";
|
||||
static const String getApiKey = "$ride/apiKey/get.php";
|
||||
static const String updateApiKey = "$ride/apiKey/update.php";
|
||||
static const String deleteApiKey = "$ride/apiKey/delete.php";
|
||||
static String addApiKey = "$ride/apiKey/add.php";
|
||||
static String getApiKey = "$ride/apiKey/get.php";
|
||||
static String updateApiKey = "$ride/apiKey/update.php";
|
||||
static String deleteApiKey = "$ride/apiKey/delete.php";
|
||||
|
||||
//-----------------Feed Back------------------
|
||||
static const String addFeedBack = "$ride/feedBack/add.php";
|
||||
static const String getFeedBack = "$ride/feedBack/get.php";
|
||||
static const String updateFeedBack = "$ride/feedBack/updateFeedBack.php";
|
||||
static String addFeedBack = "$ride/feedBack/add.php";
|
||||
static String getFeedBack = "$ride/feedBack/get.php";
|
||||
static String updateFeedBack = "$ride/feedBack/updateFeedBack.php";
|
||||
//-----------------license------------------
|
||||
static const String addLicense = "$ride/license/add.php";
|
||||
static const String getLicense = "$ride/license/get.php";
|
||||
static const String updateLicense = "$ride/license/updateFeedBack.php";
|
||||
static String addLicense = "$ride/license/add.php";
|
||||
static String getLicense = "$ride/license/get.php";
|
||||
static String updateLicense = "$ride/license/updateFeedBack.php";
|
||||
//-----------------RegisrationCar------------------
|
||||
static const String addRegisrationCar = "$ride/RegisrationCar/add.php";
|
||||
static const String getRegisrationCar = "$ride/RegisrationCar/get.php";
|
||||
static const String updateRegisrationCar =
|
||||
static String addRegisrationCar = "$ride/RegisrationCar/add.php";
|
||||
static String getRegisrationCar = "$ride/RegisrationCar/get.php";
|
||||
static String updateRegisrationCar =
|
||||
"$ride/RegisrationCar/updateFeedBack.php";
|
||||
|
||||
//-----------------DriverOrder------------------
|
||||
|
||||
static const String addDriverOrder = "$ride/driver_order/add.php";
|
||||
static const String getDriverOrder = "$ride/driver_order/get.php";
|
||||
static const String getOrderCancelStatus =
|
||||
static String addDriverOrder = "$ride/driver_order/add.php";
|
||||
static String getDriverOrder = "$ride/driver_order/get.php";
|
||||
static String getOrderCancelStatus =
|
||||
"$ride/driver_order/getOrderCancelStatus.php";
|
||||
static const String updateDriverOrder = "$ride/driver_order/update.php";
|
||||
static const String deleteDriverOrder = "$ride/driver_order/delete.php";
|
||||
static String updateDriverOrder = "$ride/driver_order/update.php";
|
||||
static String deleteDriverOrder = "$ride/driver_order/delete.php";
|
||||
|
||||
// =====================================
|
||||
static const String addRateToPassenger = "$ride/rate/add.php";
|
||||
static const String addRateToDriver = "$ride/rate/addRateToDriver.php";
|
||||
static String addRateToPassenger = "$ride/rate/add.php";
|
||||
static String addRateToDriver = "$ride/rate/addRateToDriver.php";
|
||||
|
||||
// ===========================================
|
||||
static const String pathImage = "$server/upload/types/";
|
||||
static const String uploadImage = "$server/uploadImage.php";
|
||||
static const String uploadImageType = "$server/uploadImageType.php";
|
||||
static String pathImage = "$server/upload/types/";
|
||||
static String uploadImage = "$server/uploadImage.php";
|
||||
static String uploadImagePortrate = "$server/uploadImagePortrate.php";
|
||||
static String uploadImageType = "$server/uploadImageType.php";
|
||||
|
||||
//==================certifcate==========
|
||||
static const String location = '$server/ride/location';
|
||||
static const String getCarsLocationByPassenger = "$location/get.php";
|
||||
static const String getDriverCarsLocationToPassengerAfterApplied =
|
||||
static String location = '$server/ride/location';
|
||||
static String getCarsLocationByPassenger = "$location/get.php";
|
||||
static String getDriverCarsLocationToPassengerAfterApplied =
|
||||
"$location/getDriverCarsLocationToPassengerAfterApplied.php";
|
||||
static const String addCarsLocationByPassenger = "$location/add.php";
|
||||
static const String deleteCarsLocationByPassenger = "$location/delete.php";
|
||||
static const String updateCarsLocationByPassenger = "$location/update.php";
|
||||
static const String getTotalDriverDuration =
|
||||
"$location/getTotalDriverDuration.php";
|
||||
static const String getTotalDriverDurationToday =
|
||||
static String addCarsLocationByPassenger = "$location/add.php";
|
||||
static String deleteCarsLocationByPassenger = "$location/delete.php";
|
||||
static String updateCarsLocationByPassenger = "$location/update.php";
|
||||
static String getTotalDriverDuration = "$location/getTotalDriverDuration.php";
|
||||
static String getTotalDriverDurationToday =
|
||||
"$location/getTotalDriverDurationToday.php";
|
||||
|
||||
//==================Blog=============
|
||||
static const String profile = '$server/ride/profile';
|
||||
static const String getprofile = "$profile/get.php";
|
||||
static const String addprofile = "$profile/add.php";
|
||||
static const String deleteprofile = "$profile/delete.php";
|
||||
static const String updateprofile = "$profile/update.php";
|
||||
static String profile = '$server/ride/profile';
|
||||
static String getprofile = "$profile/get.php";
|
||||
static String addprofile = "$profile/add.php";
|
||||
static String deleteprofile = "$profile/delete.php";
|
||||
static String updateprofile = "$profile/update.php";
|
||||
|
||||
//===================Auth============
|
||||
|
||||
static const String auth = 'https://ride.mobile-app.store/auth';
|
||||
static const String login = "$auth/login.php";
|
||||
static const String signUp = "$auth/signup.php";
|
||||
static const String sendVerifyEmail = "$auth/sendVerifyEmail.php";
|
||||
static const String verifyEmail = "$auth/verifyEmail.php";
|
||||
static String auth = 'https://ride.mobile-app.store/auth';
|
||||
static String login = "$auth/login.php";
|
||||
static String signUp = "$auth/signup.php";
|
||||
static String sendVerifyEmail = "$auth/sendVerifyEmail.php";
|
||||
static String verifyEmail = "$auth/verifyEmail.php";
|
||||
//===================Auth Captin============
|
||||
static const String authCaptin = 'https://ride.mobile-app.store/auth/captin';
|
||||
static const String loginCaptin = "$authCaptin/login.php";
|
||||
static const String signUpCaptin = "$authCaptin/register.php";
|
||||
static const String sendVerifyEmailCaptin = "$authCaptin/sendVerifyEmail.php";
|
||||
static const String verifyEmailCaptin = "$authCaptin/verifyEmail.php";
|
||||
static const String removeUser = "$authCaptin/removeAccount.php";
|
||||
static String authCaptin = 'https://ride.mobile-app.store/auth/captin';
|
||||
static String loginCaptin = "$authCaptin/login.php";
|
||||
static String signUpCaptin = "$authCaptin/register.php";
|
||||
static String sendVerifyEmailCaptin = "$authCaptin/sendVerifyEmail.php";
|
||||
static String verifyEmailCaptin = "$authCaptin/verifyEmail.php";
|
||||
static String removeUser = "$authCaptin/removeAccount.php";
|
||||
}
|
||||
|
||||
48
lib/controller/auth/captin/history_captain.dart
Normal file
48
lib/controller/auth/captin/history_captain.dart
Normal file
@@ -0,0 +1,48 @@
|
||||
import 'dart:convert';
|
||||
|
||||
import 'package:get/get.dart';
|
||||
|
||||
import '../../../constant/box_name.dart';
|
||||
import '../../../constant/links.dart';
|
||||
import '../../../main.dart';
|
||||
import '../../../views/home/Captin/history/history_details_page.dart';
|
||||
import '../../functions/crud.dart';
|
||||
|
||||
class HistoryCaptainController extends GetxController {
|
||||
bool isloading = false;
|
||||
Map historyData = {};
|
||||
Map historyDetailsData = {};
|
||||
late String orderID;
|
||||
getOrderId(String orderId) {
|
||||
orderID = orderId;
|
||||
update();
|
||||
}
|
||||
|
||||
getHistory() async {
|
||||
isloading = true;
|
||||
var res = await CRUD().get(
|
||||
link: AppLink.getDriverOrder,
|
||||
payload: {'driver_id': box.read(BoxName.driverID)});
|
||||
historyData = jsonDecode(res);
|
||||
print(historyData);
|
||||
isloading = false;
|
||||
update();
|
||||
}
|
||||
|
||||
getHistoryDetails(String orderId) async {
|
||||
isloading = true;
|
||||
var res = await CRUD()
|
||||
.get(link: AppLink.getRideOrderID, payload: {'id': orderId});
|
||||
historyDetailsData = jsonDecode(res);
|
||||
print(historyDetailsData);
|
||||
isloading = false;
|
||||
update();
|
||||
Get.to(() => HistoryDetailsPage());
|
||||
}
|
||||
|
||||
@override
|
||||
void onInit() {
|
||||
getHistory();
|
||||
super.onInit();
|
||||
}
|
||||
}
|
||||
@@ -3,9 +3,11 @@ import 'dart:math';
|
||||
|
||||
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/controller/functions/ocr_controller.dart';
|
||||
import 'package:ride/main.dart';
|
||||
import 'package:ride/views/auth/captin/login_captin.dart';
|
||||
import 'package:ride/views/auth/captin/verify_email_captain.dart';
|
||||
|
||||
@@ -139,6 +141,14 @@ class RegisterCaptainController extends GetxController {
|
||||
'registrationDate': registrationDate,
|
||||
});
|
||||
print(jsonDecode(res));
|
||||
box.write(BoxName.vin, vin);
|
||||
box.write(BoxName.make, make);
|
||||
box.write(BoxName.model, model);
|
||||
box.write(BoxName.year, year);
|
||||
box.write(BoxName.expirationDate, expirationDate);
|
||||
box.write(BoxName.color, color);
|
||||
box.write(BoxName.owner, owner);
|
||||
box.write(BoxName.registrationDate, registrationDate);
|
||||
isLoading = false;
|
||||
update();
|
||||
if (jsonDecode(res)['status'] == 'success') {
|
||||
@@ -166,6 +176,10 @@ class RegisterCaptainController extends GetxController {
|
||||
update();
|
||||
if (jsonDecode(res)['status'] == 'success') {
|
||||
print('sdfffffffffff');
|
||||
box.write(BoxName.dobDriver, dob);
|
||||
box.write(BoxName.sexDriver, sex);
|
||||
box.write(BoxName.phoneDriver, phoneController.text);
|
||||
box.write(BoxName.lastNameDriver, name.split(' ')[0]);
|
||||
int randomNumber = Random().nextInt(100000) + 1;
|
||||
await CRUD().post(link: AppLink.sendVerifyEmail, payload: {
|
||||
'email': emailController.text,
|
||||
|
||||
@@ -26,14 +26,13 @@ class CRUD {
|
||||
// 'Basic ${base64Encode(utf8.encode(basicAuthCredentials.toString()))}',
|
||||
},
|
||||
);
|
||||
//print("-----basicAuthCredentials----" + AK.basicAuthCredentials.toString());
|
||||
//print("-----request----" + response.request.toString());
|
||||
//print("-----headers-----" + response.headers.toString());
|
||||
//print("-----payload-----" + payload.toString());
|
||||
// print("-----request----" + response.request.toString());
|
||||
// print("-----headers-----" + response.headers.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;
|
||||
}
|
||||
|
||||
@@ -6,20 +6,16 @@ import 'package:flutter/material.dart';
|
||||
import 'package:get/get.dart';
|
||||
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/links.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';
|
||||
|
||||
import '../../constant/links.dart';
|
||||
import '../../views/auth/captin/car_license_page.dart';
|
||||
import 'launch.dart';
|
||||
|
||||
@@ -232,6 +228,7 @@ class ScanDocumentsByApi extends GetxController {
|
||||
late Uint8List imageDocumentFrontSide;
|
||||
XFile? image;
|
||||
XFile? imageFace;
|
||||
late File tempFile;
|
||||
late String imagePath;
|
||||
DateTime now = DateTime.now();
|
||||
late String name;
|
||||
@@ -326,7 +323,7 @@ class ScanDocumentsByApi extends GetxController {
|
||||
responseMap['data']['image']['portrait'] != null) {
|
||||
imagePortrait = base64Decode(responseMap['data']['image']['portrait']);
|
||||
String tempPath = Directory.systemTemp.path;
|
||||
File tempFile = File('$tempPath/image.jpg');
|
||||
tempFile = File('$tempPath/image.jpg');
|
||||
await tempFile.writeAsBytes(imagePortrait);
|
||||
|
||||
imagePath = tempFile.path;
|
||||
@@ -480,7 +477,11 @@ class ScanDocumentsByApi extends GetxController {
|
||||
)
|
||||
: MyElevatedButton(
|
||||
title: 'Next'.tr,
|
||||
onPressed: () => Get.to(() => CarLicensePage()),
|
||||
onPressed: () async {
|
||||
await uploadImage(
|
||||
tempFile, AppLink.uploadImagePortrate);
|
||||
Get.to(() => CarLicensePage());
|
||||
},
|
||||
kolor: AppColor.greenColor,
|
||||
));
|
||||
} else {
|
||||
@@ -489,12 +490,12 @@ class ScanDocumentsByApi extends GetxController {
|
||||
}
|
||||
// Todo upload images and fields
|
||||
|
||||
Future<String> uploadImage(File imageFile) async {
|
||||
Future<String> uploadImage(File imageFile, String link) async {
|
||||
String? basicAuthCredentials =
|
||||
await storage.read(key: BoxName.basicAuthCredentials);
|
||||
var request = http.MultipartRequest(
|
||||
'POST',
|
||||
Uri.parse(AppLink.uploadImage),
|
||||
Uri.parse(link), //AppLink.uploadImage
|
||||
);
|
||||
|
||||
// Attach the image file to the request
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import 'dart:async';
|
||||
import 'dart:convert';
|
||||
import 'dart:math';
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:get/get.dart';
|
||||
@@ -61,6 +62,7 @@ class MapDriverController extends GetxController {
|
||||
late Timer timer;
|
||||
String? mapAPIKEY;
|
||||
final zones = <Zone>[];
|
||||
|
||||
void onMapCreated(GoogleMapController controller) {
|
||||
LocationController locationController = Get.find<LocationController>();
|
||||
myLocation = locationController.myLocation;
|
||||
|
||||
@@ -2,6 +2,8 @@ import 'package:flutter/material.dart';
|
||||
import 'package:flutter_font_icons/flutter_font_icons.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:ride/controller/home/captin/home_captain_controller.dart';
|
||||
import 'package:ride/controller/home/captin/map_driver_controller.dart';
|
||||
import 'package:ride/controller/home/captin/widget/zones_controller.dart';
|
||||
|
||||
import '../../../../constant/colors.dart';
|
||||
import '../../../../views/Rate/ride_calculate_driver.dart';
|
||||
@@ -21,7 +23,11 @@ GetBuilder<HomeCaptainController> leftMainMenuCaptainIcons() {
|
||||
color: AppColor.secondaryColor,
|
||||
borderRadius: BorderRadius.circular(15)),
|
||||
child: IconButton(
|
||||
onPressed: () {},
|
||||
onPressed: () {
|
||||
ZonesController mapDriverController =
|
||||
Get.put(ZonesController());
|
||||
mapDriverController.getJsonOfZones();
|
||||
},
|
||||
icon: const Icon(
|
||||
FontAwesome.map_signs,
|
||||
size: 24,
|
||||
|
||||
73
lib/controller/home/captin/widget/zones_controller.dart
Normal file
73
lib/controller/home/captin/widget/zones_controller.dart
Normal file
@@ -0,0 +1,73 @@
|
||||
import 'dart:convert';
|
||||
import 'dart:math';
|
||||
|
||||
import 'package:get/get.dart';
|
||||
import 'package:google_maps_flutter/google_maps_flutter.dart';
|
||||
|
||||
class ZonesController extends GetxController {
|
||||
Map<String, List<LatLng>> generateZoneMap(
|
||||
LatLng southwest, LatLng southEast, LatLng northeast) {
|
||||
const double desiredZoneArea = 4; // in square kilometers
|
||||
|
||||
final double width = (southEast.longitude - southwest.longitude) * 100;
|
||||
final double height = (northeast.latitude - southEast.latitude) * 100;
|
||||
final double totalArea = width * height;
|
||||
print(width);
|
||||
print(height);
|
||||
|
||||
// final int numZones = (totalArea / desiredZoneArea).ceil();
|
||||
|
||||
final double zoneWidth = width / sqrt(desiredZoneArea);
|
||||
final double zoneHeight = height / sqrt(desiredZoneArea);
|
||||
final numRows =
|
||||
((northeast.latitude - southwest.latitude) / zoneHeight).ceil();
|
||||
final numCols =
|
||||
((southEast.longitude - southwest.longitude) / zoneWidth).ceil();
|
||||
print('zoneWidth = $zoneWidth');
|
||||
print('zoneHeight = $zoneHeight');
|
||||
List<String> zoneNames = [];
|
||||
List<LatLng> zoneCoordinates = [];
|
||||
|
||||
for (int row = 0; row < numRows; row++) {
|
||||
for (int col = 0; col < numCols; col++) {
|
||||
final double zoneSouthwestLat =
|
||||
southwest.latitude + (row * zoneHeight / 100);
|
||||
final double zoneSouthwestLng =
|
||||
southwest.longitude + (col * zoneWidth / 100);
|
||||
final double zoneNortheastLat = zoneSouthwestLat + zoneHeight / 100;
|
||||
final double zoneNortheastLng = zoneSouthwestLng + zoneWidth / 100;
|
||||
|
||||
LatLng zoneSouthwest = LatLng(zoneSouthwestLat, zoneSouthwestLng);
|
||||
LatLng zoneNortheast = LatLng(zoneNortheastLat, zoneNortheastLng);
|
||||
|
||||
String zoneName =
|
||||
'Zone${row + col}'; // Assign a unique name to each zone
|
||||
|
||||
zoneNames.add(zoneName);
|
||||
zoneCoordinates.add(zoneSouthwest);
|
||||
zoneCoordinates.add(zoneNortheast);
|
||||
}
|
||||
}
|
||||
|
||||
Map<String, List<LatLng>> zoneMap = {};
|
||||
for (int i = 0; i < zoneNames.length; i++) {
|
||||
zoneMap[zoneNames[i]] = [
|
||||
zoneCoordinates[i], // Southwest LatLng
|
||||
zoneCoordinates[i + 1], // Northeast LatLng
|
||||
];
|
||||
}
|
||||
|
||||
return zoneMap;
|
||||
}
|
||||
|
||||
void getJsonOfZones() {
|
||||
LatLng southwest = const LatLng(32.111107, 36.062222);
|
||||
LatLng southEast = const LatLng(32.108333, 36.101667);
|
||||
LatLng northeast = const LatLng(32.143889, 36.058889);
|
||||
Map<String, List<LatLng>> zoneMap =
|
||||
generateZoneMap(southwest, southEast, northeast);
|
||||
String jsonMap = json.encode(zoneMap);
|
||||
|
||||
print(jsonMap);
|
||||
}
|
||||
}
|
||||
@@ -312,7 +312,8 @@ class MapPassengerController extends GetxController {
|
||||
totalDriver.toString(),
|
||||
duration.toString(),
|
||||
distance.toString(),
|
||||
dataCarsLocationByPassenger['message'][carsOrder]['id'].toString(),
|
||||
dataCarsLocationByPassenger['message'][carsOrder]['driver_id']
|
||||
.toString(),
|
||||
box.read(BoxName.passengerID).toString(),
|
||||
box.read(BoxName.name).toString(),
|
||||
box.read(BoxName.tokenFCM).toString(),
|
||||
|
||||
@@ -9,7 +9,6 @@ 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';
|
||||
import '../../../main.dart';
|
||||
import '../../widgets/elevated_btn.dart';
|
||||
import '../../widgets/my_scafold.dart';
|
||||
|
||||
|
||||
102
lib/views/home/Captin/history/history_captain.dart
Normal file
102
lib/views/home/Captin/history/history_captain.dart
Normal file
@@ -0,0 +1,102 @@
|
||||
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';
|
||||
|
||||
class HistoryCaptain extends StatelessWidget {
|
||||
const HistoryCaptain({super.key});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
Get.put(HistoryCaptainController());
|
||||
return MyScafolld(
|
||||
title: 'History Page'.tr,
|
||||
body: [
|
||||
GetBuilder<HistoryCaptainController>(
|
||||
builder: (historyCaptainController) => Expanded(
|
||||
child: historyCaptainController.isloading
|
||||
? const MyCircularProgressIndicator()
|
||||
: ListView.builder(
|
||||
itemCount: historyCaptainController
|
||||
.historyData['message'].length,
|
||||
itemBuilder: (BuildContext context, int index) {
|
||||
var list = historyCaptainController
|
||||
.historyData['message'][index];
|
||||
return InkWell(
|
||||
onTap: () {
|
||||
list['status'] != 'Cancel'
|
||||
? historyCaptainController
|
||||
.getHistoryDetails(list['order_id'])
|
||||
: Get.defaultDialog(
|
||||
title: 'This Trip Cancelled'.tr,
|
||||
middleText: '',
|
||||
titleStyle: AppStyle.title,
|
||||
confirm: MyElevatedButton(
|
||||
title: 'Ok'.tr,
|
||||
onPressed: () => Get.back()));
|
||||
},
|
||||
child: Card(
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.all(8.0),
|
||||
child: Row(
|
||||
mainAxisAlignment:
|
||||
MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
Column(
|
||||
crossAxisAlignment:
|
||||
CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text(
|
||||
'OrderID',
|
||||
style: AppStyle.title,
|
||||
),
|
||||
Text(
|
||||
list['order_id'],
|
||||
style: AppStyle.subtitle,
|
||||
),
|
||||
],
|
||||
),
|
||||
Column(
|
||||
crossAxisAlignment:
|
||||
CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text(
|
||||
'created_at',
|
||||
style: AppStyle.title,
|
||||
),
|
||||
Text(
|
||||
list['created_at'],
|
||||
style: AppStyle.subtitle,
|
||||
),
|
||||
],
|
||||
),
|
||||
Text(
|
||||
list['status'],
|
||||
style: list['status'] == 'Apply'
|
||||
? AppStyle.title.copyWith(
|
||||
color: AppColor.greenColor)
|
||||
: list['status'] == 'Refused'
|
||||
? AppStyle.title.copyWith(
|
||||
color: AppColor.redColor)
|
||||
: AppStyle.title.copyWith(
|
||||
color:
|
||||
AppColor.yellowColor),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
},
|
||||
),
|
||||
))
|
||||
],
|
||||
isleading: true,
|
||||
);
|
||||
}
|
||||
}
|
||||
155
lib/views/home/Captin/history/history_details_page.dart
Normal file
155
lib/views/home/Captin/history/history_details_page.dart
Normal file
@@ -0,0 +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/auth/captin/history_captain.dart';
|
||||
import 'package:ride/controller/functions/launch.dart';
|
||||
import 'package:ride/views/widgets/my_scafold.dart';
|
||||
|
||||
import '../../../widgets/mycircular.dart';
|
||||
|
||||
class HistoryDetailsPage extends StatelessWidget {
|
||||
HistoryDetailsPage({super.key});
|
||||
HistoryCaptainController historyCaptainController =
|
||||
Get.put(HistoryCaptainController());
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return MyScafolld(
|
||||
title: 'Trip Detail'.tr,
|
||||
body: [
|
||||
GetBuilder<HistoryCaptainController>(
|
||||
builder: (historyCaptainController) {
|
||||
var res = historyCaptainController.historyDetailsData['data'];
|
||||
return Expanded(
|
||||
child: historyCaptainController.isloading
|
||||
? const MyCircularProgressIndicator()
|
||||
: SingleChildScrollView(
|
||||
child: Column(
|
||||
children: [
|
||||
Container(
|
||||
width: Get.width * .8,
|
||||
decoration: BoxDecoration(
|
||||
border: Border.all(
|
||||
color: AppColor.blueColor, width: 2)),
|
||||
child: TextButton(
|
||||
onPressed: () {
|
||||
String mapUrl =
|
||||
'https://www.google.com/maps/dir/${res['start_location']}/${res['end_location']}/';
|
||||
print(mapUrl);
|
||||
launchUrl1(mapUrl);
|
||||
},
|
||||
child: Text(
|
||||
'Trip on Map Click here'.tr,
|
||||
style: AppStyle.title,
|
||||
),
|
||||
),
|
||||
),
|
||||
const SizedBox(
|
||||
height: 10,
|
||||
),
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
|
||||
children: [
|
||||
Text(
|
||||
'Order ID ${res['id']}',
|
||||
style: AppStyle.title,
|
||||
),
|
||||
Text(
|
||||
res['date'].toString(),
|
||||
style: AppStyle.title,
|
||||
),
|
||||
],
|
||||
),
|
||||
const SizedBox(
|
||||
height: 10,
|
||||
),
|
||||
Container(
|
||||
width: Get.width * .8,
|
||||
decoration: BoxDecoration(
|
||||
border: Border.all(
|
||||
color: AppColor.greenColor, width: 2)),
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
|
||||
children: [
|
||||
Text(
|
||||
'Price is ${res['price_for_driver']}',
|
||||
style: AppStyle.title,
|
||||
),
|
||||
Text(
|
||||
'Distance is ${res['distance']} KM',
|
||||
style: AppStyle.title,
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
const SizedBox(
|
||||
height: 10,
|
||||
),
|
||||
Text(
|
||||
'Times of Trip'.tr,
|
||||
style: AppStyle.title,
|
||||
),
|
||||
const SizedBox(
|
||||
height: 10,
|
||||
),
|
||||
Container(
|
||||
width: Get.width * .8,
|
||||
decoration: BoxDecoration(
|
||||
border: Border.all(
|
||||
color: AppColor.redColor, width: 2)),
|
||||
child: Column(
|
||||
children: [
|
||||
Text(
|
||||
'To Passenger is ${res['DriverIsGoingToPassenger']}',
|
||||
style: AppStyle.title,
|
||||
),
|
||||
Text(
|
||||
'TimeStart is ${res['rideTimeStart']}',
|
||||
style: AppStyle.title,
|
||||
),
|
||||
Text(
|
||||
'Time Finish is ${res['rideTimeFinish']}',
|
||||
style: AppStyle.title,
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
const SizedBox(
|
||||
height: 10,
|
||||
),
|
||||
Container(
|
||||
width: Get.width * .8,
|
||||
decoration: BoxDecoration(
|
||||
border: Border.all(
|
||||
color: AppColor.greenColor, width: 2)),
|
||||
child: Center(
|
||||
child: Text(
|
||||
'Passenger Name is ${res['first_name']} ${res['last_name']} ',
|
||||
style: AppStyle.title,
|
||||
),
|
||||
),
|
||||
),
|
||||
const SizedBox(
|
||||
height: 10,
|
||||
),
|
||||
Container(
|
||||
width: Get.width * .8,
|
||||
decoration: BoxDecoration(
|
||||
border: Border.all(
|
||||
color: AppColor.yellowColor, width: 2)),
|
||||
child: Center(
|
||||
child: Text(
|
||||
'Status is ${res['status']}',
|
||||
style: AppStyle.title,
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
));
|
||||
})
|
||||
],
|
||||
isleading: true,
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -1,16 +0,0 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:ride/views/widgets/my_scafold.dart';
|
||||
|
||||
class HistoryCaptain extends StatelessWidget {
|
||||
const HistoryCaptain({super.key});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return MyScafolld(
|
||||
title: 'History Page'.tr,
|
||||
body: [],
|
||||
isleading: true,
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -4,7 +4,7 @@ import 'package:ride/constant/box_name.dart';
|
||||
import 'package:ride/constant/colors.dart';
|
||||
import 'package:ride/main.dart';
|
||||
import 'package:ride/views/auth/captin/logout_captain.dart';
|
||||
import 'package:ride/views/home/Captin/history_captain.dart';
|
||||
import 'package:ride/views/home/Captin/history/history_captain.dart';
|
||||
import 'package:ride/views/home/Captin/home_captain/help_captain.dart';
|
||||
import 'package:ride/views/home/Captin/settings_captain.dart';
|
||||
import 'package:ride/views/home/my_wallet/walet_captain.dart';
|
||||
|
||||
@@ -1,5 +1,11 @@
|
||||
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/env/env.dart';
|
||||
import 'package:ride/main.dart';
|
||||
import 'package:ride/views/widgets/my_scafold.dart';
|
||||
|
||||
class ProfileCaptain extends StatelessWidget {
|
||||
@@ -9,7 +15,73 @@ class ProfileCaptain extends StatelessWidget {
|
||||
Widget build(BuildContext context) {
|
||||
return MyScafolld(
|
||||
title: 'My Profile'.tr,
|
||||
body: [],
|
||||
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",
|
||||
),
|
||||
),
|
||||
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,
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user