flow_builder icon indicating copy to clipboard operation
flow_builder copied to clipboard

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

Open ThanhTuNguyen opened this issue 3 years ago • 5 comments

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 avatar Apr 27 '22 09:04 ThanhTuNguyen

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

marqueeeeeee avatar Apr 28 '22 09:04 marqueeeeeee

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?

ThanhTuNguyen avatar Apr 28 '22 10:04 ThanhTuNguyen

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

mleybacreatethrive avatar May 23 '22 17:05 mleybacreatethrive

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

ThanhTuNguyen avatar May 24 '22 07:05 ThanhTuNguyen

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

mleybacreatethrive avatar May 24 '22 14:05 mleybacreatethrive