fix: show -- instead of 0.0 when speed is 0 or null
This commit is contained in:
parent
27d2841081
commit
1319167165
1 changed files with 2 additions and 2 deletions
|
|
@ -59,7 +59,7 @@ class _MainScreenState extends State<MainScreen> with TickerProviderStateMixin {
|
|||
_lastLon = lon.toStringAsFixed(5);
|
||||
}
|
||||
final speed = status?['lastSpeed'];
|
||||
if (speed != null) {
|
||||
if (speed != null && speed > 0) {
|
||||
_lastSpeed = (speed * 3.6).toStringAsFixed(1);
|
||||
}
|
||||
final timestamp = status?['lastTimestamp'];
|
||||
|
|
@ -76,7 +76,7 @@ class _MainScreenState extends State<MainScreen> with TickerProviderStateMixin {
|
|||
setState(() {
|
||||
_lastLat = location['latitude']?.toStringAsFixed(5) ?? '--';
|
||||
_lastLon = location['longitude']?.toStringAsFixed(5) ?? '--';
|
||||
_lastSpeed = location['speed'] != null
|
||||
_lastSpeed = location['speed'] != null && location['speed'] > 0
|
||||
? (location['speed'] * 3.6).toStringAsFixed(1)
|
||||
: '--';
|
||||
_lastTime = location['timestamp'] != null && location['timestamp'] > 0
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue