The Helper for draws Arc Text on canvas


Inspired from flutter_arc_text.

If you just need a way to draw text along an arc, just go with flutter_arc_text.

This package was develop for my special use case so maybe it not suits you.

Consider this package if you need:

  • draw text along an arc on canvas
  • care about start angle and end angle
  • remove all letter out of range (from start angle to end angle)
  • center align only when the text shorter than the arc
  • customize letter spacing
  • tracking what happens on the canvas when draw an arc text. #

Basic usage

import 'package:flutter/material.dart';
import 'package:flutter/widgets.dart';
import 'package:text_x_arc/text_x_arc.dart';

main() {
    painter: MyPainter(),

class MyPainter extends CustomPainter {
  void paint(Canvas canvas, Size size) {
    final centerPos = Offset(size.width / 2, size.height / 2);
    TextPainter textPainter = TextPainter(
        textAlign: TextAlign.justify, textDirection: TextDirection.ltr);
        canvas: canvas,
        centerPos: centerPos,
        radius: 200,
            'Without requirements or design, programming is the art of adding bugs to an empty text file.',
        textStyle: TextStyle(color: Colors.black, fontSize: 20),
        textPainter: textPainter);

  bool shouldRepaint(covariant CustomPainter oldDelegate) => true;

Checkout the playground example for more information.

Feel free to report bugs or suggest any improvement. #


Viet Nguyen - taodo2291@gmail.com #twitter - @taodo2291