// lib/features/reviews/widgets/star_rating_input.dart import 'package:flutter/material.dart'; class StarRatingInput extends StatelessWidget { final int rating; final ValueChanged onRatingChanged; final double starSize; const StarRatingInput({ Key? key, required this.rating, required this.onRatingChanged, this.starSize = 36, }) : super(key: key); static const _labels = ['', 'Poor', 'Fair', 'Good', 'Very Good', 'Excellent']; static const _starGold = Color(0xFFFBBF24); static const _starEmpty = Color(0xFFD1D5DB); @override Widget build(BuildContext context) { return Column( mainAxisSize: MainAxisSize.min, children: [ Row( mainAxisSize: MainAxisSize.min, children: List.generate(5, (i) { final starIndex = i + 1; return GestureDetector( onTap: () => onRatingChanged(starIndex), child: Padding( padding: const EdgeInsets.symmetric(horizontal: 2), child: Icon( starIndex <= rating ? Icons.star_rounded : Icons.star_outline_rounded, size: starSize, color: starIndex <= rating ? _starGold : _starEmpty, ), ), ); }), ), if (rating > 0) ...[ const SizedBox(height: 4), Text( _labels[rating], style: TextStyle( fontSize: 13, fontWeight: FontWeight.w600, color: _starGold, ), ), ], ], ); } }