-
Notifications
You must be signed in to change notification settings - Fork 589
Closed
Labels
bugSomething isn't workingSomething isn't working
Description
Duplicate Check
- I have searched the opened issues and there are no duplicates
Describe the bug
In example, each ft.Dismissible is rendered without a unique key. After swiping an item away, the list is displayed with 2 items removed instead of one. The issue is fixed if uncomment key.
Code sample
Code
import flet as ft
@ft.component
def App():
items, set_items = ft.use_state(list(range(5)))
return ft.ListView(
controls=[
ft.Dismissible(
# key=i,
content=ft.ListTile(title=ft.Text(f"Item {i}")),
dismiss_direction=ft.DismissDirection.HORIZONTAL,
background=ft.Container(bgcolor=ft.Colors.GREEN),
secondary_background=ft.Container(bgcolor=ft.Colors.RED),
on_dismiss=lambda e, index=i: set_items(
[item for item in items if item != index]
),
dismiss_thresholds={
ft.DismissDirection.HORIZONTAL: 0.1,
ft.DismissDirection.START_TO_END: 0.1,
},
)
for i in items
],
)
ft.run(lambda page: page.render_views(App))To reproduce
- run example
- swipe to dismiss any item -> the dismissed row vanishes momentarily, as well as the other row that should stay
Expected behavior
once an item is dismissed, the remaining tiles realign to match the updated items state.
Screenshots / Videos
Captures
[Upload media here]
Operating System
macOS
Operating system details
macOS
Flet version
0.69.0
Regression
No, it isn't
Suggestions
No response
Logs
Logs
[Paste your logs here]Additional details
No response
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working