Bejárás mód: pont leírás mentése
This commit is contained in:
@@ -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));
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user