appendBitmapWidget method
dynamic
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,
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');
}
});
}