31 lines
759 B
Dart
31 lines
759 B
Dart
import 'package:flutter/material.dart';
|
|
import 'package:flutter_rating_bar/flutter_rating_bar.dart';
|
|
|
|
class RatingStars extends StatelessWidget {
|
|
const RatingStars({super.key, required this.onRate});
|
|
|
|
final Function onRate;
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return RatingBar.builder(
|
|
initialRating: 0,
|
|
minRating: 1,
|
|
itemSize: 80,
|
|
direction: Axis.horizontal,
|
|
allowHalfRating: false,
|
|
itemCount: 5,
|
|
itemPadding: const EdgeInsets.symmetric(horizontal: 4),
|
|
itemBuilder: (context, index) {
|
|
return Icon(
|
|
Icons.star_rounded,
|
|
color: Theme.of(context).colorScheme.tertiary,
|
|
);
|
|
},
|
|
onRatingUpdate: (rating) {
|
|
onRate();
|
|
},
|
|
);
|
|
}
|
|
}
|