Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
19 commits
Select commit Hold shift + click to select a range
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
14 changes: 9 additions & 5 deletions .github/workflows/dart_code_metrics.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,14 @@ jobs:
- uses: actions/checkout@v3

- name: Run Dart Code Metrics
uses: dart-code-checker/dart-code-metrics-action@v3
uses: subosito/flutter-action@v2
with:
channel: stable

- name: Install dependencies
run: flutter pub get
- uses: CQLabs/[email protected]
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
pull_request_comment: true
fatal_warnings: true
fatal_performance: true
fatal_style: true

- run: dcm analyze --ci-key="${{ secrets.DCM_CI_KEY }}" --email="${{ secrets.DCM_EMAIL }}" lib
47 changes: 46 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,55 @@
## [2.0.0-beta.7]
✨ New ✨
* You can now call `MacosTypography.of(context)` as a shorthand for retrieving the typography used in your `MacosTheme`.

🔄 Updated 🔄
* `MacosAlertDialog` now defines `primaryButton` and `secondaryButton` to be of type `PushButton`.
* `MacosAlertDialog` now requires that `primaryButton` and `secondaryButton` to have `controlSize`s of `ControlSize.large`.
* `MacosAlertDialog` docs now suggest that `appIcon` should be of size 64x64.

## [2.0.0-beta.6]
🔄 Updated 🔄
* `MacosCheckbox` appearance more closely matches its native counterpart.

## [2.0.0-beta.5]
🚨 Breaking Changes 🚨
* `PushButton` has been updated to support the `ControlSize` enum.
* The `buttonSize` property has been changed to `controlSize`.
* Buttons can now be any of the following sizes: mini, small, regular, or large.
* `PushButton.isSecondary` is now `PushButton.secondary`.

🔄 Updated 🔄
* `PushButton`'s secondary and disabled colors more closely match their native counterparts.

## [2.0.0-beta.4]
🛠️ Fixed 🛠️
* `ToolBar`s in use where a `SideBar` is not present will now have their title's avoid the traffic lights (native window controls).

## [2.0.0-beta.3]
✨ New ✨
* Added support for `weekdayAbbreviations` and `monthAbbreviations` to `MacosDatePicker`.
* Added support for `dateFormat` to `MacosDatePicker`.
* Added support for `startWeekOnMonday` to `MacosDatePicker`.

🛠️ Fixed 🛠️
* Better UX of the click on the calendar elements in `MacosDatePicker`

## [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.
* Wallpaper tinting is now supported.
* Support Flutter 3.10 and Dart 3

To migrate an existing application, please refer to the “Modern window look” section in the README.

Expand Down
63 changes: 42 additions & 21 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -632,23 +632,22 @@ MacosPopupButton<String>(

## PushButton

A push button appears within a view and initiates an instantaneous app-specific action, such as printing a document or
deleting a file. Push buttons contain text—not icons—and often open a separate window, dialog, or app so the user can
Push 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
complete a task. [Learn more](https://developer.apple.com/design/human-interface-guidelines/macos/buttons/push-buttons/)

| Dark Theme | Light Theme |
| ------------------------------------------ | ------------------------------------------ |
| <img src="https://imgur.com/GsShoF6.jpg"/> | <img src="https://imgur.com/klWHTAX.jpg"/> |
| <img src="https://imgur.com/v99ekWA.jpg"/> | <img src="https://imgur.com/hj6uGhI.jpg"/> |
| <img src="https://imgur.com/wt0K6u4.jpg"/> | <img src="https://imgur.com/7khWnwt.jpg"/> |
| <img src="https://imgur.com/TgfjJdQ.jpg"/> | <img src="https://imgur.com/83cEMeP.jpg"/> |
|--------------------------------------------|--------------------------------------------|
| <img src="https://imgur.com/iWNuPqs.png"/> | <img src="https://imgur.com/QPIHrJt.png"/> |

ℹ️ **Note** ℹ️
Native 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.

Here's an example of how to create a basic push button:

```dart
PushButton(
child: Text('button'),
buttonSize: ButtonSize.large,
controlSize: ControlSize.regular,
onPressed: () {
print('button pressed');
},
Expand All @@ -657,26 +656,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 All @@ -696,20 +703,18 @@ Usage:
showMacosAlertDialog(
context: context,
builder: (_) => MacosAlertDialog(
appIcon: FlutterLogo(
size: 56,
),
appIcon: FlutterLogo(size: 64),
title: Text(
'Alert Dialog with Primary Action',
style: MacosTheme.of(context).typography.headline,
),
message: Text(
'This is an alert dialog with a primary action and no secondary action',
textAlign: TextAlign.center,
style: MacosTheme.of(context).typography.headline,
style: MacosTypography.of(context).headline,
),
primaryButton: PushButton(
buttonSize: ButtonSize.large,
controlSize: ControlSize.large,
child: Text('Primary'),
onPressed: () {},
),
Expand Down Expand Up @@ -966,6 +971,22 @@ There are three styles of `MacosDatePickers`:
calendar-like interface to select a date.
* `combined`: provides both `textual` and `graphical` interfaces.

Localization 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).
* `weekdayAbbreviations` should be a list of 7 strings, one for each day of the week, starting with Sunday
* `monthAbbreviations` should be a list of 12 strings, one for each month of the year, starting with January

You can also define the `dateFormat` to change the way dates are displayed in the textual interface.
It takes a string of tokens (case-insensitive) and replaces them with their corresponding values.
The following tokens are supported:
* `D`: day of the month (1-31)
* `DD`: day of the month (01-31)
* `M`: month of the year (1-12)
* `MM`: month of the year (01-12)
* `YYYY`: year (0000-9999)
* Any separator between tokens is preserved (e.g. `/`, `-`, `.`)

The default format is `M/D/YYYY`.

Example usage:
```dart
MacosDatePicker(
Expand Down
2 changes: 0 additions & 2 deletions analysis_options.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@ linter:
- use_super_parameters

analyzer:
plugins:
- dart_code_metrics
exclude:
- test/mock_canvas.dart
- test/recording_canvas.dart
Expand Down
24 changes: 22 additions & 2 deletions example/.metadata
Original file line number Diff line number Diff line change
@@ -1,10 +1,30 @@
# This file tracks properties of this Flutter project.
# Used by Flutter tool to assess capabilities and perform upgrades etc.
#
# This file should be version controlled and should not be manually edited.
# This file should be version controlled.

version:
revision: 4d7946a68d26794349189cf21b3f68cc6fe61dcb
revision: 796c8ef79279f9c774545b3771238c3098dbefab
channel: stable

project_type: app

# Tracks metadata for the flutter migrate command
migration:
platforms:
- platform: root
create_revision: 796c8ef79279f9c774545b3771238c3098dbefab
base_revision: 796c8ef79279f9c774545b3771238c3098dbefab
- platform: macos
create_revision: 796c8ef79279f9c774545b3771238c3098dbefab
base_revision: 796c8ef79279f9c774545b3771238c3098dbefab

# User provided section

# List of Local paths (relative to this file) that should be
# ignored by the migrate tool.
#
# Files that are not part of the templates will be ignored by default.
unmanaged_files:
- 'lib/main.dart'
- 'ios/Runner.xcodeproj/project.pbxproj'
Loading