v1.0.0#8
Merged
Merged
Conversation
…avigation` initialization - **New `onInitApp` Lifecycle Method for `PlayxBinding`**: Added a new `onInitApp()` lifecycle method that is called once during app initialization. This allows developers to register app-level instances (repositories, datasources, services) directly from their bindings before any route lifecycle events are triggered. - `PlayxNavigation.boot()` now returns a `Future<void>` and automatically discovers all `PlayxBinding` instances in the route tree, calling `onInitApp()` on each during initialization. - **New `ensureInitialized`**: A static `Future<void>` getter that completes when `boot()` and all `onInitApp()` calls finish. Useful for gating startup logic (e.g., splash screens). - **New `isInitialized`**: A static `bool` getter that returns `true` after `boot()` has completed. - **New `bindings`**: A static getter that returns an unmodifiable list of all discovered `PlayxBinding` instances from the route tree. - **New `findBinding<T>()`**: Type-safe lookup to retrieve a specific binding by its concrete type. Throws `StateError` if not found. - **New `findBindingOrNull<T>()`**: Same as `findBinding<T>()` but returns `null` instead of throwing if no match is found. - `PlayxNavigationBuilder` updated to handle the async boot process seamlessly.
- **Removed redirect hack**: Binding lifecycle methods (`onEnter`, `onReEnter`) are no longer triggered through GoRoute's `redirect` callback. The `redirect` parameter on `PlayxRoute` is now passed through directly for user-defined redirection logic only. - **`onEnter` is now fired from `PlayxPage.initState`**: Guarantees it fires exactly once when the page widget mounts. This is more reliable than the previous redirect-based approach. - **`onExit` is now fired from `PlayxPage.dispose`**: Fires only when the page is truly removed from the widget tree. For shell routes, this means `onExit` does NOT fire on branch switches (the widget stays alive), only when the route is actually removed. - **`onHidden` / `onReEnter` handled by route-change listener**: These fire when the top route changes — covering push (child covers parent), pop (child removed, parent revealed), and branch switching. - **`wasPoppedAndReentered` detection improved**: Now uses path-based comparison to distinguish between a child being popped (`true`) and a branch switch (`false`). - **Removed `shouldExecuteOnExit`**: No longer needed since `PlayxPage.dispose` directly handles `onExit`. - `PlayxNavigationBuilder` updated to handle the async boot process seamlessly.
…ack routes - Introduced `PlayxPageState.pending` to represent pages that are mounted in the navigation stack but not yet visible. - Updated `PlayxPage` to defer `onEnter` execution for backstack routes (e.g., during deep-linking) until they become the top-most route. - Added `PlayxNavigation.addRouteChangeListener` to monitor visibility changes for deferred initialization. - Refined `PlayxBinding` lifecycle to ensure `onExit` only fires if `onEnter` was previously executed. - Enhanced example app with an "Explore" tab and complex nested navigation scenarios to demonstrate visibility-aware lifecycle management. - Added `onInitApp` hooks to example bindings and updated splash screen to wait for initialization.
- Added `loadingWidget` option to `PlayxRoute` and `PlayxShellBranch` to be displayed while `onEnter` is initializing. - Implemented initialization blocking to ensure the route's child widget is only built after `onEnter` completes. - Updated `PlayxPage` and documentation to support the new loading state and lifecycle behavior. -
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
1.0.0
New Features
onInitAppLifecycle Method forPlayxBinding: Added a newonInitApp()lifecycle method that is called once during app initialization. This allows developers to register app-level instances (repositories, datasources, services) directly from their bindings before any route lifecycle events are triggered.PlayxNavigation.boot()now returns aFuture<void>and automatically discovers allPlayxBindinginstances in the route tree, callingonInitApp()on each during initialization.ensureInitialized: A staticFuture<void>getter that completes whenboot()and allonInitApp()calls finish. Useful for gating startup logic (e.g., splash screens).isInitialized: A staticboolgetter that returnstrueafterboot()has completed.bindings: A static getter that returns an unmodifiable list of all discoveredPlayxBindinginstances from the route tree.findBinding<T>(): Type-safe lookup to retrieve a specific binding by its concrete type. ThrowsStateErrorif not found.findBindingOrNull<T>(): Same asfindBinding<T>()but returnsnullinstead of throwing if no match is found.loadingWidgetoption toPlayxRouteandPlayxShellBranch. This widget is displayed whileonEnteris being initialized, defaulting toSizedBox.shrink().onEntercompletes. This ensures dependencies registered inonEnter(e.g., GetX controllers) are available during the first build.Lifecycle Refactoring (Breaking Changes)
onEnter,onReEnter) are no longer triggered through GoRoute'sredirectcallback. Theredirectparameter onPlayxRouteis now passed through directly for user-defined redirection logic only.onEnteris now fired fromPlayxPage.initState: Guarantees it fires exactly once when the page widget mounts. This is more reliable than the previous redirect-based approach.onExitis now fired fromPlayxPage.dispose: Fires only when the page is truly removed from the widget tree. For shell routes, this meansonExitdoes NOT fire on branch switches (the widget stays alive), only when the route is actually removed.onHidden/onReEnterhandled by route-change listener: These fire when the top route changes — covering push (child covers parent), pop (child removed, parent revealed), and branch switching.wasPoppedAndReentereddetection improved: Now uses path-based comparison to distinguish between a child being popped (true) and a branch switch (false).shouldExecuteOnExit: No longer needed sincePlayxPage.disposedirectly handlesonExit.PlayxNavigationBuilderupdated to handle the async boot process seamlessly.