diff --git a/lib/constant/box_name.dart b/lib/constant/box_name.dart index 225f03f..53fd963 100644 --- a/lib/constant/box_name.dart +++ b/lib/constant/box_name.dart @@ -16,6 +16,7 @@ class BoxName { static const String agreeTerms = "agreeTerms"; static const String addWork = 'addWork'; static const String addHome = 'addHome'; + static const String rideArguments = 'rideArguments'; static const String durationData = 'durationData'; static const String rideStaticDriverData = 'rideStaticDriverData'; static const String lastTimeStaticThrottle = 'lastTimeStaticThrottle'; diff --git a/lib/controller/home/captin/map_driver_controller.dart b/lib/controller/home/captin/map_driver_controller.dart index f3453e4..4e7c115 100644 --- a/lib/controller/home/captin/map_driver_controller.dart +++ b/lib/controller/home/captin/map_driver_controller.dart @@ -882,18 +882,19 @@ class MapDriverController extends GetxController { // var coordDestination = passengerDestination.toString().split(','); // Parse to double - double latPassengerLocation = - double.parse(passengerLocation.toString().split(',')[0]); - double lngPassengerLocation = - double.parse(passengerLocation.toString().split(',')[1]); - double latPassengerDestination = - double.parse(passengerDestination.toString().split(',')[0]); - double lngPassengerDestination = - double.parse(passengerDestination.toString().split(',')[1]); - latLngPassengerLocation = - LatLng(latPassengerLocation, lngPassengerLocation); - latLngPassengerDestination = - LatLng(latPassengerDestination, lngPassengerDestination); + latlng(passengerLocation, passengerDestination); + // double latPassengerLocation = + // double.parse(passengerLocation.toString().split(',')[0]); + // double lngPassengerLocation = + // double.parse(passengerLocation.toString().split(',')[1]); + // double latPassengerDestination = + // double.parse(passengerDestination.toString().split(',')[0]); + // double lngPassengerDestination = + // double.parse(passengerDestination.toString().split(',')[1]); + // latLngPassengerLocation = + // LatLng(latPassengerLocation, lngPassengerLocation); + // latLngPassengerDestination = + // LatLng(latPassengerDestination, lngPassengerDestination); String lat = Get.find().myLocation.latitude.toString(); String lng = Get.find().myLocation.longitude.toString(); String origin = '$lat,$lng'; @@ -913,6 +914,22 @@ class MapDriverController extends GetxController { update(); } + latlng(String passengerLocation, passengerDestination) { + double latPassengerLocation = + double.parse(passengerLocation.toString().split(',')[0]); + print('latPassengerLocation $latPassengerLocation'); + double lngPassengerLocation = + double.parse(passengerLocation.toString().split(',')[1]); + double latPassengerDestination = + double.parse(passengerDestination.toString().split(',')[0]); + double lngPassengerDestination = + double.parse(passengerDestination.toString().split(',')[1]); + latLngPassengerLocation = + LatLng(latPassengerLocation, lngPassengerLocation); + latLngPassengerDestination = + LatLng(latPassengerDestination, lngPassengerDestination); + } + late Duration durationToAdd; int hours = 0; int minutes = 0; diff --git a/lib/controller/home/captin/speed_map_controller.dart b/lib/controller/home/captin/speed_map_controller.dart index 5bddc4a..b392154 100644 --- a/lib/controller/home/captin/speed_map_controller.dart +++ b/lib/controller/home/captin/speed_map_controller.dart @@ -109,56 +109,50 @@ class SpeedMapController extends GetxController { } argumentLoading() async { - passengerLocation = Get.arguments['passengerLocation']; + passengerLocation = box.read(BoxName.rideArguments)['passengerLocation']; print(passengerLocation); - passengerDestination = Get.arguments['passengerDestination']; + passengerDestination = + box.read(BoxName.rideArguments)['passengerDestination']; print(passengerDestination); - duration = Get.arguments['Duration']; - totalCost = Get.arguments['totalCost']; - passengerId = Get.arguments['passengerId']; - driverId = Get.arguments['driverId']; - distance = Get.arguments['Distance']; - passengerName = Get.arguments['name']; - passengerEmail = Get.arguments['email']; - totalPassenger = Get.arguments['totalPassenger']; - passengerPhone = Get.arguments['phone']; - walletChecked = Get.arguments['WalletChecked']; - tokenPassenger = Get.arguments['tokenPassenger']; - direction = Get.arguments['direction']; - durationToPassenger = Get.arguments['DurationToPassenger']; - rideId = Get.arguments['rideId']; - durationOfRideValue = Get.arguments['durationOfRideValue']; - paymentAmount = Get.arguments['paymentAmount']; - paymentMethod = Get.arguments['paymentMethod']; - isHaveSteps = Get.arguments['isHaveSteps']; - step0 = Get.arguments['step0']; - step1 = Get.arguments['step1']; - step2 = Get.arguments['step2']; - step3 = Get.arguments['step3']; - step4 = Get.arguments['step4']; - passengerWalletBurc = Get.arguments['passengerWalletBurc']; - timeOfOrder = Get.arguments['timeOfOrder']; - carType = Get.arguments['carType']; - kazan = Get.arguments['kazan']; - startNameLocation = Get.arguments['startNameLocation']; - endNameLocation = Get.arguments['endNameLocation']; + duration = box.read(BoxName.rideArguments)['Duration']; + totalCost = box.read(BoxName.rideArguments)['totalCost']; + passengerId = box.read(BoxName.rideArguments)['passengerId']; + driverId = box.read(BoxName.rideArguments)['driverId']; + distance = box.read(BoxName.rideArguments)['Distance']; + passengerName = box.read(BoxName.rideArguments)['name']; + passengerEmail = box.read(BoxName.rideArguments)['email']; + totalPassenger = box.read(BoxName.rideArguments)['totalPassenger']; + passengerPhone = box.read(BoxName.rideArguments)['phone']; + walletChecked = box.read(BoxName.rideArguments)['WalletChecked']; + tokenPassenger = box.read(BoxName.rideArguments)['tokenPassenger']; + direction = box.read(BoxName.rideArguments)['direction']; + durationToPassenger = + box.read(BoxName.rideArguments)['DurationToPassenger'].toString(); + print(durationToPassenger); + rideId = box.read(BoxName.rideArguments)['rideId']; + durationOfRideValue = + box.read(BoxName.rideArguments)['durationOfRideValue']; + paymentAmount = box.read(BoxName.rideArguments)['paymentAmount']; + paymentMethod = box.read(BoxName.rideArguments)['paymentMethod']; + isHaveSteps = box.read(BoxName.rideArguments)['isHaveSteps']; + step0 = box.read(BoxName.rideArguments)['step0']; + step1 = box.read(BoxName.rideArguments)['step1']; + step2 = box.read(BoxName.rideArguments)['step2']; + step3 = box.read(BoxName.rideArguments)['step3']; + step4 = box.read(BoxName.rideArguments)['step4']; + passengerWalletBurc = + box.read(BoxName.rideArguments)['passengerWalletBurc']; + timeOfOrder = box.read(BoxName.rideArguments)['timeOfOrder']; + carType = box.read(BoxName.rideArguments)['carType']; + kazan = box.read(BoxName.rideArguments)['kazan']; + startNameLocation = box.read(BoxName.rideArguments)['startNameLocation']; + endNameLocation = box.read(BoxName.rideArguments)['endNameLocation']; // var coords = passengerLocation.toString().split(','); // var coordDestination = passengerDestination.toString().split(','); // Parse to double - double latPassengerLocation = - double.parse(passengerLocation.toString().split(',')[0]); - double lngPassengerLocation = - double.parse(passengerLocation.toString().split(',')[1]); - double latPassengerDestination = - double.parse(passengerDestination.toString().split(',')[0]); - double lngPassengerDestination = - double.parse(passengerDestination.toString().split(',')[1]); - latLngPassengerLocation = - LatLng(latPassengerLocation, lngPassengerLocation); - latLngPassengerDestination = - LatLng(latPassengerDestination, lngPassengerDestination); + latlng(passengerLocation, passengerDestination); String lat = Get.find().myLocation.latitude.toString(); String lng = Get.find().myLocation.longitude.toString(); String origin = '$lat,$lng'; @@ -178,6 +172,22 @@ class SpeedMapController extends GetxController { update(); } + latlng(String passengerLocation, passengerDestination) { + double latPassengerLocation = + double.parse(passengerLocation.toString().split(',')[0]); + print('latPassengerLocation $latPassengerLocation'); + double lngPassengerLocation = + double.parse(passengerLocation.toString().split(',')[1]); + double latPassengerDestination = + double.parse(passengerDestination.toString().split(',')[0]); + double lngPassengerDestination = + double.parse(passengerDestination.toString().split(',')[1]); + latLngPassengerLocation = + LatLng(latPassengerLocation, lngPassengerLocation); + latLngPassengerDestination = + LatLng(latPassengerDestination, lngPassengerDestination); + } + double distanceBetweenDriverAndPassengerWhenConfirm = 0; getMap(String origin, destination) async { isLoading = false; diff --git a/lib/views/home/Captin/home_captain/widget/left_menu_map_captain.dart b/lib/views/home/Captin/home_captain/widget/left_menu_map_captain.dart index e14a960..937f397 100644 --- a/lib/views/home/Captin/home_captain/widget/left_menu_map_captain.dart +++ b/lib/views/home/Captin/home_captain/widget/left_menu_map_captain.dart @@ -1,5 +1,7 @@ import 'package:SEFER/constant/box_name.dart'; import 'package:SEFER/main.dart'; +import 'package:SEFER/views/home/Captin/driver_map_page.dart'; +import 'package:SEFER/views/home/Captin/driver_map_speed.dart'; import 'package:flutter/material.dart'; import 'package:flutter_font_icons/flutter_font_icons.dart'; import 'package:get/get.dart'; @@ -21,7 +23,7 @@ GetBuilder leftMainMenuCaptainIcons() { // duration: const Duration(microseconds: 200), // width: controller.widthMapTypeAndTraffic, // decoration: BoxDecoration( - // border: Border.all(color: AppColor.accentColor), + // border: Border.all(color: AppColor.blueColor), // color: AppColor.secondaryColor, // borderRadius: BorderRadius.circular(15)), // child: IconButton( @@ -54,7 +56,7 @@ GetBuilder leftMainMenuCaptainIcons() { duration: const Duration(microseconds: 200), width: controller.widthMapTypeAndTraffic, decoration: BoxDecoration( - border: Border.all(color: AppColor.accentColor), + border: Border.all(color: AppColor.blueColor), color: AppColor.secondaryColor, borderRadius: BorderRadius.circular(15)), child: IconButton( @@ -65,7 +67,7 @@ GetBuilder leftMainMenuCaptainIcons() { icon: const Icon( Icons.satellite_alt, size: 29, - color: AppColor.accentColor, + color: AppColor.blueColor, ), ), ), @@ -77,7 +79,7 @@ GetBuilder leftMainMenuCaptainIcons() { width: controller.widthMapTypeAndTraffic, decoration: BoxDecoration( color: AppColor.secondaryColor, - border: Border.all(color: AppColor.accentColor), + border: Border.all(color: AppColor.blueColor), borderRadius: BorderRadius.circular(15)), child: IconButton( onPressed: () { @@ -87,7 +89,7 @@ GetBuilder leftMainMenuCaptainIcons() { icon: const Icon( Icons.streetview_sharp, size: 29, - color: AppColor.accentColor, + color: AppColor.blueColor, ), ), ), @@ -99,7 +101,7 @@ GetBuilder leftMainMenuCaptainIcons() { width: controller.widthMapTypeAndTraffic, decoration: BoxDecoration( color: AppColor.secondaryColor, - border: Border.all(color: AppColor.accentColor), + border: Border.all(color: AppColor.blueColor), borderRadius: BorderRadius.circular(15)), child: IconButton( onPressed: () { @@ -112,7 +114,7 @@ GetBuilder leftMainMenuCaptainIcons() { icon: const Icon( Icons.location_on, size: 29, - color: AppColor.accentColor, + color: AppColor.blueColor, ), ), ), @@ -124,7 +126,7 @@ GetBuilder leftMainMenuCaptainIcons() { width: controller.widthMapTypeAndTraffic, decoration: BoxDecoration( color: AppColor.secondaryColor, - border: Border.all(color: AppColor.accentColor), + border: Border.all(color: AppColor.blueColor), borderRadius: BorderRadius.circular(15)), child: IconButton( onPressed: () { @@ -151,7 +153,28 @@ GetBuilder leftMainMenuCaptainIcons() { icon: const Icon( FontAwesome5.chart_bar, size: 29, - color: AppColor.accentColor, + color: AppColor.blueColor, + ), + ), + ), + AnimatedContainer( + duration: const Duration(microseconds: 200), + width: controller.widthMapTypeAndTraffic, + decoration: BoxDecoration( + color: AppColor.secondaryColor, + border: Border.all(color: AppColor.blueColor), + borderRadius: BorderRadius.circular(15)), + child: IconButton( + onPressed: () { + // Get.to(() => PassengerLocationMapPage(), + // arguments: box.read(BoxName.rideArguments)); + Get.to(() => DriverSpeedLocationMapPage()); + // print(box.read(BoxName.rideArguments)['Duration']); + }, + icon: const Icon( + FontAwesome5.grin_tears, + size: 29, + color: AppColor.blueColor, ), ), ), diff --git a/lib/views/home/Captin/orderCaptin/order_speed_request.dart b/lib/views/home/Captin/orderCaptin/order_speed_request.dart index 67b1e11..aae67c5 100644 --- a/lib/views/home/Captin/orderCaptin/order_speed_request.dart +++ b/lib/views/home/Captin/orderCaptin/order_speed_request.dart @@ -362,74 +362,111 @@ class OrderSpeedRequest extends StatelessWidget { ); Get.back(); - print( - 'Arguments passed to PassengerLocationMapPage:'); - print('Passenger Location: ${myList[0]}'); - print('Passenger Destination: ${myList[1]}'); - print('Duration: ${myList[4]}'); - print('Total Cost: ${myList[26]}'); - print('Distance: ${myList[5]}'); - print('Name: ${myList[8]}'); - print('Phone: ${myList[10]}'); - print('Email: ${myList[28]}'); - print('Wallet Checked: ${myList[13]}'); - print('Token Passenger: ${myList[9]}'); - print('Direction: ${myList[29]}'); - print('Duration To Passenger: ${myList[15]}'); - print('Ride ID: ${myList[16]}'); - print('Passenger ID: ${myList[7]}'); - print('Driver ID: ${myList[18]}'); - print('Duration Of Ride Value: ${myList[19]}'); - print('Payment Amount: ${myList[2]}'); - print( - 'Payment Method: ${myList[13] == 'true' ? 'visa' : 'cash'}'); - print('Is Have Steps: ${myList[20]}'); - print('Step 0: ${myList[21]}'); - print('Step 1: ${myList[22]}'); - print('Step 2: ${myList[23]}'); - print('Step 3: ${myList[24]}'); - print('Step 4: ${myList[25]}'); - print('Passenger Wallet Burc: ${myList[26]}'); - print('Time Of Order: ${myList[30]}'); - print('Total Passenger: ${myList[2]}'); - print('Car Type: ${myList[31]}'); - print('Kazan: ${myList[32]}'); - - Get.to(() => DriverSpeedLocationMapPage(), - arguments: { - 'passengerLocation': myList[0].toString(), - 'passengerDestination': myList[1].toString(), - 'Duration': myList[4].toString(), - 'totalCost': myList[26].toString(), - 'Distance': myList[5].toString(), - 'name': myList[8].toString(), - 'phone': myList[10].toString(), - 'email': myList[28].toString(), - 'WalletChecked': myList[13].toString(), - 'tokenPassenger': myList[9].toString(), - 'direction': - 'https://www.google.com/maps/dir/${myList[0]}/${myList[1]}/', - 'DurationToPassenger': myList[15].toString(), - 'rideId': myList[16].toString(), - 'passengerId': myList[7].toString(), - 'driverId': myList[18].toString(), - 'durationOfRideValue': myList[19].toString(), - 'paymentAmount': myList[2].toString(), - 'paymentMethod': myList[13].toString() == 'true' - ? 'visa' - : 'cash', - 'isHaveSteps': myList[20].toString(), - 'step0': myList[21].toString(), - 'step1': myList[22].toString(), - 'step2': myList[23].toString(), - 'step3': myList[24].toString(), - 'step4': myList[25].toString(), - 'passengerWalletBurc': myList[26].toString(), - 'timeOfOrder': DateTime.now().toString(), - 'totalPassenger': myList[2].toString(), - 'carType': myList[31].toString(), - 'kazan': myList[32].toString(), - }); + // print( + // 'Arguments passed to PassengerLocationMapPage:'); + // print('Passenger Location: ${myList[0]}'); + // print('Passenger Destination: ${myList[1]}'); + // print('Duration: ${myList[4]}'); + // print('Total Cost: ${myList[26]}'); + // print('Distance: ${myList[5]}'); + // print('Name: ${myList[8]}'); + // print('Phone: ${myList[10]}'); + // print('Email: ${myList[28]}'); + // print('Wallet Checked: ${myList[13]}'); + // print('Token Passenger: ${myList[9]}'); + // print('Direction: ${myList[29]}'); + // print('Duration To Passenger: ${myList[15]}'); + // print('Ride ID: ${myList[16]}'); + // print('Passenger ID: ${myList[7]}'); + // print('Driver ID: ${myList[18]}'); + // print('Duration Of Ride Value: ${myList[19]}'); + // print('Payment Amount: ${myList[2]}'); + // print( + // 'Payment Method: ${myList[13] == 'true' ? 'visa' : 'cash'}'); + // print('Is Have Steps: ${myList[20]}'); + // print('Step 0: ${myList[21]}'); + // print('Step 1: ${myList[22]}'); + // print('Step 2: ${myList[23]}'); + // print('Step 3: ${myList[24]}'); + // print('Step 4: ${myList[25]}'); + // print('Passenger Wallet Burc: ${myList[26]}'); + // print('Time Of Order: ${myList[30]}'); + // print('Total Passenger: ${myList[2]}'); + // print('Car Type: ${myList[31]}'); + // print('Kazan: ${myList[32]}'); + box.write(BoxName.rideArguments, { + 'passengerLocation': myList[0].toString(), + 'passengerDestination': myList[1].toString(), + 'Duration': myList[4].toString(), + 'totalCost': myList[26].toString(), + 'Distance': myList[5].toString(), + 'name': myList[8].toString(), + 'phone': myList[10].toString(), + 'email': myList[28].toString(), + 'WalletChecked': myList[13].toString(), + 'tokenPassenger': myList[9].toString(), + 'direction': + 'https://www.google.com/maps/dir/${myList[0]}/${myList[1]}/', + 'DurationToPassenger': myList[15].toString(), + 'rideId': myList[16].toString(), + 'passengerId': myList[7].toString(), + 'driverId': myList[18].toString(), + 'durationOfRideValue': myList[19].toString(), + 'paymentAmount': myList[2].toString(), + 'paymentMethod': myList[13].toString() == 'true' + ? 'visa' + : 'cash', + 'isHaveSteps': myList[20].toString(), + 'step0': myList[21].toString(), + 'step1': myList[22].toString(), + 'step2': myList[23].toString(), + 'step3': myList[24].toString(), + 'step4': myList[25].toString(), + 'passengerWalletBurc': myList[26].toString(), + 'timeOfOrder': DateTime.now().toString(), + 'totalPassenger': myList[2].toString(), + 'carType': myList[31].toString(), + 'kazan': myList[32].toString(), + 'startNameLocation': myList[29].toString(), + 'endNameLocation': myList[30].toString(), + }); + Get.to(() => PassengerLocationMapPage(), + arguments: box.read(BoxName.rideArguments) + // { + // 'passengerLocation': myList[0].toString(), + // 'passengerDestination': myList[1].toString(), + // 'Duration': myList[4].toString(), + // 'totalCost': myList[26].toString(), + // 'Distance': myList[5].toString(), + // 'name': myList[8].toString(), + // 'phone': myList[10].toString(), + // 'email': myList[28].toString(), + // 'WalletChecked': myList[13].toString(), + // 'tokenPassenger': myList[9].toString(), + // 'direction': + // 'https://www.google.com/maps/dir/${myList[0]}/${myList[1]}/', + // 'DurationToPassenger': myList[15].toString(), + // 'rideId': myList[16].toString(), + // 'passengerId': myList[7].toString(), + // 'driverId': myList[18].toString(), + // 'durationOfRideValue': myList[19].toString(), + // 'paymentAmount': myList[2].toString(), + // 'paymentMethod': myList[13].toString() == 'true' + // ? 'visa' + // : 'cash', + // 'isHaveSteps': myList[20].toString(), + // 'step0': myList[21].toString(), + // 'step1': myList[22].toString(), + // 'step2': myList[23].toString(), + // 'step3': myList[24].toString(), + // 'step4': myList[25].toString(), + // 'passengerWalletBurc': myList[26].toString(), + // 'timeOfOrder': DateTime.now().toString(), + // 'totalPassenger': myList[2].toString(), + // 'carType': myList[31].toString(), + // 'kazan': myList[32].toString(), + // } + ); } // }); // Get.back();