The most common use to change the cursor is through MouseRegion
and setState
. Example:
MouseRegion(cursor: _myCursor);
setState(() {
if(...) {
_myCursor = SystemMouseCursors.copy;
} else {
_myCursor = SystemMouseCursors.move;
}
});
Is there a way to make this change without rebuilding the Widget
? The CustomPaint
, for example, accepts a Listening
that, when triggered, will only notify a new repaint without rebuild.
Maybe if it were possible to set the mouse cursor inside a RenderBox
. I could create one replicating the behavior of CustomPaint
using a Listening
and markNeedsPaint
method.
Has anyone already configured the cursor inside the RenderBox
?
Studying RenderMouseRegion
, I figure out that your custom RenderBox
needs to implement MouseTrackerAnnotation
to change the cursor. The hitTest
must return TRUE
.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.