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

@@ -23,4 +23,6 @@ class ApplicationConstants {
static const DEVICE_NOTIFICATIONS_SETTINGS = "/device-notifications-settings";
static const OWNER_GROUP = "owner";
static const PARTICIPANT_GROUP = "participant";
static const NO_DATA = "no_data";
static const LOADING = "loading";
}

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;

View File

@@ -21,3 +21,5 @@ void showSnackBarResponseByStatusCodeNoIcon(BuildContext context, int statusCode
showNoIconTopSnackBar(context, failedMessage, Colors.red, Colors.white);
}
}