mouseCursor property

WidgetStateProperty<MouseCursor>? mouseCursor
final

The cursor for a mouse pointer when it enters or is hovering over the widget.

Resolved in the following states:

This example resolves the mouseCursor based on the current WidgetState of the CupertinoSwitch, providing a different mouseCursor when it is WidgetState.disabled.
link
CupertinoSwitch(
  value: true,
  onChanged: (bool value) { },
  mouseCursor: WidgetStateProperty.resolveWith<MouseCursor>((Set<WidgetState> states) {
    if (states.contains(WidgetState.disabled)) {
      return SystemMouseCursors.click;
    }
    return SystemMouseCursors.basic; // All other states will use the default mouseCursor.
  }),
)

If null, then MouseCursor.defer is used when the switch is disabled. When the switch is enabled, SystemMouseCursors.click is used on Web, and MouseCursor.defer is used on other platforms.

See also:

Implementation

final WidgetStateProperty<MouseCursor>? mouseCursor;