我使用颤振截图,我期望截图没有横幅,但它有。

注意,我得到了一个不支持的模拟器消息的配置文件和发布模式。


当前回答

在Material应用中,将debugShowCheckedModeBanner设置为false。

其他回答

使用这个

class MyApp extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      debugShowCheckedModeBanner: false,
      theme: AppTheme.appTheme,
      home: HomePage(),
    );
  }
}

官方的例子

MaterialApp(
  home: Scaffold(
    appBar: AppBar(
      title: const Text('Home'),
    ),
  ),
  debugShowCheckedModeBanner: false, //setup this property
)

有关更多信息,请查看官方文档。

你可以在MaterialApp中使用debugShowCheckedModeBanner:

return MaterialApp(
  debugShowCheckedModeBanner: false,
  ...
);

要删除Flutter调试横幅,有几种方法:

第一个是在MaterialApp小部件中使用debugShowCheckModeBanner属性。 代码: MaterialApp ( debugShowCheckedModeBanner:假的, ) 然后进行热重载。 第二种可能是在Flutter Inspector中隐藏调试模式横幅,如果您使用Android Studio或IntelliJ IDEA。 第三种可能是使用Dart DevTools。

这是最简单的方法。

适用于:MaterialApp( debugShowCheckedModeBanner:假 )

适用于:CupertinoApp( debugShowCheckedModeBanner:假 )

如果你在逻辑上处理另一个颤振组件 如果你使用bool变量并处理它。 例如 bool isDebug === false;

if(isDebug == true) { debugShowCheckedModeBanner:真 }

其他的 { debugShowCheckedModeBanner:假 }

谢谢,享受)):