added refresh

This commit is contained in:
Mohamed Nouffer
2023-07-18 22:10:30 +05:30
parent 75770c9f16
commit ed892b915b
2 changed files with 23 additions and 13 deletions

View File

@ -553,7 +553,23 @@ class DestinationController extends GetxController {
void onReady() {
Get.toNamed(AppPages.LOGIN)!.then((value){
if(indexController.currentUser.length > 0) {
String _token = indexController.currentUser[0]["token"];
fixMapBound();
}
else {
Get.toNamed(AppPages.TRAVEL);
PerfectureService.getSubExt("9").then((value){
if(value != null){
LatLngBounds bnds = LatLngBounds(LatLng(value[1], value[0]), LatLng(value[3], value[2]));
indexController.mapController!.fitBounds(bnds); //.centerZoomFitBounds(bnds);
}
});
}
});
super.onReady();
}
void fixMapBound(){
String _token = indexController.currentUser[0]["token"];
indexController.switchPage(AppPages.INITIAL);
LocationService.getLocationsExt(_token).then((value) {
if(value != null){
@ -568,18 +584,6 @@ class DestinationController extends GetxController {
indexController.loadLocationsBound();
}
});
}
else {
Get.toNamed(AppPages.TRAVEL);
PerfectureService.getSubExt("9").then((value){
if(value != null){
LatLngBounds bnds = LatLngBounds(LatLng(value[1], value[0]), LatLng(value[3], value[2]));
indexController.mapController!.fitBounds(bnds); //.centerZoomFitBounds(bnds);
}
});
}
});
super.onReady();
}
void connectionChanged(String val) {

View File

@ -39,6 +39,12 @@ class IndexPage extends GetView<IndexController> {
//automaticallyImplyLeading: false,
title: Text("add_location".tr),
actions: [
IconButton(
onPressed: (){
destinationController.fixMapBound();
},
icon: Icon(Icons.refresh)
),
InkWell(
onTap: (){
Get.toNamed(AppPages.SEARCH);