-
Notifications
You must be signed in to change notification settings - Fork 27.3k
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
SegmentedButton should not create new MaterialStatesController in every build. #133949
Conversation
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.
LGTM, fyi @HansMuller
Shouldn't we be trying to dispose controllers for segments that no longer exist? |
Yes, this may great next improvement for the code. I am not familiar with code enough to implement it. Can you create it? |
Unfortunately this PR prevents a source of unnecessary allocations but creates a leak (#133949 (comment)). I suppose what needs to be done is to diff the old and new lists of segments in a https://api.flutter.dev/flutter/widgets/State/didUpdateWidget.html override and dispose the discarded segments. |
Thanks. I will prepare update: #134061 |
Fix: #134064 |
No description provided.