fix: return to sensors list after cancelling reposition only if you've arrived from there
This commit is contained in:
@@ -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');
|
||||
},
|
||||
),
|
||||
),
|
||||
|
||||
Reference in New Issue
Block a user