flutter - 如何实现交互式复杂形状?
问题描述
我需要操纵曲线(例如:悬停颜色变化),但是使用 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(),
),
),
),
),
);
解决方案
推荐阅读
- python - 自定义输入导致错误,而运行时中给出的相同输入在 Python 中有效
- dicom - WADO-RS 标准中的“批量数据”究竟是什么?
- for-loop - 批处理文件中的 Windows 命令 FOR,指定在某个文件夹中工作
- c# - 动态创建具有参数化返回属性的表达式
- javascript - 如何在 textContent 中包含图像的替代文本?
- mysql - 如何在设置了 UNIQUE KEY 的 MySQL 中将记录从一个表复制到另一个表而不重复
- webrtc - 如何使用 webRTC 共享屏幕
- mongodb - Mongodb数组与嵌入文档列表的交集
- django - 从 django rest 框架中的 URL 获取 pk
- vue.js - 错误:vuex 不会在突变处理程序之外改变 vuex 存储状态与上传图像