Flutter
前言
MaterialApp 有一个Title属性,一开始以为是ActionBar的title,后来发现不是。查看源码的时候,注释解释说在Android端是多任务状态下的title。
class MyApp extends StatelessWidget {
const MyApp({Key? key}) : super(key: key);
// This widget is the root of your application.
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'MaterialApp Title',
home: const MyHomePage(title: 'Flutter Demo Home Page'),
);
}
}
如下图:
源码
- Android
在Android上,标题出现在任务管理器的应用程序快照上方,当用户按下“最近的应用程序”按钮时会显示。 - iOS
在iOS上,此值设置无效。应用程序使用的还是 Info.plist 中的 CbundleDisplayName,或者 CFBundleName。