Kitűzés: kényelmi funkciók, pontok listája, export
This commit is contained in:
@@ -0,0 +1,110 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:get/get.dart';
|
||||
|
||||
import '../../../../services/stakeout_service.dart';
|
||||
|
||||
/// Kitűzési beállítások dialógus — a panel fogaskerék-ikonjáról.
|
||||
/// Minden érték a StakeoutService Rx-eiben él, és a service perzisztálja
|
||||
/// (SharedPreferences), így app-újraindítás után is megmaradnak.
|
||||
Future<void> showStakeoutSettingsDialog() async {
|
||||
final svc = StakeoutService.to;
|
||||
|
||||
final tolCtrl = TextEditingController(
|
||||
text: (svc.toleranceXY.value * 100).toStringAsFixed(0));
|
||||
final maxOffCtrl = TextEditingController(
|
||||
text: svc.maxOffset.value > 0
|
||||
? svc.maxOffset.value.toStringAsFixed(1)
|
||||
: '');
|
||||
|
||||
await Get.dialog(AlertDialog(
|
||||
title: const Text('Kitűzési beállítások'),
|
||||
content: SingleChildScrollView(
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
TextField(
|
||||
controller: tolCtrl,
|
||||
keyboardType: TextInputType.number,
|
||||
decoration: const InputDecoration(
|
||||
labelText: 'Tűrés (cm)',
|
||||
helperText: 'A céltábla zöld köre és a "tűrésen belül" jelzés',
|
||||
isDense: true,
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 14),
|
||||
const Text('Átlagolás tároláskor',
|
||||
style: TextStyle(fontSize: 13, fontWeight: FontWeight.w600)),
|
||||
const SizedBox(height: 6),
|
||||
Obx(() => SegmentedButton<int>(
|
||||
segments: const [
|
||||
ButtonSegment(value: 0, label: Text('Ki')),
|
||||
ButtonSegment(value: 3, label: Text('3 s')),
|
||||
ButtonSegment(value: 5, label: Text('5 s')),
|
||||
ButtonSegment(value: 10, label: Text('10 s')),
|
||||
],
|
||||
selected: {svc.averagingSeconds.value},
|
||||
onSelectionChanged: (s) => svc.averagingSeconds.value = s.first,
|
||||
showSelectedIcon: false,
|
||||
style: const ButtonStyle(visualDensity: VisualDensity.compact),
|
||||
)),
|
||||
const SizedBox(height: 4),
|
||||
Text(
|
||||
'Bekapcsolva a "Tárol" a megadott ideig gyűjti és átlagolja '
|
||||
'a pozíciókat — csökkenti a pillanatnyi zaj hatását.',
|
||||
style: TextStyle(fontSize: 11, color: Colors.grey.shade600),
|
||||
),
|
||||
const SizedBox(height: 10),
|
||||
Obx(() => SwitchListTile(
|
||||
contentPadding: EdgeInsets.zero,
|
||||
dense: true,
|
||||
title: const Text('Haptikus visszajelzés'),
|
||||
subtitle: const Text('közeledve sűrűsödő rezgés',
|
||||
style: TextStyle(fontSize: 11)),
|
||||
value: svc.hapticsEnabled.value,
|
||||
onChanged: (v) => svc.hapticsEnabled.value = v,
|
||||
)),
|
||||
Obx(() => SwitchListTile(
|
||||
contentPadding: EdgeInsets.zero,
|
||||
dense: true,
|
||||
title: const Text('Hangjelzés'),
|
||||
subtitle: const Text('kattanás a pulzusokkal, hang a tűrésnél',
|
||||
style: TextStyle(fontSize: 11)),
|
||||
value: svc.soundEnabled.value,
|
||||
onChanged: (v) => svc.soundEnabled.value = v,
|
||||
)),
|
||||
const SizedBox(height: 6),
|
||||
TextField(
|
||||
controller: maxOffCtrl,
|
||||
keyboardType: const TextInputType.numberWithOptions(decimal: true),
|
||||
decoration: const InputDecoration(
|
||||
labelText: 'Max. crossline eltolás (m, üres = nincs korlát)',
|
||||
labelStyle: TextStyle(fontSize: 12),
|
||||
helperText: 'A specifikáció szerinti offset-korlát — '
|
||||
'e fölött az eltolás-dialógus figyelmeztet.',
|
||||
helperMaxLines: 2,
|
||||
isDense: true,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
actions: [
|
||||
TextButton(onPressed: Get.back, child: const Text('Mégse')),
|
||||
FilledButton(
|
||||
onPressed: () async {
|
||||
final tolCm = double.tryParse(tolCtrl.text.replaceAll(',', '.'));
|
||||
if (tolCm != null && tolCm > 0) {
|
||||
svc.toleranceXY.value = tolCm / 100.0;
|
||||
}
|
||||
final maxOff = double.tryParse(maxOffCtrl.text.replaceAll(',', '.'));
|
||||
svc.maxOffset.value = maxOff ?? 0;
|
||||
|
||||
await svc.saveSettings();
|
||||
Get.back();
|
||||
},
|
||||
child: const Text('Mentés'),
|
||||
),
|
||||
],
|
||||
));
|
||||
}
|
||||
Reference in New Issue
Block a user