Files
companion/lib/features/sensors/sensor_detail_screen.dart
T
2026-05-07 18:35:58 +02:00

61 lines
2.0 KiB
Dart

import 'package:flutter/material.dart';
import 'package:flutter_riverpod/flutter_riverpod.dart';
import 'package:go_router/go_router.dart';
import '../../providers.dart';
class SensorDetailScreen extends ConsumerWidget {
const SensorDetailScreen({super.key, required this.sensorId});
final String sensorId;
@override
Widget build(BuildContext context, WidgetRef ref) {
// TODO: fetch sensor via sensorRepositoryProvider.getSensor(sensorId).
return Scaffold(
appBar: AppBar(title: Text('Sensor $sensorId')),
body: Padding(
padding: const EdgeInsets.all(24),
child: Column(
crossAxisAlignment: CrossAxisAlignment.stretch,
children: [
// TODO: display sensor fields (name, status, position, last seen).
const Placeholder(fallbackHeight: 200),
const SizedBox(height: 24),
OutlinedButton.icon(
icon: const Icon(Icons.map_outlined),
label: const Text('Locate on floor plan'),
onPressed: () {
ref.read(selectedSensorIdProvider.notifier).state = sensorId;
context.go('/floorplan');
},
),
const SizedBox(height: 12),
// TODO: re-provision button → show BleProvisionSheet pre-filled.
OutlinedButton.icon(
icon: const Icon(Icons.bluetooth),
label: const Text('Re-provision WiFi'),
onPressed: () {}, // TODO
),
const SizedBox(height: 12),
OutlinedButton.icon(
icon: const Icon(Icons.edit_outlined),
label: const Text('Rename'),
onPressed: () {}, // TODO
),
const Spacer(),
TextButton(
style: TextButton.styleFrom(
foregroundColor: Theme.of(context).colorScheme.error,
),
onPressed: () {}, // TODO: confirm dialog then delete
child: const Text('Delete sensor'),
),
],
),
),
);
}
}