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

Macos issue #54 #55

Merged
merged 22 commits into from
Dec 30, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
f9a2610
example: fix incorrect word in comment
Adrian-Samoticha Dec 28, 2022
5863a17
chore: improve formatting
Adrian-Samoticha Dec 29, 2022
bd28a84
migrate example to macos_window_utils
Adrian-Samoticha Dec 29, 2022
53f54aa
macOS: migrate `Window` methods to macos_window_utils
Adrian-Samoticha Dec 29, 2022
39a35c5
macOS: fix `Window.initialize` not setting effect
Adrian-Samoticha Dec 29, 2022
158f6d5
macOS: fix transparent macOS sidebar documentation
Adrian-Samoticha Dec 29, 2022
dd84f8d
macOS: fix transparent macOS bottom bar documentation
Adrian-Samoticha Dec 29, 2022
03c6e20
macOS: fix formatting of titlebar safe area documentation
Adrian-Samoticha Dec 29, 2022
5e0cbb2
macOS: fix visual effect subview container documentation
Adrian-Samoticha Dec 29, 2022
f340e95
macOS: fix visual effect subview container with global key documentation
Adrian-Samoticha Dec 29, 2022
038b8ae
macOS: fix formatting of visual effect subview container property sto…
Adrian-Samoticha Dec 29, 2022
7d33076
macOS: remove swift and podspec files
Adrian-Samoticha Dec 29, 2022
9e3eba8
macOS: remove unused constants
Adrian-Samoticha Dec 29, 2022
2f4bb8c
macOS: move converters into `converters` directory
Adrian-Samoticha Dec 29, 2022
9aa5d3f
example: ensure selected action list item is visible
Adrian-Samoticha Dec 29, 2022
af6d17a
macOS: add image to documentation of `setDocumentEdited`
Adrian-Samoticha Dec 29, 2022
b5bd6da
Bump version to 1.1.0
Adrian-Samoticha Dec 29, 2022
c8b793a
changelog: update changelog for version 1.1.0
Adrian-Samoticha Dec 29, 2022
05eb808
migration guide: add migration guide
Adrian-Samoticha Dec 30, 2022
c40a73e
readme: update “Additional setup for macOS”
Adrian-Samoticha Dec 30, 2022
7671bc2
readme: bump minimum deployment target to 10.14.6
Adrian-Samoticha Dec 30, 2022
abdfe98
changelog: change wording to past tense
Adrian-Samoticha Dec 30, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,15 @@
## 1.1.0
- Added methods to add a toolbar to the window on macOS and change its style.
- Added methods to enable/disable the window's shadow on macOS.
- Added method to make the window fully transparent on macOS.
- Added methods to ignore mouse events on macOS.
- Added method to set the window's subtitle on macOS.
- Added methods and widgets to create visual effect subviews on macOS.
- Improved documentation of various widgets and classes.

