Térképi rétegkezelő lérehozása, track online mentésének előkészítése

This commit is contained in:
2026-06-12 13:41:36 +02:00
parent 644201dc8a
commit beb07fe007
10 changed files with 169 additions and 55 deletions
@@ -5,6 +5,7 @@ import 'package:get/get.dart';
import 'package:intl/intl.dart';
import 'package:latlong2/latlong.dart';
import 'package:share_plus/share_plus.dart';
import 'package:terepi_seged/services/project_service.dart';
import '../../../../services/location_source.dart';
import '../../../../services/phone_gps_source.dart';
@@ -116,19 +117,23 @@ class TrackingController extends GetxController {
// ── Publikus API ───────────────────────────────────────────────────────────
/// Elindítja a rögzítést a megadott forrással (alapértelmezett: telefon GPS).
Future<void> startRecording({LocationSource? source}) async {
Future<void> startRecording(
{LocationSource? source,
String? name,
TrackSyncMode syncMode = TrackSyncMode.online}) async {
if (isRecording.value) return;
_source = source ?? PhoneGpsSource(intervalMs: 1000, distanceFilter: 2.0);
// Track létrehozása az adatbázisban
final now = DateTime.now();
final name = DateFormat('yyyy-MM-dd HH:mm').format(now);
final trackName = name ?? DateFormat('yyyy-MM-dd HH:mm').format(now);
final trackId = await _db.insertTrack(Track(
name: name,
startTime: now,
source: _source!.displayName,
));
name: trackName,
startTime: now,
source: _source!.displayName,
projectId: ProjectService.to.activeProjectId,
syncMode: syncMode));
currentTrack.value = await _db.getTrack(trackId);
// Állapot reset
@@ -141,7 +146,7 @@ class TrackingController extends GetxController {
// Foreground service indítása (háttér-működéshez)
await FlutterForegroundTask.startService(
notificationTitle: 'Track rögzítése',
notificationText: name,
notificationText: trackName,
callback: startTrackingCallback,
);