mirror of
https://github.com/FoggedLens/deflock-app.git
synced 2026-07-07 13:17:53 +02:00
nav UX tweaks
This commit is contained in:
+1
-1
@@ -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';
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
|
||||
|
||||
@@ -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(),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
|
||||
|
||||
Reference in New Issue
Block a user