computeHeaderAutoFitExtents<CellDataType extends SwayzeCellData> function

Future<Map<int, double>> computeHeaderAutoFitExtents<CellDataType extends SwayzeCellData>({
  1. required BuildContext context,
  2. required Axis axis,
  3. required Iterable<int> headerPositions,
  4. required SwayzeTableDataController<SwayzeController> tableDataController,
  5. required CellDelegate<CellDataType> cellDelegate,
  6. required MatrixMapReadOnly<CellDataType> cellMatrix,
  7. required SwayzeStyle style,
  8. required String headerLabelFor(
    1. int headerPosition
    ),
})

Implementation

Future<Map<int, double>> computeHeaderAutoFitExtents<CellDataType extends SwayzeCellData>({
  required BuildContext context,
  required Axis axis,
  required Iterable<int> headerPositions,
  required SwayzeTableDataController tableDataController,
  required CellDelegate<CellDataType> cellDelegate,
  required MatrixMapReadOnly<CellDataType> cellMatrix,
  required SwayzeStyle style,
  required String Function(int headerPosition) headerLabelFor,
}) async {
  final result = <int, double>{};
  for (final headerPosition in headerPositions) {
    if (!context.mounted) {
      break;
    }

    final extent = await computeHeaderAutoFitExtent<CellDataType>(
      context: context,
      axis: axis,
      headerPosition: headerPosition,
      tableDataController: tableDataController,
      cellDelegate: cellDelegate,
      cellMatrix: cellMatrix,
      style: style,
      headerLabel: headerLabelFor(headerPosition),
    );
    if (extent != null) {
      result[headerPosition] = extent;
    }
  }

  return result;
}