
开篇寄语
伯衡君这一个月以来调试flutter应用,有时候感到很别扭,怎么和其他应用相比,有什么地方多余,终于,在今天发现开屏界面的右上角有一个debug图标,所以看起来和其他应用不一样,于是,伯衡君就找到了一个方法,在调试界面的时候将debug图标删除了,那么该如何搞定呢?请看本篇。
内容详情
解决方法很简单。
只需要做的就是转到 lib/main.dart 文件并将 MaterialApp 类的 debugShowCheckedModeBanner 属性设置为 false(默认设置为 true),如下所示:
debugShowCheckedModeBanner: false,
试举一例:
import 'package:flutter/material.dart';
import 'package:url_launcher/url_launcher.dart';
void main() {
runApp(MyApp());
}
class MyApp extends StatefulWidget {
@override
_MyAppState createState() => _MyAppState();
}
class _MyAppState extends State<MyApp> {
@override
Widget build(BuildContext context) {
return MaterialApp(
debugShowCheckedModeBanner: false,
home: Scaffold(
appBar: AppBar(
title: Text('Flutter Buttons - FlatButton'),
),
body: Center(
child: MaterialButton(
color: Colors.blue,
shape: CircleBorder(),
onPressed: () {
_launchURL();
},
child: Padding(
padding: const EdgeInsets.all(100),
child: Text(
'A circle button',
style: TextStyle(color: Colors.white, fontSize: 24),
),
),
),
),
),
);
}
}
_launchURL() async {
final Uri uri = Uri(
scheme: 'https',
path: 'www.google.com',
queryParameters: {'name': 'google dot com', 'about': 'Flutter Dart'},
);
const url = "https://www.google.com/";
if (await canLaunch(url)) {
await launch(uri.toString());
} else {
print('Could not launch $url');
}
}
生成效果如下图所示:

哒哒,是不是很简单?
- 我的微信
- 微信扫一扫加好友
-
- 我的微信公众号
- 扫描关注公众号
-





