drawIcon method

void drawIcon(
  1. Canvas canvas
)

Implementation

void drawIcon(Canvas canvas) {
  if (behaviour.icon == null) return;
  TextPainter textPainter = TextPainter(textDirection: TextDirection.ltr);
  textPainter.text = TextSpan(
    text: String.fromCharCode(behaviour.icon!.codePoint),
    style: TextStyle(
      color: color,
      fontSize: this.size,
      fontFamily: behaviour.icon!.fontFamily,
      package: behaviour.icon!.fontPackage,
    ),
  );
  textPainter.layout();
  textPainter.paint(
      canvas, Offset(pos.dx - this.size / 2, pos.dy - this.size / 2));
}