feat: make kind chip clickable to filter logs by kind
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 on
the 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 logs
table, showing only logs of that kind.
Changes
- Added an optional
onKindTappedcallback parameter toMetadataChipswidget inmetadata.dart - Added an optional
onTapcallback to the baseMetadataChipclass - Wrapped the chip with
GestureDetectorandMouseRegionwhenonTapis provided, showing a pointer cursor on hover to indicate it is clickable - In
_message_column.dart, passed anonKindTappedcallback toMetadataChipsthat callscontroller.setActiveFilter(query: 'k:$kind')when the kind chip is tapped
Behavior
- Clicking a kind chip → applies a
k:<kind>filter to the logs table - Clicking the row outside the tag → still selects the log as before
- No breaking changes →
onKindTappedis optional, so existing usages ofMetadataChipswithout the callback are unaffected
Testing
Manually tested by:
- Running a Flutter app connected to DevTools
- Opening the Logging screen
- Clicking on a kind chip (e.g.
flutter.frame) in a log row - Verified that the filter field updates to
k:flutter.frameand only logs of that kind are shown - Verified that clicking outside the chip still selects the log row
@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?
Please also add logic to apply filters for all the chips, not just the kind chips (e.g. log level, zone, isolate, etc.)
Closing as stale; please re-open if you'd like to land.