import 'package:animated_rating_stars/animated_rating_stars.dart'; import 'package:flutter/material.dart'; class StarWidget extends StatelessWidget { final double maxRating; final double starSize; final bool readOnly; const StarWidget({ super.key, required this.maxRating, required this.starSize, required this.readOnly, }); @override Widget build(BuildContext context) { return AnimatedRatingStars( initialRating: 1, minRating: 0, maxRating: maxRating, filledColor: Colors.amber, emptyColor: Colors.grey, filledIcon: Icons.star_border_rounded, halfFilledIcon: Icons.star_half_rounded, emptyIcon: Icons.star_border_rounded, onChanged: (double rating) { // Handle the rating change here print('Rating: $rating'); }, displayRatingValue: true, interactiveTooltips: true, customFilledIcon: Icons.star_border_rounded, customHalfFilledIcon: Icons.star_half_rounded, customEmptyIcon: Icons.star_border_rounded, starSize: starSize, animationDuration: const Duration(milliseconds: 300), animationCurve: Curves.easeInOut, readOnly: readOnly, ); } }