Skip to content

Conversation

@FeodorFitsner
Copy link
Contributor

@FeodorFitsner FeodorFitsner commented Sep 9, 2025

Fix #5625

Summary by Sourcery

Fix lazy item building in list and grid views and restore list tile click toggling for selection controls

Bug Fixes:

  • Build ListView, ReorderableListView, and GridView items on-demand by mapping control children to ControlWidgets with proper keys instead of prebuilding lists
  • Re-enable list tile click toggling for Checkbox, CupertinoCheckbox, Radio, CupertinoRadio, Switch, and CupertinoSwitch by adding and removing ListTileClicks listeners
  • Fix Switch control to use activeThumbColor instead of deprecated activeColor property

Updated GridView, ListView, and ReorderableListView controls to wrap child widgets with ControlWidget using ValueKey based on their IDs. This improves widget identity and performance during rebuilds and reordering.
Moved ListTileClicks notifier listeners from build methods to lifecycle methods (didChangeDependencies/initState/dispose) in checkbox, radio, and switch controls. This ensures listeners are properly registered and disposed, preventing duplicate listeners and potential memory leaks. Also, fixed SwitchControl to use activeThumbColor instead of activeColor.

Fix #5627
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

Updated GridView, ListView, and ReorderableListView controls to use a custom key from item.getKey('key') if available, falling back to the item id. This improves widget identity and helps prevent unnecessary rebuilds when item order changes.
@cloudflare-workers-and-pages
Copy link

Deploying flet-docs with  Cloudflare Pages  Cloudflare Pages

Latest commit: 9df6e5f
Status: ✅  Deploy successful!
Preview URL: https://6156a994.flet-docs.pages.dev
Branch Preview URL: https://v1-listview-fix.flet-docs.pages.dev

View logs

@FeodorFitsner FeodorFitsner merged commit 4afd78a into main Sep 10, 2025
4 of 5 checks passed
@FeodorFitsner FeodorFitsner deleted the v1-listview-fix branch September 10, 2025 03:20
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.

bug: VerticalDivider Dragging is very sluggish. Both v1 and 0.28.3 are very sluggish

2 participants