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
49 stars 9 forks source link

Consider moving away from static methods #28

Open matthew-carroll opened 1 year ago

matthew-carroll commented 1 year ago

WindowManipulator is completely based on static methods. This seems to create at least three limitations:

Developers can't use Dart's built-in builder syntax:

WindowManipulator
  ..makeTitlebarTransparent()
  ..enableFullSizeContentView()
  ..etc

It seems unlikely that this API will work in a world with multiple windows.

The implementation can't be replaced with a fake version for tests.

All of these issues could be alleviated by using a typical singleton implementation: WindowManipulator.instance or WindowManipulator.primary, etc.

Adrian-Samoticha commented 1 year ago

I am currently waiting for Flutter’s multi-window support to drop before implementing this. This way I will know what the Swift side is going to look like while designing the API. Plus, I would like to avoid breaking changes until then.