Skip to content

Conversation

@FeodorFitsner
Copy link
Contributor

@FeodorFitsner FeodorFitsner commented Oct 28, 2025

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:

  • Expose async show_drawer, close_drawer, show_end_drawer and close_end_drawer methods on Pagelet and View controls in both Dart and Python SDKs

Enhancements:

  • Unify drawer open/close handling via invokeMethod listeners and remove post-frame callbacks and property syncing
  • Replace specialized NavigationDrawerControl with generic ControlWidget and wrap Pagelet scaffold in ClipRect when a drawer is present
  • Streamline NavigationDrawer control by removing NavigationDrawerPosition enum and consolidating on_dismiss and on_change handlers

Documentation:

  • Update Python and Dart examples to demonstrate new async drawer API usage

Tests:

  • Update integration tests and examples to use new async drawer methods and adjust navigation drawer positioning tests

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
Copy link
Contributor

@sourcery-ai sourcery-ai bot left a 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

@cloudflare-workers-and-pages
Copy link

cloudflare-workers-and-pages bot commented Oct 28, 2025

Deploying flet-docs with  Cloudflare Pages  Cloudflare Pages

Latest commit: 8d97f68
Status: ✅  Deploy successful!
Preview URL: https://3fa2e025.flet-docs.pages.dev
Branch Preview URL: https://v1-pagelet.flet-docs.pages.dev

View logs

FeodorFitsner and others added 10 commits October 27, 2025 18:39
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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants