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

moved gnss enable switch back to app bar

parent 5af94a04
No related branches found
No related tags found
No related merge requests found
......@@ -236,7 +236,7 @@ class _AddEventPageState extends State<AddEvent> {
}
_overlayCloseTimer = Timer(
const Duration(seconds: 5),
const Duration(seconds: 3),
() {
try {
_overlayEntry.remove(); // Allow only one Overlay Popup. NOTE: Is this a quick an dirty or a proper solution?
......@@ -274,6 +274,7 @@ class _AddEventPageState extends State<AddEvent> {
final EventStoreInstance eventStore = EventStoreInstance();
final ConfigurationStoreInstance configuration = ConfigurationStoreInstance();
String gnssStatusText = "";
String gnssStatusTextLine2 = "";
if (true == eventStore.gnssSync){
// Update current event coordinates from GNSS stream
......@@ -287,19 +288,43 @@ class _AddEventPageState extends State<AddEvent> {
eventStore.currentEvent.endDate = isoDate;
if(accuracy == 0.0){
gnssStatusText = "No-Fix";
gnssStatusText = "GNSS On";
gnssStatusTextLine2 = "No-Fix";
}
else{
gnssStatusText = "Precision "+ accuracy.toStringAsFixed(1) +"m";
gnssStatusText = "GNSS On";
gnssStatusTextLine2 = "Precision "+ accuracy.toStringAsFixed(1) +"m";
}
}
else{
gnssStatusText = "Disabled"; // Just display existing event coordinates
gnssStatusText = "GNSS Off"; // Just display existing event coordinates
gnssStatusTextLine2 = "";
}
if (configuration.initialized == true) {
return Scaffold(
appBar: AppBar(title: const Text("Add Event")),
appBar: AppBar(
title: const Text("Add Event"),
actions: <Widget>[
Column(
children: [
Text(gnssStatusText, style: const TextStyle(fontStyle: FontStyle.italic)),
Text(gnssStatusTextLine2, style: const TextStyle(fontStyle: FontStyle.italic)),
],
),
Switch( //Enable showing all or only pending events. Default is to show only pending events
value: eventStore.gnssSync,
onChanged: (value) {
eventStore.gnssSync = value;
debugPrint('Switched to:' + eventStore.gnssSync.toString());
setState(() {
//refresh the UI
});
}),
],
)
,
body: SingleChildScrollView(
child: Container(
margin: const EdgeInsets.symmetric(horizontal: 5.0),
......@@ -307,26 +332,6 @@ class _AddEventPageState extends State<AddEvent> {
Column(
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
children: <Widget>[
const SizedBox(height: 5.0),
Row(
mainAxisAlignment: MainAxisAlignment.end,
children: [
const Text('Coordinate via GNSS: '),
Text(gnssStatusText),
//Text(gnssStatusText),
const SizedBox(width: 10),
Switch(
value: eventStore.gnssSync,
onChanged: (value) {
eventStore.gnssSync = value;
debugPrint('Switched to:' + eventStore.gnssSync.toString());
setState(() {
//refresh the UI
});
},
),
],
),
const SizedBox(height: 10.0),
TextFormField(
initialValue: eventStore.currentEvent.label,
......
......@@ -246,7 +246,7 @@ class _ViewEvents extends State<ViewEvents> {
DataCell(
TextFormField(
readOnly: true,
initialValue: event.elevation == '' ? '' : double.parse(event.elevation).toStringAsFixed(2), //TODO: show only 2 digits after decimal point. toStringAsFixed(1),
initialValue: event.elevation == '' ? '' : double.parse(event.elevation).toStringAsFixed(2),
onFieldSubmitted: (val) {
event.elevation = val; //Update Database
},
......
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