gtk-flutter / libadwaita_plugins

A place to host all the libadwaita flutter related plugins
9 stars 2 forks source link

How to use "libadwaita_bitsdojo"? #1

Open Ridhubharan opened 2 years ago

Ridhubharan commented 2 years ago

Instructions are not clear. Where am I supposed to put the following(as per https://github.com/gtk-flutter/libadwaita_plugins/tree/main/libadwaita_bitsdojo#usage)?

AdwHeaderBar.bitsdojo(
    appWindow: appWindow,
    ...
)

The 'headerbar' used in the 'AdwScaffold' widget is deprecated. (https://github.com/gtk-flutter/libadwaita_plugins/blob/main/libadwaita_bitsdojo/example/example.md)

TDuffinNTU commented 2 years ago

Check out this! https://pub.dev/packages/bitsdojo_window#for-linux-apps

Step by step:

  1. flutter pub get libadwaita_bitsdojo to install the package
  2. in your my_application.cc file, add #include <bitsdojo_window_linux/bitsdojo_window_plugin.h> to the top of the file, comment out the line gtk_window_set_default_size(window, 1280, 720); and add
    auto bdw = bitsdojo_window_from(window);
    bdw->setCustomFrame(true);

    directly above it

  3. In your main.dart file (your root MaterialApp widget) use AdwScaffold() as your scaffold, example below
return AdwScaffold(
      start: const [AdwHeaderButton(icon: Icon(Icons.abc))],
      actions: AdwActions().bitsdojo,
      body: const Center(
        child: Text('Welcome to Bitsdojo Window Example!'),
      ),
    );

You should now get something like this: image

TDuffinNTU commented 2 years ago

I'll have to make a PR to update the example as I found it was very outdated too!