Tracking funkció fejlesztése

This commit is contained in:
2026-06-11 01:20:55 +02:00
parent 2364b2311c
commit 01e6105240
18 changed files with 858 additions and 162 deletions
@@ -6,6 +6,7 @@ import 'package:latlong2/latlong.dart';
import 'package:terepi_seged/enums/map_survey_mode.dart';
import 'package:terepi_seged/pages/map_survey/presentations/controllers/map_survey_controller.dart';
import 'package:terepi_seged/pages/map_survey/presentations/views/settings_dialog.dart';
import 'package:terepi_seged/pages/tracking/presentation/controllers/tracking_controller.dart';
import 'package:terepi_seged/utils/rive_utils.dart';
import 'package:terepi_seged/widgets/coordinate_panel.dart';
import 'package:terepi_seged/widgets/map_bottom_panel.dart';
@@ -29,7 +30,18 @@ class MapSurveyView extends GetView<MapSurveyController> {
onCenterOnGps: controller.isMapMoveToCenter,
layers: [
Obx(() =>
MarkerLayer(markers: controller.currentLocationMarker.toList()))
MarkerLayer(markers: controller.currentLocationMarker.toList())),
// Track polyline
Obx(() {
final isTracking = TrackingController.to.isRecording.value;
final inTrackMode = controller.mode.value == MapSurveyMode.track;
if (!isTracking && !inTrackMode) {
return const SizedBox.shrink();
} else {
return _buildTrackLayer();
}
})
],
),
Positioned(
@@ -78,6 +90,23 @@ class MapSurveyView extends GetView<MapSurveyController> {
// child: MapBottomPanel(controller: controller))
]);
}
Widget _buildTrackLayer() {
// FutureBuilder helyett a controller livePoints-ból
return Obx(() {
final ctrl = TrackingController.to;
if (ctrl.livePoints.isEmpty) return const SizedBox.shrink();
return PolylineLayer(polylines: [
Polyline(
points: ctrl.livePoints
.map((p) => LatLng(p.latitude, p.longitude))
.toList(),
color: Colors.red.withOpacity(0.85),
strokeWidth: 3.0,
),
]);
});
}
}
class _ModeSelector extends GetView<MapSurveyController> {