[Flutter] CustomPainter에서 Text 회전
by JungWook_안녕하세요. CutomPainter
에서 TextPainter()
로 글자를 그릴 때 회전해서 그리는 방법입니다.
var textPainter = TextPainter() ..text = TextSpan(text: leftText, style: const TextStyle(color: Colors.black, fontSize: 18)) ..textDirection = TextDirection.ltr ..textAlign = TextAlign.center ..layout(); canvas.save(); canvas.translate(0, size.height / 2 - textPainter.height / 2 - bottomSize / 2); canvas.rotate(-2 * pi / 4); textPainter.paint(canvas, const Offset(0, 0)); canvas.restore();

블로그의 정보
hongmono
JungWook_