mirror of
https://github.com/flutter/flutter.git
synced 2026-02-20 02:29:02 +08:00
In order to prevent the widget inspector from being able to select and inspect elements of the widget previewer's scaffolding, this commit consists of two notable changes: 1) A `debugWillManuallyInjectWidgetInspector` property has been added to `WidgetsBinding`. Setting this property to true before running the application will prevent `WidgetsApp` from injecting a `WidgetInspector` instance into the widget tree, even if the widget inspector is enabled. This means that the widget inspector will not be able to select and highlight widgets by default, requiring `WidgetInspector` to be manually wrapped around widget trees that should be inspectable. 2) The widget_preview_scaffold template has been updated to set `debugWillManuallyInjectWidgetInspector` to true by default, and to wrap individual previews provided by the developer with an instance of `WidgetInspector` to restrict widget inspection to the contents of the preview. This change also includes a minor bug fix for situations where `WidgetInspector` is inserted into an unconstrained context. Previously, the `WidgetInspector`'s `_InspectorOverlay` would attempt to take up as much space as possible, causing an overflow. To fix this, the `_InspectorOverlay` is wrapped with `Positioned.fill(...)` to force it to take on the same size as its parent `Stack`. Work towards https://github.com/flutter/flutter/issues/166423 **Demo:** https://github.com/user-attachments/assets/6d9d384c-5470-4828-983d-a6d9051a2282
Flutter
Flutter is a new way to build high-performance, cross-platform mobile, web, and desktop apps. Flutter is optimized for today's — and tomorrow's — mobile and desktop devices. We are focused on low-latency input and high frame rates on all platforms.
See the getting started guide for information about using Flutter.