ZupIT/beagle

[Flutter] First route in a StackNavigator is not always configurable

Closed this issue · 0 comments

Use case

I want to be able to control the first route in a StackNavigator via the NavigationController.

Current behavior:
When a view is added to an existing StackNavigator, everything works fine. Via the NavigationController I can show a loading feedback on top of the current page and, if an error happens, I can dismiss the navigation and act like it never happened, maintaining the previous page in the stack, i.e. the navigation is not performed.

When the view is the first of a new stack, the stack is automatically pushed to the Root Navigator, I can't dismiss it. My loading feedback is not showed and if an error happens, the page will be blank.

Proposal

  1. The addition of a StackNavigator to the RootNavigator should act just like the addition of a Page to the StackNavigator. Considering the StackNavigator will initialize only after it's added to the RootNavigator, I don't know if this is possible.

  2. If (1) is not possible. Maybe we should add to the NavigationController onLoadingStack and onStackError. With this, we could program different behaviors for when pushing a new stack.