Flutter小技巧总结之去除右上角Debug标签


一,问题场景  

  如何去除右上角Debug标签

二,解决办法

  在MaterialApp初始化的时候,设置debugShowCheckedModeBanner: false即可:

三,示例代码

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

class MyApp extends StatefulWidget {
@override
  _MyAppState createState() => new _MyAppState();
}

class _MyAppState extends State<MyApp> {
// This widget is the root of your application.
@override
Widget build(BuildContext context) {
  return new MaterialApp(
    title: new Text('My Application'),
    debugShowCheckedModeBanner: false, // 设置这一属性即可
    theme: new ThemeData(
     primarySwatch: Colors.blue,
    ), 
    home: new SplashScreen(),
    routes: <String, WidgetBuilder> {
       '/splashscreen': (BuildContext context) => new SplashScreen(),
       '/conditions': (BuildContext context) => new TermsAndConditionsPage(),
    },
  );
 }
}

 




免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM