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