fitHeaders method
void
fitHeaders()
Implementation
void fitHeaders() {
// horizontal
// gridWidth = 0;
for (int i = 0; i < columnCount(); i++) {
final cd = horizontalHeaderCellData(i);
final txt = horizontalHeaderData(i);
final size = _textSize(txt, cd.textStyleDefault);
cd.width = max(cd.width, size.width + 10);
cd.height = max(cd.height, size.height + 2);
// gridWidth += cd.width;
}
// vertical
// gridHeight = 0;
for (int i = 0; i < rowCount(); i++) {
final cd = verticalHeaderCellData(i);
final txt = verticalHeaderData(i);
final size = _textSize(txt, cd.textStyleDefault);
cd.width = max(cd.width, size.width);
cd.height = max(cd.height, size.height + 2);
// gridHeight += cd.height;
}
// updateHeaderPositions();
void _sizeForCells() {
for (int i = 0; i < rowCount(); i += 10) {
final vcd = verticalHeaderCellData(i);
for (int j = 0; j < columnCount(); j++) {
final index = Index(i, j);
final cd = cellData(index);
final txt = data(index);
final size = _textSize(txt, cd.textStyleDefault);
final hcd = horizontalHeaderCellData(j);
hcd.width = max(hcd.width, size.width + 10);
vcd.height = max(vcd.height, size.height + 2);
}
}
updateHeaderPositions();
state?.update();
}
// print(1);
_sizeForCells();
// print(2);
}