draw method
void
draw(
- Canvas canvas,
- Size boardSize
)
override
Implementation
@override
void draw(Canvas canvas, Size boardSize) {
super.draw(canvas, boardSize);
if (!_isEditing) {
final textSpan = TextSpan(
text: text,
style: textStyle,
);
final textPainter = TextPainter(
text: textSpan,
textDirection: TextDirection.ltr,
textAlign: textAlign,
);
textPainter.layout(
minWidth: size.width,
maxWidth: size.width,
);
final offsetRect = Alignment.center.inscribe(
textPainter.size,
Rect.fromPoints(
location, location.translate(size.width, size.height)));
textPainter.paint(canvas, offsetRect.topLeft.translate(-1.5, 0));
}
}