setText method
Implementation
setText(String text, Canvas canvas, size, Offset location, String axis) {
const textStyle = TextStyle(
color: Colors.black,
fontSize: 12,
);
var textSpan = TextSpan(
text: text,
style: textStyle,
);
var textPainter = TextPainter(
text: textSpan,
textDirection: TextDirection.ltr,
);
textPainter.layout(
minWidth: 0,
maxWidth: size.width,
);
textPainter.paint(
canvas,
Offset(axis == "x" ? location.dx - 10 : location.dx - 10,
axis == "x" ? location.dy : location.dy - 10),
);
}