dart 如何绘制数字'6'使用路径与动画在Flutter?

tmb3ates  于 2023-07-31  发布在  Flutter
关注(0)|答案(1)|浏览(118)

需要绘制完美的6形状(参考图像)使用省道。
像这样...

的数据
试过下面的代码没有给出完美的6

@override
  void paint(Canvas canvas, Size size) {
    double ht = size.height;
    double wt = size.width;

    var path = Path();

    path.moveTo(wt / 2 + 5, 5);

    path.cubicTo(wt / 2 + 10, 5, wt / 6, ht / 2, wt / 2, ht - 10);

    path.cubicTo(wt / 2, ht - 10, wt, ht / 1.8, wt / 2 - 25, ht / 2);

    canvas.drawPath(path, _paint);
  }

字符串

9lowa7mx

9lowa7mx1#

我能画出下面的图,

path.moveTo(wt / 1.4, 40);
    path.cubicTo(wt / 2 + 10, 20, wt / 4, ht / 4, wt / 2.9, ht / 1.4);

    path.addArc(
        Rect.fromCenter(
            center: Offset(wt / 2 + 8, ht / 1.5),
            width: wt / 2.4,
            height: wt / 2.3),
        math.pi,
        (2 * math.pi));

    canvas.drawPath(path, paint);

字符串

相关问题