build method

Widget build({
  1. required Widget child,
  2. required BuildContext context,
  3. required int columnIndex,
  4. required int rowIndex,
  5. required bool selected,
})

Builds the Widget for the cell located at columnIndex and rowIndex. The passed in child should be wrapped by whatever widgets this builder provides.

For headers, the rowIndex will always be -1.

Implementation

Widget build({
  required Widget child,
  required BuildContext context,
  required int columnIndex,
  required int rowIndex,
  required bool selected,
}) {
  final theme = Theme.of(context);
  Widget result = Align(
    alignment: alignment,
    child: Padding(padding: padding, child: child),
  );

  final color = selected
      ? (selectedColor ??
            (theme.brightness == Brightness.dark
                ? Colors.white.withValues(alpha: 0.25)
                : Colors.black.withValues(alpha: 0.25)))
      : this.color;

  if (color != null) {
    result = Material(color: color, child: result);
  }

  return result;
}