Skip to content
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
10 changes: 9 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,14 @@
## [2.0.0-beta.2]
✨New ✨
* `MacosSwitch` has been completely rewritten and now matches the native macOS switch in appearance and behavior.
* A `ControlSize` enum has been introduced, which will allow widgets to more closely match their native counterparts.

🔄 Updated 🔄
* Some previously missing elements of the `MacosColor` class have been added.

## [2.0.0-beta.1]
🚨 Breaking Changes 🚨
* Migrate macos_ui to [macos_window_utils](https://pub.dev/packages/macos_window_utils), which provides the following benefits:
* Migrate `macos_ui` to [macos_window_utils](https://pub.dev/packages/macos_window_utils), which provides the following benefits:
* Window animation smoothness is drastically improved, particularly when miniaturizing and deminiaturizing the application window.
* Some visual artifacts that occurred while the window was being (de)miniaturized (such as the application's shadow going missing) no longer occur.
* The sidebar remains transparent when the app's brightness setting mismatches the OS setting.
Expand Down
24 changes: 16 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -657,26 +657,34 @@ PushButton(

## MacosSwitch

A switch is a visual toggle between two mutually exclusive states — on and off. A switch shows that it's on when the
accent color is visible and off when the switch appears colorless. [Learn more](https://developer.apple.com/design/human-interface-guidelines/macos/buttons/switches/)
A 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
accent color is visible and off when the switch appears colorless.

| On | Off |
| ------------------------------------------ | ------------------------------------------ |
| <img src="https://imgur.com/qK1VCVr.jpg"/> | <img src="https://imgur.com/IBh5jkz.jpg"/> |
The `ContolSize` enum can be passed to the `size` property to control the size of the switch. `MacosSwitch` supports the following
control sizes:
* `mini`
* `small`
* `regular`

| Off | On |
|--------------------------------------------|--------------------------------------------|
| <img src="https://imgur.com/NBeTMoZ.jpg"/> | <img src="https://imgur.com/SBfE0jf.jpg"/> |

Here's an example of how to create a basic toggle switch:

```dart
bool selected = false;
bool switchValue = false;

MacosSwitch(
value: selected,
value: switchValue,
onChanged: (value) {
setState(() => selected = value);
setState(() => switchValue = value);
},
),
```

Learn more about switches [here](https://developer.apple.com/design/human-interface-guidelines/toggles).

## MacosSegmentedControl

Displays one or more navigational tabs in a single horizontal group. Used by `MacosTabView` to navigate between the
Expand Down
31 changes: 26 additions & 5 deletions example/lib/pages/buttons_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -217,11 +217,32 @@ class _ButtonsPageState extends State<ButtonsPage> {
const SizedBox(height: 20),
const Text('MacosSwitch'),
const SizedBox(height: 8),
MacosSwitch(
value: switchValue,
onChanged: (value) {
setState(() => switchValue = value);
},
Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
MacosSwitch(
value: switchValue,
size: ControlSize.mini,
onChanged: (value) {
setState(() => switchValue = value);
},
),
const SizedBox(width: 16.0),
MacosSwitch(
value: switchValue,
size: ControlSize.small,
onChanged: (value) {
setState(() => switchValue = value);
},
),
const SizedBox(width: 16.0),
MacosSwitch(
value: switchValue,
onChanged: (value) {
setState(() => switchValue = value);
},
),
],
),
const SizedBox(height: 20),
const Text('MacosPulldownButton'),
Expand Down
2 changes: 1 addition & 1 deletion example/pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ packages:
path: ".."
relative: true
source: path
version: "2.0.0-beta.1"
version: "2.0.0-beta.2"
macos_window_utils:
dependency: transitive
description:
Expand Down
13 changes: 7 additions & 6 deletions lib/macos_ui.dart
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@

library macos_ui;

export 'package:macos_window_utils/macos/ns_window_delegate.dart';
export 'package:macos_window_utils/macos_window_utils.dart';

export 'src/buttons/back_button.dart';
export 'src/buttons/checkbox.dart';
export 'src/buttons/disclosure_button.dart';
Expand All @@ -29,6 +32,7 @@ export 'src/buttons/toolbar/toolbar_icon_button.dart';
export 'src/buttons/toolbar/toolbar_overflow_button.dart';
export 'src/buttons/toolbar/toolbar_pulldown_button.dart';
export 'src/dialogs/macos_alert_dialog.dart';
export 'src/enums/control_size.dart';
export 'src/fields/search_field.dart';
export 'src/fields/text_field.dart';
export 'src/icon/image_icon.dart';
Expand All @@ -37,14 +41,14 @@ export 'src/indicators/capacity_indicators.dart';
export 'src/indicators/progress_indicators.dart';
export 'src/indicators/rating_indicator.dart';
export 'src/indicators/relevance_indicator.dart';
export 'src/layout/scrollbar.dart';
export 'src/indicators/slider.dart';
export 'src/labels/label.dart';
export 'src/labels/tooltip.dart';
export 'src/layout/content_area.dart';
export 'src/layout/macos_list_tile.dart';
export 'src/layout/resizable_pane.dart';
export 'src/layout/scaffold.dart';
export 'src/layout/scrollbar.dart';
export 'src/layout/sidebar/sidebar.dart';
export 'src/layout/sidebar/sidebar_item.dart';
export 'src/layout/sidebar/sidebar_items.dart';
Expand All @@ -60,8 +64,10 @@ export 'src/layout/toolbar/toolbar_overflow_menu.dart';
export 'src/layout/toolbar/toolbar_overflow_menu_item.dart';
export 'src/layout/toolbar/toolbar_popup.dart';
export 'src/layout/toolbar/toolbar_spacer.dart';
export 'src/layout/wallpaper_tinted_area.dart';
export 'src/layout/window.dart';
export 'src/macos_app.dart';
export 'src/macos_window_utils_config.dart';
export 'src/selectors/color_well.dart';
export 'src/selectors/date_picker.dart';
export 'src/selectors/time_picker.dart';
Expand All @@ -82,8 +88,3 @@ export 'src/theme/search_field_theme.dart';
export 'src/theme/time_picker_theme.dart';
export 'src/theme/tooltip_theme.dart';
export 'src/theme/typography.dart';
export 'src/layout/wallpaper_tinted_area.dart';
export 'src/macos_window_utils_config.dart';

export 'package:macos_window_utils/macos_window_utils.dart';
export 'package:macos_window_utils/macos/ns_window_delegate.dart';
Loading