felangel / flow_builder

Flutter Flows made easy! A Flutter package which simplifies navigation flows with a flexible, declarative API.
https://pub.dev/packages/flow_builder
MIT License
389 stars 63 forks source link

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 2 years ago

ThanhTuNguyen commented 2 years ago

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

marqueeeeeee commented 2 years ago

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

ThanhTuNguyen commented 2 years ago

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 commented 2 years ago

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 commented 2 years ago

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 commented 2 years ago

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