10/19/1
This commit is contained in:
@@ -67,6 +67,10 @@ class AppLink {
|
|||||||
static const String addCarsLocationByPassenger = "$location/add.php";
|
static const String addCarsLocationByPassenger = "$location/add.php";
|
||||||
static const String deleteCarsLocationByPassenger = "$location/delete.php";
|
static const String deleteCarsLocationByPassenger = "$location/delete.php";
|
||||||
static const String updateCarsLocationByPassenger = "$location/update.php";
|
static const String updateCarsLocationByPassenger = "$location/update.php";
|
||||||
|
static const String getTotalDriverDuration =
|
||||||
|
"$location/getTotalDriverDuration.php";
|
||||||
|
static const String getTotalDriverDurationToday =
|
||||||
|
"$location/getTotalDriverDurationToday.php";
|
||||||
|
|
||||||
//==================Blog=============
|
//==================Blog=============
|
||||||
static const String profile = 'https://ride.mobile-app.store/ride/profile';
|
static const String profile = 'https://ride.mobile-app.store/ride/profile';
|
||||||
|
|||||||
@@ -36,14 +36,14 @@ class AppStyle {
|
|||||||
BoxShadow(
|
BoxShadow(
|
||||||
color: AppColor.accentColor,
|
color: AppColor.accentColor,
|
||||||
offset: Offset(-3, -3),
|
offset: Offset(-3, -3),
|
||||||
blurRadius: 1,
|
blurRadius: 0,
|
||||||
spreadRadius: 1,
|
spreadRadius: 0,
|
||||||
blurStyle: BlurStyle.outer),
|
blurStyle: BlurStyle.outer),
|
||||||
BoxShadow(
|
BoxShadow(
|
||||||
color: AppColor.accentColor,
|
color: AppColor.accentColor,
|
||||||
offset: Offset(3, 3),
|
offset: Offset(3, 3),
|
||||||
blurRadius: 1,
|
blurRadius: 0,
|
||||||
spreadRadius: 1,
|
spreadRadius: 0,
|
||||||
blurStyle: BlurStyle.outer)
|
blurStyle: BlurStyle.outer)
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|||||||
26
lib/controller/functions/custom_pant.dart
Normal file
26
lib/controller/functions/custom_pant.dart
Normal file
@@ -0,0 +1,26 @@
|
|||||||
|
import 'package:flutter/material.dart';
|
||||||
|
|
||||||
|
class LineChartPainter extends CustomPainter {
|
||||||
|
final List<double> data;
|
||||||
|
|
||||||
|
LineChartPainter(this.data);
|
||||||
|
|
||||||
|
@override
|
||||||
|
void paint(Canvas canvas, Size size) {
|
||||||
|
// Calculate the scale factor.
|
||||||
|
final scaleFactor = size.height / 240;
|
||||||
|
|
||||||
|
// Draw the line chart.
|
||||||
|
for (var i = 0; i < data.length - 1; i++) {
|
||||||
|
final x1 = i * size.width / data.length;
|
||||||
|
final y1 = data[i] * scaleFactor;
|
||||||
|
final x2 = (i + 1) * size.width / data.length;
|
||||||
|
final y2 = data[i + 1] * scaleFactor;
|
||||||
|
|
||||||
|
canvas.drawLine(Offset(x1, y1), Offset(x2, y2), Paint());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
bool shouldRepaint(LineChartPainter oldDelegate) => false;
|
||||||
|
}
|
||||||
@@ -1 +0,0 @@
|
|||||||
|
|
||||||
77
lib/controller/home/captin/duration_controller .dart
Normal file
77
lib/controller/home/captin/duration_controller .dart
Normal file
@@ -0,0 +1,77 @@
|
|||||||
|
import 'dart:convert';
|
||||||
|
|
||||||
|
import 'package:flutter/animation.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/main.dart';
|
||||||
|
|
||||||
|
class DurationController extends GetxController
|
||||||
|
with GetSingleTickerProviderStateMixin {
|
||||||
|
final data = <DurationData>[].obs;
|
||||||
|
late AnimationController animationController;
|
||||||
|
|
||||||
|
@override
|
||||||
|
void onInit() {
|
||||||
|
super.onInit();
|
||||||
|
fetchData();
|
||||||
|
animationController = AnimationController(
|
||||||
|
vsync: this,
|
||||||
|
duration: const Duration(
|
||||||
|
milliseconds: 500), // Adjust the animation duration as needed
|
||||||
|
);
|
||||||
|
animationController.forward(); // Start the animation
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
void onClose() {
|
||||||
|
animationController.dispose();
|
||||||
|
super.onClose();
|
||||||
|
}
|
||||||
|
|
||||||
|
Map<String, dynamic> jsonData = {};
|
||||||
|
bool isLoading = false;
|
||||||
|
String totalDurationToday = '';
|
||||||
|
Future<void> fetchData() async {
|
||||||
|
isLoading = true;
|
||||||
|
update(); // Notify the observers about the loading state change
|
||||||
|
|
||||||
|
var res = await CRUD().get(
|
||||||
|
link: AppLink.getTotalDriverDuration,
|
||||||
|
payload: {'driver_id': box.read(BoxName.driverID)},
|
||||||
|
);
|
||||||
|
|
||||||
|
jsonData = jsonDecode(res);
|
||||||
|
|
||||||
|
final parsedData = parseData(jsonData['message']);
|
||||||
|
data.value = parsedData;
|
||||||
|
|
||||||
|
isLoading = false;
|
||||||
|
update(); // Notify the observers about the data and loading state change
|
||||||
|
}
|
||||||
|
|
||||||
|
List<DurationData> parseData(List<dynamic> json) {
|
||||||
|
return json.map((entry) {
|
||||||
|
final Map<String, dynamic> entryMap = entry;
|
||||||
|
final day = DateTime.parse(entryMap['day']);
|
||||||
|
final totalDuration = _parseDuration(entryMap['total_duration']);
|
||||||
|
return DurationData(day, totalDuration);
|
||||||
|
}).toList();
|
||||||
|
}
|
||||||
|
|
||||||
|
Duration _parseDuration(String durationString) {
|
||||||
|
final parts = durationString.split(':');
|
||||||
|
final hours = int.parse(parts[0]);
|
||||||
|
final minutes = int.parse(parts[1]);
|
||||||
|
final seconds = int.parse(parts[2]);
|
||||||
|
return Duration(hours: hours, minutes: minutes, seconds: seconds);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
class DurationData {
|
||||||
|
final DateTime day;
|
||||||
|
final Duration totalDuration;
|
||||||
|
|
||||||
|
DurationData(this.day, this.totalDuration);
|
||||||
|
}
|
||||||
@@ -15,7 +15,9 @@ class HomeCaptainController extends GetxController {
|
|||||||
Duration activeDuration = Duration.zero;
|
Duration activeDuration = Duration.zero;
|
||||||
Timer? activeTimer;
|
Timer? activeTimer;
|
||||||
Map data = {};
|
Map data = {};
|
||||||
String totalToday = '0';
|
String totalMoneyToday = '0';
|
||||||
|
String totalDurationToday = '0';
|
||||||
|
Timer? timer;
|
||||||
// Inject the LocationController class
|
// Inject the LocationController class
|
||||||
final locationController = Get.find<LocationController>();
|
final locationController = Get.find<LocationController>();
|
||||||
|
|
||||||
@@ -55,10 +57,22 @@ class HomeCaptainController extends GetxController {
|
|||||||
return totalDuration;
|
return totalDuration;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void startPeriodicExecution() {
|
||||||
|
Timer.periodic(const Duration(seconds: 30), (timer) async {
|
||||||
|
await getCaptainDurationOnToday();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
void stopTimer() {
|
||||||
|
print('Stopping timer');
|
||||||
|
timer?.cancel();
|
||||||
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void onInit() async {
|
void onInit() async {
|
||||||
addToken();
|
addToken();
|
||||||
getPaymentToday();
|
getPaymentToday();
|
||||||
|
startPeriodicExecution();
|
||||||
super.onInit();
|
super.onInit();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -75,13 +89,24 @@ class HomeCaptainController extends GetxController {
|
|||||||
link: AppLink.getDriverpaymentToday,
|
link: AppLink.getDriverpaymentToday,
|
||||||
payload: {'driverID': box.read(BoxName.driverID).toString()});
|
payload: {'driverID': box.read(BoxName.driverID).toString()});
|
||||||
data = jsonDecode(res);
|
data = jsonDecode(res);
|
||||||
totalToday = data['message'][0]['total_amount'];
|
totalMoneyToday = data['message'][0]['total_amount'];
|
||||||
|
update();
|
||||||
|
}
|
||||||
|
|
||||||
|
Future<void> getCaptainDurationOnToday() async {
|
||||||
|
var res = await CRUD().get(
|
||||||
|
link: AppLink.getTotalDriverDurationToday,
|
||||||
|
payload: {'driver_id': box.read(BoxName.driverID).toString()});
|
||||||
|
|
||||||
|
data = jsonDecode(res);
|
||||||
|
totalDurationToday = data['message'][0]['total_duration'];
|
||||||
update();
|
update();
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void dispose() {
|
void dispose() {
|
||||||
activeTimer?.cancel();
|
activeTimer?.cancel();
|
||||||
|
stopTimer();
|
||||||
super.dispose();
|
super.dispose();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -393,51 +393,47 @@ class MapPassengerController extends GetxController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Future getCarsLocationByPassenger() async {
|
Future getCarsLocationByPassenger() async {
|
||||||
if (rideConfirm == false) {
|
// if (rideConfirm == false) {
|
||||||
carsLocationByPassenger = [];
|
carsLocationByPassenger = [];
|
||||||
LatLngBounds bounds =
|
LatLngBounds bounds =
|
||||||
calculateBounds(myLocation.latitude, myLocation.longitude, 8000);
|
calculateBounds(myLocation.latitude, myLocation.longitude, 8000);
|
||||||
print(
|
print(
|
||||||
'Southwest: ${bounds.southwest.latitude}, ${bounds.southwest.longitude}');
|
'Southwest: ${bounds.southwest.latitude}, ${bounds.southwest.longitude}');
|
||||||
print(
|
print(
|
||||||
'Northeast: ${bounds.northeast.latitude}, ${bounds.northeast.longitude}');
|
'Northeast: ${bounds.northeast.latitude}, ${bounds.northeast.longitude}');
|
||||||
|
|
||||||
var res =
|
var res =
|
||||||
await CRUD().get(link: AppLink.getCarsLocationByPassenger, payload: {
|
await CRUD().get(link: AppLink.getCarsLocationByPassenger, payload: {
|
||||||
'southwestLat': southwest.latitude.toString(),
|
'southwestLat': southwest.latitude.toString(),
|
||||||
'southwestLon': southwest.longitude.toString(),
|
'southwestLon': southwest.longitude.toString(),
|
||||||
'northeastLat': northeast.latitude.toString(),
|
'northeastLat': northeast.latitude.toString(),
|
||||||
'northeastLon': northeast.longitude.toString(),
|
'northeastLon': northeast.longitude.toString(),
|
||||||
});
|
});
|
||||||
if (res == 'failure') {
|
if (res == 'failure') {
|
||||||
Get.defaultDialog(
|
Get.defaultDialog(
|
||||||
title: 'No Car in your site.Sorry!',
|
title: 'No Car in your site.Sorry!',
|
||||||
middleText: '',
|
middleText: '',
|
||||||
confirm: MyElevatedButton(
|
confirm: MyElevatedButton(
|
||||||
title: 'Back',
|
title: 'Back',
|
||||||
onPressed: () {
|
onPressed: () {
|
||||||
Get.back();
|
Get.back();
|
||||||
markerReloadingTimer.cancel();
|
markerReloadingTimer.cancel();
|
||||||
}));
|
}));
|
||||||
} else {
|
} else {
|
||||||
dataCarsLocationByPassenger = jsonDecode(res);
|
dataCarsLocationByPassenger = jsonDecode(res);
|
||||||
// print(dataCarsLocationByPassenger);
|
// print(dataCarsLocationByPassenger);
|
||||||
driverId = dataCarsLocationByPassenger['message'][carsOrder]
|
driverId = dataCarsLocationByPassenger['message'][carsOrder]['driver_id']
|
||||||
['driver_id']
|
.toString();
|
||||||
.toString();
|
// print('driverId==============$driverId');
|
||||||
// print('driverId==============$driverId');
|
for (var i = 0; i < dataCarsLocationByPassenger['message'].length; i++) {
|
||||||
for (var i = 0;
|
carsLocationByPassenger.add(LatLng(
|
||||||
i < dataCarsLocationByPassenger['message'].length;
|
double.parse(dataCarsLocationByPassenger['message'][i]['latitude']),
|
||||||
i++) {
|
double.parse(
|
||||||
carsLocationByPassenger.add(LatLng(
|
dataCarsLocationByPassenger['message'][i]['longitude'])));
|
||||||
double.parse(
|
|
||||||
dataCarsLocationByPassenger['message'][i]['latitude']),
|
|
||||||
double.parse(
|
|
||||||
dataCarsLocationByPassenger['message'][i]['longitude'])));
|
|
||||||
}
|
|
||||||
|
|
||||||
update();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
update();
|
||||||
|
// }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -771,67 +767,72 @@ class MapPassengerController extends GetxController {
|
|||||||
|
|
||||||
void getNearestDriverByPassengerLocation() async {
|
void getNearestDriverByPassengerLocation() async {
|
||||||
if (polyLines.isEmpty || data.isEmpty) {
|
if (polyLines.isEmpty || data.isEmpty) {
|
||||||
double nearestDistance = double.infinity;
|
if (rideConfirm == false) {
|
||||||
for (var i = 0; i < dataCarsLocationByPassenger['message'].length; i++) {
|
double nearestDistance = double.infinity;
|
||||||
var carLocation = dataCarsLocationByPassenger['message'][i];
|
for (var i = 0;
|
||||||
|
i < dataCarsLocationByPassenger['message'].length;
|
||||||
|
i++) {
|
||||||
|
var carLocation = dataCarsLocationByPassenger['message'][i];
|
||||||
|
|
||||||
// double distance1 = Geolocator.distanceBetween(
|
// double distance1 = Geolocator.distanceBetween(
|
||||||
// mylocation.latitude,
|
// mylocation.latitude,
|
||||||
// mylocation.longitude,
|
// mylocation.longitude,
|
||||||
// double.parse(carLocation['latitude']),
|
// double.parse(carLocation['latitude']),
|
||||||
// double.parse(carLocation['longitude']),
|
// double.parse(carLocation['longitude']),
|
||||||
// );
|
// );
|
||||||
// if (distance1 < nearestDistance) {
|
// if (distance1 < nearestDistance) {
|
||||||
// nearestDistance = distance1;
|
// nearestDistance = distance1;
|
||||||
// // nearestCarLocation = carLocation;
|
// // nearestCarLocation = carLocation;
|
||||||
// nearestCar = CarLocation(
|
// nearestCar = CarLocation(
|
||||||
// distance: distance1,
|
// distance: distance1,
|
||||||
// id: carLocation['driver_id'],
|
// id: carLocation['driver_id'],
|
||||||
// latitude: double.parse(carLocation['latitude']),
|
// latitude: double.parse(carLocation['latitude']),
|
||||||
// longitude: double.parse(carLocation['longitude']),
|
// longitude: double.parse(carLocation['longitude']),
|
||||||
// );
|
// );
|
||||||
// }
|
// }
|
||||||
// isloading = true;
|
// isloading = true;
|
||||||
update();
|
|
||||||
// Make API request to get exact distance and duration
|
|
||||||
String apiUrl =
|
|
||||||
'${AppLink.googleMapsLink}distancematrix/json?destinations=${carLocation['latitude']},${carLocation['longitude']}&origins=${myLocation.latitude},${myLocation.longitude}&units=metric&key=${AppCredintials.mapAPIKEY}';
|
|
||||||
var response = await CRUD().getGoogleApi(link: apiUrl, payload: {});
|
|
||||||
if (response['status'] == "OK") {
|
|
||||||
var data = response;
|
|
||||||
// Extract distance and duration from the response and handle accordingly
|
|
||||||
int distance1 = data['rows'][0]['elements'][0]['distance']['value'];
|
|
||||||
distanceByPassenger =
|
|
||||||
data['rows'][0]['elements'][0]['distance']['text'];
|
|
||||||
duration1 = data['rows'][0]['elements'][0]['duration']['value'];
|
|
||||||
|
|
||||||
durationFromDriverToPassenger = Duration(seconds: duration1.toInt());
|
|
||||||
newTime1 = currentTime.add(durationFromDriverToPassenger);
|
|
||||||
timeFromDriverToPassenger =
|
|
||||||
newTime1.add(Duration(minutes: 2.toInt()));
|
|
||||||
durationByPassenger =
|
|
||||||
data['rows'][0]['elements'][0]['duration']['text'];
|
|
||||||
update();
|
update();
|
||||||
if (distance1 < nearestDistance) {
|
// Make API request to get exact distance and duration
|
||||||
nearestDistance = distance1.toDouble();
|
String apiUrl =
|
||||||
|
'${AppLink.googleMapsLink}distancematrix/json?destinations=${carLocation['latitude']},${carLocation['longitude']}&origins=${myLocation.latitude},${myLocation.longitude}&units=metric&key=${AppCredintials.mapAPIKEY}';
|
||||||
|
var response = await CRUD().getGoogleApi(link: apiUrl, payload: {});
|
||||||
|
if (response['status'] == "OK") {
|
||||||
|
var data = response;
|
||||||
|
// Extract distance and duration from the response and handle accordingly
|
||||||
|
int distance1 = data['rows'][0]['elements'][0]['distance']['value'];
|
||||||
|
distanceByPassenger =
|
||||||
|
data['rows'][0]['elements'][0]['distance']['text'];
|
||||||
|
duration1 = data['rows'][0]['elements'][0]['duration']['value'];
|
||||||
|
|
||||||
nearestCar = CarLocation(
|
durationFromDriverToPassenger =
|
||||||
distance: distance1.toDouble(),
|
Duration(seconds: duration1.toInt());
|
||||||
duration: duration1.toDouble(),
|
newTime1 = currentTime.add(durationFromDriverToPassenger);
|
||||||
id: carLocation['driver_id'],
|
timeFromDriverToPassenger =
|
||||||
latitude: double.parse(carLocation['latitude']),
|
newTime1.add(Duration(minutes: 2.toInt()));
|
||||||
longitude: double.parse(carLocation['longitude']),
|
durationByPassenger =
|
||||||
);
|
data['rows'][0]['elements'][0]['duration']['text'];
|
||||||
// isloading = false;
|
|
||||||
update();
|
update();
|
||||||
}
|
if (distance1 < nearestDistance) {
|
||||||
}
|
nearestDistance = distance1.toDouble();
|
||||||
|
|
||||||
// Handle the distance and duration as needed
|
nearestCar = CarLocation(
|
||||||
else {
|
distance: distance1.toDouble(),
|
||||||
print(
|
duration: duration1.toDouble(),
|
||||||
'Failed to retrieve distance and duration: ${response['status']}');
|
id: carLocation['driver_id'],
|
||||||
// Handle the failure case
|
latitude: double.parse(carLocation['latitude']),
|
||||||
|
longitude: double.parse(carLocation['longitude']),
|
||||||
|
);
|
||||||
|
// isloading = false;
|
||||||
|
update();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Handle the distance and duration as needed
|
||||||
|
else {
|
||||||
|
print(
|
||||||
|
'Failed to retrieve distance and duration: ${response['status']}');
|
||||||
|
// Handle the failure case
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,12 +1,126 @@
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:get/get.dart';
|
import 'package:get/get.dart';
|
||||||
|
import 'package:ride/constant/colors.dart';
|
||||||
|
import 'package:ride/constant/info.dart';
|
||||||
|
import 'package:ride/constant/style.dart';
|
||||||
import 'package:ride/views/widgets/my_scafold.dart';
|
import 'package:ride/views/widgets/my_scafold.dart';
|
||||||
|
import 'package:ride/views/widgets/mycircular.dart';
|
||||||
|
import 'package:flutter/animation.dart';
|
||||||
|
import '../../controller/home/captin/duration_controller .dart';
|
||||||
|
|
||||||
class RideCalculateDriver extends StatelessWidget {
|
class RideCalculateDriver extends StatelessWidget {
|
||||||
const RideCalculateDriver({super.key});
|
const RideCalculateDriver({super.key});
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return MyScafolld(title: 'Ride Summary'.tr, body: [], isleading: true);
|
return MyScafolld(
|
||||||
|
title: 'Ride Summary'.tr,
|
||||||
|
body: const [
|
||||||
|
Center(
|
||||||
|
child: BarChartWidget(),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
isleading: true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
class BarChartWidget extends StatelessWidget {
|
||||||
|
const BarChartWidget({super.key});
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
final durationController = Get.put(DurationController());
|
||||||
|
return Obx(() {
|
||||||
|
final data = durationController.data;
|
||||||
|
double maxDuration = 0;
|
||||||
|
|
||||||
|
// Find the maximum duration to determine the maximum height of the bars
|
||||||
|
for (final entry in data) {
|
||||||
|
final durationInHours = entry.totalDuration.inHours.toDouble();
|
||||||
|
if (durationInHours > maxDuration) {
|
||||||
|
maxDuration = durationInHours;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return durationController.isLoading
|
||||||
|
? const Center(
|
||||||
|
child: MyCircularProgressIndicator(),
|
||||||
|
)
|
||||||
|
: Column(
|
||||||
|
children: [
|
||||||
|
Text(
|
||||||
|
'Average of Hours of ${AppInfo.appName} is ON for this month'
|
||||||
|
.tr,
|
||||||
|
style: AppStyle.title,
|
||||||
|
),
|
||||||
|
Padding(
|
||||||
|
padding: const EdgeInsets.all(8.0),
|
||||||
|
child: Container(
|
||||||
|
height: Get.height * .7,
|
||||||
|
decoration: AppStyle.boxDecoration,
|
||||||
|
child: ListView.builder(
|
||||||
|
scrollDirection: Axis.horizontal,
|
||||||
|
itemCount: data.length,
|
||||||
|
itemBuilder: (context, index) {
|
||||||
|
final entry = data[index];
|
||||||
|
final durationInHours =
|
||||||
|
entry.totalDuration.inHours.toDouble();
|
||||||
|
final dayLabel = entry.day.day.toString();
|
||||||
|
|
||||||
|
return Padding(
|
||||||
|
padding: const EdgeInsets.symmetric(horizontal: 4),
|
||||||
|
child: AnimatedBuilder(
|
||||||
|
animation: durationController.animationController,
|
||||||
|
builder: (context, child) {
|
||||||
|
final animationValue =
|
||||||
|
durationController.animationController.value;
|
||||||
|
final animatedValue =
|
||||||
|
(durationInHours / maxDuration) *
|
||||||
|
animationValue;
|
||||||
|
|
||||||
|
return Column(
|
||||||
|
mainAxisAlignment: MainAxisAlignment.end,
|
||||||
|
children: [
|
||||||
|
Transform(
|
||||||
|
transform: Matrix4.identity()
|
||||||
|
..setEntry(3, 2,
|
||||||
|
0.001) // Apply perspective for a 3D effect
|
||||||
|
..rotateX(-0.5 *
|
||||||
|
animatedValue), // Rotate around X-axis
|
||||||
|
alignment: Alignment.bottomCenter,
|
||||||
|
child: Container(
|
||||||
|
width: 20,
|
||||||
|
height:
|
||||||
|
(durationInHours / maxDuration) * 400,
|
||||||
|
color: durationInHours > 8
|
||||||
|
? AppColor.greenColor
|
||||||
|
: AppColor.yellowColor,
|
||||||
|
child: Center(
|
||||||
|
child: Text(
|
||||||
|
durationInHours.toStringAsFixed(
|
||||||
|
0,
|
||||||
|
), // Display the duration value inside the bar
|
||||||
|
style: const TextStyle(
|
||||||
|
color: Colors.white,
|
||||||
|
fontWeight: FontWeight.bold,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
const SizedBox(height: 4),
|
||||||
|
Text(dayLabel),
|
||||||
|
],
|
||||||
|
);
|
||||||
|
},
|
||||||
|
),
|
||||||
|
);
|
||||||
|
},
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
);
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -8,6 +8,7 @@ import 'package:ride/constant/table_names.dart';
|
|||||||
import 'package:ride/controller/home/captin/home_captain_controller.dart';
|
import 'package:ride/controller/home/captin/home_captain_controller.dart';
|
||||||
import 'package:ride/controller/home/captin/order_request_controller.dart';
|
import 'package:ride/controller/home/captin/order_request_controller.dart';
|
||||||
import 'package:ride/main.dart';
|
import 'package:ride/main.dart';
|
||||||
|
import 'package:ride/views/Rate/ride_calculate_driver.dart';
|
||||||
import 'package:ride/views/widgets/circle_container.dart';
|
import 'package:ride/views/widgets/circle_container.dart';
|
||||||
import 'package:ride/views/widgets/elevated_btn.dart';
|
import 'package:ride/views/widgets/elevated_btn.dart';
|
||||||
import 'package:flutter_font_icons/flutter_font_icons.dart';
|
import 'package:flutter_font_icons/flutter_font_icons.dart';
|
||||||
@@ -115,7 +116,7 @@ class HomeCaptain extends StatelessWidget {
|
|||||||
Text(
|
Text(
|
||||||
' You Earn today is '.tr +
|
' You Earn today is '.tr +
|
||||||
homeCaptainController
|
homeCaptainController
|
||||||
.totalToday, //Todo add here number for income
|
.totalMoneyToday, //Todo add here number for income
|
||||||
style: AppStyle.title,
|
style: AppStyle.title,
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
@@ -131,15 +132,14 @@ class HomeCaptain extends StatelessWidget {
|
|||||||
),
|
),
|
||||||
Text(
|
Text(
|
||||||
'Total Duration:'.tr +
|
'Total Duration:'.tr +
|
||||||
' ${homeCaptainController.calculateTotalDuration()} seconds',
|
' ${homeCaptainController.totalDurationToday} ',
|
||||||
style: const TextStyle(fontSize: 20),
|
style: const TextStyle(fontSize: 20),
|
||||||
),
|
),
|
||||||
TextButton(
|
TextButton(
|
||||||
onPressed: () {
|
onPressed: () {
|
||||||
// homeCaptainController.sendSMSToRecipents(
|
Get.to(() => RideCalculateDriver());
|
||||||
// 'hi from Sefer', ['+962798583052']);
|
|
||||||
},
|
},
|
||||||
child: const Text('send msg')),
|
child: const Text('Chart')),
|
||||||
const Wrap(
|
const Wrap(
|
||||||
children: <Widget>[
|
children: <Widget>[
|
||||||
Icon(AntDesign.facebook_square),
|
Icon(AntDesign.facebook_square),
|
||||||
|
|||||||
@@ -176,7 +176,8 @@ class CreditCardWidget extends StatelessWidget {
|
|||||||
inputFormatters: [DigitObscuringFormatter()],
|
inputFormatters: [DigitObscuringFormatter()],
|
||||||
validator: (value) {
|
validator: (value) {
|
||||||
if (value!.isEmpty || value.length != 16) {
|
if (value!.isEmpty || value.length != 16) {
|
||||||
return 'Please enter a valid 16-digit card number';
|
return 'Please enter a valid 16-digit card number'
|
||||||
|
.tr;
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -232,11 +232,11 @@ class EducationDegreePicker extends StatelessWidget {
|
|||||||
final ProfileController controller = Get.put(ProfileController());
|
final ProfileController controller = Get.put(ProfileController());
|
||||||
|
|
||||||
final List<String> degreeOptions = [
|
final List<String> degreeOptions = [
|
||||||
'High School Diploma',
|
'High School Diploma'.tr,
|
||||||
'Associate Degree',
|
'Associate Degree'.tr,
|
||||||
'Bachelor\'s Degree',
|
'Bachelor\'s Degree'.tr,
|
||||||
'Master\'s Degree',
|
'Master\'s Degree'.tr,
|
||||||
'Doctoral Degree',
|
'Doctoral Degree'.tr,
|
||||||
];
|
];
|
||||||
|
|
||||||
EducationDegreePicker({Key? key}) : super(key: key);
|
EducationDegreePicker({Key? key}) : super(key: key);
|
||||||
|
|||||||
@@ -2,7 +2,6 @@ import 'package:flutter/material.dart';
|
|||||||
import 'package:get/get.dart';
|
import 'package:get/get.dart';
|
||||||
import 'package:ride/constant/box_name.dart';
|
import 'package:ride/constant/box_name.dart';
|
||||||
import 'package:ride/controller/firebase/firbase_messge.dart';
|
import 'package:ride/controller/firebase/firbase_messge.dart';
|
||||||
import 'package:ride/controller/home/captin/map_driver_controller.dart';
|
|
||||||
import 'package:ride/main.dart';
|
import 'package:ride/main.dart';
|
||||||
import 'package:ride/views/home/Captin/driver_map_page.dart';
|
import 'package:ride/views/home/Captin/driver_map_page.dart';
|
||||||
import 'package:ride/views/widgets/my_scafold.dart';
|
import 'package:ride/views/widgets/my_scafold.dart';
|
||||||
@@ -10,7 +9,6 @@ import 'package:ride/views/widgets/my_scafold.dart';
|
|||||||
import '../../constant/colors.dart';
|
import '../../constant/colors.dart';
|
||||||
import '../../constant/links.dart';
|
import '../../constant/links.dart';
|
||||||
import '../../constant/style.dart';
|
import '../../constant/style.dart';
|
||||||
import '../../constant/table_names.dart';
|
|
||||||
import '../../controller/functions/crud.dart';
|
import '../../controller/functions/crud.dart';
|
||||||
import '../../controller/functions/launch.dart';
|
import '../../controller/functions/launch.dart';
|
||||||
import '../../controller/home/captin/order_request_controller.dart';
|
import '../../controller/home/captin/order_request_controller.dart';
|
||||||
@@ -28,7 +26,7 @@ class OrderRequestPage extends StatelessWidget {
|
|||||||
final body = arguments['body'];
|
final body = arguments['body'];
|
||||||
orderRequestController.startTimer(myList[6].toString(), body.toString());
|
orderRequestController.startTimer(myList[6].toString(), body.toString());
|
||||||
return MyScafolld(
|
return MyScafolld(
|
||||||
title: 'Order Request Page',
|
title: 'Order Request Page'.tr,
|
||||||
body: [
|
body: [
|
||||||
Column(
|
Column(
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
|
|||||||
40
pubspec.lock
40
pubspec.lock
@@ -145,6 +145,14 @@ packages:
|
|||||||
url: "https://pub.dev"
|
url: "https://pub.dev"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "0.7.8"
|
version: "0.7.8"
|
||||||
|
decimal:
|
||||||
|
dependency: transitive
|
||||||
|
description:
|
||||||
|
name: decimal
|
||||||
|
sha256: "24a261d5d5c87e86c7651c417a5dbdf8bcd7080dd592533910e8d0505a279f21"
|
||||||
|
url: "https://pub.dev"
|
||||||
|
source: hosted
|
||||||
|
version: "2.3.3"
|
||||||
fake_async:
|
fake_async:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
@@ -214,6 +222,14 @@ packages:
|
|||||||
description: flutter
|
description: flutter
|
||||||
source: sdk
|
source: sdk
|
||||||
version: "0.0.0"
|
version: "0.0.0"
|
||||||
|
flutter_charts:
|
||||||
|
dependency: "direct main"
|
||||||
|
description:
|
||||||
|
name: flutter_charts
|
||||||
|
sha256: eb9d2bf98bfc779c1da9cf1fe80afd598094aed33e536cf04845d8f266f48c11
|
||||||
|
url: "https://pub.dev"
|
||||||
|
source: hosted
|
||||||
|
version: "0.5.2"
|
||||||
flutter_font_icons:
|
flutter_font_icons:
|
||||||
dependency: "direct main"
|
dependency: "direct main"
|
||||||
description:
|
description:
|
||||||
@@ -632,6 +648,14 @@ packages:
|
|||||||
url: "https://pub.dev"
|
url: "https://pub.dev"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "4.2.0"
|
version: "4.2.0"
|
||||||
|
logger:
|
||||||
|
dependency: transitive
|
||||||
|
description:
|
||||||
|
name: logger
|
||||||
|
sha256: "6bbb9d6f7056729537a4309bda2e74e18e5d9f14302489cc1e93f33b3fe32cac"
|
||||||
|
url: "https://pub.dev"
|
||||||
|
source: hosted
|
||||||
|
version: "2.0.2+1"
|
||||||
lottie:
|
lottie:
|
||||||
dependency: "direct main"
|
dependency: "direct main"
|
||||||
description:
|
description:
|
||||||
@@ -760,6 +784,14 @@ packages:
|
|||||||
url: "https://pub.dev"
|
url: "https://pub.dev"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "3.2.1"
|
version: "3.2.1"
|
||||||
|
rational:
|
||||||
|
dependency: transitive
|
||||||
|
description:
|
||||||
|
name: rational
|
||||||
|
sha256: ba58e9e18df9abde280e8b10051e4bce85091e41e8e7e411b6cde2e738d357cf
|
||||||
|
url: "https://pub.dev"
|
||||||
|
source: hosted
|
||||||
|
version: "2.2.2"
|
||||||
sanitize_html:
|
sanitize_html:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
@@ -861,6 +893,14 @@ packages:
|
|||||||
url: "https://pub.dev"
|
url: "https://pub.dev"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "0.9.2"
|
version: "0.9.2"
|
||||||
|
tuple:
|
||||||
|
dependency: transitive
|
||||||
|
description:
|
||||||
|
name: tuple
|
||||||
|
sha256: a97ce2013f240b2f3807bcbaf218765b6f301c3eff91092bcfa23a039e7dd151
|
||||||
|
url: "https://pub.dev"
|
||||||
|
source: hosted
|
||||||
|
version: "2.0.2"
|
||||||
typed_data:
|
typed_data:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
|
|||||||
@@ -38,6 +38,7 @@ dependencies:
|
|||||||
crypto: ^3.0.3
|
crypto: ^3.0.3
|
||||||
flutter_rating_bar: ^4.0.1
|
flutter_rating_bar: ^4.0.1
|
||||||
flutter_font_icons: ^2.2.5
|
flutter_font_icons: ^2.2.5
|
||||||
|
flutter_charts: ^0.5.2
|
||||||
|
|
||||||
|
|
||||||
dev_dependencies:
|
dev_dependencies:
|
||||||
|
|||||||
Reference in New Issue
Block a user