Move periodic Screen update to App level.

This commit is contained in:
Elias Müller 2023-02-22 12:20:08 +01:00
parent 2c818efce6
commit 2ba2fb9090
2 changed files with 10 additions and 3 deletions

View File

@ -1,4 +1,6 @@
import 'dart:async';
import 'package:flutter/material.dart';
import 'package:marianum_mobile/screen/pages/timetable/timetable.dart';
import 'package:provider/provider.dart';
@ -19,6 +21,14 @@ class App extends StatefulWidget {
class _AppState extends State<App> {
int currentPage = 0;
@override
void initState() {
Timer.periodic(const Duration(seconds: 30), (Timer t) => {
setState((){}),
});
super.initState();
}
@override
Widget build(BuildContext context) {
final PageController pageController = PageController();

View File

@ -24,9 +24,6 @@ class _ChatListState extends State<ChatList> {
void initState() {
super.initState();
Timer.periodic(const Duration(seconds: 30), (Timer t) => {
setState((){}),
});
Timer.periodic(const Duration(minutes: 1), (timer) {
Provider.of<ChatListProps>(context, listen: false).run();
});