macosui / macos_window_utils.dart

macos_window_utils is a Flutter package that provides a set of methods for modifying the NSWindow of a Flutter application on macOS.
https://pub.dev/packages/macos_window_utils
MIT License
52 stars 9 forks source link

Let user's specify a static window size #42

Open matthew-carroll opened 1 year ago

matthew-carroll commented 1 year ago

By default, a window is resizable. I'd like to display a window at a set width, that the user isn't allowed to change. I'd like the height to respect a minimum and maximum height if the user tries to resize the window.

Please consider adding an API to specify imposed window constraints that prevent the user from making a window thinner/wider/taller/shorter than desired.

On a related note, I found that the only control I have over window sizing is to set the global rect, which requires knowledge of screen space. I'd prefer to just set the window size, and retain the existing location.

Similarly, the window delegate notifies us when the window will resize to a given Size, but if we want to then further resize the window, based on that new Size, we're forced to create a Rect in global screen space, so that we can use the Rect-based sizing method.

Please consider creating a symmetric API in which we can read and write sizes with Size, and we can read and write global positions with Rect. As of right now, we read Sizes and we write Rects, which is asymmetric.

Lastly, on a further related note, you might consider providing a method to change only the windows offset, without exposing the full Rect. Perhaps I want to move the (x,y) offset of the window, but I don't know the size, and I don't care about the size.

Adrian-Samoticha commented 1 year ago

Related: https://github.com/macosui/macos_window_utils.dart/issues/11