Skip to content

Commit ce3d3e4

Browse files
committed
[desktop_webview_window] fix macOS webview window size not working
1 parent 3176127 commit ce3d3e4

File tree

4 files changed

+10
-4
lines changed

4 files changed

+10
-4
lines changed

packages/desktop_webview_window/CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,11 @@
1+
## 0.2.3
2+
3+
* fix macOS webview window size not working.
4+
15
## 0.2.2
26

37
* fix memory leak on macOS after close webview window.
8+
* Show and Hide Webview window by [@Iri-Hor](https://github.com/Iri-Hor) in [#268](https://github.com/MixinNetwork/flutter-plugins/pull/268)
49

510
## 0.2.1
611

packages/desktop_webview_window/example/pubspec.lock

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ packages:
5555
path: ".."
5656
relative: true
5757
source: path
58-
version: "0.2.2"
58+
version: "0.2.3"
5959
fake_async:
6060
dependency: transitive
6161
description:

packages/desktop_webview_window/macos/Classes/WebviewWindowController.swift

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,17 +37,18 @@ class WebviewWindowController: NSWindowController {
3737
self.title = title
3838
super.init(window: nil)
3939

40-
let newWindow = NSWindow(contentRect: NSRect(x: 0, y: 0, width: width, height: height), styleMask: [.titled, .closable, .resizable, .fullSizeContentView], backing: .buffered, defer: false)
40+
let newWindow = NSWindow(contentRect: NSRect(x: 0, y: 0, width: width, height: height), styleMask: [.titled, .closable, .miniaturizable, .resizable, .fullSizeContentView], backing: .buffered, defer: false)
4141
newWindow.delegate = self
4242
newWindow.title = title
4343
newWindow.titlebarAppearsTransparent = true
44-
newWindow.center()
4544

4645
let contentViewController = WebViewLayoutController(
4746
methodChannel: methodChannel,
4847
viewId: viewId, titleBarHeight: titleBarHeight,
4948
titleBarTopPadding: titleBarTopPadding)
5049
newWindow.contentViewController = contentViewController
50+
newWindow.setContentSize(NSSize(width: width, height: height))
51+
newWindow.center()
5152

5253
window = newWindow
5354
}

packages/desktop_webview_window/pubspec.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
name: desktop_webview_window
22
description: Show a webview window on your flutter desktop application.
3-
version: 0.2.2
3+
version: 0.2.3
44
homepage: https://github.com/MixinNetwork/flutter-plugins/tree/main/packages/desktop_webview_window
55

66
environment:

0 commit comments

Comments
 (0)