feat: make kind chip clickable to filter logs by kind#9803
feat: make kind chip clickable to filter logs by kind#9803crackedhandle wants to merge 2 commits intoflutter:masterfrom
Conversation
There was a problem hiding this comment.
Code Review
This pull request enables filtering of logs by their kind when tapping on the metadata chips in the logging screen. It introduces an onKindTapped callback to the MetadataChips and MetadataChip widgets, allowing the LoggingController to update the active filter. Feedback was provided to improve the robustness of the filter query by wrapping the kind in quotes to handle spaces and to refine the interactive area of the chips by moving the margin outside of the gesture detector.
|
@kenzieschmoll can you please take a look, and suggest me if any corresponding changes needed. |
|
Can you please include a .gif showing the new behavior? |
| iconAsset: kindIcon.iconAsset, | ||
| backgroundColor: kindColors.background, | ||
| foregroundColor: kindColors.foreground, | ||
| onTap: onKindTapped != null ? () => onKindTapped!(data.kind) : null, |
There was a problem hiding this comment.
define the callback here directly instead of passing it in from the MetadataChips constructor. As is, there is an unnecessary level of abstraction to pass it in from MetadataChips.
| child: MouseRegion( | ||
| cursor: SystemMouseCursors.click, | ||
| child: GestureDetector( |
There was a problem hiding this comment.
can we use an Inkwell instead of MouseRegion + GestureDetector?
There was a problem hiding this comment.
furthermore, it should be possible to use an Inkwell with a null onTap handler that will behave as if the Inkwell were not present in the tree. This should make it possible to revert the changes above to store chip as a local variable and just define everything in the return statement.
kenzieschmoll
left a comment
There was a problem hiding this comment.
please address comments and add tests. thanks.
|
Please also add logic to apply filters for all the chips, not just the kind chips (e.g. log level, zone, isolate, etc.) |
Fixes #9558
Problem
Users reported (via the 2025 DevTools user survey) that clicking on tags
in the log event rows had no effect. There was no way to quickly filter
logs by a specific kind (e.g.
stderr,flutter.error) by clicking onthe kind chip directly.
Solution
Made the kind chip in the log event rows clickable. When a user clicks
on a kind chip, it automatically applies a
k:<kind>filter to the logstable, showing only logs of that kind.
Changes
onKindTappedcallback parameter toMetadataChipswidget in
metadata.dartonTapcallback to the baseMetadataChipclassGestureDetectorandMouseRegionwhenonTapis provided, showing a pointer cursor on hover to indicate it is clickable
_message_column.dart, passed anonKindTappedcallback toMetadataChipsthat callscontroller.setActiveFilter(query: 'k:$kind')when the kind chip is tapped
Behavior
k:<kind>filter to the logs tableonKindTappedis optional, so existingusages of
MetadataChipswithout the callback are unaffectedTesting
Manually tested by:
flutter.frame) in a log rowk:flutter.frameand onlylogs of that kind are shown