-
Notifications
You must be signed in to change notification settings - Fork 589
v1: Refactor NavigationDrawer, Pagelet API and usage
#5754
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Refactored Pagelet drawer and end drawer open/close logic to use async invoke methods instead of property updates. Updated Python examples to use new async drawer methods and added a declarative example. Cleaned up related Dart code and removed unused imports.
Wraps the scaffold in a ClipRect when a drawer or endDrawer is present to ensure drawer animations remain hidden outside the pagelet bounds.
Removed NavigationDrawerPosition enum and dialog-based drawer handling. NavigationDrawer is now set via 'drawer' and 'end_drawer' properties on Page/Pagelet, with new async methods for showing and closing drawers. Updated Dart and Python code to support direct drawer control, removed ScaffoldKeyProvider, and revised examples and tests to use the new API. Fix #5386
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We've reviewed this pull request using the Sourcery rules engine
Deploying flet-docs with
|
| Latest commit: |
acab909
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://c0888118.flet-docs.pages.dev |
| Branch Preview URL: | https://v1-pagelet.flet-docs.pages.dev |
Deleted the navigationdrawerposition.md documentation file and its reference from mkdocs.yml, likely because the type is deprecated or no longer relevant.
Replaces manual window size assignments in navigation drawer integration tests with the new async resize_page method for consistency and reliability. Adds the resize_page utility to FletTestApp, improving test maintainability and accuracy. Updates golden images to reflect new window dimensions.
Replaces event-based waiting with polling to ensure window dimensions are updated correctly before and after adjusting for window chrome size. This change improves reliability of window resizing during tests.
Refactored the method to set window size by removing redundant update and wait steps. The window size is now set directly with chrome adjustments, improving efficiency.
Simplifies Pagelet reference handling by removing the use of ft.Ref and cast, assigning the Pagelet instance directly to a variable. Updates drawer handler functions to use the new variable reference.
Added a new declarative shape drawer example app using Flet's canvas. Updated integration tests for Cupertino and Material controls to use the new `resize_page` method for setting window size, replacing direct window property assignments. Updated multiple golden image files for test cases.
Replaces direct assignment of page window width and height with calls to the async resize_page method across multiple integration test files. This improves consistency and ensures proper asynchronous handling of window resizing for screenshot-based tests. Also updates related golden images to reflect any visual changes from the new resizing approach.
Enhanced the assertion error message in flet_test_app.py to include actual and threshold similarity values for easier debugging. Updated golden image for Cupertino bottom sheet basic test.
Reordered imports and function calls in test_shader_mask.py for clarity and consistency. Updated the golden image for shader mask on macOS. Minor changes in flet_test_app.py to support integration testing.
Updated the event name from 'change' to 'text_change' for dropdown controls in Dart and Python implementations. Adjusted related handler and usage in example code to improve clarity between selection changes and text input changes. Close #5760
| pump_duration: Optional[ft.DurationValue] = None, | ||
| ) -> ft.Screenshot: | ||
| """ | ||
| Wraps provided controls in a Screenshot control. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"provided" ?
I cant see them from the params, or i am wrongly interpreting.
| pixel_ratio: Optional[float] = None, | ||
| ): | ||
| pump_times: int = 0, | ||
| pump_duration: Optional[ft.DurationValue] = None, | ||
| ) -> bytes: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you please go through this file and add more docs(trings). (parameters, returns etc)
Comments too, where useful.
Summary by Sourcery
Refactor drawer APIs and implementation in Pagelet and View controls to simplify programmatic open/close logic and unify control handling across Dart and Python SDKs
New Features:
Enhancements:
Documentation:
Tests: