devtools icon indicating copy to clipboard operation
devtools copied to clipboard

feat: make kind chip clickable to filter logs by kind

Open crackedhandle opened this issue 7 months ago • 3 comments

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 onKindTapped callback parameter to MetadataChips widget in metadata.dart
  • Added an optional onTap callback to the base MetadataChip class
  • Wrapped the chip with GestureDetector and MouseRegion when onTap is provided, showing a pointer cursor on hover to indicate it is clickable
  • In _message_column.dart, passed an onKindTapped callback to MetadataChips that calls controller.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 → onKindTapped is optional, so existing usages of MetadataChips without the callback are unaffected

Testing

Manually tested by:

  1. Running a Flutter app connected to DevTools
  2. Opening the Logging screen
  3. Clicking on a kind chip (e.g. flutter.frame) in a log row
  4. Verified that the filter field updates to k:flutter.frame and only logs of that kind are shown
  5. Verified that clicking outside the chip still selects the log row

crackedhandle avatar Apr 23 '26 06:04 crackedhandle

@kenzieschmoll can you please take a look, and suggest me if any corresponding changes needed.

crackedhandle avatar Apr 23 '26 10:04 crackedhandle

Can you please include a .gif showing the new behavior?

kenzieschmoll avatar Apr 28 '26 18:04 kenzieschmoll

Please also add logic to apply filters for all the chips, not just the kind chips (e.g. log level, zone, isolate, etc.)

kenzieschmoll avatar Apr 28 '26 19:04 kenzieschmoll

Closing as stale; please re-open if you'd like to land.

srawlins avatar Jul 06 '26 16:07 srawlins