navigation_node 0.1.1
navigation_node: ^0.1.1 copied to clipboard
A nested Navigator for Flutter: dialogs, sheets and pushed routes stay inside the screen that opened them, and the system back reaches the innermost one first.
0.1.1 #
- Named routes work inside a node now, and land inside it. The nested navigator
is handed one page and nothing else, so
pushNamedfrom inside a node reached a navigator that had never heard ofroutes:and ended in an assertion of the framework — while the application had declared its routes in the one place there is to declare them. A node borrows the route table of the navigator above, so a name means the same thing inside a node as outside it, and/detailspushed from inside is built below the node, with the screen's own scope among its ancestors. Nested nodes chain, each borrowing from the one above. Still not forwarded, and now written down inREADME.md: observers, and a restoration scope. - Fix
popUntilnever finishing inside a node.NavigatorState.popUntilpops and then looks at what is left on top, over and over until its predicate matches — and a pop that reaches the node's own page takes nothing, since a node never empties itself. A predicate matching nothing inside the node therefore left that loop looking at the same route for ever, in the frame it was called from, with the application stopped. The walk now ends on the node's own page. - Fix a back press vanishing when something below the node announced that it
could handle a pop and then did not. A
NavigatororRouterof your own, deeper than the node's, is heard by the node exactly as the node's own navigator is, while the only navigator a node can hand a press to is its own — which had nothing to give up and said so into a future nobody read. The press reached neitheronPopnor the route above and simply disappeared, where with no node there at all it would have closed the route. A press nothing below took is now the node's to answer, as it always should have been. - Fix a disabled node still telling the framework that the back gesture is
handled. What its own subtree announced went past it and reached
WidgetsApp, which passes it to the platform — so a hidden tab of anIndexedStacksuppressed the predictive back gesture for a stack nobody could see and the node had promised not to touch. A node with no place on the route now keeps that news to itself, and goes on hearing it for the moment it is switched back on. - Fix an answer from an asynchronous
onPopstill taking the route after the node was switched off. Confirming a dialog after switching tabs took the route the node had already given up its place on. Such an answer now takes nothing, the way an answer arriving under a newer route does. - Report a failure from a synchronous
onPop, from the guard read on the way out of the node, and from the pop handed to the navigator above — the three places where the promise inREADME.mdwas wider than the code. A synchronous raise used to travel out through the loop a route runs over its entries, taking anyPopScopeof yours beside the node with it; a raise in the handover was left in a future nobody held. All of them are reported throughFlutterError.reportErrornow, and the press is simply not acted on. - Correct what the documentation says about
Navigator.pop(). It never reachesonPopfrom a route inside the node, which is what was meant — but on the node's first page there is no such route to take, and the pop leaves the node by asking the navigator above, whose route the node is aPopEntryof. The hook is reached there, and now it says so.README.mdalso grew a section on what a node does not do: named routes,Heroanimations and wherepopUntilstops. - Fix an error reported from a node naming the wrong library. Anything that
falls over while an asynchronous
onPopis being answered — the question itself, a confirmation dialog, the guard on the route — is reported throughFlutterError.reportError, and the report said it came fromscopo. It saysnavigation_nodenow, wherever a report comes from.
0.1.0 #
- First release.
NavigationNode,NodeNavigatorStateandPreviousNavigatorExtensionwere part of scopo up to and including its 0.10.0, and arrive here unchanged — same code, same suite of 43 tests, same six lessons inexample/. A consumer of scopo 0.11.0 or later adds this package and changes one import; there is nothing else to migrate. - The reason for the move is that it never belonged in a package about scopes: it imports nothing but Flutter, nothing inside scopo used it, and somebody looking for a nested navigator had no way of finding it in a package described as dependency injection. It still pairs with scopo the way it always did.