@Composable
fun RatingBar(
rating: Float,
maxRating: Int = 5,
onRatingChanged: (Float) -> Unit
) {
Row {
for (i in 1..maxRating) {
IconButton(onClick = { onRatingChanged(i.toFloat()) }) {
if (i <= rating) Icons.Default.Star else Icons.Default.StarBorder
}
}
}
}
1条答案
按热度按时间kx1ctssn1#
这里是我的评级栏:
当你叫它: