Flutter 去除右上角 Debug 标签

725 阅读1分钟

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

debugShowCheckedModeBanner: false,

完整代码如下

import 'package:flutter/material.dart';

void main() => runApp(new MyApp());

class MyApp extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return new MaterialApp(
      debugShowCheckedModeBanner: false,
      title: 'Welcome to Flutter',
      home: new Scaffold(
        appBar: new AppBar(
          title: const Text('Welcome to Flutter'),
        ),
        body: const Center(
          child: const Text('Hello World'),
        ),
      ),
    );
  }
}

运行效果

image.png