[英]How do I display a list in dropdown with complete value and display it's code on selection in flutter?
I have a dropdown field in a form, the list has items like, 1 - Form 4 2 - Form 5 3 - Form 6 4 - Form 7我在表单中有一个下拉字段,列表中有以下项目: 1 - 表格 4 2 - 表格 5 3 - 表格 6 4 - 表格 7
Now, I want that when the user opens the dropdown, whole 2 - Form 5 should be displayed but when he selects 1, the selected value in the dropdown should display only 1 ie.现在,我希望当用户打开下拉列表时,应该显示整个 2 - Form 5,但是当他选择 1 时,下拉列表中的选定值应该只显示 1 即。 splitted from hypehn.从连字符中分离出来。 Can I use valuetransformer or some other way?我可以使用 valuetransformer 或其他方式吗?
FormBuilderDropdown(
attribute: "selectFormValue",
items: <String>['1 - Form 4', '2 - Form 5', '3 - Form 6', '4 - Form 7']
.map<DropdownMenuItem<String>>((String value) {
return DropdownMenuItem<String>(
value: value,
child: Text(value),
);
}).toList(),
),
I have a dropdown field in a form, the list has items like, 1 - Form 4 2 - Form 5 3 - Form 6 4 - Form 7我在表单中有一个下拉字段,列表中有以下项目: 1 - 表格 4 2 - 表格 5 3 - 表格 6 4 - 表格 7
Now, I want that when the user opens the dropdown, whole 2 - Form 5 should be displayed but when he selects 1, the selected value in the dropdown should display only 1 ie.现在,我希望当用户打开下拉列表时,应该显示整个 2 - Form 5,但是当他选择 1 时,下拉列表中的选定值应该只显示 1 即。 splitted from hypehn.从连字符中分离出来。 Can I use valuetransformer or some other way?我可以使用 valuetransformer 或其他方式吗?
FormBuilderDropdown(
attribute: "selectFormValue",
items: <String>['1 - Form 4', '2 - Form 5', '3 - Form 6', '4 - Form 7']
.map<DropdownMenuItem<String>>((String value) {
return DropdownMenuItem<String>(
value: value,
child: Text(value),
);
}).toList(),
),
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.