fix: return to sensors list after cancelling reposition only if you've arrived from there

This commit is contained in:
2026-05-18 19:27:08 +02:00
parent 74aeb3589b
commit c54631bcb6
3 changed files with 13 additions and 2 deletions
@@ -80,6 +80,7 @@ class _FloorPlanScreenState extends ConsumerState<FloorPlanScreen> {
void _cancelPlacement() {
ref.read(sensorPlacementProvider.notifier).state = null;
ref.read(sensorPlacementOriginSensorsProvider.notifier).state = false;
}
@override
@@ -135,8 +136,9 @@ class _FloorPlanScreenState extends ConsumerState<FloorPlanScreen> {
canPop: placingSensor == null,
onPopInvokedWithResult: (didPop, _) {
if (!didPop && placingSensor != null) {
final fromSensors = ref.read(sensorPlacementOriginSensorsProvider);
_cancelPlacement();
context.go('/sensors');
if (fromSensors) context.go('/sensors');
}
},
child: Scaffold(
@@ -276,8 +278,10 @@ class _FloorPlanScreenState extends ConsumerState<FloorPlanScreen> {
sensor: placingSensor,
onPlace: () => _confirmPlacement(placingSensor),
onCancel: () {
final fromSensors =
ref.read(sensorPlacementOriginSensorsProvider);
_cancelPlacement();
context.go('/sensors');
if (fromSensors) context.go('/sensors');
},
),
),