flutter - 如何让 DropdownButtonFormField 显示我保存在数据库中的值的输出
问题描述
我正在使用 DropdownButtonFormField 并且到目前为止列表正在加载我,但我希望您加载列表并加载保存在我的数据库中的项目并将其作为输出显示给我,表明用户已经选择了以前的项目。
这是我正在使用的代码
DropdownButtonFormField(
isDense: true,
//hint: new Text("Seleccione Barrio"),
items: dataBarrio.map((item) {
return new DropdownMenuItem(
child: new Text(item['nom']),
value: item['id'].toString(),
);
}).toList(),
onChanged: (newVal) {
setState(() {
_mySelectionBarrio = newVal;
});
},
value: _mySelectionBarrio,
)
解决方案
推荐阅读
- html - 是否可以使用 react-native-render-html 导航到页内 URL 片段子资源作为实现浏览器行为?
- android - 如何使用改造发布带有标题的数组列表?
- python - 从 Jupyter Notebook 文件夹中的图像创建 PDF
- javascript - Python 到 chart.js
- chef-infra - 厨师在厨师客户端运行期间仍在寻找已删除的食谱
- sql - 如果没有记录 ID,则在一个表中查找不在另一个表中的记录?
- html - CSS3 动画不动
- html - 无法设置 wtform 属性的样式
- r - 如何在 R 中更改矩阵的大小?
- powerbi - PowerBI 百分比计算