diff --git a/CHANGELOG.md b/CHANGELOG.md index 9421567a..c122c367 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,7 @@ +## [0.9.2] +* Nearly all `MouseRegion`s have been updated to use `SystemMouseCursors.basic` in order to more closely adhere to Apple norms +* `mouseCursor` properties have been added to most buttons + ## [0.9.1] * Added top-level theming for `MacosIconButton` * Introduces the `MacosIconButtonTheme` InheritedTheme and the `MacosIconButtonThemeData` theme class diff --git a/example/pubspec.lock b/example/pubspec.lock index 0a3ecde7..a7b39a9c 100644 --- a/example/pubspec.lock +++ b/example/pubspec.lock @@ -73,7 +73,7 @@ packages: path: ".." relative: true source: path - version: "0.9.1" + version: "0.9.2" matcher: dependency: transitive description: diff --git a/lib/src/buttons/back_button.dart b/lib/src/buttons/back_button.dart index 717f4068..0c5005d4 100644 --- a/lib/src/buttons/back_button.dart +++ b/lib/src/buttons/back_button.dart @@ -11,6 +11,7 @@ class MacosBackButton extends StatefulWidget { this.onPressed, this.fillColor, this.semanticLabel, + this.mouseCursor = SystemMouseCursors.basic, }) : super(key: key); /// An override callback to perform instead of the default behavior which is @@ -23,6 +24,9 @@ class MacosBackButton extends StatefulWidget { /// The semantic label used by screen readers. final String? semanticLabel; + /// The mouse cursor to use when hovering over this widget. + final MouseCursor? mouseCursor; + /// Whether the button is enabled or disabled. Buttons are disabled by default. To /// enable a button, set its [onPressed] property to a non-null value. bool get enabled => onPressed != null; @@ -136,7 +140,7 @@ class MacosBackButtonState extends State } return MouseRegion( - cursor: SystemMouseCursors.click, + cursor: widget.mouseCursor!, child: GestureDetector( behavior: HitTestBehavior.opaque, onTapDown: enabled ? _handleTapDown : null, diff --git a/lib/src/buttons/help_button.dart b/lib/src/buttons/help_button.dart index 7483ad78..00f823f5 100644 --- a/lib/src/buttons/help_button.dart +++ b/lib/src/buttons/help_button.dart @@ -19,6 +19,7 @@ class HelpButton extends StatefulWidget { this.pressedOpacity = 0.4, this.alignment = Alignment.center, this.semanticLabel, + this.mouseCursor = SystemMouseCursors.basic, }) : assert(pressedOpacity == null || (pressedOpacity >= 0.0 && pressedOpacity <= 1.0)), super(key: key); @@ -59,6 +60,9 @@ class HelpButton extends StatefulWidget { /// The semantic label used by screen readers. final String? semanticLabel; + /// The mouse cursor to use when hovering over this widget. + final MouseCursor? mouseCursor; + /// Whether the button is enabled or disabled. Buttons are disabled by default. To /// enable a button, set its [onPressed] property to a non-null value. bool get enabled => onPressed != null; @@ -173,7 +177,7 @@ class HelpButtonState extends State : const Color.fromRGBO(0, 0, 0, 0.25); return MouseRegion( - cursor: SystemMouseCursors.click, + cursor: widget.mouseCursor!, child: GestureDetector( behavior: HitTestBehavior.opaque, onTapDown: enabled ? _handleTapDown : null, diff --git a/lib/src/buttons/icon_button.dart b/lib/src/buttons/icon_button.dart index 5b3fa05e..c1794d03 100644 --- a/lib/src/buttons/icon_button.dart +++ b/lib/src/buttons/icon_button.dart @@ -22,6 +22,7 @@ class MacosIconButton extends StatefulWidget { maxWidth: 30, maxHeight: 30, ), + this.mouseCursor = SystemMouseCursors.basic, }) : assert(pressedOpacity == null || (pressedOpacity >= 0.0 && pressedOpacity <= 1.0)), super(key: key); @@ -88,6 +89,9 @@ class MacosIconButton extends StatefulWidget { /// The semantic label used by screen readers. final String? semanticLabel; + /// The mouse cursor to use when hovering over this widget. + final MouseCursor? mouseCursor; + /// Whether the button is enabled or disabled. Buttons are disabled by default. To /// enable a button, set its [onPressed] property to a non-null value. bool get enabled => onPressed != null; @@ -201,7 +205,7 @@ class MacosIconButtonState extends State } return MouseRegion( - cursor: SystemMouseCursors.click, + cursor: widget.mouseCursor!, child: GestureDetector( behavior: HitTestBehavior.opaque, onTapDown: enabled ? _handleTapDown : null, diff --git a/lib/src/buttons/push_button.dart b/lib/src/buttons/push_button.dart index 1462d5fc..decc1382 100644 --- a/lib/src/buttons/push_button.dart +++ b/lib/src/buttons/push_button.dart @@ -36,6 +36,7 @@ class PushButton extends StatefulWidget { this.borderRadius = const BorderRadius.all(Radius.circular(4.0)), this.alignment = Alignment.center, this.semanticLabel, + this.mouseCursor = SystemMouseCursors.basic, }) : assert(pressedOpacity == null || (pressedOpacity >= 0.0 && pressedOpacity <= 1.0)), super(key: key); @@ -99,6 +100,9 @@ class PushButton extends StatefulWidget { /// Always defaults to [Alignment.center]. final AlignmentGeometry alignment; + /// The mouse cursor to use when hovering over this widget. + final MouseCursor? mouseCursor; + /// The semantic label used by screen readers. final String? semanticLabel; @@ -239,7 +243,7 @@ class PushButtonState extends State theme.typography.headline.copyWith(color: foregroundColor); return MouseRegion( - cursor: SystemMouseCursors.click, + cursor: widget.mouseCursor!, child: GestureDetector( behavior: HitTestBehavior.opaque, onTapDown: enabled ? _handleTapDown : null, diff --git a/lib/src/layout/sidebar_item.dart b/lib/src/layout/sidebar_item.dart index 8e56d413..eda7e5d2 100644 --- a/lib/src/layout/sidebar_item.dart +++ b/lib/src/layout/sidebar_item.dart @@ -274,7 +274,7 @@ class _SidebarItem extends StatelessWidget { focusNode: item.focusNode, descendantsAreFocusable: false, enabled: onClick != null, - mouseCursor: SystemMouseCursors.click, + mouseCursor: SystemMouseCursors.basic, actions: _actionMap, child: Container( width: 134.0 + theme.visualDensity.horizontal, diff --git a/pubspec.yaml b/pubspec.yaml index a715fe7e..2afecca1 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,6 +1,6 @@ name: macos_ui description: Flutter widgets and themes implementing the current macOS design language. -version: 0.9.1 +version: 0.9.2 homepage: "https://github.com/GroovinChip/macos_ui" environment: