Repository navigation
[Inspector V2] Handle selection of an implementation widget in the app - #8494
Merged
Merged
Conversation
| if (implementationWidgetsHidden.value && newSelection != null) { | ||
| final isInTree = | ||
| valueToInspectorTreeNode.containsKey(newSelection.valueRef); | ||
| final hasParent = newSelection.parent != null; |
Member
There was a problem hiding this comment.
just for my understanding, how does the presence of a parent tell us whether whether the user selected an implementation widget?
Member
Author
There was a problem hiding this comment.
The Widget Inspector's response includes the children for each node, but not the parent. When DevTools receives the response, it walks down the tree and sets the parent for a node. This is basically a way of check that not only is the node not in the current tree, but it was never part of the response we were given. Since we know the implementation widgets are hidden, we can assume that the selected node is an implementation widget.
kenzieschmoll
approved these changes
Oct 30, 2024
mossmana
pushed a commit
to mossmana/devtools
that referenced
this pull request
Oct 31, 2024
7 tasks
kenzieschmoll
pushed a commit
that referenced
this pull request
Nov 20, 2024
This was referenced Dec 11, 2024
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #8465
This PR fixes two issues around widget selection:
A user has implementation widgets visible in their tree, but they select an implementation widget in their app that is currently hidden behind a collapsed group
Before: The tree would not scroll, and no node would be selected
Now: The collapsed group is expanded, and we scroll to and select the implementation widget
A user has hidden all implementation widgets in their tree, but they select an implementation widget in their app
Before: The selection overlay would disappear on their app, and DevTools would scroll to the root of their tree
Now: The selection overlay stays on their app, DevTools does not scroll but shows an error notification that they need to toggle "Show Implementation Widgets" to inspect the selected widget
Note: An alternative would be to add logic to Flutter's Widget Inspector so that when DevTools has implementation widgets hidden, we don't let the user select them in their app. I'm not sure if that would be more or less confusing.