[英]how to add text on pie chart slice in CustomPaint(Canvas) widget in flutter
要使用CustomPainter
在 flutter 中绘制文本,您需要像这样使用TextSpan
和TextPainter
:
TextSpan span = new TextSpan(style: new TextStyle(color: Colors.blue[800]), text: yourText);
TextPainter tp = new TextPainter(text: span, textAlign: TextAlign.left, textDirection: TextDirection.ltr);
tp.layout();
tp.paint(canvas, new Offset(5.0, 5.0));
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.