Skip to content

Tool: Add search and filtering to widget preview scaffold#184023

Open
NamanGoyalK wants to merge 3 commits intoflutter:masterfrom
NamanGoyalK:fix-issue-175663
Open

Tool: Add search and filtering to widget preview scaffold#184023
NamanGoyalK wants to merge 3 commits intoflutter:masterfrom
NamanGoyalK:fix-issue-175663

Conversation

@NamanGoyalK
Copy link
Contributor

This PR introduces search and filtering capabilities to the Widget Preview environment UI, addressing the navigation friction when developers are working with a large number of annotated previews.

Changes introduced:

  • Added a PreviewSearchControls widget to controls.dart.tmpl featuring a TextField for text-based filtering.
  • Implemented a PopupMenuButton filter list to toggle search inclusion for Group Name, Preview Name, Containing Script, and Containing Package.
  • Added standard ValueNotifier state management in widget_preview_scaffold_controller.dart.tmpl to seamlessly sync the text input and active filters with the _filteredPreviewSet.
  • Safely handled dtdServices edge cases to ensure the search functionality works in tandem with Editor DTD service availability.
recording_2026-03-23_23.31.40.mp4

Related Issues

Fixes #175663

Pre-launch Checklist

@flutter-dashboard
Copy link

It looks like this pull request may not have tests. Please make sure to add tests or get an explicit test exemption before merging.

If you are not sure if you need tests, consider this rule of thumb: the purpose of a test is to make sure someone doesn't accidentally revert the fix. Ask yourself, is there anything in your PR that you feel it is important we not accidentally revert back to how it was before your fix?

Reviewers: Read the Tree Hygiene page and make sure this patch meets those guidelines before LGTMing. If you believe this PR qualifies for a test exemption, contact "@test-exemption-reviewer" in the #hackers channel in Discord (don't just cc them here, they won't see it!). The test exemption team is a small volunteer group, so all reviewers should feel empowered to ask for tests, without delegating that responsibility entirely to the test exemption group.

@github-actions github-actions bot added the tool Affects the "flutter" command-line tool. See also t: labels. label Mar 23, 2026
Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces search functionality for widget previews, allowing users to filter previews by a search query and specific fields such as group name, preview name, containing script, and package. The PreviewSearchControls widget, including a search text field and a filter dropdown, has been added and integrated into the WidgetPreviewControls. The WidgetPreviewScaffoldController now manages the search query and filter states, updates the filtered preview set accordingly, and disposes of new ValueNotifiers. Review comments suggest improving maintainability by centralizing the definition of search filters to reduce duplication in controls.dart.tmpl and extracting a helper method for search field notifiers in widget_preview_scaffold_controller.dart.tmpl.

Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces search functionality to the widget preview scaffold. It adds new UI controls for entering a search query and selecting search filters (group name, preview name, containing script, containing package). The controller has been updated to manage the search state and apply these filters to the displayed widget previews. A suggestion was made to remove a redundant call to _searchController.clear() in PreviewSearchControls, as widget.controller.updateSearchQuery('') already handles the text field update through its listener, promoting a cleaner, unidirectional data flow.

Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces search functionality to the widget preview scaffold. It adds new UI controls for search input and filter selection, and updates the WidgetPreviewScaffoldController to manage search state and apply filtering logic based on group name, preview name, containing script, or containing package. Feedback includes a critical type mismatch where an Iterable is assigned to a List, which needs to be converted using .toList(), and a redundant call to updateSearchQuery after _searchController.clear() which should be removed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

tool Affects the "flutter" command-line tool. See also t: labels.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Support searching and/or filtering previews and preview groups

1 participant