【问题标题】:Flutter Inspector in Visual Studio codeVisual Studio 代码中的 Flutter 检查器
【发布时间】:2018-12-22 19:49:50
【问题描述】:

有没有办法在模拟器中检查 Flutter App 元素? 我正在使用 VS 代码而不是 android studio 我想从正在运行的模拟器中检查元素。

【问题讨论】:

标签: visual-studio-code flutter


【解决方案1】:

从版本 2.24.0 开始,DevTools 选项是用于调试和检查的新功能。

打开命令面板 Ctrl+Shift+P 并输入:

>Dart: Open DevTools

要访问它,您的调试会话必须正在运行:

【讨论】:

    【解决方案2】:

    作为 Danny Tuppeny(VScode 中 dart 插件的创建者)montined

    Flutter Inspector 目前在 VS Code 中不可用

    您可以关注此issue 以获取更多更新

    更新:

    在 VS Code 的新 Dart Code 插件中有类似的东西 look here

    【讨论】:

      【解决方案3】:

      在 Flutter 项目中检查 Widget:

      1- 打开命令面板 (Ctrl+Shift+P (Cmd+Shift +P 在 macOS 上))。
      2- 选择 Flutter: Inspect Widget 命令并按 Enter。
      3- 点击模拟器中的任何小部件。
      4- 查看小部件树。
      5- 祝你好运。

      【讨论】:

        【解决方案4】:

        在运行您的应用程序时,出现热重载后,在您的终端中按“i”。还有一些其他的功能。要找到它,请在终端中按“h”。

        【讨论】:

          【解决方案5】:

          我使用快捷键:Ctrl+Alt+D(使用Ubuntu + VSCode)。

          不要忘记应用程序必须已经在调试模式下运行,就像 Evandro 提到的那样。

          【讨论】:

            【解决方案6】:

            其实,当你在运行flutter run之后在终端输入h,你就会得到所有这些东西;

            Flutter run key commands.
            r Hot reload. ???
            R Hot restart.
            h Repeat this help message.
            d Detach (terminate "flutter run" but leave application running).
            c Clear the screen
            q Quit (terminate the application on the device).
            s Save a screenshot to flutter.png.
            b Toggle the platform brightness setting (dark and light mode).          (debugBrightnessOverride)
            w Dump widget hierarchy to the console.                                             (debugDumpApp)
            t Dump rendering tree to the console.                                        (debugDumpRenderTree)
            L Dump layer tree to the console.                                             (debugDumpLayerTree)
            S Dump accessibility tree in traversal order.                                 (debugDumpSemantics)
            U Dump accessibility tree in inverse hit test order.                          (debugDumpSemantics)
            i Toggle widget inspector.                                (WidgetsApp.showWidgetInspectorOverride)
            I Toggle oversized image inversion ?️.                               (debugInvertOversizedImages)
            p Toggle the display of construction lines.                                (debugPaintSizeEnabled)
            o Simulate different operating systems.                                    (defaultTargetPlatform)
            z Toggle elevation checker.
            g Run source code generators.
            M Write SkSL shaders to a unique file in the project directory.
            v Launch DevTools.
            P Toggle performance overlay.                                  (WidgetsApp.showPerformanceOverlay)
            a Toggle timeline events for all widget build methods.                  (debugProfileWidgetBuilds)
            

            为了直接在浏览器中打开DevTool,您可以输入v

            结果会是这样的;

            open this link

            【讨论】:

            • 今天不是这样。请编辑答案或最新的步骤以重现此 OP 的说明/建议。
            猜你喜欢
            • 1970-01-01
            • 1970-01-01
            • 2021-04-07
            • 2020-07-13
            • 2015-07-25
            • 1970-01-01
            • 1970-01-01
            • 2017-05-06
            • 1970-01-01
            相关资源
            最近更新 更多