buildCell method

  1. @override
Widget buildCell(
  1. BuildContext context,
  2. T row,
  3. DataGridColumn<T> column,
  4. int rowIndex,
  5. CellRenderContext<T> renderContext,
)
override

Builds a single cell widget.

context - Flutter BuildContext row - The data row containing this cell column - The column definition rowIndex - Row index renderContext - Additional rendering context

Implementation

@override
Widget buildCell(
  BuildContext context,
  T row,
  DataGridColumn<T> column,
  int rowIndex,
  CellRenderContext<T> renderContext,
) {
  final theme = DataGridTheme.of(context);
  final value = column.valueAccessor?.call(row);
  final displayText = value?.toString() ?? '';

  return Container(
    padding: theme.padding.cellPadding,
    alignment: Alignment.centerLeft,
    child: Text(displayText, overflow: TextOverflow.ellipsis),
  );
}