'I need to be able to load multiple pages at the same time or customize the page stack in some other way
I have a 3-step registration process. If the application is stopped during any of these phases, it will resume from the last screen shown on the next restart. By doing so, however, I am no longer able to call the Navigator.pop because the pages before the one opened are never loaded. Is it possible to load multiple pages at once? Or create an always default page stack?
Solution 1:[1]
If the registration process is a three step process, use PageView with three screens passed to it, when moving to next, use the PageController.jumpTo(pageNumber).
Now, to resume the registration process to the last page left,
- Set up a function to store current position of the
PageViewin theSharedPreferences. - On
initStatewhen app is opened, read this saved value, if the value exists, initialize thePageControllerwithinitialPageparameter set to the last page left, if the value doesn't exist, keep it to defaultinitialPagevalue (0). This way it will always show the last page selected, resuming the registration process.
You can also load the last entered values in the screens passed to the PageView.
This way, without using any third party package, you can create proper mechanism which fulfills your requirement.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Lalit Fauzdar |
