fix(ui): fix error text in warning card and update information for device's inter-family owner

This commit is contained in:
anhtunz
2025-07-21 10:09:19 +07:00
parent 4ff2ad4396
commit fe622d8af9
4 changed files with 98 additions and 179 deletions

View File

@@ -33,10 +33,17 @@ class _HomeScreenState extends State<HomeScreen> {
super.initState();
homeBloc = BlocProvider.of(context);
const duration = Duration(seconds: 10);
getAllDevicesTimer =
Timer.periodic(duration, (Timer t) => homeBloc.getOwnerAndJoinedDevices(context));
WidgetsBinding.instance.addPostFrameCallback((_) {
// Code ở đây chạy sau khi giao diện render xong
getAllDevicesTimer =
Timer.periodic(duration, (Timer t) => homeBloc.getOwnerAndJoinedDevices(context));
// Ví dụ: gọi API, scroll tới vị trí nào đó, v.v.
});
}
@override
void dispose() {
getAllDevicesTimer?.cancel();
@@ -53,7 +60,6 @@ class _HomeScreenState extends State<HomeScreen> {
homeBloc.getOwnerAndJoinedDevices(context);
return const SharedLoadingAnimation();
}else{
log("Goi else");
homeBloc.getOwnerDeviceState(context, aliasDevicesSnapshot.data ?? []);
homeBloc.getDeviceStatusAliasMap(aliasDevicesSnapshot.data ?? []);
checkSettingDevice(aliasDevicesSnapshot.data ?? []);
@@ -210,7 +216,7 @@ class _HomeScreenState extends State<HomeScreen> {
),
),
),
StreamBuilder<Map<String, List<DeviceWithAlias>>>(
StreamBuilder<Map<String, List<DeviceWithAlias>>?>(
stream: homeBloc.streamAllDevicesAliasMap,
builder: (context, allDevicesAliasMapSnapshot) {
if(allDevicesAliasMapSnapshot.data == null){