fix(ui): display selected device name when add devices in DetailGroupScreen

This commit is contained in:
anhtunz
2025-02-11 11:55:51 +07:00
parent a98e84880b
commit bfeba03490
6 changed files with 124 additions and 98 deletions

View File

@@ -136,9 +136,12 @@ class DeviceUtils {
List<Device> sortDeviceByState(List<Device> devices) {
List<Device> sortedDevices = List.from(devices);
sortedDevices.sort((a, b) {
int stateOrder = [2, 1, 3, 0, -1, 3].indexOf(a.state!) -
[2, 1, 3, 0, -1, 3].indexOf(b.state!);
return stateOrder;
int stateOrder = [2, 1, 3, 0, -1].indexOf(a.state!) -
[2, 1, 3, 0, -1].indexOf(b.state!);
if (stateOrder != 0) {
return stateOrder;
}
return a.name!.compareTo(b.name!);
});
return sortedDevices;