flutter/packages/flutter_tools/test/widget_preview_scaffold.shard
Ben Konyi df5f110325
Add support for hiding widget subtrees from the widget inspector (#169007)
This PR introduces two new widgets:

- `DisableWidgetInspectorScope`, which hides its children from the
widget inspector
- `EnableWidgetInspectorScope`, which makes its children available to
the widget inspector

These widgets are used to inform the `WidgetInspectorService`'s
`InspectorSerializationDelegate` when it should be omitting
`DiagnosticableNodes` from the response when building the root widget
tree for the inspector.

This functionality is meant to be used by developer tooling and packages
that want to prevent unnecessary implementation details from polluting
the inspector and possibly confusing end users.

This change also includes some minor updates to the Widget Preview
scaffolding template to hide the scaffold's implementation details and
only show details for the previews defined by the user.

Part of https://github.com/flutter/flutter/issues/166423

**Widget Previewer Demo**
<img width="1606" alt="image"
src="https://github.com/user-attachments/assets/eb23160e-01c5-413f-b1d2-97985ced9ef9"
/>
2025-05-20 20:14:03 +00:00
..
widget_preview_scaffold Add support for hiding widget subtrees from the widget inspector (#169007) 2025-05-20 20:14:03 +00:00
.gitignore [ Widget Previews ] Add widget_preview_scaffold.shard to test the widget_preview_scaffold template contents (#166358) 2025-04-04 18:43:52 +00:00
README.md [ Widget Previews ] Add widget_preview_scaffold.shard to test the widget_preview_scaffold template contents (#166358) 2025-04-04 18:43:52 +00:00
update_widget_preview_scaffold.dart [ Widget Preview ] Add support for "soft" restart of individual previews (#166846) 2025-04-10 16:20:11 +00:00

Widget Preview Scaffold Testing

This directory contains a hydrated instance of the widget_preview_scaffold project template that's used for generating the environment used by flutter widget-preview start to host Widget Previews, as well as utilities to detect if the hydrated instance is outdated when compared to the template files.

Updating the Hydrated Template

If any of the widget_preview_scaffold template files are updated, widget_preview_scaffold/test/template_change_detection_smoke_test.dart will fail to indicate that the hydrated scaffold needs to be regenerated. To do this, run dart test/widget_preview_scaffold.shard/update_widget_preview_scaffold.dart to regenerate the project.