Skip to content

Widget inspector overlay draws across routes when selecting widgets inside a modal route #186782

Description

@muhammadkamel

Steps to reproduce

  1. Create or run a Flutter app that opens a modal route, for example with showModalBottomSheet and interactive children inside the sheet (buttons, text, etc.).

  2. Launch the app and open the modal bottom sheet (or dialog) so it covers the main screen.

  3. Open the widget inspector:

    • DevTools: connect DevTools → Widget Inspector → with the sheet still open, select a widget inside the sheet in the inspector tree, or
    • On device: enable select-widget mode and tap a widget inside the sheet.
  4. Look at the running app (not only the DevTools tree): the on-device overlay shows layout guide lines and a widget tooltip.

  5. Observe: guide lines and highlights extend over the main screen / scaffold behind the modal, not only over the sheet.

Expected results

When a widget inside an open modal route (bottom sheet, dialog, etc.) is selected in the widget inspector:

  • The on-device selection box, widget tooltip, and layout guide lines appear only on or within that modal route’s UI.
  • The main screen / scaffold behind the modal is not highlighted and does not show inspector guide lines.
  • Overlay feedback matches what the user can actually see and interact with while the modal is open.

Actual results

When a widget inside an open modal route (bottom sheet, dialog, etc.) is selected in the widget inspector:

  • The on-device selection overlay (bounding box, widget tooltip, and layout guide lines) is drawn across the entire screen.
  • Guide lines and highlights extend onto the main screen / scaffold behind the modal, including widgets that are covered by the sheet and are not interactable.
  • The overlay suggests ancestors or widgets from another route are part of the current selection, which is misleading while the modal is open.

Code sample

Code sample
import 'package:flutter/material.dart';

void main() {
  runApp(const MyApp());
}

class MyApp extends StatelessWidget {
  const MyApp({super.key});

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: const HomePage(),
    );
  }
}

class HomePage extends StatelessWidget {
  const HomePage({super.key});

  void _openSheet(BuildContext context) {
    showModalBottomSheet<void>(
      context: context,
      builder: (context) {
        return Padding(
          padding: const EdgeInsets.all(24),
          child: Column(
            mainAxisSize: MainAxisSize.min,
            children: [
              const Text('Modal bottom sheet'),
              const SizedBox(height: 16),
              FilledButton(
                onPressed: () => Navigator.pop(context),
                child: const Text('Sheet button'),
              ),
            ],
          ),
        );
      },
    );
  }

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(title: const Text('Inspector overlay repro')),
      body: Center(
        child: Column(
          mainAxisAlignment: MainAxisAlignment.center,
          children: [
            Container(
              width: 200,
              height: 120,
              color: Colors.blue.shade100,
              alignment: Alignment.center,
              child: const Text('Main screen content'),
            ),
            const SizedBox(height: 24),
            FilledButton(
              onPressed: () => _openSheet(context),
              child: const Text('Open modal bottom sheet'),
            ),
          ],
        ),
      ),
    );
  }
}

Screenshots or Video

Screenshots / Video demonstration Image

Logs

Logs
[Paste your logs here]

Flutter Doctor output

Doctor output
[✓] Flutter (Channel stable, 3.44.0, on macOS 26.5 25F71 darwin-arm64, locale
    en-EG) [512ms]
    • Flutter version 3.44.0 on channel stable at
      /Users/mohammadkamel/fvm/versions/3.44.0
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision 559ffa3f75 (4 days ago), 2026-05-15 14:13:13 -0700
    • Engine revision 4c525dac5e
    • Dart version 3.12.0
    • DevTools version 2.57.0
    • Feature flags: enable-web, enable-linux-desktop, enable-macos-desktop,
      enable-windows-desktop, enable-android, enable-ios, cli-animations,
      enable-native-assets, enable-swift-package-manager,
      omit-legacy-version-file, enable-lldb-debugging, enable-uiscene-migration

[✓] Android toolchain - develop for Android devices (Android SDK version
    36.1.0-rc1) [1,770ms]
    • Android SDK at /Users/mohammadkamel/Library/Android/sdk
    • Emulator version 36.4.9.0 (build_id 14788078) (CL:N/A)
    • Platform android-36, build-tools 36.1.0-rc1
    • ANDROID_HOME = /Users/mohammadkamel/Library/Android/sdk
    • ANDROID_SDK_ROOT = /Users/mohammadkamel/Library/Android/sdk
    • Java binary at: /Applications/Android
      Studio.app/Contents/jbr/Contents/Home/bin/java
      This is the JDK bundled with the latest Android Studio installation on
      this machine.
      To manually set the JDK path, use: `flutter config
      --jdk-dir="path/to/jdk"`.
    • Java version OpenJDK Runtime Environment (build
      21.0.10+-117844308-b1163.108)
    • All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS (Xcode 26.5) [1,145ms]
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • Build 17F42
    • CocoaPods version 1.16.2

[✓] Chrome - develop for the web [4ms]
    • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome

[✓] Connected device (3 available) [6.6s]
    • sdk gphone64 arm64 (mobile) • emulator-5554 • android-arm64  • Android 15 (API 35) (emulator)
    • macOS (desktop)             • macos         • darwin-arm64   • macOS 26.5 25F71 darwin-arm64
    • Chrome (web)                • chrome        • web-javascript • Google Chrome 148.0.7778.168
    ! Error: Browsing on the local area network for Muhammad’s iPhone. Ensure the device is unlocked and attached with a cable or associated with
      the same local area network as this Mac.
      The device must be opted into Developer Mode to connect wirelessly. (code -27)

[✓] Network resources [370ms]
    • All expected network resources are available.

• No issues found!

Metadata

Metadata

Assignees

No one assigned

    Labels

    P3Issues that are less important to the Flutter projecta: devtoolsDevTools related - suite of performance and debugging toolsa: qualityA truly polished experiencef: inspectorPart of widget inspector in framework.frameworkflutter/packages/flutter repository. See also f: labels.has reproducible stepsThe issue has been confirmed reproducible and is ready to work onteam-frameworkOwned by Framework teamtriaged-frameworkTriaged by Framework teamwaiting for PR to land (fixed)A fix is in flight

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions