Hi
In some cases I want to prevent moving to other pages like I had a profile NavButton and only authenticated user can move to this page otherwise some action (like showing dialog,etc) needs to do
without build current tab again (that's so important)
I can doing this in onTap function and return to before tab but that's trigger page again
I tried below code but it didn't work (NavButton not changed but page changed)
onTap: (index) async {
if (index == profileIndex && !isLogin()) {
bool result = await showAuthPopup(); // show signup or login dialog (also close dialog and get the result)
if(!result) // if the auth task fails, do nothing and continue on the same page you were without building it again otherwise go to profile page
return;
}
setState(() {
_page = index;
});
}
It would be great if onTap accepts bool return value for trigger (instead of void ) , then I could do that
onTap: (index) async {
if (index == profileIndex && !isLogin()) {
bool result = await showAuthPopup();
if(!result)
return false; // don't do other stuff
}
setState(() {
_page = index;
});
return true; // do remain stuff like before
}
Hi In some cases I want to prevent moving to other pages like I had a profile NavButton and only authenticated user can move to this page otherwise some action (like showing dialog,etc) needs to do without build current tab again (that's so important) I can doing this in onTap function and return to before tab but that's trigger page again I tried below code but it didn't work (NavButton not changed but page changed)
It would be great if onTap accepts bool return value for trigger (instead of void ) , then I could do that
I hope I am getting my point across.
Thanks.