4/12/7
This commit is contained in:
@@ -1,8 +1,11 @@
|
||||
import 'package:SEFER/controller/home/map_passenger_controller.dart';
|
||||
import 'package:SEFER/main.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:SEFER/constant/style.dart';
|
||||
import 'package:SEFER/views/widgets/my_scafold.dart';
|
||||
import 'package:SEFER/views/widgets/mycircular.dart';
|
||||
import 'package:google_maps_flutter/google_maps_flutter.dart';
|
||||
|
||||
import '../../../constant/colors.dart';
|
||||
import '../../../controller/functions/launch.dart';
|
||||
@@ -23,80 +26,106 @@ class OrderHistory extends StatelessWidget {
|
||||
GetBuilder<OrderHistoryController>(
|
||||
builder: (orderHistoryController) => orderHistoryController.isloading
|
||||
? const MyCircularProgressIndicator()
|
||||
: ListView.builder(
|
||||
itemCount:
|
||||
orderHistoryController.orderHistoryListPassenger.length,
|
||||
itemBuilder: (BuildContext context, int index) {
|
||||
final rides =
|
||||
orderHistoryController.orderHistoryListPassenger[index];
|
||||
return Padding(
|
||||
padding: const EdgeInsets.all(8.0),
|
||||
child: Container(
|
||||
decoration: const BoxDecoration(
|
||||
borderRadius: BorderRadius.all(Radius.circular(12)),
|
||||
color: AppColor.secondaryColor,
|
||||
boxShadow: [
|
||||
BoxShadow(
|
||||
color: AppColor.accentColor,
|
||||
offset: Offset(-3, -3),
|
||||
blurRadius: 0,
|
||||
spreadRadius: 0,
|
||||
blurStyle: BlurStyle.outer),
|
||||
BoxShadow(
|
||||
color: AppColor.accentColor,
|
||||
offset: Offset(3, 3),
|
||||
blurRadius: 0,
|
||||
spreadRadius: 0,
|
||||
blurStyle: BlurStyle.outer)
|
||||
]),
|
||||
child: Padding(
|
||||
: orderHistoryController.orderHistoryListPassenger.isEmpty
|
||||
? Center(
|
||||
child: Text(
|
||||
'No trip yet found'.tr,
|
||||
style: AppStyle.headTitle2,
|
||||
),
|
||||
)
|
||||
: ListView.builder(
|
||||
itemCount: orderHistoryController
|
||||
.orderHistoryListPassenger.length,
|
||||
itemBuilder: (BuildContext context, int index) {
|
||||
final rides = orderHistoryController
|
||||
.orderHistoryListPassenger[index];
|
||||
return Padding(
|
||||
padding: const EdgeInsets.all(8.0),
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
InkWell(
|
||||
onTap: () {
|
||||
String mapUrl =
|
||||
'https://www.google.com/maps/dir/${rides['start_location']}/${rides['end_location']}/';
|
||||
// print(mapUrl);
|
||||
showInBrowser(mapUrl);
|
||||
},
|
||||
child: Text(
|
||||
'Click here to Show it in Map'.tr,
|
||||
style: AppStyle.title,
|
||||
),
|
||||
),
|
||||
Column(
|
||||
child: Container(
|
||||
decoration: AppStyle.boxDecoration1,
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.all(8.0),
|
||||
child: Row(
|
||||
mainAxisAlignment:
|
||||
MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
Text(
|
||||
rides['date'],
|
||||
style: AppStyle.subtitle,
|
||||
InkWell(
|
||||
onTap: () {
|
||||
String mapUrl =
|
||||
'https://www.google.com/maps/dir/${rides['start_location']}/${rides['end_location']}/';
|
||||
// print(mapUrl);
|
||||
showInBrowser(mapUrl);
|
||||
},
|
||||
child: SizedBox(
|
||||
height: Get.height * .2,
|
||||
width: Get.width * .75,
|
||||
child: GoogleMap(
|
||||
initialCameraPosition: CameraPosition(
|
||||
target: Get.find<
|
||||
MapPassengerController>()
|
||||
.passengerLocation, // Assuming passenger location is available
|
||||
zoom: 15,
|
||||
),
|
||||
polylines: {
|
||||
Polyline(
|
||||
zIndex: 2,
|
||||
consumeTapEvents: true,
|
||||
geodesic: true,
|
||||
endCap: Cap.buttCap,
|
||||
startCap: Cap.buttCap,
|
||||
visible: true,
|
||||
polylineId:
|
||||
const PolylineId('route'),
|
||||
points: [
|
||||
LatLng(
|
||||
rides['start_location']
|
||||
['latitude'],
|
||||
rides['start_location']
|
||||
['longitude']),
|
||||
LatLng(
|
||||
rides['end_location']
|
||||
['latitude'],
|
||||
rides['end_location']
|
||||
['longitude']),
|
||||
],
|
||||
color: AppColor.primaryColor,
|
||||
width: 5,
|
||||
),
|
||||
},
|
||||
),
|
||||
),
|
||||
),
|
||||
Text(
|
||||
rides['time'],
|
||||
style: AppStyle.subtitle,
|
||||
),
|
||||
Text(
|
||||
rides['status'],
|
||||
style: rides['status'] != 'Canceled'.tr
|
||||
? AppStyle.subtitle.copyWith(
|
||||
color: AppColor.greenColor)
|
||||
: AppStyle.subtitle
|
||||
.copyWith(color: AppColor.redColor),
|
||||
),
|
||||
Text(
|
||||
'${'Price is'.tr} ${rides['price']}',
|
||||
style: AppStyle.subtitle,
|
||||
Column(
|
||||
children: [
|
||||
Text(
|
||||
rides['date'],
|
||||
style: AppStyle.subtitle,
|
||||
),
|
||||
Text(
|
||||
rides['time'],
|
||||
style: AppStyle.subtitle,
|
||||
),
|
||||
Text(
|
||||
rides['status'],
|
||||
style: rides['status'] != 'Canceled'.tr
|
||||
? AppStyle.subtitle.copyWith(
|
||||
color: AppColor.greenColor)
|
||||
: AppStyle.subtitle.copyWith(
|
||||
color: AppColor.redColor),
|
||||
),
|
||||
Text(
|
||||
'${'Price is'.tr} ${rides['price']}',
|
||||
style: AppStyle.subtitle,
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
},
|
||||
),
|
||||
);
|
||||
},
|
||||
),
|
||||
)
|
||||
],
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user