statusColumn<T extends Object> method

TableColumn<T> statusColumn<T extends Object>({
  1. required String title,
  2. required String label(
    1. T
    ),
  3. required Color color(
    1. T
    ),
  4. double sizeFactor = .1,
  5. String? id,
  6. bool isMain = false,
})

Color-coded status badge column.

Renders a rounded chip whose background is a translucent variant of color and whose foreground reuses the same color for the label.

Implementation

TableColumn<T> statusColumn<T extends Object>({
  required String title,
  required String Function(T) label,
  required Color Function(T) color,
  double sizeFactor = .1,
  String? id,
  bool isMain = false,
}) {
  return TableColumn<T>(
    id: id,
    title: Text(title),
    cellBuilder: (item) {
      final c = color(item);
      return Container(
        padding: const EdgeInsets.symmetric(horizontal: Sizes.gapSm, vertical: Sizes.gapXs),
        decoration: BoxDecoration(
          color: c.withValues(alpha: 0.15),
          borderRadius: BorderRadius.circular(12),
        ),
        child: Text(
          label(item),
          style: TextStyle(
            color: c,
            fontWeight: FontWeight.w600,
            fontSize: 12,
          ),
        ),
      );
    },
    sizeFactor: sizeFactor,
    isMain: isMain,
  );
}