diff --git a/assets/changelog.json b/assets/changelog.json index 9907e16..10f7186 100644 --- a/assets/changelog.json +++ b/assets/changelog.json @@ -1,4 +1,10 @@ { + "1.6.3": { + "content": [ + "• Fixed navigation sheet button flow - route to/from buttons no longer reappear after selecting second location", + "• Added cancel button when selecting second route point for easier exit from route planning" + ] + }, "1.6.2": { "content": [ "• Improved node rendering bounds - nodes appear slightly before sliding into view and stay visible until just after sliding out, eliminating edge blinking", diff --git a/lib/dev_config.dart b/lib/dev_config.dart index 3af60e8..2fc1fd2 100644 --- a/lib/dev_config.dart +++ b/lib/dev_config.dart @@ -61,7 +61,7 @@ const Duration kChangesetAutoCloseTimeout = Duration(minutes: 59); // Give up an const double kChangesetCloseBackoffMultiplier = 2.0; // Navigation routing configuration -const Duration kNavigationRoutingTimeout = Duration(seconds: 30); // HTTP timeout for routing requests +const Duration kNavigationRoutingTimeout = Duration(seconds: 60); // HTTP timeout for routing requests // Suspected locations CSV URL const String kSuspectedLocationsCsvUrl = 'https://alprwatch.org/suspected-locations/deflock-latest.csv'; diff --git a/lib/state/navigation_state.dart b/lib/state/navigation_state.dart index f090c64..ea7d488 100644 --- a/lib/state/navigation_state.dart +++ b/lib/state/navigation_state.dart @@ -207,8 +207,15 @@ class NavigationState extends ChangeNotifier { _routeEndAddress = _provisionalPinAddress; } + // BRUTALIST FIX: Set calculating state BEFORE clearing isSettingSecondPoint + // to prevent UI from briefly showing route buttons again _isSettingSecondPoint = false; + _isCalculating = true; _routingError = null; // Clear any previous errors + + // Notify listeners immediately to update UI before async calculation starts + notifyListeners(); + _calculateRoute(); } diff --git a/lib/widgets/navigation_sheet.dart b/lib/widgets/navigation_sheet.dart index 4912d50..d4d2570 100644 --- a/lib/widgets/navigation_sheet.dart +++ b/lib/widgets/navigation_sheet.dart @@ -93,8 +93,14 @@ class NavigationSheet extends StatelessWidget { children: [ _buildDragHandle(), - // SEARCH MODE: Initial location with route options - if (navigationMode == AppNavigationMode.search && !appState.isSettingSecondPoint && !appState.isCalculating && !appState.showingOverview && provisionalLocation != null) ...[ + // SEARCH MODE: Initial location with route options (only when no route points are set yet) + if (navigationMode == AppNavigationMode.search && + !appState.isSettingSecondPoint && + !appState.isCalculating && + !appState.showingOverview && + provisionalLocation != null && + appState.routeStart == null && + appState.routeEnd == null) ...[ _buildLocationInfo( label: LocalizationService.instance.t('navigation.location'), coordinates: provisionalLocation, @@ -185,13 +191,27 @@ class NavigationSheet extends StatelessWidget { const SizedBox(height: 16), ], - ElevatedButton.icon( - icon: const Icon(Icons.check), - label: Text(LocalizationService.instance.t('navigation.selectLocation')), - onPressed: appState.areRoutePointsTooClose ? null : () { - debugPrint('[NavigationSheet] Select Location button pressed'); - appState.selectSecondRoutePoint(); - }, + Row( + children: [ + Expanded( + child: ElevatedButton.icon( + icon: const Icon(Icons.check), + label: Text(LocalizationService.instance.t('navigation.selectLocation')), + onPressed: appState.areRoutePointsTooClose ? null : () { + debugPrint('[NavigationSheet] Select Location button pressed'); + appState.selectSecondRoutePoint(); + }, + ), + ), + const SizedBox(width: 12), + Expanded( + child: ElevatedButton.icon( + icon: const Icon(Icons.close), + label: Text(LocalizationService.instance.t('actions.cancel')), + onPressed: () => appState.cancelNavigation(), + ), + ), + ], ), ], diff --git a/pubspec.yaml b/pubspec.yaml index d56f073..605df20 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,7 +1,7 @@ name: deflockapp description: Map public surveillance infrastructure with OpenStreetMap publish_to: "none" -version: 1.6.2+28 # The thing after the + is the version code, incremented with each release +version: 1.6.3+29 # The thing after the + is the version code, incremented with each release environment: sdk: ">=3.5.0 <4.0.0" # oauth2_client 4.x needs Dart 3.5+