makeText method
Stream the text operations required to draw the barcode texts. This is automatically called by make
Implementation
@override
Iterable<BarcodeElement> makeText(
String data,
double width,
double height,
double fontHeight,
double textPadding,
double lineWidth,
) sync* {
final text = checkLength(data, maxLength);
final w = lineWidth * 7;
final left = marginLeft(true, width, height, fontHeight, textPadding);
final right = marginRight(true, width, height, fontHeight, textPadding);
yield BarcodeText(
left: 0,
top: height - fontHeight,
width: left - lineWidth,
height: fontHeight,
text: text[0],
align: BarcodeTextAlign.right,
);
var offset = left + lineWidth * 3;
for (var i = 1; i < text.length; i++) {
yield BarcodeText(
left: offset,
top: height - fontHeight,
width: w,
height: fontHeight,
text: text[i],
align: BarcodeTextAlign.center,
);
offset += w;
if (i == 6) {
offset += lineWidth * 5;
}
}
if (drawEndChar) {
yield BarcodeText(
left: width - right + lineWidth,
top: height - fontHeight,
width: right - lineWidth,
height: fontHeight,
text: _finalSpacer,
align: BarcodeTextAlign.left,
);
}
}