findInline method
TextLine?
findInline(
- TextLine line
Implementation
TextLine? findInline(TextLine line) {
final double top = line.boundingBox.top;
final double bottom = line.boundingBox.bottom;
final List<TextLine> result = [];
for (final block in blocks) {
for (final textLine in block.lines) {
final centerY = (textLine.boundingBox.bottom + textLine.boundingBox.top) / 2;
if (centerY >= top && centerY <= bottom && textLine.text != line.text) {
result.add(textLine);
}
}
}
if (result.isEmpty) return null;
// Find the line with the minimum left position
return result.reduce((a, b) {
final leftA = a.boundingBox.left;
final leftB = b.boundingBox.left;
return leftA < leftB ? a : b;
});
}