MaterialApp 小部件的标题 属性 不工作

MaterialApp Widget's title Property Not Working

我绝对是 Flutter 的初学者!

图#1 : 参考教程

图#2:我的实现。

虚拟设备:Nexus_5X_API_28 Android: 9.0

您确定在两个示例中使用的是同一个模拟器吗? MaterialApp Widget 中的标题不是您将在应用程序栏中看到的标题。

used by the device to identify the app

如文档所述。

所以这可能是设备显示的方式 'running applications menu'。


如果要显示appBar需要使用Scaffold

void main() => runApp(
      MaterialApp(
        title: 'App',
        home: Scaffold(
          appBar: AppBar(
            title: Text('My App'),
          ),
          body: Center(
            child: Text("text"),
          ),
        ),
      ),
    );