22

I'm using Flutter to develop Windows desktop application, but don't know how to change the name and icon for the application.

asked Nov 12, 2020 at 8:38
1

5 Answers 5

31

I think I've found the solution. The following should work for Windows application:

To change application icon: Simply put icon file under windows/runner/resources folder, and change the IDI_APP_ICON part in windows\runner\Runner.rc file to your icon file name.

To change application name: Open windows/runner/main.cpp file, and change your application name inside window.CreateAndShow function.

answered Nov 12, 2020 at 9:01
Sign up to request clarification or add additional context in comments.

4 Comments

You've described changing the window title, but your question is about the application name. What exactly is it that you wanted to change?
Is there a reason you want to change the filename of the icon instead of just replacing the existing icon file?
how to change name of the exe in flutterapp\build\windows\runner\Release?
To change the build name. Please navigate to Windows/CMakeLists.txt and update set(BINARY_NAME "ANYNAME").
14

Here is how to change the icon and the name of a Windows app.

App icon

Just replace the file app_icon.ico in windows/runner/resources with your new icon.

If the name has changed, rename app_icon.ico with your new filename in the file windows\runner\Runner.rc :

// Icon with lowest ID value placed first to ensure application icon
// remains consistent on all systems.
IDI_APP_ICON ICON "resources\\app_icon.ico"

App name

It gets a bit more complicated. There is no such thing as an "app name" in Windows. You can change the name of the window, the name of the output executable file, the name displayed in your Task Manager ...

Let's say the name of your project was oldbadname. You should replace oldbadname with yournewname and Old Bad Name with Your New Name in all the following files :

windows/runner/Runner.rc

BEGIN
 VALUE "CompanyName", "com.company" "0円"
 VALUE "FileDescription", "Old Bad Name" "0円"
 VALUE "FileVersion", VERSION_AS_STRING "0円"
 VALUE "InternalName", "Old Bad Name" "0円"
 VALUE "LegalCopyright", "Copyright (C) 2023 com.company. All rights reserved." "0円"
 VALUE "OriginalFilename", "oldbadname.exe" "0円"
 VALUE "ProductName", "Old Bad Name" "0円"
 VALUE "ProductVersion", VERSION_AS_STRING "0円"
END

windows/CMakeLists.txt (and not windows/runner/CMakeLists.txt)

set(BINARY_NAME "foldername")

windows/runner/main.cpp

if (!window.Create(L"Old Bad Name", origin, size)) {
 return EXIT_FAILURE;
}

That's it !

answered Apr 28, 2023 at 15:01

5 Comments

don't change set(BINARY_NAME "oldbadname") it will cause cmake error. the binary name should the same as the project folder name
Yes changing this doesn't work, but the comment in the code says you can change it: # The name of the executable created for the application. Change this to change # the on-disk name of your application. set(BINARY_NAME "app_name") Either the comment is wrong or you also need to change something else for this to work.
I also had to do a flutter clean after those changes in order to get it building again.
change set(BINARY_NAME "oldbadname") will cause cmake error. flutter clean fix that error
Should I remove the line set(BINARY_NAME "foldername") for windows/CMakeLists.txt ?
4

add this in your void main()

void main() {
WidgetsFlutterBinding.ensureInitialized();
 if (Platform.isWindows || Platform.isLinux || Platform.isMacOS) {
 setWindowTitle('title here');
 }
 runApp(new MyApp());
}

Include this dependency in pubspec.yaml for this to work:

window_size:
 git:
 url: git://github.com/google/flutter-desktop-embedding.git
 path: plugins/window_size
 ref: 7812516a5c1fc8ef379e244106953a2b534432b9
answered Mar 26, 2021 at 10:10

Comments

2

To change your Flutter project name for Windows, follow these simple steps:

Open the following file in your project: windows/runner/Runner.rc

BEGIN
VALUE "CompanyName", "com.example" "0円"
VALUE "FileDescription", "NameApp" "0円"
VALUE "FileVersion", VERSION_AS_STRING "0円"
VALUE "InternalName", "NameApp" "0円"
VALUE "LegalCopyright", "Copyright (C) 2023 com.example. All rights 
reserved." "0円"
VALUE "OriginalFilename", "NameApp.exe" "0円"
VALUE "ProductName", "NameApp" "0円"
VALUE "ProductVersion", VERSION_AS_STRING "0円"
END

Replace all occurrences of NameApp with your new desired name, let's say NewNameApp.

Open the following file in your project: windows/runner/main.cpp

if (!window.CreateAndShow(L"NameApp", origin, size)) {
 return EXIT_FAILURE;
}

Replace "NameApp" with "NewNameApp".

Save the changes, close the files, and run your app again.

Tyler2P
2,37030 gold badges26 silver badges34 bronze badges
answered Aug 12, 2023 at 12:20

Comments

-2

Change App Icon:

Best and easy way to use this package - https://pub.dev/packages/flutter_launcher_icons

How to configure & more details refer this - Flutter app cannot be uploaded to Microsoft Store

Change App Name: You can modify app name in this file -

windows/runner/Runner.rc
answered Jul 3, 2023 at 11:34

2 Comments

does this show how to change the app name?
Change App Name: You can modify app name in this file -windows/runner/Runner.rc

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.