makeBytes method
Iterable<BarcodeElement>
makeBytes(
- Uint8List data, {
- required double width,
- required double height,
- bool drawText = false,
- double? fontHeight,
- double? textPadding,
override
Generate the barcode graphic description like make but takes a Uint8List data.
Implementation
@override
Iterable<BarcodeElement> makeBytes(
Uint8List data, {
required double width,
required double height,
bool drawText = false,
double? fontHeight,
double? textPadding,
}) sync* {
assert(width > 0);
assert(height > 0);
assert(!drawText || fontHeight != null);
fontHeight ??= 0;
textPadding ??= Barcode1D.defaultTextPadding;
yield* super.makeBytes(
data,
width: width,
height: height,
drawText: drawText,
fontHeight: fontHeight,
textPadding: textPadding,
);
if (drawBorder) {
final bw = _getBorderWidth(width);
final hp = drawText ? fontHeight + textPadding : 0;
yield BarcodeBar(left: 0, top: 0, width: width, height: bw, black: true);
yield BarcodeBar(
left: 0,
top: height - hp - bw,
width: width,
height: bw,
black: true);
yield BarcodeBar(
left: 0,
top: bw,
width: bw,
height: height - hp - bw * 2,
black: true);
yield BarcodeBar(
left: width - bw,
top: bw,
width: bw,
height: height - hp - bw * 2,
black: true);
}
}