Closed damywise closed 4 months ago
Frankly, it’s been so long that I don’t really recall any details. However, it seems that I have used the FlutterMultiWindowPlugin.setOnWindowCreatedCallback to retrieve the FlutterViewController
of the newly created window (which is the controller
variable in the callback). I’ve probably just called the MainFlutterWindowManipulator.start
function with the FlutterViewController
’s window as the mainFlutterWindow
argument, at which point macos_window_utils was interfacing with the new window, rather than the old one.
Again, my memory of this is quite murky at this point, but I think that’s the gist of it.
Thanks for your reply! I'll share an example when I got it working
Okay I remembered this macos embedder api docs https://main-api.flutter.dev/macos-embedder/interface_flutter_view_controller.html And found this backgroundColor, which defaults to black. I set it to clear and voila, transparent sub window. I wanna cry I spent so much time on this lol.
anyway here's the code:
FlutterMultiWindowPlugin.setOnWindowCreatedCallback { controller in
// Register macos window utils on sub window. Not really needed, but just as a reminder how to register plugins.
MacOSWindowUtilsPlugin.register(with: controller.registrar(forPlugin: "MacOSWindowUtilsPlugin"))
// Set the background color of the Flutter view to clear/transparent
controller.backgroundColor = NSColor.clear
}
Oh yeah, that was a change that Flutter pushed in (I believe) version 3.7.0. It caused macos_window_utils to break and it took a while for the community to figure out what had happened.
Hello, I saw that it is possible to make sub window transparent like so: https://github.com/macosui/macos_ui/discussions/322#discussioncomment-4869430![image](https://github.com/macosui/macos_window_utils.dart/assets/25608913/7c4ea97f-c6dc-407e-a62e-3f8bb6bc7235)
How did you manage to make it work? I want to implement it in a fork of this since it would be unreasonable to introduce breaking changes. It could be helpful for others too, as I honestly don't see official multi-window implementation happening this year.
As of now, calling
WindowManipulator.makeWindowFullyTransparent()
on sub windows really doesn't do anything as far as I notice.