j_navigation 1.0.1
j_navigation: ^1.0.1 copied to clipboard
A production-proven, action-based navigation system for Flutter — context-free controller, pure stack-transform actions, tabbed shell, bring-your-own analytics. No codegen.
Changelog #
Unreleased #
- (open for next changes)
1.0.1 #
- Rename
example_app/→example/so pub.dev's package analysis detects the runnable example (awards the "Package has an example" score point). No source or behavior changes.
1.0.0 #
First standalone, open-source-ready release. Analytics is an opt-in sink
interface (no analytics vendor locked in) and presented UI is themed through a
self-contained NavigationTheme. The router now reports its current route so
the browser address bar reflects navigation on web.
Breaking changes #
NavigationControllerconstructor: analytics is now passed as an optionalNavigationAnalyticsSink? analyticsSink. Passnull(or omit) for the "no analytics" build; pass a sink implementingNavigationAnalyticsSinkto receive screen-enter / screen-exit events.- Analytics event types: navigation emits self-contained
NavigationScreenEnterEventandNavigationScreenExitEventobjects to the sink (withscreenName,navigationMethod,sourceScreen,breadcrumbon enter;exitMethod,destinationScreen,timeSpenton exit). AnalyticsQueue: takes aNavigationAnalyticsSink; enqueue aNavigationAnalyticsEventvia a singleenqueue(event)(the queue dispatches enter/exit to the sink).flush()drains the queue and callssink.flush().- Presented UI theming:
AlertDialogPageandModalBottomSheetPagereadNavigationTheme.of(context)(which falls back to Material defaults when no theme is configured) instead of host theme colors. NavigationConfig: accepts an optionalNavigationThemeData? themeused to theme the router's presented UI.
Added #
-
NavigationAnalyticsSink— interface class; implementers overrideonScreenEnter,onScreenExit, and optionallyflush. Default const constructor is a no-op sink. -
NavigationScreenEnterEvent/NavigationScreenExitEvent— self-contained event objects withscreenName,navigationMethod,sourceScreen,breadcrumb(enter) andexitMethod,destinationScreen,timeSpent(exit). -
NavigationTheme(InheritedWidget) andNavigationThemeData(scrimColor,cupertinoPrimaryColor, both defaulting to Material/Cupertino defaults). -
NavigationConfig.themeto supply navigation-presented UI colors per router. -
Web address bar support:
NavigationRouterDelegate.currentConfigurationreports the top-of-stack screen, andNavigationRouteInformationParser .restoreRouteInformationserializes it to a URL path. On web the browser address bar reflects the current screen; deep-linkable screens (registered in theFeatureProvider) round-trip fully, while programmatic pushes reflect in the URL but resolve to no navigation on reload unless the host also maps that screen name. -
Awaitable presented results:
NavigationController.present<T>(Present)navigates and awaits the value the screen returns viaNavigator.pop(context, result), resolving withnullon a programmatic dismiss.Present.dismissedexposes the underlying untyped future. -
Tabbed navigation (shell):
NavigationController.tabbed(branches:...)keeps an independent navigation stack per branch (tab).SwitchTab(id, thenNavigate:...)flips the active branch without disturbing either stack.NavigationBranch/NavigationBranchIddescribe each branch (root page,wantsKeepAlive, URLscreenName).NavigationConfig.shellBuilderwraps anIndexedStackof per-branchNavigators with host-supplied chrome (e.g. a bottom navigation bar). Branch switches emit enter/exit analytics. On web the address bar encodes/<branchScreen>/<topScreen>for the active branch. Per-branch stack restoration on process death is out of scope for this release. Single-stack (non-tabbed) controllers are behavior-identical to before — the tabbed path is opt-in.Known limitations (tabbed mode): the address bar encodes
/<branchScreen>/<topScreen>for display, but on reload the parser does not auto-strip the branch segment — the hostFeatureProvidermust recognize the branch segment to restore navigation (full tabbed deep-link round-trip is planned).NavigatorObservers passed toNavigationConfigare attached to every branchNavigator; because an observer records a single navigator, in tabbed mode it receives undifferentiated events from all branches (per-branch observer API planned). The publicnavigatorKeyis unused in tabbed mode; useNavigationRouterDelegate.currentNavigatorKeyfor the on-stageNavigatorState. -
RouteConfig: gained a nullablebranchScreenNamefield used to serialize the active branch. ExistingRouteConfigconstructions must addbranchScreenName: null(or the active branch's screen name when tabbed).
Removed #
- Dependencies on concrete analytics and design-system packages — analytics is now an opt-in sink interface, theming is self-contained.
Migration #
Replace any AnalyticsModule wiring with a NavigationAnalyticsSink implementation
that adapts to your analytics stack, and pass it as analyticsSink:. If you only
consumed ScreenEnterEvent / ScreenExitEvent, map their fields onto the new
NavigationScreen*Event types (note breadcrumb is now a top-level field, not nested
under extraProperties).