This commit is contained in:
Hamza-Ayed
2023-08-18 22:59:16 +03:00
parent 6635a46933
commit 6a3865a3d1
12 changed files with 657 additions and 141 deletions

View File

@@ -5,11 +5,14 @@ import 'package:get/get.dart';
import 'package:google_maps_flutter/google_maps_flutter.dart';
import 'package:google_polyline_algorithm/google_polyline_algorithm.dart';
import 'package:location/location.dart';
import 'package:ride/constant/box_name.dart';
import 'package:ride/constant/credential.dart';
import 'package:ride/constant/links.dart';
import 'package:ride/controller/functions/crud.dart';
import 'package:ride/views/home/map_widget.dart/buttom_sheet_map_show.dart';
import 'package:ride/views/widgets/elevated_btn.dart';
import '../../main.dart';
import '../../models/model/locations.dart';
import '../firebase/firbase_messge.dart';
@@ -39,15 +42,32 @@ class MapController extends GetxController {
bool isPickerShown = false;
bool isButtomSheetShown = false;
bool mapType = false;
bool isCancelRidePageShown = false;
bool isCashConfirmPageShown = false;
bool isPaymentMethodPageShown = false;
bool isMainBottomMenuMap = true;
double heightButtomSheetShown = 240;
double heightButtomSheetShown = 300;
double cashConfirmPageShown = 250;
double paymentPageShown = 380;
late final LatLng southwest;
late final LatLng northeast;
List<CarLocationModel> carLocations = <CarLocationModel>[];
// final mainBottomMenuMap = GlobalKey<AnimatedContainer>();
void changeButtomSheetShown() {
isButtomSheetShown = !isButtomSheetShown;
heightButtomSheetShown = isButtomSheetShown == true ? 240 : 0;
heightButtomSheetShown = isButtomSheetShown == true ? 250 : 0;
update();
}
void changeCashConfirmPageShown() {
isCashConfirmPageShown = !isCashConfirmPageShown;
cashConfirmPageShown = isCashConfirmPageShown == true ? 250 : 0;
update();
}
void changePaymentMethodPageShown() {
isPaymentMethodPageShown = !isPaymentMethodPageShown;
paymentPageShown = isPaymentMethodPageShown == true ? Get.height * .6 : 0;
update();
}
@@ -57,6 +77,14 @@ class MapController extends GetxController {
update();
}
void changeCancelRidePageShow() {
// rideConfirm == true
// ?
isCancelRidePageShown = !isCancelRidePageShown;
// : cancelRide();
update();
}
void getDrawerMenu() {
heightMenuBool = !heightMenuBool;
heightMenu = heightMenuBool == true ? 100 : 0;
@@ -68,6 +96,36 @@ class MapController extends GetxController {
update();
}
int selectedReason = -1;
void selectReason(int index) {
selectedReason = index;
update();
}
bool rideConfirm = false;
void cancelRide() async {
if (rideConfirm == false) {
clearPlaces();
clearpolyline();
data = [];
changeCancelRidePageShow();
update();
} else {
clearPlaces();
clearpolyline();
data = [];
changeCancelRidePageShow();
await CRUD().post(link: AppLink.addCancelRide, payload: {
"driverID": 1,
"passengerID": box.read(BoxName.pasengerID).toString(),
"rideID": 222,
"note": "zxcz"
});
update();
}
}
void changePickerShown() {
isPickerShown = !isPickerShown;
heightPickerContainer = isPickerShown == true ? 150 : 90;