flutter - 如何在 Flutter 中的 sqlite 在 SmoothStarRating 中显示评分
问题描述
我有一个颤动的星星平滑酒吧。我将评级保存在我的笔记表中。更新笔记时如何显示相同的内容?
Padding(
padding: const EdgeInsets.all(10.0),
child: Row(mainAxisAlignment: MainAxisAlignment.start,
children:<Widget>[
Text("Priority",style: TextStyle(fontSize: 20.0),),
Padding(
padding: const EdgeInsets.only(left:20.0),
child: Container(
child: SmoothStarRating(
size: height=50.0,
allowHalfRating: false,
onRated: (value) {
this.note.prty=value;
},
),
),
)]),
),
解决方案
所以像我在下面的例子中使用的那样使用设置状态,我在下面给出例子。
SmoothStarRating(
allowHalfRating: false,
onRated: (v) {
setState(() {
rating=v;
});
print(rating);
},
starCount: 5,
size: 40.0,
// isReadOnly:true,
filledIconData: Icons.star,
halfFilledIconData: Icons.star_half,
color: MyColors.black,
borderColor: MyColors.grey,
spacing:0.0
),
推荐阅读
- javascript - Python,使用嵌入式 java 脚本在网站中进行网页抓取
- magnolia - 从外部数据 magnolia 中检索内容
- python - 嗨,无法在 Ubuntu 19.10 中安装 python
- azure - Azure iot hub & azure function:消费者组问题
- sql - SQL 基于字段值重复行,同时增加另一个字段
- linux - 在另一台 Linux 服务器上执行 shell 脚本
- javascript - 当页面更新时,会加载旧版本的包(npm)
- reactjs - react-app-rewired 是否可以用于有条件地配置对等依赖项
- spring-kafka - KafkaTemplate 是事务性发送同步还是异步?
- wordpress - 如何将新页面替换为现有 URL?