feat: secure home credentials

This commit is contained in:
Artem Kokos
2026-04-22 23:25:48 +07:00
parent 6a961209cc
commit 7c0a2675c6
22 changed files with 1782 additions and 397 deletions

View File

@@ -47,9 +47,9 @@ class _GroupEditScreenState extends ConsumerState<GroupEditScreen> {
await ref.read(devicesProvider.notifier).load();
} catch (e) {
if (mounted) {
ScaffoldMessenger.of(context).showSnackBar(
SnackBar(content: Text('Ошибка сканирования: $e')),
);
ScaffoldMessenger.of(
context,
).showSnackBar(SnackBar(content: Text('Ошибка сканирования: $e')));
}
}
if (mounted) setState(() => _rescanning = false);
@@ -78,7 +78,9 @@ class _GroupEditScreenState extends ConsumerState<GroupEditScreen> {
],
),
body: _loading
? const Center(child: CircularProgressIndicator(color: Colors.deepOrange))
? const Center(
child: CircularProgressIndicator(color: Colors.deepOrange),
)
: Padding(
padding: const EdgeInsets.all(16),
child: Column(
@@ -166,7 +168,9 @@ class _GroupEditScreenState extends ConsumerState<GroupEditScreen> {
subtitle: Text(
'$mac${ip != null ? ' - $ip' : ''}',
style: const TextStyle(
fontSize: 11, color: Colors.white38),
fontSize: 11,
color: Colors.white38,
),
),
onChanged: (v) {
setState(() {
@@ -201,7 +205,9 @@ class _GroupEditScreenState extends ConsumerState<GroupEditScreen> {
width: 20,
height: 20,
child: CircularProgressIndicator(
strokeWidth: 2, color: Colors.white),
strokeWidth: 2,
color: Colors.white,
),
)
: const Text('СОЗДАТЬ ГРУППУ'),
),
@@ -216,7 +222,8 @@ class _GroupEditScreenState extends ConsumerState<GroupEditScreen> {
/// Извлечь MAC-адрес из объекта устройства
String? _extractMac(dynamic device) {
if (device is Map) {
return (device['mac'] ?? device['id'] ?? device['mac_address'])?.toString();
return (device['mac'] ?? device['id'] ?? device['mac_address'])
?.toString();
}
return device?.toString();
}
@@ -243,9 +250,9 @@ class _GroupEditScreenState extends ConsumerState<GroupEditScreen> {
final name = _nameCtrl.text.trim();
if (id.isEmpty || name.isEmpty) {
ScaffoldMessenger.of(context).showSnackBar(
const SnackBar(content: Text('Укажите ID и название')),
);
ScaffoldMessenger.of(
context,
).showSnackBar(const SnackBar(content: Text('Укажите ID и название')));
return;
}
@@ -265,9 +272,9 @@ class _GroupEditScreenState extends ConsumerState<GroupEditScreen> {
if (mounted) Navigator.of(context).pop();
} catch (e) {
if (mounted) {
ScaffoldMessenger.of(context).showSnackBar(
SnackBar(content: Text('Ошибка создания: $e')),
);
ScaffoldMessenger.of(
context,
).showSnackBar(SnackBar(content: Text('Ошибка создания: $e')));
}
}