nice
This commit is contained in:
@@ -248,27 +248,40 @@ class _SpeedometerState extends State<Speedometer> {
|
||||
|
||||
}
|
||||
|
||||
Timer? reloadTimer;
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
// TODO: implement initState
|
||||
super.initState();
|
||||
|
||||
Timer.periodic(Duration(milliseconds: 250), (timer) {
|
||||
reloadTimer = Timer.periodic(Duration(milliseconds: 250), (timer) {
|
||||
|
||||
Position? newPosition = LiveInformation().trackerModule.position;
|
||||
try {
|
||||
Position? newPosition = LiveInformation().trackerModule.position;
|
||||
|
||||
speed = newPosition?.speed ?? 0;
|
||||
speed = newPosition?.speed ?? 0;
|
||||
|
||||
arrivalTime -= 0.25;
|
||||
arrivalTime = arrivalTime < 0 ? 0 : arrivalTime;
|
||||
arrivalTime -= 0.25;
|
||||
arrivalTime = arrivalTime < 0 ? 0 : arrivalTime;
|
||||
|
||||
setState(() {
|
||||
setState(() {
|
||||
|
||||
});
|
||||
});
|
||||
} catch (e) {
|
||||
// print(e);
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
@override
|
||||
void dispose() {
|
||||
// TODO: implement dispose
|
||||
super.dispose();
|
||||
reloadTimer?.cancel();
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
// TODO: implement build
|
||||
|
||||
Reference in New Issue
Block a user