Каркас приложения: авторизация, зоны/устройства/правила, управление устройствами

HTTP-клиент к /api/v1 с Sanctum-токеном (хранится в secure storage),
модели зеркалят Laravel API Resources. Экраны: логин, список устройств
с живым статусом, детальная страница устройства (история телеметрии,
turn-on/turn-off/set-level с проверкой capability), списки зон и правил
автоматизации (пока только чтение — формы создания/редактирования впереди).
This commit is contained in:
2026-08-12 01:12:39 +05:00
parent 6a00826194
commit 45b8733d22
25 changed files with 1531 additions and 129 deletions
+31
View File
@@ -0,0 +1,31 @@
import 'package:flutter/material.dart';
/// Small colored dot + label for a device's live status ("online" /
/// "offline" / "unknown"), used anywhere a device is listed.
class StatusBadge extends StatelessWidget {
const StatusBadge({super.key, required this.status});
final String status;
@override
Widget build(BuildContext context) {
final (color, label) = switch (status) {
'online' => (Colors.green, 'онлайн'),
'offline' => (Colors.red, 'офлайн'),
_ => (Colors.grey, 'неизвестно'),
};
return Row(
mainAxisSize: MainAxisSize.min,
children: [
Container(
width: 8,
height: 8,
decoration: BoxDecoration(color: color, shape: BoxShape.circle),
),
const SizedBox(width: 6),
Text(label, style: TextStyle(color: color, fontSize: 12)),
],
);
}
}