Terepbejárás geometriák szerkesztése: kontrollpontok és tulajdonságok.
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:terepi_seged/enums/map_edit_tool.dart';
|
||||
import 'package:terepi_seged/pages/map_survey/presentations/controllers/map_survey_controller.dart';
|
||||
|
||||
@@ -56,10 +57,14 @@ class MapFeatureSaveSheet extends StatelessWidget {
|
||||
const SizedBox(height: 18),
|
||||
OpacitySlider(ctrl: ctrl),
|
||||
const SizedBox(height: 10),
|
||||
if (ctrl.activeEditTool.value != MapEditTool.point) ...[
|
||||
StrokeSlider(ctrl: ctrl),
|
||||
const SizedBox(height: 10),
|
||||
],
|
||||
Obx(() => ctrl.activeEditTool.value != MapEditTool.point
|
||||
? Column(children: [
|
||||
StrokeSlider(ctrl: ctrl),
|
||||
const SizedBox(
|
||||
height: 1,
|
||||
)
|
||||
])
|
||||
: const SizedBox.shrink()),
|
||||
LabelField(ctrl: ctrl),
|
||||
const SizedBox(height: 24),
|
||||
SaveSheetActions(ctrl: ctrl),
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:terepi_seged/enums/map_edit_tool.dart';
|
||||
import 'package:terepi_seged/pages/map_survey/presentations/controllers/map_survey_controller.dart';
|
||||
|
||||
class SaveSheetActions extends StatelessWidget {
|
||||
@@ -8,44 +9,142 @@ class SaveSheetActions extends StatelessWidget {
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Row(children: [
|
||||
// ← Vissza — bezárja a sheet-et, folytatja a rajzolást
|
||||
Expanded(
|
||||
child: OutlinedButton.icon(
|
||||
style: OutlinedButton.styleFrom(
|
||||
padding: const EdgeInsets.symmetric(vertical: 14),
|
||||
shape:
|
||||
RoundedRectangleBorder(borderRadius: BorderRadius.circular(10)),
|
||||
),
|
||||
icon: const Icon(Icons.arrow_back, size: 18),
|
||||
label: const Text('Vissza'),
|
||||
onPressed: () => Navigator.pop(context),
|
||||
),
|
||||
),
|
||||
const SizedBox(width: 12),
|
||||
return Obx(() {
|
||||
final isEditing = ctrl.isGeometryEditing;
|
||||
final tool = ctrl.activeEditTool.value;
|
||||
final isPoint = tool == MapEditTool.point;
|
||||
|
||||
// Mentés — végleges mentés, mindkét sheet bezárása
|
||||
Expanded(
|
||||
flex: 2,
|
||||
child: Obx(() => FilledButton.icon(
|
||||
style: FilledButton.styleFrom(
|
||||
backgroundColor: ctrl.activeEditColor.value,
|
||||
padding: const EdgeInsets.symmetric(vertical: 14),
|
||||
shape: RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.circular(10)),
|
||||
return Column(mainAxisSize: MainAxisSize.min, children: [
|
||||
Row(children: [
|
||||
Expanded(
|
||||
child: OutlinedButton.icon(
|
||||
style: OutlinedButton.styleFrom(
|
||||
padding: const EdgeInsets.symmetric(vertical: 14),
|
||||
shape: RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.circular(10))),
|
||||
icon: Icon(
|
||||
isEditing ? Icons.close : Icons.arrow_back,
|
||||
size: 18,
|
||||
),
|
||||
label: Text(isEditing ? 'Mégse' : 'Vissza'),
|
||||
onPressed: () => Get.back(),
|
||||
),
|
||||
),
|
||||
const SizedBox(width: 12),
|
||||
Expanded(
|
||||
flex: 2,
|
||||
child: FilledButton.icon(
|
||||
style: FilledButton.styleFrom(
|
||||
backgroundColor: ctrl.activeEditColor.value,
|
||||
padding: const EdgeInsets.symmetric(vertical: 14),
|
||||
shape: RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.circular(10))),
|
||||
icon: const Icon(Icons.check, size: 18),
|
||||
label: const Text(
|
||||
'Mentés',
|
||||
style: TextStyle(fontWeight: FontWeight.w600, fontSize: 15),
|
||||
),
|
||||
onPressed: () async {
|
||||
//Navigator.pop(context); // style sheet bezárás
|
||||
Get.back();
|
||||
await ctrl.finishDraft();
|
||||
},
|
||||
)),
|
||||
),
|
||||
]);
|
||||
),
|
||||
)
|
||||
]),
|
||||
if (isEditing && !isPoint) ...[
|
||||
const SizedBox(height: 8),
|
||||
SizedBox(
|
||||
width: double.infinity,
|
||||
child: OutlinedButton.icon(
|
||||
style: OutlinedButton.styleFrom(
|
||||
padding: const EdgeInsets.symmetric(vertical: 12),
|
||||
shape: RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.circular(10)),
|
||||
),
|
||||
icon: const Icon(Icons.edit_outlined, size: 18),
|
||||
label: const Text('Geometria szerkesztése'),
|
||||
onPressed: () {
|
||||
Get.back();
|
||||
ctrl.startGeometryEdit();
|
||||
},
|
||||
),
|
||||
),
|
||||
],
|
||||
if (isEditing) ...[
|
||||
const SizedBox(height: 8),
|
||||
SizedBox(
|
||||
width: double.infinity,
|
||||
child: OutlinedButton.icon(
|
||||
style: OutlinedButton.styleFrom(
|
||||
foregroundColor: Colors.red,
|
||||
side: const BorderSide(color: Colors.red),
|
||||
padding: const EdgeInsets.symmetric(vertical: 12),
|
||||
shape: RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.circular(10))),
|
||||
icon: const Icon(Icons.delete_outline, size: 18),
|
||||
label: const Text('Törlés'),
|
||||
onPressed: () => _confirmDelete(context, ctrl),
|
||||
),
|
||||
)
|
||||
]
|
||||
]);
|
||||
});
|
||||
}
|
||||
// return Row(children: [
|
||||
// // ← Vissza — bezárja a sheet-et, folytatja a rajzolást
|
||||
// Expanded(
|
||||
// child: OutlinedButton.icon(
|
||||
// style: OutlinedButton.styleFrom(
|
||||
// padding: const EdgeInsets.symmetric(vertical: 14),
|
||||
// shape: RoundedRectangleBorder(
|
||||
// borderRadius: BorderRadius.circular(10)),
|
||||
// ),
|
||||
// icon: const Icon(Icons.arrow_back, size: 18),
|
||||
// label: const Text('Vissza'),
|
||||
// onPressed: () => Navigator.pop(context),
|
||||
// ),
|
||||
// ),
|
||||
// const SizedBox(width: 12),
|
||||
|
||||
// // Mentés — végleges mentés, mindkét sheet bezárása
|
||||
// Expanded(
|
||||
// flex: 2,
|
||||
// child: Obx(() => FilledButton.icon(
|
||||
// style: FilledButton.styleFrom(
|
||||
// backgroundColor: ctrl.activeEditColor.value,
|
||||
// padding: const EdgeInsets.symmetric(vertical: 14),
|
||||
// shape: RoundedRectangleBorder(
|
||||
// borderRadius: BorderRadius.circular(10)),
|
||||
// ),
|
||||
// icon: const Icon(Icons.check, size: 18),
|
||||
// label: const Text(
|
||||
// 'Mentés',
|
||||
// style: TextStyle(fontWeight: FontWeight.w600, fontSize: 15),
|
||||
// ),
|
||||
// onPressed: () async {
|
||||
// //Navigator.pop(context); // style sheet bezárás
|
||||
// Get.back();
|
||||
// await ctrl.finishDraft();
|
||||
// },
|
||||
// )),
|
||||
// ),
|
||||
// ]);
|
||||
void _confirmDelete(BuildContext context, MapSurveyController ctrl) {
|
||||
Get.dialog(AlertDialog(
|
||||
title: const Text('Elem törlése'),
|
||||
content: const Text('Ez az elem véglegesen törlődik.'),
|
||||
actions: [
|
||||
TextButton(onPressed: Get.back, child: const Text('Mégse')),
|
||||
FilledButton(
|
||||
style: FilledButton.styleFrom(backgroundColor: Colors.red),
|
||||
onPressed: () async {
|
||||
Get.back(); // dialóg
|
||||
Get.back(); // sheet
|
||||
await ctrl.deleteEditingItem();
|
||||
},
|
||||
child: const Text('Törlés'),
|
||||
),
|
||||
],
|
||||
));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -8,6 +8,7 @@ class SharedMapWidget extends StatelessWidget {
|
||||
final MapController mapController;
|
||||
final List<Widget> layers;
|
||||
final void Function(TapPosition, LatLng)? onLongPress;
|
||||
final void Function(TapPosition, LatLng)? onTap;
|
||||
final void Function(MapCamera, bool)? onPositionChanged;
|
||||
|
||||
final MapControls controls;
|
||||
@@ -33,6 +34,7 @@ class SharedMapWidget extends StatelessWidget {
|
||||
required this.mapController,
|
||||
this.layers = const [],
|
||||
this.onLongPress,
|
||||
this.onTap,
|
||||
this.onPositionChanged,
|
||||
this.controls = const MapControls(),
|
||||
this.initialCenter = const LatLng(47.5, 19.0),
|
||||
@@ -61,6 +63,7 @@ class SharedMapWidget extends StatelessWidget {
|
||||
minZoom: minZoom,
|
||||
maxZoom: maxZoom,
|
||||
onLongPress: onLongPress,
|
||||
onTap: onTap,
|
||||
onPositionChanged: onPositionChanged,
|
||||
interactionOptions: const InteractionOptions(
|
||||
flags: InteractiveFlag.all,
|
||||
|
||||
Reference in New Issue
Block a user