-
Notifications
You must be signed in to change notification settings - Fork 282
GLFW Plugin example
The dart code cannot control the glfw.Window
size, position, ...
To gain control over the glfw.Window
we need to build your own plugin in order to access the underlying API, please read the plugin wiki in order to learn more about the plugin architecture.
In this example, we answer the issue #214, how to drag undecorated window.
go-flutter has multiples option, one of them been flutter.WindowMode(flutter.WindowModeBorderless)
.
When this option is set, the window decoration (title bar, close/maximize/.. buttons) isn't displayed, meaning the window can't be dragged around
, maximize
, closed
,.. using 'classic' mouse interaction.
Wouldn't it be natural to use the AppBar
widget to move the window?
Well, it has been implemented as a example. If you launch draggable_borderless, grab the AppBar
and start dragging, the window will follow your cursor!
In order to implement this feature, a GLFW Plugin has been created, the plugin code source is directly available in options.go, making this example a good GLFW Plugin starting point.
Make sure to read the GLFW documentation to know which functions are thread safe or not.
If you happens to need to call functions on the main thread, use MethodChannel.HandleFuncSync
, in your Golang handler (the example draggable_borderless
does it).