This commit is contained in:
Mohamed Nouffer
2022-06-06 21:15:58 +05:30
parent eea432c3c7
commit 3d9f20fd66
11 changed files with 168 additions and 34 deletions

View File

@ -20,6 +20,7 @@ class IndexController extends GetxController {
List<dynamic> perfectures = <dynamic>[].obs;
List<LatLngBounds> currentBound = <LatLngBounds>[].obs;
List<dynamic> subPerfs = <dynamic>[].obs;
List<dynamic> areas = <dynamic>[].obs;
List<dynamic> cats = <dynamic>[].obs;
List<String> currentCat = <String>[].obs;
@ -40,6 +41,7 @@ class IndexController extends GetxController {
String dropdownValue = "9";
String subDropdownValue = "-1";
String areaDropdownValue = "-1";
void toggleMode(){
if(mode.value==0){
@ -72,7 +74,8 @@ class IndexController extends GetxController {
if(perfectures.length == 0){
PerfectureService.loadPerfectures().then((value){
perfectures.add(value);
loadSubPerfFor("9");
loadAreaFor("9");
//loadSubPerfFor("9");
});
}
//loadCats();
@ -174,6 +177,19 @@ class IndexController extends GetxController {
// }
}
void loadAreaFor(String perf){
areas.clear();
dynamic initVal = {'id':'-1', 'adm2_ja':'----'};
PerfectureService.loadGifuAreas(perf).then((value){
print(value);
value!.add(initVal);
areas.add(value);
//loadSubPerfFor("9");
//subDropdownValue = getSubInitialVal();
});
}
void loadSubPerfFor(String perf){
subPerfs.clear();
dynamic initVal = {'id':'-1', 'adm2_ja':'----'};
@ -219,6 +235,15 @@ class IndexController extends GetxController {
});
}
void loadCustomLocation(String customarea, MapController mapController) async {
String cat = currentCat.isNotEmpty == true ? currentCat[0] : "";
print(currentCat);
LocationService.loadCustomLocations(cat).then((value){
locations.clear();
locations.add(value!);
});
}
void loadLocationsBound(){
String cat = currentCat.isNotEmpty ? currentCat[0] : "";
LatLngBounds bounds = mapController!.bounds!;
@ -287,6 +312,12 @@ class IndexController extends GetxController {
is_loading.value = false;
}
void populateForCustomArea(String customarea, MapController mapController){
loadCustomLocation("cus", mapController);
//zoomtoSubPerf(subperf);
is_loading.value = false;
}
GeoJsonFeature? getFeatureForLatLong(double lat, double long){
if(locations.length > 0){