13

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

billcyz
  • 1,219
  • 2
  • 18
  • 32
  • Does this answer your question? [how to change desktop windows application icon for flutter?](https://stackoverflow.com/questions/64558578/how-to-change-desktop-windows-application-icon-for-flutter) – smorgan Nov 12 '20 at 11:02

5 Answers5

23

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.

billcyz
  • 1,219
  • 2
  • 18
  • 32
3

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
SULPHURIC ACID
  • 278
  • 5
  • 19
2

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 !

Jack'
  • 1,722
  • 1
  • 19
  • 27
  • 1
    don't change set(BINARY_NAME "oldbadname") it will cause cmake error. the binary name should the same as the project folder name – Ahmed.Net Jun 17 '23 at 14:57
  • 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. – Umut Jul 04 '23 at 12:54
  • 1
    I also had to do a `flutter clean` after those changes in order to get it building again. – Bennik2000 Jul 31 '23 at 11:23
  • change `set(BINARY_NAME "oldbadname") ` will cause cmake error. `flutter clean` fix that error – JamesRobert Aug 16 '23 at 08:24
  • Should I remove the line `set(BINARY_NAME "foldername")` for `windows/CMakeLists.txt` ? – Jack' Aug 29 '23 at 16:30
0

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,324
  • 26
  • 22
  • 31
-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
Ashvin
  • 8,227
  • 3
  • 36
  • 53