fix(ui): display interfamily tags when interfamily's devices state = 1
This commit is contained in:
@@ -94,61 +94,59 @@ class _HomeScreenState extends State<HomeScreen> {
|
||||
if (snapshot.data?['state'] != null ||
|
||||
snapshot.data?['battery'] != null) {
|
||||
return Row(
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
if (snapshot.data?['state'] != null)
|
||||
...snapshot.data!['state']!
|
||||
.map(
|
||||
(item) => FutureBuilder<Widget>(
|
||||
future: warningCard(
|
||||
context, apiServices, item),
|
||||
builder:
|
||||
(context, warningCardSnapshot) {
|
||||
if (warningCardSnapshot.hasData) {
|
||||
return ConstrainedBox(
|
||||
constraints: const BoxConstraints(
|
||||
maxWidth: 400,
|
||||
maxHeight: 260,
|
||||
),
|
||||
child: warningCardSnapshot.data!,
|
||||
);
|
||||
} else {
|
||||
return const SizedBox.shrink();
|
||||
}
|
||||
},
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
if (snapshot.data?['state'] != null)
|
||||
...snapshot.data!['state']!
|
||||
.map(
|
||||
(item) => FutureBuilder<Widget>(
|
||||
future: warningCard(
|
||||
context, apiServices, item),
|
||||
builder: (context, warningCardSnapshot) {
|
||||
if (warningCardSnapshot.hasData) {
|
||||
return ConstrainedBox(
|
||||
constraints: const BoxConstraints(
|
||||
maxWidth: 400,
|
||||
maxHeight: 260,
|
||||
),
|
||||
child: warningCardSnapshot.data!,
|
||||
);
|
||||
} else {
|
||||
return const SizedBox.shrink();
|
||||
}
|
||||
},
|
||||
),
|
||||
)
|
||||
.toList(),
|
||||
if (snapshot.data?['battery'] != null)
|
||||
...snapshot.data!['battery']!
|
||||
.map(
|
||||
(batteryItem) => FutureBuilder<Widget>(
|
||||
future: notificationCard(
|
||||
context,
|
||||
"lowBattery",
|
||||
"Cảnh báo pin yếu",
|
||||
batteryItem
|
||||
),
|
||||
)
|
||||
.toList(),
|
||||
if (snapshot.data?['battery'] != null)
|
||||
...snapshot.data!['battery']!
|
||||
.map(
|
||||
(batteryItem) => FutureBuilder<Widget>(
|
||||
future: notificationCard(
|
||||
context,
|
||||
"lowBattery",
|
||||
"Cảnh báo pin yếu",
|
||||
batteryItem.name!,
|
||||
batteryItem.areaPath!,
|
||||
),
|
||||
builder:
|
||||
(context, warningCardSnapshot) {
|
||||
if (warningCardSnapshot.hasData) {
|
||||
return ConstrainedBox(
|
||||
constraints: const BoxConstraints(
|
||||
maxWidth: 400,
|
||||
maxHeight: 260,
|
||||
),
|
||||
child: warningCardSnapshot.data!,
|
||||
);
|
||||
} else {
|
||||
return const SizedBox.shrink();
|
||||
}
|
||||
},
|
||||
),
|
||||
)
|
||||
.toList(),
|
||||
]);
|
||||
builder: (context, warningCardSnapshot) {
|
||||
if (warningCardSnapshot.hasData) {
|
||||
return ConstrainedBox(
|
||||
constraints: const BoxConstraints(
|
||||
maxWidth: 400,
|
||||
maxHeight: 260,
|
||||
),
|
||||
child: warningCardSnapshot.data!,
|
||||
);
|
||||
} else {
|
||||
return const SizedBox.shrink();
|
||||
}
|
||||
},
|
||||
),
|
||||
)
|
||||
.toList(),
|
||||
],
|
||||
);
|
||||
} else {
|
||||
return Padding(
|
||||
padding: context.paddingMedium,
|
||||
@@ -355,13 +353,14 @@ class _HomeScreenState extends State<HomeScreen> {
|
||||
}
|
||||
}
|
||||
}
|
||||
checkSettingdevice(allDevicesAliasJoined);
|
||||
// checkSettingdevice(allDevicesAliasJoined);
|
||||
homeBloc.sinkAllDevicesAlias.add(allDevicesAlias);
|
||||
homeBloc.sinkAllDevicesAliasJoined.add(allDevicesAliasJoined);
|
||||
}
|
||||
|
||||
void checkSettingdevice(List<DeviceWithAlias> devices) async {
|
||||
if (isFunctionCall) {
|
||||
log("Ham check setting da duoc goi");
|
||||
} else {
|
||||
String? response =
|
||||
await apiServices.getAllSettingsNotificationOfDevices();
|
||||
@@ -380,7 +379,7 @@ class _HomeScreenState extends State<HomeScreen> {
|
||||
await apiServices.setupDeviceNotification(
|
||||
device.thingId!, device.name!);
|
||||
} else {
|
||||
log("All devives are in the notification settings list.");
|
||||
log("All devices are in the notification settings list.");
|
||||
}
|
||||
}
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user