Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Solution: hide default titlebar or customize it at MacOS #5

Open
Moosphan opened this issue Feb 12, 2022 · 0 comments
Open

Solution: hide default titlebar or customize it at MacOS #5

Moosphan opened this issue Feb 12, 2022 · 0 comments

Comments

@Moosphan
Copy link
Collaborator

Moosphan commented Feb 12, 2022

Here provide two different ways to realize it.

1. Xcode configs by hand

e.g. https://medium.com/flutter-community/transparent-title-bar-on-macos-with-flutter-7043d44f25dc

2. Flutter way

Go your project dir/macos/Runner/MainFlutterWindow.swift:

import Cocoa
import FlutterMacOS

class MainFlutterWindow: NSWindow {
  override func awakeFromNib() {
    let flutterViewController = FlutterViewController.init()
    let windowFrame = self.frame
    self.contentViewController = flutterViewController
    self.setFrame(windowFrame, display: true)

+     // Hide system icon buttons in the title bar.
+     self.standardWindowButton(.closeButton)?.isHidden = true
+    self.standardWindowButton(.miniaturizeButton)?.isHidden = true
+    self.standardWindowButton(.zoomButton)?.isHidden = true

    RegisterGeneratedPlugins(registry: flutterViewController)

    super.awakeFromNib()
  }
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant