You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Handle non-event on_ fields in diff and protocol logic (#5742)
* Handle non-event 'on_' fields in diff and protocol logic
Updates diffing and protocol encoding logic to distinguish 'on_' fields that are not events using metadata. Adds integration tests for color scheme, new test cases for 'on_' fields, and updates ColorScheme to mark non-event 'on_' fields. This improves accuracy of change detection and serialization for controls with 'on_' prefixed fields.
* Refine event attribute detection in Jinja templates
Updated logic in material Jinja templates to more accurately classify event attributes by checking config.extra.events. Also updated colorscheme.md to pass additional options for documentation rendering.
* Refactor event field handling and update color scheme test
Simplifies checks for 'event' metadata in object_patch.py and protocol.py by using get() with a default value. Updates color scheme integration test to use a more comprehensive set of ColorScheme properties and renames screenshot references for clarity.
* Improve scrollable controls and spacing in views
Added wrapIntoScrollableView option to ScrollableControl and enabled it for Column, Row, and View controls to ensure proper scroll behavior. Enhanced ListViewControl to handle spacing and dividers between children more flexibly. Refined Scrollbar visibility logic and removed unnecessary exception in ViewControl.
* Revamp color scheme integration test and screenshots
Expanded the color scheme integration test to cover palettes, surface roles, accents, buttons, themed card, and error banner. Replaced the single color_scheme.png screenshot with multiple targeted screenshots and updated the test logic and golden images accordingly.
* Rename dismissable files and add declarative example
Renamed 'dismissable_list_tiles.py' and its media file to 'dismissible_list_tiles.py' for consistency. Added a new example 'remove_on_dismiss_declarative.py' demonstrating proper use of keys with Dismissible in declarative components. Updated documentation to reflect these changes and provide guidance on key usage.
* Improve ListView prototype item handling
Enhanced logic for determining the prototype item in ListViewControl (Dart) to use either a provided prototype or the first control when appropriate. Updated Python docstrings to clarify when prototype_item and first_item_prototype properties take effect.
* Update integration test suite and doc formatting
Limits macOS integration tests to the 'controls/theme' suite for focused testing. Improves docstring formatting in ListView by splitting 'Note:' onto its own line for better readability.
* Refactor color scheme test UI and update goldens
Reorganized color palette and button rows in test_color_scheme.py, added ScrollKey to palette rows, removed redundant spacing and text labels, and adjusted error banner border radius. Updated corresponding golden images to reflect UI changes for macOS color scheme integration tests.
* Update macOS color scheme golden images and test
Regenerated golden images for macOS color scheme integration tests and adjusted test window height from 600 to 300 to match new screenshot dimensions.
* Refactor color scheme test to use Screenshot widgets
Updated the color scheme integration test to wrap palette, button, card, and banner controls in Screenshot widgets for more precise screenshot capturing. Adjusted window height and consolidated button rows. Updated screenshot assertions to use the new capture method for each control.
* Enable all test suites in macOS integration workflow
Restores the full test suite matrix in the macOS integration tests workflow, running tests for apps, examples, and all controls. Previously, only the 'controls/theme' suite was enabled.
* Fix doc filter regex and marker doc typo
Corrected a typo in the Marker class docstring in marker_layer.py and updated the filter regex in mkdocs.yml to properly match method names for documentation exclusion.
Always specify a key for `Dismissible` when using inside Flet component.
26
+
///
27
+
28
+
The issue you may encounter here is specific to the `Dismissible` control used inside Flet component (declarative UI).
29
+
30
+
When a user swipes (dismisses) an item, that widget is marked as “dismissed” on the Flutter side and effectively removed from the UI.
31
+
However, when Flet recalculates the UI diff on the Python side, it may attempt to reuse widgets in the list based on their order rather than their identity.
32
+
33
+
If no key is provided, Flet’s diffing algorithm can’t tell that a particular `Dismissible` corresponds to a specific item — so it assumes the items have merely shifted.
34
+
That leads to update commands like:
35
+
36
+
> “Update text in items 0…N-1, then delete the last item (N).”
37
+
38
+
On Flutter’s side, though, the already-dismissed `Dismissible` widget in the middle of the list can’t be updated — it’s gone — causing runtime errors.
39
+
40
+
**Always assign a stable, unique key to each `Dismissible`, typically based on the item’s identifier or index.**
0 commit comments