rating_slider 1.0.0
rating_slider: ^1.0.0 copied to clipboard
A highly customizable Flutter rating bar that supports drag and tap interactions, half ratings, and dynamic icons.
RatingSlider #
A highly customizable Flutter rating bar that supports drag and tap interactions, half ratings, and dynamic icons.
Usage #
RatingSlider(
initialRating: _rating,
iconBuilder: (context, index, type) {
switch (type) {
case RatingType.full:
return const Icon(Icons.star, color: Colors.amber);
case RatingType.half:
return const Icon(Icons.star_half, color: Colors.amber);
case RatingType.empty:
default:
return const Icon(Icons.star_border, color: Colors.grey);
}
},
onRatingUpdate: (rating) {
debugPrint("Rating: $rating");
setState(() {
_controller.text = rating.toStringAsFixed(1);
_rating = rating;
});
},
),
For more examples, check the /example folder in the repository.