-
Notifications
You must be signed in to change notification settings - Fork 28.9k
Closed as duplicate of#89351
Labels
r: duplicateIssue is closed as a duplicate of an existing issueIssue is closed as a duplicate of an existing issue
Description
Steps to reproduce
- Use the provided example to run it as a macOS app.
- Move the cursor inside the blue box.
- Note that it correctly changes the entries/exits counts, but the mouse cursor is not changed to
resizeUpLeft
If you use the example in dartpad.dev it works as expected. The issue only happens on macOS (cannot test on Windows/Linux).
The provided example is from https://api.flutter.dev/flutter/widgets/MouseRegion-class.html with just the cursor
field added.
Expected results
I expect that my cursor changes to resizeUpLeft
.
Actual results
The cursor is not changing.
Code sample
Code sample
import 'package:flutter/material.dart';
/// Flutter code sample for [MouseRegion].
void main() => runApp(const MouseRegionApp());
class MouseRegionApp extends StatelessWidget {
const MouseRegionApp({super.key});
@override
Widget build(BuildContext context) {
return MaterialApp(
home: Scaffold(
appBar: AppBar(title: const Text('MouseRegion Sample')),
body: const Center(child: MouseRegionExample()),
),
);
}
}
class MouseRegionExample extends StatefulWidget {
const MouseRegionExample({super.key});
@override
State<MouseRegionExample> createState() => _MouseRegionExampleState();
}
class _MouseRegionExampleState extends State<MouseRegionExample> {
int _enterCounter = 0;
int _exitCounter = 0;
double x = 0.0;
double y = 0.0;
void _incrementEnter(PointerEvent details) {
setState(() {
_enterCounter++;
});
}
void _incrementExit(PointerEvent details) {
setState(() {
_exitCounter++;
});
}
void _updateLocation(PointerEvent details) {
setState(() {
x = details.position.dx;
y = details.position.dy;
});
}
@override
Widget build(BuildContext context) {
return ConstrainedBox(
constraints: BoxConstraints.tight(const Size(300.0, 200.0)),
child: MouseRegion(
cursor: SystemMouseCursors.resizeUpLeft,
onEnter: _incrementEnter,
onHover: _updateLocation,
onExit: _incrementExit,
child: ColoredBox(
color: Colors.lightBlueAccent,
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
const Text('You have entered or exited this box this many times:'),
Text(
'$_enterCounter Entries\n$_exitCounter Exits',
style: Theme.of(context).textTheme.headlineMedium,
),
Text('The cursor is here: (${x.toStringAsFixed(2)}, ${y.toStringAsFixed(2)})'),
],
),
),
),
);
}
}
Screenshots or Video
Screenshots / Video demonstration
macOS (not working)
2025-07-08_13-56-27.mp4
Web (working)
2025-07-08_14-00-37.mp4
Logs
Logs
[Paste your logs here]
Flutter Doctor output
Doctor output
[✓] Flutter (Channel stable, 3.32.4, on macOS 15.5 24F74 darwin-arm64, locale en-GB) [320ms]
• Flutter version 3.32.4 on channel stable at /Users/manuelrauber/fvm/versions/3.32.4
• Upstream repository ssh://git@github.com/flutter/flutter.git
• Framework revision 6fba2447e9 (4 weeks ago), 2025-06-12 19:03:56 -0700
• Engine revision 8cd19e509d
• Dart version 3.8.1
• DevTools version 2.45.1
Metadata
Metadata
Assignees
Labels
r: duplicateIssue is closed as a duplicate of an existing issueIssue is closed as a duplicate of an existing issue