Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
M
MobileEventLog
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Data-Logistics-Support
MobileEventLog
Commits
a7d5d302
Commit
a7d5d302
authored
3 years ago
by
Maximilian Betz
Browse files
Options
Downloads
Patches
Plain Diff
add precision field
parent
428ab08b
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
lib/addevent.dart
+36
-13
36 additions, 13 deletions
lib/addevent.dart
lib/datamodel.dart
+31
-13
31 additions, 13 deletions
lib/datamodel.dart
with
67 additions
and
26 deletions
lib/addevent.dart
+
36
−
13
View file @
a7d5d302
...
...
@@ -10,7 +10,7 @@ class AddEvent extends StatefulWidget {
}
class
_AddEventPageState
extends
State
<
AddEvent
>
{
final
List
<
bool
>
_isSelected
=
[
true
];
final
List
<
bool
>
_is
GNSS
Selected
=
[
true
];
bool
servicestatus
=
false
;
bool
haspermission
=
false
;
late
LocationPermission
permission
;
...
...
@@ -18,7 +18,7 @@ class _AddEventPageState extends State<AddEvent> {
late
String
long
=
""
;
late
String
lat
=
""
;
late
String
alt
=
""
;
late
String
accuracy
=
""
;
late
double
accuracy
=
0.0
;
late
StreamSubscription
<
Position
>
positionStream
;
LocationSettings
locationSettings
=
const
LocationSettings
(
accuracy:
LocationAccuracy
.
high
,
...
...
@@ -35,7 +35,7 @@ class _AddEventPageState extends State<AddEvent> {
long
=
position
.
longitude
.
toString
();
lat
=
position
.
latitude
.
toString
();
alt
=
position
.
altitude
.
toString
();
accuracy
=
position
.
accuracy
.
toString
()
;
accuracy
=
position
.
accuracy
;
setState
(()
{
//refresh UI
...
...
@@ -49,7 +49,7 @@ class _AddEventPageState extends State<AddEvent> {
long
=
position
.
longitude
.
toString
();
lat
=
position
.
latitude
.
toString
();
alt
=
position
.
altitude
.
toString
();
accuracy
=
position
.
accuracy
.
toString
()
;
accuracy
=
position
.
accuracy
;
setState
(()
{
//refresh UI on update
...
...
@@ -125,9 +125,32 @@ class _AddEventPageState extends State<AddEvent> {
final
EventStoreInstance
storedEvents
=
EventStoreInstance
();
final
EventCurrentInstance
currentEvent
=
EventCurrentInstance
();
final
TextEditingController
_controllerLat
=
TextEditingController
(
text:
lat
);
final
TextEditingController
_controllerLong
=
TextEditingController
(
text:
long
);
final
TextEditingController
_controllerAlt
=
TextEditingController
(
text:
alt
);
final
bool
_disable_gnss_editing
=
_isGNSSSelected
[
0
];
String
_gnss_status_text
=
""
;
//print("###"+currentEvent.store.toString());
//final TextEditingController _controllerLat = TextEditingController(text: currentEvent.store.latitude);
final
TextEditingController
_controllerLat
=
TextEditingController
(
text:
"LAT123"
);
//final TextEditingController _controllerLong = TextEditingController(text: currentEvent.store.longitude);
final
TextEditingController
_controllerLong
=
TextEditingController
(
text:
"Long123"
);
//final TextEditingController _controllerAlt = TextEditingController(text: currentEvent.store.elevation);
final
TextEditingController
_controllerAlt
=
TextEditingController
(
text:
"Alt123"
);
//currentEvent.store.
if
(
true
==
_isGNSSSelected
[
0
]){
_controllerLat
.
text
=
lat
;
_controllerLong
.
text
=
long
;
_controllerAlt
.
text
=
alt
;
_gnss_status_text
=
"Precision: "
+
accuracy
.
toStringAsFixed
(
2
)
+
"m"
;
}
else
{
_gnss_status_text
=
"Off"
;
// do nothing and keep old value,
}
return
Scaffold
(
appBar:
AppBar
(
title:
const
Text
(
"Add Event"
)),
...
...
@@ -188,7 +211,7 @@ class _AddEventPageState extends State<AddEvent> {
),
TextField
(
readOnly:
true
,
enabled:
true
,
enabled:
!
_disable_gnss_editing
,
controller:
_controllerLat
,
decoration:
InputDecoration
(
labelText:
'Latitude'
,
...
...
@@ -197,7 +220,7 @@ class _AddEventPageState extends State<AddEvent> {
),
TextField
(
readOnly:
true
,
enabled:
true
,
enabled:
!
_disable_gnss_editing
,
controller:
_controllerLong
,
decoration:
InputDecoration
(
labelText:
'Longitude'
,
...
...
@@ -206,7 +229,7 @@ class _AddEventPageState extends State<AddEvent> {
),
TextField
(
readOnly:
true
,
enabled:
true
,
enabled:
!
_disable_gnss_editing
,
controller:
_controllerAlt
,
decoration:
InputDecoration
(
labelText:
'Elevation'
,
...
...
@@ -217,16 +240,16 @@ class _AddEventPageState extends State<AddEvent> {
bottomNavigationBar:
Row
(
mainAxisAlignment:
MainAxisAlignment
.
end
,
children:
[
Text
(
'No-Fix'
),
Text
(
_gnss_status_text
),
SizedBox
(
width:
50
),
ToggleButtons
(
children:
<
Widget
>[
Icon
(
Icons
.
my_location
),
],
isSelected:
_isSelected
,
isSelected:
_is
GNSS
Selected
,
onPressed:
(
int
index
)
{
setState
(()
{
_isSelected
[
index
]
=
!
_isSelected
[
index
];
_is
GNSS
Selected
[
index
]
=
!
_is
GNSS
Selected
[
index
];
});
},
),
...
...
This diff is collapsed.
Click to expand it.
lib/datamodel.dart
+
31
−
13
View file @
a7d5d302
...
...
@@ -50,28 +50,46 @@ class Event{
String
type
;
String
description
;
String
status
;
String
latitude
;
String
longitude
;
String
elevation
;
Event
(
this
.
id
,
this
.
urn
,
this
.
label
,
this
.
type
,
this
.
description
,
this
.
status
);
this
.
id
,
this
.
urn
,
this
.
label
,
this
.
type
,
this
.
description
,
this
.
status
,
[
this
.
latitude
=
""
,
this
.
longitude
=
""
,
this
.
elevation
=
""
]
);
factory
Event
.
fromJson
(
Map
<
String
,
dynamic
>
parsedJson
){
return
Event
(
parsedJson
[
'id'
]
as
int
,
parsedJson
[
'urn'
]
as
String
,
parsedJson
[
'label'
]
as
String
,
parsedJson
[
'type'
]
as
String
,
parsedJson
[
'description'
]
as
String
,
parsedJson
[
'status'
]
as
String
);
parsedJson
[
'urn'
]
as
String
,
parsedJson
[
'label'
]
as
String
,
parsedJson
[
'type'
]
as
String
,
parsedJson
[
'description'
]
as
String
,
parsedJson
[
'status'
]
as
String
,
""
,
""
,
""
,
);
}
@override
String
toString
(){
return
'{
${this.id}
,
${this.urn}
,
${this.label}
,
${this.type}
,
${this.description}
,
${this.status}
}'
;
return
'{
${this.id}
, '
'
${this.urn}
, '
'
${this.label}
, '
'
${this.type}
, '
'
${this.description}
, '
'
${this.latitude}
,'
'
${this.longitude}
,'
'
${this.elevation}
,'
'
${this.status}
}'
;
}
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment