Skip to content

v1.0.0#8

Merged
basemosama merged 4 commits into
mainfrom
qa
Apr 2, 2026
Merged

v1.0.0#8
basemosama merged 4 commits into
mainfrom
qa

Conversation

@basemosama

Copy link
Copy Markdown
Member

1.0.0

New Features

  • 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.
  • Custom Loading Widget: Added loadingWidget option to PlayxRoute and PlayxShellBranch. This widget is displayed while onEnter is being initialized, defaulting to SizedBox.shrink().
  • Initialization Blocking: The route's child widget is only built after onEnter completes. This ensures dependencies registered in onEnter (e.g., GetX controllers) are available during the first build.

Lifecycle Refactoring (Breaking Changes)

  • 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.

…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. -
@basemosama basemosama merged commit d03bc76 into main Apr 2, 2026
1 check failed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant