added goal feature

This commit is contained in:
Mohamed Nouffer
2022-10-12 21:46:17 +05:30
parent 0470e1f27f
commit 8e30ee6ba7
29 changed files with 876 additions and 481 deletions

View File

@ -173,6 +173,8 @@ void login(String email, String password, BuildContext context){
is_loading.value = false;
Navigator.pop(context);
loadUserDetails();
loadLocationsBound();
cats.clear();
if(currentFeature.isNotEmpty){
getAction();
}
@ -199,6 +201,37 @@ void login(String email, String password, BuildContext context){
});
}
void changePassword(String oldpassword, String newpassword, BuildContext context){
String _token = currentUser[0]['token'];
//print("------- change password ######## ${currentUser[0]['token']} ###### --------");
AuthService.changePassword(oldpassword, newpassword, _token).then((value){
print("------- change password ######## ${value} ###### --------");
if(value.isNotEmpty){
is_loading.value = false;
Navigator.pop(context);
if(rog_mode.value == 1){
switchPage(AppPages.TRAVEL);
}
else{
switchPage(AppPages.INITIAL);
}
//Get.toNamed(AppPages.INITIAL);
}else{
Get.snackbar(
'failed'.tr,
'password_change_failed_please_try_again'.tr,
icon: Icon(Icons.error, size: 40.0, color: Colors.blue),
snackPosition: SnackPosition.TOP,
duration: Duration(milliseconds: 800),
backgroundColor: Colors.yellow,
//icon:Image(image:AssetImage("assets/images/dora.png"))
);
}
});
is_loading.value = false;
}
void logout() async{
locations.clear();
DatabaseHelper db = DatabaseHelper.instance;
@ -209,6 +242,7 @@ void login(String email, String password, BuildContext context){
}
});
currentUser.clear();
cats.clear();
}
void register(String email, String password, BuildContext context){
@ -223,8 +257,8 @@ void login(String email, String password, BuildContext context){
}else{
is_loading.value = false;
Get.snackbar(
"Failed",
"User registration failed, please try again.",
'failed'.tr,
'user_registration_failed_please_try_again'.tr,
icon: Icon(Icons.error, size: 40.0, color: Colors.blue),
snackPosition: SnackPosition.TOP,
duration: Duration(milliseconds: 800),
@ -248,9 +282,23 @@ void login(String email, String password, BuildContext context){
}
String getCatText(){
String _cat = 'all'.tr;
if(currentUser.length > 0){
Map<String, dynamic> _urs = currentUser[0];
print('-- is_rogaining :-- ${_urs['user']['is_rogaining']} ------');
if(_urs['user']['is_rogaining'] == true){
_cat = 'rogaining'.tr;
}
else {
_cat = 'sight_seeing'.tr;
}
}
return _cat;
}
void loadCatsv2(){
dynamic initVal = {'category':'-all-'};
dynamic initVal = {'category':getCatText()};
LatLngBounds bounds = mapController!.bounds!;
if(bounds.southEast != null && bounds.southWest != null && bounds.northEast != null && bounds.southEast != null ){
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) {
@ -266,7 +314,7 @@ void login(String email, String password, BuildContext context){
}
void loadCatForCity(String city){
dynamic initVal = {'category':'-all-'};
dynamic initVal = {'category':getCatText()};
LatLngBounds bounds = mapController!.bounds!;
if(bounds.southEast != null && bounds.southWest != null && bounds.northEast != null && bounds.southEast != null ){
CatService.loadCatByCity(city).then((value) {