StickyHeadersTable constructor

StickyHeadersTable({
  1. Key? key,
  2. required int columnsLength,
  3. required int rowsLength,
  4. Widget legendCell = const Text(''),
  5. required Widget columnsTitleBuilder(
    1. int columnIndex
    ),
  6. required Widget rowsTitleBuilder(
    1. int rowIndex
    ),
  7. required Widget contentCellBuilder(
    1. int columnIndex,
    2. int rowIndex
    ),
  8. CellDimensions cellDimensions = CellDimensions.base,
  9. CellAlignments cellAlignments = CellAlignments.base,
  10. dynamic onStickyLegendPressed()?,
  11. dynamic onColumnTitlePressed(
    1. int columnIndex
    )?,
  12. dynamic onRowTitlePressed(
    1. int rowIndex
    )?,
  13. dynamic onContentCellPressed(
    1. int columnIndex,
    2. int rowIndex
    )?,
  14. double initialScrollOffsetX = 0.0,
  15. double initialScrollOffsetY = 0.0,
  16. dynamic onEndScrolling(
    1. double x,
    2. double y
    )?,
  17. ScrollControllers? scrollControllers,
})

Implementation

StickyHeadersTable({
  Key? key,

  /// Number of Columns (for content only)
  required this.columnsLength,

  /// Number of Rows (for content only)
  required this.rowsLength,

  /// Title for Top Left cell (always visible)
  this.legendCell = const Text(''),

  /// Builder for column titles. Takes index of content column as parameter
  /// and returns String for column title
  required this.columnsTitleBuilder,

  /// Builder for row titles. Takes index of content row as parameter
  /// and returns String for row title
  required this.rowsTitleBuilder,

  /// Builder for content cell. Takes index for content column first,
  /// index for content row second and returns String for cell
  required this.contentCellBuilder,

  /// Table cell dimensions
  this.cellDimensions = CellDimensions.base,

  /// Alignments for cell contents
  this.cellAlignments = CellAlignments.base,

  /// Callbacks for when pressing a cell
  Function()? onStickyLegendPressed,
  Function(int columnIndex)? onColumnTitlePressed,
  Function(int rowIndex)? onRowTitlePressed,
  Function(int columnIndex, int rowIndex)? onContentCellPressed,

  /// Initial scroll offsets in X and Y directions
  this.initialScrollOffsetX = 0.0,
  this.initialScrollOffsetY = 0.0,

  /// Called when scrolling has ended, passing the current offset position
  this.onEndScrolling,

  /// Scroll controllers for the table
  ScrollControllers? scrollControllers,
})  : this.scrollControllers = scrollControllers ?? ScrollControllers(),
      this.onStickyLegendPressed = onStickyLegendPressed ?? (() {}),
      this.onColumnTitlePressed = onColumnTitlePressed ?? ((_) {}),
      this.onRowTitlePressed = onRowTitlePressed ?? ((_) {}),
      this.onContentCellPressed = onContentCellPressed ?? ((_, __) {}),
      super(key: key) {
  cellDimensions.runAssertions(rowsLength, columnsLength);
  cellAlignments.runAssertions(rowsLength, columnsLength);
}