TKeyValue.rating constructor

TKeyValue.rating(
  1. String key,
  2. double? rating, {
  3. int itemCount = 5,
  4. double itemSize = 14.0,
  5. Color? color,
  6. Color? unratedColor,
  7. bool allowHalfRating = true,
  8. double spacing = 2.0,
  9. bool disabled = true,
  10. ValueChanged<double?>? onValueChanged,
  11. Widget? icon,
  12. double? width,
  13. Alignment? alignment,
  14. double? minWidth,
  15. double? maxWidth,
})

Creates a key-value item for displaying star ratings using TRating.

Implementation

factory TKeyValue.rating(
  String key,
  double? rating, {
  int itemCount = 5,
  double itemSize = 14.0,
  Color? color,
  Color? unratedColor,
  bool allowHalfRating = true,
  double spacing = 2.0,
  bool disabled = true,
  ValueChanged<double?>? onValueChanged,
  Widget? icon,
  double? width,
  Alignment? alignment,
  double? minWidth,
  double? maxWidth,
}) {
  Widget? widget;
  if (rating != null) {
    widget = TRating(
      value: rating,
      itemCount: itemCount,
      itemSize: itemSize,
      color: color,
      unratedColor: unratedColor,
      disabled: disabled,
      allowHalfRating: allowHalfRating,
      spacing: spacing,
      onValueChanged: onValueChanged,
    );
  }
  return TKeyValue(
    key,
    value: rating?.toString(),
    widget: widget,
    icon: icon,
    width: width,
    alignment: alignment,
    minWidth: minWidth,
    maxWidth: maxWidth,
  );
}