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.

Share:
752
Manan Domadiya
Author by

Manan Domadiya

Updated on December 01, 2022

Comments

  • Manan Domadiya
    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
      Zihan about 2 years
      As title bar do you mean where the cross, minimize, etc is situated?
    • Manan Domadiya
      Manan Domadiya about 2 years
      Yes, i mean where the Close, Minimize, maximize buttons are situated