This commit is contained in:
Mohamed Nouffer
2022-05-24 20:43:41 +05:30
parent ee0440e6b6
commit 3cb7865d3b
60 changed files with 342 additions and 100 deletions

View File

@ -3,6 +3,7 @@ import 'dart:async';
import 'package:flutter/material.dart';
import 'package:flutter_map/flutter_map.dart';
import 'package:flutter_map/plugin_api.dart';
import 'package:flutter_polyline_points/flutter_polyline_points.dart';
import 'package:geojson/geojson.dart';
import 'package:get/get.dart';
import 'package:latlong2/latlong.dart';
@ -25,6 +26,7 @@ class IndexController extends GetxController {
List<Map<String, dynamic>> currentUser = <Map<String, dynamic>>[].obs;
List<dynamic> currentAction = <dynamic>[].obs;
List<PointLatLng> routePoints = <PointLatLng>[].obs;
var is_loading = false.obs;
@ -32,12 +34,14 @@ class IndexController extends GetxController {
var mode = 0.obs;
var desination_mode = 0.obs;
String dropdownValue = "9";
String subDropdownValue = "-1";
void toggleMode(){
if(mode==0){
if(mode.value==0){
mode += 1;
}
else{
@ -45,6 +49,15 @@ class IndexController extends GetxController {
}
}
void toggleDestinationMode(){
if(desination_mode.value==0){
desination_mode.value += 1;
}
else{
desination_mode.value -= 1;
}
}
@override
void onInit() {
super.onInit();
@ -208,10 +221,10 @@ class IndexController extends GetxController {
void loadLocationsBound(){
String cat = currentCat.isNotEmpty ? currentCat[0] : "";
LatLngBounds bounds = mapController!.bounds!;
print(currentCat);
//print(currentCat);
if(bounds.southEast != null && bounds.southWest != null && bounds.northEast != null && bounds.southEast != null ){
LocationService.loadLocationsBound(bounds.southWest!.latitude, bounds.southWest!.longitude, bounds.northWest.latitude, bounds.northWest.longitude, bounds.northEast!.latitude, bounds.northEast!.longitude, bounds.southEast.latitude, bounds.southEast.longitude, cat).then((value){
print("---value length ------ ${value!.collection.length}");
//print("---value length ------ ${value!.collection.length}");
if(value == null){
return;
}
@ -219,7 +232,7 @@ class IndexController extends GetxController {
Get.showSnackbar(GetSnackBar(message: "Too many points, please zoom in",));
}
if(value != null && value.collection.isNotEmpty){
print("---- added---");
//print("---- added---");
locations.clear();
locations.add(value);
loadCatsv2();