update initial map loading

This commit is contained in:
Mohamed Nouffer
2022-12-27 18:52:37 +05:30
parent c1f7656044
commit f8a79842e3
5 changed files with 310 additions and 25 deletions

View File

@ -119,7 +119,6 @@ class IndexController extends GetxController {
@override
void onInit() {
_ever = ever(rog_mode, (_) => print("$_ has been changed (ever)"));
if(perfectures.length == 0){
@ -194,23 +193,31 @@ void login(String email, String password, BuildContext context){
AuthService.login(email, password).then((value){
print("------- logged in user details ######## ${value} ###### --------");
if(value.isNotEmpty){
currentUser.clear();
currentUser.add(value);
is_loading.value = false;
Navigator.pop(context);
loadUserDetails();
loadLocationsBound();
cats.clear();
if(currentFeature.isNotEmpty){
getAction();
}
if(rog_mode.value == 1){
switchPage(AppPages.TRAVEL);
}
else{
switchPage(AppPages.INITIAL);
}
//Get.toNamed(AppPages.INITIAL);
currentUser.clear();
currentUser.add(value);
is_loading.value = false;
Navigator.pop(context);
loadUserDetails();
loadLocationsBound();
cats.clear();
if(currentFeature.isNotEmpty){
getAction();
}
if(currentUser.length > 0){
rog_mode.value = 0 ;
}
else{
rog_mode.value = 1;
}
if(rog_mode.value == 1){
switchPage(AppPages.TRAVEL);
}
else{
switchPage(AppPages.INITIAL);
}
//Get.toNamed(AppPages.INITIAL);
}else{
is_loading.value = false;
Get.snackbar(
@ -390,9 +397,11 @@ void login(String email, String password, BuildContext context){
int user_id = currentUser[0]["user"]["id"] as int;
AuthService.UserDetails(user_id).then((value){
print("--------- user details ----- ${value}");
bool paid = value![0]["paid"] as bool;
if(paid){
loadCustomAreas();
if(value != null && value.isNotEmpty){
bool paid = value![0]["paid"] as bool;
if(paid){
loadCustomAreas();
}
}
});
}