feat: secure home credentials
This commit is contained in:
@@ -69,7 +69,8 @@ class _HomesScreenState extends ConsumerState<HomesScreen> {
|
||||
|
||||
// Расстояние до дома (null если нет координат или геолокации)
|
||||
final distKm = location.distanceToKm(
|
||||
home.latitude, home.longitude,
|
||||
home.latitude,
|
||||
home.longitude,
|
||||
);
|
||||
|
||||
return Card(
|
||||
@@ -83,7 +84,9 @@ class _HomesScreenState extends ConsumerState<HomesScreen> {
|
||||
title: Text(
|
||||
home.name,
|
||||
style: TextStyle(
|
||||
fontWeight: isActive ? FontWeight.bold : FontWeight.normal,
|
||||
fontWeight: isActive
|
||||
? FontWeight.bold
|
||||
: FontWeight.normal,
|
||||
color: isActive ? Colors.deepOrange : Colors.white,
|
||||
),
|
||||
),
|
||||
@@ -92,14 +95,21 @@ class _HomesScreenState extends ConsumerState<HomesScreen> {
|
||||
children: [
|
||||
Text(
|
||||
home.url,
|
||||
style: const TextStyle(color: Colors.white38, fontSize: 12),
|
||||
style: const TextStyle(
|
||||
color: Colors.white38,
|
||||
fontSize: 12,
|
||||
),
|
||||
),
|
||||
if (distKm != null)
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(top: 2),
|
||||
child: Row(
|
||||
children: [
|
||||
const Icon(Icons.near_me, size: 11, color: Colors.white30),
|
||||
const Icon(
|
||||
Icons.near_me,
|
||||
size: 11,
|
||||
color: Colors.white30,
|
||||
),
|
||||
const SizedBox(width: 4),
|
||||
Text(
|
||||
'~${formatDistance(distKm)}',
|
||||
@@ -115,11 +125,18 @@ class _HomesScreenState extends ConsumerState<HomesScreen> {
|
||||
// Координаты заданы, но геолокация недоступна
|
||||
Row(
|
||||
children: [
|
||||
const Icon(Icons.location_on, size: 12, color: Colors.white24),
|
||||
const Icon(
|
||||
Icons.location_on,
|
||||
size: 12,
|
||||
color: Colors.white24,
|
||||
),
|
||||
const SizedBox(width: 4),
|
||||
Text(
|
||||
location.error ?? 'Координаты заданы',
|
||||
style: const TextStyle(color: Colors.white24, fontSize: 11),
|
||||
style: const TextStyle(
|
||||
color: Colors.white24,
|
||||
fontSize: 11,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
@@ -130,12 +147,20 @@ class _HomesScreenState extends ConsumerState<HomesScreen> {
|
||||
children: [
|
||||
// Кнопка редактирования
|
||||
IconButton(
|
||||
icon: const Icon(Icons.edit, size: 20, color: Colors.white38),
|
||||
icon: const Icon(
|
||||
Icons.edit,
|
||||
size: 20,
|
||||
color: Colors.white38,
|
||||
),
|
||||
onPressed: () => _editHome(context, home),
|
||||
),
|
||||
// Кнопка удаления
|
||||
IconButton(
|
||||
icon: const Icon(Icons.delete_outline, size: 20, color: Colors.redAccent),
|
||||
icon: const Icon(
|
||||
Icons.delete_outline,
|
||||
size: 20,
|
||||
color: Colors.redAccent,
|
||||
),
|
||||
onPressed: () => _confirmDelete(context, home),
|
||||
),
|
||||
],
|
||||
@@ -166,16 +191,16 @@ class _HomesScreenState extends ConsumerState<HomesScreen> {
|
||||
|
||||
/// Добавить новый дом
|
||||
void _addHome(BuildContext context) {
|
||||
Navigator.of(context).push(
|
||||
MaterialPageRoute(builder: (_) => const HomeEditScreen()),
|
||||
);
|
||||
Navigator.of(
|
||||
context,
|
||||
).push(MaterialPageRoute(builder: (_) => const HomeEditScreen()));
|
||||
}
|
||||
|
||||
/// Редактировать дом
|
||||
void _editHome(BuildContext context, HomeConfig home) {
|
||||
Navigator.of(context).push(
|
||||
MaterialPageRoute(builder: (_) => HomeEditScreen(home: home)),
|
||||
);
|
||||
Navigator.of(
|
||||
context,
|
||||
).push(MaterialPageRoute(builder: (_) => HomeEditScreen(home: home)));
|
||||
}
|
||||
|
||||
/// Подтвердить удаление
|
||||
@@ -197,7 +222,10 @@ class _HomesScreenState extends ConsumerState<HomesScreen> {
|
||||
// Синхронизировать фоновый таск (мог быть удалён дом с геофенсом)
|
||||
await syncGeofenceTask(ref.read(homesProvider));
|
||||
},
|
||||
child: const Text('Удалить', style: TextStyle(color: Colors.redAccent)),
|
||||
child: const Text(
|
||||
'Удалить',
|
||||
style: TextStyle(color: Colors.redAccent),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
|
||||
Reference in New Issue
Block a user