9/8/1-captin
This commit is contained in:
@@ -130,10 +130,11 @@ class MapController extends GetxController {
|
||||
print('rideConfirm= $rideConfirm');
|
||||
|
||||
await CRUD().post(link: AppLink.addRides, payload: {
|
||||
"start_location":
|
||||
'${data[0]["start_location"]['lat']},${data[0]["start_location"]['lng']}',
|
||||
"end_location":
|
||||
'${data[0]["end_location"]['lat']},${data[0]["end_location"]['lng']}',
|
||||
"start_location": '${data[0]['start_address']}',
|
||||
|
||||
// '${data[0]["start_location"]['lat']},${data[0]["start_location"]['lng']}',
|
||||
"end_location": '${data[0]['end_address']}',
|
||||
// '${data[0]["end_location"]['lat']},${data[0]["end_location"]['lng']}',
|
||||
"date": DateTime.now().toString(),
|
||||
"time": DateTime.now().toString(),
|
||||
"endtime": durationToAdd.toString(),
|
||||
@@ -147,13 +148,16 @@ class MapController extends GetxController {
|
||||
}).then((value) {
|
||||
// print(jsonDecode(value)['message']);
|
||||
List<String> body = [
|
||||
// '${data[0]['start_address']}',
|
||||
// '${data[0]['end_address']}',
|
||||
'${data[0]["start_location"]['lat']},${data[0]["start_location"]['lng']}',
|
||||
'${data[0]["end_location"]['lat']},${data[0]["end_location"]['lng']}',
|
||||
totalPassenger.toString(),
|
||||
totalDriver.toString(),
|
||||
duration.toString(),
|
||||
distance.toString(),
|
||||
dataCarsLocationByPassenger['message'][0]['id'].toString()
|
||||
dataCarsLocationByPassenger['message'][0]['id'].toString(),
|
||||
box.read(BoxName.pasengerID).toString()
|
||||
];
|
||||
FirebasMessagesController().sendNotificationDriverId(
|
||||
'Order',
|
||||
@@ -165,7 +169,7 @@ class MapController extends GetxController {
|
||||
body[4],
|
||||
body[5],
|
||||
body[6],
|
||||
|
||||
body[7],
|
||||
box.read(BoxName.tokenFCM).toString(), //TODO change to Driver
|
||||
);
|
||||
});
|
||||
@@ -307,7 +311,7 @@ class MapController extends GetxController {
|
||||
}
|
||||
|
||||
// Configure location accuracy
|
||||
// LocationAccuracy desiredAccuracy = LocationAccuracy.high;
|
||||
LocationAccuracy desiredAccuracy = LocationAccuracy.high;
|
||||
|
||||
// Get the current location
|
||||
LocationData _locationData = await location.getLocation();
|
||||
@@ -808,8 +812,8 @@ class MapController extends GetxController {
|
||||
@override
|
||||
void onInit() async {
|
||||
await getLocation();
|
||||
// await getCarsLocationByPassenger();
|
||||
// getNearestDriverByPassengerLocation();
|
||||
await getCarsLocationByPassenger();
|
||||
getNearestDriverByPassengerLocation();
|
||||
addCustomPicker();
|
||||
addCustomCarIcon();
|
||||
startMarkerReloading();
|
||||
@@ -819,7 +823,7 @@ class MapController extends GetxController {
|
||||
}
|
||||
|
||||
class CarLocation {
|
||||
final int id;
|
||||
final String id;
|
||||
final double latitude;
|
||||
final double longitude;
|
||||
final double distance;
|
||||
|
||||
@@ -28,7 +28,7 @@ class OrderHistoryController extends GetxController {
|
||||
var jsonDecoded = jsonDecode(res);
|
||||
|
||||
orderHistoryListPassenger = jsonDecoded['data'];
|
||||
print(orderHistoryListPassenger);
|
||||
// print(orderHistoryListPassenger);
|
||||
isloading = false;
|
||||
update();
|
||||
}
|
||||
|
||||
32
lib/controller/home/profile/promos_controller.dart
Normal file
32
lib/controller/home/profile/promos_controller.dart
Normal file
@@ -0,0 +1,32 @@
|
||||
import 'dart:convert';
|
||||
|
||||
import 'package:get/get.dart';
|
||||
import 'package:ride/constant/links.dart';
|
||||
import 'package:ride/controller/functions/crud.dart';
|
||||
|
||||
class PromosController extends GetxController {
|
||||
List<dynamic> promoList = [];
|
||||
bool isloading = true;
|
||||
|
||||
@override
|
||||
void onInit() {
|
||||
getPromoBytody();
|
||||
super.onInit();
|
||||
}
|
||||
|
||||
Future getPromoBytody() async {
|
||||
var res = await CRUD().get(link: AppLink.getPromoBytody, payload: {});
|
||||
if (res.toString() == 'failure') {
|
||||
Get.snackbar('failure', 'message');
|
||||
isloading = false;
|
||||
update();
|
||||
} else {
|
||||
var jsonDecoded = jsonDecode(res);
|
||||
|
||||
promoList = jsonDecoded['message'];
|
||||
print(promoList);
|
||||
isloading = false;
|
||||
update();
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user