fix(location): add refresh success feedback and fix queueCommands null crash

This commit is contained in:
2026-04-26 05:41:21 +02:00
parent bef87262b1
commit 2d87cd5aee
5 changed files with 16 additions and 13 deletions

View File

@@ -73,11 +73,9 @@ class LocationScreen extends ConsumerWidget {
.read(legacyDeviceViewModelProvider.notifier)
.setSelectedDevice(device);
},
onRefreshPosition: () {
ref
.read(legacyDeviceViewModelProvider.notifier)
.refreshPositions();
},
onRefreshPosition: () => ref
.read(legacyDeviceViewModelProvider.notifier)
.refreshPositions(),
),
);
}

View File

@@ -47,7 +47,7 @@ class LocationMap extends ConsumerStatefulWidget {
final bool showRouteTrail;
final bool isLoadingHistory;
final ValueChanged<DeviceEntity> onDeviceChanged;
final VoidCallback onRefreshPosition;
final Future<void> Function() onRefreshPosition;
const LocationMap({
super.key,
@@ -685,9 +685,14 @@ class _LocationMapState extends ConsumerState<LocationMap>
unawaited(
ref.read(sfTrackingProvider).legacyLocationMapRefreshTapped(),
);
widget.onRefreshPosition();
if (!mounted) return;
await showInfoDialog(context, I18n.locationMapRefreshRequested);
try {
await widget.onRefreshPosition();
if (!mounted) return;
await showSuccessDialog(context, I18n.positionUpdated);
} catch (_) {
if (!mounted) return;
await showErrorDialog(context, I18n.errorPositions);
}
},
onCenterTap: _centerOnDevice,
onToggleFollow: () async {