Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Back to the previous page and i want this page just still remain, something simple like "Navigator.pop" in Nav 1.0 #87

Open
ThanhTuNguyen opened this issue Apr 27, 2022 · 5 comments

Comments

@ThanhTuNguyen
Copy link

ThanhTuNguyen commented Apr 27, 2022

Hi, I usually struggle with situations like this.
I had a searching view with a bunch of options and filters. I do search with those options, the results just appear, i can scroll a little bit and chose the right item which i looking for, click on this item to reveal more detail on another page ... then i go back. All i want is the searching page is remain, with the same options and filter even the position of items in list view.

So i had to store all those options, filter, and search it all again through API (or store the last results in State). it's frustrated for me when i simply just use "Navigatior.pop" in Nav 1.0.

Please correct me if there is actually a way to back previous page as simple as Navigator.pop or any trick.

Or can you make a feature like this? It very useful

@ThanhTuNguyen ThanhTuNguyen changed the title back to the previous page and i want this page just still remain, something simple like "Navigator.pop" in Nav 1.0 Back to the previous page and i want this page just still remain, something simple like "Navigator.pop" in Nav 1.0 Apr 27, 2022
@marqueeeeeee
Copy link

also looking for something like this, going back to previous page to lessen additional state checking.

@ThanhTuNguyen
Copy link
Author

also looking for something like this, going back to previous page to lessen additional state checking.

yes, this must be very simple and easy in navigation 1.0. But extremely annoying in Navigation 2.0, is this the downside of this?

@mleybacreatethrive
Copy link

I think you should maintain the search filters and results in the state (cubit for example) and when you go back the state would be the same..

Hope this can help you

@ThanhTuNguyen
Copy link
Author

I think you should maintain the search filters and results in the state (cubit for example) and when you go back the state would be the same..

Hope this can help you

Yes. I already did it, but it seem over complicated and frustrated if i just can do something like "navigation.pop" in Nav 1.0

@mleybacreatethrive
Copy link

To do something like "navigation.pop()" you should only need to update your state.

In your case your could have something like this

image

To go back update state and set itemSelected == null, also you can use WillPopScope to override physical back button behavior

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants