【问题标题】:How to change app title in "Task Menu" Flutter如何在“任务菜单”Flutter 中更改应用程序标题
【发布时间】:2020-09-23 16:10:21
【问题描述】:

当进入任务菜单(android)时,它在 Manifest xml 文件中显示“Flutter Demo”而不是我的应用程序标签字符串。在屏幕页面中,我使用了没有应用栏的脚手架,因此没有标题,但里面有安全区域小部件。

我应该在哪里编辑才能获得自定义应用磁贴名称。

 @override
  Widget build(BuildContext context) {
    return Scaffold(
        backgroundColor: Colors.white,
        body: Center(
          child: SafeArea(
              child: Column(

【问题讨论】:

    标签: android flutter scaffold


    【解决方案1】:

    MaterialApp() 中,您拥有title 属性。你应该在那里改变它。

    MaterialApp(
      title: 'HERE GOES YOUR TITLE',
      home: Scaffold(
        appBar: AppBar(
          title: const Text('MaterialApp Theme'),
        ),
      ),
    );
    

    【讨论】:

    • 你好。感谢回复。我可能不想要应用程序栏。所以我只需要省略 AppBar 对吗?会尝试......并且材料应用程序适用于有状态小部件还是仅适用于无状态?
    • 是的,只是省略 AppBar。两个都。它必须位于应用的根目录
    【解决方案2】:

    首先使用 MaterialApp Widget 并在 MaterialApp 小部件中扭曲整个 Widget 树

    MaterialApp(
      title: 'your app name',
      home: Scaffold(
    

    然后在 pubspec.yaml 中编辑名称和描述属性

    name: your app name
    description: your app description
    

    然后在 AndroidManifest.xml 中更改 android:label

    <application
            android:label="your application name"
    

    毕竟运行flutter clean 命令然后flutter build

    【讨论】:

      【解决方案3】:
      Try changing the name in pubspec.yaml file also like this 
      

      1) 打开 pubspec.yaml 文件。

      2 滚动到顶部。

      3) 将名称字段更改为您要设置的应用名称

      4) 并像这样设置图块

      MaterialApp(
        title: 'your app name',
        home: Scaffold(
      

      【讨论】:

        猜你喜欢
        • 2018-12-27
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2019-05-06
        • 2015-07-12
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多