printAntiWhiteText method

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

Implementation

@override
Future<void> printAntiWhiteText(String text, {IminTextStyle? style}) async {
  Map<String, dynamic> arguments = <String, dynamic>{};
  if (style != null) {
    if (style.wordWrap != null && style.wordWrap == false) {
      arguments.putIfAbsent('text', () => text);
    }
    if (style.align != null) {
      await setAlignment(style.align!);
    }

    if (style.width != null) {
      await setTextWidth(style.width!);
    }

    if (style.fontSize != null) {
      await setTextSize(style.fontSize!);
    }
    if (style.typeface != null) {
      await setTextTypeface(style.typeface!);
    }
    if (style.fontStyle != null) {
      await setTextStyle(style.fontStyle!);
    }
  } else {
    arguments.putIfAbsent('text', () => '$text\n');
  }

  await methodChannel.invokeMethod<void>('printAntiWhiteText', arguments);
  if (style != null) {
    if (style.align != null) {
      await setAlignment(IminPrintAlign.left);
    }
  }
}