stopNavigation method

Future<void> stopNavigation()

Implementation

Future<void> stopNavigation() async {
  if (_navigationController == null) return;

  try {
    debugPrint('[DEBUG] Stopping navigation... at ${DateTime.now()}');

    // Note: Wakelock functionality removed due to dependency issues
    debugPrint('[DEBUG] Screen wakelock would be disabled here at ${DateTime.now()}');

    // Set navigation inactive in location service
    _locationService.setNavigationActive(false);
    debugPrint('[DEBUG] Navigation marked as inactive in location service at ${DateTime.now()}');

    await _navigationController!.stopNavigation();

    _routeOverviewMode = true;
    notifyListeners();

    // Use CameraController to return to route overview
    if (_routeDetails != null && _cameraController != null) {
      await _cameraController!.enterRouteOverviewMode(_routeDetails!);
    }
  } catch (e) {
    debugPrint('[ERROR] Error stopping navigation: $e');
    _showError('Failed to stop navigation');
  }
}