如何删除 Flutter 调试横幅?
How can I remove the Flutter debug banner?
如何删除 Flutter 中的调试横幅?
我正在使用 flutter screenshot
,我希望屏幕截图没有横幅。现在有了。
请注意,我收到关于配置文件和发布模式的 not supported for emulator
消息。
在您的 MaterialApp
上将 debugShowCheckedModeBanner
设置为 false
。
MaterialApp(
debugShowCheckedModeBanner: false,
)
debug 横幅也将在发布版本中自动删除。
如果您正在使用 IntelliJ IDEA,Flutter Inspector 中有一个选项可以禁用它。
运行项目:
当您在 Flutter 检查器中时,单击或选择“更多操作”。
出现菜单时,选择“隐藏调试模式横幅”:
还有另一种方法可以从 Flutter 应用程序中删除“调试”横幅。现在在新版本发布后,主 .dart 文件中没有 "debugShowCheckedModeBanner: false,"
代码行。所以我认为这些方法是有效的:
- 如果您正在使用 Visual Studio Code, then install `"Dart DevTools" from extensions. After installation, you can easily find the "Dart DevTools" text icon at the bottom of Visual Studio Code. When you click on that text icon, a link will be opened in Google Chrome. From that link page, you can easily remove the banner by just tapping on the banner icon as shown in this screenshot.
注意:Dart DevTools 是 Visual Studio 代码
中的 Dart 语言调试器扩展
- 如果Dart DevTools已经安装在你的Visual Studio代码中,那么你可以直接打开GoogleChrome然后打开
URL "127.0.0.1: ZZZZZ/?hide=debugger&port=XXXXX"
注意:在此link中,将“XXXXX”替换为5位端口ID(您的Flutter应用程序位于运行上),这将每当您使用 flutter run
命令并将“ZZZZZ”替换为全局(不可更改的)5 位调试器 ID
时都会有所不同
注意:这些 Dart 开发人员工具仅适用于 Google Chrome 浏览器
已过时
如果您使用的是 Android Studio,您可以在 Flutter Inspector 选项卡中找到该选项 → 更多操作。
或者,如果您使用的是 Dart DevTools,您也可以在右上角找到相同的按钮。
嗯,这就是你想要的简单答案。
MaterialApp(
debugShowCheckedModeBanner: false
)
CupertinoApp(
debugShowCheckedModeBanner: false
)
但是,如果您想深入了解该应用(想要发布 APK 文件(没有调试横幅))并且如果您使用的是 Android Studio,则转到 运行 → Flutter → 运行 'main.dart' 发布模式.
这是app.dartclass属性.
当 运行 处于选中模式时,它会显示一个横幅,上面写着“DEBUG”。 MaterialApp 默认构建其中之一。
要在调试模式下也禁用此横幅,您可以设置一个布尔值 false。
return MaterialApp(
theme:....
debugShowCheckedModeBanner: false,
home: SplashScreen(),
);
在发布模式下这没有效果。
调试横幅仅在开发过程中出现,并在发布版本中自动删除。
要隐藏它,需要将 debugShowCheckedModeBanner
设置为 false
MaterialApp(
debugShowCheckedModeBanner: false,
)
要删除 Flutter 调试横幅,有几种可能:
第一个是在 MaterialApp 小部件中使用 debugShowCheckModeBanner 属性。
代码:
MaterialApp(
debugShowCheckedModeBanner: false,
)
然后进行热重载。
第二种可能是在 Flutter Inspector 中隐藏调试模式横幅,如果你使用 Android Studio or IntelliJ IDEA。
第三种可能是用Dart DevTools.
使用:
MaterialApp(
debugShowCheckedModeBanner: false,
)
这是删除此横幅的代码。
调试横幅是由于 MaterialApp,例如,您可以在所有使用 MaterialApp.
的页面上看到此横幅
您的应用程序中应该至少有一个 MaterialApp 在主根上。
所有其他答案都适用于 Android Studio,但如果使用 Visual Studio 代码,您可以使用一个命令轻松切换它。打开命令面板 (Mac: Cmd + Shift + P 或 Windows:Ctrl + Shift + P)。然后键入 toggle debug-mode banner,如下所示:
在 Material 应用中将 debugShowCheckedModeBanner
设置为 false
。
在您的 MaterialApp 上将 debugShowCheckedModeBanner 设置为 false。
MaterialApp(
debugShowCheckedModeBanner: false,
)
调试横幅也将在发布版本中自动删除。
如果您使用的是模拟器或真实设备,并且想在发布时进行检查
然后模式=>
flutter run release --apk
运行 终端上的这个命令 Android Studio / Vs Code
三种删除 flutter 调试横幅的方法:
1。在MaterialApp/ScaffoldApp
片段
MaterialApp(
debugShowCheckedModeBanner: false,
)
或
ScaffoldApp(
debugShowCheckedModeBanner: false,
);
2.By 正在制作您的应用的发布版本
For running release version of your app, use this command
flutter run --release
Or if using real devices rather than emulators or simulators.
make a build version of the app
.
flutter build apk
3.BY 使用 dart 开发工具删除调试横幅
IN vs code type ctr+shift+p
in windows and for mac cmd+shift+p
并使用此命令打开 dart dev tool
Dart: Open DevTools
使用这个
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
debugShowCheckedModeBanner: false,
theme: AppTheme.appTheme,
home: HomePage(),
);
}
}
转到 Lib 文件夹中的 main 找到 MaterialApp() 并键入 debugShowCheckedModeBanner: false,
材质应用(
debugShowCheckedModeBanner: false,
)
MaterialApp(
home: Scaffold(
appBar: AppBar(
title: const Text('Home'),
),
),
debugShowCheckedModeBanner: false, //setup this property
)
有关详细信息,请查看 official documentation。
如果你还在debug模式,你可以切换到release 模式,横幅将消失。
您还可以通过快捷方式打开相同的 Run/Debug 配置 window:
ALT+SHIFT+F10,然后按0 然后按 ALT+a.
现在输入--release
.
如果您在 Return 部分使用 Scaffold
,请在顶部添加 MaterialApp
和 Restart
void main() => runApp(
const MaterialApp(
debugShowCheckedModeBanner: false,
home: Home()),
);
您可以使用:
debugShowCheckedModeBanner: false,
materialapp 内部
只需在 MaterialApp or GetMaterialApp
中执行此操作
添加这一行
debugShowCheckedModeBanner to false.
像这样
MaterialApp(
debugShowCheckedModeBanner: false,
)
如何删除 Flutter 中的调试横幅?
我正在使用 flutter screenshot
,我希望屏幕截图没有横幅。现在有了。
请注意,我收到关于配置文件和发布模式的 not supported for emulator
消息。
在您的 MaterialApp
上将 debugShowCheckedModeBanner
设置为 false
。
MaterialApp(
debugShowCheckedModeBanner: false,
)
debug 横幅也将在发布版本中自动删除。
如果您正在使用 IntelliJ IDEA,Flutter Inspector 中有一个选项可以禁用它。
运行项目:
当您在 Flutter 检查器中时,单击或选择“更多操作”。
出现菜单时,选择“隐藏调试模式横幅”:
还有另一种方法可以从 Flutter 应用程序中删除“调试”横幅。现在在新版本发布后,主 .dart 文件中没有 "debugShowCheckedModeBanner: false,"
代码行。所以我认为这些方法是有效的:
- 如果您正在使用 Visual Studio Code, then install `"Dart DevTools" from extensions. After installation, you can easily find the "Dart DevTools" text icon at the bottom of Visual Studio Code. When you click on that text icon, a link will be opened in Google Chrome. From that link page, you can easily remove the banner by just tapping on the banner icon as shown in this screenshot.
注意:Dart DevTools 是 Visual Studio 代码
中的 Dart 语言调试器扩展- 如果Dart DevTools已经安装在你的Visual Studio代码中,那么你可以直接打开GoogleChrome然后打开 URL "127.0.0.1: ZZZZZ/?hide=debugger&port=XXXXX"
注意:在此link中,将“XXXXX”替换为5位端口ID(您的Flutter应用程序位于运行上),这将每当您使用 flutter run
命令并将“ZZZZZ”替换为全局(不可更改的)5 位调试器 ID
注意:这些 Dart 开发人员工具仅适用于 Google Chrome 浏览器
已过时
如果您使用的是 Android Studio,您可以在 Flutter Inspector 选项卡中找到该选项 → 更多操作。
或者,如果您使用的是 Dart DevTools,您也可以在右上角找到相同的按钮。
嗯,这就是你想要的简单答案。
MaterialApp(
debugShowCheckedModeBanner: false
)
CupertinoApp(
debugShowCheckedModeBanner: false
)
但是,如果您想深入了解该应用(想要发布 APK 文件(没有调试横幅))并且如果您使用的是 Android Studio,则转到 运行 → Flutter → 运行 'main.dart' 发布模式.
这是app.dartclass属性.
当 运行 处于选中模式时,它会显示一个横幅,上面写着“DEBUG”。 MaterialApp 默认构建其中之一。
要在调试模式下也禁用此横幅,您可以设置一个布尔值 false。
return MaterialApp(
theme:....
debugShowCheckedModeBanner: false,
home: SplashScreen(),
);
在发布模式下这没有效果。
调试横幅仅在开发过程中出现,并在发布版本中自动删除。
要隐藏它,需要将 debugShowCheckedModeBanner
设置为 false
MaterialApp(
debugShowCheckedModeBanner: false,
)
要删除 Flutter 调试横幅,有几种可能:
第一个是在 MaterialApp 小部件中使用 debugShowCheckModeBanner 属性。
代码:
MaterialApp( debugShowCheckedModeBanner: false, )
然后进行热重载。
第二种可能是在 Flutter Inspector 中隐藏调试模式横幅,如果你使用 Android Studio or IntelliJ IDEA。
第三种可能是用Dart DevTools.
使用:
MaterialApp(
debugShowCheckedModeBanner: false,
)
这是删除此横幅的代码。 调试横幅是由于 MaterialApp,例如,您可以在所有使用 MaterialApp.
的页面上看到此横幅您的应用程序中应该至少有一个 MaterialApp 在主根上。
所有其他答案都适用于 Android Studio,但如果使用 Visual Studio 代码,您可以使用一个命令轻松切换它。打开命令面板 (Mac: Cmd + Shift + P 或 Windows:Ctrl + Shift + P)。然后键入 toggle debug-mode banner,如下所示:
在 Material 应用中将 debugShowCheckedModeBanner
设置为 false
。
在您的 MaterialApp 上将 debugShowCheckedModeBanner 设置为 false。
MaterialApp(
debugShowCheckedModeBanner: false,
)
调试横幅也将在发布版本中自动删除。
如果您使用的是模拟器或真实设备,并且想在发布时进行检查 然后模式=>
flutter run release --apk
运行 终端上的这个命令 Android Studio / Vs Code
三种删除 flutter 调试横幅的方法:
1。在MaterialApp/ScaffoldApp
片段
MaterialApp(
debugShowCheckedModeBanner: false,
)
或
ScaffoldApp(
debugShowCheckedModeBanner: false,
);
2.By 正在制作您的应用的发布版本
For running release version of your app, use this command
flutter run --release
Or if using real devices rather than emulators or simulators.
make a build version of the app
.
flutter build apk
3.BY 使用 dart 开发工具删除调试横幅
IN vs code type ctr+shift+p
in windows and for mac cmd+shift+p
并使用此命令打开 dart dev tool
Dart: Open DevTools
使用这个
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
debugShowCheckedModeBanner: false,
theme: AppTheme.appTheme,
home: HomePage(),
);
}
}
转到 Lib 文件夹中的 main 找到 MaterialApp() 并键入 debugShowCheckedModeBanner: false,
材质应用( debugShowCheckedModeBanner: false, )
MaterialApp(
home: Scaffold(
appBar: AppBar(
title: const Text('Home'),
),
),
debugShowCheckedModeBanner: false, //setup this property
)
有关详细信息,请查看 official documentation。
如果你还在debug模式,你可以切换到release 模式,横幅将消失。
您还可以通过快捷方式打开相同的 Run/Debug 配置 window:
ALT+SHIFT+F10,然后按0 然后按 ALT+a.
现在输入--release
.
如果您在 Return 部分使用 Scaffold
,请在顶部添加 MaterialApp
和 Restart
void main() => runApp(
const MaterialApp(
debugShowCheckedModeBanner: false,
home: Home()),
);
您可以使用:
debugShowCheckedModeBanner: false,
materialapp 内部
只需在 MaterialApp or GetMaterialApp
中执行此操作
添加这一行
debugShowCheckedModeBanner to false.
像这样
MaterialApp(
debugShowCheckedModeBanner: false,
)