paintIcons method

void paintIcons(
  1. Canvas canvas, {
  2. required Offset centerLeft,
  3. required Offset centerRight,
})

Implementation

void paintIcons(
  Canvas canvas, {
  required Offset centerLeft,
  required Offset centerRight,
}) {
  final halfIconSize = Offset(style.iconSize / 2, style.iconSize / 2);

  // LEFT ICON
  if (style.leftIcon != null) {
    TextPainter leftArrow = TextPainter(textDirection: TextDirection.rtl);
    leftArrow.text = TextSpan(
      text: String.fromCharCode(style.leftIcon!.codePoint),
      style: TextStyle(
        fontSize: style.iconSize,
        fontFamily: style.leftIcon!.fontFamily,
        color: style.iconColor,
      ),
    );
    leftArrow.layout();
    leftArrow.paint(canvas, centerLeft - halfIconSize);
  }

  // RIGHT ICON
  if (style.rightIcon != null) {
    TextPainter rightArrow = TextPainter(textDirection: TextDirection.rtl);
    rightArrow.text = TextSpan(
      text: String.fromCharCode(style.rightIcon!.codePoint),
      style: TextStyle(
        fontSize: style.iconSize,
        fontFamily: style.rightIcon!.fontFamily,
        color: style.iconColor,
      ),
    );
    rightArrow.layout();
    rightArrow.paint(canvas, centerRight - halfIconSize);
  }
}