appendBitmapWidget method

dynamic appendBitmapWidget({
  1. required BuildContext context,
  2. required Widget widget,
  3. bool diffusion = true,
  4. int width = 576,
  5. bool bothScale = true,
  6. int? absolutePosition,
  7. StarAlignmentPosition? alignment,
  8. StarBitmapConverterRotation? rotation,
  9. Duration? wait,
  10. Size? logicalSize,
  11. Size? imageSize,
  12. TextDirection textDirection = TextDirection.ltr,
})

Prints an image generated by widgets widget. Set bothScale to scale the image by the width of receipt. Sets absolutePosition image absolute position. StarAlignmentPosition sets image alignment. StarBitmapConverterRotation set image rotation. Set Duration if you are using async widgets or widget that take time to fully build. logicalSize Size is the size of the device the widget is made into. imageSize Size is the size of image generated. sets the TextDirection.

Implementation

appendBitmapWidget({
  required BuildContext context,
  required Widget widget,
  bool diffusion = true,
  int width = 576,
  bool bothScale = true,
  int? absolutePosition,
  StarAlignmentPosition? alignment,
  StarBitmapConverterRotation? rotation,
  Duration? wait,
  Size? logicalSize,
  Size? imageSize,
  TextDirection textDirection = TextDirection.ltr,
}) {
  createImageFromWidget(
    context,
    widget,
    wait: wait,
    logicalSize: logicalSize,
    imageSize: imageSize,
    textDirection: textDirection,
  ).then((byte) {
    if (byte != null) {
      appendBitmapByte(
        byteData: byte,
        diffusion: diffusion,
        width: width,
        bothScale: bothScale,
        absolutePosition: absolutePosition,
        alignment: alignment,
        rotation: rotation,
      );
    } else {
      throw Exception('Error generating image');
    }
  });
}