как решить эту проблему?
DropdownMenu
DropdownButton(
value: selectedFilter,
items: statuss.map((StatusFilter status) {
return DropdownMenuItem(
value: status,
child: Text(status.name),
);
}).toList(),
onChanged: (StatusFilter value) async {
selectedFilter = value;
// await model.getServiceMonitoringLog(status: selectedFilter.num);
setState(() async {
await model.getServiceMonitoringLog(status: selectedFilter.num);
});
},
)
class StatusFilter {
final String name;
final int num;
StatusFilter(this.name, this.num);
}
StatusFilter selectedFilter;
List<StatusFilter> statuss = <StatusFilter>[
StatusFilter("Pending", 1),
StatusFilter("Approved", 2),
StatusFilter("Rejected", 3)
];
@override
void initState() {
selectedFilter = statuss[statuss.length];
super.initState();}
Модель
class ServiceMonitoringLogFilterModel extends BaseModel {
Api _api;
ServiceMonitoringLogFilterModel({@required Api api}) : _api = api;
ServiceMonitoringLog serviceMonitoringLog;
Future getServiceMonitoringLog({int status}) async {
setBusy(true);
String token = await getToken();
print("Token Lurd $token");
serviceMonitoringLog =
await _api.getServiceMonitoringLogFilter(token,status: status);
setBusy(false);
}
}
Вы можете мне помочь?
Спасибо