-
Notifications
You must be signed in to change notification settings - Fork 607
v1: Add Dropdown.text property, add on_select event
#5593
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
Deleted the before_update method in the Dropdown class, which previously set expand_loose based on expand. This change may address redundant or obsolete logic related to display issues.
Introduces a new example demonstrating a reactive dropdown control in Flet. The example uses a dataclass to manage state and updates the selected color dynamically.
Renamed Dropdown event handlers from on_change to on_select and on_text_change to on_change for clarity and consistency. Updated related property names from 'value' to 'text' where appropriate, and improved documentation for several Dropdown properties. Added a new example demonstrating both select and change events.
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
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.
Pull Request Overview
This PR enhances the Dropdown control by adding a text property for editable input fields and separating selection events from text change events. The PR introduces the on_select event specifically for dropdown selection changes while repurposing on_change for text input changes.
- Add
textproperty to track editable text input separately from selected value - Separate
on_selectevent for dropdown selections fromon_changefor text changes - Update documentation for previously undocumented properties
Reviewed Changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| dropdown.py | Add text property, rename events, update documentation, remove unused method |
| select_and_change_events.py | New example demonstrating both selection and text change events |
| reactive.py | New example showing reactive dropdown usage with state management |
| color_selection_with_filtering.py | Update to use new on_select event instead of on_change |
| pyproject.toml | Bump Python requirement to 3.10+ |
| properties_table.py | Refactor to use proper None comparisons and capture event properties |
| dropdown.dart | Update Dart implementation to support new text property and events |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
sdk/python/packages/flet/src/flet/controls/material/dropdown.py
Outdated
Show resolved
Hide resolved
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
This reverts commit 536e8b3.
Expanded the docstring for the border_radius property to specify accepted value types and default behavior when set to None.
Deploying flet-docs with
|
| Latest commit: |
77bc52f
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://39d8cc25.flet-docs.pages.dev |
| Branch Preview URL: | https://v1-dropdown-fix.flet-docs.pages.dev |
Introduces three new example scripts demonstrating CPU-bound task handling in Flet apps: cpu_bound_callback.py (thread-safe UI updates via callback), cpu_bound_queue.py (progress updates via asyncio.Queue), and cpu_bound_png_stream.py (streaming PNG frames from a producer thread to an async consumer). These examples illustrate best practices for integrating blocking operations with asyncio and Flet UI.
Summary by Sourcery
Add a
textproperty andon_selectevent to the Dropdown control, update the underlying implementations, refactor the properties table logic, and refresh examples to demonstrate both selection and text-change interactions.New Features:
textproperty to Python Dropdown for editable inputon_selectevent callback in Python Dropdown for selection changestextproperty andselectevent in Dart dropdown implementationEnhancements:
on_changewithon_selectwhere appropriateBuild: