3/31/1
This commit is contained in:
@@ -55,8 +55,8 @@ android {
|
||||
// For more information, see: https://docs.flutter.dev/deployment/android#reviewing-the-gradle-build-configuration.
|
||||
minSdkVersion 26
|
||||
targetSdkVersion flutter.targetSdkVersion
|
||||
versionCode 20
|
||||
versionName '1.4.4'
|
||||
versionCode 21
|
||||
versionName '1.4.5'
|
||||
// manifestPlaceholders = [mapsApiKey: 'android/app/src/main/AndroidManifest.xml']
|
||||
}
|
||||
|
||||
|
||||
@@ -63,8 +63,12 @@ class LocationController extends GetxController {
|
||||
'latitude': myLocation.latitude.toString(),
|
||||
'longitude': myLocation.longitude.toString(),
|
||||
'heading': heading.toString(),
|
||||
'speed': speed.toString(),
|
||||
'distance': totalDistance == 0 ? '0' : totalDistance.toString(),
|
||||
'speed': (speed * 3.6).toStringAsFixed(1),
|
||||
'distance': totalDistance == 0
|
||||
? '0'
|
||||
: totalDistance < 1
|
||||
? totalDistance.toStringAsFixed(3)
|
||||
: totalDistance.toStringAsFixed(1),
|
||||
'status': box.read(BoxName.statusDriverLocation).toString()
|
||||
});
|
||||
if (Get.find<HomeCaptainController>().rideId == '0') {
|
||||
|
||||
@@ -25,6 +25,11 @@ class HomeCaptainController extends GetxController {
|
||||
Timer? activeTimer;
|
||||
Map data = {};
|
||||
bool isLoading = true;
|
||||
late double kazan;
|
||||
double latePrice = 0;
|
||||
double heavyPrice = 0;
|
||||
double comfortPrice = 0, speedPrice = 0, deliveryPrice = 0, freePrice = 0;
|
||||
double naturePrice = 0;
|
||||
bool isCallOn = false;
|
||||
String totalMoneyToday = '0';
|
||||
String rating = '0';
|
||||
@@ -203,6 +208,7 @@ class HomeCaptainController extends GetxController {
|
||||
onButtonSelected();
|
||||
await getPaymentToday();
|
||||
await getDriverRate();
|
||||
getKazanPercent();
|
||||
getCountRideToday();
|
||||
getAllPayment();
|
||||
startPeriodicExecution();
|
||||
@@ -232,6 +238,22 @@ class HomeCaptainController extends GetxController {
|
||||
update();
|
||||
}
|
||||
|
||||
getKazanPercent() async {
|
||||
var res = await CRUD().get(link: AppLink.getKazanPercent);
|
||||
if (res != 'failure') {
|
||||
kazan = double.parse(jsonDecode(res)['message'][0]['kazan']);
|
||||
naturePrice = double.parse(jsonDecode(res)['message'][0]['naturePrice']);
|
||||
heavyPrice = double.parse(jsonDecode(res)['message'][0]['heavyPrice']);
|
||||
latePrice = double.parse(jsonDecode(res)['message'][0]['latePrice']);
|
||||
comfortPrice =
|
||||
double.parse(jsonDecode(res)['message'][0]['comfortPrice']);
|
||||
speedPrice = double.parse(jsonDecode(res)['message'][0]['speedPrice']);
|
||||
deliveryPrice =
|
||||
double.parse(jsonDecode(res)['message'][0]['deliveryPrice']);
|
||||
freePrice = double.parse(jsonDecode(res)['message'][0]['freePrice']);
|
||||
}
|
||||
}
|
||||
|
||||
getCountRideToday() async {
|
||||
var res = await CRUD().get(
|
||||
link: AppLink.getCountRide,
|
||||
|
||||
@@ -3,6 +3,7 @@ import 'dart:convert';
|
||||
import 'dart:math' as math;
|
||||
import 'dart:math' show cos;
|
||||
import 'package:SEFER/constant/table_names.dart';
|
||||
import 'package:SEFER/controller/home/captin/home_captain_controller.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:geolocator/geolocator.dart';
|
||||
import 'package:get/get.dart';
|
||||
@@ -501,7 +502,7 @@ update ui for totla results
|
||||
isRideStarted = false;
|
||||
isPriceWindow = false;
|
||||
if (cartype == 'Comfort') {
|
||||
totalCost = (price * rideTimerFromBegin).toString();
|
||||
totalCost = price.toStringAsFixed(2);
|
||||
}
|
||||
box.write(BoxName.statusDriverLocation, 'off');
|
||||
// changeRideToBeginToPassenger();
|
||||
@@ -599,10 +600,24 @@ update ui for totla results
|
||||
await Future.delayed(const Duration(seconds: 1));
|
||||
recentDistanceToDash = Get.find<LocationController>().totalDistance;
|
||||
rideTimerFromBegin = i;
|
||||
price = rideTimerFromBegin ~/ 60 +
|
||||
(recentDistanceToDash * 4); //todo from kazan
|
||||
price = (price * .10) + price;
|
||||
speed = Get.find<LocationController>().speed;
|
||||
price = cartype == 'Comfort'
|
||||
? (i ~/ 60) +
|
||||
(recentDistanceToDash *
|
||||
Get.find<HomeCaptainController>().comfortPrice)
|
||||
: cartype == 'Speed'
|
||||
? (i ~/ 60) +
|
||||
(recentDistanceToDash *
|
||||
Get.find<HomeCaptainController>().speedPrice)
|
||||
: cartype == 'Delivery'
|
||||
? (i ~/ 60) +
|
||||
(recentDistanceToDash *
|
||||
Get.find<HomeCaptainController>().deliveryPrice)
|
||||
: (i ~/ 60) +
|
||||
(recentDistanceToDash *
|
||||
Get.find<HomeCaptainController>()
|
||||
.freePrice); // $1 for each minute + $4 for each km
|
||||
price = (price * .10) + price; // Add 10% tax
|
||||
speed = Get.find<LocationController>().speed * 3.6;
|
||||
progressTimerRideBegin = i / durationOfRide;
|
||||
remainingTimeTimerRideBegin = durationOfRide - i;
|
||||
remainingTimeTimerRideBegin < 60 ? driverEndPage = 160 : 100;
|
||||
@@ -619,41 +634,6 @@ update ui for totla results
|
||||
}
|
||||
}
|
||||
|
||||
double calculateDistanceBetweenLocations(LatLng start, LatLng end) {
|
||||
double startLat = start.latitude * math.pi / 180;
|
||||
double startLon = start.longitude * math.pi / 180;
|
||||
double endLat = end.latitude * math.pi / 180;
|
||||
double endLon = end.longitude * math.pi / 180;
|
||||
|
||||
double dLat = endLat - startLat;
|
||||
double dLon = endLon - startLon;
|
||||
|
||||
double a = math.pow(math.sin(dLat / 2), 2) +
|
||||
math.cos(startLat) * math.cos(endLat) * math.pow(math.sin(dLon / 2), 2);
|
||||
double c = 2 * math.atan2(math.sqrt(a), math.sqrt(1 - a));
|
||||
double distance = 6371000 * c; // Distance in meters
|
||||
|
||||
return distance;
|
||||
}
|
||||
|
||||
double calculateAngleBetweenLocations(LatLng start, LatLng end) {
|
||||
double startLat = start.latitude * math.pi / 180;
|
||||
double startLon = start.longitude * math.pi / 180;
|
||||
double endLat = end.latitude * math.pi / 180;
|
||||
double endLon = end.longitude * math.pi / 180;
|
||||
|
||||
double dLon = endLon - startLon;
|
||||
|
||||
double y = math.sin(dLon) * cos(endLat);
|
||||
double x = cos(startLat) * math.sin(endLat) -
|
||||
math.sin(startLat) * cos(endLat) * cos(dLon);
|
||||
|
||||
double angle = math.atan2(y, x);
|
||||
double angleDegrees = angle * 180 / math.pi;
|
||||
|
||||
return angleDegrees;
|
||||
}
|
||||
|
||||
double recentDistanceToDash = 0;
|
||||
double recentAngelToMarker = 0;
|
||||
double speed = 0;
|
||||
@@ -681,8 +661,8 @@ LIMIT
|
||||
var lng = double.parse(previousLocationOfDrivers[0]['lng']);
|
||||
LatLng prev = LatLng(lat, lng);
|
||||
|
||||
recentDistanceToDash =
|
||||
calculateDistanceBetweenLocations(prev, myLocation);
|
||||
// recentDistanceToDash =
|
||||
// calculateDistanceBetweenLocations(prev, myLocation);
|
||||
print('recentAngelToMarker $recentAngelToMarker');
|
||||
print('recentDistanceToDash $recentDistanceToDash');
|
||||
}
|
||||
|
||||
@@ -72,14 +72,23 @@ class CaptainProfileController extends GetxController {
|
||||
print(d['message']);
|
||||
box.write(BoxName.sexDriver, d['message']['gender']);
|
||||
box.write(BoxName.dobDriver, d['message']['birthdate']);
|
||||
box.write(BoxName.vin, d['message']['vin']);
|
||||
box.write(BoxName.color, d['message']['color']);
|
||||
box.write(BoxName.model, d['message']['model']);
|
||||
box.write(BoxName.make, d['message']['make']);
|
||||
box.write(BoxName.year, d['message']['year']);
|
||||
box.write(BoxName.expirationDate, d['message']['expiration_date']);
|
||||
// box.write(BoxName.acc, d['message']['accountBank']);
|
||||
|
||||
update();
|
||||
}
|
||||
}
|
||||
|
||||
@override
|
||||
void onInit() {
|
||||
if (box.read(BoxName.dobDriver) == null) {
|
||||
// if (box.read(BoxName.dobDriver) == null) {
|
||||
getProfileData();
|
||||
}
|
||||
// }
|
||||
|
||||
super.onInit();
|
||||
}
|
||||
|
||||
@@ -48,8 +48,12 @@ class RatePassenger extends StatelessWidget {
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.all(4),
|
||||
child: Text(
|
||||
Get.find<MapDriverController>()
|
||||
.totalPassenger,
|
||||
Get.find<MapDriverController>().cartype ==
|
||||
'Comfort'
|
||||
? Get.find<MapDriverController>()
|
||||
.totalCost
|
||||
: Get.find<MapDriverController>()
|
||||
.totalPassenger,
|
||||
style: AppStyle.number,
|
||||
),
|
||||
),
|
||||
|
||||
@@ -117,8 +117,8 @@ GetBuilder<MapDriverController> speedCircle() {
|
||||
child: Container(
|
||||
decoration: BoxDecoration(
|
||||
shape: BoxShape.circle,
|
||||
color: AppColor.redColor,
|
||||
border: Border.all(width: 2,color: AppColor.secondaryColor)),
|
||||
color: AppColor.secondaryColor,
|
||||
border: Border.all(width: 3, color: AppColor.redColor)),
|
||||
height: 60,
|
||||
width: 60,
|
||||
child: Center(
|
||||
|
||||
@@ -4,7 +4,6 @@ import 'package:get/get.dart';
|
||||
import 'package:SEFER/constant/box_name.dart';
|
||||
import 'package:SEFER/constant/style.dart';
|
||||
import 'package:SEFER/controller/profile/captain_profile_controller.dart';
|
||||
import 'package:SEFER/env/env.dart';
|
||||
import 'package:SEFER/main.dart';
|
||||
import 'package:SEFER/views/widgets/elevated_btn.dart';
|
||||
import 'package:SEFER/views/widgets/my_scafold.dart';
|
||||
|
||||
Reference in New Issue
Block a user