How to Remove Title Bar from Flutter app built for windows?
752
Using this package bitsdojo_window do the following:
Inside your application folder, go to windows\runner\main.cpp
and add these two lines at the beginning of the file:
#include <bitsdojo_window_windows/bitsdojo_window_plugin.h>
auto bdw = bitsdojo_window_configure(BDW_CUSTOM_FRAME | BDW_HIDE_ON_STARTUP);
Now go to lib\main.dart
and add this code in the main function right after runApp(MyApp());
:
void main() {
runApp(MyApp());
// Add this code below
doWhenWindowReady(() {
appWindow.show();
});
}
You can also customize the window with something like:
doWhenWindowReady(() {
final initialSize = Size(600, 450);
appWindow.minSize = initialSize;
appWindow.size = initialSize;
appWindow.alignment = Alignment.center;
appWindow.show();
});
To implement your own title buttons and text, you can use these methods from the package:
appWindow.title(title);
appWindow.close();
appWindow.maximize();
appWindow.minimize();
You can also give the properties of the title bar to any widget (like dragging and double click for maximize) by wraping it inside MoveWindow()
widget.
Author by
Manan Domadiya
Updated on December 01, 2022Comments
-
Manan Domadiya 11 months
I've made a simple flutter app for windows, when I run it shows the default Titlebar that windows has. How can I remove it ??
-
Zihan about 2 yearsAs title bar do you mean where the cross, minimize, etc is situated?
-
Manan Domadiya about 2 yearsYes, i mean where the Close, Minimize, maximize buttons are situated
-