StickyHeadersTable constructor
StickyHeadersTable({
- Key? key,
- required int columnsLength,
- required int rowsLength,
- Widget legendCell = const Text(''),
- required Widget columnsTitleBuilder(
- int columnIndex
- required Widget rowsTitleBuilder(
- int rowIndex
- required Widget contentCellBuilder(),
- CellDimensions cellDimensions = CellDimensions.base,
- CellAlignments cellAlignments = CellAlignments.base,
- dynamic onStickyLegendPressed()?,
- dynamic onColumnTitlePressed(
- int columnIndex
- dynamic onRowTitlePressed(
- int rowIndex
- dynamic onContentCellPressed()?,
- dynamic onEndScrolling()?,
- ScrollControllers? scrollControllers,
- CustomScrollPhysics? scrollPhysics,
- TextDirection tableDirection = TextDirection.ltr,
- double? initialScrollOffsetX,
- double? initialScrollOffsetY,
- int? scrollOffsetIndexX,
- int? scrollOffsetIndexY,
- bool? showVerticalScrollbar,
- 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);
}