macosui / macos_ui

Flutter widgets and themes implementing the current macOS design language.
https://macosui.github.io/macos_ui/#/
MIT License
1.82k stars 178 forks source link

Incorrect rendering of titlebar in full screen mode #249

Closed alexvinidiktov closed 2 years ago

alexvinidiktov commented 2 years ago

Description

The demo app, when switched to Full Screen Mode, displays an empty titlebar. See the screenshot attached.

Steps To Reproduce

  1. Compile the demo.
  2. Launch the demo.
  3. Enter the full screen mode.

Expected behavior

The upper part of the sidebar and the upper part of the main pane should still be visible.

Screenshots

Capture d’écran 2022-05-13 à 12 45 05
whiplashoo commented 2 years ago

Yes, seeing that too. It happens even when ToolBar or Titlebar are missing, so probably an issue with the Swift window layout code?

whiplashoo commented 2 years ago

Did some testing, and it indeed comes from MainFlutterWindow.swift. The full screen settings here are not used at all currently. Simply changing this: https://github.com/GroovinChip/macos_ui/blob/e4c37d6699d4f6b8b1ce98ded9a7d250d7d64341/example/macos/Runner/MainFlutterWindow.swift#L37

to also extend NSWindowDelegate and using the delegate thereafter:

class MainFlutterWindow: NSWindow, NSWindowDelegate {
    delegate = self

fixes the issue, and makes the app use the required full screen settings.

However, the opaque empty toolbar still shows up when hovering the mouse at the top of the screen. We could try to listen to the full screen event and toggle it accordingly.