Bejárás mód: pont leírás mentése
This commit is contained in:
parent
52bce4b925
commit
026d7799f9
@ -1787,4 +1787,53 @@ class MapSurveyController extends GetxController {
|
||||
ignoreSafeArea: false,
|
||||
);
|
||||
}
|
||||
|
||||
// ----- Terepbejárás pont mentése
|
||||
void showSavePointDialog({required LatLng point}) {
|
||||
final labelCtrl = TextEditingController();
|
||||
|
||||
Get.dialog(
|
||||
AlertDialog(
|
||||
title: const Text('Pont mentése'),
|
||||
content: TextField(
|
||||
controller: labelCtrl,
|
||||
autofocus: true,
|
||||
decoration: const InputDecoration(
|
||||
hintText: 'Pont neve (opcionális)',
|
||||
border: OutlineInputBorder(),
|
||||
),
|
||||
textCapitalization: TextCapitalization.sentences,
|
||||
onSubmitted: (_) => _doSavePoint(point, labelCtrl.text),
|
||||
),
|
||||
actions: [
|
||||
TextButton(
|
||||
onPressed: Get.back,
|
||||
child: const Text('Mégse'),
|
||||
),
|
||||
FilledButton(
|
||||
onPressed: () => _doSavePoint(point, labelCtrl.text),
|
||||
child: const Text('Mentés'),
|
||||
),
|
||||
],
|
||||
),
|
||||
barrierDismissible: false,
|
||||
);
|
||||
}
|
||||
|
||||
void _doSavePoint(LatLng point, String label) {
|
||||
activeEditLabel.value = label.trim();
|
||||
Get.back();
|
||||
saveEditedPoint(point: point);
|
||||
}
|
||||
|
||||
void savePointFromCurrentPosition() {
|
||||
final lat = currentLatitude.value;
|
||||
final lon = currentLongitude.value;
|
||||
if (lat == 0.0 && lon == 0.0) {
|
||||
Get.snackbar('Hiba', 'GPS pozíció nem elérhető',
|
||||
snackPosition: SnackPosition.BOTTOM);
|
||||
return;
|
||||
}
|
||||
showSavePointDialog(point: LatLng(lat, lon));
|
||||
}
|
||||
}
|
||||
|
||||
@ -51,7 +51,8 @@ class MapSurveyView extends GetView<MapSurveyController> {
|
||||
onCenterOnGps: controller.setIsMapMoveToCenter,
|
||||
onLongPress: (tapPosition, point) {
|
||||
if (controller.activeEditTool.value == MapEditTool.point) {
|
||||
controller.saveEditedPoint(point: point);
|
||||
//controller.saveEditedPoint(point: point);
|
||||
controller.showSavePointDialog(point: point);
|
||||
}
|
||||
if (controller.activeEditTool.value == MapEditTool.line ||
|
||||
controller.activeEditTool.value == MapEditTool.polygon) {
|
||||
|
||||
@ -1,6 +1,9 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:terepi_seged/pages/map_survey/presentations/controllers/map_survey_controller.dart';
|
||||
import 'package:terepi_seged/services/gnss/gnss_connection.dart';
|
||||
import 'package:terepi_seged/services/gnss/gnss_device_service.dart';
|
||||
import 'package:terepi_seged/services/gnss/gnss_service.dart';
|
||||
|
||||
import 'map_edit_small_status_chip.dart';
|
||||
|
||||
@ -78,22 +81,25 @@ class PointDrawingContent extends StatelessWidget {
|
||||
Expanded(
|
||||
child: OutlinedButton.icon(
|
||||
//onPressed: controller.addPointFromCurrentPosition,
|
||||
onPressed: () {},
|
||||
onPressed: GnssService.to.connectionState.value ==
|
||||
GnssConnectionState.connected
|
||||
? controller.savePointFromCurrentPosition
|
||||
: null,
|
||||
icon: const Icon(Icons.my_location, size: 18),
|
||||
label: const Text('Saját hely'),
|
||||
),
|
||||
),
|
||||
const SizedBox(width: 8),
|
||||
Expanded(
|
||||
child: FilledButton.icon(
|
||||
// onPressed: controller.canFinishGeometry
|
||||
// ? controller.finishGeometry
|
||||
// : null,
|
||||
onPressed: () {},
|
||||
icon: const Icon(Icons.check, size: 18),
|
||||
label: const Text('Kész'),
|
||||
),
|
||||
),
|
||||
// const SizedBox(width: 8),
|
||||
// Expanded(
|
||||
// child: FilledButton.icon(
|
||||
// // onPressed: controller.canFinishGeometry
|
||||
// // ? controller.finishGeometry
|
||||
// // : null,
|
||||
// onPressed: () {},
|
||||
// icon: const Icon(Icons.check, size: 18),
|
||||
// label: const Text('Kész'),
|
||||
// ),
|
||||
// ),
|
||||
],
|
||||
),
|
||||
],
|
||||
|
||||
Loading…
Reference in New Issue
Block a user