350 lines
15 KiB
Dart
350 lines
15 KiB
Dart
import 'package:flutter/material.dart';
|
|
import 'package:flutter/services.dart';
|
|
import 'package:get/get.dart';
|
|
import 'package:terepi_seged/pages/map/presentation/controllers/map_controller.dart';
|
|
import 'package:terepi_seged/pages/navigation/presentation/controllers/navigation_controller.dart';
|
|
|
|
class SettingsDialog extends StatelessWidget {
|
|
final controller = Get.find<NavigationViewController>();
|
|
SettingsDialog({super.key});
|
|
|
|
Widget build(BuildContext context) {
|
|
return Scaffold(
|
|
body: ListView(
|
|
children: [
|
|
Padding(
|
|
padding: const EdgeInsets.all(8.0),
|
|
child: Row(
|
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
|
children: [
|
|
IconButton(
|
|
onPressed: () {
|
|
if (controller.ntripUsernameController.text.isNotEmpty) {
|
|
controller.ntripUserName.value =
|
|
controller.ntripUsernameController.text;
|
|
controller.saveNtripUserName(
|
|
controller.ntripUsernameController.text);
|
|
if (controller
|
|
.ntripPasswordController.text.isNotEmpty) {
|
|
controller.ntripPassword.value =
|
|
controller.ntripPasswordController.text;
|
|
controller.saveNtripPassword(
|
|
controller.ntripPasswordController.text);
|
|
}
|
|
if (controller
|
|
.vehicleNumberController.text.isNotEmpty) {
|
|
controller.vehicleNumber.value = int.parse(
|
|
controller.vehicleNumberController.text);
|
|
controller.saveVehicleNumber(int.parse(
|
|
controller.vehicleNumberController.text));
|
|
}
|
|
}
|
|
Get.back();
|
|
},
|
|
icon: const Icon(Icons.close)),
|
|
TextButton(
|
|
style: ButtonStyle(
|
|
overlayColor:
|
|
MaterialStateProperty.all(Colors.transparent)),
|
|
onPressed: () {
|
|
if (controller.ntripUsernameController.text.isNotEmpty) {
|
|
controller.ntripUserName.value =
|
|
controller.ntripUsernameController.text;
|
|
controller.saveNtripUserName(
|
|
controller.ntripUsernameController.text);
|
|
if (controller
|
|
.ntripPasswordController.text.isNotEmpty) {
|
|
controller.ntripPassword.value =
|
|
controller.ntripPasswordController.text;
|
|
controller.saveNtripPassword(
|
|
controller.ntripPasswordController.text);
|
|
}
|
|
if (controller
|
|
.vehicleNumberController.text.isNotEmpty) {
|
|
controller.vehicleNumber.value = int.parse(
|
|
controller.vehicleNumberController.text);
|
|
controller.saveVehicleNumber(int.parse(
|
|
controller.vehicleNumberController.text));
|
|
}
|
|
}
|
|
Get.back();
|
|
},
|
|
child: const Text(
|
|
'Bezár',
|
|
style: TextStyle(color: Colors.blue, fontSize: 14.0),
|
|
))
|
|
],
|
|
),
|
|
),
|
|
const Padding(
|
|
padding: EdgeInsets.symmetric(horizontal: 40.0),
|
|
child: Text(
|
|
'Beállítások',
|
|
style: TextStyle(fontSize: 20.0, fontWeight: FontWeight.bold),
|
|
),
|
|
),
|
|
const Padding(
|
|
padding: EdgeInsets.symmetric(horizontal: 40.0),
|
|
child: Text(
|
|
'GPS vevő',
|
|
style: TextStyle(fontSize: 14.0, fontWeight: FontWeight.w500),
|
|
),
|
|
),
|
|
Obx(() => Column(children: [
|
|
RadioListTile(
|
|
title: Text('TiGNSS Rover-BE6A'),
|
|
value: '10:06:1C:97:BE:6A',
|
|
groupValue: controller.gpsAddress.value,
|
|
onChanged: (value) {
|
|
controller.gpsAddress.value = value!;
|
|
controller.gpsName.value = 'TiGNSS Rover-BE6A';
|
|
controller.saveGpsAddress(value);
|
|
controller.saveGpsName('TiGNSS Rover-BE6A');
|
|
}),
|
|
RadioListTile(
|
|
title: Text('TiGNSS Rover-1DC6'),
|
|
value: 'E8:31:CD:16:1D:C6',
|
|
groupValue: controller.gpsAddress.value,
|
|
onChanged: (value) {
|
|
controller.gpsAddress.value = value!;
|
|
controller.gpsName.value = 'TiGNSS Rover-1DC6';
|
|
controller.saveGpsAddress(value);
|
|
controller.saveGpsName('TiGNSS Rover-1DC6');
|
|
}),
|
|
RadioListTile(
|
|
title: Text('TiGNSS Rover-9C3A'),
|
|
value: '08:3A:8D:14:9C:3A',
|
|
groupValue: controller.gpsAddress.value,
|
|
onChanged: (value) {
|
|
controller.gpsAddress.value = value!;
|
|
controller.gpsName.value = 'TiGNSS Rover-9C3A';
|
|
controller.saveGpsAddress(value);
|
|
controller.saveGpsName('TiGNSS Rover-9C3A');
|
|
}),
|
|
RadioListTile(
|
|
title: Text('TiGNSS Rover-72C2'),
|
|
value: '10:06:1C:97:72:C2',
|
|
groupValue: controller.gpsAddress.value,
|
|
onChanged: (value) {
|
|
controller.gpsAddress.value = value!;
|
|
controller.gpsName.value = 'TiGNSS Rover-72C2';
|
|
controller.saveGpsAddress(value);
|
|
controller.saveGpsName('TiGNSS Rover-72C2');
|
|
}),
|
|
RadioListTile(
|
|
title: Text('TiGNSS Rover-FE16'),
|
|
value: '10:06:1C:9F:FE:16',
|
|
groupValue: controller.gpsAddress.value,
|
|
onChanged: (value) {
|
|
controller.gpsAddress.value = value!;
|
|
controller.gpsName.value = 'TiGNSS Rover-FE16';
|
|
controller.saveGpsAddress(value);
|
|
controller.saveGpsName('TiGNSS Rover-FE16');
|
|
}),
|
|
RadioListTile(
|
|
title: Text('TiGNSS Rover-3B0A'),
|
|
value: '10:C6:1C:9E:3B:0A',
|
|
groupValue: controller.gpsAddress.value,
|
|
onChanged: (value) {
|
|
controller.gpsAddress.value = value!;
|
|
controller.gpsName.value = 'TiGNSS Rover-3B0A';
|
|
controller.saveGpsAddress(value);
|
|
controller.saveGpsName('TiGNSS Rover-3B0A');
|
|
}),
|
|
RadioListTile(
|
|
title: Text('TiGNSS Rover-7FEA'),
|
|
value: '10:06:1C:9C:7F:EA',
|
|
groupValue: controller.gpsAddress.value,
|
|
onChanged: (value) {
|
|
controller.gpsAddress.value = value!;
|
|
controller.gpsName.value = 'TiGNSS Rover-7FEA';
|
|
controller.saveGpsAddress(value);
|
|
controller.saveGpsName('TiGNSS Rover-7FEA');
|
|
}),
|
|
RadioListTile(
|
|
title: Text('TiGNSS Rover-A39E'),
|
|
value: '10:06:1C:97:A3:9E',
|
|
groupValue: controller.gpsAddress.value,
|
|
onChanged: (value) {
|
|
controller.gpsAddress.value = value!;
|
|
controller.gpsName.value = 'TiGNSS Rover-A39E';
|
|
controller.saveGpsAddress(value);
|
|
controller.saveGpsName('TiGNSS Rover-A39E');
|
|
}),
|
|
RadioListTile(
|
|
title: Text('TiGNSS Rover-FF4E'),
|
|
value: '98:CD:AC:62:FF:4E',
|
|
groupValue: controller.gpsAddress.value,
|
|
onChanged: (value) {
|
|
controller.gpsAddress.value = value!;
|
|
controller.gpsName.value = 'TiGNSS Rover-FF4E';
|
|
controller.saveGpsAddress(value);
|
|
controller.saveGpsName('TiGNSS Rover-FF4E');
|
|
}),
|
|
RadioListTile(
|
|
title: Text('TiGNSS Rover-8BB2'),
|
|
value: 'E8:31:CD:14:8B:B2',
|
|
groupValue: controller.gpsAddress.value,
|
|
onChanged: (value) {
|
|
controller.gpsAddress.value = value!;
|
|
controller.gpsName.value = 'TiGNSS Rover-8BB2';
|
|
controller.saveGpsAddress(value);
|
|
controller.saveGpsName('TiGNSS Rover-8BB2');
|
|
}),
|
|
RadioListTile(
|
|
title: Text('TiGNSS Rover-FF36'),
|
|
value: '98:CD:AC:62:FF:36',
|
|
groupValue: controller.gpsAddress.value,
|
|
onChanged: (value) {
|
|
controller.gpsAddress.value = value!;
|
|
controller.gpsName.value = 'TiGNSS Rover-FF36';
|
|
controller.saveGpsAddress(value);
|
|
controller.saveGpsName('TiGNSS Rover-FF36');
|
|
})
|
|
])),
|
|
const Padding(
|
|
padding: EdgeInsets.symmetric(horizontal: 20),
|
|
child: Divider(
|
|
height: 5,
|
|
),
|
|
),
|
|
// const SizedBox(height: 5),
|
|
// const Padding(
|
|
// padding: EdgeInsets.symmetric(horizontal: 40.0),
|
|
// child: Text(
|
|
// 'Bemért pont azonosítója:',
|
|
// style: TextStyle(fontSize: 14.0, fontWeight: FontWeight.w500),
|
|
// ),
|
|
// ),
|
|
// const SizedBox(height: 4),
|
|
// Padding(
|
|
// padding: const EdgeInsets.symmetric(horizontal: 40),
|
|
// child: Row(
|
|
// children: [
|
|
// Flexible(
|
|
// child: TextField(
|
|
// controller: controller.pointPrefixController,
|
|
// decoration: const InputDecoration(
|
|
// border: OutlineInputBorder(), labelText: 'Előtag'),
|
|
// ),
|
|
// ),
|
|
// const Padding(
|
|
// padding: EdgeInsets.symmetric(horizontal: 10.0),
|
|
// child: Text(
|
|
// 'Eredeti azonosító',
|
|
// style: TextStyle(fontSize: 12.0),
|
|
// ),
|
|
// ),
|
|
// Flexible(
|
|
// child: TextField(
|
|
// controller: controller.pointPostfixController,
|
|
// decoration: const InputDecoration(
|
|
// border: OutlineInputBorder(), labelText: 'Utótag'),
|
|
// ),
|
|
// ),
|
|
// ],
|
|
// ),
|
|
// ),
|
|
const SizedBox(height: 5),
|
|
const Padding(
|
|
padding: EdgeInsets.symmetric(horizontal: 20.0),
|
|
child: Text(
|
|
'Mérés iránya:',
|
|
style: TextStyle(fontSize: 14.0, fontWeight: FontWeight.w500),
|
|
),
|
|
),
|
|
Obx(
|
|
() => Column(children: [
|
|
RadioListTile<bool>(
|
|
title: Text('Növekvő'),
|
|
value: true,
|
|
groupValue: controller.pointMeasuringDirectionForward.value,
|
|
onChanged: (value) {
|
|
controller.pointMeasuringDirectionForward.value = value!;
|
|
}),
|
|
RadioListTile<bool>(
|
|
title: Text('Csökkenő'),
|
|
value: false,
|
|
groupValue: controller.pointMeasuringDirectionForward.value,
|
|
onChanged: (value) {
|
|
controller.pointMeasuringDirectionForward.value = value!;
|
|
})
|
|
]),
|
|
),
|
|
const Padding(
|
|
padding: EdgeInsets.symmetric(horizontal: 20),
|
|
child: Divider(
|
|
height: 5,
|
|
),
|
|
),
|
|
const SizedBox(height: 4),
|
|
const Padding(
|
|
padding: EdgeInsets.symmetric(horizontal: 20.0),
|
|
child: Text(
|
|
'Vibrátor:',
|
|
style: TextStyle(fontSize: 14.0, fontWeight: FontWeight.w500),
|
|
),
|
|
),
|
|
SizedBox(
|
|
height: 40,
|
|
child: TextField(
|
|
enableSuggestions: false,
|
|
autocorrect: false,
|
|
controller: controller.vehicleNumberController,
|
|
keyboardType: TextInputType.number,
|
|
inputFormatters: [FilteringTextInputFormatter.digitsOnly],
|
|
decoration: const InputDecoration(
|
|
border: OutlineInputBorder(),
|
|
labelText: 'Járműszám:',
|
|
icon: Icon(
|
|
Icons.numbers,
|
|
)),
|
|
),
|
|
),
|
|
const SizedBox(height: 5),
|
|
const Padding(
|
|
padding: EdgeInsets.symmetric(horizontal: 20.0),
|
|
child: Text(
|
|
'Ntrip szolgáltatás:',
|
|
style: TextStyle(fontSize: 14.0, fontWeight: FontWeight.w500),
|
|
),
|
|
),
|
|
const SizedBox(height: 5),
|
|
Padding(
|
|
padding: const EdgeInsets.symmetric(horizontal: 20.0),
|
|
child: Column(children: [
|
|
SizedBox(
|
|
height: 40,
|
|
child: TextField(
|
|
controller: controller.ntripUsernameController,
|
|
decoration: const InputDecoration(
|
|
border: OutlineInputBorder(),
|
|
labelText: 'Felhasználónév',
|
|
icon: Icon(Icons.account_circle_rounded)),
|
|
),
|
|
),
|
|
const SizedBox(height: 10),
|
|
SizedBox(
|
|
height: 40,
|
|
child: TextField(
|
|
obscureText: true,
|
|
enableSuggestions: false,
|
|
autocorrect: false,
|
|
controller: controller.ntripPasswordController,
|
|
decoration: const InputDecoration(
|
|
border: OutlineInputBorder(),
|
|
labelText: 'Jelszó',
|
|
icon: Icon(
|
|
Icons.lock,
|
|
)),
|
|
),
|
|
),
|
|
const SizedBox(height: 20)
|
|
]),
|
|
),
|
|
],
|
|
),
|
|
);
|
|
}
|
|
}
|