Dart 如何更改手机屏幕上显示的颤振应用程序名称?

Dart 如何更改手机屏幕上显示的颤振应用程序名称?,dart,flutter,flutter-dependencies,Dart,Flutter,Flutter Dependencies,如何更改手机上显示的颤振项目的应用程序名称? 我检查了文件pubspec.yaml name: flutter_app description: A new Flutter application. 已编辑名称的属性,但导入包引用也将更改,只能更改应用程序名称?Android 打开AndroidManifest.xml文件,进行以下更改 <application android:label="App Name" ...> // Your app name here <

如何更改手机上显示的颤振项目的应用程序名称? 我检查了文件
pubspec.yaml

name: flutter_app
description: A new Flutter application.
已编辑名称的属性,但导入包引用也将更改,只能更改应用程序名称?

Android 打开
AndroidManifest.xml
文件,进行以下更改

<application
    android:label="App Name" ...> // Your app name here
<key>CFBundleName</key>
<string>App Name</string> // Your app name here

要更改您的应用程序名称,您需要将其更改为Android和IOS:

<manifest xmlns:android="http://schemas.android.com/apk/res/android">
    <application
        android:name="io.flutter.app.FlutterApplication"
        android:label="Your Application Name"  //here
        android:icon="@mipmap/ic_launcher">
        <activity>
        <!--  -->
        </activity>
    </application>
</manifest>
<plist version="1.0">
<dict>
    <key>CFBundleName</key>
    <string>Your Application Name </string>  //here
</dict>
</plist>
您可以使用软件包使其变得简单

只需在flatter项目根目录中运行此命令

pub global run rename --appname "My application"

为Android编辑
AndroidManifest.xml
,为iOS编辑
info.plist

对于Android,仅编辑Android:label应用程序中的标记中的值,该标记位于以下文件夹中:
Android/app/src/main

代码:

<manifest xmlns:android="http://schemas.android.com/apk/res/android">
    <application
        android:name="io.flutter.app.FlutterApplication"
        android:label="Your Application Name"  //here
        android:icon="@mipmap/ic_launcher">
        <activity>
        <!--  -->
        </activity>
    </application>
</manifest>
<plist version="1.0">
<dict>
    <key>CFBundleName</key>
    <string>Your Application Name </string>  //here
</dict>
</plist>
屏幕截图:

<manifest xmlns:android="http://schemas.android.com/apk/res/android">
    <application
        android:name="io.flutter.app.FlutterApplication"
        android:label="Your Application Name"  //here
        android:icon="@mipmap/ic_launcher">
        <activity>
        <!--  -->
        </activity>
    </application>
</manifest>
<plist version="1.0">
<dict>
    <key>CFBundleName</key>
    <string>Your Application Name </string>  //here
</dict>
</plist>


执行
flatter clean
,如果有问题,请重新启动应用程序。

这些是执行此操作的本机方法。我想知道Flatter是否能从一个角度处理它?@PankajBansal你的意思是你想动态更改名称吗?@CopsOnRoad否我想知道iOS和android是否有共同的地方,我可以给出应用程序名称和图标,因为我知道iOS(Plist)和android(Manifest)不同。@PankajBansal我很抱歉,现在没有办法,您需要在
info.plist
AndroidManifest.xml
中执行此操作。