使用最新的Flutter ,我想用Canvas.drawArc
的方法画一个从0到10的拱形.下面是我的代码:
@override
void paint(Canvas canvas, Size size) {
final double radius = 1000.0;
final Paint paint = new Paint()
..isAntiAlias = true
..strokeWidth = 1.0
..color = Colors.blue[500]
..style = PaintingStyle.stroke;
canvas.drawArc(new Rect.fromLTWH(0.0, 0.0, size.width/2, size.height/2),
10.0, 20.0, false, paint);
}
它是在CustomPainter内部绘制的,在布局中被称为:
children: <Widget>[
new CustomPaint(
painter: new CircleGraphWidget(),
child: new Center(
child: new Text(
'Here\'s text',
style: const TextStyle(
fontSize: 40.0,
fontWeight: FontWeight.w900,
color: const Color(0xFFFFFFFFF),
),
),
),
)
],
我希望draArc调用在圆上从10到20的矩形内绘制一条圆弧,但我得到的结果如下所示:
我想知道怎么才能画出椭圆形的一小部分而不是整个东西.举个例子,如果我只想画四分之一的圆,我该怎么做呢?