fix: resolve component-wrapped views in Page root/top view accessors#6414
Merged
FeodorFitsner merged 3 commits intorelease/v0.85.0from Apr 13, 2026
Merged
Conversation
…6413) Under `page.render_views()`, `self.views` is a `Component` (or a single `View` once unwrapped), not a `list[View]`. `__root_view()` / `__top_view()` called `len(self.views)` directly, breaking `page.show_drawer()`, `close_drawer()`, and every page-level accessor backed by the root view (appbar, drawer, navigation_bar, controls, ...). Add `__resolved_views()` that unwraps component wrappers and normalizes a single-View return into a one-element list, and route both view accessors through it. Also adds a declarative `NavigationDrawer` example under `examples/apps/declarative/navigation_drawer` covering the repro from the issue.
Deploying flet-examples with
|
| Latest commit: |
22b7c91
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://491d5bab.flet-examples.pages.dev |
| Branch Preview URL: | https://fix-render-views-drawer-acce.flet-examples.pages.dev |
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.
Summary
page.show_drawer()(and every page-level accessor backed by the root view) raisedTypeError: object of type 'Component'/'View' has no len()underpage.render_views().BasePage.__root_view()/__top_view()now go through a new__resolved_views()helper that unwrapsComponentwrappers and normalizes a single-Viewreturn into a one-element list.examples/apps/declarative/navigation_drawer— declarativeNavigationDrawerexample covering the repro.Test plan
uv run flet run sdk/python/examples/apps/declarative/navigation_drawer/main.py— tap the menu icon, drawer opens; selecting a destination updates the page title and closes the drawer.examples/apps/routing_navigation/drawer_navigation) still works.Summary by Sourcery
Fix page root/top view resolution to work with component-wrapped declarative views and add a declarative navigation drawer example app.
New Features:
Bug Fixes:
Enhancements: