TTableHeader<T, K>.rating constructor
TTableHeader<T, K>.rating (
- String text,
- double? map(
- T
- int? flex,
- double? minWidth,
- double? maxWidth,
- Alignment? alignment,
- int itemCount = 5,
- double itemSize = 10.0,
- Color? color,
- Color? unratedColor,
- bool allowHalfRating = false,
- double spacing = 0.0,
- String? key,
- TFilterType? filterType = TFilterType.number,
- bool filterable = true,
- List<
TFilterOperator> ? filterOperators, - List? filterItems,
- TFilterDef<
T> ? filterDef, - double widthEstimator(
- T data
- bool flattenOnMobile = false,
- String mobileKeyPrefixBuilder()?,
- List<
TKeyValue> keyValuesBuilder(- T data
Creates a header for displaying ratings.
Implementation
TTableHeader.rating(
this.text,
double? Function(T) map, {
this.flex,
this.minWidth,
this.maxWidth,
this.alignment,
int itemCount = 5,
double itemSize = 10.0,
Color? color,
Color? unratedColor,
bool allowHalfRating = false,
double spacing = 0.0,
this.key,
this.filterType = TFilterType.number,
this.filterable = true,
this.filterOperators,
this.filterItems,
this.filterDef,
double Function(T data)? widthEstimator,
this.flattenOnMobile = false,
this.mobileKeyPrefixBuilder,
this.keyValuesBuilder,
}) : map = map,
widthEstimator = widthEstimator ?? ((_) => itemCount * itemSize + (itemCount > 1 ? (itemCount - 1) * spacing : 0.0) + 4.0),
builder = ((ctx, item, __) {
final isDense = TTableScope.maybeOf(ctx)?.dense ?? false;
final ratingValue = map(item.data) ?? 0.0;
return TRating(
value: ratingValue,
itemCount: itemCount,
itemSize: isDense ? itemSize * 0.8 : itemSize,
color: color,
unratedColor: unratedColor,
disabled: true,
allowHalfRating: allowHalfRating,
spacing: spacing,
);
});