Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
0c1a14e
Fix `MacosPulldownMenuItem.onTap` doesn't open alert dialog (#520)
TahaTesser Oct 5, 2024
ac4ee11
add “Older macOS versions” section to readme
Adrian-Samoticha Dec 27, 2024
16d3dba
bump version to 2.0.10
Adrian-Samoticha Dec 27, 2024
9036a90
add changelog entry for version 2.0.10
Adrian-Samoticha Dec 27, 2024
af795e4
Merge branch 'issue_528' into dev
Adrian-Samoticha Dec 27, 2024
b8a8e3d
Version 2.1.2 #528 (#537)
Adrian-Samoticha Dec 27, 2024
2090c8d
Version 2.1.3 #536 (#538)
Adrian-Samoticha Dec 27, 2024
cb46183
Version 2.1.4 (#533) (#539)
Adrian-Samoticha Dec 28, 2024
709125c
Version 2.1.5 #540 (#544)
Adrian-Samoticha Jan 8, 2025
e174dd7
SidebarItems section header (#543)
whirlun Jan 14, 2025
1824206
Version 2.1.7 (#546) (#547)
Adrian-Samoticha Jan 17, 2025
faea7a0
fix: ignore of shownByDefault on left sidebar (#532)
ShayperCool Jan 27, 2025
4da96e4
Version 2.1.9 (issue #545) (#549)
Adrian-Samoticha Jan 28, 2025
1097e5b
MacosTextField : Default cursor color to text color when not specifie…
driftwoodstudio Mar 3, 2025
31d62c4
Add support for Swift package manager (#573)
EchoEllet Jun 17, 2025
6e85c0f
chore: Housekeeping (#580)
GroovinChip Oct 13, 2025
8994f8b
chore: formatter updates (#582)
GroovinChip Oct 13, 2025
02177f6
chore: DCM fixes (#583)
GroovinChip Oct 13, 2025
dc4a902
Wrap toolbar items with MacosToolbarPassthrough (#579)
cbenhagen Oct 13, 2025
f5c6d6e
Fixed setState issue in MacosPulldownButton (#585)
Abbas1Hussein Oct 13, 2025
019923a
Merge branch 'stable' into dev
GroovinChip Oct 19, 2025
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
22 changes: 0 additions & 22 deletions .github/workflows/dart_code_metrics.yaml

This file was deleted.

8 changes: 8 additions & 0 deletions .github/workflows/flutter_analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,3 +34,11 @@ jobs:

- name: Analyze code
run: flutter analyze --fatal-infos .

- name: Install DCM
uses: CQLabs/setup-dcm@v2
with:
github-token: ${{ secrets.GITHUB_TOKEN }}

- name: Run DCM
run: dcm analyze .
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -82,3 +82,7 @@ coverage_report
coverage
example/macos/Flutter/GeneratedPluginRegistrant.swift
example/devtools_options.yaml

# Swift package manager
.build/
.swiftpm/
72 changes: 72 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,75 @@
## [2.2.2]
### 🛠 Fixed 🛠
- Fixed setState called after dispose issue in MacosPulldownButton.

## [2.2.1]
### 🔄 Updated 🔄
* Wrap toolbar items with `MacosToolbarPassthrough` to prevent window move or resize when interacting with toolbar items.

## [2.2.0+3]
* Address DCM lints:
* Prefer `const BorderRadius.all`
* Sort private members

## [2.2.0+2]
* Formatter updates

## [2.2.0+1]
* Support Dart 3.9.2
* Update dependencies
* Address lints

## [2.2.0]
### ✨ New ✨
* Add support for Swift package manager.

## [2.1.10]
### 🔄 Updated 🔄
* Make text field cursor color follow the user’s accent color if not explicitly set (thanks, [@driftwoodstudio](https://github.com/driftwoodstudio)).
* Expose the `AccentColorListener` class to macos_ui users.

## [2.1.9]
### 🛠️ Fixed 🛠️
* Fix incorrect highlighting and focusing behavior of `_MacosPopupMenuItemButton`.
* Remove scrolling animation from dropdown menus when manipulating the focus with the keyboard to mimic native macOS behavior.

## [2.1.8]
### 🛠️ Fixed 🛠️
* Fixed `shownByDefault` not being respected for the left sidebar of the `MacosWindow` (thanks, [@ShayperCool](https://github.com/ShayperCool)).

## [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)).
* Fix incorrect barrier color when calling `showMacosSheet` when dark mode is enabled.

## [2.1.5]
### 🛻 Migrated 🛻
* Migrate to Flutter’s new Color API.

## [2.1.4]
### 🛠️ Fixed 🛠️
* Fix incorrect barrier color when calling `showMacosAlertDialog` when dark mode is enabled.

## [2.1.3]
### 🛠️ Fixed 🛠️
* Fix `ToolbarOverflowButton` only reacting to every second click.

## [2.1.2]
### 🛠️ Updated 🛠️
* Add “Older macOS versions” section to README
* Add Flutter version constraints to prevent the following error:
```
Package validation found the following error:
* pubspec.yaml allows Flutter SDK version 1.9.x, which does not support the flutter.plugin.platforms key.
Please consider increasing the Flutter SDK requirement to ^1.10.0 (environment.sdk.flutter)
```
## [2.1.1]
* Fixed a bug where `MacosPulldownMenuItem` would not show an alert dialog when tapped.

## [2.1.0]
* Updated dependencies
* Support macOS 15
Expand Down
74 changes: 70 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ Guides, codelabs, and other documentation can be found at https://macosui.dev
### <img src="https://storage.googleapis.com/cms-storage-bucket/0dbfcc7a59cd1cf16282.png" height="14"/> Flutter channel
`macos_ui` is developed against Flutter's `stable` channel. To ensure a smooth development experience with `macos_ui`, you should build your application on Flutter's `stable` channel.

### <img src="https://storage.googleapis.com/cms-storage-bucket/0dbfcc7a59cd1cf16282.png" height="14"/> Platform Compatibility
### 🖥️ Platform Compatibility

pub.dev shows that `macos_ui` only supports macOS. This is because `macos_ui` calls some native code, and therefore
specifies macOS as a plugin platform in the `pubspec.yaml` file.
Expand All @@ -33,6 +33,12 @@ The features of `macos_ui` that will _not_ work on platforms other than macOS du
* The `MacosColors.controlAccentColor()` function
* The `MacosColorWell` widget

### <img src="https://storage.googleapis.com/cms-storage-bucket/0dbfcc7a59cd1cf16282.png" height="14"/> Flutter Compatibility

Starting with version `2.2.0+1`, `macos_ui` requires Flutter `3.35.0` or higher due to a depredation in Flutter 3.35.0. If you use an older Flutter version along with `macos_ui` version `2.2.0+1`, only version `2.2.0` will be available to you when you run `flutter pub get`.

**We therefore strongly recommend that you use Flutter `3.35.0` or higher if developing with `macos_ui` so that you gain access to the latest features and fixes.**

### <img src="https://imgur.com/TIP0V7H.png" height="14"/> Popups & window resizing

Since at this time Flutter does not allow UI elements to overflow the bounds of the window, popups are constrained to
Expand Down Expand Up @@ -124,6 +130,12 @@ should avoid allowing your application window to be resized below the height of
- [MacosColorWell](#macoscolorwell)
</details>

<details>
<summary>Older macOS versions</summary>

- [Older macOS versions](#older-macos-versions)
</details>

---

## Contributing
Expand Down Expand Up @@ -224,7 +236,9 @@ See the documentation for customizations and `ToolBar` examples.

## Modern window look

A new look for macOS apps was introduced in Big Sur (macOS 11). To match that look in your Flutter app, macos_ui relies on [macos_window_utils](https://pub.dev/packages/macos_window_utils), which requires a minimum macOS deployment target of 10.14.6. Therefore, make sure to open the `macos/Runner.xcworkspace` folder of your project using Xcode and search for `Runner.xcodeproj`. Go to `Info` > `Deployment Target` and set the `macOS Deployment Target` to `10.14.6` or above. Then, open your project's `Podfile` (if it doesn't show up in Xcode, you can find it in your project's `macos` directory via VS Code) and set the minimum deployment version in the first line to `10.14.6` or above:
A new look for macOS apps was introduced in Big Sur (macOS 11). To match that look in your Flutter app, macos_ui relies on [macos_window_utils](https://pub.dev/packages/macos_window_utils), which requires a minimum macOS deployment target of 10.14.6. Therefore, make sure to open the `macos/Runner.xcworkspace` folder of your project using Xcode and search for `Runner.xcodeproj`. Go to `Info` > `Deployment Target` and set the `macOS Deployment Target` to `10.14.6` or above.

It is recommended to enable the Swift Package Manager when using macos_ui. Instructions on how to do that can be found [here](https://docs.flutter.dev/packages-and-plugins/swift-package-manager/for-app-developers#how-to-turn-on-swift-package-manager). Alternatively, macos_ui can also be used with CocoaPods. To do so, it is necessary to open your project's `Podfile` (if it doesn't show up in Xcode, you can find it in your project's `macos` directory via VS Code) and set the minimum deployment version in the first line to `10.14.6` or above:

```podspec
platform :osx, '10.14.6'
Expand Down Expand Up @@ -472,8 +486,8 @@ A checkbox is a type of button that lets the user choose between two opposite st
checkbox is considered on when it contains a checkmark and off when it's empty. A checkbox is almost always followed
by a title unless it appears in a checklist. [Learn more](https://developer.apple.com/design/human-interface-guidelines/macos/buttons/checkboxes/)

| Unchecked | Checked | Mixed |
| --------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------ |
| Unchecked | Checked | Mixed |
| ---------------------------------------------------- | -------------------------------------------------- | ------------------------------------------------ |
| ![Unchecked Checkbox](https://imgur.com/Pu4EDAE.png) | ![Checked Checkbox](https://imgur.com/CB3Kmwo.png) | ![Mixed Checkbox](https://imgur.com/T44rV38.png) |

Here's an example of how to create a basic checkbox:
Expand Down Expand Up @@ -1012,3 +1026,55 @@ MacosColorWell(
onColorSelected: (color) => debugPrint('$color'),
),
```

## Older macOS versions

If you’re targeting older macOS versions (Monterey and earlier), it is necessary to perform the following steps to make the [macos_window_utils](https://pub.dev/packages/macos_window_utils) plugin, which macos_ui depends on, work correctly:

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

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 macOSWindowUtilsViewController = MacOSWindowUtilsViewController()
self.contentViewController = macOSWindowUtilsViewController
self.setFrame(windowFrame, display: true)

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

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 macos_window_utils

class MainFlutterWindow: NSWindow {
override func awakeFromNib() {
- let flutterViewController = FlutterViewController.init()
- let windowFrame = self.frame
- self.contentViewController = flutterViewController
- self.setFrame(windowFrame, display: true)

- RegisterGeneratedPlugins(registry: flutterViewController)

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

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

+ RegisterGeneratedPlugins(registry: macOSWindowUtilsViewController.flutterViewController)

super.awakeFromNib()
}
}
```
3 changes: 3 additions & 0 deletions example/ios/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -30,3 +30,6 @@ Runner/GeneratedPluginRegistrant.*
!default.mode2v3
!default.pbxuser
!default.perspectivev3

# Flutter related
**/Flutter/ephemeral/
98 changes: 58 additions & 40 deletions example/lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -161,36 +161,47 @@ class _WidgetGalleryState extends State<WidgetGallery> {
itemSize: SidebarItemSize.large,
items: const [
SidebarItem(
leading: MacosImageIcon(
AssetImage('assets/sf_symbols/button_programmable_2x.png'),
),
label: Text('Buttons'),
),
SidebarItem(
leading: MacosImageIcon(
AssetImage(
'assets/sf_symbols/lines_measurement_horizontal_2x.png',
label: Text('Basic UI Elements'),
section: true,
expandDisclosureItems: true,
disclosureItems: [
SidebarItem(
leading: MacosImageIcon(
AssetImage(
'assets/sf_symbols/button_programmable_2x.png',
),
),
label: Text('Buttons'),
),
),
label: Text('Indicators'),
),
SidebarItem(
leading: MacosImageIcon(
AssetImage(
'assets/sf_symbols/character_cursor_ibeam_2x.png',
SidebarItem(
leading: MacosImageIcon(
AssetImage(
'assets/sf_symbols/lines_measurement_horizontal_2x.png',
),
),
label: Text('Indicators'),
),
),
label: Text('Fields'),
),
SidebarItem(
leading: MacosImageIcon(
AssetImage('assets/sf_symbols/rectangle_3_group_2x.png'),
),
label: Text('Colors'),
),
SidebarItem(
leading: MacosIcon(CupertinoIcons.square_on_square),
label: Text('Dialogs & Sheets'),
SidebarItem(
leading: MacosImageIcon(
AssetImage(
'assets/sf_symbols/character_cursor_ibeam_2x.png',
),
),
label: Text('Fields'),
),
SidebarItem(
leading: MacosImageIcon(
AssetImage(
'assets/sf_symbols/rectangle_3_group_2x.png',
),
),
label: Text('Colors'),
),
SidebarItem(
leading: MacosIcon(CupertinoIcons.square_on_square),
label: Text('Dialogs & Sheets'),
),
],
),
SidebarItem(
leading: MacosImageIcon(
Expand All @@ -199,6 +210,7 @@ class _WidgetGalleryState extends State<WidgetGallery> {
),
),
label: Text('Layout'),
section: true,
disclosureItems: [
SidebarItem(
leading: MacosIcon(CupertinoIcons.macwindow),
Expand All @@ -224,15 +236,23 @@ class _WidgetGalleryState extends State<WidgetGallery> {
expandDisclosureItems: true,
),
SidebarItem(
leading: MacosImageIcon(
AssetImage(
'assets/sf_symbols/filemenu_and_selection_2x.png'),
),
label: Text('Selectors'),
),
SidebarItem(
leading: MacosIcon(CupertinoIcons.textformat_size),
label: Text('Typography'),
label: Text('Additional UI Elements'),
section: true,
expandDisclosureItems: true,
disclosureItems: [
SidebarItem(
leading: MacosImageIcon(
AssetImage(
'assets/sf_symbols/filemenu_and_selection_2x.png',
),
),
label: Text('Selectors'),
),
SidebarItem(
leading: MacosIcon(CupertinoIcons.textformat_size),
label: Text('Typography'),
),
],
),
],
);
Expand All @@ -249,9 +269,7 @@ class _WidgetGalleryState extends State<WidgetGallery> {
maxWidth: 300,
shownByDefault: false,
builder: (context, _) {
return const Center(
child: Text('End Sidebar'),
);
return const Center(child: Text('End Sidebar'));
},
),
child: [
Expand Down
Loading
Loading