Fix device with no config
This commit is contained in:
parent
6486590224
commit
e06a5fdeb4
@ -46,21 +46,26 @@ 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) {
|
||||||
return Row(
|
if (snapshot.data.length > 0) {
|
||||||
children: [
|
return Row(
|
||||||
Padding(
|
children: [
|
||||||
padding: const EdgeInsets.all(8.0),
|
Padding(
|
||||||
child: DropDownConfig(
|
padding: const EdgeInsets.all(8.0),
|
||||||
configurations: snapshot.data,
|
child: DropDownConfig(
|
||||||
selectedConfigurationId: inputDevice.configurationId,
|
configurations: snapshot.data,
|
||||||
onChange: (ConfigurationDTO configurationOut) {
|
selectedConfigurationId: inputDevice.configurationId,
|
||||||
inputDevice.configuration = configurationOut.label;
|
onChange: (ConfigurationDTO configurationOut) {
|
||||||
inputDevice.configurationId = configurationOut.id;
|
inputDevice.configuration = configurationOut.label;
|
||||||
},
|
inputDevice.configurationId = configurationOut.id;
|
||||||
|
},
|
||||||
|
),
|
||||||
),
|
),
|
||||||
),
|
],
|
||||||
],
|
);
|
||||||
);
|
} 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 {
|
||||||
|
|||||||
@ -22,7 +22,8 @@ class _DropDownConfigState extends State<DropDownConfig> {
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
void initState() {
|
void initState() {
|
||||||
configurationDTO = widget.configurations.firstWhere((config) => config.id == widget.selectedConfigurationId);
|
if (widget.selectedConfigurationId != null)
|
||||||
|
configurationDTO = widget.configurations.firstWhere((config) => config.id == widget.selectedConfigurationId);
|
||||||
super.initState();
|
super.initState();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user