手势检测器在带剪辑的custompainter中不起作用

时间:2020-04-10 07:09:45

标签: android flutter

我正在使用flv中的svg路径制作用于构建地图的演示。但是,某些部分不可点击。不知道为什么吗 谁能提供解决方案和理由。

这是pathpaint代码。

class PathPainter extends CustomPainter {
  final Province _province;
  PathPainter(this._province);

  @override
  void paint(Canvas canvas, Size size) {
    Path path = getPathByProvince(_province);
    canvas.drawPath(
        path,
        Paint()
          ..style = PaintingStyle.stroke
          ..color = Colors.black
          ..strokeWidth = 2.0);
  }

  @override
  bool shouldRepaint(PathPainter oldDelegate) => true;

  @override
  bool shouldRebuildSemantics(PathPainter oldDelegate) => false;
}

class PathClipper extends CustomClipper<Path> {
  final Province _province;
  PathClipper(this._province);

  @override
  Path getClip(Size size) {
    return getPathByProvince(_province);
  }

  @override
  bool shouldReclip(CustomClipper<Path> oldClipper) => false;
}

检查所有代码

https://pastebin.com/XC7QdUtx

我正在关注一个github项目。检查here

输出:

enter image description here

0 个答案:

没有答案