Skip to content
Snippets Groups Projects
Commit 15be6cd1 authored by Maximilian Betz's avatar Maximilian Betz
Browse files

some progress

parent 35104c2b
No related branches found
No related tags found
No related merge requests found
......@@ -37,4 +37,15 @@ A cross plattform project for android and ios to log events offline everywhere a
## GNSS
- Checkbox on add event page which activates GNSS locationing. A field shall signal "no fix" or presision in meter.
The fields lat, long, elevation are updated automatically if checkbox is checked.
\ No newline at end of file
The fields lat, long, elevation are updated automatically if checkbox is checked.
# Input validation
a-z , A-Z , _ , 0-9 , ,(Comma) , ( , ) , + , - , . , :
-90 => Latitude <= +90
-180 => Latitude <= +180
Elevation: any numer
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'datamodel.dart';
import 'dart:async';
import 'package:geolocator/geolocator.dart';
......@@ -255,9 +256,12 @@ class _AddEventPageState extends State<AddEvent> {
const SizedBox(width: 50),
FloatingActionButton(
heroTag: null,
onPressed: _storeCurrentEvent,
onPressed: () {
_storeCurrentEvent();
HapticFeedback.vibrate();
},
tooltip: 'Add Event',
child: const Icon(Icons.add),
child: const Icon(Icons.check),
),
const SizedBox(width: 20),
],
......
......@@ -6,7 +6,7 @@ import 'datamodel.dart';
Future<Collection> fetchCollection() async {
print("Start HTTP GET++##");
debugPrint("Start HTTP GET++##");
final response = await http
.get(Uri.parse('https://sensor.awi.de/rest/sensors/collections/getCollection/22'));
......@@ -23,13 +23,12 @@ Future<Collection> fetchCollection() async {
}
Future<List<Collection>> fetchCollections() async {
print("Fetching Collections...");
debugPrint("Fetching Collections...");
List<Collection> collectionList = [];
final response = await http
.get(Uri.parse('https://sensor.awi.de/rest/sensors/collections/getAllCollections?pointInTime=2018-07-03T12%3A30%3A55.389Z'));
if (response.statusCode == 200) {
List<Collection> collectionList;
return (json.decode(response.body) as List)
.map((i) => Collection.fromJson(i))
.toList();
......@@ -37,12 +36,16 @@ Future<List<Collection>> fetchCollections() async {
} else {
// If the server did not return a 200 OK response,
// then throw an exception.
throw Exception('Failed to load Collection');
//throw Exception('Failed to load Collection');
debugPrint('Failed to load Collection');
return collectionList;
}
}
class Configuration extends StatefulWidget {
const Configuration({Key? key}) : super(key: key);
@override
State<Configuration> createState() => _MyHomePageState();
}
......@@ -57,7 +60,6 @@ class _MyHomePageState extends State<Configuration> {
super.initState();
futureCollection = fetchCollection();
futureCollections = fetchCollections();
}
late Future<String> eventTypes;
......@@ -69,7 +71,7 @@ class _MyHomePageState extends State<Configuration> {
return Scaffold(
appBar: AppBar(
title: Text('Configuration'),
title: const Text('Configuration'),
),
body: Center(
child: Column(
......@@ -80,12 +82,11 @@ class _MyHomePageState extends State<Configuration> {
builder: (context, snapshot){
if (snapshot.hasData)
{
print(snapshot.data);
debugPrint('Got collections:');
snapshot.data?.forEach((element) {
debugPrint(element.id.toString() + ' ' + element.toString() + ' #' + element.description.toString());
});
print(futureCollections);
//storedCollections.store = snapshot.data!; // Store data locally
//var listlen = storedCollections.store.length();
//print('Length ###: ' + storedCollections.store.length().toString());
return DropdownButtonFormField(
value: currentCollection.store.collectionName,
......@@ -105,7 +106,7 @@ class _MyHomePageState extends State<Configuration> {
);
}
else{
return CircularProgressIndicator();
return const CircularProgressIndicator();
}
}
),
......@@ -117,7 +118,7 @@ class _MyHomePageState extends State<Configuration> {
return Text(snapshot.data!.collectionName);
}
else{
return CircularProgressIndicator();
return const CircularProgressIndicator();
}
}
),
......
......@@ -3,6 +3,8 @@ import 'package:flutter/material.dart';
import 'datamodel.dart';
class ViewEvents extends StatelessWidget {
const ViewEvents({Key? key}) : super(key: key);
@override
Widget build(BuildContext context) {
// Get singleton to access locally stored events:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment