Skip to content

Commit 4d710eb

Browse files
committed
0.1.5
1 parent 836400f commit 4d710eb

File tree

6 files changed

+28
-7
lines changed

6 files changed

+28
-7
lines changed

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
## 0.1.5
2+
3+
- Implement `close` method #56
4+
- Implement `center` method #59
5+
16
## 0.1.4
27

38
- [macos & windows] Implemented getOpacity & setOpacity methods #37 #45

README-ZH.md

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@
3535
- [API](#api)
3636
- [WindowManager](#windowmanager)
3737
- [Methods](#methods)
38+
- [close](#close)
3839
- [focus](#focus)
3940
- [blur `macos` `windows`](#blur--macos--windows)
4041
- [show](#show)
@@ -52,6 +53,7 @@
5253
- [getBounds](#getbounds)
5354
- [setBounds](#setbounds)
5455
- [getPosition](#getposition)
56+
- [center](#center)
5557
- [setPosition](#setposition)
5658
- [getSize](#getsize)
5759
- [setSize](#setsize)
@@ -109,7 +111,7 @@
109111

110112
```yaml
111113
dependencies:
112-
window_manager: ^0.1.4
114+
window_manager: ^0.1.5
113115
```
114116
115117
@@ -138,7 +140,7 @@ void main() async {
138140
// 隐藏窗口标题栏
139141
await windowManager.setTitleBarStyle('hidden');
140142
await windowManager.setSize(Size(800, 600));
141-
await windowManager.setPosition(Offset.zero);
143+
await windowManager.center();
142144
await windowManager.show();
143145
await windowManager.setSkipTaskbar(false);
144146
});
@@ -378,6 +380,10 @@ class _HomePageState extends State<HomePage> with WindowListener {
378380

379381
#### Methods
380382

383+
##### close
384+
385+
Try to close the window.
386+
381387
##### focus
382388

383389
Focuses on the window.
@@ -447,6 +453,10 @@ Resizes and moves the window to the supplied bounds.
447453

448454
Returns `Offset` - Contains the window's current position.
449455

456+
##### center
457+
458+
Moves window to the center of the screen.
459+
450460
##### setPosition
451461

452462
Moves window to position.

README.md

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ English | [简体中文](./README-ZH.md)
3535
- [API](#api)
3636
- [WindowManager](#windowmanager)
3737
- [Methods](#methods)
38+
- [close](#close)
3839
- [focus](#focus)
3940
- [blur `macos` `windows`](#blur--macos--windows)
4041
- [show](#show)
@@ -52,6 +53,7 @@ English | [简体中文](./README-ZH.md)
5253
- [getBounds](#getbounds)
5354
- [setBounds](#setbounds)
5455
- [getPosition](#getposition)
56+
- [center](#center)
5557
- [setPosition](#setposition)
5658
- [getSize](#getsize)
5759
- [setSize](#setsize)
@@ -109,7 +111,7 @@ Add this to your package's `pubspec.yaml` file:
109111

110112
```yaml
111113
dependencies:
112-
window_manager: ^0.1.4
114+
window_manager: ^0.1.5
113115
```
114116
115117
Or
@@ -138,7 +140,7 @@ void main() async {
138140
// Hide window title bar
139141
await windowManager.setTitleBarStyle('hidden');
140142
await windowManager.setSize(Size(800, 600));
141-
await windowManager.setPosition(Offset.zero);
143+
await windowManager.center();
142144
await windowManager.show();
143145
await windowManager.setSkipTaskbar(false);
144146
});
@@ -451,6 +453,10 @@ Resizes and moves the window to the supplied bounds.
451453

452454
Returns `Offset` - Contains the window's current position.
453455

456+
##### center
457+
458+
Moves window to the center of the screen.
459+
454460
##### setPosition
455461

456462
Moves window to position.

example/pubspec.lock

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,7 @@ packages:
169169
path: ".."
170170
relative: true
171171
source: path
172-
version: "0.1.4"
172+
version: "0.1.5"
173173
sdks:
174174
dart: ">=2.14.0 <3.0.0"
175175
flutter: ">=1.20.0"

lib/src/window_manager.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -204,7 +204,7 @@ class WindowManager {
204204
return Offset(resultData['x'], resultData['y']);
205205
}
206206

207-
// Moves window to the center of the screen.
207+
/// Moves window to the center of the screen.
208208
Future<void> center() async {
209209
Size windowSize = await getSize();
210210
Map<String, dynamic> primaryDisplay = await _getPrimaryDisplay();

pubspec.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
name: window_manager
22
description: This plugin allows Flutter desktop apps to resizing and repositioning the window.
3-
version: 0.1.4
3+
version: 0.1.5
44
homepage: https://github.com/leanflutter/window_manager
55

66
environment:

0 commit comments

Comments
 (0)