Skip to content

Commit

Permalink
Merge pull request #266 from Ahmadre/hotfix/macos_ventura
Browse files Browse the repository at this point in the history
hotfix: frame errors on MacOS Ventura
  • Loading branch information
aguilaair authored Nov 13, 2022
2 parents eafe2b4 + f9eeafb commit 2376ffd
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 20 deletions.
5 changes: 4 additions & 1 deletion macos/Podfile
Original file line number Diff line number Diff line change
Expand Up @@ -36,5 +36,8 @@ end
post_install do |installer|
installer.pods_project.targets.each do |target|
flutter_additional_macos_build_settings(target)
target.build_configurations.each do |config|
config.build_settings['MACOSX_DEPLOYMENT_TARGET'] = '10.14'
end
end
end
end
28 changes: 9 additions & 19 deletions macos/Runner/MainFlutterWindow.swift
Original file line number Diff line number Diff line change
@@ -1,33 +1,23 @@
import Cocoa
import FlutterMacOS
import flutter_acrylic
import bitsdojo_window_macos

class MainFlutterWindow: BitsdojoWindow {
override func bitsdojo_window_configure() -> UInt {
return BDW_CUSTOM_FRAME | BDW_HIDE_ON_STARTUP
}

override func awakeFromNib() {
let flutterViewController = FlutterViewController.init()
let windowFrame = self.frame
self.contentViewController = flutterViewController
let blurryContainerViewController = BlurryContainerViewController() // new
self.contentViewController = blurryContainerViewController // new
self.setFrame(windowFrame, display: true)
RegisterGeneratedPlugins(registry: flutterViewController)

// Adding a NSVisualEffectView to act as a translucent background
let contentView = contentViewController!.view;
let superView = contentView.superview!;

let blurView = NSVisualEffectView(frame: superView.bounds)
blurView.autoresizingMask = [.width, .height]
blurView.blendingMode = NSVisualEffectView.BlendingMode.behindWindow

// Pick the correct material for the task
blurView.material = NSVisualEffectView.Material.underWindowBackground

// Replace the contentView and the background view
superView.replaceSubview(contentView, with: blurView)
blurView.addSubview(contentView)

/* Initialize the flutter_acrylic plugin */
MainFlutterWindowManipulator.start(mainFlutterWindow: self) // new

RegisterGeneratedPlugins(registry: blurryContainerViewController.flutterViewController) // new
super.awakeFromNib()
}
}
}

0 comments on commit 2376ffd

Please sign in to comment.