-
-
Notifications
You must be signed in to change notification settings - Fork 475
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
🐛 interference in _NavigationBodyState between PageView and paneBodyBuilder/IndexedStack #679
Comments
A common use case for paneBodyBuilder is to use an IndexedStack to manage the state of the widgets displayed inside the navigation body. An IndexedStack does not play nicely with the PageView.builder that it was being wrapped in. Now, if a paneBodyBuilder is used, assume it is responsible for its own state management. Fixes bdlukaa#679
@klondikedragon Hello, I have been following this change and I am interested in using this implementation with IndexedStack (attempting to follow with #266 (comment) ) (I had a similar experience where the latest fluent_ui version broke my implementation) however I am still experiencing some issues and have some questions... See code sample below: This code sample works ALMOST as intended using the latest fluent_ui code directly from master branch (including PR #680). The intention is to save the state between pages by use of the IndexedStack. See comment "//--HERE--" above the NavigationView.selected property... If this property is left as null - the IndexedStack and children hold state as desired BUT the NavPaneItems do not show when they are selected. It is confusing to me how this property can effect the state of NavigationView body like this. Is there a way I can accomplish my desired behavior of the IndexedStack and children staying-alive as desired AND have the items show when they are selected?
|
Thank You!!! @bdlukaa @klondikedragon You are the GOAT. 🙏 🙏 🙏 |
Describe the bug
I've recently upgraded fluent_ui from 4.0.1 to 4.1.4, and started to receive all kinds of odd/random issues. e.g., duplicate GlobalKeys in widgets related to a nested vrouter, stateful widgets being disposed almost immediately after creation (causing futures executed in a "zero" delay created in an initState that reference the build context to get an exception that the widget was already detached), widgets not having a sized viewport during construction, etc.
It appears this is related to the recent enhancements (#607, #645) surrounding preserving state of navigation pane items through the ability to specify a key for each pane item. This is a great enhancement and good when the use of navigation pane is simple (common use case for most apps probably). In my case, I need to manage the keys/state of the widgets presented within the body of the navigation pane explicitly (and underneath an
IndexedStack
) because the content is not determined just by the currently selected pane, but also by the current route, which could include sub-routes that reference tabs with different content. (A sketch of what is being done is in #226 (comment) ).It appears that using an IndexedStack in combination with
paneBodyBuilder
is contemplated (somewhat discussed in #649 (comment)).I'm not exactly sure why, but the new
PageView.builder
(with an automatic GlobalKey passed to it) is really interfering strongly with theIndexedStack
returned by mypaneBodyBuilder
.I've tested a solution that seems to work nicely, where if the
paneBodyBuilder
is not null then it just doesn't wrap the widget built by thepaneBodyBuilder
in thePageView.builder
(nor does it use the_pageKey
in_NavigationBodyState
) and that removes all of the problems.I've created a PR for consideration to fix this issue and #678.
The text was updated successfully, but these errors were encountered: