fix: report group control failures

This commit is contained in:
Artem Kokos
2026-04-23 20:32:44 +07:00
parent 1c40852ac6
commit 736a61d54b
4 changed files with 93 additions and 15 deletions

View File

@@ -38,6 +38,17 @@ class _GroupCardState extends ConsumerState<GroupCard> {
final int gVal = g['last_state']?['g'] ?? 200;
final int b = g['last_state']?['b'] ?? 100;
ref.listen<GroupControlError?>(groupControlErrorProvider, (previous, next) {
if (next == null || next.groupId != id) return;
if (previous?.sequence == next.sequence) return;
ScaffoldMessenger.of(context).showSnackBar(
SnackBar(
content: Text('Не удалось применить ${next.action}: ${next.message}'),
),
);
});
// Значения слайдеров: локальные (если тянем) или серверные
final briValue = (_localBrightness ?? bri.toDouble()).clamp(10.0, 100.0);
final tempValue = (_localTemp ?? temp.toDouble()).clamp(2700.0, 6500.0);