getx icon indicating copy to clipboard operation
getx copied to clipboard

Nested Navigation State Not Retained on Back to "Navigation" Tab

Open bennajah0 opened this issue 1 year ago • 3 comments

ATTENTION: DO NOT USE THIS FIELD TO ASK SUPPORT QUESTIONS. USE THE PLATFORM CHANNELS FOR THIS. THIS SPACE IS DEDICATED ONLY FOR BUGS DESCRIPTION. Fill in the template. Issues that do not respect the model will be closed.

Describe the bug A clear and concise description of what the bug is.

Reproduction code NOTE: THIS IS MANDATORY, IF YOUR ISSUE DOES NOT CONTAIN IT, IT WILL BE CLOSED PRELIMINARY)

To Reproduce Steps to reproduce the behavior:

  1. Open the App:
  2. Navigate to the Products Screen
  3. Select a Product
  4. Switch to Another Tab
  5. Return to the Products Screen

Expected behavior When navigating to a product detail page from the products screen, and then switching to another tab in the bottom navigation bar, returning to the products screen should keep the product detail page active. The product detail page should only be reset when the "Products" tab in the bottom navigation bar is pressed again.

Screenshots

https://github.com/jonataslaw/getx/assets/38137719/164ae985-e56e-447c-92aa-b9a2307f3ad8

Flutter Version: 3.22.1

Getx Version: 5.0.0-release-candidate-6

Describe on which device you found the bug: all

Minimal reproduce code https://github.com/jonataslaw/getx/tree/master/example_nav2

bennajah0 avatar May 29 '24 21:05 bennajah0

At the moment, its configuration is like this, only the logical page stack is maintained, and it does not remember the history page stack.

hightman avatar May 30 '24 02:05 hightman

Now you can refer to my sample code, which has implemented page state preservation.

https://github.com/hightman/getx5-example_nav2

hightman avatar May 31 '24 02:05 hightman

Flutter version 3.22 GetX version 4.6.6

Had the same issue, Screen1 >> Screen2 >> Screen3 while getting back to Screen1 this error came up

══════ Exception caught by scheduler library ═════════════════════════════════
The following assertion was thrown during a scheduler callback:
setState() called after dispose(): OverlayState#495c2(lifecycle state: defunct, entries: [OverlayEntry#1b469(opaque: true; maintainState: false), OverlayEntry#d1b03(opaque: false; maintainState: true), OverlayEntry#6a4a3(opaque: false; maintainState: false), OverlayEntry#12e78(opaque: false; maintainState: true)])

used Stock Navigator to push the Screen3 and this resolved the issue. however this is a hacky fix

WaniAthar avatar Jun 04 '24 20:06 WaniAthar