TTableHeader<T, K>.stacked constructor

TTableHeader<T, K>.stacked(
  1. String text,
  2. List<Widget> builder(
    1. T
    ), {
  3. int? flex,
  4. double? minWidth,
  5. double? maxWidth,
  6. Alignment? alignment,
  7. double rowHeight = 40,
  8. bool showDividers = true,
  9. Color? dividerColor,
  10. EdgeInsetsGeometry contentPadding = const EdgeInsets.symmetric(horizontal: 5),
  11. String? key,
  12. double widthEstimator(
    1. T data
    )?,
  13. bool flattenOnMobile = false,
  14. bool showInDetails = true,
  15. String mobileKeyPrefixBuilder(
    1. String headerText,
    2. String childKey
    )?,
})

Creates a header that stacks several fixed-height sub-rows inside one table row.

Use it for grouped rows (one item = one card holding several sub-rows). Columns built with the same rowHeight line up sub-row by sub-row, so no colspan/rowspan is needed. Use a plain column (e.g. TTableHeader.new) for the group label cell; it stays vertically centered across the whole stack.

The cell is rendered edge to edge (fullBleedCell) and each sub-row pads its own content by contentPadding, so dividers of neighboring stacked columns join into one continuous line.

builder must return the same number of widgets for every stacked column of the table.

Implementation

factory TTableHeader.stacked(
  String text,
  List<Widget> Function(T) builder, {
  int? flex,
  double? minWidth,
  double? maxWidth,
  Alignment? alignment,
  double rowHeight = 40,
  bool showDividers = true,
  Color? dividerColor,
  EdgeInsetsGeometry contentPadding = const EdgeInsets.symmetric(horizontal: 5),
  String? key,
  double Function(T data)? widthEstimator,
  bool flattenOnMobile = false,
  bool showInDetails = true,
  String Function(String headerText, String childKey)? mobileKeyPrefixBuilder,
}) =>
    _TStackedTableHeader<T, K>(
      text,
      builder,
      flex: flex,
      minWidth: minWidth,
      maxWidth: maxWidth,
      alignment: alignment,
      rowHeight: rowHeight,
      showDividers: showDividers,
      dividerColor: dividerColor,
      contentPadding: contentPadding,
      key: key,
      widthEstimator: widthEstimator,
      flattenOnMobile: flattenOnMobile,
      showInDetails: showInDetails,
      mobileKeyPrefixBuilder: mobileKeyPrefixBuilder,
    );