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. double? minWidth,
  7. double? maxWidth,
  8. 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,
  double? minWidth,
  double? maxWidth,
  bool forceCache = false,
})  : map = null,
      minWidth = minWidth ?? (width + 16),
      maxWidth = maxWidth ?? (flex != null ? null : (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,
        );
      });