Minor fixes

This commit is contained in:
Yegor Vialov
2018-10-12 18:03:27 +03:00
parent 948d1d4e23
commit b5f9ecf601
6 changed files with 32 additions and 20 deletions

View File

@ -11,15 +11,15 @@ class _SelectEntityWidgetState extends _EntityWidgetState {
@override
Widget _buildActionWidget(BuildContext context) {
Widget ctrl;
_listOptions.clear();
if (widget.entity.attributes["options"] != null) {
widget.entity.attributes["options"].forEach((value){
_listOptions.add(value.toString());
});
}
return Expanded(
//width: Entity.INPUT_WIDTH,
child: DropdownButton<String>(
if (_listOptions.isNotEmpty) {
ctrl = DropdownButton<String>(
value: widget.entity.state,
items: this._listOptions.map((String value) {
return new DropdownMenuItem<String>(
@ -30,7 +30,13 @@ class _SelectEntityWidgetState extends _EntityWidgetState {
onChanged: (_) {
setNewState(_);
},
),
);
} else {
ctrl = Text('---');
}
return Expanded(
//width: Entity.INPUT_WIDTH,
child: ctrl,
);
}
}