Kitűzés: kényelmi funkciók, pontok listája, export
This commit is contained in:
@@ -3,6 +3,8 @@ import 'dart:ui' show FontFeature;
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:terepi_seged/pages/map_survey/presentations/widgets/stakeout_list_sheet.dart';
|
||||
import 'package:terepi_seged/pages/map_survey/presentations/widgets/stakeout_settings_dialog.dart';
|
||||
import 'package:terepi_seged/routes/app_pages.dart';
|
||||
import 'package:terepi_seged/services/gnss/gnss_service.dart';
|
||||
import 'package:terepi_seged/services/stakeout_service.dart';
|
||||
@@ -88,7 +90,7 @@ class StakeoutPanel extends StatelessWidget {
|
||||
children: [
|
||||
Text(t.displayId,
|
||||
style: const TextStyle(
|
||||
fontSize: 17, fontWeight: FontWeight.w700)),
|
||||
fontSize: 12, fontWeight: FontWeight.w700)),
|
||||
if (progress != null)
|
||||
Text(
|
||||
'${progress.staked}/${progress.total} kitűzve'
|
||||
@@ -132,6 +134,18 @@ class StakeoutPanel extends StatelessWidget {
|
||||
tooltip: 'Haptikus visszajelzés',
|
||||
onPressed: () => svc.hapticsEnabled.toggle(),
|
||||
)),
|
||||
IconButton(
|
||||
icon: const Icon(Icons.list_alt),
|
||||
visualDensity: VisualDensity.compact,
|
||||
tooltip: 'Pontlista / export',
|
||||
onPressed: () => StakeoutListSheet.show(),
|
||||
),
|
||||
IconButton(
|
||||
icon: Icon(Icons.tune),
|
||||
visualDensity: VisualDensity.compact,
|
||||
tooltip: 'Kitűzési beálítások',
|
||||
onPressed: () => showStakeoutSettingsDialog(),
|
||||
),
|
||||
IconButton(
|
||||
icon: const Icon(Icons.upload_file),
|
||||
visualDensity: VisualDensity.compact,
|
||||
@@ -160,28 +174,60 @@ class StakeoutPanel extends StatelessWidget {
|
||||
children: [
|
||||
IconButton(
|
||||
icon: Icon(svc.nearPhase.value ? Icons.map : Icons.adjust),
|
||||
visualDensity: VisualDensity.compact,
|
||||
padding: EdgeInsets.zero,
|
||||
constraints:
|
||||
const BoxConstraints(minWidth: 36, minHeight: 36),
|
||||
tooltip:
|
||||
svc.nearPhase.value ? 'Térkép-nézet' : 'Céltábla-nézet',
|
||||
onPressed: svc.togglePhase,
|
||||
),
|
||||
OutlinedButton(
|
||||
onPressed: svc.skipCurrent,
|
||||
style: OutlinedButton.styleFrom(
|
||||
visualDensity: VisualDensity.compact,
|
||||
padding: const EdgeInsets.symmetric(horizontal: 10),
|
||||
tapTargetSize: MaterialTapTargetSize.shrinkWrap,
|
||||
),
|
||||
child: const Text('Kihagy'),
|
||||
),
|
||||
const SizedBox(width: 8),
|
||||
const SizedBox(width: 6),
|
||||
OutlinedButton.icon(
|
||||
onPressed: () => _offsetDialog(svc),
|
||||
style: OutlinedButton.styleFrom(
|
||||
visualDensity: VisualDensity.compact,
|
||||
padding: const EdgeInsets.symmetric(horizontal: 10),
|
||||
tapTargetSize: MaterialTapTargetSize.shrinkWrap,
|
||||
),
|
||||
icon: const Icon(Icons.alt_route, size: 18),
|
||||
label: const Text('Eltolás'),
|
||||
),
|
||||
const Spacer(),
|
||||
FilledButton.icon(
|
||||
onPressed: () => _store(svc),
|
||||
style: within
|
||||
? FilledButton.styleFrom(backgroundColor: Colors.green)
|
||||
: null,
|
||||
icon: const Icon(Icons.push_pin),
|
||||
label: const Text('Tárol'),
|
||||
const SizedBox(width: 6),
|
||||
// Expanded: a Tárol tölti ki a maradék helyet —
|
||||
// fix-szélesség-összeg helyett, így nincs overflow.
|
||||
Expanded(
|
||||
child: FilledButton.icon(
|
||||
onPressed:
|
||||
svc.isAveraging.value ? null : () => _store(svc),
|
||||
style: FilledButton.styleFrom(
|
||||
backgroundColor: within ? Colors.green : null,
|
||||
visualDensity: VisualDensity.compact,
|
||||
padding: const EdgeInsets.symmetric(horizontal: 10),
|
||||
),
|
||||
icon: svc.isAveraging.value
|
||||
? const SizedBox(
|
||||
width: 18,
|
||||
height: 18,
|
||||
child: CircularProgressIndicator(strokeWidth: 2))
|
||||
: const Icon(Icons.push_pin, size: 18),
|
||||
label: FittedBox(
|
||||
fit: BoxFit.scaleDown,
|
||||
child: Text(svc.isAveraging.value
|
||||
? 'Átlagolás ${svc.averagingElapsed.value}/'
|
||||
'${svc.averagingSeconds.value} s'
|
||||
: 'Tárol'),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
@@ -241,6 +287,7 @@ class StakeoutPanel extends StatelessWidget {
|
||||
Future<void> _offsetDialog(StakeoutService svc) async {
|
||||
final distCtrl = TextEditingController(text: '2');
|
||||
final toRight = true.obs;
|
||||
final both = false.obs;
|
||||
|
||||
await Get.dialog(AlertDialog(
|
||||
title: const Text('Eltolt pont (transzverzális)'),
|
||||
@@ -284,6 +331,15 @@ class StakeoutPanel extends StatelessWidget {
|
||||
selected: {toRight.value},
|
||||
onSelectionChanged: (s) => toRight.value = s.first,
|
||||
)),
|
||||
Obx(() => CheckboxListTile(
|
||||
contentPadding: EdgeInsets.zero,
|
||||
dense: true,
|
||||
title: const Text('Pár létrehozása (bal ÉS jobb)'),
|
||||
subtitle: const Text('az akadály két oldalára',
|
||||
style: TextStyle(fontSize: 11)),
|
||||
value: both.value,
|
||||
onChanged: (v) => both.value = v ?? false,
|
||||
))
|
||||
],
|
||||
),
|
||||
actions: [
|
||||
@@ -292,14 +348,45 @@ class StakeoutPanel extends StatelessWidget {
|
||||
onPressed: () async {
|
||||
final d = double.tryParse(distCtrl.text.replaceAll(',', '.'));
|
||||
if (d == null || d <= 0) return;
|
||||
|
||||
// Megrendelői offset-korlát ellenőrzése (beállításokból).
|
||||
if (svc.maxOffset.value > 0 && d > svc.maxOffset.value) {
|
||||
final ok = await Get.dialog<bool>(AlertDialog(
|
||||
icon: const Icon(Icons.warning_amber, color: Colors.orange),
|
||||
title: const Text('Offset-korlát túllépése'),
|
||||
content: Text('A megadott ${d.toStringAsFixed(1)} m nagyobb '
|
||||
'a beállított max. ${svc.maxOffset.value.toStringAsFixed(1)} m '
|
||||
'crossline eltolásnál.'),
|
||||
actions: [
|
||||
TextButton(
|
||||
onPressed: () => Get.back(result: false),
|
||||
child: const Text('Mégse')),
|
||||
FilledButton(
|
||||
onPressed: () => Get.back(result: true),
|
||||
child: const Text('Mégis')),
|
||||
],
|
||||
));
|
||||
if (ok != true) return;
|
||||
}
|
||||
|
||||
Get.back();
|
||||
final p = await svc.createOffset(dist: d, toRight: toRight.value);
|
||||
if (p != null) {
|
||||
Get.snackbar(
|
||||
'Eltolt pont létrehozva',
|
||||
'${p.displayId} · ${d.toStringAsFixed(2)} m '
|
||||
'${toRight.value ? 'jobbra' : 'balra'} — ez az új cél.',
|
||||
if (both.value) {
|
||||
// Előbb az ellenoldali, aztán a választott — így a
|
||||
// választott oldal lesz az aktív cél.
|
||||
await svc.createOffset(dist: d, toRight: !toRight.value);
|
||||
await svc.createOffset(dist: d, toRight: toRight.value);
|
||||
Get.snackbar('Eltolt pontpár létrehozva',
|
||||
'±${d.toStringAsFixed(2)} m a vonalra merőlegesen.',
|
||||
snackPosition: SnackPosition.BOTTOM);
|
||||
} else {
|
||||
final p = await svc.createOffset(dist: d, toRight: toRight.value);
|
||||
if (p != null) {
|
||||
Get.snackbar(
|
||||
'Eltolt pont létrehozva',
|
||||
'${p.displayId} · ${d.toStringAsFixed(2)} m '
|
||||
'${toRight.value ? 'jobbra' : 'balra'} — ez az új cél.',
|
||||
snackPosition: SnackPosition.BOTTOM);
|
||||
}
|
||||
}
|
||||
},
|
||||
child: const Text('Létrehozás'),
|
||||
|
||||
Reference in New Issue
Block a user