From f5206b3170163c8dae6bf3ad6a0c7f1f5a766f8c Mon Sep 17 00:00:00 2001 From: SchabanBo <49782771+SchabanBo@users.noreply.github.com> Date: Thu, 25 Jul 2024 08:59:07 +0200 Subject: [PATCH] Fix error removing route from the stack in the `TemporaryQRouter` --- CHANGELOG.md | 4 ++++ README.md | 3 +++ lib/src/controllers/qrouter_controller.dart | 2 +- pubspec.yaml | 2 +- 4 files changed, 9 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 843532b..17cfc19 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,10 @@ # 1.11.0 +- Fix error removing route from the stack in the `TemporaryQRouter` + +# 1.11.0 + - Add `TemporaryQRouter` to use the router in n popups or dialogs. #126 - Fix #139 - Set min SDK to 2.17.0 diff --git a/README.md b/README.md index 39e5574..2beea20 100644 --- a/README.md +++ b/README.md @@ -35,6 +35,7 @@ - [Mix it up](#mix-it-up) - [App Page Transition](#app-page-transition) - [Temporary router](#temporary-router) + - [Example](#example) - [Limitations](#limitations) - [waiting for page result](#waiting-for-page-result) - [Restoration management](#restoration-management) @@ -427,6 +428,8 @@ This example will show the store page in a bottom sheet. the same routes are def To Check if the temporary router is active or not you can use `QR.navigator.isTemporary`. +### [Example](https://github.com/SchabanBo/qr_samples/blob/main/lib/examples/temporary_router.dart) + ### Limitations - URL Navigation: The temporary router will not function if the user directly types the path into the URL. This limitation arises because the temporary router is designed to exist only within the widget tree and is destroyed when the widget is removed. diff --git a/lib/src/controllers/qrouter_controller.dart b/lib/src/controllers/qrouter_controller.dart index 5a01e28..d73ae0d 100644 --- a/lib/src/controllers/qrouter_controller.dart +++ b/lib/src/controllers/qrouter_controller.dart @@ -272,8 +272,8 @@ class QRouterController extends QNavigator { } Future disposeAsync() async { - if (!isTemporary) await _pagesController.removeAll(); isDisposed = true; + await _pagesController.removeAll(); if (isTemporary) { // remove routes from the tree final routesNames = routes.routes.map((e) => e.name).toList(); diff --git a/pubspec.yaml b/pubspec.yaml index 9e86a80..6602575 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,7 +1,7 @@ name: qlevar_router description: A router that helps you to manage your project routes. Create nested routes. navigation without context between your pages. -version: 1.11.0 +version: 1.11.1 repository: https://github.com/SchabanBo/qlevar_router environment: