Add view to show measured point in a list
This commit is contained in:
parent
057f4a4809
commit
1293176f89
@ -29,6 +29,7 @@ import 'package:terepi_seged/models/point_to_measure.dart';
|
|||||||
import 'package:terepi_seged/models/point_with_description_model.dart';
|
import 'package:terepi_seged/models/point_with_description_model.dart';
|
||||||
import 'package:proj4dart/proj4dart.dart' as proj4;
|
import 'package:proj4dart/proj4dart.dart' as proj4;
|
||||||
import 'package:shared_preferences/shared_preferences.dart';
|
import 'package:shared_preferences/shared_preferences.dart';
|
||||||
|
import 'package:terepi_seged/pages/map_survey/presentations/views/measured_points_table_dialog.dart';
|
||||||
|
|
||||||
class MapSurveyController extends GetxController {
|
class MapSurveyController extends GetxController {
|
||||||
// String gpsAddress = "E8:31:CD:14:8B:B2";
|
// String gpsAddress = "E8:31:CD:14:8B:B2";
|
||||||
@ -59,6 +60,8 @@ class MapSurveyController extends GetxController {
|
|||||||
DateTime.now().add(const Duration(seconds: -30));
|
DateTime.now().add(const Duration(seconds: -30));
|
||||||
|
|
||||||
NumberFormat formatEov = NumberFormat("##0,000.0", "hu-HU");
|
NumberFormat formatEov = NumberFormat("##0,000.0", "hu-HU");
|
||||||
|
NumberFormat formatEovZ = NumberFormat("###0.0", "hu-HU");
|
||||||
|
NumberFormat formatAltitudeError = NumberFormat("####0.000", "hu-HU");
|
||||||
NumberFormat formatEovForFile = NumberFormat("#####0.0", "hu-HU");
|
NumberFormat formatEovForFile = NumberFormat("#####0.0", "hu-HU");
|
||||||
NumberFormat formatWgs84Sec = NumberFormat('00.000', 'hu-HU');
|
NumberFormat formatWgs84Sec = NumberFormat('00.000', 'hu-HU');
|
||||||
|
|
||||||
@ -111,6 +114,8 @@ class MapSurveyController extends GetxController {
|
|||||||
Rx<bool> isShowPassword = false.obs;
|
Rx<bool> isShowPassword = false.obs;
|
||||||
final passwordFieldFocusNode = FocusNode();
|
final passwordFieldFocusNode = FocusNode();
|
||||||
|
|
||||||
|
List? measuredPoints;
|
||||||
|
|
||||||
List<PointWithDescription> pointWithDescriptionList = [];
|
List<PointWithDescription> pointWithDescriptionList = [];
|
||||||
late Directory? directory;
|
late Directory? directory;
|
||||||
late File dataFile;
|
late File dataFile;
|
||||||
@ -786,7 +791,9 @@ class MapSurveyController extends GetxController {
|
|||||||
'horizontalError':
|
'horizontalError':
|
||||||
max(gpsLatitudeError.value, gpsLongitudeError.value),
|
max(gpsLatitudeError.value, gpsLongitudeError.value),
|
||||||
'verticalError': gpsAltitudeError.value,
|
'verticalError': gpsAltitudeError.value,
|
||||||
'description': pointDescriptionController.text
|
'description': pointDescriptionController.text,
|
||||||
|
'isDeleted': false,
|
||||||
|
'projectId': 2
|
||||||
});
|
});
|
||||||
|
|
||||||
await Supabase.instance.client
|
await Supabase.instance.client
|
||||||
@ -850,4 +857,20 @@ class MapSurveyController extends GetxController {
|
|||||||
if (passwordFieldFocusNode.hasPrimaryFocus) return;
|
if (passwordFieldFocusNode.hasPrimaryFocus) return;
|
||||||
passwordFieldFocusNode.canRequestFocus = false;
|
passwordFieldFocusNode.canRequestFocus = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void showMeasuredPointsTableDialog() {
|
||||||
|
Get.to(() => MeasuredPointsTableDialog(), transition: Transition.fadeIn);
|
||||||
|
}
|
||||||
|
|
||||||
|
Future<List> readMeasuredPoints() async {
|
||||||
|
var response = await Supabase.instance.client
|
||||||
|
.from('TerepiSeged_MeasuredPoints')
|
||||||
|
.select()
|
||||||
|
.eq('projectId', 2)
|
||||||
|
.order('created_at');
|
||||||
|
|
||||||
|
print(response);
|
||||||
|
|
||||||
|
return response;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -410,14 +410,7 @@ class MapSurveyView extends GetView<MapSurveyController> {
|
|||||||
FloatingActionButton(
|
FloatingActionButton(
|
||||||
onPressed: () {
|
onPressed: () {
|
||||||
// controller.isMapMoveToCenter();
|
// controller.isMapMoveToCenter();
|
||||||
// controller.addMeasuredPoint();
|
controller.showMeasuredPointsTableDialog();
|
||||||
ScaffoldMessenger.of(context).showSnackBar(const SnackBar(
|
|
||||||
content: Text(
|
|
||||||
"Fejlesztlés alatt",
|
|
||||||
style: TextStyle(fontWeight: FontWeight.bold),
|
|
||||||
),
|
|
||||||
backgroundColor: Colors.black54,
|
|
||||||
));
|
|
||||||
},
|
},
|
||||||
heroTag: 'Database test',
|
heroTag: 'Database test',
|
||||||
tooltip: 'Pont bemérése',
|
tooltip: 'Pont bemérése',
|
||||||
|
|||||||
@ -0,0 +1,114 @@
|
|||||||
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:get/get.dart';
|
||||||
|
import 'package:terepi_seged/pages/map_survey/presentations/controllers/map_survey_controller.dart';
|
||||||
|
|
||||||
|
class MeasuredPointsTableDialog extends StatelessWidget {
|
||||||
|
final controller = Get.find<MapSurveyController>();
|
||||||
|
MeasuredPointsTableDialog({super.key});
|
||||||
|
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
return Scaffold(
|
||||||
|
body: Padding(
|
||||||
|
padding: const EdgeInsets.only(top: 20.0),
|
||||||
|
child: Column(
|
||||||
|
children: [
|
||||||
|
Padding(
|
||||||
|
padding: const EdgeInsets.all(8.0),
|
||||||
|
child: Row(
|
||||||
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||||
|
children: [
|
||||||
|
IconButton(
|
||||||
|
onPressed: () {
|
||||||
|
Get.back();
|
||||||
|
},
|
||||||
|
icon: const Icon(Icons.close)),
|
||||||
|
TextButton(
|
||||||
|
style: ButtonStyle(
|
||||||
|
overlayColor:
|
||||||
|
MaterialStateProperty.all(Colors.transparent)),
|
||||||
|
onPressed: () {
|
||||||
|
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(
|
||||||
|
'Bemért pontok',
|
||||||
|
style: TextStyle(fontSize: 20.0, fontWeight: FontWeight.bold),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
const SizedBox(height: 5),
|
||||||
|
Expanded(
|
||||||
|
child: FutureBuilder<List<dynamic>>(
|
||||||
|
future: controller.readMeasuredPoints(),
|
||||||
|
builder: (context, snapshot) {
|
||||||
|
if (snapshot.connectionState == ConnectionState.waiting) {
|
||||||
|
return Center(child: CircularProgressIndicator());
|
||||||
|
}
|
||||||
|
|
||||||
|
if (snapshot.hasError) {
|
||||||
|
return Center(
|
||||||
|
child: Text(
|
||||||
|
snapshot.error.toString(),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
if (!snapshot.hasData) {
|
||||||
|
return const Center(
|
||||||
|
child: Text("No Data available.\n Create new Data"));
|
||||||
|
}
|
||||||
|
// print(snapshot.data);
|
||||||
|
// return const Center(child: Text("Data available."));
|
||||||
|
return ListView.builder(
|
||||||
|
itemCount: snapshot.data!.length,
|
||||||
|
shrinkWrap: true,
|
||||||
|
itemBuilder: (context, int index) {
|
||||||
|
var data = snapshot.data![index];
|
||||||
|
print("snapshot data:");
|
||||||
|
print(data);
|
||||||
|
return ListTile(
|
||||||
|
leading: CircleAvatar(
|
||||||
|
backgroundColor: const Color(0xff764abc),
|
||||||
|
child: Text((index + 1).toString())),
|
||||||
|
title: Text(data['pointNumber'].toString(),
|
||||||
|
style: TextStyle(fontWeight: FontWeight.bold)),
|
||||||
|
subtitle: Column(
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
|
children: [
|
||||||
|
Text(data['description'],
|
||||||
|
style: TextStyle(
|
||||||
|
fontStyle: FontStyle.italic,
|
||||||
|
color: Colors.grey.shade700)),
|
||||||
|
Text(
|
||||||
|
"EovX: ${controller.formatEov.format(data['eovY'])} - EovY: ${controller.formatEov.format(data['eovX'])}",
|
||||||
|
style: TextStyle(
|
||||||
|
fontStyle: FontStyle.italic,
|
||||||
|
color: Colors.grey.shade400)),
|
||||||
|
Text(
|
||||||
|
"EovZ: ${controller.formatEovZ.format(data['altitude'] - data['poleHeight'])} (m)",
|
||||||
|
style: TextStyle(
|
||||||
|
fontStyle: FontStyle.italic,
|
||||||
|
color: Colors.grey.shade400)),
|
||||||
|
Text(
|
||||||
|
"H.hiba: ${controller.formatAltitudeError.format(data['horizontalError'])} (m) - V.hiba: ${controller.formatAltitudeError.format(data['verticalError'])} (m)",
|
||||||
|
style: TextStyle(
|
||||||
|
fontStyle: FontStyle.italic,
|
||||||
|
color: Colors.grey.shade400)),
|
||||||
|
],
|
||||||
|
));
|
||||||
|
});
|
||||||
|
},
|
||||||
|
),
|
||||||
|
)
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
Loading…
Reference in New Issue
Block a user