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
d3525993
Commit
d3525993
authored
2 years ago
by
Maximilian Betz
Browse files
Options
Downloads
Patches
Plain Diff
simplified textfields and enabled editing in all modes
parent
e0541d00
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
sw/lib/addeventkottaspegel.dart
+54
-104
54 additions, 104 deletions
sw/lib/addeventkottaspegel.dart
with
54 additions
and
104 deletions
sw/lib/addeventkottaspegel.dart
+
54
−
104
View file @
d3525993
...
...
@@ -57,6 +57,9 @@ class _AddEventKottasPegelPageState extends State<AddEventKottasPegel> {
TextEditingController
labelEditingController
=
TextEditingController
();
TextEditingController
oldLengthEditingController
=
TextEditingController
();
TextEditingController
newLengthEditingController
=
TextEditingController
();
Future
startRest
()
async
{
final
ConfigurationStoreInstance
configuration
=
ConfigurationStoreInstance
();
final
EventStoreInstance
event
=
EventStoreInstance
();
...
...
@@ -187,9 +190,12 @@ class _AddEventKottasPegelPageState extends State<AddEventKottasPegel> {
//Update current event with prefix and cnt
event
.
currentEvent
.
label
=
configuration
.
labelConfig
.
prefix
+
configuration
.
labelConfig
.
cnt
.
toString
()
.
padLeft
(
3
,
'0'
);
labelEditingController
.
text
=
event
.
currentEvent
.
label
;
angleStatus
=
angleStatusItems
[
0
];
oldLengthEditingController
.
text
=
lengthOld
.
toString
();
newLengthEditingController
.
text
=
lengthNew
.
toString
();
super
.
initState
();
}
...
...
@@ -376,6 +382,15 @@ class _AddEventKottasPegelPageState extends State<AddEventKottasPegel> {
);
}
void
_resetSelectedFields
(){
measurementStatusId
=
-
1
;
rodColorValuesIdOld
=
-
1
;
rodColorValuesIdNew
=
-
1
;
angleStatus
=
angleStatusItems
[
0
];
lengthOld
=
0
;
lengthNew
=
0
;
}
Future
<
void
>
_storeCurrentMeasurementEvent
(
BuildContext
context
,
bool
addAngle
,
bool
addOldLength
,
bool
addNewLength
)
async
{
final
EventStoreInstance
event
=
EventStoreInstance
();
...
...
@@ -428,12 +443,7 @@ class _AddEventKottasPegelPageState extends State<AddEventKottasPegel> {
event
.
currentEvent
.
endDate
=
isoDate
;
// Reset fields for next event
measurementStatusId
=
-
1
;
rodColorValuesIdOld
=
-
1
;
rodColorValuesIdNew
=
-
1
;
angleStatus
=
angleStatusItems
[
0
];
lengthOld
=
0
;
lengthNew
=
0
;
_resetSelectedFields
();
await
event
.
storeToSharedPrefs
();
...
...
@@ -555,18 +565,22 @@ class _AddEventKottasPegelPageState extends State<AddEventKottasPegel> {
),
),
const
SizedBox
(
height:
15.0
),
TextFormField
(
readOnly:
false
,
enabled:
false
,
style:
const
TextStyle
(
fontSize:
30.0
),
keyboardType:
TextInputType
.
number
,
autovalidateMode:
AutovalidateMode
.
onUserInteraction
,
controller:
TextEditingController
(
text:
"Length:
${rawMeasurementValue.toString()}
[mm]"
),
decoration:
const
InputDecoration
(
labelText:
''
,
//Example
border:
OutlineInputBorder
(),
Visibility
(
visible:
event
.
gnssSync
,
child:
TextFormField
(
readOnly:
false
,
enabled:
false
,
style:
const
TextStyle
(
fontSize:
30.0
),
keyboardType:
TextInputType
.
number
,
autovalidateMode:
AutovalidateMode
.
onUserInteraction
,
controller:
TextEditingController
(
text:
"Length:
${rawMeasurementValue.toString()}
[mm]"
),
decoration:
const
InputDecoration
(
labelText:
''
,
//Example
border:
OutlineInputBorder
(),
),
),
),
const
SizedBox
(
height:
15.0
),
...
...
@@ -642,7 +656,7 @@ class _AddEventKottasPegelPageState extends State<AddEventKottasPegel> {
),
]
),
const
SizedBox
(
height:
15
.0
),
const
SizedBox
(
height:
30
.0
),
Visibility
(
visible:
displayAngle
,
child:
...
...
@@ -652,7 +666,7 @@ class _AddEventKottasPegelPageState extends State<AddEventKottasPegel> {
isExpanded:
true
,
decoration:
const
InputDecoration
(
border:
OutlineInputBorder
(),
labelText:
'
A
ngle'
,
labelText:
'
old a
ngle'
,
),
items:
angleStatusItems
.
map
((
String
angle
)
{
...
...
@@ -670,61 +684,23 @@ class _AddEventKottasPegelPageState extends State<AddEventKottasPegel> {
const
SizedBox
(
height:
15.0
),
Visibility
(
visible:
displayOldLength
,
child:
event
.
gnssSync
?
TextFormField
(
readOnly:
false
,
enabled:
true
,
keyboardType:
TextInputType
.
number
,
autovalidateMode:
AutovalidateMode
.
onUserInteraction
,
inputFormatters:
[
FilteringTextInputFormatter
.
allow
(
RegExp
(
"[0-9]"
))],
controller:
TextEditingController
(
text:
lengthOld
.
toString
(),
),
decoration:
const
InputDecoration
(
labelText:
'old length'
,
//Example
border:
OutlineInputBorder
(),
),
validator:
(
value
)
{
if
(
value
==
""
)
{
return
null
;
// Empty value is allowed
}
final
number
=
num
.
tryParse
(
value
!
);
if
(
number
!=
null
){
return
null
;
// Elevation valid
}
return
"Only numerical values [mm]"
;
},
)
:
child:
TextFormField
(
readOnly:
false
,
enabled:
true
,
keyboardType:
TextInputType
.
number
,
autovalidateMode:
AutovalidateMode
.
onUserInteraction
,
inputFormatters:
[
FilteringTextInputFormatter
.
allow
(
RegExp
(
"[0-9]"
))],
initialValue:
lengthOld
.
toString
()
,
controller:
oldLengthEditingController
,
decoration:
const
InputDecoration
(
labelText:
'old length'
,
//Example
border:
OutlineInputBorder
(),
),
onChanged:
(
value
)
{
lengthOld
=
int
.
parse
(
value
);
setState
(()
{});
},
onFieldSubmitted:
(
value
){
if
(
!
event
.
gnssSync
)
{
setState
(()
{});
}
},
validator:
(
value
)
{
if
(
value
==
""
)
{
return
null
;
// Empty value is allowed
}
final
number
=
num
.
tryParse
(
value
!
);
if
(
number
!=
null
){
return
null
;
// Elevation valid
}
return
"Only numerical values [mm]"
;
},
)
,
),
),
const
SizedBox
(
height:
5.0
),
Visibility
(
...
...
@@ -794,6 +770,7 @@ class _AddEventKottasPegelPageState extends State<AddEventKottasPegel> {
),
onPressed:
()
{
lengthOld
=
rawMeasurementValue
+
0
;
oldLengthEditingController
.
text
=
lengthOld
.
toString
();
setState
(()
{});
},
child:
const
Text
(
'+0m'
),
...
...
@@ -805,6 +782,7 @@ class _AddEventKottasPegelPageState extends State<AddEventKottasPegel> {
),
onPressed:
()
{
lengthOld
=
rawMeasurementValue
+
2000
;
//2m offset
oldLengthEditingController
.
text
=
lengthOld
.
toString
();
setState
(()
{});
},
child:
const
Text
(
'+2m'
),
...
...
@@ -813,61 +791,31 @@ class _AddEventKottasPegelPageState extends State<AddEventKottasPegel> {
),
),
const
SizedBox
(
height:
30.0
),
Visibility
(
visible:
displayNewLength
,
child:
event
.
gnssSync
?
child:
TextFormField
(
readOnly:
false
,
enabled:
true
,
keyboardType:
TextInputType
.
number
,
autovalidateMode:
AutovalidateMode
.
onUserInteraction
,
inputFormatters:
[
FilteringTextInputFormatter
.
allow
(
RegExp
(
"[0-9]"
))],
controller:
TextEditingController
(
text:
lengthNew
.
toString
()
),
controller:
newLengthEditingController
,
decoration:
const
InputDecoration
(
labelText:
'new length'
,
//Example
border:
OutlineInputBorder
(),
),
onChanged:
(
value
)
{
lengthNew
=
int
.
parse
(
value
);
},
onFieldSubmitted:
(
value
){
if
(
!
event
.
gnssSync
)
{
setState
(()
{});
}
},
validator:
(
value
)
{
if
(
value
==
""
)
{
return
null
;
// Empty value is allowed
}
final
number
=
num
.
tryParse
(
value
!
);
if
(
number
!=
null
){
return
null
;
// Elevation valid
}
return
"Only numerical values for elevation in [m]"
;
},
)
:
TextFormField
(
readOnly:
false
,
enabled:
true
,
keyboardType:
TextInputType
.
number
,
autovalidateMode:
AutovalidateMode
.
onUserInteraction
,
inputFormatters:
[
FilteringTextInputFormatter
.
allow
(
RegExp
(
"[0-9]"
))],
initialValue:
lengthNew
.
toString
(),
decoration:
const
InputDecoration
(
labelText:
'new length'
,
//Example
border:
OutlineInputBorder
(),
),
validator:
(
value
)
{
if
(
value
==
""
)
{
return
null
;
// Empty value is allowed
}
final
number
=
num
.
tryParse
(
value
!
);
if
(
number
!=
null
){
return
null
;
// Elevation valid
}
return
"Only numerical values for elevation in [m]"
;
setState
(()
{});
},
),
),
...
...
@@ -939,6 +887,7 @@ class _AddEventKottasPegelPageState extends State<AddEventKottasPegel> {
),
onPressed:
()
{
lengthNew
=
rawMeasurementValue
+
0
;
newLengthEditingController
.
text
=
lengthOld
.
toString
();
setState
(()
{});
},
child:
const
Text
(
'+0m'
),
...
...
@@ -950,6 +899,7 @@ class _AddEventKottasPegelPageState extends State<AddEventKottasPegel> {
),
onPressed:
()
{
lengthNew
=
rawMeasurementValue
+
2000
;
//2m offset
newLengthEditingController
.
text
=
lengthOld
.
toString
();
setState
(()
{});
},
child:
const
Text
(
'+2m'
),
...
...
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