TTableHeader<T, K>.image constructor

TTableHeader<T, K>.image(
  1. String text,
  2. String? map(
    1. T
    ), {
  3. int? flex,
  4. Alignment? alignment,
  5. double width = 50,
  6. bool forceCache = false,
})

Creates a header for displaying images.

Implementation

TTableHeader.image(
  this.text,
  String? Function(T) map, {
  this.flex,
  this.alignment,
  double width = 50,
  bool forceCache = false,
})  : map = null,
      minWidth = width + 16,
      maxWidth = width + 16,
      builder = ((ctx, item, __) {
        final isDense = TTableScope.maybeOf(ctx)?.dense ?? false;
        final imgUrl = map(item.data);
        if (imgUrl == null) return const SizedBox.shrink();
        return TImage(
          url: imgUrl,
          size: isDense ? width * 0.8 : width,
          forceCache: forceCache,
        );
      });