Skip to content

Shared state to support multi screen inspection - #129452

Merged
CoderDake merged 7 commits into
flutter:masterfrom
CoderDake:multi-screen-inspection-state
Jul 28, 2023
Merged

CoderDake merged 7 commits into
flutter:masterfrom
CoderDake:multi-screen-inspection-state

Conversation

@CoderDake

@CoderDake CoderDake commented Jun 23, 2023 •

Copy link
Copy Markdown
Contributor

Fixes flutter/devtools#5931

With Multi View applications on the way, we need to be able to manage the state of multiple Inspector widgets in a consistent way.

Previously each Widget inspector would manage the state of it's own inspection. This made for a confusing and inconsistent experience when clicking on the widget inspector of different views.

This PR changes the state management to the WidgetInspectorService static instance so that all widget inspectors can share that state.

Demo

Screen.Recording.2023-07-10.at.4.26.37.PM2.mov

@github-actions github-actions Bot added the framework flutter/packages/flutter repository. See also f: labels. label Jun 23, 2023
@CoderDake CoderDake changed the title Multi screen inspection state Shared state to support multi screen inspection Jun 23, 2023
@CoderDake
CoderDake marked this pull request as ready for review July 11, 2023 14:31
@CoderDake
CoderDake requested review from goderbauer and jacob314 July 11, 2023 14:31
Comment thread packages/flutter/lib/src/widgets/widget_inspector.dart Outdated
Comment thread packages/flutter/lib/src/widgets/widget_inspector.dart Outdated
Comment thread packages/flutter/lib/src/widgets/widget_inspector.dart Outdated

@jacob314 jacob314 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Overall looks like it is on the right track.

Comment thread packages/flutter/lib/src/widgets/widget_inspector.dart Outdated
Comment thread packages/flutter/lib/src/widgets/widget_inspector.dart Outdated
Comment thread packages/flutter/lib/src/widgets/widget_inspector.dart Outdated
Comment thread packages/flutter/lib/src/widgets/widget_inspector.dart Outdated
Comment thread packages/flutter/lib/src/widgets/widget_inspector.dart Outdated
Comment thread packages/flutter/lib/src/widgets/widget_inspector.dart Outdated
Comment thread packages/flutter/lib/src/widgets/widget_inspector.dart Outdated
@wanjm

wanjm commented Jul 15, 2023

Copy link
Copy Markdown

where can i get the multi window example in the above video;

@CoderDake

Copy link
Copy Markdown
Contributor Author

@wanjm It can be found here:
https://github.com/goderbauer/mvp

Comment thread packages/flutter/lib/src/widgets/widget_inspector.dart Outdated
@CoderDake

CoderDake commented Jul 21, 2023 •

Copy link
Copy Markdown
Contributor Author

Fixes flutter/devtools#5935

@CoderDake

Copy link
Copy Markdown
Contributor Author

Fixes flutter/devtools#5931

