1

I'm building an app where I ping some data in my screen with the StreamBuilder (time, location, etc.), now I want to make an option for the user to leave the current screen without breaking the state or context of the screen, sort of like minimizing the screen. How can I achieve this in Flutter? Example: I have my Screen One where I ping the data:

Screen one

Now I want to make an option to the user to check some other data in the back while the Screen One is still running in the background so it doesn't break the ping of data from the StreamBuilder:

enter image description here

If I use the Navigator.of(context).pop() that will naturally pop the current screen and return to the previous one, so what I'm looking for is a solution not to break the state or context and still be able to return to the screen, like I said, sort of minimizing the screen.

Any idea of solution is quite helpful, thanks in advance!

GrandMagus
  • 600
  • 3
  • 12
  • 37
  • Why don't you try a fullscreen AlertDialog? – Diwyansh Dec 09 '21 at 09:48
  • You mean full screen the Screen One with AlertDialog? I don't think it would be a right approach since I have a lot of interactions inside the Screen One. – GrandMagus Dec 09 '21 at 09:54
  • Okay another doubt is when the user minimize screen one and move to any screen now can the user move to any other screen as well? – Diwyansh Dec 09 '21 at 10:03
  • This is another question and not the one I asked, but if you must know, I use the `BottomNavigationBar` for my routing and I can move to anyscreen without interupting the state of the screens, I just want to solve the problem where I push the entire Screen One without the bottom nav bar and minimize the Screen One so the user can, let's say, change the current Profile picture, check some personal data etc. and then just causally gets back to the minimized Screen one. – GrandMagus Dec 09 '21 at 10:33
  • Hello, did you find a solution for that? – Michał Klepaczko May 12 '22 at 11:40

1 Answers1

0

to maintain state in the screens you can use IndexedStack

shasi
  • 1
  • As it’s currently written, your answer is unclear. Please [edit] to add additional details that will help others understand how this addresses the question asked. You can find more information on how to write good answers [in the help center](/help/how-to-answer). – Community Jun 22 '23 at 05:59