1/1/1
This commit is contained in:
Binary file not shown.
|
Before Width: | Height: | Size: 1.7 KiB After Width: | Height: | Size: 2.6 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 1.4 KiB After Width: | Height: | Size: 9.4 KiB |
@@ -1,38 +1,28 @@
|
|||||||
import 'dart:convert';
|
import 'dart:convert';
|
||||||
|
|
||||||
import 'package:flutter/animation.dart';
|
import 'package:fl_chart/fl_chart.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/constant/links.dart';
|
import 'package:ride/constant/links.dart';
|
||||||
import 'package:ride/controller/functions/crud.dart';
|
import 'package:ride/controller/functions/crud.dart';
|
||||||
import 'package:ride/main.dart';
|
import 'package:ride/main.dart';
|
||||||
|
import 'package:ride/models/model/driver/rides_summary_model.dart';
|
||||||
|
|
||||||
class DurationController extends GetxController
|
class DurationController extends GetxController {
|
||||||
with GetSingleTickerProviderStateMixin {
|
final data = DurationData;
|
||||||
final data = <DurationData>[].obs;
|
// late AnimationController animationController;
|
||||||
late AnimationController animationController;
|
late List<MonthlyDataModel> rideData;
|
||||||
|
Map<String, dynamic> jsonData1 = {};
|
||||||
@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;
|
bool isLoading = false;
|
||||||
String totalDurationToday = '';
|
String totalDurationToday = '';
|
||||||
|
var chartData;
|
||||||
|
|
||||||
|
@override
|
||||||
|
void onInit() async {
|
||||||
|
super.onInit();
|
||||||
|
await fetchData();
|
||||||
|
}
|
||||||
|
|
||||||
Future<void> fetchData() async {
|
Future<void> fetchData() async {
|
||||||
isLoading = true;
|
isLoading = true;
|
||||||
update(); // Notify the observers about the loading state change
|
update(); // Notify the observers about the loading state change
|
||||||
@@ -41,13 +31,22 @@ class DurationController extends GetxController
|
|||||||
link: AppLink.getTotalDriverDuration,
|
link: AppLink.getTotalDriverDuration,
|
||||||
payload: {'driver_id': box.read(BoxName.driverID)},
|
payload: {'driver_id': box.read(BoxName.driverID)},
|
||||||
);
|
);
|
||||||
|
jsonData1 = jsonDecode(res);
|
||||||
jsonData = jsonDecode(res);
|
var jsonResponse = jsonDecode(res) as Map<String, dynamic>;
|
||||||
|
|
||||||
final parsedData = parseData(jsonData['message']);
|
|
||||||
data.value = parsedData;
|
|
||||||
|
|
||||||
isLoading = false;
|
isLoading = false;
|
||||||
|
// print(jsonResponse);
|
||||||
|
final List<dynamic> jsonData = jsonResponse['message'];
|
||||||
|
rideData = jsonData.map<MonthlyDataModel>((item) {
|
||||||
|
return MonthlyDataModel.fromJson(item);
|
||||||
|
}).toList();
|
||||||
|
final List<FlSpot> spots = rideData
|
||||||
|
.map((data) => FlSpot(
|
||||||
|
data.day.toDouble(),
|
||||||
|
data.totalDuration.toDouble(),
|
||||||
|
))
|
||||||
|
.toList();
|
||||||
|
chartData = spots;
|
||||||
|
|
||||||
update(); // Notify the observers about the data and loading state change
|
update(); // Notify the observers about the data and loading state change
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -21,12 +21,16 @@ import '../../functions/location_controller.dart';
|
|||||||
class MapDriverController extends GetxController {
|
class MapDriverController extends GetxController {
|
||||||
bool isLoading = true;
|
bool isLoading = true;
|
||||||
List data = [];
|
List data = [];
|
||||||
|
List dataDestination = [];
|
||||||
LatLngBounds? boundsData;
|
LatLngBounds? boundsData;
|
||||||
BitmapDescriptor carIcon = BitmapDescriptor.defaultMarker;
|
BitmapDescriptor carIcon = BitmapDescriptor.defaultMarker;
|
||||||
final List<LatLng> polylineCoordinates = [];
|
final List<LatLng> polylineCoordinates = [];
|
||||||
|
final List<LatLng> polylineCoordinatesDestination = [];
|
||||||
List<Polyline> polyLines = [];
|
List<Polyline> polyLines = [];
|
||||||
|
List<Polyline> polyLinesDestination = [];
|
||||||
Set<Marker> markers = {};
|
Set<Marker> markers = {};
|
||||||
late String passengerLocation;
|
late String passengerLocation;
|
||||||
|
late String passengerDestination;
|
||||||
late String duration;
|
late String duration;
|
||||||
late String distance;
|
late String distance;
|
||||||
late String name;
|
late String name;
|
||||||
@@ -46,7 +50,7 @@ class MapDriverController extends GetxController {
|
|||||||
bool isBtnRideBegin = false;
|
bool isBtnRideBegin = false;
|
||||||
bool isRideFinished = false;
|
bool isRideFinished = false;
|
||||||
bool isRideStarted = false;
|
bool isRideStarted = false;
|
||||||
double passengerInfoWindow = Get.height * .32;
|
double passengerInfoWindow = Get.height * .35;
|
||||||
double progress = 0;
|
double progress = 0;
|
||||||
double progressToPassenger = 0;
|
double progressToPassenger = 0;
|
||||||
bool isRideBegin = false;
|
bool isRideBegin = false;
|
||||||
@@ -69,12 +73,12 @@ class MapDriverController extends GetxController {
|
|||||||
mapController = controller;
|
mapController = controller;
|
||||||
controller.getVisibleRegion();
|
controller.getVisibleRegion();
|
||||||
controller.animateCamera(
|
controller.animateCamera(
|
||||||
CameraUpdate.newLatLngZoom(myLocation, 15),
|
CameraUpdate.newLatLngZoom(myLocation, 17),
|
||||||
);
|
);
|
||||||
update();
|
update();
|
||||||
|
|
||||||
// Set up a timer or interval to trigger the marker update every 3 seconds.
|
// Set up a timer or interval to trigger the marker update every 3 seconds.
|
||||||
timer = Timer.periodic(const Duration(seconds: 3), (_) {
|
timer = Timer.periodic(const Duration(seconds: 2), (_) {
|
||||||
updateMarker();
|
updateMarker();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -111,7 +115,9 @@ class MapDriverController extends GetxController {
|
|||||||
|
|
||||||
void clearPolyline() {
|
void clearPolyline() {
|
||||||
polyLines = [];
|
polyLines = [];
|
||||||
|
polyLinesDestination = [];
|
||||||
polylineCoordinates.clear();
|
polylineCoordinates.clear();
|
||||||
|
polylineCoordinatesDestination.clear();
|
||||||
update();
|
update();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -371,6 +377,45 @@ class MapDriverController extends GetxController {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
getMapDestination(String origin, destination) async {
|
||||||
|
var url =
|
||||||
|
('${AppLink.googleMapsLink}directions/json?&language=en&avoid=tolls|ferries&destination=$destination&origin=$origin&key=${AK.mapAPIKEY}');
|
||||||
|
|
||||||
|
var response = await CRUD().getGoogleApi(link: url, payload: {});
|
||||||
|
dataDestination = response['routes'][0]['legs'];
|
||||||
|
// print(data);
|
||||||
|
final points =
|
||||||
|
decodePolyline(response["routes"][0]["overview_polyline"]["points"]);
|
||||||
|
for (int i = 0; i < points.length; i++) {
|
||||||
|
double lat = points[i][0].toDouble();
|
||||||
|
double lng = points[i][1].toDouble();
|
||||||
|
polylineCoordinatesDestination.add(LatLng(lat, lng));
|
||||||
|
}
|
||||||
|
if (polyLinesDestination.isNotEmpty) {
|
||||||
|
clearPolyline();
|
||||||
|
var polyline = Polyline(
|
||||||
|
polylineId: PolylineId(response["routes"][0]["summary"]),
|
||||||
|
points: polylineCoordinatesDestination,
|
||||||
|
width: 10,
|
||||||
|
color: AppColor.redColor,
|
||||||
|
);
|
||||||
|
polyLinesDestination.add(polyline);
|
||||||
|
// rideConfirm = false;
|
||||||
|
update();
|
||||||
|
} else {
|
||||||
|
var polyline = Polyline(
|
||||||
|
polylineId: PolylineId(response["routes"][0]["summary"]),
|
||||||
|
points: polylineCoordinatesDestination,
|
||||||
|
width: 10,
|
||||||
|
color: AppColor.redColor,
|
||||||
|
);
|
||||||
|
|
||||||
|
polyLinesDestination.add(polyline);
|
||||||
|
// rideConfirm = false;
|
||||||
|
update();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void changePassengerInfoWindow() {
|
void changePassengerInfoWindow() {
|
||||||
isPassengerInfoWindow = !isPassengerInfoWindow;
|
isPassengerInfoWindow = !isPassengerInfoWindow;
|
||||||
passengerInfoWindow = isPassengerInfoWindow == true ? 200 : 0;
|
passengerInfoWindow = isPassengerInfoWindow == true ? 200 : 0;
|
||||||
@@ -382,6 +427,7 @@ class MapDriverController extends GetxController {
|
|||||||
mapAPIKEY = await storage.read(key: BoxName.mapAPIKEY);
|
mapAPIKEY = await storage.read(key: BoxName.mapAPIKEY);
|
||||||
// Get the passenger location from the arguments.
|
// Get the passenger location from the arguments.
|
||||||
passengerLocation = Get.arguments['passengerLocation'];
|
passengerLocation = Get.arguments['passengerLocation'];
|
||||||
|
passengerDestination = Get.arguments['passengerDestination'];
|
||||||
duration = Get.arguments['Duration'];
|
duration = Get.arguments['Duration'];
|
||||||
passengerId = Get.arguments['passengerId'];
|
passengerId = Get.arguments['passengerId'];
|
||||||
driverId = Get.arguments['driverId'];
|
driverId = Get.arguments['driverId'];
|
||||||
@@ -401,6 +447,7 @@ class MapDriverController extends GetxController {
|
|||||||
String origin = '$lat,$lng';
|
String origin = '$lat,$lng';
|
||||||
// Set the origin and destination coordinates for the Google Maps directions request.
|
// Set the origin and destination coordinates for the Google Maps directions request.
|
||||||
getMap(origin, passengerLocation);
|
getMap(origin, passengerLocation);
|
||||||
|
await getMapDestination(passengerLocation, passengerDestination);
|
||||||
addCustomCarIcon();
|
addCustomCarIcon();
|
||||||
// updateMarker();
|
// updateMarker();
|
||||||
startTimerToShowPassengerInfoWindowFromDriver();
|
startTimerToShowPassengerInfoWindowFromDriver();
|
||||||
|
|||||||
@@ -87,7 +87,7 @@ GetBuilder<HomeCaptainController> leftMainMenuCaptainIcons() {
|
|||||||
borderRadius: BorderRadius.circular(15)),
|
borderRadius: BorderRadius.circular(15)),
|
||||||
child: IconButton(
|
child: IconButton(
|
||||||
onPressed: () {
|
onPressed: () {
|
||||||
Get.to(() => const RideCalculateDriver());
|
Get.to(() => RideCalculateDriver());
|
||||||
},
|
},
|
||||||
icon: const Icon(FontAwesome5.chart_bar),
|
icon: const Icon(FontAwesome5.chart_bar),
|
||||||
),
|
),
|
||||||
|
|||||||
@@ -366,7 +366,7 @@ class MapPassengerController extends GetxController {
|
|||||||
['driver_id']
|
['driver_id']
|
||||||
.toString(),
|
.toString(),
|
||||||
"status": "waiting",
|
"status": "waiting",
|
||||||
"price_for_driver": totalDriver.toString(),
|
"price_for_driver": totalPassenger.toString(),
|
||||||
"price_for_passenger": totalME.toString(),
|
"price_for_passenger": totalME.toString(),
|
||||||
"distance": distance.toString()
|
"distance": distance.toString()
|
||||||
}).then((value) {
|
}).then((value) {
|
||||||
@@ -934,69 +934,72 @@ class MapPassengerController extends GetxController {
|
|||||||
if (polyLines.isEmpty || data.isEmpty) {
|
if (polyLines.isEmpty || data.isEmpty) {
|
||||||
if (rideConfirm == false) {
|
if (rideConfirm == false) {
|
||||||
double nearestDistance = double.infinity;
|
double nearestDistance = double.infinity;
|
||||||
for (var i = 0;
|
if (dataCarsLocationByPassenger['message'].length > 0) {
|
||||||
i < dataCarsLocationByPassenger['message'].length;
|
for (var i = 0;
|
||||||
i++) {
|
i < dataCarsLocationByPassenger['message'].length;
|
||||||
var carLocation = dataCarsLocationByPassenger['message'][i];
|
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=${AK.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=${AK.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
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
12
lib/models/model/driver/rides_summary_model.dart
Normal file
12
lib/models/model/driver/rides_summary_model.dart
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
class MonthlyDataModel {
|
||||||
|
int day;
|
||||||
|
int totalDuration;
|
||||||
|
|
||||||
|
MonthlyDataModel({required this.day, required this.totalDuration});
|
||||||
|
|
||||||
|
factory MonthlyDataModel.fromJson(Map<String, dynamic> json) =>
|
||||||
|
MonthlyDataModel(
|
||||||
|
day: int.parse(json['day'].toString().split('-')[2]),
|
||||||
|
totalDuration:
|
||||||
|
int.parse(json['total_duration'].toString().split(':')[0]));
|
||||||
|
}
|
||||||
@@ -1,3 +1,4 @@
|
|||||||
|
import 'package:fl_chart/fl_chart.dart';
|
||||||
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/colors.dart';
|
||||||
@@ -9,118 +10,204 @@ import 'package:flutter/animation.dart';
|
|||||||
import '../../controller/home/captin/duration_controller .dart';
|
import '../../controller/home/captin/duration_controller .dart';
|
||||||
|
|
||||||
class RideCalculateDriver extends StatelessWidget {
|
class RideCalculateDriver extends StatelessWidget {
|
||||||
const RideCalculateDriver({super.key});
|
RideCalculateDriver({super.key});
|
||||||
|
// DurationController durationController = Get.put(DurationController());
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
|
Get.put(DurationController());
|
||||||
return MyScafolld(
|
return MyScafolld(
|
||||||
title: 'Ride Summary'.tr,
|
title: 'Ride Summaries'.tr,
|
||||||
body: const [
|
body: [
|
||||||
Center(
|
Center(
|
||||||
child: BarChartWidget(),
|
child: GetBuilder<DurationController>(
|
||||||
),
|
builder: (durationController) => durationController.isLoading
|
||||||
|
? const Center(child: MyCircularProgressIndicator())
|
||||||
|
: Column(
|
||||||
|
mainAxisAlignment: MainAxisAlignment.start,
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.center,
|
||||||
|
children: [
|
||||||
|
Text(
|
||||||
|
'Average of Hours of ${AppInformation.appName} is ON for this month ${durationController.jsonData1['message'][0]['day'].toString().split('-')[1]}'
|
||||||
|
.tr,
|
||||||
|
style: AppStyle.title,
|
||||||
|
textAlign: TextAlign.center,
|
||||||
|
),
|
||||||
|
SizedBox(
|
||||||
|
height: Get.height * .4,
|
||||||
|
child: LineChart(
|
||||||
|
duration: const Duration(milliseconds: 150),
|
||||||
|
curve: Curves.ease,
|
||||||
|
LineChartData(
|
||||||
|
lineBarsData: [
|
||||||
|
LineChartBarData(
|
||||||
|
spots: durationController.chartData,
|
||||||
|
isCurved: true,
|
||||||
|
color: Colors.deepPurpleAccent, // Custom color
|
||||||
|
barWidth: 3, // Thinner line
|
||||||
|
dotData: const FlDotData(
|
||||||
|
show: true), // Show dots on each point
|
||||||
|
belowBarData: BarAreaData(
|
||||||
|
// Add gradient fill below the line
|
||||||
|
show: true,
|
||||||
|
color: AppColor.deepPurpleAccent,
|
||||||
|
),
|
||||||
|
isStrokeJoinRound: true,
|
||||||
|
shadow: const BoxShadow(
|
||||||
|
color: AppColor.yellowColor,
|
||||||
|
blurRadius: 4,
|
||||||
|
offset: Offset(2, 2),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
showingTooltipIndicators: const [],
|
||||||
|
titlesData: FlTitlesData(
|
||||||
|
show: true,
|
||||||
|
topTitles: AxisTitles(
|
||||||
|
axisNameWidget: Text(
|
||||||
|
'Days',
|
||||||
|
style: AppStyle.title,
|
||||||
|
),
|
||||||
|
axisNameSize: 30,
|
||||||
|
sideTitles: const SideTitles(
|
||||||
|
reservedSize: 30, showTitles: true)),
|
||||||
|
bottomTitles: AxisTitles(
|
||||||
|
axisNameWidget: Text(
|
||||||
|
'Total Hours on month'.tr,
|
||||||
|
style: AppStyle.title,
|
||||||
|
),
|
||||||
|
axisNameSize: 30,
|
||||||
|
sideTitles: const SideTitles(
|
||||||
|
reservedSize: 30, showTitles: true)),
|
||||||
|
leftTitles: AxisTitles(
|
||||||
|
axisNameWidget: Text(
|
||||||
|
'Counts of Hours on days'.tr,
|
||||||
|
style: AppStyle.title,
|
||||||
|
),
|
||||||
|
axisNameSize: 30,
|
||||||
|
sideTitles: const SideTitles(
|
||||||
|
reservedSize: 30, showTitles: true)),
|
||||||
|
),
|
||||||
|
gridData: const FlGridData(
|
||||||
|
show: true,
|
||||||
|
),
|
||||||
|
borderData: FlBorderData(
|
||||||
|
show: true,
|
||||||
|
border: const Border(
|
||||||
|
bottom: BorderSide(color: AppColor.accentColor),
|
||||||
|
left: BorderSide(color: AppColor.accentColor),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
)
|
||||||
|
// BarChartWidget(),
|
||||||
|
),
|
||||||
],
|
],
|
||||||
isleading: true);
|
isleading: true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
class BarChartWidget extends StatelessWidget {
|
// class BarChartWidget extends StatelessWidget {
|
||||||
const BarChartWidget({super.key});
|
// const BarChartWidget({super.key});
|
||||||
|
|
||||||
@override
|
// @override
|
||||||
Widget build(BuildContext context) {
|
// Widget build(BuildContext context) {
|
||||||
final durationController = Get.put(DurationController());
|
// final durationController = Get.put(DurationController());
|
||||||
return Obx(() {
|
// return Obx(() {
|
||||||
final data = durationController.data;
|
// final data = durationController.data;
|
||||||
double maxDuration = 0;
|
// double maxDuration = 0;
|
||||||
|
|
||||||
// Find the maximum duration to determine the maximum height of the bars
|
// // Find the maximum duration to determine the maximum height of the bars
|
||||||
for (final entry in data) {
|
// for (final entry in data) {
|
||||||
final durationInHours = entry.totalDuration.inHours.toDouble();
|
// final durationInHours = entry.totalDuration.inHours.toDouble();
|
||||||
if (durationInHours > maxDuration) {
|
// if (durationInHours > maxDuration) {
|
||||||
maxDuration = durationInHours;
|
// maxDuration = durationInHours;
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
|
|
||||||
return durationController.isLoading
|
// return durationController.isLoading
|
||||||
? const Center(
|
// ? const Center(
|
||||||
child: MyCircularProgressIndicator(),
|
// child: MyCircularProgressIndicator(),
|
||||||
)
|
// )
|
||||||
: Column(
|
// : Column(
|
||||||
children: [
|
// children: [
|
||||||
Text(
|
// Text(
|
||||||
'Average of Hours of ${AppInformation.appName} is ON for this month'
|
// 'Average of Hours of ${AppInformation.appName} is ON for this month'
|
||||||
.tr,
|
// .tr,
|
||||||
style: AppStyle.title,
|
// style: AppStyle.title,
|
||||||
),
|
// ),
|
||||||
Padding(
|
// Padding(
|
||||||
padding: const EdgeInsets.all(8.0),
|
// padding: const EdgeInsets.all(8.0),
|
||||||
child: Container(
|
// child: Container(
|
||||||
height: Get.height * .7,
|
// height: Get.height * .7,
|
||||||
decoration: AppStyle.boxDecoration,
|
// decoration: AppStyle.boxDecoration,
|
||||||
child: ListView.builder(
|
// child: ListView.builder(
|
||||||
scrollDirection: Axis.horizontal,
|
// scrollDirection: Axis.horizontal,
|
||||||
itemCount: data.length,
|
// itemCount: data.length,
|
||||||
itemBuilder: (context, index) {
|
// itemBuilder: (context, index) {
|
||||||
final entry = data[index];
|
// final entry = data[index];
|
||||||
final durationInHours =
|
// final durationInHours =
|
||||||
entry.totalDuration.inHours.toDouble();
|
// entry.totalDuration.inHours.toDouble();
|
||||||
final dayLabel = entry.day.day.toString();
|
// final dayLabel = entry.day.day.toString();
|
||||||
|
|
||||||
return Padding(
|
// return Padding(
|
||||||
padding: const EdgeInsets.symmetric(horizontal: 4),
|
// padding: const EdgeInsets.symmetric(horizontal: 4),
|
||||||
child: AnimatedBuilder(
|
// child: AnimatedBuilder(
|
||||||
animation: durationController.animationController,
|
// // animation: durationController.animationController,
|
||||||
builder: (context, child) {
|
// builder: (context, child) {
|
||||||
final animationValue =
|
// final animationValue =
|
||||||
durationController.animationController.value;
|
// durationController.animationController.value;
|
||||||
final animatedValue =
|
// final animatedValue =
|
||||||
(durationInHours / maxDuration) *
|
// (durationInHours / maxDuration) *
|
||||||
animationValue;
|
// animationValue;
|
||||||
|
|
||||||
return Column(
|
// return Column(
|
||||||
mainAxisAlignment: MainAxisAlignment.end,
|
// mainAxisAlignment: MainAxisAlignment.end,
|
||||||
children: [
|
// children: [
|
||||||
Transform(
|
// Transform(
|
||||||
transform: Matrix4.identity()
|
// transform: Matrix4.identity()
|
||||||
..setEntry(3, 2,
|
// ..setEntry(3, 2,
|
||||||
0.001) // Apply perspective for a 3D effect
|
// 0.001) // Apply perspective for a 3D effect
|
||||||
..rotateX(-0.5 *
|
// ..rotateX(-0.5 *
|
||||||
animatedValue), // Rotate around X-axis
|
// animatedValue), // Rotate around X-axis
|
||||||
alignment: Alignment.bottomCenter,
|
// alignment: Alignment.bottomCenter,
|
||||||
child: Container(
|
// child: Container(
|
||||||
width: 20,
|
// width: 20,
|
||||||
height:
|
// height:
|
||||||
(durationInHours / maxDuration) * 400,
|
// (durationInHours / maxDuration) * 400,
|
||||||
color: durationInHours > 8
|
// color: durationInHours > 8
|
||||||
? AppColor.greenColor
|
// ? AppColor.greenColor
|
||||||
: AppColor.yellowColor,
|
// : AppColor.yellowColor,
|
||||||
child: Center(
|
// child: Center(
|
||||||
child: Text(
|
// child: Text(
|
||||||
durationInHours.toStringAsFixed(
|
// durationInHours.toStringAsFixed(
|
||||||
0,
|
// 0,
|
||||||
), // Display the duration value inside the bar
|
// ), // Display the duration value inside the bar
|
||||||
style: const TextStyle(
|
// style: const TextStyle(
|
||||||
color: Colors.white,
|
// color: Colors.white,
|
||||||
fontWeight: FontWeight.bold,
|
// fontWeight: FontWeight.bold,
|
||||||
),
|
// ),
|
||||||
),
|
// ),
|
||||||
),
|
// ),
|
||||||
),
|
// ),
|
||||||
),
|
// ),
|
||||||
const SizedBox(height: 4),
|
// const SizedBox(height: 4),
|
||||||
Text(dayLabel),
|
// Text(dayLabel),
|
||||||
],
|
// ],
|
||||||
);
|
// );
|
||||||
},
|
// },
|
||||||
),
|
// ),
|
||||||
);
|
// );
|
||||||
},
|
// },
|
||||||
),
|
// ),
|
||||||
),
|
// ),
|
||||||
),
|
// ),
|
||||||
],
|
// ],
|
||||||
);
|
// );
|
||||||
});
|
// });
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
|
|||||||
@@ -45,6 +45,18 @@ class GoogleDriverMap extends StatelessWidget {
|
|||||||
color: AppColor.greenColor,
|
color: AppColor.greenColor,
|
||||||
width: 5,
|
width: 5,
|
||||||
),
|
),
|
||||||
|
Polyline(
|
||||||
|
zIndex: 2,
|
||||||
|
consumeTapEvents: true,
|
||||||
|
geodesic: true,
|
||||||
|
endCap: Cap.buttCap,
|
||||||
|
startCap: Cap.buttCap,
|
||||||
|
visible: true,
|
||||||
|
polylineId: const PolylineId('route'),
|
||||||
|
points: controller.polylineCoordinatesDestination,
|
||||||
|
color: AppColor.redColor,
|
||||||
|
width: 5,
|
||||||
|
),
|
||||||
},
|
},
|
||||||
markers: {
|
markers: {
|
||||||
Marker(
|
Marker(
|
||||||
|
|||||||
@@ -111,25 +111,25 @@ class OrderRequestPage extends StatelessWidget {
|
|||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
// Padding(
|
||||||
|
// padding: const EdgeInsets.all(8.0),
|
||||||
|
// child: RichText(
|
||||||
|
// text: TextSpan(
|
||||||
|
// text: 'Total For You is '.tr,
|
||||||
|
// style: AppStyle.title,
|
||||||
|
// children: [
|
||||||
|
// TextSpan(
|
||||||
|
// text: double.parse(myList[3]).toStringAsFixed(2),
|
||||||
|
// style: AppStyle.headtitle2),
|
||||||
|
// ],
|
||||||
|
// ),
|
||||||
|
// ),
|
||||||
|
// ),
|
||||||
Padding(
|
Padding(
|
||||||
padding: const EdgeInsets.all(8.0),
|
padding: const EdgeInsets.all(8.0),
|
||||||
child: RichText(
|
child: RichText(
|
||||||
text: TextSpan(
|
text: TextSpan(
|
||||||
text: 'Total For You is '.tr,
|
text: 'Distance from Passenger to destination is '.tr,
|
||||||
style: AppStyle.title,
|
|
||||||
children: [
|
|
||||||
TextSpan(
|
|
||||||
text: double.parse(myList[3]).toStringAsFixed(2),
|
|
||||||
style: AppStyle.headtitle2),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
Padding(
|
|
||||||
padding: const EdgeInsets.all(8.0),
|
|
||||||
child: RichText(
|
|
||||||
text: TextSpan(
|
|
||||||
text: 'Distance is '.tr,
|
|
||||||
style: AppStyle.title,
|
style: AppStyle.title,
|
||||||
children: [
|
children: [
|
||||||
TextSpan(
|
TextSpan(
|
||||||
@@ -190,6 +190,7 @@ class OrderRequestPage extends StatelessWidget {
|
|||||||
Get.back();
|
Get.back();
|
||||||
Get.to(() => PassengerLocationMapPage(), arguments: {
|
Get.to(() => PassengerLocationMapPage(), arguments: {
|
||||||
'passengerLocation': myList[0].toString(),
|
'passengerLocation': myList[0].toString(),
|
||||||
|
'passengerDestination': myList[1].toString(),
|
||||||
'Duration': myList[4].toString(),
|
'Duration': myList[4].toString(),
|
||||||
'Distance': myList[5].toString(),
|
'Distance': myList[5].toString(),
|
||||||
'name': myList[8].toString(),
|
'name': myList[8].toString(),
|
||||||
|
|||||||
@@ -47,87 +47,71 @@ GetBuilder<MapPassengerController> buttomSheetMapPage() {
|
|||||||
],
|
],
|
||||||
borderRadius: const BorderRadius.all(
|
borderRadius: const BorderRadius.all(
|
||||||
Radius.circular(15))),
|
Radius.circular(15))),
|
||||||
child: ListView.builder(
|
child: Row(
|
||||||
itemCount:
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||||
controller.dataCarsLocationByPassenger.length,
|
children: [
|
||||||
itemBuilder: (BuildContext context, int index) {
|
SizedBox(
|
||||||
return Row(
|
width: Get.width * .15,
|
||||||
mainAxisAlignment:
|
child: Padding(
|
||||||
MainAxisAlignment.spaceBetween,
|
padding: const EdgeInsets.all(8.0),
|
||||||
children: [
|
child: Image.asset(
|
||||||
SizedBox(
|
'assets/images/jeep.png',
|
||||||
width: Get.width * .15,
|
width: 50,
|
||||||
child: Padding(
|
fit: BoxFit.fill,
|
||||||
padding: const EdgeInsets.all(8.0),
|
repeat: ImageRepeat.repeatX,
|
||||||
child: Column(
|
),
|
||||||
children: [
|
),
|
||||||
Text(controller
|
),
|
||||||
.dataCarsLocationByPassenger
|
SizedBox(
|
||||||
.toString()),
|
width: Get.width * .55,
|
||||||
Image.asset(
|
child: Column(
|
||||||
'assets/images/jeep.png',
|
crossAxisAlignment:
|
||||||
width: 50,
|
CrossAxisAlignment.start,
|
||||||
fit: BoxFit.fill,
|
mainAxisAlignment:
|
||||||
repeat: ImageRepeat.repeatX,
|
MainAxisAlignment.spaceEvenly,
|
||||||
),
|
children: [
|
||||||
],
|
Text(
|
||||||
|
'${'Your Ride Duration is '.tr}${controller.duration} minutes',
|
||||||
|
style: AppStyle.subtitle,
|
||||||
|
),
|
||||||
|
Text(
|
||||||
|
'${'You will be thier in'.tr} ${DateFormat('h:mm a').format(controller.newTime)}',
|
||||||
|
style: AppStyle.subtitle,
|
||||||
|
),
|
||||||
|
Text(
|
||||||
|
'${'You trip distance is'.tr} ${controller.distance} KM',
|
||||||
|
style: AppStyle.subtitle,
|
||||||
|
)
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
SizedBox(
|
||||||
|
width: Get.width * .2,
|
||||||
|
child: Padding(
|
||||||
|
padding: const EdgeInsets.only(
|
||||||
|
right: 5, left: 5),
|
||||||
|
child: Column(
|
||||||
|
crossAxisAlignment:
|
||||||
|
CrossAxisAlignment.center,
|
||||||
|
children: [
|
||||||
|
Text(
|
||||||
|
'${'Fee is'.tr} \n${controller.totalPassenger.toStringAsFixed(2)}',
|
||||||
|
style: AppStyle.subtitle,
|
||||||
),
|
),
|
||||||
),
|
controller.promoTaken
|
||||||
|
? const Icon(
|
||||||
|
Icons.filter_vintage_rounded,
|
||||||
|
color: AppColor.redColor,
|
||||||
|
)
|
||||||
|
: const SizedBox(
|
||||||
|
height: 0,
|
||||||
|
)
|
||||||
|
],
|
||||||
),
|
),
|
||||||
SizedBox(
|
),
|
||||||
width: Get.width * .55,
|
),
|
||||||
child: Column(
|
],
|
||||||
crossAxisAlignment:
|
)),
|
||||||
CrossAxisAlignment.start,
|
|
||||||
mainAxisAlignment:
|
|
||||||
MainAxisAlignment.spaceEvenly,
|
|
||||||
children: [
|
|
||||||
Text(
|
|
||||||
'${'Your Ride Duration is '.tr}${controller.duration} minutes',
|
|
||||||
style: AppStyle.subtitle,
|
|
||||||
),
|
|
||||||
Text(
|
|
||||||
'${'You will be thier in'.tr} ${DateFormat('h:mm a').format(controller.newTime)}',
|
|
||||||
style: AppStyle.subtitle,
|
|
||||||
),
|
|
||||||
Text(
|
|
||||||
'${'You trip distance is'.tr} ${controller.distance} KM',
|
|
||||||
style: AppStyle.subtitle,
|
|
||||||
)
|
|
||||||
],
|
|
||||||
),
|
|
||||||
),
|
|
||||||
SizedBox(
|
|
||||||
width: Get.width * .2,
|
|
||||||
child: Padding(
|
|
||||||
padding: const EdgeInsets.only(
|
|
||||||
right: 5, left: 5),
|
|
||||||
child: Column(
|
|
||||||
crossAxisAlignment:
|
|
||||||
CrossAxisAlignment.center,
|
|
||||||
children: [
|
|
||||||
Text(
|
|
||||||
'${'Fee is'.tr} \n${controller.totalPassenger.toStringAsFixed(2)}',
|
|
||||||
style: AppStyle.subtitle,
|
|
||||||
),
|
|
||||||
controller.promoTaken
|
|
||||||
? const Icon(
|
|
||||||
Icons
|
|
||||||
.filter_vintage_rounded,
|
|
||||||
color: AppColor.redColor,
|
|
||||||
)
|
|
||||||
: const SizedBox(
|
|
||||||
height: 0,
|
|
||||||
)
|
|
||||||
],
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
);
|
|
||||||
},
|
|
||||||
),
|
|
||||||
),
|
|
||||||
const SizedBox(
|
const SizedBox(
|
||||||
height: 5,
|
height: 5,
|
||||||
),
|
),
|
||||||
|
|||||||
@@ -151,7 +151,7 @@ class GoogleMapPassengerWidget extends StatelessWidget {
|
|||||||
markerId: MarkerId('MyLocation'.tr),
|
markerId: MarkerId('MyLocation'.tr),
|
||||||
position: controller.newStartPointLocation,
|
position: controller.newStartPointLocation,
|
||||||
draggable: true,
|
draggable: true,
|
||||||
icon: controller.markerIcon,
|
icon: controller.tripIcon,
|
||||||
infoWindow: const InfoWindow(
|
infoWindow: const InfoWindow(
|
||||||
title: 'Time',
|
title: 'Time',
|
||||||
// snippet: controller.durationFromDriverToPassenger
|
// snippet: controller.durationFromDriverToPassenger
|
||||||
@@ -166,7 +166,7 @@ class GoogleMapPassengerWidget extends StatelessWidget {
|
|||||||
markerId: MarkerId('Destination'.tr),
|
markerId: MarkerId('Destination'.tr),
|
||||||
position: controller.newMyLocation,
|
position: controller.newMyLocation,
|
||||||
draggable: true,
|
draggable: true,
|
||||||
icon: controller.markerIcon,
|
icon: controller.tripIcon,
|
||||||
infoWindow: const InfoWindow(
|
infoWindow: const InfoWindow(
|
||||||
title: 'Time',
|
title: 'Time',
|
||||||
// snippet: controller.durationFromDriverToPassenger
|
// snippet: controller.durationFromDriverToPassenger
|
||||||
|
|||||||
@@ -187,7 +187,7 @@ class PassengerProfilePage extends StatelessWidget {
|
|||||||
)),
|
)),
|
||||||
Positioned(
|
Positioned(
|
||||||
left: 70,
|
left: 70,
|
||||||
bottom: 240,
|
bottom: 100,
|
||||||
right: 70,
|
right: 70,
|
||||||
child: MyElevatedButton(
|
child: MyElevatedButton(
|
||||||
title: 'Sign Out'.tr,
|
title: 'Sign Out'.tr,
|
||||||
@@ -197,7 +197,7 @@ class PassengerProfilePage extends StatelessWidget {
|
|||||||
),
|
),
|
||||||
Positioned(
|
Positioned(
|
||||||
left: 70,
|
left: 70,
|
||||||
bottom: 140,
|
bottom: 10,
|
||||||
right: 70,
|
right: 70,
|
||||||
child: MyElevatedButton(
|
child: MyElevatedButton(
|
||||||
title: 'Delete My Account'.tr,
|
title: 'Delete My Account'.tr,
|
||||||
|
|||||||
Reference in New Issue
Block a user