buildCell method
Widget
buildCell(
- BuildContext context,
- T row,
- DataGridColumn<
T> column, - int rowIndex,
- 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),
);
}