printTextBitmap method

  1. @override
Future<void> printTextBitmap(
  1. String text, {
  2. IminTextPictureStyle? style,
})
override

Implementation

@override
Future<void> printTextBitmap(String text,
    {IminTextPictureStyle? style}) async {
  Map<String, dynamic> arguments = <String, dynamic>{};
  if (style != null) {
    if (style.wordWrap != null && style.wordWrap == false) {
      arguments.putIfAbsent('text', () => text);
    } else {
      arguments.putIfAbsent('text', () => '$text\n');
    }
    if (style.fontSize != null) {
      logger.d('fontSize');
      await setTextBitmapSize(style.fontSize!);
    }
    if (style.typeface != null) {
      logger.d('typeface');
      await setTextBitmapTypeface(style.typeface!);
    }
    if (style.fontStyle != null) {
      logger.d('fontStyle');
      await setTextBitmapStyle(style.fontStyle!);
    }
    if (style.throughline != null) {
      logger.d('throughline');
      await setTextBitmapStrikeThru(style.throughline!);
    }
    if (style.underline != null) {
      logger.d('underline');
      await setTextBitmapUnderline(style.underline!);
    }

    if (style.lineHeight != null) {
      logger.d('lineHeight', style.lineHeight);
      await setTextBitmapLineSpacing(style.lineHeight!);
    }

    if (style.letterSpacing != null) {
      logger.d('letterSpacing');
      await setTextBitmapLetterSpacing(style.letterSpacing!);
    }

    if (style.reverseWhite != null) {
      logger.d('reverseWhite');
      await setTextBitmapAntiWhite(style.reverseWhite!);
    }
  } else {
    arguments.putIfAbsent('text', () => '$text\n');
  }
  if (style != null && style.align != null) {
    arguments.putIfAbsent('align', () => style.align!.index);
    await methodChannel.invokeMethod<void>(
        'printTextBitmapWithAli', arguments);
  } else {
    await methodChannel.invokeMethod<void>('printTextBitmap', arguments);
  }
}