I am unable to find any way to do that when searching official documentation. Does anybody know any way to do that?
5 Answers
It is possible, as mentioned in https://github.com/flutter/flutter/issues/30712
In pubspec.yaml add
dependencies: window_size: git: url: https://github.com/google/flutter-desktop-embedding.git path: plugins/window_size ref: fd519be1e8398c6b6c2062c2447bac960a71bc02 Now in your code just call
import 'package:window_size/window_size.dart'; WidgetsFlutterBinding.ensureInitialized(); setWindowTitle("Custom window title"); Works fine on Linux. Haven't tested on Windows/Mac
PS Thanks to @Johan Ordenes Galleguillos for the missing WidgetsFlutterBinding.ensureInitialized();
4 Comments
https://github.com/google/flutter-desktop-embedding.git to get this to work, which is what the referenced issue above used. The url in this answer on the other hand gave me pub get failed (server unavailable) and infinite retries.setWindowTitle(...). I inserted the lines inside the MainPage.build(...) function when I run as Chrome executable. Any ideas?Go to windows > runner > main.cpp folder, find a " !window.CreateAndShow(L"schedule_task", origin, size) " And change the "schedule_task" text
2 Comments
Achieved this by using windowmanager package. It has a lot of features for desktop development with flutter.
After installing package just add this to main():
void main() async { //needed to ensure binding was initialized WidgetsFlutterBinding.ensureInitialized(); await WindowManager.instance.ensureInitialized(); windowManager.waitUntilReadyToShow().then((_) async { await windowManager.setTitle('Yor title goes here'); }); runApp(const MyApp()); } for me worked with Windows and Linux.
references:
2 Comments
windowManager.waitUntilReadyToShow().then((_) {} scope for this, but if you plan, for example, resize your window its's better to have it.Ok, that seems to be not possible (yet), but work in progress: https://github.com/flutter/flutter/issues/30712
Comments
In order to replace flutter app title on the Windows caption bar, as well as optionally adjusting the dimensions for size and the window coordinates you have to navigate to windows/main.cpp file and edit following code: !window.Create(L"My App New Title Here", origin, size) Source: https://docs.flutter.dev/platform-integration/windows/building