Comments (4)
I am using the old instructions as a workaround and can confirm that the example now works from macOS 10.15.7 to 14.2.1:
Open the macos/Runner.xcworkspace
folder of your project using Xcode, press β§ + β + O and search for MainFlutterWindow.swift
.
Insert import macos_window_utils
at the top of the file.
Then, replace the code above the super.awakeFromNib()
-line with the following code:
let windowFrame = self.frame
let macOSWindowUtilsViewController = MacOSWindowUtilsViewController()
self.contentViewController = macOSWindowUtilsViewController
self.setFrame(windowFrame, display: true)
/* Initialize the macos_window_utils plugin */
MainFlutterWindowManipulator.start(mainFlutterWindow: self)
RegisterGeneratedPlugins(registry: macOSWindowUtilsViewController.flutterViewController)
Assuming you're starting with the default configuration, the finished code should look something like this:
import Cocoa
import FlutterMacOS
+import macos_window_utils
class MainFlutterWindow: NSWindow {
override func awakeFromNib() {
- let flutterViewController = FlutterViewController.init()
- let windowFrame = self.frame
- self.contentViewController = flutterViewController
- self.setFrame(windowFrame, display: true)
- RegisterGeneratedPlugins(registry: flutterViewController)
+ let windowFrame = self.frame
+ let macOSWindowUtilsViewController = MacOSWindowUtilsViewController()
+ self.contentViewController = macOSWindowUtilsViewController
+ self.setFrame(windowFrame, display: true)
+ /* Initialize the macos_window_utils plugin */
+ MainFlutterWindowManipulator.start(mainFlutterWindow: self)
+ RegisterGeneratedPlugins(registry: macOSWindowUtilsViewController.flutterViewController)
super.awakeFromNib()
}
}
from macos_window_utils.dart.
Related to macosui/macos_ui#450. I am aware of the issue, but havenβt had much time to work on it lately.
EDIT: Thanks for finding out which commit is causing the issue, though. This might help with investigating the issue.
from macos_window_utils.dart.
Thank you! The workaround seems to work.
from macos_window_utils.dart.
Related Issues (20)
- All window styles doesn't work after upgrading Flutter to 3.7.0 HOT 2
- Expose `NSWindowDelegate` events
- Expose UI Element Colors HOT 1
- Add a method to check whether the plugin has been set up properly in the MainFlutterWindow.swift file. HOT 1
- macos_window_utils/MainFlutterWindowManipulator.swift:370: Fatal error: Unexpectedly found nil while unwrapping an Optional value HOT 1
- Fix typo in readme
- `'self' captured by a closure before all members were initialized`
- Flutter 3.10 - Exiting app doesn't work properly HOT 1
- Add query and mutation controls for the traffic light window buttons HOT 11
- Consider moving away from static methods HOT 1
- Consider offering a widget for window configuration HOT 5
- Create a TrafficLightsSafeArea widget HOT 2
- Expose `isMainWindow`.
- Make it possible to center the window on the screen HOT 3
- Avoid visual glitch on launch HOT 5
- Let user's specify a static window size HOT 1
- Because both the window_manager plug-in and this plug-in use NSWindowDelegate, there is an incompatibility problem between the two, which will cause all monitoring in window_manager to fail. This problem has been encountered in the macos_ui library. HOT 5
- deployment target 11.0 does not work HOT 1
- [Question] Transparency compatibility with desktop_multi_window HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
π Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. πππ
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google β€οΈ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from macos_window_utils.dart.