File tree Expand file tree Collapse file tree 2 files changed +25
-1
lines changed Expand file tree Collapse file tree 2 files changed +25
-1
lines changed Original file line number Diff line number Diff line change 5
5
## [ 2.0.1]
6
6
### 🔄 Updated 🔄
7
7
* ` PushButton ` has received a facelift. It now mimics the look and feel of native macOS buttons more closely.
8
- * ** Note:** As a result, its ` pressedOpacity ` property and the ` PushButtonTheme ` class have been deprecated.
8
+ * ** Note:** As a result, its ` pressedOpacity ` property and the ` PushButtonTheme ` class have been deprecated.
9
9
10
10
## [ 2.0.0]
11
11
### 🚨 Breaking Changes 🚨
Original file line number Diff line number Diff line change
1
+ import 'dart:io' ;
2
+
3
+ import 'package:flutter/foundation.dart' ;
1
4
import 'package:macos_ui/macos_ui.dart' ;
2
5
import 'package:macos_ui/src/library.dart' ;
3
6
@@ -66,3 +69,24 @@ class Unsupported {
66
69
67
70
final String message;
68
71
}
72
+
73
+ /// A class that ensures that the application's macOS window's brightness
74
+ /// matches the given brightness.
75
+ class MacOSBrightnessOverrideHandler {
76
+ static Brightness ? _lastBrightness;
77
+
78
+ /// Ensures that the application's macOS window's brightness matches
79
+ /// [currentBrightness] .
80
+ ///
81
+ /// For performance reasons, the brightness setting will only be overridden if
82
+ /// [currentBrightness] differs from the value it had when this method was
83
+ /// previously called. Therefore, it is safe to call this method frequently.
84
+ static void ensureMatchingBrightness (Brightness currentBrightness) {
85
+ if (kIsWeb) return ;
86
+ if (! Platform .isMacOS) return ;
87
+ if (currentBrightness == _lastBrightness) return ;
88
+
89
+ WindowManipulator .overrideMacOSBrightness (dark: currentBrightness.isDark);
90
+ _lastBrightness = currentBrightness;
91
+ }
92
+ }
You can’t perform that action at this time.
0 commit comments