Fix device with no config

This commit is contained in:
Thomas Fransolet 2021-08-25 16:12:42 +02:00
parent 6486590224
commit e06a5fdeb4
2 changed files with 21 additions and 15 deletions

View File

@ -46,6 +46,7 @@ showChangeInfo (String text, DeviceDTO inputDevice, Function onGetResult, int ma
future: getConfigurations(appContext), future: getConfigurations(appContext),
builder: (context, AsyncSnapshot<dynamic> snapshot) { builder: (context, AsyncSnapshot<dynamic> snapshot) {
if (snapshot.connectionState == ConnectionState.done) { if (snapshot.connectionState == ConnectionState.done) {
if (snapshot.data.length > 0) {
return Row( return Row(
children: [ children: [
Padding( Padding(
@ -61,6 +62,10 @@ showChangeInfo (String text, DeviceDTO inputDevice, Function onGetResult, int ma
), ),
], ],
); );
} else {
return Text("Aucune configuration trouvée");
}
} else if (snapshot.connectionState == ConnectionState.none) { } else if (snapshot.connectionState == ConnectionState.none) {
return Text("No data"); return Text("No data");
} else { } else {

View File

@ -22,6 +22,7 @@ class _DropDownConfigState extends State<DropDownConfig> {
@override @override
void initState() { void initState() {
if (widget.selectedConfigurationId != null)
configurationDTO = widget.configurations.firstWhere((config) => config.id == widget.selectedConfigurationId); configurationDTO = widget.configurations.firstWhere((config) => config.id == widget.selectedConfigurationId);
super.initState(); super.initState();
} }