3/27/3
This commit is contained in:
@@ -1,98 +0,0 @@
|
||||
import 'package:SEFER/constant/colors.dart';
|
||||
import 'package:SEFER/constant/style.dart';
|
||||
import 'package:SEFER/controller/firebase/firbase_messge.dart';
|
||||
import 'package:SEFER/controller/home/captin/map_driver_controller.dart';
|
||||
import 'package:SEFER/views/home/Captin/home_captain/call_controller.dart';
|
||||
import 'package:SEFER/views/widgets/my_scafold.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:SEFER/controller/home/captin/home_captain_controller.dart';
|
||||
|
||||
import '../../../../constant/box_name.dart';
|
||||
import '../../../../main.dart';
|
||||
|
||||
class CallPage extends StatelessWidget {
|
||||
const CallPage({super.key});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return MyScafolld(title: 'Call Page', isleading: true, body: [callPage()]);
|
||||
}
|
||||
}
|
||||
|
||||
GetBuilder<HomeCaptainController> callPage() {
|
||||
CallController callController = Get.put(CallController());
|
||||
Get.put(MapDriverController());
|
||||
callController.initAgoraFull();
|
||||
return GetBuilder<HomeCaptainController>(
|
||||
builder: (controller) => Positioned(
|
||||
top: Get.height * .2,
|
||||
child: Container(
|
||||
height: 100, width: Get.width,
|
||||
decoration: AppStyle.boxDecoration,
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
|
||||
children: [
|
||||
GestureDetector(
|
||||
onTap: () async {
|
||||
// await callController.initAgoraFull();
|
||||
// callController.join();
|
||||
FirebaseMessagesController().sendNotificationToPassengerToken(
|
||||
'Call Income',
|
||||
'You have call from driver ${box.read(BoxName.nameDriver)}',
|
||||
Get.find<MapDriverController>().tokenPassenger,
|
||||
[
|
||||
callController.token,
|
||||
callController.channelName,
|
||||
callController.uid.toString(),
|
||||
callController.remoteUid.toString(),
|
||||
],
|
||||
);
|
||||
callController.join();
|
||||
},
|
||||
child: Container(
|
||||
width: 50,
|
||||
height: 50,
|
||||
decoration: const BoxDecoration(
|
||||
shape: BoxShape.circle, color: AppColor.greenColor),
|
||||
child: const Icon(
|
||||
Icons.phone,
|
||||
size: 35,
|
||||
color: AppColor.secondaryColor,
|
||||
)),
|
||||
),
|
||||
Column(
|
||||
children: [
|
||||
Text(callController.status),
|
||||
Text(Get.find<MapDriverController>().passengerName.toString()),
|
||||
],
|
||||
),
|
||||
GestureDetector(
|
||||
onTap: () async {
|
||||
FirebaseMessagesController().sendNotificationToPassengerToken(
|
||||
'Call End'.tr,
|
||||
'Call End',
|
||||
Get.find<MapDriverController>().tokenPassenger,
|
||||
[],
|
||||
);
|
||||
callController.leave();
|
||||
Get.back();
|
||||
},
|
||||
child: Container(
|
||||
width: 50,
|
||||
height: 50,
|
||||
decoration: const BoxDecoration(
|
||||
shape: BoxShape.circle, color: AppColor.redColor),
|
||||
child: const Icon(
|
||||
Icons.phone_disabled_sharp,
|
||||
size: 35,
|
||||
color: AppColor.secondaryColor,
|
||||
)),
|
||||
)
|
||||
],
|
||||
),
|
||||
// ignore: prefer_const_constructors
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
@@ -1,77 +0,0 @@
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:SEFER/controller/home/payment/captain_wallet_controller.dart';
|
||||
|
||||
import '../../../../constant/style.dart';
|
||||
import '../../../../views/widgets/elevated_btn.dart';
|
||||
import '../home_captain_controller.dart';
|
||||
import '../order_request_controller.dart';
|
||||
|
||||
class ConnectWidget extends StatelessWidget {
|
||||
const ConnectWidget({
|
||||
super.key,
|
||||
});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final OrderRequestController orderRequestController =
|
||||
Get.put(OrderRequestController());
|
||||
CaptainWalletController captainWalletController =
|
||||
Get.put(CaptainWalletController());
|
||||
|
||||
captainWalletController.getCaptainWalletFromBuyPoints();
|
||||
return Center(
|
||||
child: GetBuilder<HomeCaptainController>(
|
||||
builder: (homeCaptainController) => int.parse(
|
||||
orderRequestController.countRefuse) >
|
||||
3 ||
|
||||
double.parse(captainWalletController.totalPoints) < -300
|
||||
? CupertinoButton(
|
||||
onPressed: () {
|
||||
Get.defaultDialog(
|
||||
// backgroundColor: CupertinoColors.destructiveRed,
|
||||
barrierDismissible: false,
|
||||
title: double.parse(captainWalletController.totalPoints) <
|
||||
-300
|
||||
? 'You dont have Points'.tr
|
||||
: 'You Are Stopped For this Day !'.tr,
|
||||
titleStyle: AppStyle.title,
|
||||
content: Text(
|
||||
double.parse(captainWalletController.totalPoints) < -300
|
||||
? 'You must be recharge your Account'.tr
|
||||
: 'You Refused 3 Rides this Day that is the reason \nSee you Tomorrow!'
|
||||
.tr,
|
||||
style: AppStyle.title,
|
||||
),
|
||||
confirm:
|
||||
double.parse(captainWalletController.totalPoints) <
|
||||
-300
|
||||
? MyElevatedButton(
|
||||
title: 'Recharge my Account'.tr,
|
||||
onPressed: () {
|
||||
homeCaptainController
|
||||
.goToWalletFromConnect();
|
||||
})
|
||||
: MyElevatedButton(
|
||||
title: 'Ok , See you Tomorrow'.tr,
|
||||
onPressed: () {
|
||||
Get.back();
|
||||
Get.back();
|
||||
}));
|
||||
},
|
||||
color: CupertinoColors.destructiveRed,
|
||||
child: Text('You are Stopped'.tr),
|
||||
)
|
||||
: CupertinoButton(
|
||||
onPressed: homeCaptainController.onButtonSelected,
|
||||
color: homeCaptainController.isActive
|
||||
? CupertinoColors.activeGreen
|
||||
: CupertinoColors.inactiveGray,
|
||||
child: Text(homeCaptainController.isActive
|
||||
? 'Connected'.tr
|
||||
: 'Not Connected'.tr),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -1,121 +0,0 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_font_icons/flutter_font_icons.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:SEFER/controller/home/captin/home_captain_controller.dart';
|
||||
import 'package:SEFER/controller/home/captin/widget/zones_controller.dart';
|
||||
import 'package:google_maps_flutter/google_maps_flutter.dart';
|
||||
|
||||
import '../../../../constant/colors.dart';
|
||||
import '../../../../views/Rate/ride_calculate_driver.dart';
|
||||
import '../../../functions/location_controller.dart';
|
||||
|
||||
GetBuilder<HomeCaptainController> leftMainMenuCaptainIcons() {
|
||||
return GetBuilder<HomeCaptainController>(
|
||||
builder: (controller) => Positioned(
|
||||
bottom: Get.height * .17,
|
||||
left: 6,
|
||||
child: Column(
|
||||
children: [
|
||||
AnimatedContainer(
|
||||
duration: const Duration(microseconds: 200),
|
||||
width: controller.widthMapTypeAndTraffic,
|
||||
decoration: BoxDecoration(
|
||||
border: Border.all(),
|
||||
color: AppColor.secondaryColor,
|
||||
borderRadius: BorderRadius.circular(15)),
|
||||
child: IconButton(
|
||||
onPressed: () {
|
||||
ZonesController mapDriverController =
|
||||
Get.put(ZonesController());
|
||||
mapDriverController.getJsonOfZones();
|
||||
},
|
||||
icon: const Icon(
|
||||
FontAwesome.map_signs,
|
||||
size: 24,
|
||||
color: Colors.black,
|
||||
)),
|
||||
),
|
||||
const SizedBox(
|
||||
height: 5,
|
||||
),
|
||||
AnimatedContainer(
|
||||
duration: const Duration(microseconds: 200),
|
||||
width: controller.widthMapTypeAndTraffic,
|
||||
decoration: BoxDecoration(
|
||||
border: Border.all(),
|
||||
color: AppColor.secondaryColor,
|
||||
borderRadius: BorderRadius.circular(15)),
|
||||
child: IconButton(
|
||||
onPressed: () {
|
||||
controller.changeMapType();
|
||||
// Toast.show(context, 'This is a toast message!');
|
||||
},
|
||||
icon: const Icon(
|
||||
Icons.satellite_alt,
|
||||
size: 29,
|
||||
),
|
||||
),
|
||||
),
|
||||
const SizedBox(
|
||||
height: 5,
|
||||
),
|
||||
AnimatedContainer(
|
||||
duration: const Duration(microseconds: 200),
|
||||
width: controller.widthMapTypeAndTraffic,
|
||||
decoration: BoxDecoration(
|
||||
color: AppColor.secondaryColor,
|
||||
border: Border.all(),
|
||||
borderRadius: BorderRadius.circular(15)),
|
||||
child: IconButton(
|
||||
onPressed: () {
|
||||
controller.changeMapTraffic();
|
||||
// Toast.show(context, 'This is a toast message!');
|
||||
},
|
||||
icon: const Icon(
|
||||
Icons.streetview_sharp,
|
||||
size: 29,
|
||||
),
|
||||
),
|
||||
),
|
||||
const SizedBox(
|
||||
height: 5,
|
||||
),
|
||||
AnimatedContainer(
|
||||
duration: const Duration(microseconds: 200),
|
||||
width: controller.widthMapTypeAndTraffic,
|
||||
decoration: BoxDecoration(
|
||||
color: AppColor.secondaryColor,
|
||||
border: Border.all(),
|
||||
borderRadius: BorderRadius.circular(15)),
|
||||
child: IconButton(
|
||||
onPressed: () {
|
||||
controller.mapHomeCaptaiController
|
||||
.animateCamera(CameraUpdate.newLatLng(LatLng(
|
||||
Get.find<LocationController>().myLocation.latitude,
|
||||
Get.find<LocationController>().myLocation.longitude,
|
||||
)));
|
||||
},
|
||||
icon: const Icon(
|
||||
Icons.location_on,
|
||||
size: 29,
|
||||
),
|
||||
),
|
||||
),
|
||||
AnimatedContainer(
|
||||
duration: const Duration(microseconds: 200),
|
||||
width: controller.widthMapTypeAndTraffic,
|
||||
decoration: BoxDecoration(
|
||||
color: AppColor.secondaryColor,
|
||||
border: Border.all(),
|
||||
borderRadius: BorderRadius.circular(15)),
|
||||
child: IconButton(
|
||||
onPressed: () {
|
||||
Get.to(() => RideCalculateDriver());
|
||||
},
|
||||
icon: const Icon(FontAwesome5.chart_bar),
|
||||
),
|
||||
),
|
||||
],
|
||||
)),
|
||||
);
|
||||
}
|
||||
@@ -1,73 +0,0 @@
|
||||
import 'dart:convert';
|
||||
import 'dart:math';
|
||||
|
||||
import 'package:get/get.dart';
|
||||
import 'package:google_maps_flutter/google_maps_flutter.dart';
|
||||
|
||||
class ZonesController extends GetxController {
|
||||
Map<String, List<LatLng>> generateZoneMap(
|
||||
LatLng southwest, LatLng southEast, LatLng northeast) {
|
||||
const double desiredZoneArea = 4; // in square kilometers
|
||||
|
||||
final double width = (southEast.longitude - southwest.longitude) * 100;
|
||||
final double height = (northeast.latitude - southEast.latitude) * 100;
|
||||
final double totalArea = width * height;
|
||||
print(width);
|
||||
print(height);
|
||||
|
||||
// final int numZones = (totalArea / desiredZoneArea).ceil();
|
||||
|
||||
final double zoneWidth = width / sqrt(desiredZoneArea);
|
||||
final double zoneHeight = height / sqrt(desiredZoneArea);
|
||||
final numRows =
|
||||
((northeast.latitude - southwest.latitude) / zoneHeight).ceil();
|
||||
final numCols =
|
||||
((southEast.longitude - southwest.longitude) / zoneWidth).ceil();
|
||||
print('zoneWidth = $zoneWidth');
|
||||
print('zoneHeight = $zoneHeight');
|
||||
List<String> zoneNames = [];
|
||||
List<LatLng> zoneCoordinates = [];
|
||||
|
||||
for (int row = 0; row < numRows; row++) {
|
||||
for (int col = 0; col < numCols; col++) {
|
||||
final double zoneSouthwestLat =
|
||||
southwest.latitude + (row * zoneHeight / 100);
|
||||
final double zoneSouthwestLng =
|
||||
southwest.longitude + (col * zoneWidth / 100);
|
||||
final double zoneNortheastLat = zoneSouthwestLat + zoneHeight / 100;
|
||||
final double zoneNortheastLng = zoneSouthwestLng + zoneWidth / 100;
|
||||
|
||||
LatLng zoneSouthwest = LatLng(zoneSouthwestLat, zoneSouthwestLng);
|
||||
LatLng zoneNortheast = LatLng(zoneNortheastLat, zoneNortheastLng);
|
||||
|
||||
String zoneName =
|
||||
'Zone${row + col}'; // Assign a unique name to each zone
|
||||
|
||||
zoneNames.add(zoneName);
|
||||
zoneCoordinates.add(zoneSouthwest);
|
||||
zoneCoordinates.add(zoneNortheast);
|
||||
}
|
||||
}
|
||||
|
||||
Map<String, List<LatLng>> zoneMap = {};
|
||||
for (int i = 0; i < zoneNames.length; i++) {
|
||||
zoneMap[zoneNames[i]] = [
|
||||
zoneCoordinates[i], // Southwest LatLng
|
||||
zoneCoordinates[i + 1], // Northeast LatLng
|
||||
];
|
||||
}
|
||||
|
||||
return zoneMap;
|
||||
}
|
||||
|
||||
void getJsonOfZones() {
|
||||
LatLng southwest = const LatLng(32.111107, 36.062222);
|
||||
LatLng southEast = const LatLng(32.108333, 36.101667);
|
||||
LatLng northeast = const LatLng(32.143889, 36.058889);
|
||||
Map<String, List<LatLng>> zoneMap =
|
||||
generateZoneMap(southwest, southEast, northeast);
|
||||
String jsonMap = json.encode(zoneMap);
|
||||
|
||||
print(jsonMap);
|
||||
}
|
||||
}
|
||||
@@ -839,6 +839,8 @@ class MapPassengerController extends GetxController {
|
||||
.toStringAsFixed(2)
|
||||
: '0',
|
||||
box.read(BoxName.email).toString(),
|
||||
startNameAddress,
|
||||
endNameAddress,
|
||||
];
|
||||
print(body);
|
||||
FirebaseMessagesController().sendNotificationToDriverMapPolyline(
|
||||
@@ -912,6 +914,8 @@ class MapPassengerController extends GetxController {
|
||||
.toStringAsFixed(2)
|
||||
: '0',
|
||||
box.read(BoxName.email).toString(),
|
||||
startNameAddress,
|
||||
endNameAddress,
|
||||
];
|
||||
print('driversToken');
|
||||
print(driversToken);
|
||||
@@ -1835,6 +1839,8 @@ class MapPassengerController extends GetxController {
|
||||
}
|
||||
|
||||
late LatLngBounds boundsData;
|
||||
late String startNameAddress;
|
||||
late String endNameAddress;
|
||||
getMap(String origin, destination) async {
|
||||
remainingTime = 25; //to make cancel every call
|
||||
await getCarsLocationByPassenger();
|
||||
@@ -1855,6 +1861,8 @@ class MapPassengerController extends GetxController {
|
||||
var response = await CRUD().getGoogleApi(link: url, payload: {});
|
||||
data = response['routes'][0]['legs'];
|
||||
// //print(data);
|
||||
startNameAddress = data[0]['start_address'];
|
||||
endNameAddress = data[0]['end_address'];
|
||||
isLoading = false;
|
||||
update();
|
||||
durationToRide = data[0]['duration']['value'];
|
||||
|
||||
Reference in New Issue
Block a user