Reputation: 1389
I'm using Flutter to develop Windows desktop application, but don't know how to change the name and icon for the application.
Upvotes: 20
Views: 15233
Reputation: 21
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.
Upvotes: 2
Reputation: 8997
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
Upvotes: -2
Reputation: 2488
Here is how to change the icon and the name of a Windows app.
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"
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 !
Upvotes: 13
Reputation: 337
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
Upvotes: 4
Reputation: 1389
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.
Upvotes: 30