如何实现交互式复杂形状?

时间:2020-09-05 19:20:30

标签: flutter flutter-desktop

我需要操纵曲线(例如,悬停颜色变化),但是使用MouseRegion和CustomPaint只能与一块矩形进行交互,操纵曲线不够精确。

就这样,我希望鼠标在曲线上移动并执行某些操作,例如更改颜色或设置一些业务属性。

image

这是我当前的代码:

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(),
            ),
          ),
        ),
      ),
    );

0 个答案:

没有答案
相关问题