dateColumn<T extends Object> method
Date column rendered with DateFormat using pattern.
When value returns null the cell shows an em-dash placeholder.
Implementation
TableColumn<T> dateColumn<T extends Object>({
required String title,
required DateTime? Function(T) value,
String pattern = 'dd/MM/yyyy',
double sizeFactor = .1,
bool sortable = false,
String? id,
bool isMain = false,
}) {
final formatter = DateFormat(pattern);
return TableColumn<T>(
id: id,
title: Text(title),
cellBuilder: (item) {
final d = value(item);
return Text(d == null ? '—' : formatter.format(d));
},
sizeFactor: sizeFactor,
sortable: sortable,
isMain: isMain,
);
}