1/1/1
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
import 'package:fl_chart/fl_chart.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:ride/constant/colors.dart';
|
||||
@@ -9,118 +10,204 @@ import 'package:flutter/animation.dart';
|
||||
import '../../controller/home/captin/duration_controller .dart';
|
||||
|
||||
class RideCalculateDriver extends StatelessWidget {
|
||||
const RideCalculateDriver({super.key});
|
||||
RideCalculateDriver({super.key});
|
||||
// DurationController durationController = Get.put(DurationController());
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
Get.put(DurationController());
|
||||
return MyScafolld(
|
||||
title: 'Ride Summary'.tr,
|
||||
body: const [
|
||||
title: 'Ride Summaries'.tr,
|
||||
body: [
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
class BarChartWidget extends StatelessWidget {
|
||||
const BarChartWidget({super.key});
|
||||
// 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;
|
||||
// @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;
|
||||
}
|
||||
}
|
||||
// // 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 ${AppInformation.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 durationController.isLoading
|
||||
// ? const Center(
|
||||
// child: MyCircularProgressIndicator(),
|
||||
// )
|
||||
// : Column(
|
||||
// children: [
|
||||
// Text(
|
||||
// 'Average of Hours of ${AppInformation.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 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),
|
||||
],
|
||||
);
|
||||
},
|
||||
),
|
||||
);
|
||||
},
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
);
|
||||
});
|
||||
}
|
||||
}
|
||||
// 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),
|
||||
// ],
|
||||
// );
|
||||
// },
|
||||
// ),
|
||||
// );
|
||||
// },
|
||||
// ),
|
||||
// ),
|
||||
// ),
|
||||
// ],
|
||||
// );
|
||||
// });
|
||||
// }
|
||||
// }
|
||||
|
||||
@@ -45,6 +45,18 @@ class GoogleDriverMap extends StatelessWidget {
|
||||
color: AppColor.greenColor,
|
||||
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: {
|
||||
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: 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: const EdgeInsets.all(8.0),
|
||||
child: RichText(
|
||||
text: TextSpan(
|
||||
text: 'Distance is '.tr,
|
||||
text: 'Distance from Passenger to destination is '.tr,
|
||||
style: AppStyle.title,
|
||||
children: [
|
||||
TextSpan(
|
||||
@@ -190,6 +190,7 @@ class OrderRequestPage extends StatelessWidget {
|
||||
Get.back();
|
||||
Get.to(() => PassengerLocationMapPage(), arguments: {
|
||||
'passengerLocation': myList[0].toString(),
|
||||
'passengerDestination': myList[1].toString(),
|
||||
'Duration': myList[4].toString(),
|
||||
'Distance': myList[5].toString(),
|
||||
'name': myList[8].toString(),
|
||||
|
||||
@@ -47,87 +47,71 @@ GetBuilder<MapPassengerController> buttomSheetMapPage() {
|
||||
],
|
||||
borderRadius: const BorderRadius.all(
|
||||
Radius.circular(15))),
|
||||
child: ListView.builder(
|
||||
itemCount:
|
||||
controller.dataCarsLocationByPassenger.length,
|
||||
itemBuilder: (BuildContext context, int index) {
|
||||
return Row(
|
||||
mainAxisAlignment:
|
||||
MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
SizedBox(
|
||||
width: Get.width * .15,
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.all(8.0),
|
||||
child: Column(
|
||||
children: [
|
||||
Text(controller
|
||||
.dataCarsLocationByPassenger
|
||||
.toString()),
|
||||
Image.asset(
|
||||
'assets/images/jeep.png',
|
||||
width: 50,
|
||||
fit: BoxFit.fill,
|
||||
repeat: ImageRepeat.repeatX,
|
||||
),
|
||||
],
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
SizedBox(
|
||||
width: Get.width * .15,
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.all(8.0),
|
||||
child: Image.asset(
|
||||
'assets/images/jeep.png',
|
||||
width: 50,
|
||||
fit: BoxFit.fill,
|
||||
repeat: ImageRepeat.repeatX,
|
||||
),
|
||||
),
|
||||
),
|
||||
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,
|
||||
)
|
||||
],
|
||||
),
|
||||
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(
|
||||
height: 5,
|
||||
),
|
||||
|
||||
@@ -151,7 +151,7 @@ class GoogleMapPassengerWidget extends StatelessWidget {
|
||||
markerId: MarkerId('MyLocation'.tr),
|
||||
position: controller.newStartPointLocation,
|
||||
draggable: true,
|
||||
icon: controller.markerIcon,
|
||||
icon: controller.tripIcon,
|
||||
infoWindow: const InfoWindow(
|
||||
title: 'Time',
|
||||
// snippet: controller.durationFromDriverToPassenger
|
||||
@@ -166,7 +166,7 @@ class GoogleMapPassengerWidget extends StatelessWidget {
|
||||
markerId: MarkerId('Destination'.tr),
|
||||
position: controller.newMyLocation,
|
||||
draggable: true,
|
||||
icon: controller.markerIcon,
|
||||
icon: controller.tripIcon,
|
||||
infoWindow: const InfoWindow(
|
||||
title: 'Time',
|
||||
// snippet: controller.durationFromDriverToPassenger
|
||||
|
||||
@@ -187,7 +187,7 @@ class PassengerProfilePage extends StatelessWidget {
|
||||
)),
|
||||
Positioned(
|
||||
left: 70,
|
||||
bottom: 240,
|
||||
bottom: 100,
|
||||
right: 70,
|
||||
child: MyElevatedButton(
|
||||
title: 'Sign Out'.tr,
|
||||
@@ -197,7 +197,7 @@ class PassengerProfilePage extends StatelessWidget {
|
||||
),
|
||||
Positioned(
|
||||
left: 70,
|
||||
bottom: 140,
|
||||
bottom: 10,
|
||||
right: 70,
|
||||
child: MyElevatedButton(
|
||||
title: 'Delete My Account'.tr,
|
||||
|
||||
Reference in New Issue
Block a user