enumBadge<T> static method

ReadableColumn<T> enumBadge<T>(
  1. String label, {
  2. required String value(
    1. T v
    ),
  3. Color color(
    1. String tag
    )?,
  4. double? width = 132,
  5. bool sortable = true,
})

A coloured status/type pill drawn from a small enum-like set. color maps the string to a swatch; falls back to a neutral pill.

Implementation

static ReadableColumn<T> enumBadge<T>(
  String label, {
  required String Function(T v) value,
  Color Function(String tag)? color,
  double? width = 132,
  bool sortable = true,
}) =>
    ReadableColumn<T>(
      label,
      type: ReadableColumnType.enumBadge,
      width: width,
      sortable: sortable,
      sortKey: (v) => value(v),
      cell: (ctx, v) => ReadableCells.badge(value(v), color: color),
    );