RatingBar constructor

const RatingBar({
  1. Key? key,
  2. required double rating,
  3. ValueChanged<double>? onChanged,
  4. int amount = 5,
  5. Duration animationDuration = Duration.zero,
  6. Curve? animationCurve,
  7. IconData? icon,
  8. double iconSize = 20.0,
  9. Color? ratedIconColor,
  10. Color? unratedIconColor,
  11. String? semanticLabel,
  12. FocusNode? focusNode,
  13. bool autofocus = false,
  14. double starSpacing = 0,
  15. DragStartBehavior dragStartBehavior = DragStartBehavior.down,
})

Creates a new rating bar.

rating must be greater than 0 and less than amount

starSpacing and amount must be greater than 0

Implementation

const RatingBar({
  super.key,
  required this.rating,
  this.onChanged,
  this.amount = 5,
  this.animationDuration = Duration.zero,
  this.animationCurve,
  this.icon,
  this.iconSize = 20.0,
  this.ratedIconColor,
  this.unratedIconColor,
  this.semanticLabel,
  this.focusNode,
  this.autofocus = false,
  this.starSpacing = 0,
  this.dragStartBehavior = DragStartBehavior.down,
})  : assert(rating >= 0 && rating <= amount),
      assert(starSpacing >= 0),
      assert(amount > 0);