像这样绘制自定义形状的颤振

时间:2020-01-01 19:59:22

标签: flutter

我需要使用颤动image that i want to draw shape like it

绘制类似的形状

1 个答案:

答案 0 :(得分:0)

我认为您可能希望为此使用CustomPaintCustomPainter

扩展CustomPainter,并在其canvas.drawLine()方法中使用canvas.drawArc()paint。也许canvas.drawPoints()也可以工作。

这两个链接包含有关如何使用这些组件的视频。

CustomPaint(
  painter: MyCustomShapePainter(),
  // other properties
),

class MyCustomShapePainter extends CustomPainter {

  @override
  void paint(Canvas canvas, Size size) {
    final paint = Paint()
      ..color = Colors.black
      ..strokeCap = StrokeCap.round;
    canvas.drawLine(...);
  }

  @override
  bool shouldRepaint(CustomPainter oldDelegate) {
    return false;
  }

}