**Breaking change:**
Migrated to [macos_window_utils](https://pub.dev/packages/macos_window_utils). See the [migration guide](https://github.com/alexmercerind/flutter_acrylic/blob/master/MIGRATIONGUIDE.md) for more information.

## 1.0.0+2

- Hotfix: Fixes a problem with too many rebuilds in TitlebarSafeArea.
Expand Down
65 changes: 65 additions & 0 deletions MIGRATIONGUIDE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
# Migration Guide
## ^1.0.0 → 1.1.0
If you have followed the **“Additional setup for macOS”** instructions for flutter_acrylic 1.0.0, your `MainFlutterWindow.swift` file should like like this:

```swift
import Cocoa
import FlutterMacOS
import flutter_acrylic

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

/* Initialize the flutter_acrylic plugin */
MainFlutterWindowManipulator.start(mainFlutterWindow: self)
RegisterGeneratedPlugins(registry: blurryContainerViewController.flutterViewController)

super.awakeFromNib()
}
}
```

In 1.1.0, flutter_acrylic has been made a dependent of [macos_window_utils](https://pub.dev/packages/macos_window_utils), which needs to be initialized instead of flutter_acrylic. To do so, the following changes need to be made:

+ Replace `import flutter_acrylic` with `import macos_window_utils`.
+ Replace `BlurryContainerViewController` with `MacOSWindowUtilsViewController`.

Once you are done, your finished code should like something like this:

```diff
import Cocoa
import FlutterMacOS
-import flutter_acrylic
+import macos_window_utils

class MainFlutterWindow: NSWindow {
override func awakeFromNib() {
let windowFrame = self.frame
- let blurryContainerViewController = BlurryContainerViewController()
- self.contentViewController = blurryContainerViewController
+ let macOSWindowUtilsViewController = MacOSWindowUtilsViewController()
+ self.contentViewController = macOSWindowUtilsViewController
self.setFrame(windowFrame, display: true)

- /* Initialize the flutter_acrylic plugin */
+ /* Initialize the macos_window_utils plugin */
MainFlutterWindowManipulator.start(mainFlutterWindow: self)
- RegisterGeneratedPlugins(registry: blurryContainerViewController.flutterViewController)
+ RegisterGeneratedPlugins(registry: macOSWindowUtilsViewController.flutterViewController)

super.awakeFromNib()
}
}
```

Additionally, you may need to open the `Podfile` in your Xcode project and make sure the deployment target in the first line is set to `10.14.6` or above:

```podspec
platform :osx, '10.14.6'
```

If your app does not support the macOS platform, no migration is necessary.
32 changes: 20 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ Mention in your `pubspec.yaml`.
```yaml
dependencies:
...
flutter_acrylic: ^1.0.0
flutter_acrylic: ^1.1.0
```

## Example
Expand Down Expand Up @@ -371,29 +371,31 @@ You can see the [example](https://github.com/alexmercerind/flutter_acrylic/blob/

**Additional setup for macOS:**

flutter_acrylic depends on the [macos_window_utils](https://pub.dev/packages/macos_window_utils) plugin, which needs to be initialized as follows:

Open the `macos/Runner.xcworkspace` folder of your project using Xcode, press ⇧ + ⌘ + O and search for `MainFlutterWindow.swift`.

Insert `import flutter_acrylic` at the top of the file.
Insert `import macos_window_utils` at the top of the file.
Then, replace the code above the `super.awakeFromNib()`-line with the following code:

```swift
let windowFrame = self.frame
let blurryContainerViewController = BlurryContainerViewController()
self.contentViewController = blurryContainerViewController
let macOSWindowUtilsViewController = MacOSWindowUtilsViewController()
self.contentViewController = macOSWindowUtilsViewController
self.setFrame(windowFrame, display: true)

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

RegisterGeneratedPlugins(registry: blurryContainerViewController.flutterViewController)
RegisterGeneratedPlugins(registry: macOSWindowUtilsViewController.flutterViewController)
```

Assuming you're starting with the default configuration, the finished code should look something like this:

```diff
import Cocoa
import FlutterMacOS
+import flutter_acrylic
+import macos_window_utils

class MainFlutterWindow: NSWindow {
override func awakeFromNib() {
Expand All @@ -405,21 +407,27 @@ class MainFlutterWindow: NSWindow {
- RegisterGeneratedPlugins(registry: flutterViewController)

+ let windowFrame = self.frame
+ let blurryContainerViewController = BlurryContainerViewController()
+ self.contentViewController = blurryContainerViewController
+ let macOSWindowUtilsViewController = MacOSWindowUtilsViewController()
+ self.contentViewController = macOSWindowUtilsViewController
+ self.setFrame(windowFrame, display: true)

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

+ RegisterGeneratedPlugins(registry: blurryContainerViewController.flutterViewController)
+ RegisterGeneratedPlugins(registry: macOSWindowUtilsViewController.flutterViewController)

super.awakeFromNib()
}
}
```

Now press ⇧ + ⌘ + O once more and search for `Runner.xcodeproj`. Go to `info` > `Deployment Target` and set the `macOS Deployment Target` to `10.13` or above.
Now press ⇧ + ⌘ + O once more and search for `Runner.xcodeproj`. Go to `info` > `Deployment Target` and set the `macOS Deployment Target` to `10.14.6` or above.

Additionally, you may need to open the `Podfile` in your Xcode project and make sure the deployment target in the first line is set to `10.14.6` or above:

```podspec
platform :osx, '10.14.6'
```

Depending on your use case, you may want to extend the area of the window that Flutter can draw to to the entire window, such that you are able to draw onto the window's title bar as well (for example when you're only trying to make the sidebar transparent while the rest of the window is meant to stay opaque).

Expand Down
Loading