【发布时间】:2019-11-24 00:43:48
【问题描述】:
我希望这能满足所有 Flutter 开发者的需求。
我正在开发一个应用程序,我遇到了几个问题。这是我的问题。
我想在 selectedLocations 之间切换,它会显示与该位置相关的表格供用户填写。
void switchSelectedCountry(selection) {
events = selection;
scoops = selection;
setState(() {
_selectedLocation = selection;
});
}
formField: FixDropdownButtonFormField(
value: _selectedLocation,
hint: Text('Select'),
items: <String>['Scoops', 'Events',].map((String value) {
return new FixDropdownMenuItem<String>(
value: value,
child: new Text(value),
);
}).toList(),
onChanged: (newValue) {
setState(() {
_selectedLocation = newValue;
});
},
),
),
【问题讨论】:
-
在您的
build方法中放置一个if块。 -
告诉我,我一直在尝试不工作,也许我做错了
-
展示你的尝试。
标签: if-statement flutter dart switch-statement mobile-development