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

Version 2.1.7 (#546) #547

Merged
merged 4 commits into from
Jan 17, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## [2.1.7]
### 🔄 Updated 🔄
* Expose `WindowMainStateListener` and implement `overrideIsMainWindow` method to allow for the window’s main state to be overridden.

## [2.1.6]
### 🔄 Updated 🔄
* add `section` parameter to `SidebarItem` to display an unclickable widget in the sidebar as a section header (thanks, [@whirlun](https://github.com/whirlun)).
Expand Down
1 change: 1 addition & 0 deletions lib/macos_ui.dart
Original file line number Diff line number Diff line change
Expand Up @@ -89,3 +89,4 @@ export 'src/theme/time_picker_theme.dart';
export 'src/theme/tooltip_theme.dart';
export 'src/theme/typography.dart';
export 'src/enums/accent_color.dart';
export 'src/utils/window_main_state_listener.dart';
13 changes: 12 additions & 1 deletion lib/src/utils/window_main_state_listener.dart
Original file line number Diff line number Diff line change
Expand Up @@ -42,12 +42,23 @@ class WindowMainStateListener {
/// Whether the window is currently the main window.
bool _isMainWindow = true;

/// Overrides the value of [_isMainWindow].
bool? _isMainWindowOverride;

/// Whether the window is currently the main window.
bool get isMainWindow => _isMainWindow;
bool get isMainWindow => _isMainWindowOverride ?? _isMainWindow;

/// Notifies listeners when the window’s main state changes.
final _windowMainStateStreamController = StreamController<bool>.broadcast();

/// Overrides the value of [isMainWindow].
///
/// Passing `null` will remove the override.
void overrideIsMainWindow(bool? value) {
_isMainWindowOverride = value;
_windowMainStateStreamController.add(isMainWindow);
}

/// A stream of the window’s main state. Emits a new value whenever the state
/// changes.
Stream<bool> get onChanged => _windowMainStateStreamController.stream;
Expand Down
2 changes: 1 addition & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: macos_ui
description: Flutter widgets and themes implementing the current macOS design language.
version: 2.1.6
version: 2.1.7
homepage: "https://macosui.dev"
repository: "https://github.com/GroovinChip/macos_ui"

Expand Down
Loading