This commit is contained in:
Hamza Aleghwairyeen
2024-04-18 00:53:16 +03:00
parent d450ad0f93
commit 1f333852ac
11 changed files with 493 additions and 255 deletions

View File

@@ -1,3 +1,4 @@
import 'package:SEFER/controller/functions/location_controller.dart';
import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:SEFER/constant/colors.dart';
@@ -5,6 +6,7 @@ import 'package:SEFER/constant/style.dart';
import 'package:SEFER/controller/auth/captin/history_captain.dart';
import 'package:SEFER/controller/functions/launch.dart';
import 'package:SEFER/views/widgets/my_scafold.dart';
import 'package:google_maps_flutter/google_maps_flutter.dart';
import '../../../widgets/mycircular.dart';
@@ -20,133 +22,181 @@ class HistoryDetailsPage extends StatelessWidget {
GetBuilder<HistoryCaptainController>(
builder: (historyCaptainController) {
var res = historyCaptainController.historyDetailsData['data'];
return Expanded(
child: historyCaptainController.isloading
? const MyCircularProgressIndicator()
: SingleChildScrollView(
child: Column(
children: [
Container(
width: Get.width * .8,
decoration: BoxDecoration(
border: Border.all(
color: AppColor.blueColor, width: 2)),
child: TextButton(
onPressed: () {
String mapUrl =
'https://www.google.com/maps/dir/${res['start_location']}/${res['end_location']}/';
print(mapUrl);
showInBrowser(mapUrl);
},
child: Text(
'Trip on Map Click here'.tr,
style: AppStyle.title,
),
return historyCaptainController.isloading
? const MyCircularProgressIndicator()
: SingleChildScrollView(
child: Center(
child: Column(
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.center,
children: [
Container(
width: Get.width * .8,
decoration: BoxDecoration(
border: Border.all(
color: AppColor.blueColor, width: 2)),
child: TextButton(
onPressed: () {
String mapUrl =
'https://www.google.com/maps/dir/${res['start_location']}/${res['end_location']}/';
print(mapUrl);
showInBrowser(mapUrl);
},
child: Column(
children: [
SizedBox(
height: Get.height * .2,
width: Get.width * .75,
child: GoogleMap(
initialCameraPosition: CameraPosition(
target: Get.find<LocationController>()
.myLocation, // Assuming passenger location is available
tilt: 80, zoom: 13,
),
zoomControlsEnabled: true,
// liteModeEnabled: true,
polylines: {
Polyline(
zIndex: 2,
consumeTapEvents: true,
geodesic: true,
endCap: Cap.buttCap,
startCap: Cap.buttCap,
visible: true,
polylineId: const PolylineId('route'),
points: [
LatLng(
double.parse(res['start_location']
.toString()
.split(',')[0]),
double.parse(res['start_location']
.toString()
.split(',')[1]),
),
LatLng(
double.parse(res['end_location']
.toString()
.split(',')[0]),
double.parse(res['end_location']
.toString()
.split(',')[1]),
)
],
color: AppColor.primaryColor,
width: 5,
),
},
),
),
const SizedBox(
height: 10,
),
Row(
mainAxisAlignment:
MainAxisAlignment.spaceEvenly,
children: [
Text(
'${'Order ID'.tr} ${res['id']}',
style: AppStyle.title,
),
Text(
res['date'].toString(),
style: AppStyle.title,
),
],
),
],
),
),
const SizedBox(
height: 10,
),
Row(
),
const SizedBox(
height: 10,
),
Container(
width: Get.width * .8,
decoration: BoxDecoration(
border: Border.all(
color: AppColor.greenColor, width: 2)),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
children: [
Text(
'${'Order ID'.tr} ${res['id']}',
'${'Price is'.tr} ${res['price_for_driver']}',
style: AppStyle.title,
),
Text(
res['date'].toString(),
'${'Distance is'.tr} ${res['distance']} KM',
style: AppStyle.title,
),
],
),
const SizedBox(
height: 10,
),
Container(
width: Get.width * .8,
decoration: BoxDecoration(
border: Border.all(
color: AppColor.greenColor, width: 2)),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
children: [
Text(
'${'Price is'.tr} ${res['price_for_driver']}',
style: AppStyle.title,
),
Text(
'${'Distance is'.tr} ${res['distance']} KM',
style: AppStyle.title,
),
],
),
),
const SizedBox(
height: 10,
),
Text(
'Times of Trip'.tr,
style: AppStyle.title,
),
const SizedBox(
height: 10,
),
Container(
width: Get.width * .8,
decoration: BoxDecoration(
border: Border.all(
color: AppColor.redColor, width: 2)),
child: Column(
children: [
Text(
'${'Time to Passenger is'.tr} ${res['DriverIsGoingToPassenger']}',
style: AppStyle.title,
),
Text(
'${'TimeStart is'.tr} ${res['rideTimeStart']}',
style: AppStyle.title,
),
Text(
'${'Time Finish is'.tr} ${res['rideTimeFinish']}',
style: AppStyle.title,
),
],
),
),
const SizedBox(
height: 10,
),
Container(
width: Get.width * .8,
decoration: BoxDecoration(
border: Border.all(
color: AppColor.greenColor, width: 2)),
child: Center(
child: Text(
'${'Passenger Name is'.tr} ${res['first_name']} ${res['last_name']} ',
),
const SizedBox(
height: 10,
),
Text(
'Times of Trip'.tr,
style: AppStyle.title,
),
const SizedBox(
height: 10,
),
Container(
width: Get.width * .8,
decoration: BoxDecoration(
border: Border.all(
color: AppColor.redColor, width: 2)),
child: Column(
children: [
Text(
'${'Time to Passenger is'.tr} ${res['DriverIsGoingToPassenger']}',
style: AppStyle.title,
),
),
),
const SizedBox(
height: 10,
),
Container(
width: Get.width * .8,
decoration: BoxDecoration(
border: Border.all(
color: AppColor.yellowColor, width: 2)),
child: Center(
child: Text(
'${'Status is'.tr} ${res['status']}',
Text(
'${'TimeStart is'.tr} ${res['rideTimeStart']}',
style: AppStyle.title,
),
Text(
'${'Time Finish is'.tr} ${res['rideTimeFinish']}',
style: AppStyle.title,
),
],
),
),
const SizedBox(
height: 10,
),
Container(
width: Get.width * .8,
decoration: BoxDecoration(
border: Border.all(
color: AppColor.greenColor, width: 2)),
child: Center(
child: Text(
'${'Passenger Name is'.tr} ${res['first_name']} ${res['last_name']} ',
style: AppStyle.title,
),
),
],
),
));
),
const SizedBox(
height: 10,
),
Container(
width: Get.width * .8,
decoration: BoxDecoration(
border: Border.all(
color: AppColor.yellowColor, width: 2)),
child: Center(
child: Text(
'${'Status is'.tr} ${res['status']}',
style: AppStyle.title,
),
),
),
],
),
),
);
})
],
isleading: true,