This commit is contained in:
Mohamed Nouffer
2022-07-25 19:56:32 +05:30
parent 7739fecdf7
commit ff018a56fe
8 changed files with 106 additions and 44 deletions

View File

@ -241,7 +241,27 @@ void login(String email, String password, BuildContext context){
CatService.loadCats(bounds.southWest!.latitude, bounds.southWest!.longitude, bounds.northWest.latitude, bounds.northWest.longitude, bounds.northEast!.latitude, bounds.northEast!.longitude, bounds.southEast.latitude, bounds.southEast.longitude).then((value) {
cats.clear();
cats.add(initVal);
cats.addAll(value!);
for(dynamic cat in value!){
if(cat['category'] != null){
cats.add(cat!);
}
}
});
}
}
void loadCatForCity(String city){
dynamic initVal = {'category':'-all-'};
LatLngBounds bounds = mapController!.bounds!;
if(bounds.southEast != null && bounds.southWest != null && bounds.northEast != null && bounds.southEast != null ){
CatService.loadCatByCity(city).then((value) {
cats.clear();
cats.add(initVal);
for(dynamic cat in value!){
if(cat['category'] != null){
cats.add(cat!);
}
}
});
}
}
@ -338,7 +358,9 @@ void login(String email, String password, BuildContext context){
void loadLocationforSubPerf(String subperf, MapController mapController) async {
String cat = currentCat.isNotEmpty == true ? currentCat[0] : "";
print(currentCat);
if(currentCat[0] == "-all-"){
cat = "";
}
LocationService.loadLocationsSubFor(subperf, cat).then((value){
locations.clear();
locations.add(value!);
@ -419,6 +441,8 @@ void login(String email, String password, BuildContext context){
}
void zoomtoSubPerf(String id){
print("zooooom");
PerfectureService.getSubExt(id).then((value){
LatLng lat1 = LatLng(value![1], value[0]);
@ -439,7 +463,7 @@ void login(String email, String password, BuildContext context){
}
void populateForSubPerf(String subperf, MapController mapController){
subDropdownValue = subperf;
//subDropdownValue = subperf;
loadLocationforSubPerf(subperf, mapController);
zoomtoSubPerf(subperf);
is_loading.value = false;

View File

@ -112,20 +112,20 @@ class IndexPage extends GetView<IndexController> {
:
BreadCrumbWidget(mapController: indexController.mapController),
Container(width: 24.0,),
Row(
children: [
indexController.currentCat.isNotEmpty ? Text(indexController.currentCat[0].toString()): Text(""),
indexController.currentCat.isNotEmpty ?
IconButton(
onPressed: (){
indexController.currentCat.clear();
indexController.loadLocationsBound();
},
icon: Icon(Icons.cancel, color: Colors.red,)
) :
Container(width: 0, height: 0,)
],
)
// Row(
// children: [
// indexController.currentCat.isNotEmpty ? Text(indexController.currentCat[0].toString()): Text(""),
// indexController.currentCat.isNotEmpty ?
// IconButton(
// onPressed: (){
// indexController.currentCat.clear();
// indexController.loadLocationsBound();
// },
// icon: Icon(Icons.cancel, color: Colors.red,)
// ) :
// Container(width: 0, height: 0,)
// ],
// )
],
)
),