Refactor excursion_main.dart to implement a confirmation dialog on page exit, allowing users to save templates or exit without saving. Update TrackingService to support instance reset for better state management.
This commit is contained in:
@@ -9,10 +9,22 @@ import 'package:latlong2/latlong.dart';
|
||||
import 'package:shared_preferences/shared_preferences.dart';
|
||||
|
||||
class TrackingService {
|
||||
static final TrackingService _instance = TrackingService._internal();
|
||||
factory TrackingService() => _instance;
|
||||
static TrackingService? _instance;
|
||||
|
||||
factory TrackingService() {
|
||||
_instance ??= TrackingService._internal();
|
||||
return _instance!;
|
||||
}
|
||||
|
||||
TrackingService._internal();
|
||||
|
||||
static void resetInstance() {
|
||||
if (_instance != null) {
|
||||
_instance!.dispose();
|
||||
_instance = null;
|
||||
}
|
||||
}
|
||||
|
||||
List<LatLng> pathList = [];
|
||||
List<double> accuracyList = [];
|
||||
Timer? _positionTimer;
|
||||
|
||||
Reference in New Issue
Block a user