9/27/1
This commit is contained in:
@@ -1,10 +1,14 @@
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:ride/constant/box_name.dart';
|
||||
import 'package:ride/constant/colors.dart';
|
||||
import 'package:ride/constant/style.dart';
|
||||
import 'package:ride/constant/table_names.dart';
|
||||
import 'package:ride/controller/home/captin/home_captain_controller.dart';
|
||||
import 'package:ride/controller/home/captin/order_request_controller.dart';
|
||||
import 'package:ride/main.dart';
|
||||
import 'package:ride/views/widgets/circle_container.dart';
|
||||
|
||||
import '../../../controller/functions/location_controller.dart';
|
||||
import '../../../controller/home/captin/widget/connect.dart';
|
||||
@@ -15,7 +19,8 @@ class HomeCaptain extends StatelessWidget {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
Get.put(LocationController());
|
||||
|
||||
final OrderRequestController orderRequestController =
|
||||
Get.put(OrderRequestController());
|
||||
Get.put(HomeCaptainController());
|
||||
return Scaffold(
|
||||
appBar: AppBar(
|
||||
@@ -31,8 +36,21 @@ class HomeCaptain extends StatelessWidget {
|
||||
: const SizedBox(),
|
||||
),
|
||||
IconButton(
|
||||
onPressed: () => box.remove(BoxName.periods),
|
||||
icon: Icon(Icons.remove))
|
||||
// onPressed: () => box.remove(BoxName.periods),
|
||||
onPressed: () => sql.deleteAllData(TableName.driverOrdersRefuse),
|
||||
icon: const Icon(Icons.remove)),
|
||||
GetBuilder<OrderRequestController>(
|
||||
builder: (orderRequestController) => IconButton(
|
||||
onPressed: () =>
|
||||
orderRequestController.getRefusedOrderByCaptain(),
|
||||
icon: const Icon(Icons.get_app)),
|
||||
),
|
||||
GetBuilder<OrderRequestController>(
|
||||
builder: (orderRequestController) => MyCircleContainer(
|
||||
child: Text(
|
||||
orderRequestController.countRefuse.toString(),
|
||||
style: AppStyle.title,
|
||||
)))
|
||||
],
|
||||
),
|
||||
drawer: const Drawer(),
|
||||
@@ -94,7 +112,7 @@ class HomeCaptain extends StatelessWidget {
|
||||
),
|
||||
],
|
||||
),
|
||||
)
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
|
||||
@@ -22,6 +22,7 @@ import 'map_widget.dart/map_menu_widget.dart';
|
||||
import 'map_widget.dart/menu_map_page.dart';
|
||||
import 'map_widget.dart/payment_method.page.dart';
|
||||
import 'map_widget.dart/timer_for_cancell_trip_from_passenger.dart';
|
||||
import 'map_widget.dart/timer_to_passenger_from_driver.dart';
|
||||
|
||||
class MapPage extends StatelessWidget {
|
||||
const MapPage({super.key});
|
||||
@@ -64,7 +65,7 @@ class MapPage extends StatelessWidget {
|
||||
child: Stack(
|
||||
children: [
|
||||
GetBuilder<MapController>(
|
||||
builder: (controller) => controller.isloading
|
||||
builder: (controller) => controller.isLoading
|
||||
? const MyCircularProgressIndicator()
|
||||
: GoogleMap(
|
||||
onMapCreated: controller.onMapCreated,
|
||||
@@ -83,11 +84,11 @@ class MapPage extends StatelessWidget {
|
||||
confirm: MyElevatedButton(
|
||||
title: 'Ok'.tr,
|
||||
onPressed: () async {
|
||||
controller.clearpolyline();
|
||||
controller.clearPolyline();
|
||||
if (controller.dataCarsLocationByPassenger !=
|
||||
null) {
|
||||
await controller.getMap(
|
||||
'${controller.mylocation.latitude},${controller.mylocation.longitude}',
|
||||
'${controller.myLocation.latitude},${controller.myLocation.longitude}',
|
||||
'${argument.latitude.toString()},${argument.longitude.toString()}');
|
||||
|
||||
Get.back();
|
||||
@@ -182,11 +183,11 @@ class MapPage extends StatelessWidget {
|
||||
onTap: (argument) {
|
||||
controller.hidePlaces();
|
||||
|
||||
controller.changeButtomSheetShown();
|
||||
controller.changeBottomSheetShown();
|
||||
// controller.bottomSheet();
|
||||
},
|
||||
initialCameraPosition: CameraPosition(
|
||||
target: controller.mylocation,
|
||||
target: controller.myLocation,
|
||||
zoom: 15,
|
||||
),
|
||||
markers: {
|
||||
@@ -206,22 +207,27 @@ class MapPage extends StatelessWidget {
|
||||
markerId: MarkerId(carLocation.toString())),
|
||||
Marker(
|
||||
markerId: MarkerId('MyLocation'.tr),
|
||||
position: controller.mylocation,
|
||||
position: controller.myLocation,
|
||||
draggable: true,
|
||||
icon: controller.markerIcon,
|
||||
infoWindow: InfoWindow(
|
||||
title: 'Time',
|
||||
snippet: controller.durationFromDriverToPassenger
|
||||
.toString(),
|
||||
),
|
||||
onDragEnd: (value) {
|
||||
print(value);
|
||||
},
|
||||
infoWindow: InfoWindow(title: 'my location'.tr),
|
||||
),
|
||||
Marker(
|
||||
markerId: MarkerId('Target'.tr),
|
||||
position: controller.mydestination,
|
||||
draggable: true,
|
||||
onDragEnd: (v) {
|
||||
print(v);
|
||||
},
|
||||
// infoWindow: InfoWindow(title: 'my location'.tr),
|
||||
),
|
||||
// Marker(
|
||||
// markerId: MarkerId('Target'.tr),
|
||||
// position: controller.myDestination,
|
||||
// draggable: true,
|
||||
// onDragEnd: (v) {
|
||||
// print(v);
|
||||
// },
|
||||
// ),
|
||||
},
|
||||
polylines: {
|
||||
Polyline(
|
||||
@@ -261,6 +267,18 @@ class MapPage extends StatelessWidget {
|
||||
// radius: 60,
|
||||
// fillColor: AppColor.primaryColor,)
|
||||
// },
|
||||
|
||||
circles: <Circle>{
|
||||
Circle(
|
||||
circleId: const CircleId('circle_id'),
|
||||
center: controller.myLocation,
|
||||
radius: 100,
|
||||
fillColor: Colors.blue.withOpacity(0.3),
|
||||
strokeColor: Colors.blue,
|
||||
strokeWidth: 2,
|
||||
),
|
||||
},
|
||||
|
||||
mapType: controller.mapType
|
||||
? MapType.satellite
|
||||
: MapType.normal,
|
||||
@@ -268,11 +286,11 @@ class MapPage extends StatelessWidget {
|
||||
// liteModeEnabled: true, tiltGesturesEnabled: false,
|
||||
|
||||
// indoorViewEnabled: true,
|
||||
trafficEnabled: controller.mapTraficON,
|
||||
trafficEnabled: controller.mapTrafficON,
|
||||
buildingsEnabled: true,
|
||||
mapToolbarEnabled: true,
|
||||
onCameraMove: (position) {
|
||||
controller.newMylocation = position.target;
|
||||
controller.newMyLocation = position.target;
|
||||
// print('my' + controller.mylocation.toString());
|
||||
// print('new' + controller.newMylocation.toString());
|
||||
},
|
||||
@@ -292,34 +310,9 @@ class MapPage extends StatelessWidget {
|
||||
const CancelRidePageShow(),
|
||||
const CashConfirmPageShown(),
|
||||
const PaymentMethodPage(),
|
||||
timerForCancellTripFromPassenger(),
|
||||
const DriverTimeArrivePassengerPage(),
|
||||
GetBuilder<MapController>(builder: (controller) {
|
||||
if (controller.remainingTime == 0
|
||||
//&&
|
||||
// controller.newTime1.isBefore(
|
||||
// controller.currentTime.add(const Duration(minutes: 2)),
|
||||
// )
|
||||
) {
|
||||
return Center(
|
||||
child: Container(
|
||||
decoration: AppStyle.boxDecoration,
|
||||
// height: 100,
|
||||
// width: 100,
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.all(8.0),
|
||||
child: Text(
|
||||
'You Can cancel Ride After Captain did not come in the time'
|
||||
.tr,
|
||||
style: AppStyle.subtitle,
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
} else {
|
||||
return const SizedBox();
|
||||
}
|
||||
}),
|
||||
timerForCancelTripFromPassenger(),
|
||||
// const DriverTimeArrivePassengerPage(),
|
||||
const TimerToPassengerFromDriver(),
|
||||
],
|
||||
),
|
||||
),
|
||||
@@ -336,7 +329,8 @@ class CancelRidePageShow extends StatelessWidget {
|
||||
Widget build(BuildContext context) {
|
||||
return GetBuilder<MapController>(
|
||||
builder: (controller) =>
|
||||
controller.data.isNotEmpty && controller.remainingTime > 0
|
||||
(controller.data.isNotEmpty && controller.remainingTime > 0) ||
|
||||
controller.timeToPassengerFromDriverAfterApplied == 0
|
||||
? Positioned.directional(
|
||||
end: 10,
|
||||
top: 55,
|
||||
|
||||
@@ -12,7 +12,7 @@ import '../../../controller/home/map_page_controller.dart';
|
||||
GetBuilder<MapController> buttomSheetMapPage() {
|
||||
Get.put(PaymentController());
|
||||
return GetBuilder<MapController>(
|
||||
builder: (controller) => controller.isButtomSheetShown
|
||||
builder: (controller) => controller.isBottomSheetShown
|
||||
? Positioned(
|
||||
left: 5,
|
||||
bottom: 0,
|
||||
@@ -23,7 +23,7 @@ GetBuilder<MapController> buttomSheetMapPage() {
|
||||
onEnd: () {
|
||||
controller.height = 250;
|
||||
},
|
||||
height: controller.heightButtomSheetShown,
|
||||
height: controller.heightBottomSheetShown,
|
||||
duration: const Duration(seconds: 2),
|
||||
child: Column(
|
||||
children: [
|
||||
@@ -283,7 +283,7 @@ GetBuilder<MapController> buttomSheetMapPage() {
|
||||
'Add Promo'.tr,
|
||||
onPressed:
|
||||
() async {
|
||||
controller.applyPromoCodetoPassenger();
|
||||
controller.applyPromoCodeToPassenger();
|
||||
},
|
||||
)
|
||||
],
|
||||
@@ -508,7 +508,7 @@ class Details extends StatelessWidget {
|
||||
style: AppStyle.title,
|
||||
),
|
||||
Text(
|
||||
'totaME ${controller.totaME.toStringAsFixed(2)} ',
|
||||
'totaME ${controller.totalME.toStringAsFixed(2)} ',
|
||||
style: AppStyle.title,
|
||||
),
|
||||
],
|
||||
|
||||
@@ -30,7 +30,7 @@ class DriverTimeArrivePassengerPage extends StatelessWidget {
|
||||
child: Column(
|
||||
children: [
|
||||
Text(
|
||||
controller.duratioByPassenger.toString() +
|
||||
controller.durationByPassenger.toString() +
|
||||
' to arrive you.'.tr,
|
||||
style: AppStyle.title,
|
||||
),
|
||||
|
||||
@@ -63,10 +63,10 @@ GetBuilder<MapController> formSearchPlaces() {
|
||||
confirm: MyElevatedButton(
|
||||
title: 'Confirm'.tr,
|
||||
onPressed: () async {
|
||||
controller.clearpolyline();
|
||||
controller.clearPolyline();
|
||||
controller.data = [];
|
||||
await controller.getMap(
|
||||
'${controller.mylocation.latitude.toString()},${controller.mylocation.longitude.toString()}',
|
||||
'${controller.myLocation.latitude.toString()},${controller.myLocation.longitude.toString()}',
|
||||
"${res['geometry']['location']['lat']},${res['geometry']['location']['lng']}");
|
||||
controller.places = [];
|
||||
controller.placeController.clear();
|
||||
|
||||
@@ -13,7 +13,7 @@ GetBuilder<MapController> leftMainMenuIcons() {
|
||||
children: [
|
||||
AnimatedContainer(
|
||||
duration: const Duration(microseconds: 200),
|
||||
width: controller.widthMapTypeAndTrafic,
|
||||
width: controller.widthMapTypeAndTraffic,
|
||||
decoration: BoxDecoration(
|
||||
border: Border.all(),
|
||||
color: AppColor.secondaryColor,
|
||||
@@ -34,7 +34,7 @@ GetBuilder<MapController> leftMainMenuIcons() {
|
||||
),
|
||||
AnimatedContainer(
|
||||
duration: const Duration(microseconds: 200),
|
||||
width: controller.widthMapTypeAndTrafic,
|
||||
width: controller.widthMapTypeAndTraffic,
|
||||
decoration: BoxDecoration(
|
||||
color: AppColor.secondaryColor,
|
||||
border: Border.all(),
|
||||
|
||||
@@ -104,7 +104,7 @@ class MainBottomMenuMap extends StatelessWidget {
|
||||
child: Text(
|
||||
(controller.nearestCar != null
|
||||
? controller
|
||||
.duratioByPassenger
|
||||
.durationByPassenger
|
||||
.toString()
|
||||
: 'N/A')),
|
||||
),
|
||||
@@ -195,7 +195,7 @@ class FavioratePlacesDialogu extends StatelessWidget {
|
||||
TextButton(
|
||||
onPressed: () async {
|
||||
await controller.getMap(
|
||||
'${controller.mylocation.latitude},${controller.mylocation.longitude}',
|
||||
'${controller.myLocation.latitude},${controller.myLocation.longitude}',
|
||||
'${favoritePlaces[index]['latitude']},${favoritePlaces[index]['longitude']}',
|
||||
);
|
||||
// controller.changePickerShown();
|
||||
|
||||
@@ -135,13 +135,13 @@ class PickerAnimtionContainerFormPlaces extends StatelessWidget {
|
||||
onPressed: () async {
|
||||
await controller
|
||||
.getMap(
|
||||
'${controller.mylocation.latitude},${controller.mylocation.longitude}',
|
||||
'${controller.myLocation.latitude},${controller.myLocation.longitude}',
|
||||
'${favoritePlaces[index]['latitude']},${favoritePlaces[index]['longitude']}',
|
||||
);
|
||||
controller
|
||||
.changePickerShown();
|
||||
controller
|
||||
.changeButtomSheetShown();
|
||||
.changeBottomSheetShown();
|
||||
controller
|
||||
.bottomSheet();
|
||||
Get.back();
|
||||
@@ -193,11 +193,11 @@ class PickerAnimtionContainerFormPlaces extends StatelessWidget {
|
||||
title: 'Go to this Target'.tr,
|
||||
onPressed: () async {
|
||||
await controller.getMap(
|
||||
'${controller.mylocation.latitude},${controller.mylocation.longitude}',
|
||||
'${controller.newMylocation.latitude},${controller.newMylocation.longitude}',
|
||||
'${controller.myLocation.latitude},${controller.myLocation.longitude}',
|
||||
'${controller.newMyLocation.latitude},${controller.newMyLocation.longitude}',
|
||||
);
|
||||
controller.changePickerShown();
|
||||
controller.changeButtomSheetShown();
|
||||
controller.changeBottomSheetShown();
|
||||
controller.bottomSheet();
|
||||
// await sql
|
||||
// .getAllData(TableName.placesFavorite)
|
||||
|
||||
@@ -1,10 +1,11 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:ride/views/home/map_page.dart';
|
||||
|
||||
import '../../../constant/style.dart';
|
||||
import '../../../controller/home/map_page_controller.dart';
|
||||
|
||||
GetBuilder<MapController> timerForCancellTripFromPassenger() {
|
||||
GetBuilder<MapController> timerForCancelTripFromPassenger() {
|
||||
return GetBuilder<MapController>(
|
||||
builder: (controller) {
|
||||
final isNearEnd =
|
||||
|
||||
@@ -0,0 +1,70 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:get/get.dart';
|
||||
|
||||
import '../../../constant/colors.dart';
|
||||
import '../../../constant/style.dart';
|
||||
import '../../../controller/home/map_page_controller.dart';
|
||||
|
||||
class TimerToPassengerFromDriver extends StatelessWidget {
|
||||
const TimerToPassengerFromDriver({
|
||||
super.key,
|
||||
});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return GetBuilder<MapController>(builder: (controller) {
|
||||
if (controller.remainingTime == 0 &&
|
||||
controller.timeToPassengerFromDriverAfterApplied > 60) {
|
||||
return Positioned(
|
||||
left: 10,
|
||||
right: 10,
|
||||
bottom: Get.height * .35,
|
||||
child: Container(
|
||||
decoration: AppStyle.boxDecoration,
|
||||
height: 140,
|
||||
// width: 100,
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.all(8.0),
|
||||
child: Column(
|
||||
children: [
|
||||
Text(
|
||||
'You Can cancel Ride After Captain did not come in the time'
|
||||
.tr,
|
||||
style: AppStyle.title,
|
||||
),
|
||||
Stack(
|
||||
children: [
|
||||
LinearProgressIndicator(
|
||||
backgroundColor: AppColor.accentColor,
|
||||
color:
|
||||
controller.timeToPassengerFromDriverAfterApplied <
|
||||
60
|
||||
? AppColor.redColor
|
||||
: AppColor.greenColor,
|
||||
minHeight: 50,
|
||||
borderRadius: BorderRadius.circular(15),
|
||||
value: controller
|
||||
.progressTimerToPassengerFromDriverAfterApplied
|
||||
.toDouble(),
|
||||
),
|
||||
Center(
|
||||
child: Text(
|
||||
controller
|
||||
.remainingTimeToPassengerFromDriverAfterApplied
|
||||
.toString(),
|
||||
style: AppStyle.title,
|
||||
),
|
||||
)
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
} else {
|
||||
return const SizedBox();
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user