[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"project-9250":3},{"id":4,"name":5,"fullName":6,"owner":7,"repo":5,"description":8,"homepage":9,"htmlUrl":10,"language":11,"languages":10,"totalLinesOfCode":10,"stars":12,"forks":13,"watchers":14,"openIssues":15,"contributorsCount":16,"subscribersCount":16,"size":16,"stars1d":16,"stars7d":17,"stars30d":18,"stars90d":16,"forks30d":16,"starsTrendScore":16,"compositeScore":19,"rankGlobal":10,"rankLanguage":10,"license":20,"archived":21,"fork":21,"defaultBranch":22,"hasWiki":21,"hasPages":23,"topics":24,"createdAt":10,"pushedAt":10,"updatedAt":27,"readmeContent":28,"aiSummary":29,"trendingCount":16,"starSnapshotCount":16,"syncStatus":17,"lastSyncTime":30,"discoverSource":31},9250,"macos_ui","macosui\u002Fmacos_ui","macosui","Flutter widgets and themes implementing the current macOS design language.","https:\u002F\u002Fmacosui.github.io\u002Fmacos_ui\u002F#\u002F",null,"Dart",2134,204,22,69,0,2,5,60.44,"MIT License",false,"dev",true,[25,26],"flutter","macos","2026-06-12 04:00:43","# macos_ui\n\nFlutter widgets and themes implementing the current macOS design language.\n\nCheck out our **interactive widget gallery** online at https:\u002F\u002Fmacosui.github.io\u002Fmacos_ui\u002F#\u002F\n\nGuides, codelabs, and other documentation can be found at https:\u002F\u002Fmacosui.dev\n\n[![pub package](https:\u002F\u002Fimg.shields.io\u002Fpub\u002Fv\u002Fmacos_ui.svg)](https:\u002F\u002Fpub.dev\u002Fpackages\u002Fmacos_ui)\n[![pub package](https:\u002F\u002Fimg.shields.io\u002Fpub\u002Fpublisher\u002Fmacos_ui.svg)](https:\u002F\u002Fpub.dev\u002Fpackages\u002Fmacos_ui)  \n\n[![Flutter Analysis](https:\u002F\u002Fgithub.com\u002FGroovinChip\u002Fmacos_ui\u002Factions\u002Fworkflows\u002Fflutter_analysis.yml\u002Fbadge.svg?branch=stable)](https:\u002F\u002Fgithub.com\u002FGroovinChip\u002Fmacos_ui\u002Factions\u002Fworkflows\u002Fflutter_analysis.yml)\n[![Pana Analysis](https:\u002F\u002Fgithub.com\u002FGroovinChip\u002Fmacos_ui\u002Factions\u002Fworkflows\u002Fpana_analysis.yml\u002Fbadge.svg)](https:\u002F\u002Fgithub.com\u002FGroovinChip\u002Fmacos_ui\u002Factions\u002Fworkflows\u002Fpana_analysis.yml)\n[![codecov](https:\u002F\u002Fgithub.com\u002FGroovinChip\u002Fmacos_ui\u002Factions\u002Fworkflows\u002Fcodecov.yaml\u002Fbadge.svg)](https:\u002F\u002Fgithub.com\u002FGroovinChip\u002Fmacos_ui\u002Factions\u002Fworkflows\u002Fcodecov.yaml)\n[![codecov](https:\u002F\u002Fcodecov.io\u002Fgh\u002Fmacosui\u002Fmacos_ui\u002Fbranch\u002Fdev\u002Fgraph\u002Fbadge.svg?token=1SZGEVVMCH)](https:\u002F\u002Fcodecov.io\u002Fgh\u002Fmacosui\u002Fmacos_ui)\n\n\u003Cimg src=\"https:\u002F\u002Fimgur.com\u002F44iJB7H.png\" width=\"75%\"\u002F>\n\n## 🚨 Usage notes\n### \u003Cimg src=\"https:\u002F\u002Fstorage.googleapis.com\u002Fcms-storage-bucket\u002F0dbfcc7a59cd1cf16282.png\" height=\"14\"\u002F> Flutter channel\n`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.\n\n### 🖥️ Platform Compatibility\n\npub.dev shows that `macos_ui` only supports macOS. This is because `macos_ui` calls some native code, and therefore \nspecifies macOS as a plugin platform in the `pubspec.yaml` file.\n\n`macos_ui` _technically_ will work on any platform that\nFlutter supports, **but you will get best results on macOS**. non-macOS platform support is ***not*** guaranteed.\n\nThe features of `macos_ui` that will _not_ work on platforms other than macOS due to calling native code are:\n* Anything related to `macos_window_utils`\n* The `MacosColors.controlAccentColor()` function\n* The `MacosColorWell` widget\n\n### \u003Cimg src=\"https:\u002F\u002Fstorage.googleapis.com\u002Fcms-storage-bucket\u002F0dbfcc7a59cd1cf16282.png\" height=\"14\"\u002F> Flutter Compatibility\n\nStarting 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`.\n\n**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.**\n\n### \u003Cimg src=\"https:\u002F\u002Fimgur.com\u002FTIP0V7H.png\" height=\"14\"\u002F> Popups & window resizing\n\nSince at this time Flutter does not allow UI elements to overflow the bounds of the window, popups are constrained to\nthe available space.\n\nTherefore, if you are using widgets that create popups in your toolbar, like `ToolBarPopupButton`, you \nshould avoid allowing your application window to be resized below the height of your tallest popup.\n\n## Contents\n\n\u003Cdetails>\n\u003Csummary>Contributing & Resources\u003C\u002Fsummary>\n\n- [Contributing](#contributing)\n- [Resources](#resources)\n\u003C\u002Fdetails>\n\n\u003Cdetails>\n\u003Csummary>Layout\u003C\u002Fsummary>\n\n- [Layout](#layout)\n  - [MacosWindow](#macoswindow)\n  - [Sidebar](#sidebar)\n  - [MacosScaffold](#macosscaffold)\n  - [Modern Window Look](#modern-window-look)\n  - [ToolBar](#toolbar)\n  - [SliverToolBar](#SliverToolBar)\n  - [MacosListTile](#MacosListTile)\n  - [MacosTabView](#MacosTabView)\n\u003C\u002Fdetails>\n\n\u003Cdetails>\n\u003Csummary>Icons\u003C\u002Fsummary>\n\n- [Icons](#icons)\n  - [MacosIcon](#MacosIcon)\n\u003C\u002Fdetails>\n\n\u003Cdetails>\n\u003Csummary>Buttons\u003C\u002Fsummary>\n\n- [Buttons](#buttons)\n  - [MacosCheckbox](#macoscheckbox)\n  - [HelpButton](#helpbutton)\n  - [RadioButton](#radiobutton)\n  - [PulldownButton](#pulldownbutton)\n  - [PopupButton](#popupbutton)\n  - [PushButton](#pushbutton)\n  - [MacosSwitch](#macosswitch)\n  - [MacosSegmentedControl](#macossegmentedcontrol)\n\u003C\u002Fdetails>\n  \n\u003Cdetails>\n\u003Csummary>Dialogs & Sheets\u003C\u002Fsummary>\n\n- [Dialogs & Sheets](#dialogs)\n  - [MacosAlertDialog](#MacosAlertDialog)\n  - [MacosSheet](#MacosSheet)\n\u003C\u002Fdetails>\n\n\u003Cdetails>\n\u003Csummary>Fields & Labels\u003C\u002Fsummary>\n\n- [Fields](#fields)\n  - [MacosTextField](#macostextfield)\n  - [MacosSearchField](#macossearchfield)\n- [Labels](#labels)\n  - [MacosTooltip](#macostooltip)\n\u003C\u002Fdetails>\n\n\u003Cdetails>\n\u003Csummary>Indicators\u003C\u002Fsummary>\n\n- [Indicators](#indicators)\n  - [Progress Indicators](#progress-indicators)\n    - [ProgressCircle](#progresscircle)\n    - [ProgressBar](#progressbar)\n  - [Level Indicators](#level-indicators)\n    - [CapacityIndicator](#capacityindicator)\n    - [RatingIndicator](#ratingindicator)\n\u003C\u002Fdetails>\n\n\u003Cdetails>\n\u003Csummary>Selectors\u003C\u002Fsummary>\n\n- [Selectors](#selectors)\n  - [MacosDatePicker](#macosdatepicker)\n  - [MacosTimePicker](#macostimepicker)\n  - [MacosColorWell](#macoscolorwell)\n\u003C\u002Fdetails>\n\n\u003Cdetails>\n\u003Csummary>Older macOS versions\u003C\u002Fsummary>\n\n- [Older macOS versions](#older-macos-versions)\n\u003C\u002Fdetails>\n\n---\n\n## Contributing\n\n`macos_ui` welcomes contributions! Please see `CONTRIBUTING.md` for more information.\n\n## Resources\n\n- [macOS Sonoma Figma kit](https:\u002F\u002Fwww.figma.com\u002Ffile\u002FM6K5L3GK0WJh6pnsASyVeE\u002FmacOS-Big-Sur-UI-Kit?node-id=1%3A2)\n- [macOS Human Interface Guidelines](https:\u002F\u002Fdeveloper.apple.com\u002Fdesign\u002Fhuman-interface-guidelines\u002Fdesigning-for-macos)\n- [macOS Design Resources](https:\u002F\u002Fdeveloper.apple.com\u002Fdesign\u002Fresources\u002F)\n\n# Layout\n\n## MacosWindow\n\n`MacosWindow` is the basic frame for a macOS-style layout.\n\n\u003Cimg src=\"https:\u002F\u002Fimgur.com\u002FolstQFC.png\" width=\"40%\"\u002F>\n\u003Cimg src=\"https:\u002F\u002Fimgur.com\u002FyFXsoSy.png\" width=\"40%\"\u002F>\n\nIt supports a `Sidebar` on the left, an optional `TitleBar` at the top, and the rest of the window is typically filled out\nwith a `MacosScaffold`. \n\nA scope for the `MacosWindow` is provided by `MacosWindowScope`.\nThe sidebar can be toggled with `MacosWindowScope.of(context).toggleSidebar()`. **Please note** that you must wrap \nyour `MacosScaffold` in a `Builder` widget in order for this to work properly.\n\n\u003Cimg src=\"https:\u002F\u002Fimgur.com\u002FIBbp5rN.gif\" width=\"75%\">\n\n## Sidebar\nA sidebar enables app navigation and provides quick access to top-level collections of content in your app.\n\nSidebars may be placed at the left or right of your app. To place a sidebar on the left, use the `MacosWindow.sidebar` property. To place a sidebar on the right, use the `MacosWindow.endSidebar` property.\n\n\u003Cimg src=\"https:\u002F\u002Fimgur.com\u002FBfoHcXE.png\" width=\"75%\"\u002F>\n\nExample usage:\n\n```dart\nint pageIndex = 0;\n\n...\n\nMacosWindow(\n  sidebar: Sidebar(\n    minWidth: 200,\n    builder: (context, scrollController) {\n      return SidebarItems(\n        currentIndex: pageIndex,\n        scrollController: scrollController,\n        itemSize: SidebarItemSize.large,\n        onChanged: (i) {\n          setState(() => pageIndex = i);\n        },\n        items: const [\n          SidebarItem(\n            label: Text('Page One'),\n          ),\n          SidebarItem(\n            label: Text('Page Two'),\n          ),\n        ],\n      );\n    },\n  ),\n  endSidebar: Sidebar(\n    startWidth: 200,\n    minWidth: 200,\n    maxWidth: 300,\n    shownByDefault: false,\n    builder: (context, _) {\n      return const Center(\n        child: Text('End Sidebar'),\n      );\n    },\n  ),\n),\n```\n\n## MacosScaffold\n\nThe `MacosScaffold` is what you might call a \"page\".\n\nThe scaffold has a `toolbar` property and a `children` property. `children` accepts a `ContentArea` widget and \nmultiple `ResizablePane` widgets. To catch navigation or routes below the scaffold, consider wrapping the \n`MacosScaffold` in a [`CupertinoTabView`](https:\u002F\u002Fapi.flutter.dev\u002Fflutter\u002Fcupertino\u002FCupertinoTabView-class.html). \nBy doing so, navigation inside the `MacosScaffold` will be displayed inside the `MacosScaffold` area instead of \ncovering the entire window. To push a route outside a `MacosScaffold` wrapped in a \n[`CupertinoTabView`](https:\u002F\u002Fapi.flutter.dev\u002Fflutter\u002Fcupertino\u002FCupertinoTabView-class.html), use the root navigator \n`Navigator.of(context, rootNavigator: true)`\n\nSee the documentation for customizations and `ToolBar` examples.\n\n\u003Cimg src=\"https:\u002F\u002Fimgur.com\u002FePV2x2p.png\" width=\"75%\"\u002F>\n\n\u003Cimg src=\"https:\u002F\u002Fimgur.com\u002F76fpFE2.png\" width=\"75%\"\u002F>\n\n## Modern window look\n\nA 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:\u002F\u002Fpub.dev\u002Fpackages\u002Fmacos_window_utils), which requires a minimum macOS deployment target of 10.14.6. Therefore, make sure to open the `macos\u002FRunner.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.\n\nIt is recommended to enable the Swift Package Manager when using macos_ui. Instructions on how to do that can be found [here](https:\u002F\u002Fdocs.flutter.dev\u002Fpackages-and-plugins\u002Fswift-package-manager\u002Ffor-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:\n\n```podspec\nplatform :osx, '10.14.6'\n```\n\nYou may also need to open up your app's `Runner.xcodeproj` in XCode and set the minimum deployment version there.\n\nNow, configure your window inside your `main()` as follows:\n\n```dart\n\u002F\u002F\u002F This method initializes macos_window_utils and styles the window.\nFuture\u003Cvoid> _configureMacosWindowUtils() async {\n  const config = MacosWindowUtilsConfig(\n    toolbarStyle: NSWindowToolbarStyle.unified,\n  );\n  await config.apply();\n}\n\nvoid main() async {\n  await _configureMacosWindowUtils();\n\n  runApp(const YourAppHere());\n}\n```\n\nPlease note that if you are using a title bar (`TitleBar`) in your `MacosWindow`, you should set the `toolbarStyle` of your window to `NSWindowToolbarStyle.expanded`, in order to properly align the close, minimize, zoom window buttons:\n\n```dart\nFuture\u003Cvoid> _configureMacosWindowUtils() async {\n  const config = MacosWindowUtilsConfig(\n    toolbarStyle: NSWindowToolbarStyle.expanded,\n  );\n  await config.apply();\n}\n```\n\nIn any other case, you should keep it as `NSWindowToolbarStyle.unified`.\n\n## ToolBar\n\nCreates a toolbar in the `MacosScaffold`. The toolbar appears below the title bar (if present) of the macOS app or integrates with it, by using its `title` property. \n\nA toolbar provides convenient access to frequently used commands and features (toolbar items). Different routes of your app could have different toolbars. \n\nToolbar items include `ToolBarIconButton`, `ToolBarPulldownButton`, and `ToolBarSpacer` widgets, and should be provided via the `items` property. The action of every toolbar item should also be provided as a menu bar command of your app.\n\nToolbars look best and are easiest to understand when they contain elements of the same type (so either use labels for every toolbar item or not).\n\nYou can use the `ToolBarSpacer` widgets to set the grouping of the different toolbar actions.\n\nAn example toolbar would be:\n\n```dart\nToolBar(\n  title: const Text('Untitled Document'),\n  titleWidth: 200.0,\n  leading: MacosBackButton(\n    onPressed: () => debugPrint('click'),\n    fillColor: Colors.transparent,\n  ),\n  actions: [\n    ToolBarIconButton(\n      label: \"Add\",\n      icon: const MacosIcon(\n        CupertinoIcons.add_circled,\n      ),\n      onPressed: () => debugPrint(\"Add...\"),\n      showLabel: true,\n    ),\n    const ToolBarSpacer(),\n    ToolBarIconButton(\n      label: \"Delete\",\n      icon: const MacosIcon(\n        CupertinoIcons.trash,\n      ),\n      onPressed: () => debugPrint(\"Delete\"),\n      showLabel: false,\n    ),\n    ToolBarPullDownButton(\n      label: \"Actions\",\n      icon: CupertinoIcons.ellipsis_circle,\n      items: [\n        MacosPulldownMenuItem(\n          label: \"New Folder\",\n          title: const Text(\"New Folder\"),\n          onTap: () => debugPrint(\"Creating new folder...\"),\n        ),\n        MacosPulldownMenuItem(\n          label: \"Open\",\n          title: const Text(\"Open\"),\n          onTap: () => debugPrint(\"Opening...\"),\n        ),\n      ],\n    ),\n  ]\n),\n```\n\nThis builds this simple toolbar: \n\u003Cimg src=\"https:\u002F\u002Fimgur.com\u002FBDUdQkj.png\"\u002F>\n\nOther toolbar examples:\n\n- Toolbar with icon buttons (no labels):\n\u003Cimg src=\"https:\u002F\u002Fimgur.com\u002FPtrjhPx.png\"\u002F>\n\n- Toolbar with icon buttons and labels:\n\u003Cimg src=\"https:\u002F\u002Fimgur.com\u002FOuaud12.png\"\u002F>\n\n- Toolbar with a pulldown button open:\n\u003Cimg src=\"https:\u002F\u002Fimgur.com\u002FmsGmcNY.png\"\u002F>\n\n- Toolbar with title bar above (also see [the note above](#modern-window-look)):\n\u003Cimg src=\"https:\u002F\u002Fimgur.com\u002FeAgcsKY.png\"\u002F>\n\nYou can also create your own `CustomToolbarItem` to include any type of widget in the toolbar:\n\n```dart\n\u002F\u002F Add a grey vertical line as a custom toolbar item:\nCustomToolbarItem(\n  inToolbarBuilder: (context) => Padding(\n    padding: const EdgeInsets.all(8.0),\n    child: Container(color: Colors.grey, width: 1, height: 30),\n  ),\n  inOverflowedBuilder: (context) =>\n      Container(color: Colors.grey, width: 30, height: 1),\n),\n```\n\n## `SliverToolBar`\n\u003Cimg src=\"https:\u002F\u002Fimgur.com\u002Fu4LDaxj.gif\" width=\"75%\"\u002F>\n\n`SliverToolbar` is a variant of the standard `ToolBar`, with the key difference being that (as the name implies), it \nis compatible with scrollable widgets like `CustomScrollView` and `NestedScrollView`. There are three additional \nproperties on `SliverToolBar`:\n* `pinned`, which determines if the toolbar should remain visible while scrolling\n* `floating`, which determines if the toolbar should become visible as soon as the use starts scrolling upwards\n* `opacity`, which manages the translucency effect of the toolbar\n\nThis widget enables developers to achieve the toolbar behaviors seen in Apple's App Store.\n\nSample usage:\n```dart\nreturn CustomScrollView(\n  controller: scrollController,\n  slivers: [\n    SliverToolBar(\n      title: const Text('SliverToolbar'),\n      pinned: true,\n      toolbarOpacity: 0.75,\n    ),\n    \u002F\u002F Other slivers below  \n  ],\n);\n```\n\n## MacosListTile\n\nA widget that aims to approximate the [`ListTile`](https:\u002F\u002Fapi.flutter.dev\u002Fflutter\u002Fmaterial\u002FListTile-class.html) widget found in\nFlutter's material library.\n\n![MacosListTile](https:\u002F\u002Fimgur.com\u002FpQB99M2.png)\n\nSample usage:\n```dart\nMacosListTile(\n  leading: const Icon(CupertinoIcons.lightbulb),\n  title: Text(\n    'A robust library of Flutter components for macOS',\n    style: MacosTheme.of(context).typography.headline,\n  ),\n  subtitle: Text(\n    'Create native looking macOS applications using Flutter',\n    style: MacosTheme.of(context).typography.subheadline.copyWith(\n      color: MacosColors.systemGrayColor,\n    ),\n  ),\n),\n```\n\n## MacosTabView\nA multipage interface that displays one page at a time. Must be used in a `StatefulWidget`.\n\n\u003Cimg src=\"https:\u002F\u002Fimgur.com\u002FWNF1CSl.png\"\u002F>\n\nYou can control the placement of the tabs using the `position` property.\n\nUsage:\n```dart\nfinal _controller = MacosTabController(\n  initialIndex: 0,\n  length: 3,\n);\n\n...\n\nMacosTabView(\n  controller: _controller,\n  tabs: const [\n    MacosTab(\n      label: 'Tab 1',\n    ),\n    MacosTab(\n      label: 'Tab 2',\n    ),\n    MacosTab(\n      label: 'Tab 3',\n    ),\n  ],\n  children: const [\n    Center(\n      child: Text('Tab 1'),\n    ),\n    Center(\n      child: Text('Tab 2'),\n    ),\n    Center(\n      child: Text('Tab 3'),\n    ),\n  ],\n),        \n\n```\n\n# Icons\n\n## MacosIcon\n\nA `MacosIcon` is identical to a regular `Icon` in every way with one exception - it respects\na `MacosTheme`. Use it the same way you would a regular icon:\n\n```dart\nMacosIcon(\n  CupertinoIcons.add,\n  \u002F\u002F color: CupertinoColors.activeBlue.color,\n  \u002F\u002F size: 20,\n),\n```\n\n# Buttons\n\n## MacosCheckbox\n\nA checkbox is a type of button that lets the user choose between two opposite states, actions, or values. A selected \ncheckbox is considered on when it contains a checkmark and off when it's empty. A checkbox is almost always followed \nby a title unless it appears in a checklist. [Learn more](https:\u002F\u002Fdeveloper.apple.com\u002Fdesign\u002Fhuman-interface-guidelines\u002Fmacos\u002Fbuttons\u002Fcheckboxes\u002F)\n\n| Unchecked                                            | Checked                                            | Mixed                                            |\n| ---------------------------------------------------- | -------------------------------------------------- | ------------------------------------------------ |\n| ![Unchecked Checkbox](https:\u002F\u002Fimgur.com\u002FPu4EDAE.png) | ![Checked Checkbox](https:\u002F\u002Fimgur.com\u002FCB3Kmwo.png) | ![Mixed Checkbox](https:\u002F\u002Fimgur.com\u002FT44rV38.png) |\n\nHere's an example of how to create a basic checkbox:\n\n```dart\nbool selected = false;\n\nMacosCheckbox(\n  value: selected,\n  onChanged: (value) {\n    setState(() => selected = value);\n  },\n)\n```\n\nTo make a checkbox in the `mixed` state, set `value` to `null`.\n\n## HelpButton\n\nA help button appears within a view and opens app-specific help documentation when clicked. All help buttons are \ncircular, consistently sized buttons that contain a question mark icon. [Learn more](https:\u002F\u002Fdeveloper.apple.com\u002Fdesign\u002Fhuman-interface-guidelines\u002Fmacos\u002Fbuttons\u002Fhelp-buttons\u002F)\n\n![HelpButton Example](https:\u002F\u002Fimgur.com\u002FDlP7uLV.png)\n\nHere's an example of how to create a help button:\n\n```dart\nHelpButton(\n  onPressed: () {\n    print('pressed help button'),\n  },\n)\n```\n\nYou can customize the help button appearance and behaviour using the `HelpButtonTheme`, but it's not recommended by \napple to change help button's appearance.\n\n## RadioButton\n\nA radio button is a small, circular button followed by a title. Typically presented in groups of two to five, radio \nbuttons provide the user a set of related but mutually exclusive choices. A radio button’s state is either on \n(a filled circle) or off (an empty circle). [Learn more](https:\u002F\u002Fdeveloper.apple.com\u002Fdesign\u002Fhuman-interface-guidelines\u002Fmacos\u002Fbuttons\u002Fradio-buttons\u002F)\n\n![RadioButton Preview](https:\u002F\u002Fimgur.com\u002FHI0eQsU.png)\n\nHere's an example of how to create a basic radio button:\n\n```dart\nbool selected = false;\n\nMacosRadioButton(\n  value: selected,\n  onChanged: (value) {\n    setState(() => selected = value);\n  },\n),\n```\n\n## PulldownButton\n\nA pull-down button (often referred to as a pull-down menu) is a type of pop-up button that, when clicked, displays a \nmenu containing a list of choices. The menu appears below the button. Once the menu is displayed onscreen, it remains \nopen until the user chooses a menu item, clicks outside of the menu, switches to another app, or quits the app; or \nuntil the system displays an alert. [Learn more](https:\u002F\u002Fdeveloper.apple.com\u002Fdesign\u002Fhuman-interface-guidelines\u002Fmacos\u002Fbuttons\u002Fpull-down-buttons\u002F)\n\nUse a pull-down button to present a list of commands. A pull-down button can either show a `title` or an `icon` to \ndescribe the contents of the button's menu. If you use an icon, make sure it clearly communicates the button’s purpose.\n\nIf `items` is null, the button will be disabled (greyed out). \n\n A `title` or an `icon` must be provided, to be displayed as the  pull-down button's title, but not both at the same time.\n\nThe menu can also be navigated with the up\u002Fdown keys and an action selected with the Return key.\n\nIt can also appear in the toolbar, via the `ToolBarPulldownButton` widget.\n\n| Dark Theme                                 | Light Theme                                |\n| ------------------------------------------ | ------------------------------------------ |\n| \u003Cimg src=\"https:\u002F\u002Fimgur.com\u002FXZlsUxF.jpg\"\u002F> | \u003Cimg src=\"https:\u002F\u002Fimgur.com\u002FEtrydYd.jpg\"\u002F> |\n| \u003Cimg src=\"https:\u002F\u002Fimgur.com\u002FKVX8OsR.jpg\"\u002F> | \u003Cimg src=\"https:\u002F\u002Fimgur.com\u002FmTvBxyL.jpg\"\u002F> |\n| \u003Cimg src=\"https:\u002F\u002Fimgur.com\u002Fk1Wm6fd.jpg\"\u002F> | \u003Cimg src=\"https:\u002F\u002Fimgur.com\u002Fwb08RXI.jpg\"\u002F> |\n\nHere's an example of how to create a basic pull-down button:\n\n```dart\nMacosPulldownButton(\n  title: \"Actions\",\n  \u002F\u002F Or provide an icon to use as title:\n  \u002F\u002F icon: CupertinoIcons.ellipsis_circle, \n  items: [\n    MacosPulldownMenuItem(\n      title: const Text('Save'),\n      onTap: () => debugPrint(\"Saving...\"),\n    ),\n    MacosPulldownMenuItem(\n      title: const Text('Save as...'),\n      onTap: () => debugPrint(\"Opening Save As dialog...\"),\n    ),\n    const MacosPulldownMenuDivider(),\n    MacosPulldownMenuItem(\n      enabled: false,\n      title: const Text('Export'),\n      onTap: () => debugPrint(\"Exporting\"),\n    ),\n  ],\n),\n```\n\n## PopupButton\n\nA pop-up button (often referred to as a pop-up menu) is a type of button that, when clicked, displays a menu containing \na list of mutually exclusive choices. The menu appears on top of the button. Like other types of menus, a pop-up \nbutton’s menu can include separators and symbols like checkmarks. After the menu is revealed, it remains open until the \nuser chooses a menu item, clicks outside of the menu, switches to another app, or quits the app; or until the system \ndisplays an alert. [Learn more](https:\u002F\u002Fdeveloper.apple.com\u002Fdesign\u002Fhuman-interface-guidelines\u002Fmacos\u002Fbuttons\u002Fpop-up-buttons\u002F)\n\nThe type `T` of the `MacosPopupButton` is the type of the value that each pop-up menu item represents. All the entries \nin a given menu must represent values with consistent types. Typically, an `enum` is used. Each `MacosPopupMenuItem` \nin items must be specialized with that same type argument.\n\nThe `onChanged` callback should update a state variable that defines the pop-up menu's value. It should also call \n`State.setState` to rebuild the pop-up button with the new value.\n\nWhen there are menu items that cannot be displayed within the available menu constraints, a caret is shown at the top \nor bottom of the open menu to signal that there are items that are not currently visible. \n\nThe menu can also be navigated with the up\u002Fdown keys and an item selected with the Return key.\n\n| Dark Theme                                 | Light Theme                                |\n| ------------------------------------------ | ------------------------------------------ |\n| \u003Cimg src=\"https:\u002F\u002Fimgur.com\u002Fov0kzJC.jpg\"\u002F> | \u003Cimg src=\"https:\u002F\u002Fimgur.com\u002FbuhYEo1.jpg\"\u002F> |\n| \u003Cimg src=\"https:\u002F\u002Fimgur.com\u002FBOEH59L.jpg\"\u002F> | \u003Cimg src=\"https:\u002F\u002Fimgur.com\u002F61S7DSX.jpg\"\u002F> |\n| \u003Cimg src=\"https:\u002F\u002Fimgur.com\u002FzY0d8RF.jpg\"\u002F> | \u003Cimg src=\"https:\u002F\u002Fimgur.com\u002FW4CMa5z.jpg\"\u002F> |\n\nHere's an example of how to create a basic pop-up button:\n\n```dart\nString popupValue = 'One';\n\nMacosPopupButton\u003CString>(\n  value: popupValue,\n  onChanged: (String? newValue) {\n    setState(() {\n      popupValue = newValue!;\n    });\n  },\n  items: \u003CString>['One', 'Two', 'Three', 'Four']\n      .map\u003CMacosPopupMenuItem\u003CString>>((String value) {\n    return MacosPopupMenuItem\u003CString>(\n      value: value,\n      child: Text(value),\n    );\n  }).toList(),\n),\n```\n\n## PushButton\n\nPush buttons are the standard button type in macOS. Push buttons contain text—not icons—and often open a separate window, dialog, or app so the user can \ncomplete a task. [Learn more](https:\u002F\u002Fdeveloper.apple.com\u002Fdesign\u002Fhuman-interface-guidelines\u002Fmacos\u002Fbuttons\u002Fpush-buttons\u002F)\n\n| Dark Theme                                 | Light Theme                                |\n| ------------------------------------------ | ------------------------------------------ |\n| \u003Cimg src=\"https:\u002F\u002Fimgur.com\u002FRLg1tWu.png\"\u002F> | \u003Cimg src=\"https:\u002F\u002Fimgur.com\u002FzymbEIE.png\"\u002F> |\n\nℹ️ **Note** ℹ️\nNative push buttons can be styled as text-only, text with an icon, or icon-only. Currently, text-only push buttons are supported. To create an icon-only button, use the `MacosIconButton` widget.\n\nHere's an example of how to create a basic push button:\n\n```dart\nPushButton(\n  child: Text('button'),\n  controlSize: ControlSize.regular,\n  onPressed: () {\n    print('button pressed');\n  },\n),\n```\n\n## MacosSwitch\n\nA switch (also known as a toggle) is a control that offers a binary choice between two mutually exclusive states — on and off. A switch shows that it's on when the \naccent color is visible and off when the switch appears colorless.\n\nThe `ContolSize` enum can be passed to the `size` property to control the size of the switch. `MacosSwitch` supports the following\ncontrol sizes:\n* `mini`\n* `small`\n* `regular`\n\n| Off                                        | On                                         |\n| ------------------------------------------ | ------------------------------------------ |\n| \u003Cimg src=\"https:\u002F\u002Fimgur.com\u002FbH7I0Lg.png\"\u002F> | \u003Cimg src=\"https:\u002F\u002Fimgur.com\u002FuuaXiS3.png\"\u002F> |\n\nHere's an example of how to create a basic toggle switch:\n\n```dart\nbool switchValue = false;\n\nMacosSwitch(\n  value: switchValue,\n  onChanged: (value) {\n    setState(() => switchValue = value);\n  },\n),\n```\n\nLearn more about switches [here](https:\u002F\u002Fdeveloper.apple.com\u002Fdesign\u002Fhuman-interface-guidelines\u002Ftoggles).\n\n## MacosSegmentedControl\n\nDisplays one or more navigational tabs in a single horizontal group. Used by `MacosTabView` to navigate between the \ndifferent tabs of the tab bar.\n\n\u003Cimg src=\"https:\u002F\u002Fimgur.com\u002F6fIkCMr.png\"\u002F>\n\nThe typical usage of this widget is by `MacosTabView`, to control the navigation of its children. You do not need to \nspecify a `MacosSegmentedControl` with your `MacosTabView`, as it is built by that widget.\n\n# Dialogs and Sheets\n\n## MacosAlertDialog\n\nUsage:\n```dart\nshowMacosAlertDialog(\n  context: context,\n  builder: (_) => MacosAlertDialog(\n    appIcon: FlutterLogo(size: 64),\n    title: Text(\n      'Alert Dialog with Primary Action',\n      style: MacosTheme.of(context).typography.headline,\n    ),\n    message: Text(\n      'This is an alert dialog with a primary action and no secondary action',\n      textAlign: TextAlign.center,\n      style: MacosTypography.of(context).headline,\n    ),\n    primaryButton: PushButton(\n      controlSize: ControlSize.large,\n      child: Text('Primary'),\n      onPressed: () {},\n    ),\n  ),\n);\n```\n\n![](https:\u002F\u002Fimgur.com\u002F4zbGsFi.png)\n![](https:\u002F\u002Fimgur.com\u002F5fgkRU9.png)\n![](https:\u002F\u002Fimgur.com\u002FjOyJrZO.png)\n![](https:\u002F\u002Fimgur.com\u002FNX9taPj.png)\n\n## MacosSheet\n\nUsage:\n```dart\nshowMacosSheet(\n  context: context,\n  builder: (_) => const MacosuiSheet(),\n);\n```\n\n![](https:\u002F\u002Fimgur.com\u002FMnw2ywm.png)\n\n# Fields\n\n## MacosTextField\n\nA text field is a rectangular area in which the user enters or edits one or more lines of text. A text field can \ncontain plain or styled text.\n\n\u003Cimg src=\"https:\u002F\u002Fimgur.com\u002FUzyMlcL.png\" width=\"75%\"\u002F>\n\nHere's an example of how to create a basic text field:\n\n```dart\nMacosTextField(\n  placeholder: 'Type some text here',\n)\n```\n\n## MacosSearchField\n\nA search field is a style of text field optimized for performing text-based searches in a large collection of values.\n\nWhen the user starts typing into the search field, a list of selectable results appears in an overlay below (or above) the field. \n\n\u003Cimg src=\"https:\u002F\u002Fimgur.com\u002FqbabwAW.png\" width=\"75%\"\u002F>\n\n| Dark Theme                                 | Light Theme                                |\n| ------------------------------------------ | ------------------------------------------ |\n| \u003Cimg src=\"https:\u002F\u002Fimgur.com\u002FJol85ny.jpg\"\u002F> | \u003Cimg src=\"https:\u002F\u002Fimgur.com\u002FxP3l3Lv.jpg\"\u002F> |\n\nHere's an example of how to create a search field:\n\n```dart\nMacosSearchField(\n  placeholder: 'Search for a country...',\n  results: countries.map((e) => SearchResultItem(e)).toList(),\n  onResultSelected: (resultItem) {\n    debugPrint(resultItem.searchKey);\n  },\n)\n```\n\nCheck the `examples\u002Ffields_page` for more examples.\n\n# Labels\n\nLabels are a short description of what an element on the screen does.\n\n## MacosTooltip\n\nTooltips succinctly describe how to use controls without shifting people’s focus away from the primary interface. \nHelp tags appear when the user positions the pointer over a control for a few seconds. A tooltip remains visible for \n10 seconds, or until the pointer moves away from the control.\n\n| Dark Theme                                 | Light Theme                                |\n| ------------------------------------------ | ------------------------------------------ |\n| \u003Cimg src=\"https:\u002F\u002Fimgur.com\u002F0qLFqdK.jpg\"\u002F> | \u003Cimg src=\"https:\u002F\u002Fimgur.com\u002FY3PLqBo.jpg\"\u002F> |\n\nTo create a tooltip, wrap any widget on a `MacosTooltip`:\n\n```dart\nMacosTooltip(\n  message: 'This is a tooltip',\n  child: Text('Hover or long press to show a tooltip'),\n),\n```\n\nYou can customize the tooltip the way you want by customizing the theme's `TooltipTheme`. A tooltip automatically adapts to its \nenvironment, responding to touch and pointer events. To use a tooltip with a toolbar item, provide it with a `tooltipMessage` property.\n\n# Indicators\n\n## Progress Indicators\n\nDon’t make people sit around staring at a static screen waiting for your app to load content or perform lengthy data \nprocessing operations. Use progress indicators to let people know your app hasn't stalled and to give them some idea \nof how long they’ll be waiting.\n\nProgress indicators have two distinct styles:\n\n- **Bar indicators**, more commonly known as progress bars, show progress in a horizontal bar.\n- **Spinning indicators** show progress in a circular form, either as a spinner or as a circle that fills in as progress continues.\n\nPeople don't interact with progress indicators; however, they are often accompanied by a button for canceling the \ncorresponding operation. [Learn more](https:\u002F\u002Fdeveloper.apple.com\u002Fdesign\u002Fhuman-interface-guidelines\u002Fmacos\u002Findicators\u002Fprogress-indicators\u002F)\n\n### ProgressCircle\n\nA `ProgressCircle` can be either determinate or indeterminate.\n\n| Determinate Progress Circle                | Indeterminate Progress Circle              |\n| ------------------------------------------ | ------------------------------------------ |\n| \u003Cimg src=\"https:\u002F\u002Fimgur.com\u002Fhr3dHn9.jpg\"\u002F> | \u003Cimg src=\"https:\u002F\u002Fimgur.com\u002FNSbKqLK.gif\"\u002F> |\n\nHere's an example of how to create an indeterminate progress circle:\n\n```dart\nProgressCircle(\n  value: null,\n),\n```\n\nYou can provide a non-null value to `value` to make the progress circle determinate.\n\n### ProgressBar\n\nA `ProgressBar` can only be determinate.\n\n\u003Cimg src=\"https:\u002F\u002Fimgur.com\u002FtdYgJmB.jpg\" width=\"50%\" height=\"50%\"\u002F>\n\nHere's an example of how to create a determinate progress bar:\n\n```dart\nProgressBar(\n  value: 30,\n)\n```\n\n## Level Indicators\n\nA level indicator graphically represents of a specific value within a range of numeric values. It’s similar to a \n[slider](#slider) in purpose, but more visual and doesn’t contain a distinct control for selecting a value—clicking and \ndragging across the level indicator itself to select a value is supported, however. A level indicator can also include \ntick marks, making it easy for the user to pinpoint a specific value in the range. There are three different level \nindicator styles, each with a different appearance, for communicating capacity, rating, and relevance.\n\n### CapacityIndicator\n\nA capacity indicator illustrates the current level in relation to a finite capacity. Capacity indicators are often used \nwhen communicating factors like disk and battery usage. [Learn more](https:\u002F\u002Fdeveloper.apple.com\u002Fdesign\u002Fhuman-interface-guidelines\u002Fmacos\u002Findicators\u002Flevel-indicators#capacity-indicators)\n\n\u003Cimg src=\"https:\u002F\u002Fimgur.com\u002FU7hcCqJ.png\" \u002F>\n\u003Cimg src=\"https:\u002F\u002Fimgur.com\u002FAJyXG6p.png\" \u002F>\n\nHere's an example of how to create an interactive continuous capacity indicator:\n\n```dart\ndouble value = 30;\n\nCapacityIndicator(\n  value: value,\n  discrete: false,\n  onChanged: (v) {\n    setState(() => value = v);\n  },\n),\n```\n\nYou can set `discrete` to `true` to make it a discrete capacity indicator.\n\n### MacosSlider\n\nA slider is a control that lets people select a value from a continuous or discrete range of values by moving the slider thumb.\n\n | Continuous                                                                                 | Discrete                                                                                                                                 |\n | ------------------------------------------------------------------------------------------ | ---------------------------------------------------------------------------------------------------------------------------------------- |\n | ![Continuous Slider Example](https:\u002F\u002Fi.imgur.com\u002Fdc4YjoX.png)                              | ![Discrete Slider Example](https:\u002F\u002Fi.imgur.com\u002FKckOTUf.png)                                                                              |\n | A horizontal slider where any value continuous value between a min and max can be selected | A horizontal slider where only discrete values between a min and max can be selected. Tick marks are often displayed to provide context. |\n\n\nHere's an example of how to create an interactive continuous slider:\n\n```dart\ndouble value = 0.5;\n\nMacosSlider(\n  value: value,\n  onChanged: (v) {\n    setState(() => value = v);\n  },\n),\n```\n\n### RatingIndicator\n\nA rating indicator uses a series of horizontally arranged graphical symbols to communicate a ranking level. The default \nsymbol is a star.\n\n![RatingIndicator Example](https:\u002F\u002Fimgur.com\u002FySQBpL6.png)\n\nA rating indicator doesn’t display partial symbols—its value is rounded in order to display complete symbols only. \nWithin a rating indicator, symbols are always the same distance apart and don't expand or shrink to fit the control. \n[Learn more](https:\u002F\u002Fdeveloper.apple.com\u002Fdesign\u002Fhuman-interface-guidelines\u002Fmacos\u002Findicators\u002Flevel-indicators#rating-indicators)\n\nHere's an example of how to create an interactive rating indicator:\n\n```dart\ndouble value = 3;\n\nRatingIndicator(\n  amount: 5,\n  value: value,\n  onChanged: (v) {\n    setState(() => value = v);\n  }\n)\n```\n\n# Selectors\n\n## MacosDatePicker\n\n\u003Cimg src=\"https:\u002F\u002Fimgur.com\u002Fsprmep1.png\" width=\"75%\"\u002F>\n\nLets the user choose a date.\n\nThere are three styles of `MacosDatePickers`:\n* `textual`: a text-only date picker where the user must select the day,\n  month, or year and use the caret-control buttons to change the value.\n  This is useful when space in your app is constrained.\n* `graphical`: a visual date picker where the user can navigate through a\n  calendar-like interface to select a date.\n* `combined`: provides both `textual` and `graphical` interfaces.\n\nLocalization of the time picker is supported by the `weekdayAbbreviations` and `monthAbbreviations` parameters (instead of e.g. standard `localizations.narrowWeekdays()` in order to match Apple's spec).\n* `weekdayAbbreviations` should be a list of 7 strings, one for each day of the week, starting with Sunday\n* `monthAbbreviations` should be a list of 12 strings, one for each month of the year, starting with January\n\nYou can also define the `dateFormat` to change the way dates are displayed in the textual interface.\nIt takes a string of tokens (case-insensitive) and replaces them with their corresponding values.\nThe following tokens are supported:\n* `D`: day of the month (1-31)\n* `DD`: day of the month (01-31)\n* `M`: month of the year (1-12)\n* `MM`: month of the year (01-12)\n* `YYYY`: year (0000-9999)\n* Any separator between tokens is preserved (e.g. `\u002F`, `-`, `.`)\n\nThe default format is `M\u002FD\u002FYYYY`. \n\nExample usage:\n```dart\nMacosDatePicker(\n  onDateChanged: (date) => debugPrint('$date'),\n),\n```\n\n## MacosTimePicker\n\n\u003Cimg src=\"https:\u002F\u002Fimgur.com\u002FRtPbRo2.png\" width=\"50%\"\u002F>\n\nLets the user choose a time.\n\nThere are three styles of `MacosTimePickers`:\n* `textual`: a text-only time picker where the user must select the hour\n  or minute and use the caret-control buttons to change the value.\n  This is useful when space in your app is constrained.\n* `graphical`: a visual time picker where the user can move the hands of a\n  clock-like interface to select a time.\n* `combined`: provides both `textual` and `graphical` interfaces.\n\nExample usage:\n```dart\nMacosTimePicker(\n  onTimeChanged: (time) => debugPrint('$time'),\n),\n```\n\n## MacosColorWell\n\n\u003Cimg src=\"https:\u002F\u002Fimgur.com\u002FVpK4IlM.gif\" width=\"50%\"\u002F>\n\nLets the user choose a color via the native macOS color picker.\n\nYou can choose which mode to launch the picker in using the `ColorPickerMode` enum. The default is `ColorPickerMode.wheel`\n\n🚨 This widget will not work on platforms other than macOS!\n\nExample usage: \n```dart\nMacosColorWell(\n  onColorSelected: (color) => debugPrint('$color'),\n),\n```\n\n## Older macOS versions\n\nIf you’re targeting older macOS versions (Monterey and earlier), it is necessary to perform the following steps to make the [macos_window_utils](https:\u002F\u002Fpub.dev\u002Fpackages\u002Fmacos_window_utils) plugin, which macos_ui depends on, work correctly:\n\nOpen the `macos\u002FRunner.xcworkspace` folder of your project using Xcode, press ⇧ + ⌘ + O and search for `MainFlutterWindow.swift`.\n\nInsert `import macos_window_utils` at the top of the file.\nThen, replace the code above the `super.awakeFromNib()`-line with the following code:\n\n```swift\nlet windowFrame = self.frame\nlet macOSWindowUtilsViewController = MacOSWindowUtilsViewController()\nself.contentViewController = macOSWindowUtilsViewController\nself.setFrame(windowFrame, display: true)\n\n\u002F* Initialize the macos_window_utils plugin *\u002F\nMainFlutterWindowManipulator.start(mainFlutterWindow: self)\n\nRegisterGeneratedPlugins(registry: macOSWindowUtilsViewController.flutterViewController)\n```\n\nAssuming you're starting with the default configuration, the finished code should look something like this:\n\n```diff\nimport Cocoa\nimport FlutterMacOS\n+import macos_window_utils\n\nclass MainFlutterWindow: NSWindow {\n  override func awakeFromNib() {\n-   let flutterViewController = FlutterViewController.init()\n-   let windowFrame = self.frame\n-   self.contentViewController = flutterViewController\n-   self.setFrame(windowFrame, display: true)\n\n-   RegisterGeneratedPlugins(registry: flutterViewController)\n    \n+   let windowFrame = self.frame\n+   let macOSWindowUtilsViewController = MacOSWindowUtilsViewController()\n+   self.contentViewController = macOSWindowUtilsViewController\n+   self.setFrame(windowFrame, display: true)\n\n+   \u002F* Initialize the macos_window_utils plugin *\u002F\n+   MainFlutterWindowManipulator.start(mainFlutterWindow: self)\n\n+   RegisterGeneratedPlugins(registry: macOSWindowUtilsViewController.flutterViewController)\n\n    super.awakeFromNib()\n  }\n}\n```","macos_ui 是一个基于 Flutter 的项目，提供了实现当前 macOS 设计语言的组件和主题。该项目使用 Dart 语言开发，包含了一系列遵循 macOS 视觉风格的小部件与主题方案，支持如按钮、文本框等 UI 元素，并且具备一定的原生代码调用能力来增强用户体验。macos_ui 最适合用于希望在 macOS 平台上构建具有原生外观应用程序的开发者场景中，同时它也能够在其他平台上运行，但部分功能仅限于 macOS 环境下可用。通过该项目，开发者可以快速搭建出符合 macOS 审美标准的应用界面。","2026-06-11 03:21:53","top_language"]