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 customRenderBox
needs to implementMouseTrackerAnnotation
to change the cursor. ThehitTest
must returnTRUE
.