@github-actions github-actions Bot added a: text input Entering text in a text field or keyboard related problems tool Affects the "flutter" command-line tool. See also t: labels. p: material_ui material_ui package in flutter/packages f: scrolling Viewports, list views, slivers, etc. labels Jul 26, 2023
@CoderDake
CoderDake force-pushed the multi-screen-inspection-state branch from 78adb4b to fa66401 Compare July 26, 2023 21:03
Comment thread packages/flutter/lib/src/widgets/widget_inspector.dart
Comment thread packages/flutter/lib/src/widgets/widget_inspector.dart Outdated
Comment thread packages/flutter/lib/src/widgets/widget_inspector.dart Outdated
Comment thread packages/flutter/lib/src/widgets/widget_inspector.dart Outdated
final double maxWidth = size.width - 2 * (_kScreenEdgeMargin + _kTooltipPadding);
final double maxWidth = math.max(
size.width - 2 * (_kScreenEdgeMargin + _kTooltipPadding),
0,

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

good catch! should we just short circuit and not try to draw anything is maxWidth <= 0?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Perhaps we could but I don't know enough about these cases to know if we always want to.

Comment thread packages/flutter/lib/src/widgets/widget_inspector.dart

@jacob314 jacob314 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM once these small nits are resolved.

@goderbauer goderbauer left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM

Comment thread packages/flutter/test/widgets/widget_inspector_test.dart Outdated
Comment thread packages/flutter/test/widgets/widget_inspector_test.dart Outdated
Comment thread packages/flutter/test/widgets/widget_inspector_test.dart Outdated
Comment thread packages/flutter/test/widgets/widget_inspector_test.dart Outdated

@jacob314 jacob314 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

lgtm

@CoderDake
CoderDake merged commit f0163c0 into flutter:master Jul 28, 2023
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Jul 29, 2023
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Jul 29, 2023
auto-submit Bot pushed a commit to flutter/packages that referenced this pull request Jul 29, 2023
flutter/flutter@e81907e...c2b40ca

2023-07-29 [email protected] Roll Flutter Engine from 24ccd8fffbcb to 5184062f7543 (2 revisions) (flutter/flutter#131554)
2023-07-29 [email protected] Roll Flutter Engine from 90bc483524fe to 24ccd8fffbcb (1 revision) (flutter/flutter#131540)
2023-07-29 [email protected] Roll Flutter Engine from 27128f29a066 to 90bc483524fe (2 revisions) (flutter/flutter#131535)
2023-07-29 [email protected] Roll Flutter Engine from 69b5b77edaf7 to 27128f29a066 (1 revision) (flutter/flutter#131533)
2023-07-29 [email protected] Roll Flutter Engine from b854fdea2715 to 69b5b77edaf7 (1 revision) (flutter/flutter#131532)
2023-07-29 [email protected] Roll Flutter Engine from 0a5b2f521539 to b854fdea2715 (1 revision) (flutter/flutter#131530)
2023-07-29 49699333+dependabot[bot]@users.noreply.github.com Bump github/codeql-action from 2.21.0 to 2.21.2 (flutter/flutter#131512)
2023-07-29 [email protected] Roll Flutter Engine from f5c17f0e2406 to 0a5b2f521539 (2 revisions) (flutter/flutter#131529)
2023-07-29 [email protected] Roll Flutter Engine from b4bf592279d6 to f5c17f0e2406 (1 revision) (flutter/flutter#131525)
2023-07-28 [email protected] Roll Flutter Engine from da3721adba65 to b4bf592279d6 (2 revisions) (flutter/flutter#131519)
2023-07-28 [email protected] Roll Flutter Engine from aa1278eb7b84 to da3721adba65 (5 revisions) (flutter/flutter#131514)
2023-07-28 [email protected] Reland - Fix floating SnackBar throws when FAB is on the top (flutter/flutter#131475)
2023-07-28 [email protected] Device discovery output cleanup (flutter/flutter#131223)
2023-07-28 [email protected] Roll Flutter Engine from 182e1189873b to aa1278eb7b84 (2 revisions) (flutter/flutter#131500)
2023-07-28 [email protected] Update `BottomSheet.enableDrag`  & `BottomSheet.showDragHandle` docs for animation controller (flutter/flutter#131484)
2023-07-28 [email protected] Deprecate `useMaterial3` parameter in `ThemeData.copyWith()` (flutter/flutter#131455)
2023-07-28 [email protected] Roll Flutter Engine from 73615d66b2fe to 182e1189873b (2 revisions) (flutter/flutter#131492)
2023-07-28 [email protected] Add `CheckedPopupMenuItemâ��.labelTextStyle` and update default text style for Material 3 (flutter/flutter#131060)
2023-07-28 [email protected] Remove obsolete `complex_layout_ios__compile.dart` test (flutter/flutter#131487)
2023-07-28 [email protected] Roll Flutter Engine from e97014c71014 to 73615d66b2fe (3 revisions) (flutter/flutter#131485)
2023-07-28 [email protected] Shared state to support multi screen inspection  (flutter/flutter#129452)
2023-07-28 [email protected] Roll Packages from f4ae933 to 10aab44 (4 revisions) (flutter/flutter#131483)
2023-07-28 [email protected] Move ios_app_with_extensions_test to host only (flutter/flutter#131441)
2023-07-28 [email protected] Update `Card.color` documentation for Material 3 (flutter/flutter#131468)

If this roll has caused a breakage, revert this CL and stop the roller
using the controls here:
https://autoroll.skia.org/r/flutter-packages
Please CC [email protected],[email protected],[email protected] on the revert to ensure that a human
is aware of the problem.

To file a bug in Packages: https://github.com/flutter/flutter/issues/new/choose

To report a problem with the AutoRoller itself, please file a bug:
https://bugs.chromium.org/p/skia/issues/entry?template=Autoroller+Bug

Documentation for the AutoRoller is here:
https://skia.googlesource.com/buildbot/+doc/main/autoroll/README.md
LouiseHsu pushed a commit to LouiseHsu/flutter that referenced this pull request Jul 31, 2023
![](https://media.giphy.com/media/KY2dtJNlGPH08w41FN/giphy.gif)

Fixes flutter/devtools#5931

With Multi View applications on the way, we need to be able to manage
the state of multiple Inspector widgets in a consistent way.

Previously each Widget inspector would manage the state of it's own
inspection. This made for a confusing and inconsistent experience when
clicking on the widget inspector of different views.

This PR changes the state management to the WidgetInspectorService
static instance so that all widget inspectors can share that state.

# Demo


https://github.com/flutter/flutter/assets/1386322/70fd18dc-5827-4dcd-8cb7-ef20e6221291
vashworth pushed a commit to vashworth/flutter that referenced this pull request Aug 2, 2023
![](https://media.giphy.com/media/KY2dtJNlGPH08w41FN/giphy.gif)

Fixes flutter/devtools#5931

With Multi View applications on the way, we need to be able to manage
the state of multiple Inspector widgets in a consistent way.

Previously each Widget inspector would manage the state of it's own
inspection. This made for a confusing and inconsistent experience when
clicking on the widget inspector of different views.

This PR changes the state management to the WidgetInspectorService
static instance so that all widget inspectors can share that state.

# Demo


https://github.com/flutter/flutter/assets/1386322/70fd18dc-5827-4dcd-8cb7-ef20e6221291
creatorpiyush pushed a commit to creatorpiyush/packages that referenced this pull request Jun 10, 2026
flutter/flutter@e81907e...c2b40ca

2023-07-29 [email protected] Roll Flutter Engine from 24ccd8fffbcb to 5184062f7543 (2 revisions) (flutter/flutter#131554)
2023-07-29 [email protected] Roll Flutter Engine from 90bc483524fe to 24ccd8fffbcb (1 revision) (flutter/flutter#131540)
2023-07-29 [email protected] Roll Flutter Engine from 27128f29a066 to 90bc483524fe (2 revisions) (flutter/flutter#131535)
2023-07-29 [email protected] Roll Flutter Engine from 69b5b77edaf7 to 27128f29a066 (1 revision) (flutter/flutter#131533)
2023-07-29 [email protected] Roll Flutter Engine from b854fdea2715 to 69b5b77edaf7 (1 revision) (flutter/flutter#131532)
2023-07-29 [email protected] Roll Flutter Engine from 0a5b2f521539 to b854fdea2715 (1 revision) (flutter/flutter#131530)
2023-07-29 49699333+dependabot[bot]@users.noreply.github.com Bump github/codeql-action from 2.21.0 to 2.21.2 (flutter/flutter#131512)
2023-07-29 [email protected] Roll Flutter Engine from f5c17f0e2406 to 0a5b2f521539 (2 revisions) (flutter/flutter#131529)
2023-07-29 [email protected] Roll Flutter Engine from b4bf592279d6 to f5c17f0e2406 (1 revision) (flutter/flutter#131525)
2023-07-28 [email protected] Roll Flutter Engine from da3721adba65 to b4bf592279d6 (2 revisions) (flutter/flutter#131519)
2023-07-28 [email protected] Roll Flutter Engine from aa1278eb7b84 to da3721adba65 (5 revisions) (flutter/flutter#131514)
2023-07-28 [email protected] Reland - Fix floating SnackBar throws when FAB is on the top (flutter/flutter#131475)
2023-07-28 [email protected] Device discovery output cleanup (flutter/flutter#131223)
2023-07-28 [email protected] Roll Flutter Engine from 182e1189873b to aa1278eb7b84 (2 revisions) (flutter/flutter#131500)
2023-07-28 [email protected] Update `BottomSheet.enableDrag`  & `BottomSheet.showDragHandle` docs for animation controller (flutter/flutter#131484)
2023-07-28 [email protected] Deprecate `useMaterial3` parameter in `ThemeData.copyWith()` (flutter/flutter#131455)
2023-07-28 [email protected] Roll Flutter Engine from 73615d66b2fe to 182e1189873b (2 revisions) (flutter/flutter#131492)
2023-07-28 [email protected] Add `CheckedPopupMenuItemâ��.labelTextStyle` and update default text style for Material 3 (flutter/flutter#131060)
2023-07-28 [email protected] Remove obsolete `complex_layout_ios__compile.dart` test (flutter/flutter#131487)
2023-07-28 [email protected] Roll Flutter Engine from e97014c71014 to 73615d66b2fe (3 revisions) (flutter/flutter#131485)
2023-07-28 [email protected] Shared state to support multi screen inspection  (flutter/flutter#129452)
2023-07-28 [email protected] Roll Packages from f4ae933 to 10aab44 (4 revisions) (flutter/flutter#131483)
2023-07-28 [email protected] Move ios_app_with_extensions_test to host only (flutter/flutter#131441)
2023-07-28 [email protected] Update `Card.color` documentation for Material 3 (flutter/flutter#131468)

If this roll has caused a breakage, revert this CL and stop the roller
using the controls here:
https://autoroll.skia.org/r/flutter-packages
Please CC [email protected],[email protected],[email protected] on the revert to ensure that a human
is aware of the problem.

To file a bug in Packages: https://github.com/flutter/flutter/issues/new/choose

To report a problem with the AutoRoller itself, please file a bug:
https://bugs.chromium.org/p/skia/issues/entry?template=Autoroller+Bug

Documentation for the AutoRoller is here:
https://skia.googlesource.com/buildbot/+doc/main/autoroll/README.md
bisor0627 pushed a commit to bisor0627/packages that referenced this pull request Jun 19, 2026
flutter/flutter@e81907e...c2b40ca

2023-07-29 [email protected] Roll Flutter Engine from 24ccd8fffbcb to 5184062f7543 (2 revisions) (flutter/flutter#131554)
2023-07-29 [email protected] Roll Flutter Engine from 90bc483524fe to 24ccd8fffbcb (1 revision) (flutter/flutter#131540)
2023-07-29 [email protected] Roll Flutter Engine from 27128f29a066 to 90bc483524fe (2 revisions) (flutter/flutter#131535)
2023-07-29 [email protected] Roll Flutter Engine from 69b5b77edaf7 to 27128f29a066 (1 revision) (flutter/flutter#131533)
2023-07-29 [email protected] Roll Flutter Engine from b854fdea2715 to 69b5b77edaf7 (1 revision) (flutter/flutter#131532)
2023-07-29 [email protected] Roll Flutter Engine from 0a5b2f521539 to b854fdea2715 (1 revision) (flutter/flutter#131530)
2023-07-29 49699333+dependabot[bot]@users.noreply.github.com Bump github/codeql-action from 2.21.0 to 2.21.2 (flutter/flutter#131512)
2023-07-29 [email protected] Roll Flutter Engine from f5c17f0e2406 to 0a5b2f521539 (2 revisions) (flutter/flutter#131529)
2023-07-29 [email protected] Roll Flutter Engine from b4bf592279d6 to f5c17f0e2406 (1 revision) (flutter/flutter#131525)
2023-07-28 [email protected] Roll Flutter Engine from da3721adba65 to b4bf592279d6 (2 revisions) (flutter/flutter#131519)
2023-07-28 [email protected] Roll Flutter Engine from aa1278eb7b84 to da3721adba65 (5 revisions) (flutter/flutter#131514)
2023-07-28 [email protected] Reland - Fix floating SnackBar throws when FAB is on the top (flutter/flutter#131475)
2023-07-28 [email protected] Device discovery output cleanup (flutter/flutter#131223)
2023-07-28 [email protected] Roll Flutter Engine from 182e1189873b to aa1278eb7b84 (2 revisions) (flutter/flutter#131500)
2023-07-28 [email protected] Update `BottomSheet.enableDrag`  & `BottomSheet.showDragHandle` docs for animation controller (flutter/flutter#131484)
2023-07-28 [email protected] Deprecate `useMaterial3` parameter in `ThemeData.copyWith()` (flutter/flutter#131455)
2023-07-28 [email protected] Roll Flutter Engine from 73615d66b2fe to 182e1189873b (2 revisions) (flutter/flutter#131492)
2023-07-28 [email protected] Add `CheckedPopupMenuItemâ��.labelTextStyle` and update default text style for Material 3 (flutter/flutter#131060)
2023-07-28 [email protected] Remove obsolete `complex_layout_ios__compile.dart` test (flutter/flutter#131487)
2023-07-28 [email protected] Roll Flutter Engine from e97014c71014 to 73615d66b2fe (3 revisions) (flutter/flutter#131485)
2023-07-28 [email protected] Shared state to support multi screen inspection  (flutter/flutter#129452)
2023-07-28 [email protected] Roll Packages from 2265a78 to f96f040 (4 revisions) (flutter/flutter#131483)
2023-07-28 [email protected] Move ios_app_with_extensions_test to host only (flutter/flutter#131441)
2023-07-28 [email protected] Update `Card.color` documentation for Material 3 (flutter/flutter#131468)

If this roll has caused a breakage, revert this CL and stop the roller
using the controls here:
https://autoroll.skia.org/r/flutter-packages
Please CC [email protected],[email protected],[email protected] on the revert to ensure that a human
is aware of the problem.

To file a bug in Packages: https://github.com/flutter/flutter/issues/new/choose

To report a problem with the AutoRoller itself, please file a bug:
https://bugs.chromium.org/p/skia/issues/entry?template=Autoroller+Bug

Documentation for the AutoRoller is here:
https://skia.googlesource.com/buildbot/+doc/main/autoroll/README.md
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

a: text input Entering text in a text field or keyboard related problems f: scrolling Viewports, list views, slivers, etc. framework flutter/packages/flutter repository. See also f: labels. p: material_ui material_ui package in flutter/packages tool Affects the "flutter" command-line tool. See also t: labels.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Widget inspection Magnifying glass experience broken in Multi View app

4 participants