Fix widget inspector control layout and add safe area regression test#180789
Fix widget inspector control layout and add safe area regression test#180789elliette merged 14 commits intoflutter:masterfrom
Conversation
There was a problem hiding this comment.
Code Review
This pull request correctly fixes an issue where the Widget Inspector controls could overlap with system UI by not respecting safe area insets. The change adjusts the bottom padding of the inspector controls using MediaQuery.viewPaddingOf(context).bottom. A regression test is also added to ensure that the application content being previewed is not incorrectly inset, which is a good safeguard against regressions. My feedback includes a suggestion to add a direct test for the control's position to fully cover the fix.
|
Hi @gktirkha - thank you for opening a PR! To make this easier to review, could you file an issue in the Flutter repo that describes this issue (along with steps on how to reproduce) and link to it in this PR. Thank you! |
dev/integration_tests/widget_preview_scaffold/test/widget_inspector_test.dart
Outdated
Show resolved
Hide resolved
elliette
left a comment
There was a problem hiding this comment.
Sorry for the delay! This is looking good. Just a couple more requests. Thank you!
…to appropriate direction
elliette
left a comment
There was a problem hiding this comment.
LGTM once tests are passing. Thank you!
f22ee11 to
7171cbd
Compare
faf6ae6 to
1af656c
Compare
1af656c to
a561882
Compare
|
Hi @elliette, just checking in to see if there are any updates on this PR. Thanks for taking a look! |
Hi! Do you mind looking into the test failures to see if they are related to this PR? It looks the failing tests are the widget tests. Merging in the |
I Don't think that it is related bin/flutter test --reporter=expanded --file-reporter=json:/b/s/w/ir/x/t/metrics_1769943602511512.json --test-randomize-ordering-seed=20260201 --fatal-warnings --track-widget-creation test/widgets/
Resolving dependencies...
The current Flutter SDK version is 0.0.0-unknown.
Because _flutter_packages depends on webview_flutter_wkwebview 3.23.5 which requires Flutter SDK version >=3.35.0, version solving failed.
Failed to update packages.
but if I do use flutter from main branch (system flutter) Resolving dependencies...
Downloading packages...
_fe_analyzer_shared 92.0.0 (94.0.0 available)
adaptive_breakpoints 0.1.7 (discontinued)
analyzer 9.0.0 (10.0.2 available)
archive 3.6.1 (4.0.7 available)
dart_style 3.1.3 (3.1.5 available)
device_info 2.0.3 (discontinued replaced by device_info_plus)
gcloud 0.8.19 (0.9.0 available)
google_fonts 6.3.3 (8.0.1 available)
google_mobile_ads 5.1.0 (7.0.0 available)
googleapis 14.0.0 (16.0.0 available)
hooks 1.0.0 (1.0.1 available)
isolate 2.1.1 (discontinued)
js 0.7.2 (discontinued)
json_annotation 4.9.0 (4.10.0 available)
lints 6.0.0 (6.1.0 available)
meta 1.18.0 (1.18.1 available)
objective_c 9.2.3 (9.3.0 available)
pedantic 1.11.1 (discontinued replaced by lints)
source_span 1.10.1 (1.10.2 available)
url_launcher_ios 6.3.6 (6.4.0 available)
video_player_avfoundation 2.8.10 (2.9.1 available)
webview_flutter 4.9.0 (4.13.1 available)
webview_flutter_android 3.16.9 (4.10.11 available)
webview_flutter_wkwebview 3.23.5 (3.23.6 available)
Got dependencies!
5 packages are discontinued.
19 packages have newer versions incompatible with dependency constraints.
Try `flutter pub outdated` for more information.
Shuffling test order with --test-randomize-ordering-seed=20260201
Creation failed, path = '/b' (OS Error: Read-only file system, errno = 30)
dart:io _File.createSync
package:test_core/src/runner.dart 87:32 new Runner.<fn>.createFileReporter
package:test_core/src/runner.dart 99:15 new Runner.<fn>
dart:async runZoned
package:test_core/src/runner/configuration.dart 865:7 Configuration.asCurrent
package:test_core/src/runner.dart 76:50 new Runner
package:test_core/src/executable.dart 149:14 _execute
package:test_core/src/executable.dart 38:9 main
package:flutter_tools/src/test/test_wrapper.dart 31:16 _DefaultTestWrapper.main
package:flutter_tools/src/test/runner.dart 187:25 FlutterTestRunner.runTests
package:flutter_tools/src/commands/test.dart 662:33 TestCommand.runCommand
package:flutter_tools/src/runner/flutter_command.dart 1559:27 FlutterCommand.run.<fn>
package:flutter_tools/src/base/context.dart 154:19 AppContext.run.<fn>
package:args/command_runner.dart 212:13 CommandRunner.runCommand
package:flutter_tools/src/runner/flutter_command_runner.dart 487:9 FlutterCommandRunner.runCommand.<fn>
package:flutter_tools/src/base/context.dart 154:19 AppContext.run.<fn>
package:flutter_tools/src/runner/flutter_command_runner.dart 422:5 FlutterCommandRunner.runCommand
package:flutter_tools/runner.dart 104:11 run.<fn>.<fn>
package:flutter_tools/src/base/context.dart 154:19 AppContext.run.<fn>
package:flutter_tools/executable.dart 103:3 main
This is an unexpected error. Please file an issue at http://github.com/dart-lang/test
with the stack trace and instructions for reproducing the error.
|
Thank you! Looks like the tree is currently broken. Let's wait for that to resolve and then make sure the tests are passing. Sorry for wait! |
did this, // Before // After Using viewPadding.bottom alone breaks on devices/environments with no bottom safe area inset (Android, older iPhones, tests) where it returns 0. |
|
hi @elliette I Believe all widgets tests related to pr have passed, let me know if i can do anything regarding failed test cases |
Hi @gktirkha - it looks like the |
Oops!, forgot that |
flutter/flutter@d117642...dd64978 2026-03-18 [email protected] Roll Skia from 2fb5fa71eb12 to f0a13e5efbad (2 revisions) (flutter/flutter#183830) 2026-03-18 [email protected] Roll Skia from ae3d36cb9e29 to 2fb5fa71eb12 (3 revisions) (flutter/flutter#183823) 2026-03-18 [email protected] Linux reuse sibling (flutter/flutter#183653) 2026-03-18 [email protected] Roll Skia from 84a180a1fa80 to ae3d36cb9e29 (4 revisions) (flutter/flutter#183812) 2026-03-18 [email protected] fix(web): handle asynchronously disposed platform views (flutter/flutter#183666) 2026-03-17 [email protected] (Test cross-imports) Remove legacy Material import from sliver_constraints_test (flutter/flutter#183351) 2026-03-17 [email protected] Fix Android Studio pluginsPath when version is unknown (do not use 0.0) (flutter/flutter#182681) 2026-03-17 [email protected] Fixes animation glitch into bottom sheet (flutter/flutter#183303) 2026-03-17 [email protected] Handle#6537 second grouped test (flutter/flutter#182529) 2026-03-17 [email protected] Add a Clarification for the docs of suggestionsBuilder of SearchAnchor (flutter/flutter#183106) 2026-03-17 [email protected] Remove obsolete null checks from style guide (flutter/flutter#181703) 2026-03-17 [email protected] [Impeller] Do not delete the GL object in a HandleGLES if the handle has a cleanup callback (flutter/flutter#183561) 2026-03-17 [email protected] Encode source file patches as UTF-8 in the code formatter script (flutter/flutter#183761) 2026-03-17 [email protected] Fix widget inspector control layout and add safe area regression test (flutter/flutter#180789) 2026-03-17 [email protected] Reland "[Android] Add mechanism for setting Android engine flags via Android manifest (take 2)" (flutter/flutter#182522) 2026-03-17 [email protected] fix(web): fix crash in Skwasm when transferring non-transferable texture sources (flutter/flutter#183799) 2026-03-17 [email protected] Roll Skia from dba893a44d7a to 84a180a1fa80 (7 revisions) (flutter/flutter#183803) 2026-03-17 [email protected] Framework: Improve DropdownButton selectedItemBuilder assertion (flutter/flutter#183732) 2026-03-17 [email protected] Add mainAxisAlignment to NavigationRail (flutter/flutter#183514) 2026-03-17 [email protected] Update android triage process to not look at unassigned p1s every week (flutter/flutter#183805) 2026-03-17 [email protected] Adds macos impeller new gallery transition perf test. (flutter/flutter#183802) 2026-03-17 [email protected] fix(web_ui): move prepareToDraw after raster to improve concurrency and stability (flutter/flutter#183791) 2026-03-17 [email protected] [build] Generate debug info for assembly. (flutter/flutter#183425) 2026-03-17 [email protected] [web] Fix occasional failure to find Chrome tab (flutter/flutter#183737) 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] 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://issues.skia.org/issues/new?component=1389291&template=1850622 Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+doc/main/autoroll/README.md

Description
This PR fixes Widget Inspector controls not respecting system safe area insets.
Previously, the inspector control buttons were positioned without accounting for system UI insets (such as gesture navigation bars), which could cause them to overlap or be partially obscured by system UI.
This change updates the Widget Inspector control layout to respect
MediaQuery.viewPaddingwhen positioning the controls. Importantly, the safe area handling is scoped only to the inspector controls themselves, so the previewed application and inspector selection overlay continue to occupy the full available screen and remain selectable in unsafe areas.A regression test is added to ensure preview content is not inset when
viewPaddingis present.Issues fixed
(No existing issue was filed; this was identified during review. Happy to link one if preferred.)
Tests
MediaQuery.viewPaddingis applied.Pre-launch Checklist
///) where appropriate.Beofre Fix
After Fix