-
Notifications
You must be signed in to change notification settings - Fork 29.7k
_SearchBarState should dispose FocusNode, if it created it. #133947
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
chunhtai
left a comment
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
|
I think this may not be well solved. We don't have
I think a more appropriate implementation would be something like this: @override
void initState() {
super.initState();
// ...
_focusNode = widget.focusNode ?? FocusNode();
}
@override
void didUpdateWidget(TradingChart oldWidget) {
super.didUpdateWidget(oldWidget);
if (widget.focusNode != oldWidget.focusNode) {
if (oldWidget.focusNode == null) _focusNode.dispose();
_focusNode = widget.focusNode ?? FocusNode();
}
}
@override
void dispose() {
// ...
if (widget.focusNode == null) {
_focusNode.dispose();
}
super.dispose();
}WDYT? |
|
@mateusfccp |
|
@chunhtai Sure, as soon as I have some time! |
|
@chunhtai It seems that this issue has already been fixed in a later PR. |
No description provided.