MobilApp/lib/pages/rtcm_test/presentation/views/rtcm_test_view.dart

121 lines
5.5 KiB
Dart

import 'dart:math';
import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:terepi_seged/pages/rtcm_test/presentation/controllers/rtcm_test_controller.dart';
class RtcmTestView extends GetView<RtcmTestController> {
const RtcmTestView({Key? key}) : super(key: key);
@override
Widget build(BuildContext context) {
return Container(
color: Colors.white,
child: Scaffold(
extendBody: true,
backgroundColor: Colors.black.withOpacity(0.05),
appBar: AppBar(
elevation: 0.0,
title: const Text('RtcmTest'),
leading: IconButton(
icon: const Icon(Icons.arrow_back_ios),
color: Colors.white,
onPressed: () {
Get.back();
},
),
),
body: Column(
children: [
const Center(
child: Text("RTCM teszt view"),
),
ListTile(
title: Text(controller.gpsName),
subtitle: Obx(() => controller.gpsIsConnected.value
? const Text("Connected",
style: TextStyle(color: Colors.green))
: const Text(
"Disconnected",
style: TextStyle(color: Colors.red),
)),
trailing: Obx(() => ElevatedButton(
child: Text(controller.gpsIsConnected.value
? "Disconnect"
: "Connect"),
onPressed: () {
if (controller.gpsIsConnected.value) {
controller.disconnectFromGps();
} else {
controller.connectToGps();
}
},
)),
),
ListTile(
title: const Text("NTRIP Server (KOVARIK)"),
subtitle: Obx(() => controller.ntripIsConnected.value
? const Text("Connected",
style: TextStyle(color: Colors.green))
: const Text(
"Disconnected",
style: TextStyle(color: Colors.red),
)),
trailing: Obx(() => ElevatedButton(
child: Text(controller.ntripIsConnected.value
? "Disconnect"
: "Connect"),
onPressed: () {
if (controller.ntripIsConnected.value) {
controller.disconnectFromNtripServer();
} else {
controller.connectToNtripServer();
}
},
)),
),
Padding(
padding: const EdgeInsets.only(top: 10),
child: Center(
child: Obx(() => Text(
"Received ${controller.gpsReceivedData} byte(s) from GNSS device")))),
Padding(
padding: const EdgeInsets.only(top: 10),
child: Center(
child: Obx(() => Text(
"Received ${controller.ntripReceivedData} byte(s) from ntrip server ${controller.ntripDataPacketNumbers}")))),
Padding(
padding: const EdgeInsets.only(top: 10),
child: Center(
child: Obx(() => Text(
"GPS quality -> ${controller.getGpsQualityIndicator(quality: controller.gpsQuality.value)} ")))),
Padding(
padding: const EdgeInsets.only(top: 10),
child: Center(
child: Obx(() => Text(
"GpsDateTime -> ${controller.gpsDateTime} (UTC)")))),
Padding(
padding: const EdgeInsets.only(top: 10),
child: Center(
child: Obx(() => Text(
'Lat: ${controller.latDegree.value}°${controller.latMin.value.toString().padLeft(2, '0')}\'${controller.formatWgs84Sec.format(controller.latSec.value)}" - Long: ${controller.longDegree.value}°${controller.longMin.value.toString().padLeft(2, '0')}\'${controller.formatWgs84Sec.format(controller.longSec.value)}"')))),
Padding(
padding: const EdgeInsets.only(top: 10),
child: Center(
child: Obx(() => Text(
"EovX: ${controller.formatEov.format(controller.eov.value.Y)} - EovY: ${controller.formatEov.format(controller.eov.value.X)}")))),
Padding(
padding: const EdgeInsets.only(top: 10),
child: Center(
child: Obx(() => Text(
"Altitude -> ${controller.gpsAltitude} (m)")))),
Padding(
padding: const EdgeInsets.only(top: 10),
child: Center(
child: Obx(() => Text(
"Hor. error: ${max(controller.gpsLatitudeError.value, controller.gpsLongitudeError.value)} (m) - Vert. error: ${controller.gpsAltitudeError} (m)"))))
],
)));
}
}