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. dynamic onEndScrolling(
    1. double x,
    2. double y
    )?,
  15. ScrollControllers? scrollControllers,
  16. CustomScrollPhysics? scrollPhysics,
  17. TextDirection tableDirection = TextDirection.ltr,
  18. double? initialScrollOffsetX,
  19. double? initialScrollOffsetY,
  20. int? scrollOffsetIndexX,
  21. int? scrollOffsetIndexY,
  22. bool? showVerticalScrollbar,
  23. bool? showHorizontalScrollbar,
})

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,

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

  /// Scroll controllers for the table. Make sure that you dispose ScrollControllers inside when you don't need table_sticky_headers anymore.
  ScrollControllers? scrollControllers,

  /// Custom Scroll physics for table
  CustomScrollPhysics? scrollPhysics,

  /// Table Direction to support RTL languages
  this.tableDirection = TextDirection.ltr,

  /// Initial scroll offsets in X and Y directions. Specified in points. Overrides scroll Offset in index if both are present.
  this.initialScrollOffsetX,
  this.initialScrollOffsetY,

  /// Initial scroll offsets in X and Y directions. Specified in index.
  this.scrollOffsetIndexX,
  this.scrollOffsetIndexY,

  /// Turn scrollbars
  this.showVerticalScrollbar,
  this.showHorizontalScrollbar,
})  : this.shouldDisposeScrollControllers = scrollControllers == null,
      this.scrollControllers = scrollControllers ?? ScrollControllers(),
      this.onStickyLegendPressed = onStickyLegendPressed ?? (() {}),
      this.onColumnTitlePressed = onColumnTitlePressed ?? ((_) {}),
      this.onRowTitlePressed = onRowTitlePressed ?? ((_) {}),
      this.onContentCellPressed = onContentCellPressed ?? ((_, __) {}),
      this.scrollPhysics = scrollPhysics ?? CustomScrollPhysics(),
      super(key: key) {
  cellDimensions.runAssertions(rowsLength, columnsLength);
  cellAlignments.runAssertions(rowsLength, columnsLength);
}