Skip to content

Commit 57887b6

Browse files
fix: move update checker to TodayPage's initState for better update management
1 parent eb580a5 commit 57887b6

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

lib/presentation/app.dart

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ import 'package:whph/presentation/features/calendar/pages/today_page.dart';
77
import 'package:whph/presentation/features/habits/pages/habits_page.dart';
88
import 'package:whph/presentation/features/shared/components/responsive_scaffold_layout.dart';
99
import 'package:whph/presentation/features/shared/constants/app_theme.dart';
10-
import 'package:whph/presentation/features/shared/utils/update_checker.dart';
1110
import 'package:whph/presentation/features/sync/pages/sync_devices_page.dart';
1211

1312
import 'package:whph/presentation/features/tags/pages/tags_page.dart';
@@ -18,8 +17,6 @@ class App extends StatelessWidget {
1817

1918
@override
2019
Widget build(BuildContext context) {
21-
UpdateChecker.checkForUpdates(context);
22-
2320
final topNavItems = [
2421
NavItem(title: 'Today', icon: Icons.today, route: TodayPage.route),
2522
NavItem(title: 'Tasks', icon: Icons.check_circle, route: TasksPage.route),

lib/presentation/features/calendar/pages/today_page.dart

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import 'package:whph/presentation/features/habits/pages/habit_details_page.dart'
66
import 'package:whph/presentation/features/shared/components/done_overlay.dart';
77
import 'package:whph/presentation/features/shared/components/secondary_app_bar.dart';
88
import 'package:whph/presentation/features/shared/utils/error_helper.dart';
9+
import 'package:whph/presentation/features/shared/utils/update_checker.dart';
910
import 'package:whph/presentation/features/tags/components/tag_select_dropdown.dart';
1011
import 'package:whph/presentation/features/tags/components/tag_time_chart.dart';
1112
import 'package:whph/presentation/features/tasks/components/tasks_list.dart';
@@ -31,6 +32,12 @@ class _TodayPageState extends State<TodayPage> {
3132

3233
List<String>? _selectedTagFilter;
3334

35+
@override
36+
void initState() {
37+
super.initState();
38+
UpdateChecker.checkForUpdates(context);
39+
}
40+
3441
Future<void> _openTaskDetails(BuildContext context, String taskId) async {
3542
await Navigator.push(
3643
context,

0 commit comments

Comments
 (0)