[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();
'Programming > Flutter' 카테고리의 다른 글
Flutter_reactive_ble (0) | 2022.12.29 |
---|---|
[Flutter] CustomPaint repaint 문제 (0) | 2022.06.10 |
ESP32-S devkit <-> Flutter BLE 연결 (0) | 2022.03.22 |
[Flutter] Could not find a set of Noto fonts to display all missing characters. (0) | 2021.10.26 |
블로그의 정보
hongmono
JungWook_