我需要操纵曲线(例如,悬停颜色变化),但是使用MouseRegion和CustomPaint只能与一块矩形进行交互,操纵曲线不够精确。
就这样,我希望鼠标在曲线上移动并执行某些操作,例如更改颜色或设置一些业务属性。
这是我当前的代码:
return Positioned(
top: dy,
left: dx,
width: 300,
height: 50,
child: ColoredBox(
color: Colors.blue.withOpacity(0.3),
child: SizedBox(
width: 250.0,
height: 250.0,
child: MouseRegion(
cursor: _cursor,
onEnter: _onEnter,
onExit: _onExit,
child: CustomPaint(
painter: CurvePainter(color: _color),
child: Container(),
),
),
),
),
);