getBandsOnTheSameRelativeRow method
Return groups of band that are relatively on the same aligned row
Implementation
List<List<Band>> getBandsOnTheSameRelativeRow() {
List<List<Band>> rows = [];
if (list.isEmpty) {
return rows;
}
List<Band> currentRow = [list[0]];
for (int i = 1; i < list.length; i++) {
Band currentBand = list[i];
Band lastBandInRow = currentRow.last;
if (areBandAlmostOnTheSameHorizontalRow(lastBandInRow, currentBand)) {
currentRow.add(currentBand);
} else {
rows.add(List.from(currentRow));
currentRow = [currentBand];
}
}
rows.add(currentRow);
return rows;
}