Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Minimize, Maximize, MaximizeOrRestore functions support #60

Closed
prateekmedia opened this issue Aug 6, 2021 · 17 comments
Closed

Add Minimize, Maximize, MaximizeOrRestore functions support #60

prateekmedia opened this issue Aug 6, 2021 · 17 comments

Comments

@prateekmedia
Copy link

prateekmedia commented Aug 6, 2021

As CSD support is complete by setting frame to WindowFrame.noTitle, the only thing missing is the titlebar button functions support.

@prateekmedia prateekmedia changed the title Add better csd support Add better CSD support Aug 6, 2021
@prateekmedia
Copy link
Author

This can be done by GTK on linux, UWP on windows and AppKit on macos.

@knopp
Copy link
Contributor

knopp commented Aug 6, 2021

Can you be more specific? By default (when not customizing title bar) GTK is using CSD on gnome and SSD on KDE. What better support exactly do you have in mind?

@prateekmedia
Copy link
Author

prateekmedia commented Aug 6, 2021

  • Let us create a native looking header for desktop platforms
  • which also follow CSD standards like rounded corner and drop shadows like a native desktop app.
  • Follow theming for header like gtk theming and window buttons for linux or windows theming for light/dark mode , or macos inline title bar look

Ultimately I want to achieve this using nativeshell:

@knopp
Copy link
Contributor

knopp commented Aug 6, 2021

If you set window frame to WindowFrame.noTitle, it should still have shadow and possibly rounded corners.

@prateekmedia
Copy link
Author

If you set window frame to WindowFrame.noTitle, it should still have shadow and possibly rounded corners.

Ok I will try it, also can we mimic current theming headerbar for platforms like gtk to lookmmore native, It is possible in GTK but I don't know much about it.

@knopp
Copy link
Contributor

knopp commented Aug 6, 2021

You can make custom title bar (or any draggable section) by calling Window.of(context).beginDrag() from a gesture detector. There's currently no support for maximizing/minimizing window and listening to window states, but that will come soon. That should be enough to build any custom title bar.

@prateekmedia
Copy link
Author

@knopp And please if possible make max, min, close icon native to the current Operating system and theming.

@knopp
Copy link
Contributor

knopp commented Aug 6, 2021

That is not really possible, nor goal of flutter / nativeshell. If you want to do that, then you can just write native code and customize the GtkHeaderBar of the window. If you're making a custom window you're in charge of anything you put in there.

@prateekmedia

This comment has been minimized.

@prateekmedia
Copy link
Author

@knopp Is there any way to get response from window manager to check if titlebar buttons are to be shown or not?

Use case:
on mobile linux with custom titlebar buttons, the visiblity of maximize, minimize and close button is not neccesary as it will always be controlled by window manager.

But because this was custom implementation inside flutter code so titlebar buttons will still be visible.

I want to get a callback from shell something like Window.of(context).isTitlebarButtonVisible.

This can also be used for windows phone and apps, I don't know about mac as it only have a desktop ui so this method will always return true on that.

For ios / android this method will return false as titlebar is not needed there.

@knopp
Copy link
Contributor

knopp commented Aug 22, 2021

You can not use nativeshell with iOS / Android. It is desktop only at this point.

@prateekmedia
Copy link
Author

@knopp Yeah, I only gave an example if the callback is added to this plugin.

@prateekmedia prateekmedia changed the title Add better CSD support Add Minimize, Maximize, MaximizeOrRestore functions support Aug 22, 2021
@prateekmedia
Copy link
Author

prateekmedia commented Feb 12, 2022

6799261 has this implemented but it is not auto and you need to provide the maximize value.

Like
setMaximize(true)

But I wanted an auto method which would restore if maximized and maximize if restore like
maximizeOrRestore()

@knopp Can this be implemented?

@knopp
Copy link
Contributor

knopp commented Feb 12, 2022

Something like this should work:

    final flags = await window.getWindowStateFlags();
    await window.setMaximized(!flags.maximized);

@prateekmedia
Copy link
Author

prateekmedia commented Feb 12, 2022

@knopp Can this be a method so that it would be easy and I will not have to repeat the code, Thanks.

@knopp
Copy link
Contributor

knopp commented Feb 12, 2022

You can easily make it an extension method.

@prateekmedia
Copy link
Author

Thanks, I will close this then.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants