提问人:kris 提问时间:7/24/2023 更新时间:7/24/2023 访问量:22
在列表中显示模型的给定值的评级并动态绘制颜色
Displaying rating with given value from model in list and painting colors dynamically
问:
帮助!!! 我需要帮助实现一个逻辑,根据我拥有的模型数据,将评级星涂成金色(满分五星)。没有用户交互,只有显示评级。 我想在我的小部件列表中输出评级。
我的模型类:-
class Trending {
const Trending({
required this.image,
required this.title,
required this.genre,
required this.subtitle,
required this.rating,
});
final String image;
final String title;
final Genre genre;
final String subtitle;
final int rating;
}
我的傻瓜数据:-
const trendingHome = <Trending>[
Trending(
image: 'assets/images/psimg.jpg',
title: 'The Havoc Bringer',
rating: 4,
genre: Genre.action,
subtitle:
'In a small town where the youths have been manipulated by their rulers a courageous Man stands up for his people...'),
Trending(
image: 'assets/images/img0.jpg',
title: 'Chainsaw Wreck',
rating: 5,
genre: Genre.rpg,
subtitle: ''),
];
答:
评论